1: /*
   2:  * Copyright (c) 1984, 1985, 1986 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  *
   6:  *	@(#)ns.h	7.1 (Berkeley) 6/5/86
   7:  */
   8: 
   9: /*
  10:  * Constants and Structures defined by the Xerox Network Software
  11:  * per "Internet Transport Protocols", XSIS 028112, December 1981
  12:  */
  13: 
  14: /*
  15:  * Protocols
  16:  */
  17: #define NSPROTO_RI  1       /* Routing Information */
  18: #define NSPROTO_ECHO    2       /* Echo Protocol */
  19: #define NSPROTO_ERROR   3       /* Error Protocol */
  20: #define NSPROTO_PE  4       /* Packet Exchange */
  21: #define NSPROTO_SPP 5       /* Sequenced Packet */
  22: #define NSPROTO_RAW 255     /* Placemarker*/
  23: #define NSPROTO_MAX 256     /* Placemarker*/
  24: 
  25: 
  26: /*
  27:  * Port/Socket numbers: network standard functions
  28:  */
  29: 
  30: #define NSPORT_RI   1       /* Routing Information */
  31: #define NSPORT_ECHO 2       /* Echo */
  32: #define NSPORT_RE   3       /* Router Error */
  33: 
  34: /*
  35:  * Ports < NSPORT_RESERVED are reserved for priveleged
  36:  * processes (e.g. root).
  37:  */
  38: #define NSPORT_RESERVED     3000
  39: 
  40: /* flags passed to ns_output as last parameter */
  41: 
  42: #define NS_FORWARDING       0x1 /* most of idp header exists */
  43: #define NS_ROUTETOIF        0x10    /* same as SO_DONTROUTE */
  44: #define NS_ALLOWBROADCAST   SO_BROADCAST    /* can send broadcast packets */
  45: 
  46: #define NS_MAXHOPS      15
  47: 
  48: /* flags passed to get/set socket option */
  49: #define SO_HEADERS_ON_INPUT 1
  50: #define SO_HEADERS_ON_OUTPUT    2
  51: #define SO_DEFAULT_HEADERS  3
  52: #define SO_LAST_HEADER      4
  53: #define SO_NSIP_ROUTE       5
  54: #define SO_SEQNO        6
  55: #define SO_ALL_PACKETS      7
  56: #define SO_MTU          8
  57: 
  58: 
  59: /*
  60:  * NS addressing
  61:  */
  62: union ns_host {
  63:     u_char  c_host[6];
  64:     u_short s_host[3];
  65: };
  66: 
  67: union ns_net {
  68:     u_char  c_net[4];
  69:     u_short s_net[2];
  70: };
  71: 
  72: union ns_net_u {
  73:     union ns_net    net_e;
  74:     u_long      long_e;
  75: };
  76: 
  77: struct ns_addr {
  78:     union ns_net    x_net;
  79:     union ns_host   x_host;
  80:     u_short x_port;
  81: };
  82: 
  83: /*
  84:  * Socket address, Xerox style
  85:  */
  86: struct sockaddr_ns {
  87:     u_short     sns_family;
  88:     struct ns_addr  sns_addr;
  89:     char        sns_zero[2];
  90: };
  91: #define sns_port sns_addr.x_port
  92: 
  93: #ifdef vax
  94: #define ns_netof(a) (*(long *) & ((a).x_net)) /* XXX - not needed */
  95: #endif
  96: #define ns_neteqnn(a,b) (((a).s_net[0]==(b).s_net[0]) && \
  97:                     ((a).s_net[1]==(b).s_net[1]))
  98: #define ns_neteq(a,b) ns_neteqnn((a).x_net, (b).x_net)
  99: #define satons_addr(sa) (((struct sockaddr_ns *)&(sa))->sns_addr)
 100: #define ns_hosteqnh(s,t) ((s).s_host[0] == (t).s_host[0] && \
 101:     (s).s_host[1] == (t).s_host[1] && (s).s_host[2] == (t).s_host[2])
 102: #define ns_hosteq(s,t) (ns_hosteqnh((s).x_host,(t).x_host))
 103: #define ns_nullhost(x) (((x).x_host.s_host[0]==0) && \
 104:     ((x).x_host.s_host[1]==0) && ((x).x_host.s_host[2]==0))
 105: 
 106: #if !defined(vax) && !defined(ntohl) && !defined(lint)
 107: /*
 108:  * Macros for number representation conversion.
 109:  */
 110: #define ntohl(x)    (x)
 111: #define ntohs(x)    (x)
 112: #define htonl(x)    (x)
 113: #define htons(x)    (x)
 114: #endif
 115: 
 116: #if !defined(ntohl) && (defined(vax) || defined(lint))
 117: u_short ntohs(), htons();
 118: u_long  ntohl(), htonl();
 119: #endif
 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: #endif

Defined variables

ns_broadnet defined in line 127; used 2 times
ns_zerohost defined in line 124; used 4 times
ns_zeronet defined in line 126; used 1 times

Defined struct's

Defined union's

ns_net defined in line 67; used 20 times
ns_net_u defined in line 72; never used

Defined macros

NSPORT_ECHO defined in line 31; never used
NSPORT_RE defined in line 32; never used
NSPORT_RESERVED defined in line 38; used 3 times
NSPORT_RI defined in line 30; never used
NSPROTO_ECHO defined in line 18; used 1 times
NSPROTO_ERROR defined in line 19; used 3 times
NSPROTO_MAX defined in line 23; never used
NSPROTO_PE defined in line 20; never used
NSPROTO_RAW defined in line 22; used 1 times
NSPROTO_RI defined in line 17; never used
NSPROTO_SPP defined in line 21; used 4 times
NS_MAXHOPS defined in line 46; used 4 times
SO_ALL_PACKETS defined in line 55; never used
SO_DEFAULT_HEADERS defined in line 51; never used
SO_HEADERS_ON_INPUT defined in line 49; never used
SO_HEADERS_ON_OUTPUT defined in line 50; never used
SO_LAST_HEADER defined in line 52; never used
SO_MTU defined in line 56; never used
SO_NSIP_ROUTE defined in line 53; never used
SO_SEQNO defined in line 54; never used
htonl defined in line 112; used 2 times
ns_hosteqnh defined in line 100; used 10 times
ns_neteqnn defined in line 96; used 7 times
ns_netof defined in line 94; never used
ntohl defined in line 110; used 3 times
sns_port defined in line 91; used 5 times

Usage of this include

Last modified: 1986-06-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1302
Valid CSS Valid XHTML 1.0 Strict