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