Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include/netinet
File: in.h
/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
[0] Fix | Delete
This file is part of the GNU C Library.
[1] Fix | Delete
[2] Fix | Delete
The GNU C Library is free software; you can redistribute it and/or
[3] Fix | Delete
modify it under the terms of the GNU Lesser General Public
[4] Fix | Delete
License as published by the Free Software Foundation; either
[5] Fix | Delete
version 2.1 of the License, or (at your option) any later version.
[6] Fix | Delete
[7] Fix | Delete
The GNU C Library is distributed in the hope that it will be useful,
[8] Fix | Delete
but WITHOUT ANY WARRANTY; without even the implied warranty of
[9] Fix | Delete
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
[10] Fix | Delete
Lesser General Public License for more details.
[11] Fix | Delete
[12] Fix | Delete
You should have received a copy of the GNU Lesser General Public
[13] Fix | Delete
License along with the GNU C Library; if not, see
[14] Fix | Delete
<http://www.gnu.org/licenses/>. */
[15] Fix | Delete
[16] Fix | Delete
#ifndef _NETINET_IN_H
[17] Fix | Delete
#define _NETINET_IN_H 1
[18] Fix | Delete
[19] Fix | Delete
#include <features.h>
[20] Fix | Delete
#include <bits/stdint-uintn.h>
[21] Fix | Delete
#include <sys/socket.h>
[22] Fix | Delete
#include <bits/types.h>
[23] Fix | Delete
[24] Fix | Delete
[25] Fix | Delete
__BEGIN_DECLS
[26] Fix | Delete
[27] Fix | Delete
/* Internet address. */
[28] Fix | Delete
typedef uint32_t in_addr_t;
[29] Fix | Delete
struct in_addr
[30] Fix | Delete
{
[31] Fix | Delete
in_addr_t s_addr;
[32] Fix | Delete
};
[33] Fix | Delete
[34] Fix | Delete
/* Get system-specific definitions. */
[35] Fix | Delete
#include <bits/in.h>
[36] Fix | Delete
[37] Fix | Delete
/* Standard well-defined IP protocols. */
[38] Fix | Delete
enum
[39] Fix | Delete
{
[40] Fix | Delete
IPPROTO_IP = 0, /* Dummy protocol for TCP. */
[41] Fix | Delete
#define IPPROTO_IP IPPROTO_IP
[42] Fix | Delete
IPPROTO_ICMP = 1, /* Internet Control Message Protocol. */
[43] Fix | Delete
#define IPPROTO_ICMP IPPROTO_ICMP
[44] Fix | Delete
IPPROTO_IGMP = 2, /* Internet Group Management Protocol. */
[45] Fix | Delete
#define IPPROTO_IGMP IPPROTO_IGMP
[46] Fix | Delete
IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94). */
[47] Fix | Delete
#define IPPROTO_IPIP IPPROTO_IPIP
[48] Fix | Delete
IPPROTO_TCP = 6, /* Transmission Control Protocol. */
[49] Fix | Delete
#define IPPROTO_TCP IPPROTO_TCP
[50] Fix | Delete
IPPROTO_EGP = 8, /* Exterior Gateway Protocol. */
[51] Fix | Delete
#define IPPROTO_EGP IPPROTO_EGP
[52] Fix | Delete
IPPROTO_PUP = 12, /* PUP protocol. */
[53] Fix | Delete
#define IPPROTO_PUP IPPROTO_PUP
[54] Fix | Delete
IPPROTO_UDP = 17, /* User Datagram Protocol. */
[55] Fix | Delete
#define IPPROTO_UDP IPPROTO_UDP
[56] Fix | Delete
IPPROTO_IDP = 22, /* XNS IDP protocol. */
[57] Fix | Delete
#define IPPROTO_IDP IPPROTO_IDP
[58] Fix | Delete
IPPROTO_TP = 29, /* SO Transport Protocol Class 4. */
[59] Fix | Delete
#define IPPROTO_TP IPPROTO_TP
[60] Fix | Delete
IPPROTO_DCCP = 33, /* Datagram Congestion Control Protocol. */
[61] Fix | Delete
#define IPPROTO_DCCP IPPROTO_DCCP
[62] Fix | Delete
IPPROTO_IPV6 = 41, /* IPv6 header. */
[63] Fix | Delete
#define IPPROTO_IPV6 IPPROTO_IPV6
[64] Fix | Delete
IPPROTO_RSVP = 46, /* Reservation Protocol. */
[65] Fix | Delete
#define IPPROTO_RSVP IPPROTO_RSVP
[66] Fix | Delete
IPPROTO_GRE = 47, /* General Routing Encapsulation. */
[67] Fix | Delete
#define IPPROTO_GRE IPPROTO_GRE
[68] Fix | Delete
IPPROTO_ESP = 50, /* encapsulating security payload. */
[69] Fix | Delete
#define IPPROTO_ESP IPPROTO_ESP
[70] Fix | Delete
IPPROTO_AH = 51, /* authentication header. */
[71] Fix | Delete
#define IPPROTO_AH IPPROTO_AH
[72] Fix | Delete
IPPROTO_MTP = 92, /* Multicast Transport Protocol. */
[73] Fix | Delete
#define IPPROTO_MTP IPPROTO_MTP
[74] Fix | Delete
IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET. */
[75] Fix | Delete
#define IPPROTO_BEETPH IPPROTO_BEETPH
[76] Fix | Delete
IPPROTO_ENCAP = 98, /* Encapsulation Header. */
[77] Fix | Delete
#define IPPROTO_ENCAP IPPROTO_ENCAP
[78] Fix | Delete
IPPROTO_PIM = 103, /* Protocol Independent Multicast. */
[79] Fix | Delete
#define IPPROTO_PIM IPPROTO_PIM
[80] Fix | Delete
IPPROTO_COMP = 108, /* Compression Header Protocol. */
[81] Fix | Delete
#define IPPROTO_COMP IPPROTO_COMP
[82] Fix | Delete
IPPROTO_SCTP = 132, /* Stream Control Transmission Protocol. */
[83] Fix | Delete
#define IPPROTO_SCTP IPPROTO_SCTP
[84] Fix | Delete
IPPROTO_UDPLITE = 136, /* UDP-Lite protocol. */
[85] Fix | Delete
#define IPPROTO_UDPLITE IPPROTO_UDPLITE
[86] Fix | Delete
IPPROTO_MPLS = 137, /* MPLS in IP. */
[87] Fix | Delete
#define IPPROTO_MPLS IPPROTO_MPLS
[88] Fix | Delete
IPPROTO_ETHERNET = 143, /* Ethernet-within-IPv6 Encapsulation. */
[89] Fix | Delete
#define IPPROTO_ETHERNET IPPROTO_ETHERNET
[90] Fix | Delete
IPPROTO_RAW = 255, /* Raw IP packets. */
[91] Fix | Delete
#define IPPROTO_RAW IPPROTO_RAW
[92] Fix | Delete
IPPROTO_MPTCP = 262, /* Multipath TCP connection. */
[93] Fix | Delete
#define IPPROTO_MPTCP IPPROTO_MPTCP
[94] Fix | Delete
IPPROTO_MAX
[95] Fix | Delete
};
[96] Fix | Delete
[97] Fix | Delete
/* If __USE_KERNEL_IPV6_DEFS is 1 then the user has included the kernel
[98] Fix | Delete
network headers first and we should use those ABI-identical definitions
[99] Fix | Delete
instead of our own, otherwise 0. */
[100] Fix | Delete
#if !__USE_KERNEL_IPV6_DEFS
[101] Fix | Delete
enum
[102] Fix | Delete
{
[103] Fix | Delete
IPPROTO_HOPOPTS = 0, /* IPv6 Hop-by-Hop options. */
[104] Fix | Delete
#define IPPROTO_HOPOPTS IPPROTO_HOPOPTS
[105] Fix | Delete
IPPROTO_ROUTING = 43, /* IPv6 routing header. */
[106] Fix | Delete
#define IPPROTO_ROUTING IPPROTO_ROUTING
[107] Fix | Delete
IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header. */
[108] Fix | Delete
#define IPPROTO_FRAGMENT IPPROTO_FRAGMENT
[109] Fix | Delete
IPPROTO_ICMPV6 = 58, /* ICMPv6. */
[110] Fix | Delete
#define IPPROTO_ICMPV6 IPPROTO_ICMPV6
[111] Fix | Delete
IPPROTO_NONE = 59, /* IPv6 no next header. */
[112] Fix | Delete
#define IPPROTO_NONE IPPROTO_NONE
[113] Fix | Delete
IPPROTO_DSTOPTS = 60, /* IPv6 destination options. */
[114] Fix | Delete
#define IPPROTO_DSTOPTS IPPROTO_DSTOPTS
[115] Fix | Delete
IPPROTO_MH = 135 /* IPv6 mobility header. */
[116] Fix | Delete
#define IPPROTO_MH IPPROTO_MH
[117] Fix | Delete
};
[118] Fix | Delete
#endif /* !__USE_KERNEL_IPV6_DEFS */
[119] Fix | Delete
[120] Fix | Delete
/* Type to represent a port. */
[121] Fix | Delete
typedef uint16_t in_port_t;
[122] Fix | Delete
[123] Fix | Delete
/* Standard well-known ports. */
[124] Fix | Delete
enum
[125] Fix | Delete
{
[126] Fix | Delete
IPPORT_ECHO = 7, /* Echo service. */
[127] Fix | Delete
IPPORT_DISCARD = 9, /* Discard transmissions service. */
[128] Fix | Delete
IPPORT_SYSTAT = 11, /* System status service. */
[129] Fix | Delete
IPPORT_DAYTIME = 13, /* Time of day service. */
[130] Fix | Delete
IPPORT_NETSTAT = 15, /* Network status service. */
[131] Fix | Delete
IPPORT_FTP = 21, /* File Transfer Protocol. */
[132] Fix | Delete
IPPORT_TELNET = 23, /* Telnet protocol. */
[133] Fix | Delete
IPPORT_SMTP = 25, /* Simple Mail Transfer Protocol. */
[134] Fix | Delete
IPPORT_TIMESERVER = 37, /* Timeserver service. */
[135] Fix | Delete
IPPORT_NAMESERVER = 42, /* Domain Name Service. */
[136] Fix | Delete
IPPORT_WHOIS = 43, /* Internet Whois service. */
[137] Fix | Delete
IPPORT_MTP = 57,
[138] Fix | Delete
[139] Fix | Delete
IPPORT_TFTP = 69, /* Trivial File Transfer Protocol. */
[140] Fix | Delete
IPPORT_RJE = 77,
[141] Fix | Delete
IPPORT_FINGER = 79, /* Finger service. */
[142] Fix | Delete
IPPORT_TTYLINK = 87,
[143] Fix | Delete
IPPORT_SUPDUP = 95, /* SUPDUP protocol. */
[144] Fix | Delete
[145] Fix | Delete
[146] Fix | Delete
IPPORT_EXECSERVER = 512, /* execd service. */
[147] Fix | Delete
IPPORT_LOGINSERVER = 513, /* rlogind service. */
[148] Fix | Delete
IPPORT_CMDSERVER = 514,
[149] Fix | Delete
IPPORT_EFSSERVER = 520,
[150] Fix | Delete
[151] Fix | Delete
/* UDP ports. */
[152] Fix | Delete
IPPORT_BIFFUDP = 512,
[153] Fix | Delete
IPPORT_WHOSERVER = 513,
[154] Fix | Delete
IPPORT_ROUTESERVER = 520,
[155] Fix | Delete
[156] Fix | Delete
/* Ports less than this value are reserved for privileged processes. */
[157] Fix | Delete
IPPORT_RESERVED = 1024,
[158] Fix | Delete
[159] Fix | Delete
/* Ports greater this value are reserved for (non-privileged) servers. */
[160] Fix | Delete
IPPORT_USERRESERVED = 5000
[161] Fix | Delete
};
[162] Fix | Delete
[163] Fix | Delete
/* Definitions of the bits in an Internet address integer.
[164] Fix | Delete
[165] Fix | Delete
On subnets, host and network parts are found according to
[166] Fix | Delete
the subnet mask, not these masks. */
[167] Fix | Delete
[168] Fix | Delete
#define IN_CLASSA(a) ((((in_addr_t)(a)) & 0x80000000) == 0)
[169] Fix | Delete
#define IN_CLASSA_NET 0xff000000
[170] Fix | Delete
#define IN_CLASSA_NSHIFT 24
[171] Fix | Delete
#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET)
[172] Fix | Delete
#define IN_CLASSA_MAX 128
[173] Fix | Delete
[174] Fix | Delete
#define IN_CLASSB(a) ((((in_addr_t)(a)) & 0xc0000000) == 0x80000000)
[175] Fix | Delete
#define IN_CLASSB_NET 0xffff0000
[176] Fix | Delete
#define IN_CLASSB_NSHIFT 16
[177] Fix | Delete
#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET)
[178] Fix | Delete
#define IN_CLASSB_MAX 65536
[179] Fix | Delete
[180] Fix | Delete
#define IN_CLASSC(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000)
[181] Fix | Delete
#define IN_CLASSC_NET 0xffffff00
[182] Fix | Delete
#define IN_CLASSC_NSHIFT 8
[183] Fix | Delete
#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET)
[184] Fix | Delete
[185] Fix | Delete
#define IN_CLASSD(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000)
[186] Fix | Delete
#define IN_MULTICAST(a) IN_CLASSD(a)
[187] Fix | Delete
[188] Fix | Delete
#define IN_EXPERIMENTAL(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000)
[189] Fix | Delete
#define IN_BADCLASS(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000)
[190] Fix | Delete
[191] Fix | Delete
/* Address to accept any incoming messages. */
[192] Fix | Delete
#define INADDR_ANY ((in_addr_t) 0x00000000)
[193] Fix | Delete
/* Address to send to all hosts. */
[194] Fix | Delete
#define INADDR_BROADCAST ((in_addr_t) 0xffffffff)
[195] Fix | Delete
/* Address indicating an error return. */
[196] Fix | Delete
#define INADDR_NONE ((in_addr_t) 0xffffffff)
[197] Fix | Delete
[198] Fix | Delete
/* Network number for local host loopback. */
[199] Fix | Delete
#define IN_LOOPBACKNET 127
[200] Fix | Delete
/* Address to loopback in software to local host. */
[201] Fix | Delete
#ifndef INADDR_LOOPBACK
[202] Fix | Delete
# define INADDR_LOOPBACK ((in_addr_t) 0x7f000001) /* Inet 127.0.0.1. */
[203] Fix | Delete
#endif
[204] Fix | Delete
[205] Fix | Delete
/* Defines for Multicast INADDR. */
[206] Fix | Delete
#define INADDR_UNSPEC_GROUP ((in_addr_t) 0xe0000000) /* 224.0.0.0 */
[207] Fix | Delete
#define INADDR_ALLHOSTS_GROUP ((in_addr_t) 0xe0000001) /* 224.0.0.1 */
[208] Fix | Delete
#define INADDR_ALLRTRS_GROUP ((in_addr_t) 0xe0000002) /* 224.0.0.2 */
[209] Fix | Delete
#define INADDR_ALLSNOOPERS_GROUP ((in_addr_t) 0xe000006a) /* 224.0.0.106 */
[210] Fix | Delete
#define INADDR_MAX_LOCAL_GROUP ((in_addr_t) 0xe00000ff) /* 224.0.0.255 */
[211] Fix | Delete
[212] Fix | Delete
#if !__USE_KERNEL_IPV6_DEFS
[213] Fix | Delete
/* IPv6 address */
[214] Fix | Delete
struct in6_addr
[215] Fix | Delete
{
[216] Fix | Delete
union
[217] Fix | Delete
{
[218] Fix | Delete
uint8_t __u6_addr8[16];
[219] Fix | Delete
uint16_t __u6_addr16[8];
[220] Fix | Delete
uint32_t __u6_addr32[4];
[221] Fix | Delete
} __in6_u;
[222] Fix | Delete
#define s6_addr __in6_u.__u6_addr8
[223] Fix | Delete
#ifdef __USE_MISC
[224] Fix | Delete
# define s6_addr16 __in6_u.__u6_addr16
[225] Fix | Delete
# define s6_addr32 __in6_u.__u6_addr32
[226] Fix | Delete
#endif
[227] Fix | Delete
};
[228] Fix | Delete
#endif /* !__USE_KERNEL_IPV6_DEFS */
[229] Fix | Delete
[230] Fix | Delete
extern const struct in6_addr in6addr_any; /* :: */
[231] Fix | Delete
extern const struct in6_addr in6addr_loopback; /* ::1 */
[232] Fix | Delete
#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
[233] Fix | Delete
#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
[234] Fix | Delete
[235] Fix | Delete
#define INET_ADDRSTRLEN 16
[236] Fix | Delete
#define INET6_ADDRSTRLEN 46
[237] Fix | Delete
[238] Fix | Delete
[239] Fix | Delete
/* Structure describing an Internet socket address. */
[240] Fix | Delete
struct sockaddr_in
[241] Fix | Delete
{
[242] Fix | Delete
__SOCKADDR_COMMON (sin_);
[243] Fix | Delete
in_port_t sin_port; /* Port number. */
[244] Fix | Delete
struct in_addr sin_addr; /* Internet address. */
[245] Fix | Delete
[246] Fix | Delete
/* Pad to size of `struct sockaddr'. */
[247] Fix | Delete
unsigned char sin_zero[sizeof (struct sockaddr) -
[248] Fix | Delete
__SOCKADDR_COMMON_SIZE -
[249] Fix | Delete
sizeof (in_port_t) -
[250] Fix | Delete
sizeof (struct in_addr)];
[251] Fix | Delete
};
[252] Fix | Delete
[253] Fix | Delete
#if !__USE_KERNEL_IPV6_DEFS
[254] Fix | Delete
/* Ditto, for IPv6. */
[255] Fix | Delete
struct sockaddr_in6
[256] Fix | Delete
{
[257] Fix | Delete
__SOCKADDR_COMMON (sin6_);
[258] Fix | Delete
in_port_t sin6_port; /* Transport layer port # */
[259] Fix | Delete
uint32_t sin6_flowinfo; /* IPv6 flow information */
[260] Fix | Delete
struct in6_addr sin6_addr; /* IPv6 address */
[261] Fix | Delete
uint32_t sin6_scope_id; /* IPv6 scope-id */
[262] Fix | Delete
};
[263] Fix | Delete
#endif /* !__USE_KERNEL_IPV6_DEFS */
[264] Fix | Delete
[265] Fix | Delete
#ifdef __USE_MISC
[266] Fix | Delete
/* IPv4 multicast request. */
[267] Fix | Delete
struct ip_mreq
[268] Fix | Delete
{
[269] Fix | Delete
/* IP multicast address of group. */
[270] Fix | Delete
struct in_addr imr_multiaddr;
[271] Fix | Delete
[272] Fix | Delete
/* Local IP address of interface. */
[273] Fix | Delete
struct in_addr imr_interface;
[274] Fix | Delete
};
[275] Fix | Delete
[276] Fix | Delete
struct ip_mreq_source
[277] Fix | Delete
{
[278] Fix | Delete
/* IP multicast address of group. */
[279] Fix | Delete
struct in_addr imr_multiaddr;
[280] Fix | Delete
[281] Fix | Delete
/* IP address of interface. */
[282] Fix | Delete
struct in_addr imr_interface;
[283] Fix | Delete
[284] Fix | Delete
/* IP address of source. */
[285] Fix | Delete
struct in_addr imr_sourceaddr;
[286] Fix | Delete
};
[287] Fix | Delete
#endif
[288] Fix | Delete
[289] Fix | Delete
#if !__USE_KERNEL_IPV6_DEFS
[290] Fix | Delete
/* Likewise, for IPv6. */
[291] Fix | Delete
struct ipv6_mreq
[292] Fix | Delete
{
[293] Fix | Delete
/* IPv6 multicast address of group */
[294] Fix | Delete
struct in6_addr ipv6mr_multiaddr;
[295] Fix | Delete
[296] Fix | Delete
/* local interface */
[297] Fix | Delete
unsigned int ipv6mr_interface;
[298] Fix | Delete
};
[299] Fix | Delete
#endif /* !__USE_KERNEL_IPV6_DEFS */
[300] Fix | Delete
[301] Fix | Delete
#ifdef __USE_MISC
[302] Fix | Delete
/* Multicast group request. */
[303] Fix | Delete
struct group_req
[304] Fix | Delete
{
[305] Fix | Delete
/* Interface index. */
[306] Fix | Delete
uint32_t gr_interface;
[307] Fix | Delete
[308] Fix | Delete
/* Group address. */
[309] Fix | Delete
struct sockaddr_storage gr_group;
[310] Fix | Delete
};
[311] Fix | Delete
[312] Fix | Delete
struct group_source_req
[313] Fix | Delete
{
[314] Fix | Delete
/* Interface index. */
[315] Fix | Delete
uint32_t gsr_interface;
[316] Fix | Delete
[317] Fix | Delete
/* Group address. */
[318] Fix | Delete
struct sockaddr_storage gsr_group;
[319] Fix | Delete
[320] Fix | Delete
/* Source address. */
[321] Fix | Delete
struct sockaddr_storage gsr_source;
[322] Fix | Delete
};
[323] Fix | Delete
[324] Fix | Delete
[325] Fix | Delete
/* Full-state filter operations. */
[326] Fix | Delete
struct ip_msfilter
[327] Fix | Delete
{
[328] Fix | Delete
/* IP multicast address of group. */
[329] Fix | Delete
struct in_addr imsf_multiaddr;
[330] Fix | Delete
[331] Fix | Delete
/* Local IP address of interface. */
[332] Fix | Delete
struct in_addr imsf_interface;
[333] Fix | Delete
[334] Fix | Delete
/* Filter mode. */
[335] Fix | Delete
uint32_t imsf_fmode;
[336] Fix | Delete
[337] Fix | Delete
/* Number of source addresses. */
[338] Fix | Delete
uint32_t imsf_numsrc;
[339] Fix | Delete
/* Source addresses. */
[340] Fix | Delete
struct in_addr imsf_slist[1];
[341] Fix | Delete
};
[342] Fix | Delete
[343] Fix | Delete
#define IP_MSFILTER_SIZE(numsrc) (sizeof (struct ip_msfilter) \
[344] Fix | Delete
- sizeof (struct in_addr) \
[345] Fix | Delete
+ (numsrc) * sizeof (struct in_addr))
[346] Fix | Delete
[347] Fix | Delete
struct group_filter
[348] Fix | Delete
{
[349] Fix | Delete
/* Interface index. */
[350] Fix | Delete
uint32_t gf_interface;
[351] Fix | Delete
[352] Fix | Delete
/* Group address. */
[353] Fix | Delete
struct sockaddr_storage gf_group;
[354] Fix | Delete
[355] Fix | Delete
/* Filter mode. */
[356] Fix | Delete
uint32_t gf_fmode;
[357] Fix | Delete
[358] Fix | Delete
/* Number of source addresses. */
[359] Fix | Delete
uint32_t gf_numsrc;
[360] Fix | Delete
/* Source addresses. */
[361] Fix | Delete
struct sockaddr_storage gf_slist[1];
[362] Fix | Delete
};
[363] Fix | Delete
[364] Fix | Delete
#define GROUP_FILTER_SIZE(numsrc) (sizeof (struct group_filter) \
[365] Fix | Delete
- sizeof (struct sockaddr_storage) \
[366] Fix | Delete
+ ((numsrc) \
[367] Fix | Delete
* sizeof (struct sockaddr_storage)))
[368] Fix | Delete
#endif
[369] Fix | Delete
[370] Fix | Delete
/* Functions to convert between host and network byte order.
[371] Fix | Delete
[372] Fix | Delete
Please note that these functions normally take `unsigned long int' or
[373] Fix | Delete
`unsigned short int' values as arguments and also return them. But
[374] Fix | Delete
this was a short-sighted decision since on different systems the types
[375] Fix | Delete
may have different representations but the values are always the same. */
[376] Fix | Delete
[377] Fix | Delete
extern uint32_t ntohl (uint32_t __netlong) __THROW __attribute__ ((__const__));
[378] Fix | Delete
extern uint16_t ntohs (uint16_t __netshort)
[379] Fix | Delete
__THROW __attribute__ ((__const__));
[380] Fix | Delete
extern uint32_t htonl (uint32_t __hostlong)
[381] Fix | Delete
__THROW __attribute__ ((__const__));
[382] Fix | Delete
extern uint16_t htons (uint16_t __hostshort)
[383] Fix | Delete
__THROW __attribute__ ((__const__));
[384] Fix | Delete
[385] Fix | Delete
#include <endian.h>
[386] Fix | Delete
[387] Fix | Delete
/* Get machine dependent optimized versions of byte swapping functions. */
[388] Fix | Delete
#include <bits/byteswap.h>
[389] Fix | Delete
#include <bits/uintn-identity.h>
[390] Fix | Delete
[391] Fix | Delete
#ifdef __OPTIMIZE__
[392] Fix | Delete
/* We can optimize calls to the conversion functions. Either nothing has
[393] Fix | Delete
to be done or we are using directly the byte-swapping functions which
[394] Fix | Delete
often can be inlined. */
[395] Fix | Delete
# if __BYTE_ORDER == __BIG_ENDIAN
[396] Fix | Delete
/* The host byte order is the same as network byte order,
[397] Fix | Delete
so these functions are all just identity. */
[398] Fix | Delete
# define ntohl(x) __uint32_identity (x)
[399] Fix | Delete
# define ntohs(x) __uint16_identity (x)
[400] Fix | Delete
# define htonl(x) __uint32_identity (x)
[401] Fix | Delete
# define htons(x) __uint16_identity (x)
[402] Fix | Delete
# else
[403] Fix | Delete
# if __BYTE_ORDER == __LITTLE_ENDIAN
[404] Fix | Delete
# define ntohl(x) __bswap_32 (x)
[405] Fix | Delete
# define ntohs(x) __bswap_16 (x)
[406] Fix | Delete
# define htonl(x) __bswap_32 (x)
[407] Fix | Delete
# define htons(x) __bswap_16 (x)
[408] Fix | Delete
# endif
[409] Fix | Delete
# endif
[410] Fix | Delete
#endif
[411] Fix | Delete
[412] Fix | Delete
#ifdef __GNUC__
[413] Fix | Delete
# define IN6_IS_ADDR_UNSPECIFIED(a) \
[414] Fix | Delete
(__extension__ \
[415] Fix | Delete
({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
[416] Fix | Delete
__a->__in6_u.__u6_addr32[0] == 0 \
[417] Fix | Delete
&& __a->__in6_u.__u6_addr32[1] == 0 \
[418] Fix | Delete
&& __a->__in6_u.__u6_addr32[2] == 0 \
[419] Fix | Delete
&& __a->__in6_u.__u6_addr32[3] == 0; }))
[420] Fix | Delete
[421] Fix | Delete
# define IN6_IS_ADDR_LOOPBACK(a) \
[422] Fix | Delete
(__extension__ \
[423] Fix | Delete
({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
[424] Fix | Delete
__a->__in6_u.__u6_addr32[0] == 0 \
[425] Fix | Delete
&& __a->__in6_u.__u6_addr32[1] == 0 \
[426] Fix | Delete
&& __a->__in6_u.__u6_addr32[2] == 0 \
[427] Fix | Delete
&& __a->__in6_u.__u6_addr32[3] == htonl (1); }))
[428] Fix | Delete
[429] Fix | Delete
# define IN6_IS_ADDR_LINKLOCAL(a) \
[430] Fix | Delete
(__extension__ \
[431] Fix | Delete
({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
[432] Fix | Delete
(__a->__in6_u.__u6_addr32[0] & htonl (0xffc00000)) == htonl (0xfe800000); }))
[433] Fix | Delete
[434] Fix | Delete
# define IN6_IS_ADDR_SITELOCAL(a) \
[435] Fix | Delete
(__extension__ \
[436] Fix | Delete
({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
[437] Fix | Delete
(__a->__in6_u.__u6_addr32[0] & htonl (0xffc00000)) == htonl (0xfec00000); }))
[438] Fix | Delete
[439] Fix | Delete
# define IN6_IS_ADDR_V4MAPPED(a) \
[440] Fix | Delete
(__extension__ \
[441] Fix | Delete
({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
[442] Fix | Delete
__a->__in6_u.__u6_addr32[0] == 0 \
[443] Fix | Delete
&& __a->__in6_u.__u6_addr32[1] == 0 \
[444] Fix | Delete
&& __a->__in6_u.__u6_addr32[2] == htonl (0xffff); }))
[445] Fix | Delete
[446] Fix | Delete
# define IN6_IS_ADDR_V4COMPAT(a) \
[447] Fix | Delete
(__extension__ \
[448] Fix | Delete
({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
[449] Fix | Delete
__a->__in6_u.__u6_addr32[0] == 0 \
[450] Fix | Delete
&& __a->__in6_u.__u6_addr32[1] == 0 \
[451] Fix | Delete
&& __a->__in6_u.__u6_addr32[2] == 0 \
[452] Fix | Delete
&& ntohl (__a->__in6_u.__u6_addr32[3]) > 1; }))
[453] Fix | Delete
[454] Fix | Delete
# define IN6_ARE_ADDR_EQUAL(a,b) \
[455] Fix | Delete
(__extension__ \
[456] Fix | Delete
({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
[457] Fix | Delete
const struct in6_addr *__b = (const struct in6_addr *) (b); \
[458] Fix | Delete
__a->__in6_u.__u6_addr32[0] == __b->__in6_u.__u6_addr32[0] \
[459] Fix | Delete
&& __a->__in6_u.__u6_addr32[1] == __b->__in6_u.__u6_addr32[1] \
[460] Fix | Delete
&& __a->__in6_u.__u6_addr32[2] == __b->__in6_u.__u6_addr32[2] \
[461] Fix | Delete
&& __a->__in6_u.__u6_addr32[3] == __b->__in6_u.__u6_addr32[3]; }))
[462] Fix | Delete
#else
[463] Fix | Delete
# define IN6_IS_ADDR_UNSPECIFIED(a) \
[464] Fix | Delete
(((const uint32_t *) (a))[0] == 0 \
[465] Fix | Delete
&& ((const uint32_t *) (a))[1] == 0 \
[466] Fix | Delete
&& ((const uint32_t *) (a))[2] == 0 \
[467] Fix | Delete
&& ((const uint32_t *) (a))[3] == 0)
[468] Fix | Delete
[469] Fix | Delete
# define IN6_IS_ADDR_LOOPBACK(a) \
[470] Fix | Delete
(((const uint32_t *) (a))[0] == 0 \
[471] Fix | Delete
&& ((const uint32_t *) (a))[1] == 0 \
[472] Fix | Delete
&& ((const uint32_t *) (a))[2] == 0 \
[473] Fix | Delete
&& ((const uint32_t *) (a))[3] == htonl (1))
[474] Fix | Delete
[475] Fix | Delete
# define IN6_IS_ADDR_LINKLOCAL(a) \
[476] Fix | Delete
((((const uint32_t *) (a))[0] & htonl (0xffc00000)) \
[477] Fix | Delete
== htonl (0xfe800000))
[478] Fix | Delete
[479] Fix | Delete
# define IN6_IS_ADDR_SITELOCAL(a) \
[480] Fix | Delete
((((const uint32_t *) (a))[0] & htonl (0xffc00000)) \
[481] Fix | Delete
== htonl (0xfec00000))
[482] Fix | Delete
[483] Fix | Delete
# define IN6_IS_ADDR_V4MAPPED(a) \
[484] Fix | Delete
((((const uint32_t *) (a))[0] == 0) \
[485] Fix | Delete
&& (((const uint32_t *) (a))[1] == 0) \
[486] Fix | Delete
&& (((const uint32_t *) (a))[2] == htonl (0xffff)))
[487] Fix | Delete
[488] Fix | Delete
# define IN6_IS_ADDR_V4COMPAT(a) \
[489] Fix | Delete
((((const uint32_t *) (a))[0] == 0) \
[490] Fix | Delete
&& (((const uint32_t *) (a))[1] == 0) \
[491] Fix | Delete
&& (((const uint32_t *) (a))[2] == 0) \
[492] Fix | Delete
&& (ntohl (((const uint32_t *) (a))[3]) > 1))
[493] Fix | Delete
[494] Fix | Delete
# define IN6_ARE_ADDR_EQUAL(a,b) \
[495] Fix | Delete
((((const uint32_t *) (a))[0] == ((const uint32_t *) (b))[0]) \
[496] Fix | Delete
&& (((const uint32_t *) (a))[1] == ((const uint32_t *) (b))[1]) \
[497] Fix | Delete
&& (((const uint32_t *) (a))[2] == ((const uint32_t *) (b))[2]) \
[498] Fix | Delete
&& (((const uint32_t *) (a))[3] == ((const uint32_t *) (b))[3]))
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function