Several predefined fields and functions are available for a custom protocol. This topic lists all those predefined components.
This section lists predefined fields available in all components: USB, Serial and Network:
packet_ordinalentry_timeFILETIME structure (that is, it is a 64-bit unsigned integer representing the number of 100-nanosecond intervals since January 1, 1601). The time is UTC time.packet_sizecurrent_offsetdevice_sourceSerial Monitor and Serial Bridge add the following predefined fields:
packet_typeA value from PacketType enumeration (std_serialdefs.h). May be one of the following values:
| Constant | Description |
|---|---|
PACKET_CONDISCONNECT | Port connection/disconnection packet. |
PACKET_GENERAL | General packet. Contains either sent (written) or received (read) data. |
PACKET_CREATE | Port open packet. |
PACKET_IO | I/O Request packet. |
is_packet_uptrue if this packet is captured on its way UP or equals false if it is captured on its way DOWN.sending_devicestatusNTSTATUS code, as defined in WDK.The following global functions are available:
get_communications_mode()Returns the current monitoring session's communication mode. See ECommunicationType enumeration defined in std_serialdefs.h. May be one of the following values:
| Constant | Description |
|---|---|
GENERAL_COMMUNICATION | No special communication mode is set. |
PPP_COMMUNICATION | PPP communication mode is configured for a session. |
X0D_COMMUNICATION | “One packet a line” communication mode is configured for a session. |
MODBUS_COMMUNICATION | MODBUS communication mode is configured for a session. |
modbus_is_request_read()true if “Parse requests on WRITE (responses on READ)” global setting is checked, false otherwise.modbus_get_use_rtu()true if RTU mode is configured for MODBUS in settings, false otherwise.USB Monitor adds the following predefined fields and functions:
event_typeUSB packet type. May be one of the following values:
| Constant | Description |
|---|---|
EVENT_URB | USB Request Block. Custom protocol should mainly focus on this packet type. |
EVENT_DEVICECONNECTED | Device connection packet. |
EVENT_DEVICEDISCONNECTED | Device disconnection packet. |
EVENT_DEVICESURPRISEREMOVAL | Device surprise removal packet. |
EVENT_DEVICEQUERYID | Device Query ID packet. |
EVENT_DEVICEQUERYTEXT | Device Query Text packet. |
EVENT_PIPEINFO | Internal packet used to report updated configuration descriptor to the USB Monitor. Should be ignored by custom protocol. |
EVENT_QUERYINTERFACE | Device Query Interface packet. |
is_packet_uptrue if this packet is captured on its way UP or false if it is captured on its way DOWN.usb_get_vendor_name(vendorId)usb_get_model_name(vendorId, modelId)Network Monitor adds the following predefined fields:
fragment_noLONG_MAX.process_idis_send_packettrue for Send packets and false for Receive packets.