in.h

来自「此工具是arm-linux-GCC交叉编译工具(cross-3.4.4)」· C头文件 代码 · 共 513 行 · 第 1/2 页

H
513
字号
    /* IP address of source.  */    struct in_addr imr_interface;    /* IP address of interface.  */    struct in_addr imr_sourceaddr;  };/* Likewise, for IPv6.  */struct ipv6_mreq  {    /* IPv6 multicast address of group */    struct in6_addr ipv6mr_multiaddr;    /* local interface */    unsigned int ipv6mr_interface;  };/* Multicast group request.  */struct group_req  {    /* Interface index.  */    uint32_t gr_interface;    /* Group address.  */    struct sockaddr_storage gr_group;  };struct group_source_req  {    /* Interface index.  */    uint32_t gsr_interface;    /* Group address.  */    struct sockaddr_storage gsr_group;    /* Source address.  */    struct sockaddr_storage gsr_source;  };/* Full-state filter operations.  */struct ip_msfilter  {    /* IP multicast address of group.  */    struct in_addr imsf_multiaddr;    /* Local IP address of interface.  */    struct in_addr imsf_interface;    /* Filter mode.  */    uint32_t imsf_fmode;    /* Number of source addresses.  */    uint32_t imsf_numsrc;    /* Source addresses.  */    struct in_addr imsf_slist[1];  };#define IP_MSFILTER_SIZE(numsrc) (sizeof (struct ip_msfilter) \				  - sizeof (struct in_addr)		      \				  + (numsrc) * sizeof (struct in_addr))struct group_filter  {    /* Interface index.  */    uint32_t gf_interface;    /* Group address.  */    struct sockaddr_storage gf_group;    /* Filter mode.  */    uint32_t gf_fmode;    /* Number of source addresses.  */    uint32_t gf_numsrc;    /* Source addresses.  */    struct sockaddr_storage gf_slist[1];};#define GROUP_FILTER_SIZE(numsrc) (sizeof (struct group_filter) \				   - sizeof (struct sockaddr_storage)	      \				   + ((numsrc)				      \				      * sizeof (struct sockaddr_storage)))/* Get system-specific definitions.  */#include <bits/in.h>/* Functions to convert between host and network byte order.   Please note that these functions normally take `unsigned long int' or   `unsigned short int' values as arguments and also return them.  But   this was a short-sighted decision since on different systems the types   may have different representations but the values are always the same.  */extern uint32_t ntohl (uint32_t __netlong) __THROW __attribute__ ((__const__));extern uint16_t ntohs (uint16_t __netshort)     __THROW __attribute__ ((__const__));extern uint32_t htonl (uint32_t __hostlong)     __THROW __attribute__ ((__const__));extern uint16_t htons (uint16_t __hostshort)     __THROW __attribute__ ((__const__));#include <endian.h>/* Get machine dependent optimized versions of byte swapping functions.  */#include <bits/byteswap.h>#ifdef __OPTIMIZE__/* We can optimize calls to the conversion functions.  Either nothing has   to be done or we are using directly the byte-swapping functions which   often can be inlined.  */# if __BYTE_ORDER == __BIG_ENDIAN/* The host byte order is the same as network byte order,   so these functions are all just identity.  */# define ntohl(x)	(x)# define ntohs(x)	(x)# define htonl(x)	(x)# define htons(x)	(x)# else#  if __BYTE_ORDER == __LITTLE_ENDIAN#   define ntohl(x)	__bswap_32 (x)#   define ntohs(x)	__bswap_16 (x)#   define htonl(x)	__bswap_32 (x)#   define htons(x)	__bswap_16 (x)#  endif# endif#endif#define IN6_IS_ADDR_UNSPECIFIED(a) \	(((__const uint32_t *) (a))[0] == 0				      \	 && ((__const uint32_t *) (a))[1] == 0				      \	 && ((__const uint32_t *) (a))[2] == 0				      \	 && ((__const uint32_t *) (a))[3] == 0)#define IN6_IS_ADDR_LOOPBACK(a) \	(((__const uint32_t *) (a))[0] == 0				      \	 && ((__const uint32_t *) (a))[1] == 0				      \	 && ((__const uint32_t *) (a))[2] == 0				      \	 && ((__const uint32_t *) (a))[3] == htonl (1))#define IN6_IS_ADDR_MULTICAST(a) (((__const uint8_t *) (a))[0] == 0xff)#define IN6_IS_ADDR_LINKLOCAL(a) \	((((__const uint32_t *) (a))[0] & htonl (0xffc00000))		      \	 == htonl (0xfe800000))#define IN6_IS_ADDR_SITELOCAL(a) \	((((__const uint32_t *) (a))[0] & htonl (0xffc00000))		      \	 == htonl (0xfec00000))#define IN6_IS_ADDR_V4MAPPED(a) \	((((__const uint32_t *) (a))[0] == 0)				      \	 && (((__const uint32_t *) (a))[1] == 0)			      \	 && (((__const uint32_t *) (a))[2] == htonl (0xffff)))#define IN6_IS_ADDR_V4COMPAT(a) \	((((__const uint32_t *) (a))[0] == 0)				      \	 && (((__const uint32_t *) (a))[1] == 0)			      \	 && (((__const uint32_t *) (a))[2] == 0)			      \	 && (ntohl (((__const uint32_t *) (a))[3]) > 1))#define IN6_ARE_ADDR_EQUAL(a,b) \	((((__const uint32_t *) (a))[0] == ((__const uint32_t *) (b))[0])     \	 && (((__const uint32_t *) (a))[1] == ((__const uint32_t *) (b))[1])  \	 && (((__const uint32_t *) (a))[2] == ((__const uint32_t *) (b))[2])  \	 && (((__const uint32_t *) (a))[3] == ((__const uint32_t *) (b))[3]))/* Bind socket to a privileged IP port.  */extern int bindresvport (int __sockfd, struct sockaddr_in *__sock_in) __THROW;/* The IPv6 version of this function.  */extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in)     __THROW;#define IN6_IS_ADDR_MC_NODELOCAL(a) \	(IN6_IS_ADDR_MULTICAST(a)					      \	 && ((((__const uint8_t *) (a))[1] & 0xf) == 0x1))#define IN6_IS_ADDR_MC_LINKLOCAL(a) \	(IN6_IS_ADDR_MULTICAST(a)					      \	 && ((((__const uint8_t *) (a))[1] & 0xf) == 0x2))#define IN6_IS_ADDR_MC_SITELOCAL(a) \	(IN6_IS_ADDR_MULTICAST(a)					      \	 && ((((__const uint8_t *) (a))[1] & 0xf) == 0x5))#define IN6_IS_ADDR_MC_ORGLOCAL(a) \	(IN6_IS_ADDR_MULTICAST(a)					      \	 && ((((__const uint8_t *) (a))[1] & 0xf) == 0x8))#define IN6_IS_ADDR_MC_GLOBAL(a) \	(IN6_IS_ADDR_MULTICAST(a)					      \	 && ((((__const uint8_t *) (a))[1] & 0xf) == 0xe))/* IPv6 packet information.  */struct in6_pktinfo  {    struct in6_addr	ipi6_addr;    /* src/dst IPv6 address */    unsigned int	ipi6_ifindex; /* send/recv interface index */  };#ifdef __USE_GNU/* Hop-by-Hop and Destination Options Processing.  */extern int inet6_option_space (int __nbytes) __THROW;extern int inet6_option_init (void *__bp, struct cmsghdr **__cmsgp,			      int __type) __THROW;extern int inet6_option_append (struct cmsghdr *__cmsg,				__const uint8_t *__typep, int __multx,				int __plusy) __THROW;extern uint8_t *inet6_option_alloc (struct cmsghdr *__cmsg, int __datalen,				    int __multx, int __plusy) __THROW;extern int inet6_option_next (__const struct cmsghdr *__cmsg,			      uint8_t **__tptrp) __THROW;extern int inet6_option_find (__const struct cmsghdr *__cmsg,			      uint8_t **__tptrp, int __type) __THROW;/* Multicast source filter support.  *//* Get IPv4 source filter.  */extern int getipv4sourcefilter (int __s, struct in_addr __interface_addr,				struct in_addr __group, uint32_t *__fmode,				uint32_t *__numsrc, struct in_addr *__slist)     __THROW;/* Set IPv4 source filter.  */extern int setipv4sourcefilter (int __s, struct in_addr __interface_addr,				struct in_addr __group, uint32_t __fmode,				uint32_t __numsrc,				__const struct in_addr *__slist)     __THROW;/* Get source filter.  */extern int getsourcefilter (int __s, uint32_t __interface_addr,			    __const struct sockaddr *__group,			    socklen_t __grouplen, uint32_t *__fmode,			    uint32_t *__numsrc,			    struct sockaddr_storage *__slist) __THROW;/* Set source filter.  */extern int setsourcefilter (int __s, uint32_t __interface_addr,			    __const struct sockaddr *__group,			    socklen_t __grouplen, uint32_t __fmode,			    uint32_t __numsrc,			    __const struct sockaddr_storage *__slist) __THROW;#endif	/* use GNU */__END_DECLS#endif	/* netinet/in.h */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?