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

Defined variables

ns_broadnet defined in line 124; used 2 times
ns_zerohost defined in line 121; used 4 times

Defined struct's

Defined union's

ns_net defined in line 73; used 36 times
ns_net_u defined in line 78; never used

Defined macros

NSPORT_ECHO defined in line 37; never used
NSPORT_RE defined in line 38; never used
NSPORT_RESERVED defined in line 44; used 3 times
NSPORT_RI defined in line 36; never used
NSPROTO_ECHO defined in line 24; used 1 times
NSPROTO_ERROR defined in line 25; used 3 times
NSPROTO_MAX defined in line 29; never used
NSPROTO_PE defined in line 26; never used
NSPROTO_RAW defined in line 28; used 1 times
NSPROTO_RI defined in line 23; never used
NSPROTO_SPP defined in line 27; used 4 times
NS_MAXHOPS defined in line 52; used 4 times
SO_ALL_PACKETS defined in line 61; never used
SO_DEFAULT_HEADERS defined in line 57; never used
SO_HEADERS_ON_INPUT defined in line 55; never used
SO_HEADERS_ON_OUTPUT defined in line 56; never used
SO_LAST_HEADER defined in line 58; never used
SO_MTU defined in line 62; never used
SO_NSIP_ROUTE defined in line 59; used 1 times
SO_SEQNO defined in line 60; never used
ns_hosteqnh defined in line 106; used 10 times
ns_neteqnn defined in line 102; used 7 times
ns_netof defined in line 100; never used
sns_port defined in line 97; used 5 times

Usage of this include

Last modified: 1994-01-01
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 4175
Valid CSS Valid XHTML 1.0 Strict