Annotation of 43BSDReno/sys/netns/ns.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1984, 1985, 1986, 1987 Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * Redistribution is only permitted until one year after the first shipment
                      6:  * of 4.4BSD by the Regents.  Otherwise, redistribution and use in source and
                      7:  * binary forms are permitted provided that: (1) source distributions retain
                      8:  * this entire copyright notice and comment, and (2) distributions including
                      9:  * binaries display the following acknowledgement:  This product includes
                     10:  * software developed by the University of California, Berkeley and its
                     11:  * contributors'' in the documentation or other materials provided with the
                     12:  * distribution and in all advertising materials mentioning features or use
                     13:  * of this software.  Neither the name of the University nor the names of
                     14:  * its contributors may be used to endorse or promote products derived from
                     15:  * this software without specific prior written permission.
                     16:  * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
                     17:  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
                     18:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     19:  *
                     20:  *     @(#)ns.h        7.7 (Berkeley) 6/28/90
                     21:  */
                     22: 
                     23: /*
                     24:  * Constants and Structures defined by the Xerox Network Software
                     25:  * per "Internet Transport Protocols", XSIS 028112, December 1981
                     26:  */
                     27: 
                     28: /*
                     29:  * Protocols
                     30:  */
                     31: #define NSPROTO_RI     1               /* Routing Information */
                     32: #define NSPROTO_ECHO   2               /* Echo Protocol */
                     33: #define NSPROTO_ERROR  3               /* Error Protocol */
                     34: #define NSPROTO_PE     4               /* Packet Exchange */
                     35: #define NSPROTO_SPP    5               /* Sequenced Packet */
                     36: #define NSPROTO_RAW    255             /* Placemarker*/
                     37: #define NSPROTO_MAX    256             /* Placemarker*/
                     38: 
                     39: 
                     40: /*
                     41:  * Port/Socket numbers: network standard functions
                     42:  */
                     43: 
                     44: #define NSPORT_RI      1               /* Routing Information */
                     45: #define NSPORT_ECHO    2               /* Echo */
                     46: #define NSPORT_RE      3               /* Router Error */
                     47: 
                     48: /*
                     49:  * Ports < NSPORT_RESERVED are reserved for priveleged
                     50:  * processes (e.g. root).
                     51:  */
                     52: #define NSPORT_RESERVED                3000
                     53: 
                     54: /* flags passed to ns_output as last parameter */
                     55: 
                     56: #define        NS_FORWARDING           0x1     /* most of idp header exists */
                     57: #define        NS_ROUTETOIF            0x10    /* same as SO_DONTROUTE */
                     58: #define        NS_ALLOWBROADCAST       SO_BROADCAST    /* can send broadcast packets */
                     59: 
                     60: #define NS_MAXHOPS             15
                     61: 
                     62: /* flags passed to get/set socket option */
                     63: #define        SO_HEADERS_ON_INPUT     1
                     64: #define        SO_HEADERS_ON_OUTPUT    2
                     65: #define        SO_DEFAULT_HEADERS      3
                     66: #define        SO_LAST_HEADER          4
                     67: #define        SO_NSIP_ROUTE           5
                     68: #define SO_SEQNO               6
                     69: #define        SO_ALL_PACKETS          7
                     70: #define SO_MTU                 8
                     71: 
                     72: 
                     73: /*
                     74:  * NS addressing
                     75:  */
                     76: union ns_host {
                     77:        u_char  c_host[6];
                     78:        u_short s_host[3];
                     79: };
                     80: 
                     81: union ns_net {
                     82:        u_char  c_net[4];
                     83:        u_short s_net[2];
                     84: };
                     85: 
                     86: union ns_net_u {
                     87:        union ns_net    net_e;
                     88:        u_long          long_e;
                     89: };
                     90: 
                     91: struct ns_addr {
                     92:        union ns_net    x_net;
                     93:        union ns_host   x_host;
                     94:        u_short x_port;
                     95: };
                     96: 
                     97: /*
                     98:  * Socket address, Xerox style
                     99:  */
                    100: struct sockaddr_ns {
                    101:        u_char          sns_len;
                    102:        u_char          sns_family;
                    103:        struct ns_addr  sns_addr;
                    104:        char            sns_zero[2];
                    105: };
                    106: #define sns_port sns_addr.x_port
                    107: 
                    108: #ifdef vax
                    109: #define ns_netof(a) (*(long *) & ((a).x_net)) /* XXX - not needed */
                    110: #endif
                    111: #define ns_neteqnn(a,b) (((a).s_net[0]==(b).s_net[0]) && \
                    112:                                        ((a).s_net[1]==(b).s_net[1]))
                    113: #define ns_neteq(a,b) ns_neteqnn((a).x_net, (b).x_net)
                    114: #define satons_addr(sa)        (((struct sockaddr_ns *)&(sa))->sns_addr)
                    115: #define ns_hosteqnh(s,t) ((s).s_host[0] == (t).s_host[0] && \
                    116:        (s).s_host[1] == (t).s_host[1] && (s).s_host[2] == (t).s_host[2])
                    117: #define ns_hosteq(s,t) (ns_hosteqnh((s).x_host,(t).x_host))
                    118: #define ns_nullhost(x) (((x).x_host.s_host[0]==0) && \
                    119:        ((x).x_host.s_host[1]==0) && ((x).x_host.s_host[2]==0))
                    120: 
                    121: #ifdef KERNEL
                    122: extern struct domain nsdomain;
                    123: union ns_host ns_thishost;
                    124: union ns_host ns_zerohost;
                    125: union ns_host ns_broadhost;
                    126: union ns_net ns_zeronet;
                    127: union ns_net ns_broadnet;
                    128: u_short ns_cksum();
                    129: #else
                    130: #ifdef __STDC__
                    131: extern struct ns_addr ns_addr(const char *);
                    132: extern char *ns_ntoa(struct ns_addr);
                    133: #else
                    134: extern struct ns_addr ns_addr();
                    135: extern char *ns_ntoa();
                    136: #endif
                    137: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.