Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
layer2.h
Go to the documentation of this file.
1 /*
2  * Layer 2 defines
3  *
4  * Copyright 2008 by Karsten Keil <[email protected]>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  */
16 
17 #include <linux/mISDNif.h>
18 #include <linux/skbuff.h>
19 #include "fsm.h"
20 
21 #define MAX_WINDOW 8
22 
23 struct manager {
24  struct mISDNchannel ch;
25  struct mISDNchannel bcast;
27  struct list_head layer2;
29  struct FsmInst deact;
30  struct FsmTimer datimer;
32  struct mISDNchannel *up;
35 };
36 
37 struct teimgr {
38  int ri;
39  int rcnt;
40  struct FsmInst tei_m;
41  struct FsmTimer timer;
42  int tval, nval;
43  struct layer2 *l2;
44  struct manager *mgr;
45 };
46 
47 struct laddr {
50 };
51 
52 struct layer2 {
53  struct list_head list;
54  struct mISDNchannel ch;
56  int id;
57  struct mISDNchannel *up;
58  signed char sapi;
59  signed char tei;
60  struct laddr addr;
62  struct teimgr *tm;
64  int rc;
67  struct FsmInst l2m;
68  struct FsmTimer t200, t203;
69  int T200, N200, T203;
77 };
78 
79 enum {
88 };
89 
90 #define L2_STATE_COUNT (ST_L2_8 + 1)
91 
92 extern struct layer2 *create_l2(struct mISDNchannel *, u_int,
93  u_long, int, int);
94 extern int tei_l2(struct layer2 *, u_int, u_long arg);
95 
96 
97 /* from tei.c */
98 extern int l2_tei(struct layer2 *, u_int, u_long arg);
99 extern void TEIrelease(struct layer2 *);
100 extern int TEIInit(u_int *);
101 extern void TEIFree(void);
102 
103 #define MAX_L2HEADER_LEN 4
104 
105 #define RR 0x01
106 #define RNR 0x05
107 #define REJ 0x09
108 #define SABME 0x6f
109 #define SABM 0x2f
110 #define DM 0x0f
111 #define UI 0x03
112 #define DISC 0x43
113 #define UA 0x63
114 #define FRMR 0x87
115 #define XID 0xaf
116 
117 #define CMD 0
118 #define RSP 1
119 
120 #define LC_FLUSH_WAIT 1
121 
122 #define FLG_LAPB 0
123 #define FLG_LAPD 1
124 #define FLG_ORIG 2
125 #define FLG_MOD128 3
126 #define FLG_PEND_REL 4
127 #define FLG_L3_INIT 5
128 #define FLG_T200_RUN 6
129 #define FLG_ACK_PEND 7
130 #define FLG_REJEXC 8
131 #define FLG_OWN_BUSY 9
132 #define FLG_PEER_BUSY 10
133 #define FLG_DCHAN_BUSY 11
134 #define FLG_L1_ACTIV 12
135 #define FLG_ESTAB_PEND 13
136 #define FLG_PTP 14
137 #define FLG_FIXED_TEI 15
138 #define FLG_L2BLOCK 16
139 #define FLG_L1_NOTREADY 17
140 #define FLG_LAPD_NET 18