1: /*      enet.h	Stanford	25 April 1983 */
   2: 
   3: /*
   4:  *  Ethernet definitions needed for user processes
   5:  *
   6:  **********************************************************************
   7:  * HISTORY
   8:  * 7 October 1985	Jeff Mogul	Stanford
   9:  *	Added EIOCMFREE ioctl to indicate # of free minor devices;
  10:  *	may or may not be useful.
  11:  * 17 October 1984	Jeff Mogul	Stanford
  12:  *	Added ENF_CAND, ENF_COR, ENF_CNAND, and ENF_CNOR, short-circuit
  13:  *	operators, to make filters run faster.
  14:  *	All evaluate "(*sp++ == *sp++)":
  15:  *	ENF_CAND: returns false immediately if result is false, otherwise
  16:  *		continue
  17:  *	ENF_COR: returns true immediately if result is true, otherwise
  18:  *		continue
  19:  *	ENF_CNAND: returns true immediately if result is false, otherwise
  20:  *		continue
  21:  *	ENF_CNOR: returns false immediately if result is true, otherwise
  22:  *		continue
  23:  *	Also added ENF_NEQ to complement ENF_EQ
  24:  *
  25:  * 10 November 1983	Jeffrey Mogul	Stanford
  26:  *	Slight restructuring for support of 10mb ethers;
  27:  *	added the EIOCDEVP ioctl and associated definitions
  28:  *	and removed the EIOCMTU ioctl (subsumed by EIOCDEVP)
  29:  *
  30:  * 25-Apr-83	Jeffrey Mogul	Stanford
  31:  *	Began conversion to 4.2BSD.  This involves removing all
  32:  *	references to the actual hardware.
  33:  *	Incompatible change: ioctl encodings!
  34:  *	Added EIOCMTU ioctl to get MTU (max packet size).
  35:  *	Most previous history comments removed.
  36:  *	Definitions of interest only to kernel now are in enetdefs.h
  37:  *
  38:  * 10-Aug-82  Mike Accetta (mja) at Carnegie-Mellon University
  39:  *	Added EIOCMBIS and EIOCMBIC definitions, and new ENHOLDSIG mode
  40:  *	bit and ENPRIVMODES defintions (V3.05e). [Last change before
  41:  *	4.2BSD conversion starts.]
  42:  *
  43:  * 22-Feb-80  Rick Rashid (rfr) at Carnegie-Mellon University
  44:  *	Rewritten for multiple simultaneous opens with filters (V1.05).
  45:  *
  46:  * 18-Jan-80  Mike Accetta (mja) at Carnegie-Mellon University
  47:  *      Created (V1.00).
  48:  *
  49:  **********************************************************************
  50:  */
  51: #ifdef KERNEL
  52: #include "ioctl.h"
  53: #else
  54: #include <sys/ioctl.h>
  55: #endif	KERNEL
  56: 
  57: #define ENMAXFILTERS    40      /* maximum filter short words */
  58: 
  59: /*
  60:  *  filter structure for SETF
  61:  */
  62: struct enfilter
  63: {
  64:     u_char  enf_Priority;       /* priority of filter */
  65:     u_char  enf_FilterLen;      /* length of filter command list */
  66:     u_short enf_Filter[ENMAXFILTERS];   /* the filter command list */
  67: };
  68: 
  69: /*  set/get parameters, set filter ioctl commands  */
  70: #define EIOCSETP    _IOW(E,100, struct eniocb)
  71: #define EIOCGETP    _IOR(E,101, struct eniocb)
  72: #define EIOCSETF    _IOW(E,102, struct enfilter)
  73: #define EIOCENBS    _IOW(E,103, int)
  74: #define EIOCINHS    _IO(E,104)
  75: #define EIOCSETW    _IOW(E,105, u_int)
  76: #define EIOCFLUSH   _IO(E,106)
  77: #define EIOCALLOCP  _IO(E,107)
  78: #define EIOCDEALLOCP    _IO(E,108)
  79: #define EIOCMBIS    _IOW(E,109, u_short)
  80: #define EIOCMBIC    _IOW(E,110, u_short)
  81: #define EIOCDEVP    _IOR(E,111, struct endevp)
  82: #define EIOCMFREE   _IOR(E,112, int)
  83: 
  84: /*
  85:  *  Bits in mode word modified by EIOCMBIS and EIOCMBIC.
  86:  */
  87: #define ENHOLDSIG   (0x0001)    /* don't disable signal after sending */
  88: #define ENPRIVMODES (~(ENHOLDSIG))
  89: 
  90: /*
  91:  *  We now allow specification of up to MAXFILTERS (short) words of a filter
  92:  *  command list to be applied to incoming packets to determine if
  93:  *  those packets should be given to a particular open ethernet file.
  94:  *
  95:  *  Each open enet file specifies the filter command list via iocontrl.
  96:  *  Each filter command list specifies a sequences of actions which leave a
  97:  *  boolean value on the top of an internal stack.  Each word of the
  98:  *  command list specifies an action from the set {PUSHLIT, PUSHZERO,
  99:  *  PUSHWORD+N} which respectively push the next word of the stack, zero,
 100:  *  or word N of the incoming packet on the stack, and a binary operator
 101:  *  from the set {EQ, LT, LE, GT, GE, AND, OR, XOR} which operates on the
 102:  *  top two elements of the stack and replaces them with its result.  The
 103:  *  special action NOPUSH and the special operator NOP can be used to only
 104:  *  perform the binary operation or to only push a value on the stack.
 105:  *
 106:  *  If the final value of the filter operation is true, then the packet is
 107:  *  accepted for the open file which specified the filter.
 108:  *
 109:  */
 110: 
 111: /*  these must sum to 16!  */
 112: #define ENF_NBPA    10          /* # bits / action */
 113: #define ENF_NBPO    6           /* # bits / operator */
 114: 
 115: /*  binary operators  */
 116: #define ENF_NOP (0<<ENF_NBPA)
 117: #define ENF_EQ  (1<<ENF_NBPA)
 118: #define ENF_LT  (2<<ENF_NBPA)
 119: #define ENF_LE  (3<<ENF_NBPA)
 120: #define ENF_GT  (4<<ENF_NBPA)
 121: #define ENF_GE  (5<<ENF_NBPA)
 122: #define ENF_AND (6<<ENF_NBPA)
 123: #define ENF_OR  (7<<ENF_NBPA)
 124: #define ENF_XOR (8<<ENF_NBPA)
 125: #define ENF_COR (9<<ENF_NBPA)
 126: #define ENF_CAND    (10<<ENF_NBPA)
 127: #define ENF_CNOR    (11<<ENF_NBPA)
 128: #define ENF_CNAND   (12<<ENF_NBPA)
 129: #define ENF_NEQ     (13<<ENF_NBPA)
 130: 
 131: /*  stack actions  */
 132: #define ENF_NOPUSH  0
 133: #define ENF_PUSHLIT 1
 134: #define ENF_PUSHZERO    2
 135: #define ENF_PUSHWORD    16
 136: 
 137: /*
 138:  *  parameter buffer structure for GETP and SETP
 139:  */
 140: struct eniocb
 141: {
 142:     u_char en_addr;     /* ethernet address (RO) */
 143:     u_char en_maxfilters;   /* max filter words available (RO) */
 144:     u_char en_maxwaiting;   /* max queued input packets (RO) */
 145:     u_char en_maxpriority;  /* max filter priority for this file (RO) */
 146:     long   en_rtout;        /* receive timeout in (jiffies) (RW) */
 147: };
 148: 
 149: /*
 150:  * parameter structure for EIOCDEVP (get device parameters)
 151:  */
 152: 
 153: #define EN_MAX_ADDR_LEN 8   /* maximum bytes in a hardware address */
 154: 
 155: struct endevp {
 156:     u_char  end_dev_type;   /* device type, codes below */
 157:     u_char  end_addr_len;   /* length (bytes) of a hardware address */
 158:     u_short end_hdr_len;    /* length of a hardware packet header */
 159:     u_short end_MTU;    /* maximum packet size (bytes) */
 160:     u_char  end_addr[EN_MAX_ADDR_LEN];
 161:                 /* hardware address for this unit */
 162:     u_char  end_broadaddr[EN_MAX_ADDR_LEN];
 163:                 /* hardware-supported broadcast address */
 164: };
 165: 
 166: /* Ethernet Device Type codes */
 167: 
 168: #define ENDT_3MB    3   /* Xerox Experimental Ethernet */
 169: #define ENDT_BS3MB  1   /* Xerox Experimental Ethernet/byteswapped */
 170: #define ENDT_10MB   2   /* Xerox-DEC-Intel Standard Ethernet */
 171: 
 172: #define ENDT_MIN    1   /* minimum defined device type code */
 173: #define ENDT_MAX    3   /* maximum defined device type code */

Defined struct's

enfilter defined in line 62; used 2 times
eniocb defined in line 140; used 4 times

Defined macros

EIOCALLOCP defined in line 77; never used
EIOCDEALLOCP defined in line 78; never used
EIOCDEVP defined in line 81; never used
EIOCENBS defined in line 73; never used
EIOCFLUSH defined in line 76; never used
EIOCGETP defined in line 71; never used
EIOCINHS defined in line 74; never used
EIOCMBIC defined in line 80; never used
EIOCMBIS defined in line 79; never used
EIOCMFREE defined in line 82; never used
EIOCSETF defined in line 72; never used
EIOCSETP defined in line 70; never used
EIOCSETW defined in line 75; never used
ENDT_3MB defined in line 168; used 1 times
ENDT_BS3MB defined in line 169; used 1 times
ENDT_MAX defined in line 173; never used
ENDT_MIN defined in line 172; never used
ENF_AND defined in line 122; used 1 times
ENF_CAND defined in line 126; used 1 times
ENF_CNAND defined in line 128; used 1 times
ENF_CNOR defined in line 127; used 1 times
ENF_COR defined in line 125; used 1 times
ENF_EQ defined in line 117; used 1 times
ENF_GE defined in line 121; used 1 times
ENF_GT defined in line 120; used 1 times
ENF_LE defined in line 119; used 1 times
ENF_LT defined in line 118; used 1 times
ENF_NBPA defined in line 112; used 16 times
ENF_NBPO defined in line 113; used 1 times
ENF_NEQ defined in line 129; used 1 times
ENF_NOP defined in line 116; used 1 times
ENF_NOPUSH defined in line 132; never used
ENF_OR defined in line 123; used 1 times
ENF_PUSHLIT defined in line 133; never used
ENF_PUSHWORD defined in line 135; used 1 times
ENF_PUSHZERO defined in line 134; never used
ENF_XOR defined in line 124; used 1 times
ENHOLDSIG defined in line 87; used 2 times
ENMAXFILTERS defined in line 57; used 6 times
ENPRIVMODES defined in line 88; used 2 times
EN_MAX_ADDR_LEN defined in line 153; used 2 times

Usage of this include

Last modified: 1985-11-11
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1470
Valid CSS Valid XHTML 1.0 Strict