📄 llc_var.h
字号:
/* * Copyright (C) Dirk Husemann, Computer Science Department IV, * University of Erlangen-Nuremberg, Germany, 1990, 1991, 1992 * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Dirk Husemann and the Computer Science Department (IV) of * the University of Erlangen-Nuremberg, Germany. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)llc_var.h 8.1 (Berkeley) 6/10/93 */#ifdef __STDC__/* * Forward structure declarations for function prototypes [sic]. */struct llc;#endif#define NPAIDB_LINK 0struct npaidbentry { union { /* MAC,DLSAP -> CONS */ struct { struct llc_linkcb *NE_link; struct rtentry *NE_rt; } NE; /* SAP info for unconfigured incoming calls */ struct { u_short SI_class;#define LLC_CLASS_I 0x1#define LLC_CLASS_II 0x3#define LLC_CLASS_III 0x4 /* Future */#define LLC_CLASS_IV 0x7 /* Future */ u_short SI_window; u_short SI_trace; u_short SI_xchxid; void (*SI_input) __P((struct mbuf *)); caddr_t (*SI_ctlinput) __P((int, struct sockaddr *, caddr_t)); } SI; } NESIun;};#define np_link NESIun.NE.NE_link#define np_rt NESIun.NE.NE_rt#define si_class NESIun.SI.SI_class#define si_window NESIun.SI.SI_window#define si_trace NESIun.SI.SI_trace#define si_xchxid NESIun.SI.SI_xchxid#define si_input NESIun.SI.SI_input#define si_ctlinput NESIun.SI.SI_ctlinput#define NPDL_SAPNETMASK 0x7e/* * Definitions for accessing bitfields/bitslices inside * LLC2 headers */struct bitslice { unsigned int bs_mask; unsigned int bs_shift;};#define i_z 0#define i_ns 1#define i_pf 0#define i_nr 1#define s_oz 2#define s_selector 3#define s_pf 0#define s_nr 1#define u_bb 2#define u_select_other 3#define u_pf 4#define u_select 5#define f_vs 1#define f_cr 0#define f_vr 1#define f_wxyzv 6#define LLCGBITS(Arg, Index) (((Arg) & llc_bitslice[(Index)].bs_mask) >> llc_bitslice[(Index)].bs_shift)#define LLCSBITS(Arg, Index, Val) (Arg) |= (((Val) << llc_bitslice[(Index)].bs_shift) & llc_bitslice[(Index)].bs_mask)#define LLCCSBITS(Arg, Index, Val) (Arg) = (((Val) << llc_bitslice[(Index)].bs_shift) & llc_bitslice[(Index)].bs_mask)extern struct bitslice llc_bitslice[];#define LLC_CMD 0#define LLC_RSP 1#define LLC_MAXCMDRSP 2/* * LLC events --- These events may either be frames received from the * remote LLC DSAP, request from the network layer user, * timer events from llc_timer(), or diagnostic events from * llc_input(). *//* LLC frame types */#define LLCFT_INFO 0 * LLC_MAXCMDRSP#define LLCFT_RR 1 * LLC_MAXCMDRSP#define LLCFT_RNR 2 * LLC_MAXCMDRSP#define LLCFT_REJ 3 * LLC_MAXCMDRSP#define LLCFT_DM 4 * LLC_MAXCMDRSP#define LLCFT_SABME 5 * LLC_MAXCMDRSP#define LLCFT_DISC 6 * LLC_MAXCMDRSP#define LLCFT_UA 7 * LLC_MAXCMDRSP#define LLCFT_FRMR 8 * LLC_MAXCMDRSP#define LLCFT_UI 9 * LLC_MAXCMDRSP#define LLCFT_XID 10 * LLC_MAXCMDRSP#define LLCFT_TEST 11 * LLC_MAXCMDRSP/* LLC2 timer events */#define LLC_ACK_TIMER_EXPIRED 12 * LLC_MAXCMDRSP#define LLC_P_TIMER_EXPIRED 13 * LLC_MAXCMDRSP#define LLC_REJ_TIMER_EXPIRED 14 * LLC_MAXCMDRSP#define LLC_BUSY_TIMER_EXPIRED 15 * LLC_MAXCMDRSP/* LLC2 diagnostic events */#define LLC_INVALID_NR 16 * LLC_MAXCMDRSP#define LLC_INVALID_NS 17 * LLC_MAXCMDRSP#define LLC_BAD_PDU 18 * LLC_MAXCMDRSP#define LLC_LOCAL_BUSY_DETECTED 19 * LLC_MAXCMDRSP#define LLC_LOCAL_BUSY_CLEARED 20 * LLC_MAXCMDRSP/* Network layer user requests *//* * NL_CONNECT_REQUEST --- The user has requested that a data link connection * be established with a remote LLC DSAP. */#define NL_CONNECT_REQUEST 21 * LLC_MAXCMDRSP/* * NL_CONNECT_RESPONSE --- The user has accepted the data link connection. */#define NL_CONNECT_RESPONSE 22 * LLC_MAXCMDRSP/* * NL_RESET_REQUEST --- The user has requested that the data link with the * remote LLC DSAP be reset. */#define NL_RESET_REQUEST 23 * LLC_MAXCMDRSP/* * NL_RESET_RESPONSE --- The user has accepted the reset of the data link * connection. */#define NL_RESET_RESPONSE 24 * LLC_MAXCMDRSP/* * NL_DISCONNECT_REQUEST --- The user has requested that the data link * connection with remote LLC DSAP be terminated. */#define NL_DISCONNECT_REQUEST 25 * LLC_MAXCMDRSP/* * NL_DATA_REQUEST --- The user has requested that a data unit be sent ot the * remote LLC DSAP. */#define NL_DATA_REQUEST 26 * LLC_MAXCMDRSP/* * NL_INITIATE_PF_CYCLE --- The local LLC wants to initiate a P/F cycle. */#define NL_INITIATE_PF_CYCLE 27 * LLC_MAXCMDRSP/* * NL_LOCAL_BUSY_DETECTED --- The local entity has encountered a busy condition */#define NL_LOCAL_BUSY_DETECTED 28 * LLC_MAXCMDRSP#define LLCFT_NONE 255/* return message from state handlers *//* * LLC_CONNECT_INDICATION --- Inform the user that a connection has been * requested by a remote LLC SSAP. */#define LLC_CONNECT_INDICATION 1/* * LLC_CONNECT_CONFIRM --- The connection service component indicates that the * remote network entity has accepted the connection. */#define LLC_CONNECT_CONFIRM 2/* * LLC_DISCONNECT_INDICATION --- Inform the user that the remote network * entity has intiated disconnection of the data * link connection. */#define LLC_DISCONNECT_INDICATION 3/* * LLC_RESET_CONFIRM --- The connection service component indicates that the * remote network entity has accepted the reset. */#define LLC_RESET_CONFIRM 4/* * LLC_RESET_INDICATION_REMOTE --- The remote network entity or remote peer * has initiated a reset of the data link * connection. */#define LLC_RESET_INDICATION_REMOTE 5/* * LLC_RESET_INDICATION_LOCAL --- The local LLC has determined that the data * link connection is in need of * reinitialization. */#define LLC_RESET_INDICATION_LOCAL 6/* * LLC_FRMR_RECEIVED --- The local connection service component has received a * FRMR response PDU. */#define LLC_FRMR_RECEIVED 7/* * LLC_FRMR_SENT --- The local connection component has received an ivalid * PDU, and has sent a FRMR response PDU. */#define LLC_FRMR_SENT 8/* * LLC_DATA_INDICATION --- The connection service component passes the data * unit from the received I PDU to the user. */#define LLC_DATA_INDICATION 9/* * LLC_REMOTE_NOT_BUSY --- The remote LLC DSAP is no longer busy. The local * connection service component will now accept a * DATA_REQUEST. */#define LLC_REMOTE_NOT_BUSY 10/* * LLC_REMOTE_BUSY --- The remote LLC DSAP is busy. The local connection * service component will not accept a DATA_REQUEST. */#define LLC_REMOTE_BUSY 11/* Internal return code */#define LLC_PASSITON 255#define INFORMATION_CONTROL 0x00#define SUPERVISORY_CONTROL 0x02#define UNUMBERED_CONTROL 0x03 /* * Other necessary definitions */ #define LLC_MAX_SEQUENCE 128#define LLC_MAX_WINDOW 127#define LLC_WINDOW_SIZE 7/* * Don't we love this one? CCITT likes to suck on bits 8=) */#define NLHDRSIZEGUESS 3/* * LLC control block */struct llc_linkcb { struct llccb_q { struct llccb_q *q_forw; /* admin chain */ struct llccb_q *q_backw; } llcl_q; struct npaidbentry *llcl_sapinfo; /* SAP information */ struct sockaddr_dl llcl_addr; /* link snpa address */ struct rtentry *llcl_nlrt; /* layer 3 -> LLC */ struct rtentry *llcl_llrt; /* LLC -> layer 3 */ struct ifnet *llcl_if; /* our interface */ caddr_t llcl_nlnext; /* cb for network layer */ struct mbuf *llcl_writeqh; /* Write queue head */ struct mbuf *llcl_writeqt; /* Write queue tail */ struct mbuf **llcl_output_buffers; short llcl_timers[6]; /* timer array */ long llcl_timerflags; /* flags signalling running timers */ int (*llcl_statehandler) __P((struct llc_linkcb *, struct llc *, int, int, int)); int llcl_P_flag; int llcl_F_flag; int llcl_S_flag; int llcl_DATA_flag; int llcl_REMOTE_BUSY_flag; int llcl_DACTION_flag; /* delayed action */ int llcl_retry; /* * The following components deal --- in one way or the other --- * with the LLC2 window. Indicated by either [L] or [W] is the * domain of the specific component: * * [L] The domain is 0--LLC_MAX_WINDOW * [W] The domain is 0--llcl_window */ short llcl_vr; /* next to receive [L] */ short llcl_vs; /* next to send [L] */ short llcl_nr_received; /* next frame to b ack'd [L] */ short llcl_freeslot; /* next free slot [W] */ short llcl_projvs; /* V(S) associated with freeslot */ short llcl_slotsfree; /* free slots [W] */ short llcl_window; /* window size */ /* * In llcl_frmrinfo we jot down the last frmr info field, which we * need to do as we need to be able to resend it in the ERROR state. */ struct frmrinfo llcl_frmrinfo; /* last FRMR info field */};#define llcl_frmr_pdu0 llcl_frmrinfo.rej_pdu_0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -