#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_ack(pcb) |
#define | TCP_ACK 0x10 |
#define | tcp_ack_now(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) |
#define | TCP_RMV(pcbs, npcb) |
#define | TCP_RST 0x04 |
#define | TCP_SEQ_GEQ(a, b) ((Int32)((a)-(b)) >= 0) |
#define | TCP_SEQ_GT(a, b) ((Int32)((a)-(b)) > 0) |
#define | TCP_SEQ_LEQ(a, b) ((Int32)((a)-(b)) <= 0) |
#define | TCP_SEQ_LT(a, b) ((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) |
#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 |
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_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) |
tcp_pcb * | tcp_listen (struct tcp_pcb *pcb) |
tcp_pcb * | tcp_new (void) |
uInt32 | tcp_next_iss (void) |
err_t | tcp_output (struct tcp_pcb *pcb) |
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) |
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) |
Variables | |
tcp_hdr | PACK_STRUCT_STRUCT |
tcp_pcb * | tcp_active_pcbs |
tcp_pcb_listen * | tcp_listen_pcbs |
uInt32 | tcp_ticks |
tcp_pcb * | tcp_tmp_pcb |
tcp_pcb * | tcp_tw_pcbs |
#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_now | ( | pcb | ) |
#define TCP_REG | ( | pcbs, | |||
npcb | ) |
#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_sndbuf | ( | pcb | ) | ((pcb)->snd_buf) |
#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 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)) |
enum tcp_state |
void tcp_abort | ( | struct tcp_pcb * | pcb | ) |
Referenced by do_delconn().
void tcp_accept | ( | struct tcp_pcb * | pcb, | |
err_t(*)(void *arg, struct tcp_pcb *newpcb, err_t err) | accept | |||
) |
Referenced by do_delconn(), and do_listen().
void tcp_arg | ( | struct tcp_pcb * | pcb, | |
void * | arg | |||
) |
Referenced by do_delconn(), do_listen(), and setup_tcp().
Referenced by do_bind().
Referenced by do_close(), and do_delconn().
err_t tcp_connect | ( | struct tcp_pcb * | pcb, | |
struct ip_addr * | ipaddr, | |||
uInt16 | port, | |||
err_t(*)(void *arg, struct tcp_pcb *tpcb, err_t err) | connected | |||
) |
Referenced by do_connect().
err_t tcp_enqueue | ( | struct tcp_pcb * | pcb, | |
void * | dataptr, | |||
uInt16 | len, | |||
uInt8 | flags, | |||
uInt8 | copy, | |||
uInt8 * | optdata, | |||
uInt8 | optlen | |||
) |
Referenced by do_delconn(), and setup_tcp().
void tcp_fasttmr | ( | void | ) |
void tcp_init | ( | void | ) |
Referenced by tcpip_thread().
Referenced by do_listen().
struct tcp_pcb* tcp_new | ( | void | ) |
Referenced by do_bind(), and do_connect().
uInt32 tcp_next_iss | ( | void | ) |
Referenced by do_write().
void tcp_pcb_purge | ( | struct tcp_pcb * | pcb | ) |
void tcp_poll | ( | struct tcp_pcb * | pcb, | |
err_t(*)(void *arg, struct tcp_pcb *tpcb) | poll, | |||
uInt8 | interval | |||
) |
Referenced by do_delconn(), and setup_tcp().
void tcp_recv | ( | struct tcp_pcb * | pcb, | |
err_t(*)(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err) | recv | |||
) |
Referenced by do_delconn(), and setup_tcp().
void tcp_rst | ( | uInt32 | seqno, | |
uInt32 | ackno, | |||
struct ip_addr * | local_ip, | |||
struct ip_addr * | remote_ip, | |||
uInt16 | local_port, | |||
uInt16 | remote_port | |||
) |
Referenced by do_delconn(), and setup_tcp().
void tcp_slowtmr | ( | void | ) |
void tcp_tmr | ( | void | ) |
Referenced by tcpip_tcp_timer().
Referenced by do_write().
struct tcp_hdr PACK_STRUCT_STRUCT |
struct tcp_pcb* tcp_active_pcbs |
struct tcp_pcb_listen* tcp_listen_pcbs |
struct tcp_pcb* tcp_tmp_pcb |
struct tcp_pcb* tcp_tw_pcbs |