#include <epan/prefs.h>
#include <epan/expert.h>
#include <epan/uat.h>
-
-#ifdef HAVE_LIBGCRYPT
#include <wsutil/wsgcrypt.h>
-#endif /* HAVE_LIBGCRYPT */
/* Define this symbol if you have a working implementation of SNOW3G f8() and f9() available.
Note that the use of this algorithm is restricted, and that an administrative charge
static int hf_pdcp_lte_reserved4 = -1;
static int hf_pdcp_lte_fms2 = -1;
static int hf_pdcp_lte_bitmap = -1;
+static int hf_pdcp_lte_bitmap_byte = -1;
/* Sequence Analysis */
/* Forwad declarations */
static void dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-/* Heuristic dissection */
-static gboolean global_pdcp_lte_heur = FALSE;
-
/* Heuristic dissector looks for supported framing protocol (see wiki page) */
static gboolean dissect_pdcp_lte_heur(tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree, void *data _U_)
gboolean infoAlreadySet = FALSE;
gboolean seqnumLengthTagPresent = FALSE;
- /* This is a heuristic dissector, which means we get all the UDP
- * traffic not sent to a known dissector and not claimed by
- * a heuristic dissector called before us!
- */
-
- if (!global_pdcp_lte_heur) {
- return FALSE;
- }
-
/* Do this again on re-dissection to re-discover offset of actual PDU */
/* Needs to be at least as long as:
write_pdu_label_and_info(root_ti, pinfo, " sn=%-2u ", seqnum);
offset++;
- if (tvb_reported_length_remaining(tvb, offset) == 0) {
+ if (tvb_captured_length_remaining(tvb, offset) == 0) {
/* Only PDCP header was captured, stop dissection here */
return;
}
not_received++;
}
}
- proto_tree_add_text(bitmap_tree, tvb, bit_offset/8, 1, "%s", buff);
+ proto_tree_add_uint_format(bitmap_tree, hf_pdcp_lte_bitmap_byte, tvb, bit_offset/8, 1, bits, "%s", buff);
bit_offset += 8;
}
}
col_append_fstr(pinfo->cinfo, COL_INFO, " MAC=0x%08x (%u bytes data)",
mac, data_length);
}
- else {
+ else if (tvb_captured_length_remaining(payload_tvb, offset)) {
/* User-plane payload here */
/* If not compressed with ROHC, show as user-plane data */
* file is loaded or re-loaded in wireshark */
static void pdcp_lte_init_protocol(void)
{
- /* Destroy any existing hashes. */
- if (pdcp_sequence_analysis_channel_hash) {
- g_hash_table_destroy(pdcp_sequence_analysis_channel_hash);
- }
- if (pdcp_lte_sequence_analysis_report_hash) {
- g_hash_table_destroy(pdcp_lte_sequence_analysis_report_hash);
- }
- if (pdcp_security_hash) {
- g_hash_table_destroy(pdcp_security_hash);
- }
- if (pdcp_security_result_hash) {
- g_hash_table_destroy(pdcp_security_result_hash);
- }
- if (pdcp_security_key_hash) {
- g_hash_table_destroy(pdcp_security_key_hash);
- }
-
-
- /* Now create them over */
pdcp_sequence_analysis_channel_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
pdcp_lte_sequence_analysis_report_hash = g_hash_table_new(pdcp_result_hash_func, pdcp_result_hash_equal);
pdcp_security_hash = g_hash_table_new(pdcp_lte_ueid_hash_func, pdcp_lte_ueid_hash_equal);
pdcp_security_key_hash = g_hash_table_new(pdcp_lte_ueid_hash_func, pdcp_lte_ueid_hash_equal);
}
+static void pdcp_lte_cleanup_protocol(void)
+{
+ g_hash_table_destroy(pdcp_sequence_analysis_channel_hash);
+ g_hash_table_destroy(pdcp_lte_sequence_analysis_report_hash);
+ g_hash_table_destroy(pdcp_security_hash);
+ g_hash_table_destroy(pdcp_security_result_hash);
+ g_hash_table_destroy(pdcp_security_key_hash);
+}
+
void proto_register_pdcp(void)
"Status report bitmap (0=error, 1=OK)", HFILL
}
},
-
+ { &hf_pdcp_lte_bitmap_byte,
+ { "Bitmap byte",
+ "pdcp-lte.bitmap.byte", FT_UINT8, BASE_HEX, NULL, 0x0,
+ NULL, HFILL
+ }
+ },
{ &hf_pdcp_lte_sequence_analysis,
{ "Sequence Analysis",
"Attempt to decode ROHC data",
&global_pdcp_dissect_rohc);
- prefs_register_bool_preference(pdcp_lte_module, "heuristic_pdcp_lte_over_udp",
- "Try Heuristic LTE-PDCP over UDP framing",
- "When enabled, use heuristic dissector to find PDCP-LTE frames sent with "
- "UDP framing",
- &global_pdcp_lte_heur);
+ prefs_register_obsolete_preference(pdcp_lte_module, "heuristic_pdcp_lte_over_udp");
prefs_register_enum_preference(pdcp_lte_module, "layer_to_show",
"Which layer info to show in Info column",
&global_pdcp_check_integrity);
register_init_routine(&pdcp_lte_init_protocol);
+ register_cleanup_routine(&pdcp_lte_cleanup_protocol);
}
void proto_reg_handoff_pdcp_lte(void)
{
/* Add as a heuristic UDP dissector */
- heur_dissector_add("udp", dissect_pdcp_lte_heur, proto_pdcp_lte);
+ heur_dissector_add("udp", dissect_pdcp_lte_heur, "PDCP-LTE over UDP", "pdcp_lte_udp", proto_pdcp_lte, HEURISTIC_DISABLE);
ip_handle = find_dissector("ip");
ipv6_handle = find_dissector("ipv6");