X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=gsm.h;h=3ecaf0d83c1471fdca4b23da9ab50dbfea566256;hp=1fbcee7202c956e0130a7b70aa57a4ba8e27d19f;hb=c67eb259868a81432a68fe14d3caeea33d7eafb2;hpb=cf1ea15cc320019d7b41eb56aeeb3c1956fbb7a0 diff --git a/gsm.h b/gsm.h index 1fbcee7..3ecaf0d 100644 --- a/gsm.h +++ b/gsm.h @@ -1,31 +1,30 @@ -extern "C" { -#include -} -struct gsm_conf { - char debug[128]; /* debug info */ - char interface_bsc[64]; /* loopback interface BSC side */ - char interface_lcr[64]; /* loopback interface LCR side */ - char openbsc_cfg[128]; /* openbsc config file */ - char short_name[64]; /* short network name */ - char long_name[64]; /* long network name */ - char hlr[64]; /* database name */ - int allow_all; /* accept unknown subscribers */ - int keep_l2; /* keep layer 2 after exit */ - int noemergshut; /* don't shut down on emergency */ - char pcapfile[128]; /* open capture file for BS11 links */ - int reject_cause; /* reject cause for unsubcribed IMSIs */ - int rtp_proxy; /* enable RTP proxy */ +#include + +extern int new_callref; + +struct mncc_q_entry { + struct mncc_q_entry *next; + unsigned int len; + char data[0]; /* struct gsm_mncc */ }; -struct lcr_gsm { - void *network; /* OpenBSC network handle */ - struct gsm_conf conf; /* gsm.conf options */ - int gsm_sock; /* loopback interface BSC side */ - int gsm_port; /* loopback interface port number */ +enum { + LCR_GSM_TYPE_NETWORK, + LCR_GSM_TYPE_MS, }; -extern struct lcr_gsm *gsm; +struct lcr_gsm { + struct lcr_gsm *gsm_ms_next; /* list of MS instances, in case of MS */ + char name[16]; /* name of MS instance, in case of MS */ + int type; /* LCR_GSM_TYPE_*/ + + struct lcr_fd mncc_lfd; /* Unix domain socket to OpenBSC MNCC */ + struct mncc_q_entry *mncc_q_hd; + struct mncc_q_entry *mncc_q_tail; + struct lcr_timer socket_retry; /* Timer to re-try connecting to BSC socket */ + struct sockaddr_un sun; /* Socket address of MNCC socket */ +}; /* GSM port class */ class Pgsm : public PmISDN @@ -34,9 +33,12 @@ class Pgsm : public PmISDN Pgsm(int type, struct mISDNport *mISDNport, char *portname, struct port_settings *settings, int channel, int exclusive, int mode); ~Pgsm(); - unsigned int p_m_g_callref; /* ref by OpenBSC */ + struct lcr_gsm *p_m_g_lcr_gsm; /* pointer to network/ms instance */ + unsigned int p_m_g_callref; /* ref by OpenBSC/Osmocom-BB */ + struct lcr_work p_m_g_delete; /* queue destruction of GSM port instance */ unsigned int p_m_g_mode; /* data/transparent mode */ int p_m_g_gsm_b_sock; /* gsm bchannel socket */ + struct lcr_fd p_m_g_gsm_b_fd; /* event node */ int p_m_g_gsm_b_index; /* gsm bchannel socket index to use */ int p_m_g_gsm_b_active; /* gsm bchannel socket is activated */ struct lcr_msg *p_m_g_notify_pending; /* queue for NOTIFY if not connected */ @@ -50,35 +52,31 @@ class Pgsm : public PmISDN void bchannel_receive(struct mISDNhead *hh, unsigned char *data, int len); void bchannel_send(unsigned int prim, unsigned int id, unsigned char *data, int len); - void trau_send(void *_tf); - void trau_receive(void *_frame); + void frame_send(void *_frame); + void frame_receive(void *_frame); int hunt_bchannel(void); - void setup_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc); - void start_dtmf_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc); - void stop_dtmf_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc); void call_conf_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *gsm); + void call_proc_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc); void alert_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc); void setup_cnf(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc); void setup_compl_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc); void disc_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc); void rel_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc); void notify_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc); - void hold_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc); - void retr_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc); - void message_setup(unsigned int epoint_id, int message_id, union parameter *param); void message_notify(unsigned int epoint_id, int message_id, union parameter *param); void message_alerting(unsigned int epoint_id, int message_id, union parameter *param); void message_connect(unsigned int epoint_id, int message_id, union parameter *param); void message_disconnect(unsigned int epoint_id, int message_id, union parameter *param); void message_release(unsigned int epoint_id, int message_id, union parameter *param); int message_epoint(unsigned int epoint_id, int message_id, union parameter *param); - int handler(void); }; -extern char *gsm_conf_error; -int gsm_conf(struct gsm_conf *gsm_conf); -int handle_gsm(void); +struct gsm_mncc *create_mncc(int msg_type, unsigned int callref); +int send_and_free_mncc(struct lcr_gsm *lcr_gsm, unsigned int msg_type, void *data); +void gsm_trace_header(struct mISDNport *mISDNport, class PmISDN *port, unsigned int msg_type, int direction); +int gsm_conf(struct gsm_conf *gsm_conf, char *conf_error); int gsm_exit(int rc); int gsm_init(void); +int mncc_socket_retry_cb(struct lcr_timer *timer, void *inst, int index);