in.h revision 74700
11541Srgrimes/* 21541Srgrimes * Copyright (c) 1982, 1986, 1990, 1993 31541Srgrimes * The Regents of the University of California. All rights reserved. 41541Srgrimes * 51541Srgrimes * Redistribution and use in source and binary forms, with or without 61541Srgrimes * modification, are permitted provided that the following conditions 71541Srgrimes * are met: 81541Srgrimes * 1. Redistributions of source code must retain the above copyright 91541Srgrimes * notice, this list of conditions and the following disclaimer. 101541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 111541Srgrimes * notice, this list of conditions and the following disclaimer in the 121541Srgrimes * documentation and/or other materials provided with the distribution. 131541Srgrimes * 3. All advertising materials mentioning features or use of this software 141541Srgrimes * must display the following acknowledgement: 151541Srgrimes * This product includes software developed by the University of 161541Srgrimes * California, Berkeley and its contributors. 171541Srgrimes * 4. Neither the name of the University nor the names of its contributors 181541Srgrimes * may be used to endorse or promote products derived from this software 191541Srgrimes * without specific prior written permission. 201541Srgrimes * 211541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 221541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 231541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 241541Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 251541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 261541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 271541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 281541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 291541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 301541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 311541Srgrimes * SUCH DAMAGE. 321541Srgrimes * 331541Srgrimes * @(#)in.h 8.3 (Berkeley) 1/3/94 3450477Speter * $FreeBSD: head/sys/netinet/in.h 74700 2001-03-23 18:59:31Z ume $ 351541Srgrimes */ 361541Srgrimes 372169Spaul#ifndef _NETINET_IN_H_ 382169Spaul#define _NETINET_IN_H_ 392169Spaul 401541Srgrimes/* 411541Srgrimes * Constants and structures defined by the internet system, 421541Srgrimes * Per RFC 790, September 1981, and numerous additions. 431541Srgrimes */ 441541Srgrimes 451541Srgrimes/* 4633804Sjulian * Protocols (RFC 1700) 471541Srgrimes */ 481541Srgrimes#define IPPROTO_IP 0 /* dummy for IP */ 4952904Sshin#define IPPROTO_HOPOPTS 0 /* IP6 hop-by-hop options */ 501541Srgrimes#define IPPROTO_ICMP 1 /* control message protocol */ 511541Srgrimes#define IPPROTO_IGMP 2 /* group mgmt protocol */ 521541Srgrimes#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */ 5352904Sshin#define IPPROTO_IPV4 4 /* IPv4 encapsulation */ 5452904Sshin#define IPPROTO_IPIP IPPROTO_IPV4 /* for compatibility */ 551541Srgrimes#define IPPROTO_TCP 6 /* tcp */ 5633804Sjulian#define IPPROTO_ST 7 /* Stream protocol II */ 571541Srgrimes#define IPPROTO_EGP 8 /* exterior gateway protocol */ 5833804Sjulian#define IPPROTO_PIGP 9 /* private interior gateway */ 5933804Sjulian#define IPPROTO_RCCMON 10 /* BBN RCC Monitoring */ 6033804Sjulian#define IPPROTO_NVPII 11 /* network voice protocol*/ 611541Srgrimes#define IPPROTO_PUP 12 /* pup */ 6233804Sjulian#define IPPROTO_ARGUS 13 /* Argus */ 6333804Sjulian#define IPPROTO_EMCON 14 /* EMCON */ 6433804Sjulian#define IPPROTO_XNET 15 /* Cross Net Debugger */ 6533804Sjulian#define IPPROTO_CHAOS 16 /* Chaos*/ 661541Srgrimes#define IPPROTO_UDP 17 /* user datagram protocol */ 6733804Sjulian#define IPPROTO_MUX 18 /* Multiplexing */ 6833804Sjulian#define IPPROTO_MEAS 19 /* DCN Measurement Subsystems */ 6933804Sjulian#define IPPROTO_HMP 20 /* Host Monitoring */ 7033804Sjulian#define IPPROTO_PRM 21 /* Packet Radio Measurement */ 711541Srgrimes#define IPPROTO_IDP 22 /* xns idp */ 7233804Sjulian#define IPPROTO_TRUNK1 23 /* Trunk-1 */ 7333804Sjulian#define IPPROTO_TRUNK2 24 /* Trunk-2 */ 7433804Sjulian#define IPPROTO_LEAF1 25 /* Leaf-1 */ 7533804Sjulian#define IPPROTO_LEAF2 26 /* Leaf-2 */ 7633804Sjulian#define IPPROTO_RDP 27 /* Reliable Data */ 7733804Sjulian#define IPPROTO_IRTP 28 /* Reliable Transaction */ 781541Srgrimes#define IPPROTO_TP 29 /* tp-4 w/ class negotiation */ 7933804Sjulian#define IPPROTO_BLT 30 /* Bulk Data Transfer */ 8033804Sjulian#define IPPROTO_NSP 31 /* Network Services */ 8133804Sjulian#define IPPROTO_INP 32 /* Merit Internodal */ 8233804Sjulian#define IPPROTO_SEP 33 /* Sequential Exchange */ 8333804Sjulian#define IPPROTO_3PC 34 /* Third Party Connect */ 8433804Sjulian#define IPPROTO_IDPR 35 /* InterDomain Policy Routing */ 8533804Sjulian#define IPPROTO_XTP 36 /* XTP */ 8633804Sjulian#define IPPROTO_DDP 37 /* Datagram Delivery */ 8733804Sjulian#define IPPROTO_CMTP 38 /* Control Message Transport */ 8833804Sjulian#define IPPROTO_TPXX 39 /* TP++ Transport */ 8933804Sjulian#define IPPROTO_IL 40 /* IL transport protocol */ 9052904Sshin#define IPPROTO_IPV6 41 /* IP6 header */ 9133804Sjulian#define IPPROTO_SDRP 42 /* Source Demand Routing */ 9252904Sshin#define IPPROTO_ROUTING 43 /* IP6 routing header */ 9352904Sshin#define IPPROTO_FRAGMENT 44 /* IP6 fragmentation header */ 9433804Sjulian#define IPPROTO_IDRP 45 /* InterDomain Routing*/ 9552904Sshin#define IPPROTO_RSVP 46 /* resource reservation */ 9633804Sjulian#define IPPROTO_GRE 47 /* General Routing Encap. */ 9733804Sjulian#define IPPROTO_MHRP 48 /* Mobile Host Routing */ 9833804Sjulian#define IPPROTO_BHA 49 /* BHA */ 9952904Sshin#define IPPROTO_ESP 50 /* IP6 Encap Sec. Payload */ 10052904Sshin#define IPPROTO_AH 51 /* IP6 Auth Header */ 10133804Sjulian#define IPPROTO_INLSP 52 /* Integ. Net Layer Security */ 10233804Sjulian#define IPPROTO_SWIPE 53 /* IP with encryption */ 10333804Sjulian#define IPPROTO_NHRP 54 /* Next Hop Resolution */ 10472486Sasmodai#define IPPROTO_MOBILE 55 /* IP Mobility */ 10572486Sasmodai#define IPPROTO_TLSP 56 /* Transport Layer Security */ 10672486Sasmodai#define IPPROTO_SKIP 57 /* SKIP */ 10752904Sshin#define IPPROTO_ICMPV6 58 /* ICMP6 */ 10852904Sshin#define IPPROTO_NONE 59 /* IP6 no next header */ 10952904Sshin#define IPPROTO_DSTOPTS 60 /* IP6 destination option */ 11033804Sjulian#define IPPROTO_AHIP 61 /* any host internal protocol */ 11133804Sjulian#define IPPROTO_CFTP 62 /* CFTP */ 11233804Sjulian#define IPPROTO_HELLO 63 /* "hello" routing protocol */ 11333804Sjulian#define IPPROTO_SATEXPAK 64 /* SATNET/Backroom EXPAK */ 11433804Sjulian#define IPPROTO_KRYPTOLAN 65 /* Kryptolan */ 11533804Sjulian#define IPPROTO_RVD 66 /* Remote Virtual Disk */ 11633804Sjulian#define IPPROTO_IPPC 67 /* Pluribus Packet Core */ 11733804Sjulian#define IPPROTO_ADFS 68 /* Any distributed FS */ 11833804Sjulian#define IPPROTO_SATMON 69 /* Satnet Monitoring */ 11933804Sjulian#define IPPROTO_VISA 70 /* VISA Protocol */ 12033804Sjulian#define IPPROTO_IPCV 71 /* Packet Core Utility */ 12133804Sjulian#define IPPROTO_CPNX 72 /* Comp. Prot. Net. Executive */ 12233804Sjulian#define IPPROTO_CPHB 73 /* Comp. Prot. HeartBeat */ 12333804Sjulian#define IPPROTO_WSN 74 /* Wang Span Network */ 12433804Sjulian#define IPPROTO_PVP 75 /* Packet Video Protocol */ 12533804Sjulian#define IPPROTO_BRSATMON 76 /* BackRoom SATNET Monitoring */ 12633804Sjulian#define IPPROTO_ND 77 /* Sun net disk proto (temp.) */ 12733804Sjulian#define IPPROTO_WBMON 78 /* WIDEBAND Monitoring */ 12833804Sjulian#define IPPROTO_WBEXPAK 79 /* WIDEBAND EXPAK */ 1291541Srgrimes#define IPPROTO_EON 80 /* ISO cnlp */ 13033804Sjulian#define IPPROTO_VMTP 81 /* VMTP */ 13133804Sjulian#define IPPROTO_SVMTP 82 /* Secure VMTP */ 13233804Sjulian#define IPPROTO_VINES 83 /* Banyon VINES */ 13333804Sjulian#define IPPROTO_TTP 84 /* TTP */ 13433804Sjulian#define IPPROTO_IGP 85 /* NSFNET-IGP */ 13533804Sjulian#define IPPROTO_DGP 86 /* dissimilar gateway prot. */ 13633814Sjulian#define IPPROTO_TCF 87 /* TCF */ 13733804Sjulian#define IPPROTO_IGRP 88 /* Cisco/GXS IGRP */ 13833804Sjulian#define IPPROTO_OSPFIGP 89 /* OSPFIGP */ 13933804Sjulian#define IPPROTO_SRPC 90 /* Strite RPC protocol */ 14033804Sjulian#define IPPROTO_LARP 91 /* Locus Address Resoloution */ 14133804Sjulian#define IPPROTO_MTP 92 /* Multicast Transport */ 14233804Sjulian#define IPPROTO_AX25 93 /* AX.25 Frames */ 14333804Sjulian#define IPPROTO_IPEIP 94 /* IP encapsulated in IP */ 14433804Sjulian#define IPPROTO_MICP 95 /* Mobile Int.ing control */ 14533804Sjulian#define IPPROTO_SCCSP 96 /* Semaphore Comm. security */ 14633804Sjulian#define IPPROTO_ETHERIP 97 /* Ethernet IP encapsulation */ 1471541Srgrimes#define IPPROTO_ENCAP 98 /* encapsulation header */ 14833804Sjulian#define IPPROTO_APES 99 /* any private encr. scheme */ 14933804Sjulian#define IPPROTO_GMTP 100 /* GMTP*/ 15052904Sshin#define IPPROTO_IPCOMP 108 /* payload compression (IPComp) */ 15146420Sluigi/* 101-254: Partly Unassigned */ 15252904Sshin#define IPPROTO_PIM 103 /* Protocol Independent Mcast */ 15346420Sluigi#define IPPROTO_PGM 113 /* PGM */ 15433804Sjulian/* 255: Reserved */ 15533804Sjulian/* BSD Private, local use, namespace incursion */ 15617072Sjulian#define IPPROTO_DIVERT 254 /* divert pseudo-protocol */ 1571541Srgrimes#define IPPROTO_RAW 255 /* raw IP packet */ 1581541Srgrimes#define IPPROTO_MAX 256 1591541Srgrimes 16052904Sshin/* last return value of *_input(), meaning "all job for this pkt is done". */ 16152904Sshin#define IPPROTO_DONE 257 1621541Srgrimes 1631541Srgrimes/* 1641541Srgrimes * Local port number conventions: 16514195Speter * 16614195Speter * When a user does a bind(2) or connect(2) with a port number of zero, 16714195Speter * a non-conflicting local port address is chosen. 16814195Speter * The default range is IPPORT_RESERVED through 16914195Speter * IPPORT_USERRESERVED, although that is settable by sysctl. 17014195Speter * 17114195Speter * A user may set the IPPROTO_IP option IP_PORTRANGE to change this 17214195Speter * default assignment range. 17314195Speter * 17414195Speter * The value IP_PORTRANGE_DEFAULT causes the default behavior. 17514195Speter * 17614195Speter * The value IP_PORTRANGE_HIGH changes the range of candidate port numbers 17714195Speter * into the "high" range. These are reserved for client outbound connections 17814195Speter * which do not want to be filtered by any firewalls. 17914195Speter * 18014195Speter * The value IP_PORTRANGE_LOW changes the range to the "low" are 18114195Speter * that is (by convention) restricted to privileged processes. This 18214195Speter * convention is based on "vouchsafe" principles only. It is only secure 18314195Speter * if you trust the remote host to restrict these ports. 18414195Speter * 18514195Speter * The default range of ports and the high range can be changed by 18617541Speter * sysctl(3). (net.inet.ip.port{hi,low}{first,last}_auto) 18714195Speter * 18814195Speter * Changing those values has bad security implications if you are 18914195Speter * using a a stateless firewall that is allowing packets outside of that 19014195Speter * range in order to allow transparent outgoing connections. 19114195Speter * 19214195Speter * Such a firewall configuration will generally depend on the use of these 19314195Speter * default values. If you change them, you may find your Security 19414195Speter * Administrator looking for you with a heavy object. 19535304Sphk * 19635304Sphk * For a slightly more orthodox text view on this: 19735304Sphk * 19835304Sphk * ftp://ftp.isi.edu/in-notes/iana/assignments/port-numbers 19935304Sphk * 20035304Sphk * port numbers are divided into three ranges: 20135304Sphk * 20235304Sphk * 0 - 1023 Well Known Ports 20335304Sphk * 1024 - 49151 Registered Ports 20435304Sphk * 49152 - 65535 Dynamic and/or Private Ports 20535304Sphk * 20614195Speter */ 20714195Speter 20814195Speter/* 2091541Srgrimes * Ports < IPPORT_RESERVED are reserved for 21014195Speter * privileged processes (e.g. root). (IP_PORTRANGE_LOW) 2111541Srgrimes * Ports > IPPORT_USERRESERVED are reserved 21214195Speter * for servers, not necessarily privileged. (IP_PORTRANGE_DEFAULT) 2131541Srgrimes */ 2141541Srgrimes#define IPPORT_RESERVED 1024 2151541Srgrimes#define IPPORT_USERRESERVED 5000 2161541Srgrimes 2171541Srgrimes/* 21814195Speter * Default local port range to use by setting IP_PORTRANGE_HIGH 21913491Speter */ 22035304Sphk#define IPPORT_HIFIRSTAUTO 49152 22135304Sphk#define IPPORT_HILASTAUTO 65535 22213491Speter 22313491Speter/* 22417541Speter * Scanning for a free reserved port return a value below IPPORT_RESERVED, 22517541Speter * but higher than IPPORT_RESERVEDSTART. Traditionally the start value was 22617541Speter * 512, but that conflicts with some well-known-services that firewalls may 22717541Speter * have a fit if we use. 22817541Speter */ 22917541Speter#define IPPORT_RESERVEDSTART 600 23017541Speter 23117541Speter/* 2321541Srgrimes * Internet address (a structure for historical reasons) 2331541Srgrimes */ 2341541Srgrimesstruct in_addr { 23574700Sume in_addr_t s_addr; 2361541Srgrimes}; 2371541Srgrimes 2381541Srgrimes/* 2391541Srgrimes * Definitions of bits in internet address integers. 2401541Srgrimes * On subnets, the decomposition of addresses to host and net parts 2411541Srgrimes * is done according to subnet mask, not the masks here. 2421541Srgrimes */ 24335919Sjb#define IN_CLASSA(i) (((u_int32_t)(i) & 0x80000000) == 0) 2441541Srgrimes#define IN_CLASSA_NET 0xff000000 2451541Srgrimes#define IN_CLASSA_NSHIFT 24 2461541Srgrimes#define IN_CLASSA_HOST 0x00ffffff 2471541Srgrimes#define IN_CLASSA_MAX 128 2481541Srgrimes 24935919Sjb#define IN_CLASSB(i) (((u_int32_t)(i) & 0xc0000000) == 0x80000000) 2501541Srgrimes#define IN_CLASSB_NET 0xffff0000 2511541Srgrimes#define IN_CLASSB_NSHIFT 16 2521541Srgrimes#define IN_CLASSB_HOST 0x0000ffff 2531541Srgrimes#define IN_CLASSB_MAX 65536 2541541Srgrimes 25535919Sjb#define IN_CLASSC(i) (((u_int32_t)(i) & 0xe0000000) == 0xc0000000) 2561541Srgrimes#define IN_CLASSC_NET 0xffffff00 2571541Srgrimes#define IN_CLASSC_NSHIFT 8 2581541Srgrimes#define IN_CLASSC_HOST 0x000000ff 2591541Srgrimes 26035919Sjb#define IN_CLASSD(i) (((u_int32_t)(i) & 0xf0000000) == 0xe0000000) 2611541Srgrimes#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */ 2621541Srgrimes#define IN_CLASSD_NSHIFT 28 /* net and host fields, but */ 2631541Srgrimes#define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */ 2641541Srgrimes#define IN_MULTICAST(i) IN_CLASSD(i) 2651541Srgrimes 26635919Sjb#define IN_EXPERIMENTAL(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000) 26735919Sjb#define IN_BADCLASS(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000) 2681541Srgrimes 26935919Sjb#define INADDR_ANY (u_int32_t)0x00000000 27035919Sjb#define INADDR_LOOPBACK (u_int32_t)0x7f000001 27135919Sjb#define INADDR_BROADCAST (u_int32_t)0xffffffff /* must be masked */ 27255205Speter#ifndef _KERNEL 2731541Srgrimes#define INADDR_NONE 0xffffffff /* -1 return */ 2741541Srgrimes#endif 2751541Srgrimes 27635919Sjb#define INADDR_UNSPEC_GROUP (u_int32_t)0xe0000000 /* 224.0.0.0 */ 27735919Sjb#define INADDR_ALLHOSTS_GROUP (u_int32_t)0xe0000001 /* 224.0.0.1 */ 27835919Sjb#define INADDR_ALLRTRS_GROUP (u_int32_t)0xe0000002 /* 224.0.0.2 */ 27935919Sjb#define INADDR_MAX_LOCAL_GROUP (u_int32_t)0xe00000ff /* 224.0.0.255 */ 2801541Srgrimes 2811541Srgrimes#define IN_LOOPBACKNET 127 /* official! */ 2821541Srgrimes 2831541Srgrimes/* 2841541Srgrimes * Socket address, internet style. 2851541Srgrimes */ 2861541Srgrimesstruct sockaddr_in { 2871541Srgrimes u_char sin_len; 2881541Srgrimes u_char sin_family; 2891541Srgrimes u_short sin_port; 2901541Srgrimes struct in_addr sin_addr; 2911541Srgrimes char sin_zero[8]; 2921541Srgrimes}; 2931541Srgrimes 29452904Sshin#define INET_ADDRSTRLEN 16 29552904Sshin 2961541Srgrimes/* 2971541Srgrimes * Structure used to describe IP options. 2981541Srgrimes * Used to store options internally, to pass them to a process, 2991541Srgrimes * or to restore options retrieved earlier. 3001541Srgrimes * The ip_dst is used for the first-hop gateway when using a source route 3011541Srgrimes * (this gets put into the header proper). 3021541Srgrimes */ 3031541Srgrimesstruct ip_opts { 3041541Srgrimes struct in_addr ip_dst; /* first hop, 0 w/o src rt */ 3051541Srgrimes char ip_opts[40]; /* actually variable in size */ 3061541Srgrimes}; 3071541Srgrimes 3081541Srgrimes/* 3091541Srgrimes * Options for use with [gs]etsockopt at the IP level. 3101541Srgrimes * First word of comment is data type; bool is stored in int. 3111541Srgrimes */ 3121541Srgrimes#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */ 3131541Srgrimes#define IP_HDRINCL 2 /* int; header is included with data */ 3141541Srgrimes#define IP_TOS 3 /* int; IP type of service and preced. */ 3151541Srgrimes#define IP_TTL 4 /* int; IP time to live */ 3161541Srgrimes#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */ 3171541Srgrimes#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */ 3181541Srgrimes#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */ 3191541Srgrimes#define IP_RETOPTS 8 /* ip_opts; set/get IP options */ 3201541Srgrimes#define IP_MULTICAST_IF 9 /* u_char; set/get IP multicast i/f */ 3211541Srgrimes#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */ 3221541Srgrimes#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */ 3231541Srgrimes#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */ 3241541Srgrimes#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */ 3252531Swollman#define IP_MULTICAST_VIF 14 /* set/get IP mcast virt. iface */ 3262531Swollman#define IP_RSVP_ON 15 /* enable RSVP in kernel */ 3272531Swollman#define IP_RSVP_OFF 16 /* disable RSVP in kernel */ 3289209Swollman#define IP_RSVP_VIF_ON 17 /* set RSVP per-vif socket */ 3299209Swollman#define IP_RSVP_VIF_OFF 18 /* unset RSVP per-vif socket */ 33014195Speter#define IP_PORTRANGE 19 /* int; range to choose for unspec port */ 33119622Sfenner#define IP_RECVIF 20 /* bool; receive reception if w/dgram */ 33252904Sshin/* for IPSEC */ 33352904Sshin#define IP_IPSEC_POLICY 21 /* int; set/get security policy */ 33452904Sshin#define IP_FAITH 22 /* bool; accept FAITH'ed connections */ 3351541Srgrimes 33652904Sshin#define IP_FW_ADD 50 /* add a firewall rule to chain */ 33752904Sshin#define IP_FW_DEL 51 /* delete a firewall rule from chain */ 33852904Sshin#define IP_FW_FLUSH 52 /* flush firewall rule chain */ 33952904Sshin#define IP_FW_ZERO 53 /* clear single/all firewall counter(s) */ 34052904Sshin#define IP_FW_GET 54 /* get entire firewall rule chain */ 34152904Sshin#define IP_FW_RESETLOG 55 /* reset logging counters */ 34217758Ssos 34341793Sluigi#define IP_DUMMYNET_CONFIGURE 60 /* add/configure a dummynet pipe */ 34441793Sluigi#define IP_DUMMYNET_DEL 61 /* delete a dummynet pipe from chain */ 34541793Sluigi#define IP_DUMMYNET_FLUSH 62 /* flush dummynet */ 34641793Sluigi#define IP_DUMMYNET_GET 64 /* get entire dummynet pipes */ 34741793Sluigi 3481541Srgrimes/* 3491541Srgrimes * Defaults and limits for options 3501541Srgrimes */ 3511541Srgrimes#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */ 3521541Srgrimes#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ 3539209Swollman#define IP_MAX_MEMBERSHIPS 20 /* per socket */ 3541541Srgrimes 3551541Srgrimes/* 3561541Srgrimes * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. 3571541Srgrimes */ 3581541Srgrimesstruct ip_mreq { 3591541Srgrimes struct in_addr imr_multiaddr; /* IP multicast address of group */ 3601541Srgrimes struct in_addr imr_interface; /* local IP address of interface */ 3611541Srgrimes}; 3621541Srgrimes 3631541Srgrimes/* 36414195Speter * Argument for IP_PORTRANGE: 36514195Speter * - which range to search when port is unspecified at bind() or connect() 36614195Speter */ 36714195Speter#define IP_PORTRANGE_DEFAULT 0 /* default range */ 36814195Speter#define IP_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */ 36914195Speter#define IP_PORTRANGE_LOW 2 /* "low" - vouchsafe security */ 37014195Speter 37114195Speter/* 3721541Srgrimes * Definitions for inet sysctl operations. 3731541Srgrimes * 3741541Srgrimes * Third level is protocol number. 3751541Srgrimes * Fourth level is desired variable within that protocol. 3761541Srgrimes */ 37762587Sitojun#define IPPROTO_MAXID (IPPROTO_AH + 1) /* don't list to IPPROTO_MAX */ 3781541Srgrimes 3791541Srgrimes#define CTL_IPPROTO_NAMES { \ 3801541Srgrimes { "ip", CTLTYPE_NODE }, \ 3811541Srgrimes { "icmp", CTLTYPE_NODE }, \ 3821541Srgrimes { "igmp", CTLTYPE_NODE }, \ 3831541Srgrimes { "ggp", CTLTYPE_NODE }, \ 3841541Srgrimes { 0, 0 }, \ 3851541Srgrimes { 0, 0 }, \ 3861541Srgrimes { "tcp", CTLTYPE_NODE }, \ 3871541Srgrimes { 0, 0 }, \ 3881541Srgrimes { "egp", CTLTYPE_NODE }, \ 3891541Srgrimes { 0, 0 }, \ 3901541Srgrimes { 0, 0 }, \ 3911541Srgrimes { 0, 0 }, \ 3921541Srgrimes { "pup", CTLTYPE_NODE }, \ 3931541Srgrimes { 0, 0 }, \ 3941541Srgrimes { 0, 0 }, \ 3951541Srgrimes { 0, 0 }, \ 3961541Srgrimes { 0, 0 }, \ 3971541Srgrimes { "udp", CTLTYPE_NODE }, \ 3981541Srgrimes { 0, 0 }, \ 3991541Srgrimes { 0, 0 }, \ 4001541Srgrimes { 0, 0 }, \ 4011541Srgrimes { 0, 0 }, \ 4021541Srgrimes { "idp", CTLTYPE_NODE }, \ 40362587Sitojun { 0, 0 }, \ 40462587Sitojun { 0, 0 }, \ 40562587Sitojun { 0, 0 }, \ 40662587Sitojun { 0, 0 }, \ 40762587Sitojun { 0, 0 }, \ 40862587Sitojun { 0, 0 }, \ 40962587Sitojun { 0, 0 }, \ 41062587Sitojun { 0, 0 }, \ 41162587Sitojun { 0, 0 }, \ 41262587Sitojun { 0, 0 }, \ 41362587Sitojun { 0, 0 }, \ 41462587Sitojun { 0, 0 }, \ 41562587Sitojun { 0, 0 }, \ 41662587Sitojun { 0, 0 }, \ 41762587Sitojun { 0, 0 }, \ 41862587Sitojun { 0, 0 }, \ 41962587Sitojun { 0, 0 }, \ 42062587Sitojun { 0, 0 }, \ 42162587Sitojun { 0, 0 }, \ 42262587Sitojun { 0, 0 }, \ 42362587Sitojun { 0, 0 }, \ 42462587Sitojun { 0, 0 }, \ 42562587Sitojun { 0, 0 }, \ 42662587Sitojun { 0, 0 }, \ 42762587Sitojun { 0, 0 }, \ 42862587Sitojun { 0, 0 }, \ 42962587Sitojun { 0, 0 }, \ 43062587Sitojun { 0, 0 }, \ 43162587Sitojun { "ipsec", CTLTYPE_NODE }, \ 4321541Srgrimes} 4331541Srgrimes 4341541Srgrimes/* 4351541Srgrimes * Names for IP sysctl objects 4361541Srgrimes */ 4371541Srgrimes#define IPCTL_FORWARDING 1 /* act as router */ 4381541Srgrimes#define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */ 4391541Srgrimes#define IPCTL_DEFTTL 3 /* default TTL */ 4401541Srgrimes#ifdef notyet 4411541Srgrimes#define IPCTL_DEFMTU 4 /* default MTU */ 4421541Srgrimes#endif 4435109Swollman#define IPCTL_RTEXPIRE 5 /* cloned route expiration time */ 4446399Swollman#define IPCTL_RTMINEXPIRE 6 /* min value for expiration time */ 4456399Swollman#define IPCTL_RTMAXCACHE 7 /* trigger level for dynamic expire */ 4467091Swollman#define IPCTL_SOURCEROUTE 8 /* may perform source routes */ 4479575Speter#define IPCTL_DIRECTEDBROADCAST 9 /* may re-broadcast received packets */ 44812003Swollman#define IPCTL_INTRQMAXLEN 10 /* max length of netisr queue */ 44952904Sshin#define IPCTL_INTRQDROPS 11 /* number of netisr q drops */ 45029838Swollman#define IPCTL_STATS 12 /* ipstat structure */ 45133440Sguido#define IPCTL_ACCEPTSOURCEROUTE 13 /* may accept source routed packets */ 45252904Sshin#define IPCTL_FASTFORWARDING 14 /* use fast IP forwarding code */ 45355009Sshin#define IPCTL_KEEPFAITH 15 /* FAITH IPv4->IPv6 translater ctl */ 45452904Sshin#define IPCTL_GIF_TTL 16 /* default TTL for gif encap packet */ 45552904Sshin#define IPCTL_MAXID 17 4561541Srgrimes 4571541Srgrimes#define IPCTL_NAMES { \ 4581541Srgrimes { 0, 0 }, \ 4591541Srgrimes { "forwarding", CTLTYPE_INT }, \ 4601541Srgrimes { "redirect", CTLTYPE_INT }, \ 4611541Srgrimes { "ttl", CTLTYPE_INT }, \ 4621541Srgrimes { "mtu", CTLTYPE_INT }, \ 4635109Swollman { "rtexpire", CTLTYPE_INT }, \ 4646399Swollman { "rtminexpire", CTLTYPE_INT }, \ 4656399Swollman { "rtmaxcache", CTLTYPE_INT }, \ 4667091Swollman { "sourceroute", CTLTYPE_INT }, \ 4679575Speter { "directed-broadcast", CTLTYPE_INT }, \ 46812003Swollman { "intr-queue-maxlen", CTLTYPE_INT }, \ 46912003Swollman { "intr-queue-drops", CTLTYPE_INT }, \ 47029838Swollman { "stats", CTLTYPE_STRUCT }, \ 47133440Sguido { "accept_sourceroute", CTLTYPE_INT }, \ 47236192Sdg { "fastforwarding", CTLTYPE_INT }, \ 4731541Srgrimes} 4741541Srgrimes 47552904Sshin/* INET6 stuff */ 47657120Sshin#define __KAME_NETINET_IN_H_INCLUDED_ 47752904Sshin#include <netinet6/in6.h> 47857120Sshin#undef __KAME_NETINET_IN_H_INCLUDED_ 4791541Srgrimes 48055205Speter#ifdef _KERNEL 4817088Swollmanstruct ifnet; struct mbuf; /* forward declarations for Standard C */ 48246696Speterstruct proc; 4837088Swollman 4841541Srgrimesint in_broadcast __P((struct in_addr, struct ifnet *)); 4851541Srgrimesint in_canforward __P((struct in_addr)); 4861541Srgrimesint in_localaddr __P((struct in_addr)); 4877088Swollmanchar *inet_ntoa __P((struct in_addr)); /* in libkern */ 48870951Sbmilekicchar *inet_ntoa_r __P((struct in_addr ina, char *buf)); /* in libkern */ 4892169Spaul 49055205Speter#endif 49115026Sphk 4922169Spaul#endif 493