Commit 49dd5204 authored by ROOL's avatar ROOL 🤖
Browse files

Add support for RFC2553

Detail:
  headers/net/if.h: new defines, structs, prototypes per RFC2553.
  headers/netdb.h: new defines, structs, prototypes per RFC2553 (from FreeBSD revision 102227).
  headers/sys/socket.h: portability sockaddr_storage struct, extend list of PF_ and AF_ defines (from FreeBSD revision 102227).
  headers/netinet/in.h: new defines, structs, prototypes per RFC2553 (from FreeBSD in6.h revision 102227)
  inetlib/if_indextoname.c
          if_nameindex.c
          if_nametoindex.c: import of new interface functions (from FreeBSD revision 100138).
          in6addr.c: constant structs for in6addr_any and in6addr_loopback per RFC2553.
          getnainfo.c: import of new function (from FreeBSD revision 158790).
          getipnode.c: new (with hostentdup based on _hpcopy from FreeBSD revision 103335).
          getadinfo.c: new (with portions based on FreeBSD revision 103640).
  LibraryDoc: updated with summaries of the new functions in Inetlib.
Admin:
  Test harness in test/rfc2553.c e...
parent 04cc01fa
Acorn TCP/IP libraries version 5.65
Acorn TCP/IP libraries version 5.66
-----------------------------------
These libraries are an update to the libraries described in chapter 123 of the PRM
......@@ -907,6 +907,32 @@ Exported by
-----------
Unixlib
GETADDRINFO
===========
New prototype: int getaddrinfo(const char *nodename, const char *servname,
const struct addrinfo *hints,
struct addrinfo **res);
void freeaddrinfo(struct addrinfo *ai);
The getaddrinfo() function fills an addrinfo structure having looked up the
node and server name given. An optional hints structure can be given to direct
the output result, for example to restrict the return results to ones the
caller supports.
The hints flags can be combinations of AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST:
AI_PASSIVE - set if the caller plans to use the result with bind(),
otherwise connect()
AI_CANONNAME - try to return the canonical name in the first addrinfo
structure
AI_NUMERICHOST - this flag flag prevents any type of name resolution service
When finished with the result, it must be freed by the caller by calling
freeaddrinfo().
The return value from the function is 0 upon success or a nonzero error code.
The error code can be turned into a string, for example for use in error logs,
by passing the return value to gai_strerror().
GETEGID
=======
......@@ -923,13 +949,52 @@ GETHOSTBYNAME
New prototypes: struct hostent *gethostbyname(const char *name);
struct hostent *gethostbyaddr(const char *addr, int len, int type);
gethostbyaddr will now attempt to do its reverse name lookup using a DNS resolver
module, if present.
gethostbyaddr() will now attempt to do its reverse name lookup using a DNS
resolver module, if present.
Note that these functions are not thread safe, nor do they handle IPv6
addresses, and as such should be considered deprecated. See getipnodebyname()
and getipnodebyaddr() for suitable replacements.
GETIPNODEBY
===========
New prototypes: struct hostent *getipnodebyname(const char *name, int af,
int flags, int *error_num);
struct hostent *getipnodebyaddr(const void *src, size_t len,
int af, int *error_num);
void freehostent(struct hostent *ptr);
Performs nodename-to-address and address-to-nodename translation.
For getipnodebyname() the name argument can be either a node name or a
numeric address string. Using an address family of AF_INET is largely equivalent
to the former gethostbyname().
The flags argument specifies the types of addresses that are searched for, and
the types of addresses that are returned.
For getipnodebyaddr() takes similar arguments to the former gethostbyaddr(),
but adds a error return value rather than relying on the global errno value.
The hostent structure returned by getipnodebyname() and getipnodebyaddr() must
subsequently be freed by the caller by calling freehostent();
GETNAMEINFO
===========
New prototype: int getnameinfo(const struct sockaddr *sa, socklen_t salen,
char *host, size_t hostlen,
char *serv, size_t servlen,
int flags);
This function looks up an IP address and port number provided by the
caller in the DNS and system-specific database, and returns text
strings for both in buffers provided by the caller. The function
indicates successful completion by a zero return value; a non-zero
return value indicates failure.
GETNETENT
=========
New prototypes: struct netent *getnetbyname(const char *name);
struct netent *getnetbyaddr(long net, int type);
struct netent *getnetbyaddr(unsigned long net, int type);
GETOPT
======
......@@ -1104,64 +1169,45 @@ GETSOCKNAME
===========
New variants: ngetsockname and ogetsockname
SETSOCKOPT
==========
New prototype: int setsockopt(int s, int level, int optname, const void *optval, int optlen);
New options:
SO_REUSEPORT enables duplicate address and port bindings
SO_SNDLOWAT set minimum count for output
SO_RCVLOWAT set minimum count for input
SO_SNDTIMEO set timeout value for output
SO_RCVTIMEO set timeout value for input
SO_REUSEPORT allows completely
duplicate bindings by multiple processes if they all set SO_REUSEPORT before
binding the port. This option permits multiple instances of a program to
each receive UDP/IP multicast or broadcast datagrams destined for the bound
port.
SO_SNDLOWAT is an option to set the minimum count for output operations. Most
output operations process all of the data supplied by the call, delivering
data to the protocol for transmission and blocking as necessary for flow
control. Nonblocking output operations will process as much data as
permitted subject to flow control without blocking, but will process no data
if flow control does not allow the smaller of the low water mark value or the
entire request to be processed. A select operation testing the ability to
write to a socket will return true only if the low water mark amount could be
processed. The default value for SO_SNDLOWAT is set to a convenient size for
network efficiency, often 1024. SO_RCVLOWAT is an option to set the minimum
count for input operations. In general, receive calls will block until any
(non-zero) amount of data is received, then return with the smaller of the
amount available or the amount requested. The default value for SO_RCVLOWAT
is 1. If SO_RCVLOWAT is set to a larger value, blocking receive calls
normally wait until they have received the smaller of the low water mark
value or the requested amount. Receive calls may still return less than the
low water mark if an error occurs, a signal is caught, or the type of data
next in the receive queue is different than that returned.
SO_SNDTIMEO is an option to set a timeout value for output operations. It
accepts a struct timeval parameter with the number of seconds and micro-
seconds used to limit waits for output operations to complete. If a send
operation has blocked for this much time, it returns with a partial count or
with the error EWOULDBLOCK if no data were sent. In the current
implementation, this timer is restarted each time additional data are
delivered to the protocol, implying that the limit applies to output portion
ranging in size from the low water mark to the high water mark for output.
SO_RCVTIMEO is an option to set a timeout value for input operations. It
accepts a struct timeval parameter with the number of seconds and micro-
seconds used to limit waits for input operations to complete. In the
current implementation, this timer is restarted each time additional data are
received by the protocol, and thus the limit is in effect an inactivity
timer. If a receive operation has been blocked for this much time without
receiving additional data, it returns with a short count or with the error
EWOULDBLOCK if no data were received.
GETUID
======
New prototypes: unsigned long getuid(void);
unsigned long geteuid(void);
IF_INDEX
========
New prototypes: char *if_indextoname(unsigned int, char *);
unsigned int if_nametoindex(const char *);
struct if_nameindex *if_nameindex(void);
void if_freenameindex(struct if_nameindex *);
This API uses an interface index (a small positive integer) to
identify the local interface on which a multicast group is joined.
Interfaces are normally known by names such as "lo0", "em0", "ppp2",
and the like.
The API defines two functions that map between an interface name and
index, a third function that returns all the interface names and
indexes, and a fourth function to return the dynamic memory allocated
by the previous function.
IN6_IS...
=========
This family of macros tests an in6_addr structure and returns a boolean result
if the address given is of that type. The tests available are as follows:
IN6_IS_ADDR_LINKLOCAL(const struct in6_addr *);
IN6_IS_ADDR_LOOPBACK(const struct in6_addr *);
IN6_IS_ADDR_MC_GLOBAL(const struct in6_addr *);
IN6_IS_ADDR_MC_LINKLOCAL(const struct in6_addr *);
IN6_IS_ADDR_MC_NODELOCAL(const struct in6_addr *);
IN6_IS_ADDR_MC_ORGLOCAL(const struct in6_addr *);
IN6_IS_ADDR_MC_SITELOCAL(const struct in6_addr *);
IN6_IS_ADDR_MULTICAST(const struct in6_addr *);
IN6_IS_ADDR_SITELOCAL(const struct in6_addr *);
IN6_IS_ADDR_UNSPECIFIED(const struct in6_addr *);
IN6_IS_ADDR_V4COMPAT(const struct in6_addr *);
IN6_IS_ADDR_V4MAPPED(const struct in6_addr *);
INET_ADDR
......@@ -1169,7 +1215,7 @@ INET_ADDR
New prototypes: u_long inet_addr(const char *cp);
int inet_aton(const char *cp, struct in_addr *in);
u_long inet_network(const char *cp);
struct in_addr inet_makeaddr(u_long net, u_long host);
struct in_addr inet_makeaddr(u_long net, u_long host);
Four new functions have been defined:
......@@ -1202,8 +1248,6 @@ format (which is usually some kind of binary format). Return:
Convert a network format address to presentation format. Returns a pointer to
presentation format address (`dst'), or NULL (see errno).
_INET_ERROR
===========
......@@ -1280,7 +1324,7 @@ KVM
Name
----
KVM - kernel memory interface
KVM - kernel virtual memory interface
Synopsis
--------
......@@ -1500,6 +1544,62 @@ New prototypes: int send(int s, const void *msg, size_t len, int flags);
int sendto(int s, const void *msg, size_t len, int flags,
const struct sockaddr *to, int tolen);
SETSOCKOPT
==========
New prototype: int setsockopt(int s, int level, int optname, const void *optval, int optlen);
New options:
SO_REUSEPORT enables duplicate address and port bindings
SO_SNDLOWAT set minimum count for output
SO_RCVLOWAT set minimum count for input
SO_SNDTIMEO set timeout value for output
SO_RCVTIMEO set timeout value for input
SO_REUSEPORT allows completely
duplicate bindings by multiple processes if they all set SO_REUSEPORT before
binding the port. This option permits multiple instances of a program to
each receive UDP/IP multicast or broadcast datagrams destined for the bound
port.
SO_SNDLOWAT is an option to set the minimum count for output operations. Most
output operations process all of the data supplied by the call, delivering
data to the protocol for transmission and blocking as necessary for flow
control. Nonblocking output operations will process as much data as
permitted subject to flow control without blocking, but will process no data
if flow control does not allow the smaller of the low water mark value or the
entire request to be processed. A select operation testing the ability to
write to a socket will return true only if the low water mark amount could be
processed. The default value for SO_SNDLOWAT is set to a convenient size for
network efficiency, often 1024.
SO_RCVLOWAT is an option to set the minimum
count for input operations. In general, receive calls will block until any
(non-zero) amount of data is received, then return with the smaller of the
amount available or the amount requested. The default value for SO_RCVLOWAT
is 1. If SO_RCVLOWAT is set to a larger value, blocking receive calls
normally wait until they have received the smaller of the low water mark
value or the requested amount. Receive calls may still return less than the
low water mark if an error occurs, a signal is caught, or the type of data
next in the receive queue is different than that returned.
SO_SNDTIMEO is an option to set a timeout value for output operations. It
accepts a struct timeval parameter with the number of seconds and micro-
seconds used to limit waits for output operations to complete. If a send
operation has blocked for this much time, it returns with a partial count or
with the error EWOULDBLOCK if no data were sent. In the current
implementation, this timer is restarted each time additional data are
delivered to the protocol, implying that the limit applies to output portion
ranging in size from the low water mark to the high water mark for output.
SO_RCVTIMEO is an option to set a timeout value for input operations. It
accepts a struct timeval parameter with the number of seconds and micro-
seconds used to limit waits for input operations to complete. In the
current implementation, this timer is restarted each time additional data are
received by the protocol, and thus the limit is in effect an inactivity
timer. If a receive operation has been blocked for this much time without
receiving additional data, it returns with a short count or with the error
EWOULDBLOCK if no data were received.
SLEEP
=====
......
/* (5.65)
/* (5.66)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 5.65
#define Module_MajorVersion_CMHG 5.66
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 19 May 2018
#define Module_Date_CMHG 25 Aug 2018
#define Module_MajorVersion "5.65"
#define Module_Version 565
#define Module_MajorVersion "5.66"
#define Module_Version 566
#define Module_MinorVersion ""
#define Module_Date "19 May 2018"
#define Module_Date "25 Aug 2018"
#define Module_ApplicationDate "19-May-18"
#define Module_ApplicationDate "25-Aug-18"
#define Module_ComponentName "TCPIPLibs"
#define Module_ComponentPath "mixed/RiscOS/Sources/Lib/TCPIPLibs"
#define Module_FullVersion "5.65"
#define Module_HelpVersion "5.65 (19 May 2018)"
#define Module_LibraryVersionInfo "5:65"
#define Module_FullVersion "5.66"
#define Module_HelpVersion "5.66 (25 Aug 2018)"
#define Module_LibraryVersionInfo "5:66"
......@@ -56,7 +56,16 @@
#ifndef _NETDB_H_
#define _NETDB_H_
#define _PATH_HEQUIV "/etc/hosts.equiv"
#include <sys/cdefs.h>
#ifndef _SOCKLEN_T_DECLARED
typedef u_int32_t socklen_t;
#define _SOCKLEN_T_DECLARED
#endif
#ifndef _PATH_HEQUIV
# define _PATH_HEQUIV "/etc/hosts.equiv"
#endif
#define _PATH_HOSTS "/etc/hosts"
#define _PATH_NETWORKS "/etc/networks"
#define _PATH_PROTOCOLS "/etc/protocols"
......@@ -75,7 +84,7 @@ struct hostent {
int h_addrtype; /* host address type */
int h_length; /* length of address */
char **h_addr_list; /* list of addresses from name server */
#define h_addr h_addr_list[0] /* address, for backward compatiblity */
#define h_addr h_addr_list[0] /* address, for backward compatibility */
};
/*
......@@ -102,6 +111,17 @@ struct protoent {
int p_proto; /* protocol # */
};
struct addrinfo {
int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
int ai_family; /* PF_xxx */
int ai_socktype; /* SOCK_xxx */
int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
size_t ai_addrlen; /* length of ai_addr */
char *ai_canonname; /* canonical name for hostname */
struct sockaddr *ai_addr; /* binary address */
struct addrinfo *ai_next; /* next structure in linked list */
};
/*
* Error return codes from gethostbyname() and gethostbyaddr()
* (left in extern int h_errno).
......@@ -110,22 +130,79 @@ struct protoent {
#define NETDB_INTERNAL -1 /* see errno */
#define NETDB_SUCCESS 0 /* no problem */
#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
#define TRY_AGAIN 2 /* Non-Authoritative Host not found, or SERVERFAIL */
#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
#define NO_DATA 4 /* Valid name, no data record of requested type */
#define NO_ADDRESS NO_DATA /* no address, look for MX record */
#include <sys/cdefs.h>
/*
* Error return codes from getaddrinfo()
*/
#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */
#define EAI_AGAIN 2 /* temporary failure in name resolution */
#define EAI_BADFLAGS 3 /* invalid value for ai_flags */
#define EAI_FAIL 4 /* non-recoverable failure in name resolution */
#define EAI_FAMILY 5 /* ai_family not supported */
#define EAI_MEMORY 6 /* memory allocation failure */
#define EAI_NODATA 7 /* no address associated with hostname */
#define EAI_NONAME 8 /* hostname nor servname provided, or not known */
#define EAI_SERVICE 9 /* servname not supported for ai_socktype */
#define EAI_SOCKTYPE 10 /* ai_socktype not supported */
#define EAI_SYSTEM 11 /* system error returned in errno */
#define EAI_BADHINTS 12
#define EAI_PROTOCOL 13
#define EAI_MAX 14
/*
* Flag values for getaddrinfo()
*/
#define AI_PASSIVE 0x00000001 /* get address to use bind() */
#define AI_CANONNAME 0x00000002 /* fill ai_canonname */
#define AI_NUMERICHOST 0x00000004 /* prevent name resolution */
/* valid flags for addrinfo */
#define AI_MASK \
(AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_ADDRCONFIG)
#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */
#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */
#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */
#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */
/* special recommended flags for getipnodebyname */
#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG)
/*
* Constants for getnameinfo()
*/
#define NI_MAXHOST 1025
#define NI_MAXSERV 32
/*
* Flag values for getnameinfo()
*/
#define NI_NOFQDN 0x00000001
#define NI_NUMERICHOST 0x00000002
#define NI_NAMEREQD 0x00000004
#define NI_NUMERICSERV 0x00000008
#define NI_DGRAM 0x00000010
#define NI_WITHSCOPEID 0x00000020
/*
* Scope delimit character
*/
#define SCOPE_DELIMITER '%'
__BEGIN_DECLS
void endhostent(void);
void endnetent(void);
void endprotoent(void);
void endservent(void);
void freehostent(struct hostent *);
struct hostent *gethostbyaddr(const char *, int, int);
struct hostent *gethostbyname(const char *);
struct hostent *gethostent(void);
struct netent *getnetbyaddr(long, int); /* u_long? */
struct hostent *getipnodebyaddr(const void *, size_t, int, int *);
struct hostent *getipnodebyname(const char *, int, int, int *);
struct netent *getnetbyaddr(unsigned long, int);
struct netent *getnetbyname(const char *);
struct netent *getnetent(void);
struct protoent *getprotobyname(const char *);
......@@ -140,6 +217,12 @@ void sethostent(int);
/* void sethostfile(const char *); */
void setnetent(int);
void setprotoent(int);
int getaddrinfo(const char *, const char *,
const struct addrinfo *, struct addrinfo **);
int getnameinfo(const struct sockaddr *, socklen_t, char *,
size_t, char *, size_t, int);
void freeaddrinfo(struct addrinfo *);
const char *gai_strerror(int);
void setservent(int);
__END_DECLS
......
......@@ -45,6 +45,13 @@
#include <sys/time.h>
#endif
/*
* Length of interface external name, including terminating '\0'.
* Note: this is the same size as a generic device's external name.
*/
#define IF_NAMESIZE 16
#define IFNAMSIZ IF_NAMESIZE
/*
* Structure describing information about an interface
* which may be of interest to management entities.
......@@ -166,7 +173,6 @@ struct ifma_msghdr {
* remainder may be interface specific.
*/
struct ifreq {
#define IFNAMSIZ 16
char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
union {
struct sockaddr ifru_addr;
......@@ -299,12 +305,17 @@ MALLOC_DECLARE(M_IFMADDR);
#endif
#ifdef KERNEL
#ifndef __riscos
struct proc;
int prison_if(struct proc *p, struct sockaddr *sa);
/* XXX - this should go away soon */
#endif
#include <net/if_var.h>
#else
struct if_nameindex {
unsigned int if_index; /* 1, 2, ... */
char *if_name; /* null terminated name: "le0", ... */
};
void if_freenameindex(struct if_nameindex *);
char *if_indextoname(unsigned int, char *);
struct if_nameindex *if_nameindex(void);
unsigned int if_nametoindex(const char *);
#endif
#endif /* !_NET_IF_H_ */
......@@ -37,6 +37,18 @@
#ifndef _NETINET_IN_H_
#define _NETINET_IN_H_
/*
* Data types.
*/
#ifndef _SA_FAMILY_T_DECLARED
#define _SA_FAMILY_T_DECLARED
typedef u_char sa_family_t;
#endif
#ifndef _SOCKLEN_T_DECLARED
#define _SOCKLEN_T_DECLARED
typedef u_int32_t socklen_t;
#endif
/*
*
* Constants and structures defined by the internet system,
......@@ -50,7 +62,8 @@
#define IPPROTO_ICMP 1 /* control message protocol */
#define IPPROTO_IGMP 2 /* group mgmt protocol */
#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */
#define IPPROTO_IPIP 4 /* IP encapsulation in IP */
#define IPPROTO_IPV4 4 /* IPv4 encapsulation */
#define IPPROTO_IPIP IPPROTO_IPV4 /* for compatibility */
#define IPPROTO_TCP 6 /* tcp */
#define IPPROTO_ST 7 /* Stream protocol II */
#define IPPROTO_EGP 8 /* exterior gateway protocol */
......@@ -75,6 +88,8 @@
#define IPPROTO_RDP 27 /* Reliable Data */
#define IPPROTO_IRTP 28 /* Reliable Transaction */
#define IPPROTO_TP 29 /* tp-4 w/ class negotiation */
#define IPPROTO_BLT 30 /* Bulk Data Transfer */
#define IPPROTO_NSP 31 /* Network Services */
#define IPPROTO_INP 32 /* Merit Internodal */
#define IPPROTO_SEP 33 /* Sequential Exchange */
#define IPPROTO_3PC 34 /* Third Party Connect */
......@@ -84,21 +99,26 @@
#define IPPROTO_CMTP 38 /* Control Message Transport */
#define IPPROTO_TPXX 39 /* TP++ Transport */
#define IPPROTO_IL 40 /* IL transport protocol */
#define IPPROTO_SIP 41 /* Simple Internet Protocol */
#define IPPROTO_IPV6 41 /* IP6 header */
#define IPPROTO_SDRP 42 /* Source Demand Routing */
#define IPPROTO_SIPSR 43 /* SIP Source Route */
#define IPPROTO_SIPFRAG 44 /* SIP Fragment */
#define IPPROTO_ROUTING 43 /* IP6 routing header */
#define IPPROTO_FRAGMENT 44 /* IP6 fragmentation header */
#define IPPROTO_IDRP 45 /* InterDomain Routing*/
#define IPPROTO_RSVP 46 /* resource reservation */
#define IPPROTO_GRE 47 /* General Routing Encap. */
#define IPPROTO_MHRP 48 /* Mobile Host Routing */
#define IPPROTO_BHA 49 /* BHA */
#define IPPROTO_ESP 50 /* SIPP Encap Sec. Payload */
#define IPPROTO_AH 51 /* SIPP Auth Header */
#define IPPROTO_ESP 50 /* IP6 Encap Sec. Payload */
#define IPPROTO_AH 51 /* IP6 Auth Header */
#define IPPROTO_INLSP 52 /* Integ. Net Layer Security */
#define IPPROTO_SWIPE 53 /* IP with encryption */
#define IPPROTO_NHRP 54 /* Next Hop Resolution */
/* 55-60: Unassigned */
#define IPPROTO_MOBILE 55 /* IP Mobility */
#define IPPROTO_TLSP 56 /* Transport Layer Security */
#define IPPROTO_SKIP 57 /* SKIP */
#define IPPROTO_ICMPV6 58 /* ICMP6 */
#define IPPROTO_NONE 59 /* IP6 no next header */
#define IPPROTO_DSTOPTS 60 /* IP6 destination option */
#define IPPROTO_AHIP 61 /* any host internal protocol */
#define IPPROTO_CFTP 62 /* CFTP */
#define IPPROTO_HELLO 63 /* "hello" routing protocol */
......@@ -137,10 +157,11 @@
#define IPPROTO_SCCSP 96 /* Semaphore Comm. security */
#define IPPROTO_ETHERIP 97 /* Ethernet IP encapsulation */
#define IPPROTO_ENCAP 98 /* encapsulation header */
#define IPPROTO_APES 99 /* any private encr. scheme */
#define IPPROTO_GMTP 100 /* GMTP*/
#define IPPROTO_IPCOMP 108 /* payload compression (IPComp) */
/* 101-254: Partly Unassigned */
#define IPPROTO_PIM 103 /* Protocol Independent Mcast */
#define IPPROTO_PGM 113 /* PGM */
/* 255: Reserved */
/* BSD Private, local use, namespace incursion */
......@@ -255,6 +276,7 @@ struct in_addr {
#define IN_EXPERIMENTAL(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
#define IN_BADCLASS(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
#define INADDR_LOOPBACK (u_int32_t)0x7f000001
#define INADDR_ANY (u_int32_t)0x00000000
#define INADDR_BROADCAST (u_int32_t)0xffffffff /* must be masked */
#ifndef KERNEL
......@@ -290,6 +312,8 @@ struct sockaddr_in {
char sin_zero[8];
};
#define INET_ADDRSTRLEN 16
/*
* Structure used to describe IP options.
* Used to store options internally, to pass them to a process,
......@@ -449,4 +473,134 @@ extern ip_fw_chk_t *ip_fw_chk_ptr;
extern ip_fw_ctl_t *ip_fw_ctl_ptr;
#endif /* KERNEL */
/*
* IPv6 address
*/
struct in6_addr {
union {
u_char __u6_addr8[16];
u_short __u6_addr16[8];
u_long __u6_addr32[4];
} __u6_addr; /* 128-bit IP6 address */
};
#define s6_addr __u6_addr.__u6_addr8
#define INET6_ADDRSTRLEN 46
/*
* Socket address for IPv6
*/
#define SIN6_LEN
struct sockaddr_in6 {
u_char sin6_len; /* length of this struct */
sa_family_t sin6_family; /* AF_INET6 */
u_short sin6_port; /* Transport layer port # */
u_long sin6_flowinfo; /* IP6 flow information */
struct in6_addr sin6_addr; /* IP6 address */
u_long sin6_scope_id; /* scope zone index */
};
/*
* Options for use with [gs]etsockopt at the IPV6 level.
* First word of comment is data type; bool is stored in int.
*/
#define IPV6_JOIN_GROUP 12 /* ip6_mreq; join a group membership */
#define IPV6_LEAVE_GROUP 13 /* ip6_mreq; leave a group membership */
#define IPV6_MULTICAST_HOPS 10 /* int; set/get IP6 multicast hops */
#define IPV6_MULTICAST_IF 9 /* u_int; set/get IP6 multicast i/f */
#define IPV6_MULTICAST_LOOP 11 /* u_int; set/get IP6 multicast loopback */
#define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */
/*
* Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP.
*/
struct ipv6_mreq {
struct in6_addr ipv6mr_multiaddr;
unsigned int ipv6mr_interface;
};