32 #ifndef __LWIP_TCP_H__ 33 #define __LWIP_TCP_H__ 73 void (* err)(
void *arg,
err_t err));
75 #define tcp_mss(pcb) ((pcb)->mss) 76 #define tcp_sndbuf(pcb) ((pcb)->snd_buf) 93 #define TCP_PRIO_MIN 1 94 #define TCP_PRIO_NORMAL 64 95 #define TCP_PRIO_MAX 127 112 #define TCP_SEQ_LT(a,b) ((s32_t)((a)-(b)) < 0) 113 #define TCP_SEQ_LEQ(a,b) ((s32_t)((a)-(b)) <= 0) 114 #define TCP_SEQ_GT(a,b) ((s32_t)((a)-(b)) > 0) 115 #define TCP_SEQ_GEQ(a,b) ((s32_t)((a)-(b)) >= 0) 118 #define TCP_SEQ_BETWEEN(a,b,c) ((c)-(b) >= (a)-(b)) 120 #define TCP_SEQ_BETWEEN(a,b,c) (TCP_SEQ_GEQ(a,b) && TCP_SEQ_LEQ(a,c)) 121 #define TCP_FIN 0x01U 122 #define TCP_SYN 0x02U 123 #define TCP_RST 0x04U 124 #define TCP_PSH 0x08U 125 #define TCP_ACK 0x10U 126 #define TCP_URG 0x20U 127 #define TCP_ECE 0x40U 128 #define TCP_CWR 0x80U 130 #define TCP_FLAGS 0x3fU 135 #ifndef TCP_TMR_INTERVAL 136 #define TCP_TMR_INTERVAL 250 140 #ifndef TCP_FAST_INTERVAL 141 #define TCP_FAST_INTERVAL TCP_TMR_INTERVAL 145 #ifndef TCP_SLOW_INTERVAL 146 #define TCP_SLOW_INTERVAL (2*TCP_TMR_INTERVAL) 150 #define TCP_FIN_WAIT_TIMEOUT 20000 151 #define TCP_SYN_RCVD_TIMEOUT 20000 153 #define TCP_OOSEQ_TIMEOUT 6 155 #define TCP_MSL 60000 160 #define TCP_NODELAY 0x01 161 #define TCP_KEEPALIVE 0x02 164 #define TCP_KEEPDEFAULT 7200000 165 #define TCP_KEEPINTVL 75000 166 #define TCP_KEEPCNT 9 167 #define TCP_MAXIDLE TCP_KEEPCNT * TCP_KEEPINTVL 170 #ifdef PACK_STRUCT_USE_INCLUDES 171 # include "arch/bpstruct.h" 185 #ifdef PACK_STRUCT_USE_INCLUDES 186 # include "arch/epstruct.h" 189 #define TCPH_OFFSET(phdr) (ntohs((phdr)->_hdrlen_rsvd_flags) >> 8) 190 #define TCPH_HDRLEN(phdr) (ntohs((phdr)->_hdrlen_rsvd_flags) >> 12) 191 #define TCPH_FLAGS(phdr) (ntohs((phdr)->_hdrlen_rsvd_flags) & TCP_FLAGS) 193 #define TCPH_OFFSET_SET(phdr, offset) (phdr)->_hdrlen_rsvd_flags = htons(((offset) << 8) | TCPH_FLAGS(phdr)) 194 #define TCPH_HDRLEN_SET(phdr, len) (phdr)->_hdrlen_rsvd_flags = htons(((len) << 12) | TCPH_FLAGS(phdr)) 195 #define TCPH_FLAGS_SET(phdr, flags) (phdr)->_hdrlen_rsvd_flags = htons((ntohs((phdr)->_hdrlen_rsvd_flags) & ~TCP_FLAGS) | (flags)) 196 #define TCPH_SET_FLAG(phdr, flags ) (phdr)->_hdrlen_rsvd_flags = htons(ntohs((phdr)->_hdrlen_rsvd_flags) | (flags)) 197 #define TCPH_UNSET_FLAG(phdr, flags) (phdr)->_hdrlen_rsvd_flags = htons(ntohs((phdr)->_hdrlen_rsvd_flags) | (TCPH_FLAGS(phdr) & ~(flags)) ) 199 #define TCP_TCPLEN(seg) ((seg)->len + ((TCPH_FLAGS((seg)->tcphdr) & TCP_FIN || \ 200 TCPH_FLAGS((seg)->tcphdr) & TCP_SYN)? 1: 0)) 230 #define TF_ACK_DELAY (u8_t)0x01U 231 #define TF_ACK_NOW (u8_t)0x02U 232 #define TF_INFR (u8_t)0x04U 233 #define TF_RESET (u8_t)0x08U 234 #define TF_CLOSED (u8_t)0x10U 235 #define TF_GOT_FIN (u8_t)0x20U 236 #define TF_NODELAY (u8_t)0x40U 288 #if LWIP_CALLBACK_API 333 #if LWIP_CALLBACK_API 345 LWIP_EVENT_CONNECTED,
356 #define TCP_EVENT_ACCEPT(pcb,err,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\ 357 LWIP_EVENT_ACCEPT, NULL, 0, err) 358 #define TCP_EVENT_SENT(pcb,space,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\ 359 LWIP_EVENT_SENT, NULL, space, ERR_OK) 360 #define TCP_EVENT_RECV(pcb,p,err,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\ 361 LWIP_EVENT_RECV, (p), 0, (err)) 362 #define TCP_EVENT_CONNECTED(pcb,err,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\ 363 LWIP_EVENT_CONNECTED, NULL, 0, (err)) 364 #define TCP_EVENT_POLL(pcb,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\ 365 LWIP_EVENT_POLL, NULL, 0, ERR_OK) 366 #define TCP_EVENT_ERR(errf,arg,err) lwip_tcp_event((arg), NULL, \ 367 LWIP_EVENT_ERR, NULL, 0, (err)) 369 #define TCP_EVENT_ACCEPT(pcb,err,ret) \ 370 if((pcb)->accept != NULL) \ 371 (ret = (pcb)->accept((pcb)->callback_arg,(pcb),(err))) 372 #define TCP_EVENT_SENT(pcb,space,ret) \ 373 if((pcb)->sent != NULL) \ 374 (ret = (pcb)->sent((pcb)->callback_arg,(pcb),(space))) 375 #define TCP_EVENT_RECV(pcb,p,err,ret) \ 376 if((pcb)->recv != NULL) \ 377 { ret = (pcb)->recv((pcb)->callback_arg,(pcb),(p),(err)); } else { \ 378 if (p) pbuf_free(p); } 379 #define TCP_EVENT_CONNECTED(pcb,err,ret) \ 380 if((pcb)->connected != NULL) \ 381 (ret = (pcb)->connected((pcb)->callback_arg,(pcb),(err))) 382 #define TCP_EVENT_POLL(pcb,ret) \ 383 if((pcb)->poll != NULL) \ 384 (ret = (pcb)->poll((pcb)->callback_arg,(pcb))) 385 #define TCP_EVENT_ERR(errf,arg,err) \ 408 #define tcp_ack(pcb) if((pcb)->flags & TF_ACK_DELAY) { \ 409 (pcb)->flags &= ~TF_ACK_DELAY; \ 410 (pcb)->flags |= TF_ACK_NOW; \ 413 (pcb)->flags |= TF_ACK_DELAY; \ 416 #define tcp_ack_now(pcb) (pcb)->flags |= TF_ACK_NOW; \ 437 #if TCP_DEBUG || TCP_INPUT_DEBUG || TCP_OUTPUT_DEBUG 444 # define tcp_debug_print(tcphdr) 445 # define tcp_debug_print_flags(flags) 446 # define tcp_debug_print_state(s) 447 # define tcp_debug_print_pcbs() 448 # define tcp_pcbs_sane() 1 482 #define TCP_REG(pcbs, npcb) do {\ 483 LWIP_DEBUGF(TCP_DEBUG, ("TCP_REG %p local port %d\n", npcb, npcb->local_port)); \ 484 for(tcp_tmp_pcb = *pcbs; \ 485 tcp_tmp_pcb != NULL; \ 486 tcp_tmp_pcb = tcp_tmp_pcb->next) { \ 487 LWIP_ASSERT("TCP_REG: already registered\n", tcp_tmp_pcb != npcb); \ 489 LWIP_ASSERT("TCP_REG: pcb->state != CLOSED", npcb->state != CLOSED); \ 490 npcb->next = *pcbs; \ 491 LWIP_ASSERT("TCP_REG: npcb->next != npcb", npcb->next != npcb); \ 493 LWIP_ASSERT("TCP_RMV: tcp_pcbs sane", tcp_pcbs_sane()); \ 494 tcp_timer_needed(); \ 496 #define TCP_RMV(pcbs, npcb) do { \ 497 LWIP_ASSERT("TCP_RMV: pcbs != NULL", *pcbs != NULL); \ 498 LWIP_DEBUGF(TCP_DEBUG, ("TCP_RMV: removing %p from %p\n", npcb, *pcbs)); \ 499 if(*pcbs == npcb) { \ 500 *pcbs = (*pcbs)->next; \ 501 } else for(tcp_tmp_pcb = *pcbs; tcp_tmp_pcb != NULL; tcp_tmp_pcb = tcp_tmp_pcb->next) { \ 502 if(tcp_tmp_pcb->next != NULL && tcp_tmp_pcb->next == npcb) { \ 503 tcp_tmp_pcb->next = npcb->next; \ 508 LWIP_ASSERT("TCP_RMV: tcp_pcbs sane", tcp_pcbs_sane()); \ 509 LWIP_DEBUGF(TCP_DEBUG, ("TCP_RMV: removed %p from %p\n", npcb, *pcbs)); \ 513 #define TCP_REG(pcbs, npcb) do { \ 514 npcb->next = *pcbs; \ 516 tcp_timer_needed(); \ 518 #define TCP_RMV(pcbs, npcb) do { \ 519 if(*(pcbs) == npcb) { \ 520 (*(pcbs)) = (*pcbs)->next; \ 521 } else for(tcp_tmp_pcb = *pcbs; tcp_tmp_pcb != NULL; tcp_tmp_pcb = tcp_tmp_pcb->next) { \ 522 if(tcp_tmp_pcb->next != NULL && tcp_tmp_pcb->next == npcb) { \ 523 tcp_tmp_pcb->next = npcb->next; \
u8_t polltmr
Definition: tcp.h:244
struct tcp_pcb_listen * listen_pcbs
Definition: tcp.h:461
err_t tcp_write(struct tcp_pcb *pcb, const void *dataptr, u16_t len, u8_t copy)
u8_t nrtx
Definition: tcp.h:257
static u32_t chksum(void *dataptr, u16_t len)
Definition: inet6.c:59
err_t tcp_output(struct tcp_pcb *pcb)
struct tcp_pcb * tcp_alloc(u8_t prio)
u8_t keep_cnt
Definition: tcp.h:312
int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
#define tcp_debug_print(tcphdr)
Definition: tcp.h:444
struct tcp_pcb_listen * next
Definition: tcp.h:320
s8_t err_t
Definition: err.h:39
u32_t snd_wnd
Definition: tcp.h:268
u32_t rttest
Definition: tcp.h:252
void tcp_input(struct pbuf *p, struct netif *inp)
#define tcp_pcbs_sane()
Definition: tcp.h:448
u32_t snd_wl1
Definition: tcp.h:268
u16_t snd_queuelen
Definition: tcp.h:278
void tcp_err(struct tcp_pcb *pcb, void(*err)(void *arg, err_t err))
struct tcp_pcb * tcp_tw_pcbs
err_t tcp_enqueue(struct tcp_pcb *pcb, void *dataptr, u16_t len, u8_t flags, u8_t copy, u8_t *optdata, u8_t optlen)
struct tcp_pcb * pcbs
Definition: tcp.h:462
void * callback_arg
Definition: tcp.h:224
struct tcp_seg * unacked
Definition: tcp.h:283
u32_t snd_max
Definition: tcp.h:268
#define PACK_STRUCT_BEGIN
Definition: arch.h:46
void * callback_arg
Definition: tcp.h:329
struct tcp_pcb * next
Definition: tcp.h:221
void tcp_rexmit_seg(struct tcp_pcb *pcb, struct tcp_seg *seg)
err_t tcp_send_ctrl(struct tcp_pcb *pcb, u8_t flags)
GLenum GLsizei len
Definition: glext.h:7389
void tcp_abort(struct tcp_pcb *pcb)
void tcp_rexmit(struct tcp_pcb *pcb)
u16_t rcv_wnd
Definition: tcp.h:240
GLsizeiptr size
Definition: glext.h:6559
includes all by default used to find thumbnails Please choose a single playlist first Add Entry Add Folder Select Files< multiple > Please fill out all required fields RetroArch updated successfully Please restart the application for the changes to take effect Contributors Move Down Load Remove Add Pass No shader passes Reset All Passes Download thumbnail Start on Download All Thumbnails This Playlist Configured in port
Definition: msg_hash_us.h:7699
u16_t remote_port
Definition: tcp.h:227
void tcp_pcb_purge(struct tcp_pcb *pcb)
GLdouble s
Definition: glext.h:6390
typedef void(__stdcall *PFN_DESTRUCTION_CALLBACK)(void *pData)
struct tcp_pcb * tcp_new(void)
void tcp_rexmit_rto(struct tcp_pcb *pcb)
void tcp_recv(struct tcp_pcb *pcb, err_t(*recv)(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err))
struct tcp_pcb * tcp_active_pcbs
struct tcp_pcb * tcp_tmp_pcb
u8_t dupacks
Definition: tcp.h:261
ssize_t recv(int sockfd, void *buf, size_t len, int flags)
struct tcp_seg * next
Definition: tcp.h:392
u32_t rtseq
Definition: tcp.h:253
s16_t sa
Definition: tcp.h:254
u32_t keepalive
Definition: tcp.h:309
#define tcp_debug_print_state(s)
Definition: tcp.h:446
u32_t snd_wl2
Definition: tcp.h:268
void tcp_accept(struct tcp_pcb *pcb, err_t(*accept)(void *arg, struct tcp_pcb *newpcb, err_t err))
s16_t sv
Definition: tcp.h:254
void * dataptr
Definition: tcp.h:394
#define tcp_debug_print_pcbs()
Definition: tcp.h:447
struct tcp_pcb * tcp_pcb_copy(struct tcp_pcb *pcb)
u8_t pollinterval
Definition: tcp.h:244
u16_t rto
Definition: tcp.h:256
err_t tcp_close(struct tcp_pcb *pcb)
u32_t snd_lbb
Definition: tcp.h:268
#define tcp_debug_print_flags(flags)
Definition: tcp.h:445
u8_t prio
Definition: tcp.h:328
err_t tcp_bind(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
u16_t ssthresh
Definition: tcp.h:265
union tcp_listen_pcbs_t tcp_listen_pcbs
u16_t snd_buf
Definition: tcp.h:277
u16_t acked
Definition: tcp.h:275
struct tcp_pcb * tcp_listen(struct tcp_pcb *pcb)
void tcp_poll(struct tcp_pcb *pcb, err_t(*poll)(void *arg, struct tcp_pcb *tpcb), u8_t interval)
GLenum src
Definition: glext.h:6980
u8_t tcp_seg_free(struct tcp_seg *seg)
enum tcp_state state
Definition: tcp.h:326
u16_t local_port
Definition: tcp.h:331
GLfloat GLfloat p
Definition: glext.h:9809
#define PACK_STRUCT_END
Definition: arch.h:50
s16 s16_t
Definition: cc.h:46
PACK_STRUCT_BEGIN struct tcp_hdr PACK_STRUCT_STRUCT
IP_PCB
Definition: tcp.h:317
u32_t rcv_nxt
Definition: tcp.h:239
struct pbuf * p
Definition: tcp.h:393
u8 u8_t
Definition: cc.h:43
u16_t len
Definition: tcp.h:395
enum tcp_state state
Definition: tcp.h:222
u32_t tmr
Definition: tcp.h:243
PACK_STRUCT_FIELD(u16_t src)
u8_t tcp_segs_free(struct tcp_seg *seg)
u8_t prio
Definition: tcp.h:223
u16_t mss
Definition: tcp.h:249
void tcp_setprio(struct tcp_pcb *pcb, u8_t prio)
void tcp_timer_needed(void)
Definition: network.c:186
u32 u32_t
Definition: cc.h:47
void tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb)
void tcp_rst(u32_t seqno, u32_t ackno, struct ip_addr *local_ip, struct ip_addr *remote_ip, u16_t local_port, u16_t remote_port)
struct tcp_hdr * tcphdr
Definition: tcp.h:396
tcp_state
Definition: tcp.h:202
void tcp_recved(struct tcp_pcb *pcb, u16_t len)
u16_t local_port
Definition: tcp.h:226
u16_t cwnd
Definition: tcp.h:264
void tcp_arg(struct tcp_pcb *pcb, void *arg)
IP_PCB
Definition: tcp.h:219
u32_t lastack
Definition: tcp.h:260
void tcp_keepalive(struct tcp_pcb *pcb)
GLbitfield flags
Definition: glext.h:7828
u16_t rtime
Definition: tcp.h:247
u8_t flags
Definition: tcp.h:229
struct tcp_pcb * tcp_input_pcb
void tcp_sent(struct tcp_pcb *pcb, err_t(*sent)(void *arg, struct tcp_pcb *tpcb, u16_t len))
struct tcp_seg * tcp_seg_copy(struct tcp_seg *seg)
u16 u16_t
Definition: cc.h:45
u32_t snd_nxt
Definition: tcp.h:268
struct tcp_seg * unsent
Definition: tcp.h:282
err_t tcp_connect(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port, err_t(*connected)(void *arg, struct tcp_pcb *tpcb, err_t err))