mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-04-15 23:42:33 +00:00
Fixed some typo's in the comments.
This commit is contained in:
parent
ea0dc429a7
commit
1ad5537c9b
@ -110,7 +110,7 @@ timeout(void *arg)
|
|||||||
bufptr = (u_char *)pcapif->pkt;
|
bufptr = (u_char *)pcapif->pkt;
|
||||||
for(q = p; q != NULL; q = q->next) {
|
for(q = p; q != NULL; q = q->next) {
|
||||||
/* Read enough bytes to fill this pbuf in the chain. The
|
/* Read enough bytes to fill this pbuf in the chain. The
|
||||||
avaliable data in the pbuf is given by the q->len
|
available data in the pbuf is given by the q->len
|
||||||
variable. */
|
variable. */
|
||||||
/* read data into(q->payload, q->len); */
|
/* read data into(q->payload, q->len); */
|
||||||
bcopy(bufptr, q->payload, q->len);
|
bcopy(bufptr, q->payload, q->len);
|
||||||
|
@ -205,7 +205,7 @@ low_level_input(struct tapif *tapif)
|
|||||||
bufptr = &buf[0];
|
bufptr = &buf[0];
|
||||||
for(q = p; q != NULL; q = q->next) {
|
for(q = p; q != NULL; q = q->next) {
|
||||||
/* Read enough bytes to fill this pbuf in the chain. The
|
/* Read enough bytes to fill this pbuf in the chain. The
|
||||||
avaliable data in the pbuf is given by the q->len
|
available data in the pbuf is given by the q->len
|
||||||
variable. */
|
variable. */
|
||||||
/* read data into(q->payload, q->len); */
|
/* read data into(q->payload, q->len); */
|
||||||
memcpy(q->payload, bufptr, q->len);
|
memcpy(q->payload, bufptr, q->len);
|
||||||
|
@ -179,7 +179,7 @@ low_level_input(struct tunif *tunif)
|
|||||||
bufptr = &buf[0];
|
bufptr = &buf[0];
|
||||||
for(q = p; q != NULL; q = q->next) {
|
for(q = p; q != NULL; q = q->next) {
|
||||||
/* Read enough bytes to fill this pbuf in the chain. The
|
/* Read enough bytes to fill this pbuf in the chain. The
|
||||||
avaliable data in the pbuf is given by the q->len
|
available data in the pbuf is given by the q->len
|
||||||
variable. */
|
variable. */
|
||||||
/* read data into(q->payload, q->len); */
|
/* read data into(q->payload, q->len); */
|
||||||
bcopy(bufptr, q->payload, q->len);
|
bcopy(bufptr, q->payload, q->len);
|
||||||
|
@ -357,7 +357,7 @@ static struct pbuf * low_level_input(struct xemacif *xemacif_ptr)
|
|||||||
* read the entire packet into the pbuf. */
|
* read the entire packet into the pbuf. */
|
||||||
for(q = p; q != NULL; q = q->next) {
|
for(q = p; q != NULL; q = q->next) {
|
||||||
/* Read enough bytes to fill this pbuf
|
/* Read enough bytes to fill this pbuf
|
||||||
* in the chain. The avaliable data in
|
* in the chain. The available data in
|
||||||
* the pbuf is given by the q->len variable. */
|
* the pbuf is given by the q->len variable. */
|
||||||
for (i = 0 ; i < q->len ; i++) {
|
for (i = 0 ; i < q->len ; i++) {
|
||||||
((u8_t *)q->payload)[i] = *(frame_bytes++);
|
((u8_t *)q->payload)[i] = *(frame_bytes++);
|
||||||
|
@ -232,7 +232,7 @@ ip_reass(struct pbuf *p)
|
|||||||
i = 0;
|
i = 0;
|
||||||
for (q = p; q != NULL; q = q->next) {
|
for (q = p; q != NULL; q = q->next) {
|
||||||
/* Copy enough bytes to fill this pbuf in the chain. The
|
/* Copy enough bytes to fill this pbuf in the chain. The
|
||||||
avaliable data in the pbuf is given by the q->len
|
available data in the pbuf is given by the q->len
|
||||||
variable. */
|
variable. */
|
||||||
DEBUGF(IP_REASS_DEBUG,
|
DEBUGF(IP_REASS_DEBUG,
|
||||||
("ip_reass: memcpy from %p (%d) to %p, %d bytes\n",
|
("ip_reass: memcpy from %p (%d) to %p, %d bytes\n",
|
||||||
|
@ -274,7 +274,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
|||||||
} else {
|
} else {
|
||||||
err = ERR_OK;
|
err = ERR_OK;
|
||||||
/* If the application has registered a "sent" function to be
|
/* If the application has registered a "sent" function to be
|
||||||
called when new send buffer space is avaliable, we call it
|
called when new send buffer space is available, we call it
|
||||||
now. */
|
now. */
|
||||||
if(pcb->acked > 0) {
|
if(pcb->acked > 0) {
|
||||||
TCP_EVENT_SENT(pcb, pcb->acked, err);
|
TCP_EVENT_SENT(pcb, pcb->acked, err);
|
||||||
@ -356,7 +356,7 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
|
|||||||
npcb = tcp_alloc(pcb->prio);
|
npcb = tcp_alloc(pcb->prio);
|
||||||
/* If a new PCB could not be created (probably due to lack of memory),
|
/* If a new PCB could not be created (probably due to lack of memory),
|
||||||
we don't do anything, but rely on the sender will retransmit the
|
we don't do anything, but rely on the sender will retransmit the
|
||||||
SYN at a time when we have more memory avaliable. */
|
SYN at a time when we have more memory available. */
|
||||||
if(npcb == NULL) {
|
if(npcb == NULL) {
|
||||||
DEBUGF(TCP_DEBUG, ("tcp_listen_input: could not allocate PCB\n"));
|
DEBUGF(TCP_DEBUG, ("tcp_listen_input: could not allocate PCB\n"));
|
||||||
#ifdef TCP_STATS
|
#ifdef TCP_STATS
|
||||||
|
@ -76,6 +76,7 @@ tcp_send_ctrl(struct tcp_pcb *pcb, u8_t flags)
|
|||||||
err_t
|
err_t
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_write(pcb=%p, arg=%p, len=%u, copy=%d)\n", pcb, arg, len, copy));
|
||||||
if(pcb->state == SYN_SENT ||
|
if(pcb->state == SYN_SENT ||
|
||||||
pcb->state == SYN_RCVD ||
|
pcb->state == SYN_RCVD ||
|
||||||
pcb->state == ESTABLISHED ||
|
pcb->state == ESTABLISHED ||
|
||||||
@ -85,6 +86,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t copy)
|
|||||||
}
|
}
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
} else {
|
} else {
|
||||||
|
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_write() called in invalid state\n"));
|
||||||
return ERR_CONN;
|
return ERR_CONN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,6 +103,7 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
|
|||||||
void *ptr;
|
void *ptr;
|
||||||
u8_t queuelen;
|
u8_t queuelen;
|
||||||
|
|
||||||
|
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue(pcb=%p, arg=%p, len=%u, flags=%x, copy=%d)\n", pcb, arg, len, flags, copy));
|
||||||
left = len;
|
left = len;
|
||||||
ptr = arg;
|
ptr = arg;
|
||||||
/* fail on too much data */
|
/* fail on too much data */
|
||||||
@ -110,38 +113,38 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* seqno will be the sequence number of the first segment enqueued
|
/* seqno will be the sequence number of the first segment enqueued
|
||||||
by the call to this function. */
|
by the call to this function. */
|
||||||
seqno = pcb->snd_lbb;
|
seqno = pcb->snd_lbb;
|
||||||
|
|
||||||
queue = NULL;
|
queue = NULL;
|
||||||
DEBUGF(TCP_QLEN_DEBUG, ("tcp_enqueue: %d\n", pcb->snd_queuelen));
|
DEBUGF(TCP_QLEN_DEBUG, ("tcp_enqueue: queuelen: %d\n", pcb->snd_queuelen));
|
||||||
|
|
||||||
/* Check if the queue length exceeds the configured maximum queue
|
/* Check if the queue length exceeds the configured maximum queue
|
||||||
length. If so, we return an error. */
|
length. If so, we return an error. */
|
||||||
queuelen = pcb->snd_queuelen;
|
queuelen = pcb->snd_queuelen;
|
||||||
if(queuelen >= TCP_SND_QUEUELEN) {
|
if(queuelen >= TCP_SND_QUEUELEN) {
|
||||||
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: too long queue %d (max %d)\n", queuelen, TCP_SND_QUEUELEN));
|
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: too long queue %d (max %d)\n", queuelen, TCP_SND_QUEUELEN));
|
||||||
goto memerr;
|
goto memerr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LWIP_DEBUG
|
#ifdef LWIP_DEBUG
|
||||||
if(pcb->snd_queuelen != 0) {
|
if(pcb->snd_queuelen != 0) {
|
||||||
ASSERT("tcp_enqueue: valid queue length", pcb->unacked != NULL ||
|
ASSERT("tcp_enqueue: valid queue length", pcb->unacked != NULL ||
|
||||||
pcb->unsent != NULL);
|
pcb->unsent != NULL);
|
||||||
}
|
}
|
||||||
#endif /* LWIP_DEBUG */
|
#endif /* LWIP_DEBUG */
|
||||||
|
|
||||||
seg = NULL;
|
seg = NULL;
|
||||||
seglen = 0;
|
seglen = 0;
|
||||||
|
|
||||||
/* First, break up the data into segments and tuck them together in
|
/* First, break up the data into segments and tuck them together in
|
||||||
the local "queue" variable. */
|
the local "queue" variable. */
|
||||||
while(queue == NULL || left > 0) {
|
while(queue == NULL || left > 0) {
|
||||||
|
|
||||||
/* The segment length should be the MSS if the data to be enqueued
|
/* The segment length should be the MSS if the data to be enqueued
|
||||||
is larger than the MSS. */
|
is larger than the MSS. */
|
||||||
seglen = left > pcb->mss? pcb->mss: left;
|
seglen = left > pcb->mss? pcb->mss: left;
|
||||||
|
|
||||||
/* Allocate memory for tcp_seg, and fill in fields. */
|
/* Allocate memory for tcp_seg, and fill in fields. */
|
||||||
seg = memp_malloc(MEMP_TCP_SEG);
|
seg = memp_malloc(MEMP_TCP_SEG);
|
||||||
if(seg == NULL) {
|
if(seg == NULL) {
|
||||||
@ -150,42 +153,45 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
|
|||||||
}
|
}
|
||||||
seg->next = NULL;
|
seg->next = NULL;
|
||||||
seg->p = NULL;
|
seg->p = NULL;
|
||||||
|
|
||||||
if(queue == NULL) {
|
if(queue == NULL) {
|
||||||
queue = seg;
|
queue = seg;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* Attach the segment to the end of the queued segments. */
|
/* Attach the segment to the end of the queued segments. */
|
||||||
for(useg = queue; useg->next != NULL; useg = useg->next);
|
for(useg = queue; useg->next != NULL; useg = useg->next);
|
||||||
useg->next = seg;
|
useg->next = seg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If copy is set, memory should be allocated
|
/* If copy is set, memory should be allocated
|
||||||
and data copied into pbuf, otherwise data comes from
|
and data copied into pbuf, otherwise data comes from
|
||||||
ROM or other static memory, and need not be copied. If
|
ROM or other static memory, and need not be copied. If
|
||||||
optdata is != NULL, we have options instead of data. */
|
optdata is != NULL, we have options instead of data. */
|
||||||
if(optdata != NULL) {
|
if(optdata != NULL) {
|
||||||
if((seg->p = pbuf_alloc(PBUF_TRANSPORT, optlen, PBUF_RAM)) == NULL) {
|
if((seg->p = pbuf_alloc(PBUF_TRANSPORT, optlen, PBUF_RAM)) == NULL) {
|
||||||
goto memerr;
|
goto memerr;
|
||||||
}
|
}
|
||||||
++queuelen;
|
++queuelen;
|
||||||
seg->dataptr = seg->p->payload;
|
seg->dataptr = seg->p->payload;
|
||||||
} else if(copy) {
|
}
|
||||||
|
else if(copy) {
|
||||||
if((seg->p = pbuf_alloc(PBUF_TRANSPORT, seglen, PBUF_RAM)) == NULL) {
|
if((seg->p = pbuf_alloc(PBUF_TRANSPORT, seglen, PBUF_RAM)) == NULL) {
|
||||||
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: could not allocate memory for pbuf copy\n"));
|
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: could not allocate memory for pbuf copy size %u\n", seglen));
|
||||||
goto memerr;
|
goto memerr;
|
||||||
}
|
}
|
||||||
++queuelen;
|
++queuelen;
|
||||||
if(arg != NULL) {
|
if(arg != NULL) {
|
||||||
memcpy(seg->p->payload, ptr, seglen);
|
memcpy(seg->p->payload, ptr, seglen);
|
||||||
}
|
}
|
||||||
seg->dataptr = seg->p->payload;
|
seg->dataptr = seg->p->payload;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* Do not copy the data. */
|
/* Do not copy the data. */
|
||||||
|
|
||||||
/* First, allocate a pbuf for holding the data. */
|
/* First, allocate a pbuf for holding the data. */
|
||||||
if((p = pbuf_alloc(PBUF_TRANSPORT, seglen, PBUF_ROM)) == NULL) {
|
if((p = pbuf_alloc(PBUF_TRANSPORT, seglen, PBUF_ROM)) == NULL) {
|
||||||
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: could not allocate memory for pbuf non-copy\n"));
|
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: could not allocate memory for pbuf non-copy\n"));
|
||||||
goto memerr;
|
goto memerr;
|
||||||
}
|
}
|
||||||
++queuelen;
|
++queuelen;
|
||||||
p->payload = ptr;
|
p->payload = ptr;
|
||||||
@ -193,11 +199,11 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
|
|||||||
|
|
||||||
/* Second, allocate a pbuf for the headers. */
|
/* Second, allocate a pbuf for the headers. */
|
||||||
if((seg->p = pbuf_alloc(PBUF_TRANSPORT, 0, PBUF_RAM)) == NULL) {
|
if((seg->p = pbuf_alloc(PBUF_TRANSPORT, 0, PBUF_RAM)) == NULL) {
|
||||||
/* If allocation fails, we have to deallocate the data pbuf as
|
/* If allocation fails, we have to deallocate the data pbuf as
|
||||||
well. */
|
well. */
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: could not allocate memory for header pbuf\n"));
|
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: could not allocate memory for header pbuf\n"));
|
||||||
goto memerr;
|
goto memerr;
|
||||||
}
|
}
|
||||||
++queuelen;
|
++queuelen;
|
||||||
|
|
||||||
@ -206,22 +212,22 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Now that there are more segments queued, we check again if the
|
/* Now that there are more segments queued, we check again if the
|
||||||
length of the queue exceeds the configured maximum. */
|
length of the queue exceeds the configured maximum. */
|
||||||
if(queuelen > TCP_SND_QUEUELEN) {
|
if(queuelen > TCP_SND_QUEUELEN) {
|
||||||
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: queue too long %d (%d)\n", queuelen, TCP_SND_QUEUELEN));
|
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: queue too long %d (%d)\n", queuelen, TCP_SND_QUEUELEN));
|
||||||
goto memerr;
|
goto memerr;
|
||||||
}
|
}
|
||||||
|
|
||||||
seg->len = seglen;
|
seg->len = seglen;
|
||||||
/* if((flags & TCP_SYN) || (flags & TCP_FIN)) {
|
/* if((flags & TCP_SYN) || (flags & TCP_FIN)) {
|
||||||
++seg->len;
|
++seg->len;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/* Build TCP header. */
|
/* Build TCP header. */
|
||||||
if(pbuf_header(seg->p, TCP_HLEN)) {
|
if(pbuf_header(seg->p, TCP_HLEN)) {
|
||||||
|
|
||||||
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: no room for TCP header in pbuf.\n"));
|
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: no room for TCP header in pbuf.\n"));
|
||||||
|
|
||||||
#ifdef TCP_STATS
|
#ifdef TCP_STATS
|
||||||
++lwip_stats.tcp.err;
|
++lwip_stats.tcp.err;
|
||||||
#endif /* TCP_STATS */
|
#endif /* TCP_STATS */
|
||||||
@ -238,56 +244,60 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
|
|||||||
/* Copy the options into the header, if they are present. */
|
/* Copy the options into the header, if they are present. */
|
||||||
if(optdata == NULL) {
|
if(optdata == NULL) {
|
||||||
TCPH_OFFSET_SET(seg->tcphdr, 5 << 4);
|
TCPH_OFFSET_SET(seg->tcphdr, 5 << 4);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
TCPH_OFFSET_SET(seg->tcphdr, (5 + optlen / 4) << 4);
|
TCPH_OFFSET_SET(seg->tcphdr, (5 + optlen / 4) << 4);
|
||||||
/* Copy options into data portion of segment.
|
/* Copy options into data portion of segment.
|
||||||
Options can thus only be sent in non data carrying
|
Options can thus only be sent in non data carrying
|
||||||
segments such as SYN|ACK. */
|
segments such as SYN|ACK. */
|
||||||
memcpy(seg->dataptr, optdata, optlen);
|
memcpy(seg->dataptr, optdata, optlen);
|
||||||
}
|
}
|
||||||
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: queueing %lu:%lu (0x%x)\n",
|
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: queueing %lu:%lu (0x%x)\n",
|
||||||
ntohl(seg->tcphdr->seqno),
|
ntohl(seg->tcphdr->seqno),
|
||||||
ntohl(seg->tcphdr->seqno) + TCP_TCPLEN(seg),
|
ntohl(seg->tcphdr->seqno) + TCP_TCPLEN(seg),
|
||||||
flags));
|
flags));
|
||||||
|
|
||||||
left -= seglen;
|
left -= seglen;
|
||||||
seqno += seglen;
|
seqno += seglen;
|
||||||
ptr = (void *)((char *)ptr + seglen);
|
ptr = (void *)((char *)ptr + seglen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Now that the data to be enqueued has been broken up into TCP
|
/* Now that the data to be enqueued has been broken up into TCP
|
||||||
segments in the queue variable, we add them to the end of the
|
segments in the queue variable, we add them to the end of the
|
||||||
pcb->unsent queue. */
|
pcb->unsent queue. */
|
||||||
if(pcb->unsent == NULL) {
|
if(pcb->unsent == NULL) {
|
||||||
useg = NULL;
|
useg = NULL;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
for(useg = pcb->unsent; useg->next != NULL; useg = useg->next);
|
for(useg = pcb->unsent; useg->next != NULL; useg = useg->next);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If there is room in the last pbuf on the unsent queue,
|
/* If there is room in the last pbuf on the unsent queue,
|
||||||
chain the first pbuf on the queue together with that. */
|
chain the first pbuf on the queue together with that. */
|
||||||
if(useg != NULL &&
|
if(useg != NULL &&
|
||||||
TCP_TCPLEN(useg) != 0 &&
|
TCP_TCPLEN(useg) != 0 &&
|
||||||
!(TCPH_FLAGS(useg->tcphdr) & (TCP_SYN | TCP_FIN)) &&
|
!(TCPH_FLAGS(useg->tcphdr) & (TCP_SYN | TCP_FIN)) &&
|
||||||
!(flags & (TCP_SYN | TCP_FIN)) &&
|
!(flags & (TCP_SYN | TCP_FIN)) &&
|
||||||
useg->len + queue->len <= pcb->mss) {
|
useg->len + queue->len <= pcb->mss) {
|
||||||
/* Remove TCP header from first segment. */
|
/* Remove TCP header from first segment. */
|
||||||
pbuf_header(queue->p, -TCP_HLEN);
|
pbuf_header(queue->p, -TCP_HLEN);
|
||||||
pbuf_chain(useg->p, queue->p);
|
pbuf_chain(useg->p, queue->p);
|
||||||
useg->len += queue->len;
|
useg->len += queue->len;
|
||||||
useg->next = queue->next;
|
useg->next = queue->next;
|
||||||
|
|
||||||
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: chaining, new len %u\n", useg->len));
|
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: chaining, new len %u\n", useg->len));
|
||||||
if(seg == queue) {
|
if(seg == queue) {
|
||||||
seg = NULL;
|
seg = NULL;
|
||||||
}
|
}
|
||||||
memp_free(MEMP_TCP_SEG, queue);
|
memp_free(MEMP_TCP_SEG, queue);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if(useg == NULL) {
|
if(useg == NULL) {
|
||||||
pcb->unsent = queue;
|
pcb->unsent = queue;
|
||||||
|
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
useg->next = queue;
|
useg->next = queue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -301,19 +311,19 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
|
|||||||
#ifdef LWIP_DEBUG
|
#ifdef LWIP_DEBUG
|
||||||
if(pcb->snd_queuelen != 0) {
|
if(pcb->snd_queuelen != 0) {
|
||||||
ASSERT("tcp_enqueue: valid queue length", pcb->unacked != NULL ||
|
ASSERT("tcp_enqueue: valid queue length", pcb->unacked != NULL ||
|
||||||
pcb->unsent != NULL);
|
pcb->unsent != NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif /* LWIP_DEBUG */
|
#endif /* LWIP_DEBUG */
|
||||||
|
|
||||||
/* Set the PSH flag in the last segment that we enqueued, but only
|
/* Set the PSH flag in the last segment that we enqueued, but only
|
||||||
if the segment has data (indicated by seglen > 0). */
|
if the segment has data (indicated by seglen > 0). */
|
||||||
if(seg != NULL && seglen > 0 && seg->tcphdr != NULL) {
|
if(seg != NULL && seglen > 0 && seg->tcphdr != NULL) {
|
||||||
TCPH_FLAGS_SET(seg->tcphdr, TCPH_FLAGS(seg->tcphdr) | TCP_PSH);
|
TCPH_FLAGS_SET(seg->tcphdr, TCPH_FLAGS(seg->tcphdr) | TCP_PSH);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
memerr:
|
memerr:
|
||||||
#ifdef TCP_STATS
|
#ifdef TCP_STATS
|
||||||
++lwip_stats.tcp.memerr;
|
++lwip_stats.tcp.memerr;
|
||||||
#endif /* TCP_STATS */
|
#endif /* TCP_STATS */
|
||||||
@ -324,8 +334,8 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
|
|||||||
#ifdef LWIP_DEBUG
|
#ifdef LWIP_DEBUG
|
||||||
if(pcb->snd_queuelen != 0) {
|
if(pcb->snd_queuelen != 0) {
|
||||||
ASSERT("tcp_enqueue: valid queue length", pcb->unacked != NULL ||
|
ASSERT("tcp_enqueue: valid queue length", pcb->unacked != NULL ||
|
||||||
pcb->unsent != NULL);
|
pcb->unsent != NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif /* LWIP_DEBUG */
|
#endif /* LWIP_DEBUG */
|
||||||
DEBUGF(TCP_QLEN_DEBUG, ("tcp_enqueue: %d (with mem err)\n", pcb->snd_queuelen));
|
DEBUGF(TCP_QLEN_DEBUG, ("tcp_enqueue: %d (with mem err)\n", pcb->snd_queuelen));
|
||||||
@ -471,6 +481,7 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb)
|
|||||||
if(pcb->rcv_wnd < pcb->mss) {
|
if(pcb->rcv_wnd < pcb->mss) {
|
||||||
seg->tcphdr->wnd = 0;
|
seg->tcphdr->wnd = 0;
|
||||||
} else {
|
} else {
|
||||||
|
/* advertise our receive window size in this TCP segment */
|
||||||
seg->tcphdr->wnd = htons(pcb->rcv_wnd);
|
seg->tcphdr->wnd = htons(pcb->rcv_wnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
* $Id: udp.c,v 1.7 2003/01/08 10:09:42 likewise Exp $
|
* $Id: udp.c,v 1.8 2003/01/13 13:24:11 likewise Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
@ -58,7 +58,7 @@
|
|||||||
|
|
||||||
/* The list of UDP PCBs. */
|
/* The list of UDP PCBs. */
|
||||||
#if LWIP_UDP
|
#if LWIP_UDP
|
||||||
static struct udp_pcb *udp_pcbs = NULL;
|
/*static*/ struct udp_pcb *udp_pcbs = NULL;
|
||||||
|
|
||||||
static struct udp_pcb *pcb_cache = NULL;
|
static struct udp_pcb *pcb_cache = NULL;
|
||||||
#endif /* LWIP_UDP */
|
#endif /* LWIP_UDP */
|
||||||
@ -336,6 +336,7 @@ udp_send(struct udp_pcb *pcb, struct pbuf *p)
|
|||||||
|
|
||||||
if(pcb->flags & UDP_FLAGS_UDPLITE) {
|
if(pcb->flags & UDP_FLAGS_UDPLITE) {
|
||||||
DEBUGF(UDP_DEBUG, ("udp_send: UDP LITE packet length %u", p->tot_len));
|
DEBUGF(UDP_DEBUG, ("udp_send: UDP LITE packet length %u", p->tot_len));
|
||||||
|
/* set UDP message length in UDP header */
|
||||||
udphdr->len = htons(pcb->chksum_len);
|
udphdr->len = htons(pcb->chksum_len);
|
||||||
/* calculate checksum */
|
/* calculate checksum */
|
||||||
udphdr->chksum = inet_chksum_pseudo(p, src_ip, &(pcb->remote_ip),
|
udphdr->chksum = inet_chksum_pseudo(p, src_ip, &(pcb->remote_ip),
|
||||||
|
@ -140,7 +140,7 @@ low_level_input(struct ethernetif *ethernetif)
|
|||||||
packet into the pbuf. */
|
packet into the pbuf. */
|
||||||
for(q = p; q != NULL; q = q->next) {
|
for(q = p; q != NULL; q = q->next) {
|
||||||
/* Read enough bytes to fill this pbuf in the chain. The
|
/* Read enough bytes to fill this pbuf in the chain. The
|
||||||
avaliable data in the pbuf is given by the q->len
|
available data in the pbuf is given by the q->len
|
||||||
variable. */
|
variable. */
|
||||||
read data into(q->payload, q->len);
|
read data into(q->payload, q->len);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user