35 |
* |
* |
36 |
*/ |
*/ |
37 |
|
|
38 |
/*-----------------------------------------------------------------------------------*/ |
|
39 |
/* tcp_output.c |
/* tcp_output.c |
40 |
* |
* |
41 |
* The output functions of TCP. |
* The output functions of TCP. |
42 |
* |
* |
43 |
*/ |
*/ |
44 |
/*-----------------------------------------------------------------------------------*/ |
|
45 |
|
|
46 |
|
|
47 |
#include "lwip/def.h" |
#include "lwip/def.h" |
64 |
static void tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb); |
static void tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb); |
65 |
|
|
66 |
|
|
67 |
/*-----------------------------------------------------------------------------------*/ |
|
68 |
err_t |
err_t |
69 |
tcp_send_ctrl(struct tcp_pcb *pcb, u8_t flags) |
tcp_send_ctrl(struct tcp_pcb *pcb, u8_t flags) |
70 |
{ |
{ |
71 |
return tcp_enqueue(pcb, NULL, 0, flags, 1, NULL, 0); |
return tcp_enqueue(pcb, NULL, 0, flags, 1, NULL, 0); |
72 |
|
|
73 |
} |
} |
74 |
/*-----------------------------------------------------------------------------------*/ |
|
75 |
err_t |
err_t |
76 |
tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t copy) |
tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t copy) |
77 |
{ |
{ |
90 |
return ERR_CONN; |
return ERR_CONN; |
91 |
} |
} |
92 |
} |
} |
93 |
/*-----------------------------------------------------------------------------------*/ |
|
94 |
err_t |
err_t |
95 |
tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len, |
tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len, |
96 |
u8_t flags, u8_t copy, |
u8_t flags, u8_t copy, |
338 |
LWIP_DEBUGF(TCP_QLEN_DEBUG | DBG_STATE, ("tcp_enqueue: %d (with mem err)\n", pcb->snd_queuelen)); |
LWIP_DEBUGF(TCP_QLEN_DEBUG | DBG_STATE, ("tcp_enqueue: %d (with mem err)\n", pcb->snd_queuelen)); |
339 |
return ERR_MEM; |
return ERR_MEM; |
340 |
} |
} |
341 |
/*-----------------------------------------------------------------------------------*/ |
|
342 |
/* find out what we can send and send it */ |
/* find out what we can send and send it */ |
343 |
err_t |
err_t |
344 |
tcp_output(struct tcp_pcb *pcb) |
tcp_output(struct tcp_pcb *pcb) |
468 |
} |
} |
469 |
return ERR_OK; |
return ERR_OK; |
470 |
} |
} |
471 |
/*-----------------------------------------------------------------------------------*/ |
|
472 |
static void |
static void |
473 |
tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb) |
tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb) |
474 |
{ |
{ |
526 |
ip_output(seg->p, &(pcb->local_ip), &(pcb->remote_ip), pcb->ttl, pcb->tos, |
ip_output(seg->p, &(pcb->local_ip), &(pcb->remote_ip), pcb->ttl, pcb->tos, |
527 |
IP_PROTO_TCP); |
IP_PROTO_TCP); |
528 |
} |
} |
529 |
/*-----------------------------------------------------------------------------------*/ |
|
530 |
void |
void |
531 |
tcp_rst(u32_t seqno, u32_t ackno, |
tcp_rst(u32_t seqno, u32_t ackno, |
532 |
struct ip_addr *local_ip, struct ip_addr *remote_ip, |
struct ip_addr *local_ip, struct ip_addr *remote_ip, |
560 |
pbuf_free(p); |
pbuf_free(p); |
561 |
LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_rst: seqno %lu ackno %lu.\n", seqno, ackno)); |
LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_rst: seqno %lu ackno %lu.\n", seqno, ackno)); |
562 |
} |
} |
563 |
/*-----------------------------------------------------------------------------------*/ |
|
564 |
void |
void |
565 |
tcp_rexmit(struct tcp_pcb *pcb) |
tcp_rexmit(struct tcp_pcb *pcb) |
566 |
{ |
{ |
590 |
tcp_output(pcb); |
tcp_output(pcb); |
591 |
|
|
592 |
} |
} |
593 |
/*-----------------------------------------------------------------------------------*/ |
|
594 |
void |
void |
595 |
tcp_keepalive(struct tcp_pcb *pcb) |
tcp_keepalive(struct tcp_pcb *pcb) |
596 |
{ |
{ |