in.h revision 10e6dadfe63181edabc58c8f42e3c56a1cd9ec95
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 1982, 1986 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that this notice is preserved and that due credit is given
* to the University of California at Berkeley. The name of the University
* may not be used to endorse or promote products derived from this
* software without specific prior written permission. This software
* is provided ``as is'' without express or implied warranty.
*/
/*
* Constants and structures defined by the internet system,
* according to following documents
*
* Internet ASSIGNED NUMBERS (RFC1700) and its successors
* and other assignments at ftp://ftp.isi.edu/in-notes/iana/assignments
* Basic Socket Interface Extensions for IPv6 (RFC2133 and its successors)
*
*/
#ifndef _NETINET_IN_H
#define _NETINET_IN_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/feature_tests.h>
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
#include <sys/socket_impl.h>
#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
#ifndef _SOCKLEN_T
#define _SOCKLEN_T
/*
*/
#else
#endif /* defined(_XPG4_2) && !defined(_XPG5) && !defined(_LP64) */
typedef socklen_t *Psocklen_t;
#else
typedef void *Psocklen_t;
#endif /* defined(_XPG4_2) || defined(_BOOT) */
#endif /* _SOCKLEN_T */
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
/*
* Symbols such as htonl() are required to be exposed through this file,
* per XNS Issue 5. This is achieved by inclusion of <sys/byteorder.h>
*/
#include <sys/byteorder.h>
#endif
#ifndef _IN_PORT_T
#define _IN_PORT_T
#endif
/*
* Note: IPv4 address data structures usage conventions.
* The "in_addr_t" type below (required by Unix standards)
* is NOT a typedef of "struct in_addr" and violates the usual
* conventions where "struct <name>" and <name>_t are corresponding
* typedefs.
* To minimize confusion, kernel data structures/usage prefers use
* of "ipaddr_t" as atomic uint32_t type and avoid using "in_addr_t"
* The user level APIs continue to follow the historic popular
* practice of using "struct in_addr".
*/
#ifndef _IN_ADDR_T
#define _IN_ADDR_T
#endif
#ifndef _IPADDR_T
#define _IPADDR_T
#endif
struct in6_addr {
union {
/*
* Note: Static initalizers of "union" type assume
* the constant on the RHS is the type of the first member
* of union.
* To make static initializers (and efficient usage) work,
* the order of members exposed to user and kernel view of
* this data structure is different.
* User environment sees specified uint8_t type as first
* member whereas kernel sees most efficient type as
* first member.
*/
#ifdef _KERNEL
#else
#endif
} _S6_un;
};
#ifdef _KERNEL
#endif
typedef struct in6_addr in6_addr_t;
#endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
#ifndef _SA_FAMILY_T
#define _SA_FAMILY_T
typedef uint16_t sa_family_t;
#endif
/*
* Protocols
*
* Some of these constant names are copied for the DTrace IP provider in
* in sync.
*/
#define IPPROTO_IP 0 /* dummy for IP */
#define IPPROTO_HOPOPTS 0 /* Hop by hop header for IPv6 */
/* Transmission Protocol */
#define IPPROTO_MAX 256
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
/*
*
* Entries should exist here for each port number compiled into an ON
* component, such as snoop.
*/
#define IPPORT_ECHO 7
#define IPPORT_DISCARD 9
#define IPPORT_SYSTAT 11
#define IPPORT_DAYTIME 13
#define IPPORT_NETSTAT 15
#define IPPORT_CHARGEN 19
#define IPPORT_FTP 21
#define IPPORT_TELNET 23
#define IPPORT_SMTP 25
#define IPPORT_TIMESERVER 37
#define IPPORT_NAMESERVER 42
#define IPPORT_WHOIS 43
#define IPPORT_DOMAIN 53
#define IPPORT_MDNS 5353
#define IPPORT_MTP 57
/*
*/
#define IPPORT_BOOTPS 67
#define IPPORT_BOOTPC 68
#define IPPORT_TFTP 69
#define IPPORT_RJE 77
#define IPPORT_FINGER 79
#define IPPORT_HTTP 80
#define IPPORT_HTTP_ALT 8080
#define IPPORT_TTYLINK 87
#define IPPORT_SUPDUP 95
#define IPPORT_NTP 123
#define IPPORT_NETBIOS_NS 137
#define IPPORT_NETBIOS_DGM 138
#define IPPORT_NETBIOS_SSN 139
#define IPPORT_LDAP 389
#define IPPORT_SLP 427
#define IPPORT_MIP 434
/*
* Internet Key Exchange (IKE) ports
*/
#define IPPORT_IKE 500
#define IPPORT_IKE_NATT 4500
/*
* UNIX TCP sockets
*/
#define IPPORT_EXECSERVER 512
#define IPPORT_LOGINSERVER 513
#define IPPORT_CMDSERVER 514
#define IPPORT_PRINTER 515
#define IPPORT_EFSSERVER 520
/*
* UNIX UDP sockets
*/
#define IPPORT_BIFFUDP 512
#define IPPORT_WHOSERVER 513
#define IPPORT_SYSLOG 514
#define IPPORT_TALK 517
#define IPPORT_ROUTESERVER 520
#define IPPORT_RIPNG 521
/*
* DHCPv6 UDP ports
*/
#define IPPORT_DHCPV6C 546
#define IPPORT_DHCPV6S 547
#define IPPORT_SOCKS 1080
/*
* Ports < IPPORT_RESERVED are reserved for
* privileged processes (e.g. root).
* Ports > IPPORT_USERRESERVED are reserved
* for servers, not necessarily privileged.
*/
#define IPPORT_RESERVED 1024
#define IPPORT_USERRESERVED 5000
/*
* Link numbers
*/
#define IMPLINK_IP 155
#define IMPLINK_LOWEXPER 156
#define IMPLINK_HIGHEXPER 158
/*
* IPv4 Internet address
* This definition contains obsolete fields for compatibility
* with SunOS 3.x and 4.2bsd. The presence of subnets renders
* divisions into fixed fields misleading at best. New code
* should use only the s_addr field.
*/
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
struct in_addr {
union {
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
#else
#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
} _S_un;
};
/*
* Definitions of bits in internet address integers.
* On subnets, the decomposition of addresses to host and net parts
* is done according to subnet mask, not the masks here.
*
* Note that with the introduction of CIDR, IN_CLASSA, IN_CLASSB,
* IN_CLASSC, IN_CLASSD and IN_CLASSE macros have become "de-facto
* obsolete". IN_MULTICAST macro should be used to test if a address
* is a multicast address.
*/
#define IN_CLASSA(i) (((i) & 0x80000000U) == 0)
#define IN_CLASSA_NET 0xff000000U
#define IN_CLASSA_NSHIFT 24
#define IN_CLASSA_HOST 0x00ffffffU
#define IN_CLASSA_MAX 128
#define IN_CLASSB_NET 0xffff0000U
#define IN_CLASSB_NSHIFT 16
#define IN_CLASSB_HOST 0x0000ffffU
#define IN_CLASSB_MAX 65536
#define IN_CLASSC_NET 0xffffff00U
#define IN_CLASSC_NSHIFT 8
#define IN_CLASSC_HOST 0x000000ffU
#define IN_CLASSE_NET 0xffffffffU
#define IN_MULTICAST(i) IN_CLASSD(i)
/*
* We have removed CLASS E checks from the kernel
* But we preserve these defines for userland in order
* to avoid compile breakage of some 3rd party piece of software
*/
#ifndef _KERNEL
#endif
#define INADDR_ANY 0x00000000U
#define INADDR_LOOPBACK 0x7F000001U
#define INADDR_NONE 0xffffffffU
/* Scoped IPv4 prefixes (in host byte-order) */
#define IN_AUTOCONF_MASK 0xffff0000U
#define IN_PRIVATE8_MASK 0xff000000U
#define IN_PRIVATE12_MASK 0xfff00000U
#define IN_PRIVATE16_MASK 0xffff0000U
/* RFC 3927 IPv4 link local address (i in host byte-order) */
/* Well known 6to4 Relay Router Anycast address defined in RFC 3068 */
#if !defined(_XPG4_2) || !defined(__EXTENSIONS__)
#endif /* !defined(_XPG4_2) || !defined(__EXTENSIONS__) */
/*
* Define a macro to stuff the loopback address into an Internet address
*/
#if !defined(_XPG4_2) || !defined(__EXTENSIONS__)
#define IN_SET_LOOPBACK_ADDR(a) \
(a)->sin_family = AF_INET; }
#endif /* !defined(_XPG4_2) || !defined(__EXTENSIONS__) */
/*
* IPv4 Socket address.
*/
struct sockaddr_in {
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
char sin_zero[8];
#else
unsigned char sin_zero[8];
#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
};
/*
* IPv6 socket address.
*/
struct sockaddr_in6 {
};
/*
* Macros for accessing the traffic class and flow label fields from
* sin6_flowinfo.
* These are designed to be applied to a 32-bit value.
*/
#ifdef _BIG_ENDIAN
/* masks */
#define IPV6_FLOWINFO_FLOWLABEL 0x000fffffU
#define IPV6_FLOWINFO_TCLASS 0x0ff00000U
#else /* _BIG_ENDIAN */
/* masks */
#define IPV6_FLOWINFO_FLOWLABEL 0xffff0f00U
#define IPV6_FLOWINFO_TCLASS 0x0000f00fU
#endif /* _BIG_ENDIAN */
/*
* Note: Macros IN6ADDR_ANY_INIT and IN6ADDR_LOOPBACK_INIT are for
* use as RHS of Static initializers of "struct in6_addr" (or in6_addr_t)
* component data structure is defined differently (it is identical at
* binary representation level).
*
* const struct in6_addr IN6ADDR_ANY_INIT;
* const struct in6_addr IN6ADDR_LOOPBACK_INIT;
*/
#ifdef _KERNEL
#define IN6ADDR_ANY_INIT { 0, 0, 0, 0 }
#ifdef _BIG_ENDIAN
#define IN6ADDR_LOOPBACK_INIT { 0, 0, 0, 0x00000001U }
#else /* _BIG_ENDIAN */
#define IN6ADDR_LOOPBACK_INIT { 0, 0, 0, 0x01000000U }
#endif /* _BIG_ENDIAN */
#else
#define IN6ADDR_ANY_INIT { 0, 0, 0, 0, \
0, 0, 0, 0, \
0, 0, 0, 0, \
0, 0, 0, 0 }
#define IN6ADDR_LOOPBACK_INIT { 0, 0, 0, 0, \
0, 0, 0, 0, \
0, 0, 0, 0, \
0, 0, 0, 0x1U }
#endif /* _KERNEL */
/*
* RFC 2553 specifies the following macros. Their type is defined
* as "int" in the RFC but they only have boolean significance
* (zero or non-zero). For the purposes of our comment notation,
* we assume a hypothetical type "bool" defined as follows to
* write the prototypes assumed for macros in our comments better.
*
* typedef int bool;
*/
/*
* IN6 macros used to test for special IPv6 addresses
* (Mostly from spec)
*
* bool IN6_IS_ADDR_UNSPECIFIED (const struct in6_addr *);
* bool IN6_IS_ADDR_LOOPBACK (const struct in6_addr *);
* bool IN6_IS_ADDR_MULTICAST (const struct in6_addr *);
* bool IN6_IS_ADDR_LINKLOCAL (const struct in6_addr *);
* bool IN6_IS_ADDR_SITELOCAL (const struct in6_addr *);
* bool IN6_IS_ADDR_V4MAPPED (const struct in6_addr *);
* bool IN6_IS_ADDR_V4MAPPED_ANY(const struct in6_addr *); -- Not from RFC2553
* bool IN6_IS_ADDR_V4COMPAT (const struct in6_addr *);
* bool IN6_IS_ADDR_MC_RESERVED (const struct in6_addr *); -- Not from RFC2553
* bool IN6_IS_ADDR_MC_NODELOCAL(const struct in6_addr *);
* bool IN6_IS_ADDR_MC_LINKLOCAL(const struct in6_addr *);
* bool IN6_IS_ADDR_MC_SITELOCAL(const struct in6_addr *);
* bool IN6_IS_ADDR_MC_ORGLOCAL (const struct in6_addr *);
* bool IN6_IS_ADDR_MC_GLOBAL (const struct in6_addr *);
* bool IN6_IS_ADDR_6TO4 (const struct in6_addr *); -- Not from RFC2553
* bool IN6_ARE_6TO4_PREFIX_EQUAL(const struct in6_addr *,
* const struct in6_addr *); -- Not from RFC2553
* bool IN6_IS_ADDR_LINKSCOPE (const struct in6addr *); -- Not from RFC2553
*/
#define IN6_IS_ADDR_UNSPECIFIED(addr) \
#ifdef _BIG_ENDIAN
#define IN6_IS_ADDR_LOOPBACK(addr) \
#else /* _BIG_ENDIAN */
#define IN6_IS_ADDR_LOOPBACK(addr) \
#endif /* _BIG_ENDIAN */
#ifdef _BIG_ENDIAN
#define IN6_IS_ADDR_MULTICAST(addr) \
#else /* _BIG_ENDIAN */
#define IN6_IS_ADDR_MULTICAST(addr) \
#endif /* _BIG_ENDIAN */
#ifdef _BIG_ENDIAN
#define IN6_IS_ADDR_LINKLOCAL(addr) \
#else /* _BIG_ENDIAN */
#define IN6_IS_ADDR_LINKLOCAL(addr) \
#endif /* _BIG_ENDIAN */
#ifdef _BIG_ENDIAN
#define IN6_IS_ADDR_SITELOCAL(addr) \
#else /* _BIG_ENDIAN */
#define IN6_IS_ADDR_SITELOCAL(addr) \
#endif /* _BIG_ENDIAN */
#ifdef _BIG_ENDIAN
#define IN6_IS_ADDR_V4MAPPED(addr) \
#else /* _BIG_ENDIAN */
#define IN6_IS_ADDR_V4MAPPED(addr) \
#endif /* _BIG_ENDIAN */
/*
* IN6_IS_ADDR_V4MAPPED - A IPv4 mapped INADDR_ANY
* Note: This macro is currently NOT defined in RFC2553 specification
* and not a standard macro that portable applications should use.
*/
#ifdef _BIG_ENDIAN
#define IN6_IS_ADDR_V4MAPPED_ANY(addr) \
#else /* _BIG_ENDIAN */
#define IN6_IS_ADDR_V4MAPPED_ANY(addr) \
#endif /* _BIG_ENDIAN */
/* Exclude loopback and unspecified address */
#ifdef _BIG_ENDIAN
#define IN6_IS_ADDR_V4COMPAT(addr) \
#else /* _BIG_ENDIAN */
#define IN6_IS_ADDR_V4COMPAT(addr) \
#endif /* _BIG_ENDIAN */
/*
* Note:
* IN6_IS_ADDR_MC_RESERVED macro is currently NOT defined in RFC2553
* specification and not a standard macro that portable applications
* should use.
*/
#ifdef _BIG_ENDIAN
#define IN6_IS_ADDR_MC_RESERVED(addr) \
#else /* _BIG_ENDIAN */
#define IN6_IS_ADDR_MC_RESERVED(addr) \
#endif /* _BIG_ENDIAN */
#ifdef _BIG_ENDIAN
#define IN6_IS_ADDR_MC_NODELOCAL(addr) \
#else /* _BIG_ENDIAN */
#define IN6_IS_ADDR_MC_NODELOCAL(addr) \
#endif /* _BIG_ENDIAN */
#ifdef _BIG_ENDIAN
#define IN6_IS_ADDR_MC_LINKLOCAL(addr) \
#else /* _BIG_ENDIAN */
#define IN6_IS_ADDR_MC_LINKLOCAL(addr) \
#endif /* _BIG_ENDIAN */
#ifdef _BIG_ENDIAN
#define IN6_IS_ADDR_MC_SITELOCAL(addr) \
#else /* _BIG_ENDIAN */
#define IN6_IS_ADDR_MC_SITELOCAL(addr) \
#endif /* _BIG_ENDIAN */
#ifdef _BIG_ENDIAN
#define IN6_IS_ADDR_MC_ORGLOCAL(addr) \
#else /* _BIG_ENDIAN */
#define IN6_IS_ADDR_MC_ORGLOCAL(addr) \
#endif /* _BIG_ENDIAN */
#ifdef _BIG_ENDIAN
#define IN6_IS_ADDR_MC_GLOBAL(addr) \
#else /* _BIG_ENDIAN */
#define IN6_IS_ADDR_MC_GLOBAL(addr) \
#endif /* _BIG_ENDIAN */
/*
* The IN6_IS_ADDR_MC_SOLICITEDNODE macro is not defined in any standard or
* RFC, and shouldn't be used by portable applications. It is used to see
* if an address is a solicited-node multicast address, which is prefixed
* with ff02:0:0:0:0:1:ff00::/104.
*/
#ifdef _BIG_ENDIAN
#define IN6_IS_ADDR_MC_SOLICITEDNODE(addr) \
#else
#define IN6_IS_ADDR_MC_SOLICITEDNODE(addr) \
#endif
/*
* Macros to a) test for 6to4 IPv6 address, and b) to test if two
* 6to4 addresses have the same /48 prefix, and, hence, are from the
* same 6to4 site.
*/
#ifdef _BIG_ENDIAN
#define IN6_IS_ADDR_6TO4(addr) \
#else /* _BIG_ENDIAN */
#define IN6_IS_ADDR_6TO4(addr) \
#endif /* _BIG_ENDIAN */
/*
* IN6_IS_ADDR_LINKSCOPE
* Identifies an address as being either link-local, link-local multicast or
* node-local multicast. All types of addresses are considered to be unique
* within the scope of a given link.
*/
#define IN6_IS_ADDR_LINKSCOPE(addr) \
/*
* Useful utility macros for operations with IPv6 addresses
* Note: These macros are NOT defined in the RFC2553 or any other
* standard specification and are not standard macros that portable
* applications should use.
*/
/*
* IN6_V4MAPPED_TO_INADDR
* IN6_V4MAPPED_TO_IPADDR
* Assign a IPv4-Mapped IPv6 address to an IPv4 address.
* Note: These macros are NOT defined in RFC2553 or any other standard
* specification and are not macros that portable applications should
* use.
*
* void IN6_V4MAPPED_TO_INADDR(const in6_addr_t *v6, struct in_addr *v4);
* void IN6_V4MAPPED_TO_IPADDR(const in6_addr_t *v6, ipaddr_t v4);
*
*/
/*
* IN6_INADDR_TO_V4MAPPED
* IN6_IPADDR_TO_V4MAPPED
* Assign a IPv4 address address to an IPv6 address as a IPv4-mapped
* address.
* Note: These macros are NOT defined in RFC2553 or any other standard
* specification and are not macros that portable applications should
* use.
*
* void IN6_INADDR_TO_V4MAPPED(const struct in_addr *v4, in6_addr_t *v6);
* void IN6_IPADDR_TO_V4MAPPED(const ipaddr_t v4, in6_addr_t *v6);
*
*/
#ifdef _BIG_ENDIAN
#else /* _BIG_ENDIAN */
#endif /* _BIG_ENDIAN */
/*
* IN6_6TO4_TO_V4ADDR
* Extract the embedded IPv4 address from the prefix to a 6to4 IPv6
* address.
* Note: This macro is NOT defined in RFC2553 or any other standard
* specification and is not a macro that portable applications should
* use.
* Note: we don't use the IPADDR form of the macro because we need
* to do a bytewise copy; the V4ADDR in the 6to4 address is not
* 32-bit aligned.
*
* void IN6_6TO4_TO_V4ADDR(const in6_addr_t *v6, struct in_addr *v4);
*
*/
/*
* IN6_V4ADDR_TO_6TO4
* Given an IPv4 address and an IPv6 address for output, a 6to4 address
* will be created from the IPv4 Address.
* Note: This method for creating 6to4 addresses is not standardized
* outside of Solaris. The newly created 6to4 address will be of the form
* 2002:<V4ADDR>:<SUBNETID>::<HOSTID>, where SUBNETID will equal 0 and
* HOSTID will equal 1.
*
* void IN6_V4ADDR_TO_6TO4(const struct in_addr *v4, in6_addr_t *v6)
*
*/
#ifdef _BIG_ENDIAN
#else
#endif /* _BIG_ENDIAN */
/*
* IN6_ARE_ADDR_EQUAL (defined in RFC2292)
* Compares if IPv6 addresses are equal.
* Note: Compares in order of high likelyhood of a miss so we minimize
* compares. (Current heuristic order, compare in reverse order of
* uint32_t units)
*
* bool IN6_ARE_ADDR_EQUAL(const struct in6_addr *,
* const struct in6_addr *);
*/
#endif /* !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__) */
/*
* Options for use with [gs]etsockopt at the IP level.
*
* Note: Some of the IP_ namespace has conflict with and
* and is exposed through <xti.h>. (It also requires exposing
* options not implemented). The options with potential
* for conflicts use #ifndef guards.
*/
#ifndef IP_OPTIONS
#endif
#ifndef IP_TOS
#endif
#ifndef IP_TTL
#endif
/*
* IP_PKTINFO and IP_RECVPKTINFO have same value. Size of argument passed in
* is used to differentiate b/w the two.
*/
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
/*
* Different preferences that can be requested from IPSEC protocols.
*/
#define IPSEC_PREF_NEVER 0x01
#define IPSEC_PREF_REQUIRED 0x02
#define IPSEC_PREF_UNIQUE 0x04
/*
* This can be used with the setsockopt() call to set per socket security
* options. When the application uses per-socket API, we will reflect
* the request on both outbound and inbound packets.
*/
typedef struct ipsec_req {
} ipsec_req_t;
/*
* MCAST_* options are protocol-independent. The actual definitions
* are with the v6 options below; this comment is here to note the
* namespace usage.
*
* #define MCAST_JOIN_GROUP 0x29
* #define MCAST_LEAVE_GROUP 0x2a
* #define MCAST_BLOCK_SOURCE 0x2b
* #define MCAST_UNBLOCK_SOURCE 0x2c
* #define MCAST_JOIN_SOURCE_GROUP 0x2d
* #define MCAST_LEAVE_SOURCE_GROUP 0x2e
*/
#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
/*
* SunOS private (potentially not portable) IP_ option names
*/
/*
* IP_DONTFAILOVER_IF option is used to indicate that outbound unicast and
* multicast packets go through the specified interface, no load spreading,
* no failover.
* This is a Sun private interface.
*/
#define IP_DONTFAILOVER_IF 0x44
/*
* Option values and names (when !_XPG5) shared with <xti_inet.h>
*/
#ifndef IP_REUSEADDR
#define IP_REUSEADDR 0x104
#endif
#ifndef IP_DONTROUTE
#define IP_DONTROUTE 0x105
#endif
#ifndef IP_BROADCAST
#define IP_BROADCAST 0x106
#endif
/*
* The following option values are reserved by <xti_inet.h>
*
* T_IP_OPTIONS 0x107 - IP per-packet options
* T_IP_TOS 0x108 - IP per packet type of service
*/
/*
* Default value constants for multicast attributes controlled by
* IP*_MULTICAST_LOOP and IP*_MULTICAST_{TTL,HOPS} options.
*/
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
/*
* Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
*/
struct ip_mreq {
};
/*
* Argument structure for IP_BLOCK_SOURCE, IP_UNBLOCK_SOURCE,
* IP_ADD_SOURCE_MEMBERSHIP, and IP_DROP_SOURCE_MEMBERSHIP.
*/
struct ip_mreq_source {
};
/*
* Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP on
* IPv6 addresses.
*/
struct ipv6_mreq {
unsigned int ipv6mr_interface; /* interface index */
};
/*
* Use #pragma pack() construct to force 32-bit alignment on amd64.
* This is needed to keep the structure size and offsets consistent
* between a 32-bit app and the 64-bit amd64 kernel in structures
* where 64-bit alignment would create gaps (in this case, structures
* which have a uint32_t followed by a struct sockaddr_storage).
*/
#pragma pack(4)
#endif
/*
* Argument structure for MCAST_JOIN_GROUP and MCAST_LEAVE_GROUP.
*/
struct group_req {
};
/*
* Argument structure for MCAST_BLOCK_SOURCE, MCAST_UNBLOCK_SOURCE,
* MCAST_JOIN_SOURCE_GROUP, MCAST_LEAVE_SOURCE_GROUP.
*/
struct group_source_req {
};
/*
* Argument for SIOC[GS]MSFILTER ioctls
*/
struct group_filter {
};
#pragma pack()
#endif
#define GROUP_FILTER_SIZE(numsrc) \
(sizeof (struct group_filter) - sizeof (struct sockaddr_storage) \
+ (numsrc) * sizeof (struct sockaddr_storage))
/*
* Argument for SIOC[GS]IPMSFILTER ioctls (IPv4-specific)
*/
struct ip_msfilter {
};
#define IP_MSFILTER_SIZE(numsrc) \
(sizeof (struct ip_msfilter) - sizeof (struct in_addr) \
/*
* Multicast source filter manipulation functions in libsocket;
* defined in RFC 3678.
*/
uint_t, struct sockaddr_storage *);
uint_t *, struct sockaddr_storage *);
/*
* Definitions needed for [gs]etsourcefilter(), [gs]etipv4sourcefilter()
*/
#define MCAST_INCLUDE 1
#define MCAST_EXCLUDE 2
/*
* Argument struct for IP_PKTINFO option
*/
typedef struct in_pktinfo {
unsigned int ipi_ifindex; /* send/recv interface index */
} in_pktinfo_t;
/*
* Argument struct for IPV6_PKTINFO option
*/
struct in6_pktinfo {
unsigned int ipi6_ifindex; /* send/recv interface index */
};
/*
* Argument struct for IPV6_MTUINFO option
*/
struct ip6_mtuinfo {
};
/*
* IPv6 routing header types
*/
#define IPV6_RTHDR_TYPE_0 0
extern int inet6_rth_segments(const void *bp);
#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
/*
* Argument structure for IP_ADD_PROXY_ADDR.
* Note that this is an unstable, experimental interface. It may change
* later. Don't use it unless you know what it is.
*/
typedef struct {
struct in_addr in_prefix_addr;
unsigned int in_prefix_len;
} in_prefix_t;
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
/*
* IPv6 options
*/
/* packets. */
/* argument type: uint_t */
/* multicast packets. */
/* argument type: struct in6_addr */
/* multicast packets. */
/* argument type: uint_t */
/* multicast packets on same socket. */
/* argument type: uint_t */
/* argument type: struct ipv6_mreq */
/* argument type: struct ipv6_mreq */
/*
* IPV6_ADD_MEMBERSHIP and IPV6_DROP_MEMBERSHIP are being kept
* for backward compatibility. They have the same meaning as IPV6_JOIN_GROUP
* and IPV6_LEAVE_GROUP respectively.
*/
/* argument type: struct ipv6_mreq */
/* argument type: struct ipv6_mreq */
/* arg type: "struct in6_pktingo" - */
/* the routing header */
/* the routing header */
/*
* This options exists for backwards compatability and should no longer be
* used. Use IPV6_RECVDSTOPTS instead.
*/
#define _OLD_IPV6_RECVDSTOPTS 0x15
/*
* the receipt of both headers.
*/
#define IPV6_RECVRTHDRDSTOPTS 0x17
/*
*/
#define IPV6_RECVDSTOPTS 0x28
/*
* protocol-independent multicast membership options.
*/
/* 32Bit field for IPV6_SRC_PREFERENCES */
#define IPV6_PREFER_SRC_HOME 0x00000001
#define IPV6_PREFER_SRC_COA 0x00000002
#define IPV6_PREFER_SRC_PUBLIC 0x00000004
#define IPV6_PREFER_SRC_TMP 0x00000008
#define IPV6_PREFER_SRC_NONCGA 0x00000010
#define IPV6_PREFER_SRC_CGA 0x00000020
#define IPV6_PREFER_SRC_MASK (IPV6_PREFER_SRC_MIPMASK |\
#define IPV6_PREFER_SRC_DEFAULT (IPV6_PREFER_SRC_MIPDEFAULT |\
/*
* SunOS private (potentially not portable) IPV6_ option names
*/
/* unspecified (all zeros) */
/* No load balancing or failover */
/*
* IPV6_DONTFAILOVER_IF option is used to indicate that outbound unicast and
* multicast packets go through the specified interface, no load spreading,
* no failover.
* This is a Sun private interface.
*/
#define IPV6_DONTFAILOVER_IF 0x44
/*
* Miscellaneous IPv6 constants.
*/
/* decimal notation. */
/* standard colon-hex notation. */
#define IPV6_PAD1_OPT 0 /* pad byte in IPv6 extension hdrs */
#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
/*
* Extern declarations for pre-defined global const variables
*/
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
#ifndef _KERNEL
#ifdef __STDC__
extern const struct in6_addr in6addr_any;
extern const struct in6_addr in6addr_loopback;
#else
extern struct in6_addr in6addr_any;
extern struct in6_addr in6addr_loopback;
#endif
#endif
#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
#ifdef __cplusplus
}
#endif
#endif /* _NETINET_IN_H */