Removed trailing whitespace in chan_misdn files.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@183831 65c4cc65-6c06-0410-ace0-fbb531ad65f3
certified/1.8.6
Richard Mudgett 17 years ago
parent 85cbd1fd46
commit 9a6bf5f9c6

File diff suppressed because it is too large Load Diff

@ -13,5 +13,5 @@ all:
portinfo: portinfo.o portinfo: portinfo.o
$(CC) -o $@ $^ -lisdnnet -lmISDN -lpthread $(CC) -o $@ $^ -lisdnnet -lmISDN -lpthread
clean: clean:
rm -rf *.a *.o *.so portinfo *.i rm -rf *.a *.o *.so portinfo *.i

@ -11,7 +11,7 @@
* the GNU General Public License * the GNU General Public License
*/ */
/*! \file /*! \file
* \brief Interface to mISDN - Config * \brief Interface to mISDN - Config
* \author Christian Richter <crich@beronet.com> * \author Christian Richter <crich@beronet.com>
*/ */
@ -89,7 +89,7 @@ enum misdn_cfg_elements {
MISDN_CFG_FAXDETECT_TIMEOUT, /* int */ MISDN_CFG_FAXDETECT_TIMEOUT, /* int */
MISDN_CFG_PTP, /* int (bool) */ MISDN_CFG_PTP, /* int (bool) */
MISDN_CFG_LAST, MISDN_CFG_LAST,
/* general config items */ /* general config items */
MISDN_GEN_FIRST, MISDN_GEN_FIRST,
#ifndef MISDN_1_2 #ifndef MISDN_1_2
@ -116,14 +116,14 @@ enum misdn_cfg_method {
}; };
/* you must call misdn_cfg_init before any other function of this header file */ /* you must call misdn_cfg_init before any other function of this header file */
int misdn_cfg_init(int max_ports, int reload); int misdn_cfg_init(int max_ports, int reload);
void misdn_cfg_reload(void); void misdn_cfg_reload(void);
void misdn_cfg_destroy(void); void misdn_cfg_destroy(void);
void misdn_cfg_update_ptp( void ); void misdn_cfg_update_ptp( void );
/* if you requst a general config element, the port value is ignored. if the requested /* if you requst a general config element, the port value is ignored. if the requested
* value is not available, or the buffer is too small, the buffer will be nulled (in * value is not available, or the buffer is too small, the buffer will be nulled (in
* case of a char* only its first byte will be nulled). */ * case of a char* only its first byte will be nulled). */
void misdn_cfg_get(int port, enum misdn_cfg_elements elem, void* buf, int bufsize); void misdn_cfg_get(int port, enum misdn_cfg_elements elem, void* buf, int bufsize);

@ -15,7 +15,7 @@
* the GNU General Public License * the GNU General Public License
*/ */
/*! \file /*! \file
* \brief Interface to mISDN * \brief Interface to mISDN
* \author Christian Richter <crich@beronet.com> * \author Christian Richter <crich@beronet.com>
*/ */
@ -153,7 +153,7 @@ static void enc_ie_bearer(unsigned char **ntmode, msg_t *msg, int coding, int ca
p[4+(multi>=0)] = 0xa0 + user; p[4+(multi>=0)] = 0xa0 + user;
} }
static void dec_ie_bearer(unsigned char *p, Q931_info_t *qi, int *coding, int *capability, int *mode, int *rate, int *multi, int *user, static void dec_ie_bearer(unsigned char *p, Q931_info_t *qi, int *coding, int *capability, int *mode, int *rate, int *multi, int *user,
int *async, int *urate, int *stopbits, int *dbits, int *parity, int nt, struct misdn_bchannel *bc) int *async, int *urate, int *stopbits, int *dbits, int *parity, int nt, struct misdn_bchannel *bc)
{ {
int octet; int octet;
@ -168,13 +168,13 @@ static void dec_ie_bearer(unsigned char *p, Q931_info_t *qi, int *coding, int *c
*stopbits = -1; *stopbits = -1;
*dbits = -1; *dbits = -1;
*parity = -1; *parity = -1;
if (!nt) if (!nt)
{ {
p = NULL; p = NULL;
#ifdef LLC_SUPPORT #ifdef LLC_SUPPORT
if (qi->QI_ELEMENT(llc)) { if (qi->QI_ELEMENT(llc)) {
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(llc) + 1; p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->QI_ELEMENT(llc) + 1;
} }
#endif #endif
@ -189,7 +189,7 @@ static void dec_ie_bearer(unsigned char *p, Q931_info_t *qi, int *coding, int *c
printf("%s: ERROR: IE too short (%d).\n", __FUNCTION__, p[0]); printf("%s: ERROR: IE too short (%d).\n", __FUNCTION__, p[0]);
return; return;
} }
*coding = (p[1]&0x60) >> 5; *coding = (p[1]&0x60) >> 5;
*capability = p[1] & 0x1f; *capability = p[1] & 0x1f;
octet = 2; octet = 2;
@ -221,7 +221,7 @@ static void dec_ie_bearer(unsigned char *p, Q931_info_t *qi, int *coding, int *c
if (p[0] <= octet) if (p[0] <= octet)
goto done; goto done;
if (p[octet++] & 0x80) if (p[octet++] & 0x80)
goto l2; goto l2;
@ -231,7 +231,7 @@ static void dec_ie_bearer(unsigned char *p, Q931_info_t *qi, int *coding, int *c
if (p[0] <= octet) if (p[0] <= octet)
goto done; goto done;
if (p[octet++] & 0x80) if (p[octet++] & 0x80)
goto l2; goto l2;
@ -239,7 +239,7 @@ static void dec_ie_bearer(unsigned char *p, Q931_info_t *qi, int *coding, int *c
if (p[0] <= octet) if (p[0] <= octet)
goto done; goto done;
if (p[octet++] & 0x80) if (p[octet++] & 0x80)
goto l2; goto l2;
@ -247,20 +247,20 @@ static void dec_ie_bearer(unsigned char *p, Q931_info_t *qi, int *coding, int *c
if (p[0] <= octet) if (p[0] <= octet)
goto done; goto done;
if (!p[octet++] & 0x80) if (!p[octet++] & 0x80)
goto l2; goto l2;
/* Wheee. V.110 speed information */ /* Wheee. V.110 speed information */
*stopbits = (p[octet] & 0x60) >> 5; *stopbits = (p[octet] & 0x60) >> 5;
*dbits = (p[octet] & 0x18) >> 3; *dbits = (p[octet] & 0x18) >> 3;
*parity = p[octet] & 7; *parity = p[octet] & 7;
octet++; octet++;
} }
l2: /* Nobody seems to want the rest so we don't bother (yet) */ l2: /* Nobody seems to want the rest so we don't bother (yet) */
done: done:
if (MISDN_IE_DEBG) printf(" coding=%d capability=%d mode=%d rate=%d multi=%d user=%d async=%d urate=%d stopbits=%d dbits=%d parity=%d\n", *coding, *capability, *mode, *rate, *multi, *user, *async, *urate, *stopbits, *dbits, *parity); if (MISDN_IE_DEBG) printf(" coding=%d capability=%d mode=%d rate=%d multi=%d user=%d async=%d urate=%d stopbits=%d dbits=%d parity=%d\n", *coding, *capability, *mode, *rate, *multi, *user, *async, *urate, *stopbits, *dbits, *parity);
} }
@ -292,7 +292,7 @@ static void enc_ie_call_id(unsigned char **ntmode, msg_t *msg, char *callid, int
if (MISDN_IE_DEBG) printf(debug+(i*3), " %02x", callid[i]); if (MISDN_IE_DEBG) printf(debug+(i*3), " %02x", callid[i]);
i++; i++;
} }
if (MISDN_IE_DEBG) printf(" callid%s\n", debug); if (MISDN_IE_DEBG) printf(" callid%s\n", debug);
l = callid_len; l = callid_len;
@ -338,7 +338,7 @@ static void dec_ie_call_id(unsigned char *p, Q931_info_t *qi, char *callid, int
if (MISDN_IE_DEBG) printf(debug+(i*3), " %02x", callid[i]); if (MISDN_IE_DEBG) printf(debug+(i*3), " %02x", callid[i]);
i++; i++;
} }
if (MISDN_IE_DEBG) printf(" callid%s\n", debug); if (MISDN_IE_DEBG) printf(" callid%s\n", debug);
} }
#endif #endif
@ -501,7 +501,7 @@ static void dec_ie_calling_pn(unsigned char *p, Q931_info_t *qi, int *type, int
} else } else
{ {
strnncpy(number, (char *)p+2, p[0]-1, number_len); strnncpy(number, (char *)p+2, p[0]-1, number_len);
/* SPECIAL workarround for IBT software bug */ /* SPECIAL workarround for IBT software bug */
/* if (number[0]==0x80) */ /* if (number[0]==0x80) */
/* strcpy((char *)number, (char *)number+1); */ /* strcpy((char *)number, (char *)number+1); */
} }
@ -691,7 +691,7 @@ static void enc_ie_channel_id(unsigned char **ntmode, msg_t *msg, int exclusive,
int l; int l;
struct misdn_stack *stack=get_stack_by_bc(bc); struct misdn_stack *stack=get_stack_by_bc(bc);
int pri = stack->pri; int pri = stack->pri;
if (exclusive<0 || exclusive>1) if (exclusive<0 || exclusive>1)
{ {
printf("%s: ERROR: exclusive(%d) is out of range.\n", __FUNCTION__, exclusive); printf("%s: ERROR: exclusive(%d) is out of range.\n", __FUNCTION__, exclusive);
@ -707,7 +707,7 @@ static void enc_ie_channel_id(unsigned char **ntmode, msg_t *msg, int exclusive,
} }
/* if (MISDN_IE_DEBG) printf(" exclusive=%d channel=%d\n", exclusive, channel); */ /* if (MISDN_IE_DEBG) printf(" exclusive=%d channel=%d\n", exclusive, channel); */
if (!pri) if (!pri)
{ {
@ -1086,7 +1086,7 @@ static void dec_ie_progress(unsigned char *p, Q931_info_t *qi, int *coding, int
*location = -1; *location = -1;
//*progress = -1; //*progress = -1;
*progress = 0; *progress = 0;
if (!nt) if (!nt)
{ {
p = NULL; p = NULL;
@ -1350,7 +1350,7 @@ static void enc_ie_useruser(unsigned char **ntmode, msg_t *msg, int protocol, ch
if (MISDN_IE_DEBG) sprintf(debug+(i*3), " %02x", user[i]); if (MISDN_IE_DEBG) sprintf(debug+(i*3), " %02x", user[i]);
i++; i++;
} }
if (MISDN_IE_DEBG) printf(" protocol=%d user-user%s\n", protocol, debug); if (MISDN_IE_DEBG) printf(" protocol=%d user-user%s\n", protocol, debug);
l = user_len+1; l = user_len+1;
@ -1397,7 +1397,7 @@ static void dec_ie_useruser(unsigned char *p, Q931_info_t *qi, int *protocol, ch
i++; i++;
} }
debug[i*3] = '\0'; debug[i*3] = '\0';
if (MISDN_IE_DEBG) printf(" protocol=%d user-user%s\n", *protocol, debug); if (MISDN_IE_DEBG) printf(" protocol=%d user-user%s\n", *protocol, debug);
} }
#endif #endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,4 +1,4 @@
/*! \file /*! \file
* \brief Interface to mISDN - port info * \brief Interface to mISDN - port info
* \author Christian Richter <crich@beronet.com> * \author Christian Richter <crich@beronet.com>
*/ */

@ -1,6 +1,6 @@
/* /*
* Asterisk -- An open source telephony toolkit. * Asterisk -- An open source telephony toolkit.
* *
* Copyright (C) 2005, Christian Richter * Copyright (C) 2005, Christian Richter
* *
* Christian Richter <crich@beronet.com> * Christian Richter <crich@beronet.com>
@ -364,8 +364,8 @@ static const struct misdn_cfg_spec gen_spec[] = {
{ "crypt_keys", MISDN_GEN_CRYPT_KEYS, MISDN_CTYPE_STR, NO_DEFAULT, NONE, { "crypt_keys", MISDN_GEN_CRYPT_KEYS, MISDN_CTYPE_STR, NO_DEFAULT, NONE,
"Keys for cryption, you reference them in the dialplan\n" "Keys for cryption, you reference them in the dialplan\n"
"\tLater also in dynamic encr." }, "\tLater also in dynamic encr." },
{ "ntkeepcalls", MISDN_GEN_NTKEEPCALLS, MISDN_CTYPE_BOOL, "no", NONE, { "ntkeepcalls", MISDN_GEN_NTKEEPCALLS, MISDN_CTYPE_BOOL, "no", NONE,
"avoid dropping calls if the L2 goes down. some Nortel pbx\n" "avoid dropping calls if the L2 goes down. some Nortel pbx\n"
"do put down the L2/L1 for some milliseconds even if there\n" "do put down the L2/L1 for some milliseconds even if there\n"
"are running calls. with this option you can avoid dropping them" }, "are running calls. with this option you can avoid dropping them" },
{ "ntdebugflags", MISDN_GEN_NTDEBUGFLAGS, MISDN_CTYPE_INT, "0", NONE, { "ntdebugflags", MISDN_GEN_NTDEBUGFLAGS, MISDN_CTYPE_INT, "0", NONE,
@ -386,7 +386,7 @@ static int *ptp;
/* maps enum config elements to array positions */ /* maps enum config elements to array positions */
static int *map; static int *map;
static ast_mutex_t config_mutex; static ast_mutex_t config_mutex;
#define CLI_ERROR(name, value, section) ({ \ #define CLI_ERROR(name, value, section) ({ \
ast_log(LOG_WARNING, "misdn.conf: \"%s=%s\" (section: %s) invalid or out of range. " \ ast_log(LOG_WARNING, "misdn.conf: \"%s=%s\" (section: %s) invalid or out of range. " \
@ -475,7 +475,7 @@ static void _free_port_cfg (void)
int i, j; int i, j;
int gn = map[MISDN_CFG_GROUPNAME]; int gn = map[MISDN_CFG_GROUPNAME];
union misdn_cfg_pt* free_list[max_ports + 2]; union misdn_cfg_pt* free_list[max_ports + 2];
memset(free_list, 0, sizeof(free_list)); memset(free_list, 0, sizeof(free_list));
free_list[0] = port_cfg[0]; free_list[0] = port_cfg[0];
for (i = 1; i <= max_ports; ++i) { for (i = 1; i <= max_ports; ++i) {
@ -507,7 +507,7 @@ static void _free_general_cfg (void)
{ {
int i; int i;
for (i = 0; i < NUM_GEN_ELEMENTS; i++) for (i = 0; i < NUM_GEN_ELEMENTS; i++)
if (general_cfg[i].any) if (general_cfg[i].any)
ast_free(general_cfg[i].any); ast_free(general_cfg[i].any);
} }
@ -579,11 +579,11 @@ enum misdn_cfg_elements misdn_cfg_get_elem(char *name)
pos = get_cfg_position(name, PORT_CFG); pos = get_cfg_position(name, PORT_CFG);
if (pos >= 0) if (pos >= 0)
return port_spec[pos].elem; return port_spec[pos].elem;
pos = get_cfg_position(name, GEN_CFG); pos = get_cfg_position(name, GEN_CFG);
if (pos >= 0) if (pos >= 0)
return gen_spec[pos].elem; return gen_spec[pos].elem;
return MISDN_CFG_FIRST; return MISDN_CFG_FIRST;
} }
@ -597,7 +597,7 @@ void misdn_cfg_get_name(enum misdn_cfg_elements elem, void *buf, int bufsize)
memset(buf, 0, 1); memset(buf, 0, 1);
return; return;
} }
/* here comes a hack to replace the (not existing) "name" element with the "ports" element */ /* here comes a hack to replace the (not existing) "name" element with the "ports" element */
if (elem == MISDN_CFG_GROUPNAME) { if (elem == MISDN_CFG_GROUPNAME) {
if (!snprintf(buf, bufsize, "ports")) if (!snprintf(buf, bufsize, "ports"))
@ -630,7 +630,7 @@ void misdn_cfg_get_desc (enum misdn_cfg_elements elem, void *buf, int bufsize, v
spec = (struct misdn_cfg_spec *)port_spec; spec = (struct misdn_cfg_spec *)port_spec;
else if ((elem > MISDN_GEN_FIRST) && (elem < MISDN_GEN_LAST)) else if ((elem > MISDN_GEN_FIRST) && (elem < MISDN_GEN_LAST))
spec = (struct misdn_cfg_spec *)gen_spec; spec = (struct misdn_cfg_spec *)gen_spec;
if (!spec || !spec[place].desc) if (!spec || !spec[place].desc)
memset(buf, 0, 1); memset(buf, 0, 1);
else { else {
@ -659,7 +659,7 @@ int misdn_cfg_is_msn_valid (int port, char* msn)
iter = port_cfg[port][map[MISDN_CFG_MSNS]].ml; iter = port_cfg[port][map[MISDN_CFG_MSNS]].ml;
else else
iter = port_cfg[0][map[MISDN_CFG_MSNS]].ml; iter = port_cfg[0][map[MISDN_CFG_MSNS]].ml;
for (; iter; iter = iter->next) for (; iter; iter = iter->next)
if (*(iter->msn) == '*' || ast_extension_match(iter->msn, msn)) { if (*(iter->msn) == '*' || ast_extension_match(iter->msn, msn)) {
re = 1; re = 1;
break; break;
@ -688,7 +688,7 @@ int misdn_cfg_is_group_method (char *group, enum misdn_cfg_method meth)
for (i = 1; i <= max_ports; i++) { for (i = 1; i <= max_ports; i++) {
if (port_cfg[i] && port_cfg[i][map[MISDN_CFG_GROUPNAME]].str) { if (port_cfg[i] && port_cfg[i][map[MISDN_CFG_GROUPNAME]].str) {
if (!strcasecmp(port_cfg[i][map[MISDN_CFG_GROUPNAME]].str, group)) if (!strcasecmp(port_cfg[i][map[MISDN_CFG_GROUPNAME]].str, group))
method = (port_cfg[i][map[MISDN_CFG_METHOD]].str ? method = (port_cfg[i][map[MISDN_CFG_METHOD]].str ?
port_cfg[i][map[MISDN_CFG_METHOD]].str : port_cfg[0][map[MISDN_CFG_METHOD]].str); port_cfg[i][map[MISDN_CFG_METHOD]].str : port_cfg[0][map[MISDN_CFG_METHOD]].str);
} }
} }
@ -708,7 +708,7 @@ int misdn_cfg_is_group_method (char *group, enum misdn_cfg_method meth)
return re; return re;
} }
/*! /*!
* \brief Generate a comma separated list of all active ports * \brief Generate a comma separated list of all active ports
*/ */
void misdn_cfg_get_ports_string (char *ports) void misdn_cfg_get_ports_string (char *ports)
@ -776,10 +776,10 @@ void misdn_cfg_get_config_string (int port, enum misdn_cfg_elements elem, char*
break; break;
case MISDN_CTYPE_ASTGROUP: case MISDN_CTYPE_ASTGROUP:
if (port_cfg[port][place].grp) if (port_cfg[port][place].grp)
snprintf(buf, bufsize, " -> %s: %s", port_spec[place].name, snprintf(buf, bufsize, " -> %s: %s", port_spec[place].name,
ast_print_group(tempbuf, sizeof(tempbuf), *port_cfg[port][place].grp)); ast_print_group(tempbuf, sizeof(tempbuf), *port_cfg[port][place].grp));
else if (port_cfg[0][place].grp) else if (port_cfg[0][place].grp)
snprintf(buf, bufsize, " -> %s: %s", port_spec[place].name, snprintf(buf, bufsize, " -> %s: %s", port_spec[place].name,
ast_print_group(tempbuf, sizeof(tempbuf), *port_cfg[0][place].grp)); ast_print_group(tempbuf, sizeof(tempbuf), *port_cfg[0][place].grp));
else else
snprintf(buf, bufsize, " -> %s:", port_spec[place].name); snprintf(buf, bufsize, " -> %s:", port_spec[place].name);
@ -844,7 +844,7 @@ int misdn_cfg_get_next_port (int port)
{ {
int p = -1; int p = -1;
int gn = map[MISDN_CFG_GROUPNAME]; int gn = map[MISDN_CFG_GROUPNAME];
misdn_cfg_lock(); misdn_cfg_lock();
for (port++; port <= max_ports; port++) { for (port++; port <= max_ports; port++) {
if (port_cfg[port][gn].str) { if (port_cfg[port][gn].str) {
@ -936,7 +936,7 @@ static void _build_general_config (struct ast_variable *v)
for (; v; v = v->next) { for (; v; v = v->next) {
if (!ast_jb_read_conf(&global_jbconf, v->name, v->value)) if (!ast_jb_read_conf(&global_jbconf, v->name, v->value))
continue; continue;
if (((pos = get_cfg_position(v->name, GEN_CFG)) < 0) || if (((pos = get_cfg_position(v->name, GEN_CFG)) < 0) ||
(_parse(&general_cfg[pos], v->value, gen_spec[pos].type, gen_spec[pos].boolint_def) < 0)) (_parse(&general_cfg[pos], v->value, gen_spec[pos].type, gen_spec[pos].boolint_def) < 0))
CLI_ERROR(v->name, v->value, "general"); CLI_ERROR(v->name, v->value, "general");
} }
@ -958,7 +958,7 @@ static void _build_port_config (struct ast_variable *v, char *cat)
cfg_for_ports[0] = 1; cfg_for_ports[0] = 1;
} }
if (((pos = get_cfg_position("name", PORT_CFG)) < 0) || if (((pos = get_cfg_position("name", PORT_CFG)) < 0) ||
(_parse(&cfg_tmp[pos], cat, port_spec[pos].type, port_spec[pos].boolint_def) < 0)) { (_parse(&cfg_tmp[pos], cat, port_spec[pos].type, port_spec[pos].boolint_def) < 0)) {
CLI_ERROR(v->name, v->value, cat); CLI_ERROR(v->name, v->value, cat);
return; return;
@ -969,7 +969,7 @@ static void _build_port_config (struct ast_variable *v, char *cat)
char *token, *tmp = ast_strdupa(v->value); char *token, *tmp = ast_strdupa(v->value);
char ptpbuf[BUFFERSIZE] = ""; char ptpbuf[BUFFERSIZE] = "";
int start, end; int start, end;
for (token = strsep(&tmp, ","); token; token = strsep(&tmp, ","), *ptpbuf = 0) { for (token = strsep(&tmp, ","); token; token = strsep(&tmp, ","), *ptpbuf = 0) {
if (!*token) if (!*token)
continue; continue;
if (sscanf(token, "%d-%d%s", &start, &end, ptpbuf) >= 2) { if (sscanf(token, "%d-%d%s", &start, &end, ptpbuf) >= 2) {
@ -992,7 +992,7 @@ static void _build_port_config (struct ast_variable *v, char *cat)
} }
} }
} else { } else {
if (((pos = get_cfg_position(v->name, PORT_CFG)) < 0) || if (((pos = get_cfg_position(v->name, PORT_CFG)) < 0) ||
(_parse(&cfg_tmp[pos], v->value, port_spec[pos].type, port_spec[pos].boolint_def) < 0)) (_parse(&cfg_tmp[pos], v->value, port_spec[pos].type, port_spec[pos].boolint_def) < 0))
CLI_ERROR(v->name, v->value, cat); CLI_ERROR(v->name, v->value, cat);
} }

Loading…
Cancel
Save