mirror of
https://github.com/apache/nuttx.git
synced 2026-06-08 10:32:47 +08:00
net: extract l3 header build code into new functions
Signed-off-by: liyi <liyi25@xiaomi.com>
This commit is contained in:
@@ -88,6 +88,7 @@
|
||||
#ifdef CONFIG_NET_IPv4
|
||||
# define IPv4_HDRLEN 20 /* Size of IPv4 header (without options) */
|
||||
# define IPv4_HLMASK 0x0f /* Isolates headler length in VHL field */
|
||||
# define IPV4_OPTMAX 40 /* The limit of ip option length */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
@@ -164,6 +165,14 @@ struct ipv4_hdr_s
|
||||
uint16_t srcipaddr[2]; /* 32-bit Source IP address */
|
||||
uint16_t destipaddr[2]; /* 32-bit Destination IP address */
|
||||
};
|
||||
|
||||
/* The IPv4 options */
|
||||
|
||||
struct ipv4_opt_s
|
||||
{
|
||||
uint8_t len;
|
||||
uint8_t data[IPV4_OPTMAX];
|
||||
};
|
||||
#endif /* CONFIG_NET_IPv4 */
|
||||
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
|
||||
@@ -668,27 +668,6 @@ uint16_t net_chksum(FAR uint16_t *data, uint16_t len);
|
||||
|
||||
void net_incr32(FAR uint8_t *op32, uint16_t op16);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ipv4_chksum
|
||||
*
|
||||
* Description:
|
||||
* Calculate the IPv4 header checksum of the packet header in d_buf.
|
||||
*
|
||||
* The IPv4 header checksum is the Internet checksum of the 20 bytes of
|
||||
* the IPv4 header.
|
||||
*
|
||||
* If CONFIG_NET_ARCH_CHKSUM is defined, then this function must be
|
||||
* provided by architecture-specific logic.
|
||||
*
|
||||
* Returned Value:
|
||||
* The IPv4 header checksum of the IPv4 header in the d_buf buffer.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_IPv4
|
||||
uint16_t ipv4_chksum(FAR struct net_driver_s *dev);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: netdev_ipv4_hdrlen
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user