NetBurner 3.1
tcp.h File Reference

NetBurner TCP API. More...

#include <ip.h>
#include <nettypes.h>

Go to the source code of this file.

Macros

#define TCP_STATE_CLOSED   (0)
 Socket Closed.
 
#define TCP_STATE_LISTEN   (1)
 Listen Socket.
 
#define TCP_STATE_SYN_SENT   (2)
 Packet with synchronization flag sent.
 
#define TCP_STATE_SYN_RCVD   (3)
 Packet with synchronisation flag received.
 
#define TCP_STATE_WAIT_FOR_ACCEPT   (4)
 Socket waiting for accept.
 
#define TCP_STATE_ESTABLISHED   (5)
 TCP session established.
 
#define TCP_STATE_CLOSE_WAIT   (6)
 FIN received from client and socet is in the process of closing.
 
#define TCP_STATE_LAST_ACK   (7)
 Server is in the process of sending its own FIN signal.
 
#define TCP_STATE_FIN_WAIT_1   (8)
 Connection is active but not currently being used.
 
#define TCP_STATE_FIN_WAIT_2   (9)
 Client has received first ACK of the first FIN signal from server.
 
#define TCP_STATE_CLOSING   (10)
 Session is closing, but data may still be processed.
 
#define TCP_STATE_TIME_WAIT   (11)
 Client recognizes connection still open, but not currently being used.
 
#define TCP_ERR_NORMAL   (0)
 No errors.
 
#define TCP_ERR_TIMEOUT   (-1)
 Socket timed out.
 
#define TCP_ERR_NOCON   (-2)
 No connection exists.
 
#define TCP_ERR_CLOSING   (-3)
 Socket is in the process of closing.
 
#define TCP_ERR_NOSUCH_SOCKET   (-4)
 No such socket exists.
 
#define TCP_ERR_NONE_AVAIL   (-5)
 No new sockets are available.
 
#define TCP_ERR_CON_RESET   (-6)
 Connection has been reset.
 
#define TCP_ERR_CON_ABORT   (-7)
 Connection has been aborted.
 
#define SO_DEBUG   1
 Reserved.
 
#define SO_NONAGLE   2
 Disable the Nagle algorithm.
 
#define SO_NOPUSH   4
 Disable TCP PUSH feature.
 

Functions

int listen4 (IPADDR4 addr, uint16_t port, uint8_t maxpend=5)
 Listen for incoming IPv4 connections. More...
 
int accept4 (int listening_socket, IPADDR4 *address, uint16_t *port, uint16_t timeout)
 Accept an incoming IPv4 connection from a listening socket. More...
 
int listen6 (const IPADDR6 &addr, uint16_t port, uint8_t maxpend=5)
 Listen for incoming IPv6 connections. More...
 
int accept6 (int listening_socket, IPADDR6 *address, uint16_t *port, uint16_t timeout)
 Accept an incoming IPv6 connection from a listening socket. More...
 
int connect4 (IPADDR4 ipAddress, uint16_t remotePort, uint32_t timeout, IPADDR4 interfaceIpAddress)
 Connect to a remote IPv4 host. More...
 
int connect6 (const IPADDR6 &ipAddress, uint16_t remotePort, uint32_t timeout, const IPADDR6 &interfaceIpAddress)
 Connect to a remote IPv6 host. More...
 
int NoBlockConnect4 (IPADDR4 ipAddress, uint16_t remotePort, IPADDR4 interfaceIpAddress=IPADDR4::NullIP())
 Create a file descriptior and return immediately, does not wait for connection to complete. Before attempting to use the socket verify a connection was successful with TcpGetSocketState(fd). More...
 
int NoBlockConnect6 (const IPADDR6 &ipAddress, uint16_t remotePort, const IPADDR6 &interfaceIpAddress)
 Create a file descriptior and return immediately, does not wait for connection to complete. Before attempting to use the socket verify a connection was successful with TcpGetSocketState(fd). More...
 
IPADDR4 GetSocketRemoteAddr4 (int fd)
 Returns the IPv4 address of the remote host associated with the specified file descriptor. More...
 
IPADDR4 GetSocketLocalAddr4 (int fd)
 Returns the IPv4 address of the local interface associated with the connection. More...
 
IPADDR6 GetSocketRemoteAddr6 (int fd)
 Returns the IPv6 address of the remote host associated with the specified file descriptor. More...
 
IPADDR6 GetSocketLocalAddr6 (int fd)
 Returns the IPv6 address of the local interface associated with the connection. More...
 
uint16_t GetSocketRemotePort (int fd)
 Returns the port number of the remote host associated with the connection. More...
 
uint16_t GetSocketLocalPort (int fd)
 Returns the local port number associated with the connection. More...
 
uint32_t TcpGetLastRxTime (int fd)
 Returns the value of system Time Ticks when the last packet was received. Used for the TCP Keep Alive feature. More...
 
void TcpSendKeepAlive (int fd)
 Send a TCP keep alive packet to a remote host. More...
 
uint32_t TcpGetLastRxInterval (int fd)
 Returns the number of system Time Ticks since the last packet was received. This is the difference between the current system time and lastRxTime of the socket. More...
 
int GetTcpRtxCount (int fd)
 Returns the number of re-transmits that have occured on the specified connection. More...
 
int setsockoption (int fd, int option)
 Set TCP socket options. More...
 
int clrsockoption (int fd, int option)
 Clear TCP socket options. More...
 
int getsockoption (int fd)
 Returns the options for the specified TCP socket. More...
 
char SocketPeek (int fd)
 Returns the next char that would be read, 0 if no data. More...
 
int TcpGetSocketInterface (int fd)
 Return the network interface asociated with a TCP socket. More...
 
uint8_t TcpGetSocketState (int fd)
 Return the current state of a TCP socket. More...
 

Detailed Description

NetBurner TCP API.