441 | | === 6) int '''giet_nic_recvfrom'''( int socket , void * buffer , int length , int flags , sockaddr_t * dest_addr , int * addr_len ) === |
442 | | This blocking function moves one ''raw'' packet from a kernel buffer to an user buffer defined by the <buffer> argument. The <length> argument define the user buffer size (in bytes). Packets exceeding this size are discarded. Only packets matching the local IP address and local port number, defined by the <socket> argument will be delivered (2 matching conditions). If the socket is in ''connected'' mode, the matching must also be on remote IP address an remote port number (4 matching conditions). The remote socket address is returned in the <dest_addr> argument. It returns only when the user buffer has been written. The user thread blocking uses a descheduling policy. |
| 441 | === 6) int '''giet_nic_recvfrom'''( int socket , void * buffer , int length , int flags , sockaddr_t * dest_addr , int * pkt_len ) === |
| 442 | This blocking function moves one ''raw'' packet from a kernel buffer to an user buffer defined by the <buffer> argument. The <size> argument define the user buffer size and must be larger than 2 Kbytes. Only packets matching the local IP address and local port number, defined by the <socket> argument will be delivered (2 matching conditions). If the socket is in ''connected'' mode, the matching must also be on remote IP address an remote port number (4 matching conditions). The remote socket address is returned in the <src_addr> argument. The actual received packet length |
| 443 | is returned in the <length> argument. It returns only when the user buffer has been written, and uses a descheduling policy for blocking. |
451 | | === 7) int '''giet_nic_write'''( int socket , void * buffer , int length void* buffer ) === |
452 | | This blocking function makes the same as the giet_nic_sendto() function, with only one difference: the remote socket address must have been previously registered in the local socket descriptor using the giet_nic_connect() function. |
453 | | * '''socket''' : socket identifier. |
454 | | * '''buffer''' : pointer on user buffer. |
455 | | * '''length''' : raw packet length (bytes). |
456 | | * returns 0 if success / returns -1 if error. |
457 | | |
458 | | === 8) void '''giet_nic_read'''( int socket , void * buffer , int length void* buffer ) === |
459 | | This blocking function makes the same as the giet_nic_recvfrom() function, with two differences: (i) the remote socket address must have been previously registered in the local socket descriptor using the giet_nic_connect() function, (ii) the matching condition is computed on 4 conditions: local IP address, local port number, remote IP addresses, remote port number. |
460 | | * '''socket''' : socket identifier. |
461 | | * '''buffer''' : pointer on user buffer. |
462 | | * '''length''' : raw packet length (bytes). |
463 | | * returns 0 if success / returns -1 if error. |
464 | | |
465 | | === 9) void '''giet_nic_print_stats'''( ) === |
| 452 | === 7) void '''giet_nic_print_stats'''( ) === |