Wed Oct 28 11:52:46 2009

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)
struct 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))

#define QI_ELEMENT (  )     a.off

Definition at line 21 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 365 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().

00366 {
00367    int i = 0;
00368    msg_t *dmsg;
00369    Q931_info_t *qi;
00370    iframe_t *frm;
00371   
00372    if (!ntmode)
00373       size = sizeof(Q931_info_t)+2;
00374   
00375    while(i < 10) {
00376       if (ntmode) {
00377          dmsg = prep_l3data_msg(prim, dinfo, size, 256, NULL);
00378          if (dmsg) {
00379             return(dmsg);
00380          }
00381       } else {
00382          dmsg = alloc_msg(size+256+mISDN_HEADER_LEN+DEFAULT_HEADROOM);
00383          if (dmsg)
00384          {
00385             memset(msg_put(dmsg,size+mISDN_HEADER_LEN), 0, size+mISDN_HEADER_LEN);
00386             frm = (iframe_t *)dmsg->data;
00387             frm->prim = prim;
00388             frm->dinfo = dinfo;
00389             qi = (Q931_info_t *)(dmsg->data + mISDN_HEADER_LEN);
00390             qi->type = mt;
00391             return(dmsg);
00392          }
00393       }
00394     
00395       if (!i) printf("cannot allocate memory, trying again...\n");
00396       i++;
00397       usleep(300000);
00398    }
00399    printf("cannot allocate memory, system overloaded.\n");
00400    exit(-1);
00401 }

struct misdn_stack* get_stack_by_bc ( struct misdn_bchannel bc  )  [read]

Definition at line 146 of file isdn_lib.c.

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

00147 {
00148    struct misdn_stack *stack = get_misdn_stack();
00149 
00150    if (!bc)
00151       return NULL;
00152    
00153    for ( ; stack; stack = stack->next) {
00154       if (bc->port == stack->port)
00155          return stack;
00156    }
00157 
00158    return NULL;
00159 }

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 
)

Definition at line 1347 of file isdn_msg_parser.c.

References isdn_msg_get_index_by_event(), and isdn_msg::msg_builder.

Referenced by misdn_lib_send_event().

01348 {
01349    int i=isdn_msg_get_index_by_event(msgs, event, nt);
01350    if(i<0) return NULL;
01351   
01352    return  msgs[i].msg_builder(msgs, bc, nt);
01353 }

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

Definition at line 1292 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().

01293 {
01294    int i=isdn_msg_get_index(msgs, msg, nt);
01295    if(i>=0) return msgs[i].event;
01296    return EVENT_UNKNOWN;
01297 }

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

INTERFACE FCTS

Definition at line 1260 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().

01261 {
01262    int i;
01263 
01264    if (nt){
01265       mISDNuser_head_t *hh = (mISDNuser_head_t*)msg->data;
01266       
01267       for (i=0; i< msgs_max -1; i++) {
01268          if ( (hh->prim&COMMAND_MASK)==(msgs[i].misdn_msg&COMMAND_MASK)) return i;
01269       }
01270       
01271    } else {
01272       iframe_t *frm = (iframe_t*)msg->data;
01273     
01274       for (i=0; i< msgs_max -1; i++) 
01275          if ( (frm->prim&COMMAND_MASK)==(msgs[i].misdn_msg&COMMAND_MASK)) return i;
01276    }
01277 
01278    return -1;
01279 }

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

Definition at line 1281 of file isdn_msg_parser.c.

References cb_log, and msgs_max.

Referenced by isdn_get_info(), and isdn_msg_build_event().

01282 {
01283    int i;
01284    for (i=0; i< msgs_max; i++) 
01285       if ( event == msgs[i].event) return i;
01286 
01287    cb_log(10,0, "get_index: event not found!\n");
01288    
01289    return -1;
01290 }

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

Definition at line 1299 of file isdn_msg_parser.c.

References isdn_msg::info, and isdn_msg_get_index().

01300 {
01301    int i=isdn_msg_get_index(msgs, msg, nt);
01302    if(i>=0) return msgs[i].info;
01303    return NULL;
01304 }

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

Definition at line 1338 of file isdn_msg_parser.c.

References isdn_msg_get_index(), and isdn_msg::msg_parser.

Referenced by handle_event_nt(), and handle_frm().

01339 {
01340    int i=isdn_msg_get_index(msgs, msg, nt);
01341    if(i<0) return -1;
01342 
01343    msgs[i].msg_parser(msgs, msg, bc, nt);
01344    return 0;
01345 }


Variable Documentation

ibuffer_t* astbuf

Definition at line 31 of file isdn_lib_intern.h.

ibuffer_t* misdnbuf

Definition at line 32 of file isdn_lib_intern.h.


Generated on Wed Oct 28 11:52:46 2009 for Asterisk - the Open Source PBX by  doxygen 1.5.6