Annotation of OSKit-Mach/include/device/net_status.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Mach Operating System
        !             3:  * Copyright (c) 1991,1990,1989 Carnegie Mellon University
        !             4:  * All Rights Reserved.
        !             5:  *
        !             6:  * Permission to use, copy, modify and distribute this software and its
        !             7:  * documentation is hereby granted, provided that both the copyright
        !             8:  * notice and this permission notice appear in all copies of the
        !             9:  * software, derivative works or modified versions, and any portions
        !            10:  * thereof, and that both notices appear in supporting documentation.
        !            11:  *
        !            12:  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
        !            13:  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
        !            14:  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
        !            15:  *
        !            16:  * Carnegie Mellon requests users of this software to return to
        !            17:  *
        !            18:  *  Software Distribution Coordinator  or  [email protected]
        !            19:  *  School of Computer Science
        !            20:  *  Carnegie Mellon University
        !            21:  *  Pittsburgh PA 15213-3890
        !            22:  *
        !            23:  * any improvements or extensions that they make and grant Carnegie Mellon
        !            24:  * the rights to redistribute these changes.
        !            25:  */
        !            26: /*
        !            27:  *     Author: David B. Golub, Carnegie Mellon University
        !            28:  *     Date:   3/89
        !            29:  *
        !            30:  *     Status information for network interfaces.
        !            31:  */
        !            32: 
        !            33: #ifndef        _DEVICE_NET_STATUS_H_
        !            34: #define        _DEVICE_NET_STATUS_H_
        !            35: 
        !            36: #include <device/device_types.h>
        !            37: #include <mach/message.h>
        !            38: 
        !            39: /*
        !            40:  * General interface status
        !            41:  */
        !            42: struct net_status {
        !            43:        int     min_packet_size;        /* minimum size, including header */
        !            44:        int     max_packet_size;        /* maximum size, including header */
        !            45:        int     header_format;          /* format of network header */
        !            46:        int     header_size;            /* size of network header */
        !            47:        int     address_size;           /* size of network address */
        !            48:        int     flags;                  /* interface status */
        !            49:        int     mapped_size;            /* if mappable, virtual mem needed */
        !            50: };
        !            51: #define        NET_STATUS_COUNT        (sizeof(struct net_status)/sizeof(int))
        !            52: #define        NET_STATUS              (('n'<<16) + 1)
        !            53: 
        !            54: /*
        !            55:  * Header formats, as given by RFC 826/1010 for ARP:
        !            56:  */
        !            57: #define        HDR_ETHERNET            1       /* Ethernet hardware address */
        !            58: #define        HDR_EXP_ETHERNET        2       /* 3Mhz experimental Ethernet
        !            59:                                           hardware address */
        !            60: #define        HDR_PRO_NET             4       /* Proteon ProNET Token Ring */
        !            61: #define        HDR_CHAOS               5       /* Chaosnet */
        !            62: #define        HDR_802                 6       /* IEEE 802 networks */
        !            63: 
        !            64: 
        !            65: /*
        !            66:  * A network address is an array of bytes.  In order to return
        !            67:  * this in an array of (long) integers, it is returned in net order.
        !            68:  * Use 'ntohl' on each element of the array to retrieve the original
        !            69:  * ordering.
        !            70:  */
        !            71: #define        NET_ADDRESS             (('n'<<16) + 2)
        !            72: 
        !            73: #define        NET_DSTADDR             (('n'<<16) + 3)
        !            74: 
        !            75: 
        !            76: /*
        !            77:  * Input packet filter definition
        !            78:  */
        !            79: #define        NET_MAX_FILTER          128 /* was 64, bpf programs are big */
        !            80: #define        NET_FILTER_STACK_DEPTH  32
        !            81: 
        !            82: /*
        !            83:  *  We allow specification of up to NET_MAX_FILTER (short) words of a filter
        !            84:  *  command list to be applied to incoming packets to determine if
        !            85:  *  those packets should be given to a particular network input filter.
        !            86:  *
        !            87:  *  Each network filter specifies the filter command list via net_add_filter.
        !            88:  *  Each filter command list specifies a sequences of actions which leave a
        !            89:  *  boolean value on the top of an internal stack.  Each word of the
        !            90:  *  command list specifies an action from the set {PUSHLIT, PUSHZERO,
        !            91:  *  PUSHWORD+N} which respectively push the next word of the filter, zero,
        !            92:  *  or word N of the incoming packet on the stack, and a binary operator
        !            93:  *  from the set {EQ, LT, LE, GT, GE, AND, OR, XOR} which operates on the
        !            94:  *  top two elements of the stack and replaces them with its result.  The
        !            95:  *  special action NOPUSH and the special operator NOP can be used to only
        !            96:  *  perform the binary operation or to only push a value on the stack.
        !            97:  *
        !            98:  *  If the final value of the filter operation is true, then the packet is
        !            99:  *  accepted for the filter.
        !           100:  *
        !           101:  */
        !           102: 
        !           103: typedef        unsigned short  filter_t;
        !           104: typedef filter_t       *filter_array_t;
        !           105: 
        !           106: #define CSPF_BYTES(n) ((n) * sizeof (filter_t))
        !           107: 
        !           108: /*  these must sum to 16!  */
        !           109: #define NETF_NBPA      10                      /* # bits / argument */
        !           110: #define NETF_NBPO      6                       /* # bits / operator */
        !           111: 
        !           112: #define        NETF_ARG(word)  ((word) & 0x3ff)
        !           113: #define        NETF_OP(word)   (((word)>>NETF_NBPA)&0x3f)
        !           114: 
        !           115: /*  binary operators  */
        !           116: #define NETF_NOP       (0<<NETF_NBPA)
        !           117: #define NETF_EQ                (1<<NETF_NBPA)
        !           118: #define NETF_LT                (2<<NETF_NBPA)
        !           119: #define NETF_LE                (3<<NETF_NBPA)
        !           120: #define NETF_GT                (4<<NETF_NBPA)
        !           121: #define NETF_GE                (5<<NETF_NBPA)
        !           122: #define NETF_AND       (6<<NETF_NBPA)
        !           123: #define NETF_OR                (7<<NETF_NBPA)
        !           124: #define NETF_XOR       (8<<NETF_NBPA)
        !           125: #define NETF_COR       (9<<NETF_NBPA)
        !           126: #define NETF_CAND      (10<<NETF_NBPA)
        !           127: #define NETF_CNOR      (11<<NETF_NBPA)
        !           128: #define NETF_CNAND     (12<<NETF_NBPA)
        !           129: #define NETF_NEQ       (13<<NETF_NBPA)
        !           130: #define        NETF_LSH        (14<<NETF_NBPA)
        !           131: #define        NETF_RSH        (15<<NETF_NBPA)
        !           132: #define        NETF_ADD        (16<<NETF_NBPA)
        !           133: #define        NETF_SUB        (17<<NETF_NBPA)
        !           134: #define NETF_BPF       (((1 << NETF_NBPO) - 1) << NETF_NBPA)
        !           135: 
        !           136: 
        !           137: /*  stack arguments  */
        !           138: #define NETF_NOPUSH    0               /* don`t push */
        !           139: #define NETF_PUSHLIT   1               /* next word in filter */
        !           140: #define NETF_PUSHZERO  2               /* 0 */
        !           141: #define        NETF_PUSHIND    14              /* word indexed by stack top */
        !           142: #define        NETF_PUSHHDRIND 15              /* header word indexed by stack top */
        !           143: #define NETF_PUSHWORD  16              /* word 0 .. 944 in packet */
        !           144: #define        NETF_PUSHHDR    960             /* word 0 .. 31  in header */
        !           145: #define        NETF_PUSHSTK    992             /* word 0 .. 31  in stack */
        !           146: 
        !           147: /* priorities */
        !           148: #define        NET_HI_PRI      100
        !           149: #define        NET_PRI_MAX     255
        !           150: 
        !           151: /*
        !           152:  * BPF support.
        !           153:  */
        !           154: #include <device/bpf.h>
        !           155: 
        !           156: /*
        !           157:  * Net receive message format.
        !           158:  *
        !           159:  * The header and data are packaged separately, since some hardware
        !           160:  * supports variable-length headers.  We prefix the packet with
        !           161:  * a packet_hdr structure so that the real data portion begins
        !           162:  * on a long-word boundary, and so that packet filters can address
        !           163:  * the type field and packet size uniformly.
        !           164:  */
        !           165: #define        NET_RCV_MAX     4095
        !           166: #define        NET_HDW_HDR_MAX 64
        !           167: 
        !           168: #define        NET_RCV_MSG_ID  2999    /* in device.defs reply range */
        !           169: 
        !           170: struct packet_header {
        !           171:        unsigned short  length;
        !           172:        unsigned short  type;   /* network order */
        !           173: };
        !           174: 
        !           175: struct net_rcv_msg {
        !           176:        mach_msg_header_t msg_hdr;
        !           177:        mach_msg_type_t header_type;
        !           178:        char            header[NET_HDW_HDR_MAX];
        !           179:        mach_msg_type_t packet_type;
        !           180:        char            packet[NET_RCV_MAX];
        !           181: };
        !           182: typedef struct net_rcv_msg     *net_rcv_msg_t;
        !           183: #define        net_rcv_msg_packet_count packet_type.msgt_number
        !           184: 
        !           185: 
        !           186: 
        !           187: #endif /* _DEVICE_NET_STATUS_H_ */

unix.superglobalmegacorp.com

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