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

sock_var.h File Reference

UDP and TCP socket interface definitions. More...

#include <sys/types.h>
#include <dev/netbuf.h>
#include <sys/device.h>
#include <netinet/tcp_fsm.h>

Go to the source code of this file.

Data Structures

struct  tcp_socket
 TCP socket information structure. More...

struct  udp_socket
 UDP socket information structure. More...


Defines

#define SO_FIN   0x01
 Send FIN after all data has been transmitted.

#define SO_SYN   0x02
 Send SYN first.

#define SO_FORCE   0x08
 Force sending ACK.

#define SO_ACK   0x10
 Send ACK.


Typedefs

typedef tcp_socket TCPSOCKET
 TCP socket type.


Functions

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

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

int NutTcpOutput (TCPSOCKET *sock, u_char *data, u_short size)
 Initiate TCP segment transmission.

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


Detailed Description

UDP and TCP socket interface definitions.


Function Documentation

int NutTcpOutput TCPSOCKET   sock,
u_char   data,
u_short    size
 

Initiate TCP segment transmission.

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

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.

Segments containing data or SYN and FIN flags are added to a special queue for unacknowledged segments and will be retransmitted by the TCP timer thread, if not acknowledged by the remote within a specific time. The state machine will remove these segments from the queue as soon as they are acknowledged.

Note:
This function is mainly used by the TCP state machine. Applications typically do not call this function but use NutTcpSend(), which is part of the TCP socket interface.
Parameters:
sock  Socket descriptor. This pointer must have been retrieved by calling NutTcpCreateSocket().
Returns:
0 on success, -1 otherwise. Returning 0 does not imply that the data has been successfully delivered, because flow control and retransmission is still handled in the background.

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 structure of the incoming segment. Will be released within this function.
Returns:
0 on success, -1 otherwise.


Generated on Thu Jan 30 22:30:55 2003 for EduNet by doxygen1.2.18