capi.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:32k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /* $Id: capi.c,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $
  2.  *
  3.  * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000.
  4.  * CAPI encoder/decoder
  5.  *
  6.  * Author       Fritz Elfert
  7.  * Copyright    by Fritz Elfert      <fritz@isdn4linux.de>
  8.  * 
  9.  * This software may be used and distributed according to the terms
  10.  * of the GNU General Public License, incorporated herein by reference.
  11.  *
  12.  * Thanks to Friedemann Baitinger and IBM Germany
  13.  *
  14.  */
  15. #define __NO_VERSION__
  16. #include "act2000.h"
  17. #include "capi.h"
  18. static actcapi_msgdsc valid_msg[] = {
  19. {{ 0x86, 0x02}, "DATA_B3_IND"},       /* DATA_B3_IND/CONF must be first because of speed!!! */
  20. {{ 0x86, 0x01}, "DATA_B3_CONF"},
  21. {{ 0x02, 0x01}, "CONNECT_CONF"},
  22. {{ 0x02, 0x02}, "CONNECT_IND"},
  23. {{ 0x09, 0x01}, "CONNECT_INFO_CONF"},
  24. {{ 0x03, 0x02}, "CONNECT_ACTIVE_IND"},
  25. {{ 0x04, 0x01}, "DISCONNECT_CONF"},
  26. {{ 0x04, 0x02}, "DISCONNECT_IND"},
  27. {{ 0x05, 0x01}, "LISTEN_CONF"},
  28. {{ 0x06, 0x01}, "GET_PARAMS_CONF"},
  29. {{ 0x07, 0x01}, "INFO_CONF"},
  30. {{ 0x07, 0x02}, "INFO_IND"},
  31. {{ 0x08, 0x01}, "DATA_CONF"},
  32. {{ 0x08, 0x02}, "DATA_IND"},
  33. {{ 0x40, 0x01}, "SELECT_B2_PROTOCOL_CONF"},
  34. {{ 0x80, 0x01}, "SELECT_B3_PROTOCOL_CONF"},
  35. {{ 0x81, 0x01}, "LISTEN_B3_CONF"},
  36. {{ 0x82, 0x01}, "CONNECT_B3_CONF"},
  37. {{ 0x82, 0x02}, "CONNECT_B3_IND"},
  38. {{ 0x83, 0x02}, "CONNECT_B3_ACTIVE_IND"},
  39. {{ 0x84, 0x01}, "DISCONNECT_B3_CONF"},
  40. {{ 0x84, 0x02}, "DISCONNECT_B3_IND"},
  41. {{ 0x85, 0x01}, "GET_B3_PARAMS_CONF"},
  42. {{ 0x01, 0x01}, "RESET_B3_CONF"},
  43. {{ 0x01, 0x02}, "RESET_B3_IND"},
  44. /* {{ 0x87, 0x02, "HANDSET_IND"}, not implemented */
  45. {{ 0xff, 0x01}, "MANUFACTURER_CONF"},
  46. {{ 0xff, 0x02}, "MANUFACTURER_IND"},
  47. #ifdef DEBUG_MSG
  48. /* Requests */
  49. {{ 0x01, 0x00}, "RESET_B3_REQ"},
  50. {{ 0x02, 0x00}, "CONNECT_REQ"},
  51. {{ 0x04, 0x00}, "DISCONNECT_REQ"},
  52. {{ 0x05, 0x00}, "LISTEN_REQ"},
  53. {{ 0x06, 0x00}, "GET_PARAMS_REQ"},
  54. {{ 0x07, 0x00}, "INFO_REQ"},
  55. {{ 0x08, 0x00}, "DATA_REQ"},
  56. {{ 0x09, 0x00}, "CONNECT_INFO_REQ"},
  57. {{ 0x40, 0x00}, "SELECT_B2_PROTOCOL_REQ"},
  58. {{ 0x80, 0x00}, "SELECT_B3_PROTOCOL_REQ"},
  59. {{ 0x81, 0x00}, "LISTEN_B3_REQ"},
  60. {{ 0x82, 0x00}, "CONNECT_B3_REQ"},
  61. {{ 0x84, 0x00}, "DISCONNECT_B3_REQ"},
  62. {{ 0x85, 0x00}, "GET_B3_PARAMS_REQ"},
  63. {{ 0x86, 0x00}, "DATA_B3_REQ"},
  64. {{ 0xff, 0x00}, "MANUFACTURER_REQ"},
  65. /* Responses */
  66. {{ 0x01, 0x03}, "RESET_B3_RESP"},
  67. {{ 0x02, 0x03}, "CONNECT_RESP"},
  68. {{ 0x03, 0x03}, "CONNECT_ACTIVE_RESP"},
  69. {{ 0x04, 0x03}, "DISCONNECT_RESP"},
  70. {{ 0x07, 0x03}, "INFO_RESP"},
  71. {{ 0x08, 0x03}, "DATA_RESP"},
  72. {{ 0x82, 0x03}, "CONNECT_B3_RESP"},
  73. {{ 0x83, 0x03}, "CONNECT_B3_ACTIVE_RESP"},
  74. {{ 0x84, 0x03}, "DISCONNECT_B3_RESP"},
  75. {{ 0x86, 0x03}, "DATA_B3_RESP"},
  76. {{ 0xff, 0x03}, "MANUFACTURER_RESP"},
  77. #endif
  78. {{ 0x00, 0x00}, NULL},
  79. };
  80. #define num_valid_msg (sizeof(valid_msg)/sizeof(actcapi_msgdsc))
  81. #define num_valid_imsg 27 /* MANUFACTURER_IND */
  82. /*
  83.  * Check for a valid incoming CAPI message.
  84.  * Return:
  85.  *   0 = Invalid message
  86.  *   1 = Valid message, no B-Channel-data
  87.  *   2 = Valid message, B-Channel-data
  88.  */
  89. int
  90. actcapi_chkhdr(act2000_card * card, actcapi_msghdr *hdr)
  91. {
  92. int i;
  93. if (hdr->applicationID != 1)
  94. return 0;
  95. if (hdr->len < 9)
  96. return 0;
  97. for (i = 0; i < num_valid_imsg; i++)
  98. if ((hdr->cmd.cmd == valid_msg[i].cmd.cmd) &&
  99.     (hdr->cmd.subcmd == valid_msg[i].cmd.subcmd)) {
  100. return (i?1:2);
  101. }
  102. return 0;
  103. }
  104. #define ACTCAPI_MKHDR(l, c, s) { 
  105. skb = alloc_skb(l + 8, GFP_ATOMIC); 
  106. if (skb) { 
  107.         m = (actcapi_msg *)skb_put(skb, l + 8); 
  108. m->hdr.len = l + 8; 
  109. m->hdr.applicationID = 1; 
  110.         m->hdr.cmd.cmd = c; 
  111.         m->hdr.cmd.subcmd = s; 
  112.         m->hdr.msgnum = actcapi_nextsmsg(card); 
  113. } else m = NULL;
  114. }
  115. #define ACTCAPI_CHKSKB if (!skb) { 
  116. printk(KERN_WARNING "actcapi: alloc_skb failedn"); 
  117. return; 
  118. }
  119. #define ACTCAPI_QUEUE_TX { 
  120. actcapi_debug_msg(skb, 1); 
  121. skb_queue_tail(&card->sndq, skb); 
  122. act2000_schedule_tx(card); 
  123. }
  124. int
  125. actcapi_listen_req(act2000_card *card)
  126. {
  127. __u16 eazmask = 0;
  128. int i;
  129. actcapi_msg *m;
  130. struct sk_buff *skb;
  131. for (i = 0; i < ACT2000_BCH; i++)
  132. eazmask |= card->bch[i].eazmask;
  133. ACTCAPI_MKHDR(9, 0x05, 0x00);
  134.         if (!skb) {
  135.                 printk(KERN_WARNING "actcapi: alloc_skb failedn");
  136.                 return -ENOMEM;
  137.         }
  138. m->msg.listen_req.controller = 0;
  139. m->msg.listen_req.infomask = 0x3f; /* All information */
  140. m->msg.listen_req.eazmask = eazmask;
  141. m->msg.listen_req.simask = (eazmask)?0x86:0; /* All SI's  */
  142. ACTCAPI_QUEUE_TX;
  143.         return 0;
  144. }
  145. int
  146. actcapi_connect_req(act2000_card *card, act2000_chan *chan, char *phone,
  147.     char eaz, int si1, int si2)
  148. {
  149. actcapi_msg *m;
  150. struct sk_buff *skb;
  151. ACTCAPI_MKHDR((11 + strlen(phone)), 0x02, 0x00);
  152. if (!skb) {
  153.                 printk(KERN_WARNING "actcapi: alloc_skb failedn");
  154. chan->fsm_state = ACT2000_STATE_NULL;
  155. return -ENOMEM;
  156. }
  157. m->msg.connect_req.controller = 0;
  158. m->msg.connect_req.bchan = 0x83;
  159. m->msg.connect_req.infomask = 0x3f;
  160. m->msg.connect_req.si1 = si1;
  161. m->msg.connect_req.si2 = si2;
  162. m->msg.connect_req.eaz = eaz?eaz:'0';
  163. m->msg.connect_req.addr.len = strlen(phone) + 1;
  164. m->msg.connect_req.addr.tnp = 0x81;
  165. memcpy(m->msg.connect_req.addr.num, phone, strlen(phone));
  166. chan->callref = m->hdr.msgnum;
  167. ACTCAPI_QUEUE_TX;
  168. return 0;
  169. }
  170. static void
  171. actcapi_connect_b3_req(act2000_card *card, act2000_chan *chan)
  172. {
  173. actcapi_msg *m;
  174. struct sk_buff *skb;
  175. ACTCAPI_MKHDR(17, 0x82, 0x00);
  176. ACTCAPI_CHKSKB;
  177. m->msg.connect_b3_req.plci = chan->plci;
  178. memset(&m->msg.connect_b3_req.ncpi, 0,
  179.        sizeof(m->msg.connect_b3_req.ncpi));
  180. m->msg.connect_b3_req.ncpi.len = 13;
  181. m->msg.connect_b3_req.ncpi.modulo = 8;
  182. ACTCAPI_QUEUE_TX;
  183. }
  184. /*
  185.  * Set net type (1TR6) or (EDSS1)
  186.  */
  187. int
  188. actcapi_manufacturer_req_net(act2000_card *card)
  189. {
  190. actcapi_msg *m;
  191. struct sk_buff *skb;
  192. ACTCAPI_MKHDR(5, 0xff, 0x00);
  193.         if (!skb) {
  194.                 printk(KERN_WARNING "actcapi: alloc_skb failedn");
  195.                 return -ENOMEM;
  196.         }
  197. m->msg.manufacturer_req_net.manuf_msg = 0x11;
  198. m->msg.manufacturer_req_net.controller = 1;
  199. m->msg.manufacturer_req_net.nettype = (card->ptype == ISDN_PTYPE_EURO)?1:0;
  200. ACTCAPI_QUEUE_TX;
  201. printk(KERN_INFO "act2000 %s: D-channel protocol now %sn",
  202.        card->interface.id, (card->ptype == ISDN_PTYPE_EURO)?"euro":"1tr6");
  203. card->interface.features &=
  204. ~(ISDN_FEATURE_P_UNKNOWN | ISDN_FEATURE_P_EURO | ISDN_FEATURE_P_1TR6);
  205. card->interface.features |=
  206. ((card->ptype == ISDN_PTYPE_EURO)?ISDN_FEATURE_P_EURO:ISDN_FEATURE_P_1TR6);
  207.         return 0;
  208. }
  209. /*
  210.  * Switch V.42 on or off
  211.  */
  212. int
  213. actcapi_manufacturer_req_v42(act2000_card *card, ulong arg)
  214. {
  215. actcapi_msg *m;
  216. struct sk_buff *skb;
  217. ACTCAPI_MKHDR(8, 0xff, 0x00);
  218.         if (!skb) {
  219.                 printk(KERN_WARNING "actcapi: alloc_skb failedn");
  220.                 return -ENOMEM;
  221.         }
  222. m->msg.manufacturer_req_v42.manuf_msg = 0x10;
  223. m->msg.manufacturer_req_v42.controller = 0;
  224. m->msg.manufacturer_req_v42.v42control = (arg?1:0);
  225. ACTCAPI_QUEUE_TX;
  226.         return 0;
  227. }
  228. /*
  229.  * Set error-handler
  230.  */
  231. int
  232. actcapi_manufacturer_req_errh(act2000_card *card)
  233. {
  234. actcapi_msg *m;
  235. struct sk_buff *skb;
  236. ACTCAPI_MKHDR(4, 0xff, 0x00);
  237.         if (!skb) {
  238.                 printk(KERN_WARNING "actcapi: alloc_skb failedn");
  239.                 return -ENOMEM;
  240.         }
  241. m->msg.manufacturer_req_err.manuf_msg = 0x03;
  242. m->msg.manufacturer_req_err.controller = 0;
  243. ACTCAPI_QUEUE_TX;
  244.         return 0;
  245. }
  246. /*
  247.  * Set MSN-Mapping.
  248.  */
  249. int
  250. actcapi_manufacturer_req_msn(act2000_card *card)
  251. {
  252. msn_entry *p = card->msn_list;
  253. actcapi_msg *m;
  254. struct sk_buff *skb;
  255. int len;
  256. while (p) {
  257. int i;
  258. len = strlen(p->msn);
  259. for (i = 0; i < 2; i++) {
  260. ACTCAPI_MKHDR(6 + len, 0xff, 0x00);
  261. if (!skb) {
  262. printk(KERN_WARNING "actcapi: alloc_skb failedn");
  263. return -ENOMEM;
  264. }
  265. m->msg.manufacturer_req_msn.manuf_msg = 0x13 + i;
  266. m->msg.manufacturer_req_msn.controller = 0;
  267. m->msg.manufacturer_req_msn.msnmap.eaz = p->eaz;
  268. m->msg.manufacturer_req_msn.msnmap.len = len;
  269. memcpy(m->msg.manufacturer_req_msn.msnmap.msn, p->msn, len);
  270. ACTCAPI_QUEUE_TX;
  271. }
  272. p = p->next;
  273. }
  274.         return 0;
  275. }
  276. void
  277. actcapi_select_b2_protocol_req(act2000_card *card, act2000_chan *chan)
  278. {
  279. actcapi_msg *m;
  280. struct sk_buff *skb;
  281. ACTCAPI_MKHDR(10, 0x40, 0x00);
  282. ACTCAPI_CHKSKB;
  283. m->msg.select_b2_protocol_req.plci = chan->plci;
  284. memset(&m->msg.select_b2_protocol_req.dlpd, 0,
  285.        sizeof(m->msg.select_b2_protocol_req.dlpd));
  286. m->msg.select_b2_protocol_req.dlpd.len = 6;
  287. switch (chan->l2prot) {
  288. case ISDN_PROTO_L2_TRANS:
  289. m->msg.select_b2_protocol_req.protocol = 0x03;
  290. m->msg.select_b2_protocol_req.dlpd.dlen = 4000;
  291. break;
  292. case ISDN_PROTO_L2_HDLC:
  293. m->msg.select_b2_protocol_req.protocol = 0x02;
  294. m->msg.select_b2_protocol_req.dlpd.dlen = 4000;
  295. break;
  296. case ISDN_PROTO_L2_X75I:
  297. case ISDN_PROTO_L2_X75UI:
  298. case ISDN_PROTO_L2_X75BUI:
  299. m->msg.select_b2_protocol_req.protocol = 0x01;
  300. m->msg.select_b2_protocol_req.dlpd.dlen = 4000;
  301. m->msg.select_b2_protocol_req.dlpd.laa = 3;
  302. m->msg.select_b2_protocol_req.dlpd.lab = 1;
  303. m->msg.select_b2_protocol_req.dlpd.win = 7;
  304. m->msg.select_b2_protocol_req.dlpd.modulo = 8;
  305. break;
  306. }
  307. ACTCAPI_QUEUE_TX;
  308. }
  309. static void
  310. actcapi_select_b3_protocol_req(act2000_card *card, act2000_chan *chan)
  311. {
  312. actcapi_msg *m;
  313. struct sk_buff *skb;
  314. ACTCAPI_MKHDR(17, 0x80, 0x00);
  315. ACTCAPI_CHKSKB;
  316. m->msg.select_b3_protocol_req.plci = chan->plci;
  317. memset(&m->msg.select_b3_protocol_req.ncpd, 0,
  318.        sizeof(m->msg.select_b3_protocol_req.ncpd));
  319. switch (chan->l3prot) {
  320. case ISDN_PROTO_L3_TRANS:
  321. m->msg.select_b3_protocol_req.protocol = 0x04;
  322. m->msg.select_b3_protocol_req.ncpd.len = 13;
  323. m->msg.select_b3_protocol_req.ncpd.modulo = 8;
  324. break;
  325. }
  326. ACTCAPI_QUEUE_TX;
  327. }
  328. static void
  329. actcapi_listen_b3_req(act2000_card *card, act2000_chan *chan)
  330. {
  331. actcapi_msg *m;
  332. struct sk_buff *skb;
  333. ACTCAPI_MKHDR(2, 0x81, 0x00);
  334. ACTCAPI_CHKSKB;
  335. m->msg.listen_b3_req.plci = chan->plci;
  336. ACTCAPI_QUEUE_TX;
  337. }
  338. static void
  339. actcapi_disconnect_req(act2000_card *card, act2000_chan *chan)
  340. {
  341. actcapi_msg *m;
  342. struct sk_buff *skb;
  343. ACTCAPI_MKHDR(3, 0x04, 0x00);
  344. ACTCAPI_CHKSKB;
  345. m->msg.disconnect_req.plci = chan->plci;
  346. m->msg.disconnect_req.cause = 0;
  347. ACTCAPI_QUEUE_TX;
  348. }
  349. void
  350. actcapi_disconnect_b3_req(act2000_card *card, act2000_chan *chan)
  351. {
  352. actcapi_msg *m;
  353. struct sk_buff *skb;
  354. ACTCAPI_MKHDR(17, 0x84, 0x00);
  355. ACTCAPI_CHKSKB;
  356. m->msg.disconnect_b3_req.ncci = chan->ncci;
  357. memset(&m->msg.disconnect_b3_req.ncpi, 0,
  358.        sizeof(m->msg.disconnect_b3_req.ncpi));
  359. m->msg.disconnect_b3_req.ncpi.len = 13;
  360. m->msg.disconnect_b3_req.ncpi.modulo = 8;
  361. chan->fsm_state = ACT2000_STATE_BHWAIT;
  362. ACTCAPI_QUEUE_TX;
  363. }
  364. void
  365. actcapi_connect_resp(act2000_card *card, act2000_chan *chan, __u8 cause)
  366. {
  367. actcapi_msg *m;
  368. struct sk_buff *skb;
  369. ACTCAPI_MKHDR(3, 0x02, 0x03);
  370. ACTCAPI_CHKSKB;
  371. m->msg.connect_resp.plci = chan->plci;
  372. m->msg.connect_resp.rejectcause = cause;
  373. if (cause) {
  374. chan->fsm_state = ACT2000_STATE_NULL;
  375. chan->plci = 0x8000;
  376. } else
  377. chan->fsm_state = ACT2000_STATE_IWAIT;
  378. ACTCAPI_QUEUE_TX;
  379. }
  380. static void
  381. actcapi_connect_active_resp(act2000_card *card, act2000_chan *chan)
  382. {
  383. actcapi_msg *m;
  384. struct sk_buff *skb;
  385. ACTCAPI_MKHDR(2, 0x03, 0x03);
  386. ACTCAPI_CHKSKB;
  387. m->msg.connect_resp.plci = chan->plci;
  388. if (chan->fsm_state == ACT2000_STATE_IWAIT)
  389. chan->fsm_state = ACT2000_STATE_IBWAIT;
  390. ACTCAPI_QUEUE_TX;
  391. }
  392. static void
  393. actcapi_connect_b3_resp(act2000_card *card, act2000_chan *chan, __u8 rejectcause)
  394. {
  395. actcapi_msg *m;
  396. struct sk_buff *skb;
  397. ACTCAPI_MKHDR((rejectcause?3:17), 0x82, 0x03);
  398. ACTCAPI_CHKSKB;
  399. m->msg.connect_b3_resp.ncci = chan->ncci;
  400. m->msg.connect_b3_resp.rejectcause = rejectcause;
  401. if (!rejectcause) {
  402. memset(&m->msg.connect_b3_resp.ncpi, 0,
  403.        sizeof(m->msg.connect_b3_resp.ncpi));
  404. m->msg.connect_b3_resp.ncpi.len = 13;
  405. m->msg.connect_b3_resp.ncpi.modulo = 8;
  406. chan->fsm_state = ACT2000_STATE_BWAIT;
  407. }
  408. ACTCAPI_QUEUE_TX;
  409. }
  410. static void
  411. actcapi_connect_b3_active_resp(act2000_card *card, act2000_chan *chan)
  412. {
  413. actcapi_msg *m;
  414. struct sk_buff *skb;
  415. ACTCAPI_MKHDR(2, 0x83, 0x03);
  416. ACTCAPI_CHKSKB;
  417. m->msg.connect_b3_active_resp.ncci = chan->ncci;
  418. chan->fsm_state = ACT2000_STATE_ACTIVE;
  419. ACTCAPI_QUEUE_TX;
  420. }
  421. static void
  422. actcapi_info_resp(act2000_card *card, act2000_chan *chan)
  423. {
  424. actcapi_msg *m;
  425. struct sk_buff *skb;
  426. ACTCAPI_MKHDR(2, 0x07, 0x03);
  427. ACTCAPI_CHKSKB;
  428. m->msg.info_resp.plci = chan->plci;
  429. ACTCAPI_QUEUE_TX;
  430. }
  431. static void
  432. actcapi_disconnect_b3_resp(act2000_card *card, act2000_chan *chan)
  433. {
  434. actcapi_msg *m;
  435. struct sk_buff *skb;
  436. ACTCAPI_MKHDR(2, 0x84, 0x03);
  437. ACTCAPI_CHKSKB;
  438. m->msg.disconnect_b3_resp.ncci = chan->ncci;
  439. chan->ncci = 0x8000;
  440. chan->queued = 0;
  441. ACTCAPI_QUEUE_TX;
  442. }
  443. static void
  444. actcapi_disconnect_resp(act2000_card *card, act2000_chan *chan)
  445. {
  446. actcapi_msg *m;
  447. struct sk_buff *skb;
  448. ACTCAPI_MKHDR(2, 0x04, 0x03);
  449. ACTCAPI_CHKSKB;
  450. m->msg.disconnect_resp.plci = chan->plci;
  451. chan->plci = 0x8000;
  452. ACTCAPI_QUEUE_TX;
  453. }
  454. static int
  455. new_plci(act2000_card *card, __u16 plci)
  456. {
  457. int i;
  458. for (i = 0; i < ACT2000_BCH; i++)
  459. if (card->bch[i].plci == 0x8000) {
  460. card->bch[i].plci = plci;
  461. return i;
  462. }
  463. return -1;
  464. }
  465. static int
  466. find_plci(act2000_card *card, __u16 plci)
  467. {
  468. int i;
  469. for (i = 0; i < ACT2000_BCH; i++)
  470. if (card->bch[i].plci == plci)
  471. return i;
  472. return -1;
  473. }
  474. static int
  475. find_ncci(act2000_card *card, __u16 ncci)
  476. {
  477. int i;
  478. for (i = 0; i < ACT2000_BCH; i++)
  479. if (card->bch[i].ncci == ncci)
  480. return i;
  481. return -1;
  482. }
  483. static int
  484. find_dialing(act2000_card *card, __u16 callref)
  485. {
  486. int i;
  487. for (i = 0; i < ACT2000_BCH; i++)
  488. if ((card->bch[i].callref == callref) &&
  489.     (card->bch[i].fsm_state == ACT2000_STATE_OCALL))
  490. return i;
  491. return -1;
  492. }
  493. static int
  494. actcapi_data_b3_ind(act2000_card *card, struct sk_buff *skb) {
  495. __u16 plci;
  496. __u16 ncci;
  497. __u16 controller;
  498. __u8  blocknr;
  499. int chan;
  500. actcapi_msg *msg = (actcapi_msg *)skb->data;
  501. EVAL_NCCI(msg->msg.data_b3_ind.fakencci, plci, controller, ncci);
  502. chan = find_ncci(card, ncci);
  503. if (chan < 0)
  504. return 0;
  505. if (card->bch[chan].fsm_state != ACT2000_STATE_ACTIVE)
  506. return 0;
  507. if (card->bch[chan].plci != plci)
  508. return 0;
  509. blocknr = msg->msg.data_b3_ind.blocknr;
  510. skb_pull(skb, 19);
  511. card->interface.rcvcallb_skb(card->myid, chan, skb);
  512.         if (!(skb = alloc_skb(11, GFP_ATOMIC))) {
  513.                 printk(KERN_WARNING "actcapi: alloc_skb failedn");
  514.                 return 1;
  515.         }
  516. msg = (actcapi_msg *)skb_put(skb, 11);
  517. msg->hdr.len = 11;
  518. msg->hdr.applicationID = 1;
  519. msg->hdr.cmd.cmd = 0x86;
  520. msg->hdr.cmd.subcmd = 0x03;
  521. msg->hdr.msgnum = actcapi_nextsmsg(card);
  522. msg->msg.data_b3_resp.ncci = ncci;
  523. msg->msg.data_b3_resp.blocknr = blocknr;
  524. ACTCAPI_QUEUE_TX;
  525. return 1;
  526. }
  527. /*
  528.  * Walk over ackq, unlink DATA_B3_REQ from it, if
  529.  * ncci and blocknr are matching.
  530.  * Decrement queued-bytes counter.
  531.  */
  532. static int
  533. handle_ack(act2000_card *card, act2000_chan *chan, __u8 blocknr) {
  534. unsigned long flags;
  535. struct sk_buff *skb;
  536. struct sk_buff *tmp;
  537. struct actcapi_msg *m;
  538. int ret = 0;
  539. save_flags(flags);
  540. cli();
  541. skb = skb_peek(&card->ackq);
  542. restore_flags(flags);
  543.         if (!skb) {
  544. printk(KERN_WARNING "act2000: handle_ack nothing found!n");
  545. return 0;
  546. }
  547.         tmp = skb;
  548.         while (1) {
  549.                 m = (actcapi_msg *)tmp->data;
  550.                 if ((((m->msg.data_b3_req.fakencci >> 8) & 0xff) == chan->ncci) &&
  551.     (m->msg.data_b3_req.blocknr == blocknr)) {
  552. /* found corresponding DATA_B3_REQ */
  553.                         skb_unlink(tmp);
  554. chan->queued -= m->msg.data_b3_req.datalen;
  555. if (m->msg.data_b3_req.flags)
  556. ret = m->msg.data_b3_req.datalen;
  557. dev_kfree_skb(tmp);
  558. if (chan->queued < 0)
  559. chan->queued = 0;
  560.                         return ret;
  561.                 }
  562. save_flags(flags);
  563. cli();
  564.                 tmp = skb_peek((struct sk_buff_head *)tmp);
  565. restore_flags(flags);
  566.                 if ((tmp == skb) || (tmp == NULL)) {
  567. /* reached end of queue */
  568. printk(KERN_WARNING "act2000: handle_ack nothing found!n");
  569.                         return 0;
  570. }
  571.         }
  572. }
  573. void
  574. actcapi_dispatch(act2000_card *card)
  575. {
  576. struct sk_buff *skb;
  577. actcapi_msg *msg;
  578. __u16 ccmd;
  579. int chan;
  580. int len;
  581. act2000_chan *ctmp;
  582. isdn_ctrl cmd;
  583. char tmp[170];
  584. while ((skb = skb_dequeue(&card->rcvq))) {
  585. actcapi_debug_msg(skb, 0);
  586. msg = (actcapi_msg *)skb->data;
  587. ccmd = ((msg->hdr.cmd.cmd << 8) | msg->hdr.cmd.subcmd);
  588. switch (ccmd) {
  589. case 0x8602:
  590. /* DATA_B3_IND */
  591. if (actcapi_data_b3_ind(card, skb))
  592. return;
  593. break;
  594. case 0x8601:
  595. /* DATA_B3_CONF */
  596. chan = find_ncci(card, msg->msg.data_b3_conf.ncci);
  597. if ((chan >= 0) && (card->bch[chan].fsm_state == ACT2000_STATE_ACTIVE)) {
  598. if (msg->msg.data_b3_conf.info != 0)
  599. printk(KERN_WARNING "act2000: DATA_B3_CONF: %04xn",
  600.        msg->msg.data_b3_conf.info);
  601. len = handle_ack(card, &card->bch[chan],
  602.  msg->msg.data_b3_conf.blocknr);
  603. if (len) {
  604. cmd.driver = card->myid;
  605. cmd.command = ISDN_STAT_BSENT;
  606. cmd.arg = chan;
  607. cmd.parm.length = len;
  608. card->interface.statcallb(&cmd);
  609. }
  610. }
  611. break;
  612. case 0x0201:
  613. /* CONNECT_CONF */
  614. chan = find_dialing(card, msg->hdr.msgnum);
  615. if (chan >= 0) {
  616. if (msg->msg.connect_conf.info) {
  617. card->bch[chan].fsm_state = ACT2000_STATE_NULL;
  618. cmd.driver = card->myid;
  619. cmd.command = ISDN_STAT_DHUP;
  620. cmd.arg = chan;
  621. card->interface.statcallb(&cmd);
  622. } else {
  623. card->bch[chan].fsm_state = ACT2000_STATE_OWAIT;
  624. card->bch[chan].plci = msg->msg.connect_conf.plci;
  625. }
  626. }
  627. break;
  628. case 0x0202:
  629. /* CONNECT_IND */
  630. chan = new_plci(card, msg->msg.connect_ind.plci);
  631. if (chan < 0) {
  632. ctmp = (act2000_chan *)tmp;
  633. ctmp->plci = msg->msg.connect_ind.plci;
  634. actcapi_connect_resp(card, ctmp, 0x11); /* All Card-Cannels busy */
  635. } else {
  636. card->bch[chan].fsm_state = ACT2000_STATE_ICALL;
  637. cmd.driver = card->myid;
  638. cmd.command = ISDN_STAT_ICALL;
  639. cmd.arg = chan;
  640. cmd.parm.setup.si1 = msg->msg.connect_ind.si1;
  641. cmd.parm.setup.si2 = msg->msg.connect_ind.si2;
  642. if (card->ptype == ISDN_PTYPE_EURO)
  643. strcpy(cmd.parm.setup.eazmsn,
  644.        act2000_find_eaz(card, msg->msg.connect_ind.eaz));
  645. else {
  646. cmd.parm.setup.eazmsn[0] = msg->msg.connect_ind.eaz;
  647. cmd.parm.setup.eazmsn[1] = 0;
  648. }
  649. memset(cmd.parm.setup.phone, 0, sizeof(cmd.parm.setup.phone));
  650. memcpy(cmd.parm.setup.phone, msg->msg.connect_ind.addr.num,
  651.        msg->msg.connect_ind.addr.len - 1);
  652. cmd.parm.setup.plan = msg->msg.connect_ind.addr.tnp;
  653. cmd.parm.setup.screen = 0;
  654. if (card->interface.statcallb(&cmd) == 2)
  655. actcapi_connect_resp(card, &card->bch[chan], 0x15); /* Reject Call */
  656. }
  657. break;
  658. case 0x0302:
  659. /* CONNECT_ACTIVE_IND */
  660. chan = find_plci(card, msg->msg.connect_active_ind.plci);
  661. if (chan >= 0)
  662. switch (card->bch[chan].fsm_state) {
  663. case ACT2000_STATE_IWAIT:
  664. actcapi_connect_active_resp(card, &card->bch[chan]);
  665. break;
  666. case ACT2000_STATE_OWAIT:
  667. actcapi_connect_active_resp(card, &card->bch[chan]);
  668. actcapi_select_b2_protocol_req(card, &card->bch[chan]);
  669. break;
  670. }
  671. break;
  672. case 0x8202:
  673. /* CONNECT_B3_IND */
  674. chan = find_plci(card, msg->msg.connect_b3_ind.plci);
  675. if ((chan >= 0) && (card->bch[chan].fsm_state == ACT2000_STATE_IBWAIT)) {
  676. card->bch[chan].ncci = msg->msg.connect_b3_ind.ncci;
  677. actcapi_connect_b3_resp(card, &card->bch[chan], 0);
  678. } else {
  679. ctmp = (act2000_chan *)tmp;
  680. ctmp->ncci = msg->msg.connect_b3_ind.ncci;
  681. actcapi_connect_b3_resp(card, ctmp, 0x11); /* All Card-Cannels busy */
  682. }
  683. break;
  684. case 0x8302:
  685. /* CONNECT_B3_ACTIVE_IND */
  686. chan = find_ncci(card, msg->msg.connect_b3_active_ind.ncci);
  687. if ((chan >= 0) && (card->bch[chan].fsm_state == ACT2000_STATE_BWAIT)) {
  688. actcapi_connect_b3_active_resp(card, &card->bch[chan]);
  689. cmd.driver = card->myid;
  690. cmd.command = ISDN_STAT_BCONN;
  691. cmd.arg = chan;
  692. card->interface.statcallb(&cmd);
  693. }
  694. break;
  695. case 0x8402:
  696. /* DISCONNECT_B3_IND */
  697. chan = find_ncci(card, msg->msg.disconnect_b3_ind.ncci);
  698. if (chan >= 0) {
  699. ctmp = &card->bch[chan];
  700. actcapi_disconnect_b3_resp(card, ctmp);
  701. switch (ctmp->fsm_state) {
  702. case ACT2000_STATE_ACTIVE:
  703. ctmp->fsm_state = ACT2000_STATE_DHWAIT2;
  704. cmd.driver = card->myid;
  705. cmd.command = ISDN_STAT_BHUP;
  706. cmd.arg = chan;
  707. card->interface.statcallb(&cmd);
  708. break;
  709. case ACT2000_STATE_BHWAIT2:
  710. actcapi_disconnect_req(card, ctmp);
  711. ctmp->fsm_state = ACT2000_STATE_DHWAIT;
  712. cmd.driver = card->myid;
  713. cmd.command = ISDN_STAT_BHUP;
  714. cmd.arg = chan;
  715. card->interface.statcallb(&cmd);
  716. break;
  717. }
  718. }
  719. break;
  720. case 0x0402:
  721. /* DISCONNECT_IND */
  722. chan = find_plci(card, msg->msg.disconnect_ind.plci);
  723. if (chan >= 0) {
  724. ctmp = &card->bch[chan];
  725. actcapi_disconnect_resp(card, ctmp);
  726. ctmp->fsm_state = ACT2000_STATE_NULL;
  727. cmd.driver = card->myid;
  728. cmd.command = ISDN_STAT_DHUP;
  729. cmd.arg = chan;
  730. card->interface.statcallb(&cmd);
  731. } else {
  732. ctmp = (act2000_chan *)tmp;
  733. ctmp->plci = msg->msg.disconnect_ind.plci;
  734. actcapi_disconnect_resp(card, ctmp);
  735. }
  736. break;
  737. case 0x4001:
  738. /* SELECT_B2_PROTOCOL_CONF */
  739. chan = find_plci(card, msg->msg.select_b2_protocol_conf.plci);
  740. if (chan >= 0)
  741. switch (card->bch[chan].fsm_state) {
  742. case ACT2000_STATE_ICALL:
  743. case ACT2000_STATE_OWAIT:
  744. ctmp = &card->bch[chan];
  745. if (msg->msg.select_b2_protocol_conf.info == 0)
  746. actcapi_select_b3_protocol_req(card, ctmp);
  747. else {
  748. ctmp->fsm_state = ACT2000_STATE_NULL;
  749. cmd.driver = card->myid;
  750. cmd.command = ISDN_STAT_DHUP;
  751. cmd.arg = chan;
  752. card->interface.statcallb(&cmd);
  753. }
  754. break;
  755. }
  756. break;
  757. case 0x8001:
  758. /* SELECT_B3_PROTOCOL_CONF */
  759. chan = find_plci(card, msg->msg.select_b3_protocol_conf.plci);
  760. if (chan >= 0)
  761. switch (card->bch[chan].fsm_state) {
  762. case ACT2000_STATE_ICALL:
  763. case ACT2000_STATE_OWAIT:
  764. ctmp = &card->bch[chan];
  765. if (msg->msg.select_b3_protocol_conf.info == 0)
  766. actcapi_listen_b3_req(card, ctmp);
  767. else {
  768. ctmp->fsm_state = ACT2000_STATE_NULL;
  769. cmd.driver = card->myid;
  770. cmd.command = ISDN_STAT_DHUP;
  771. cmd.arg = chan;
  772. card->interface.statcallb(&cmd);
  773. }
  774. }
  775. break;
  776. case 0x8101:
  777. /* LISTEN_B3_CONF */
  778. chan = find_plci(card, msg->msg.listen_b3_conf.plci);
  779. if (chan >= 0)
  780. switch (card->bch[chan].fsm_state) {
  781. case ACT2000_STATE_ICALL:
  782. ctmp = &card->bch[chan];
  783. if (msg->msg.listen_b3_conf.info == 0)
  784. actcapi_connect_resp(card, ctmp, 0);
  785. else {
  786. ctmp->fsm_state = ACT2000_STATE_NULL;
  787. cmd.driver = card->myid;
  788. cmd.command = ISDN_STAT_DHUP;
  789. cmd.arg = chan;
  790. card->interface.statcallb(&cmd);
  791. }
  792. break;
  793. case ACT2000_STATE_OWAIT:
  794. ctmp = &card->bch[chan];
  795. if (msg->msg.listen_b3_conf.info == 0) {
  796. actcapi_connect_b3_req(card, ctmp);
  797. ctmp->fsm_state = ACT2000_STATE_OBWAIT;
  798. cmd.driver = card->myid;
  799. cmd.command = ISDN_STAT_DCONN;
  800. cmd.arg = chan;
  801. card->interface.statcallb(&cmd);
  802. } else {
  803. ctmp->fsm_state = ACT2000_STATE_NULL;
  804. cmd.driver = card->myid;
  805. cmd.command = ISDN_STAT_DHUP;
  806. cmd.arg = chan;
  807. card->interface.statcallb(&cmd);
  808. }
  809. break;
  810. }
  811. break;
  812. case 0x8201:
  813. /* CONNECT_B3_CONF */
  814. chan = find_plci(card, msg->msg.connect_b3_conf.plci);
  815. if ((chan >= 0) && (card->bch[chan].fsm_state == ACT2000_STATE_OBWAIT)) {
  816. ctmp = &card->bch[chan];
  817. if (msg->msg.connect_b3_conf.info) {
  818. ctmp->fsm_state = ACT2000_STATE_NULL;
  819. cmd.driver = card->myid;
  820. cmd.command = ISDN_STAT_DHUP;
  821. cmd.arg = chan;
  822. card->interface.statcallb(&cmd);
  823. } else {
  824. ctmp->ncci = msg->msg.connect_b3_conf.ncci;
  825. ctmp->fsm_state = ACT2000_STATE_BWAIT;
  826. }
  827. }
  828. break;
  829. case 0x8401:
  830. /* DISCONNECT_B3_CONF */
  831. chan = find_ncci(card, msg->msg.disconnect_b3_conf.ncci);
  832. if ((chan >= 0) && (card->bch[chan].fsm_state == ACT2000_STATE_BHWAIT))
  833. card->bch[chan].fsm_state = ACT2000_STATE_BHWAIT2;
  834. break;
  835. case 0x0702:
  836. /* INFO_IND */
  837. chan = find_plci(card, msg->msg.info_ind.plci);
  838. if (chan >= 0)
  839. /* TODO: Eval Charging info / cause */
  840. actcapi_info_resp(card, &card->bch[chan]);
  841. break;
  842. case 0x0401:
  843. /* LISTEN_CONF */
  844. case 0x0501:
  845. /* LISTEN_CONF */
  846. case 0xff01:
  847. /* MANUFACTURER_CONF */
  848. break;
  849. case 0xff02:
  850. /* MANUFACTURER_IND */
  851. if (msg->msg.manuf_msg == 3) {
  852. memset(tmp, 0, sizeof(tmp));
  853. strncpy(tmp,
  854. &msg->msg.manufacturer_ind_err.errstring,
  855. msg->hdr.len - 16);
  856. if (msg->msg.manufacturer_ind_err.errcode)
  857. printk(KERN_WARNING "act2000: %sn", tmp);
  858. else {
  859. printk(KERN_DEBUG "act2000: %sn", tmp);
  860. if ((!strncmp(tmp, "INFO: Trace buffer con", 22)) ||
  861.     (!strncmp(tmp, "INFO: Compile Date/Tim", 22))) {
  862. card->flags |= ACT2000_FLAGS_RUNNING;
  863. cmd.command = ISDN_STAT_RUN;
  864. cmd.driver = card->myid;
  865. cmd.arg = 0;
  866. actcapi_manufacturer_req_net(card);
  867. actcapi_manufacturer_req_msn(card);
  868. actcapi_listen_req(card);
  869. card->interface.statcallb(&cmd);
  870. }
  871. }
  872. }
  873. break;
  874. default:
  875. printk(KERN_WARNING "act2000: UNHANDLED Message %04xn", ccmd);
  876. break;
  877. }
  878. dev_kfree_skb(skb);
  879. }
  880. }
  881. #ifdef DEBUG_MSG
  882. static void
  883. actcapi_debug_caddr(actcapi_addr *addr)
  884. {
  885. char tmp[30];
  886. printk(KERN_DEBUG " Alen  = %dn", addr->len);
  887. if (addr->len > 0)
  888. printk(KERN_DEBUG " Atnp  = 0x%02xn", addr->tnp);
  889. if (addr->len > 1) {
  890. memset(tmp, 0, 30);
  891. memcpy(tmp, addr->num, addr->len - 1);
  892. printk(KERN_DEBUG " Anum  = '%s'n", tmp);
  893. }
  894. }
  895. static void
  896. actcapi_debug_ncpi(actcapi_ncpi *ncpi)
  897. {
  898. printk(KERN_DEBUG " ncpi.len = %dn", ncpi->len);
  899. if (ncpi->len >= 2)
  900. printk(KERN_DEBUG " ncpi.lic = 0x%04xn", ncpi->lic);
  901. if (ncpi->len >= 4)
  902. printk(KERN_DEBUG " ncpi.hic = 0x%04xn", ncpi->hic);
  903. if (ncpi->len >= 6)
  904. printk(KERN_DEBUG " ncpi.ltc = 0x%04xn", ncpi->ltc);
  905. if (ncpi->len >= 8)
  906. printk(KERN_DEBUG " ncpi.htc = 0x%04xn", ncpi->htc);
  907. if (ncpi->len >= 10)
  908. printk(KERN_DEBUG " ncpi.loc = 0x%04xn", ncpi->loc);
  909. if (ncpi->len >= 12)
  910. printk(KERN_DEBUG " ncpi.hoc = 0x%04xn", ncpi->hoc);
  911. if (ncpi->len >= 13)
  912. printk(KERN_DEBUG " ncpi.mod = %dn", ncpi->modulo);
  913. }
  914. static void
  915. actcapi_debug_dlpd(actcapi_dlpd *dlpd)
  916. {
  917. printk(KERN_DEBUG " dlpd.len = %dn", dlpd->len);
  918. if (dlpd->len >= 2)
  919. printk(KERN_DEBUG " dlpd.dlen   = 0x%04xn", dlpd->dlen);
  920. if (dlpd->len >= 3)
  921. printk(KERN_DEBUG " dlpd.laa    = 0x%02xn", dlpd->laa);
  922. if (dlpd->len >= 4)
  923. printk(KERN_DEBUG " dlpd.lab    = 0x%02xn", dlpd->lab);
  924. if (dlpd->len >= 5)
  925. printk(KERN_DEBUG " dlpd.modulo = %dn", dlpd->modulo);
  926. if (dlpd->len >= 6)
  927. printk(KERN_DEBUG " dlpd.win    = %dn", dlpd->win);
  928. }
  929. #ifdef DEBUG_DUMP_SKB
  930. static void dump_skb(struct sk_buff *skb) {
  931. char tmp[80];
  932. char *p = skb->data;
  933. char *t = tmp;
  934. int i;
  935. for (i = 0; i < skb->len; i++) {
  936. t += sprintf(t, "%02x ", *p++ & 0xff);
  937. if ((i & 0x0f) == 8) {
  938. printk(KERN_DEBUG "dump: %sn", tmp);
  939. t = tmp;
  940. }
  941. }
  942. if (i & 0x07)
  943. printk(KERN_DEBUG "dump: %sn", tmp);
  944. }
  945. #endif
  946. void
  947. actcapi_debug_msg(struct sk_buff *skb, int direction)
  948. {
  949. actcapi_msg *msg = (actcapi_msg *)skb->data;
  950. char *descr;
  951. int i;
  952. char tmp[170];
  953. #ifndef DEBUG_DATA_MSG
  954. if (msg->hdr.cmd.cmd == 0x86)
  955. return;
  956. #endif
  957. descr = "INVALID";
  958. #ifdef DEBUG_DUMP_SKB
  959. dump_skb(skb);
  960. #endif
  961. for (i = 0; i < num_valid_msg; i++)
  962. if ((msg->hdr.cmd.cmd == valid_msg[i].cmd.cmd) &&
  963.     (msg->hdr.cmd.subcmd == valid_msg[i].cmd.subcmd)) {
  964. descr = valid_msg[i].description;
  965. break;
  966. }
  967. printk(KERN_DEBUG "%s %s msgn", direction?"Outgoing":"Incoming", descr);
  968. printk(KERN_DEBUG " ApplID = %dn", msg->hdr.applicationID);
  969. printk(KERN_DEBUG " Len    = %dn", msg->hdr.len);
  970. printk(KERN_DEBUG " MsgNum = 0x%04xn", msg->hdr.msgnum);
  971. printk(KERN_DEBUG " Cmd    = 0x%02xn", msg->hdr.cmd.cmd);
  972. printk(KERN_DEBUG " SubCmd = 0x%02xn", msg->hdr.cmd.subcmd);
  973. switch (i) {
  974. case 0:
  975. /* DATA B3 IND */
  976. printk(KERN_DEBUG " BLOCK = 0x%02xn",
  977.        msg->msg.data_b3_ind.blocknr);
  978. break;
  979. case 2:
  980. /* CONNECT CONF */
  981. printk(KERN_DEBUG " PLCI = 0x%04xn",
  982.        msg->msg.connect_conf.plci);
  983. printk(KERN_DEBUG " Info = 0x%04xn",
  984.        msg->msg.connect_conf.info);
  985. break;
  986. case 3:
  987. /* CONNECT IND */
  988. printk(KERN_DEBUG " PLCI = 0x%04xn",
  989.        msg->msg.connect_ind.plci);
  990. printk(KERN_DEBUG " Contr = %dn",
  991.        msg->msg.connect_ind.controller);
  992. printk(KERN_DEBUG " SI1   = %dn",
  993.        msg->msg.connect_ind.si1);
  994. printk(KERN_DEBUG " SI2   = %dn",
  995.        msg->msg.connect_ind.si2);
  996. printk(KERN_DEBUG " EAZ   = '%c'n",
  997.        msg->msg.connect_ind.eaz);
  998. actcapi_debug_caddr(&msg->msg.connect_ind.addr);
  999. break;
  1000. case 5:
  1001. /* CONNECT ACTIVE IND */
  1002. printk(KERN_DEBUG " PLCI = 0x%04xn",
  1003.        msg->msg.connect_active_ind.plci);
  1004. actcapi_debug_caddr(&msg->msg.connect_active_ind.addr);
  1005. break;
  1006. case 8:
  1007. /* LISTEN CONF */
  1008. printk(KERN_DEBUG " Contr = %dn",
  1009.        msg->msg.listen_conf.controller);
  1010. printk(KERN_DEBUG " Info = 0x%04xn",
  1011.        msg->msg.listen_conf.info);
  1012. break;
  1013. case 11:
  1014. /* INFO IND */
  1015. printk(KERN_DEBUG " PLCI = 0x%04xn",
  1016.        msg->msg.info_ind.plci);
  1017. printk(KERN_DEBUG " Imsk = 0x%04xn",
  1018.        msg->msg.info_ind.nr.mask);
  1019. if (msg->hdr.len > 12) {
  1020. int l = msg->hdr.len - 12;
  1021. int j;
  1022. char *p = tmp;
  1023. for (j = 0; j < l ; j++)
  1024. p += sprintf(p, "%02x ", msg->msg.info_ind.el.display[j]);
  1025. printk(KERN_DEBUG " D = '%s'n", tmp);
  1026. }
  1027. break;
  1028. case 14:
  1029. /* SELECT B2 PROTOCOL CONF */
  1030. printk(KERN_DEBUG " PLCI = 0x%04xn",
  1031.        msg->msg.select_b2_protocol_conf.plci);
  1032. printk(KERN_DEBUG " Info = 0x%04xn",
  1033.        msg->msg.select_b2_protocol_conf.info);
  1034. break;
  1035. case 15:
  1036. /* SELECT B3 PROTOCOL CONF */
  1037. printk(KERN_DEBUG " PLCI = 0x%04xn",
  1038.        msg->msg.select_b3_protocol_conf.plci);
  1039. printk(KERN_DEBUG " Info = 0x%04xn",
  1040.        msg->msg.select_b3_protocol_conf.info);
  1041. break;
  1042. case 16:
  1043. /* LISTEN B3 CONF */
  1044. printk(KERN_DEBUG " PLCI = 0x%04xn",
  1045.        msg->msg.listen_b3_conf.plci);
  1046. printk(KERN_DEBUG " Info = 0x%04xn",
  1047.        msg->msg.listen_b3_conf.info);
  1048. break;
  1049. case 18:
  1050. /* CONNECT B3 IND */
  1051. printk(KERN_DEBUG " NCCI = 0x%04xn",
  1052.        msg->msg.connect_b3_ind.ncci);
  1053. printk(KERN_DEBUG " PLCI = 0x%04xn",
  1054.        msg->msg.connect_b3_ind.plci);
  1055. actcapi_debug_ncpi(&msg->msg.connect_b3_ind.ncpi);
  1056. break;
  1057. case 19:
  1058. /* CONNECT B3 ACTIVE IND */
  1059. printk(KERN_DEBUG " NCCI = 0x%04xn",
  1060.        msg->msg.connect_b3_active_ind.ncci);
  1061. actcapi_debug_ncpi(&msg->msg.connect_b3_active_ind.ncpi);
  1062. break;
  1063. case 26:
  1064. /* MANUFACTURER IND */
  1065. printk(KERN_DEBUG " Mmsg = 0x%02xn",
  1066.        msg->msg.manufacturer_ind_err.manuf_msg);
  1067. switch (msg->msg.manufacturer_ind_err.manuf_msg) {
  1068. case 3:
  1069. printk(KERN_DEBUG " Contr = %dn",
  1070.        msg->msg.manufacturer_ind_err.controller);
  1071. printk(KERN_DEBUG " Code = 0x%08xn",
  1072.        msg->msg.manufacturer_ind_err.errcode);
  1073. memset(tmp, 0, sizeof(tmp));
  1074. strncpy(tmp, &msg->msg.manufacturer_ind_err.errstring,
  1075. msg->hdr.len - 16);
  1076. printk(KERN_DEBUG " Emsg = '%s'n", tmp);
  1077. break;
  1078. }
  1079. break;
  1080. case 30:
  1081. /* LISTEN REQ */
  1082. printk(KERN_DEBUG " Imsk = 0x%08xn",
  1083.        msg->msg.listen_req.infomask);
  1084. printk(KERN_DEBUG " Emsk = 0x%04xn",
  1085.        msg->msg.listen_req.eazmask);
  1086. printk(KERN_DEBUG " Smsk = 0x%04xn",
  1087.        msg->msg.listen_req.simask);
  1088. break;
  1089. case 35:
  1090. /* SELECT_B2_PROTOCOL_REQ */
  1091. printk(KERN_DEBUG " PLCI  = 0x%04xn",
  1092.        msg->msg.select_b2_protocol_req.plci);
  1093. printk(KERN_DEBUG " prot  = 0x%02xn",
  1094.        msg->msg.select_b2_protocol_req.protocol);
  1095. if (msg->hdr.len >= 11)
  1096. printk(KERN_DEBUG "No dlpdn");
  1097. else
  1098. actcapi_debug_dlpd(&msg->msg.select_b2_protocol_req.dlpd);
  1099. break;
  1100. case 44:
  1101. /* CONNECT RESP */
  1102. printk(KERN_DEBUG " PLCI  = 0x%04xn",
  1103.        msg->msg.connect_resp.plci);
  1104. printk(KERN_DEBUG " CAUSE = 0x%02xn",
  1105.        msg->msg.connect_resp.rejectcause);
  1106. break;
  1107. case 45:
  1108. /* CONNECT ACTIVE RESP */
  1109. printk(KERN_DEBUG " PLCI  = 0x%04xn",
  1110.        msg->msg.connect_active_resp.plci);
  1111. break;
  1112. }
  1113. }
  1114. #endif