GSM: Define mncc_send() as it is no longer available from OpenBSC headers
[lcr.git] / gsm.h
1 extern int new_callref;
2
3 struct gsm_conf {
4         char debug[128];                /* debug info */
5         char openbsc_cfg[128];          /* openbsc config file */
6         char short_name[64];            /* short network name */
7         char long_name[64];             /* long network name */
8         char hlr[64];                   /* database name */
9         int allow_all;                  /* accept unknown subscribers */
10         int keep_l2;                    /* keep layer 2 after exit */
11         char pcapfile[128];             /* open capture file for BS11 links */
12         int reject_cause;               /* reject cause for unsubcribed IMSIs */
13 };
14
15 struct mncc_q_entry {
16         struct mncc_q_entry *next;
17         unsigned int len;
18         char data[0];                   /* struct gsm_mncc */
19 };
20
21 struct lcr_gsm {
22         void            *network;       /* OpenBSC network handle */
23         struct gsm_conf conf;           /* gsm.conf options */
24         int             gsm_sock;       /* loopback interface GSM side */
25         int             gsm_port;       /* loopback interface port number */
26
27         struct lcr_fd   mncc_lfd;       /* Unix domain socket to OpenBSC MNCC */
28         struct mncc_q_entry *mncc_q_hd;
29         struct mncc_q_entry *mncc_q_tail;
30 };
31
32 extern struct lcr_gsm *gsm;
33
34 /* GSM port class */
35 class Pgsm : public PmISDN
36 {
37         public:
38         Pgsm(int type, struct mISDNport *mISDNport, char *portname, struct port_settings *settings, int channel, int exclusive, int mode);
39         ~Pgsm();
40
41         void *p_m_g_instance; /* pointer to network/ms instance */
42         unsigned int p_m_g_callref; /* ref by OpenBSC/Osmocom-BB */
43         struct lcr_work p_m_g_delete;           /* timer for audio transmission */
44         unsigned int p_m_g_mode; /* data/transparent mode */
45         int p_m_g_gsm_b_sock; /* gsm bchannel socket */
46         struct lcr_fd p_m_g_gsm_b_fd; /* event node */
47         int p_m_g_gsm_b_index; /* gsm bchannel socket index to use */
48         int p_m_g_gsm_b_active; /* gsm bchannel socket is activated */
49         struct lcr_msg *p_m_g_notify_pending;   /* queue for NOTIFY if not connected */
50         void *p_m_g_encoder, *p_m_g_decoder;    /* gsm handle */
51         signed short p_m_g_rxdata[160]; /* receive audio buffer */
52         int p_m_g_rxpos; /* position in audio buffer 0..159 */
53         int p_m_g_tch_connected; /* indicates if audio is connected */
54
55         void bchannel_close(void);
56         int bchannel_open(int index);
57         void bchannel_receive(struct mISDNhead *hh, unsigned char *data, int len);
58         void bchannel_send(unsigned int prim, unsigned int id, unsigned char *data, int len);
59
60         void frame_send(void *_frame);
61         void frame_receive(void *_frame);
62
63         int hunt_bchannel(void);
64         void call_conf_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *gsm);
65         void call_proc_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc);
66         void alert_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc);
67         void setup_cnf(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc);
68         void setup_compl_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc);
69         void disc_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc);
70         void rel_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc);
71         void notify_ind(unsigned int msg_type, unsigned int callref, struct gsm_mncc *mncc);
72         void message_notify(unsigned int epoint_id, int message_id, union parameter *param);
73         void message_alerting(unsigned int epoint_id, int message_id, union parameter *param);
74         void message_connect(unsigned int epoint_id, int message_id, union parameter *param);
75         void message_disconnect(unsigned int epoint_id, int message_id, union parameter *param);
76         void message_release(unsigned int epoint_id, int message_id, union parameter *param);
77         int message_epoint(unsigned int epoint_id, int message_id, union parameter *param);
78 };
79
80 struct gsm_mncc *create_mncc(int msg_type, unsigned int callref);
81 int send_and_free_mncc(void *instance, unsigned int msg_type, void *data);
82 void gsm_trace_header(struct mISDNport *mISDNport, class PmISDN *port, unsigned int msg_type, int direction);
83 int handle_gsm(void);
84 int gsm_conf(struct gsm_conf *gsm_conf, char *conf_error);
85 int gsm_exit(int rc);
86 int gsm_init(void);
87
88 extern "C" {
89 int mncc_send(struct gsm_network *instance, int msg_type, void *data);
90 };