|
|
DataMuseum.dkPresents historical artifacts from the history of: Regnecentalen RC-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Regnecentalen RC-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T U l
Length: 7382 (0x1cd6)
Types: TextFile
Notes: UNIX file
Names: »llc.h«
└─⟦8c4f54e61⟧ Bits:30004068/disk2.imd Interactive TCP/IP v.1.2
└─⟦8c4f54e61⟧ UNIX Filesystem
└─⟦this⟧ »hb/new/usr/include/sys/llc.h«
/*
* LLC datalink protocol driver data.
*
* This header is meant to be used by streams datalink level
* drivers such as ethernet drivers.
*
* Copyrighted as an unpublished work.
* (c) Copyright 1988 INTERACTIVE Systems Corporation
* All rights reserved.
*
* RESTRICTED RIGHTS:
*
* These programs are supplied under a license. They may be used,
* disclosed, and/or copied only as permitted under such license
* agreement. Any copy must contain the above copyright notice and
* this restricted rights notice. Use, copying, and/or disclosure
* of the programs is strictly prohibited unless otherwise provided
* in the license agreement.
*/
#ident "@(#)llc.h 1.8 - 89/09/29"
#define LLC_UI 0x03 /* unnumbered information field */
#define LLC_XID 0xAF /* XID with P == 0 */
#define LLC_TEST 0xE3 /* TEST with P == 0 */
#define LLC_P 0x10 /* P bit for use with XID/TEST */
#define LLC_XID_FMTID 0x81 /* XID format identifier */
#define LLC_SERVICES 0x01 /* Services supported */
#define LLC_GLOBAL_SAP 0XFF /* Global SAP address */
#define LLC_GROUP_ADDR 0x01 /* indication in DSAP of a group address */
#define LLC_RESPONSE 0x01 /* indication in SSAP of a response */
#define LLC_SNAP_SAP 0xAA /* lsap for SNAP addressing */
#define LLC_XID_INFO_SIZE 3 /* length of the INFO field */
/*
* recoverable error conditions
*/
#define LLCE_OK 0 /* normal condition */
#define LLCE_NOBUFFER 1 /* couldn't allocb */
#define LLCE_INVALID 2 /* operation isn't valid at this time */
#define LLCE_BOUND 3 /* stream is already bound */
#define LLCE_BLOCKED 4 /* blocked at next queue */
/*
* debug bits
*/
# define LLCTRACE 0x01
# define LLCRECV 0x02
# define LLCSEND 0x04
# define LLCPROT 0x08
# define LLCERRS 0x10
#ifdef DEBUG
#define LLCDEBUG
#endif
/*
* The llcdev structure contains pointers to the device specific routines
* referenced by the general llc routines. This structure should be
* a model for all q_qptr structures using the llc routines.
*/
struct llcdev {
queue_t *llc_qptr; /* points to queue assoc with open device */
int (*llc_reset)(); /* reset procedure */
int (*llc_saddr)(); /* set physical address */
int (*llc_send)(); /* transmit procedure */
int (*llc_prom)(); /* set promiscuous mode */
int (*llc_gstat)(); /* get board statistics */
int (*llc_dioctl)();/* Driver specific ioctls */
struct llcparam *llc_macpar;/* board specific parameters */
struct llcstats *llc_stats; /* driver and board statistics */
u_short llc_state; /* state variable for DL_INFO */
u_short llc_flags; /* flags to indicate driver status */
u_short llc_type; /* LLC or Ether */
u_short llc_sap; /* sap or ethertype depending on llc_type */
u_short llc_no; /* index number from front of array */
u_short llc_mask; /* mask for ether type or LLC SAPs */
u_short llc_snap[3]; /* for SNAP and other extensions */
u_short llc_rws; /* receive window size - for LLC2 */
u_short llc_sws; /* send window size - for LLC2 */
u_short llc_rseq; /* receive sequence number - for LLC2 */
u_short llc_sseq; /* send sequence number - for LLC2 */
};
/* driver status bits */
#define LLC_OPEN 0x01 /* minor device is opened */
#define LLC_PROM 0x02 /* promiscuous mode enabled */
#define LLC_XWAIT 0x04 /* waiting to be rescheduled */
#define LLC_SU 0x80 /* opened by priviledged user */
#define LLC_RWAIT 0x100 /* waiting for read reschedule */
/* define llc class 1 and mac structures and macros */
struct llctype {
u_short llc_length; /* header length */
u_char llc_dsap; /* destination sap */
u_char llc_ssap; /* source sap */
u_char llc_control; /* control information */
u_char llc_org[3]; /* SNAP organization/protocol */
u_char llc_type[2]; /* SNAP type */
u_char llc_info[1]; /* data */
};
struct ethertype {
u_short ether_type;
u_char ether_data[1];
};
struct llc_machdr {
u_char mac_dst[6];
u_char mac_src[6];
union {
struct ethertype ether;
struct llctype llc;
} mac_llc;
};
typedef struct llc_machdr machdr_t;
#define LLC_SAP_LEN 1 /* length of sap only field */
#define LLC_LSAP_LEN 2 /* length of sap/type field */
#define LLC_TYPE_LEN 2 /* ethernet type field length */
#define LLC_ADDR_LEN 6 /* length of 802.3/ethernet address */
#define LLC_LSAP_HDR_SIZE 3
#define LLC_SNAP_SIZE 5
#define LLC_HDR_SIZE ((2*LLC_ADDR_LEN)+LLC_LSAP_HDR_SIZE+LLC_LSAP_LEN)
#define LLC_EHDR_SIZE ((2*LLC_ADDR_LEN)+LLC_TYPE_LEN)
#define LLC_LIADDR_LEN (LLC_ADDR_LEN+LLC_SAP_LEN)
#define LLC_ENADDR_LEN (LLC_ADDR_LEN+LLC_TYPE_LEN)
union llc_bind_fmt {
struct llca {
unsigned char lbf_addr[LLC_ADDR_LEN];
unsigned short lbf_sap;
} llca;
struct llcb {
unsigned char lbf_addr[LLC_ADDR_LEN];
unsigned short lbf_sap;
unsigned long lbf_xsap;
unsigned long lbf_type;
} llcb;
struct llcc {
unsigned char lbf_addr[LLC_ADDR_LEN];
unsigned char lbf_sap;
} llcc;
};
#define LLC_LENGTH(m) ntohs(((struct llc_machdr *)m)->mac_llc.llc.llc_length)
#define LLC_DSAP(m) (((struct llc_machdr *)m)->mac_llc.llc.llc_dsap)
#define LLC_SSAP(m) (((struct llc_machdr *)m)->mac_llc.llc.llc_ssap)
#define LLC_CONTROL(m) (((struct llc_machdr *)m)->mac_llc.llc.llc_control)
#define LLC_SNAP(m) (((struct llc_machdr *)m)->mac_llc.llc.llc_org)
#define ETHER_TYPE(m) ntohs(((struct llc_machdr *)m)->mac_llc.ether.ether_type)
#define LLCMAXSAPVALUE 0xFF /* largest LSAP value */
#define LLCSLIPSAPVALUE 0x888 /* SAP for SLIP */
/* other useful macros */
#define HIGH(x) ((x>>8)&0xFF)
#define LOW(x) (x&0xFF)
/*
* The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
* (type-ETHERTYPE_TRAIL)*512 bytes of data followed
* by an ETHER type (as given above) and then the (variable-length) header.
*/
#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */
#define ETHERTYPE_NTRAILER 16
/*
* board dependent parameters
*/
struct llcparam {
short llcp_index; /* board index */
short llcp_int; /* interrupt level */
short llcp_port; /* I/O port address */
short llcp_portsize; /* port address range */
long llcp_base; /* address of board's memory */
long llcp_memsize; /* size of on-board memory */
caddr_t llcp_memp; /* pointer to mapped version */
int llcp_running; /* initialization status */
int llcp_state; /* board state */
short llcp_major; /* major device number */
short llcp_minors; /* number of minor devices allocated */
short llcp_maxpkt; /* maximum packet size */
short llcp_maxpktllc; /* maximum packet size - LLC1 */
long llcp_nextq; /* next queue to be scheduled */
long llcp_ncount; /* count of bufcalls */
long llcp_proms; /* number of promiscuous streams */
long llcp_devmode; /* promiscuous mode */
short llcp_firstd; /* first minor device for this major */
unchar llcp_macaddr[LLC_ADDR_LEN];
};
/*
* statistics on drivers and boards; this structure is pointed to
* by the llcdev structure and must be defined at the front of the
* driver statistics structures.
*/
struct llcstats {
ulong llcs_nstats; /* number of stat fields */
/* non-hardware */
ulong llcs_nobuffer; /* 0 */
ulong llcs_blocked; /* 1 */
ulong llcs_blocked2; /* 2 */
ulong llcs_multicast; /* 3 */
/* rest are hardware dependent; see individual drivers */
};