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

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

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

revision 1.30 by likewise, Wed Jun 11 22:34:51 2003 UTC revision 1.30.2.1 by marcbou, Thu Jun 19 14:26:22 2003 UTC
# Line 99  tcp_input(struct pbuf *p, struct netif * Line 99  tcp_input(struct pbuf *p, struct netif *
99  {  {
100    struct tcp_pcb *pcb, *prev;    struct tcp_pcb *pcb, *prev;
101    struct tcp_pcb_listen *lpcb;    struct tcp_pcb_listen *lpcb;
102    u8_t offset;    u8_t hdrlen;
103    err_t err;    err_t err;
104    
105    
# Line 113  tcp_input(struct pbuf *p, struct netif * Line 113  tcp_input(struct pbuf *p, struct netif *
113    iphdr = p->payload;    iphdr = p->payload;
114    tcphdr = (struct tcp_hdr *)((u8_t *)p->payload + IPH_HL(iphdr) * 4);    tcphdr = (struct tcp_hdr *)((u8_t *)p->payload + IPH_HL(iphdr) * 4);
115    
116    #if TCP_INPUT_DEBUG
117      tcp_debug_print(tcphdr);
118    #endif
119    
120    /* remove header from payload */    /* remove header from payload */
121    if (pbuf_header(p, -((s16_t)(IPH_HL(iphdr) * 4))) || (p->tot_len < sizeof(struct tcp_hdr))) {    if (pbuf_header(p, -((s16_t)(IPH_HL(iphdr) * 4))) || (p->tot_len < sizeof(struct tcp_hdr))) {
122      /* drop short packets */      /* drop short packets */
# Line 154  tcp_input(struct pbuf *p, struct netif * Line 158  tcp_input(struct pbuf *p, struct netif *
158    
159    /* Move the payload pointer in the pbuf so that it points to the    /* Move the payload pointer in the pbuf so that it points to the
160       TCP data instead of the TCP header. */       TCP data instead of the TCP header. */
161    offset = TCPH_OFFSET(tcphdr) >> 4;    hdrlen = TCPH_HDRLEN(tcphdr);
162    pbuf_header(p, -(offset * 4));    pbuf_header(p, -(hdrlen * 4));
163    
164    /* Convert fields in TCP header to host byte order. */    /* Convert fields in TCP header to host byte order. */
165    tcphdr->src = ntohs(tcphdr->src);    tcphdr->src = ntohs(tcphdr->src);
# Line 934  tcp_receive(struct tcp_pcb *pcb) Line 938  tcp_receive(struct tcp_pcb *pcb)
938      inseg.p = NULL;      inseg.p = NULL;
939    }    }
940    if (TCPH_FLAGS(inseg.tcphdr) & TCP_FIN) {    if (TCPH_FLAGS(inseg.tcphdr) & TCP_FIN) {
941      LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_receive: received FIN."));      LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_receive: received FIN.\n"));
942      recv_flags = TF_GOT_FIN;      recv_flags = TF_GOT_FIN;
943    }    }
944    
# Line 965  tcp_receive(struct tcp_pcb *pcb) Line 969  tcp_receive(struct tcp_pcb *pcb)
969        cseg->p = NULL;        cseg->p = NULL;
970      }      }
971      if (flags & TCP_FIN) {      if (flags & TCP_FIN) {
972        LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_receive: dequeued FIN."));        LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_receive: dequeued FIN.\n"));
973        recv_flags = TF_GOT_FIN;        recv_flags = TF_GOT_FIN;
974      }      }
975    
# Line 1122  tcp_parseopt(struct tcp_pcb *pcb) Line 1126  tcp_parseopt(struct tcp_pcb *pcb)
1126    opts = (u8_t *)tcphdr + TCP_HLEN;    opts = (u8_t *)tcphdr + TCP_HLEN;
1127    
1128    /* Parse the TCP MSS option, if present. */    /* Parse the TCP MSS option, if present. */
1129    if ((TCPH_OFFSET(tcphdr) & 0xf0) > 0x50) {    if(TCPH_HDRLEN(tcphdr) > 0x5) {
1130      for(c = 0; c < ((TCPH_OFFSET(tcphdr) >> 4) - 5) << 2 ;) {      for(c = 0; c < (TCPH_HDRLEN(tcphdr) - 5) << 2 ;) {
1131        opt = opts[c];        opt = opts[c];
1132        if (opt == 0x00) {        if (opt == 0x00) {
1133          /* End of options. */          /* End of options. */

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.30.2.1

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