summaryrefslogtreecommitdiff
path: root/include/net.h
diff options
context:
space:
mode:
authorJoe Hershberger <joe.hershberger@ni.com>2012-05-23 07:58:05 +0000
committerJoe Hershberger <joe.hershberger@ni.com>2012-05-23 17:46:14 -0500
commitc5c59df04d6bb394209936c2a2c2a3054ead9150 (patch)
tree166890b8221e53b6a11de975626b1e0c3fd4634e /include/net.h
parent594c26f8a7dbb83243a5168378a2164fa08d6dd8 (diff)
downloadu-boot-imx-c5c59df04d6bb394209936c2a2c2a3054ead9150.zip
u-boot-imx-c5c59df04d6bb394209936c2a2c2a3054ead9150.tar.gz
u-boot-imx-c5c59df04d6bb394209936c2a2c2a3054ead9150.tar.bz2
net: cosmetic: Split struct ip_udp_hdr into ip_hdr
Add a structure that only contains IP header fields to be used by functions that don't need UDP Rename IP_HDR_SIZE_NO_UDP to IP_HDR_SIZE Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'include/net.h')
-rw-r--r--include/net.h32
1 files changed, 24 insertions, 8 deletions
diff --git a/include/net.h b/include/net.h
index 3e4f304..7692153 100644
--- a/include/net.h
+++ b/include/net.h
@@ -194,9 +194,9 @@ typedef struct {
#define IPPROTO_UDP 17 /* User Datagram Protocol */
/*
- * Internet Protocol (IP) + UDP header.
+ * Internet Protocol (IP) header.
*/
-struct ip_udp_hdr {
+struct ip_hdr {
uchar ip_hl_v; /* header length and version */
uchar ip_tos; /* type of service */
ushort ip_len; /* total length */
@@ -207,10 +207,6 @@ struct ip_udp_hdr {
ushort ip_sum; /* checksum */
IPaddr_t ip_src; /* Source IP address */
IPaddr_t ip_dst; /* Destination IP address */
- ushort udp_src; /* UDP source port */
- ushort udp_dst; /* UDP destination port */
- ushort udp_len; /* Length of UDP packet */
- ushort udp_xsum; /* Checksum */
};
#define IP_OFFS 0x1fff /* ip offset *= 8 */
@@ -219,10 +215,30 @@ struct ip_udp_hdr {
#define IP_FLAGS_DFRAG 0x4000 /* don't fragments */
#define IP_FLAGS_MFRAG 0x2000 /* more fragments */
-#define IP_HDR_SIZE_NO_UDP (sizeof(struct ip_udp_hdr) - 8)
+#define IP_HDR_SIZE (sizeof(struct ip_hdr))
+
+/*
+ * Internet Protocol (IP) + UDP header.
+ */
+struct ip_udp_hdr {
+ uchar ip_hl_v; /* header length and version */
+ uchar ip_tos; /* type of service */
+ ushort ip_len; /* total length */
+ ushort ip_id; /* identification */
+ ushort ip_off; /* fragment offset field */
+ uchar ip_ttl; /* time to live */
+ uchar ip_p; /* protocol */
+ ushort ip_sum; /* checksum */
+ IPaddr_t ip_src; /* Source IP address */
+ IPaddr_t ip_dst; /* Destination IP address */
+ ushort udp_src; /* UDP source port */
+ ushort udp_dst; /* UDP destination port */
+ ushort udp_len; /* Length of UDP packet */
+ ushort udp_xsum; /* Checksum */
+};
#define IP_UDP_HDR_SIZE (sizeof(struct ip_udp_hdr))
-#define UDP_HDR_SIZE (IP_UDP_HDR_SIZE - IP_HDR_SIZE_NO_UDP)
+#define UDP_HDR_SIZE (IP_UDP_HDR_SIZE - IP_HDR_SIZE)
/*
* Address Resolution Protocol (ARP) header.