Added 'polling' option to options.conf.
[lcr.git] / gsm.h
1 extern "C" {
2 #include <openbsc/gsm_data.h>
3 }
4
5 struct gsm_conf {
6         char debug[128];                /* debug info */
7         char interface_bsc[64];         /* loopback interface BSC side */
8         char interface_lcr[64];         /* loopback interface LCR side */
9         char openbsc_cfg[128];          /* openbsc config file */
10         char short_name[64];            /* short network name */
11         char long_name[64];             /* long network name */
12         char hlr[64];                   /* database name */
13         int allow_all;                  /* accept unknown subscribers */
14         int keep_l2;                    /* keep layer 2 after exit */
15         int noemergshut;                /* don't shut down on emergency */
16         char pcapfile[128];             /* open capture file for BS11 links */
17         int reject_cause;               /* reject cause for unsubcribed IMSIs */
18 };
19
20 struct lcr_gsm {
21         void            *network;       /* OpenBSC network handle */
22         struct gsm_conf conf;           /* gsm.conf options */
23         int             gsm_sock;       /* loopback interface BSC side */
24         int             gsm_port;       /* loopback interface port number */
25 };
26
27 extern struct lcr_gsm *gsm;
28
29 /* GSM port class */
30 class Pgsm : public PmISDN
31 {
32         public:
33         Pgsm(int type, struct mISDNport *mISDNport, char *portname, struct port_settings *settings, int channel, int exclusive, int mode);
34         ~Pgsm();
35
36         struct lcr_work p_m_g_delete;           /* timer for audio transmission */
37         unsigned int p_m_g_callref; /* ref by OpenBSC */
38         unsigned int p_m_g_mode; /* data/transparent mode */
39         int p_m_g_gsm_b_sock; /* gsm bchannel socket */
40         struct lcr_fd p_m_g_gsm_b_fd; /* event node */
41         int p_m_g_gsm_b_index; /* gsm bchannel socket index to use */
42         int p_m_g_gsm_b_active; /* gsm bchannel socket is activated */
43         struct lcr_msg *p_m_g_notify_pending;   /* queue for NOTIFY if not connected */
44         void *p_m_g_encoder, *p_m_g_decoder;    /* gsm handle */
45         signed short p_m_g_rxdata[160]; /* receive audio buffer */
46         int p_m_g_rxpos; /* position in audio buffer 0..159 */
47         int p_m_g_tch_connected; /* indicates if audio is connected */
48
49         void bchannel_close(void);
50         int bchannel_open(int index);
51         void bchannel_receive(struct mISDNhead *hh, unsigned char *data, int len);
52         void bchannel_send(unsigned int prim, unsigned int id, unsigned char *data, int len);
53
54         void frame_send(void *_frame);
55         void frame_receive(void *_frame);
56
57         int hunt_bchannel(void);
58         void setup_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc);
59         void start_dtmf_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc);
60         void stop_dtmf_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc);
61         void call_conf_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *gsm);
62         void alert_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc);
63         void setup_cnf(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc);
64         void setup_compl_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc);
65         void disc_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc);
66         void rel_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc);
67         void notify_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc);
68         void hold_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc);
69         void retr_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc);
70         void message_setup(unsigned int epoint_id, int message_id, union parameter *param);
71         void message_notify(unsigned int epoint_id, int message_id, union parameter *param);
72         void message_alerting(unsigned int epoint_id, int message_id, union parameter *param);
73         void message_connect(unsigned int epoint_id, int message_id, union parameter *param);
74         void message_disconnect(unsigned int epoint_id, int message_id, union parameter *param);
75         void message_release(unsigned int epoint_id, int message_id, union parameter *param);
76         int message_epoint(unsigned int epoint_id, int message_id, union parameter *param);
77 };
78
79 int gsm_conf(struct gsm_conf *gsm_conf, char *conf_error);
80 int handle_gsm(void);
81 int gsm_exit(int rc);
82 int gsm_init(void);
83