Fixed some typo's in the comments.

This commit is contained in:
likewise 2003-01-13 13:22:09 +00:00
parent ea0dc429a7
commit 1ad5537c9b
9 changed files with 87 additions and 75 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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++);

View File

@ -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",

View File

@ -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

View File

@ -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 */
@ -114,7 +117,7 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
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. */
@ -153,7 +156,8 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
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;
@ -169,9 +173,10 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
} }
++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;
@ -179,7 +184,8 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
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. */
@ -238,7 +244,8 @@ 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
@ -261,7 +268,8 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
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);
} }
@ -283,11 +291,13 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
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;
} }
} }
@ -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);
} }

View File

@ -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),

View File

@ -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);
} }