NGAP: Handle vnd.3gpp.ngap content-type (TS 39.502)

Change-Id: I35044ede286a2013ad04dc817892f9ff788da6a5
Reviewed-on: https://code.wireshark.org/review/31661
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Anders Broman 2019-01-21 16:41:53 +01:00 committed by Anders Broman
parent c2eef8f888
commit dcaa429a34
9 changed files with 73 additions and 13 deletions

View File

@ -34,6 +34,7 @@
#include "packet-cell_broadcast.h"
#include "packet-ntp.h"
#include "packet-gsm_a_common.h"
#include "packet-http.h"
#define PNAME "NG Application Protocol"
#define PSNAME "NGAP"
@ -46,11 +47,14 @@ void proto_register_ngap(void);
void proto_reg_handoff_ngap(void);
static dissector_handle_t ngap_handle;
static dissector_handle_t ngap_media_type_handle;
static dissector_handle_t nas_5gs_handle;
static dissector_handle_t nr_rrc_ue_radio_paging_info_handle;
static dissector_handle_t nr_rrc_ue_radio_access_cap_info_handle;
static dissector_handle_t lte_rrc_ue_radio_paging_info_handle;
static dissector_table_t ngap_n2_sm_dissector_table;
#include "packet-ngap-val.h"
/* Initialize the protocol and registered fields */
@ -420,6 +424,22 @@ dissect_ngap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
return dissect_NGAP_PDU_PDU(tvb, pinfo, ngap_tree, NULL);
}
/*
* 6.1.6.4.3 N2 SM Information
* N2 SM Information shall encode NG Application Protocol (NGAP) IEs, as specified in subclause 9.3 of 3GPP TS 38.413 [9] (ASN.1 encoded),
* using the vnd.3gpp.ngap content-type.
*/
static int
dissect_ngap_media_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
http_message_info_t *message_info = (http_message_info_t *)data;
if (! message_info->content_id)
return 0;
return (dissector_try_string(ngap_n2_sm_dissector_table, message_info->content_id, tvb, pinfo, tree, NULL)) ? tvb_captured_length(tvb) : 0;
}
/*--- proto_reg_handoff_ngap ---------------------------------------*/
void
proto_reg_handoff_ngap(void)
@ -436,6 +456,9 @@ proto_reg_handoff_ngap(void)
dissector_add_uint("sctp.ppi", NGAP_PROTOCOL_ID, ngap_handle);
Initialized=TRUE;
#include "packet-ngap-dis-tab.c"
dissector_add_string("ngap.n2.sm", "PduSessionResourceReleaseCommandTransfer", create_dissector_handle(dissect_PDUSessionResourceReleaseCommandTransfer_PDU, proto_ngap));
dissector_add_string("media_type", "application/vnd.3gpp.ngap", ngap_media_type_handle);
} else {
if (SctpPort != 0) {
dissector_delete_uint("sctp.port", SctpPort, ngap_handle);
@ -627,6 +650,7 @@ void proto_register_ngap(void) {
/* Register dissector */
ngap_handle = register_dissector("ngap", dissect_ngap, proto_ngap);
ngap_media_type_handle = register_dissector("ngap_media_type", dissect_ngap_media_type, proto_ngap);
/* Register dissector tables */
ngap_ies_dissector_table = register_dissector_table("ngap.ies", "NGAP-PROTOCOL-IES", proto_ngap, FT_UINT32, BASE_DEC);
@ -637,6 +661,10 @@ void proto_register_ngap(void) {
ngap_proc_sout_dissector_table = register_dissector_table("ngap.proc.sout", "NGAP-ELEMENTARY-PROCEDURE SuccessfulOutcome", proto_ngap, FT_UINT32, BASE_DEC);
ngap_proc_uout_dissector_table = register_dissector_table("ngap.proc.uout", "NGAP-ELEMENTARY-PROCEDURE UnsuccessfulOutcome", proto_ngap, FT_UINT32, BASE_DEC);
/* 3GPP TS 29.502 */
ngap_n2_sm_dissector_table = register_dissector_table("ngap.n2.sm", "NGAP N2 SM Information table", proto_ngap, FT_STRING, BASE_NONE);
/* Register configuration options for ports */
ngap_module = prefs_register_protocol(proto_ngap, proto_reg_handoff_ngap);

View File

@ -86,6 +86,7 @@ typedef enum _http_type {
typedef struct _http_message_info_t {
http_type_t type; /**< Message type; may be HTTP_OTHERS if not called by HTTP */
const char *media_str; /**< Content-Type parameters */
const char *content_id; /**< Content-ID parameter */
void *data; /**< The http_type is used to indicate the data transported */
} http_message_info_t;

View File

@ -2006,7 +2006,7 @@ dissect_body_data(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb,
{
http2_data_stream_body_info_t *body_info = get_data_stream_body_info(pinfo);
gchar *content_type = body_info->content_type;
http_message_info_t metadata_used_for_media_type_handle = { HTTP_OTHERS, body_info->content_type_parameters, NULL };
http_message_info_t metadata_used_for_media_type_handle = { HTTP_OTHERS, body_info->content_type_parameters, NULL, NULL };
proto_tree_add_item(tree, hf_http2_data_data, tvb, start, length, encoding);

View File

@ -2017,7 +2017,7 @@ static int dissect_media( const gchar* fullmediatype, tvbuff_t * tvb, packet_inf
gchar *mediatype = wmem_strdup(wmem_packet_scope(), fullmediatype);
gchar *parms_at = strchr(mediatype, ';');
const char *save_match_string = pinfo->match_string;
http_message_info_t message_info = { HTTP_OTHERS, NULL, NULL };
http_message_info_t message_info = { HTTP_OTHERS, NULL, NULL, NULL };
/* Based upon what is done in packet-media.c we set up type and params */
if (NULL != parms_at) {

View File

@ -3022,7 +3022,7 @@ dissect_megaco_LocalRemotedescriptor(tvbuff_t *tvb, proto_tree *megaco_mediadesc
{
gint tokenlen;
tvbuff_t *next_tvb;
http_message_info_t message_info = { SIP_DATA, NULL, NULL };
http_message_info_t message_info = { SIP_DATA, NULL, NULL, NULL };
sdp_setup_info_t setup_info;

View File

@ -457,7 +457,7 @@ dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
int found_match = 0;
gint content_type_len, content_type_parameter_str_len;
gchar *media_type_str_lower_case = NULL;
http_message_info_t message_info = { HTTP_OTHERS, NULL, NULL };
http_message_info_t message_info = { HTTP_OTHERS, NULL, NULL, NULL };
tvbuff_t *next_tvb;
gint parameter_offset;
gint semi_colon_offset;

View File

@ -545,7 +545,7 @@ process_body_part(proto_tree *tree, tvbuff_t *tvb,
proto_tree *subtree;
proto_item *ti;
gint offset = start, next_offset = 0;
http_message_info_t message_info = { input_message_info->type, NULL, NULL };
http_message_info_t message_info = { input_message_info->type, NULL, NULL, NULL };
gint body_start, boundary_start, boundary_line_len;
gchar *content_type_str = NULL;
@ -708,6 +708,9 @@ process_body_part(proto_tree *tree, tvbuff_t *tvb,
filename = ws_find_media_type_parameter(wmem_packet_scope(), value_str, "filename");
}
break;
case POS_CONTENT_ID:
message_info.content_id = wmem_strdup(wmem_packet_scope(), value_str);
break;
default:
break;
}

View File

@ -42,6 +42,7 @@
#include "packet-cell_broadcast.h"
#include "packet-ntp.h"
#include "packet-gsm_a_common.h"
#include "packet-http.h"
#define PNAME "NG Application Protocol"
#define PSNAME "NGAP"
@ -54,11 +55,14 @@ void proto_register_ngap(void);
void proto_reg_handoff_ngap(void);
static dissector_handle_t ngap_handle;
static dissector_handle_t ngap_media_type_handle;
static dissector_handle_t nas_5gs_handle;
static dissector_handle_t nr_rrc_ue_radio_paging_info_handle;
static dissector_handle_t nr_rrc_ue_radio_access_cap_info_handle;
static dissector_handle_t lte_rrc_ue_radio_paging_info_handle;
static dissector_table_t ngap_n2_sm_dissector_table;
/*--- Included file: packet-ngap-val.h ---*/
#line 1 "./asn1/ngap/packet-ngap-val.h"
@ -320,7 +324,7 @@ typedef enum _HandoverType_enum {
} HandoverType_enum;
/*--- End of included file: packet-ngap-val.h ---*/
#line 55 "./asn1/ngap/packet-ngap-template.c"
#line 59 "./asn1/ngap/packet-ngap-template.c"
/* Initialize the protocol and registered fields */
static int proto_ngap = -1;
@ -1047,7 +1051,7 @@ static int hf_ngap_successfulOutcome_value = -1; /* SuccessfulOutcome_value */
static int hf_ngap_unsuccessfulOutcome_value = -1; /* UnsuccessfulOutcome_value */
/*--- End of included file: packet-ngap-hf.c ---*/
#line 90 "./asn1/ngap/packet-ngap-template.c"
#line 94 "./asn1/ngap/packet-ngap-template.c"
/* Initialize the subtree pointers */
static gint ett_ngap = -1;
@ -1495,7 +1499,7 @@ static gint ett_ngap_SuccessfulOutcome = -1;
static gint ett_ngap_UnsuccessfulOutcome = -1;
/*--- End of included file: packet-ngap-ett.c ---*/
#line 117 "./asn1/ngap/packet-ngap-template.c"
#line 121 "./asn1/ngap/packet-ngap-template.c"
static expert_field ei_ngap_number_pages_le15 = EI_INIT;
@ -13539,7 +13543,7 @@ static int dissect_PDUSessionResourceReleaseCommandTransfer_PDU(tvbuff_t *tvb _U
/*--- End of included file: packet-ngap-fn.c ---*/
#line 321 "./asn1/ngap/packet-ngap-template.c"
#line 325 "./asn1/ngap/packet-ngap-template.c"
static int dissect_ProtocolIEFieldValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
@ -13642,6 +13646,22 @@ dissect_ngap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
return dissect_NGAP_PDU_PDU(tvb, pinfo, ngap_tree, NULL);
}
/*
* 6.1.6.4.3 N2 SM Information
* N2 SM Information shall encode NG Application Protocol (NGAP) IEs, as specified in subclause 9.3 of 3GPP TS 38.413 [9] (ASN.1 encoded),
* using the vnd.3gpp.ngap content-type.
*/
static int
dissect_ngap_media_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
http_message_info_t *message_info = (http_message_info_t *)data;
if (! message_info->content_id)
return 0;
return (dissector_try_string(ngap_n2_sm_dissector_table, message_info->content_id, tvb, pinfo, tree, NULL)) ? tvb_captured_length(tvb) : 0;
}
/*--- proto_reg_handoff_ngap ---------------------------------------*/
void
proto_reg_handoff_ngap(void)
@ -13881,7 +13901,10 @@ proto_reg_handoff_ngap(void)
/*--- End of included file: packet-ngap-dis-tab.c ---*/
#line 439 "./asn1/ngap/packet-ngap-template.c"
#line 459 "./asn1/ngap/packet-ngap-template.c"
dissector_add_string("ngap.n2.sm", "PduSessionResourceReleaseCommandTransfer", create_dissector_handle(dissect_PDUSessionResourceReleaseCommandTransfer_PDU, proto_ngap));
dissector_add_string("media_type", "application/vnd.3gpp.ngap", ngap_media_type_handle);
} else {
if (SctpPort != 0) {
dissector_delete_uint("sctp.port", SctpPort, ngap_handle);
@ -16777,7 +16800,7 @@ void proto_register_ngap(void) {
"UnsuccessfulOutcome_value", HFILL }},
/*--- End of included file: packet-ngap-hfarr.c ---*/
#line 582 "./asn1/ngap/packet-ngap-template.c"
#line 605 "./asn1/ngap/packet-ngap-template.c"
};
/* List of subtrees */
@ -17227,7 +17250,7 @@ void proto_register_ngap(void) {
&ett_ngap_UnsuccessfulOutcome,
/*--- End of included file: packet-ngap-ettarr.c ---*/
#line 611 "./asn1/ngap/packet-ngap-template.c"
#line 634 "./asn1/ngap/packet-ngap-template.c"
};
static ei_register_info ei[] = {
@ -17247,6 +17270,7 @@ void proto_register_ngap(void) {
/* Register dissector */
ngap_handle = register_dissector("ngap", dissect_ngap, proto_ngap);
ngap_media_type_handle = register_dissector("ngap_media_type", dissect_ngap_media_type, proto_ngap);
/* Register dissector tables */
ngap_ies_dissector_table = register_dissector_table("ngap.ies", "NGAP-PROTOCOL-IES", proto_ngap, FT_UINT32, BASE_DEC);
@ -17257,6 +17281,10 @@ void proto_register_ngap(void) {
ngap_proc_sout_dissector_table = register_dissector_table("ngap.proc.sout", "NGAP-ELEMENTARY-PROCEDURE SuccessfulOutcome", proto_ngap, FT_UINT32, BASE_DEC);
ngap_proc_uout_dissector_table = register_dissector_table("ngap.proc.uout", "NGAP-ELEMENTARY-PROCEDURE UnsuccessfulOutcome", proto_ngap, FT_UINT32, BASE_DEC);
/* 3GPP TS 29.502 */
ngap_n2_sm_dissector_table = register_dissector_table("ngap.n2.sm", "NGAP N2 SM Information table", proto_ngap, FT_STRING, BASE_NONE);
/* Register configuration options for ports */
ngap_module = prefs_register_protocol(proto_ngap, proto_reg_handoff_ngap);

View File

@ -3339,7 +3339,7 @@ dissect_sip_common(tvbuff_t *tvb, int offset, int remaining_length, packet_info
char cseq_method[MAX_CSEQ_METHOD_SIZE] = "";
char call_id[MAX_CALL_ID_SIZE] = "";
gchar *media_type_str_lower_case = NULL;
http_message_info_t message_info = { SIP_DATA, NULL, NULL };
http_message_info_t message_info = { SIP_DATA, NULL, NULL, NULL };
char *content_encoding_parameter_str = NULL;
guint resend_for_packet = 0;
guint request_for_response = 0;