diff options
author | Joe Perches <joe@perches.com> | 2012-02-19 22:52:38 -0500 |
---|---|---|
committer | Joe Perches <joe@perches.com> | 2012-02-21 12:04:01 -0500 |
commit | 475be4d85a274d0961593db41cf85689db1d583c (patch) | |
tree | b2b8931eb747794730522c3cf1898e46948527b9 /drivers/isdn/hisax/l3ni1.c | |
parent | 0b0a635f79f91f3755b6518627ea06dd0dbfd523 (diff) |
isdn: whitespace coding style cleanup
isdn source code uses a not-current coding style.
Update the coding style used on a per-line basis
so that git diff -w shows only elided blank lines
at EOF.
Done with emacs and some scripts and some typing.
Built x86 allyesconfig.
No detected change in objdump -d or size.
Signed-off-by: Joe Perches <joe@perches.com>
Diffstat (limited to 'drivers/isdn/hisax/l3ni1.c')
-rw-r--r-- | drivers/isdn/hisax/l3ni1.c | 1838 |
1 files changed, 919 insertions, 919 deletions
diff --git a/drivers/isdn/hisax/l3ni1.c b/drivers/isdn/hisax/l3ni1.c index 092dcbb39d94..0df6691d045c 100644 --- a/drivers/isdn/hisax/l3ni1.c +++ b/drivers/isdn/hisax/l3ni1.c | |||
@@ -4,14 +4,14 @@ | |||
4 | * | 4 | * |
5 | * Author Matt Henderson & Guy Ellis | 5 | * Author Matt Henderson & Guy Ellis |
6 | * Copyright by Traverse Technologies Pty Ltd, www.travers.com.au | 6 | * Copyright by Traverse Technologies Pty Ltd, www.travers.com.au |
7 | * | 7 | * |
8 | * This software may be used and distributed according to the terms | 8 | * This software may be used and distributed according to the terms |
9 | * of the GNU General Public License, incorporated herein by reference. | 9 | * of the GNU General Public License, incorporated herein by reference. |
10 | * | 10 | * |
11 | * 2000.6.6 Initial implementation of routines for US NI1 | 11 | * 2000.6.6 Initial implementation of routines for US NI1 |
12 | * Layer 3 protocol based on the EURO/DSS1 D-channel protocol | 12 | * Layer 3 protocol based on the EURO/DSS1 D-channel protocol |
13 | * driver written by Karsten Keil et al. | 13 | * driver written by Karsten Keil et al. |
14 | * NI-1 Hall of Fame - Thanks to.... | 14 | * NI-1 Hall of Fame - Thanks to.... |
15 | * Ragnar Paulson - for some handy code fragments | 15 | * Ragnar Paulson - for some handy code fragments |
16 | * Will Scales - beta tester extraordinaire | 16 | * Will Scales - beta tester extraordinaire |
17 | * Brett Whittacre - beta tester and remote devel system in Vegas | 17 | * Brett Whittacre - beta tester and remote devel system in Vegas |
@@ -29,14 +29,14 @@ static const char *ni1_revision = "$Revision: 2.8.2.3 $"; | |||
29 | 29 | ||
30 | #define EXT_BEARER_CAPS 1 | 30 | #define EXT_BEARER_CAPS 1 |
31 | 31 | ||
32 | #define MsgHead(ptr, cref, mty) \ | 32 | #define MsgHead(ptr, cref, mty) \ |
33 | *ptr++ = 0x8; \ | 33 | *ptr++ = 0x8; \ |
34 | if (cref == -1) { \ | 34 | if (cref == -1) { \ |
35 | *ptr++ = 0x0; \ | 35 | *ptr++ = 0x0; \ |
36 | } else { \ | 36 | } else { \ |
37 | *ptr++ = 0x1; \ | 37 | *ptr++ = 0x1; \ |
38 | *ptr++ = cref^0x80; \ | 38 | *ptr++ = cref^0x80; \ |
39 | } \ | 39 | } \ |
40 | *ptr++ = mty | 40 | *ptr++ = mty |
41 | 41 | ||
42 | 42 | ||
@@ -48,22 +48,22 @@ static unsigned char new_invoke_id(struct PStack *p) | |||
48 | { | 48 | { |
49 | unsigned char retval; | 49 | unsigned char retval; |
50 | int i; | 50 | int i; |
51 | 51 | ||
52 | i = 32; /* maximum search depth */ | 52 | i = 32; /* maximum search depth */ |
53 | 53 | ||
54 | retval = p->prot.ni1.last_invoke_id + 1; /* try new id */ | 54 | retval = p->prot.ni1.last_invoke_id + 1; /* try new id */ |
55 | while ((i) && (p->prot.ni1.invoke_used[retval >> 3] == 0xFF)) { | 55 | while ((i) && (p->prot.ni1.invoke_used[retval >> 3] == 0xFF)) { |
56 | p->prot.ni1.last_invoke_id = (retval & 0xF8) + 8; | 56 | p->prot.ni1.last_invoke_id = (retval & 0xF8) + 8; |
57 | i--; | 57 | i--; |
58 | } | 58 | } |
59 | if (i) { | 59 | if (i) { |
60 | while (p->prot.ni1.invoke_used[retval >> 3] & (1 << (retval & 7))) | 60 | while (p->prot.ni1.invoke_used[retval >> 3] & (1 << (retval & 7))) |
61 | retval++; | 61 | retval++; |
62 | } else | 62 | } else |
63 | retval = 0; | 63 | retval = 0; |
64 | p->prot.ni1.last_invoke_id = retval; | 64 | p->prot.ni1.last_invoke_id = retval; |
65 | p->prot.ni1.invoke_used[retval >> 3] |= (1 << (retval & 7)); | 65 | p->prot.ni1.invoke_used[retval >> 3] |= (1 << (retval & 7)); |
66 | return(retval); | 66 | return (retval); |
67 | } /* new_invoke_id */ | 67 | } /* new_invoke_id */ |
68 | 68 | ||
69 | /*************************/ | 69 | /*************************/ |
@@ -72,10 +72,10 @@ static unsigned char new_invoke_id(struct PStack *p) | |||
72 | static void free_invoke_id(struct PStack *p, unsigned char id) | 72 | static void free_invoke_id(struct PStack *p, unsigned char id) |
73 | { | 73 | { |
74 | 74 | ||
75 | if (!id) return; /* 0 = invalid value */ | 75 | if (!id) return; /* 0 = invalid value */ |
76 | 76 | ||
77 | p->prot.ni1.invoke_used[id >> 3] &= ~(1 << (id & 7)); | 77 | p->prot.ni1.invoke_used[id >> 3] &= ~(1 << (id & 7)); |
78 | } /* free_invoke_id */ | 78 | } /* free_invoke_id */ |
79 | 79 | ||
80 | 80 | ||
81 | /**********************************************************/ | 81 | /**********************************************************/ |
@@ -85,26 +85,26 @@ static struct l3_process | |||
85 | *ni1_new_l3_process(struct PStack *st, int cr) | 85 | *ni1_new_l3_process(struct PStack *st, int cr) |
86 | { struct l3_process *proc; | 86 | { struct l3_process *proc; |
87 | 87 | ||
88 | if (!(proc = new_l3_process(st, cr))) | 88 | if (!(proc = new_l3_process(st, cr))) |
89 | return(NULL); | 89 | return (NULL); |
90 | 90 | ||
91 | proc->prot.ni1.invoke_id = 0; | 91 | proc->prot.ni1.invoke_id = 0; |
92 | proc->prot.ni1.remote_operation = 0; | 92 | proc->prot.ni1.remote_operation = 0; |
93 | proc->prot.ni1.uus1_data[0] = '\0'; | 93 | proc->prot.ni1.uus1_data[0] = '\0'; |
94 | 94 | ||
95 | return(proc); | 95 | return (proc); |
96 | } /* ni1_new_l3_process */ | 96 | } /* ni1_new_l3_process */ |
97 | 97 | ||
98 | /************************************************/ | 98 | /************************************************/ |
99 | /* free a l3 process and all ni1 specific data */ | 99 | /* free a l3 process and all ni1 specific data */ |
100 | /************************************************/ | 100 | /************************************************/ |
101 | static void | 101 | static void |
102 | ni1_release_l3_process(struct l3_process *p) | 102 | ni1_release_l3_process(struct l3_process *p) |
103 | { | 103 | { |
104 | free_invoke_id(p->st,p->prot.ni1.invoke_id); | 104 | free_invoke_id(p->st, p->prot.ni1.invoke_id); |
105 | release_l3_process(p); | 105 | release_l3_process(p); |
106 | } /* ni1_release_l3_process */ | 106 | } /* ni1_release_l3_process */ |
107 | 107 | ||
108 | /********************************************************/ | 108 | /********************************************************/ |
109 | /* search a process with invoke id id and dummy callref */ | 109 | /* search a process with invoke id id and dummy callref */ |
110 | /********************************************************/ | 110 | /********************************************************/ |
@@ -112,120 +112,120 @@ static struct l3_process * | |||
112 | l3ni1_search_dummy_proc(struct PStack *st, int id) | 112 | l3ni1_search_dummy_proc(struct PStack *st, int id) |
113 | { struct l3_process *pc = st->l3.proc; /* start of processes */ | 113 | { struct l3_process *pc = st->l3.proc; /* start of processes */ |
114 | 114 | ||
115 | if (!id) return(NULL); | 115 | if (!id) return (NULL); |
116 | 116 | ||
117 | while (pc) | 117 | while (pc) |
118 | { if ((pc->callref == -1) && (pc->prot.ni1.invoke_id == id)) | 118 | { if ((pc->callref == -1) && (pc->prot.ni1.invoke_id == id)) |
119 | return(pc); | 119 | return (pc); |
120 | pc = pc->next; | 120 | pc = pc->next; |
121 | } | 121 | } |
122 | return(NULL); | 122 | return (NULL); |
123 | } /* l3ni1_search_dummy_proc */ | 123 | } /* l3ni1_search_dummy_proc */ |
124 | 124 | ||
125 | /*******************************************************************/ | 125 | /*******************************************************************/ |
126 | /* called when a facility message with a dummy callref is received */ | 126 | /* called when a facility message with a dummy callref is received */ |
127 | /* and a return result is delivered. id specifies the invoke id. */ | 127 | /* and a return result is delivered. id specifies the invoke id. */ |
128 | /*******************************************************************/ | 128 | /*******************************************************************/ |
129 | static void | 129 | static void |
130 | l3ni1_dummy_return_result(struct PStack *st, int id, u_char *p, u_char nlen) | 130 | l3ni1_dummy_return_result(struct PStack *st, int id, u_char *p, u_char nlen) |
131 | { isdn_ctrl ic; | 131 | { isdn_ctrl ic; |
132 | struct IsdnCardState *cs; | 132 | struct IsdnCardState *cs; |
133 | struct l3_process *pc = NULL; | 133 | struct l3_process *pc = NULL; |
134 | 134 | ||
135 | if ((pc = l3ni1_search_dummy_proc(st, id))) | 135 | if ((pc = l3ni1_search_dummy_proc(st, id))) |
136 | { L3DelTimer(&pc->timer); /* remove timer */ | 136 | { L3DelTimer(&pc->timer); /* remove timer */ |
137 | 137 | ||
138 | cs = pc->st->l1.hardware; | 138 | cs = pc->st->l1.hardware; |
139 | ic.driver = cs->myid; | 139 | ic.driver = cs->myid; |
140 | ic.command = ISDN_STAT_PROT; | 140 | ic.command = ISDN_STAT_PROT; |
141 | ic.arg = NI1_STAT_INVOKE_RES; | 141 | ic.arg = NI1_STAT_INVOKE_RES; |
142 | ic.parm.ni1_io.hl_id = pc->prot.ni1.invoke_id; | 142 | ic.parm.ni1_io.hl_id = pc->prot.ni1.invoke_id; |
143 | ic.parm.ni1_io.ll_id = pc->prot.ni1.ll_id; | 143 | ic.parm.ni1_io.ll_id = pc->prot.ni1.ll_id; |
144 | ic.parm.ni1_io.proc = pc->prot.ni1.proc; | 144 | ic.parm.ni1_io.proc = pc->prot.ni1.proc; |
145 | ic.parm.ni1_io.timeout= 0; | 145 | ic.parm.ni1_io.timeout = 0; |
146 | ic.parm.ni1_io.datalen = nlen; | 146 | ic.parm.ni1_io.datalen = nlen; |
147 | ic.parm.ni1_io.data = p; | 147 | ic.parm.ni1_io.data = p; |
148 | free_invoke_id(pc->st, pc->prot.ni1.invoke_id); | 148 | free_invoke_id(pc->st, pc->prot.ni1.invoke_id); |
149 | pc->prot.ni1.invoke_id = 0; /* reset id */ | 149 | pc->prot.ni1.invoke_id = 0; /* reset id */ |
150 | 150 | ||
151 | cs->iif.statcallb(&ic); | 151 | cs->iif.statcallb(&ic); |
152 | ni1_release_l3_process(pc); | 152 | ni1_release_l3_process(pc); |
153 | } | 153 | } |
154 | else | 154 | else |
155 | l3_debug(st, "dummy return result id=0x%x result len=%d",id,nlen); | 155 | l3_debug(st, "dummy return result id=0x%x result len=%d", id, nlen); |
156 | } /* l3ni1_dummy_return_result */ | 156 | } /* l3ni1_dummy_return_result */ |
157 | 157 | ||
158 | /*******************************************************************/ | 158 | /*******************************************************************/ |
159 | /* called when a facility message with a dummy callref is received */ | 159 | /* called when a facility message with a dummy callref is received */ |
160 | /* and a return error is delivered. id specifies the invoke id. */ | 160 | /* and a return error is delivered. id specifies the invoke id. */ |
161 | /*******************************************************************/ | 161 | /*******************************************************************/ |
162 | static void | 162 | static void |
163 | l3ni1_dummy_error_return(struct PStack *st, int id, ulong error) | 163 | l3ni1_dummy_error_return(struct PStack *st, int id, ulong error) |
164 | { isdn_ctrl ic; | 164 | { isdn_ctrl ic; |
165 | struct IsdnCardState *cs; | 165 | struct IsdnCardState *cs; |
166 | struct l3_process *pc = NULL; | 166 | struct l3_process *pc = NULL; |
167 | 167 | ||
168 | if ((pc = l3ni1_search_dummy_proc(st, id))) | 168 | if ((pc = l3ni1_search_dummy_proc(st, id))) |
169 | { L3DelTimer(&pc->timer); /* remove timer */ | 169 | { L3DelTimer(&pc->timer); /* remove timer */ |
170 | 170 | ||
171 | cs = pc->st->l1.hardware; | 171 | cs = pc->st->l1.hardware; |
172 | ic.driver = cs->myid; | 172 | ic.driver = cs->myid; |
173 | ic.command = ISDN_STAT_PROT; | 173 | ic.command = ISDN_STAT_PROT; |
174 | ic.arg = NI1_STAT_INVOKE_ERR; | 174 | ic.arg = NI1_STAT_INVOKE_ERR; |
175 | ic.parm.ni1_io.hl_id = pc->prot.ni1.invoke_id; | 175 | ic.parm.ni1_io.hl_id = pc->prot.ni1.invoke_id; |
176 | ic.parm.ni1_io.ll_id = pc->prot.ni1.ll_id; | 176 | ic.parm.ni1_io.ll_id = pc->prot.ni1.ll_id; |
177 | ic.parm.ni1_io.proc = pc->prot.ni1.proc; | 177 | ic.parm.ni1_io.proc = pc->prot.ni1.proc; |
178 | ic.parm.ni1_io.timeout= error; | 178 | ic.parm.ni1_io.timeout = error; |
179 | ic.parm.ni1_io.datalen = 0; | 179 | ic.parm.ni1_io.datalen = 0; |
180 | ic.parm.ni1_io.data = NULL; | 180 | ic.parm.ni1_io.data = NULL; |
181 | free_invoke_id(pc->st, pc->prot.ni1.invoke_id); | 181 | free_invoke_id(pc->st, pc->prot.ni1.invoke_id); |
182 | pc->prot.ni1.invoke_id = 0; /* reset id */ | 182 | pc->prot.ni1.invoke_id = 0; /* reset id */ |
183 | 183 | ||
184 | cs->iif.statcallb(&ic); | 184 | cs->iif.statcallb(&ic); |
185 | ni1_release_l3_process(pc); | 185 | ni1_release_l3_process(pc); |
186 | } | 186 | } |
187 | else | 187 | else |
188 | l3_debug(st, "dummy return error id=0x%x error=0x%lx",id,error); | 188 | l3_debug(st, "dummy return error id=0x%x error=0x%lx", id, error); |
189 | } /* l3ni1_error_return */ | 189 | } /* l3ni1_error_return */ |
190 | 190 | ||
191 | /*******************************************************************/ | 191 | /*******************************************************************/ |
192 | /* called when a facility message with a dummy callref is received */ | 192 | /* called when a facility message with a dummy callref is received */ |
193 | /* and a invoke is delivered. id specifies the invoke id. */ | 193 | /* and a invoke is delivered. id specifies the invoke id. */ |
194 | /*******************************************************************/ | 194 | /*******************************************************************/ |
195 | static void | 195 | static void |
196 | l3ni1_dummy_invoke(struct PStack *st, int cr, int id, | 196 | l3ni1_dummy_invoke(struct PStack *st, int cr, int id, |
197 | int ident, u_char *p, u_char nlen) | 197 | int ident, u_char *p, u_char nlen) |
198 | { isdn_ctrl ic; | 198 | { isdn_ctrl ic; |
199 | struct IsdnCardState *cs; | 199 | struct IsdnCardState *cs; |
200 | 200 | ||
201 | l3_debug(st, "dummy invoke %s id=0x%x ident=0x%x datalen=%d", | 201 | l3_debug(st, "dummy invoke %s id=0x%x ident=0x%x datalen=%d", |
202 | (cr == -1) ? "local" : "broadcast",id,ident,nlen); | 202 | (cr == -1) ? "local" : "broadcast", id, ident, nlen); |
203 | if (cr >= -1) return; /* ignore local data */ | 203 | if (cr >= -1) return; /* ignore local data */ |
204 | 204 | ||
205 | cs = st->l1.hardware; | 205 | cs = st->l1.hardware; |
206 | ic.driver = cs->myid; | 206 | ic.driver = cs->myid; |
207 | ic.command = ISDN_STAT_PROT; | 207 | ic.command = ISDN_STAT_PROT; |
208 | ic.arg = NI1_STAT_INVOKE_BRD; | 208 | ic.arg = NI1_STAT_INVOKE_BRD; |
209 | ic.parm.ni1_io.hl_id = id; | 209 | ic.parm.ni1_io.hl_id = id; |
210 | ic.parm.ni1_io.ll_id = 0; | 210 | ic.parm.ni1_io.ll_id = 0; |
211 | ic.parm.ni1_io.proc = ident; | 211 | ic.parm.ni1_io.proc = ident; |
212 | ic.parm.ni1_io.timeout= 0; | 212 | ic.parm.ni1_io.timeout = 0; |
213 | ic.parm.ni1_io.datalen = nlen; | 213 | ic.parm.ni1_io.datalen = nlen; |
214 | ic.parm.ni1_io.data = p; | 214 | ic.parm.ni1_io.data = p; |
215 | 215 | ||
216 | cs->iif.statcallb(&ic); | 216 | cs->iif.statcallb(&ic); |
217 | } /* l3ni1_dummy_invoke */ | 217 | } /* l3ni1_dummy_invoke */ |
218 | 218 | ||
219 | static void | 219 | static void |
220 | l3ni1_parse_facility(struct PStack *st, struct l3_process *pc, | 220 | l3ni1_parse_facility(struct PStack *st, struct l3_process *pc, |
221 | int cr, u_char * p) | 221 | int cr, u_char *p) |
222 | { | 222 | { |
223 | int qd_len = 0; | 223 | int qd_len = 0; |
224 | unsigned char nlen = 0, ilen, cp_tag; | 224 | unsigned char nlen = 0, ilen, cp_tag; |
225 | int ident, id; | 225 | int ident, id; |
226 | ulong err_ret; | 226 | ulong err_ret; |
227 | 227 | ||
228 | if (pc) | 228 | if (pc) |
229 | st = pc->st; /* valid Stack */ | 229 | st = pc->st; /* valid Stack */ |
230 | else | 230 | else |
231 | if ((!st) || (cr >= 0)) return; /* neither pc nor st specified */ | 231 | if ((!st) || (cr >= 0)) return; /* neither pc nor st specified */ |
@@ -254,173 +254,173 @@ l3ni1_parse_facility(struct PStack *st, struct l3_process *pc, | |||
254 | l3_debug(st, "class and form != 0xA0"); | 254 | l3_debug(st, "class and form != 0xA0"); |
255 | return; | 255 | return; |
256 | } | 256 | } |
257 | |||
258 | cp_tag = *p & 0x1F; /* remember tag value */ | ||
259 | 257 | ||
260 | p++; | 258 | cp_tag = *p & 0x1F; /* remember tag value */ |
259 | |||
260 | p++; | ||
261 | qd_len--; | 261 | qd_len--; |
262 | if (qd_len < 1) | 262 | if (qd_len < 1) |
263 | { l3_debug(st, "qd_len < 1"); | 263 | { l3_debug(st, "qd_len < 1"); |
264 | return; | 264 | return; |
265 | } | 265 | } |
266 | if (*p & 0x80) | 266 | if (*p & 0x80) |
267 | { /* length format indefinite or limited */ | 267 | { /* length format indefinite or limited */ |
268 | nlen = *p++ & 0x7F; /* number of len bytes or indefinite */ | 268 | nlen = *p++ & 0x7F; /* number of len bytes or indefinite */ |
269 | if ((qd_len-- < ((!nlen) ? 3 : (1 + nlen))) || | 269 | if ((qd_len-- < ((!nlen) ? 3 : (1 + nlen))) || |
270 | (nlen > 1)) | 270 | (nlen > 1)) |
271 | { l3_debug(st, "length format error or not implemented"); | 271 | { l3_debug(st, "length format error or not implemented"); |
272 | return; | 272 | return; |
273 | } | 273 | } |
274 | if (nlen == 1) | 274 | if (nlen == 1) |
275 | { nlen = *p++; /* complete length */ | 275 | { nlen = *p++; /* complete length */ |
276 | qd_len--; | 276 | qd_len--; |
277 | } | 277 | } |
278 | else | 278 | else |
279 | { qd_len -= 2; /* trailing null bytes */ | 279 | { qd_len -= 2; /* trailing null bytes */ |
280 | if ((*(p+qd_len)) || (*(p+qd_len+1))) | 280 | if ((*(p + qd_len)) || (*(p + qd_len + 1))) |
281 | { l3_debug(st,"length format indefinite error"); | 281 | { l3_debug(st, "length format indefinite error"); |
282 | return; | 282 | return; |
283 | } | 283 | } |
284 | nlen = qd_len; | 284 | nlen = qd_len; |
285 | } | 285 | } |
286 | } | 286 | } |
287 | else | 287 | else |
288 | { nlen = *p++; | 288 | { nlen = *p++; |
289 | qd_len--; | 289 | qd_len--; |
290 | } | 290 | } |
291 | if (qd_len < nlen) | 291 | if (qd_len < nlen) |
292 | { l3_debug(st, "qd_len < nlen"); | 292 | { l3_debug(st, "qd_len < nlen"); |
293 | return; | 293 | return; |
294 | } | 294 | } |
295 | qd_len -= nlen; | 295 | qd_len -= nlen; |
296 | 296 | ||
297 | if (nlen < 2) | 297 | if (nlen < 2) |
298 | { l3_debug(st, "nlen < 2"); | 298 | { l3_debug(st, "nlen < 2"); |
299 | return; | 299 | return; |
300 | } | 300 | } |
301 | if (*p != 0x02) | 301 | if (*p != 0x02) |
302 | { /* invoke identifier tag */ | 302 | { /* invoke identifier tag */ |
303 | l3_debug(st, "invoke identifier tag !=0x02"); | 303 | l3_debug(st, "invoke identifier tag !=0x02"); |
304 | return; | 304 | return; |
305 | } | 305 | } |
306 | p++; | 306 | p++; |
307 | nlen--; | 307 | nlen--; |
308 | if (*p & 0x80) | 308 | if (*p & 0x80) |
309 | { /* length format */ | 309 | { /* length format */ |
310 | l3_debug(st, "invoke id length format 2"); | 310 | l3_debug(st, "invoke id length format 2"); |
311 | return; | 311 | return; |
312 | } | 312 | } |
313 | ilen = *p++; | 313 | ilen = *p++; |
314 | nlen--; | 314 | nlen--; |
315 | if (ilen > nlen || ilen == 0) | 315 | if (ilen > nlen || ilen == 0) |
316 | { l3_debug(st, "ilen > nlen || ilen == 0"); | 316 | { l3_debug(st, "ilen > nlen || ilen == 0"); |
317 | return; | 317 | return; |
318 | } | 318 | } |
319 | nlen -= ilen; | 319 | nlen -= ilen; |
320 | id = 0; | 320 | id = 0; |
321 | while (ilen > 0) | 321 | while (ilen > 0) |
322 | { id = (id << 8) | (*p++ & 0xFF); /* invoke identifier */ | 322 | { id = (id << 8) | (*p++ & 0xFF); /* invoke identifier */ |
323 | ilen--; | 323 | ilen--; |
324 | } | 324 | } |
325 | 325 | ||
326 | switch (cp_tag) { /* component tag */ | 326 | switch (cp_tag) { /* component tag */ |
327 | case 1: /* invoke */ | 327 | case 1: /* invoke */ |
328 | if (nlen < 2) { | 328 | if (nlen < 2) { |
329 | l3_debug(st, "nlen < 2 22"); | 329 | l3_debug(st, "nlen < 2 22"); |
330 | return; | 330 | return; |
331 | } | 331 | } |
332 | if (*p != 0x02) { /* operation value */ | 332 | if (*p != 0x02) { /* operation value */ |
333 | l3_debug(st, "operation value !=0x02"); | 333 | l3_debug(st, "operation value !=0x02"); |
334 | return; | 334 | return; |
335 | } | 335 | } |
336 | p++; | 336 | p++; |
337 | nlen--; | 337 | nlen--; |
338 | ilen = *p++; | 338 | ilen = *p++; |
339 | nlen--; | 339 | nlen--; |
340 | if (ilen > nlen || ilen == 0) { | 340 | if (ilen > nlen || ilen == 0) { |
341 | l3_debug(st, "ilen > nlen || ilen == 0 22"); | 341 | l3_debug(st, "ilen > nlen || ilen == 0 22"); |
342 | return; | 342 | return; |
343 | } | 343 | } |
344 | nlen -= ilen; | 344 | nlen -= ilen; |
345 | ident = 0; | 345 | ident = 0; |
346 | while (ilen > 0) { | 346 | while (ilen > 0) { |
347 | ident = (ident << 8) | (*p++ & 0xFF); | 347 | ident = (ident << 8) | (*p++ & 0xFF); |
348 | ilen--; | 348 | ilen--; |
349 | } | 349 | } |
350 | 350 | ||
351 | if (!pc) | 351 | if (!pc) |
352 | { | 352 | { |
353 | l3ni1_dummy_invoke(st, cr, id, ident, p, nlen); | 353 | l3ni1_dummy_invoke(st, cr, id, ident, p, nlen); |
354 | return; | 354 | return; |
355 | } | 355 | } |
356 | l3_debug(st, "invoke break"); | 356 | l3_debug(st, "invoke break"); |
357 | break; | 357 | break; |
358 | case 2: /* return result */ | 358 | case 2: /* return result */ |
359 | /* if no process available handle separately */ | 359 | /* if no process available handle separately */ |
360 | if (!pc) | 360 | if (!pc) |
361 | { if (cr == -1) | 361 | { if (cr == -1) |
362 | l3ni1_dummy_return_result(st, id, p, nlen); | 362 | l3ni1_dummy_return_result(st, id, p, nlen); |
363 | return; | 363 | return; |
364 | } | 364 | } |
365 | if ((pc->prot.ni1.invoke_id) && (pc->prot.ni1.invoke_id == id)) | 365 | if ((pc->prot.ni1.invoke_id) && (pc->prot.ni1.invoke_id == id)) |
366 | { /* Diversion successful */ | 366 | { /* Diversion successful */ |
367 | free_invoke_id(st,pc->prot.ni1.invoke_id); | 367 | free_invoke_id(st, pc->prot.ni1.invoke_id); |
368 | pc->prot.ni1.remote_result = 0; /* success */ | 368 | pc->prot.ni1.remote_result = 0; /* success */ |
369 | pc->prot.ni1.invoke_id = 0; | 369 | pc->prot.ni1.invoke_id = 0; |
370 | pc->redir_result = pc->prot.ni1.remote_result; | 370 | pc->redir_result = pc->prot.ni1.remote_result; |
371 | st->l3.l3l4(st, CC_REDIR | INDICATION, pc); } /* Diversion successful */ | 371 | st->l3.l3l4(st, CC_REDIR | INDICATION, pc); } /* Diversion successful */ |
372 | else | 372 | else |
373 | l3_debug(st,"return error unknown identifier"); | 373 | l3_debug(st, "return error unknown identifier"); |
374 | break; | 374 | break; |
375 | case 3: /* return error */ | 375 | case 3: /* return error */ |
376 | err_ret = 0; | 376 | err_ret = 0; |
377 | if (nlen < 2) | 377 | if (nlen < 2) |
378 | { l3_debug(st, "return error nlen < 2"); | 378 | { l3_debug(st, "return error nlen < 2"); |
379 | return; | 379 | return; |
380 | } | 380 | } |
381 | if (*p != 0x02) | 381 | if (*p != 0x02) |
382 | { /* result tag */ | 382 | { /* result tag */ |
383 | l3_debug(st, "invoke error tag !=0x02"); | 383 | l3_debug(st, "invoke error tag !=0x02"); |
384 | return; | 384 | return; |
385 | } | 385 | } |
386 | p++; | 386 | p++; |
387 | nlen--; | 387 | nlen--; |
388 | if (*p > 4) | 388 | if (*p > 4) |
389 | { /* length format */ | 389 | { /* length format */ |
390 | l3_debug(st, "invoke return errlen > 4 "); | 390 | l3_debug(st, "invoke return errlen > 4 "); |
391 | return; | 391 | return; |
392 | } | 392 | } |
393 | ilen = *p++; | 393 | ilen = *p++; |
394 | nlen--; | 394 | nlen--; |
395 | if (ilen > nlen || ilen == 0) | 395 | if (ilen > nlen || ilen == 0) |
396 | { l3_debug(st, "error return ilen > nlen || ilen == 0"); | 396 | { l3_debug(st, "error return ilen > nlen || ilen == 0"); |
397 | return; | 397 | return; |
398 | } | 398 | } |
399 | nlen -= ilen; | 399 | nlen -= ilen; |
400 | while (ilen > 0) | 400 | while (ilen > 0) |
401 | { err_ret = (err_ret << 8) | (*p++ & 0xFF); /* error value */ | 401 | { err_ret = (err_ret << 8) | (*p++ & 0xFF); /* error value */ |
402 | ilen--; | 402 | ilen--; |
403 | } | 403 | } |
404 | /* if no process available handle separately */ | 404 | /* if no process available handle separately */ |
405 | if (!pc) | 405 | if (!pc) |
406 | { if (cr == -1) | 406 | { if (cr == -1) |
407 | l3ni1_dummy_error_return(st, id, err_ret); | 407 | l3ni1_dummy_error_return(st, id, err_ret); |
408 | return; | 408 | return; |
409 | } | 409 | } |
410 | if ((pc->prot.ni1.invoke_id) && (pc->prot.ni1.invoke_id == id)) | 410 | if ((pc->prot.ni1.invoke_id) && (pc->prot.ni1.invoke_id == id)) |
411 | { /* Deflection error */ | 411 | { /* Deflection error */ |
412 | free_invoke_id(st,pc->prot.ni1.invoke_id); | 412 | free_invoke_id(st, pc->prot.ni1.invoke_id); |
413 | pc->prot.ni1.remote_result = err_ret; /* result */ | 413 | pc->prot.ni1.remote_result = err_ret; /* result */ |
414 | pc->prot.ni1.invoke_id = 0; | 414 | pc->prot.ni1.invoke_id = 0; |
415 | pc->redir_result = pc->prot.ni1.remote_result; | 415 | pc->redir_result = pc->prot.ni1.remote_result; |
416 | st->l3.l3l4(st, CC_REDIR | INDICATION, pc); | 416 | st->l3.l3l4(st, CC_REDIR | INDICATION, pc); |
417 | } /* Deflection error */ | 417 | } /* Deflection error */ |
418 | else | 418 | else |
419 | l3_debug(st,"return result unknown identifier"); | 419 | l3_debug(st, "return result unknown identifier"); |
420 | break; | 420 | break; |
421 | default: | 421 | default: |
422 | l3_debug(st, "facility default break tag=0x%02x",cp_tag); | 422 | l3_debug(st, "facility default break tag=0x%02x", cp_tag); |
423 | break; | 423 | break; |
424 | } | 424 | } |
425 | } | 425 | } |
426 | 426 | ||
@@ -518,21 +518,21 @@ l3ni1_msg_without_setup(struct l3_process *pc, u_char pr, void *arg) | |||
518 | struct sk_buff *skb; | 518 | struct sk_buff *skb; |
519 | 519 | ||
520 | switch (pc->para.cause) { | 520 | switch (pc->para.cause) { |
521 | case 81: /* invalid callreference */ | 521 | case 81: /* invalid callreference */ |
522 | case 88: /* incomp destination */ | 522 | case 88: /* incomp destination */ |
523 | case 96: /* mandory IE missing */ | 523 | case 96: /* mandory IE missing */ |
524 | case 100: /* invalid IE contents */ | 524 | case 100: /* invalid IE contents */ |
525 | case 101: /* incompatible Callstate */ | 525 | case 101: /* incompatible Callstate */ |
526 | MsgHead(p, pc->callref, MT_RELEASE_COMPLETE); | 526 | MsgHead(p, pc->callref, MT_RELEASE_COMPLETE); |
527 | *p++ = IE_CAUSE; | 527 | *p++ = IE_CAUSE; |
528 | *p++ = 0x2; | 528 | *p++ = 0x2; |
529 | *p++ = 0x80; | 529 | *p++ = 0x80; |
530 | *p++ = pc->para.cause | 0x80; | 530 | *p++ = pc->para.cause | 0x80; |
531 | break; | 531 | break; |
532 | default: | 532 | default: |
533 | printk(KERN_ERR "HiSax l3ni1_msg_without_setup wrong cause %d\n", | 533 | printk(KERN_ERR "HiSax l3ni1_msg_without_setup wrong cause %d\n", |
534 | pc->para.cause); | 534 | pc->para.cause); |
535 | return; | 535 | return; |
536 | } | 536 | } |
537 | l = p - tmp; | 537 | l = p - tmp; |
538 | if (!(skb = l3_alloc_skb(l))) | 538 | if (!(skb = l3_alloc_skb(l))) |
@@ -543,42 +543,42 @@ l3ni1_msg_without_setup(struct l3_process *pc, u_char pr, void *arg) | |||
543 | } | 543 | } |
544 | 544 | ||
545 | static int ie_ALERTING[] = {IE_BEARER, IE_CHANNEL_ID | IE_MANDATORY_1, | 545 | static int ie_ALERTING[] = {IE_BEARER, IE_CHANNEL_ID | IE_MANDATORY_1, |
546 | IE_FACILITY, IE_PROGRESS, IE_DISPLAY, IE_SIGNAL, IE_HLC, | 546 | IE_FACILITY, IE_PROGRESS, IE_DISPLAY, IE_SIGNAL, IE_HLC, |
547 | IE_USER_USER, -1}; | 547 | IE_USER_USER, -1}; |
548 | static int ie_CALL_PROCEEDING[] = {IE_BEARER, IE_CHANNEL_ID | IE_MANDATORY_1, | 548 | static int ie_CALL_PROCEEDING[] = {IE_BEARER, IE_CHANNEL_ID | IE_MANDATORY_1, |
549 | IE_FACILITY, IE_PROGRESS, IE_DISPLAY, IE_HLC, -1}; | 549 | IE_FACILITY, IE_PROGRESS, IE_DISPLAY, IE_HLC, -1}; |
550 | static int ie_CONNECT[] = {IE_BEARER, IE_CHANNEL_ID | IE_MANDATORY_1, | 550 | static int ie_CONNECT[] = {IE_BEARER, IE_CHANNEL_ID | IE_MANDATORY_1, |
551 | IE_FACILITY, IE_PROGRESS, IE_DISPLAY, IE_DATE, IE_SIGNAL, | 551 | IE_FACILITY, IE_PROGRESS, IE_DISPLAY, IE_DATE, IE_SIGNAL, |
552 | IE_CONNECT_PN, IE_CONNECT_SUB, IE_LLC, IE_HLC, IE_USER_USER, -1}; | 552 | IE_CONNECT_PN, IE_CONNECT_SUB, IE_LLC, IE_HLC, IE_USER_USER, -1}; |
553 | static int ie_CONNECT_ACKNOWLEDGE[] = {IE_CHANNEL_ID, IE_DISPLAY, IE_SIGNAL, -1}; | 553 | static int ie_CONNECT_ACKNOWLEDGE[] = {IE_CHANNEL_ID, IE_DISPLAY, IE_SIGNAL, -1}; |
554 | static int ie_DISCONNECT[] = {IE_CAUSE | IE_MANDATORY, IE_FACILITY, | 554 | static int ie_DISCONNECT[] = {IE_CAUSE | IE_MANDATORY, IE_FACILITY, |
555 | IE_PROGRESS, IE_DISPLAY, IE_SIGNAL, IE_USER_USER, -1}; | 555 | IE_PROGRESS, IE_DISPLAY, IE_SIGNAL, IE_USER_USER, -1}; |
556 | static int ie_INFORMATION[] = {IE_COMPLETE, IE_DISPLAY, IE_KEYPAD, IE_SIGNAL, | 556 | static int ie_INFORMATION[] = {IE_COMPLETE, IE_DISPLAY, IE_KEYPAD, IE_SIGNAL, |
557 | IE_CALLED_PN, -1}; | 557 | IE_CALLED_PN, -1}; |
558 | static int ie_NOTIFY[] = {IE_BEARER, IE_NOTIFY | IE_MANDATORY, IE_DISPLAY, -1}; | 558 | static int ie_NOTIFY[] = {IE_BEARER, IE_NOTIFY | IE_MANDATORY, IE_DISPLAY, -1}; |
559 | static int ie_PROGRESS[] = {IE_BEARER, IE_CAUSE, IE_FACILITY, IE_PROGRESS | | 559 | static int ie_PROGRESS[] = {IE_BEARER, IE_CAUSE, IE_FACILITY, IE_PROGRESS | |
560 | IE_MANDATORY, IE_DISPLAY, IE_HLC, IE_USER_USER, -1}; | 560 | IE_MANDATORY, IE_DISPLAY, IE_HLC, IE_USER_USER, -1}; |
561 | static int ie_RELEASE[] = {IE_CAUSE | IE_MANDATORY_1, IE_FACILITY, IE_DISPLAY, | 561 | static int ie_RELEASE[] = {IE_CAUSE | IE_MANDATORY_1, IE_FACILITY, IE_DISPLAY, |
562 | IE_SIGNAL, IE_USER_USER, -1}; | 562 | IE_SIGNAL, IE_USER_USER, -1}; |
563 | /* a RELEASE_COMPLETE with errors don't require special actions | 563 | /* a RELEASE_COMPLETE with errors don't require special actions |
564 | static int ie_RELEASE_COMPLETE[] = {IE_CAUSE | IE_MANDATORY_1, IE_DISPLAY, IE_SIGNAL, IE_USER_USER, -1}; | 564 | static int ie_RELEASE_COMPLETE[] = {IE_CAUSE | IE_MANDATORY_1, IE_DISPLAY, IE_SIGNAL, IE_USER_USER, -1}; |
565 | */ | 565 | */ |
566 | static int ie_RESUME_ACKNOWLEDGE[] = {IE_CHANNEL_ID| IE_MANDATORY, IE_FACILITY, | 566 | static int ie_RESUME_ACKNOWLEDGE[] = {IE_CHANNEL_ID | IE_MANDATORY, IE_FACILITY, |
567 | IE_DISPLAY, -1}; | 567 | IE_DISPLAY, -1}; |
568 | static int ie_RESUME_REJECT[] = {IE_CAUSE | IE_MANDATORY, IE_DISPLAY, -1}; | 568 | static int ie_RESUME_REJECT[] = {IE_CAUSE | IE_MANDATORY, IE_DISPLAY, -1}; |
569 | static int ie_SETUP[] = {IE_COMPLETE, IE_BEARER | IE_MANDATORY, | 569 | static int ie_SETUP[] = {IE_COMPLETE, IE_BEARER | IE_MANDATORY, |
570 | IE_CHANNEL_ID| IE_MANDATORY, IE_FACILITY, IE_PROGRESS, | 570 | IE_CHANNEL_ID | IE_MANDATORY, IE_FACILITY, IE_PROGRESS, |
571 | IE_NET_FAC, IE_DISPLAY, IE_KEYPAD, IE_SIGNAL, IE_CALLING_PN, | 571 | IE_NET_FAC, IE_DISPLAY, IE_KEYPAD, IE_SIGNAL, IE_CALLING_PN, |
572 | IE_CALLING_SUB, IE_CALLED_PN, IE_CALLED_SUB, IE_REDIR_NR, | 572 | IE_CALLING_SUB, IE_CALLED_PN, IE_CALLED_SUB, IE_REDIR_NR, |
573 | IE_LLC, IE_HLC, IE_USER_USER, -1}; | 573 | IE_LLC, IE_HLC, IE_USER_USER, -1}; |
574 | static int ie_SETUP_ACKNOWLEDGE[] = {IE_CHANNEL_ID | IE_MANDATORY, IE_FACILITY, | 574 | static int ie_SETUP_ACKNOWLEDGE[] = {IE_CHANNEL_ID | IE_MANDATORY, IE_FACILITY, |
575 | IE_PROGRESS, IE_DISPLAY, IE_SIGNAL, -1}; | 575 | IE_PROGRESS, IE_DISPLAY, IE_SIGNAL, -1}; |
576 | static int ie_STATUS[] = {IE_CAUSE | IE_MANDATORY, IE_CALL_STATE | | 576 | static int ie_STATUS[] = {IE_CAUSE | IE_MANDATORY, IE_CALL_STATE | |
577 | IE_MANDATORY, IE_DISPLAY, -1}; | 577 | IE_MANDATORY, IE_DISPLAY, -1}; |
578 | static int ie_STATUS_ENQUIRY[] = {IE_DISPLAY, -1}; | 578 | static int ie_STATUS_ENQUIRY[] = {IE_DISPLAY, -1}; |
579 | static int ie_SUSPEND_ACKNOWLEDGE[] = {IE_DISPLAY, IE_FACILITY, -1}; | 579 | static int ie_SUSPEND_ACKNOWLEDGE[] = {IE_DISPLAY, IE_FACILITY, -1}; |
580 | static int ie_SUSPEND_REJECT[] = {IE_CAUSE | IE_MANDATORY, IE_DISPLAY, -1}; | 580 | static int ie_SUSPEND_REJECT[] = {IE_CAUSE | IE_MANDATORY, IE_DISPLAY, -1}; |
581 | /* not used | 581 | /* not used |
582 | * static int ie_CONGESTION_CONTROL[] = {IE_CONGESTION | IE_MANDATORY, | 582 | * static int ie_CONGESTION_CONTROL[] = {IE_CONGESTION | IE_MANDATORY, |
583 | * IE_CAUSE | IE_MANDATORY, IE_DISPLAY, -1}; | 583 | * IE_CAUSE | IE_MANDATORY, IE_DISPLAY, -1}; |
584 | * static int ie_USER_INFORMATION[] = {IE_MORE_DATA, IE_USER_USER | IE_MANDATORY, -1}; | 584 | * static int ie_USER_INFORMATION[] = {IE_MORE_DATA, IE_USER_USER | IE_MANDATORY, -1}; |
@@ -586,8 +586,8 @@ static int ie_SUSPEND_REJECT[] = {IE_CAUSE | IE_MANDATORY, IE_DISPLAY, -1}; | |||
586 | * IE_MANDATORY, -1}; | 586 | * IE_MANDATORY, -1}; |
587 | */ | 587 | */ |
588 | static int ie_FACILITY[] = {IE_FACILITY | IE_MANDATORY, IE_DISPLAY, -1}; | 588 | static int ie_FACILITY[] = {IE_FACILITY | IE_MANDATORY, IE_DISPLAY, -1}; |
589 | static int comp_required[] = {1,2,3,5,6,7,9,10,11,14,15,-1}; | 589 | static int comp_required[] = {1, 2, 3, 5, 6, 7, 9, 10, 11, 14, 15, -1}; |
590 | static int l3_valid_states[] = {0,1,2,3,4,6,7,8,9,10,11,12,15,17,19,25,-1}; | 590 | static int l3_valid_states[] = {0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 15, 17, 19, 25, -1}; |
591 | 591 | ||
592 | struct ie_len { | 592 | struct ie_len { |
593 | int ie; | 593 | int ie; |
@@ -628,7 +628,7 @@ struct ie_len max_ie_len[] = { | |||
628 | {IE_LLC, 18}, | 628 | {IE_LLC, 18}, |
629 | {IE_HLC, 5}, | 629 | {IE_HLC, 5}, |
630 | {IE_USER_USER, 131}, | 630 | {IE_USER_USER, 131}, |
631 | {-1,0}, | 631 | {-1, 0}, |
632 | }; | 632 | }; |
633 | 633 | ||
634 | static int | 634 | static int |
@@ -636,10 +636,10 @@ getmax_ie_len(u_char ie) { | |||
636 | int i = 0; | 636 | int i = 0; |
637 | while (max_ie_len[i].ie != -1) { | 637 | while (max_ie_len[i].ie != -1) { |
638 | if (max_ie_len[i].ie == ie) | 638 | if (max_ie_len[i].ie == ie) |
639 | return(max_ie_len[i].len); | 639 | return (max_ie_len[i].len); |
640 | i++; | 640 | i++; |
641 | } | 641 | } |
642 | return(255); | 642 | return (255); |
643 | } | 643 | } |
644 | 644 | ||
645 | static int | 645 | static int |
@@ -649,14 +649,14 @@ ie_in_set(struct l3_process *pc, u_char ie, int *checklist) { | |||
649 | while (*checklist != -1) { | 649 | while (*checklist != -1) { |
650 | if ((*checklist & 0xff) == ie) { | 650 | if ((*checklist & 0xff) == ie) { |
651 | if (ie & 0x80) | 651 | if (ie & 0x80) |
652 | return(-ret); | 652 | return (-ret); |
653 | else | 653 | else |
654 | return(ret); | 654 | return (ret); |
655 | } | 655 | } |
656 | ret++; | 656 | ret++; |
657 | checklist++; | 657 | checklist++; |
658 | } | 658 | } |
659 | return(0); | 659 | return (0); |
660 | } | 660 | } |
661 | 661 | ||
662 | static int | 662 | static int |
@@ -670,7 +670,7 @@ check_infoelements(struct l3_process *pc, struct sk_buff *skb, int *checklist) | |||
670 | u_char codeset = 0; | 670 | u_char codeset = 0; |
671 | u_char old_codeset = 0; | 671 | u_char old_codeset = 0; |
672 | u_char codelock = 1; | 672 | u_char codelock = 1; |
673 | 673 | ||
674 | p = skb->data; | 674 | p = skb->data; |
675 | /* skip cr */ | 675 | /* skip cr */ |
676 | p++; | 676 | p++; |
@@ -688,7 +688,7 @@ check_infoelements(struct l3_process *pc, struct sk_buff *skb, int *checklist) | |||
688 | codelock = 1; | 688 | codelock = 1; |
689 | if (pc->debug & L3_DEB_CHECK) | 689 | if (pc->debug & L3_DEB_CHECK) |
690 | l3_debug(pc->st, "check IE shift%scodeset %d->%d", | 690 | l3_debug(pc->st, "check IE shift%scodeset %d->%d", |
691 | codelock ? " locking ": " ", old_codeset, codeset); | 691 | codelock ? " locking " : " ", old_codeset, codeset); |
692 | p++; | 692 | p++; |
693 | continue; | 693 | continue; |
694 | } | 694 | } |
@@ -720,7 +720,7 @@ check_infoelements(struct l3_process *pc, struct sk_buff *skb, int *checklist) | |||
720 | if (!codelock) { | 720 | if (!codelock) { |
721 | if (pc->debug & L3_DEB_CHECK) | 721 | if (pc->debug & L3_DEB_CHECK) |
722 | l3_debug(pc->st, "check IE shift back codeset %d->%d", | 722 | l3_debug(pc->st, "check IE shift back codeset %d->%d", |
723 | codeset, old_codeset); | 723 | codeset, old_codeset); |
724 | codeset = old_codeset; | 724 | codeset = old_codeset; |
725 | codelock = 1; | 725 | codelock = 1; |
726 | } | 726 | } |
@@ -728,17 +728,17 @@ check_infoelements(struct l3_process *pc, struct sk_buff *skb, int *checklist) | |||
728 | if (err_compr | err_ureg | err_len | err_seq) { | 728 | if (err_compr | err_ureg | err_len | err_seq) { |
729 | if (pc->debug & L3_DEB_CHECK) | 729 | if (pc->debug & L3_DEB_CHECK) |
730 | l3_debug(pc->st, "check IE MT(%x) %d/%d/%d/%d", | 730 | l3_debug(pc->st, "check IE MT(%x) %d/%d/%d/%d", |
731 | mt, err_compr, err_ureg, err_len, err_seq); | 731 | mt, err_compr, err_ureg, err_len, err_seq); |
732 | if (err_compr) | 732 | if (err_compr) |
733 | return(ERR_IE_COMPREHENSION); | 733 | return (ERR_IE_COMPREHENSION); |
734 | if (err_ureg) | 734 | if (err_ureg) |
735 | return(ERR_IE_UNRECOGNIZED); | 735 | return (ERR_IE_UNRECOGNIZED); |
736 | if (err_len) | 736 | if (err_len) |
737 | return(ERR_IE_LENGTH); | 737 | return (ERR_IE_LENGTH); |
738 | if (err_seq) | 738 | if (err_seq) |
739 | return(ERR_IE_SEQUENCE); | 739 | return (ERR_IE_SEQUENCE); |
740 | } | 740 | } |
741 | return(0); | 741 | return (0); |
742 | } | 742 | } |
743 | 743 | ||
744 | /* verify if a message type exists and contain no IE error */ | 744 | /* verify if a message type exists and contain no IE error */ |
@@ -746,42 +746,42 @@ static int | |||
746 | l3ni1_check_messagetype_validity(struct l3_process *pc, int mt, void *arg) | 746 | l3ni1_check_messagetype_validity(struct l3_process *pc, int mt, void *arg) |
747 | { | 747 | { |
748 | switch (mt) { | 748 | switch (mt) { |
749 | case MT_ALERTING: | 749 | case MT_ALERTING: |
750 | case MT_CALL_PROCEEDING: | 750 | case MT_CALL_PROCEEDING: |
751 | case MT_CONNECT: | 751 | case MT_CONNECT: |
752 | case MT_CONNECT_ACKNOWLEDGE: | 752 | case MT_CONNECT_ACKNOWLEDGE: |
753 | case MT_DISCONNECT: | 753 | case MT_DISCONNECT: |
754 | case MT_INFORMATION: | 754 | case MT_INFORMATION: |
755 | case MT_FACILITY: | 755 | case MT_FACILITY: |
756 | case MT_NOTIFY: | 756 | case MT_NOTIFY: |
757 | case MT_PROGRESS: | 757 | case MT_PROGRESS: |
758 | case MT_RELEASE: | 758 | case MT_RELEASE: |
759 | case MT_RELEASE_COMPLETE: | 759 | case MT_RELEASE_COMPLETE: |
760 | case MT_SETUP: | 760 | case MT_SETUP: |
761 | case MT_SETUP_ACKNOWLEDGE: | 761 | case MT_SETUP_ACKNOWLEDGE: |
762 | case MT_RESUME_ACKNOWLEDGE: | 762 | case MT_RESUME_ACKNOWLEDGE: |
763 | case MT_RESUME_REJECT: | 763 | case MT_RESUME_REJECT: |
764 | case MT_SUSPEND_ACKNOWLEDGE: | 764 | case MT_SUSPEND_ACKNOWLEDGE: |
765 | case MT_SUSPEND_REJECT: | 765 | case MT_SUSPEND_REJECT: |
766 | case MT_USER_INFORMATION: | 766 | case MT_USER_INFORMATION: |
767 | case MT_RESTART: | 767 | case MT_RESTART: |
768 | case MT_RESTART_ACKNOWLEDGE: | 768 | case MT_RESTART_ACKNOWLEDGE: |
769 | case MT_CONGESTION_CONTROL: | 769 | case MT_CONGESTION_CONTROL: |
770 | case MT_STATUS: | 770 | case MT_STATUS: |
771 | case MT_STATUS_ENQUIRY: | 771 | case MT_STATUS_ENQUIRY: |
772 | if (pc->debug & L3_DEB_CHECK) | 772 | if (pc->debug & L3_DEB_CHECK) |
773 | l3_debug(pc->st, "l3ni1_check_messagetype_validity mt(%x) OK", mt); | 773 | l3_debug(pc->st, "l3ni1_check_messagetype_validity mt(%x) OK", mt); |
774 | break; | 774 | break; |
775 | case MT_RESUME: /* RESUME only in user->net */ | 775 | case MT_RESUME: /* RESUME only in user->net */ |
776 | case MT_SUSPEND: /* SUSPEND only in user->net */ | 776 | case MT_SUSPEND: /* SUSPEND only in user->net */ |
777 | default: | 777 | default: |
778 | if (pc->debug & (L3_DEB_CHECK | L3_DEB_WARN)) | 778 | if (pc->debug & (L3_DEB_CHECK | L3_DEB_WARN)) |
779 | l3_debug(pc->st, "l3ni1_check_messagetype_validity mt(%x) fail", mt); | 779 | l3_debug(pc->st, "l3ni1_check_messagetype_validity mt(%x) fail", mt); |
780 | pc->para.cause = 97; | 780 | pc->para.cause = 97; |
781 | l3ni1_status_send(pc, 0, NULL); | 781 | l3ni1_status_send(pc, 0, NULL); |
782 | return(1); | 782 | return (1); |
783 | } | 783 | } |
784 | return(0); | 784 | return (0); |
785 | } | 785 | } |
786 | 786 | ||
787 | static void | 787 | static void |
@@ -789,24 +789,24 @@ l3ni1_std_ie_err(struct l3_process *pc, int ret) { | |||
789 | 789 | ||
790 | if (pc->debug & L3_DEB_CHECK) | 790 | if (pc->debug & L3_DEB_CHECK) |
791 | l3_debug(pc->st, "check_infoelements ret %d", ret); | 791 | l3_debug(pc->st, "check_infoelements ret %d", ret); |
792 | switch(ret) { | 792 | switch (ret) { |
793 | case 0: | 793 | case 0: |
794 | break; | 794 | break; |
795 | case ERR_IE_COMPREHENSION: | 795 | case ERR_IE_COMPREHENSION: |
796 | pc->para.cause = 96; | 796 | pc->para.cause = 96; |
797 | l3ni1_status_send(pc, 0, NULL); | 797 | l3ni1_status_send(pc, 0, NULL); |
798 | break; | 798 | break; |
799 | case ERR_IE_UNRECOGNIZED: | 799 | case ERR_IE_UNRECOGNIZED: |
800 | pc->para.cause = 99; | 800 | pc->para.cause = 99; |
801 | l3ni1_status_send(pc, 0, NULL); | 801 | l3ni1_status_send(pc, 0, NULL); |
802 | break; | 802 | break; |
803 | case ERR_IE_LENGTH: | 803 | case ERR_IE_LENGTH: |
804 | pc->para.cause = 100; | 804 | pc->para.cause = 100; |
805 | l3ni1_status_send(pc, 0, NULL); | 805 | l3ni1_status_send(pc, 0, NULL); |
806 | break; | 806 | break; |
807 | case ERR_IE_SEQUENCE: | 807 | case ERR_IE_SEQUENCE: |
808 | default: | 808 | default: |
809 | break; | 809 | break; |
810 | } | 810 | } |
811 | } | 811 | } |
812 | 812 | ||
@@ -828,14 +828,14 @@ l3ni1_get_channel_id(struct l3_process *pc, struct sk_buff *skb) { | |||
828 | l3_debug(pc->st, "wrong chid %x", *p); | 828 | l3_debug(pc->st, "wrong chid %x", *p); |
829 | return (-3); | 829 | return (-3); |
830 | } | 830 | } |
831 | return(*p & 0x3); | 831 | return (*p & 0x3); |
832 | } else | 832 | } else |
833 | return(-1); | 833 | return (-1); |
834 | } | 834 | } |
835 | 835 | ||
836 | static int | 836 | static int |
837 | l3ni1_get_cause(struct l3_process *pc, struct sk_buff *skb) { | 837 | l3ni1_get_cause(struct l3_process *pc, struct sk_buff *skb) { |
838 | u_char l, i=0; | 838 | u_char l, i = 0; |
839 | u_char *p; | 839 | u_char *p; |
840 | 840 | ||
841 | p = skb->data; | 841 | p = skb->data; |
@@ -844,13 +844,13 @@ l3ni1_get_cause(struct l3_process *pc, struct sk_buff *skb) { | |||
844 | if ((p = findie(p, skb->len, IE_CAUSE, 0))) { | 844 | if ((p = findie(p, skb->len, IE_CAUSE, 0))) { |
845 | p++; | 845 | p++; |
846 | l = *p++; | 846 | l = *p++; |
847 | if (l>30) | 847 | if (l > 30) |
848 | return(1); | 848 | return (1); |
849 | if (l) { | 849 | if (l) { |
850 | pc->para.loc = *p++; | 850 | pc->para.loc = *p++; |
851 | l--; | 851 | l--; |
852 | } else { | 852 | } else { |
853 | return(2); | 853 | return (2); |
854 | } | 854 | } |
855 | if (l && !(pc->para.loc & 0x80)) { | 855 | if (l && !(pc->para.loc & 0x80)) { |
856 | l--; | 856 | l--; |
@@ -860,36 +860,36 @@ l3ni1_get_cause(struct l3_process *pc, struct sk_buff *skb) { | |||
860 | pc->para.cause = *p++; | 860 | pc->para.cause = *p++; |
861 | l--; | 861 | l--; |
862 | if (!(pc->para.cause & 0x80)) | 862 | if (!(pc->para.cause & 0x80)) |
863 | return(3); | 863 | return (3); |
864 | } else | 864 | } else |
865 | return(4); | 865 | return (4); |
866 | while (l && (i<6)) { | 866 | while (l && (i < 6)) { |
867 | pc->para.diag[i++] = *p++; | 867 | pc->para.diag[i++] = *p++; |
868 | l--; | 868 | l--; |
869 | } | 869 | } |
870 | } else | 870 | } else |
871 | return(-1); | 871 | return (-1); |
872 | return(0); | 872 | return (0); |
873 | } | 873 | } |
874 | 874 | ||
875 | static void | 875 | static void |
876 | l3ni1_msg_with_uus(struct l3_process *pc, u_char cmd) | 876 | l3ni1_msg_with_uus(struct l3_process *pc, u_char cmd) |
877 | { | 877 | { |
878 | struct sk_buff *skb; | 878 | struct sk_buff *skb; |
879 | u_char tmp[16+40]; | 879 | u_char tmp[16 + 40]; |
880 | u_char *p = tmp; | 880 | u_char *p = tmp; |
881 | int l; | 881 | int l; |
882 | 882 | ||
883 | MsgHead(p, pc->callref, cmd); | 883 | MsgHead(p, pc->callref, cmd); |
884 | 884 | ||
885 | if (pc->prot.ni1.uus1_data[0]) | 885 | if (pc->prot.ni1.uus1_data[0]) |
886 | { *p++ = IE_USER_USER; /* UUS info element */ | 886 | { *p++ = IE_USER_USER; /* UUS info element */ |
887 | *p++ = strlen(pc->prot.ni1.uus1_data) + 1; | 887 | *p++ = strlen(pc->prot.ni1.uus1_data) + 1; |
888 | *p++ = 0x04; /* IA5 chars */ | 888 | *p++ = 0x04; /* IA5 chars */ |
889 | strcpy(p,pc->prot.ni1.uus1_data); | 889 | strcpy(p, pc->prot.ni1.uus1_data); |
890 | p += strlen(pc->prot.ni1.uus1_data); | 890 | p += strlen(pc->prot.ni1.uus1_data); |
891 | pc->prot.ni1.uus1_data[0] = '\0'; | 891 | pc->prot.ni1.uus1_data[0] = '\0'; |
892 | } | 892 | } |
893 | 893 | ||
894 | l = p - tmp; | 894 | l = p - tmp; |
895 | if (!(skb = l3_alloc_skb(l))) | 895 | if (!(skb = l3_alloc_skb(l))) |
@@ -903,7 +903,7 @@ l3ni1_release_req(struct l3_process *pc, u_char pr, void *arg) | |||
903 | { | 903 | { |
904 | StopAllL3Timer(pc); | 904 | StopAllL3Timer(pc); |
905 | newl3state(pc, 19); | 905 | newl3state(pc, 19); |
906 | if (!pc->prot.ni1.uus1_data[0]) | 906 | if (!pc->prot.ni1.uus1_data[0]) |
907 | l3ni1_message(pc, MT_RELEASE); | 907 | l3ni1_message(pc, MT_RELEASE); |
908 | else | 908 | else |
909 | l3ni1_msg_with_uus(pc, MT_RELEASE); | 909 | l3ni1_msg_with_uus(pc, MT_RELEASE); |
@@ -916,9 +916,9 @@ l3ni1_release_cmpl(struct l3_process *pc, u_char pr, void *arg) | |||
916 | struct sk_buff *skb = arg; | 916 | struct sk_buff *skb = arg; |
917 | int ret; | 917 | int ret; |
918 | 918 | ||
919 | if ((ret = l3ni1_get_cause(pc, skb))>0) { | 919 | if ((ret = l3ni1_get_cause(pc, skb)) > 0) { |
920 | if (pc->debug & L3_DEB_WARN) | 920 | if (pc->debug & L3_DEB_WARN) |
921 | l3_debug(pc->st, "RELCMPL get_cause ret(%d)",ret); | 921 | l3_debug(pc->st, "RELCMPL get_cause ret(%d)", ret); |
922 | } else if (ret < 0) | 922 | } else if (ret < 0) |
923 | pc->para.cause = NO_CAUSE; | 923 | pc->para.cause = NO_CAUSE; |
924 | StopAllL3Timer(pc); | 924 | StopAllL3Timer(pc); |
@@ -930,7 +930,7 @@ l3ni1_release_cmpl(struct l3_process *pc, u_char pr, void *arg) | |||
930 | #if EXT_BEARER_CAPS | 930 | #if EXT_BEARER_CAPS |
931 | 931 | ||
932 | static u_char * | 932 | static u_char * |
933 | EncodeASyncParams(u_char * p, u_char si2) | 933 | EncodeASyncParams(u_char *p, u_char si2) |
934 | { // 7c 06 88 90 21 42 00 bb | 934 | { // 7c 06 88 90 21 42 00 bb |
935 | 935 | ||
936 | p[0] = 0; | 936 | p[0] = 0; |
@@ -958,38 +958,38 @@ EncodeASyncParams(u_char * p, u_char si2) | |||
958 | p[2] += 3; | 958 | p[2] += 3; |
959 | 959 | ||
960 | switch (si2 & 0x07) { | 960 | switch (si2 & 0x07) { |
961 | case 0: | 961 | case 0: |
962 | p[0] = 66; // 1200 bit/s | 962 | p[0] = 66; // 1200 bit/s |
963 | 963 | ||
964 | break; | 964 | break; |
965 | case 1: | 965 | case 1: |
966 | p[0] = 88; // 1200/75 bit/s | 966 | p[0] = 88; // 1200/75 bit/s |
967 | 967 | ||
968 | break; | 968 | break; |
969 | case 2: | 969 | case 2: |
970 | p[0] = 87; // 75/1200 bit/s | 970 | p[0] = 87; // 75/1200 bit/s |
971 | 971 | ||
972 | break; | 972 | break; |
973 | case 3: | 973 | case 3: |
974 | p[0] = 67; // 2400 bit/s | 974 | p[0] = 67; // 2400 bit/s |
975 | 975 | ||
976 | break; | 976 | break; |
977 | case 4: | 977 | case 4: |
978 | p[0] = 69; // 4800 bit/s | 978 | p[0] = 69; // 4800 bit/s |
979 | 979 | ||
980 | break; | 980 | break; |
981 | case 5: | 981 | case 5: |
982 | p[0] = 72; // 9600 bit/s | 982 | p[0] = 72; // 9600 bit/s |
983 | 983 | ||
984 | break; | 984 | break; |
985 | case 6: | 985 | case 6: |
986 | p[0] = 73; // 14400 bit/s | 986 | p[0] = 73; // 14400 bit/s |
987 | 987 | ||
988 | break; | 988 | break; |
989 | case 7: | 989 | case 7: |
990 | p[0] = 75; // 19200 bit/s | 990 | p[0] = 75; // 19200 bit/s |
991 | 991 | ||
992 | break; | 992 | break; |
993 | } | 993 | } |
994 | return p + 3; | 994 | return p + 3; |
995 | } | 995 | } |
@@ -999,84 +999,84 @@ EncodeSyncParams(u_char si2, u_char ai) | |||
999 | { | 999 | { |
1000 | 1000 | ||
1001 | switch (si2) { | 1001 | switch (si2) { |
1002 | case 0: | 1002 | case 0: |
1003 | return ai + 2; // 1200 bit/s | 1003 | return ai + 2; // 1200 bit/s |
1004 | 1004 | ||
1005 | case 1: | 1005 | case 1: |
1006 | return ai + 24; // 1200/75 bit/s | 1006 | return ai + 24; // 1200/75 bit/s |
1007 | 1007 | ||
1008 | case 2: | 1008 | case 2: |
1009 | return ai + 23; // 75/1200 bit/s | 1009 | return ai + 23; // 75/1200 bit/s |
1010 | 1010 | ||
1011 | case 3: | 1011 | case 3: |
1012 | return ai + 3; // 2400 bit/s | 1012 | return ai + 3; // 2400 bit/s |
1013 | 1013 | ||
1014 | case 4: | 1014 | case 4: |
1015 | return ai + 5; // 4800 bit/s | 1015 | return ai + 5; // 4800 bit/s |
1016 | 1016 | ||
1017 | case 5: | 1017 | case 5: |
1018 | return ai + 8; // 9600 bit/s | 1018 | return ai + 8; // 9600 bit/s |
1019 | 1019 | ||
1020 | case 6: | 1020 | case 6: |
1021 | return ai + 9; // 14400 bit/s | 1021 | return ai + 9; // 14400 bit/s |
1022 | 1022 | ||
1023 | case 7: | 1023 | case 7: |
1024 | return ai + 11; // 19200 bit/s | 1024 | return ai + 11; // 19200 bit/s |
1025 | 1025 | ||
1026 | case 8: | 1026 | case 8: |
1027 | return ai + 14; // 48000 bit/s | 1027 | return ai + 14; // 48000 bit/s |
1028 | 1028 | ||
1029 | case 9: | 1029 | case 9: |
1030 | return ai + 15; // 56000 bit/s | 1030 | return ai + 15; // 56000 bit/s |
1031 | 1031 | ||
1032 | case 15: | 1032 | case 15: |
1033 | return ai + 40; // negotiate bit/s | 1033 | return ai + 40; // negotiate bit/s |
1034 | 1034 | ||
1035 | default: | 1035 | default: |
1036 | break; | 1036 | break; |
1037 | } | 1037 | } |
1038 | return ai; | 1038 | return ai; |
1039 | } | 1039 | } |
1040 | 1040 | ||
1041 | 1041 | ||
1042 | static u_char | 1042 | static u_char |
1043 | DecodeASyncParams(u_char si2, u_char * p) | 1043 | DecodeASyncParams(u_char si2, u_char *p) |
1044 | { | 1044 | { |
1045 | u_char info; | 1045 | u_char info; |
1046 | 1046 | ||
1047 | switch (p[5]) { | 1047 | switch (p[5]) { |
1048 | case 66: // 1200 bit/s | 1048 | case 66: // 1200 bit/s |
1049 | 1049 | ||
1050 | break; // si2 don't change | 1050 | break; // si2 don't change |
1051 | 1051 | ||
1052 | case 88: // 1200/75 bit/s | 1052 | case 88: // 1200/75 bit/s |
1053 | 1053 | ||
1054 | si2 += 1; | 1054 | si2 += 1; |
1055 | break; | 1055 | break; |
1056 | case 87: // 75/1200 bit/s | 1056 | case 87: // 75/1200 bit/s |
1057 | 1057 | ||
1058 | si2 += 2; | 1058 | si2 += 2; |
1059 | break; | 1059 | break; |
1060 | case 67: // 2400 bit/s | 1060 | case 67: // 2400 bit/s |
1061 | 1061 | ||
1062 | si2 += 3; | 1062 | si2 += 3; |
1063 | break; | 1063 | break; |
1064 | case 69: // 4800 bit/s | 1064 | case 69: // 4800 bit/s |
1065 | 1065 | ||
1066 | si2 += 4; | 1066 | si2 += 4; |
1067 | break; | 1067 | break; |
1068 | case 72: // 9600 bit/s | 1068 | case 72: // 9600 bit/s |
1069 | 1069 | ||
1070 | si2 += 5; | 1070 | si2 += 5; |
1071 | break; | 1071 | break; |
1072 | case 73: // 14400 bit/s | 1072 | case 73: // 14400 bit/s |
1073 | 1073 | ||
1074 | si2 += 6; | 1074 | si2 += 6; |
1075 | break; | 1075 | break; |
1076 | case 75: // 19200 bit/s | 1076 | case 75: // 19200 bit/s |
1077 | 1077 | ||
1078 | si2 += 7; | 1078 | si2 += 7; |
1079 | break; | 1079 | break; |
1080 | } | 1080 | } |
1081 | 1081 | ||
1082 | info = p[7] & 0x7f; | 1082 | info = p[7] & 0x7f; |
@@ -1101,39 +1101,39 @@ DecodeSyncParams(u_char si2, u_char info) | |||
1101 | { | 1101 | { |
1102 | info &= 0x7f; | 1102 | info &= 0x7f; |
1103 | switch (info) { | 1103 | switch (info) { |
1104 | case 40: // bit/s negotiation failed ai := 165 not 175! | 1104 | case 40: // bit/s negotiation failed ai := 165 not 175! |
1105 | 1105 | ||
1106 | return si2 + 15; | 1106 | return si2 + 15; |
1107 | case 15: // 56000 bit/s failed, ai := 0 not 169 ! | 1107 | case 15: // 56000 bit/s failed, ai := 0 not 169 ! |
1108 | 1108 | ||
1109 | return si2 + 9; | 1109 | return si2 + 9; |
1110 | case 14: // 48000 bit/s | 1110 | case 14: // 48000 bit/s |
1111 | 1111 | ||
1112 | return si2 + 8; | 1112 | return si2 + 8; |
1113 | case 11: // 19200 bit/s | 1113 | case 11: // 19200 bit/s |
1114 | 1114 | ||
1115 | return si2 + 7; | 1115 | return si2 + 7; |
1116 | case 9: // 14400 bit/s | 1116 | case 9: // 14400 bit/s |
1117 | 1117 | ||
1118 | return si2 + 6; | 1118 | return si2 + 6; |
1119 | case 8: // 9600 bit/s | 1119 | case 8: // 9600 bit/s |
1120 | 1120 | ||
1121 | return si2 + 5; | 1121 | return si2 + 5; |
1122 | case 5: // 4800 bit/s | 1122 | case 5: // 4800 bit/s |
1123 | 1123 | ||
1124 | return si2 + 4; | 1124 | return si2 + 4; |
1125 | case 3: // 2400 bit/s | 1125 | case 3: // 2400 bit/s |
1126 | 1126 | ||
1127 | return si2 + 3; | 1127 | return si2 + 3; |
1128 | case 23: // 75/1200 bit/s | 1128 | case 23: // 75/1200 bit/s |
1129 | 1129 | ||
1130 | return si2 + 2; | 1130 | return si2 + 2; |
1131 | case 24: // 1200/75 bit/s | 1131 | case 24: // 1200/75 bit/s |
1132 | 1132 | ||
1133 | return si2 + 1; | 1133 | return si2 + 1; |
1134 | default: // 1200 bit/s | 1134 | default: // 1200 bit/s |
1135 | 1135 | ||
1136 | return si2; | 1136 | return si2; |
1137 | } | 1137 | } |
1138 | } | 1138 | } |
1139 | 1139 | ||
@@ -1144,20 +1144,20 @@ DecodeSI2(struct sk_buff *skb) | |||
1144 | 1144 | ||
1145 | if ((p = findie(skb->data, skb->len, 0x7c, 0))) { | 1145 | if ((p = findie(skb->data, skb->len, 0x7c, 0))) { |
1146 | switch (p[4] & 0x0f) { | 1146 | switch (p[4] & 0x0f) { |
1147 | case 0x01: | 1147 | case 0x01: |
1148 | if (p[1] == 0x04) // sync. Bitratenadaption | 1148 | if (p[1] == 0x04) // sync. Bitratenadaption |
1149 | 1149 | ||
1150 | return DecodeSyncParams(160, p[5]); // V.110/X.30 | 1150 | return DecodeSyncParams(160, p[5]); // V.110/X.30 |
1151 | 1151 | ||
1152 | else if (p[1] == 0x06) // async. Bitratenadaption | 1152 | else if (p[1] == 0x06) // async. Bitratenadaption |
1153 | 1153 | ||
1154 | return DecodeASyncParams(192, p); // V.110/X.30 | 1154 | return DecodeASyncParams(192, p); // V.110/X.30 |
1155 | 1155 | ||
1156 | break; | 1156 | break; |
1157 | case 0x08: // if (p[5] == 0x02) // sync. Bitratenadaption | 1157 | case 0x08: // if (p[5] == 0x02) // sync. Bitratenadaption |
1158 | if (p[1] > 3) | 1158 | if (p[1] > 3) |
1159 | return DecodeSyncParams(176, p[5]); // V.120 | 1159 | return DecodeSyncParams(176, p[5]); // V.120 |
1160 | break; | 1160 | break; |
1161 | } | 1161 | } |
1162 | } | 1162 | } |
1163 | return 0; | 1163 | return 0; |
@@ -1168,7 +1168,7 @@ DecodeSI2(struct sk_buff *skb) | |||
1168 | 1168 | ||
1169 | static void | 1169 | static void |
1170 | l3ni1_setup_req(struct l3_process *pc, u_char pr, | 1170 | l3ni1_setup_req(struct l3_process *pc, u_char pr, |
1171 | void *arg) | 1171 | void *arg) |
1172 | { | 1172 | { |
1173 | struct sk_buff *skb; | 1173 | struct sk_buff *skb; |
1174 | u_char tmp[128]; | 1174 | u_char tmp[128]; |
@@ -1191,7 +1191,7 @@ l3ni1_setup_req(struct l3_process *pc, u_char pr, | |||
1191 | case 1: /* Telephony */ | 1191 | case 1: /* Telephony */ |
1192 | *p++ = IE_BEARER; | 1192 | *p++ = IE_BEARER; |
1193 | *p++ = 0x3; /* Length */ | 1193 | *p++ = 0x3; /* Length */ |
1194 | *p++ = 0x90; /* 3.1khz Audio */ | 1194 | *p++ = 0x90; /* 3.1khz Audio */ |
1195 | *p++ = 0x90; /* Circuit-Mode 64kbps */ | 1195 | *p++ = 0x90; /* Circuit-Mode 64kbps */ |
1196 | *p++ = 0xa2; /* u-Law Audio */ | 1196 | *p++ = 0xa2; /* u-Law Audio */ |
1197 | break; | 1197 | break; |
@@ -1214,7 +1214,7 @@ l3ni1_setup_req(struct l3_process *pc, u_char pr, | |||
1214 | } else | 1214 | } else |
1215 | sp++; | 1215 | sp++; |
1216 | } | 1216 | } |
1217 | 1217 | ||
1218 | *p++ = IE_KEYPAD; | 1218 | *p++ = IE_KEYPAD; |
1219 | *p++ = strlen(teln); | 1219 | *p++ = strlen(teln); |
1220 | while (*teln) | 1220 | while (*teln) |
@@ -1222,7 +1222,7 @@ l3ni1_setup_req(struct l3_process *pc, u_char pr, | |||
1222 | 1222 | ||
1223 | if (sub) | 1223 | if (sub) |
1224 | *sub++ = '.'; | 1224 | *sub++ = '.'; |
1225 | 1225 | ||
1226 | #if EXT_BEARER_CAPS | 1226 | #if EXT_BEARER_CAPS |
1227 | if ((pc->para.setup.si2 >= 160) && (pc->para.setup.si2 <= 175)) { // sync. Bitratenadaption, V.110/X.30 | 1227 | if ((pc->para.setup.si2 >= 160) && (pc->para.setup.si2 <= 175)) { // sync. Bitratenadaption, V.110/X.30 |
1228 | 1228 | ||
@@ -1250,7 +1250,7 @@ l3ni1_setup_req(struct l3_process *pc, u_char pr, | |||
1250 | *p++ = 0x21; | 1250 | *p++ = 0x21; |
1251 | p = EncodeASyncParams(p, pc->para.setup.si2 - 192); | 1251 | p = EncodeASyncParams(p, pc->para.setup.si2 - 192); |
1252 | } else { | 1252 | } else { |
1253 | switch (pc->para.setup.si1) { | 1253 | switch (pc->para.setup.si1) { |
1254 | case 1: /* Telephony */ | 1254 | case 1: /* Telephony */ |
1255 | *p++ = IE_LLC; | 1255 | *p++ = IE_LLC; |
1256 | *p++ = 0x3; /* Length */ | 1256 | *p++ = 0x3; /* Length */ |
@@ -1266,14 +1266,14 @@ l3ni1_setup_req(struct l3_process *pc, u_char pr, | |||
1266 | *p++ = 0x88; /* Coding Std. CCITT, unrestr. dig. Inform. */ | 1266 | *p++ = 0x88; /* Coding Std. CCITT, unrestr. dig. Inform. */ |
1267 | *p++ = 0x90; /* Circuit-Mode 64kbps */ | 1267 | *p++ = 0x90; /* Circuit-Mode 64kbps */ |
1268 | break; | 1268 | break; |
1269 | } | 1269 | } |
1270 | } | 1270 | } |
1271 | #endif | 1271 | #endif |
1272 | l = p - tmp; | 1272 | l = p - tmp; |
1273 | if (!(skb = l3_alloc_skb(l))) | 1273 | if (!(skb = l3_alloc_skb(l))) |
1274 | { | 1274 | { |
1275 | return; | 1275 | return; |
1276 | } | 1276 | } |
1277 | memcpy(skb_put(skb, l), tmp, l); | 1277 | memcpy(skb_put(skb, l), tmp, l); |
1278 | L3DelTimer(&pc->timer); | 1278 | L3DelTimer(&pc->timer); |
1279 | L3AddTimer(&pc->timer, T303, CC_T303); | 1279 | L3AddTimer(&pc->timer, T303, CC_T303); |
@@ -1375,7 +1375,7 @@ l3ni1_disconnect(struct l3_process *pc, u_char pr, void *arg) | |||
1375 | cause = 96; | 1375 | cause = 96; |
1376 | else if (ret > 0) | 1376 | else if (ret > 0) |
1377 | cause = 100; | 1377 | cause = 100; |
1378 | } | 1378 | } |
1379 | if ((p = findie(skb->data, skb->len, IE_FACILITY, 0))) | 1379 | if ((p = findie(skb->data, skb->len, IE_FACILITY, 0))) |
1380 | l3ni1_parse_facility(pc->st, pc, pc->callref, p); | 1380 | l3ni1_parse_facility(pc->st, pc, pc->callref, p); |
1381 | ret = check_infoelements(pc, skb, ie_DISCONNECT); | 1381 | ret = check_infoelements(pc, skb, ie_DISCONNECT); |
@@ -1387,10 +1387,10 @@ l3ni1_disconnect(struct l3_process *pc, u_char pr, void *arg) | |||
1387 | newl3state(pc, 12); | 1387 | newl3state(pc, 12); |
1388 | if (cause) | 1388 | if (cause) |
1389 | newl3state(pc, 19); | 1389 | newl3state(pc, 19); |
1390 | if (11 != ret) | 1390 | if (11 != ret) |
1391 | pc->st->l3.l3l4(pc->st, CC_DISCONNECT | INDICATION, pc); | 1391 | pc->st->l3.l3l4(pc->st, CC_DISCONNECT | INDICATION, pc); |
1392 | else if (!cause) | 1392 | else if (!cause) |
1393 | l3ni1_release_req(pc, pr, NULL); | 1393 | l3ni1_release_req(pc, pr, NULL); |
1394 | if (cause) { | 1394 | if (cause) { |
1395 | l3ni1_message_cause(pc, MT_RELEASE, cause); | 1395 | l3ni1_message_cause(pc, MT_RELEASE, cause); |
1396 | L3AddTimer(&pc->timer, T308, CC_T308_1); | 1396 | L3AddTimer(&pc->timer, T308, CC_T308_1); |
@@ -1456,56 +1456,56 @@ l3ni1_setup(struct l3_process *pc, u_char pr, void *arg) | |||
1456 | else { | 1456 | else { |
1457 | pc->para.setup.si2 = 0; | 1457 | pc->para.setup.si2 = 0; |
1458 | switch (p[2] & 0x7f) { | 1458 | switch (p[2] & 0x7f) { |
1459 | case 0x00: /* Speech */ | 1459 | case 0x00: /* Speech */ |
1460 | case 0x10: /* 3.1 Khz audio */ | 1460 | case 0x10: /* 3.1 Khz audio */ |
1461 | pc->para.setup.si1 = 1; | 1461 | pc->para.setup.si1 = 1; |
1462 | break; | 1462 | break; |
1463 | case 0x08: /* Unrestricted digital information */ | 1463 | case 0x08: /* Unrestricted digital information */ |
1464 | pc->para.setup.si1 = 7; | 1464 | pc->para.setup.si1 = 7; |
1465 | /* JIM, 05.11.97 I wanna set service indicator 2 */ | 1465 | /* JIM, 05.11.97 I wanna set service indicator 2 */ |
1466 | #if EXT_BEARER_CAPS | 1466 | #if EXT_BEARER_CAPS |
1467 | pc->para.setup.si2 = DecodeSI2(skb); | 1467 | pc->para.setup.si2 = DecodeSI2(skb); |
1468 | #endif | 1468 | #endif |
1469 | break; | 1469 | break; |
1470 | case 0x09: /* Restricted digital information */ | 1470 | case 0x09: /* Restricted digital information */ |
1471 | pc->para.setup.si1 = 2; | 1471 | pc->para.setup.si1 = 2; |
1472 | break; | 1472 | break; |
1473 | case 0x11: | 1473 | case 0x11: |
1474 | /* Unrestr. digital information with | 1474 | /* Unrestr. digital information with |
1475 | * tones/announcements ( or 7 kHz audio | 1475 | * tones/announcements ( or 7 kHz audio |
1476 | */ | 1476 | */ |
1477 | pc->para.setup.si1 = 3; | 1477 | pc->para.setup.si1 = 3; |
1478 | break; | 1478 | break; |
1479 | case 0x18: /* Video */ | 1479 | case 0x18: /* Video */ |
1480 | pc->para.setup.si1 = 4; | 1480 | pc->para.setup.si1 = 4; |
1481 | break; | 1481 | break; |
1482 | default: | 1482 | default: |
1483 | err = 2; | 1483 | err = 2; |
1484 | break; | 1484 | break; |
1485 | } | 1485 | } |
1486 | switch (p[3] & 0x7f) { | 1486 | switch (p[3] & 0x7f) { |
1487 | case 0x40: /* packed mode */ | 1487 | case 0x40: /* packed mode */ |
1488 | pc->para.setup.si1 = 8; | 1488 | pc->para.setup.si1 = 8; |
1489 | break; | 1489 | break; |
1490 | case 0x10: /* 64 kbit */ | 1490 | case 0x10: /* 64 kbit */ |
1491 | case 0x11: /* 2*64 kbit */ | 1491 | case 0x11: /* 2*64 kbit */ |
1492 | case 0x13: /* 384 kbit */ | 1492 | case 0x13: /* 384 kbit */ |
1493 | case 0x15: /* 1536 kbit */ | 1493 | case 0x15: /* 1536 kbit */ |
1494 | case 0x17: /* 1920 kbit */ | 1494 | case 0x17: /* 1920 kbit */ |
1495 | pc->para.moderate = p[3] & 0x7f; | 1495 | pc->para.moderate = p[3] & 0x7f; |
1496 | break; | 1496 | break; |
1497 | default: | 1497 | default: |
1498 | err = 3; | 1498 | err = 3; |
1499 | break; | 1499 | break; |
1500 | } | 1500 | } |
1501 | } | 1501 | } |
1502 | if (pc->debug & L3_DEB_SI) | 1502 | if (pc->debug & L3_DEB_SI) |
1503 | l3_debug(pc->st, "SI=%d, AI=%d", | 1503 | l3_debug(pc->st, "SI=%d, AI=%d", |
1504 | pc->para.setup.si1, pc->para.setup.si2); | 1504 | pc->para.setup.si1, pc->para.setup.si2); |
1505 | if (err) { | 1505 | if (err) { |
1506 | if (pc->debug & L3_DEB_WARN) | 1506 | if (pc->debug & L3_DEB_WARN) |
1507 | l3_debug(pc->st, "setup with wrong bearer(l=%d:%x,%x)", | 1507 | l3_debug(pc->st, "setup with wrong bearer(l=%d:%x,%x)", |
1508 | p[1], p[2], p[3]); | 1508 | p[1], p[2], p[3]); |
1509 | pc->para.cause = 100; | 1509 | pc->para.cause = 100; |
1510 | l3ni1_msg_without_setup(pc, pr, NULL); | 1510 | l3ni1_msg_without_setup(pc, pr, NULL); |
1511 | return; | 1511 | return; |
@@ -1526,17 +1526,17 @@ l3ni1_setup(struct l3_process *pc, u_char pr, void *arg) | |||
1526 | if ((3 == id) && (0x10 == pc->para.moderate)) { | 1526 | if ((3 == id) && (0x10 == pc->para.moderate)) { |
1527 | if (pc->debug & L3_DEB_WARN) | 1527 | if (pc->debug & L3_DEB_WARN) |
1528 | l3_debug(pc->st, "setup with wrong chid %x", | 1528 | l3_debug(pc->st, "setup with wrong chid %x", |
1529 | id); | 1529 | id); |
1530 | pc->para.cause = 100; | 1530 | pc->para.cause = 100; |
1531 | l3ni1_msg_without_setup(pc, pr, NULL); | 1531 | l3ni1_msg_without_setup(pc, pr, NULL); |
1532 | return; | 1532 | return; |
1533 | } | 1533 | } |
1534 | bcfound++; | 1534 | bcfound++; |
1535 | } else | 1535 | } else |
1536 | { if (pc->debug & L3_DEB_WARN) | 1536 | { if (pc->debug & L3_DEB_WARN) |
1537 | l3_debug(pc->st, "setup without bchannel, call waiting"); | 1537 | l3_debug(pc->st, "setup without bchannel, call waiting"); |
1538 | bcfound++; | 1538 | bcfound++; |
1539 | } | 1539 | } |
1540 | } else { | 1540 | } else { |
1541 | if (pc->debug & L3_DEB_WARN) | 1541 | if (pc->debug & L3_DEB_WARN) |
1542 | l3_debug(pc->st, "setup with wrong chid ret %d", id); | 1542 | l3_debug(pc->st, "setup with wrong chid ret %d", id); |
@@ -1611,7 +1611,7 @@ static void | |||
1611 | l3ni1_disconnect_req(struct l3_process *pc, u_char pr, void *arg) | 1611 | l3ni1_disconnect_req(struct l3_process *pc, u_char pr, void *arg) |
1612 | { | 1612 | { |
1613 | struct sk_buff *skb; | 1613 | struct sk_buff *skb; |
1614 | u_char tmp[16+40]; | 1614 | u_char tmp[16 + 40]; |
1615 | u_char *p = tmp; | 1615 | u_char *p = tmp; |
1616 | int l; | 1616 | int l; |
1617 | u_char cause = 16; | 1617 | u_char cause = 16; |
@@ -1628,14 +1628,14 @@ l3ni1_disconnect_req(struct l3_process *pc, u_char pr, void *arg) | |||
1628 | *p++ = 0x80; | 1628 | *p++ = 0x80; |
1629 | *p++ = cause | 0x80; | 1629 | *p++ = cause | 0x80; |
1630 | 1630 | ||
1631 | if (pc->prot.ni1.uus1_data[0]) | 1631 | if (pc->prot.ni1.uus1_data[0]) |
1632 | { *p++ = IE_USER_USER; /* UUS info element */ | 1632 | { *p++ = IE_USER_USER; /* UUS info element */ |
1633 | *p++ = strlen(pc->prot.ni1.uus1_data) + 1; | 1633 | *p++ = strlen(pc->prot.ni1.uus1_data) + 1; |
1634 | *p++ = 0x04; /* IA5 chars */ | 1634 | *p++ = 0x04; /* IA5 chars */ |
1635 | strcpy(p,pc->prot.ni1.uus1_data); | 1635 | strcpy(p, pc->prot.ni1.uus1_data); |
1636 | p += strlen(pc->prot.ni1.uus1_data); | 1636 | p += strlen(pc->prot.ni1.uus1_data); |
1637 | pc->prot.ni1.uus1_data[0] = '\0'; | 1637 | pc->prot.ni1.uus1_data[0] = '\0'; |
1638 | } | 1638 | } |
1639 | 1639 | ||
1640 | l = p - tmp; | 1640 | l = p - tmp; |
1641 | if (!(skb = l3_alloc_skb(l))) | 1641 | if (!(skb = l3_alloc_skb(l))) |
@@ -1648,18 +1648,18 @@ l3ni1_disconnect_req(struct l3_process *pc, u_char pr, void *arg) | |||
1648 | 1648 | ||
1649 | static void | 1649 | static void |
1650 | l3ni1_setup_rsp(struct l3_process *pc, u_char pr, | 1650 | l3ni1_setup_rsp(struct l3_process *pc, u_char pr, |
1651 | void *arg) | 1651 | void *arg) |
1652 | { | 1652 | { |
1653 | if (!pc->para.bchannel) | 1653 | if (!pc->para.bchannel) |
1654 | { if (pc->debug & L3_DEB_WARN) | 1654 | { if (pc->debug & L3_DEB_WARN) |
1655 | l3_debug(pc->st, "D-chan connect for waiting call"); | 1655 | l3_debug(pc->st, "D-chan connect for waiting call"); |
1656 | l3ni1_disconnect_req(pc, pr, arg); | 1656 | l3ni1_disconnect_req(pc, pr, arg); |
1657 | return; | 1657 | return; |
1658 | } | 1658 | } |
1659 | newl3state(pc, 8); | 1659 | newl3state(pc, 8); |
1660 | if (pc->debug & L3_DEB_WARN) | 1660 | if (pc->debug & L3_DEB_WARN) |
1661 | l3_debug(pc->st, "D-chan connect for waiting call"); | 1661 | l3_debug(pc->st, "D-chan connect for waiting call"); |
1662 | l3ni1_message_plus_chid(pc, MT_CONNECT); /* GE 05/09/00 */ | 1662 | l3ni1_message_plus_chid(pc, MT_CONNECT); /* GE 05/09/00 */ |
1663 | L3DelTimer(&pc->timer); | 1663 | L3DelTimer(&pc->timer); |
1664 | L3AddTimer(&pc->timer, T313, CC_T313); | 1664 | L3AddTimer(&pc->timer, T313, CC_T313); |
1665 | } | 1665 | } |
@@ -1716,26 +1716,26 @@ l3ni1_release(struct l3_process *pc, u_char pr, void *arg) | |||
1716 | { | 1716 | { |
1717 | struct sk_buff *skb = arg; | 1717 | struct sk_buff *skb = arg; |
1718 | u_char *p; | 1718 | u_char *p; |
1719 | int ret, cause=0; | 1719 | int ret, cause = 0; |
1720 | 1720 | ||
1721 | StopAllL3Timer(pc); | 1721 | StopAllL3Timer(pc); |
1722 | if ((ret = l3ni1_get_cause(pc, skb))>0) { | 1722 | if ((ret = l3ni1_get_cause(pc, skb)) > 0) { |
1723 | if (pc->debug & L3_DEB_WARN) | 1723 | if (pc->debug & L3_DEB_WARN) |
1724 | l3_debug(pc->st, "REL get_cause ret(%d)", ret); | 1724 | l3_debug(pc->st, "REL get_cause ret(%d)", ret); |
1725 | } else if (ret<0) | 1725 | } else if (ret < 0) |
1726 | pc->para.cause = NO_CAUSE; | 1726 | pc->para.cause = NO_CAUSE; |
1727 | if ((p = findie(skb->data, skb->len, IE_FACILITY, 0))) { | 1727 | if ((p = findie(skb->data, skb->len, IE_FACILITY, 0))) { |
1728 | l3ni1_parse_facility(pc->st, pc, pc->callref, p); | 1728 | l3ni1_parse_facility(pc->st, pc, pc->callref, p); |
1729 | } | 1729 | } |
1730 | if ((ret<0) && (pc->state != 11)) | 1730 | if ((ret < 0) && (pc->state != 11)) |
1731 | cause = 96; | 1731 | cause = 96; |
1732 | else if (ret>0) | 1732 | else if (ret > 0) |
1733 | cause = 100; | 1733 | cause = 100; |
1734 | ret = check_infoelements(pc, skb, ie_RELEASE); | 1734 | ret = check_infoelements(pc, skb, ie_RELEASE); |
1735 | if (ERR_IE_COMPREHENSION == ret) | 1735 | if (ERR_IE_COMPREHENSION == ret) |
1736 | cause = 96; | 1736 | cause = 96; |
1737 | else if ((ERR_IE_UNRECOGNIZED == ret) && (!cause)) | 1737 | else if ((ERR_IE_UNRECOGNIZED == ret) && (!cause)) |
1738 | cause = 99; | 1738 | cause = 99; |
1739 | if (cause) | 1739 | if (cause) |
1740 | l3ni1_message_cause(pc, MT_RELEASE_COMPLETE, cause); | 1740 | l3ni1_message_cause(pc, MT_RELEASE_COMPLETE, cause); |
1741 | else | 1741 | else |
@@ -1747,27 +1747,27 @@ l3ni1_release(struct l3_process *pc, u_char pr, void *arg) | |||
1747 | 1747 | ||
1748 | static void | 1748 | static void |
1749 | l3ni1_alert_req(struct l3_process *pc, u_char pr, | 1749 | l3ni1_alert_req(struct l3_process *pc, u_char pr, |
1750 | void *arg) | 1750 | void *arg) |
1751 | { | 1751 | { |
1752 | newl3state(pc, 7); | 1752 | newl3state(pc, 7); |
1753 | if (!pc->prot.ni1.uus1_data[0]) | 1753 | if (!pc->prot.ni1.uus1_data[0]) |
1754 | l3ni1_message(pc, MT_ALERTING); | 1754 | l3ni1_message(pc, MT_ALERTING); |
1755 | else | 1755 | else |
1756 | l3ni1_msg_with_uus(pc, MT_ALERTING); | 1756 | l3ni1_msg_with_uus(pc, MT_ALERTING); |
1757 | } | 1757 | } |
1758 | 1758 | ||
1759 | static void | 1759 | static void |
1760 | l3ni1_proceed_req(struct l3_process *pc, u_char pr, | 1760 | l3ni1_proceed_req(struct l3_process *pc, u_char pr, |
1761 | void *arg) | 1761 | void *arg) |
1762 | { | 1762 | { |
1763 | newl3state(pc, 9); | 1763 | newl3state(pc, 9); |
1764 | l3ni1_message(pc, MT_CALL_PROCEEDING); | 1764 | l3ni1_message(pc, MT_CALL_PROCEEDING); |
1765 | pc->st->l3.l3l4(pc->st, CC_PROCEED_SEND | INDICATION, pc); | 1765 | pc->st->l3.l3l4(pc->st, CC_PROCEED_SEND | INDICATION, pc); |
1766 | } | 1766 | } |
1767 | 1767 | ||
1768 | static void | 1768 | static void |
1769 | l3ni1_setup_ack_req(struct l3_process *pc, u_char pr, | 1769 | l3ni1_setup_ack_req(struct l3_process *pc, u_char pr, |
1770 | void *arg) | 1770 | void *arg) |
1771 | { | 1771 | { |
1772 | newl3state(pc, 25); | 1772 | newl3state(pc, 25); |
1773 | L3DelTimer(&pc->timer); | 1773 | L3DelTimer(&pc->timer); |
@@ -1781,22 +1781,22 @@ l3ni1_setup_ack_req(struct l3_process *pc, u_char pr, | |||
1781 | static void | 1781 | static void |
1782 | l3ni1_deliver_display(struct l3_process *pc, int pr, u_char *infp) | 1782 | l3ni1_deliver_display(struct l3_process *pc, int pr, u_char *infp) |
1783 | { u_char len; | 1783 | { u_char len; |
1784 | isdn_ctrl ic; | 1784 | isdn_ctrl ic; |
1785 | struct IsdnCardState *cs; | 1785 | struct IsdnCardState *cs; |
1786 | char *p; | 1786 | char *p; |
1787 | 1787 | ||
1788 | if (*infp++ != IE_DISPLAY) return; | 1788 | if (*infp++ != IE_DISPLAY) return; |
1789 | if ((len = *infp++) > 80) return; /* total length <= 82 */ | 1789 | if ((len = *infp++) > 80) return; /* total length <= 82 */ |
1790 | if (!pc->chan) return; | 1790 | if (!pc->chan) return; |
1791 | 1791 | ||
1792 | p = ic.parm.display; | 1792 | p = ic.parm.display; |
1793 | while (len--) | 1793 | while (len--) |
1794 | *p++ = *infp++; | 1794 | *p++ = *infp++; |
1795 | *p = '\0'; | 1795 | *p = '\0'; |
1796 | ic.command = ISDN_STAT_DISPLAY; | 1796 | ic.command = ISDN_STAT_DISPLAY; |
1797 | cs = pc->st->l1.hardware; | 1797 | cs = pc->st->l1.hardware; |
1798 | ic.driver = cs->myid; | 1798 | ic.driver = cs->myid; |
1799 | ic.arg = pc->chan->chan; | 1799 | ic.arg = pc->chan->chan; |
1800 | cs->iif.statcallb(&ic); | 1800 | cs->iif.statcallb(&ic); |
1801 | } /* l3ni1_deliver_display */ | 1801 | } /* l3ni1_deliver_display */ |
1802 | 1802 | ||
@@ -1814,37 +1814,37 @@ l3ni1_progress(struct l3_process *pc, u_char pr, void *arg) | |||
1814 | pc->para.cause = 100; | 1814 | pc->para.cause = 100; |
1815 | } else if (!(p[2] & 0x70)) { | 1815 | } else if (!(p[2] & 0x70)) { |
1816 | switch (p[2]) { | 1816 | switch (p[2]) { |
1817 | case 0x80: | 1817 | case 0x80: |
1818 | case 0x81: | ||
1819 | case 0x82: | ||
1820 | case 0x84: | ||
1821 | case 0x85: | ||
1822 | case 0x87: | ||
1823 | case 0x8a: | ||
1824 | switch (p[3]) { | ||
1818 | case 0x81: | 1825 | case 0x81: |
1819 | case 0x82: | 1826 | case 0x82: |
1827 | case 0x83: | ||
1820 | case 0x84: | 1828 | case 0x84: |
1821 | case 0x85: | 1829 | case 0x88: |
1822 | case 0x87: | ||
1823 | case 0x8a: | ||
1824 | switch (p[3]) { | ||
1825 | case 0x81: | ||
1826 | case 0x82: | ||
1827 | case 0x83: | ||
1828 | case 0x84: | ||
1829 | case 0x88: | ||
1830 | break; | ||
1831 | default: | ||
1832 | err = 2; | ||
1833 | pc->para.cause = 100; | ||
1834 | break; | ||
1835 | } | ||
1836 | break; | 1830 | break; |
1837 | default: | 1831 | default: |
1838 | err = 3; | 1832 | err = 2; |
1839 | pc->para.cause = 100; | 1833 | pc->para.cause = 100; |
1840 | break; | 1834 | break; |
1835 | } | ||
1836 | break; | ||
1837 | default: | ||
1838 | err = 3; | ||
1839 | pc->para.cause = 100; | ||
1840 | break; | ||
1841 | } | 1841 | } |
1842 | } | 1842 | } |
1843 | } else { | 1843 | } else { |
1844 | pc->para.cause = 96; | 1844 | pc->para.cause = 96; |
1845 | err = 4; | 1845 | err = 4; |
1846 | } | 1846 | } |
1847 | if (err) { | 1847 | if (err) { |
1848 | if (pc->debug & L3_DEB_WARN) | 1848 | if (pc->debug & L3_DEB_WARN) |
1849 | l3_debug(pc->st, "progress error %d", err); | 1849 | l3_debug(pc->st, "progress error %d", err); |
1850 | l3ni1_status_send(pc, pr, NULL); | 1850 | l3ni1_status_send(pc, pr, NULL); |
@@ -1871,21 +1871,21 @@ l3ni1_notify(struct l3_process *pc, u_char pr, void *arg) | |||
1871 | pc->para.cause = 100; | 1871 | pc->para.cause = 100; |
1872 | } else { | 1872 | } else { |
1873 | switch (p[2]) { | 1873 | switch (p[2]) { |
1874 | case 0x80: | 1874 | case 0x80: |
1875 | case 0x81: | 1875 | case 0x81: |
1876 | case 0x82: | 1876 | case 0x82: |
1877 | break; | 1877 | break; |
1878 | default: | 1878 | default: |
1879 | pc->para.cause = 100; | 1879 | pc->para.cause = 100; |
1880 | err = 2; | 1880 | err = 2; |
1881 | break; | 1881 | break; |
1882 | } | 1882 | } |
1883 | } | 1883 | } |
1884 | } else { | 1884 | } else { |
1885 | pc->para.cause = 96; | 1885 | pc->para.cause = 96; |
1886 | err = 3; | 1886 | err = 3; |
1887 | } | 1887 | } |
1888 | if (err) { | 1888 | if (err) { |
1889 | if (pc->debug & L3_DEB_WARN) | 1889 | if (pc->debug & L3_DEB_WARN) |
1890 | l3_debug(pc->st, "notify error %d", err); | 1890 | l3_debug(pc->st, "notify error %d", err); |
1891 | l3ni1_status_send(pc, pr, NULL); | 1891 | l3ni1_status_send(pc, pr, NULL); |
@@ -1908,7 +1908,7 @@ l3ni1_status_enq(struct l3_process *pc, u_char pr, void *arg) | |||
1908 | ret = check_infoelements(pc, skb, ie_STATUS_ENQUIRY); | 1908 | ret = check_infoelements(pc, skb, ie_STATUS_ENQUIRY); |
1909 | l3ni1_std_ie_err(pc, ret); | 1909 | l3ni1_std_ie_err(pc, ret); |
1910 | pc->para.cause = 30; /* response to STATUS_ENQUIRY */ | 1910 | pc->para.cause = 30; /* response to STATUS_ENQUIRY */ |
1911 | l3ni1_status_send(pc, pr, NULL); | 1911 | l3ni1_status_send(pc, pr, NULL); |
1912 | } | 1912 | } |
1913 | 1913 | ||
1914 | static void | 1914 | static void |
@@ -1942,68 +1942,68 @@ static void l3ni1_redir_req(struct l3_process *pc, u_char pr, void *arg) | |||
1942 | struct sk_buff *skb; | 1942 | struct sk_buff *skb; |
1943 | u_char tmp[128]; | 1943 | u_char tmp[128]; |
1944 | u_char *p = tmp; | 1944 | u_char *p = tmp; |
1945 | u_char *subp; | 1945 | u_char *subp; |
1946 | u_char len_phone = 0; | 1946 | u_char len_phone = 0; |
1947 | u_char len_sub = 0; | 1947 | u_char len_sub = 0; |
1948 | int l; | 1948 | int l; |
1949 | 1949 | ||
1950 | 1950 | ||
1951 | strcpy(pc->prot.ni1.uus1_data,pc->chan->setup.eazmsn); /* copy uus element if available */ | 1951 | strcpy(pc->prot.ni1.uus1_data, pc->chan->setup.eazmsn); /* copy uus element if available */ |
1952 | if (!pc->chan->setup.phone[0]) | 1952 | if (!pc->chan->setup.phone[0]) |
1953 | { pc->para.cause = -1; | 1953 | { pc->para.cause = -1; |
1954 | l3ni1_disconnect_req(pc,pr,arg); /* disconnect immediately */ | 1954 | l3ni1_disconnect_req(pc, pr, arg); /* disconnect immediately */ |
1955 | return; | 1955 | return; |
1956 | } /* only uus */ | 1956 | } /* only uus */ |
1957 | 1957 | ||
1958 | if (pc->prot.ni1.invoke_id) | 1958 | if (pc->prot.ni1.invoke_id) |
1959 | free_invoke_id(pc->st,pc->prot.ni1.invoke_id); | 1959 | free_invoke_id(pc->st, pc->prot.ni1.invoke_id); |
1960 | 1960 | ||
1961 | if (!(pc->prot.ni1.invoke_id = new_invoke_id(pc->st))) | 1961 | if (!(pc->prot.ni1.invoke_id = new_invoke_id(pc->st))) |
1962 | return; | 1962 | return; |
1963 | 1963 | ||
1964 | MsgHead(p, pc->callref, MT_FACILITY); | 1964 | MsgHead(p, pc->callref, MT_FACILITY); |
1965 | 1965 | ||
1966 | for (subp = pc->chan->setup.phone; (*subp) && (*subp != '.'); subp++) len_phone++; /* len of phone number */ | 1966 | for (subp = pc->chan->setup.phone; (*subp) && (*subp != '.'); subp++) len_phone++; /* len of phone number */ |
1967 | if (*subp++ == '.') len_sub = strlen(subp) + 2; /* length including info subaddress element */ | 1967 | if (*subp++ == '.') len_sub = strlen(subp) + 2; /* length including info subaddress element */ |
1968 | 1968 | ||
1969 | *p++ = 0x1c; /* Facility info element */ | 1969 | *p++ = 0x1c; /* Facility info element */ |
1970 | *p++ = len_phone + len_sub + 2 + 2 + 8 + 3 + 3; /* length of element */ | 1970 | *p++ = len_phone + len_sub + 2 + 2 + 8 + 3 + 3; /* length of element */ |
1971 | *p++ = 0x91; /* remote operations protocol */ | 1971 | *p++ = 0x91; /* remote operations protocol */ |
1972 | *p++ = 0xa1; /* invoke component */ | 1972 | *p++ = 0xa1; /* invoke component */ |
1973 | 1973 | ||
1974 | *p++ = len_phone + len_sub + 2 + 2 + 8 + 3; /* length of data */ | 1974 | *p++ = len_phone + len_sub + 2 + 2 + 8 + 3; /* length of data */ |
1975 | *p++ = 0x02; /* invoke id tag, integer */ | 1975 | *p++ = 0x02; /* invoke id tag, integer */ |
1976 | *p++ = 0x01; /* length */ | 1976 | *p++ = 0x01; /* length */ |
1977 | *p++ = pc->prot.ni1.invoke_id; /* invoke id */ | 1977 | *p++ = pc->prot.ni1.invoke_id; /* invoke id */ |
1978 | *p++ = 0x02; /* operation value tag, integer */ | 1978 | *p++ = 0x02; /* operation value tag, integer */ |
1979 | *p++ = 0x01; /* length */ | 1979 | *p++ = 0x01; /* length */ |
1980 | *p++ = 0x0D; /* Call Deflect */ | 1980 | *p++ = 0x0D; /* Call Deflect */ |
1981 | 1981 | ||
1982 | *p++ = 0x30; /* sequence phone number */ | 1982 | *p++ = 0x30; /* sequence phone number */ |
1983 | *p++ = len_phone + 2 + 2 + 3 + len_sub; /* length */ | 1983 | *p++ = len_phone + 2 + 2 + 3 + len_sub; /* length */ |
1984 | 1984 | ||
1985 | *p++ = 0x30; /* Deflected to UserNumber */ | 1985 | *p++ = 0x30; /* Deflected to UserNumber */ |
1986 | *p++ = len_phone+2+len_sub; /* length */ | 1986 | *p++ = len_phone + 2 + len_sub; /* length */ |
1987 | *p++ = 0x80; /* NumberDigits */ | 1987 | *p++ = 0x80; /* NumberDigits */ |
1988 | *p++ = len_phone; /* length */ | 1988 | *p++ = len_phone; /* length */ |
1989 | for (l = 0; l < len_phone; l++) | 1989 | for (l = 0; l < len_phone; l++) |
1990 | *p++ = pc->chan->setup.phone[l]; | 1990 | *p++ = pc->chan->setup.phone[l]; |
1991 | 1991 | ||
1992 | if (len_sub) | 1992 | if (len_sub) |
1993 | { *p++ = 0x04; /* called party subaddress */ | 1993 | { *p++ = 0x04; /* called party subaddress */ |
1994 | *p++ = len_sub - 2; | 1994 | *p++ = len_sub - 2; |
1995 | while (*subp) *p++ = *subp++; | 1995 | while (*subp) *p++ = *subp++; |
1996 | } | 1996 | } |
1997 | 1997 | ||
1998 | *p++ = 0x01; /* screening identifier */ | 1998 | *p++ = 0x01; /* screening identifier */ |
1999 | *p++ = 0x01; | 1999 | *p++ = 0x01; |
2000 | *p++ = pc->chan->setup.screen; | 2000 | *p++ = pc->chan->setup.screen; |
2001 | 2001 | ||
2002 | l = p - tmp; | 2002 | l = p - tmp; |
2003 | if (!(skb = l3_alloc_skb(l))) return; | 2003 | if (!(skb = l3_alloc_skb(l))) return; |
2004 | memcpy(skb_put(skb, l), tmp, l); | 2004 | memcpy(skb_put(skb, l), tmp, l); |
2005 | 2005 | ||
2006 | l3_msg(pc->st, DL_DATA | REQUEST, skb); | 2006 | l3_msg(pc->st, DL_DATA | REQUEST, skb); |
2007 | } /* l3ni1_redir_req */ | 2007 | } /* l3ni1_redir_req */ |
2008 | 2008 | ||
2009 | /********************************************/ | 2009 | /********************************************/ |
@@ -2011,8 +2011,8 @@ static void l3ni1_redir_req(struct l3_process *pc, u_char pr, void *arg) | |||
2011 | /********************************************/ | 2011 | /********************************************/ |
2012 | static void l3ni1_redir_req_early(struct l3_process *pc, u_char pr, void *arg) | 2012 | static void l3ni1_redir_req_early(struct l3_process *pc, u_char pr, void *arg) |
2013 | { | 2013 | { |
2014 | l3ni1_proceed_req(pc,pr,arg); | 2014 | l3ni1_proceed_req(pc, pr, arg); |
2015 | l3ni1_redir_req(pc,pr,arg); | 2015 | l3ni1_redir_req(pc, pr, arg); |
2016 | } /* l3ni1_redir_req_early */ | 2016 | } /* l3ni1_redir_req_early */ |
2017 | 2017 | ||
2018 | /***********************************************/ | 2018 | /***********************************************/ |
@@ -2022,108 +2022,108 @@ static void l3ni1_redir_req_early(struct l3_process *pc, u_char pr, void *arg) | |||
2022 | /***********************************************/ | 2022 | /***********************************************/ |
2023 | static int l3ni1_cmd_global(struct PStack *st, isdn_ctrl *ic) | 2023 | static int l3ni1_cmd_global(struct PStack *st, isdn_ctrl *ic) |
2024 | { u_char id; | 2024 | { u_char id; |
2025 | u_char temp[265]; | 2025 | u_char temp[265]; |
2026 | u_char *p = temp; | 2026 | u_char *p = temp; |
2027 | int i, l, proc_len; | 2027 | int i, l, proc_len; |
2028 | struct sk_buff *skb; | 2028 | struct sk_buff *skb; |
2029 | struct l3_process *pc = NULL; | 2029 | struct l3_process *pc = NULL; |
2030 | 2030 | ||
2031 | switch (ic->arg) | 2031 | switch (ic->arg) |
2032 | { case NI1_CMD_INVOKE: | 2032 | { case NI1_CMD_INVOKE: |
2033 | if (ic->parm.ni1_io.datalen < 0) return(-2); /* invalid parameter */ | 2033 | if (ic->parm.ni1_io.datalen < 0) return (-2); /* invalid parameter */ |
2034 | 2034 | ||
2035 | for (proc_len = 1, i = ic->parm.ni1_io.proc >> 8; i; i++) | 2035 | for (proc_len = 1, i = ic->parm.ni1_io.proc >> 8; i; i++) |
2036 | i = i >> 8; /* add one byte */ | 2036 | i = i >> 8; /* add one byte */ |
2037 | l = ic->parm.ni1_io.datalen + proc_len + 8; /* length excluding ie header */ | 2037 | l = ic->parm.ni1_io.datalen + proc_len + 8; /* length excluding ie header */ |
2038 | if (l > 255) | 2038 | if (l > 255) |
2039 | return(-2); /* too long */ | 2039 | return (-2); /* too long */ |
2040 | 2040 | ||
2041 | if (!(id = new_invoke_id(st))) | 2041 | if (!(id = new_invoke_id(st))) |
2042 | return(0); /* first get a invoke id -> return if no available */ | 2042 | return (0); /* first get a invoke id -> return if no available */ |
2043 | 2043 | ||
2044 | i = -1; | 2044 | i = -1; |
2045 | MsgHead(p, i, MT_FACILITY); /* build message head */ | 2045 | MsgHead(p, i, MT_FACILITY); /* build message head */ |
2046 | *p++ = 0x1C; /* Facility IE */ | 2046 | *p++ = 0x1C; /* Facility IE */ |
2047 | *p++ = l; /* length of ie */ | 2047 | *p++ = l; /* length of ie */ |
2048 | *p++ = 0x91; /* remote operations */ | 2048 | *p++ = 0x91; /* remote operations */ |
2049 | *p++ = 0xA1; /* invoke */ | 2049 | *p++ = 0xA1; /* invoke */ |
2050 | *p++ = l - 3; /* length of invoke */ | 2050 | *p++ = l - 3; /* length of invoke */ |
2051 | *p++ = 0x02; /* invoke id tag */ | 2051 | *p++ = 0x02; /* invoke id tag */ |
2052 | *p++ = 0x01; /* length is 1 */ | 2052 | *p++ = 0x01; /* length is 1 */ |
2053 | *p++ = id; /* invoke id */ | 2053 | *p++ = id; /* invoke id */ |
2054 | *p++ = 0x02; /* operation */ | 2054 | *p++ = 0x02; /* operation */ |
2055 | *p++ = proc_len; /* length of operation */ | 2055 | *p++ = proc_len; /* length of operation */ |
2056 | 2056 | ||
2057 | for (i = proc_len; i; i--) | 2057 | for (i = proc_len; i; i--) |
2058 | *p++ = (ic->parm.ni1_io.proc >> (i-1)) & 0xFF; | 2058 | *p++ = (ic->parm.ni1_io.proc >> (i - 1)) & 0xFF; |
2059 | memcpy(p, ic->parm.ni1_io.data, ic->parm.ni1_io.datalen); /* copy data */ | 2059 | memcpy(p, ic->parm.ni1_io.data, ic->parm.ni1_io.datalen); /* copy data */ |
2060 | l = (p - temp) + ic->parm.ni1_io.datalen; /* total length */ | 2060 | l = (p - temp) + ic->parm.ni1_io.datalen; /* total length */ |
2061 | 2061 | ||
2062 | if (ic->parm.ni1_io.timeout > 0) | 2062 | if (ic->parm.ni1_io.timeout > 0) |
2063 | if (!(pc = ni1_new_l3_process(st, -1))) | 2063 | if (!(pc = ni1_new_l3_process(st, -1))) |
2064 | { free_invoke_id(st, id); | 2064 | { free_invoke_id(st, id); |
2065 | return(-2); | 2065 | return (-2); |
2066 | } | 2066 | } |
2067 | pc->prot.ni1.ll_id = ic->parm.ni1_io.ll_id; /* remember id */ | 2067 | pc->prot.ni1.ll_id = ic->parm.ni1_io.ll_id; /* remember id */ |
2068 | pc->prot.ni1.proc = ic->parm.ni1_io.proc; /* and procedure */ | 2068 | pc->prot.ni1.proc = ic->parm.ni1_io.proc; /* and procedure */ |
2069 | 2069 | ||
2070 | if (!(skb = l3_alloc_skb(l))) | 2070 | if (!(skb = l3_alloc_skb(l))) |
2071 | { free_invoke_id(st, id); | 2071 | { free_invoke_id(st, id); |
2072 | if (pc) ni1_release_l3_process(pc); | 2072 | if (pc) ni1_release_l3_process(pc); |
2073 | return(-2); | 2073 | return (-2); |
2074 | } | 2074 | } |
2075 | memcpy(skb_put(skb, l), temp, l); | 2075 | memcpy(skb_put(skb, l), temp, l); |
2076 | 2076 | ||
2077 | if (pc) | 2077 | if (pc) |
2078 | { pc->prot.ni1.invoke_id = id; /* remember id */ | 2078 | { pc->prot.ni1.invoke_id = id; /* remember id */ |
2079 | L3AddTimer(&pc->timer, ic->parm.ni1_io.timeout, CC_TNI1_IO | REQUEST); | 2079 | L3AddTimer(&pc->timer, ic->parm.ni1_io.timeout, CC_TNI1_IO | REQUEST); |
2080 | } | 2080 | } |
2081 | 2081 | ||
2082 | l3_msg(st, DL_DATA | REQUEST, skb); | 2082 | l3_msg(st, DL_DATA | REQUEST, skb); |
2083 | ic->parm.ni1_io.hl_id = id; /* return id */ | 2083 | ic->parm.ni1_io.hl_id = id; /* return id */ |
2084 | return(0); | 2084 | return (0); |
2085 | 2085 | ||
2086 | case NI1_CMD_INVOKE_ABORT: | 2086 | case NI1_CMD_INVOKE_ABORT: |
2087 | if ((pc = l3ni1_search_dummy_proc(st, ic->parm.ni1_io.hl_id))) | 2087 | if ((pc = l3ni1_search_dummy_proc(st, ic->parm.ni1_io.hl_id))) |
2088 | { L3DelTimer(&pc->timer); /* remove timer */ | 2088 | { L3DelTimer(&pc->timer); /* remove timer */ |
2089 | ni1_release_l3_process(pc); | 2089 | ni1_release_l3_process(pc); |
2090 | return(0); | 2090 | return (0); |
2091 | } | 2091 | } |
2092 | else | 2092 | else |
2093 | { l3_debug(st, "l3ni1_cmd_global abort unknown id"); | 2093 | { l3_debug(st, "l3ni1_cmd_global abort unknown id"); |
2094 | return(-2); | 2094 | return (-2); |
2095 | } | 2095 | } |
2096 | break; | 2096 | break; |
2097 | 2097 | ||
2098 | default: | 2098 | default: |
2099 | l3_debug(st, "l3ni1_cmd_global unknown cmd 0x%lx", ic->arg); | 2099 | l3_debug(st, "l3ni1_cmd_global unknown cmd 0x%lx", ic->arg); |
2100 | return(-1); | 2100 | return (-1); |
2101 | } /* switch ic-> arg */ | 2101 | } /* switch ic-> arg */ |
2102 | return(-1); | 2102 | return (-1); |
2103 | } /* l3ni1_cmd_global */ | 2103 | } /* l3ni1_cmd_global */ |
2104 | 2104 | ||
2105 | static void | 2105 | static void |
2106 | l3ni1_io_timer(struct l3_process *pc) | 2106 | l3ni1_io_timer(struct l3_process *pc) |
2107 | { isdn_ctrl ic; | 2107 | { isdn_ctrl ic; |
2108 | struct IsdnCardState *cs = pc->st->l1.hardware; | 2108 | struct IsdnCardState *cs = pc->st->l1.hardware; |
2109 | 2109 | ||
2110 | L3DelTimer(&pc->timer); /* remove timer */ | 2110 | L3DelTimer(&pc->timer); /* remove timer */ |
2111 | 2111 | ||
2112 | ic.driver = cs->myid; | 2112 | ic.driver = cs->myid; |
2113 | ic.command = ISDN_STAT_PROT; | 2113 | ic.command = ISDN_STAT_PROT; |
2114 | ic.arg = NI1_STAT_INVOKE_ERR; | 2114 | ic.arg = NI1_STAT_INVOKE_ERR; |
2115 | ic.parm.ni1_io.hl_id = pc->prot.ni1.invoke_id; | 2115 | ic.parm.ni1_io.hl_id = pc->prot.ni1.invoke_id; |
2116 | ic.parm.ni1_io.ll_id = pc->prot.ni1.ll_id; | 2116 | ic.parm.ni1_io.ll_id = pc->prot.ni1.ll_id; |
2117 | ic.parm.ni1_io.proc = pc->prot.ni1.proc; | 2117 | ic.parm.ni1_io.proc = pc->prot.ni1.proc; |
2118 | ic.parm.ni1_io.timeout= -1; | 2118 | ic.parm.ni1_io.timeout = -1; |
2119 | ic.parm.ni1_io.datalen = 0; | 2119 | ic.parm.ni1_io.datalen = 0; |
2120 | ic.parm.ni1_io.data = NULL; | 2120 | ic.parm.ni1_io.data = NULL; |
2121 | free_invoke_id(pc->st, pc->prot.ni1.invoke_id); | 2121 | free_invoke_id(pc->st, pc->prot.ni1.invoke_id); |
2122 | pc->prot.ni1.invoke_id = 0; /* reset id */ | 2122 | pc->prot.ni1.invoke_id = 0; /* reset id */ |
2123 | 2123 | ||
2124 | cs->iif.statcallb(&ic); | 2124 | cs->iif.statcallb(&ic); |
2125 | 2125 | ||
2126 | ni1_release_l3_process(pc); | 2126 | ni1_release_l3_process(pc); |
2127 | } /* l3ni1_io_timer */ | 2127 | } /* l3ni1_io_timer */ |
2128 | 2128 | ||
2129 | static void | 2129 | static void |
@@ -2293,12 +2293,12 @@ l3ni1_status(struct l3_process *pc, u_char pr, void *arg) | |||
2293 | { | 2293 | { |
2294 | u_char *p; | 2294 | u_char *p; |
2295 | struct sk_buff *skb = arg; | 2295 | struct sk_buff *skb = arg; |
2296 | int ret; | 2296 | int ret; |
2297 | u_char cause = 0, callState = 0; | 2297 | u_char cause = 0, callState = 0; |
2298 | 2298 | ||
2299 | if ((ret = l3ni1_get_cause(pc, skb))) { | 2299 | if ((ret = l3ni1_get_cause(pc, skb))) { |
2300 | if (pc->debug & L3_DEB_WARN) | 2300 | if (pc->debug & L3_DEB_WARN) |
2301 | l3_debug(pc->st, "STATUS get_cause ret(%d)",ret); | 2301 | l3_debug(pc->st, "STATUS get_cause ret(%d)", ret); |
2302 | if (ret < 0) | 2302 | if (ret < 0) |
2303 | cause = 96; | 2303 | cause = 96; |
2304 | else if (ret > 0) | 2304 | else if (ret > 0) |
@@ -2323,9 +2323,9 @@ l3ni1_status(struct l3_process *pc, u_char pr, void *arg) | |||
2323 | } | 2323 | } |
2324 | if (cause) { | 2324 | if (cause) { |
2325 | u_char tmp; | 2325 | u_char tmp; |
2326 | 2326 | ||
2327 | if (pc->debug & L3_DEB_WARN) | 2327 | if (pc->debug & L3_DEB_WARN) |
2328 | l3_debug(pc->st, "STATUS error(%d/%d)",ret,cause); | 2328 | l3_debug(pc->st, "STATUS error(%d/%d)", ret, cause); |
2329 | tmp = pc->para.cause; | 2329 | tmp = pc->para.cause; |
2330 | pc->para.cause = cause; | 2330 | pc->para.cause = cause; |
2331 | l3ni1_status_send(pc, 0, NULL); | 2331 | l3ni1_status_send(pc, 0, NULL); |
@@ -2351,10 +2351,10 @@ l3ni1_facility(struct l3_process *pc, u_char pr, void *arg) | |||
2351 | { | 2351 | { |
2352 | struct sk_buff *skb = arg; | 2352 | struct sk_buff *skb = arg; |
2353 | int ret; | 2353 | int ret; |
2354 | 2354 | ||
2355 | ret = check_infoelements(pc, skb, ie_FACILITY); | 2355 | ret = check_infoelements(pc, skb, ie_FACILITY); |
2356 | l3ni1_std_ie_err(pc, ret); | 2356 | l3ni1_std_ie_err(pc, ret); |
2357 | { | 2357 | { |
2358 | u_char *p; | 2358 | u_char *p; |
2359 | if ((p = findie(skb->data, skb->len, IE_FACILITY, 0))) | 2359 | if ((p = findie(skb->data, skb->len, IE_FACILITY, 0))) |
2360 | l3ni1_parse_facility(pc->st, pc, pc->callref, p); | 2360 | l3ni1_parse_facility(pc->st, pc, pc->callref, p); |
@@ -2403,7 +2403,7 @@ l3ni1_suspend_ack(struct l3_process *pc, u_char pr, void *arg) | |||
2403 | /* We don't handle suspend_ack for IE errors now */ | 2403 | /* We don't handle suspend_ack for IE errors now */ |
2404 | if ((ret = check_infoelements(pc, skb, ie_SUSPEND_ACKNOWLEDGE))) | 2404 | if ((ret = check_infoelements(pc, skb, ie_SUSPEND_ACKNOWLEDGE))) |
2405 | if (pc->debug & L3_DEB_WARN) | 2405 | if (pc->debug & L3_DEB_WARN) |
2406 | l3_debug(pc->st, "SUSPACK check ie(%d)",ret); | 2406 | l3_debug(pc->st, "SUSPACK check ie(%d)", ret); |
2407 | ni1_release_l3_process(pc); | 2407 | ni1_release_l3_process(pc); |
2408 | } | 2408 | } |
2409 | 2409 | ||
@@ -2415,8 +2415,8 @@ l3ni1_suspend_rej(struct l3_process *pc, u_char pr, void *arg) | |||
2415 | 2415 | ||
2416 | if ((ret = l3ni1_get_cause(pc, skb))) { | 2416 | if ((ret = l3ni1_get_cause(pc, skb))) { |
2417 | if (pc->debug & L3_DEB_WARN) | 2417 | if (pc->debug & L3_DEB_WARN) |
2418 | l3_debug(pc->st, "SUSP_REJ get_cause ret(%d)",ret); | 2418 | l3_debug(pc->st, "SUSP_REJ get_cause ret(%d)", ret); |
2419 | if (ret < 0) | 2419 | if (ret < 0) |
2420 | pc->para.cause = 96; | 2420 | pc->para.cause = 96; |
2421 | else | 2421 | else |
2422 | pc->para.cause = 100; | 2422 | pc->para.cause = 100; |
@@ -2507,8 +2507,8 @@ l3ni1_resume_rej(struct l3_process *pc, u_char pr, void *arg) | |||
2507 | 2507 | ||
2508 | if ((ret = l3ni1_get_cause(pc, skb))) { | 2508 | if ((ret = l3ni1_get_cause(pc, skb))) { |
2509 | if (pc->debug & L3_DEB_WARN) | 2509 | if (pc->debug & L3_DEB_WARN) |
2510 | l3_debug(pc->st, "RES_REJ get_cause ret(%d)",ret); | 2510 | l3_debug(pc->st, "RES_REJ get_cause ret(%d)", ret); |
2511 | if (ret < 0) | 2511 | if (ret < 0) |
2512 | pc->para.cause = 96; | 2512 | pc->para.cause = 96; |
2513 | else | 2513 | else |
2514 | pc->para.cause = 100; | 2514 | pc->para.cause = 100; |
@@ -2562,7 +2562,7 @@ l3ni1_global_restart(struct l3_process *pc, u_char pr, void *arg) | |||
2562 | up->st->lli.l4l3(up->st, CC_RESTART | REQUEST, up); | 2562 | up->st->lli.l4l3(up->st, CC_RESTART | REQUEST, up); |
2563 | else if (up->para.bchannel == chan) | 2563 | else if (up->para.bchannel == chan) |
2564 | up->st->lli.l4l3(up->st, CC_RESTART | REQUEST, up); | 2564 | up->st->lli.l4l3(up->st, CC_RESTART | REQUEST, up); |
2565 | 2565 | ||
2566 | up = up->next; | 2566 | up = up->next; |
2567 | } | 2567 | } |
2568 | p = tmp; | 2568 | p = tmp; |
@@ -2586,112 +2586,112 @@ l3ni1_global_restart(struct l3_process *pc, u_char pr, void *arg) | |||
2586 | static void | 2586 | static void |
2587 | l3ni1_dl_reset(struct l3_process *pc, u_char pr, void *arg) | 2587 | l3ni1_dl_reset(struct l3_process *pc, u_char pr, void *arg) |
2588 | { | 2588 | { |
2589 | pc->para.cause = 0x29; /* Temporary failure */ | 2589 | pc->para.cause = 0x29; /* Temporary failure */ |
2590 | pc->para.loc = 0; | 2590 | pc->para.loc = 0; |
2591 | l3ni1_disconnect_req(pc, pr, NULL); | 2591 | l3ni1_disconnect_req(pc, pr, NULL); |
2592 | pc->st->l3.l3l4(pc->st, CC_SETUP_ERR, pc); | 2592 | pc->st->l3.l3l4(pc->st, CC_SETUP_ERR, pc); |
2593 | } | 2593 | } |
2594 | 2594 | ||
2595 | static void | 2595 | static void |
2596 | l3ni1_dl_release(struct l3_process *pc, u_char pr, void *arg) | 2596 | l3ni1_dl_release(struct l3_process *pc, u_char pr, void *arg) |
2597 | { | 2597 | { |
2598 | newl3state(pc, 0); | 2598 | newl3state(pc, 0); |
2599 | pc->para.cause = 0x1b; /* Destination out of order */ | 2599 | pc->para.cause = 0x1b; /* Destination out of order */ |
2600 | pc->para.loc = 0; | 2600 | pc->para.loc = 0; |
2601 | pc->st->l3.l3l4(pc->st, CC_RELEASE | INDICATION, pc); | 2601 | pc->st->l3.l3l4(pc->st, CC_RELEASE | INDICATION, pc); |
2602 | release_l3_process(pc); | 2602 | release_l3_process(pc); |
2603 | } | 2603 | } |
2604 | 2604 | ||
2605 | static void | 2605 | static void |
2606 | l3ni1_dl_reestablish(struct l3_process *pc, u_char pr, void *arg) | 2606 | l3ni1_dl_reestablish(struct l3_process *pc, u_char pr, void *arg) |
2607 | { | 2607 | { |
2608 | L3DelTimer(&pc->timer); | 2608 | L3DelTimer(&pc->timer); |
2609 | L3AddTimer(&pc->timer, T309, CC_T309); | 2609 | L3AddTimer(&pc->timer, T309, CC_T309); |
2610 | l3_msg(pc->st, DL_ESTABLISH | REQUEST, NULL); | 2610 | l3_msg(pc->st, DL_ESTABLISH | REQUEST, NULL); |
2611 | } | 2611 | } |
2612 | 2612 | ||
2613 | static void | 2613 | static void |
2614 | l3ni1_dl_reest_status(struct l3_process *pc, u_char pr, void *arg) | 2614 | l3ni1_dl_reest_status(struct l3_process *pc, u_char pr, void *arg) |
2615 | { | 2615 | { |
2616 | L3DelTimer(&pc->timer); | 2616 | L3DelTimer(&pc->timer); |
2617 | 2617 | ||
2618 | pc->para.cause = 0x1F; /* normal, unspecified */ | 2618 | pc->para.cause = 0x1F; /* normal, unspecified */ |
2619 | l3ni1_status_send(pc, 0, NULL); | 2619 | l3ni1_status_send(pc, 0, NULL); |
2620 | } | 2620 | } |
2621 | 2621 | ||
2622 | static void l3ni1_SendSpid( struct l3_process *pc, u_char pr, struct sk_buff *skb, int iNewState ) | 2622 | static void l3ni1_SendSpid(struct l3_process *pc, u_char pr, struct sk_buff *skb, int iNewState) |
2623 | { | 2623 | { |
2624 | u_char * p; | 2624 | u_char *p; |
2625 | char * pSPID; | 2625 | char *pSPID; |
2626 | struct Channel * pChan = pc->st->lli.userdata; | 2626 | struct Channel *pChan = pc->st->lli.userdata; |
2627 | int l; | 2627 | int l; |
2628 | 2628 | ||
2629 | if ( skb ) | 2629 | if (skb) |
2630 | dev_kfree_skb( skb); | 2630 | dev_kfree_skb(skb); |
2631 | 2631 | ||
2632 | if ( !( pSPID = strchr( pChan->setup.eazmsn, ':' ) ) ) | 2632 | if (!(pSPID = strchr(pChan->setup.eazmsn, ':'))) |
2633 | { | 2633 | { |
2634 | printk( KERN_ERR "SPID not supplied in EAZMSN %s\n", pChan->setup.eazmsn ); | 2634 | printk(KERN_ERR "SPID not supplied in EAZMSN %s\n", pChan->setup.eazmsn); |
2635 | newl3state( pc, 0 ); | 2635 | newl3state(pc, 0); |
2636 | pc->st->l3.l3l2( pc->st, DL_RELEASE | REQUEST, NULL ); | 2636 | pc->st->l3.l3l2(pc->st, DL_RELEASE | REQUEST, NULL); |
2637 | return; | 2637 | return; |
2638 | } | 2638 | } |
2639 | 2639 | ||
2640 | l = strlen( ++pSPID ); | 2640 | l = strlen(++pSPID); |
2641 | if ( !( skb = l3_alloc_skb( 5+l ) ) ) | 2641 | if (!(skb = l3_alloc_skb(5 + l))) |
2642 | { | 2642 | { |
2643 | printk( KERN_ERR "HiSax can't get memory to send SPID\n" ); | 2643 | printk(KERN_ERR "HiSax can't get memory to send SPID\n"); |
2644 | return; | 2644 | return; |
2645 | } | 2645 | } |
2646 | 2646 | ||
2647 | p = skb_put( skb, 5 ); | 2647 | p = skb_put(skb, 5); |
2648 | *p++ = PROTO_DIS_EURO; | 2648 | *p++ = PROTO_DIS_EURO; |
2649 | *p++ = 0; | 2649 | *p++ = 0; |
2650 | *p++ = MT_INFORMATION; | 2650 | *p++ = MT_INFORMATION; |
2651 | *p++ = IE_SPID; | 2651 | *p++ = IE_SPID; |
2652 | *p++ = l; | 2652 | *p++ = l; |
2653 | 2653 | ||
2654 | memcpy( skb_put( skb, l ), pSPID, l ); | 2654 | memcpy(skb_put(skb, l), pSPID, l); |
2655 | 2655 | ||
2656 | newl3state( pc, iNewState ); | 2656 | newl3state(pc, iNewState); |
2657 | 2657 | ||
2658 | L3DelTimer( &pc->timer ); | 2658 | L3DelTimer(&pc->timer); |
2659 | L3AddTimer( &pc->timer, TSPID, CC_TSPID ); | 2659 | L3AddTimer(&pc->timer, TSPID, CC_TSPID); |
2660 | 2660 | ||
2661 | pc->st->l3.l3l2( pc->st, DL_DATA | REQUEST, skb ); | 2661 | pc->st->l3.l3l2(pc->st, DL_DATA | REQUEST, skb); |
2662 | } | 2662 | } |
2663 | 2663 | ||
2664 | static void l3ni1_spid_send( struct l3_process *pc, u_char pr, void *arg ) | 2664 | static void l3ni1_spid_send(struct l3_process *pc, u_char pr, void *arg) |
2665 | { | 2665 | { |
2666 | l3ni1_SendSpid( pc, pr, arg, 20 ); | 2666 | l3ni1_SendSpid(pc, pr, arg, 20); |
2667 | } | 2667 | } |
2668 | 2668 | ||
2669 | static void l3ni1_spid_epid( struct l3_process *pc, u_char pr, void *arg ) | 2669 | static void l3ni1_spid_epid(struct l3_process *pc, u_char pr, void *arg) |
2670 | { | 2670 | { |
2671 | struct sk_buff *skb = arg; | 2671 | struct sk_buff *skb = arg; |
2672 | 2672 | ||
2673 | if ( skb->data[ 1 ] == 0 ) | 2673 | if (skb->data[1] == 0) |
2674 | if ( skb->data[ 3 ] == IE_ENDPOINT_ID ) | 2674 | if (skb->data[3] == IE_ENDPOINT_ID) |
2675 | { | 2675 | { |
2676 | L3DelTimer( &pc->timer ); | 2676 | L3DelTimer(&pc->timer); |
2677 | newl3state( pc, 0 ); | 2677 | newl3state(pc, 0); |
2678 | l3_msg( pc->st, DL_ESTABLISH | CONFIRM, NULL ); | 2678 | l3_msg(pc->st, DL_ESTABLISH | CONFIRM, NULL); |
2679 | } | 2679 | } |
2680 | dev_kfree_skb( skb); | 2680 | dev_kfree_skb(skb); |
2681 | } | 2681 | } |
2682 | 2682 | ||
2683 | static void l3ni1_spid_tout( struct l3_process *pc, u_char pr, void *arg ) | 2683 | static void l3ni1_spid_tout(struct l3_process *pc, u_char pr, void *arg) |
2684 | { | 2684 | { |
2685 | if ( pc->state < 22 ) | 2685 | if (pc->state < 22) |
2686 | l3ni1_SendSpid( pc, pr, arg, pc->state+1 ); | 2686 | l3ni1_SendSpid(pc, pr, arg, pc->state + 1); |
2687 | else | 2687 | else |
2688 | { | 2688 | { |
2689 | L3DelTimer( &pc->timer ); | 2689 | L3DelTimer(&pc->timer); |
2690 | dev_kfree_skb( arg); | 2690 | dev_kfree_skb(arg); |
2691 | 2691 | ||
2692 | printk( KERN_ERR "SPID not accepted\n" ); | 2692 | printk(KERN_ERR "SPID not accepted\n"); |
2693 | newl3state( pc, 0 ); | 2693 | newl3state(pc, 0); |
2694 | pc->st->l3.l3l2( pc->st, DL_RELEASE | REQUEST, NULL ); | 2694 | pc->st->l3.l3l2(pc->st, DL_RELEASE | REQUEST, NULL); |
2695 | } | 2695 | } |
2696 | } | 2696 | } |
2697 | 2697 | ||
@@ -2724,12 +2724,12 @@ static struct stateentry downstatelist[] = | |||
2724 | CC_SETUP | RESPONSE, l3ni1_setup_rsp}, | 2724 | CC_SETUP | RESPONSE, l3ni1_setup_rsp}, |
2725 | {SBIT(10), | 2725 | {SBIT(10), |
2726 | CC_SUSPEND | REQUEST, l3ni1_suspend_req}, | 2726 | CC_SUSPEND | REQUEST, l3ni1_suspend_req}, |
2727 | {SBIT(7) | SBIT(9) | SBIT(25), | 2727 | {SBIT(7) | SBIT(9) | SBIT(25), |
2728 | CC_REDIR | REQUEST, l3ni1_redir_req}, | 2728 | CC_REDIR | REQUEST, l3ni1_redir_req}, |
2729 | {SBIT(6), | 2729 | {SBIT(6), |
2730 | CC_REDIR | REQUEST, l3ni1_redir_req_early}, | 2730 | CC_REDIR | REQUEST, l3ni1_redir_req_early}, |
2731 | {SBIT(9) | SBIT(25), | 2731 | {SBIT(9) | SBIT(25), |
2732 | CC_DISCONNECT | REQUEST, l3ni1_disconnect_req}, | 2732 | CC_DISCONNECT | REQUEST, l3ni1_disconnect_req}, |
2733 | {SBIT(25), | 2733 | {SBIT(25), |
2734 | CC_T302, l3ni1_t302}, | 2734 | CC_T302, l3ni1_t302}, |
2735 | {SBIT(1), | 2735 | {SBIT(1), |
@@ -2752,8 +2752,8 @@ static struct stateentry downstatelist[] = | |||
2752 | CC_T308_2, l3ni1_t308_2}, | 2752 | CC_T308_2, l3ni1_t308_2}, |
2753 | {SBIT(10), | 2753 | {SBIT(10), |
2754 | CC_T309, l3ni1_dl_release}, | 2754 | CC_T309, l3ni1_dl_release}, |
2755 | { SBIT( 20 ) | SBIT( 21 ) | SBIT( 22 ), | 2755 | { SBIT(20) | SBIT(21) | SBIT(22), |
2756 | CC_TSPID, l3ni1_spid_tout }, | 2756 | CC_TSPID, l3ni1_spid_tout }, |
2757 | }; | 2757 | }; |
2758 | 2758 | ||
2759 | static struct stateentry datastatelist[] = | 2759 | static struct stateentry datastatelist[] = |
@@ -2815,22 +2815,22 @@ static struct stateentry globalmes_list[] = | |||
2815 | {SBIT(0), | 2815 | {SBIT(0), |
2816 | MT_RESTART, l3ni1_global_restart}, | 2816 | MT_RESTART, l3ni1_global_restart}, |
2817 | /* {SBIT(1), | 2817 | /* {SBIT(1), |
2818 | MT_RESTART_ACKNOWLEDGE, l3ni1_restart_ack}, | 2818 | MT_RESTART_ACKNOWLEDGE, l3ni1_restart_ack}, |
2819 | */ | 2819 | */ |
2820 | { SBIT( 0 ), MT_DL_ESTABLISHED, l3ni1_spid_send }, | 2820 | { SBIT(0), MT_DL_ESTABLISHED, l3ni1_spid_send }, |
2821 | { SBIT( 20 ) | SBIT( 21 ) | SBIT( 22 ), MT_INFORMATION, l3ni1_spid_epid }, | 2821 | { SBIT(20) | SBIT(21) | SBIT(22), MT_INFORMATION, l3ni1_spid_epid }, |
2822 | }; | 2822 | }; |
2823 | 2823 | ||
2824 | static struct stateentry manstatelist[] = | 2824 | static struct stateentry manstatelist[] = |
2825 | { | 2825 | { |
2826 | {SBIT(2), | 2826 | {SBIT(2), |
2827 | DL_ESTABLISH | INDICATION, l3ni1_dl_reset}, | 2827 | DL_ESTABLISH | INDICATION, l3ni1_dl_reset}, |
2828 | {SBIT(10), | 2828 | {SBIT(10), |
2829 | DL_ESTABLISH | CONFIRM, l3ni1_dl_reest_status}, | 2829 | DL_ESTABLISH | CONFIRM, l3ni1_dl_reest_status}, |
2830 | {SBIT(10), | 2830 | {SBIT(10), |
2831 | DL_RELEASE | INDICATION, l3ni1_dl_reestablish}, | 2831 | DL_RELEASE | INDICATION, l3ni1_dl_reestablish}, |
2832 | {ALL_STATES, | 2832 | {ALL_STATES, |
2833 | DL_RELEASE | INDICATION, l3ni1_dl_release}, | 2833 | DL_RELEASE | INDICATION, l3ni1_dl_release}, |
2834 | }; | 2834 | }; |
2835 | 2835 | ||
2836 | /* *INDENT-ON* */ | 2836 | /* *INDENT-ON* */ |
@@ -2845,7 +2845,7 @@ global_handler(struct PStack *st, int mt, struct sk_buff *skb) | |||
2845 | int i; | 2845 | int i; |
2846 | struct l3_process *proc = st->l3.global; | 2846 | struct l3_process *proc = st->l3.global; |
2847 | 2847 | ||
2848 | if ( skb ) | 2848 | if (skb) |
2849 | proc->callref = skb->data[2]; /* cr flag */ | 2849 | proc->callref = skb->data[2]; /* cr flag */ |
2850 | else | 2850 | else |
2851 | proc->callref = 0; | 2851 | proc->callref = 0; |
@@ -2856,13 +2856,13 @@ global_handler(struct PStack *st, int mt, struct sk_buff *skb) | |||
2856 | if (i == ARRAY_SIZE(globalmes_list)) { | 2856 | if (i == ARRAY_SIZE(globalmes_list)) { |
2857 | if (st->l3.debug & L3_DEB_STATE) { | 2857 | if (st->l3.debug & L3_DEB_STATE) { |
2858 | l3_debug(st, "ni1 global state %d mt %x unhandled", | 2858 | l3_debug(st, "ni1 global state %d mt %x unhandled", |
2859 | proc->state, mt); | 2859 | proc->state, mt); |
2860 | } | 2860 | } |
2861 | MsgHead(p, proc->callref, MT_STATUS); | 2861 | MsgHead(p, proc->callref, MT_STATUS); |
2862 | *p++ = IE_CAUSE; | 2862 | *p++ = IE_CAUSE; |
2863 | *p++ = 0x2; | 2863 | *p++ = 0x2; |
2864 | *p++ = 0x80; | 2864 | *p++ = 0x80; |
2865 | *p++ = 81 |0x80; /* invalid cr */ | 2865 | *p++ = 81 | 0x80; /* invalid cr */ |
2866 | *p++ = 0x14; /* CallState */ | 2866 | *p++ = 0x14; /* CallState */ |
2867 | *p++ = 0x1; | 2867 | *p++ = 0x1; |
2868 | *p++ = proc->state & 0x3f; | 2868 | *p++ = proc->state & 0x3f; |
@@ -2874,7 +2874,7 @@ global_handler(struct PStack *st, int mt, struct sk_buff *skb) | |||
2874 | } else { | 2874 | } else { |
2875 | if (st->l3.debug & L3_DEB_STATE) { | 2875 | if (st->l3.debug & L3_DEB_STATE) { |
2876 | l3_debug(st, "ni1 global %d mt %x", | 2876 | l3_debug(st, "ni1 global %d mt %x", |
2877 | proc->state, mt); | 2877 | proc->state, mt); |
2878 | } | 2878 | } |
2879 | globalmes_list[i].rout(proc, mt, skb); | 2879 | globalmes_list[i].rout(proc, mt, skb); |
2880 | } | 2880 | } |
@@ -2890,23 +2890,23 @@ ni1up(struct PStack *st, int pr, void *arg) | |||
2890 | struct l3_process *proc; | 2890 | struct l3_process *proc; |
2891 | 2891 | ||
2892 | switch (pr) { | 2892 | switch (pr) { |
2893 | case (DL_DATA | INDICATION): | 2893 | case (DL_DATA | INDICATION): |
2894 | case (DL_UNIT_DATA | INDICATION): | 2894 | case (DL_UNIT_DATA | INDICATION): |
2895 | break; | 2895 | break; |
2896 | case (DL_ESTABLISH | INDICATION): | 2896 | case (DL_ESTABLISH | INDICATION): |
2897 | case (DL_RELEASE | INDICATION): | 2897 | case (DL_RELEASE | INDICATION): |
2898 | case (DL_RELEASE | CONFIRM): | 2898 | case (DL_RELEASE | CONFIRM): |
2899 | l3_msg(st, pr, arg); | 2899 | l3_msg(st, pr, arg); |
2900 | return; | 2900 | return; |
2901 | break; | 2901 | break; |
2902 | 2902 | ||
2903 | case (DL_ESTABLISH | CONFIRM): | 2903 | case (DL_ESTABLISH | CONFIRM): |
2904 | global_handler( st, MT_DL_ESTABLISHED, NULL ); | 2904 | global_handler(st, MT_DL_ESTABLISHED, NULL); |
2905 | return; | 2905 | return; |
2906 | 2906 | ||
2907 | default: | 2907 | default: |
2908 | printk(KERN_ERR "HiSax ni1up unknown pr=%04x\n", pr); | 2908 | printk(KERN_ERR "HiSax ni1up unknown pr=%04x\n", pr); |
2909 | return; | 2909 | return; |
2910 | } | 2910 | } |
2911 | if (skb->len < 3) { | 2911 | if (skb->len < 3) { |
2912 | l3_debug(st, "ni1up frame too short(%d)", skb->len); | 2912 | l3_debug(st, "ni1up frame too short(%d)", skb->len); |
@@ -2941,10 +2941,10 @@ ni1up(struct PStack *st, int pr, void *arg) | |||
2941 | if (mt == MT_FACILITY) | 2941 | if (mt == MT_FACILITY) |
2942 | { | 2942 | { |
2943 | if ((p = findie(skb->data, skb->len, IE_FACILITY, 0))) { | 2943 | if ((p = findie(skb->data, skb->len, IE_FACILITY, 0))) { |
2944 | l3ni1_parse_facility(st, NULL, | 2944 | l3ni1_parse_facility(st, NULL, |
2945 | (pr == (DL_DATA | INDICATION)) ? -1 : -2, p); | 2945 | (pr == (DL_DATA | INDICATION)) ? -1 : -2, p); |
2946 | dev_kfree_skb(skb); | 2946 | dev_kfree_skb(skb); |
2947 | return; | 2947 | return; |
2948 | } | 2948 | } |
2949 | } | 2949 | } |
2950 | else | 2950 | else |
@@ -2952,13 +2952,13 @@ ni1up(struct PStack *st, int pr, void *arg) | |||
2952 | global_handler(st, mt, skb); | 2952 | global_handler(st, mt, skb); |
2953 | return; | 2953 | return; |
2954 | } | 2954 | } |
2955 | 2955 | ||
2956 | if (st->l3.debug & L3_DEB_WARN) | 2956 | if (st->l3.debug & L3_DEB_WARN) |
2957 | l3_debug(st, "ni1up dummy Callref (no facility msg or ie)"); | 2957 | l3_debug(st, "ni1up dummy Callref (no facility msg or ie)"); |
2958 | dev_kfree_skb(skb); | 2958 | dev_kfree_skb(skb); |
2959 | return; | 2959 | return; |
2960 | } else if ((((skb->data[1] & 0x0f) == 1) && (0==(cr & 0x7f))) || | 2960 | } else if ((((skb->data[1] & 0x0f) == 1) && (0 == (cr & 0x7f))) || |
2961 | (((skb->data[1] & 0x0f) == 2) && (0==(cr & 0x7fff)))) { /* Global CallRef */ | 2961 | (((skb->data[1] & 0x0f) == 2) && (0 == (cr & 0x7fff)))) { /* Global CallRef */ |
2962 | if (st->l3.debug & L3_DEB_STATE) | 2962 | if (st->l3.debug & L3_DEB_STATE) |
2963 | l3_debug(st, "ni1up Global CallRef"); | 2963 | l3_debug(st, "ni1up Global CallRef"); |
2964 | global_handler(st, mt, skb); | 2964 | global_handler(st, mt, skb); |
@@ -3036,8 +3036,8 @@ ni1up(struct PStack *st, int pr, void *arg) | |||
3036 | dev_kfree_skb(skb); | 3036 | dev_kfree_skb(skb); |
3037 | return; | 3037 | return; |
3038 | } | 3038 | } |
3039 | if ((p = findie(skb->data, skb->len, IE_DISPLAY, 0)) != NULL) | 3039 | if ((p = findie(skb->data, skb->len, IE_DISPLAY, 0)) != NULL) |
3040 | l3ni1_deliver_display(proc, pr, p); /* Display IE included */ | 3040 | l3ni1_deliver_display(proc, pr, p); /* Display IE included */ |
3041 | for (i = 0; i < ARRAY_SIZE(datastatelist); i++) | 3041 | for (i = 0; i < ARRAY_SIZE(datastatelist); i++) |
3042 | if ((mt == datastatelist[i].primitive) && | 3042 | if ((mt == datastatelist[i].primitive) && |
3043 | ((1 << proc->state) & datastatelist[i].state)) | 3043 | ((1 << proc->state) & datastatelist[i].state)) |
@@ -3045,8 +3045,8 @@ ni1up(struct PStack *st, int pr, void *arg) | |||
3045 | if (i == ARRAY_SIZE(datastatelist)) { | 3045 | if (i == ARRAY_SIZE(datastatelist)) { |
3046 | if (st->l3.debug & L3_DEB_STATE) { | 3046 | if (st->l3.debug & L3_DEB_STATE) { |
3047 | l3_debug(st, "ni1up%sstate %d mt %#x unhandled", | 3047 | l3_debug(st, "ni1up%sstate %d mt %#x unhandled", |
3048 | (pr == (DL_DATA | INDICATION)) ? " " : "(broadcast) ", | 3048 | (pr == (DL_DATA | INDICATION)) ? " " : "(broadcast) ", |
3049 | proc->state, mt); | 3049 | proc->state, mt); |
3050 | } | 3050 | } |
3051 | if ((MT_RELEASE_COMPLETE != mt) && (MT_RELEASE != mt)) { | 3051 | if ((MT_RELEASE_COMPLETE != mt) && (MT_RELEASE != mt)) { |
3052 | proc->para.cause = 101; | 3052 | proc->para.cause = 101; |
@@ -3055,8 +3055,8 @@ ni1up(struct PStack *st, int pr, void *arg) | |||
3055 | } else { | 3055 | } else { |
3056 | if (st->l3.debug & L3_DEB_STATE) { | 3056 | if (st->l3.debug & L3_DEB_STATE) { |
3057 | l3_debug(st, "ni1up%sstate %d mt %x", | 3057 | l3_debug(st, "ni1up%sstate %d mt %x", |
3058 | (pr == (DL_DATA | INDICATION)) ? " " : "(broadcast) ", | 3058 | (pr == (DL_DATA | INDICATION)) ? " " : "(broadcast) ", |
3059 | proc->state, mt); | 3059 | proc->state, mt); |
3060 | } | 3060 | } |
3061 | datastatelist[i].rout(proc, pr, skb); | 3061 | datastatelist[i].rout(proc, pr, skb); |
3062 | } | 3062 | } |
@@ -3092,10 +3092,10 @@ ni1down(struct PStack *st, int pr, void *arg) | |||
3092 | return; | 3092 | return; |
3093 | } | 3093 | } |
3094 | 3094 | ||
3095 | if ( pr == (CC_TNI1_IO | REQUEST)) { | 3095 | if (pr == (CC_TNI1_IO | REQUEST)) { |
3096 | l3ni1_io_timer(proc); /* timer expires */ | 3096 | l3ni1_io_timer(proc); /* timer expires */ |
3097 | return; | 3097 | return; |
3098 | } | 3098 | } |
3099 | 3099 | ||
3100 | for (i = 0; i < ARRAY_SIZE(downstatelist); i++) | 3100 | for (i = 0; i < ARRAY_SIZE(downstatelist); i++) |
3101 | if ((pr == downstatelist[i].primitive) && | 3101 | if ((pr == downstatelist[i].primitive) && |
@@ -3104,12 +3104,12 @@ ni1down(struct PStack *st, int pr, void *arg) | |||
3104 | if (i == ARRAY_SIZE(downstatelist)) { | 3104 | if (i == ARRAY_SIZE(downstatelist)) { |
3105 | if (st->l3.debug & L3_DEB_STATE) { | 3105 | if (st->l3.debug & L3_DEB_STATE) { |
3106 | l3_debug(st, "ni1down state %d prim %#x unhandled", | 3106 | l3_debug(st, "ni1down state %d prim %#x unhandled", |
3107 | proc->state, pr); | 3107 | proc->state, pr); |
3108 | } | 3108 | } |
3109 | } else { | 3109 | } else { |
3110 | if (st->l3.debug & L3_DEB_STATE) { | 3110 | if (st->l3.debug & L3_DEB_STATE) { |
3111 | l3_debug(st, "ni1down state %d prim %#x", | 3111 | l3_debug(st, "ni1down state %d prim %#x", |
3112 | proc->state, pr); | 3112 | proc->state, pr); |
3113 | } | 3113 | } |
3114 | downstatelist[i].rout(proc, pr, arg); | 3114 | downstatelist[i].rout(proc, pr, arg); |
3115 | } | 3115 | } |
@@ -3118,31 +3118,31 @@ ni1down(struct PStack *st, int pr, void *arg) | |||
3118 | static void | 3118 | static void |
3119 | ni1man(struct PStack *st, int pr, void *arg) | 3119 | ni1man(struct PStack *st, int pr, void *arg) |
3120 | { | 3120 | { |
3121 | int i; | 3121 | int i; |
3122 | struct l3_process *proc = arg; | 3122 | struct l3_process *proc = arg; |
3123 | 3123 | ||
3124 | if (!proc) { | 3124 | if (!proc) { |
3125 | printk(KERN_ERR "HiSax ni1man without proc pr=%04x\n", pr); | 3125 | printk(KERN_ERR "HiSax ni1man without proc pr=%04x\n", pr); |
3126 | return; | 3126 | return; |
3127 | } | 3127 | } |
3128 | for (i = 0; i < ARRAY_SIZE(manstatelist); i++) | 3128 | for (i = 0; i < ARRAY_SIZE(manstatelist); i++) |
3129 | if ((pr == manstatelist[i].primitive) && | 3129 | if ((pr == manstatelist[i].primitive) && |
3130 | ((1 << proc->state) & manstatelist[i].state)) | 3130 | ((1 << proc->state) & manstatelist[i].state)) |
3131 | break; | 3131 | break; |
3132 | if (i == ARRAY_SIZE(manstatelist)) { | 3132 | if (i == ARRAY_SIZE(manstatelist)) { |
3133 | if (st->l3.debug & L3_DEB_STATE) { | 3133 | if (st->l3.debug & L3_DEB_STATE) { |
3134 | l3_debug(st, "cr %d ni1man state %d prim %#x unhandled", | 3134 | l3_debug(st, "cr %d ni1man state %d prim %#x unhandled", |
3135 | proc->callref & 0x7f, proc->state, pr); | 3135 | proc->callref & 0x7f, proc->state, pr); |
3136 | } | 3136 | } |
3137 | } else { | 3137 | } else { |
3138 | if (st->l3.debug & L3_DEB_STATE) { | 3138 | if (st->l3.debug & L3_DEB_STATE) { |
3139 | l3_debug(st, "cr %d ni1man state %d prim %#x", | 3139 | l3_debug(st, "cr %d ni1man state %d prim %#x", |
3140 | proc->callref & 0x7f, proc->state, pr); | 3140 | proc->callref & 0x7f, proc->state, pr); |
3141 | } | 3141 | } |
3142 | manstatelist[i].rout(proc, pr, arg); | 3142 | manstatelist[i].rout(proc, pr, arg); |
3143 | } | 3143 | } |
3144 | } | 3144 | } |
3145 | 3145 | ||
3146 | void | 3146 | void |
3147 | setstack_ni1(struct PStack *st) | 3147 | setstack_ni1(struct PStack *st) |
3148 | { | 3148 | { |
@@ -3157,8 +3157,8 @@ setstack_ni1(struct PStack *st) | |||
3157 | st->prot.ni1.last_invoke_id = 0; | 3157 | st->prot.ni1.last_invoke_id = 0; |
3158 | st->prot.ni1.invoke_used[0] = 1; /* Bit 0 must always be set to 1 */ | 3158 | st->prot.ni1.invoke_used[0] = 1; /* Bit 0 must always be set to 1 */ |
3159 | i = 1; | 3159 | i = 1; |
3160 | while (i < 32) | 3160 | while (i < 32) |
3161 | st->prot.ni1.invoke_used[i++] = 0; | 3161 | st->prot.ni1.invoke_used[i++] = 0; |
3162 | 3162 | ||
3163 | if (!(st->l3.global = kmalloc(sizeof(struct l3_process), GFP_ATOMIC))) { | 3163 | if (!(st->l3.global = kmalloc(sizeof(struct l3_process), GFP_ATOMIC))) { |
3164 | printk(KERN_ERR "HiSax can't get memory for ni1 global CR\n"); | 3164 | printk(KERN_ERR "HiSax can't get memory for ni1 global CR\n"); |
@@ -3169,7 +3169,7 @@ setstack_ni1(struct PStack *st) | |||
3169 | st->l3.global->debug = L3_DEB_WARN; | 3169 | st->l3.global->debug = L3_DEB_WARN; |
3170 | st->l3.global->st = st; | 3170 | st->l3.global->st = st; |
3171 | st->l3.global->N303 = 1; | 3171 | st->l3.global->N303 = 1; |
3172 | st->l3.global->prot.ni1.invoke_id = 0; | 3172 | st->l3.global->prot.ni1.invoke_id = 0; |
3173 | 3173 | ||
3174 | L3InitTimer(st->l3.global, &st->l3.global->timer); | 3174 | L3InitTimer(st->l3.global, &st->l3.global->timer); |
3175 | } | 3175 | } |