Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

sys/sock_var.h File Reference

UDP and TCP socket interface definitions. More...


Data Structures

struct  tcp_socket
 TCP socket information structure. More...

struct  udp_socket
 UDP socket information structure. More...


Defines

#define SO_FIN
 \brief Send FIN after all data has been transmitted.

#define SO_SYN
 \brief Send SYN first.

#define SO_FORCE
 \brief Force sending ACK.

#define SO_ACK
 \brief Send ACK.


Typedefs

typedef struct udp_socket UDPSOCKET
 UDP socket type.

typedef struct tcp_socket TCPSOCKET
 TCP socket type.


Functions

void NutUdpInput (NETBUF *nb)
 Handle incoming UDP packets. More...

int NutUdpOutput (UDPSOCKET *sock, u_long dest, u_short port, NETBUF *nb)
 Send an UDP packet. More...

int NutTcpOutput (TCPSOCKET *sock, u_char flags)
 Initiate TCP segment transmission. More...

int NutTcpReject (NETBUF *nb)
 Reject an incoming segment. More...


Detailed Description

UDP and TCP socket interface definitions.


Function Documentation

int NutTcpOutput ( TCPSOCKET * sock,
u_char flags )
 

Initiate TCP segment transmission.

Check the TCP socket status and send any segment waiting for transmission.

Segments may be sent synchronously or asynchronously.

If sent synchronously, the function will not return until the data has been stored in the network device hardware for transmission. If the device is not ready for transmitting a new packet, the calling thread will be suspended until the device becomes ready again. If the target host is connected through an Ethernet network and if the hardware address of that host is currently unknown, an ARP request is sent out and the function will block until a response is received or an ARP timeout occurs. This does not imply that the data has been successfully delivered, because flow control and retransmission is still handled in the background.

If sent asynchronously, the function will not wait for hardware address resolution or until the network device becomes ready for transmission. In such cases the data will be buffered by underlying layers and tranmitted in the background.

Note:
This function is mainly used by the TCP state machine. Applications typically do not call this function but use the TCP socket interface.
Parameters:
sock   Socket descriptor. This pointer must have been retrieved by calling NutTcpCreateSocket().
flags   Set to 1 for asynchronous output, 0 otherwise.

Returns:
0 on success, -1 otherwise.

int NutTcpReject ( NETBUF * nb )
 

Reject an incoming segment.

Send RST in response to an incoming segment, which should be rejected.

The function avoids to send out a RST segment in response to an incoming RST segment.

Note:
This function is mainly used by the TCP state machine. Applications typically do not call this function.
Parameters:
nb   Network buffer strucutre of the incoming segment. Reused for response or explicitely released.


© 2000-2001 by egnite Software GmbH - visit http://www.ethernut.de/