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/netns/ns.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: ns.h,v 1.17 2003/08/07 16:33:45 agc Exp $      */
    2 
    3 /*
    4  * Copyright (c) 1984, 1985, 1986, 1987, 1993
    5  *      The Regents of the University of California.  All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  * 3. Neither the name of the University nor the names of its contributors
   16  *    may be used to endorse or promote products derived from this software
   17  *    without specific prior written permission.
   18  *
   19  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   29  * SUCH DAMAGE.
   30  *
   31  *      @(#)ns.h        8.1 (Berkeley) 6/10/93
   32  */
   33 
   34 /*
   35  * Constants and Structures defined by the Xerox Network Software
   36  * per "Internet Transport Protocols", XSIS 028112, December 1981
   37  */
   38 
   39 /*
   40  * Protocols
   41  */
   42 #define NSPROTO_RI      1               /* Routing Information */
   43 #define NSPROTO_ECHO    2               /* Echo Protocol */
   44 #define NSPROTO_ERROR   3               /* Error Protocol */
   45 #define NSPROTO_PE      4               /* Packet Exchange */
   46 #define NSPROTO_SPP     5               /* Sequenced Packet */
   47 #define NSPROTO_RAW     255             /* Placemarker*/
   48 #define NSPROTO_MAX     256             /* Placemarker*/
   49 
   50 
   51 /*
   52  * Port/Socket numbers: network standard functions
   53  */
   54 
   55 #define NSPORT_RI       1               /* Routing Information */
   56 #define NSPORT_ECHO     2               /* Echo */
   57 #define NSPORT_RE       3               /* Router Error */
   58 
   59 /*
   60  * Ports < NSPORT_RESERVED are reserved for privileged
   61  * processes (e.g. root).
   62  */
   63 #define NSPORT_RESERVED         3000
   64 
   65 /* flags passed to ns_output as last parameter */
   66 
   67 #define NS_FORWARDING           0x1             /* most of idp header exists */
   68 #define NS_ROUTETOIF            SO_DONTROUTE    /* bypass routing tables */
   69 #define NS_ALLOWBROADCAST       SO_BROADCAST    /* can send broadcast packets */
   70 
   71 #define NS_MAXHOPS              15
   72 
   73 /* flags passed to get/set socket option */
   74 #define SO_HEADERS_ON_INPUT     1
   75 #define SO_HEADERS_ON_OUTPUT    2
   76 #define SO_DEFAULT_HEADERS      3
   77 #define SO_LAST_HEADER          4
   78 #define SO_NSIP_ROUTE           5
   79 #define SO_SEQNO                6
   80 #define SO_ALL_PACKETS          7
   81 #define SO_MTU                  8
   82 
   83 
   84 /*
   85  * NS addressing
   86  */
   87 union ns_host {
   88         u_int8_t        c_host[6];
   89         u_int16_t       s_host[3];
   90 };
   91 
   92 union ns_net {
   93         u_int8_t        c_net[4];
   94         u_int16_t       s_net[2];
   95 };
   96 
   97 union ns_net_u {
   98         union ns_net    net_e;
   99         u_int32_t       long_e;
  100 };
  101 
  102 struct ns_addr {
  103         union ns_net    x_net;
  104         union ns_host   x_host;
  105         u_int16_t       x_port;
  106 };
  107 
  108 /*
  109  * Socket address, Xerox style
  110  */
  111 struct sockaddr_ns {
  112         u_char          sns_len;
  113         u_char          sns_family;
  114         struct ns_addr  sns_addr;
  115         char            sns_zero[2];
  116 };
  117 #define sns_port sns_addr.x_port
  118 
  119 #define ns_neteqnn(a,b) (((a).s_net[0]==(b).s_net[0]) && \
  120                                         ((a).s_net[1]==(b).s_net[1]))
  121 #define ns_neteq(a,b) ns_neteqnn((a).x_net, (b).x_net)
  122 #define satons_addr(sa) (((struct sockaddr_ns *)&(sa))->sns_addr)
  123 #define ns_hosteqnh(s,t) ((s).s_host[0] == (t).s_host[0] && \
  124         (s).s_host[1] == (t).s_host[1] && (s).s_host[2] == (t).s_host[2])
  125 #define ns_hosteq(s,t) (ns_hosteqnh((s).x_host,(t).x_host))
  126 #define ns_nullhost(x) (((x).x_host.s_host[0]==0) && \
  127         ((x).x_host.s_host[1]==0) && ((x).x_host.s_host[2]==0))
  128 
  129 #ifdef _KERNEL
  130 extern struct domain nsdomain;
  131 extern union ns_host ns_thishost;
  132 extern union ns_host ns_zerohost;
  133 extern union ns_host ns_broadhost;
  134 extern union ns_net ns_zeronet;
  135 extern union ns_net ns_broadnet;
  136 
  137 #define satosns(sa)     ((struct sockaddr_ns *)(sa))
  138 #define snstosa(sns)    ((struct sockaddr *)(sns))
  139 
  140 extern struct sockaddr_ns ns_netmask, ns_hostmask;
  141 #else
  142 
  143 #include <sys/cdefs.h>
  144 
  145 __BEGIN_DECLS
  146 extern struct ns_addr ns_addr __P((const char *));
  147 extern char *ns_ntoa __P((struct ns_addr));
  148 __END_DECLS
  149 
  150 #endif

Cache object: ed283b678e07eb5627499ad2c6947732


[ 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.