From 0104002d2ef03f3fb71558f4b2dd3a7f2b3bdaea Mon Sep 17 00:00:00 2001 From: Ulf Lamping Date: Mon, 2 Apr 2007 05:18:31 +0000 Subject: Add PN-IO FSHelloBlock and PN-DCP Device/AliasName svn path=/trunk/; revision=21298 --- plugins/profinet/packet-dcerpc-pn-io.c | 63 +++++++++++++++++++++++++++++++++- plugins/profinet/packet-pn-dcp.c | 24 +++++++++++-- plugins/profinet/packet-pn-rt.c | 6 ++-- plugins/profinet/packet-pn.h | 7 ++-- 4 files changed, 90 insertions(+), 10 deletions(-) (limited to 'plugins') diff --git a/plugins/profinet/packet-dcerpc-pn-io.c b/plugins/profinet/packet-dcerpc-pn-io.c index 777728a7d0..447ab50182 100644 --- a/plugins/profinet/packet-dcerpc-pn-io.c +++ b/plugins/profinet/packet-dcerpc-pn-io.c @@ -401,6 +401,11 @@ static int hf_pn_io_im_tag_location = -1; static int hf_pn_io_im_date = -1; static int hf_pn_io_im_descriptor = -1; +static int hf_pn_io_fs_hello_mode = -1; +static int hf_pn_io_fs_hello_interval = -1; +static int hf_pn_io_fs_hello_retry = -1; +static int hf_pn_io_fs_hello_delay = -1; + static gint ett_pn_io = -1; static gint ett_pn_io_block = -1; @@ -544,6 +549,7 @@ static const value_string pn_io_block_type[] = { { 0x0240, "PDInterfaceDataReal"}, { 0x0400, "MultipleBlockHeader"}, { 0x0500, "RecordDataReadQuery"}, + { 0x0600, "FSHello"}, { 0x0F00, "MaintenanceItem"}, { 0, NULL } }; @@ -1118,7 +1124,9 @@ static const value_string pn_io_index[] = { { 0xE030, "IsochronousModeData for one AR" }, /*0xE031 - 0xE03F reserved */ { 0xE040, "MultipleWrite" }, - /*0xE041 - 0xEBFF reserved */ + /*0xE041 - 0xE04F reserved */ + { 0xE050, "FastStartUp data for one AR" }, + /*0xE051 - 0xE05F reserved */ /*0xEC00 - 0xEFFF reserved */ /* API specific */ @@ -1397,6 +1405,12 @@ static const value_string pn_io_control_properties_aplication_ready_vals[] = { { 0, NULL } }; +static const value_string pn_io_fs_hello_mode_vals[] = { + { 0x0000, "OFF" }, + { 0x0001, "Send req on LinkUp" }, + { 0x0002, "Send req on LinkUp after HelloDelay" }, + { 0, NULL } +}; static int dissect_block(tvbuff_t *tvb, int offset, @@ -3750,6 +3764,40 @@ dissect_LogData_block(tvbuff_t *tvb, int offset, } +/* dissect the FS Hello block */ +static int +dissect_FSHello_block(tvbuff_t *tvb, int offset, + packet_info *pinfo, proto_tree *tree, proto_item *item, guint8 *drep) +{ + guint32 u32FSHelloMode; + guint32 u32FSHelloInterval; + guint32 u32FSHelloRetry; + guint32 u32FSHelloDelay; + + + offset = dissect_pn_align4(tvb, offset, pinfo, tree); + + /* FSHelloMode */ + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, + hf_pn_io_fs_hello_mode, &u32FSHelloMode); + /* FSHelloInterval */ + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, + hf_pn_io_fs_hello_interval, &u32FSHelloInterval); + /* FSHelloRetry */ + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, + hf_pn_io_fs_hello_retry, &u32FSHelloRetry); + /* FSHelloDelay */ + offset = dissect_dcerpc_uint32(tvb, offset, pinfo, tree, drep, + hf_pn_io_fs_hello_delay, &u32FSHelloDelay); + + proto_item_append_text(item, ": Mode:%s, Interval:%ums, Retry:%u, Delay:%ums", + val_to_str(u32FSHelloMode, pn_io_fs_hello_mode_vals, "0x%x"), + u32FSHelloInterval, u32FSHelloRetry, u32FSHelloDelay); + + return offset; +} + + /* dissect the ARBlockReq */ static int dissect_ARBlockReq(tvbuff_t *tvb, int offset, @@ -4772,6 +4820,9 @@ dissect_block(tvbuff_t *tvb, int offset, case(0x0500): dissect_RecordDataReadQuery_block(tvb, offset, pinfo, sub_tree, sub_item, drep, *u16Index, u16BodyLength); break; + case(0x0600): + dissect_FSHello_block(tvb, offset, pinfo, sub_tree, sub_item, drep); + break; case(0x0f00): dissect_Maintenance_block(tvb, offset, pinfo, sub_tree, sub_item, drep); break; @@ -5168,6 +5219,7 @@ dissect_RecordDataWrite(tvbuff_t *tvb, int offset, case(0x8070): /* PDNCDataCheck for one subslot */ case(0xe030): /* IsochronousModeData for one AR */ + case(0xe050): /* FastStartUp data for one AR */ offset = dissect_block(tvb, offset, pinfo, tree, drep, &u16Index, &u32RecDataLen); break; default: @@ -6139,6 +6191,15 @@ proto_register_pn_io (void) { &hf_pn_io_im_descriptor, { "IM_Descriptor", "pn_io.im_descriptor", FT_STRING, BASE_NONE, NULL, 0x0, "", HFILL }}, + { &hf_pn_io_fs_hello_mode, + { "FSHelloMode", "pn_io.fs_hello_mode", FT_UINT32, BASE_HEX, VALS(pn_io_fs_hello_mode_vals), 0x0, "", HFILL }}, + { &hf_pn_io_fs_hello_interval, + { "FSHelloInterval", "pn_io.fs_hello_interval", FT_UINT32, BASE_DEC, NULL, 0x0, "ms before conveying a second DCP_Hello.req", HFILL }}, + { &hf_pn_io_fs_hello_retry, + { "FSHelloRetry", "pn_io.fs_hello_retry", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }}, + { &hf_pn_io_fs_hello_delay, + { "FSHelloDelay", "pn_io.fs_hello_delay", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }}, + }; static gint *ett[] = { diff --git a/plugins/profinet/packet-pn-dcp.c b/plugins/profinet/packet-pn-dcp.c index 919067e59e..6741f2fd25 100644 --- a/plugins/profinet/packet-pn-dcp.c +++ b/plugins/profinet/packet-pn-dcp.c @@ -77,6 +77,7 @@ static int hf_pn_dcp_suboption_device_nameofstation = -1; static int hf_pn_dcp_suboption_vendor_id = -1; static int hf_pn_dcp_suboption_device_id = -1; static int hf_pn_dcp_suboption_device_role = -1; +static int hf_pn_dcp_suboption_device_aliasname = -1; static int hf_pn_dcp_suboption_dhcp = -1; static int hf_pn_dcp_suboption_dhcp_device_id = -1; @@ -208,6 +209,7 @@ static const value_string pn_dcp_suboption_ip_block_info[] = { #define PNDCP_SUBOPTION_DEVICE_DEV_ID 0x03 #define PNDCP_SUBOPTION_DEVICE_DEV_ROLE 0x04 #define PNDCP_SUBOPTION_DEVICE_DEV_OPTIONS 0x05 +#define PNDCP_SUBOPTION_DEVICE_ALIAS_NAME 0x06 static const value_string pn_dcp_suboption_device[] = { { 0x00, "Reserved" }, @@ -216,7 +218,8 @@ static const value_string pn_dcp_suboption_device[] = { { PNDCP_SUBOPTION_DEVICE_DEV_ID, "Device ID" }, { PNDCP_SUBOPTION_DEVICE_DEV_ROLE, "Device Role" }, { PNDCP_SUBOPTION_DEVICE_DEV_OPTIONS, "Device Options" }, - /*0x06 - 0xff reserved */ + { PNDCP_SUBOPTION_DEVICE_ALIAS_NAME, "Alias Name" }, + /*0x07 - 0xff reserved */ { 0, NULL } }; @@ -412,6 +415,7 @@ dissect_PNDCP_Suboption_Device(tvbuff_t *tvb, int offset, packet_info *pinfo, guint16 device_id; char *typeofstation; char *nameofstation; + char *aliasname; guint16 status=0; @@ -440,7 +444,7 @@ dissect_PNDCP_Suboption_Device(tvbuff_t *tvb, int offset, packet_info *pinfo, tvb_memcpy(tvb, (guint8 *) nameofstation, offset, block_length); nameofstation[block_length] = '\0'; proto_tree_add_string (tree, hf_pn_dcp_suboption_device_nameofstation, tvb, offset, block_length, nameofstation); - pn_append_info(pinfo, dcp_item, ", NameOfStation"); + pn_append_info(pinfo, dcp_item, ep_strdup_printf(", NameOfStation:\"%s\"", nameofstation)); proto_item_append_text(block_item, "Device/NameOfStation"); if(is_response) proto_item_append_text(block_item, ", Status: %u", status); @@ -484,6 +488,18 @@ dissect_PNDCP_Suboption_Device(tvbuff_t *tvb, int offset, packet_info *pinfo, FALSE /* append_col */); } break; + case(PNDCP_SUBOPTION_DEVICE_ALIAS_NAME): + aliasname = ep_alloc(block_length+1); + tvb_memcpy(tvb, (guint8 *) aliasname, offset, block_length); + aliasname[block_length] = '\0'; + proto_tree_add_string (tree, hf_pn_dcp_suboption_device_aliasname, tvb, offset, block_length, aliasname); + pn_append_info(pinfo, dcp_item, ep_strdup_printf(", AliasName:\"%s\"", aliasname)); + proto_item_append_text(block_item, "Device/AliasName"); + if(is_response) + proto_item_append_text(block_item, ", Status: %u", status); + proto_item_append_text(block_item, ", \"%s\"", aliasname); + offset += block_length; + break; default: offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, block_length); } @@ -830,7 +846,7 @@ dissect_PNDCP_Data_heur(tvbuff_t *tvb, u16FrameID = GPOINTER_TO_UINT(pinfo->private_data); /* frame id must be in valid range (acyclic Real-Time, DCP) */ - if (u16FrameID < FRAME_ID_UC || u16FrameID > FRAME_ID_MC_RESP) { + if (u16FrameID < FRAME_ID_DCP_HELLO || u16FrameID > FRAME_ID_DCP_IDENT_RES) { /* we are not interested in this packet */ return FALSE; } @@ -909,6 +925,8 @@ proto_register_pn_dcp (void) { "DeviceID", "pn_dcp.suboption_device_id", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL }}, { &hf_pn_dcp_suboption_device_role, { "Device-role", "pn_dcp.suboption_device_role", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL }}, + { &hf_pn_dcp_suboption_device_aliasname, + { "AliasName", "pn_dcp.suboption_device_aliasname", FT_STRING, BASE_NONE, NULL, 0x0, "", HFILL }}, { &hf_pn_dcp_suboption_dhcp, { "Suboption", "pn_dcp.suboption_dhcp", FT_UINT8, BASE_DEC, VALS(pn_dcp_suboption_dhcp), 0x0, "", HFILL }}, diff --git a/plugins/profinet/packet-pn-rt.c b/plugins/profinet/packet-pn-rt.c index 848840bc0c..7bfadf2d4c 100644 --- a/plugins/profinet/packet-pn-rt.c +++ b/plugins/profinet/packet-pn-rt.c @@ -212,19 +212,19 @@ dissect_pn_rt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) pszProtSummary = "acyclic Real-Time"; pszProtComment = "Real-Time: Acyclic PN-IO Alarm low priority"; } - if (u16FrameID == 0xfefd) { + if (u16FrameID == FRAME_ID_DCP_GETORSET) { pszProtShort = "PN-RTA"; pszProtAddInfo = ""; pszProtSummary = "acyclic Real-Time"; pszProtComment = "Real-Time: DCP (Dynamic Configuration Protocol)"; } - if (u16FrameID == 0xfefe) { + if (u16FrameID == FRAME_ID_DCP_IDENT_REQ) { pszProtShort = "PN-RTA"; pszProtAddInfo = ""; pszProtSummary = "acyclic Real-Time"; pszProtComment = "Real-Time: DCP (Dynamic Configuration Protocol) identify multicast request"; } - if (u16FrameID == 0xfeff) { + if (u16FrameID == FRAME_ID_DCP_IDENT_RES) { pszProtShort = "PN-RTA"; pszProtAddInfo = ""; pszProtSummary = "acyclic Real-Time"; diff --git a/plugins/profinet/packet-pn.h b/plugins/profinet/packet-pn.h index a2ff2013bd..3e7c23cb03 100644 --- a/plugins/profinet/packet-pn.h +++ b/plugins/profinet/packet-pn.h @@ -22,9 +22,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define FRAME_ID_UC 0xfefd -#define FRAME_ID_MC 0xfefe -#define FRAME_ID_MC_RESP 0xfeff +#define FRAME_ID_DCP_HELLO 0xfefc +#define FRAME_ID_DCP_GETORSET 0xfefd +#define FRAME_ID_DCP_IDENT_REQ 0xfefe +#define FRAME_ID_DCP_IDENT_RES 0xfeff extern void init_pn(int proto); -- cgit v1.2.3