gsm 04.80: Add value_string for component type and op code

Change-Id: I2615a88db5224d65f37c7cc505e183ec8b196e8a
This commit is contained in:
Harald Welte 2018-06-16 18:34:52 +02:00
parent 6a6a609309
commit b1a35d63b9
3 changed files with 44 additions and 0 deletions

View File

@ -7,6 +7,16 @@
#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);
}
/**
* According to the GSM 04.80 (version 5.0.0) specification Annex A
* "Expanded ASN.1 Module "SS-Protocol", the maximum size of a USSD

View File

@ -3,6 +3,7 @@
/*
* (C) 2010 by Holger Hans Peter Freyther <zecke@selfish.org>
* (C) 2009 by Mike Haben <michael.haben@btinternet.com>
* (C) 2018 by Harald Welte <laforge@gnumonks.org>
*
* All Rights Reserved
*
@ -35,6 +36,37 @@
#include <string.h>
#include <errno.h>
const struct value_string gsm0480_comp_type_names[] = {
{ GSM0480_CTYPE_INVOKE, "Invoke" },
{ GSM0480_CTYPE_RETURN_RESULT, "ReturnResult" },
{ GSM0480_CTYPE_RETURN_ERROR, "ReturnError" },
{ GSM0480_CTYPE_REJECT, "Reject" },
{ 0, NULL }
};
const struct value_string gsm0480_op_code_names[] = {
{ GSM0480_OP_CODE_REGISTER_SS, "RegisterSS" },
{ GSM0480_OP_CODE_ERASE_SS, "EraseSS" },
{ GSM0480_OP_CODE_ACTIVATE_SS, "ActivateSS" },
{ GSM0480_OP_CODE_DEACTIVATE_SS, "DeactivateSS" },
{ GSM0480_OP_CODE_INTERROGATE_SS, "IngerrogateSS" },
{ GSM0480_OP_CODE_NOTIFY_SS, "NotifySS" },
{ GSM0480_OP_CODE_REGISTER_PASSWORD, "RegisterPassword" },
{ GSM0480_OP_CODE_GET_PASSWORD, "GetPassword" },
{ GSM0480_OP_CODE_PROCESS_USS_DATA, "ProcessUSSD" },
{ GSM0480_OP_CODE_FORWARD_CHECK_SS_IND, "ForwardChecckSSind" },
{ GSM0480_OP_CODE_PROCESS_USS_REQ, "ProcessUssReq" },
{ GSM0480_OP_CODE_USS_REQUEST, "UssRequest" },
{ GSM0480_OP_CODE_USS_NOTIFY, "UssNotify" },
{ GSM0480_OP_CODE_FORWARD_CUG_INFO, "ForwardCugInfo" },
{ GSM0480_OP_CODE_SPLIT_MPTY, "SplitMPTY" },
{ GSM0480_OP_CODE_RETRIEVE_MPTY, "RetrieveMPTY" },
{ GSM0480_OP_CODE_HOLD_MPTY, "HoldMPTY" },
{ GSM0480_OP_CODE_BUILD_MPTY, "BuildMPTY" },
{ GSM0480_OP_CODE_FORWARD_CHARGE_ADVICE, "ForwardChargeAdvice" },
{ 0, NULL }
};
static inline unsigned char *msgb_wrap_with_TL(struct msgb *msgb, uint8_t tag)
{
uint8_t *data = msgb_push(msgb, 2);

View File

@ -95,6 +95,8 @@ gsm0480_decode_ussd_request;
gsm0480_decode_ss_request;
gsm0480_wrap_facility;
gsm0480_wrap_invoke;
gsm0480_comp_type_names;
gsm0480_op_code_names;
gsm0502_calc_paging_group;