Mon May 14 04:48:57 2007

Asterisk developer's documentation


isdn_lib_intern.h File Reference

#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"

Include dependency graph for isdn_lib_intern.h:

This graph shows which files directly or indirectly include this file:

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)
misdn_stackget_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 Documentation

#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.off

Definition at line 19 of file isdn_lib_intern.h.


Function Documentation

msg_t* create_l3msg ( int  prim,
int  mt,
int  dinfo,
int  size,
int  nt 
)

Definition at line 330 of file isdn_lib.c.

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(), and handle_event_nt().

00331 {
00332    int i = 0;
00333    msg_t *dmsg;
00334    Q931_info_t *qi;
00335    iframe_t *frm;
00336   
00337    if (!ntmode)
00338       size = sizeof(Q931_info_t)+2;
00339   
00340    while(i < 10) {
00341       if (ntmode) {
00342          dmsg = prep_l3data_msg(prim, dinfo, size, 256, NULL);
00343          if (dmsg) {
00344             return(dmsg);
00345          }
00346       } else {
00347          dmsg = alloc_msg(size+256+mISDN_HEADER_LEN+DEFAULT_HEADROOM);
00348          if (dmsg)
00349          {
00350             memset(msg_put(dmsg,size+mISDN_HEADER_LEN), 0, size+mISDN_HEADER_LEN);
00351             frm = (iframe_t *)dmsg->data;
00352             frm->prim = prim;
00353             frm->dinfo = dinfo;
00354             qi = (Q931_info_t *)(dmsg->data + mISDN_HEADER_LEN);
00355             qi->type = mt;
00356             return(dmsg);
00357          }
00358       }
00359     
00360       if (!i) printf("cannot allocate memory, trying again...\n");
00361       i++;
00362       usleep(300000);
00363    }
00364    printf("cannot allocate memory, system overloaded.\n");
00365    exit(-1);
00366 }

struct misdn_stack* get_stack_by_bc ( struct misdn_bchannel bc  ) 

Definition at line 104 of file isdn_lib.c.

References misdn_stack::b_num, misdn_stack::bc, get_misdn_stack(), misdn_stack::next, misdn_stack::port, and misdn_bchannel::port.

Referenced by clean_up_bc(), create_process(), dec_ie_channel_id(), enc_ie_channel_id(), handle_bchan(), handle_event(), manager_bchannel_activate(), manager_bchannel_deactivate(), manager_clean_bc(), manager_ec_disable(), manager_ec_enable(), manager_find_bc_holded(), misdn_lib_log_ies(), misdn_lib_release(), misdn_lib_send_event(), misdn_lib_tx2misdn_frm(), parse_release_complete(), parse_restart(), send_msg(), and setup_bc().

00105 {
00106    struct misdn_stack *stack=get_misdn_stack();
00107 
00108    if (!bc) return NULL;
00109    
00110    for ( ; stack; stack=stack->next) {
00111       int i;
00112       for (i=0; i <=stack->b_num; i++) {
00113          if ( bc->port == stack->port) return stack;
00114       }
00115    }
00116 
00117    return NULL;
00118 }

char* isdn_get_info ( struct isdn_msg  msgs[],
enum event_e  event,
int  nt 
)

Definition at line 1295 of file isdn_msg_parser.c.

References EVENT_BCHAN_ACTIVATED, EVENT_BCHAN_ACTIVATED_INFO, EVENT_BCHAN_DATA, EVENT_BCHAN_DATA_INFO, EVENT_BCHAN_ERROR, EVENT_BCHAN_ERROR_INFO, EVENT_CLEAN_INFO, EVENT_CLEANUP, EVENT_DTMF_TONE, EVENT_DTMF_TONE_INFO, EVENT_NEW_BC, EVENT_NEW_BC_INFO, EVENT_NEW_CHANNEL, EVENT_NEW_CHANNEL_INFO, EVENT_NEW_L3ID, EVENT_NEW_L3ID_INFO, EVENT_PORT_ALARM, EVENT_PORT_ALARM_INFO, EVENT_TONE_GENERATE, EVENT_TONE_GENERATE_INFO, isdn_msg::info, and isdn_msg_get_index_by_event().

Referenced by handle_event_nt(), handle_frm(), handle_l1(), manager_isdn_get_info(), and misdn_lib_send_event().

01296 {
01297    int i=isdn_msg_get_index_by_event(msgs, event, nt);
01298    
01299    if(i>=0) return msgs[i].info;
01300    
01301    if (event == EVENT_CLEANUP) return EVENT_CLEAN_INFO;
01302    if (event == EVENT_DTMF_TONE) return EVENT_DTMF_TONE_INFO;
01303    if (event == EVENT_NEW_L3ID) return EVENT_NEW_L3ID_INFO;
01304    if (event == EVENT_NEW_BC) return EVENT_NEW_BC_INFO;
01305    if (event == EVENT_NEW_CHANNEL) return EVENT_NEW_CHANNEL_INFO;
01306    if (event == EVENT_BCHAN_DATA) return EVENT_BCHAN_DATA_INFO;
01307    if (event == EVENT_BCHAN_ACTIVATED) return EVENT_BCHAN_ACTIVATED_INFO;
01308    if (event == EVENT_TONE_GENERATE) return EVENT_TONE_GENERATE_INFO;
01309    if (event == EVENT_PORT_ALARM) return EVENT_PORT_ALARM_INFO;
01310    if (event == EVENT_BCHAN_ERROR) return EVENT_BCHAN_ERROR_INFO;
01311    
01312    return NULL;
01313 }

msg_t* isdn_msg_build_event ( struct isdn_msg  msgs[],
struct misdn_bchannel bc,
enum event_e  event,
int  nt 
)

Definition at line 1324 of file isdn_msg_parser.c.

References isdn_msg_get_index_by_event(), and isdn_msg::msg_builder.

Referenced by misdn_lib_send_event().

01325 {
01326    int i=isdn_msg_get_index_by_event(msgs, event, nt);
01327    if(i<0) return NULL;
01328   
01329    return  msgs[i].msg_builder(msgs, bc, nt);
01330 }

enum event_e isdn_msg_get_event ( struct isdn_msg  msgs[],
msg_t *  frm,
int  nt 
)

Definition at line 1269 of file isdn_msg_parser.c.

References isdn_msg::event, EVENT_UNKNOWN, and isdn_msg_get_index().

Referenced by handle_event_nt(), and handle_frm().

01270 {
01271    int i=isdn_msg_get_index(msgs, msg, nt);
01272    if(i>=0) return msgs[i].event;
01273    return EVENT_UNKNOWN;
01274 }

int isdn_msg_get_index ( struct isdn_msg  msgs[],
msg_t *  msg,
int  nt 
)

INTERFACE FCTS

Definition at line 1237 of file isdn_msg_parser.c.

References isdn_msg::misdn_msg, and msgs_max.

Referenced by isdn_msg_get_event(), isdn_msg_get_info(), and isdn_msg_parse_event().

01238 {
01239    int i;
01240 
01241    if (nt){
01242       mISDNuser_head_t *hh = (mISDNuser_head_t*)msg->data;
01243       
01244       for (i=0; i< msgs_max -1; i++) {
01245          if ( (hh->prim&COMMAND_MASK)==(msgs[i].misdn_msg&COMMAND_MASK)) return i;
01246       }
01247       
01248    } else {
01249       iframe_t *frm = (iframe_t*)msg->data;
01250     
01251       for (i=0; i< msgs_max -1; i++) 
01252          if ( (frm->prim&COMMAND_MASK)==(msgs[i].misdn_msg&COMMAND_MASK)) return i;
01253    }
01254 
01255    return -1;
01256 }

int isdn_msg_get_index_by_event ( struct isdn_msg  msgs[],
enum event_e  event,
int  nt 
)

Definition at line 1258 of file isdn_msg_parser.c.

References cb_log, and msgs_max.

Referenced by isdn_get_info(), and isdn_msg_build_event().

01259 {
01260    int i;
01261    for (i=0; i< msgs_max; i++) 
01262       if ( event == msgs[i].event) return i;
01263 
01264    cb_log(10,0, "get_index: event not found!\n");
01265    
01266    return -1;
01267 }

char* isdn_msg_get_info ( struct isdn_msg  msgs[],
msg_t *  msg,
int  nt 
)

Definition at line 1276 of file isdn_msg_parser.c.

References isdn_msg::info, and isdn_msg_get_index().

01277 {
01278    int i=isdn_msg_get_index(msgs, msg, nt);
01279    if(i>=0) return msgs[i].info;
01280    return NULL;
01281 }

int isdn_msg_parse_event ( struct isdn_msg  msgs[],
msg_t *  frm,
struct misdn_bchannel bc,
int  nt 
)

Definition at line 1315 of file isdn_msg_parser.c.

References isdn_msg_get_index(), and isdn_msg::msg_parser.

Referenced by handle_event_nt(), and handle_frm().

01316 {
01317    int i=isdn_msg_get_index(msgs, msg, nt);
01318    if(i<0) return -1;
01319 
01320    msgs[i].msg_parser(msgs, msg, bc, nt);
01321    return 0;
01322 }


Variable Documentation

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.


Generated on Mon May 14 04:48:58 2007 for Asterisk - the Open Source PBX by  doxygen 1.5.1