Wed Oct 14 15:01:56 2009

Asterisk developer's documentation


isdn_lib_intern.h

Go to the documentation of this file.
00001 #ifndef ISDN_LIB_INTERN
00002 #define ISDN_LIB_INTERN
00003 
00004 
00005 #include <mISDNuser/mISDNlib.h>
00006 #include <mISDNuser/isdn_net.h>
00007 #include <mISDNuser/l3dss1.h>
00008 #include <mISDNuser/net_l3.h>
00009 
00010 #include <pthread.h>
00011 
00012 #include "isdn_lib.h"
00013 
00014 #if !defined MISDNUSER_VERSION_CODE || (MISDNUSER_VERSION_CODE < MISDNUSER_VERSION(1, 0, 3))
00015 #error "You need a newer version of mISDNuser ..."
00016 #endif
00017 
00018 
00019 #define QI_ELEMENT(a) a.off
00020 
00021 
00022 #ifndef mISDNUSER_HEAD_SIZE
00023 
00024 #define mISDNUSER_HEAD_SIZE (sizeof(mISDNuser_head_t))
00025 /*#define mISDNUSER_HEAD_SIZE (sizeof(mISDN_head_t))*/
00026 #endif
00027 
00028 
00029 ibuffer_t *astbuf;      /* Not used */
00030 ibuffer_t *misdnbuf; /* Not used */
00031 
00032 struct send_lock {
00033    pthread_mutex_t lock;
00034 };
00035 
00036 
00037 struct isdn_msg {
00038    unsigned long misdn_msg;
00039 
00040    enum layer_e layer;
00041    enum event_e event;
00042 
00043    void (*msg_parser)(struct isdn_msg *msgs, msg_t *msg, struct misdn_bchannel *bc, int nt);
00044    msg_t *(*msg_builder)(struct isdn_msg *msgs, struct misdn_bchannel *bc, int nt);
00045    char *info;
00046 } ;
00047 
00048 /* for isdn_msg_parser.c */
00049 msg_t *create_l3msg(int prim, int mt, int dinfo , int size, int nt);
00050 
00051 
00052 
00053 struct misdn_stack {
00054    /** is first element because &nst equals &mISDNlist **/
00055    net_stack_t nst;
00056    manager_t mgr;
00057 
00058    /*! \brief D Channel mISDN driver stack ID (Parent stack ID) */
00059    int d_stid;
00060 
00061    /*! /brief Number of B channels supported by this port */
00062    int b_num;
00063 
00064    /*! \brief B Channel mISDN driver stack IDs (Child stack IDs) */
00065    int b_stids[MAX_BCHANS + 1];
00066 
00067    /*! \brief TRUE if Point-To-Point(PTP) (Point-To-Multipoint(PTMP) otherwise) */
00068    int ptp;
00069 
00070    /*! \brief Number of consecutive times PTP Layer 2 declared down */
00071    int l2upcnt;
00072 
00073    int l2_id;  /* Not used */
00074 
00075    /*! \brief Lower layer mISDN ID (addr) (Layer 1/3) */
00076    int lower_id;
00077 
00078    /*! \brief Upper layer mISDN ID (addr) (Layer 2/4) */
00079    int upper_id;
00080 
00081    /*! \brief TRUE if port is blocked */
00082    int blocked;
00083 
00084    /*! \brief TRUE if Layer 2 is UP */
00085    int l2link;
00086 
00087    time_t l2establish;  /* Not used */
00088 
00089    /*! \brief TRUE if Layer 1 is UP */
00090    int l1link;
00091 
00092    /*! \brief TRUE if restart has been sent to the other side after stack startup */
00093    int restart_sent;
00094 
00095    /*! \brief mISDN device handle returned by mISDN_open() */
00096    int midev;
00097 
00098    /*! \brief TRUE if NT side of protocol (TE otherwise) */
00099    int nt;
00100 
00101    /*! \brief TRUE if ISDN-PRI (ISDN-BRI otherwise) */
00102    int pri;
00103 
00104    /*! \brief CR Process ID allocation table.  TRUE if ID allocated */
00105    int procids[0x100+1];
00106 
00107    /*! \brief Queue of Event messages to send to mISDN */
00108    msg_queue_t downqueue;
00109    msg_queue_t upqueue; /* No code puts anything on this queue */
00110    int busy;   /* Not used */
00111 
00112    /*! \brief Logical Layer 1 port associated with this stack */
00113    int port;
00114 
00115    /*! \brief B Channel record pool array */
00116    struct misdn_bchannel bc[MAX_BCHANS + 1];
00117 
00118    struct misdn_bchannel* bc_list;  /* Not used */
00119 
00120    /*! \brief Array of B channels in use (a[0] = B1).  TRUE if B channel in use */
00121    int channels[MAX_BCHANS + 1];
00122 
00123    /*! \brief List of holded channels */
00124    struct misdn_bchannel *holding;
00125 
00126    /*! \brief Next stack in the list of stacks */
00127    struct misdn_stack *next;
00128 };
00129 
00130 
00131 struct misdn_stack* get_stack_by_bc(struct misdn_bchannel *bc);
00132 
00133 int isdn_msg_get_index(struct isdn_msg msgs[], msg_t *frm, int nt);
00134 enum event_e isdn_msg_get_event(struct isdn_msg msgs[], msg_t *frm, int nt);
00135 int isdn_msg_parse_event(struct isdn_msg msgs[], msg_t *frm, struct misdn_bchannel *bc, int nt);
00136 char * isdn_get_info(struct isdn_msg msgs[], enum event_e event, int nt);
00137 msg_t * isdn_msg_build_event(struct isdn_msg msgs[], struct misdn_bchannel *bc, enum event_e event, int nt);
00138 int isdn_msg_get_index_by_event(struct isdn_msg msgs[], enum event_e event, int nt);
00139 char * isdn_msg_get_info(struct isdn_msg msgs[], msg_t *msg, int nt);
00140 
00141 
00142 #endif

Generated on Wed Oct 14 15:01:56 2009 for Asterisk - the Open Source PBX by  doxygen 1.4.7