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
00026 #endif
00027
00028
00029 ibuffer_t *astbuf;
00030 ibuffer_t *misdnbuf;
00031
00032
00033 struct isdn_msg {
00034 unsigned long misdn_msg;
00035
00036 enum layer_e layer;
00037 enum event_e event;
00038
00039 void (*msg_parser)(struct isdn_msg *msgs, msg_t *msg, struct misdn_bchannel *bc, int nt);
00040 msg_t *(*msg_builder)(struct isdn_msg *msgs, struct misdn_bchannel *bc, int nt);
00041 char *info;
00042
00043 } ;
00044
00045
00046 msg_t *create_l3msg(int prim, int mt, int dinfo , int size, int nt);
00047
00048
00049
00050 struct misdn_stack {
00051
00052 net_stack_t nst;
00053 manager_t mgr;
00054
00055 int d_stid;
00056
00057 int b_num;
00058
00059 int b_stids[MAX_BCHANS + 1];
00060
00061 int ptp;
00062
00063 int l2upcnt;
00064
00065 int l2_id;
00066 int lower_id;
00067 int upper_id;
00068
00069
00070 int blocked;
00071
00072 int l2link;
00073
00074 time_t l2establish;
00075
00076 int l1link;
00077 int midev;
00078
00079 int nt;
00080
00081 int pri;
00082
00083
00084 int procids[0x100+1];
00085
00086 msg_queue_t downqueue;
00087 msg_queue_t upqueue;
00088 int busy;
00089
00090 int port;
00091 struct misdn_bchannel bc[MAX_BCHANS + 1];
00092
00093 struct misdn_bchannel* bc_list;
00094
00095 int channels[MAX_BCHANS + 1];
00096
00097
00098 struct misdn_bchannel *holding;
00099
00100 struct misdn_stack *next;
00101 };
00102
00103
00104 struct misdn_stack* get_stack_by_bc(struct misdn_bchannel *bc);
00105
00106 int isdn_msg_get_index(struct isdn_msg msgs[], msg_t *frm, int nt);
00107 enum event_e isdn_msg_get_event(struct isdn_msg msgs[], msg_t *frm, int nt);
00108 int isdn_msg_parse_event(struct isdn_msg msgs[], msg_t *frm, struct misdn_bchannel *bc, int nt);
00109 char * isdn_get_info(struct isdn_msg msgs[], enum event_e event, int nt);
00110 msg_t * isdn_msg_build_event(struct isdn_msg msgs[], struct misdn_bchannel *bc, enum event_e event, int nt);
00111 int isdn_msg_get_index_by_event(struct isdn_msg msgs[], enum event_e event, int nt);
00112 char * isdn_msg_get_info(struct isdn_msg msgs[], msg_t *msg, int nt);
00113
00114
00115 #endif