libosmogsm 1.13.1.1-afb4 Osmocom GSM library

gsm0480.h
Go to the documentation of this file.
1
3#pragma once
4
5#include <osmocom/core/defs.h>
6#include <osmocom/core/msgb.h>
7#include <osmocom/gsm/protocol/gsm_04_08.h>
8#include <osmocom/gsm/protocol/gsm_04_80.h>
9
10 extern const struct value_string gsm0480_comp_type_names[];
11 static inline const char *gsm0480_comp_type_name(uint8_t comp_type) {
12 return get_value_string(gsm0480_comp_type_names, comp_type);
13}
14
15 extern const struct value_string gsm0480_op_code_names[];
16 static inline const char *gsm0480_op_code_name(uint8_t op_code) {
17 return get_value_string(gsm0480_op_code_names, op_code);
18}
19
25#define GSM0480_USSD_OCTET_STRING_LEN 160
26
33#define GSM0480_USSD_7BIT_STRING_LEN 182
34
40#define MAX_LEN_USSD_STRING 31
41
42/* deprecated */
43 struct ussd_request {
44 char text[MAX_LEN_USSD_STRING + 1];
45 uint8_t transaction_id;
46 uint8_t invoke_id;
47};
48
49/* deprecated */
50 int gsm0480_decode_ussd_request(const struct gsm48_hdr *hdr, uint16_t len,
51 struct ussd_request *request) OSMO_DEPRECATED("Use gsm0480_decode_ss_request() instead");
52
57 struct ss_request {
62 uint8_t opcode;
68 uint8_t ss_code;
69
77 uint8_t ussd_text[GSM0480_USSD_OCTET_STRING_LEN];
78
87 uint8_t ussd_data[GSM0480_USSD_OCTET_STRING_LEN];
88 uint8_t ussd_data_len; /* Length in bytes */
89 uint8_t ussd_data_dcs; /* Data Coding Scheme */
90
95 uint8_t transaction_id;
101 uint8_t invoke_id;
102};
103
104 int gsm0480_extract_ie_by_tag(const struct gsm48_hdr *hdr, uint16_t msg_len,
105 uint8_t **ie, uint16_t *ie_len, uint8_t ie_tag);
106 int gsm0480_parse_facility_ie(const uint8_t *facility_ie, uint16_t length,
107 struct ss_request *req);
108 int gsm0480_decode_ss_request(const struct gsm48_hdr *hdr, uint16_t len,
109 struct ss_request *request);
110
111 struct msgb *gsm0480_msgb_alloc_name(const char *name);
112 struct msgb *gsm0480_gen_ussd_resp_7bit(uint8_t invoke_id, const char *text);
113 struct msgb *gsm0480_gen_return_error(uint8_t invoke_id, uint8_t error_code);
114 struct msgb *gsm0480_gen_reject(int invoke_id, uint8_t problem_tag, uint8_t problem_code);
115
116 struct msgb *gsm0480_create_ussd_resp(uint8_t invoke_id, uint8_t trans_id, const char *text);
117 struct msgb *gsm0480_create_unstructuredSS_Notify(int alertPattern, const char *text);
118 struct msgb *gsm0480_create_notifySS(const char *text);
119 struct msgb *gsm0480_create_ussd_notify(int level, const char *text);
120 struct msgb *gsm0480_create_ussd_release_complete(void)
121 OSMO_DEPRECATED("Use gsm0480_create_release_complete() instead.");
122 struct msgb *gsm0480_create_release_complete(uint8_t trans_id);
123
124 int gsm0480_wrap_invoke(struct msgb *msg, int op, int link_id);
125 int gsm0480_wrap_facility(struct msgb *msg);
defs.h
OSMO_DEPRECATED
#define OSMO_DEPRECATED(text)
get_value_string
const char * get_value_string(const struct value_string *vs, uint32_t val)
gsm0480_comp_type_names
const struct value_string gsm0480_comp_type_names[]
Definition: gsm0480.c:36
gsm0480_decode_ussd_request
int gsm0480_decode_ussd_request(const struct gsm48_hdr *hdr, uint16_t len, struct ussd_request *request) OSMO_DEPRECATED("Use gsm0480_decode_ss_request() instead")
Definition: gsm0480.c:313
gsm0480_gen_return_error
struct msgb * gsm0480_gen_return_error(uint8_t invoke_id, uint8_t error_code)
Generate a ReturnError component (see section 3.6.1) and given error code (see section 3....
Definition: gsm0480.c:846
gsm0480_create_notifySS
struct msgb * gsm0480_create_notifySS(const char *text)
Definition: gsm0480.c:137
gsm0480_op_code_name
static const char * gsm0480_op_code_name(uint8_t op_code)
Definition: gsm0480.h:16
gsm0480_decode_ss_request
int gsm0480_decode_ss_request(const struct gsm48_hdr *hdr, uint16_t len, struct ss_request *request)
Definition: gsm0480.c:350
MAX_LEN_USSD_STRING
#define MAX_LEN_USSD_STRING
DEPRECATED: this definition doesn't follow any specification, so we only keep it for compatibility re...
Definition: gsm0480.h:40
gsm0480_extract_ie_by_tag
int gsm0480_extract_ie_by_tag(const struct gsm48_hdr *hdr, uint16_t msg_len, uint8_t **ie, uint16_t *ie_len, uint8_t ie_tag)
Get pointer to the IE of a given type.
Definition: gsm0480.c:241
gsm0480_parse_facility_ie
int gsm0480_parse_facility_ie(const uint8_t *facility_ie, uint16_t length, struct ss_request *req)
Parse the components of a given Facility IE.
Definition: gsm0480.c:478
gsm0480_create_ussd_resp
struct msgb * gsm0480_create_ussd_resp(uint8_t invoke_id, uint8_t trans_id, const char *text)
Legacy helper: Generate USSD response including FACILITY IE + L3 header.
Definition: gsm0480.c:821
gsm0480_create_release_complete
struct msgb * gsm0480_create_release_complete(uint8_t trans_id)
Create a GSM 04.80 Release complete (see 2.5) message, prefixed by GSM 04.08 L3 header with a given t...
Definition: gsm0480.c:941
GSM0480_USSD_OCTET_STRING_LEN
#define GSM0480_USSD_OCTET_STRING_LEN
According to the GSM 04.80 (version 5.0.0) specification Annex A "Expanded ASN.1 Module "SS-Protocol"...
Definition: gsm0480.h:25
gsm0480_op_code_names
const struct value_string gsm0480_op_code_names[]
Definition: gsm0480.c:44
gsm0480_wrap_invoke
int gsm0480_wrap_invoke(struct msgb *msg, int op, int link_id)
Definition: gsm0480.c:74
gsm0480_msgb_alloc_name
struct msgb * gsm0480_msgb_alloc_name(const char *name)
Definition: gsm0480.c:765
gsm0480_create_ussd_notify
struct msgb * gsm0480_create_ussd_notify(int level, const char *text)
Definition: gsm0480.c:900
gsm0480_create_ussd_release_complete
struct msgb * gsm0480_create_ussd_release_complete(void) OSMO_DEPRECATED("Use gsm0480_create_release_complete() instead.")
Deprecated, use gsm0480_create_release_complete() instead.
Definition: gsm0480.c:920
gsm0480_gen_reject
struct msgb * gsm0480_gen_reject(int invoke_id, uint8_t problem_tag, uint8_t problem_code)
Generate a Reject component (see section 3.6.1) and given error code (see section 3....
Definition: gsm0480.c:876
gsm0480_wrap_facility
int gsm0480_wrap_facility(struct msgb *msg)
Definition: gsm0480.c:89
gsm0480_create_unstructuredSS_Notify
struct msgb * gsm0480_create_unstructuredSS_Notify(int alertPattern, const char *text)
Definition: gsm0480.c:96
gsm0480_gen_ussd_resp_7bit
struct msgb * gsm0480_gen_ussd_resp_7bit(uint8_t invoke_id, const char *text)
Generate a USSD ReturnResult component containing a string in default GSM alphabet.
Definition: gsm0480.c:774
gsm0480_comp_type_name
static const char * gsm0480_comp_type_name(uint8_t comp_type)
Definition: gsm0480.h:11
gsm_04_08.h
GSM TS 04.08 definitions.
hdr
struct gsm48_hdr hdr
Definition: gsm_04_08.h:0
len
uint8_t len
Definition: gsm_04_11.h:0
gsm_04_80.h
GSM TS 04.80 definitions (Supplementary Services Specification, Formats and Coding).
msg
uint8_t msg[0]
Definition: gsm_08_08.h:8
length
uint8_t length
Definition: gsm_08_08.h:1
link_id
uint8_t link_id
Definition: gsm_08_08.h:2
msgb.h
gsm48_hdr
Definition: gsm_04_08.h:941
msgb
ss_request
This structure represents some meaningful parts of a decoded and/or to be encoded GSM 04....
Definition: gsm0480.h:57
ss_request::opcode
uint8_t opcode
GSM TS 04.80, section 3.6.4 "Operation code" See GSM0480_OP_CODE_* for possible values.
Definition: gsm0480.h:62
ss_request::ussd_data_len
uint8_t ussd_data_len
Definition: gsm0480.h:88
ss_request::ussd_data
uint8_t ussd_data[GSM0480_USSD_OCTET_STRING_LEN]
Represents the data of either an INVOKE, either a RETURN_RESULT component 'as is'.
Definition: gsm0480.h:87
ss_request::ussd_data_dcs
uint8_t ussd_data_dcs
Definition: gsm0480.h:89
ss_request::ussd_text
uint8_t ussd_text[GSM0480_USSD_OCTET_STRING_LEN]
A rudiment of deprecated 'ussd_request' structure.
Definition: gsm0480.h:77
ss_request::invoke_id
uint8_t invoke_id
GSM TS 04.80, section 3.6.3 "Component ID tag" The term Component ID refers to the Invoke ID or the L...
Definition: gsm0480.h:101
ss_request::transaction_id
uint8_t transaction_id
GSM TS 04.80, section 3.3 "Transaction identifier" See GSM TS 04.07, section 11.2....
Definition: gsm0480.h:95
ss_request::ss_code
uint8_t ss_code
GSM TS 04.80, section 4.4.3.9 "ss-Code" The ss-Code identifier refers to the code which identify a su...
Definition: gsm0480.h:68
ussd_request
Definition: gsm0480.h:43
ussd_request::text
char text[MAX_LEN_USSD_STRING+1]
Definition: gsm0480.h:44
ussd_request::invoke_id
uint8_t invoke_id
Definition: gsm0480.h:46
ussd_request::transaction_id
uint8_t transaction_id
Definition: gsm0480.h:45
value_string