mirror of git://git.sysmocom.de/ofono
stkutil: Add event list command parser
This commit is contained in:
parent
c02ae417f4
commit
beb01428b7
|
@ -703,7 +703,10 @@ static gboolean parse_dataobj_event_list(struct comprehension_tlv_iter *iter,
|
|||
const unsigned char *data;
|
||||
unsigned int len = comprehension_tlv_iter_get_length(iter);
|
||||
|
||||
if ((len < 1) || (len > sizeof(el->list)))
|
||||
if (len == 0)
|
||||
return TRUE;
|
||||
|
||||
if (len > sizeof(el->list))
|
||||
return FALSE;
|
||||
|
||||
data = comprehension_tlv_iter_get_data(iter);
|
||||
|
@ -2585,6 +2588,29 @@ static gboolean parse_provide_local_info(struct stk_command *command,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean parse_setup_event_list(struct stk_command *command,
|
||||
struct comprehension_tlv_iter *iter)
|
||||
{
|
||||
struct stk_command_setup_event_list *obj = &command->setup_event_list;
|
||||
gboolean ret;
|
||||
|
||||
if (command->src != STK_DEVICE_IDENTITY_TYPE_UICC)
|
||||
return FALSE;
|
||||
|
||||
if (command->dst != STK_DEVICE_IDENTITY_TYPE_TERMINAL)
|
||||
return FALSE;
|
||||
|
||||
ret = parse_dataobj(iter, STK_DATA_OBJECT_TYPE_EVENT_LIST,
|
||||
DATAOBJ_FLAG_MANDATORY | DATAOBJ_FLAG_MINIMUM,
|
||||
&obj->event_list,
|
||||
STK_DATA_OBJECT_TYPE_INVALID);
|
||||
|
||||
if (ret == FALSE)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
struct stk_command *stk_command_new_from_pdu(const unsigned char *pdu,
|
||||
unsigned int len)
|
||||
{
|
||||
|
@ -2682,6 +2708,9 @@ struct stk_command *stk_command_new_from_pdu(const unsigned char *pdu,
|
|||
case STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO:
|
||||
ok = parse_provide_local_info(command, &iter);
|
||||
break;
|
||||
case STK_COMMAND_TYPE_SETUP_EVENT_LIST:
|
||||
ok = parse_setup_event_list(command, &iter);
|
||||
break;
|
||||
default:
|
||||
ok = FALSE;
|
||||
break;
|
||||
|
|
|
@ -883,6 +883,10 @@ struct stk_command_refresh {
|
|||
struct stk_frame_id frame_id;
|
||||
};
|
||||
|
||||
struct stk_command_setup_event_list {
|
||||
struct stk_event_list event_list;
|
||||
};
|
||||
|
||||
struct stk_command {
|
||||
unsigned char number;
|
||||
unsigned char type;
|
||||
|
@ -901,6 +905,7 @@ struct stk_command {
|
|||
struct stk_command_send_sms send_sms;
|
||||
struct stk_command_setup_call setup_call;
|
||||
struct stk_command_refresh refresh;
|
||||
struct stk_command_setup_event_list setup_event_list;
|
||||
};
|
||||
|
||||
void (*destructor)(struct stk_command *command);
|
||||
|
|
Loading…
Reference in New Issue