From c052d135624d1051cb44808ce583000a3ba35c03 Mon Sep 17 00:00:00 2001 From: thomasDOTwtf Date: Mon, 21 Jan 2019 00:08:00 +0100 Subject: add variable ie info --- epan/dissectors/packet-dect-nwk.c | 164 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 159 insertions(+), 5 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-dect-nwk.c b/epan/dissectors/packet-dect-nwk.c index a72965cc94..093eeed81c 100644 --- a/epan/dissectors/packet-dect-nwk.c +++ b/epan/dissectors/packet-dect-nwk.c @@ -24,6 +24,12 @@ static gint hf_nwk_msg_type_cc = -1; static gint hf_nwk_msg_type_mm = -1; static gint ett_dect_nwk = -1; +static gint ett_dect_nwk_ie = -1; + +static gint hf_nwk_ie_var_type = -1; +//static gint hf_nwk_ie_fix_single_type = -1; +//static gint hf_nwk_ie_fix_double_type = -1; +static gint hf_nwk_ie_len = -1; static dissector_handle_t dect_nwk_handle; @@ -128,6 +134,27 @@ enum dect_nwk_lce_msg_type { DECT_NWK_LCE_PAGE_REJ = 0x72, }; +/* Section 7.6.1 */ +enum dect_nwk_info_fix_single_type { + DECT_NWK_INFO_FIX_SHIFT = 0x90, + DECT_NWK_INFO_FIX_SEND_COMPLETE = 0xa1, + DECT_NWK_INFO_FIX_DELIMITER_REQ = 0xa2, + DECT_NWK_INFO_FIX_USE_TPUI = 0xa3, + DECT_NWK_INFO_FIX_REPEAT_IND = 0xd0, + DECT_NWK_DOUBLE_OCTET_ELEMENT = 0xe0, +}; + +enum dect_nwk_info_fix_double_type { + DECT_NWK_INFO_FIX_BASIC_SVC = 0xe0, + DECT_NWK_INFO_FIX_REL_REASON = 0xe2, + DECT_NWK_INFO_FIX_SIGNAL = 0xe4, + DECT_NWK_INFO_FIX_TIMER_RESTART = 0xe5, + DECT_NWK_INFO_FIX_TEST_HOOK_C = 0xe6, + DECT_NWK_INFO_FIX_SINGLE_DISP = 0xe8, + DECT_NWK_INFO_FIX_SINGLE_KEYPAD = 0xe9, + DECT_NWK_INFO_FIX_RESERVED = 0xef, +}; + /* Section 7.7.1 */ enum dect_nwk_info_var_type { DECT_NWK_INFO_VAR_INFO_TYPE = 0x01, @@ -311,6 +338,67 @@ static const value_string nwk_lce_msgt_vals[] = { { 0, NULL } }; +/* Section 7.7.1 */ +static const value_string nwk_info_var_vals[] = { + { DECT_NWK_INFO_VAR_INFO_TYPE , "Info Type"}, + { DECT_NWK_INFO_VAR_IDENTITY_TYPE , "Identity Type"}, + { DECT_NWK_INFO_VAR_PORTABLE_ID , "Portable Identity"}, + { DECT_NWK_INFO_VAR_FIXED_ID , "Fixed Identity"}, + { DECT_NWK_INFO_VAR_LOC_AREA , "Location area"}, + { DECT_NWK_INFO_VAR_NWK_ID , "NWK assigned Identity"}, + { DECT_NWK_INFO_VAR_AUTH_TYPE , "AUTH-Type"}, + { DECT_NWK_INFO_VAR_ALLOC_TYPE , "Allocation Type"}, + { DECT_NWK_INFO_VAR_RAND , "RAND"}, + { DECT_NWK_INFO_VAR_RES , "RES"}, + { DECT_NWK_INFO_VAR_RS , "RS"}, + { DECT_NWK_INFO_VAR_IWU_ATTR , "IWU attributes"}, + { DECT_NWK_INFO_VAR_CALL_ATTR , "Call attributes"}, + { DECT_NWK_INFO_VAR_SVC_CHANGE , "Service change info"}, + { DECT_NWK_INFO_VAR_CON_ATTR , "Connection attributes"}, + { DECT_NWK_INFO_VAR_CIPH_INFO , "Cipher Info"}, + { DECT_NWK_INFO_VAR_CALL_ID , "Call identity"}, + { DECT_NWK_INFO_VAR_CON_ID , "Connection identity"}, + { DECT_NWK_INFO_VAR_FACILITY , "Facility"}, + { DECT_NWK_INFO_VAR_PROGRESS_IND , "Progress Indicator"}, + { DECT_NWK_INFO_VAR_MMS_GEN_HEAD , "MMS Generic Header"}, + { DECT_NWK_INFO_VAR_MMS_OBJ_HEAD , "Object Header"}, + { DECT_NWK_INFO_VAR_MMS_EXT_HEAD , "Extended Header"}, + { DECT_NWK_INFO_VAR_TIME_DATE , "Time-Date"}, + { DECT_NWK_INFO_VAR_MULTI_DISP , "Multi Display"}, + { DECT_NWK_INFO_VAR_MULTI_KEYPAD , "Multi-Keypad"}, + { DECT_NWK_INFO_VAR_FEATURE_ACT , "Feature Activate"}, + { DECT_NWK_INFO_VAR_FEATURE_IND , "Feature Indicate"}, + { DECT_NWK_INFO_VAR_NET_PARAM , "Network parameter"}, + { DECT_NWK_INFO_VAR_EXT_HO_IND , "Ext h/o indicator"}, + { DECT_NWK_INFO_VAR_ZAP_FIELD , "ZAP field"}, + { DECT_NWK_INFO_VAR_SVC_CLASS , "Serice Class"}, + { DECT_NWK_INFO_VAR_KEY , "Key"}, + { DECT_NWK_INFO_VAR_REJECT_REASON , "Reject Reason"}, + { DECT_NWK_INFO_VAR_SETUP_CAP , "Setup capability"}, + { DECT_NWK_INFO_VAR_TERM_CAP , "Terminal capability"}, + { DECT_NWK_INFO_VAR_E2E_COMP , "End-to-End compatibility"}, + { DECT_NWK_INFO_VAR_RATE_PARAM , "Rate parameters"}, + { DECT_NWK_INFO_VAR_TRANS_DELAY , "Transit Delay"}, + { DECT_NWK_INFO_VAR_WINDOW_SIZE , "Window size"}, + { DECT_NWK_INFO_VAR_CALLING_NR , "Calling Party Number"}, + { DECT_NWK_INFO_VAR_CALLING_NAME , "Calling Party Name"}, + { DECT_NWK_INFO_VAR_CALLED_NR , "Called Paty Number"}, + { DECT_NWK_INFO_VAR_CALLED_SUBA , "Called Party Subaddr"}, + { DECT_NWK_INFO_VAR_DURATION , "Duration"}, + { DECT_NWK_INFO_VAR_CALLED_NAME , "Called Party Name"}, + { DECT_NWK_INFO_VAR_SEGMENT_INFO , "Segmented Info"}, + { DECT_NWK_INFO_VAR_ALPHANUM , "Alphanumeric"}, + { DECT_NWK_INFO_VAR_IWU2IWU , "IWU-to-IWU"}, + { DECT_NWK_INFO_VAR_MODEL_ID , "Model identifier"}, + { DECT_NWK_INFO_VAR_IWU_PACKET , "IWU-PACKET"}, + { DECT_NWK_INFO_VAR_ESC_PROP , "Escape to proprietary"}, + { DECT_NWK_INFO_VAR_CODEC_LIST , "Codec List"}, + { DECT_NWK_INFO_VAR_EVENTS_NOTI , "Events notification"}, + { DECT_NWK_INFO_VAR_CALL_INFO , "Call information"}, + { DECT_NWK_INFO_VAR_ESC_EXTENSION , "Escape for extension"}, + { 0, NULL } +}; + /* TOOD: value_string for other protocols */ @@ -318,38 +406,94 @@ static const value_string nwk_lce_msgt_vals[] = { * DECT dissector code *********************************************************************************/ +static int dissect_dect_nwk_ie(tvbuff_t *tvb, guint offset, packet_info _U_ *pinfo, proto_tree *tree, void _U_ *data) +{ + guint8 ie_type; + guint8 ie_len; + guint8 type_offset; + guint len; + proto_item *ie_ti; + proto_tree *ie_tree; + + len = tvb_reported_length(tvb); + type_offset = offset; + ie_type = tvb_get_guint8(tvb, offset); + offset++; + + if ((ie_type & 0xf0) == 0xe0) + { + /* double octet ie */ + offset++; + } + else if (ie_type & 0x80) + { + /* single octet ie */ + } + else + { + /* variable length ie */ + ie_len = tvb_get_guint8(tvb, offset); + ie_ti = proto_tree_add_item(tree, hf_nwk_ie_var_type, tvb, type_offset, 1, ENC_NA); + ie_tree = proto_item_add_subtree(ie_ti, ett_dect_nwk_ie); + proto_tree_add_item(ie_tree, hf_nwk_ie_len, tvb, offset, 1, ENC_NA); + offset++; + offset += ie_len; + } + return offset; +} + + static int dissect_dect_nwk_lce(tvbuff_t *tvb, guint8 msg_type, guint offset, packet_info *pinfo, proto_tree *tree, void _U_ *data) { + guint len; + proto_tree_add_item(tree, hf_nwk_msg_type_lce, tvb, offset, 1, ENC_NA); col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(msg_type, nwk_lce_msgt_vals, "Unknown 0x%02x")); offset++; + len = tvb_reported_length(tvb); - /* TOOD: dissection of TLVs/IEs */ + while (offset < len) + { + offset = dissect_dect_nwk_ie(tvb, offset, pinfo, tree, data); + } return offset; } static int dissect_dect_nwk_cc(tvbuff_t *tvb, guint8 msg_type, guint offset, packet_info *pinfo, proto_tree *tree, void _U_ *data) { + guint len; + proto_tree_add_item(tree, hf_nwk_msg_type_cc, tvb, offset, 1, ENC_NA); col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(msg_type, nwk_cc_msgt_vals, "Unknown 0x%02x")); offset++; + len = tvb_reported_length(tvb); - /* TOOD: dissection of TLVs/IEs */ + while (offset < len) + { + offset = dissect_dect_nwk_ie(tvb, offset, pinfo, tree, data); + } return offset; } + static int dissect_dect_nwk_mm(tvbuff_t *tvb, guint8 msg_type, guint offset, packet_info *pinfo, proto_tree *tree, void _U_ *data) { + guint len; + proto_tree_add_item(tree, hf_nwk_msg_type_mm, tvb, offset, 1, ENC_NA); col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str(msg_type, nwk_mm_msgt_vals, "Unknown 0x%02x")); offset++; + len = tvb_reported_length(tvb); - /* TOOD: dissection of TLVs/IEs */ + while (offset < len) + { + offset = dissect_dect_nwk_ie(tvb, offset, pinfo, tree, data); + } return offset; } @@ -362,7 +506,7 @@ static int dissect_dect_nwk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 pdisc, msg_type; guint len; guint offset = 0; - int available_length; + guint available_length; len = tvb_reported_length(tvb); @@ -432,12 +576,22 @@ void proto_register_dect_nwk(void) VALS(nwk_lce_msgt_vals), 0x0, NULL, HFILL } }, - + { &hf_nwk_ie_var_type, + { "Information Element", "dect_nwk.ie_type", FT_UINT8, BASE_HEX, + VALS(nwk_info_var_vals), 0x0, NULL, HFILL + } + }, + { &hf_nwk_ie_len, + { "IE Length", "dect_nwk.ie_len", FT_UINT8, BASE_DEC, + NULL, 0x0, NULL, HFILL + } + } }; static gint *ett[] = { &ett_dect_nwk, + &ett_dect_nwk_ie, }; /* Register protocol */ -- cgit v1.2.3