Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
0002 /*
0003  * INET         An implementation of the TCP/IP protocol suite for the LINUX
0004  *              operating system.  INET is implemented using the  BSD Socket
0005  *              interface as the means of communication with the user level.
0006  *
0007  *              Global definitions for the ARCnet interface.
0008  *
0009  * Authors:     David Woodhouse and Avery Pennarun
0010  *
0011  *              This program is free software; you can redistribute it and/or
0012  *              modify it under the terms of the GNU General Public License
0013  *              as published by the Free Software Foundation; either version
0014  *              2 of the License, or (at your option) any later version.
0015  */
0016 
0017 #ifndef _LINUX_IF_ARCNET_H
0018 #define _LINUX_IF_ARCNET_H
0019 
0020 #include <linux/types.h>
0021 #include <linux/if_ether.h>
0022 
0023 /*
0024  *    These are the defined ARCnet Protocol ID's.
0025  */
0026 
0027 /* CAP mode */
0028 /* No macro but uses 1-8 */
0029 
0030 /* RFC1201 Protocol ID's */
0031 #define ARC_P_IP        212 /* 0xD4 */
0032 #define ARC_P_IPV6      196 /* 0xC4: RFC2497 */
0033 #define ARC_P_ARP       213 /* 0xD5 */
0034 #define ARC_P_RARP      214 /* 0xD6 */
0035 #define ARC_P_IPX       250 /* 0xFA */
0036 #define ARC_P_NOVELL_EC     236 /* 0xEC */
0037 
0038 /* Old RFC1051 Protocol ID's */
0039 #define ARC_P_IP_RFC1051    240 /* 0xF0 */
0040 #define ARC_P_ARP_RFC1051   241 /* 0xF1 */
0041 
0042 /* MS LanMan/WfWg "NDIS" encapsulation */
0043 #define ARC_P_ETHER     232 /* 0xE8 */
0044 
0045 /* Unsupported/indirectly supported protocols */
0046 #define ARC_P_DATAPOINT_BOOT    0   /* very old Datapoint equipment */
0047 #define ARC_P_DATAPOINT_MOUNT   1
0048 #define ARC_P_POWERLAN_BEACON   8   /* Probably ATA-Netbios related */
0049 #define ARC_P_POWERLAN_BEACON2  243 /* 0xF3 */
0050 #define ARC_P_LANSOFT       251 /* 0xFB - what is this? */
0051 #define ARC_P_ATALK     0xDD
0052 
0053 /* Hardware address length */
0054 #define ARCNET_ALEN 1
0055 
0056 /*
0057  * The RFC1201-specific components of an arcnet packet header.
0058  */
0059 struct arc_rfc1201 {
0060     __u8  proto;        /* protocol ID field - varies       */
0061     __u8  split_flag;   /* for use with split packets       */
0062     __be16   sequence;  /* sequence number          */
0063     __u8  payload[];    /* space remaining in packet (504 bytes)*/
0064 };
0065 #define RFC1201_HDR_SIZE 4
0066 
0067 /*
0068  * The RFC1051-specific components.
0069  */
0070 struct arc_rfc1051 {
0071     __u8 proto;     /* ARC_P_RFC1051_ARP/RFC1051_IP */
0072     __u8 payload[]; /* 507 bytes            */
0073 };
0074 #define RFC1051_HDR_SIZE 1
0075 
0076 /*
0077  * The ethernet-encap-specific components.  We have a real ethernet header
0078  * and some data.
0079  */
0080 struct arc_eth_encap {
0081     __u8 proto;     /* Always ARC_P_ETHER           */
0082     struct ethhdr eth;  /* standard ethernet header (yuck!) */
0083     __u8 payload[]; /* 493 bytes                */
0084 };
0085 #define ETH_ENCAP_HDR_SIZE 14
0086 
0087 struct arc_cap {
0088     __u8 proto;
0089     __u8 cookie[sizeof(int)];
0090                 /* Actually NOT sent over the network */
0091     union {
0092         __u8 ack;
0093         __u8 raw[0];    /* 507 bytes */
0094     } mes;
0095 };
0096 
0097 /*
0098  * The data needed by the actual arcnet hardware.
0099  *
0100  * Now, in the real arcnet hardware, the third and fourth bytes are the
0101  * 'offset' specification instead of the length, and the soft data is at
0102  * the _end_ of the 512-byte buffer.  We hide this complexity inside the
0103  * driver.
0104  */
0105 struct arc_hardware {
0106     __u8 source;        /* source ARCnet - filled in automagically */
0107     __u8 dest;      /* destination ARCnet - 0 for broadcast    */
0108     __u8 offset[2];     /* offset bytes (some weird semantics)     */
0109 };
0110 #define ARC_HDR_SIZE 4
0111 
0112 /*
0113  * This is an ARCnet frame header, as seen by the kernel (and userspace,
0114  * when you do a raw packet capture).
0115  */
0116 struct archdr {
0117     /* hardware requirements */
0118     struct arc_hardware hard;
0119 
0120     /* arcnet encapsulation-specific bits */
0121     union {
0122         struct arc_rfc1201   rfc1201;
0123         struct arc_rfc1051   rfc1051;
0124         struct arc_eth_encap eth_encap;
0125         struct arc_cap       cap;
0126         __u8 raw[0];    /* 508 bytes                */
0127     } soft;
0128 };
0129 
0130 #endif              /* _LINUX_IF_ARCNET_H */