libosmogsm 1.9.0.196-9975
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>
9
10extern const struct value_string gsm0480_comp_type_names[];
11static inline const char *gsm0480_comp_type_name(uint8_t comp_type) {
13}
14
15extern const struct value_string gsm0480_op_code_names[];
16static inline const char *gsm0480_op_code_name(uint8_t 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 */
46 uint8_t invoke_id;
47};
48
49/* deprecated */
50int 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
57struct ss_request {
62 uint8_t opcode;
68 uint8_t ss_code;
69
78
88 uint8_t ussd_data_len; /* Length in bytes */
89 uint8_t ussd_data_dcs; /* Data Coding Scheme */
90
101 uint8_t invoke_id;
102};
103
104int 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);
106int gsm0480_parse_facility_ie(const uint8_t *facility_ie, uint16_t length,
107 struct ss_request *req);
108int gsm0480_decode_ss_request(const struct gsm48_hdr *hdr, uint16_t len,
109 struct ss_request *request);
110
111struct msgb *gsm0480_msgb_alloc_name(const char *name);
112struct msgb *gsm0480_gen_ussd_resp_7bit(uint8_t invoke_id, const char *text);
113struct msgb *gsm0480_gen_return_error(uint8_t invoke_id, uint8_t error_code);
114struct msgb *gsm0480_gen_reject(int invoke_id, uint8_t problem_tag, uint8_t problem_code);
115
116struct msgb *gsm0480_create_ussd_resp(uint8_t invoke_id, uint8_t trans_id, const char *text);
117struct msgb *gsm0480_create_unstructuredSS_Notify(int alertPattern, const char *text);
118struct msgb *gsm0480_create_notifySS(const char *text);
119struct msgb *gsm0480_create_ussd_notify(int level, const char *text);
121 OSMO_DEPRECATED("Use gsm0480_create_release_complete() instead.");
122struct msgb *gsm0480_create_release_complete(uint8_t trans_id);
123
124int gsm0480_wrap_invoke(struct msgb *msg, int op, int link_id);
125int gsm0480_wrap_facility(struct msgb *msg);
const char * name
#define OSMO_DEPRECATED(text)
const char * get_value_string(const struct value_string *vs, uint32_t val)
const struct value_string gsm0480_comp_type_names[]
Definition: gsm0480.c:36
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
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
struct msgb * gsm0480_create_notifySS(const char *text)
Definition: gsm0480.c:137
static const char * gsm0480_op_code_name(uint8_t op_code)
Definition: gsm0480.h:16
int gsm0480_decode_ss_request(const struct gsm48_hdr *hdr, uint16_t len, struct ss_request *request)
Definition: gsm0480.c:350
#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
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
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
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
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
#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
const struct value_string gsm0480_op_code_names[]
Definition: gsm0480.c:44
int gsm0480_wrap_invoke(struct msgb *msg, int op, int link_id)
Definition: gsm0480.c:74
struct msgb * gsm0480_msgb_alloc_name(const char *name)
Definition: gsm0480.c:765
struct msgb * gsm0480_create_ussd_notify(int level, const char *text)
Definition: gsm0480.c:900
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
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
int gsm0480_wrap_facility(struct msgb *msg)
Definition: gsm0480.c:89
struct msgb * gsm0480_create_unstructuredSS_Notify(int alertPattern, const char *text)
Definition: gsm0480.c:96
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
static const char * gsm0480_comp_type_name(uint8_t comp_type)
Definition: gsm0480.h:11
GSM TS 04.08 definitions.
struct gsm48_hdr hdr
Definition: gsm_04_08.h:0
uint8_t len
Definition: gsm_04_11.h:0
GSM TS 04.80 definitions (Supplementary Services Specification, Formats and Coding).
uint8_t msg[0]
Definition: gsm_08_08.h:8
uint8_t length
Definition: gsm_08_08.h:1
uint8_t link_id
Definition: gsm_08_08.h:2
Definition: gsm_04_08.h:941
This structure represents some meaningful parts of a decoded and/or to be encoded GSM 04....
Definition: gsm0480.h:57
uint8_t opcode
GSM TS 04.80, section 3.6.4 "Operation code" See GSM0480_OP_CODE_* for possible values.
Definition: gsm0480.h:62
uint8_t ussd_data_len
Definition: gsm0480.h:88
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
uint8_t ussd_data_dcs
Definition: gsm0480.h:89
uint8_t ussd_text[GSM0480_USSD_OCTET_STRING_LEN]
A rudiment of deprecated 'ussd_request' structure.
Definition: gsm0480.h:77
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
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
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
Definition: gsm0480.h:43
char text[MAX_LEN_USSD_STRING+1]
Definition: gsm0480.h:44
uint8_t invoke_id
Definition: gsm0480.h:46
uint8_t transaction_id
Definition: gsm0480.h:45