示例#1
0
void CanPump::_send_next_frames()
{
    for(size_t i=0; i < _channels.size(); ++i)
    {
        ChannelHandle& handle = _channels[i];
        if(handle.request_frames.size() > 0)
        {
            _send_frame(handle.request_frames.back(), i);
            handle.request_frames.pop_back();
        }
        else if(handle.command_frames.size() > 0)
        {
            _send_frame(handle.command_frames.back(), i);
            handle.command_frames.pop_back();
        }
    }
}
示例#2
0
void _send_ack( Hubyte *target )
{
    Huint   ack;
    Huint   frame[8];

    ack = htonl( 0xDEADBEEF );
    _setup_frame( (Hubyte*)frame, target, (Hubyte*)&ack, sizeof(ack) );
    _send_frame( (Hubyte*)frame, ETH_HDR_SIZE + sizeof(ack) );
}
示例#3
0
void eth_send_ackless( Hubyte *target, Hubyte *data, Huint size )
{
    Huint   i;
    Hushort len;

    i = 0;
    while( i < size )
    {
        if( size - i > ETH_MTU_SIZE )   len = ETH_MTU_SIZE;
        else                            len = size - i;

        _setup_frame( (Hubyte*)eth_sbuf, target, data + i, len );
        printf("Waiting for send (i = %d), (size = %d) \n",i, size);
        _send_frame( (Hubyte*)eth_sbuf, len + ETH_HDR_SIZE );
        printf("Send  complete\n");
        i += len;
    }
}
示例#4
0
void eth_send( Hubyte *target, Hubyte *data, Huint size )
{
    Huint   i;
    Hushort len;

    i = 0;
    while( i < size )
    {
        if( size - i > ETH_MTU_SIZE )   len = ETH_MTU_SIZE;
        else                            len = size - i;

        _setup_frame( (Hubyte*)eth_sbuf, target, data + i, len );
        _send_frame( (Hubyte*)eth_sbuf, len + ETH_HDR_SIZE );
        _recv_ack();

        i += len;
    }
}