summaryrefslogtreecommitdiff
path: root/inet/netinet/ip.h
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2019-06-01 19:32:01 -0400
committerZack Weinberg <zackw@panix.com>2020-01-08 14:15:41 -0500
commit0e8caaf081a844893aa5bbf67010c3e34ca47f34 (patch)
tree0b0c25b99b9531f66d41cdb5821d850c70c14ce6 /inet/netinet/ip.h
parentb32c5f35b8fb037bd54cde10bb14e6510171534a (diff)
downloadglibc-0e8caaf081a844893aa5bbf67010c3e34ca47f34.tar.gz
Minimize includes of unrelated public headers by networking headers.
Stop including sys/param.h, sys/types.h, stdint.h, inttypes.h, stdio.h, and string.h from network-related headers. This is done separately from earlier patches because the network headers are extra messy, and are also more likely to contain quirks inherited verbatim from 4.xBSD than the bulk of our public headers. Rose and NetROM are based on AX.25 so it makes practical sense for netrose/rose.h and netrom/netrom.h to continue including netax25/ax25.h. The only copies of ip_icmp.h and udp.h in the source tree are moved from sysdeps/gnu to inet (after which there are no longer any netinet/ headers in sysdeps/gnu). Much as sys/un.h needs to duplicate the prototype for strlen, netinet/icmp6.h needs to duplicate the prototype for memset. I am open to better ideas on that front. * resolv/resolv.h: Include bits/types.h, bits/types/FILE.h, and bits/types/size_t.h; don’t include sys/param.h, sys/types.h, or stdio.h. Use __uint16_t and __uint32_t instead of uint16_t and uint32_t. * resolv/arpa/nameser.h: Include features.h, bits/types.h, and bits/types/size_t.h; don’t include sys/param.h, sys/types.h, or stdint.h. Use __uint16_t and __uint32_t instead of uint16_t and uint32_t. * resolv/arpa/nameser_compat.h: Include features.h. * sysdeps/mach/hurd/net/ethernet.h: Include bits/types.h; don’t include sys/types.h or stdint.h. Use __uint8_t and __uint16_t instead of uint8_t and uint16_t. * sysdeps/unix/sysv/linux/net/ethernet.h: Include features.h and bits/types.h; don’t include sys/types.h or stdint.h. Use __uint8_t and __uint16_t instead of uint8_t and uint16_t. * sysdeps/unix/sysv/linux/netinet/if_ether.h: Include features.h and bits/types.h. Use __uint8_t instead of uint8_t. * sysdeps/mach/hurd/net/if_arp.h: Don’t include sys/types.h or stdint.h. Use __uint32_t instead of uint32_t. * sysdeps/unix/sysv/linux/net/if_arp.h: Include features.h. Don’t include sys/types.h or stdint.h. Use __uint32_t instead of uint32_t. * sysdeps/mach/hurd/net/route.h: Don’t include sys/types.h. * sysdeps/unix/sysv/linux/net/route.h: Don’t include sys/types.h. * sysdeps/unix/sysv/linux/net/if_ppp.h: Include features.h and bits/types.h. Don’t include sys/types.h or stdint.h. Use __uint8_t and __uint32_t instead of uint8_t and uint32_t. * sysdeps/unix/sysv/linux/net/if_shaper.h: Include features.h and bits/types.h. Don’t include sys/types.h or stdint.h. Use __uint16_t and __uint32_t instead of uint16_t and uint32_t. * sysdeps/unix/sysv/linux/netatalk/at.h: Include features.h, bits/types.h, and sys/ioctl.h. Don’t include asm/types.h or linux/atalk.h. Copy over all user-appropriate definitions from linux/atalk.h with adjustments for glibc context. * grp/initgroups.c, nscd/initgrcache.c, nss/nss_db/db-XXX.c * resolv/ns_print.c, resolv/tst-ns_name_compress.c * resolv/tst-res_hnok.c, support/resolv_test.c: Include stdio.h. * nscd/initgrcache.c, nscd/netgroupcache.c * nss/nss_compat/compat-grp.c, nss/nss_compat/compat-pwd.c * nss/nss_compat/compat-spwd.c, resolv/ns_print.c: Include sys/param.h for MIN and/or MAX. * resolv/tst-resolv-res_init-skeleton.c: Include signal.h. * inet/protocols/rwhod.h: Include features.h and bits/types.h. Don’t include sys/types.h. Use __int32_t instead of int32_t. * inet/protocols/talkd.h: Include features.h and bits/types.h. Don’t include sys/types.h, sys/socket.h, or stdint.h. Use __int32_t and __uint32_t instead of int32_t and uint32_t. * inet/protocols/timed.h: Include features.h, bits/types.h, and bits/types/struct_timeval.h. Don’t include sys/types.h or sys/time.h. * sysdeps/unix/sysv/linux/netipx/ipx.h: Include features.h and bits/types.h. Don’t include sys/types.h or stdint.h. Use __uint16_t and __uint32_t instead of uint16_t and uint32_t. * sysdeps/unix/sysv/linux/netrose/rose.h: Include features.h. Don’t include sys/socket.h. * inet/netinet/icmp6.h: Include features.h, bits/endian.h, bits/types.h, and bits/types/size_t.h. Don’t include inttypes.h, string.h, or sys/types.h. Duplicate prototype of memset here. Use __uintN_t instead of uintN_t types. * inet/netinet/igmp.h: Include bits/types.h. Don’t include sys/types.h. Use __uintN_t instead of uintN_t types. * inet/netinet/ip.h: Include bits/types.h. Don’t include bits/stdint-uintn.h. Use __uintN_t instead of uintN_t types. * inet/netinet/ip6.h: Include features.h, bits/endian.h, and bits/types.h. Don’t include inttypes.h. Use __uintN_t instead of uintN_t types. * inet/netinet/ip_icmp.h: Include features.h and bits/types.h. Don’t include sys/types.h or stdint.h. Use __uintN_t instead of uintN_t types. * inet/netinet/udp.h: Likewise. * sysdeps/generic/netinet/if_ether.h: Likewise. * sysdeps/unix/sysv/linux/netinet/if_ether.h: Likewise. * sysdeps/unix/sysv/linux/netinet/if_fddi.h: Likewise. * sysdeps/unix/sysv/linux/netinet/if_tr.h: Likewise. * sysdeps/gnu/netinet/ip_icmp.h: Move to inet/netinet/ip_icmp.h. * sysdeps/gnu/netinet/udp.h: Move to inet/netinet/udp.h. * include/netinet/ip_icmp.h, include/netinet/udp.h: New wrappers. * sysdeps/gnu/Makefile: Remove $(subdir)==inet stanza. * inet/Makefile (headers): Add netinet/ip_icmp.h and netinet/udp.h. Don’t use $(wildcard *.h) for arpa and protocols headers. Sort list. * scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES, SYSDEP_ALLOWED_INCLUDES): Update.
Diffstat (limited to 'inet/netinet/ip.h')
-rw-r--r--inet/netinet/ip.h40
1 files changed, 20 insertions, 20 deletions
diff --git a/inet/netinet/ip.h b/inet/netinet/ip.h
index 8dd7f6a40e..9184b34f20 100644
--- a/inet/netinet/ip.h
+++ b/inet/netinet/ip.h
@@ -22,14 +22,14 @@
#include <netinet/in.h>
#include <bits/endian.h>
-#include <bits/stdint-uintn.h>
+#include <bits/types.h>
__BEGIN_DECLS
struct timestamp
{
- uint8_t len;
- uint8_t ptr;
+ __uint8_t len;
+ __uint8_t ptr;
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned int flags:4;
unsigned int overflow:4;
@@ -39,7 +39,7 @@ struct timestamp
#else
# error "Please fix <bits/endian.h>"
#endif
- uint32_t data[9];
+ __uint32_t data[9];
};
struct iphdr
@@ -53,15 +53,15 @@ struct iphdr
#else
# error "Please fix <bits/endian.h>"
#endif
- uint8_t tos;
- uint16_t tot_len;
- uint16_t id;
- uint16_t frag_off;
- uint8_t ttl;
- uint8_t protocol;
- uint16_t check;
- uint32_t saddr;
- uint32_t daddr;
+ __uint8_t tos;
+ __uint16_t tot_len;
+ __uint16_t id;
+ __uint16_t frag_off;
+ __uint8_t ttl;
+ __uint8_t protocol;
+ __uint16_t check;
+ __uint32_t saddr;
+ __uint32_t daddr;
/*The options start here. */
};
@@ -115,7 +115,7 @@ struct ip
unsigned int ip_v:4; /* version */
unsigned int ip_hl:4; /* header length */
#endif
- uint8_t ip_tos; /* type of service */
+ __uint8_t ip_tos; /* type of service */
unsigned short ip_len; /* total length */
unsigned short ip_id; /* identification */
unsigned short ip_off; /* fragment offset field */
@@ -123,8 +123,8 @@ struct ip
#define IP_DF 0x4000 /* dont fragment flag */
#define IP_MF 0x2000 /* more fragments flag */
#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
- uint8_t ip_ttl; /* time to live */
- uint8_t ip_p; /* protocol */
+ __uint8_t ip_ttl; /* time to live */
+ __uint8_t ip_p; /* protocol */
unsigned short ip_sum; /* checksum */
struct in_addr ip_src, ip_dst; /* source and dest address */
};
@@ -134,9 +134,9 @@ struct ip
*/
struct ip_timestamp
{
- uint8_t ipt_code; /* IPOPT_TS */
- uint8_t ipt_len; /* size of structure (variable) */
- uint8_t ipt_ptr; /* index of current entry */
+ __uint8_t ipt_code; /* IPOPT_TS */
+ __uint8_t ipt_len; /* size of structure (variable) */
+ __uint8_t ipt_ptr; /* index of current entry */
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned int ipt_flg:4; /* flags, see below */
unsigned int ipt_oflw:4; /* overflow counter */
@@ -145,7 +145,7 @@ struct ip_timestamp
unsigned int ipt_oflw:4; /* overflow counter */
unsigned int ipt_flg:4; /* flags, see below */
#endif
- uint32_t data[9];
+ __uint32_t data[9];
};
#endif /* __USE_MISC */