#include <mISDNuser/mISDNlib.h>
#include <mISDNuser/isdn_net.h>
#include <mISDNuser/l3dss1.h>
#include <mISDNuser/net_l3.h>
#include <pthread.h>
#include "isdn_lib.h"
Go to the source code of this file.
Data Structures | |
struct | isdn_msg |
struct | misdn_stack |
struct | send_lock |
Defines | |
#define | mISDNUSER_HEAD_SIZE (sizeof(mISDNuser_head_t)) |
#define | QI_ELEMENT(a) a.off |
Functions | |
msg_t * | create_l3msg (int prim, int mt, int dinfo, int size, int nt) |
struct misdn_stack * | get_stack_by_bc (struct misdn_bchannel *bc) |
char * | isdn_get_info (struct isdn_msg msgs[], enum event_e event, int nt) |
msg_t * | isdn_msg_build_event (struct isdn_msg msgs[], struct misdn_bchannel *bc, enum event_e event, int nt) |
enum event_e | isdn_msg_get_event (struct isdn_msg msgs[], msg_t *frm, int nt) |
int | isdn_msg_get_index (struct isdn_msg msgs[], msg_t *frm, int nt) |
int | isdn_msg_get_index_by_event (struct isdn_msg msgs[], enum event_e event, int nt) |
char * | isdn_msg_get_info (struct isdn_msg msgs[], msg_t *msg, int nt) |
int | isdn_msg_parse_event (struct isdn_msg msgs[], msg_t *frm, struct misdn_bchannel *bc, int nt) |
Variables | |
ibuffer_t * | astbuf |
ibuffer_t * | misdnbuf |
#define mISDNUSER_HEAD_SIZE (sizeof(mISDNuser_head_t)) |
Definition at line 24 of file isdn_lib_intern.h.
Referenced by build_alerting(), build_connect(), build_connect_acknowledge(), build_disconnect(), build_facility(), build_hold(), build_hold_acknowledge(), build_hold_reject(), build_information(), build_notify(), build_proceeding(), build_progress(), build_release(), build_release_complete(), build_restart(), build_resume(), build_resume_acknowledge(), build_resume_reject(), build_retrieve(), build_retrieve_acknowledge(), build_retrieve_reject(), build_setup(), build_setup_acknowledge(), build_status(), build_status_enquiry(), build_suspend(), build_suspend_acknowledge(), build_suspend_reject(), build_timeout(), build_user_information(), handle_event_nt(), parse_alerting(), parse_connect(), parse_disconnect(), parse_facility(), parse_information(), parse_proceeding(), parse_progress(), parse_release(), parse_release_complete(), parse_restart(), parse_setup(), parse_setup_acknowledge(), and parse_status().
#define QI_ELEMENT | ( | a | ) | a.off |
Definition at line 19 of file isdn_lib_intern.h.
msg_t* create_l3msg | ( | int | prim, | |
int | mt, | |||
int | dinfo, | |||
int | size, | |||
int | nt | |||
) |
Definition at line 341 of file isdn_lib.c.
00342 { 00343 int i = 0; 00344 msg_t *dmsg; 00345 Q931_info_t *qi; 00346 iframe_t *frm; 00347 00348 if (!ntmode) 00349 size = sizeof(Q931_info_t)+2; 00350 00351 while(i < 10) { 00352 if (ntmode) { 00353 dmsg = prep_l3data_msg(prim, dinfo, size, 256, NULL); 00354 if (dmsg) { 00355 return(dmsg); 00356 } 00357 } else { 00358 dmsg = alloc_msg(size+256+mISDN_HEADER_LEN+DEFAULT_HEADROOM); 00359 if (dmsg) 00360 { 00361 memset(msg_put(dmsg,size+mISDN_HEADER_LEN), 0, size+mISDN_HEADER_LEN); 00362 frm = (iframe_t *)dmsg->data; 00363 frm->prim = prim; 00364 frm->dinfo = dinfo; 00365 qi = (Q931_info_t *)(dmsg->data + mISDN_HEADER_LEN); 00366 qi->type = mt; 00367 return(dmsg); 00368 } 00369 } 00370 00371 if (!i) printf("cannot allocate memory, trying again...\n"); 00372 i++; 00373 usleep(300000); 00374 } 00375 printf("cannot allocate memory, system overloaded.\n"); 00376 exit(-1); 00377 }
struct misdn_stack* get_stack_by_bc | ( | struct misdn_bchannel * | bc | ) | [read] |
Definition at line 115 of file isdn_lib.c.
References misdn_stack::b_num, get_misdn_stack(), misdn_stack::next, misdn_stack::port, and misdn_bchannel::port.
00116 { 00117 struct misdn_stack *stack=get_misdn_stack(); 00118 00119 if (!bc) return NULL; 00120 00121 for ( ; stack; stack=stack->next) { 00122 int i; 00123 for (i=0; i <=stack->b_num; i++) { 00124 if ( bc->port == stack->port) return stack; 00125 } 00126 } 00127 00128 return NULL; 00129 }
Definition at line 1290 of file isdn_msg_parser.c.
Referenced by handle_event_nt(), handle_frm(), handle_l1(), manager_isdn_get_info(), and misdn_lib_send_event().
01291 { 01292 int i=isdn_msg_get_index_by_event(msgs, event, nt); 01293 01294 if(i>=0) return msgs[i].info; 01295 01296 if (event == EVENT_CLEANUP) return EVENT_CLEAN_INFO; 01297 if (event == EVENT_DTMF_TONE) return EVENT_DTMF_TONE_INFO; 01298 if (event == EVENT_NEW_L3ID) return EVENT_NEW_L3ID_INFO; 01299 if (event == EVENT_NEW_BC) return EVENT_NEW_BC_INFO; 01300 if (event == EVENT_NEW_CHANNEL) return EVENT_NEW_CHANNEL_INFO; 01301 if (event == EVENT_BCHAN_DATA) return EVENT_BCHAN_DATA_INFO; 01302 if (event == EVENT_BCHAN_ACTIVATED) return EVENT_BCHAN_ACTIVATED_INFO; 01303 if (event == EVENT_TONE_GENERATE) return EVENT_TONE_GENERATE_INFO; 01304 if (event == EVENT_PORT_ALARM) return EVENT_PORT_ALARM_INFO; 01305 if (event == EVENT_BCHAN_ERROR) return EVENT_BCHAN_ERROR_INFO; 01306 01307 return NULL; 01308 }
msg_t* isdn_msg_build_event | ( | struct isdn_msg | msgs[], | |
struct misdn_bchannel * | bc, | |||
enum event_e | event, | |||
int | nt | |||
) |
Definition at line 1319 of file isdn_msg_parser.c.
Referenced by misdn_lib_send_event().
01320 { 01321 int i=isdn_msg_get_index_by_event(msgs, event, nt); 01322 if(i<0) return NULL; 01323 01324 return msgs[i].msg_builder(msgs, bc, nt); 01325 }
Definition at line 1264 of file isdn_msg_parser.c.
Referenced by handle_event_nt(), and handle_frm().
01265 { 01266 int i=isdn_msg_get_index(msgs, msg, nt); 01267 if(i>=0) return msgs[i].event; 01268 return EVENT_UNKNOWN; 01269 }
int isdn_msg_get_index | ( | struct isdn_msg | msgs[], | |
msg_t * | msg, | |||
int | nt | |||
) |
INTERFACE FCTS
Definition at line 1232 of file isdn_msg_parser.c.
Referenced by isdn_msg_get_event(), isdn_msg_get_info(), and isdn_msg_parse_event().
01233 { 01234 int i; 01235 01236 if (nt){ 01237 mISDNuser_head_t *hh = (mISDNuser_head_t*)msg->data; 01238 01239 for (i=0; i< msgs_max -1; i++) { 01240 if ( (hh->prim&COMMAND_MASK)==(msgs[i].misdn_msg&COMMAND_MASK)) return i; 01241 } 01242 01243 } else { 01244 iframe_t *frm = (iframe_t*)msg->data; 01245 01246 for (i=0; i< msgs_max -1; i++) 01247 if ( (frm->prim&COMMAND_MASK)==(msgs[i].misdn_msg&COMMAND_MASK)) return i; 01248 } 01249 01250 return -1; 01251 }
Definition at line 1253 of file isdn_msg_parser.c.
Referenced by isdn_get_info(), and isdn_msg_build_event().
01254 { 01255 int i; 01256 for (i=0; i< msgs_max; i++) 01257 if ( event == msgs[i].event) return i; 01258 01259 cb_log(10,0, "get_index: event not found!\n"); 01260 01261 return -1; 01262 }
char* isdn_msg_get_info | ( | struct isdn_msg | msgs[], | |
msg_t * | msg, | |||
int | nt | |||
) |
Definition at line 1271 of file isdn_msg_parser.c.
01272 { 01273 int i=isdn_msg_get_index(msgs, msg, nt); 01274 if(i>=0) return msgs[i].info; 01275 return NULL; 01276 }
int isdn_msg_parse_event | ( | struct isdn_msg | msgs[], | |
msg_t * | frm, | |||
struct misdn_bchannel * | bc, | |||
int | nt | |||
) |
Definition at line 1310 of file isdn_msg_parser.c.
Referenced by handle_event_nt(), and handle_frm().
01311 { 01312 int i=isdn_msg_get_index(msgs, msg, nt); 01313 if(i<0) return -1; 01314 01315 msgs[i].msg_parser(msgs, msg, bc, nt); 01316 return 0; 01317 }
ibuffer_t* astbuf |
Definition at line 29 of file isdn_lib_intern.h.
ibuffer_t* misdnbuf |
Definition at line 30 of file isdn_lib_intern.h.