The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/netipx/ipx.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 1995, Mike Mitchell
    3  * Copyright (c) 1984, 1985, 1986, 1987, 1993
    4  *      The Regents of the University of California.  All rights reserved.
    5  *
    6  * Redistribution and use in source and binary forms, with or without
    7  * modification, are permitted provided that the following conditions
    8  * are met:
    9  * 1. Redistributions of source code must retain the above copyright
   10  *    notice, this list of conditions and the following disclaimer.
   11  * 2. Redistributions in binary form must reproduce the above copyright
   12  *    notice, this list of conditions and the following disclaimer in the
   13  *    documentation and/or other materials provided with the distribution.
   14  * 3. All advertising materials mentioning features or use of this software
   15  *    must display the following acknowledgement:
   16  *      This product includes software developed by the University of
   17  *      California, Berkeley and its contributors.
   18  * 4. Neither the name of the University nor the names of its contributors
   19  *    may be used to endorse or promote products derived from this software
   20  *    without specific prior written permission.
   21  *
   22  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   32  * SUCH DAMAGE.
   33  *
   34  *      @(#)ipx.h
   35  *
   36  * $FreeBSD$
   37  */
   38 
   39 #ifndef _NETIPX_IPX_H_
   40 #define _NETIPX_IPX_H_
   41 
   42 /*
   43  * Constants and Structures
   44  */
   45 
   46 /*
   47  * Protocols
   48  */
   49 #define IPXPROTO_UNKWN          0       /* Unknown */
   50 #define IPXPROTO_RI             1       /* RIP Routing Information */
   51 #define IPXPROTO_PXP            4       /* IPX Packet Exchange Protocol */
   52 #define IPXPROTO_SPX            5       /* SPX Sequenced Packet */
   53 #define IPXPROTO_NCP            17      /* NCP NetWare Core */
   54 #define IPXPROTO_NETBIOS        20      /* Propagated Packet */
   55 #define IPXPROTO_RAW            255     /* Placemarker*/
   56 #define IPXPROTO_MAX            256     /* Placemarker*/
   57 
   58 /*
   59  * Port/Socket numbers: network standard functions
   60  */
   61 
   62 #define IPXPORT_RI              1       /* NS RIP Routing Information */
   63 #define IPXPORT_ECHO            2       /* NS Echo */
   64 #define IPXPORT_RE              3       /* NS Router Error */
   65 #define IPXPORT_NCP             0x0451  /* NW NCP Core Protocol */
   66 #define IPXPORT_SAP             0x0452  /* NW SAP Service Advertising */
   67 #define IPXPORT_RIP             0x0453  /* NW RIP Routing Information */
   68 #define IPXPORT_NETBIOS         0x0455  /* NW NetBIOS */
   69 #define IPXPORT_DIAGS           0x0456  /* NW Diagnostics */
   70 /*
   71  * Ports < IPXPORT_RESERVED are reserved for privileged
   72  */
   73 #define IPXPORT_RESERVED        0x4000
   74 /*
   75  * Ports > IPXPORT_WELLKNOWN are reserved for privileged
   76  * processes (e.g. root).
   77  */
   78 #define IPXPORT_WELLKNOWN       0x6000
   79 
   80 /* flags passed to ipx_outputfl as last parameter */
   81 
   82 #define IPX_FORWARDING          0x1     /* most of ipx header exists */
   83 #define IPX_ROUTETOIF           0x10    /* same as SO_DONTROUTE */
   84 #define IPX_ALLOWBROADCAST      SO_BROADCAST    /* can send broadcast packets */
   85 
   86 #define IPX_MAXHOPS             15
   87 
   88 /* flags passed to get/set socket option */
   89 #define SO_HEADERS_ON_INPUT     1
   90 #define SO_HEADERS_ON_OUTPUT    2
   91 #define SO_DEFAULT_HEADERS      3
   92 #define SO_LAST_HEADER          4
   93 #define SO_IPXIP_ROUTE          5
   94 #define SO_SEQNO                6
   95 #define SO_ALL_PACKETS          7
   96 #define SO_MTU                  8
   97 #define SO_IPXTUN_ROUTE         9
   98 #define SO_IPX_CHECKSUM         10
   99 
  100 /*
  101  * IPX addressing
  102  */
  103 union ipx_host {
  104         u_char  c_host[6];
  105         u_short s_host[3];
  106 };
  107 
  108 union ipx_net {
  109         u_char  c_net[4];
  110         u_short s_net[2];
  111 };
  112 
  113 union ipx_net_u {
  114         union   ipx_net net_e;
  115         u_long          long_e;
  116 };
  117 
  118 struct ipx_addr {
  119         union ipx_net   x_net;
  120         union ipx_host  x_host;
  121         u_short         x_port;
  122 };
  123 
  124 /*
  125  * Socket address
  126  */
  127 struct sockaddr_ipx {
  128         u_char          sipx_len;
  129         u_char          sipx_family;
  130         struct ipx_addr sipx_addr;
  131         char            sipx_zero[2];
  132 };
  133 #define sipx_port sipx_addr.x_port
  134 
  135 /*
  136  * Definitions for IPX Internetwork Packet Exchange Protocol
  137  */
  138 struct ipx {
  139         u_short ipx_sum;        /* Checksum */
  140         u_short ipx_len;        /* Length, in bytes, including header */
  141         u_char  ipx_tc;         /* Transport Control (i.e. hop count) */
  142         u_char  ipx_pt;         /* Packet Type (i.e. level 2 protocol) */
  143         struct ipx_addr ipx_dna;        /* Destination Network Address */
  144         struct ipx_addr ipx_sna;        /* Source Network Address */
  145 } __packed;
  146 
  147 #define ipx_neteqnn(a,b) \
  148         (((a).s_net[0] == (b).s_net[0]) && ((a).s_net[1] == (b).s_net[1]))
  149 #define ipx_neteq(a,b) ipx_neteqnn((a).x_net, (b).x_net)
  150 #define satoipx_addr(sa) (((struct sockaddr_ipx *)&(sa))->sipx_addr)
  151 #define ipx_hosteqnh(s,t) ((s).s_host[0] == (t).s_host[0] && \
  152         (s).s_host[1] == (t).s_host[1] && (s).s_host[2] == (t).s_host[2])
  153 #define ipx_hosteq(s,t) (ipx_hosteqnh((s).x_host,(t).x_host))
  154 #define ipx_nullnet(x) (((x).x_net.s_net[0]==0) && ((x).x_net.s_net[1]==0))
  155 #define ipx_nullhost(x) (((x).x_host.s_host[0] == 0) && \
  156         ((x).x_host.s_host[1] == 0) && ((x).x_host.s_host[2] == 0))
  157 #define ipx_wildnet(x) (((x).x_net.s_net[0] == 0xffff) && \
  158         ((x).x_net.s_net[1] == 0xffff))
  159 #define ipx_wildhost(x) (((x).x_host.s_host[0] == 0xffff) && \
  160         ((x).x_host.s_host[1] == 0xffff) && ((x).x_host.s_host[2] == 0xffff))
  161 
  162 #include <sys/cdefs.h>
  163 
  164 __BEGIN_DECLS
  165 struct  ipx_addr ipx_addr(const char *);
  166 char    *ipx_ntoa(struct ipx_addr);
  167 __END_DECLS
  168 
  169 #endif /* !_NETIPX_IPX_H_ */

Cache object: 1db5fa8451a718a7bf8afb1985ca0f77


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.