Changes between Version 155 and Version 156 of library_stdio


Ignore:
Timestamp:
Dec 11, 2016, 7:43:49 PM (8 years ago)
Author:
alain
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • library_stdio

    v155 v156  
    408408 * return socket identifier if success / returns -1 if error.
    409409
    410  === 2) void '''giet_nic_close'''( int socket ) ===
     410 === 2) int '''giet_nic_close'''( int socket ) ===
    411411This function releases all memory allocated for a socket: the socket descriptor itself, and the RX packets / Tx packets queues associated to the socket. The kernel threads associated to these queues are desactivated.
    412412 * '''socket''' : socket identifier.
    413413 * return 0 if success / returns -1 if error.
    414414
    415  === 3) void '''giet_nic_bind'''( int socket , sockaddr_t * addr , int addr_len ) ===
     415 === 3) int '''giet_nic_bind'''( int socket , sockaddr_t * addr , int addr_len ) ===
    416416This function makes the binding between a socket identified by the <socket> argument, and a local socket addres, that is a couple (IPV4 address  / port number). The default value
    417417INADDR_ANY value can be used fot thr IPV4 address, toask the kernel to define the value.
    418418 * '''socket''' : socket identifier.
    419419 * '''addr''' : pointer on the local socket address.
    420  * '''addr_len''' : address structure length (in bytes).
     420 * '''addr_len''' : socket address length (in bytes).
    421421 * return 0 if success / returns -1 if error.
    422422
    423  === 4) void '''giet_nic_connect'''( int socket , sockaddr_t * addr , int addr_len ) ===
     423 === 4) int '''giet_nic_connect'''( int socket , sockaddr_t * addr , int addr_len ) ===
    424424This function is generally used by a client to connect a local client socket to a remote
    425425server socket. It forces the local socket in connected mode, and register the remote socket address in the local socket descriptor. It allows the client to use the read() / write() sytem call without specifying the explicitely the remote server address.
     
    429429 * return 0 if success / returns -1 if error.
    430430
    431  === 5) void '''giet_nic_tx_move'''(  void* buffer ) ===
    432 This blocking function transfer one container (4 Kbytes)  from an user buffer to the kernel chbuf defined by the NIC_TX channel registered in the calling thread context. The <buffer> argument is the container base address in user space.
    433 Several user threads can concurrently access the same chbuf, because the syscall handler takes the lock protecting the chbuf. It returns only when the container has been fully transfered.
    434 The calling thread exit if the buffer is not in user space, or if no allocated NIC_TX channel, or in case of timeout.
    435 
    436  === 6) void '''giet_nic_rx_move'''( void* buffer ) ===
    437 This blocking function transfer one container (4 Kbytes)  from the kernel chbuf defined by the NIC_RX channel registered in the calling thread context to an user buffer. The <buffer> argument is the container base address in user space.
    438 Several user threads can concurrently access the same chbuf, because the syscall handler takes the lock protecting the chbuf. It returns only when the container has been fully transfered.
    439 The calling thread exit if the buffer is not in user space, or if no allocated NIC_RX channel, or in case of timeout.
    440 
    441  === 7) void '''giet_nic_tx_stop'''( ) ===
    442 This function must be called by one single thread (typically the main() ). It desactivates both the NIC_TX channel and the CMA_TX channel allocated to the calling thread.
    443 The calling thread exit if no allocated NIC_TX channel or no allocated CMA_TX channel.
    444 
    445  === 8) void '''giet_nic_rx_stop'''( ) ===
    446 This function  must be called by one single thread (typically the main() ). It desactivates both the NIC_RX channel and the CMA channel allocated to the calling thread.
    447 The calling thread exit if no allocated NIC_RX channel or no allocated CMA channel.
    448 
    449  === 9) void '''giet_nic_rx_clear'''( ) ===
    450 This function reset all instrumentation (packets counters) associated to the RX channels.
    451 
    452  === 10) void '''giet_nic_tx_clear'''( ) ===
    453 This function reset all instrumentation (packets counters) associated to the TX channels.
    454 
    455  === 11) void '''giet_nic_rx_stats'''( ) ===
    456 This function display on kernel TTY0 the content of the instrumentation registers associated to the RX channels.
    457 
    458  === 12) void '''giet_nic_tx_stats'''( ) ===
    459 This function display on kernel TTY0 the content of the instrumentation registers associated to the TX channels.
     431 === 5) int '''giet_nic_sendto'''( int socket , void * buffer , int length , int flags , sockaddr_t * dest_addr , int addr_len ) ===
     432This blocking function moves one ''raw'' packet from an user buffer defined by the <buffer> argument to a kernel buffer. The packet length (in bytes) is defned by the <length> arguments. It uses the the <socket> and <dest_addr> arguments to build the ETH/IP/UDP header. It returns only when the user buffer can be re-used. The user thread blocking uses a descheduling policy.
     433 * '''socket''' : socket identifier.
     434 * '''buffer''' : pointer on user buffer.
     435 * '''length''' : raw packet length (bytes).
     436 * '''flags''' : unsupported / must be 0.
     437 * '''dest_addr''' : remote socket address.
     438 * '''addr_len''' : socket address length (in bytes).
     439 * return 0 if success / returns -1 if error.
     440
     441 === 6) int '''giet_nic_recvfrom'''( int socket , void * buffer , int length , int flags , sockaddr_t * dest_addr , int * addr_len ) ===
     442This 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 received packet length is written in the <addr_len> argument. The remote socket address is written in the <dest_addr> argument. It returns only when the user buffer has been written. The user thread blocking uses a descheduling policy.
     443 * '''socket''' : socket identifier.
     444 * '''buffer''' : pointer on user buffer.
     445 * '''length''' : raw packet length (bytes).
     446 * '''flags''' : unsupported / must be 0.
     447 * '''dest_addr''' : pointer on remote socket address.
     448 * '''addr_len''' : pointer on actual raw packet length. (in bytes).
     449 * return 0 if success / returns -1 if error.
     450
     451 === 7) int '''giet_nic_write'''( int socket , void * buffer , int length void* buffer ) ===
     452This 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 ) ===
     459This 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'''( ) ===
     466This function  print on the calling thread terminal the current values of the hardware NIC instrumentation counters.
     467
     468 === 10) void '''giet_nic_clear_stats'''( ) ===
     469This function reset all Hardware NIC instrumentation counters.
     470
    460471
    461472