Changeset 657e6c93 in rtems


Ignore:
Timestamp:
Jun 24, 2016, 5:57:17 AM (3 years ago)
Author:
Christian Mauderer <Christian.Mauderer@…>
Branches:
master
Children:
4c02385
Parents:
005c3fe7
git-author:
Christian Mauderer <Christian.Mauderer@…> (06/24/16 05:57:17)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/28/16 11:09:44)
Message:

libnetworking: Import current <netinet/in.h>

Import the <netinet/in.h> from current FreeBSD. This allows to build
some current software (e.g. libressl).

Add legacy support like

  • prototype for in_cksum(),
  • IPPORT_USERRESERVED,
  • deprecated IPCTL_RT* defines,
  • ip_fw_chk_t and ip_fw_ctl_t,
  • ip_nat_... (IP NAT hooks), and
  • IP_NAT option for get/setsockopt()

to new <rtems/rtems_netinet_in.h>.

Location:
cpukit/libnetworking
Files:
1 added
17 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libnetworking/Makefile.am

    r005c3fe7 r657e6c93  
    157157include_rtems_HEADERS += rtems/rtems_mii_ioctl.h
    158158include_rtems_HEADERS += rtems/rtems_netdb.h
     159include_rtems_HEADERS += rtems/rtems_netinet_in.h
    159160
    160161libnetworking_a_SOURCES += rtems/sghostname.c \
  • cpukit/libnetworking/netinet/igmp.c

    r005c3fe7 r657e6c93  
    6161
    6262#include <netinet/in.h>
     63#include <rtems/rtems_netinet_in.h>
    6364#include <netinet/in_var.h>
    6465#include <netinet/in_systm.h>
  • cpukit/libnetworking/netinet/in.h

    r005c3fe7 r657e6c93  
    1 /*
     1/*-
    22 * Copyright (c) 1982, 1986, 1990, 1993
    33 *      The Regents of the University of California.  All rights reserved.
     
    2828 *
    2929 *      @(#)in.h        8.3 (Berkeley) 1/3/94
    30  * $FreeBSD: src/sys/netinet/in.h,v 1.91 2005/08/22 16:13:07 andre Exp $
    31  */
    32  
     30 * $FreeBSD: head/sys/netinet/in.h 281649 2015-04-17 11:57:06Z glebius $
     31 */
    3332
    3433#ifndef _NETINET_IN_H_
    35 #define _NETINET_IN_H_
    36 
    37 #include <rtems/bsdnet/_types.h>
    38 #include <rtems/endian.h>
    39 
    40 #ifndef _IN_ADDR_T_DECLARED
    41 typedef uint32_t                in_addr_t;
    42 #define _IN_ADDR_T_DECLARED
    43 #endif
     34#define _NETINET_IN_H_
     35
     36#include <sys/cdefs.h>
     37#include <sys/_types.h>
     38#include <machine/endian.h>
    4439
    4540/* Protocols common to RFC 1700, POSIX, and X/Open. */
     
    4944#define IPPROTO_UDP             17              /* user datagram protocol */
    5045
    51 #define INADDR_ANY              (u_int32_t)0x00000000
    52 #define INADDR_BROADCAST        (u_int32_t)0xffffffff   /* must be masked */
     46#define INADDR_ANY              ((in_addr_t)0x00000000)
     47#define INADDR_BROADCAST        ((in_addr_t)0xffffffff) /* must be masked */
     48
     49#ifndef _UINT8_T_DECLARED
     50typedef __uint8_t               uint8_t;
     51#define _UINT8_T_DECLARED
     52#endif
     53
     54#ifndef _UINT16_T_DECLARED
     55typedef __uint16_t              uint16_t;
     56#define _UINT16_T_DECLARED
     57#endif
     58
     59#ifndef _UINT32_T_DECLARED
     60typedef __uint32_t              uint32_t;
     61#define _UINT32_T_DECLARED
     62#endif
     63
     64#ifndef _IN_ADDR_T_DECLARED
     65typedef uint32_t                in_addr_t;
     66#define _IN_ADDR_T_DECLARED
     67#endif
    5368
    5469#ifndef _IN_PORT_T_DECLARED
     
    6378
    6479/* Internet address (a structure for historical reasons). */
    65 #ifndef _STRUCT_IN_ADDR_DECLARED
     80#ifndef _STRUCT_IN_ADDR_DECLARED
    6681struct in_addr {
    6782        in_addr_t s_addr;
    6883};
    69 #define _STRUCT_IN_ADDR_DECLARED
    70 #endif
     84#define _STRUCT_IN_ADDR_DECLARED
     85#endif
     86
     87#ifndef _SOCKLEN_T_DECLARED
     88typedef __socklen_t     socklen_t;
     89#define _SOCKLEN_T_DECLARED
     90#endif
     91
     92#include <sys/_sockaddr_storage.h>
    7193
    7294/* Socket address, internet style. */
     
    79101};
    80102
    81 
     103#if !defined(_KERNEL) && __POSIX_VISIBLE >= 200112
     104
     105#ifndef _BYTEORDER_PROTOTYPED
     106#define _BYTEORDER_PROTOTYPED
     107__BEGIN_DECLS
     108uint32_t        htonl(uint32_t);
     109uint16_t        htons(uint16_t);
     110uint32_t        ntohl(uint32_t);
     111uint16_t        ntohs(uint16_t);
     112__END_DECLS
     113#endif
     114
     115#ifndef _BYTEORDER_FUNC_DEFINED
     116#define _BYTEORDER_FUNC_DEFINED
     117#define htonl(x)        __htonl(x)
     118#define htons(x)        __htons(x)
     119#define ntohl(x)        __ntohl(x)
     120#define ntohs(x)        __ntohs(x)
     121#endif
     122
     123#endif /* !_KERNEL && __POSIX_VISIBLE >= 200112 */
     124
     125#if __POSIX_VISIBLE >= 200112
     126#define IPPROTO_IPV6            41              /* IP6 header */
     127#define IPPROTO_RAW             255             /* raw IP packet */
     128#define INET_ADDRSTRLEN         16
     129#endif
     130
     131#if __BSD_VISIBLE
    82132/*
    83133 * Constants and structures defined by the internet system,
     
    114164#define IPPROTO_RDP             27              /* Reliable Data */
    115165#define IPPROTO_IRTP            28              /* Reliable Transaction */
    116 #define IPPROTO_TP              29              /* tp-4 w/ class negotiation */
     166#define IPPROTO_TP              29              /* tp-4 w/ class negotiation */
    117167#define IPPROTO_BLT             30              /* Bulk Data Transfer */
    118168#define IPPROTO_NSP             31              /* Network Services */
     
    126176#define IPPROTO_TPXX            39              /* TP++ Transport */
    127177#define IPPROTO_IL              40              /* IL transport protocol */
    128 #define IPPROTO_IPV6            41              /* IP6 header */
    129178#define IPPROTO_SDRP            42              /* Source Demand Routing */
    130179#define IPPROTO_ROUTING         43              /* IP6 routing header */
    131180#define IPPROTO_FRAGMENT        44              /* IP6 fragmentation header */
    132181#define IPPROTO_IDRP            45              /* InterDomain Routing*/
    133 #define IPPROTO_RSVP            46              /* resource reservation */
     182#define IPPROTO_RSVP            46              /* resource reservation */
    134183#define IPPROTO_GRE             47              /* General Routing Encap. */
    135184#define IPPROTO_MHRP            48              /* Mobile Host Routing */
     
    187236#define IPPROTO_GMTP            100             /* GMTP*/
    188237#define IPPROTO_IPCOMP          108             /* payload compression (IPComp) */
     238#define IPPROTO_SCTP            132             /* SCTP */
     239#define IPPROTO_MH              135             /* IPv6 Mobility Header */
     240#define IPPROTO_UDPLITE         136             /* UDP-Lite */
     241#define IPPROTO_HIP             139             /* IP6 Host Identity Protocol */
     242#define IPPROTO_SHIM6           140             /* IP6 Shim6 Protocol */
    189243/* 101-254: Partly Unassigned */
    190244#define IPPROTO_PIM             103             /* Protocol Independent Mcast */
    191245#define IPPROTO_CARP            112             /* CARP */
    192246#define IPPROTO_PGM             113             /* PGM */
     247#define IPPROTO_MPLS            137             /* MPLS-in-IP */
    193248#define IPPROTO_PFSYNC          240             /* PFSYNC */
     249#define IPPROTO_RESERVED_253    253             /* Reserved */
     250#define IPPROTO_RESERVED_254    254             /* Reserved */
    194251/* 255: Reserved */
    195 /* BSD Private, local use, namespace incursion */
    196 #define IPPROTO_DIVERT          254             /* divert pseudo-protocol */
    197 #define IPPROTO_RAW             255             /* raw IP packet */
     252/* BSD Private, local use, namespace incursion, no longer used */
     253#define IPPROTO_OLD_DIVERT      254             /* OLD divert pseudo-proto */
    198254#define IPPROTO_MAX             256
    199255
    200 /*
    201  * Merged from FreeBSD 1.78 of this file so Python compiles.
    202  * This is a size value for functions such as inet_ntop().
    203  */
    204 #define INET_ADDRSTRLEN         16
     256/* last return value of *_input(), meaning "all job for this pkt is done".  */
     257#define IPPROTO_DONE            257
     258
     259/* Only used internally, so can be outside the range of valid IP protocols. */
     260#define IPPROTO_DIVERT          258             /* divert pseudo-protocol */
     261#define IPPROTO_SEND            259             /* SeND pseudo-protocol */
     262
     263/*
     264 * Defined to avoid confusion.  The master value is defined by
     265 * PROTO_SPACER in sys/protosw.h.
     266 */
     267#define IPPROTO_SPACER          32767           /* spacer for loadable protos */
    205268
    206269/*
     
    236299 * default values.  If you change them, you may find your Security
    237300 * Administrator looking for you with a heavy object.
     301 *
     302 * For a slightly more orthodox text view on this:
     303 *
     304 *            ftp://ftp.isi.edu/in-notes/iana/assignments/port-numbers
     305 *
     306 *    port numbers are divided into three ranges:
     307 *
     308 *                0 -  1023 Well Known Ports
     309 *             1024 - 49151 Registered Ports
     310 *            49152 - 65535 Dynamic and/or Private Ports
     311 *
    238312 */
    239313
     
    241315 * Ports < IPPORT_RESERVED are reserved for
    242316 * privileged processes (e.g. root).         (IP_PORTRANGE_LOW)
    243  * Ports > IPPORT_USERRESERVED are reserved
    244  * for servers, not necessarily privileged.  (IP_PORTRANGE_DEFAULT)
    245317 */
    246318#define IPPORT_RESERVED         1024
    247 #define IPPORT_USERRESERVED     5000
    248 
    249 /*
    250  * Default local port range to use by setting IP_PORTRANGE_HIGH
    251  */
    252 #define IPPORT_HIFIRSTAUTO      40000
    253 #define IPPORT_HILASTAUTO       44999
     319
     320/*
     321 * Default local port range, used by IP_PORTRANGE_DEFAULT
     322 */
     323#define IPPORT_EPHEMERALFIRST   10000
     324#define IPPORT_EPHEMERALLAST    65535
     325 
     326/*
     327 * Dynamic port range, used by IP_PORTRANGE_HIGH.
     328 */
     329#define IPPORT_HIFIRSTAUTO      49152
     330#define IPPORT_HILASTAUTO       65535
    254331
    255332/*
     
    259336 * have a fit if we use.
    260337 */
    261 #define IPPORT_RESERVEDSTART    600
     338#define IPPORT_RESERVEDSTART    600
     339
     340#define IPPORT_MAX              65535
     341
    262342/*
    263343 * Definitions of bits in internet address integers.
     
    265345 * is done according to subnet mask, not the masks here.
    266346 */
    267 #define IN_CLASSA(i)            (((u_int32_t)(i) & 0x80000000) == 0)
     347#define IN_CLASSA(i)            (((in_addr_t)(i) & 0x80000000) == 0)
    268348#define IN_CLASSA_NET           0xff000000
    269349#define IN_CLASSA_NSHIFT        24
     
    271351#define IN_CLASSA_MAX           128
    272352
    273 #define IN_CLASSB(i)            (((u_int32_t)(i) & 0xc0000000) == 0x80000000)
     353#define IN_CLASSB(i)            (((in_addr_t)(i) & 0xc0000000) == 0x80000000)
    274354#define IN_CLASSB_NET           0xffff0000
    275355#define IN_CLASSB_NSHIFT        16
     
    277357#define IN_CLASSB_MAX           65536
    278358
    279 #define IN_CLASSC(i)            (((u_int32_t)(i) & 0xe0000000) == 0xc0000000)
     359#define IN_CLASSC(i)            (((in_addr_t)(i) & 0xe0000000) == 0xc0000000)
    280360#define IN_CLASSC_NET           0xffffff00
    281361#define IN_CLASSC_NSHIFT        8
    282362#define IN_CLASSC_HOST          0x000000ff
    283363
    284 #define IN_CLASSD(i)            (((u_int32_t)(i) & 0xf0000000) == 0xe0000000)
     364#define IN_CLASSD(i)            (((in_addr_t)(i) & 0xf0000000) == 0xe0000000)
    285365#define IN_CLASSD_NET           0xf0000000      /* These ones aren't really */
    286366#define IN_CLASSD_NSHIFT        28              /* net and host fields, but */
     
    288368#define IN_MULTICAST(i)         IN_CLASSD(i)
    289369
    290 #define IN_EXPERIMENTAL(i)      (((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
    291 #define IN_BADCLASS(i)          (((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
    292 
    293 #define INADDR_LOOPBACK         (u_int32_t)0x7f000001
     370#define IN_EXPERIMENTAL(i)      (((in_addr_t)(i) & 0xf0000000) == 0xf0000000)
     371#define IN_BADCLASS(i)          (((in_addr_t)(i) & 0xf0000000) == 0xf0000000)
     372
     373#define IN_LINKLOCAL(i)         (((in_addr_t)(i) & 0xffff0000) == 0xa9fe0000)
     374#define IN_LOOPBACK(i)          (((in_addr_t)(i) & 0xff000000) == 0x7f000000)
     375#define IN_ZERONET(i)           (((in_addr_t)(i) & 0xff000000) == 0)
     376
     377#define IN_PRIVATE(i)   ((((in_addr_t)(i) & 0xff000000) == 0x0a000000) || \
     378                         (((in_addr_t)(i) & 0xfff00000) == 0xac100000) || \
     379                         (((in_addr_t)(i) & 0xffff0000) == 0xc0a80000))
     380
     381#define IN_LOCAL_GROUP(i)       (((in_addr_t)(i) & 0xffffff00) == 0xe0000000)
     382 
     383#define IN_ANY_LOCAL(i)         (IN_LINKLOCAL(i) || IN_LOCAL_GROUP(i))
     384
     385#define INADDR_LOOPBACK         ((in_addr_t)0x7f000001)
    294386#ifndef _KERNEL
    295 #define INADDR_NONE             0xffffffff              /* -1 return */
    296 #endif
    297 
    298 #define INADDR_UNSPEC_GROUP     (u_int32_t)0xe0000000   /* 224.0.0.0 */
    299 #define INADDR_ALLHOSTS_GROUP   (u_int32_t)0xe0000001   /* 224.0.0.1 */
    300 #define INADDR_ALLRTRS_GROUP    (u_int32_t)0xe0000002   /* 224.0.0.2 */
    301 #define INADDR_MAX_LOCAL_GROUP  (u_int32_t)0xe00000ff   /* 224.0.0.255 */
    302 
    303 #define IN_LOOPBACKNET          (u_int32_t)127                  /* official! */
     387#define INADDR_NONE             ((in_addr_t)0xffffffff) /* -1 return */
     388#endif
     389
     390#define INADDR_UNSPEC_GROUP     ((in_addr_t)0xe0000000) /* 224.0.0.0 */
     391#define INADDR_ALLHOSTS_GROUP   ((in_addr_t)0xe0000001) /* 224.0.0.1 */
     392#define INADDR_ALLRTRS_GROUP    ((in_addr_t)0xe0000002) /* 224.0.0.2 */
     393#define INADDR_ALLRPTS_GROUP    ((in_addr_t)0xe0000016) /* 224.0.0.22, IGMPv3 */
     394#define INADDR_CARP_GROUP       ((in_addr_t)0xe0000012) /* 224.0.0.18 */
     395#define INADDR_PFSYNC_GROUP     ((in_addr_t)0xe00000f0) /* 224.0.0.240 */
     396#define INADDR_ALLMDNS_GROUP    ((in_addr_t)0xe00000fb) /* 224.0.0.251 */
     397#define INADDR_MAX_LOCAL_GROUP  ((in_addr_t)0xe00000ff) /* 224.0.0.255 */
     398
     399#define IN_LOOPBACKNET          127                     /* official! */
     400
     401#define IN_RFC3021_MASK         ((in_addr_t)0xfffffffe)
    304402
    305403/*
     
    316414#define IP_SENDSRCADDR          IP_RECVDSTADDR /* cmsg_type to set src addr */
    317415#define IP_RETOPTS              8    /* ip_opts; set/get IP options */
    318 #define IP_MULTICAST_IF         9    /* u_char; set/get IP multicast i/f  */
     416#define IP_MULTICAST_IF         9    /* struct in_addr *or* struct ip_mreqn;
     417                                      * set/get IP multicast i/f  */
    319418#define IP_MULTICAST_TTL        10   /* u_char; set/get IP multicast ttl */
    320419#define IP_MULTICAST_LOOP       11   /* u_char; set/get IP multicast loopback */
    321420#define IP_ADD_MEMBERSHIP       12   /* ip_mreq; add an IP group membership */
    322421#define IP_DROP_MEMBERSHIP      13   /* ip_mreq; drop an IP group membership */
    323 #define IP_MULTICAST_VIF        14   /* set/get IP mcast virt. iface */
    324 #define IP_RSVP_ON              15   /* enable RSVP in kernel */
    325 #define IP_RSVP_OFF             16   /* disable RSVP in kernel */
    326 #define IP_RSVP_VIF_ON          17   /* set RSVP per-vif socket */
    327 #define IP_RSVP_VIF_OFF         18   /* unset RSVP per-vif socket */
    328 #define IP_PORTRANGE            19   /* int; range to choose for unspec port */
     422#define IP_MULTICAST_VIF        14   /* set/get IP mcast virt. iface */
     423#define IP_RSVP_ON              15   /* enable RSVP in kernel */
     424#define IP_RSVP_OFF             16   /* disable RSVP in kernel */
     425#define IP_RSVP_VIF_ON          17   /* set RSVP per-vif socket */
     426#define IP_RSVP_VIF_OFF         18   /* unset RSVP per-vif socket */
     427#define IP_PORTRANGE            19   /* int; range to choose for unspec port */
    329428#define IP_RECVIF               20   /* bool; receive reception if w/dgram */
    330 
    331 #define IP_FW_ADD               50   /* add a firewall rule to chain */
    332 #define IP_FW_DEL               51   /* delete a firewall rule from chain */
    333 #define IP_FW_FLUSH             52   /* flush firewall rule chain */
    334 #define IP_FW_ZERO              53   /* clear single/all firewall counter(s) */
    335 #define IP_FW_GET               54   /* get entire firewall rule chain */
    336 #define IP_NAT                  55   /* set/get NAT opts */
     429/* for IPSEC */
     430#define IP_IPSEC_POLICY         21   /* int; set/get security policy */
     431                                     /* unused; was IP_FAITH */
     432#define IP_ONESBCAST            23   /* bool: send all-ones broadcast */
     433#define IP_BINDANY              24   /* bool: allow bind to any address */
     434#define IP_BINDMULTI            25   /* bool: allow multiple listeners on a tuple */
     435#define IP_RSS_LISTEN_BUCKET    26   /* int; set RSS listen bucket */
     436
     437/*
     438 * Options for controlling the firewall and dummynet.
     439 * Historical options (from 40 to 64) will eventually be
     440 * replaced by only two options, IP_FW3 and IP_DUMMYNET3.
     441 */
     442#define IP_FW_TABLE_ADD         40   /* add entry */
     443#define IP_FW_TABLE_DEL         41   /* delete entry */
     444#define IP_FW_TABLE_FLUSH       42   /* flush table */
     445#define IP_FW_TABLE_GETSIZE     43   /* get table size */
     446#define IP_FW_TABLE_LIST        44   /* list table contents */
     447
     448#define IP_FW3                  48   /* generic ipfw v.3 sockopts */
     449#define IP_DUMMYNET3            49   /* generic dummynet v.3 sockopts */
     450
     451#define IP_FW_ADD               50   /* add a firewall rule to chain */
     452#define IP_FW_DEL               51   /* delete a firewall rule from chain */
     453#define IP_FW_FLUSH             52   /* flush firewall rule chain */
     454#define IP_FW_ZERO              53   /* clear single/all firewall counter(s) */
     455#define IP_FW_GET               54   /* get entire firewall rule chain */
     456#define IP_FW_RESETLOG          55   /* reset logging counters */
     457
     458#define IP_FW_NAT_CFG           56   /* add/config a nat rule */
     459#define IP_FW_NAT_DEL           57   /* delete a nat rule */
     460#define IP_FW_NAT_GET_CONFIG    58   /* get configuration of a nat rule */
     461#define IP_FW_NAT_GET_LOG       59   /* get log of a nat rule */
     462
     463#define IP_DUMMYNET_CONFIGURE   60   /* add/configure a dummynet pipe */
     464#define IP_DUMMYNET_DEL         61   /* delete a dummynet pipe from chain */
     465#define IP_DUMMYNET_FLUSH       62   /* flush dummynet */
     466#define IP_DUMMYNET_GET         64   /* get entire dummynet pipes */
     467
     468#define IP_RECVTTL              65   /* bool; receive IP TTL w/dgram */
     469#define IP_MINTTL               66   /* minimum TTL for packet or drop */
     470#define IP_DONTFRAG             67   /* don't fragment packet */
     471#define IP_RECVTOS              68   /* bool; receive IP TOS w/dgram */
     472
     473/* IPv4 Source Filter Multicast API [RFC3678] */
     474#define IP_ADD_SOURCE_MEMBERSHIP        70   /* join a source-specific group */
     475#define IP_DROP_SOURCE_MEMBERSHIP       71   /* drop a single source */
     476#define IP_BLOCK_SOURCE                 72   /* block a source */
     477#define IP_UNBLOCK_SOURCE               73   /* unblock a source */
     478
     479/* The following option is private; do not use it from user applications. */
     480#define IP_MSFILTER                     74   /* set/get filter list */
     481
     482/* Protocol Independent Multicast API [RFC3678] */
     483#define MCAST_JOIN_GROUP                80   /* join an any-source group */
     484#define MCAST_LEAVE_GROUP               81   /* leave all sources for group */
     485#define MCAST_JOIN_SOURCE_GROUP         82   /* join a source-specific group */
     486#define MCAST_LEAVE_SOURCE_GROUP        83   /* leave a single source */
     487#define MCAST_BLOCK_SOURCE              84   /* block a source */
     488#define MCAST_UNBLOCK_SOURCE            85   /* unblock a source */
     489
     490/* Flow and RSS definitions */
     491#define IP_FLOWID               90   /* get flow id for the given socket/inp */
     492#define IP_FLOWTYPE             91   /* get flow type (M_HASHTYPE) */
     493#define IP_RSSBUCKETID          92   /* get RSS flowid -> bucket mapping */
     494#define IP_RECVFLOWID           93   /* bool; receive IP flowid/flowtype w/ datagram */
     495#define IP_RECVRSSBUCKETID      94   /* bool; receive IP RSS bucket id w/ datagram */
    337496
    338497/*
     
    341500#define IP_DEFAULT_MULTICAST_TTL  1     /* normally limit m'casts to 1 hop  */
    342501#define IP_DEFAULT_MULTICAST_LOOP 1     /* normally hear sends if a member  */
    343 #define IP_MAX_MEMBERSHIPS      20      /* per socket */
     502
     503/*
     504 * The imo_membership vector for each socket is now dynamically allocated at
     505 * run-time, bounded by USHRT_MAX, and is reallocated when needed, sized
     506 * according to a power-of-two increment.
     507 */
     508#define IP_MIN_MEMBERSHIPS      31
     509#define IP_MAX_MEMBERSHIPS      4095
     510#define IP_MAX_SOURCE_FILTER    1024    /* XXX to be unused */
     511
     512/*
     513 * Default resource limits for IPv4 multicast source filtering.
     514 * These may be modified by sysctl.
     515 */
     516#define IP_MAX_GROUP_SRC_FILTER         512     /* sources per group */
     517#define IP_MAX_SOCK_SRC_FILTER          128     /* sources per socket/group */
     518#define IP_MAX_SOCK_MUTE_FILTER         128     /* XXX no longer used */
    344519
    345520/*
     
    352527
    353528/*
     529 * Modified argument structure for IP_MULTICAST_IF, obtained from Linux.
     530 * This is used to specify an interface index for multicast sends, as
     531 * the IPv4 legacy APIs do not support this (unless IP_SENDIF is available).
     532 */
     533struct ip_mreqn {
     534        struct  in_addr imr_multiaddr;  /* IP multicast address of group */
     535        struct  in_addr imr_address;    /* local IP address of interface */
     536        int             imr_ifindex;    /* Interface index; cast to uint32_t */
     537};
     538
     539/*
     540 * Argument structure for IPv4 Multicast Source Filter APIs. [RFC3678]
     541 */
     542struct ip_mreq_source {
     543        struct  in_addr imr_multiaddr;  /* IP multicast address of group */
     544        struct  in_addr imr_sourceaddr; /* IP address of source */
     545        struct  in_addr imr_interface;  /* local IP address of interface */
     546};
     547
     548/*
     549 * Argument structures for Protocol-Independent Multicast Source
     550 * Filter APIs. [RFC3678]
     551 */
     552struct group_req {
     553        uint32_t                gr_interface;   /* interface index */
     554        struct sockaddr_storage gr_group;       /* group address */
     555};
     556
     557struct group_source_req {
     558        uint32_t                gsr_interface;  /* interface index */
     559        struct sockaddr_storage gsr_group;      /* group address */
     560        struct sockaddr_storage gsr_source;     /* source address */
     561};
     562
     563#ifndef __MSFILTERREQ_DEFINED
     564#define __MSFILTERREQ_DEFINED
     565/*
     566 * The following structure is private; do not use it from user applications.
     567 * It is used to communicate IP_MSFILTER/IPV6_MSFILTER information between
     568 * the RFC 3678 libc functions and the kernel.
     569 */
     570struct __msfilterreq {
     571        uint32_t                 msfr_ifindex;  /* interface index */
     572        uint32_t                 msfr_fmode;    /* filter mode for group */
     573        uint32_t                 msfr_nsrcs;    /* # of sources in msfr_srcs */
     574        struct sockaddr_storage  msfr_group;    /* group address */
     575        struct sockaddr_storage *msfr_srcs;     /* pointer to the first member
     576                                                 * of a contiguous array of
     577                                                 * sources to filter in full.
     578                                                 */
     579};
     580#endif
     581
     582struct sockaddr;
     583
     584/*
     585 * Advanced (Full-state) APIs [RFC3678]
     586 * The RFC specifies uint_t for the 6th argument to [sg]etsourcefilter().
     587 * We use uint32_t here to be consistent.
     588 */
     589int     setipv4sourcefilter(int, struct in_addr, struct in_addr, uint32_t,
     590            uint32_t, struct in_addr *);
     591int     getipv4sourcefilter(int, struct in_addr, struct in_addr, uint32_t *,
     592            uint32_t *, struct in_addr *);
     593int     setsourcefilter(int, uint32_t, struct sockaddr *, socklen_t,
     594            uint32_t, uint32_t, struct sockaddr_storage *);
     595int     getsourcefilter(int, uint32_t, struct sockaddr *, socklen_t,
     596            uint32_t *, uint32_t *, struct sockaddr_storage *);
     597
     598/*
     599 * Filter modes; also used to represent per-socket filter mode internally.
     600 */
     601#define MCAST_UNDEFINED 0       /* fmode: not yet defined */
     602#define MCAST_INCLUDE   1       /* fmode: include these source(s) */
     603#define MCAST_EXCLUDE   2       /* fmode: exclude these source(s) */
     604
     605/*
    354606 * Argument for IP_PORTRANGE:
    355607 * - which range to search when port is unspecified at bind() or connect()
     
    360612
    361613/*
    362  * Definitions for inet sysctl operations.
    363  *
    364  * Third level is protocol number.
    365  * Fourth level is desired variable within that protocol.
    366  */
    367 #define IPPROTO_MAXID   (IPPROTO_IDP + 1)       /* don't list to IPPROTO_MAX */
    368 
    369 #define CTL_IPPROTO_NAMES { \
    370         { "ip", CTLTYPE_NODE }, \
    371         { "icmp", CTLTYPE_NODE }, \
    372         { "igmp", CTLTYPE_NODE }, \
    373         { "ggp", CTLTYPE_NODE }, \
    374         { 0, 0 }, \
    375         { 0, 0 }, \
    376         { "tcp", CTLTYPE_NODE }, \
    377         { 0, 0 }, \
    378         { "egp", CTLTYPE_NODE }, \
    379         { 0, 0 }, \
    380         { 0, 0 }, \
    381         { 0, 0 }, \
    382         { "pup", CTLTYPE_NODE }, \
    383         { 0, 0 }, \
    384         { 0, 0 }, \
    385         { 0, 0 }, \
    386         { 0, 0 }, \
    387         { "udp", CTLTYPE_NODE }, \
    388         { 0, 0 }, \
    389         { 0, 0 }, \
    390         { 0, 0 }, \
    391         { 0, 0 }, \
    392         { "idp", CTLTYPE_NODE }, \
    393 }
    394 
    395 /*
    396  * Names for IP sysctl objects
     614 * Identifiers for IP sysctl nodes
    397615 */
    398616#define IPCTL_FORWARDING        1       /* act as router */
     
    402620#define IPCTL_DEFMTU            4       /* default MTU */
    403621#endif
    404 #define IPCTL_RTEXPIRE          5       /* cloned route expiration time */
    405 #define IPCTL_RTMINEXPIRE       6       /* min value for expiration time */
    406 #define IPCTL_RTMAXCACHE        7       /* trigger level for dynamic expire */
     622/*      IPCTL_RTEXPIRE          5       deprecated */
     623/*      IPCTL_RTMINEXPIRE       6       deprecated */
     624/*      IPCTL_RTMAXCACHE        7       deprecated */
    407625#define IPCTL_SOURCEROUTE       8       /* may perform source routes */
    408626#define IPCTL_DIRECTEDBROADCAST 9       /* may re-broadcast received packets */
    409 #define IPCTL_INTRQMAXLEN       10      /* max length of netisr queue */
    410 #define IPCTL_INTRQDROPS        11      /* number of netisr q drops */
     627#define IPCTL_INTRQMAXLEN       10      /* max length of netisr queue */
     628#define IPCTL_INTRQDROPS        11      /* number of netisr q drops */
     629#define IPCTL_STATS             12      /* ipstat structure */
    411630#define IPCTL_ACCEPTSOURCEROUTE 13      /* may accept source routed packets */
    412 #define IPCTL_MAXID             13
    413 
    414 #define IPCTL_NAMES { \
    415         { 0, 0 }, \
    416         { "forwarding", CTLTYPE_INT }, \
    417         { "redirect", CTLTYPE_INT }, \
    418         { "ttl", CTLTYPE_INT }, \
    419         { "mtu", CTLTYPE_INT }, \
    420         { "rtexpire", CTLTYPE_INT }, \
    421         { "rtminexpire", CTLTYPE_INT }, \
    422         { "rtmaxcache", CTLTYPE_INT }, \
    423         { "sourceroute", CTLTYPE_INT }, \
    424         { "directed-broadcast", CTLTYPE_INT }, \
    425         { "intr-queue-maxlen", CTLTYPE_INT }, \
    426         { "intr-queue-drops", CTLTYPE_INT }, \
    427         { "accept_sourceroute", CTLTYPE_INT }, \
    428 }
    429 
     631#define IPCTL_FASTFORWARDING    14      /* use fast IP forwarding code */
     632                                        /* 15, unused, was: IPCTL_KEEPFAITH  */
     633#define IPCTL_GIF_TTL           16      /* default TTL for gif encap packet */
     634
     635#endif /* __BSD_VISIBLE */
    430636
    431637#ifdef _KERNEL
     
    435641int      in_broadcast(struct in_addr, struct ifnet *);
    436642int      in_canforward(struct in_addr);
    437 int      in_cksum(struct mbuf *, int);
    438643int      in_localaddr(struct in_addr);
    439 char    *inet_ntoa(struct in_addr); /* in libkern */
    440 
    441 /* Firewall hooks */
    442 struct ip;
    443 typedef int ip_fw_chk_t(struct ip**, int, struct ifnet*, int, struct mbuf**);
    444 typedef int ip_fw_ctl_t(int, struct mbuf**);
    445 extern  ip_fw_chk_t *ip_fw_chk_ptr;
    446 extern  ip_fw_ctl_t *ip_fw_ctl_ptr;
    447 
    448 /* IP NAT hooks */
    449 typedef int ip_nat_t(struct ip**, struct mbuf**, struct ifnet*, int);
    450 typedef int ip_nat_ctl_t(int, struct mbuf**);
    451 extern  ip_nat_t *ip_nat_ptr;
    452 extern  ip_nat_ctl_t *ip_nat_ctl_ptr;
    453 #define IP_NAT_IN       0x00000001
    454 #define IP_NAT_OUT      0x00000002
    455 
     644int      in_localip(struct in_addr);
     645int      in_ifhasaddr(struct ifnet *, struct in_addr);
     646int      inet_aton(const char *, struct in_addr *); /* in libkern */
     647char    *inet_ntoa(struct in_addr); /* in libkern */
     648char    *inet_ntoa_r(struct in_addr ina, char *buf); /* in libkern */
     649char    *inet_ntop(int, const void *, char *, socklen_t); /* in libkern */
     650int      inet_pton(int af, const char *, void *); /* in libkern */
     651void     in_ifdetach(struct ifnet *);
     652
     653#define in_hosteq(s, t) ((s).s_addr == (t).s_addr)
     654#define in_nullhost(x)  ((x).s_addr == INADDR_ANY)
     655#define in_allhosts(x)  ((x).s_addr == htonl(INADDR_ALLHOSTS_GROUP))
     656
     657#define satosin(sa)     ((struct sockaddr_in *)(sa))
     658#define sintosa(sin)    ((struct sockaddr *)(sin))
     659#define ifatoia(ifa)    ((struct in_ifaddr *)(ifa))
    456660#endif /* _KERNEL */
    457661
     662/* INET6 stuff */
     663#if __POSIX_VISIBLE >= 200112
     664#define __KAME_NETINET_IN_H_INCLUDED_
     665#include <netinet6/in6.h>
     666#undef __KAME_NETINET_IN_H_INCLUDED_
     667#endif
     668
    458669#endif /* !_NETINET_IN_H_*/
  • cpukit/libnetworking/netinet/in_cksum_sparc.h

    r005c3fe7 r657e6c93  
    8383#include <sys/mbuf.h>
    8484#include <netinet/in.h>
     85#include <rtems/rtems_netinet_in.h>
    8586#include <netinet/in_systm.h>
    8687#include <netinet/ip.h>
  • cpukit/libnetworking/netinet/in_pcb.c

    r005c3fe7 r657e6c93  
    5555
    5656#include <netinet/in.h>
     57#include <rtems/rtems_netinet_in.h>
    5758#include <netinet/in_systm.h>
    5859#include <netinet/ip.h>
  • cpukit/libnetworking/netinet/in_rmx.c

    r005c3fe7 r657e6c93  
    5858#include <net/route.h>
    5959#include <netinet/in.h>
     60#include <rtems/rtems_netinet_in.h>
    6061#include <netinet/in_systm.h>
    6162#include <netinet/in_var.h>
     
    114115                        rt->rt_flags |= RTF_BROADCAST;
    115116                } else {
    116 #define satosin(sa) ((struct sockaddr_in *)sa)
    117117                        if (satosin(rt->rt_ifa->ifa_addr)->sin_addr.s_addr
    118118                            == sin->sin_addr.s_addr)
    119119                                rt->rt_flags |= RTF_LOCAL;
    120 #undef satosin
    121120                }
    122121        }
  • cpukit/libnetworking/netinet/ip_fw.c

    r005c3fe7 r657e6c93  
    3838#include <net/route.h>
    3939#include <netinet/in.h>
     40#include <rtems/rtems_netinet_in.h>
    4041#include <netinet/in_systm.h>
    4142#include <netinet/ip.h>
  • cpukit/libnetworking/netinet/ip_icmp.c

    r005c3fe7 r657e6c93  
    5151#define _IP_VHL
    5252#include <netinet/in.h>
     53#include <rtems/rtems_netinet_in.h>
    5354#include <netinet/in_pcb.h>
    5455#include <netinet/in_systm.h>
  • cpukit/libnetworking/netinet/ip_input.c

    r005c3fe7 r657e6c93  
    6060
    6161#include <netinet/in.h>
     62#include <rtems/rtems_netinet_in.h>
    6263#include <netinet/in_systm.h>
    6364#include <netinet/in_var.h>
  • cpukit/libnetworking/netinet/ip_output.c

    r005c3fe7 r657e6c93  
    5252
    5353#include <netinet/in.h>
     54#include <rtems/rtems_netinet_in.h>
    5455#include <netinet/in_systm.h>
    5556#include <netinet/ip.h>
  • cpukit/libnetworking/netinet/raw_ip.c

    r005c3fe7 r657e6c93  
    5555#define _IP_VHL
    5656#include <netinet/in.h>
     57#include <rtems/rtems_netinet_in.h>
    5758#include <netinet/in_systm.h>
    5859#include <netinet/in_pcb.h>
  • cpukit/libnetworking/netinet/tcp_input.c

    r005c3fe7 r657e6c93  
    5656
    5757#include <netinet/in.h>
     58#include <rtems/rtems_netinet_in.h>
    5859#include <netinet/in_systm.h>
    5960#include <netinet/ip.h>
  • cpukit/libnetworking/netinet/tcp_output.c

    r005c3fe7 r657e6c93  
    4949
    5050#include <netinet/in.h>
     51#include <rtems/rtems_netinet_in.h>
    5152#include <netinet/in_systm.h>
    5253#include <netinet/ip.h>
  • cpukit/libnetworking/netinet/tcp_subr.c

    r005c3fe7 r657e6c93  
    5656#define _IP_VHL
    5757#include <netinet/in.h>
     58#include <rtems/rtems_netinet_in.h>
    5859#include <netinet/in_systm.h>
    5960#include <netinet/ip.h>
  • cpukit/libnetworking/netinet/tcp_usrreq.c

    r005c3fe7 r657e6c93  
    5555
    5656#include <netinet/in.h>
     57#include <rtems/rtems_netinet_in.h>
    5758#include <netinet/in_systm.h>
    5859#include <netinet/ip.h>
  • cpukit/libnetworking/netinet/udp_usrreq.c

    r005c3fe7 r657e6c93  
    5353
    5454#include <netinet/in.h>
     55#include <rtems/rtems_netinet_in.h>
    5556#include <netinet/in_systm.h>
    5657#include <netinet/ip.h>
  • cpukit/libnetworking/preinstall.am

    r005c3fe7 r657e6c93  
    324324PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtems_netdb.h
    325325
     326$(PROJECT_INCLUDE)/rtems/rtems_netinet_in.h: rtems/rtems_netinet_in.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
     327        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtems_netinet_in.h
     328PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtems_netinet_in.h
     329
    326330$(PROJECT_INCLUDE)/sys/$(dirstamp):
    327331        @$(MKDIR_P) $(PROJECT_INCLUDE)/sys
Note: See TracChangeset for help on using the changeset viewer.