libosmogsm  0.6.3
Osmocom GSM library
gsm48_ie.h
1 #ifndef _OSMOCORE_GSM48_IE_H
2 #define _OSMOCORE_GSM48_IE_H
3 
4 #include <stdint.h>
5 #include <string.h>
6 #include <errno.h>
7 
8 #include <osmocom/core/msgb.h>
9 #include <osmocom/gsm/tlv.h>
10 #include <osmocom/gsm/mncc.h>
11 #include <osmocom/gsm/protocol/gsm_04_08.h>
12 
13 /* decode a 'called/calling/connect party BCD number' as in 10.5.4.7 */
14 int gsm48_decode_bcd_number(char *output, int output_len,
15  const uint8_t *bcd_lv, int h_len);
16 
17 /* convert a ASCII phone number to 'called/calling/connect party BCD number' */
18 int gsm48_encode_bcd_number(uint8_t *bcd_lv, uint8_t max_len,
19  int h_len, const char *input);
20 /* decode 'bearer capability' */
21 int gsm48_decode_bearer_cap(struct gsm_mncc_bearer_cap *bcap,
22  const uint8_t *lv);
23 /* encode 'bearer capability' */
24 int gsm48_encode_bearer_cap(struct msgb *msg, int lv_only,
25  const struct gsm_mncc_bearer_cap *bcap);
26 /* decode 'call control cap' */
27 int gsm48_decode_cccap(struct gsm_mncc_cccap *ccap, const uint8_t *lv);
28 /* encode 'call control cap' */
29 int gsm48_encode_cccap(struct msgb *msg,
30  const struct gsm_mncc_cccap *ccap);
31 /* decode 'called party BCD number' */
32 int gsm48_decode_called(struct gsm_mncc_number *called,
33  const uint8_t *lv);
34 /* encode 'called party BCD number' */
35 int gsm48_encode_called(struct msgb *msg,
36  const struct gsm_mncc_number *called);
37 /* decode callerid of various IEs */
38 int gsm48_decode_callerid(struct gsm_mncc_number *callerid,
39  const uint8_t *lv);
40 /* encode callerid of various IEs */
41 int gsm48_encode_callerid(struct msgb *msg, int ie, int max_len,
42  const struct gsm_mncc_number *callerid);
43 /* decode 'cause' */
44 int gsm48_decode_cause(struct gsm_mncc_cause *cause,
45  const uint8_t *lv);
46 /* encode 'cause' */
47 int gsm48_encode_cause(struct msgb *msg, int lv_only,
48  const struct gsm_mncc_cause *cause);
49 /* decode 'calling number' */
50 int gsm48_decode_calling(struct gsm_mncc_number *calling,
51  const uint8_t *lv);
52 /* encode 'calling number' */
53 int gsm48_encode_calling(struct msgb *msg,
54  const struct gsm_mncc_number *calling);
55 /* decode 'connected number' */
56 int gsm48_decode_connected(struct gsm_mncc_number *connected,
57  const uint8_t *lv);
58 /* encode 'connected number' */
59 int gsm48_encode_connected(struct msgb *msg,
60  const struct gsm_mncc_number *connected);
61 /* decode 'redirecting number' */
62 int gsm48_decode_redirecting(struct gsm_mncc_number *redirecting,
63  const uint8_t *lv);
64 /* encode 'redirecting number' */
65 int gsm48_encode_redirecting(struct msgb *msg,
66  const struct gsm_mncc_number *redirecting);
67 /* decode 'facility' */
68 int gsm48_decode_facility(struct gsm_mncc_facility *facility,
69  const uint8_t *lv);
70 /* encode 'facility' */
71 int gsm48_encode_facility(struct msgb *msg, int lv_only,
72  const struct gsm_mncc_facility *facility);
73 /* decode 'notify' */
74 int gsm48_decode_notify(int *notify, const uint8_t *v);
75 /* encode 'notify' */
76 int gsm48_encode_notify(struct msgb *msg, int notify);
77 /* decode 'signal' */
78 int gsm48_decode_signal(int *signal, const uint8_t *v);
79 /* encode 'signal' */
80 int gsm48_encode_signal(struct msgb *msg, int signal);
81 /* decode 'keypad' */
82 int gsm48_decode_keypad(int *keypad, const uint8_t *lv);
83 /* encode 'keypad' */
84 int gsm48_encode_keypad(struct msgb *msg, int keypad);
85 /* decode 'progress' */
86 int gsm48_decode_progress(struct gsm_mncc_progress *progress,
87  const uint8_t *lv);
88 /* encode 'progress' */
89 int gsm48_encode_progress(struct msgb *msg, int lv_only,
90  const struct gsm_mncc_progress *p);
91 /* decode 'user-user' */
92 int gsm48_decode_useruser(struct gsm_mncc_useruser *uu,
93  const uint8_t *lv);
94 /* encode 'useruser' */
95 int gsm48_encode_useruser(struct msgb *msg, int lv_only,
96  const struct gsm_mncc_useruser *uu);
97 /* decode 'ss version' */
98 int gsm48_decode_ssversion(struct gsm_mncc_ssversion *ssv,
99  const uint8_t *lv);
100 /* encode 'ss version' */
101 int gsm48_encode_ssversion(struct msgb *msg,
102  const struct gsm_mncc_ssversion *ssv);
103 /* decode 'more data' does not require a function, because it has no value */
104 /* encode 'more data' */
105 int gsm48_encode_more(struct msgb *msg);
106 
107 /* structure of one frequency */
109  /* if the frequency included in the sysinfo */
110  uint8_t mask;
111 };
112 
113 /* decode "Cell Channel Description" (10.5.2.1b) and other frequency lists */
114 int gsm48_decode_freq_list(struct gsm_sysinfo_freq *f, uint8_t *cd,
115  uint8_t len, uint8_t mask, uint8_t frqt);
116 
117 #endif