diff options
Diffstat (limited to 'plugins/profinet')
-rw-r--r-- | plugins/profinet/packet-dcerpc-pn-io.c | 110 |
1 files changed, 109 insertions, 1 deletions
diff --git a/plugins/profinet/packet-dcerpc-pn-io.c b/plugins/profinet/packet-dcerpc-pn-io.c index db36c0ae40..c4579c9709 100644 --- a/plugins/profinet/packet-dcerpc-pn-io.c +++ b/plugins/profinet/packet-dcerpc-pn-io.c @@ -508,6 +508,9 @@ static int hf_pn_io_im_profile_specific_type = -1; static int hf_pn_io_im_version_major = -1; static int hf_pn_io_im_version_minor = -1; static int hf_pn_io_im_supported = -1; +static int hf_pn_io_im_numberofentries = -1; +static int hf_pn_io_im_annotation = -1; +static int hf_pn_io_im_order_id = -1; static int hf_pn_io_number_of_ars = -1; @@ -735,6 +738,7 @@ static const value_string pn_io_block_type[] = { { 0x0030, "I&M0FilterDataSubmodul"}, { 0x0031, "I&M0FilterDataModul"}, { 0x0032, "I&M0FilterDataDevice"}, + { 0x0033, "I&M5Data"}, { 0x8001, "Alarm Ack High"}, { 0x8002, "Alarm Ack Low"}, { 0x0101, "ARBlockReq"}, @@ -3458,6 +3462,26 @@ dissect_IandM4_block(tvbuff_t *tvb, int offset, return offset; } +static int +dissect_IandM5_block(tvbuff_t *tvb, int offset, + packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint8 *drep _U_, guint8 u8BlockVersionHigh, guint8 u8BlockVersionLow) +{ + guint16 u16NumberofEntries; + + if (u8BlockVersionHigh != 1 || u8BlockVersionLow != 0) { + expert_add_info_format(pinfo, item, &ei_pn_io_block_version, + "Block version %u.%u not implemented yet!", u8BlockVersionHigh, u8BlockVersionLow); + return offset; + } + + offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, hf_pn_io_im_numberofentries, &u16NumberofEntries); + + while(u16NumberofEntries > 0) { + offset = dissect_a_block(tvb, offset, pinfo, tree, drep); + u16NumberofEntries--; + } + return offset; +} static int dissect_IandM0FilterData_block(tvbuff_t *tvb, int offset, @@ -3538,6 +3562,70 @@ dissect_IandM0FilterData_block(tvbuff_t *tvb, int offset, } +static int +dissect_IandM5Data_block(tvbuff_t *tvb, int offset, + packet_info *pinfo, proto_tree *tree, proto_item *item _U_, guint8 *drep) +{ + char *pIMAnnotation; + char *pIMOrderID; + guint8 u8VendorIDHigh; + guint8 u8VendorIDLow; + char *pIMSerialNumber; + guint16 u16IMHardwareRevision; + guint8 u8SWRevisionPrefix; + guint8 u8IMSWRevisionFunctionalEnhancement; + guint8 u8IMSWRevisionBugFix; + guint8 u8IMSWRevisionInternalChange; + + /* c8[64] IM Annotation */ + pIMAnnotation = (char *)wmem_alloc(wmem_packet_scope(), 64+1); + tvb_memcpy(tvb, (guint8 *) pIMAnnotation, offset, 64); + pIMAnnotation[64] = '\0'; + proto_tree_add_string(tree, hf_pn_io_im_annotation, tvb, offset, 64, pIMAnnotation); + offset += 64; + + /* c8[64] IM Order ID */ + pIMOrderID = (char *)wmem_alloc(wmem_packet_scope(), 64+1); + tvb_memcpy(tvb, (guint8 *) pIMOrderID, offset, 64); + pIMOrderID[64] = '\0'; + proto_tree_add_string(tree, hf_pn_io_im_order_id, tvb, offset, 64, pIMOrderID); + offset += 64; + + /* x8 VendorIDHigh */ + offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, + hf_pn_io_vendor_id_high, &u8VendorIDHigh); + /* x8 VendorIDLow */ + offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, + hf_pn_io_vendor_id_low, &u8VendorIDLow); + + /* c8[16] IM Serial Number */ + pIMSerialNumber = (char *)wmem_alloc(wmem_packet_scope(), 16+1); + tvb_memcpy(tvb, (guint8 *) pIMSerialNumber, offset, 16); + pIMSerialNumber[16] = '\0'; + proto_tree_add_string(tree, hf_pn_io_im_serial_number, tvb, offset, 16, pIMSerialNumber); + offset += 16; + + /* x16 IM_Hardware_Revision */ + offset = dissect_dcerpc_uint16(tvb, offset, pinfo, tree, drep, + hf_pn_io_im_hardware_revision, &u16IMHardwareRevision); + /* c8 SWRevisionPrefix */ + offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, + hf_pn_io_im_revision_prefix, &u8SWRevisionPrefix); + /* x8 IM_SWRevision_Functional_Enhancement */ + offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, + hf_pn_io_im_sw_revision_functional_enhancement, &u8IMSWRevisionFunctionalEnhancement); + /* x8 IM_SWRevision_Bug_Fix */ + offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, + hf_pn_io_im_revision_bugfix, &u8IMSWRevisionBugFix); + + /* x8 IM_SWRevision_Internal_Change */ + offset = dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, + hf_pn_io_im_sw_revision_internal_change, &u8IMSWRevisionInternalChange); + + return offset; +} + + /* dissect the IdentificationData block */ static int dissect_IdentificationData_block(tvbuff_t *tvb, int offset, @@ -8312,6 +8400,9 @@ dissect_block(tvbuff_t *tvb, int offset, case(0x0024): dissect_IandM4_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; + case(0x0025): + dissect_IandM5_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh,u8BlockVersionLow); + break; case(0x0030): dissect_IandM0FilterData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; @@ -8321,6 +8412,9 @@ dissect_block(tvbuff_t *tvb, int offset, case(0x0032): dissect_IandM0FilterData_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow); break; + case(0x0033): + dissect_IandM5Data_block(tvb, offset, pinfo, sub_tree, sub_item, drep); + break; case(0x0101): dissect_ARBlockReq_block(tvb, offset, pinfo, sub_tree, sub_item, drep, u8BlockVersionHigh, u8BlockVersionLow, ar); @@ -11598,7 +11692,21 @@ proto_register_pn_io (void) FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, - + { &hf_pn_io_im_numberofentries, + { "NumberOfEntries", "pn_io.im_numberofentries", + FT_UINT16, BASE_HEX, NULL, 0x0, + NULL, HFILL } + }, + { &hf_pn_io_im_annotation, + { "IM Annotation", "pn_io.im_annotation", + FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, + { &hf_pn_io_im_order_id, + { "IM Order ID", "pn_io.im_order_id", + FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, { &hf_pn_io_number_of_ars, { "NumberOfARs", "pn_io.number_of_ars", FT_UINT16, BASE_DEC, NULL, 0x0, |