http://gimel.esc.cam.ac.uk/james/rpld/src/rpld-1.7.tar.gz
[rpld.git] / kernel / linux.2.2.llc.patch
1
2 # /*************************************************
3 # *     rpld - an IBM style RIPL server            *
4 # *************************************************/
5
6 # /* Copyright (c) 1999,2000, James McKenzie.
7 #  *                      All rights reserved
8 #  * Copyright (c) 1998,2000, Christopher Lightfoot.
9 #  *                      All rights reserved
10 #  *
11 #  * By using this file, you agree to the terms and conditions set
12 #  * forth in the LICENCE file which can be found at the top level of
13 #  * the rpld distribution.
14 #  *
15 #  * IBM is a trademark of IBM corp.
16 #  *
17 #  */
18 #                           NO WARRANTY
19
20 # BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
21 # FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
22 # OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
23 # PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
24 # OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
26 # TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
27 # PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
28 # REPAIR OR CORRECTION.
29 #
30 # this patch is hacked together from an old release of the linux-sna
31 # patches and some extensive bugfixes by me.
32 #
33
34 diff -uNr linux/Documentation/networking/llc.txt linux-llc/Documentation/networking/llc.txt
35 --- linux/Documentation/networking/llc.txt      Thu Jan  1 01:00:00 1970
36 +++ linux-llc/Documentation/networking/llc.txt  Mon Sep 25 06:47:02 2000
37 @@ -0,0 +1,80 @@
38 +llc.txt: Documentation for the Linux IEEE 802.2 and Linux LLC UI layers.
39 +         Written by: Jay Schulist <jschlst@turbolinux.com>
40 +
41 +LLC User Interface Notes:
42 +
43 +LLC Class 1 socket types:
44 +       - SOCK_DGRAM
45 +LLC Class 2 socket types:
46 +       - SOCK_STREAM
47 +
48 +Besides normal data transfer, the user can send a test request 
49 +from either socket type. just set the sllc_test to 1 in the sockaddr_llc
50 +structure.
51 +
52 +struct sockaddr_llc {
53 +       sa_family_t     sllc_family;
54 +
55 +       unsigned char   sllc_dmac[14];
56 +       unsigned char   sllc_dsap;
57 +       unsigned char   sllc_smac[14];
58 +       unsigned char   sllc_ssap;
59 +       unsigned char   sllc_test;
60 +};
61 +
62 +
63 +IEEE 802.2 Layer Notes:
64 +Initialization/LLC load:
65 +1). LLC scans for LLC interfaces in the IFF_UP state. For each interface
66 +    found a independent Station Component (SC) is created. *
67 +2). We register a device notifier to alert us of devices going up and/or
68 +    down. We then either add or delete a SC for the appropriate device. *
69 +
70 +* Required for protocol compliance.
71 +
72 +Operation:
73 +
74 +LLC commands are executed by the llc_queue_cmd() call unless otherwise
75 +noted. The following commands are available depending on the llc class type.
76 +([] = only available by this command)
77 +
78 +Class One:
79 +- LLC_STATE_SAP_ACTIVATION_REQUEST     [register_8022_client()]
80 +- LLC_STATE_SAP_DEACTIVATION_REQUEST   [unregister_8022_client()]
81 +
82 +- LLC_STATE_XID_REQUEST
83 +
84 +- LLC_STATE_TEST_REQUEST               [dl->datalink_header()]
85 +                                       [dev_queue_xmit() or llc_queue_xmit()]
86 +- LLC_STATE_UNITDATA_REQUEST           [dl->datalink_header()]
87 +                                       [dev_queue_xmit() or llc_queue_xmit()]
88 +
89 +Class Two:
90 +- LLC_STATE_CONNECT_REQUEST            [llc_connect()]
91 +- LLC_STATE_CONNECT_RESPONSE           [llc_connect()]
92 +- LLC_STATE_DISCONNECT_REQUEST         [llc_disconnect()]
93 +- LLC_STATE_DISCONNECT_RESPONSE                [llc_disconnect()]
94 +- LLC_STATE_RESET_REQUEST              [llc_reset()]
95 +- LLC_STATE_RESET_RESPONSE             [llc_reset()]
96 +
97 +- LLC_STATE_DATA_REQUEST               [dl->datalink_header()]
98 +                                       [llc_queue_xmit()]
99 +
100 +Check linux/net/llc/af_llc.c for a great reference on how to connect your
101 +networking layer into the llc layer, it is great fun and worth a try.
102 +
103 +
104 +- Transmit and Receive Processor paths
105 +
106 +Receive:
107 +- llc_rcv
108 +  - llc_find_client
109 +  - llc_decode_pdu
110 +  - llc_demux_pdu
111 +    - llc_process_pdu_type2
112 +
113 +Transmit
114 +- llc_datalink_header
115 +  - llc_demux_cmd
116 +    - llc_process_cmd_type2
117 +      - llc_build_pdu
118 diff -uNr linux/MAINTAINERS linux-llc/MAINTAINERS
119 --- linux/MAINTAINERS   Fri Jun 23 10:57:58 2000
120 +++ linux-llc/MAINTAINERS       Mon Sep 25 06:47:02 2000
121 @@ -533,6 +533,13 @@
122  W:    http://linux.msede.com/lvm
123  S:    Maintained
124  
125 +LLC NETWORK LAYER
126 +P:     Jay Schulist
127 +M:     jschlst@turbolinux.com
128 +W:     http://www.linux-sna.org
129 +L:     linux-sna@tubrolinux.com
130 +S:     Maintained
131 +
132  MAESTRO PCI SOUND DRIVER
133  P:     Zach Brown
134  M:     zab@redhat.com
135 diff -uNr linux/include/linux/llc.h linux-llc/include/linux/llc.h
136 --- linux/include/linux/llc.h   Thu Jan  1 01:00:00 1970
137 +++ linux-llc/include/linux/llc.h       Mon Sep 25 06:47:02 2000
138 @@ -0,0 +1,109 @@
139 +/*
140 + * IEEE 802.2 for Linux, data structures and indicators.
141 + *
142 + * This program is free software; you can redistribute it and/or
143 + * modify it under the terms of the GNU General Public License
144 + * as published by the Free Software Foundation; either version
145 + * 2 of the License, or (at your option) any later version.
146 + *
147 + * None of the authors or maintainers or their employers admit
148 + * liability nor provide warranty for any of this software.
149 + * This material is provided "as is" and at no charge.
150 + */
151 +
152 +#ifndef __LINUX_LLC_H
153 +#define __LINUX_LLC_H
154 +
155 +#ifdef __KERNEL__
156 +
157 +struct llc_msg_head
158 +{
159 +       struct llc_msg *next;
160 +       struct llc_msg *prev;
161 +       unsigned long qlen;
162 +};
163 +
164 +struct llc_msg
165 +{
166 +       struct llc_msg *next;
167 +       struct llc_msg *prev;
168 +
169 +       struct llc_msg_head *list;
170 +       struct llc_pinfo *llc;
171 +
172 +       unsigned char cmd;
173 +       unsigned char rsp;
174 +
175 +       struct sk_buff *skb;
176 +};
177 +#endif
178 +
179 +struct sockaddr_llc {
180 +        sa_family_t     sllc_family;
181 +        unsigned char   sllc_dmac[14];
182 +        unsigned char   sllc_dsap;
183 +        unsigned char   sllc_smac[14];
184 +        unsigned char   sllc_ssap;
185 +       unsigned char   sllc_test;
186 +};
187 +
188 +#define LLC_IOCTL_RETRY                        0x01    /* Max retrans attempts. */
189 +#define LLC_IOCTL_SIZE                 0x02    /* Max PDU size. */
190 +#define LLC_IOCTL_WINDOW               0x03    /* Max PDU window size. */
191 +#define LLC_IOCTL_ACK_TIMER_EXPIRE     0x04
192 +#define LLC_IOCTL_P_TIMER_EXPIRE       0x05
193 +#define LLC_IOCTL_REJ_TIMER_EXPIRE     0x06
194 +#define LLC_IOCTL_BUSY_TIMER_EXPIRE    0x07
195 +#define LLC_IOCTL_SSAP                 0x08
196 +#define LLC_IOCTL_CLASS                        0x09
197 +
198 +#define LLC_MAX_RETRY                  100
199 +#define        LLC_MAX_SIZE                    sizeof(int)
200 +#define LLC_MAX_WINDOW                 50
201 +#define LLC_MAX_ACK_TIMER_EXPIRE       60 * HZ
202 +#define LLC_MAX_P_TIMER_EXPIRE         60 * HZ
203 +#define LLC_MAX_REJ_TIMER_EXPIRE       60 * HZ
204 +#define LLC_MAX_BUSY_TIMER_EXPIRE      60 * HZ
205 +
206 +struct llc_data
207 +{
208 +       unsigned char   ssap;
209 +};
210 +
211 +/* LLC socket operations. */
212 +#define LLC_REG_SAP_CLIENT     0xAA            /* Reg. LLC UI client w/ LLC */
213 +#define LLC_SET_SAP_CLASS      0xBB            /* Set class (LLC1 or LLC2) */
214 +#define LLC_QUE_MSG            0xCC            /* UI SAP Event Indication. */
215 +
216 +/* LLC types. */
217 +#define LLC_SAP_CLASS_1                0x01
218 +#define LLC_SAP_CLASS_2         0x02
219 +
220 +/* Linux LLC header sizes. */
221 +#define LLC_TYPE1_SIZE          3       /* 3 bytes. */
222 +#define LLC_TYPE2_SIZE          4       /* 4 bytes. */
223 +
224 +/* LLC SAP types. */
225 +#define LLC_SAP_NULL   0x00            /* NULL SAP.                    */
226 +#define LLC_SAP_LLC    0x02            /* LLC Sublayer Managment.      */
227 +#define LLC_SAP_SNA    0x04            /* SNA Path Control.            */
228 +#define LLC_SAP_PNM    0x0E            /* Proway Network Managment.    */      
229 +#define LLC_SAP_IP     0x06            /* TCP/IP.                      */
230 +#define LLC_SAP_BSPAN  0x42            /* Bridge Spanning Tree Proto   */
231 +#define LLC_SAP_MMS    0x4E            /* Manufacturing Message Srv.   */
232 +#define LLC_SAP_8208   0x7E            /* ISO 8208                     */
233 +#define LLC_SAP_3COM   0x80            /* 3COM.                        */
234 +#define LLC_SAP_PRO    0x8E            /* Proway Active Station List   */
235 +#define LLC_SAP_SNAP   0xAA            /* SNAP.                        */
236 +#define LLC_SAP_BANYAN 0xBC            /* Banyan.                      */
237 +#define LLC_SAP_IPX    0xE0            /* IPX/SPX.                     */
238 +#define LLC_SAP_NETBIOS        0xF0            /* NetBIOS.                     */
239 +#define LLC_SAP_LANMGR 0xF4            /* LanManager.                  */
240 +#define LLC_SAP_IMPL   0xF8            /* IMPL                         */
241 +#define LLC_SAP_DISC   0xFC            /* Discovery                    */
242 +#define LLC_SAP_OSI    0xFE            /* OSI Network Layers.          */
243 +#define LLC_SAP_LAR    0xDC            /* LAN Address Resolution       */
244 +#define LLC_SAP_RM     0xD4            /* Resource Management          */
245 +#define LLC_SAP_GLOBAL 0xFF            /* Global SAP.                  */
246 +
247 +#endif /* __LINUX_LLC_H */
248 diff -uNr linux/include/linux/skbuff.h linux-llc/include/linux/skbuff.h
249 --- linux/include/linux/skbuff.h        Fri Jun 23 11:12:47 2000
250 +++ linux-llc/include/linux/skbuff.h    Mon Sep 25 07:16:54 2000
251 @@ -36,6 +36,7 @@
252                                            for using debugging */
253  };
254  
255 +
256  struct sk_buff {
257         struct sk_buff  * next;                 /* Next buffer in list                          */
258         struct sk_buff  * prev;                 /* Previous buffer in list                      */
259 @@ -66,7 +67,14 @@
260                 unsigned char   *raw;
261         } nh;
262    
263 -       /* Link layer header */
264 +       /* Link layer header, ie. 802.2 */
265 +        union
266 +        {
267 +                struct llchdr   *llc;
268 +                unsigned char   *raw;
269 +        } link;
270 +
271 +       /* Mac/Hardware header. */
272         union 
273         {       
274                 struct ethhdr   *ethernet;
275 @@ -76,6 +84,10 @@
276         struct  dst_entry *dst;
277  
278         char            cb[48];  
279 +
280 +       /* LLC layer. */
281 +       unsigned int llc_cmd;
282 +       struct packet_type *pt;
283  
284         unsigned int    len;                    /* Length of actual data                        */
285         unsigned int    csum;                   /* Checksum                                     */
286 diff -uNr linux/include/linux/socket.h linux-llc/include/linux/socket.h
287 --- linux/include/linux/socket.h        Fri Jun 23 11:12:46 2000
288 +++ linux-llc/include/linux/socket.h    Mon Sep 25 06:47:02 2000
289 @@ -155,6 +155,7 @@
290  #define AF_ATMSVC      20      /* ATM SVCs                     */
291  #define AF_SNA         22      /* Linux SNA Project (nutters!) */
292  #define AF_IRDA                23      /* IRDA sockets                 */
293 +#define AF_LLC          30      /* LLC Class One and Two.       */
294  #define AF_MAX         32      /* For now.. */
295  
296  /* Protocol families, same as address families. */
297 @@ -183,6 +184,7 @@
298  #define PF_ATMSVC      AF_ATMSVC
299  #define PF_SNA         AF_SNA
300  #define PF_IRDA                AF_IRDA
301 +#define PF_LLC         AF_LLC
302  
303  #define PF_MAX         AF_MAX
304  
305 @@ -235,6 +237,7 @@
306  #define SOL_ATM                264     /* ATM layer (cell level) */
307  #define SOL_AAL                265     /* ATM Adaption Layer (packet level) */
308  #define SOL_IRDA        266
309 +#define SOL_LLC                277     /* LLC User Interface SAPs */
310  
311  /* IPX options */
312  #define IPX_TYPE       1
313 diff -uNr linux/include/linux/sysctl.h linux-llc/include/linux/sysctl.h
314 --- linux/include/linux/sysctl.h        Wed Jun  7 22:26:44 2000
315 +++ linux-llc/include/linux/sysctl.h    Mon Sep 25 06:50:30 2000
316 @@ -143,7 +143,8 @@
317         NET_X25=13,
318         NET_TR=14,
319         NET_DECNET=15,
320 -       NET_ECONET=16
321 +       NET_ECONET=16,
322 +       NET_LLC=17
323  };
324  
325  /* /proc/sys/bus/isa */
326 @@ -171,7 +172,17 @@
327  
328  /* /proc/sys/net/ethernet */
329  
330 -/* /proc/sys/net/802 */
331 +/* /proc/sys/net/llc */
332 +enum {
333 +        NET_LLC_MAX_RETRY=1,
334 +        NET_LLC_MAX_SIZE=2,
335 +        NET_LLC_MAX_WINDOW=3,
336 +        NET_LLC_ACK_TIMER_EXPIRE=4,
337 +        NET_LLC_P_TIMER_EXPIRE=5,
338 +        NET_LLC_REJ_TIMER_EXPIRE=6,
339 +        NET_LLC_BUSY_TIMER_EXPIRE=7,
340 +       NET_LLC_DEBUG=8
341 +};
342  
343  /* /proc/sys/net/unix */
344  
345 diff -uNr linux/include/net/datalink.h linux-llc/include/net/datalink.h
346 --- linux/include/net/datalink.h        Tue Oct 24 13:26:07 1995
347 +++ linux-llc/include/net/datalink.h    Mon Sep 25 07:21:02 2000
348 @@ -2,15 +2,24 @@
349  #define _NET_INET_DATALINK_H_
350  
351  struct datalink_proto {
352 -       unsigned short  type_len;
353 -       unsigned char   type[8];
354 -       const char      *string_name;
355 -       unsigned short  header_length;
356 -       int     (*rcvfunc)(struct sk_buff *, struct device *, 
357 -                               struct packet_type *);
358 -       void    (*datalink_header)(struct datalink_proto *, struct sk_buff *,
359 -                                       unsigned char *);
360 -       struct datalink_proto   *next;
361 +        unsigned short  type_len;
362 +        unsigned char   type[8];
363 +        const char      *string_name;
364 +
365 +        union {
366 +                struct llc_pinfo *llc;
367 +        } ll_pinfo;
368 +
369 +       struct llc_sc_info *llc_sc;
370 +       struct sock *sock;
371 +
372 +        unsigned short  header_length;
373 +
374 +        int     (*rcvfunc)(struct sk_buff *, struct device *,
375 +                                struct packet_type *);
376 +        void    (*datalink_header)(struct datalink_proto *, struct sk_buff *,
377 +                                        unsigned char *);
378 +        struct datalink_proto   *next;
379  };
380  
381  #endif
382 diff -uNr linux/include/net/llc.h linux-llc/include/net/llc.h
383 --- linux/include/net/llc.h     Wed Dec 10 17:45:16 1997
384 +++ linux-llc/include/net/llc.h Mon Sep 25 07:25:33 2000
385 @@ -1,135 +1,1538 @@
386  #include <linux/skbuff.h>
387  
388 -#define LLC_MODULE
389 -
390 -typedef struct llc_struct llc;
391 -typedef struct llc_struct *llcptr;
392 -
393  /*
394 - *     LLC private data area structure.
395 + * IEEE 802.2 for Linux, data structures and indicators.
396   */
397  
398 -struct llc_struct
399 -{ 
400 -       char eye[4];                    /* To recognize llc area in dump */
401 -       int retry_count;                /* LLC link state variables */
402 -       unsigned char name[9];          /* name of this llc instance */
403 -       unsigned char s_flag;
404 -       unsigned char p_flag;
405 -       unsigned char f_flag;
406 -       unsigned char data_flag;
407 -       unsigned char cause_flag;
408 -       unsigned char vs;               /* Send state variable */
409 -       unsigned char vr;               /* Receive state variable */
410 -       unsigned char remote_busy;
411 -       unsigned char state;            /* Current state of type2 llc procedure */
412 -       int n1;                         /* Maximum number of bytes in I pdu 7.8.2 */
413 -       int n2;                         /* Naximum number of retransmissions 7.8.2 */
414 -       unsigned char k;                /* Transmit window size 7.8.4, tw in IBM doc*/ 
415 -       unsigned char rw;               /* Receive window size */
416 -       struct 
417 -       {                               
418 -               /*
419 -                *      FRMR_RSP info field structure: 5.4.2.3.5 p55
420 -                */
421 -
422 -               unsigned char cntl1;
423 -               unsigned char cntl2;
424 -               unsigned char vs;
425 -               unsigned char vr_cr;
426 -               unsigned char xxyz;
427 -       } frmr_info_fld;
428 -
429 -       /*
430 -        *      Timers in 7.8.1 page 78 
431 -        */
432 -
433 -#define P_TIMER         0
434 -#define REJ_TIMER       1
435 -#define ACK_TIMER       2 
436 -#define BUSY_TIMER      3
437 -       unsigned long timer_expire_time[4];     
438 -       unsigned char timer_state[4];   /* The state of each timer */
439 -#define TIMER_IDLE      0
440 -#define TIMER_RUNNING   1
441 -#define TIMER_EXPIRED   2
442 -       unsigned long timer_interval[4]; 
443 -       struct timer_list tl[4];
444 -
445 -       /* 
446 -        *      Client entry point, called by the LLC.
447 -        */
448 -        
449 -       void    (*llc_event)(struct llc_struct *);
450 -       
451 -       /*
452 -        *      Mux and Demux variables
453 -        */
454 -        
455 -       char * client_data;             /* Pointer to clients context */
456 -       unsigned char local_sap;
457 -       unsigned char remote_sap ;
458 -       char remote_mac[MAX_ADDR_LEN];  /* MAC address of remote session partner */ 
459 -       struct device *dev;             /* Device we are attached to */
460 -                    
461 -       unsigned char llc_mode;         /* See doc 7.1 on p70 */
462 -#define MODE_ADM 1
463 -#define MODE_ABM 2
464 -
465 -       int llc_callbacks;              /* Pending callbacks */
466 -#define LLC_CONN_INDICATION    1       /* We have to ensure the names don't */
467 -#define LLC_CONN_CONFIRM       2       /* mix up with the 802 state table */
468 -#define LLC_DATA_INDIC         4
469 -#define LLC_DISC_INDICATION    8
470 -#define LLC_RESET_INDIC_LOC    16
471 -#define LLC_RESET_INDIC_REM    32
472 -#define LLC_RST_CONFIRM                64
473 -#define LLC_FRMR_RECV          128
474 -#define LLC_FRMR_SENT          256
475 -#define LLC_REMOTE_BUSY                512
476 -#define LLC_REMOTE_NOTBUSY     1024
477 -#define LLC_TEST_INDICATION    2048
478 -#define LLC_XID_INDICATION     4096
479 -#define LLC_UI_DATA            8192
480 -
481 -       struct sk_buff *inc_skb;        /* Saved data buffer for indications */
482 -       
483 -       struct sk_buff_head rtq;        /* Retransmit queue */
484 -       struct sk_buff_head atq;        /* Await transit queue */
485 -      
486 -       unsigned char xid_count;
487 +#ifndef __NET_LLC_H
488 +#define __NET_LLC_H
489 +
490 +#include <linux/skbuff.h>
491 +#include <linux/llc.h>
492 +
493 +#define LLC_SC_SAP             0x12    /* Linux Specific SC SAP. */
494 +
495 +#define LLC_MSG_QUEUE_SIZE     20
496 +
497 +/* LLC timer indicators. */
498 +#define LLC_P_TIMER            0
499 +#define LLC_REJ_TIMER          1
500 +#define LLC_ACK_TIMER          2
501 +#define LLC_BUSY_TIMER         3
502 +#define LLC_TIMER_IDLE         0
503 +#define LLC_TIMER_RUNNING      1
504 +#define LLC_TIMER_EXPIRED      2
505 +
506 +/* LLC operational modes. */
507 +#define LLC_MODE_ADM           1
508 +#define LLC_MODE_ABM           2
509 +
510 +typedef struct
511 +{
512 +       unsigned pdu_type:1;    /* PDU type field. */
513 +       unsigned ns:7;          /* Send sequence #, network-order. */
514 +       unsigned pf:1;          /* Poll/Final command/response bit. */
515 +       unsigned nr:7;          /* Receive sequence #, network-order. */
516 +} llc_ictrl;
517 +
518 +typedef struct
519 +{
520 +       unsigned pdu_type:2;    /* PDU type field. */
521 +       unsigned cmd:2;         /* Supervisory command. */
522 +       unsigned __pad:4;       /* Zero'd out padding. */
523 +       unsigned pf:1;          /* Poll/Final command/response bit. */
524 +       unsigned nr:7;          /* Receive sequence #, network-order. */
525 +} llc_sctrl;
526 +
527 +typedef struct
528 +{
529 +       unsigned pdu_type:2;    /* PDU type field. */
530 +       unsigned mod1:2;        /* Modifer bits, field one. */
531 +       unsigned pf:1;          /* Poll/Final command/response bit. */
532 +       unsigned mod2:3;        /* Modifier bits, field two. */
533 +} llc_uctrl;
534 +
535 +typedef struct
536 +{
537 +       unsigned f1:1;
538 +       unsigned f2:1;
539 +       unsigned f3:6;
540 +} llc_bits;
541 +
542 +/* LLC data link header. */
543 +typedef struct
544 +{
545 +       __u8    dsap:8; /* Destination Service Access Point. */
546 +       __u8    ssap:8; /* Source Service Access Point. */
547 +
548 +       union {
549 +               llc_bits bits __attribute__ ((packed));
550 +               /* I PDU control bit fields. */
551 +               llc_ictrl ictrl __attribute__ ((packed));
552 +               /* S PDU control bit fields. */
553 +               llc_sctrl sctrl __attribute__ ((packed));
554 +               /* U PDU control bit fields. */
555 +               llc_uctrl uctrl __attribute__ ((packed));
556 +               __u8 ctrl __attribute__ ((packed));
557 +       } ctrl;
558 +} llchdr;
559 +
560 +typedef struct
561 +{
562 +       __u16   ctrl;
563 +       unsigned __pad1:1;
564 +       unsigned vs:7;
565 +       unsigned cr:1;
566 +       unsigned vr:7;
567 +       unsigned wxyz:4;
568 +       unsigned v:4;
569 +} llc_frmr;
570 +
571 +typedef struct
572 +{
573 +       __u8    format;         /* 10000001, IEEE Basic Format. */
574 +       unsigned class:5;       /* LLC Type/Class. */
575 +       unsigned __pad:4;
576 +       unsigned window:7;      /* Recieve window size (k). */
577 +} llc_xid;
578 +
579 +typedef struct
580 +{
581 +       unsigned vs:7;
582 +       unsigned vr:7;
583 +} llc_seq;
584 +
585 +/* LLC SC information */
586 +struct llc_sc_info
587 +{
588 +       struct llc_sc_info *next;
589 +       struct llc_sc_info *prev;
590 +
591 +       struct datalink_proto *llc_sap_list;
592 +       struct device *dev;
593 +
594 +       int state;
595 +};
596 +
597 +/* LLC SAP information per socket. */
598 +struct llc_pinfo 
599 +{
600 +       int event;              /* Current event on the link. */
601 +       int state;              /* Current state of the link. LLC 1 */
602 +       int state2;             /* Current state of the link. LLC 2 */
603 +
604 +       int build;              /* Current PDU to be built. */
605 +       __u8 build_pf:1;        /* PF to use when Building PDU. */
606 +       int build_dsap;         /* DSAP to use when Building PDU. */
607 +
608 +       __u8 dmac[14];          /* XXX??? Destination Mac. may not stay */
609 +
610 +       __u8 dsap;
611 +       __u8 ssap;
612 +
613 +       int class;              /* LLC communication class. */
614  
615 -       struct llc_struct *nextllc;     /* ptr to next llc struct in proto chain */
616 +       int s_flag;             /* Supervisory function bit. */
617 +       int p_flag;             /* Poll function bit. */
618 +       int f_flag;             /* Final function bit. */
619 +       int data_flag;          /* Number of toss'd PDUs due to a local busy. */
620 +       int remote_busy;        /* Indicates if the DSAP is busy. */
621 +
622 +       llc_seq seq;            /* Tx/Rx sequence numbers */
623 +
624 +#ifdef NOT
625 +       __u8 vs;                /* Send state variable. (Tx sequence #) */
626 +       __u8 vr;                /* Receive state variable. (Rx sequence #) */
627 +#endif
628 +
629 +       int retry_count;        /* Number of retransmits/retrys. */
630 +       int window_count;       /* Number of outstanding I PDUs. */
631 +       int xid_r_count;        /* Number of XID responses. */
632 +
633 +       int max_retry;          /* Maximm number of transmissions, N2. */
634 +       int max_size;           /* Maximum number of octets in an I PDU, N1. */
635 +       int max_window;         /* Maximum number of outstanding I PDUs, k. */
636 +
637 +       struct sk_buff_head rx_queue;
638 +
639 +       int tx_queue_depth;
640 +       struct sk_buff_head tx_queue;
641 +
642 +       int retransmitting;
643 +       int retx_queue_depth;
644 +       struct sk_buff_head retx_queue;
645 +
646 +       struct datalink_proto *dl;
647 +
648 +       int (*rcvfunc)(int rsp, struct sk_buff *);
649 +
650 +       int ack_expire;                 /* Ack time-out value. */
651 +       struct timer_list ack_timer;    /* Acknowledgment timer. */
652 +       int p_expire;                   /* P time-out value. */
653 +       struct timer_list p_timer;      /* P-bit timer. */
654 +       int rej_expire;                 /* Reject time-out value. */
655 +       struct timer_list rej_timer;    /* Reject timer. */
656 +       int busy_expire;                /* Busy time-out value. */
657 +       struct timer_list busy_timer;   /* Busy timer. */
658  };
659  
660 -#define ADD_TO_RTQ(skb) skb_queue_tail(&lp->rtq,skb)
661 -#define ADD_TO_ATQ(skb) skb_queue_tail(&lp->atq,skb)
662 +#define LLC_PDU_RSP            0x01
663 +#define LLC_P_FLAG             1
664 +#define LLC_F_FLAG             1
665 +#define LLC_X_FLAG             0
666 +
667 +#define LLC_XID_SIZE           3
668 +#define LLC_FRMR_SIZE          5
669 +
670 +/* LLC timer time-outs, these are linux specific (not to spec). */
671 +#define LLC_ACK_TIMER_EXPIRE   3 * HZ;
672 +#define LLC_P_TIMER_EXPIRE     3 * HZ;
673 +#define LLC_REJ_TIMER_EXPIRE   10 * HZ;
674 +#define LLC_BUSY_TIMER_EXPIRE  15 * HZ;
675 +
676 +/* LLC maximum counts, these are linux specific (not to spec). */
677 +#define LLC_RETRY              10
678 +#define LLC_SIZE               65535   /* Should hold us for a while ;) */
679 +#define LLC_WINDOW             15
680 +
681 +/* LLC PDU types. */
682 +#define LLC_I_CMD                      0x00
683 +#define LLC_I_RSP                      0x01
684 +#define LLC_RR_CMD                     0x02
685 +#define LLC_RR_RSP                     0x03
686 +#define LLC_ACK_CMD                    LLC_RR_CMD
687 +#define LLC_ACK_RSP                    LLC_RR_RSP
688 +#define LLC_RNR_CMD                    0x04
689 +#define LLC_RNR_RSP                    0x05
690 +#define LLC_REJ_CMD                    0x06
691 +#define LLC_REJ_RSP                    0x07
692 +#define LLC_FRMR_RSP                   0x08
693 +#define LLC_UI_CMD                     0x09
694 +#define LLC_TEST_CMD                   0x0A
695 +#define LLC_TEST_RSP                   0x0B
696 +#define LLC_DISC_CMD                   0x0C
697 +#define LLC_UA_RSP                     0x0D
698 +#define LLC_DM_RSP                     0x0E
699 +#define LLC_XID_CMD                    0x0F
700 +#define LLC_XID_RSP                    0x10
701 +#define LLC_SABME_CMD                  0x11
702 +
703 +/* LLC Control Byte Assignments. */
704 +#define LLC_CTRL_I_CMD                 0x00
705 +#define LLC_CTRL_I_RSP                 LLC_CTRL_I_CMD
706 +#define LLC_CTRL_RR_CMD                        0x01
707 +#define LLC_CTRL_RR_RSP                        LLC_CTRL_RR_CMD
708 +#define LLC_CTRL_RNR_CMD               0x05
709 +#define LLC_CTRL_RNR_RSP               LLC_CTRL_RNR_CMD
710 +#define LLC_CTRL_REJ_CMD               0x09
711 +#define LLC_CTRL_REJ_RSP               LLC_CTRL_REJ_CMD
712 +#define LLC_CTRL_DISC_CMD              0x43
713 +#define LLC_CTRL_SABME_CMD             0x7F
714 +#define LLC_CTRL_UA_RSP                        0x63
715 +#define LLC_CTRL_DM_RSP                        0x0F
716 +#define LLC_CTRL_FRMR_RSP              0x87
717 +#define LLC_CTRL_UI_CMD                        0x03
718 +#define LLC_CTRL_XID_CMD               0xBF
719 +#define LLC_CTRL_XID_RSP               LLC_CTRL_XID_CMD
720 +#define LLC_CTRL_TEST_CMD              0xF3            /* Was 0xE3 */
721 +#define LLC_CTRL_TEST_RSP              LLC_CTRL_TEST_CMD
722 +
723 +/* LLC connection states, Type 1 and Type 2. */
724 +#define LLC_STATE_DISCONNECTED         0x00
725 +#define LLC_STATE_DISCONNECTING                0x01
726 +#define LLC_STATE_RESETTING            0x02
727 +#define LLC_STATE_FRMR_TX              0x03
728 +#define LLC_STATE_FRMR_RX              0x04
729 +#define LLC_STATE_CONNECTING           0x05
730 +#define LLC_STATE_CONNECTED            0x06
731 +#define LLC_STATE_CHKPOINT             0x07
732 +#define LLC_STATE_LOCAL_BUSY           0x08    /* User and Buffer. */
733 +#define LLC_STATE_REMOTE_BUSY          0x09
734 +#define LLC_STATE_REJECTION            0x0A
735 +#define LLC_STATE_CLEARING             0x0B
736 +#define LLC_STATE_DYNWINDOW            0x0C
737 +
738 +/* Message/Command action words. */
739 +#define ENABLE_W_DUP_ADDR_CHK  LLC_STATE_ENABLE_W_DUPLICATE_ADDRESS_CHK
740 +#define ENABLE                 LLC_STATE_ENABLE_WOUT_DUPLICATE_ADDRESS_CHK
741 +
742 +#define LLC_R_XID_C_INDICATION                 0x01
743 +#define LLC_R_XID_R_INDICATION                 0x02
744 +#define LLC_R_TEST_C_INDICATION                        0x03
745 +#define LLC_R_TEST_R_INDICATION                        0x04
746 +
747 +
748 +
749 +#define LLC_STATE_SEND_XID_R_DATA              0x9F    /* Linux specific. */
750 +
751 +/* Linux LLC states for the Linux LLC state machine. 
752 + * - IEEE 802.2-1989 state naratives are provided for the enjoyment
753 + *   of the reader.
754 + */
755 +
756 +/* Linux LLC Type 1 states. */
757 +#define LLC_STATE_DOWN                 0x90    /* DOWN_STATE. The station
758 +                                                * component is powered off,
759 +                                                * not initialized, and/or
760 +                                                * disabled from operating in
761 +                                                * the local area network.
762 +                                                */
763 +#define LLC_STATE_DUPLICATE_ADDRESS_CHK        0x91    /* DUPLICATE_ADDRESS_CHECK_STATE
764 +                                                * The station component is in
765 +                                                * the process of checking for
766 +                                                * duplicate MAC addresses on
767 +                                                * the LAN. The main purpose of
768 +                                                * this state shall be to allow
769 +                                                * the LLC station component to
770 +                                                * verify that this station's
771 +                                                * MAC address is unique on the
772 +                                                * LAN. The station component
773 +                                                * shall send XID command PDUs
774 +                                                * with identical MAC DA and SA
775 +                                                * addresses, and shall wait for
776 +                                                * a possible XID Response PDU
777 +                                                * indicating the existance of
778 +                                                * other stations with identical
779 +                                                * MAC link addresses.
780 +                                                */
781 +#define LLC_STATE_UP                   0x92    /* UP_STATE. The station 
782 +                                                * component is enabled, powered
783 +                                                * on, initialized, and 
784 +                                                * operating in the local area
785 +                                                * network. The LLC shall allow
786 +                                                * SAPs to exchange LLC PDUs on
787 +                                                * the medium.
788 +                                                */
789 +#define LLC_STATE_ENABLE_W_DUPLICATE_ADDRESS_CHK 0x93
790 +                                               /* ENABLE_WITH_DUPLICATE_
791 +                                                * ADDRESS_CHECK. Station
792 +                                                * component user has 
793 +                                                * initialized/enabled the
794 +                                                * station equipment, and has
795 +                                                * requested that the LLC check
796 +                                                * for MAC service access point
797 +                                                * address duplications before
798 +                                                * participating in data link
799 +                                                * communications.
800 +                                                */
801 +#define LLC_STATE_ENABLE_WOUT_DUPLICATE_ADDRESS_CHK 0x94
802 +                                               /* ENABLE_WITHOUT_DUPLICATE_
803 +                                                * ADDRESS_CHECK. Station
804 +                                                * component user has
805 +                                                * initialized/enabled the
806 +                                                * station equipment, but
807 +                                                * duplicate MAC service access
808 +                                                * point address checking by the
809 +                                                * LLC is not supported/desired.
810 +                                                */
811 +#define LLC_STATE_ACK_TIMER_EXPIRED_AND_RETRY_COUNT_OK 0x95
812 +                                               /* ACK_TIMER_EXPIRED_AND_RETRY_
813 +                                                * COUNT<MAXIMUM_RETRY.
814 +                                                * Acknowledgment timer has
815 +                                                * expired and retry count is
816 +                                                * less than maximum retry 
817 +                                                * limit.
818 +                                                */
819 +#define LLC_STATE_ACK_TIMER_EXPIRED_AND_RETRY_COUNT_MAX 0x96
820 +                                               /* ACK_TIMER_EXPIRED_AND_RETRY_
821 +                                                * COUNT=MAXIMUM_RETRY.
822 +                                                * Acknowledgment timer has
823 +                                                * expired and retry count is
824 +                                                * equal to the maximum retry
825 +                                                * limit.
826 +                                                */
827 +#define LLC_STATE_RECEIVE_NULL_DSAP_XID_C 0x97 /* RECEIVE_NULL_DSAP_XID_C. An
828 +                                                * XID command PDU with the
829 +                                                * NULL DSAP address has been
830 +                                                * received.
831 +                                                */
832 +#define LLC_STATE_RECEIVE_NULL_DSAP_XID_R 0x98
833 +                                               /* RECEIVE_NULL_DSAP_XID_R_AND_
834 +                                                * XID_R_COUNT=0. A single XID
835 +                                                * response PDU with the null
836 +                                                * DSAP address has been 
837 +                                                * received.
838 +                                                */
839 +#define LLC_STATE_RECEIVE_NULL_DSAP_XID_R_AND_XID_R_CNT_1 0x99
840 +                                               /* RECEIVE_NULL_DSAP_XID_R_AND_
841 +                                                * XID_R_COUNT=1. A second XID
842 +                                                * response PDU with the null
843 +                                                * DSAP address have been
844 +                                                * received.
845 +                                                */
846 +#define LLC_STATE_RECEIVE_NULL_DSAP_TEST_C 0x9A        /* RECEIVE_NULL_DSAP_TEST_C. A
847 +                                                * TEST command PDU with the
848 +                                                * null DSAP address has been
849 +                                                * received.
850 +                                                */
851 +#define LLC_STATE_DISABLE_REQUEST      0x9B    /* DISABLE_REQUEST. Station user
852 +                                                * has requested that the
853 +                                                * equipment be disabled from
854 +                                                * operating on the medium.
855 +                                                */
856 +#define LLC_STATE_XID_R_COUNT_0                0x9F    /* XID_R_COUNT:=0. Initialize
857 +                                                * the XID response PDU counter.
858 +                                                */
859 +#define LLC_STATE_XID_R_COUNT_PLUS_1   0xA0    /* XID_R_COUNT:=XID_R_COUNT+1.
860 +                                                * Increment the XID response
861 +                                                * PDU counter.
862 +                                                */
863 +#define LLC_STATE_SEND_NULL_DSAP_XID_C 0xA1    /* SEND_NULL_DSAP_XID_C. The LLC
864 +                                                * shall send an XID command PDU
865 +                                                * with null SSAP and null DSAP
866 +                                                * addresses and with identical
867 +                                                * MAC DA and SA addresses.
868 +                                                */
869 +#define LLC_STATE_SEND_XID_R           0xA2    /* SEND_XID_R. The LLC shall 
870 +                                                * send an XID response PDU,
871 +                                                * using the SSAP address of the
872 +                                                * XID command PDU as the DSAP
873 +                                                * address of the response PDU,
874 +                                                * and using a null SSAP 
875 +                                                * address.
876 +                                                */
877 +#define LLC_STATE_SEND_TEST_R          0xA3    /* SEND_TEST_R. The LLC shall
878 +                                                * send a TEST response PDU,
879 +                                                * using the SSAP address of the
880 +                                                * TEST command PDU as the DSAP
881 +                                                * address of the response PDU,
882 +                                                * and using a null SSAP 
883 +                                                * address.
884 +                                                */
885 +#define LLC_STATE_RPT_STATION_UP       0xA4    /* REPORT_STATUS(STATION_UP).
886 +                                                * LLC entity is now 
887 +                                                * operational.
888 +                                                */
889 +#define LLC_STATE_RPT_STATION_DOWN     0xA5    /* REPORT_STATUS(STATION_DOWN).
890 +                                                * The LLC entity is now
891 +                                                * non-operational.
892 +                                                */
893 +#define LLC_STATE_RPT_DUPLOCATE_ADDRESS_FOUND 0xA6
894 +                                               /* REPORT_STATUS(DUPLICATE_
895 +                                                * ADDRESS_FOUNT). LLC entity 
896 +                                                * has detected another LLC
897 +                                                * entity on the LAN with a MAC
898 +                                                * service access point address
899 +                                                * identical to its own.
900 +                                                */
901 +#define LLC_STATE_INACTIVE             0xA7    /* INACTIVE_STATE. LLC SAP
902 +                                                * component is not active,
903 +                                                * functioning, or operational.
904 +                                                * No PDUs are accepted and/or
905 +                                                * sent.
906 +                                                */
907 +#define LLC_STATE_ACTIVE               0xA8    /* ACTIVE_STATE. LLC SAP
908 +                                                * component is active, 
909 +                                                * functioning, and operational.
910 +                                                * PDUs are received and sent.
911 +                                                */
912 +#define LLC_STATE_SAP_ACTIVATION_REQUEST 0xA9  /* SAP_ACTIVATION_REQUEST. The
913 +                                                * SAP user has requested that
914 +                                                * the particular LLC SAP
915 +                                                * component be activated and
916 +                                                * begin logical data link
917 +                                                * operation of the Type 1
918 +                                                * services.
919 +                                                */
920 +#define LLC_STATE_SAP_DEACTIVATION_REQUEST 0xAA        /* SAP_DEACTIVATION_REQUEST. The
921 +                                                * SAP user has requested that
922 +                                                * the particular LLC SAP
923 +                                                * component be deactivated and
924 +                                                * no longer allow to operate on
925 +                                                * the logical data link.
926 +                                                */
927 +#define LLC_STATE_XID_REQUEST          0xAB    /* XID_REQUEST. The SAP user has
928 +                                                * requested that the LLC SAP
929 +                                                * component send an XID
930 +                                                * command PDU to one or more
931 +                                                * remote SAPs.
932 +                                                */
933 +#define LLC_STATE_TEST_REQUEST         0xAC    /* TEST_REQUEST. The SAP user 
934 +                                                * has requested that the LLC
935 +                                                * SAP component send a TEST
936 +                                                * command PDU to one or more
937 +                                                * remote SAPs.
938 +                                                */
939 +#define LLC_STATE_RECEIVE_UI           0xAD    /* RECEIVE_UI. The local SAP
940 +                                                * component has received a UI
941 +                                                * PDU from a remote SAP.
942 +                                                */
943 +#define LLC_STATE_UNITDATA_REQUEST     0xAE    /* UNITDATA_REQUEST. The SAP
944 +                                                * user has requested that a
945 +                                                * data unit be passed to a
946 +                                                * remote LLC SAP, via a UI PDU.
947 +                                                */
948 +#define LLC_STATE_RECEIVE_XID_C                0xAF    /* RECEIVE_XID_C. The local SAP
949 +                                                * component has received an XID
950 +                                                * command PDU from a remote 
951 +                                                * SAP.
952 +                                                */
953 +#define LLC_STATE_RECEIVE_XID_R                0xB0    /* RECEIVE_XID_R. The local SAP
954 +                                                * component has received an XID
955 +                                                * response PDU from a remote 
956 +                                                * SAP.
957 +                                                */
958 +#define LLC_STATE_RECEIVE_TEST_C       0xB1    /* RECEIVE_TEST_C. The local SAP
959 +                                                * component has received a TEST
960 +                                                * command PDU from the remote
961 +                                                * SAP.
962 +                                                */
963 +#define LLC_STATE_RECEIVE_TEST_R       0xB2    /* RECEIVE_TEST_R. The local SAP
964 +                                                * component has received a TEST
965 +                                                * response PDU from the remote
966 +                                                * SAP.
967 +                                                */
968 +#define LLC_STATE_UNITDATA_INDICATION  0xB3    /* UNITDATA_INDICATION. LLC SAP
969 +                                                * component has received a UI
970 +                                                * PDU from a remote SAP. The
971 +                                                * service data unit is given to
972 +                                                * the SAP user.
973 +                                                */
974 +#define LLC_STATE_SEND_UI              0xB4    /* SEND_UI. A UI PDU is sent to
975 +                                                * one or more remote SAPs in
976 +                                                * response to a user request to
977 +                                                * send a service data unit.
978 +                                                */
979 +#define LLC_STATE_SEND_XID_C           0xB5    /* SEND_XID_C. LLC SAP component
980 +                                                * shall send an XID command PDU
981 +                                                * to remote SAPs in response to
982 +                                                * a SAP user request to 
983 +                                                * identify other SAPs.
984 +                                                */
985 +#define LLC_STATE_SEND_TEST_C          0xB7    /* SEND_TEST_C. LLC SAP 
986 +                                                * component shall send a TEST
987 +                                                * command PDU in response to
988 +                                                * a SAP user request to test
989 +                                                * a remote SAP.
990 +                                                */
991 +#define LLC_STATE_RPT_SAP_ACTIVE       0xB9    /* REPORT_STATUS(SAP_ACTIVE).
992 +                                                * The SAP_ACTIVATION_REQUEST
993 +                                                * has been successfully
994 +                                                * processed and the component
995 +                                                * is now operational.
996 +                                                */
997 +#define LLC_STATE_RPT_SAP_INACTIVE     0xBA    /* REPORT_STATUS(SAP_INACTIVE).
998 +                                                * The SAP_DEACTIVATION_REQUEST
999 +                                                * has been successfully
1000 +                                                * processed and the component
1001 +                                                * is now deactivated.
1002 +                                                */
1003 +#define LLC_STATE_XID_INDICATION       0xBB    /* XID_INDICATION. LLC SAP
1004 +                                                * component has received an XID
1005 +                                                * response PDU from a remote
1006 +                                                * SAP. An indication of this
1007 +                                                * event is passed to the SAP
1008 +                                                * user, and may also return the
1009 +                                                * XID information field.
1010 +                                                */
1011 +#define LLC_STATE_TEST_INDICATION      0xBC    /* TEST_INDICATION. LLC SAP
1012 +                                                * component has received a
1013 +                                                * TEST response PDU from a
1014 +                                                * remote SAP. An indication of
1015 +                                                * this event is passed to the
1016 +                                                * SAP user, and may also return
1017 +                                                * the TEST information field.
1018 +                                                */
1019 +
1020 +/* Linux LLC Type 2 states. */
1021 +#define LLC_STATE_ADM                  0x00    /* ADM. The connection component
1022 +                                                * is in the asynchronous
1023 +                                                * disconnected mode. It can
1024 +                                                * accept an SABME PDU from a
1025 +                                                * remote LLC SSAP or, at the
1026 +                                                * request of the service access
1027 +                                                * point user, can initiate an
1028 +                                                * SABME PDU transmission to a
1029 +                                                * remote LLC DSAP, to establish
1030 +                                                * a data link connection. It
1031 +                                                * also responds to a DISC
1032 +                                                * command PDU and to any 
1033 +                                                * command PDU with the P bit
1034 +                                                * set to "1".
1035 +                                                */
1036 +#define LLC_STATE_SETUP                        0x01    /* SETUP. The connection 
1037 +                                                * component has transmitted an
1038 +                                                * SABME command PDU to a remote
1039 +                                                * LLC DSAP and is waiting for
1040 +                                                * a reply.
1041 +                                                */
1042 +#define LLC_STATE_NORMAL               0x02    /* NORMAL. A data link 
1043 +                                                * connection exists between the
1044 +                                                * local LLC service access 
1045 +                                                * point and the remote LLC
1046 +                                                * service access point. Sending
1047 +                                                * and reception of information
1048 +                                                * and supervisory PDUs can be
1049 +                                                * performed.
1050 +                                                */
1051 +#define LLC_STATE_BUSY                 0x03    /* BUSY. A data link connection
1052 +                                                * exists between the local LLC
1053 +                                                * service access point and the
1054 +                                                * remote LLC service access
1055 +                                                * point. I PDUs may be sent.
1056 +                                                * Local conditions make it 
1057 +                                                * likely that the information
1058 +                                                * field of received I PDUs will
1059 +                                                * be ignored. Supervisory PDUs
1060 +                                                * may be both sent and received
1061 +                                                */
1062 +#define LLC_STATE_REJECT               0x04    /* REJECT. A data link 
1063 +                                                * connection exists between the
1064 +                                                * local LLC service access 
1065 +                                                * point and the remote LLC
1066 +                                                * service point The remote
1067 +                                                * connection component has
1068 +                                                * requested that the remote
1069 +                                                * connection component resend
1070 +                                                * a specified I PDU that the
1071 +                                                * local connection component
1072 +                                                * has detected as being out
1073 +                                                * of sequence. Both I PDUs and
1074 +                                                * supervisory PDUs may be
1075 +                                                * sent and received.
1076 +                                                */
1077 +#define LLC_STATE_AWAIT                        0x05    /* AWAIT. A data link connection
1078 +                                                * exists between the local LLC
1079 +                                                * service access point and the
1080 +                                                * remote LLC service access
1081 +                                                * point. The local LLC is
1082 +                                                * performing a timer recovery
1083 +                                                * operation and has sent a
1084 +                                                * command PDU with the P bit
1085 +                                                * set to "1", and is awaiting
1086 +                                                * an acknowledgment from the
1087 +                                                * remote LLC. I PDUs may be
1088 +                                                * received but not sent.
1089 +                                                * Supervisory PDUs may be both
1090 +                                                * sent and received.
1091 +                                                */
1092 +#define LLC_STATE_AWAIT_BUSY           0x06    /* AWAIT_BUSY. A data link
1093 +                                                * connection exists between the
1094 +                                                * local LLC service access
1095 +                                                * point and the remote LLC
1096 +                                                * service access point. The 
1097 +                                                * local LLC is performing a
1098 +                                                * timer recovery operation and
1099 +                                                * has sent a command PDU with 
1100 +                                                * the P bit set to "1", and is
1101 +                                                * awaiting an acknowledgment
1102 +                                                * from the remote LLC. I PDUs
1103 +                                                * may not be sent. Local
1104 +                                                * conditions make it likely
1105 +                                                * that the information field of
1106 +                                                * received I PDUs will be 
1107 +                                                * ignored. Supervisory PDUs may
1108 +                                                * be both sent and received.
1109 +                                                */
1110 +#define LLC_STATE_AWAIT_REJECT         0x07    /* AWAIT_REJECT. A data link
1111 +                                                * connection exists between the
1112 +                                                * local LLC service access
1113 +                                                * point and the remote LLC
1114 +                                                * service access point. The
1115 +                                                * local connection component
1116 +                                                * has requested that the remote
1117 +                                                * connection component
1118 +                                                * re-transmit a specified I PDU
1119 +                                                * that the local connection
1120 +                                                * component has detected as
1121 +                                                * being out of sequence. Before
1122 +                                                * the local LLC entered this
1123 +                                                * state it was performing a
1124 +                                                * timer recovery operation and
1125 +                                                * had sent a command PDU with
1126 +                                                * the P bit set to "1", and is
1127 +                                                * still awaiting an 
1128 +                                                * acknowledgment from the 
1129 +                                                * remote LLC. I PDUs may be
1130 +                                                * received but not transmitted.
1131 +                                                * Supervisory PDUs may be both
1132 +                                                * transmitted and received.
1133 +                                                */
1134 +#define LLC_STATE_D_CONN               0x08    /* D_CONN. At the request of the
1135 +                                                * service access point user, 
1136 +                                                * the local LLC has sent a DISC
1137 +                                                * command PDU to the remote LLC
1138 +                                                * DSAP and it waiting for a
1139 +                                                * reply.
1140 +                                                */
1141 +#define LLC_STATE_RESET                        0x09    /* RESET. As a result of a 
1142 +                                                * service access point user
1143 +                                                * request or the receipt of a
1144 +                                                * FRMR response PDU, the local
1145 +                                                * connection component has sent
1146 +                                                * an SABME command PDU to the
1147 +                                                * remote LLC DSAP to reset the
1148 +                                                * data link connection and is
1149 +                                                * waiting for a reply.
1150 +                                                */
1151 +#define LLC_STATE_ERROR                        0x0A    /* ERROR. The local connection
1152 +                                                * component has detected an
1153 +                                                * error in a received PDU and
1154 +                                                * has sent a FRMR response PDU.
1155 +                                                * It is waiting for a reply
1156 +                                                * from the remote connection
1157 +                                                * component.
1158 +                                                */
1159 +#define LLC_STATE_CONN                 0x0B    /* CONN. The local connection
1160 +                                                * component has received an
1161 +                                                * SABME PDU from a remote LLC
1162 +                                                * SSAP, and it is waiting for
1163 +                                                * the local user to accept or
1164 +                                                * refuse the connection.
1165 +                                                */
1166 +#define LLC_STATE_RESET_CHECK          0x0C    /* RESET_CHECK. The local
1167 +                                                * connection component is 
1168 +                                                * waiting for the local user to
1169 +                                                * accept or refuse a remote
1170 +                                                * reset request.
1171 +                                                */
1172 +#define LLC_STATE_RESET_WAIT           0x0D    /* RESET_WAIT. The local 
1173 +                                                * connection component is 
1174 +                                                * waiting for the local user to
1175 +                                                * indicate a RESET_REQUEST or a
1176 +                                                * DISCONNECT_REQUEST.
1177 +                                                */
1178 +#define LLC_STATE_CONNECT_REQUEST      0x10    /* CONNECT_REQUEST. The user has
1179 +                                                * requested that a data link
1180 +                                                * connection be established 
1181 +                                                * with a remote LLC DSAP.
1182 +                                                */
1183 +#define LLC_STATE_CONNECT_RESPONSE     0x11    /* CONNECT_RESPONSE. The user
1184 +                                                * has accepted the data link
1185 +                                                * connection.
1186 +                                                */
1187 +#define LLC_STATE_DATA_REQUEST         0x12    /* DATA_REQUEST. The user has
1188 +                                                * requested that a data unit
1189 +                                                * be sent to the remote LLC
1190 +                                                * DSAP.
1191 +                                                */
1192 +#define LLC_STATE_DISCONNECT_REQUEST   0x13    /* DISCONNECT_REQUEST. The user
1193 +                                                * has requested that the data
1194 +                                                * link connection with the
1195 +                                                * remote LLC DSAP be 
1196 +                                                * terminated.
1197 +                                                */
1198 +#define LLC_STATE_RESET_REQUEST                0x14    /* RESET_REQUEST. The user has
1199 +                                                * requested that the data link
1200 +                                                * connection with the remote
1201 +                                                * LLC DSAP be reset.
1202 +                                                */
1203 +#define LLC_STATE_RESET_RESPONSE       0x15    /* RESET_RESPONSE. The user has
1204 +                                                * accepted the reset of the 
1205 +                                                * data link connection.
1206 +                                                */
1207 +#define LLC_STATE_LOCAL_BUSY_DETECTED  0x16    /* LOCAL_BUSY_DETECTED. The
1208 +                                                * local station has entered a
1209 +                                                * busy condition and may not
1210 +                                                * be able to accept I PDUs from
1211 +                                                * the remote LLC SSAP.
1212 +                                                */
1213 +#define LLC_STATE_LOCAL_BUSY_CLEARED   0x17    /* LOCAL_BUSY_CLEARED. The local
1214 +                                                * station busy condition has
1215 +                                                * ended and the station can
1216 +                                                * accept I PDUs from the remote
1217 +                                                * LLC SSAP.
1218 +                                                */
1219 +#define LLC_STATE_RECEIVE_BAD_PDU      0x18    /* RECEIVE_BAD_PDU. The remote
1220 +                                                * SSAP has sent to the local
1221 +                                                * DSAP a command or response
1222 +                                                * PDU which is not implemented,
1223 +                                                * or has an information field
1224 +                                                * when not permitted, or is an
1225 +                                                * I PDU with an information
1226 +                                                * field length greater than can
1227 +                                                * be accommodated by the local
1228 +                                                * LLC.
1229 +                                                */
1230 +#define LLC_STATE_RECEIVE_DISC_CMD     0x19    /* RECEIVE_DISC_CMD(P=X). The
1231 +                                                * remote SSAP has sent a DISC
1232 +                                                * command PDU with the P bit
1233 +                                                * set to "X" addressed to the
1234 +                                                * local DSAP.
1235 +                                                */
1236 +#define LLC_STATE_RECEIVE_DM_RSP       0x1A    /* RECEIVE_DM_RSP(F=X). The
1237 +                                                * remote SSAP has sent a DM
1238 +                                                * response PDU with the F bit
1239 +                                                * set to "X" addressed to the
1240 +                                                * local DSAP.
1241 +                                                */
1242 +#define LLC_STATE_RECEIVE_FRMR_RSP     0x1B    /* RECEIVE_FRMR_RSP(F=X). The
1243 +                                                * remote SSAP has sent a
1244 +                                                * FRMR response PDU with the F
1245 +                                                * bit set to "X" addressed to
1246 +                                                * the local DSAP.
1247 +                                                */
1248 +#define LLC_STATE_RECEIVE_I_CMD                0x1C    /* RECEIVE_I_CMD(P=X). The 
1249 +                                                * remote SSAP has sent a I
1250 +                                                * command PDU with the P bit 
1251 +                                                * set to "X" addressed to the
1252 +                                                * local DSAP. Both the N(R) and
1253 +                                                * N(S) fields are valid and the
1254 +                                                * N(S) value is the expected
1255 +                                                * sequence number.
1256 +                                                */
1257 +#define LLC_STATE_RECEIVE_I_CMD_W_UNEXPECTED_SEQ 0x1D
1258 +                                               /* RECEIVE_I_CMD(P=X)_WITH_
1259 +                                                * UNEXPECTED_N(S). The remote
1260 +                                                * SSAP has sent an I command
1261 +                                                * PDU with the P bit set to
1262 +                                                * "X" addressed to the local
1263 +                                                * DSAP. The N(S) field of the
1264 +                                                * command does not contain the
1265 +                                                * expected sequence number but
1266 +                                                * is within the windows size.
1267 +                                                * The N(R) field is valid.
1268 +                                                */
1269 +#define LLC_STATE_RECEIVE_I_CMD_W_INVALID_SEQ 0x1E
1270 +                                               /* RECEIVE_I_CMD(P=X)_WITH_
1271 +                                                * INVALID_N(S). The remote SSAP
1272 +                                                * has sent an I command PDU 
1273 +                                                * with the P bit set to "X"
1274 +                                                * addressed to the local DSAP.
1275 +                                                * The N(S) field of the command
1276 +                                                * is invalid. The N(R) field is
1277 +                                                * valid.
1278 +                                                */
1279 +#define LLC_STATE_RECEIVE_I_RSP                0x1F    /* RECEIVE_I_RSP(F=X). The 
1280 +                                                * remote SSAP has sent a I
1281 +                                                * response PDU with the F bit
1282 +                                                * set to "X" addressed to the
1283 +                                                * local DSAP. Both the N(R) and
1284 +                                                * N(S) fields are valid and the
1285 +                                                * N(S) value is the expected
1286 +                                                * sequence number.
1287 +                                                */
1288 +#define LLC_STATE_RECEIVE_I_RSP_W_UNEXPECTED_SEQ 0x20
1289 +                                               /* RECEIVE_I_RSP(F=X)_WITH_
1290 +                                                * UNEXPECTED_N(S). The remote
1291 +                                                * SSAP has sent an I response
1292 +                                                * PDU with the F bit set to "X"
1293 +                                                * addressed to the local DSAP.
1294 +                                                * The N(S) field of the command
1295 +                                                * does not contain the expected
1296 +                                                * sequence number but is within
1297 +                                                * the window size.
1298 +                                                */
1299 +#define LLC_STATE_RECEIVE_I_RSP_W_INVALID_SEQ 0x21
1300 +                                               /* RECEIVE_I_RSP(F=X)_WITH_
1301 +                                                * INVALID_N(S). The remote SSAP
1302 +                                                * has sent an I response PDU
1303 +                                                * with the F bit set to "X"
1304 +                                                * addressed to the local DSAP.
1305 +                                                * The N(S) field of the 
1306 +                                                * response is invalid. The N(R)
1307 +                                                * field is valid.
1308 +                                                */
1309 +#define LLC_STATE_RECEIVE_REJ_CMD      0x22    /* RECEIVE_REJ_CMD(P=X). The
1310 +                                                * remote SSAP has sent a REJ
1311 +                                                * command PDU with the P bit 
1312 +                                                * set to "X" addressed to the
1313 +                                                * local DSAP.
1314 +                                                */
1315 +#define LLC_STATE_RECEIVE_REJ_RSP      0x23    /* RECEIVE_REJ_RSP(F=X). The
1316 +                                                * remote SSAP has sent a REJ
1317 +                                                * response PDU with the F bit
1318 +                                                * set to "X" addressed to the
1319 +                                                * local DSAP.
1320 +                                                */
1321 +#define LLC_STATE_RECEIVE_RNR_CMD      0x24    /* RECEIVE_RNR_CMD(P=X). The
1322 +                                                * remote SSAP has sent a REJ
1323 +                                                * response PDU with the P bit
1324 +                                                * set to "X" addressed to the
1325 +                                                * local DSAP.
1326 +                                                */
1327 +#define LLC_STATE_RECEIVE_RNR_RSP      0x25    /* RECEIVE_RNR_RSP(F=X). The
1328 +                                                * remote SSAP has sent a RNR
1329 +                                                * response PDU with the F bit
1330 +                                                * set to "X" addressed to the
1331 +                                                * local DSAP.
1332 +                                                */
1333 +#define LLC_STATE_RECEIVE_RR_CMD       0x26    /* RECEIVE_RR_CMD(P=X). The
1334 +                                                * remote SSAP has sent a RNR
1335 +                                                * command PDU with the F bit
1336 +                                                * set to "X" addressed to the
1337 +                                                * local DSAP.
1338 +                                                */
1339 +#define LLC_STATE_RECEIVE_RR_RSP       0x27    /* RECEIVE_RR_RSP(F=X). The
1340 +                                                * remote SSAP has sent a RR
1341 +                                                * response PDU with the F bit
1342 +                                                * set to "X" addressed to the
1343 +                                                * local DSAP.
1344 +                                                */
1345 +#define LLC_STATE_RECEIVE_SABME_CMD    0x28    /* RECEIVE_SABME_CMD(P=X). The
1346 +                                                * remote SSAP has sent an SABME
1347 +                                                * command PDU with the P bit
1348 +                                                * set to "X" addressed to the
1349 +                                                * local DSAP.
1350 +                                                */
1351 +#define LLC_STATE_RECEIVE_UA_RSP       0x29    /* RECEIVE_UA_RSP(F=X). The
1352 +                                                * remote SSAP has sent a UA
1353 +                                                * response PDU with the F bit
1354 +                                                * set to "X" addressed to the
1355 +                                                * local DSAP.
1356 +                                                */
1357 +#define LLC_STATE_RECEIVE_XXX_CMD      0x2A    /* RECEIVE_XXX_CMD(F=X). The
1358 +                                                * remote SSAP has sent a Type 2
1359 +                                                * command PDU with the P bit
1360 +                                                * set to "X" addressed to the
1361 +                                                * local DSAP. The command is
1362 +                                                * any command not specificly
1363 +                                                * listed for that state.
1364 +                                                */
1365 +#define LLC_STATE_RECEIVE_XXX_RSP      0x2B    /* RECEIVE_XXX_RSP(F=X). The
1366 +                                                * remote SSAP has sent a Type 2
1367 +                                                * response PDU with the F bit
1368 +                                                * set to "X" addressed to the
1369 +                                                * local DSAP. The response is
1370 +                                                * any response not specifically
1371 +                                                * listed for that state.
1372 +                                                */
1373 +#define LLC_STATE_RECEIVE_XXX_YYY      0x2C    /* RECEIVE_XXX_YYY. The remote
1374 +                                                * SSAP has sent a Type 2 PDU
1375 +                                                * addressed to the local DSAP.
1376 +                                                * The PDU is any command or
1377 +                                                * response not specificly 
1378 +                                                * listed for that state.
1379 +                                                */
1380 +#define LLC_STATE_RECEIVE_ZZZ_CMD_W_INVALID_SEQ        0x2D
1381 +                                               /* RECEIVE_ZZZ_CMD(P=X)_WITH_
1382 +                                                * INVALID_N(R). The remote
1383 +                                                * SSAP has sent an I, RR, RNR,
1384 +                                                * or REJ command PDU with the
1385 +                                                * P bit set to "X" addressed to
1386 +                                                * the local DSAP. The N(R) 
1387 +                                                * field of the command is 
1388 +                                                * invalid.
1389 +                                                */
1390 +#define LLC_STATE_RECEIVE_ZZZ_RSP_W_INVALID_SEQ        0x2E
1391 +                                               /* RECEIVE_ZZZ_RSP(F=X)_WITH_
1392 +                                                * INVALID_N(R). The remote SSAP
1393 +                                                * has sent an I, RR, RNR, or
1394 +                                                * REJ command PDU with the F 
1395 +                                                * bit set to "X" addressed to 
1396 +                                                * the local DSAP. The N(R) 
1397 +                                                * field of the response is
1398 +                                                * invalid.
1399 +                                                */
1400 +#define LLC_STATE_P_TIMER_EXPIRED      0x2F    /* P_TIMER_EXPIRED. The P/F 
1401 +                                                * cycle timer has expired.
1402 +                                                */
1403 +#define LLC_STATE_ACK_TIMER_EXPIRED    0x30    /* ACK_TIMER_EXPIRED. The
1404 +                                                * acknowledgment timer has
1405 +                                                * expired.
1406 +                                                */
1407 +#define LLC_STATE_REJ_TIMER_EXPIRED    0x31    /* REJ_TIMER_EXPIRED. The "sent
1408 +                                                * REJ" timer has expired.
1409 +                                                */
1410 +#define LLC_STATE_BUSY_TIMER_EXPIRED   0x32    /* BUSY_TIMER_EXPIRED. The
1411 +                                                * remote-busy timer has expired
1412 +                                                * In the state transition table
1413 +                                                * some of the above events are
1414 +                                                * qualified by the following
1415 +                                                * conditions. The event is
1416 +                                                * recognized only when the
1417 +                                                * condition is true.
1418 +                                                */
1419 +#define LLC_STATE_P_FLAG_1             0x37    /* P_FLAG=1. P_FLAG has a value
1420 +                                                * of one when a command with 
1421 +                                                * the P bit set to "1" has been
1422 +                                                * sent and a response with the
1423 +                                                * F bit set to "1" is expected.
1424 +                                                */
1425 +#define LLC_STATE_P_FLAG_F             0x38    /* P_FLAG=F. P_FLAG has a value
1426 +                                                * equal to the F bit in the
1427 +                                                * response PDU received.
1428 +                                                */
1429 +#define LLC_STATE_REMOTE_BUSY_1                0x39    /* REMOTE_BUSY=1. When
1430 +                                                * REMOTE_BUSY has a value of
1431 +                                                * one, an RNR PDU has been
1432 +                                                * received from the remote
1433 +                                                * connection commponent to
1434 +                                                * indicate that I PDUs should
1435 +                                                * not be sent. DATA_REQUEST
1436 +                                                * events are not recognized
1437 +                                                * until this flag is reset to
1438 +                                                * zero.
1439 +                                                */
1440 +#define LLC_STATE_RETRY_COUNT_OK       0x3B    /* RETRY_COUNT<N2. The number of
1441 +                                                * retries is less than the
1442 +                                                * maximum number of retries.
1443 +                                                */
1444 +#define LLC_STATE_RETRY_COUNT_MAX      0x3C    /* RETRY_COUNT>=N2. The number
1445 +                                                * of retries has reached the
1446 +                                                * maximum number permissible.
1447 +                                                */
1448 +#define LLC_STATE_INIT_PF_CYCLE                0x3F    /* INITIATE_P/F_CYCLE. The local
1449 +                                                * LLC wants to initiate a P/F
1450 +                                                * cycle. (This is only required
1451 +                                                * if the local LLC is not
1452 +                                                * generating other command PDUs
1453 +                                                * for some reason.
1454 +                                                */
1455 +#define LLC_STATE_CLEAR_REMOTE_BUSY    0x40    /* CLEAR_REMOTE_BUSY. If
1456 +                                                * REMOTE_BUSY has a value of
1457 +                                                * one, then set REMOTE_BUSY to
1458 +                                                * zero to indicate the remote
1459 +                                                * LLC is now able to accept I
1460 +                                                * PDUs, stop the BUSY_TIMER,
1461 +                                                * inform the user by issuing
1462 +                                                * REPORT_STATUS(
1463 +                                                * REMOTE_NOT_BUSY) and, 
1464 +                                                * provided the local LLC is in
1465 +                                                * the NORMAL, REJECT, or BUSY
1466 +                                                * state, start the (re)sending
1467 +                                                * of any I PDUs that were 
1468 +                                                * waiting for the remote busy
1469 +                                                * to be cleared.
1470 +                                                */
1471 +#define LLC_STATE_CONNECT_INDICATION   0x41    /* CONNECT_INDICATION. Inform
1472 +                                                * the user that a connection
1473 +                                                * has been requested by a
1474 +                                                * remote LLC SSAP.
1475 +                                                */
1476 +#define LLC_STATE_CONNECT_CONFIRM      0x42    /* CONENCT_CONFIRM. The
1477 +                                                * connection service component
1478 +                                                * indicates that the remote
1479 +                                                * network entity has accepted
1480 +                                                * the connection.
1481 +                                                */
1482 +#define LLC_STATE_DATA_INDICATION      0x43    /* DATA_INDICATION. The 
1483 +                                                * connection service component
1484 +                                                * passes the data unit from the
1485 +                                                * received I PDU to the user.
1486 +                                                */
1487 +#define LLC_STATE_DISCONNECT_INDICATION        0x44    /* DISCONNECT_INDICATION. Inform
1488 +                                                * the user that the remote
1489 +                                                * network entity has initiated
1490 +                                                * disconnection of the data 
1491 +                                                * link connection.
1492 +                                                */
1493 +#define LLC_STATE_REMOTE_RESET_INDICATION 0x45 /* REMOTE_RESET_INDICATION. The
1494 +                                                * remote network entity or
1495 +                                                * remote peer has initiated a
1496 +                                                * reset of the data link
1497 +                                                * connection.
1498 +                                                */
1499 +#define LLC_STATE_LOCAL_RESET_INDICATION 0x46  /* LOCAL_RESET_INDICATION. The
1500 +                                                * local LLC has determined that
1501 +                                                * the data link connection is
1502 +                                                * in need of reinitialization.
1503 +                                                */
1504 +#define LLC_STATE_RESET_CONFIRM                0x47    /* RESET_CONFIRM. The connection
1505 +                                                * service component indicated
1506 +                                                * that the remote network
1507 +                                                * entity has accepted the
1508 +                                                * reset.
1509 +                                                */
1510 +#define LLC_STATE_RPT_FRMR_RECEIVED    0x48    /* REPORT_STATUS. FRMR_RECEIVED.
1511 +                                                * The local connection service
1512 +                                                * component has received a FRMR
1513 +                                                * response PDU.
1514 +                                                */
1515 +#define LLC_STATE_RPT_FRMR_SENT                0x49    /* REPORT_STATUS. FRMR_SENT. The
1516 +                                                * local connection service
1517 +                                                * component has received an
1518 +                                                * invalid PDU, and has sent a
1519 +                                                * FRMR response PDU.
1520 +                                                */
1521 +#define LLC_STATE_RPT_REMOTE_BUSY      0x4A    /* REPORT_STATUS. REMOTE_BUSY.
1522 +                                                * The remote LLC DSAP is busy.
1523 +                                                * The local connection service
1524 +                                                * component will not accept a
1525 +                                                * DATA_REQUEST.
1526 +                                                */
1527 +#define LLC_STATE_RPT_REMOTE_NOT_BUSY  0x4B    /* REPORT_STATUS. 
1528 +                                                * REMOTE_NOT_BUSY. The remote
1529 +                                                * LLC DSAP is no longer busy.
1530 +                                                * The local connection service
1531 +                                                * component will now accept a
1532 +                                                * DATA_REQUEST.
1533 +                                                */
1534 +#define LLC_STATE_IF_F_1_CLEAR_REMOTE_BUSY 0x4C        /* IF_F=1_CLEAR_REMOTE_BUSY. If
1535 +                                                * the I PDU is a response with
1536 +                                                * the F bit set to "1" in
1537 +                                                * response to a command PDU 
1538 +                                                * with the P bit set to "1",
1539 +                                                * then perform the 
1540 +                                                * CLEAR_REMOTE_BUSY action.
1541 +                                                */
1542 +#define LLC_STATE_IF_DATA_FLAG_2_STOP_REJ_TIMER 0x4D /* 
1543 +                                                * IF_DATA_FLAG=2_STOP_REJ_TIMER
1544 +                                                * If DATA_FLAG has a value of
1545 +                                                * two, indicating that a REJ
1546 +                                                * PDU has been sent, stop the
1547 +                                                * "sent REJ" timer.
1548 +                                                */
1549 +#define LLC_STATE_SEND_DISC_CMD                0x4E    /* SEND_DISC_CMD(P=X). Transmit
1550 +                                                * a DISC command PDU with the
1551 +                                                * P bit set to "X" to the 
1552 +                                                * remote LLC DSAP.
1553 +                                                */
1554 +#define LLC_STATE_SEND_DM_RSP          0x4F    /* SEND_DM_RSP(F=X). Send a DM
1555 +                                                * response PDU with the F bit
1556 +                                                * set to "X" to the remote LLC
1557 +                                                * DSAP.
1558 +                                                */
1559 +#define LLC_STATE_SEND_FRMR_RSP                0x50    /* SEND_FRMR_RSP(F=X). Send a
1560 +                                                * FRMR response PDU with the F
1561 +                                                * bit set to "X" to the remote
1562 +                                                * LLC DSAP.
1563 +                                                */
1564 +#define LLC_STATE_RESEND_FRMR_RSP_0    0x51    /* RE-SEND_FRMR_RSP(F=0). Send
1565 +                                                * the same FRMR response PDU
1566 +                                                * with the same information
1567 +                                                * field as sent earlier to the
1568 +                                                * remote LLC DSAP. Set the F
1569 +                                                * bit to "0".
1570 +                                                */
1571 +#define LLC_STATE_RESEND_FRMR_RSP_P    0x52    /* RE-SEND_FRMR_RSP(F=P). Send
1572 +                                                * the same FRMR response PDU
1573 +                                                * with the same information
1574 +                                                * field as sent earlier to the
1575 +                                                * remote LLC DSAP. Set the F
1576 +                                                * bit equal to the P bit of the
1577 +                                                * received command PDU.
1578 +                                                */
1579 +#define LLC_STATE_SEND_I_CMD           0x53    /* SEND_I_CMD(P=1). Send an I
1580 +                                                * command PDU with the P bit
1581 +                                                * set to "1" to the remote LLC
1582 +                                                * DSAP with the data unit
1583 +                                                * supplied by the user with the
1584 +                                                * DATA_REQUEST. Before 
1585 +                                                * transmission, copy the 
1586 +                                                * current values of the send
1587 +                                                * state variable V(S) and the
1588 +                                                * receive state variable V(R)
1589 +                                                * into the N(S) and N(R)
1590 +                                                * fields, respectively, of the
1591 +                                                * I PDU and increment (modulo 
1592 +                                                * 128) the send state variable
1593 +                                                * V(S).
1594 +                                                */
1595 +#define LLC_STATE_RESEND_I_CMD         0x54    /* RE-SEND_I_CMD(P=1). Start
1596 +                                                * resending all the 
1597 +                                                * unacknowledged I PDUs for 
1598 +                                                * this data link connection
1599 +                                                * begining with the N(R) given
1600 +                                                * in the received PDU. Send the
1601 +                                                * first as a command with the P
1602 +                                                * bit set to "1". If the queue
1603 +                                                * contains more than one I PDU,
1604 +                                                * the balance must be sent as
1605 +                                                * commands with the P bit set
1606 +                                                * to "0", or as response with
1607 +                                                * the F bit set to "0".
1608 +                                                */
1609 +#define LLC_STATE_RESEND_I_CMD_OR_SEND_RR 0x55 /* RE-SEND_I_CMD(P=I)_OR_SEND_RR
1610 +                                                * Start resending all the
1611 +                                                * unacknowledged I PDUs for
1612 +                                                 * this data link connection
1613 +                                                 * begining with the N(R) given
1614 +                                                 * in the received PDU. Send the                                                 * first as a command with the P                                                 * bit set to "1". If the queue
1615 +                                                 * contains more than one I PDU,                                                 * the balance must be sent as
1616 +                                                 * commands with the P bit set
1617 +                                                 * to "0", or as response with
1618 +                                                 * the F bit set to "0". It is
1619 +                                                * permissable to send a RR
1620 +                                                * command PDU with the P bit
1621 +                                                * set to "0", or as a response
1622 +                                                * with the F bit set to "0". If
1623 +                                                * no I PDU is ready to send, a                                                  * RR command PDU with the P bit
1624 +                                                * set to "1" must be sent to
1625 +                                                * the remote LLC DSAP.
1626 +                                                */
1627 +#define LLC_STATE_SEND_I_XXX           0x56    /* SEND_I_XXX(X=0). Send either
1628 +                                                * an I response PDU with the
1629 +                                                * F bit set to "0" or an I
1630 +                                                * command PDU with the P bit
1631 +                                                * set to "0" to the remote LLC
1632 +                                                * DSAP with the data unit
1633 +                                                * supplied by the user with the
1634 +                                                * DATA_REQUEST. Before 
1635 +                                                * transmission, copy the
1636 +                                                * current values of the send
1637 +                                                * state variable V(S) and the
1638 +                                                * receive state variable V(R)
1639 +                                                * into the N(S) and N(R) fields
1640 +                                                * respectively, of the I PDU
1641 +                                                * and increment (modulo 128)
1642 +                                                * the send state variable V(S).
1643 +                                                */
1644 +#define LLC_STATE_RESEND_I_XXX         0x57    /* RE-SEND_I_XXX(X=0). Start
1645 +                                                * resending all the 
1646 +                                                * unacknowledged I PDUs for
1647 +                                                * this data link connection
1648 +                                                * begining with the N(R) given
1649 +                                                * in the received PDU. They
1650 +                                                * must be sent as either 
1651 +                                                * commands with the P bit set 
1652 +                                                * to "0" or as responses with 
1653 +                                                * the F bit set to "0".
1654 +                                                */
1655 +#define LLC_STATE_RESEND_I_XXX_OR_SEND_RR 0x58 /* RE-SEND_I_XXX(X=0)_OR_SEND_RR
1656 +                                                * Start resending all the
1657 +                                                 * unacknowledged I PDUs for
1658 +                                                 * this data link connection
1659 +                                                 * begining with the N(R) given
1660 +                                                 * in the received PDU. They
1661 +                                                 * must be sent as either
1662 +                                                 * commands with the P bit set
1663 +                                                 * to "0" or as responses with
1664 +                                                 * the F bit set to "0". It is
1665 +                                                * permissable to send either
1666 +                                                * a RR response PDU with the
1667 +                                                * F bit set to "0" or a RR
1668 +                                                * command PDU with the P bit
1669 +                                                * set to "0" to the remote
1670 +                                                * LLC DSAP before starting the
1671 +                                                * resending of the I PDUs. If
1672 +                                                * no I PDU is ready to send,
1673 +                                                * either an RR response PDU
1674 +                                                * with the F bit set to "0" or
1675 +                                                * an RR command PDU with the P
1676 +                                                * bit set to "0" must be sent
1677 +                                                * to the remote LLC DSAP.
1678 +                                                */
1679 +#define LLC_STATE_RESEND_I_RSP         0x59    /* RE-SEND_I_RSP(F=1). Start
1680 +                                                * resending all the
1681 +                                                * unacknowledged I PDUs for
1682 +                                                * this data link connection
1683 +                                                * begining with the N(R) given
1684 +                                                * in the received PDU. Send the
1685 +                                                * first as a response with the
1686 +                                                * F bit set to "1". If the
1687 +                                                * queue contains more than one
1688 +                                                * I PDU, the balance must be
1689 +                                                * transmitted as commands with
1690 +                                                * the P bit set to "0" or as
1691 +                                                * responses with the F bit set
1692 +                                                * to "0".
1693 +                                                */
1694 +#define LLC_STATE_SEND_REJ_CMD         0x5A    /* SEND_REJ_CMD(P=1). Send a REJ
1695 +                                                * command PDU with the P bit
1696 +                                                * set to "1" to the remote LLC
1697 +                                                * DSAP.
1698 +                                                */
1699 +#define LLC_STATE_SEND_REJ_RSP         0x5B    /* SEND_REJ_RSP(F=1). Send a REJ
1700 +                                                * response PDU with the F bit
1701 +                                                * set to "1" to the remote LLC
1702 +                                                * DSAP.
1703 +                                                */
1704 +#define LLC_STATE_SEND_REJ_XXX         0x5C    /* SEND_REJ_XXX(X=0). Send
1705 +                                                * either a REJ response PDU
1706 +                                                * with the F bit set to "0" or
1707 +                                                * a REJ command PDU with the P
1708 +                                                * bit set to "0" to the remote
1709 +                                                * LLC DSAP.
1710 +                                                */
1711 +#define LLC_STATE_SEND_RNR_CMD         0x5D    /* SEND_RNR_CMD(P=1). Send a RNR
1712 +                                                * command PDU with the P bit
1713 +                                                * set to "1" to the remote LLC
1714 +                                                * DSAP.
1715 +                                                */
1716 +#define LLC_STATE_SEND_RNR_RSP         0x5E    /* SEND_RNR_RSP(F=I). Send a RNR
1717 +                                                * response PDU with the F bit
1718 +                                                * set to "1"  to the remote LLC
1719 +                                                * DSAP.
1720 +                                                */
1721 +#define LLC_STATE_SEND_RNR_XXX         0x5F    /* SEND_RNR_XXX(X=0). Send
1722 +                                                * either a RNR response PDU 
1723 +                                                * with the F bit set to "0" or
1724 +                                                * a RNR command PDU with the P
1725 +                                                * bit set to "0" to the remote
1726 +                                                * LLC DSAP.
1727 +                                                */
1728 +#define LLC_STATE_SET_REMOTE_BUSY      0x60    /* SET_REMOTE_BUSY. If 
1729 +                                                * REMOTE_BUSY is zero, then set
1730 +                                                * REMOTE_BUSY to one to 
1731 +                                                * indicate the remote LLC is in
1732 +                                                * the busy state and is no able
1733 +                                                * to accept I PDUs, start the
1734 +                                                * BUSY timer, inform the 
1735 +                                                * sublayer management function
1736 +                                                * by using REPORT_STATUS(
1737 +                                                * REMOTE_BUSY) and stop any
1738 +                                                * (re)sending of I PDUs that is
1739 +                                                * in progess.
1740 +                                                */
1741 +#define LLC_STATE_OPTIONAL_SEND_RNR_XXX        0x61    /* OPTIONAL_SEND_RNR_XXX(X=0).
1742 +                                                * It is permissible to send a
1743 +                                                * RNR command PDU with the P
1744 +                                                * bit set to "0" or a RNR
1745 +                                                * response PDU with the
1746 +                                                * F bit set to "0" to the 
1747 +                                                * remote LLC DSAP in case the
1748 +                                                * remote LLC did no receive the
1749 +                                                * first RNR sent when the busy
1750 +                                                * state was entered.
1751 +                                                */
1752 +#define LLC_STATE_SEND_RR_CMD          0x62    /* SEND_RR_CMD(P=1). Send a RR
1753 +                                                * command PDU with the P bit
1754 +                                                * set to "1" to the remote LLC
1755 +                                                * DSAP.
1756 +                                                */
1757 +#define LLC_STATE_SEND_ACKNOWLEDGE_CMD 0x63    /* SEND_ACKNOWLEDGE_CMD(P=1).
1758 +                                                * Under all conditions it is
1759 +                                                * permissible to send a RR
1760 +                                                * command PDU with the P bit
1761 +                                                * set to "1" to the remote LLC
1762 +                                                * DSAP. If no I PDU is ready to
1763 +                                                * send, the RR command PDU with
1764 +                                                * the P bit set to "1" must be
1765 +                                                * sent to the remote LLC DSAP.
1766 +                                                * (This RR PDU may be delayed
1767 +                                                * by a time bounded by the
1768 +                                                * ACK_TIMER value, to wait for
1769 +                                                * the generation of an I PDU.)
1770 +                                                * However, if an I PDU is ready
1771 +                                                * send, and can be modified to
1772 +                                                * a command with the P bit set
1773 +                                                * to "1", then the RR command
1774 +                                                * PDU does not need to be sent.
1775 +                                                */
1776 +#define LLC_STATE_SEND_RR_RSP          0x64    /* SEND_RR_RSP(F=I). Send a RR
1777 +                                                * response PDU with the F bit
1778 +                                                * set to "1" to the remote LLC
1779 +                                                * DSAP.
1780 +                                                */
1781 +#define LLC_STATE_SEND_ACKNOWLEDGE_RSP 0x65    /* SEND_ACKNOWLEDGE_RSP(F=I).
1782 +                                                * Under all conditions it is
1783 +                                                * permissible to send a RR 
1784 +                                                * response PDU with the F bit
1785 +                                                * set to "1" to the remote LLC
1786 +                                                * DSAP. If no I PDU is ready to
1787 +                                                * send, the RR response PDU 
1788 +                                                * with the F bit set to "1" 
1789 +                                                * must be sent to the remote
1790 +                                                * LLC DSAP. However, if an I 
1791 +                                                * PDU is ready to send, and can
1792 +                                                * be modified to a response 
1793 +                                                * with the F bit set to "1," 
1794 +                                                * then the RR response PDU does
1795 +                                                * not need to be sent.
1796 +                                                */
1797 +#define LLC_STATE_SEND_RR_XXX          0x66    /* SEND_RR_XXX(X=0). Send either
1798 +                                                * a RR response PDU with the F
1799 +                                                * bit set to "0" or a RR 
1800 +                                                * command PDU with the P bit
1801 +                                                * set to "0" to the remote LLC
1802 +                                                * DSAP.
1803 +                                                */
1804 +#define LLC_STATE_SEND_ACKNOWLEDGE_XXX 0x67    /* SEND_ACKNOWLEDGE_XXX(X=0).
1805 +                                                * Under all conditions it is
1806 +                                                * permissible to send either a
1807 +                                                * RR response PDU with the F
1808 +                                                * bit set to "0" or a RR 
1809 +                                                * command PDU with the P bit
1810 +                                                * set to "0" to the remote LLC
1811 +                                                * DSAP. If no I PDU is ready to
1812 +                                                * send, either an RR response
1813 +                                                * with the F bit set to "0" or
1814 +                                                * an RR command PDU with the P
1815 +                                                * bit set to "0" must be sent 
1816 +                                                * to the remote LLC DSAP. (This
1817 +                                                * RR PDU may be delayed, by a
1818 +                                                * time bounded by the ACK_TIMER
1819 +                                                * value, to wait for the
1820 +                                                * generation of an I PDU.)
1821 +                                                * However, if an I PDU is ready
1822 +                                                * to send, then the RR PDU does
1823 +                                                * not need to be sent.
1824 +                                                */
1825 +#define LLC_STATE_SEND_SABME_CMD       0x68    /* SEND_SABME_CMD(P=X). Send a
1826 +                                                * SABME command PDU with the P
1827 +                                                * bit set to "X" to the remote
1828 +                                                * LLC DSAP.
1829 +                                                */
1830 +#define LLC_STATE_SEND_UA_RSP          0x69    /* SEND_UA_RSP(F=X). Send a UA
1831 +                                                * response PDU with the F bit
1832 +                                                * set to "X" to the remote LLC
1833 +                                                * DSAP.
1834 +                                                */
1835 +#define LLC_STATE_S_FLAG_0             0x6A    /* S_FLAG:=0. Set S_FLAG to zero
1836 +                                                * to indicate that a SABME PDU
1837 +                                                * has not been received from
1838 +                                                * the remote LLC while the
1839 +                                                * local connection service
1840 +                                                * component is in the RESET,
1841 +                                                * SETUP, or RESET_WAIT state.
1842 +                                                */
1843 +#define LLC_STATE_S_FLAG_1             0x6B    /* S_FLAG:=1. Set S_FLAG to one
1844 +                                                * to indicate that a SABME PDU
1845 +                                                * has been received from the
1846 +                                                * remote LLC while the local
1847 +                                                * connection service component
1848 +                                                * is in the RESET, SETUP, or
1849 +                                                * RESET_WAIT state.
1850 +                                                */
1851 +#define LLC_STATE_START_P_TIMER                0x6C    /* START_P_TIMER. Start the P/F
1852 +                                                * cycle timer from zero; if the
1853 +                                                * P_FLAG is zero, initialize
1854 +                                                * RETRY_COUNT to zero, and set
1855 +                                                * P_FLAG to one.
1856 +                                                */
1857 +#define LLC_STATE_START_ACK_TIMER      0x6D    /* START_ACK_TIMER. Start the
1858 +                                                * acknowledgment timer from
1859 +                                                * zero.
1860 +                                                */
1861 +#define LLC_STATE_START_REJ_TIMER      0x6E    /* START_REJ_TIMER. Start the
1862 +                                                * "sent REJ" timer from zero.
1863 +                                                */
1864 +#define LLC_STATE_START_ACK_TIMER_IF_NOT_RUNNING 0x6F
1865 +                                               /* START_ACK_TIMER_IF_NOT_
1866 +                                                * RUNNING. If the 
1867 +                                                * acknowledgment timer is not
1868 +                                                * currently running, then start
1869 +                                                * the acknowledgment timer from
1870 +                                                * zero.
1871 +                                                */
1872 +#define LLC_STATE_STOP_ACK_TIMER       0x6F    /* STOP_ACK_TIMER. Stop the
1873 +                                                * acknowledgment timer.
1874 +                                                */
1875 +#define LLC_STATE_STOP_P_TIMER         0x70    /* STOP_P_TIMER. Stop the P/F
1876 +                                                * cycle timer and set P_FLAG
1877 +                                                * to zero.
1878 +                                                */
1879 +#define LLC_STATE_STOP_REJ_TIMER       0x71    /* STOP_REJ_TIMER. Stop the
1880 +                                                * "sent REJ" timer.
1881 +                                                */
1882 +#define LLC_STATE_STOP_ALL_TIMERS      0x72    /* STOP_ALL_TIMERS. Stop the
1883 +                                                * P/F cycle timer, the "sent
1884 +                                                * REJ" timer, the remote-busy
1885 +                                                * timer, and the acknowledgment
1886 +                                                * timer.
1887 +                                                */
1888 +#define LLC_STATE_STOP_OTHER_TIMERS    0x73    /* STOP_OTHER_TIMERS. Stop the
1889 +                                                * P/F cycle timer, the "sent
1890 +                                                * REJ" timer, and the remote-
1891 +                                                * busy timer.
1892 +                                                */
1893 +#define LLC_STATE_UPDATE_SEQ_RECEIVED  0x74    /* UPDATE_N(R)_RECEIVED. If the
1894 +                                                * N(R) of the received PDU
1895 +                                                * acknowledges the receipt of
1896 +                                                * one or more previously
1897 +                                                * unacknowledged I PDUs, update
1898 +                                                * the local record of 
1899 +                                                * N(R)_RECEIVED, set 
1900 +                                                * RETRY_COUNT to zero, and stop
1901 +                                                * the acknowledgment timer. If
1902 +                                                * unacknowledged I PDUs still
1903 +                                                * exist, start the 
1904 +                                                * acknowledgment timer if it
1905 +                                                * was stopped.
1906 +                                                */
1907 +#define LLC_STATE_UPDATE_P_FLAG                0x75    /* UPDATE_P_FLAG. If the 
1908 +                                                * received PDU was a response
1909 +                                                * with the F bit set to "1",
1910 +                                                * set the P_FLAG to zero and
1911 +                                                * stop the P/F cycle timer.
1912 +                                                */
1913 +#define LLC_STATE_DATA_FLAG_0          0x76    /* DATA_FLAG:=0. Set the 
1914 +                                                * DATA_FLAG to zero to indicate
1915 +                                                * that the data units from
1916 +                                                * received I PDUs were not
1917 +                                                * discarded during a local busy
1918 +                                                * period.
1919 +                                                */
1920 +#define LLC_STATE_DATA_FLAG_1          0x77    /* DATA_FLAG:=1. Set the 
1921 +                                                * DATA_FLAG to one to indicate
1922 +                                                * that the data units from
1923 +                                                * receieved I PDUs were 
1924 +                                                * discarded during a local busy
1925 +                                                * period.
1926 +                                                */
1927 +#define LLC_STATE_DATA_FLAG_2          0x78    /* DATA_FLAG:=2. Set the
1928 +                                                * DATA_FLAG to two to record
1929 +                                                * that the BUSY state was 
1930 +                                                * entered with a REJ PDU
1931 +                                                * outstanding.
1932 +                                                */
1933 +#define LLC_STATE_DATA_FLAG_0_THEN_DATA_FLAG_1 0x79
1934 +                                               /* DATA_FLAG=0_THEN_DATA_FLAG:=1
1935 +                                                * If the DATA_FLAG had been
1936 +                                                * zero, indicating that no data
1937 +                                                * units had been discarded, set
1938 +                                                * it to one to indicate that
1939 +                                                * data units have now been
1940 +                                                * discarded.
1941 +                                                */
1942 +#define LLC_STATE_P_FLAG_0             0x7A    /* P_FLAG:=0. Initialize the
1943 +                                                * P_FLAG to zero. This 
1944 +                                                * indicates that the reception
1945 +                                                * of a response PDU with the F
1946 +                                                * bit set to "1" is not 
1947 +                                                * expected.
1948 +                                                */
1949 +#define LLC_STATE_P_FLAG_P             0x7B    /* P_FLAG:=P. Set the P_FLAG to
1950 +                                                * the value of the P bit in the
1951 +                                                * command PDU being sent.
1952 +                                                */
1953 +#define LLC_STATE_REMOTE_BUSY_0                0x7C    /* REMOTE_BUSY:=0. Set 
1954 +                                                * REMOTE_BUSY to zero to 
1955 +                                                * indicate that the remote LLC
1956 +                                                * is avle to accept I PDUs.
1957 +                                                */
1958 +#define LLC_STATE_RETRY_COUNT_0                0x7D    /* RETRY_COUNT:=0. Initialize
1959 +                                                * RETRY_COUNT to zero.
1960 +                                                */
1961 +#define LLC_STATE_RETRY_COUNT_PLUS_1   0x7E    /* RETRY_COUNT:=RETRY_COUNT+1.
1962 +                                                * Increment RETRY_COUNT by one.
1963 +                                                */
1964 +#define LLC_STATE_RECEIVE_SEQ_0                0x7F    /* V(R):=0. Initialize the 
1965 +                                                * receive state variable. This
1966 +                                                * is the expected sequence
1967 +                                                * number of the next I PDU
1968 +                                                * received.
1969 +                                                */
1970 +#define LLC_STATE_RECEIVE_SEQ_PLUS_1   0x80    /* V(R):=V(R)+1. Increment
1971 +                                                * (modulo 128) the receive
1972 +                                                * state variable. This is the
1973 +                                                * expected sequence number of 
1974 +                                                * the next I PDU received.
1975 +                                                */
1976 +#define LLC_STATE_SEND_SEQ_0           0x81    /* V(S):=0. Initialize the send
1977 +                                                * state variable. This is the
1978 +                                                * sequence number of the next
1979 +                                                * I PDU to be sent.
1980 +                                                */
1981 +#define LLC_STATE_SEND_SEQ_TO_RECEIVE_PDU 0x82 /* V(S):=N(R). Reset the send
1982 +                                                * state variable to the value
1983 +                                                * specified by the N(R) field
1984 +                                                * of the PDU just received.
1985 +                                                */
1986 +#define LLC_STATE_F_FLAG_P             0x83    /* F_FLAG:=P. Set the F_FLAG to
1987 +                                                * the value of the P bit
1988 +                                                * received. This is the value
1989 +                                                * of the F bit to be sent in
1990 +                                                * UA or DM PDUs.
1991 +                                                */
1992 +#define LLC_STATE_SEND_I_RSP           0x84
1993 +#define LLC_STATE_DISCONNECT_RESPONSE  0x85
1994 +#define LLC_STATE_SEND_RR_RESPONSE     0x86
1995 +#define LLC_STATE_SEND_RR_REQUEST      0x87
1996 +#define LLC_STATE_SEND_REJ_REQUEST     0x88
1997 +#define LLC_STATE_SEND_REJ_RESPONSE    0x89
1998 +#define LLC_STATE_SEND_RNR_REQUEST     0x8A
1999 +#define LLC_STATE_SEND_RNR_RESPONSE    0x8B
2000 +#define LLC_STATE_SEND_DM_RESPONSE     0x8C
2001 +#define LLC_STATE_SEND_UA_RESPONSE     0x8D
2002 +#define LLC_STATE_SEND_NULL_DSAP_TEST_R        0x8E
2003  
2004 -void           llc_cancel_timers(llcptr lp);
2005 -int            llc_decode_frametype(frameptr fr);
2006 -llcptr                 llc_find(void);
2007 -int            llc_free_acknowledged_skbs(llcptr lp, unsigned char ack);
2008 -void           llc_handle_xid_indication( char *chsp, short int ll, char *xid_data);
2009 -void           llc_interpret_pseudo_code(llcptr lp, int pc_label, struct sk_buff *skb, char type);
2010 -void           llc_add_to_queue(struct sk_buff *skb, struct sk_buff **f, struct sk_buff **b);
2011 -void           llc_process_otype2_frame(llcptr lp, struct sk_buff *skb, char type);
2012 -struct sk_buff *llc_pull_from_atq(llcptr lp); 
2013 -int            llc_resend_ipdu(llcptr lp, unsigned char ack_nr, unsigned char type, char p);
2014 -void           llc_sendpdu(llcptr lp, char type, char pf, int data_len, char *pdu_data);
2015 -void           llc_sendipdu(llcptr lp, char type, char pf, struct sk_buff *skb);
2016 -void           llc_start_timer(llcptr lp, int t);
2017 -void           llc_stop_timer(llcptr lp, int t);
2018 -void           llc_timer_expired(llcptr lp, int t);
2019 -int            llc_validate_seq_nos(llcptr lp, frameptr fr);
2020 -
2021 -int            llc_data_request(llcptr lp, struct sk_buff *skb);
2022 -void           llc_unit_data_request(llcptr lp, int ll, char * data);
2023 -void           llc_disconnect_request(llcptr lp);
2024 -void           llc_connect_request(llcptr lp);
2025 -void           llc_xid_request(llcptr lp, char opt, int data_len, char *pdu_data);
2026 -void           llc_test_request(llcptr lp, int data_len, char *pdu_data);
2027 -
2028 -int            register_cl2llc_client(llcptr llc, const char *device, void (*ops)(llcptr), u8 *rmac, u8 ssap, u8 dsap);
2029 -void           unregister_cl2llc_client(llcptr lp);
2030 -int            llc_mac_data_indicate(llcptr lp, struct sk_buff *skb );
2031 +extern int llc_queue_xmit(struct sk_buff *skb);
2032 +extern struct datalink_proto *register_8022_client(unsigned char type,
2033 +        int (*rcvfunc)(struct sk_buff*,struct device*,struct packet_type*),
2034 +        int (*msgrcvfunc)(int rsp, struct sk_buff *));
2035 +extern void unregister_8022_client(unsigned char type);
2036 +extern int llc_connect(struct datalink_proto *dl, struct device *dev,
2037 +        __u8 *dmac, __u8 dsap, int rsp);
2038 +extern int llc_reset(struct datalink_proto *dl, struct device *dev,
2039 +        __u8 *dmac, __u8 dsap, int rsp);
2040 +extern int llc_disconnect(struct datalink_proto *dl, struct device *dev,
2041 +        __u8 *dmac, __u8 dsap, int rsp);
2042 +extern int llc_decode_pdu(llchdr *llc);
2043 +extern int llc_data(__u8 ssap, __u8 dsap, __u8 *dmac,
2044 +        struct sk_buff *skb, struct device *dev);
2045 +extern int llc_test(__u8 ssap, __u8 dsap, __u8 *dmac,
2046 +        struct sk_buff *skb, struct device *dev);
2047  
2048 +#endif /* __NET_LLC_H */
2049 diff -uNr linux/include/net/llc_frame.h linux-llc/include/net/llc_frame.h
2050 --- linux/include/net/llc_frame.h       Thu Dec 12 14:54:21 1996
2051 +++ linux-llc/include/net/llc_frame.h   Thu Jan  1 01:00:00 1970
2052 @@ -1,98 +0,0 @@
2053 -/* if_ether.h needed for definition of ETH_DATA_LEN and ETH_ALEN
2054 - */
2055 -#include "linux/if_ether.h"
2056 -
2057 -/* frame layout based on par3.2 "LLC PDU format"
2058 - */
2059 -typedef union {                        /* pdu layout from pages 40 & 44 */
2060 -    struct {                   /* general header, all pdu types */
2061 -       unsigned dsap : 8;      /* dest service access point */
2062 -       unsigned ssap : 8;      /* source service access point */
2063 -       unsigned f1 : 1;        /* I- U- or S- format id bits */
2064 -       unsigned f2 : 1;
2065 -       unsigned : 6;
2066 -       unsigned : 8;
2067 -   } pdu_hdr;
2068 -   struct {
2069 -        char dummy1[2];        /* dsap + ssap */
2070 -       char byte1;
2071 -       char byte2;
2072 -   } pdu_cntl;                 /* unformatted control bytes */
2073 -   struct {                    /* header of an Information pdu */
2074 -       unsigned char dummy2[2];
2075 -       unsigned : 1;
2076 -       unsigned ns : 7;
2077 -       unsigned i_pflag : 1;   /* poll/final bit */
2078 -       unsigned nr : 7;        /* N(R)  */     
2079 -       unsigned char is_info[ ETH_DATA_LEN ];
2080 -   }  i_hdr;
2081 -   struct {                    /* header of a Supervisory pdu */
2082 -       unsigned char dummy3[2];
2083 -       unsigned : 2;
2084 -       unsigned ss : 2;        /* supervisory function bits */
2085 -       unsigned : 4;
2086 -       unsigned s_pflag : 1;   /* poll/final bit  */
2087 -       unsigned nr : 7;        /* N(R)  */
2088 -   } s_hdr;
2089 -
2090 -/* when accessing the P/F bit or the N(R) field there's no need to distinguish
2091 -   I pdus from S pdus i_pflag and s_pflag / i_nr and s_nr map to the same
2092 -   physical location.
2093 - */ 
2094 -   struct {                    /* header of an Unnumbered pdu */
2095 -       unsigned char dummy4[2];
2096 -       unsigned : 2;
2097 -       unsigned mm1 : 2;       /* modifier function part1 */
2098 -       unsigned u_pflag : 1;    /* P/F for U- pdus */
2099 -       unsigned mm2 : 3;       /* modifier function part2 */
2100 -       unsigned char u_info[ ETH_DATA_LEN-1];
2101 -   } u_hdr;
2102 -   struct {                    /* mm field in an Unnumbered pdu */
2103 -       unsigned char dummy5[2];
2104 -       unsigned : 2;
2105 -       unsigned mm : 6;        /* must be masked to get ridd of P/F !  */
2106 -   } u_mm;
2107 -        
2108 -} frame_type, *frameptr;
2109 -
2110 -/* frame format test macros: */
2111 -
2112 -#define IS_UFRAME( fr ) ( ( (fr)->pdu_hdr.f1) & ( (fr)->pdu_hdr.f2) )
2113 -
2114 -#define IS_IFRAME( fr ) ( !( (fr)->pdu_hdr.f1) )
2115 -
2116 -#define IS_SFRAME( fr ) ( ( (fr)->pdu_hdr.f1) & !( (fr)->pdu_hdr.f2) )
2117 -
2118 -#define IS_RSP( fr ) ( fr->pdu_hdr.ssap & 0x01 )
2119 -
2120 -
2121 -/* The transition table, the _encode tables and some tests in the
2122 -   source code depend on the numeric order of these values.
2123 -   Think twice before changing.
2124 - */
2125 -
2126 -/* frame names for TYPE 2 operation: */
2127 -#define I_CMD          0
2128 -#define RR_CMD         1
2129 -#define RNR_CMD                2
2130 -#define REJ_CMD                3
2131 -#define DISC_CMD       4
2132 -#define SABME_CMD      5
2133 -#define I_RSP          6
2134 -#define RR_RSP         7
2135 -#define RNR_RSP                8
2136 -#define REJ_RSP                9
2137 -#define UA_RSP         10
2138 -#define DM_RSP         11
2139 -#define FRMR_RSP       12
2140 -
2141 -/* junk frame name: */
2142 -#define BAD_FRAME      13
2143 -#define NO_FRAME       13
2144 -
2145 -/* frame names for TYPE 1 operation: */
2146 -#define UI_CMD         14
2147 -#define XID_CMD                15
2148 -#define TEST_CMD       16
2149 -#define XID_RSP                17
2150 -#define TEST_RSP       18
2151 diff -uNr linux/include/net/llc_name.h linux-llc/include/net/llc_name.h
2152 --- linux/include/net/llc_name.h        Thu Dec 12 14:54:21 1996
2153 +++ linux-llc/include/net/llc_name.h    Thu Jan  1 01:00:00 1970
2154 @@ -1,7 +0,0 @@
2155 -char *frame_names[] =
2156 -    {"I_CMD","RR_CMD","RNR_CMD","REJ_CMD","DISC_CMD",
2157 -    "SABME_CMD","I_RSP","RR_RSP","RNR_RSP","REJ_RSP",
2158 -    "UA_RSP","DM_RSP","FRMR_RSP","BAD_FRAME","UI_CMD",
2159 -    "XID_CMD","TEST_CMD","XID_RSP","TEST_RSP"
2160 -};
2161
2162 diff -uNr linux/include/net/llc_state.h linux-llc/include/net/llc_state.h
2163 --- linux/include/net/llc_state.h       Thu Dec 12 14:54:21 1996
2164 +++ linux-llc/include/net/llc_state.h   Thu Jan  1 01:00:00 1970
2165 @@ -1,4 +0,0 @@
2166 -char *state_names[] = { 
2167 -       "ADM","CONN","RESET_WAIT","RESET_CHECK","SETUP",
2168 -       "RESET","D_CONN","ERROR","NORMAL"
2169 -};
2170 diff -uNr linux/include/net/llccall.h linux-llc/include/net/llccall.h
2171 --- linux/include/net/llccall.h Thu Dec 12 14:54:21 1996
2172 +++ linux-llc/include/net/llccall.h     Mon Sep 25 06:47:02 2000
2173 @@ -1,3 +1,2 @@
2174  /* Separate to keep compilation of protocols.c simpler */
2175 -extern void llc_init(struct net_proto *pro);
2176 -
2177 +extern void llc_proto_init(struct net_proto *);
2178 diff -uNr linux/include/net/p8022.h linux-llc/include/net/p8022.h
2179 --- linux/include/net/p8022.h   Mon Mar 25 06:58:22 1996
2180 +++ linux-llc/include/net/p8022.h       Thu Jan  1 01:00:00 1970
2181 @@ -1,7 +0,0 @@
2182 -#ifndef _NET_P8022_H
2183 -#define _NET_P8022_H
2184 -
2185 -extern struct datalink_proto *register_8022_client(unsigned char type, int (*rcvfunc)(struct sk_buff *, struct device *, struct packet_type *));
2186 -extern void unregister_8022_client(unsigned char type);
2187 -
2188 -#endif
2189 diff -uNr linux/include/net/p8023.h linux-llc/include/net/p8023.h
2190 --- linux/include/net/p8023.h   Thu Jan  1 01:00:00 1970
2191 +++ linux-llc/include/net/p8023.h       Mon Sep 25 06:47:27 2000
2192 @@ -0,0 +1,2 @@
2193 +extern struct datalink_proto *make_8023_client(void);
2194 +extern void destroy_8023_client(struct datalink_proto *);
2195 diff -uNr linux/include/net/sock.h linux-llc/include/net/sock.h
2196 --- linux/include/net/sock.h    Fri Jun 23 11:13:52 2000
2197 +++ linux-llc/include/net/sock.h        Mon Sep 25 07:21:08 2000
2198 @@ -461,6 +461,11 @@
2199         struct sk_filter        *filter;
2200  #endif /* CONFIG_FILTER */
2201  
2202 +#if defined(CONFIG_LLC_UI) || defined(CONFIG_LLC_UI_MODULE)
2203 +        __u8                    sap;
2204 +        struct datalink_proto   *llc_proto;
2205 +#endif
2206 +
2207         /* This is where all the private (optional) areas that don't
2208          * overlap will eventually live. 
2209          */
2210 diff -uNr linux/net/802/Makefile linux-llc/net/802/Makefile
2211 --- linux/net/802/Makefile      Thu Aug 26 01:29:53 1999
2212 +++ linux-llc/net/802/Makefile  Thu Jan  1 01:00:00 1970
2213 @@ -1,60 +0,0 @@
2214 -#
2215 -# Makefile for the Linux 802.x protocol layers.
2216 -#
2217 -# Note! Dependencies are done automagically by 'make dep', which also
2218 -# removes any old dependencies. DON'T put your own dependencies here
2219 -# unless it's something special (ie not a .c file).
2220 -#
2221 -# Note 2! The CFLAGS definition is now in the main makefile...
2222 -
2223 -O_TARGET := 802.o
2224 -O_OBJS   = p8023.o
2225 -
2226 -ifeq ($(CONFIG_SYSCTL),y)
2227 -O_OBJS += sysctl_net_802.o
2228 -endif
2229 -
2230 -ifeq ($(CONFIG_LLC),y)
2231 -SUB_DIRS += transit
2232 -O_OBJS += llc_sendpdu.o llc_utility.o cl2llc.o
2233 -OX_OBJS += llc_macinit.o
2234 -SNAP = y
2235 -endif
2236 -
2237 -ifdef CONFIG_TR
2238 -O_OBJS += tr.o
2239 -       SNAP=y
2240 -endif
2241 -
2242 -ifdef CONFIG_NET_FC
2243 -O_OBJS += fc.o
2244 -endif
2245 -
2246 -ifdef CONFIG_FDDI
2247 -O_OBJS += fddi.o
2248 -endif
2249 -
2250 -ifdef CONFIG_HIPPI
2251 -O_OBJS += hippi.o
2252 -endif
2253 -
2254 -ifdef CONFIG_IPX
2255 -       SNAP=y
2256 -endif
2257 -
2258 -ifdef CONFIG_ATALK
2259 -       SNAP=y
2260 -endif
2261 -
2262 -ifeq ($(SNAP),y)
2263 -OX_OBJS += p8022.o psnap.o
2264 -endif
2265 -
2266 -
2267 -include $(TOPDIR)/Rules.make
2268 -
2269 -cl2llc.c: cl2llc.pre
2270 -       sed -f ./pseudo/opcd2num.sed cl2llc.pre >cl2llc.c
2271 -
2272 -tar:
2273 -               tar -cvf /dev/f1 .
2274 diff -uNr linux/net/802/TODO linux-llc/net/802/TODO
2275 --- linux/net/802/TODO  Thu Dec 12 14:54:22 1996
2276 +++ linux-llc/net/802/TODO      Thu Jan  1 01:00:00 1970
2277 @@ -1,29 +0,0 @@
2278 -Remaining Problems:
2279 -
2280 -1. Serialization of access to variables in the llc structure
2281 -by mac_data_indicate(), timer expired functions, and data_request() .
2282 -There is not serialization of any kind right now.
2283 -While testing, I have not seen any problems that stem from this lack of
2284 -serialization, but it wories me...
2285 -
2286 -2. The code is currently able to handle one connection only,
2287 -there is more work in register_cl2llc_client() to make a chain
2288 -of llc structures and in mac_data_indicate() to find back
2289 -the llc structure addressed by an incomming frame.
2290 -According to IEEE, connections are identified by (remote mac + local mac
2291 -+ dsap + ssap). dsap and ssap do not seem important: existing applications
2292 -always use the same dsap/ssap. Its probably sufficient to index on 
2293 -the remote mac only. 
2294
2295 -3. There is no test to see if the transmit window is full in data_request()
2296 -as described in the doc p73, "7.5.1 Sending I PDUs" 3th alinea.
2297 -The pdus presented to data_request() could probably go on the 
2298 -awaiting-transmit-queue (atq). The real difficulty is coding a test
2299 -to see if the transmit window is used up and to send the queue
2300 -when space in the window becomes available.
2301 -As I have no network layer that can generate a continous flow of pdus it is
2302 -difficult to simulate a remote busy condition and hence to test the code
2303 -to handle it.
2304
2305 -4. A simple flow control algorithm, steering the size of the transmit
2306 -window would be nice to have.
2307 diff -uNr linux/net/802/cl2llc.c linux-llc/net/802/cl2llc.c
2308 --- linux/net/802/cl2llc.c      Sat Nov 29 18:41:10 1997
2309 +++ linux-llc/net/802/cl2llc.c  Thu Jan  1 01:00:00 1970
2310 @@ -1,615 +0,0 @@
2311 -/*
2312 - * NET         An implementation of the IEEE 802.2 LLC protocol for the
2313 - *             LINUX operating system.  LLC is implemented as a set of 
2314 - *             state machines and callbacks for higher networking layers.
2315 - *
2316 - *             Class 2 llc algorithm.
2317 - *             Pseudocode interpreter, transition table lookup,
2318 - *                     data_request & indicate primitives...
2319 - *
2320 - *             Code for initialization, termination, registration and 
2321 - *             MAC layer glue.
2322 - *
2323 - *             Copyright Tim Alpaerts, 
2324 - *                     <Tim_Alpaerts@toyota-motor-europe.com>
2325 - *
2326 - *             This program is free software; you can redistribute it and/or
2327 - *             modify it under the terms of the GNU General Public License
2328 - *             as published by the Free Software Foundation; either version
2329 - *             2 of the License, or (at your option) any later version.
2330 - *
2331 - *     Changes
2332 - *             Alan Cox        :       Chainsawed into Linux format
2333 - *                                     Modified to use llc_ names
2334 - *                                     Changed callbacks
2335 - *
2336 - *     This file must be processed by sed before it can be compiled.
2337 - */
2338 -
2339 -#include <linux/types.h>
2340 -#include <linux/kernel.h>
2341 -#include <linux/malloc.h>
2342 -#include <linux/netdevice.h>
2343 -#include <linux/skbuff.h>
2344 -#include <net/p8022.h>
2345 -#include <linux/proc_fs.h>
2346 -#include <linux/stat.h>
2347 -#include <asm/byteorder.h>
2348 -
2349 -#include "pseudo/pseudocode.h"
2350 -#include "transit/pdutr.h"
2351 -#include "transit/timertr.h"
2352 -#include <net/llc_frame.h>
2353 -#include <net/llc.h>
2354 -
2355 -/*
2356 - *     Data_request() is called by the client to present a data unit
2357 - *     to the llc for transmission.
2358 - *     In the future this function should also check if the transmit window
2359 - *     allows the sending of another pdu, and if not put the skb on the atq
2360 - *     for deferred sending.
2361 - */
2362 -
2363 -int llc_data_request(llcptr lp, struct sk_buff *skb)
2364 -{
2365 -       if (skb_headroom(skb) < (lp->dev->hard_header_len +4)){
2366 -               printk("cl2llc: data_request() not enough headroom in skb\n");
2367 -               return -1;
2368 -       };
2369 -
2370 -       skb_push(skb, 4);
2371 -
2372 -       if ((lp->state != NORMAL) && (lp->state != BUSY) && (lp->state != REJECT))
2373 -       {
2374 -               printk("cl2llc: data_request() while no llc connection\n"); 
2375 -               return -1;  
2376 -       }
2377 -
2378 -       if (lp->remote_busy)
2379 -       {     /* if the remote llc is BUSY, */
2380 -               ADD_TO_ATQ(skb);      /* save skb in the await transmit queue */
2381 -               return 0;
2382 -       }                           
2383 -       else
2384 -       {
2385 -               /*
2386 -                *      Else proceed with xmit 
2387 -                */
2388 -
2389 -               switch(lp->state)
2390 -               {
2391 -                       case NORMAL:
2392 -                               if(lp->p_flag)
2393 -                                       llc_interpret_pseudo_code(lp, NORMAL2, skb, NO_FRAME);
2394 -                               else
2395 -                                       llc_interpret_pseudo_code(lp, NORMAL1, skb, NO_FRAME);
2396 -                               break;
2397 -                       case BUSY:
2398 -                               if (lp->p_flag)
2399 -                                       llc_interpret_pseudo_code(lp, BUSY2, skb, NO_FRAME);
2400 -                               else
2401 -                                       llc_interpret_pseudo_code(lp, BUSY1, skb, NO_FRAME);
2402 -                               break;
2403 -                       case REJECT:
2404 -                               if (lp->p_flag)
2405 -                                       llc_interpret_pseudo_code(lp, REJECT2, skb, NO_FRAME);
2406 -                               else
2407 -                                       llc_interpret_pseudo_code(lp, REJECT1, skb, NO_FRAME);
2408 -                               break;
2409 -                       default:
2410 -               }
2411 -               if(lp->llc_callbacks)
2412 -               {
2413 -                       lp->llc_event(lp);
2414 -                       lp->llc_callbacks=0;
2415 -               }
2416 -               return 0;  
2417 -       }              
2418 -}
2419 -
2420 -
2421 -
2422 -/* 
2423 - *     Disconnect_request() requests that the llc to terminate a connection
2424 - */
2425 -
2426 -void disconnect_request(llcptr lp)
2427 -{
2428 -       if ((lp->state == NORMAL) ||
2429 -               (lp->state == BUSY) ||
2430 -               (lp->state == REJECT) ||
2431 -               (lp->state == AWAIT) ||
2432 -               (lp->state == AWAIT_BUSY) ||
2433 -               (lp->state == AWAIT_REJECT))
2434 -       {
2435 -               lp->state = D_CONN;
2436 -               llc_interpret_pseudo_code(lp, SH1, NULL, NO_FRAME);
2437 -               if(lp->llc_callbacks)
2438 -               {
2439 -                       lp->llc_event(lp);
2440 -                       lp->llc_callbacks=0;
2441 -               }
2442 -               /*
2443 -                *      lp may be invalid after the callback
2444 -                */
2445 -       }
2446 -}
2447 -
2448 -
2449 -/*
2450 - *     Connect_request() requests that the llc to start a connection
2451 - */
2452 -
2453 -void connect_request(llcptr lp)
2454 -{
2455 -       if (lp->state == ADM)
2456 -       {
2457 -               lp->state = SETUP;
2458 -               llc_interpret_pseudo_code(lp, ADM1, NULL, NO_FRAME);
2459 -               if(lp->llc_callbacks)
2460 -               {
2461 -                       lp->llc_event(lp);
2462 -                       lp->llc_callbacks=0;
2463 -               }
2464 -               /*
2465 -                *      lp may be invalid after the callback
2466 -                */
2467 -       }
2468 -}
2469 -
2470 -
2471 -/*
2472 - *     Interpret_pseudo_code() executes the actions in the connection component
2473 - *     state transition table. Table 4 in document on p88.
2474 - *
2475 - *     If this function is called to handle an incomming pdu, skb will point
2476 - *     to the buffer with the pdu and type will contain the decoded pdu type.
2477 - *
2478 - *     If called by data_request skb points to an skb that was skb_alloc-ed by 
2479 - *     the llc client to hold the information unit to be transmitted, there is
2480 - *     no valid type in this case.  
2481 - *
2482 - *     If called because a timer expired no skb is passed, and there is no 
2483 - *     type.
2484 - */
2485 -
2486 -void llc_interpret_pseudo_code(llcptr lp, int pc_label, struct sk_buff *skb, 
2487 -               char type)
2488 -{    
2489 -       short int pc;   /* program counter in pseudo code array */ 
2490 -       char p_flag_received;
2491 -       frameptr fr;
2492 -       int resend_count;   /* number of pdus resend by llc_resend_ipdu() */
2493 -       int ack_count;      /* number of pdus acknowledged */
2494 -       struct sk_buff *skb2;
2495 -
2496 -       if (skb != NULL) 
2497 -       {
2498 -               fr = (frameptr) skb->data;
2499 -       }
2500 -       else
2501 -               fr = NULL;
2502 -
2503 -       pc = pseudo_code_idx[pc_label];
2504 -       while(pseudo_code[pc])
2505 -       {
2506 -               switch(pseudo_code[pc])
2507 -               {
2508 -                       case 9:
2509 -                               if ((type != I_CMD) || (fr->i_hdr.i_pflag == 0))
2510 -                                       break;
2511 -                       case 1:
2512 -                               lp->remote_busy = 0;
2513 -                               llc_stop_timer(lp, BUSY_TIMER);
2514 -                               if ((lp->state == NORMAL) ||
2515 -                                       (lp->state == REJECT) ||
2516 -                                       (lp->state == BUSY))
2517 -                               {
2518 -                                       skb2 = llc_pull_from_atq(lp);
2519 -                                       if (skb2 != NULL) 
2520 -                                               llc_start_timer(lp, ACK_TIMER);
2521 -                                       while (skb2 != NULL)
2522 -                                       {
2523 -                                               llc_sendipdu( lp, I_CMD, 0, skb2);
2524 -                                               skb2 = llc_pull_from_atq(lp);
2525 -                                       }
2526 -                               }          
2527 -                               break;
2528 -                       case 2:
2529 -                               lp->state = NORMAL;  /* needed to eliminate connect_response() */
2530 -                               lp->llc_mode = MODE_ABM;
2531 -                               lp->llc_callbacks|=LLC_CONN_INDICATION;
2532 -                               break;
2533 -                       case 3:
2534 -                               lp->llc_mode = MODE_ABM;
2535 -                               lp->llc_callbacks|=LLC_CONN_CONFIRM;
2536 -                               break;
2537 -                       case 4:
2538 -                               skb_pull(skb, 4);
2539 -                               lp->inc_skb=skb;
2540 -                               lp->llc_callbacks|=LLC_DATA_INDIC;
2541 -                               break;
2542 -                       case 5:
2543 -                               lp->llc_mode = MODE_ADM;
2544 -                               lp->llc_callbacks|=LLC_DISC_INDICATION;
2545 -                               break;
2546 -                       case 70:
2547 -                               lp->llc_callbacks|=LLC_RESET_INDIC_LOC;
2548 -                               break;
2549 -                       case 71:
2550 -                               lp->llc_callbacks|=LLC_RESET_INDIC_REM;
2551 -                               break;
2552 -                       case 7:
2553 -                               lp->llc_callbacks|=LLC_RST_CONFIRM;
2554 -                               break;
2555 -                       case 66:
2556 -                               lp->llc_callbacks|=LLC_FRMR_RECV;
2557 -                               break;
2558 -                       case 67:
2559 -                               lp->llc_callbacks|=LLC_FRMR_SENT;
2560 -                               break;
2561 -                       case 68:
2562 -                               lp->llc_callbacks|=LLC_REMOTE_BUSY;
2563 -                               break;
2564 -                       case 69:
2565 -                               lp->llc_callbacks|=LLC_REMOTE_NOTBUSY;
2566 -                               break;
2567 -                       case 11:
2568 -                               llc_sendpdu(lp, DISC_CMD, lp->f_flag, 0, NULL);
2569 -                               break;
2570 -                       case 12:
2571 -                               llc_sendpdu(lp, DM_RSP, 0, 0, NULL);
2572 -                               break;
2573 -                       case 13:                        
2574 -                               lp->frmr_info_fld.cntl1 = fr->pdu_cntl.byte1;
2575 -                               lp->frmr_info_fld.cntl2 = fr->pdu_cntl.byte2;
2576 -                               lp->frmr_info_fld.vs = lp->vs;
2577 -                               lp->frmr_info_fld.vr_cr = lp->vr;
2578 -                               llc_sendpdu(lp, FRMR_RSP, 0, 5, (char *) &lp->frmr_info_fld);
2579 -                               break;
2580 -                       case 14:
2581 -                               llc_sendpdu(lp, FRMR_RSP, 0, 5, (char *) &lp->frmr_info_fld);
2582 -                               break;
2583 -                       case 15:
2584 -                               llc_sendpdu(lp, FRMR_RSP, lp->p_flag,
2585 -                                       5, (char *) &lp->frmr_info_fld);
2586 -                               break;
2587 -                       case 16:
2588 -                               llc_sendipdu(lp, I_CMD, 1, skb);   
2589 -                               break;
2590 -                       case 17:
2591 -                               resend_count = llc_resend_ipdu(lp, fr->i_hdr.nr, I_CMD, 1);
2592 -                               break;
2593 -                       case 18:
2594 -                               resend_count = llc_resend_ipdu(lp, fr->i_hdr.nr, I_CMD, 1);
2595 -                               if (resend_count == 0) 
2596 -                               {
2597 -                                       llc_sendpdu(lp, RR_CMD, 1, 0, NULL);
2598 -                               }    
2599 -                               break;
2600 -                       case 19:
2601 -                               llc_sendipdu(lp, I_CMD, 0, skb);   
2602 -                               break;
2603 -                       case 20:
2604 -                               resend_count = llc_resend_ipdu(lp, fr->i_hdr.nr, I_CMD, 0);
2605 -                               break;
2606 -                       case 21:
2607 -                               resend_count = llc_resend_ipdu(lp, fr->i_hdr.nr, I_CMD, 0);
2608 -                               if (resend_count == 0) 
2609 -                               {
2610 -                                       llc_sendpdu(lp, RR_CMD, 0, 0, NULL);
2611 -                               }    
2612 -                               break;
2613 -                       case 22:
2614 -                               resend_count = llc_resend_ipdu(lp, fr->i_hdr.nr, I_RSP, 1);
2615 -                               break;
2616 -                       case 23:
2617 -                               llc_sendpdu(lp, REJ_CMD, 1, 0, NULL);
2618 -                               break;
2619 -                       case 24:
2620 -                               llc_sendpdu(lp, REJ_RSP, 1, 0, NULL);
2621 -                               break;
2622 -                       case 25:
2623 -                               if (IS_RSP(fr))
2624 -                                       llc_sendpdu(lp, REJ_CMD, 0, 0, NULL);
2625 -                               else
2626 -                                       llc_sendpdu(lp, REJ_RSP, 0, 0, NULL);
2627 -                               break;
2628 -                       case 26:
2629 -                               llc_sendpdu(lp, RNR_CMD, 1, 0, NULL);
2630 -                               break;
2631 -                       case 27:
2632 -                               llc_sendpdu(lp, RNR_RSP, 1, 0, NULL);
2633 -                               break;
2634 -                       case 28:
2635 -                               if (IS_RSP(fr))
2636 -                                       llc_sendpdu(lp, RNR_CMD, 0, 0, NULL);
2637 -                               else
2638 -                                       llc_sendpdu(lp, RNR_RSP, 0, 0, NULL);
2639 -                               break;
2640 -                       case 29:
2641 -                               if (lp->remote_busy == 0)
2642 -                               {
2643 -                                       lp->remote_busy = 1;
2644 -                                       llc_start_timer(lp, BUSY_TIMER);
2645 -                                       lp->llc_callbacks|=LLC_REMOTE_BUSY;
2646 -                               }
2647 -                               else if (lp->timer_state[BUSY_TIMER] == TIMER_IDLE)
2648 -                               {
2649 -                                       llc_start_timer(lp, BUSY_TIMER);
2650 -                               }
2651 -                               break;
2652 -                       case 30:
2653 -                               if (IS_RSP(fr)) 
2654 -                                       llc_sendpdu(lp, RNR_CMD, 0, 0, NULL);
2655 -                               else
2656 -                                       llc_sendpdu(lp, RNR_RSP, 0, 0, NULL);
2657 -                               break;
2658 -                       case 31:
2659 -                               llc_sendpdu(lp, RR_CMD, 1, 0, NULL);
2660 -                               break;
2661 -                       case 32:
2662 -                               llc_sendpdu(lp, RR_CMD, 1, 0, NULL);
2663 -                               break;
2664 -                       case 33:
2665 -                               llc_sendpdu(lp, RR_RSP, 1, 0, NULL);
2666 -                               break;
2667 -                       case 34:
2668 -                               llc_sendpdu(lp, RR_RSP, 1, 0, NULL);
2669 -                               break;
2670 -                       case 35:
2671 -                               llc_sendpdu(lp, RR_RSP, 0, 0, NULL);
2672 -                               break;
2673 -                       case 36:
2674 -                               if (IS_RSP(fr)) 
2675 -                                       llc_sendpdu(lp, RR_CMD, 0, 0, NULL);
2676 -                               else
2677 -                                       llc_sendpdu(lp, RR_RSP, 0, 0, NULL);
2678 -                               break;
2679 -                       case 37:
2680 -                               llc_sendpdu(lp, SABME_CMD, 0, 0, NULL);
2681 -                               lp->f_flag = 0;
2682 -                               break;
2683 -                       case 38:
2684 -                               llc_sendpdu(lp, UA_RSP, lp->f_flag, 0, NULL);
2685 -                               break;
2686 -                       case 39:
2687 -                               lp->s_flag = 0;
2688 -                               break;
2689 -                       case 40:
2690 -                               lp->s_flag = 1;
2691 -                               break;
2692 -                       case 41:
2693 -                               if(lp->timer_state[P_TIMER] == TIMER_RUNNING)
2694 -                                       llc_stop_timer(lp, P_TIMER);
2695 -                               llc_start_timer(lp, P_TIMER);
2696 -                               if (lp->p_flag == 0)
2697 -                               {
2698 -                                       lp->retry_count = 0;
2699 -                                       lp->p_flag = 1;
2700 -                               }
2701 -                               break;
2702 -                       case 44:
2703 -                               if (lp->timer_state[ACK_TIMER] == TIMER_IDLE)
2704 -                                       llc_start_timer(lp, ACK_TIMER);
2705 -                               break;
2706 -                       case 42:
2707 -                               llc_start_timer(lp, ACK_TIMER);
2708 -                               break;
2709 -                       case 43:
2710 -                               llc_start_timer(lp, REJ_TIMER);
2711 -                               break;
2712 -                       case 45:
2713 -                               llc_stop_timer(lp, ACK_TIMER);
2714 -                               break;
2715 -                       case 46:
2716 -                               llc_stop_timer(lp, ACK_TIMER);
2717 -                               lp->p_flag = 0;
2718 -                               break;
2719 -                       case 10:
2720 -                               if (lp->data_flag == 2)
2721 -                                       llc_stop_timer(lp, REJ_TIMER);
2722 -                               break;
2723 -                       case 47:
2724 -                               llc_stop_timer(lp, REJ_TIMER);
2725 -                               break;
2726 -                       case 48:
2727 -                               llc_stop_timer(lp, ACK_TIMER);
2728 -                               llc_stop_timer(lp, P_TIMER);
2729 -                               llc_stop_timer(lp, REJ_TIMER);
2730 -                               llc_stop_timer(lp, BUSY_TIMER);
2731 -                               break;
2732 -                       case 49:
2733 -                               llc_stop_timer(lp, P_TIMER);
2734 -                               llc_stop_timer(lp, REJ_TIMER);
2735 -                               llc_stop_timer(lp, BUSY_TIMER);
2736 -                               break;
2737 -                       case 50:             
2738 -                               ack_count = llc_free_acknowledged_skbs(lp,
2739 -                                       (unsigned char) fr->s_hdr.nr);
2740 -                               if (ack_count > 0)
2741 -                               {
2742 -                                       lp->retry_count = 0;
2743 -                                       llc_stop_timer(lp, ACK_TIMER);  
2744 -                                       if (skb_peek(&lp->rtq) != NULL)
2745 -                                       {
2746 -        &nb