/[lwip]/lwip/src/core/tcp_out.c
ViewVC logotype

Diff of /lwip/src/core/tcp_out.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.27 by likewise, Wed Jun 11 22:34:51 2003 UTC revision 1.27.2.1 by marcbou, Thu Jun 19 14:26:22 2003 UTC
# Line 249  tcp_enqueue(struct tcp_pcb *pcb, void *a Line 249  tcp_enqueue(struct tcp_pcb *pcb, void *a
249    
250      /* Copy the options into the header, if they are present. */      /* Copy the options into the header, if they are present. */
251      if (optdata == NULL) {      if (optdata == NULL) {
252        TCPH_OFFSET_SET(seg->tcphdr, 5 << 4);        TCPH_HDRLEN_SET(seg->tcphdr, 5);
253      }      }
254      else {      else {
255        TCPH_OFFSET_SET(seg->tcphdr, (5 + optlen / 4) << 4);        TCPH_HDRLEN_SET(seg->tcphdr, (5 + optlen / 4));
256        /* Copy options into data portion of segment.        /* Copy options into data portion of segment.
257         Options can thus only be sent in non data carrying         Options can thus only be sent in non data carrying
258         segments such as SYN|ACK. */         segments such as SYN|ACK. */
# Line 327  tcp_enqueue(struct tcp_pcb *pcb, void *a Line 327  tcp_enqueue(struct tcp_pcb *pcb, void *a
327    /* 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
328    if the segment has data (indicated by seglen > 0). */    if the segment has data (indicated by seglen > 0). */
329    if (seg != NULL && seglen > 0 && seg->tcphdr != NULL) {    if (seg != NULL && seglen > 0 && seg->tcphdr != NULL) {
330      TCPH_FLAGS_SET(seg->tcphdr, TCPH_FLAGS(seg->tcphdr) | TCP_PSH);      TCPH_SET_FLAG(seg->tcphdr, TCP_PSH);
331    }    }
332    
333    return ERR_OK;    return ERR_OK;
# Line 372  tcp_output(struct tcp_pcb *pcb) Line 372  tcp_output(struct tcp_pcb *pcb)
372    
373    
374    seg = pcb->unsent;    seg = pcb->unsent;
375       useg = pcb->unacked;
376      
377    /* If the TF_ACK_NOW flag is set, we check if there is data that is    /* If the TF_ACK_NOW flag is set, we check if there is data that is
378       to be sent. If data is to be sent out, we'll just piggyback our       to be sent. If data is to be sent out, we'll just piggyback our
379       acknowledgement with the outgoing segment. If no data will be       acknowledgement with the outgoing segment. If no data will be
# Line 398  tcp_output(struct tcp_pcb *pcb) Line 399  tcp_output(struct tcp_pcb *pcb)
399      TCPH_FLAGS_SET(tcphdr, TCP_ACK);      TCPH_FLAGS_SET(tcphdr, TCP_ACK);
400      tcphdr->wnd = htons(pcb->rcv_wnd);      tcphdr->wnd = htons(pcb->rcv_wnd);
401      tcphdr->urgp = 0;      tcphdr->urgp = 0;
402      TCPH_OFFSET_SET(tcphdr, 5 << 4);      TCPH_HDRLEN_SET(tcphdr, 5);
403    
404      tcphdr->chksum = 0;      tcphdr->chksum = 0;
405      tcphdr->chksum = inet_chksum_pseudo(p, &(pcb->local_ip), &(pcb->remote_ip),      tcphdr->chksum = inet_chksum_pseudo(p, &(pcb->local_ip), &(pcb->remote_ip),
# Line 443  tcp_output(struct tcp_pcb *pcb) Line 444  tcp_output(struct tcp_pcb *pcb)
444      pcb->unsent = seg->next;      pcb->unsent = seg->next;
445    
446      if (pcb->state != SYN_SENT) {      if (pcb->state != SYN_SENT) {
447        TCPH_FLAGS_SET(seg->tcphdr, TCPH_FLAGS(seg->tcphdr) | TCP_ACK);        TCPH_SET_FLAG(seg->tcphdr, TCP_ACK);
448        pcb->flags &= ~(TF_ACK_DELAY | TF_ACK_NOW);        pcb->flags &= ~(TF_ACK_DELAY | TF_ACK_NOW);
449      }      }
450    
# Line 457  tcp_output(struct tcp_pcb *pcb) Line 458  tcp_output(struct tcp_pcb *pcb)
458        seg->next = NULL;        seg->next = NULL;
459        if (pcb->unacked == NULL) {        if (pcb->unacked == NULL) {
460          pcb->unacked = seg;          pcb->unacked = seg;
461            useg = seg;
   
462        } else {        } else {
         for (useg = pcb->unacked; useg->next != NULL; useg = useg->next);  
463          useg->next = seg;          useg->next = seg;
464            useg = useg->next;
465        }        }
466      } else {      } else {
467        tcp_seg_free(seg);        tcp_seg_free(seg);
# Line 552  tcp_rst(u32_t seqno, u32_t ackno, Line 552  tcp_rst(u32_t seqno, u32_t ackno,
552    TCPH_FLAGS_SET(tcphdr, TCP_RST | TCP_ACK);    TCPH_FLAGS_SET(tcphdr, TCP_RST | TCP_ACK);
553    tcphdr->wnd = htons(TCP_WND);    tcphdr->wnd = htons(TCP_WND);
554    tcphdr->urgp = 0;    tcphdr->urgp = 0;
555    TCPH_OFFSET_SET(tcphdr, 5 << 4);    TCPH_HDRLEN_SET(tcphdr, 5);
556    
557    tcphdr->chksum = 0;    tcphdr->chksum = 0;
558    tcphdr->chksum = inet_chksum_pseudo(p, local_ip, remote_ip,    tcphdr->chksum = inet_chksum_pseudo(p, local_ip, remote_ip,

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.27.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26