File: /usr/src/linux/include/net/llc.h

1     #include <linux/skbuff.h>
2     
3     #define LLC_MODULE
4     
5     typedef struct llc_struct llc;
6     typedef struct llc_struct *llcptr;
7     
8     /*
9      *	LLC private data area structure.
10      */
11     
12     struct llc_struct
13     { 
14     	char eye[4];			/* To recognize llc area in dump */
15     	int retry_count;		/* LLC link state variables */
16     	unsigned char name[9];		/* name of this llc instance */
17     	unsigned char s_flag;
18     	unsigned char p_flag;
19     	unsigned char f_flag;
20     	unsigned char data_flag;
21     	unsigned char cause_flag;
22     	unsigned char vs;		/* Send state variable */
23     	unsigned char vr;		/* Receive state variable */
24     	unsigned char remote_busy;
25     	unsigned char state;		/* Current state of type2 llc procedure */
26     	int n1;				/* Maximum number of bytes in I pdu 7.8.2 */
27     	int n2;				/* Naximum number of retransmissions 7.8.2 */
28     	unsigned char k;		/* Transmit window size 7.8.4, tw in IBM doc*/ 
29     	unsigned char rw;		/* Receive window size */
30     	struct 
31     	{     				
32     		/*
33     		 *	FRMR_RSP info field structure: 5.4.2.3.5 p55
34     		 */
35     
36     		unsigned char cntl1;
37     		unsigned char cntl2;
38     		unsigned char vs;
39     		unsigned char vr_cr;
40     		unsigned char xxyz;
41     	} frmr_info_fld;
42     
43     	/*
44     	 *	Timers in 7.8.1 page 78 
45     	 */
46     
47     #define P_TIMER         0
48     #define REJ_TIMER       1
49     #define ACK_TIMER       2 
50     #define BUSY_TIMER      3
51     	unsigned long timer_expire_time[4];	
52     	unsigned char timer_state[4];	/* The state of each timer */
53     #define TIMER_IDLE      0
54     #define TIMER_RUNNING   1
55     #define TIMER_EXPIRED   2
56     	unsigned long timer_interval[4]; 
57     	struct timer_list tl[4];
58     
59     	/* 
60     	 *	Client entry point, called by the LLC.
61     	 */
62     	 
63     	void	(*llc_event)(struct llc_struct *);
64     	
65     	/*
66     	 *	Mux and Demux variables
67     	 */
68     	 
69     	char * client_data;		/* Pointer to clients context */
70     	unsigned char local_sap;
71     	unsigned char remote_sap ;
72     	char remote_mac[MAX_ADDR_LEN];  /* MAC address of remote session partner */ 
73     	struct net_device *dev;		/* Device we are attached to */
74     		     
75     	unsigned char llc_mode;		/* See doc 7.1 on p70 */
76     #define MODE_ADM 1
77     #define MODE_ABM 2
78     
79     	int llc_callbacks;		/* Pending callbacks */
80     #define LLC_CONN_INDICATION	1	/* We have to ensure the names don't */
81     #define LLC_CONN_CONFIRM	2	/* mix up with the 802 state table */
82     #define LLC_DATA_INDIC		4
83     #define LLC_DISC_INDICATION	8
84     #define LLC_RESET_INDIC_LOC	16
85     #define LLC_RESET_INDIC_REM	32
86     #define LLC_RST_CONFIRM		64
87     #define LLC_FRMR_RECV		128
88     #define LLC_FRMR_SENT		256
89     #define LLC_REMOTE_BUSY		512
90     #define LLC_REMOTE_NOTBUSY	1024
91     #define LLC_TEST_INDICATION	2048
92     #define LLC_XID_INDICATION	4096
93     #define LLC_UI_DATA		8192
94     
95     	struct sk_buff *inc_skb;	/* Saved data buffer for indications */
96     	
97     	struct sk_buff_head rtq;	/* Retransmit queue */
98     	struct sk_buff_head atq;	/* Await transit queue */
99           
100     	unsigned char xid_count;
101     
102     	struct llc_struct *nextllc;	/* ptr to next llc struct in proto chain */
103     };
104     
105     #define ADD_TO_RTQ(skb) skb_queue_tail(&lp->rtq,skb)
106     #define ADD_TO_ATQ(skb) skb_queue_tail(&lp->atq,skb)
107     
108     void 		llc_cancel_timers(llcptr lp);
109     int		llc_decode_frametype(frameptr fr);
110     llcptr 		llc_find(void);
111     int		llc_free_acknowledged_skbs(llcptr lp, unsigned char ack);
112     void		llc_handle_xid_indication( char *chsp, short int ll, char *xid_data);
113     void		llc_interpret_pseudo_code(llcptr lp, int pc_label, struct sk_buff *skb, char type);
114     void		llc_add_to_queue(struct sk_buff *skb, struct sk_buff **f, struct sk_buff **b);
115     void		llc_process_otype2_frame(llcptr lp, struct sk_buff *skb, char type);
116     struct sk_buff *llc_pull_from_atq(llcptr lp); 
117     int 		llc_resend_ipdu(llcptr lp, unsigned char ack_nr, unsigned char type, char p);
118     void 		llc_sendpdu(llcptr lp, char type, char pf, int data_len, char *pdu_data);
119     void 		llc_sendipdu(llcptr lp, char type, char pf, struct sk_buff *skb);
120     void		llc_start_timer(llcptr lp, int t);
121     void		llc_stop_timer(llcptr lp, int t);
122     void		llc_timer_expired(llcptr lp, int t);
123     int		llc_validate_seq_nos(llcptr lp, frameptr fr);
124     
125     int		llc_data_request(llcptr lp, struct sk_buff *skb);
126     void		llc_unit_data_request(llcptr lp, int ll, char * data);
127     void		llc_disconnect_request(llcptr lp);
128     void		llc_connect_request(llcptr lp);
129     void		llc_xid_request(llcptr lp, char opt, int data_len, char *pdu_data);
130     void		llc_test_request(llcptr lp, int data_len, char *pdu_data);
131     
132     int		register_cl2llc_client(llcptr llc, const char *device, void (*ops)(llcptr), u8 *rmac, u8 ssap, u8 dsap);
133     void		unregister_cl2llc_client(llcptr lp);
134     int 		llc_mac_data_indicate(llcptr lp, struct sk_buff *skb );
135     
136