libosmogsm 1.13.1.1-afb4 Osmocom GSM library

gsm48_ie.h
Go to the documentation of this file.
1
3#pragma once
4
5#include <stdint.h>
6#include <string.h>
7#include <errno.h>
8
9#include <osmocom/core/msgb.h>
10#include <osmocom/core/defs.h>
11#include <osmocom/gsm/tlv.h>
12#include <osmocom/gsm/mncc.h>
13#include <osmocom/gsm/protocol/gsm_04_08.h>
14
15/* decode a 'called/calling/connect party BCD number' as in 10.5.4.7 */
16 int gsm48_decode_bcd_number(char *output, int output_len,
17 const uint8_t *bcd_lv, int h_len)
18 OSMO_DEPRECATED_OUTSIDE("Use gsm48_decode_bcd_number2() for improved bounds checking");
19 int gsm48_decode_bcd_number2(char *output, size_t output_len,
20 const uint8_t *bcd_lv, size_t input_len,
21 size_t h_len);
22
23/* convert a ASCII phone number to 'called/calling/connect party BCD number' */
24 int gsm48_encode_bcd_number(uint8_t *bcd_lv, uint8_t max_len,
25 int h_len, const char *input);
26/* decode 'bearer capability' */
27 int gsm48_decode_bearer_cap(struct gsm_mncc_bearer_cap *bcap,
28 const uint8_t *lv);
29/* encode 'bearer capability' */
30 int gsm48_encode_bearer_cap(struct msgb *msg, int lv_only,
31 const struct gsm_mncc_bearer_cap *bcap);
32/* decode 'call control cap' */
33 int gsm48_decode_cccap(struct gsm_mncc_cccap *ccap, const uint8_t *lv);
34/* encode 'call control cap' */
35 int gsm48_encode_cccap(struct msgb *msg,
36 const struct gsm_mncc_cccap *ccap);
37/* decode 'called party BCD number' */
38 int gsm48_decode_called(struct gsm_mncc_number *called,
39 const uint8_t *lv);
40/* encode 'called party BCD number' */
41 int gsm48_encode_called(struct msgb *msg,
42 const struct gsm_mncc_number *called);
43/* decode callerid of various IEs */
44 int gsm48_decode_callerid(struct gsm_mncc_number *callerid,
45 const uint8_t *lv);
46/* encode callerid of various IEs */
47 int gsm48_encode_callerid(struct msgb *msg, int ie, int max_len,
48 const struct gsm_mncc_number *callerid);
49/* decode 'cause' */
50 int gsm48_decode_cause(struct gsm_mncc_cause *cause,
51 const uint8_t *lv);
52/* encode 'cause' */
53 int gsm48_encode_cause(struct msgb *msg, int lv_only,
54 const struct gsm_mncc_cause *cause);
55/* decode 'calling number' */
56 int gsm48_decode_calling(struct gsm_mncc_number *calling,
57 const uint8_t *lv);
58/* encode 'calling number' */
59 int gsm48_encode_calling(struct msgb *msg,
60 const struct gsm_mncc_number *calling);
61/* decode 'connected number' */
62 int gsm48_decode_connected(struct gsm_mncc_number *connected,
63 const uint8_t *lv);
64/* encode 'connected number' */
65 int gsm48_encode_connected(struct msgb *msg,
66 const struct gsm_mncc_number *connected);
67/* decode 'redirecting number' */
68 int gsm48_decode_redirecting(struct gsm_mncc_number *redirecting,
69 const uint8_t *lv);
70/* encode 'redirecting number' */
71 int gsm48_encode_redirecting(struct msgb *msg,
72 const struct gsm_mncc_number *redirecting);
73/* decode 'facility' */
74 int gsm48_decode_facility(struct gsm_mncc_facility *facility,
75 const uint8_t *lv);
76/* encode 'facility' */
77 int gsm48_encode_facility(struct msgb *msg, int lv_only,
78 const struct gsm_mncc_facility *facility);
79/* decode 'notify' */
80 int gsm48_decode_notify(int *notify, const uint8_t *v);
81/* encode 'notify' */
82 int gsm48_encode_notify(struct msgb *msg, int notify);
83/* decode 'signal' */
84 int gsm48_decode_signal(int *signal, const uint8_t *v);
85/* encode 'signal' */
86 int gsm48_encode_signal(struct msgb *msg, int signal);
87/* decode 'keypad' */
88 int gsm48_decode_keypad(int *keypad, const uint8_t *lv);
89/* encode 'keypad' */
90 int gsm48_encode_keypad(struct msgb *msg, int keypad);
91/* decode 'progress' */
92 int gsm48_decode_progress(struct gsm_mncc_progress *progress,
93 const uint8_t *lv);
94/* encode 'progress' */
95 int gsm48_encode_progress(struct msgb *msg, int lv_only,
96 const struct gsm_mncc_progress *p);
97/* decode 'user-user' */
98 int gsm48_decode_useruser(struct gsm_mncc_useruser *uu,
99 const uint8_t *lv);
100/* encode 'useruser' */
101 int gsm48_encode_useruser(struct msgb *msg, int lv_only,
102 const struct gsm_mncc_useruser *uu);
103/* decode 'ss version' */
104 int gsm48_decode_ssversion(struct gsm_mncc_ssversion *ssv,
105 const uint8_t *lv);
106/* encode 'ss version' */
107 int gsm48_encode_ssversion(struct msgb *msg,
108 const struct gsm_mncc_ssversion *ssv);
109/* decode 'more data' does not require a function, because it has no value */
110/* encode 'more data' */
111 int gsm48_encode_more(struct msgb *msg);
112
113/* structure of one frequency */
114 struct gsm_sysinfo_freq {
115 /* if the frequency included in the sysinfo */
116 uint8_t mask;
117};
118
119/* decode "Cell Channel Description" (10.5.2.1b) and other frequency lists */
120 int gsm48_decode_freq_list(struct gsm_sysinfo_freq *f,
121 const uint8_t *cd, uint8_t len,
122 uint8_t mask, uint8_t frqt);
123
124/* decode "CSN.1 encoded Classmark 3" (10.5.1.7) */
125 int gsm48_decode_classmark3(struct gsm48_classmark3 *classmark3_out,
126 const uint8_t *classmark3, size_t classmark3_len);
defs.h
gsm48_encode_useruser
int gsm48_encode_useruser(struct msgb *msg, int lv_only, const struct gsm_mncc_useruser *uu)
Encode TS 04.08 User-User IE (10.5.4.25)
Definition: gsm48_ie.c:823
gsm48_decode_signal
int gsm48_decode_signal(int *signal, const uint8_t *v)
Decode TS 04.08 Signal IE (10.5.4.23)
Definition: gsm48_ie.c:727
gsm48_encode_facility
int gsm48_encode_facility(struct msgb *msg, int lv_only, const struct gsm_mncc_facility *facility)
Encode TS 04.08 Facility IE (10.5.4.15)
Definition: gsm48_ie.c:692
gsm48_decode_cause
int gsm48_decode_cause(struct gsm_mncc_cause *cause, const uint8_t *lv)
Decode TS 04.08 Cause IE (10.5.4.11)
Definition: gsm48_ie.c:545
gsm48_decode_connected
int gsm48_decode_connected(struct gsm_mncc_number *connected, const uint8_t *lv)
Decode TS 04.08 Connected Number IE (10.5.4.13)
Definition: gsm48_ie.c:646
gsm48_decode_cccap
int gsm48_decode_cccap(struct gsm_mncc_cccap *ccap, const uint8_t *lv)
Decode TS 04.08 Call Control Capabilities IE (10.5.4.5a)
Definition: gsm48_ie.c:393
gsm48_encode_calling
int gsm48_encode_calling(struct msgb *msg, const struct gsm_mncc_number *calling)
Encode TS 04.08 Calling Number IE (10.5.4.9)
Definition: gsm48_ie.c:639
gsm48_decode_calling
int gsm48_decode_calling(struct gsm_mncc_number *calling, const uint8_t *lv)
Decode TS 04.08 Calling Number IE (10.5.4.9)
Definition: gsm48_ie.c:632
gsm48_encode_keypad
int gsm48_encode_keypad(struct msgb *msg, int keypad)
Encode TS 04.08 Keypad IE (10.5.4.17)
Definition: gsm48_ie.c:756
gsm48_encode_callerid
int gsm48_encode_callerid(struct msgb *msg, int ie, int max_len, const struct gsm_mncc_number *callerid)
Encode TS 04.08 Caller ID IE.
Definition: gsm48_ie.c:511
gsm48_encode_progress
int gsm48_encode_progress(struct msgb *msg, int lv_only, const struct gsm_mncc_progress *p)
Encode TS 04.08 Progress IE (10.5.4.21)
Definition: gsm48_ie.c:780
gsm48_decode_progress
int gsm48_decode_progress(struct gsm_mncc_progress *progress, const uint8_t *lv)
Decode TS 04.08 Progress IE (10.5.4.21)
Definition: gsm48_ie.c:764
gsm48_decode_freq_list
int gsm48_decode_freq_list(struct gsm_sysinfo_freq *f, const uint8_t *cd, uint8_t len, uint8_t mask, uint8_t frqt)
Decode TS 04.08 Cell Channel Description IE (10.5.2.1b) and other frequency lists.
Definition: gsm48_ie.c:903
gsm48_encode_ssversion
int gsm48_encode_ssversion(struct msgb *msg, const struct gsm_mncc_ssversion *ssv)
Encode TS 04.08 SS Version IE (10.5.4.24)
Definition: gsm48_ie.c:858
gsm48_decode_notify
int gsm48_decode_notify(int *notify, const uint8_t *v)
Decode TS 04.08 Notify IE (10.5.4.20)
Definition: gsm48_ie.c:711
gsm48_decode_bcd_number2
int gsm48_decode_bcd_number2(char *output, size_t output_len, const uint8_t *bcd_lv, size_t input_len, size_t h_len)
Decode a 'called/calling/connect party BCD number' as in 10.5.4.7.
Definition: gsm48_ie.c:77
gsm48_encode_notify
int gsm48_encode_notify(struct msgb *msg, int notify)
Encode TS 04.08 Notify IE (10.5.4.20)
Definition: gsm48_ie.c:719
gsm48_decode_facility
int gsm48_decode_facility(struct gsm_mncc_facility *facility, const uint8_t *lv)
Decode TS 04.08 Facility IE (10.5.4.15)
Definition: gsm48_ie.c:674
gsm48_decode_bearer_cap
int gsm48_decode_bearer_cap(struct gsm_mncc_bearer_cap *bcap, const uint8_t *lv)
Decode TS 04.08 Bearer Capability IE (10.5.4.5)
Definition: gsm48_ie.c:186
gsm48_encode_more
int gsm48_encode_more(struct msgb *msg)
Encode TS 04.08 More Data IE (10.5.4.19)
Definition: gsm48_ie.c:876
gsm48_decode_useruser
int gsm48_decode_useruser(struct gsm_mncc_useruser *uu, const uint8_t *lv)
Decode TS 04.08 User-User IE (10.5.4.25)
Definition: gsm48_ie.c:797
gsm48_decode_classmark3
int gsm48_decode_classmark3(struct gsm48_classmark3 *classmark3_out, const uint8_t *classmark3, size_t classmark3_len)
Decode 3GPP TS 24.008 Mobile Station Classmark 3 (10.5.1.7).
Definition: gsm48_ie.c:1343
gsm48_decode_keypad
int gsm48_decode_keypad(int *keypad, const uint8_t *lv)
Decode TS 04.08 Keypad IE (10.5.4.17)
Definition: gsm48_ie.c:743
gsm48_decode_callerid
int gsm48_decode_callerid(struct gsm_mncc_number *callerid, const uint8_t *lv)
Decode TS 04.08 Caller ID.
Definition: gsm48_ie.c:479
gsm48_encode_cccap
int gsm48_encode_cccap(struct msgb *msg, const struct gsm_mncc_cccap *ccap)
Encodoe TS 04.08 Call Control Capabilities (10.5.4.5a)
Definition: gsm48_ie.c:411
gsm48_encode_redirecting
int gsm48_encode_redirecting(struct msgb *msg, const struct gsm_mncc_number *redirecting)
Encode TS 04.08 Redirecting Number IE (10.5.4.21b)
Definition: gsm48_ie.c:667
gsm48_encode_called
int gsm48_encode_called(struct msgb *msg, const struct gsm_mncc_number *called)
Encode TS 04.08 Called Party IE (10.5.4.7)
Definition: gsm48_ie.c:454
gsm48_encode_signal
int gsm48_encode_signal(struct msgb *msg, int signal)
Encode TS 04.08 Signal IE (10.5.4.23)
Definition: gsm48_ie.c:735
gsm48_decode_called
int gsm48_decode_called(struct gsm_mncc_number *called, const uint8_t *lv)
Decode TS 04.08 Called Party BCD Number IE (10.5.4.7)
Definition: gsm48_ie.c:432
gsm48_decode_ssversion
int gsm48_decode_ssversion(struct gsm_mncc_ssversion *ssv, const uint8_t *lv)
Decode TS 04.08 SS Version IE (10.5.4.24)
Definition: gsm48_ie.c:843
gsm48_encode_bcd_number
int gsm48_encode_bcd_number(uint8_t *bcd_lv, uint8_t max_len, int h_len, const char *input)
convert a ASCII phone number to 'called/calling/connect party BCD number'
Definition: gsm48_ie.c:150
gsm48_decode_bcd_number
int gsm48_decode_bcd_number(char *output, int output_len, const uint8_t *bcd_lv, int h_len) OSMO_DEPRECATED_OUTSIDE("Use gsm48_decode_bcd_number2() for improved bounds checking")
Like gsm48_decode_bcd_number2() but with less airtight bounds checking.
Definition: gsm48_ie.c:52
gsm48_encode_bearer_cap
int gsm48_encode_bearer_cap(struct msgb *msg, int lv_only, const struct gsm_mncc_bearer_cap *bcap)
Encode TS 04.08 Bearer Capability IE (10.5.4.5)
Definition: gsm48_ie.c:317
gsm48_decode_redirecting
int gsm48_decode_redirecting(struct gsm_mncc_number *redirecting, const uint8_t *lv)
Decode TS 04.08 Redirecting Number IE (10.5.4.21b)
Definition: gsm48_ie.c:660
gsm48_encode_connected
int gsm48_encode_connected(struct msgb *msg, const struct gsm_mncc_number *connected)
Encode TS 04.08 Connected Number IE (10.5.4.13)
Definition: gsm48_ie.c:653
gsm48_encode_cause
int gsm48_encode_cause(struct msgb *msg, int lv_only, const struct gsm_mncc_cause *cause)
Encode TS 04.08 Cause IE (10.5.4.11)
Definition: gsm48_ie.c:592
OSMO_DEPRECATED_OUTSIDE
#define OSMO_DEPRECATED_OUTSIDE(text)
gsm_04_08.h
GSM TS 04.08 definitions.
cause
uint8_t cause
Definition: gsm_04_08.h:2
len
uint8_t len
Definition: gsm_04_11.h:0
msg
uint8_t msg[0]
Definition: gsm_08_08.h:8
mncc.h
msgb.h
gsm48_classmark3
Definition: gsm_04_08.h:62
gsm_mncc_bearer_cap
Definition: mncc.h:12
gsm_mncc_cause
Definition: mncc.h:41
gsm_mncc_cccap
Definition: mncc.h:72
gsm_mncc_facility
Definition: mncc.h:62
gsm_mncc_number
Definition: mncc.h:33
gsm_mncc_progress
Definition: mncc.h:56
gsm_mncc_ssversion
Definition: mncc.h:67
gsm_mncc_useruser
Definition: mncc.h:51
gsm_sysinfo_freq
Definition: gsm48_ie.h:114
gsm_sysinfo_freq::mask
uint8_t mask
Definition: gsm48_ie.h:116
msgb
tlv.h