SMPP: Add command/response field

This commit is contained in:
David Perry 2023-03-07 13:34:34 +00:00 committed by Gilbert Ramirez
parent 248ee51e36
commit 808fcd3c2b
1 changed files with 26 additions and 3 deletions

View File

@ -74,6 +74,8 @@ static int st_smpp_res = -1;
static int st_smpp_res_status = -1;
static int hf_smpp_command_id = -1;
static int hf_smpp_command_request = -1;
static int hf_smpp_command_response = -1;
static int hf_smpp_command_length = -1;
static int hf_smpp_command_status = -1;
static int hf_smpp_sequence_number = -1;
@ -2497,18 +2499,25 @@ dissect_smpp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
* Create display subtree for the PDU
*/
proto_tree_add_uint(smpp_tree, hf_smpp_command_length, tvb, 0, 4, command_length);
if (command_id & SMPP_COMMAND_ID_RESPONSE_MASK) {
ti = proto_tree_add_boolean(smpp_tree, hf_smpp_command_response, tvb, 4, 4, TRUE);
}
else {
ti = proto_tree_add_boolean(smpp_tree, hf_smpp_command_request, tvb, 4, 4, TRUE);
}
proto_item_set_generated(ti);
proto_tree_add_uint(smpp_tree, hf_smpp_command_id, tvb, 4, 4, command_id);
proto_item_append_text(ti, ", Command: %s", command_str);
proto_item_append_text(smpp_tree, ", Command: %s", command_str);
/*
* Status is only meaningful with responses
*/
if (command_id & SMPP_COMMAND_ID_RESPONSE_MASK) {
proto_tree_add_uint(smpp_tree, hf_smpp_command_status, tvb, 8, 4, command_status);
proto_item_append_text (ti, ", Status: \"%s\"", command_status_str);
proto_item_append_text (smpp_tree, ", Status: \"%s\"", command_status_str);
}
proto_tree_add_uint(smpp_tree, hf_smpp_sequence_number, tvb, 12, 4, sequence_number);
proto_item_append_text(ti, ", Seq: %u, Len: %u", sequence_number, command_length);
proto_item_append_text(smpp_tree, ", Seq: %u, Len: %u", sequence_number, command_length);
if (command_length <= tvb_reported_length(tvb))
{
@ -2766,6 +2775,20 @@ proto_register_smpp(void)
HFILL
}
},
{ &hf_smpp_command_request,
{ "Request", "smpp.request",
FT_BOOLEAN, BASE_NONE, NULL, 0x00,
"TRUE if this is a SMPP request.",
HFILL
}
},
{ &hf_smpp_command_response,
{ "Response", "smpp.response",
FT_BOOLEAN, BASE_NONE, NULL, 0x00,
"TRUE if this is a SMPP response.",
HFILL
}
},
{ &hf_smpp_command_status,
{ "Result", "smpp.command_status",
FT_UINT32, BASE_HEX | BASE_RANGE_STRING, RVALS(rvals_command_status), 0x00,