tcp.h File Reference

#include "net/sys.h"
#include "net/mem.h"
#include "net/pbuf.h"
#include "net/opt.h"
#include "net/ipv4/ip.h"
#include "net/ipv4/icmp.h"
#include "net/err.h"

Go to the source code of this file.

Data Structures

struct  tcp_hdr
struct  tcp_pcb
struct  tcp_pcb_listen
struct  tcp_seg

Defines

#define tcp_sndbuf(pcb)   ((pcb)->snd_buf)
#define TCP_SEQ_LT(a, b)   ((Int32)((a)-(b)) < 0)
#define TCP_SEQ_LEQ(a, b)   ((Int32)((a)-(b)) <= 0)
#define TCP_SEQ_GT(a, b)   ((Int32)((a)-(b)) > 0)
#define TCP_SEQ_GEQ(a, b)   ((Int32)((a)-(b)) >= 0)
#define TCP_FIN   0x01
#define TCP_SYN   0x02
#define TCP_RST   0x04
#define TCP_PSH   0x08
#define TCP_ACK   0x10
#define TCP_URG   0x20
#define TCP_HLEN   20
#define TCP_TMR_INTERVAL   100
#define TCP_FAST_INTERVAL   200
#define TCP_SLOW_INTERVAL   500
#define TCP_FIN_WAIT_TIMEOUT   20000
#define TCP_SYN_RCVD_TIMEOUT   20000
#define TCP_OOSEQ_TIMEOUT   6
#define TCP_MSL   60000
#define TCPH_OFFSET(hdr)   (NTOHS((hdr)->_offset_flags) >> 8)
#define TCPH_FLAGS(hdr)   (NTOHS((hdr)->_offset_flags) & 0xff)
#define TCPH_OFFSET_SET(hdr, offset)   (hdr)->_offset_flags = HTONS(((offset) << 8) | TCPH_FLAGS(hdr))
#define TCPH_FLAGS_SET(hdr, flags)   (hdr)->_offset_flags = HTONS((TCPH_OFFSET(hdr) << 8) | (flags))
#define TCP_TCPLEN(seg)
#define TF_ACK_DELAY   0x01
#define TF_ACK_NOW   0x02
#define TF_INFR   0x04
#define TF_RESET   0x08
#define TF_CLOSED   0x10
#define TF_GOT_FIN   0x20
#define tcp_ack(pcb)
#define tcp_ack_now(pcb)
#define tcp_pcbs_sane()   1
#define TCP_REG(pcbs, npcb)
#define TCP_RMV(pcbs, npcb)

Enumerations

enum  tcp_state {
  CLOSED = 0, LISTEN = 1, SYN_SENT = 2, SYN_RCVD = 3,
  ESTABLISHED = 4, FIN_WAIT_1 = 5, FIN_WAIT_2 = 6, CLOSE_WAIT = 7,
  CLOSING = 8, LAST_ACK = 9, TIME_WAIT = 10
}

Functions

void tcp_init (void)
void tcp_tmr (void)
tcp_pcbtcp_new (void)
void tcp_arg (struct tcp_pcb *pcb, void *arg)
void tcp_accept (struct tcp_pcb *pcb, err_t(*accept)(void *arg, struct tcp_pcb *newpcb, err_t err))
void tcp_recv (struct tcp_pcb *pcb, err_t(*recv)(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err))
void tcp_sent (struct tcp_pcb *pcb, err_t(*sent)(void *arg, struct tcp_pcb *tpcb, uInt16 len))
void tcp_poll (struct tcp_pcb *pcb, err_t(*poll)(void *arg, struct tcp_pcb *tpcb), uInt8 interval)
void tcp_err (struct tcp_pcb *pcb, void(*err)(void *arg, err_t err))
void tcp_recved (struct tcp_pcb *pcb, uInt16 len)
err_t tcp_bind (struct tcp_pcb *pcb, struct ip_addr *ipaddr, uInt16 port)
err_t tcp_connect (struct tcp_pcb *pcb, struct ip_addr *ipaddr, uInt16 port, err_t(*connected)(void *arg, struct tcp_pcb *tpcb, err_t err))
tcp_pcbtcp_listen (struct tcp_pcb *pcb)
void tcp_abort (struct tcp_pcb *pcb)
err_t tcp_close (struct tcp_pcb *pcb)
err_t tcp_write (struct tcp_pcb *pcb, const void *dataptr, uInt16 len, uInt8 copy)
void tcp_slowtmr (void)
void tcp_fasttmr (void)
void tcp_input (struct pbuf *p, struct netif *inp)
err_t tcp_output (struct tcp_pcb *pcb)
tcp_pcbtcp_pcb_copy (struct tcp_pcb *pcb)
void tcp_pcb_purge (struct tcp_pcb *pcb)
void tcp_pcb_remove (struct tcp_pcb **pcblist, struct tcp_pcb *pcb)
uInt8 tcp_segs_free (struct tcp_seg *seg)
uInt8 tcp_seg_free (struct tcp_seg *seg)
tcp_segtcp_seg_copy (struct tcp_seg *seg)
err_t tcp_send_ctrl (struct tcp_pcb *pcb, uInt8 flags)
err_t tcp_enqueue (struct tcp_pcb *pcb, void *dataptr, uInt16 len, uInt8 flags, uInt8 copy, uInt8 *optdata, uInt8 optlen)
void tcp_rexmit_seg (struct tcp_pcb *pcb, struct tcp_seg *seg)
void tcp_rst (uInt32 seqno, uInt32 ackno, struct ip_addr *local_ip, struct ip_addr *remote_ip, uInt16 local_port, uInt16 remote_port)
uInt32 tcp_next_iss (void)

Variables

tcp_hdr PACK_STRUCT_STRUCT
uInt32 tcp_ticks
tcp_pcb_listentcp_listen_pcbs
tcp_pcbtcp_active_pcbs
tcp_pcbtcp_tw_pcbs
tcp_pcbtcp_tmp_pcb


Define Documentation

#define tcp_ack pcb   ) 
 

Value:

if((pcb)->flags & TF_ACK_DELAY) { \
                            (pcb)->flags |= TF_ACK_NOW; \
                            tcp_output(pcb); \
                         } else { \
                            (pcb)->flags |= TF_ACK_DELAY; \
                         }

#define TCP_ACK   0x10
 

#define tcp_ack_now pcb   ) 
 

Value:

(pcb)->flags |= TF_ACK_NOW; \
                         tcp_output(pcb)

#define TCP_FAST_INTERVAL   200
 

#define TCP_FIN   0x01
 

#define TCP_FIN_WAIT_TIMEOUT   20000
 

#define TCP_HLEN   20
 

#define TCP_MSL   60000
 

#define TCP_OOSEQ_TIMEOUT   6
 

 
#define tcp_pcbs_sane  )     1
 

#define TCP_PSH   0x08
 

#define TCP_REG pcbs,
npcb   ) 
 

Value:

do { \
                            npcb->next = *pcbs; \
                            *pcbs = npcb; \
                            } while(0)

#define TCP_RMV pcbs,
npcb   ) 
 

Value:

do { \
                            if(*pcbs == npcb) { \
                               *pcbs = (*pcbs)->next; \
                            } else for(tcp_tmp_pcb = *pcbs; tcp_tmp_pcb != NULL; tcp_tmp_pcb = tcp_tmp_pcb->next) { \
                               if(tcp_tmp_pcb->next != NULL && tcp_tmp_pcb->next == npcb) { \
                                  tcp_tmp_pcb->next = npcb->next; \
                                  break; \
                               } \
                            } \
                            npcb->next = NULL; \
                            } while(0)

#define TCP_RST   0x04
 

#define TCP_SEQ_GEQ a,
 )     ((Int32)((a)-(b)) >= 0)
 

#define TCP_SEQ_GT a,
 )     ((Int32)((a)-(b)) > 0)
 

#define TCP_SEQ_LEQ a,
 )     ((Int32)((a)-(b)) <= 0)
 

#define TCP_SEQ_LT a,
 )     ((Int32)((a)-(b)) < 0)
 

#define TCP_SLOW_INTERVAL   500
 

#define tcp_sndbuf pcb   )     ((pcb)->snd_buf)
 

#define TCP_SYN   0x02
 

#define TCP_SYN_RCVD_TIMEOUT   20000
 

#define TCP_TCPLEN seg   ) 
 

Value:

((seg)->len + ((TCPH_FLAGS((seg)->tcphdr) & TCP_FIN || \
                                        TCPH_FLAGS((seg)->tcphdr) & TCP_SYN)? 1: 0))

#define TCP_TMR_INTERVAL   100
 

#define TCP_URG   0x20
 

#define TCPH_FLAGS hdr   )     (NTOHS((hdr)->_offset_flags) & 0xff)
 

#define TCPH_FLAGS_SET hdr,
flags   )     (hdr)->_offset_flags = HTONS((TCPH_OFFSET(hdr) << 8) | (flags))
 

#define TCPH_OFFSET hdr   )     (NTOHS((hdr)->_offset_flags) >> 8)
 

#define TCPH_OFFSET_SET hdr,
offset   )     (hdr)->_offset_flags = HTONS(((offset) << 8) | TCPH_FLAGS(hdr))
 

#define TF_ACK_DELAY   0x01
 

#define TF_ACK_NOW   0x02
 

#define TF_CLOSED   0x10
 

#define TF_GOT_FIN   0x20
 

#define TF_INFR   0x04
 

#define TF_RESET   0x08
 


Enumeration Type Documentation

enum tcp_state
 

Enumeration values:
CLOSED 
LISTEN 
SYN_SENT 
SYN_RCVD 
ESTABLISHED 
FIN_WAIT_1 
FIN_WAIT_2 
CLOSE_WAIT 
CLOSING 
LAST_ACK 
TIME_WAIT 


Function Documentation

void tcp_abort struct tcp_pcb pcb  ) 
 

void tcp_accept struct tcp_pcb pcb,
err_t(*  accept)(void *arg, struct tcp_pcb *newpcb, err_t err)
 

void tcp_arg struct tcp_pcb pcb,
void *  arg
 

err_t tcp_bind struct tcp_pcb pcb,
struct ip_addr ipaddr,
uInt16  port
 

err_t tcp_close struct tcp_pcb pcb  ) 
 

err_t tcp_connect struct tcp_pcb pcb,
struct ip_addr ipaddr,
uInt16  port,
err_t(*  connected)(void *arg, struct tcp_pcb *tpcb, err_t err)
 

err_t tcp_enqueue struct tcp_pcb pcb,
void *  dataptr,
uInt16  len,
uInt8  flags,
uInt8  copy,
uInt8 optdata,
uInt8  optlen
 

void tcp_err struct tcp_pcb pcb,
void(*  err)(void *arg, err_t err)
 

void tcp_fasttmr void   ) 
 

void tcp_init void   ) 
 

void tcp_input struct pbuf p,
struct netif inp
 

struct tcp_pcb* tcp_listen struct tcp_pcb pcb  ) 
 

struct tcp_pcb* tcp_new void   ) 
 

uInt32 tcp_next_iss void   ) 
 

err_t tcp_output struct tcp_pcb pcb  ) 
 

struct tcp_pcb* tcp_pcb_copy struct tcp_pcb pcb  ) 
 

void tcp_pcb_purge struct tcp_pcb pcb  ) 
 

void tcp_pcb_remove struct tcp_pcb **  pcblist,
struct tcp_pcb pcb
 

void tcp_poll struct tcp_pcb pcb,
err_t(*  poll)(void *arg, struct tcp_pcb *tpcb),
uInt8  interval
 

void tcp_recv struct tcp_pcb pcb,
err_t(*  recv)(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err)
 

void tcp_recved struct tcp_pcb pcb,
uInt16  len
 

void tcp_rexmit_seg struct tcp_pcb pcb,
struct tcp_seg seg
 

void tcp_rst uInt32  seqno,
uInt32  ackno,
struct ip_addr local_ip,
struct ip_addr remote_ip,
uInt16  local_port,
uInt16  remote_port
 

struct tcp_seg* tcp_seg_copy struct tcp_seg seg  ) 
 

uInt8 tcp_seg_free struct tcp_seg seg  ) 
 

uInt8 tcp_segs_free struct tcp_seg seg  ) 
 

err_t tcp_send_ctrl struct tcp_pcb pcb,
uInt8  flags
 

void tcp_sent struct tcp_pcb pcb,
err_t(*  sent)(void *arg, struct tcp_pcb *tpcb, uInt16 len)
 

void tcp_slowtmr void   ) 
 

void tcp_tmr void   ) 
 

err_t tcp_write struct tcp_pcb pcb,
const void *  dataptr,
uInt16  len,
uInt8  copy
 


Variable Documentation

struct tcp_hdr PACK_STRUCT_STRUCT
 

struct tcp_pcb* tcp_active_pcbs
 

struct tcp_pcb_listen* tcp_listen_pcbs
 

uInt32 tcp_ticks
 

struct tcp_pcb* tcp_tmp_pcb
 

struct tcp_pcb* tcp_tw_pcbs
 


Generated on Sat May 8 09:28:23 2004 for Ubixos by doxygen 1.3.3