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