diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-06-27 17:51:32 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-06-27 17:51:32 -0600 |
commit | ecdeb1753ab553b2081217fbac9dfd04d0620469 (patch) | |
tree | 07971b493bebcfb847c2de1f4cbecd78b43191b7 /nuttx/net/utils/utils.h | |
parent | 2829ffe832cb656645f8eb3378ace9d402dce2ff (diff) | |
download | px4-nuttx-ecdeb1753ab553b2081217fbac9dfd04d0620469.tar.gz px4-nuttx-ecdeb1753ab553b2081217fbac9dfd04d0620469.tar.bz2 px4-nuttx-ecdeb1753ab553b2081217fbac9dfd04d0620469.zip |
Clean-up naming associated with network checksums
Diffstat (limited to 'nuttx/net/utils/utils.h')
-rw-r--r-- | nuttx/net/utils/utils.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/nuttx/net/utils/utils.h b/nuttx/net/utils/utils.h index 10c386edf..1ccd0aedc 100644 --- a/nuttx/net/utils/utils.h +++ b/nuttx/net/utils/utils.h @@ -87,6 +87,49 @@ extern "C" struct timeval; void net_dsec2timeval(uint16_t dsec, FAR struct timeval *tv); +/**************************************************************************** + * Name: tcp_chksum + * + * Description: + * Calculate the TCP checksum of the packet in d_buf and d_appdata. + * + * The TCP checksum is the Internet checksum of data contents of the + * TCP segment, and a pseudo-header as defined in RFC793. + * + * Note: The d_appdata pointer that points to the packet data may + * point anywhere in memory, so it is not possible to simply calculate + * the Internet checksum of the contents of the d_buf buffer. + * + * Returned Value: + * The TCP checksum of the TCP segment in d_buf and pointed to by + * d_appdata. + * + ****************************************************************************/ + +uint16_t tcp_chksum(FAR struct net_driver_s *dev); + +/**************************************************************************** + * Name: udp_chksum + * + * Description: + * Calculate the UDP checksum of the packet in d_buf and d_appdata. + * + ****************************************************************************/ + +#ifdef CONFIG_NET_UDP_CHECKSUMS +uint16_t udp_chksum(FAR struct net_driver_s *dev); +#endif + +/**************************************************************************** + * Name: icmp_chksum + * + * Description: + * Calculate the checksum of the ICMP message + * + ****************************************************************************/ + +uint16_t icmp_chksum(FAR struct net_driver_s *dev, int len); + #undef EXTERN #ifdef __cplusplus } |