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

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

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

revision 1.5 by likewise, Mon Jun 9 21:14:47 2003 UTC revision 1.5.2.1 by likewise, Fri Nov 14 09:42:51 2003 UTC
# Line 30  Line 30 
30   *   *
31   */   */
32    
33  /*-----------------------------------------------------------------------------------*/  
34  /* inet6.c  /* inet6.c
35   *   *
36   * Functions common to all TCP/IP modules, such as the Internet checksum and the   * Functions common to all TCP/IP modules, such as the Internet checksum and the
37   * byte order functions.   * byte order functions.
38   *   *
39   */   */
40  /*-----------------------------------------------------------------------------------*/  
41    
42  #include "lwip/opt.h"  #include "lwip/opt.h"
43    
# Line 45  Line 45 
45  #include "lwip/inet.h"  #include "lwip/inet.h"
46    
47    
48  /*-----------------------------------------------------------------------------------*/  
49  /* chksum:  /* chksum:
50   *   *
51   * Sums up all 16 bit words in a memory portion. Also includes any odd byte.   * Sums up all 16 bit words in a memory portion. Also includes any odd byte.
# Line 54  Line 54 
54   * For now, this is not optimized. Must be optimized for the particular processor   * For now, this is not optimized. Must be optimized for the particular processor
55   * arcitecture on which it is to run. Preferebly coded in assembler.   * arcitecture on which it is to run. Preferebly coded in assembler.
56   */   */
57  /*-----------------------------------------------------------------------------------*/  
58  static u32_t  static u32_t
59  chksum(void *dataptr, u16_t len)  chksum(void *dataptr, u16_t len)
60  {  {
# Line 74  chksum(void *dataptr, u16_t len) Line 74  chksum(void *dataptr, u16_t len)
74    return acc;    return acc;
75    
76  }  }
77  /*-----------------------------------------------------------------------------------*/  
78  /* inet_chksum_pseudo:  /* inet_chksum_pseudo:
79   *   *
80   * Calculates the pseudo Internet checksum used by TCP and UDP for a pbuf chain.   * Calculates the pseudo Internet checksum used by TCP and UDP for a pbuf chain.
81   */   */
82  /*-----------------------------------------------------------------------------------*/  
83  u16_t  u16_t
84  inet_chksum_pseudo(struct pbuf *p,  inet_chksum_pseudo(struct pbuf *p,
85         struct ip_addr *src, struct ip_addr *dest,         struct ip_addr *src, struct ip_addr *dest,
# Line 122  inet_chksum_pseudo(struct pbuf *p, Line 122  inet_chksum_pseudo(struct pbuf *p,
122    }    }
123    return ~(acc & 0xffff);    return ~(acc & 0xffff);
124  }  }
125  /*-----------------------------------------------------------------------------------*/  
126  /* inet_chksum:  /* inet_chksum:
127   *   *
128   * Calculates the Internet checksum over a portion of memory. Used primarely for IP   * Calculates the Internet checksum over a portion of memory. Used primarely for IP
129   * and ICMP.   * and ICMP.
130   */   */
131  /*-----------------------------------------------------------------------------------*/  
132  u16_t  u16_t
133  inet_chksum(void *dataptr, u16_t len)  inet_chksum(void *dataptr, u16_t len)
134  {  {
# Line 139  inet_chksum(void *dataptr, u16_t len) Line 139  inet_chksum(void *dataptr, u16_t len)
139    sum += (sum >> 16);    sum += (sum >> 16);
140    return ~(sum & 0xffff);    return ~(sum & 0xffff);
141  }  }
142  /*-----------------------------------------------------------------------------------*/  
143  u16_t  u16_t
144  inet_chksum_pbuf(struct pbuf *p)  inet_chksum_pbuf(struct pbuf *p)
145  {  {
# Line 165  inet_chksum_pbuf(struct pbuf *p) Line 165  inet_chksum_pbuf(struct pbuf *p)
165    }    }
166    return ~(acc & 0xffff);    return ~(acc & 0xffff);
167  }  }
168  /*-----------------------------------------------------------------------------------*/  

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.5.2.1

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