Loading...
Searching...
No Matches
gsm0480.h
Go to the documentation of this file.
#pragma once
#include <osmocom/core/defs.h>
#include <osmocom/core/msgb.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
#include <osmocom/gsm/protocol/gsm_04_80.h>
extern const struct value_string gsm0480_comp_type_names[];
static inline const char *gsm0480_comp_type_name(uint8_t comp_type) {
return get_value_string(gsm0480_comp_type_names, comp_type);
}
extern const struct value_string gsm0480_op_code_names[];
static inline const char *gsm0480_op_code_name(uint8_t op_code) {
return get_value_string(gsm0480_op_code_names, op_code);
}
#define GSM0480_USSD_OCTET_STRING_LEN 160
#define GSM0480_USSD_7BIT_STRING_LEN 182
#define MAX_LEN_USSD_STRING 31
/* deprecated */
struct ussd_request {
char text[MAX_LEN_USSD_STRING + 1];
uint8_t transaction_id;
uint8_t invoke_id;
};
/* deprecated */
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");
struct ss_request {
uint8_t opcode;
uint8_t ss_code;
uint8_t ussd_text[GSM0480_USSD_OCTET_STRING_LEN];
uint8_t ussd_data[GSM0480_USSD_OCTET_STRING_LEN];
uint8_t ussd_data_len; /* Length in bytes */
uint8_t ussd_data_dcs; /* Data Coding Scheme */
uint8_t transaction_id;
uint8_t invoke_id;
};
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);
int gsm0480_parse_facility_ie(const uint8_t *facility_ie, uint16_t length,
struct ss_request *req);
int gsm0480_decode_ss_request(const struct gsm48_hdr *hdr, uint16_t len,
struct ss_request *request);
struct msgb *gsm0480_msgb_alloc_name(const char *name);
struct msgb *gsm0480_gen_ussd_resp_7bit(uint8_t invoke_id, const char *text);
struct msgb *gsm0480_gen_return_error(uint8_t invoke_id, uint8_t error_code);
struct msgb *gsm0480_gen_reject(int invoke_id, uint8_t problem_tag, uint8_t problem_code);
struct msgb *gsm0480_create_ussd_resp(uint8_t invoke_id, uint8_t trans_id, const char *text);
struct msgb *gsm0480_create_unstructuredSS_Notify(int alertPattern, const char *text);
struct msgb *gsm0480_create_notifySS(const char *text);
struct msgb *gsm0480_create_ussd_notify(int level, const char *text);
struct msgb *gsm0480_create_ussd_release_complete(void)
OSMO_DEPRECATED("Use gsm0480_create_release_complete() instead.");
struct msgb *gsm0480_create_release_complete(uint8_t trans_id);
int gsm0480_wrap_invoke(struct msgb *msg, int op, int link_id);
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