blob: f4fce25c6379a624558d687aa1909dea2cf79d56 [file] [log] [blame]
Harald Welte1e908662010-03-07 23:39:54 +01001#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
Pablo Neira Ayuso83419342011-03-22 16:36:13 +01008#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>
Harald Welte1e908662010-03-07 23:39:54 +010012
13/* decode a 'called/calling/connect party BCD number' as in 10.5.4.7 */
14int 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' */
18int gsm48_encode_bcd_number(uint8_t *bcd_lv, uint8_t max_len,
19 int h_len, const char *input);
20/* decode 'bearer capability' */
21int gsm48_decode_bearer_cap(struct gsm_mncc_bearer_cap *bcap,
22 const uint8_t *lv);
23/* encode 'bearer capability' */
24int gsm48_encode_bearer_cap(struct msgb *msg, int lv_only,
25 const struct gsm_mncc_bearer_cap *bcap);
26/* decode 'call control cap' */
27int gsm48_decode_cccap(struct gsm_mncc_cccap *ccap, const uint8_t *lv);
28/* encode 'call control cap' */
29int gsm48_encode_cccap(struct msgb *msg,
30 const struct gsm_mncc_cccap *ccap);
31/* decode 'called party BCD number' */
32int gsm48_decode_called(struct gsm_mncc_number *called,
33 const uint8_t *lv);
34/* encode 'called party BCD number' */
35int gsm48_encode_called(struct msgb *msg,
36 const struct gsm_mncc_number *called);
37/* decode callerid of various IEs */
38int gsm48_decode_callerid(struct gsm_mncc_number *callerid,
39 const uint8_t *lv);
40/* encode callerid of various IEs */
41int gsm48_encode_callerid(struct msgb *msg, int ie, int max_len,
42 const struct gsm_mncc_number *callerid);
43/* decode 'cause' */
44int gsm48_decode_cause(struct gsm_mncc_cause *cause,
45 const uint8_t *lv);
46/* encode 'cause' */
47int gsm48_encode_cause(struct msgb *msg, int lv_only,
48 const struct gsm_mncc_cause *cause);
49/* decode 'calling number' */
50int gsm48_decode_calling(struct gsm_mncc_number *calling,
51 const uint8_t *lv);
52/* encode 'calling number' */
53int gsm48_encode_calling(struct msgb *msg,
54 const struct gsm_mncc_number *calling);
55/* decode 'connected number' */
56int gsm48_decode_connected(struct gsm_mncc_number *connected,
57 const uint8_t *lv);
58/* encode 'connected number' */
59int gsm48_encode_connected(struct msgb *msg,
60 const struct gsm_mncc_number *connected);
61/* decode 'redirecting number' */
62int gsm48_decode_redirecting(struct gsm_mncc_number *redirecting,
63 const uint8_t *lv);
64/* encode 'redirecting number' */
65int gsm48_encode_redirecting(struct msgb *msg,
66 const struct gsm_mncc_number *redirecting);
67/* decode 'facility' */
68int gsm48_decode_facility(struct gsm_mncc_facility *facility,
69 const uint8_t *lv);
70/* encode 'facility' */
71int gsm48_encode_facility(struct msgb *msg, int lv_only,
72 const struct gsm_mncc_facility *facility);
73/* decode 'notify' */
74int gsm48_decode_notify(int *notify, const uint8_t *v);
75/* encode 'notify' */
76int gsm48_encode_notify(struct msgb *msg, int notify);
77/* decode 'signal' */
78int gsm48_decode_signal(int *signal, const uint8_t *v);
79/* encode 'signal' */
80int gsm48_encode_signal(struct msgb *msg, int signal);
81/* decode 'keypad' */
82int gsm48_decode_keypad(int *keypad, const uint8_t *lv);
83/* encode 'keypad' */
84int gsm48_encode_keypad(struct msgb *msg, int keypad);
85/* decode 'progress' */
86int gsm48_decode_progress(struct gsm_mncc_progress *progress,
87 const uint8_t *lv);
88/* encode 'progress' */
89int gsm48_encode_progress(struct msgb *msg, int lv_only,
90 const struct gsm_mncc_progress *p);
91/* decode 'user-user' */
92int gsm48_decode_useruser(struct gsm_mncc_useruser *uu,
93 const uint8_t *lv);
94/* encode 'useruser' */
95int gsm48_encode_useruser(struct msgb *msg, int lv_only,
96 const struct gsm_mncc_useruser *uu);
97/* decode 'ss version' */
98int gsm48_decode_ssversion(struct gsm_mncc_ssversion *ssv,
99 const uint8_t *lv);
100/* encode 'ss version' */
101int 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' */
105int gsm48_encode_more(struct msgb *msg);
106
Harald Welte1523d702010-08-04 11:46:44 +0200107/* structure of one frequency */
108struct gsm_sysinfo_freq {
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 */
114int gsm48_decode_freq_list(struct gsm_sysinfo_freq *f, uint8_t *cd,
115 uint8_t len, uint8_t mask, uint8_t frqt);
116
Harald Welte1e908662010-03-07 23:39:54 +0100117#endif