0001
0002
0003
0004
0005
0006
0007
0008 #include <linux/mISDNif.h>
0009 #include <linux/skbuff.h>
0010 #include "fsm.h"
0011
0012 #define MAX_WINDOW 8
0013
0014 struct manager {
0015 struct mISDNchannel ch;
0016 struct mISDNchannel bcast;
0017 u_long options;
0018 struct list_head layer2;
0019 rwlock_t lock;
0020 struct FsmInst deact;
0021 struct FsmTimer datimer;
0022 struct sk_buff_head sendq;
0023 struct mISDNchannel *up;
0024 u_int nextid;
0025 u_int lastid;
0026 };
0027
0028 struct teimgr {
0029 int ri;
0030 int rcnt;
0031 struct FsmInst tei_m;
0032 struct FsmTimer timer;
0033 int tval, nval;
0034 struct layer2 *l2;
0035 struct manager *mgr;
0036 };
0037
0038 struct laddr {
0039 u_char A;
0040 u_char B;
0041 };
0042
0043 struct layer2 {
0044 struct list_head list;
0045 struct mISDNchannel ch;
0046 u_long flag;
0047 int id;
0048 struct mISDNchannel *up;
0049 signed char sapi;
0050 signed char tei;
0051 struct laddr addr;
0052 u_int maxlen;
0053 struct teimgr *tm;
0054 u_int vs, va, vr;
0055 int rc;
0056 u_int window;
0057 u_int sow;
0058 struct FsmInst l2m;
0059 struct FsmTimer t200, t203;
0060 int T200, N200, T203;
0061 u_int next_id;
0062 u_int down_id;
0063 struct sk_buff *windowar[MAX_WINDOW];
0064 struct sk_buff_head i_queue;
0065 struct sk_buff_head ui_queue;
0066 struct sk_buff_head down_queue;
0067 struct sk_buff_head tmp_queue;
0068 };
0069
0070 enum {
0071 ST_L2_1,
0072 ST_L2_2,
0073 ST_L2_3,
0074 ST_L2_4,
0075 ST_L2_5,
0076 ST_L2_6,
0077 ST_L2_7,
0078 ST_L2_8,
0079 };
0080
0081 #define L2_STATE_COUNT (ST_L2_8 + 1)
0082
0083 extern struct layer2 *create_l2(struct mISDNchannel *, u_int,
0084 u_long, int, int);
0085 extern int tei_l2(struct layer2 *, u_int, u_long arg);
0086
0087
0088
0089 extern int l2_tei(struct layer2 *, u_int, u_long arg);
0090 extern void TEIrelease(struct layer2 *);
0091 extern int TEIInit(u_int *);
0092 extern void TEIFree(void);
0093
0094 #define MAX_L2HEADER_LEN 4
0095
0096 #define RR 0x01
0097 #define RNR 0x05
0098 #define REJ 0x09
0099 #define SABME 0x6f
0100 #define SABM 0x2f
0101 #define DM 0x0f
0102 #define UI 0x03
0103 #define DISC 0x43
0104 #define UA 0x63
0105 #define FRMR 0x87
0106 #define XID 0xaf
0107
0108 #define CMD 0
0109 #define RSP 1
0110
0111 #define LC_FLUSH_WAIT 1
0112
0113 #define FLG_LAPB 0
0114 #define FLG_LAPD 1
0115 #define FLG_ORIG 2
0116 #define FLG_MOD128 3
0117 #define FLG_PEND_REL 4
0118 #define FLG_L3_INIT 5
0119 #define FLG_T200_RUN 6
0120 #define FLG_ACK_PEND 7
0121 #define FLG_REJEXC 8
0122 #define FLG_OWN_BUSY 9
0123 #define FLG_PEER_BUSY 10
0124 #define FLG_DCHAN_BUSY 11
0125 #define FLG_L1_ACTIV 12
0126 #define FLG_ESTAB_PEND 13
0127 #define FLG_PTP 14
0128 #define FLG_FIXED_TEI 15
0129 #define FLG_L2BLOCK 16
0130 #define FLG_L1_NOTREADY 17
0131 #define FLG_LAPD_NET 18