isdnhdlc.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. /*
  2. * isdnhdlc.c -- General purpose ISDN HDLC decoder.
  3. *
  4. *Copyright (C) 2002 Wolfgang Mües <wolfgang@iksw-muees.de>
  5. * 2001 Frode Isaksen <fisaksen@bewan.com>
  6. * 2001 Kai Germaschewski <kai.germaschewski@gmx.de>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. */
  22. #include <linux/module.h>
  23. #include <linux/init.h>
  24. #include <linux/crc-ccitt.h>
  25. #include "isdnhdlc.h"
  26. /*-------------------------------------------------------------------*/
  27. MODULE_AUTHOR("Wolfgang Mües <wolfgang@iksw-muees.de>, "
  28. "Frode Isaksen <fisaksen@bewan.com>, "
  29. "Kai Germaschewski <kai.germaschewski@gmx.de>");
  30. MODULE_DESCRIPTION("General purpose ISDN HDLC decoder");
  31. MODULE_LICENSE("GPL");
  32. /*-------------------------------------------------------------------*/
  33. enum {
  34. HDLC_FAST_IDLE,HDLC_GET_FLAG_B0,HDLC_GETFLAG_B1A6,HDLC_GETFLAG_B7,
  35. HDLC_GET_DATA,HDLC_FAST_FLAG
  36. };
  37. enum {
  38. HDLC_SEND_DATA,HDLC_SEND_CRC1,HDLC_SEND_FAST_FLAG,
  39. HDLC_SEND_FIRST_FLAG,HDLC_SEND_CRC2,HDLC_SEND_CLOSING_FLAG,
  40. HDLC_SEND_IDLE1,HDLC_SEND_FAST_IDLE,HDLC_SENDFLAG_B0,
  41. HDLC_SENDFLAG_B1A6,HDLC_SENDFLAG_B7,STOPPED
  42. };
  43. void isdnhdlc_rcv_init (struct isdnhdlc_vars *hdlc, int do_adapt56)
  44. {
  45. hdlc->bit_shift = 0;
  46. hdlc->hdlc_bits1 = 0;
  47. hdlc->data_bits = 0;
  48. hdlc->ffbit_shift = 0;
  49. hdlc->data_received = 0;
  50. hdlc->state = HDLC_GET_DATA;
  51. hdlc->do_adapt56 = do_adapt56;
  52. hdlc->dchannel = 0;
  53. hdlc->crc = 0;
  54. hdlc->cbin = 0;
  55. hdlc->shift_reg = 0;
  56. hdlc->ffvalue = 0;
  57. hdlc->dstpos = 0;
  58. }
  59. void isdnhdlc_out_init (struct isdnhdlc_vars *hdlc, int is_d_channel, int do_adapt56)
  60. {
  61. hdlc->bit_shift = 0;
  62. hdlc->hdlc_bits1 = 0;
  63. hdlc->data_bits = 0;
  64. hdlc->ffbit_shift = 0;
  65. hdlc->data_received = 0;
  66. hdlc->do_closing = 0;
  67. hdlc->ffvalue = 0;
  68. if (is_d_channel) {
  69. hdlc->dchannel = 1;
  70. hdlc->state = HDLC_SEND_FIRST_FLAG;
  71. } else {
  72. hdlc->dchannel = 0;
  73. hdlc->state = HDLC_SEND_FAST_FLAG;
  74. hdlc->ffvalue = 0x7e;
  75. }
  76. hdlc->cbin = 0x7e;
  77. hdlc->bit_shift = 0;
  78. if(do_adapt56){
  79. hdlc->do_adapt56 = 1;
  80. hdlc->data_bits = 0;
  81. hdlc->state = HDLC_SENDFLAG_B0;
  82. } else {
  83. hdlc->do_adapt56 = 0;
  84. hdlc->data_bits = 8;
  85. }
  86. hdlc->shift_reg = 0;
  87. }
  88. /*
  89. isdnhdlc_decode - decodes HDLC frames from a transparent bit stream.
  90. The source buffer is scanned for valid HDLC frames looking for
  91. flags (01111110) to indicate the start of a frame. If the start of
  92. the frame is found, the bit stuffing is removed (0 after 5 1's).
  93. When a new flag is found, the complete frame has been received
  94. and the CRC is checked.
  95. If a valid frame is found, the function returns the frame length
  96. excluding the CRC with the bit HDLC_END_OF_FRAME set.
  97. If the beginning of a valid frame is found, the function returns
  98. the length.
  99. If a framing error is found (too many 1s and not a flag) the function
  100. returns the length with the bit HDLC_FRAMING_ERROR set.
  101. If a CRC error is found the function returns the length with the
  102. bit HDLC_CRC_ERROR set.
  103. If the frame length exceeds the destination buffer size, the function
  104. returns the length with the bit HDLC_LENGTH_ERROR set.
  105. src - source buffer
  106. slen - source buffer length
  107. count - number of bytes removed (decoded) from the source buffer
  108. dst _ destination buffer
  109. dsize - destination buffer size
  110. returns - number of decoded bytes in the destination buffer and status
  111. flag.
  112. */
  113. int isdnhdlc_decode (struct isdnhdlc_vars *hdlc, const unsigned char *src,
  114. int slen, int *count, unsigned char *dst, int dsize)
  115. {
  116. int status=0;
  117. static const unsigned char fast_flag[]={
  118. 0x00,0x00,0x00,0x20,0x30,0x38,0x3c,0x3e,0x3f
  119. };
  120. static const unsigned char fast_flag_value[]={
  121. 0x00,0x7e,0xfc,0xf9,0xf3,0xe7,0xcf,0x9f,0x3f
  122. };
  123. static const unsigned char fast_abort[]={
  124. 0x00,0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff
  125. };
  126. *count = slen;
  127. while(slen > 0){
  128. if(hdlc->bit_shift==0){
  129. hdlc->cbin = *src++;
  130. slen--;
  131. hdlc->bit_shift = 8;
  132. if(hdlc->do_adapt56){
  133. hdlc->bit_shift --;
  134. }
  135. }
  136. switch(hdlc->state){
  137. case STOPPED:
  138. return 0;
  139. case HDLC_FAST_IDLE:
  140. if(hdlc->cbin == 0xff){
  141. hdlc->bit_shift = 0;
  142. break;
  143. }
  144. hdlc->state = HDLC_GET_FLAG_B0;
  145. hdlc->hdlc_bits1 = 0;
  146. hdlc->bit_shift = 8;
  147. break;
  148. case HDLC_GET_FLAG_B0:
  149. if(!(hdlc->cbin & 0x80)) {
  150. hdlc->state = HDLC_GETFLAG_B1A6;
  151. hdlc->hdlc_bits1 = 0;
  152. } else {
  153. if(!hdlc->do_adapt56){
  154. if(++hdlc->hdlc_bits1 >=8 ) if(hdlc->bit_shift==1)
  155. hdlc->state = HDLC_FAST_IDLE;
  156. }
  157. }
  158. hdlc->cbin<<=1;
  159. hdlc->bit_shift --;
  160. break;
  161. case HDLC_GETFLAG_B1A6:
  162. if(hdlc->cbin & 0x80){
  163. hdlc->hdlc_bits1++;
  164. if(hdlc->hdlc_bits1==6){
  165. hdlc->state = HDLC_GETFLAG_B7;
  166. }
  167. } else {
  168. hdlc->hdlc_bits1 = 0;
  169. }
  170. hdlc->cbin<<=1;
  171. hdlc->bit_shift --;
  172. break;
  173. case HDLC_GETFLAG_B7:
  174. if(hdlc->cbin & 0x80) {
  175. hdlc->state = HDLC_GET_FLAG_B0;
  176. } else {
  177. hdlc->state = HDLC_GET_DATA;
  178. hdlc->crc = 0xffff;
  179. hdlc->shift_reg = 0;
  180. hdlc->hdlc_bits1 = 0;
  181. hdlc->data_bits = 0;
  182. hdlc->data_received = 0;
  183. }
  184. hdlc->cbin<<=1;
  185. hdlc->bit_shift --;
  186. break;
  187. case HDLC_GET_DATA:
  188. if(hdlc->cbin & 0x80){
  189. hdlc->hdlc_bits1++;
  190. switch(hdlc->hdlc_bits1){
  191. case 6:
  192. break;
  193. case 7:
  194. if(hdlc->data_received) {
  195. // bad frame
  196. status = -HDLC_FRAMING_ERROR;
  197. }
  198. if(!hdlc->do_adapt56){
  199. if(hdlc->cbin==fast_abort[hdlc->bit_shift+1]){
  200. hdlc->state = HDLC_FAST_IDLE;
  201. hdlc->bit_shift=1;
  202. break;
  203. }
  204. } else {
  205. hdlc->state = HDLC_GET_FLAG_B0;
  206. }
  207. break;
  208. default:
  209. hdlc->shift_reg>>=1;
  210. hdlc->shift_reg |= 0x80;
  211. hdlc->data_bits++;
  212. break;
  213. }
  214. } else {
  215. switch(hdlc->hdlc_bits1){
  216. case 5:
  217. break;
  218. case 6:
  219. if(hdlc->data_received){
  220. if (hdlc->dstpos < 2) {
  221. status = -HDLC_FRAMING_ERROR;
  222. } else if (hdlc->crc != 0xf0b8){
  223. // crc error
  224. status = -HDLC_CRC_ERROR;
  225. } else {
  226. // remove CRC
  227. hdlc->dstpos -= 2;
  228. // good frame
  229. status = hdlc->dstpos;
  230. }
  231. }
  232. hdlc->crc = 0xffff;
  233. hdlc->shift_reg = 0;
  234. hdlc->data_bits = 0;
  235. if(!hdlc->do_adapt56){
  236. if(hdlc->cbin==fast_flag[hdlc->bit_shift]){
  237. hdlc->ffvalue = fast_flag_value[hdlc->bit_shift];
  238. hdlc->state = HDLC_FAST_FLAG;
  239. hdlc->ffbit_shift = hdlc->bit_shift;
  240. hdlc->bit_shift = 1;
  241. } else {
  242. hdlc->state = HDLC_GET_DATA;
  243. hdlc->data_received = 0;
  244. }
  245. } else {
  246. hdlc->state = HDLC_GET_DATA;
  247. hdlc->data_received = 0;
  248. }
  249. break;
  250. default:
  251. hdlc->shift_reg>>=1;
  252. hdlc->data_bits++;
  253. break;
  254. }
  255. hdlc->hdlc_bits1 = 0;
  256. }
  257. if (status) {
  258. hdlc->dstpos = 0;
  259. *count -= slen;
  260. hdlc->cbin <<= 1;
  261. hdlc->bit_shift--;
  262. return status;
  263. }
  264. if(hdlc->data_bits==8){
  265. hdlc->data_bits = 0;
  266. hdlc->data_received = 1;
  267. hdlc->crc = crc_ccitt_byte(hdlc->crc, hdlc->shift_reg);
  268. // good byte received
  269. if (hdlc->dstpos < dsize) {
  270. dst[hdlc->dstpos++] = hdlc->shift_reg;
  271. } else {
  272. // frame too long
  273. status = -HDLC_LENGTH_ERROR;
  274. hdlc->dstpos = 0;
  275. }
  276. }
  277. hdlc->cbin <<= 1;
  278. hdlc->bit_shift--;
  279. break;
  280. case HDLC_FAST_FLAG:
  281. if(hdlc->cbin==hdlc->ffvalue){
  282. hdlc->bit_shift = 0;
  283. break;
  284. } else {
  285. if(hdlc->cbin == 0xff){
  286. hdlc->state = HDLC_FAST_IDLE;
  287. hdlc->bit_shift=0;
  288. } else if(hdlc->ffbit_shift==8){
  289. hdlc->state = HDLC_GETFLAG_B7;
  290. break;
  291. } else {
  292. hdlc->shift_reg = fast_abort[hdlc->ffbit_shift-1];
  293. hdlc->hdlc_bits1 = hdlc->ffbit_shift-2;
  294. if(hdlc->hdlc_bits1<0)hdlc->hdlc_bits1 = 0;
  295. hdlc->data_bits = hdlc->ffbit_shift-1;
  296. hdlc->state = HDLC_GET_DATA;
  297. hdlc->data_received = 0;
  298. }
  299. }
  300. break;
  301. default:
  302. break;
  303. }
  304. }
  305. *count -= slen;
  306. return 0;
  307. }
  308. /*
  309. isdnhdlc_encode - encodes HDLC frames to a transparent bit stream.
  310. The bit stream starts with a beginning flag (01111110). After
  311. that each byte is added to the bit stream with bit stuffing added
  312. (0 after 5 1's).
  313. When the last byte has been removed from the source buffer, the
  314. CRC (2 bytes is added) and the frame terminates with the ending flag.
  315. For the dchannel, the idle character (all 1's) is also added at the end.
  316. If this function is called with empty source buffer (slen=0), flags or
  317. idle character will be generated.
  318. src - source buffer
  319. slen - source buffer length
  320. count - number of bytes removed (encoded) from source buffer
  321. dst _ destination buffer
  322. dsize - destination buffer size
  323. returns - number of encoded bytes in the destination buffer
  324. */
  325. int isdnhdlc_encode(struct isdnhdlc_vars *hdlc, const unsigned char *src,
  326. unsigned short slen, int *count,
  327. unsigned char *dst, int dsize)
  328. {
  329. static const unsigned char xfast_flag_value[] = {
  330. 0x7e,0x3f,0x9f,0xcf,0xe7,0xf3,0xf9,0xfc,0x7e
  331. };
  332. int len = 0;
  333. *count = slen;
  334. while (dsize > 0) {
  335. if(hdlc->bit_shift==0){
  336. if(slen && !hdlc->do_closing){
  337. hdlc->shift_reg = *src++;
  338. slen--;
  339. if (slen == 0)
  340. hdlc->do_closing = 1; /* closing sequence, CRC + flag(s) */
  341. hdlc->bit_shift = 8;
  342. } else {
  343. if(hdlc->state == HDLC_SEND_DATA){
  344. if(hdlc->data_received){
  345. hdlc->state = HDLC_SEND_CRC1;
  346. hdlc->crc ^= 0xffff;
  347. hdlc->bit_shift = 8;
  348. hdlc->shift_reg = hdlc->crc & 0xff;
  349. } else if(!hdlc->do_adapt56){
  350. hdlc->state = HDLC_SEND_FAST_FLAG;
  351. } else {
  352. hdlc->state = HDLC_SENDFLAG_B0;
  353. }
  354. }
  355. }
  356. }
  357. switch(hdlc->state){
  358. case STOPPED:
  359. while (dsize--)
  360. *dst++ = 0xff;
  361. return dsize;
  362. case HDLC_SEND_FAST_FLAG:
  363. hdlc->do_closing = 0;
  364. if(slen == 0){
  365. *dst++ = hdlc->ffvalue;
  366. len++;
  367. dsize--;
  368. break;
  369. }
  370. if(hdlc->bit_shift==8){
  371. hdlc->cbin = hdlc->ffvalue>>(8-hdlc->data_bits);
  372. hdlc->state = HDLC_SEND_DATA;
  373. hdlc->crc = 0xffff;
  374. hdlc->hdlc_bits1 = 0;
  375. hdlc->data_received = 1;
  376. }
  377. break;
  378. case HDLC_SENDFLAG_B0:
  379. hdlc->do_closing = 0;
  380. hdlc->cbin <<= 1;
  381. hdlc->data_bits++;
  382. hdlc->hdlc_bits1 = 0;
  383. hdlc->state = HDLC_SENDFLAG_B1A6;
  384. break;
  385. case HDLC_SENDFLAG_B1A6:
  386. hdlc->cbin <<= 1;
  387. hdlc->data_bits++;
  388. hdlc->cbin++;
  389. if(++hdlc->hdlc_bits1 == 6)
  390. hdlc->state = HDLC_SENDFLAG_B7;
  391. break;
  392. case HDLC_SENDFLAG_B7:
  393. hdlc->cbin <<= 1;
  394. hdlc->data_bits++;
  395. if(slen == 0){
  396. hdlc->state = HDLC_SENDFLAG_B0;
  397. break;
  398. }
  399. if(hdlc->bit_shift==8){
  400. hdlc->state = HDLC_SEND_DATA;
  401. hdlc->crc = 0xffff;
  402. hdlc->hdlc_bits1 = 0;
  403. hdlc->data_received = 1;
  404. }
  405. break;
  406. case HDLC_SEND_FIRST_FLAG:
  407. hdlc->data_received = 1;
  408. if(hdlc->data_bits==8){
  409. hdlc->state = HDLC_SEND_DATA;
  410. hdlc->crc = 0xffff;
  411. hdlc->hdlc_bits1 = 0;
  412. break;
  413. }
  414. hdlc->cbin <<= 1;
  415. hdlc->data_bits++;
  416. if(hdlc->shift_reg & 0x01)
  417. hdlc->cbin++;
  418. hdlc->shift_reg >>= 1;
  419. hdlc->bit_shift--;
  420. if(hdlc->bit_shift==0){
  421. hdlc->state = HDLC_SEND_DATA;
  422. hdlc->crc = 0xffff;
  423. hdlc->hdlc_bits1 = 0;
  424. }
  425. break;
  426. case HDLC_SEND_DATA:
  427. hdlc->cbin <<= 1;
  428. hdlc->data_bits++;
  429. if(hdlc->hdlc_bits1 == 5){
  430. hdlc->hdlc_bits1 = 0;
  431. break;
  432. }
  433. if(hdlc->bit_shift==8){
  434. hdlc->crc = crc_ccitt_byte(hdlc->crc, hdlc->shift_reg);
  435. }
  436. if(hdlc->shift_reg & 0x01){
  437. hdlc->hdlc_bits1++;
  438. hdlc->cbin++;
  439. hdlc->shift_reg >>= 1;
  440. hdlc->bit_shift--;
  441. } else {
  442. hdlc->hdlc_bits1 = 0;
  443. hdlc->shift_reg >>= 1;
  444. hdlc->bit_shift--;
  445. }
  446. break;
  447. case HDLC_SEND_CRC1:
  448. hdlc->cbin <<= 1;
  449. hdlc->data_bits++;
  450. if(hdlc->hdlc_bits1 == 5){
  451. hdlc->hdlc_bits1 = 0;
  452. break;
  453. }
  454. if(hdlc->shift_reg & 0x01){
  455. hdlc->hdlc_bits1++;
  456. hdlc->cbin++;
  457. hdlc->shift_reg >>= 1;
  458. hdlc->bit_shift--;
  459. } else {
  460. hdlc->hdlc_bits1 = 0;
  461. hdlc->shift_reg >>= 1;
  462. hdlc->bit_shift--;
  463. }
  464. if(hdlc->bit_shift==0){
  465. hdlc->shift_reg = (hdlc->crc >> 8);
  466. hdlc->state = HDLC_SEND_CRC2;
  467. hdlc->bit_shift = 8;
  468. }
  469. break;
  470. case HDLC_SEND_CRC2:
  471. hdlc->cbin <<= 1;
  472. hdlc->data_bits++;
  473. if(hdlc->hdlc_bits1 == 5){
  474. hdlc->hdlc_bits1 = 0;
  475. break;
  476. }
  477. if(hdlc->shift_reg & 0x01){
  478. hdlc->hdlc_bits1++;
  479. hdlc->cbin++;
  480. hdlc->shift_reg >>= 1;
  481. hdlc->bit_shift--;
  482. } else {
  483. hdlc->hdlc_bits1 = 0;
  484. hdlc->shift_reg >>= 1;
  485. hdlc->bit_shift--;
  486. }
  487. if(hdlc->bit_shift==0){
  488. hdlc->shift_reg = 0x7e;
  489. hdlc->state = HDLC_SEND_CLOSING_FLAG;
  490. hdlc->bit_shift = 8;
  491. }
  492. break;
  493. case HDLC_SEND_CLOSING_FLAG:
  494. hdlc->cbin <<= 1;
  495. hdlc->data_bits++;
  496. if(hdlc->hdlc_bits1 == 5){
  497. hdlc->hdlc_bits1 = 0;
  498. break;
  499. }
  500. if(hdlc->shift_reg & 0x01){
  501. hdlc->cbin++;
  502. }
  503. hdlc->shift_reg >>= 1;
  504. hdlc->bit_shift--;
  505. if(hdlc->bit_shift==0){
  506. hdlc->ffvalue = xfast_flag_value[hdlc->data_bits];
  507. if(hdlc->dchannel){
  508. hdlc->ffvalue = 0x7e;
  509. hdlc->state = HDLC_SEND_IDLE1;
  510. hdlc->bit_shift = 8-hdlc->data_bits;
  511. if(hdlc->bit_shift==0)
  512. hdlc->state = HDLC_SEND_FAST_IDLE;
  513. } else {
  514. if(!hdlc->do_adapt56){
  515. hdlc->state = HDLC_SEND_FAST_FLAG;
  516. hdlc->data_received = 0;
  517. } else {
  518. hdlc->state = HDLC_SENDFLAG_B0;
  519. hdlc->data_received = 0;
  520. }
  521. // Finished with this frame, send flags
  522. if (dsize > 1) dsize = 1;
  523. }
  524. }
  525. break;
  526. case HDLC_SEND_IDLE1:
  527. hdlc->do_closing = 0;
  528. hdlc->cbin <<= 1;
  529. hdlc->cbin++;
  530. hdlc->data_bits++;
  531. hdlc->bit_shift--;
  532. if(hdlc->bit_shift==0){
  533. hdlc->state = HDLC_SEND_FAST_IDLE;
  534. hdlc->bit_shift = 0;
  535. }
  536. break;
  537. case HDLC_SEND_FAST_IDLE:
  538. hdlc->do_closing = 0;
  539. hdlc->cbin = 0xff;
  540. hdlc->data_bits = 8;
  541. if(hdlc->bit_shift == 8){
  542. hdlc->cbin = 0x7e;
  543. hdlc->state = HDLC_SEND_FIRST_FLAG;
  544. } else {
  545. *dst++ = hdlc->cbin;
  546. hdlc->bit_shift = hdlc->data_bits = 0;
  547. len++;
  548. dsize = 0;
  549. }
  550. break;
  551. default:
  552. break;
  553. }
  554. if(hdlc->do_adapt56){
  555. if(hdlc->data_bits==7){
  556. hdlc->cbin <<= 1;
  557. hdlc->cbin++;
  558. hdlc->data_bits++;
  559. }
  560. }
  561. if(hdlc->data_bits==8){
  562. *dst++ = hdlc->cbin;
  563. hdlc->data_bits = 0;
  564. len++;
  565. dsize--;
  566. }
  567. }
  568. *count -= slen;
  569. return len;
  570. }
  571. EXPORT_SYMBOL(isdnhdlc_rcv_init);
  572. EXPORT_SYMBOL(isdnhdlc_decode);
  573. EXPORT_SYMBOL(isdnhdlc_out_init);
  574. EXPORT_SYMBOL(isdnhdlc_encode);