libosmogsm
0.11.0-dirty
Osmocom GSM library
|
Format functions for GSM 04.80. More...
#include <osmocom/gsm/gsm0480.h>
#include <osmocom/gsm/gsm_utils.h>
#include <osmocom/core/logging.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
#include <osmocom/gsm/protocol/gsm_04_80.h>
#include <string.h>
Functions | |
static unsigned char * | msgb_wrap_with_TL (struct msgb *msgb, uint8_t tag) |
static unsigned char * | msgb_push_TLV1 (struct msgb *msgb, uint8_t tag, uint8_t value) |
int | gsm0480_wrap_invoke (struct msgb *msg, int op, int link_id) |
int | gsm0480_wrap_facility (struct msgb *msg) |
struct msgb * | gsm0480_create_unstructuredSS_Notify (int alertPattern, const char *text) |
struct msgb * | gsm0480_create_notifySS (const char *text) |
static int | parse_ss (const struct gsm48_hdr *hdr, uint16_t len, struct ss_request *req) |
static int | parse_ss_facility (const uint8_t *ss_facility, uint16_t len, struct ss_request *req) |
static int | parse_ss_info_elements (const uint8_t *ss_ie, uint16_t len, struct ss_request *req) |
static int | parse_facility_ie (const uint8_t *facility_ie, uint16_t length, struct ss_request *req) |
static int | parse_ss_invoke (const uint8_t *invoke_data, uint16_t length, struct ss_request *req) |
static int | parse_ss_return_result (const uint8_t *rr_data, uint16_t length, struct ss_request *req) |
static int | parse_process_uss_data (const uint8_t *uss_req_data, uint16_t length, struct ss_request *req) |
static int | parse_process_uss_req (const uint8_t *uss_req_data, uint16_t length, struct ss_request *req) |
static int | parse_ss_for_bs_req (const uint8_t *ss_req_data, uint16_t length, struct ss_request *req) |
int | gsm0480_decode_ussd_request (const struct gsm48_hdr *hdr, uint16_t len, struct ussd_request *req) |
int | gsm0480_decode_ss_request (const struct gsm48_hdr *hdr, uint16_t len, struct ss_request *req) |
struct msgb * | gsm0480_create_ussd_resp (uint8_t invoke_id, uint8_t trans_id, const char *text) |
struct gsm48_hdr * | gsm0480_l3hdr_push (struct msgb *msg, uint8_t proto_discr, uint8_t msg_type) |
struct msgb * | gsm0480_create_ussd_notify (int level, const char *text) |
struct msgb * | gsm0480_create_ussd_release_complete (void) |
Format functions for GSM 04.80.
struct msgb* gsm0480_create_notifySS | ( | const char * | text | ) | [read] |
References data, GSM_0480_SEQUENCE_TAG, gsm_7bit_encode_n_ussd(), len, msgb_alloc_headroom(), msgb_put(), msgb_put_u8(), and msgb_tailroom().
struct msgb* gsm0480_create_unstructuredSS_Notify | ( | int | alertPattern, |
const char * | text | ||
) | [read] |
References ASN1_OCTET_STRING_TAG, data, GSM_0480_SEQUENCE_TAG, gsm_7bit_encode_n_ussd(), len, msgb_alloc_headroom(), msgb_put(), msgb_put_u8(), and msgb_tailroom().
Referenced by gsm0480_create_ussd_notify().
struct msgb* gsm0480_create_ussd_notify | ( | int | level, |
const char * | text | ||
) | [read] |
struct msgb* gsm0480_create_ussd_release_complete | ( | void | ) | [read] |
References gsm0480_l3hdr_push(), GSM0480_MTYPE_RELEASE_COMPLETE, GSM48_PDISC_NC_SS, and msgb_alloc_headroom().
struct msgb* gsm0480_create_ussd_resp | ( | uint8_t | invoke_id, |
uint8_t | trans_id, | ||
const char * | text | ||
) | [read] |
References ASN1_OCTET_STRING_TAG, GSM0480_COMPIDTAG_INVOKE_ID, GSM0480_CTYPE_RETURN_RESULT, GSM0480_IE_FACILITY, gsm0480_l3hdr_push(), GSM0480_MTYPE_RELEASE_COMPLETE, GSM0480_OP_CODE_PROCESS_USS_REQ, GSM0480_OPERATION_CODE, GSM48_PDISC_NC_SS, GSM_0480_SEQUENCE_TAG, gsm_7bit_encode_n_ussd(), msgb_alloc_headroom(), msgb_push_TLV1(), msgb_put(), msgb_tailroom(), and msgb_wrap_with_TL().
int gsm0480_decode_ss_request | ( | const struct gsm48_hdr * | hdr, |
uint16_t | len, | ||
struct ss_request * | req | ||
) |
Check Protocol Discriminator see TS GSM 04.07 and GSM 04.80
References gsm48_hdr_pdisc(), GSM48_PDISC_NC_SS, LOGL_ERROR, LOGP, parse_ss(), pdisc, gsm48_hdr::proto_discr, and ss_request::transaction_id.
int gsm0480_decode_ussd_request | ( | const struct gsm48_hdr * | hdr, |
uint16_t | len, | ||
struct ussd_request * | req | ||
) |
struct gsm48_hdr* gsm0480_l3hdr_push | ( | struct msgb * | msg, |
uint8_t | proto_discr, | ||
uint8_t | msg_type | ||
) | [read] |
References msg_type, gsm48_hdr::msg_type, msgb_push(), proto_discr, and gsm48_hdr::proto_discr.
Referenced by gsm0480_create_ussd_notify(), gsm0480_create_ussd_release_complete(), gsm0480_create_ussd_resp(), and gsm411_push_cp_header().
int gsm0480_wrap_facility | ( | struct msgb * | msg | ) |
References GSM0480_IE_FACILITY, and msgb_wrap_with_TL().
Referenced by gsm0480_create_ussd_notify().
int gsm0480_wrap_invoke | ( | struct msgb * | msg, |
int | op, | ||
int | link_id | ||
) |
References GSM0480_COMPIDTAG_INVOKE_ID, GSM0480_CTYPE_INVOKE, GSM0480_OPERATION_CODE, msgb_push_TLV1(), and msgb_wrap_with_TL().
Referenced by gsm0480_create_ussd_notify().
static unsigned char* msgb_push_TLV1 | ( | struct msgb * | msgb, |
uint8_t | tag, | ||
uint8_t | value | ||
) | [inline, static] |
References data, msgb_push(), and value_string::value.
Referenced by gsm0480_create_ussd_resp(), and gsm0480_wrap_invoke().
static unsigned char* msgb_wrap_with_TL | ( | struct msgb * | msgb, |
uint8_t | tag | ||
) | [inline, static] |
References data, msgb::len, and msgb_push().
Referenced by gsm0480_create_ussd_resp(), gsm0480_wrap_facility(), and gsm0480_wrap_invoke().
static int parse_facility_ie | ( | const uint8_t * | facility_ie, |
uint16_t | length, | ||
struct ss_request * | req | ||
) | [static] |
References GSM0480_CTYPE_INVOKE, GSM0480_CTYPE_REJECT, GSM0480_CTYPE_RETURN_ERROR, GSM0480_CTYPE_RETURN_RESULT, LOGL_DEBUG, LOGL_ERROR, LOGP, parse_ss_invoke(), and parse_ss_return_result().
Referenced by parse_ss_facility(), and parse_ss_info_elements().
static int parse_process_uss_data | ( | const uint8_t * | uss_req_data, |
uint16_t | length, | ||
struct ss_request * | req | ||
) | [static] |
References ASN1_IA5_STRING_TAG, DLGLOBAL, GSM0480_USSD_OCTET_STRING_LEN, LOGL_ERROR, LOGP, ss_request::ussd_data, ss_request::ussd_data_dcs, ss_request::ussd_data_len, and ss_request::ussd_text.
Referenced by parse_ss_invoke(), and parse_ss_return_result().
static int parse_process_uss_req | ( | const uint8_t * | uss_req_data, |
uint16_t | length, | ||
struct ss_request * | req | ||
) | [static] |
According to GSM 04.08, 4.4.2 "ASN.1 data types": the USSD-DataCodingScheme shall indicate use of the default alphabet using the 0x0F value.
References ASN1_OCTET_STRING_TAG, dcs, DLGLOBAL, GSM0480_USSD_OCTET_STRING_LEN, GSM_0480_SEQUENCE_TAG, gsm_7bit_decode_n_ussd(), LOGL_ERROR, LOGP, ss_request::ussd_data, ss_request::ussd_data_dcs, ss_request::ussd_data_len, and ss_request::ussd_text.
Referenced by parse_ss_invoke(), and parse_ss_return_result().
static int parse_ss | ( | const struct gsm48_hdr * | hdr, |
uint16_t | len, | ||
struct ss_request * | req | ||
) | [static] |
GSM 04.80 Section 2.5 'Release complete' Table 2.5 payload is optional for 'RELEASE COMPLETE' message
References gsm48_hdr::data, GSM0480_MTYPE_FACILITY, GSM0480_MTYPE_REGISTER, GSM0480_MTYPE_RELEASE_COMPLETE, LOGL_DEBUG, LOGP, msg_type, gsm48_hdr::msg_type, parse_ss_facility(), parse_ss_info_elements(), and ss_request::ussd_text.
Referenced by gsm0480_decode_ss_request(), and gsm0480_decode_ussd_request().
static int parse_ss_facility | ( | const uint8_t * | ss_facility, |
uint16_t | len, | ||
struct ss_request * | req | ||
) | [static] |
References parse_facility_ie().
Referenced by parse_ss().
static int parse_ss_for_bs_req | ( | const uint8_t * | ss_req_data, |
uint16_t | length, | ||
struct ss_request * | req | ||
) | [static] |
References ASN1_OCTET_STRING_TAG, GSM_0480_SEQUENCE_TAG, and ss_request::ss_code.
Referenced by parse_ss_invoke().
static int parse_ss_info_elements | ( | const uint8_t * | ss_ie, |
uint16_t | len, | ||
struct ss_request * | req | ||
) | [static] |
References GSM0480_IE_FACILITY, GSM0480_IE_SS_VERSION, GSM48_IE_CAUSE, iei, LOGL_DEBUG, LOGP, and parse_facility_ie().
Referenced by parse_ss().
static int parse_ss_invoke | ( | const uint8_t * | invoke_data, |
uint16_t | length, | ||
struct ss_request * | req | ||
) | [static] |
References GSM0480_COMPIDTAG_INVOKE_ID, GSM0480_COMPIDTAG_LINKED_ID, GSM0480_OP_CODE_ACTIVATE_SS, GSM0480_OP_CODE_DEACTIVATE_SS, GSM0480_OP_CODE_INTERROGATE_SS, GSM0480_OP_CODE_PROCESS_USS_DATA, GSM0480_OP_CODE_PROCESS_USS_REQ, GSM0480_OP_CODE_USS_NOTIFY, GSM0480_OP_CODE_USS_REQUEST, GSM0480_OPERATION_CODE, ss_request::invoke_id, LOGL_DEBUG, LOGP, ss_request::opcode, parse_process_uss_data(), parse_process_uss_req(), and parse_ss_for_bs_req().
Referenced by parse_facility_ie().
static int parse_ss_return_result | ( | const uint8_t * | rr_data, |
uint16_t | length, | ||
struct ss_request * | req | ||
) | [static] |
References GSM0480_COMPIDTAG_INVOKE_ID, GSM0480_OP_CODE_PROCESS_USS_DATA, GSM0480_OP_CODE_PROCESS_USS_REQ, GSM0480_OP_CODE_USS_NOTIFY, GSM0480_OP_CODE_USS_REQUEST, GSM_0480_SEQUENCE_TAG, ss_request::invoke_id, LOGL_DEBUG, LOGP, ss_request::opcode, parse_process_uss_data(), and parse_process_uss_req().
Referenced by parse_facility_ie().