X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=bchannel.c;h=5793795fba5951a1f1f0c81a2d45bdba34b4b0f2;hp=b6107b689bc919367ff5b569465f1cbe24079036;hb=13f107bc240d351b1eb1915eff140efe1b4a95bb;hpb=8fb861ef9ece9f4bd68ef79a77625ec23c27aef1 diff --git a/bchannel.c b/bchannel.c index b6107b6..5793795 100644 --- a/bchannel.c +++ b/bchannel.c @@ -23,11 +23,11 @@ #include #include #include -#include +#include -#define AF_COMPATIBILITY_FUNC 1 -#define MISDN_OLD_AF_COMPATIBILITY 1 -#include +#include +int __af_isdn = MISDN_AF_ISDN; +#include #define HAVE_ATTRIBUTE_always_inline 1 #define HAVE_ARPA_INET_H 1 @@ -74,8 +74,6 @@ static void bchannel_send_queue(struct bchannel *bchannel); int bchannel_initialize(void) { - init_af_isdn(); - return 0; } @@ -420,26 +418,29 @@ void bchannel_transmit(struct bchannel *bchannel, unsigned char *data, int len) return; if (len > 1024 || len < 1) return; - switch(bchannel->b_mode) { - case 0: - for (i = 0; i < len; i++) - *p++ = flip_bits[*data++]; - frm->prim = DL_DATA_REQ; - break; - case 1: - for (i = 0; i < len; i++) - *p++ = flip_bits[*data++]; - frm->prim = PH_DATA_REQ; - break; - case 2: - memcpy(p, data, len); - frm->prim = DL_DATA_REQ; - break; - case 3: - memcpy(p, data, len); - frm->prim = PH_DATA_REQ; - break; - } + if (data) { + switch(bchannel->b_mode) { + case 0: + for (i = 0; i < len; i++) + *p++ = flip_bits[*data++]; + frm->prim = DL_DATA_REQ; + break; + case 1: + for (i = 0; i < len; i++) + *p++ = flip_bits[*data++]; + frm->prim = PH_DATA_REQ; + break; + case 2: + memcpy(p, data, len); + frm->prim = DL_DATA_REQ; + break; + case 3: + memcpy(p, data, len); + frm->prim = PH_DATA_REQ; + break; + } + } else + memset(p, flip_bits[(options.law=='a')?0x2a:0xff], len); frm->id = 0; #ifdef SEAMLESS_TEST unsigned char test_tone[8] = {0x2a, 0x24, 0xb4, 0x24, 0x2a, 0x25, 0xb5, 0x25};