diff options
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 } |