1 /* packet-openwire.c
2  * Routines for ActiveMQ OpenWire protocol
3  *
4  * metatech <metatechbe@gmail.com>
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * SPDX-License-Identifier: GPL-2.0-or-later
11  */
12 
13 /*
14     OpenWire has two wire formats :
15     - "loose" : more verbose, less CPU-intensive, less network-intensive (1-pass)
16     - "tight" : more compact, more CPU-intensive, more network-intensive (2-pass)
17     This dissector only supports the "loose" syntax, which is not the default.
18     This dissector only supports version 6 of the protocol.
19     It can be changed on the broker in the activemq.xml file by specifying "tightEncodingEnabled=false" :
20 
21     <transportConnectors>
22         <transportConnector name="tcp-connector" uri="tcp://0.0.0.0:61616?wireFormat.tightEncodingEnabled=false&amp;wireFormat.cacheEnabled=false"/>
23     </transportConnectors>
24 
25     Note : The WIREFORMAT_INFO command is always sent in "loose" format.
26 
27 */
28 #include "config.h"
29 
30 #include <epan/packet.h>
31 #include <epan/exceptions.h>
32 #include <epan/prefs.h>
33 #include <epan/expert.h>
34 #include "packet-tcp.h"
35 
36 void proto_register_openwire(void);
37 void proto_reg_handoff_openwire(void);
38 
39 static int proto_openwire = -1;
40 static int hf_openwire_none = -1;
41 static int hf_openwire_length = -1;
42 static int hf_openwire_command = -1;
43 
44 static int hf_openwire_command_id = -1;
45 static int hf_openwire_command_response_required = -1;
46 
47 static int hf_openwire_response_correlationid = -1;
48 
49 static int hf_openwire_dataresponse_data = -1;
50 
51 static int hf_openwire_exceptionresponse_exception = -1;
52 
53 static int hf_openwire_connectionerror_exception = -1;
54 static int hf_openwire_connectionerror_connectionid = -1;
55 
56 static int hf_openwire_controlcommand_command = -1;
57 
58 static int hf_openwire_wireformatinfo_magic = -1;
59 static int hf_openwire_wireformatinfo_version = -1;
60 static int hf_openwire_wireformatinfo_data = -1;
61 static int hf_openwire_wireformatinfo_length = -1;
62 
63 static int hf_openwire_sessioninfo_sessionid = -1;
64 
65 static int hf_openwire_connectioninfo_connectionid = -1;
66 static int hf_openwire_connectioninfo_clientid = -1;
67 static int hf_openwire_connectioninfo_password = -1;
68 static int hf_openwire_connectioninfo_username = -1;
69 static int hf_openwire_connectioninfo_brokerpath = -1;
70 static int hf_openwire_connectioninfo_brokermasterconnector = -1;
71 static int hf_openwire_connectioninfo_manageable = -1;
72 static int hf_openwire_connectioninfo_clientmaster = -1;
73 static int hf_openwire_connectioninfo_faulttolerant = -1;
74 static int hf_openwire_connectioninfo_failoverreconnect = -1;
75 
76 static int hf_openwire_destinationinfo_connectionid = -1;
77 static int hf_openwire_destinationinfo_destination = -1;
78 static int hf_openwire_destinationinfo_operationtype = -1;
79 static int hf_openwire_destinationinfo_timeout = -1;
80 static int hf_openwire_destinationinfo_brokerpath = -1;
81 
82 static int hf_openwire_brokerinfo_brokerid = -1;
83 static int hf_openwire_brokerinfo_brokerurl = -1;
84 static int hf_openwire_brokerinfo_peerbrokerinfos = -1;
85 static int hf_openwire_brokerinfo_brokername = -1;
86 static int hf_openwire_brokerinfo_slavebroker = -1;
87 static int hf_openwire_brokerinfo_masterbroker = -1;
88 static int hf_openwire_brokerinfo_faulttolerantconfiguration = -1;
89 static int hf_openwire_brokerinfo_duplexconnection = -1;
90 static int hf_openwire_brokerinfo_networkconnection = -1;
91 static int hf_openwire_brokerinfo_connectionid = -1;
92 static int hf_openwire_brokerinfo_brokeruploadurl = -1;
93 static int hf_openwire_brokerinfo_networkproperties = -1;
94 
95 static int hf_openwire_connectioncontrol_close = -1;
96 static int hf_openwire_connectioncontrol_exit = -1;
97 static int hf_openwire_connectioncontrol_faulttolerant = -1;
98 static int hf_openwire_connectioncontrol_resume = -1;
99 static int hf_openwire_connectioncontrol_suspend = -1;
100 static int hf_openwire_connectioncontrol_connectedbrokers = -1;
101 static int hf_openwire_connectioncontrol_reconnectto = -1;
102 static int hf_openwire_connectioncontrol_rebalanceconnection = -1;
103 
104 static int hf_openwire_consumercontrol_destination = -1;
105 static int hf_openwire_consumercontrol_close = -1;
106 static int hf_openwire_consumercontrol_consumerid = -1;
107 static int hf_openwire_consumercontrol_prefetch = -1;
108 static int hf_openwire_consumercontrol_flush = -1;
109 static int hf_openwire_consumercontrol_start = -1;
110 static int hf_openwire_consumercontrol_stop = -1;
111 
112 static int hf_openwire_consumerinfo_consumerid = -1;
113 static int hf_openwire_consumerinfo_browser = -1;
114 static int hf_openwire_consumerinfo_destination = -1;
115 static int hf_openwire_consumerinfo_prefetchsize = -1;
116 static int hf_openwire_consumerinfo_maximumpendingmessagelimit = -1;
117 static int hf_openwire_consumerinfo_dispatchasync = -1;
118 static int hf_openwire_consumerinfo_selector = -1;
119 static int hf_openwire_consumerinfo_subscriptionname = -1;
120 static int hf_openwire_consumerinfo_nolocal = -1;
121 static int hf_openwire_consumerinfo_exclusive = -1;
122 static int hf_openwire_consumerinfo_retroactive = -1;
123 static int hf_openwire_consumerinfo_priority = -1;
124 static int hf_openwire_consumerinfo_brokerpath = -1;
125 static int hf_openwire_consumerinfo_additionalpredicate = -1;
126 static int hf_openwire_consumerinfo_networksubscription = -1;
127 static int hf_openwire_consumerinfo_optimizedacknowledge = -1;
128 static int hf_openwire_consumerinfo_norangeacks = -1;
129 static int hf_openwire_consumerinfo_networkconsumerpath = -1;
130 
131 static int hf_openwire_producerinfo_producerid = -1;
132 static int hf_openwire_producerinfo_destination = -1;
133 static int hf_openwire_producerinfo_brokerpath = -1;
134 static int hf_openwire_producerinfo_dispatchasync = -1;
135 static int hf_openwire_producerinfo_windowsize = -1;
136 
137 static int hf_openwire_removeinfo_objectid = -1;
138 static int hf_openwire_removeinfo_lastdeliveredsequenceid = -1;
139 
140 static int hf_openwire_removesubscriptioninfo_connectionid = -1;
141 static int hf_openwire_removesubscriptioninfo_subscriptionname = -1;
142 static int hf_openwire_removesubscriptioninfo_clientid = -1;
143 
144 static int hf_openwire_transactioninfo_connectionid = -1;
145 static int hf_openwire_transactioninfo_transactionid = -1;
146 static int hf_openwire_transactioninfo_type = -1;
147 
148 static int hf_openwire_producerack_producerid = -1;
149 static int hf_openwire_producerack_size = -1;
150 
151 
152 static int hf_openwire_messagedispatch_consumerid = -1;
153 static int hf_openwire_messagedispatch_destination = -1;
154 static int hf_openwire_messagedispatch_message = -1;
155 static int hf_openwire_messagedispatch_redeliverycounter = -1;
156 
157 static int hf_openwire_messageack_destination = -1;
158 static int hf_openwire_messageack_transactionid = -1;
159 static int hf_openwire_messageack_consumerid = -1;
160 static int hf_openwire_messageack_acktype = -1;
161 static int hf_openwire_messageack_firstmessageid = -1;
162 static int hf_openwire_messageack_lastmessageid = -1;
163 static int hf_openwire_messageack_messagecount = -1;
164 
165 static int hf_openwire_messagepull_consumerid = -1;
166 static int hf_openwire_messagepull_destinationid = -1;
167 static int hf_openwire_messagepull_timeout = -1;
168 static int hf_openwire_messagepull_correlationid = -1;
169 static int hf_openwire_messagepull_messageid = -1;
170 
171 static int hf_openwire_message_producerid = -1;
172 static int hf_openwire_message_destination = -1;
173 static int hf_openwire_message_transactionid = -1;
174 static int hf_openwire_message_originaldestination = -1;
175 static int hf_openwire_message_messageid = -1;
176 static int hf_openwire_message_originaldestinationid = -1;
177 static int hf_openwire_message_groupid = -1;
178 static int hf_openwire_message_groupsequence = -1;
179 static int hf_openwire_message_correlationid = -1;
180 static int hf_openwire_message_persistent = -1;
181 static int hf_openwire_message_expiration = -1;
182 static int hf_openwire_message_priority = -1;
183 static int hf_openwire_message_replyto = -1;
184 static int hf_openwire_message_timestamp = -1;
185 static int hf_openwire_message_type = -1;
186 static int hf_openwire_message_body = -1;
187 static int hf_openwire_message_properties = -1;
188 static int hf_openwire_message_datastructure = -1;
189 static int hf_openwire_message_targetconsumerid = -1;
190 static int hf_openwire_message_compressed = -1;
191 static int hf_openwire_message_redeliverycount = -1;
192 static int hf_openwire_message_brokerpath = -1;
193 static int hf_openwire_message_arrival = -1;
194 static int hf_openwire_message_userid = -1;
195 static int hf_openwire_message_receivedbydfbridge = -1;
196 static int hf_openwire_message_droppable = -1;
197 static int hf_openwire_message_cluster = -1;
198 static int hf_openwire_message_brokerintime = -1;
199 static int hf_openwire_message_brokerouttime = -1;
200 
201 static int hf_openwire_producerid_connectionid = -1;
202 static int hf_openwire_producerid_value = -1;
203 static int hf_openwire_producerid_sessionid = -1;
204 
205 static int hf_openwire_consumerid_connectionid = -1;
206 static int hf_openwire_consumerid_value = -1;
207 static int hf_openwire_consumerid_sessionid = -1;
208 
209 static int hf_openwire_destination_name = -1;
210 
211 static int hf_openwire_messageid_producerid = -1;
212 static int hf_openwire_messageid_producersequenceid = -1;
213 static int hf_openwire_messageid_brokersequenceid = -1;
214 
215 static int hf_openwire_connectionid_value = -1;
216 
217 static int hf_openwire_sessionid_connectionid = -1;
218 static int hf_openwire_sessionid_value = -1;
219 
220 static int hf_openwire_brokerid_value = -1;
221 
222 static int hf_openwire_localtransactionid_value = -1;
223 static int hf_openwire_localtransactionid_connectionid = -1;
224 
225 static int hf_openwire_xatransactionid_formatid = -1;
226 static int hf_openwire_xatransactionid_globaltransactionid = -1;
227 static int hf_openwire_xatransactionid_branchqualifier = -1;
228 
229 static int hf_openwire_map_length = -1;
230 static int hf_openwire_map_key = -1;
231 static int hf_openwire_map_entry = -1;
232 
233 static int hf_openwire_throwable_class = -1;
234 static int hf_openwire_throwable_message = -1;
235 static int hf_openwire_throwable_element = -1;
236 static int hf_openwire_throwable_classname = -1;
237 static int hf_openwire_throwable_methodname = -1;
238 static int hf_openwire_throwable_filename = -1;
239 static int hf_openwire_throwable_linenumber = -1;
240 
241 static int hf_openwire_type_integer = -1;
242 static int hf_openwire_type_short = -1;
243 static int hf_openwire_type_string = -1;
244 static int hf_openwire_type_bytes = -1;
245 static int hf_openwire_type_boolean = -1;
246 static int hf_openwire_type_byte = -1;
247 static int hf_openwire_type_char = -1;
248 static int hf_openwire_type_notnull = -1;
249 static int hf_openwire_type_long = -1;
250 static int hf_openwire_type_float = -1;
251 static int hf_openwire_type_double = -1;
252 static int hf_openwire_type_object = -1;
253 static int hf_openwire_type = -1;
254 
255 static int hf_openwire_cached_inlined = -1;
256 static int hf_openwire_cached_id = -1;
257 static int hf_openwire_cached_enabled = -1;
258 
259 static gint ett_openwire = -1;
260 static gint ett_openwire_type = -1;
261 
262 static expert_field ei_openwire_tight_encoding_not_supported = EI_INIT;
263 static expert_field ei_openwire_encoding_not_supported = EI_INIT;
264 static expert_field ei_openwire_type_not_supported = EI_INIT;
265 static expert_field ei_openwire_command_not_supported = EI_INIT;
266 static expert_field ei_openwire_body_type_not_supported = EI_INIT;
267 
268 static dissector_handle_t openwire_tcp_handle;
269 
270 static gboolean openwire_desegment = TRUE;
271 static gboolean openwire_verbose_type = FALSE;
272 
273 #define OPENWIRE_PORT_TCP    61616
274 
275 #define OPENWIRE_MAGIC_PART_1    0x41637469 /* "Acti" */
276 #define OPENWIRE_MAGIC_PART_2    0x76654D51 /* "veMQ" */
277 
278 #define OPENWIRE_WIREFORMAT_INFO                 1
279 #define OPENWIRE_BROKER_INFO                     2
280 #define OPENWIRE_CONNECTION_INFO                 3
281 #define OPENWIRE_SESSION_INFO                    4
282 #define OPENWIRE_CONSUMER_INFO                   5
283 #define OPENWIRE_PRODUCER_INFO                   6
284 #define OPENWIRE_TRANSACTION_INFO                7
285 #define OPENWIRE_DESTINATION_INFO                8
286 #define OPENWIRE_REMOVE_SUBSCRIPTION_INFO        9
287 #define OPENWIRE_KEEP_ALIVE_INFO                10
288 #define OPENWIRE_SHUTDOWN_INFO                  11
289 #define OPENWIRE_REMOVE_INFO                    12
290 #define OPENWIRE_CONTROL_COMMAND                14
291 #define OPENWIRE_FLUSH_COMMAND                  15
292 #define OPENWIRE_CONNECTION_ERROR               16
293 #define OPENWIRE_CONSUMER_CONTROL               17
294 #define OPENWIRE_CONNECTION_CONTROL             18
295 #define OPENWIRE_PRODUCER_ACK                   19
296 #define OPENWIRE_MESSAGE_PULL                   20
297 #define OPENWIRE_MESSAGE_DISPATCH               21
298 #define OPENWIRE_MESSAGE_ACK                    22
299 #define OPENWIRE_ACTIVEMQ_MESSAGE               23
300 #define OPENWIRE_ACTIVEMQ_BYTES_MESSAGE         24
301 #define OPENWIRE_ACTIVEMQ_MAP_MESSAGE           25
302 #define OPENWIRE_ACTIVEMQ_OBJECT_MESSAGE        26
303 #define OPENWIRE_ACTIVEMQ_STREAM_MESSAGE        27
304 #define OPENWIRE_ACTIVEMQ_TEXT_MESSAGE          28
305 #define OPENWIRE_ACTIVEMQ_BLOB_MESSAGE          29
306 #define OPENWIRE_RESPONSE                       30
307 #define OPENWIRE_EXCEPTION_RESPONSE             31
308 #define OPENWIRE_DATA_RESPONSE                  32
309 #define OPENWIRE_DATA_ARRAY_RESPONSE            33
310 #define OPENWIRE_INTEGER_RESPONSE               34
311 #define OPENWIRE_DISCOVERY_EVENT                40
312 #define OPENWIRE_JOURNAL_ACK                    50
313 #define OPENWIRE_JOURNAL_REMOVE                 52
314 #define OPENWIRE_JOURNAL_TRACE                  53
315 #define OPENWIRE_JOURNAL_TRANSACTION            54
316 #define OPENWIRE_DURABLE_SUBSCRIPTION_INFO      55
317 #define OPENWIRE_PARTIAL_COMMAND                60
318 #define OPENWIRE_PARTIAL_LAST_COMMAND           61
319 #define OPENWIRE_REPLAY                         65
320 #define OPENWIRE_BYTE_TYPE                      70
321 #define OPENWIRE_CHAR_TYPE                      71
322 #define OPENWIRE_SHORT_TYPE                     72
323 #define OPENWIRE_INTEGER_TYPE                   73
324 #define OPENWIRE_LONG_TYPE                      74
325 #define OPENWIRE_DOUBLE_TYPE                    75
326 #define OPENWIRE_FLOAT_TYPE                     76
327 #define OPENWIRE_STRING_TYPE                    77
328 #define OPENWIRE_BOOLEAN_TYPE                   78
329 #define OPENWIRE_BYTE_ARRAY_TYPE                79
330 #define OPENWIRE_MESSAGE_DISPATCH_NOTIFICATION  90
331 #define OPENWIRE_NETWORK_BRIDGE_FILTER          91
332 #define OPENWIRE_ACTIVEMQ_QUEUE                100
333 #define OPENWIRE_ACTIVEMQ_TOPIC                101
334 #define OPENWIRE_ACTIVEMQ_TEMP_QUEUE           102
335 #define OPENWIRE_ACTIVEMQ_TEMP_TOPIC           103
336 #define OPENWIRE_MESSAGE_ID                    110
337 #define OPENWIRE_ACTIVEMQ_LOCAL_TRANSACTION_ID 111
338 #define OPENWIRE_ACTIVEMQ_XA_TRANSACTION_ID    112
339 #define OPENWIRE_CONNECTION_ID                 120
340 #define OPENWIRE_SESSION_ID                    121
341 #define OPENWIRE_CONSUMER_ID                   122
342 #define OPENWIRE_PRODUCER_ID                   123
343 #define OPENWIRE_BROKER_ID                     124
344 
345 static const value_string openwire_opcode_vals[] = {
346     { OPENWIRE_WIREFORMAT_INFO,               "WireFormatInfo" },
347     { OPENWIRE_BROKER_INFO,                   "BrokerInfo" },
348     { OPENWIRE_CONNECTION_INFO,               "ConnectionInfo" },
349     { OPENWIRE_SESSION_INFO,                  "SessionInfo" },
350     { OPENWIRE_CONSUMER_INFO,                 "ConsumerInfo" },
351     { OPENWIRE_PRODUCER_INFO,                 "ProducerInfo" },
352     { OPENWIRE_TRANSACTION_INFO,              "TransactionInfo" },
353     { OPENWIRE_DESTINATION_INFO,              "DestinationInfo" },
354     { OPENWIRE_REMOVE_SUBSCRIPTION_INFO,      "RemoveSubscriptionInfo" },
355     { OPENWIRE_KEEP_ALIVE_INFO,               "KeepAliveInfo" },
356     { OPENWIRE_SHUTDOWN_INFO,                 "ShutdownInfo" },
357     { OPENWIRE_REMOVE_INFO,                   "RemoveInfo" },
358     { OPENWIRE_CONTROL_COMMAND,               "ControlCommand" },
359     { OPENWIRE_FLUSH_COMMAND,                 "FlushCommand" },
360     { OPENWIRE_CONNECTION_ERROR,              "ConnectionError" },
361     { OPENWIRE_CONSUMER_CONTROL,              "ConsumerControl" },
362     { OPENWIRE_CONNECTION_CONTROL,            "ConnectionControl" },
363     { OPENWIRE_PRODUCER_ACK,                  "ProducerAck" },
364     { OPENWIRE_MESSAGE_PULL,                  "MessagePull" },
365     { OPENWIRE_MESSAGE_DISPATCH,              "MessageDispatch" },
366     { OPENWIRE_MESSAGE_ACK,                   "MessageAck" },
367     { OPENWIRE_ACTIVEMQ_MESSAGE,              "ActiveMQMessage" },
368     { OPENWIRE_ACTIVEMQ_BYTES_MESSAGE,        "ActiveMQBytesMessage" },
369     { OPENWIRE_ACTIVEMQ_MAP_MESSAGE,          "ActiveMQMapMessage" },
370     { OPENWIRE_ACTIVEMQ_OBJECT_MESSAGE,       "ActiveMQObjectMessage" },
371     { OPENWIRE_ACTIVEMQ_STREAM_MESSAGE,       "ActiveMQStreamMessage" },
372     { OPENWIRE_ACTIVEMQ_TEXT_MESSAGE,         "ActiveMQTextMessage" },
373     { OPENWIRE_ACTIVEMQ_BLOB_MESSAGE,         "ActiveMQBlobMessage" },
374     { OPENWIRE_RESPONSE,                      "Response" },
375     { OPENWIRE_EXCEPTION_RESPONSE,            "ExceptionResponse" },
376     { OPENWIRE_DATA_RESPONSE,                 "DataResponse" },
377     { OPENWIRE_DATA_ARRAY_RESPONSE,           "DataArrayResponse" },
378     { OPENWIRE_INTEGER_RESPONSE,              "IntegerResponse" },
379     { OPENWIRE_DISCOVERY_EVENT,               "DiscoveryEvent" },
380     { OPENWIRE_JOURNAL_ACK,                   "JournalTopicAck" },
381     { OPENWIRE_JOURNAL_REMOVE,                "JournalQueueAck" },
382     { OPENWIRE_JOURNAL_TRACE,                 "JournalTrace" },
383     { OPENWIRE_JOURNAL_TRANSACTION,           "JournalTransaction" },
384     { OPENWIRE_DURABLE_SUBSCRIPTION_INFO,     "SubscriptionInfo" },
385     { OPENWIRE_PARTIAL_COMMAND,               "PartialCommand" },
386     { OPENWIRE_PARTIAL_LAST_COMMAND,          "LastPartialCommand" },
387     { OPENWIRE_REPLAY,                        "ReplayCommand" },
388     { OPENWIRE_BYTE_TYPE,                     "Byte" },
389     { OPENWIRE_CHAR_TYPE,                     "Char" },
390     { OPENWIRE_SHORT_TYPE,                    "Short" },
391     { OPENWIRE_INTEGER_TYPE,                  "Integer" },
392     { OPENWIRE_LONG_TYPE,                     "Long" },
393     { OPENWIRE_DOUBLE_TYPE,                   "Double" },
394     { OPENWIRE_FLOAT_TYPE,                    "Float" },
395     { OPENWIRE_STRING_TYPE,                   "String" },
396     { OPENWIRE_BOOLEAN_TYPE,                  "Boolean" },
397     { OPENWIRE_BYTE_ARRAY_TYPE,               "ByteArray" },
398     { OPENWIRE_MESSAGE_DISPATCH_NOTIFICATION, "MessageDispatchNotification" },
399     { OPENWIRE_NETWORK_BRIDGE_FILTER,         "NetworkBridgeFilter" },
400     { OPENWIRE_ACTIVEMQ_QUEUE,                "ActiveMQQueue" },
401     { OPENWIRE_ACTIVEMQ_TOPIC,                "ActiveMQTopic" },
402     { OPENWIRE_ACTIVEMQ_TEMP_QUEUE,           "ActiveMQTempQueue" },
403     { OPENWIRE_ACTIVEMQ_TEMP_TOPIC,           "ActiveMQTempTopic" },
404     { OPENWIRE_MESSAGE_ID,                    "MessageId" },
405     { OPENWIRE_ACTIVEMQ_LOCAL_TRANSACTION_ID, "LocalTransactionId" },
406     { OPENWIRE_ACTIVEMQ_XA_TRANSACTION_ID,    "XATransactionId" },
407     { OPENWIRE_CONNECTION_ID,                 "ConnectionId" },
408     { OPENWIRE_SESSION_ID,                    "SessionId" },
409     { OPENWIRE_CONSUMER_ID,                   "ConsumerId" },
410     { OPENWIRE_PRODUCER_ID,                   "ProducerId" },
411     { OPENWIRE_BROKER_ID,                     "BrokerId" },
412     { 0,          NULL }
413 };
414 
415 static value_string_ext openwire_opcode_vals_ext = VALUE_STRING_EXT_INIT(openwire_opcode_vals);
416 
417 #define OPENWIRE_COMMAND_INNER        -5
418 #define OPENWIRE_TYPE_OBJECT_ARRAY    -4
419 #define OPENWIRE_TYPE_CACHED          -3
420 #define OPENWIRE_TYPE_NESTED          -2
421 #define OPENWIRE_TYPE_THROWABLE       -1
422 #define OPENWIRE_TYPE_NULL             0
423 #define OPENWIRE_TYPE_BOOLEAN          1
424 #define OPENWIRE_TYPE_BYTE             2
425 #define OPENWIRE_TYPE_CHAR             3
426 #define OPENWIRE_TYPE_SHORT            4
427 #define OPENWIRE_TYPE_INTEGER          5
428 #define OPENWIRE_TYPE_LONG             6
429 #define OPENWIRE_TYPE_DOUBLE           7
430 #define OPENWIRE_TYPE_FLOAT            8
431 #define OPENWIRE_TYPE_STRING           9
432 #define OPENWIRE_TYPE_BYTE_ARRAY      10
433 #define OPENWIRE_TYPE_MAP             11
434 #define OPENWIRE_TYPE_LIST            12
435 #define OPENWIRE_TYPE_BIG_STRING      13
436 
437 static const value_string openwire_type_vals[] = {
438     { OPENWIRE_TYPE_NULL,                      "Null" },
439     { OPENWIRE_TYPE_BOOLEAN,                   "Boolean" },
440     { OPENWIRE_TYPE_BYTE,                      "Byte" },
441     { OPENWIRE_TYPE_CHAR,                      "Char" },
442     { OPENWIRE_TYPE_SHORT,                     "Short" },
443     { OPENWIRE_TYPE_INTEGER,                   "Integer" },
444     { OPENWIRE_TYPE_LONG,                      "Long" },
445     { OPENWIRE_TYPE_DOUBLE,                    "Double" },
446     { OPENWIRE_TYPE_FLOAT,                     "Float" },
447     { OPENWIRE_TYPE_STRING,                    "String" },
448     { OPENWIRE_TYPE_BYTE_ARRAY,                "ByteArray" },
449     { OPENWIRE_TYPE_MAP,                       "Map" },
450     { OPENWIRE_TYPE_LIST,                      "List" },
451     { OPENWIRE_TYPE_BIG_STRING,                "BigString" },
452     { OPENWIRE_ACTIVEMQ_MESSAGE,               "ActiveMQMessage" },
453     { OPENWIRE_ACTIVEMQ_BYTES_MESSAGE,         "ActiveMQBytesMessage" },
454     { OPENWIRE_ACTIVEMQ_MAP_MESSAGE,           "ActiveMQMapMessage" },
455     { OPENWIRE_ACTIVEMQ_OBJECT_MESSAGE,        "ActiveMQObjectMessage" },
456     { OPENWIRE_ACTIVEMQ_STREAM_MESSAGE,        "ActiveMQStreamMessage" },
457     { OPENWIRE_ACTIVEMQ_TEXT_MESSAGE,          "ActiveMQTextMessage" },
458     { OPENWIRE_ACTIVEMQ_BLOB_MESSAGE,          "ActiveMQBlobMessage" },
459     { OPENWIRE_ACTIVEMQ_QUEUE,                 "ActiveMQQueue" },
460     { OPENWIRE_ACTIVEMQ_TOPIC,                 "ActiveMQTopic" },
461     { OPENWIRE_ACTIVEMQ_TEMP_QUEUE,            "ActiveMQTempQueue" },
462     { OPENWIRE_ACTIVEMQ_TEMP_TOPIC,            "ActiveMQTempTopic" },
463     { OPENWIRE_MESSAGE_ID,                     "MessageId" },
464     { OPENWIRE_ACTIVEMQ_LOCAL_TRANSACTION_ID,  "LocalTransactionId" },
465     { OPENWIRE_ACTIVEMQ_XA_TRANSACTION_ID,     "XATransactionId" },
466     { OPENWIRE_CONNECTION_ID,                  "ConnectionId" },
467     { OPENWIRE_SESSION_ID,                     "SessionId" },
468     { OPENWIRE_CONSUMER_ID,                    "ConsumerId" },
469     { OPENWIRE_PRODUCER_ID,                    "ProducerId" },
470     { OPENWIRE_BROKER_ID,                      "BrokerId" },
471     { OPENWIRE_TYPE_OBJECT_ARRAY,              "ObjectArray" },
472     { OPENWIRE_TYPE_THROWABLE,                 "Throwable" },
473     { 0,                                        NULL }
474 };
475 
476 static value_string_ext openwire_type_vals_ext = VALUE_STRING_EXT_INIT(openwire_type_vals);
477 
478 #define OPENWIRE_TRANSACTIONTYPE_BEGIN              0
479 #define OPENWIRE_TRANSACTIONTYPE_PREPARE            1
480 #define OPENWIRE_TRANSACTIONTYPE_COMMIT_ONE_PHASE   2
481 #define OPENWIRE_TRANSACTIONTYPE_COMMIT_TWO_PHASE   3
482 #define OPENWIRE_TRANSACTIONTYPE_ROLLBACK           4
483 #define OPENWIRE_TRANSACTIONTYPE_RECOVER            5
484 #define OPENWIRE_TRANSACTIONTYPE_FORGET             6
485 #define OPENWIRE_TRANSACTIONTYPE_END                7
486 
487 static const value_string openwire_transaction_type_vals[] = {
488     { OPENWIRE_TRANSACTIONTYPE_BEGIN,                "Begin" },
489     { OPENWIRE_TRANSACTIONTYPE_PREPARE,              "Prepare" },
490     { OPENWIRE_TRANSACTIONTYPE_COMMIT_ONE_PHASE,     "CommitOnePhase" },
491     { OPENWIRE_TRANSACTIONTYPE_COMMIT_TWO_PHASE,     "CommitTwoPhase" },
492     { OPENWIRE_TRANSACTIONTYPE_ROLLBACK,             "Rollback" },
493     { OPENWIRE_TRANSACTIONTYPE_RECOVER,              "Recover" },
494     { OPENWIRE_TRANSACTIONTYPE_FORGET,               "Forget" },
495     { OPENWIRE_TRANSACTIONTYPE_END,                  "End" },
496     { 0,                                             NULL }
497 };
498 
499 static value_string_ext openwire_transaction_type_vals_ext = VALUE_STRING_EXT_INIT(openwire_transaction_type_vals);
500 
501 #define OPENWIRE_MESSAGE_ACK_TYPE_DELIVERED       0
502 #define OPENWIRE_MESSAGE_ACK_TYPE_POISON          1
503 #define OPENWIRE_MESSAGE_ACK_TYPE_STANDARD        2
504 #define OPENWIRE_MESSAGE_ACK_TYPE_REDELIVERED     3
505 #define OPENWIRE_MESSAGE_ACK_TYPE_INDIVIDUAL      4
506 #define OPENWIRE_MESSAGE_ACK_TYPE_UNMATCHED       5
507 
508 static const value_string openwire_message_ack_type_vals[] = {
509     { OPENWIRE_MESSAGE_ACK_TYPE_DELIVERED,         "Delivered" },
510     { OPENWIRE_MESSAGE_ACK_TYPE_POISON,            "Poison" },
511     { OPENWIRE_MESSAGE_ACK_TYPE_STANDARD,          "Standard" },
512     { OPENWIRE_MESSAGE_ACK_TYPE_REDELIVERED,       "Redelivered" },
513     { OPENWIRE_MESSAGE_ACK_TYPE_INDIVIDUAL,        "Individual" },
514     { OPENWIRE_MESSAGE_ACK_TYPE_UNMATCHED,         "Unmatched" },
515     { 0,                                           NULL }
516 };
517 
518 #define OPENWIRE_OPERATION_TYPE_ADD       0
519 #define OPENWIRE_OPERATION_TYPE_REMOVE    1
520 
521 static const value_string openwire_operation_type_vals[] = {
522     { OPENWIRE_OPERATION_TYPE_ADD,          "Add" },
523     { OPENWIRE_OPERATION_TYPE_REMOVE,       "Remove" },
524     { 0,                                    NULL }
525 };
526 
527 typedef struct openwire_conv_data {
528     gboolean caching;
529     gboolean tight;
530 } openwire_conv_data;
531 
532 static void
validate_boolean(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree _U_,int offset,proto_item * boolean_item)533 validate_boolean(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_, int offset, proto_item *boolean_item)
534 {
535     /* Sanity check of boolean : must be 0x00 or 0x01 */
536     guint8 booleanByte;
537     booleanByte = tvb_get_guint8(tvb, offset);
538     if (booleanByte != FALSE && booleanByte != TRUE)
539     {
540         expert_add_info(pinfo, boolean_item, &ei_openwire_encoding_not_supported);
541     }
542 }
543 
544 static int
particularize(int specificField,int genericField)545 particularize(int specificField, int genericField)
546 {
547     return (specificField == hf_openwire_none ? genericField : specificField);
548 }
549 
550 static void
detect_protocol_options(tvbuff_t * tvb,packet_info * pinfo,int offset,int iCommand)551 detect_protocol_options(tvbuff_t *tvb, packet_info *pinfo, int offset, int iCommand)
552 {
553     /* This function is level-2 heuristic to detect the protocol options, after the level-1 heuristic to detect the protocol.
554        The WireFormatInfo structure reliably declares whether tight encoding and/or caching are used.
555        However, only the response must be used, which is the result of the "negotiation" handshake with the server.
556        However, if the capture is started after the connection initial handshake, it must be deduced in a heuristic way.
557        For the sake of generality, we do not consider the handshake, but only the heuristic way.
558     */
559     if (tvb_captured_length_remaining(tvb, offset) >= 12)
560     {
561         /* Only check commands which start with a "OPENWIRE_TYPE_CACHED" object */
562         if (iCommand == OPENWIRE_SESSION_INFO
563             || iCommand == OPENWIRE_DESTINATION_INFO
564             || iCommand == OPENWIRE_CONNECTION_INFO
565             || iCommand == OPENWIRE_CONSUMER_INFO
566             || iCommand == OPENWIRE_PRODUCER_INFO
567             || iCommand == OPENWIRE_BROKER_INFO
568             || iCommand == OPENWIRE_TRANSACTION_INFO
569             || iCommand == OPENWIRE_REMOVE_SUBSCRIPTION_INFO
570             || iCommand == OPENWIRE_MESSAGE_DISPATCH
571             || iCommand == OPENWIRE_MESSAGE_ACK
572             || iCommand == OPENWIRE_MESSAGE_PULL)
573         {
574             conversation_t *conv = NULL;
575             openwire_conv_data *cd = NULL;
576             conv = find_or_create_conversation(pinfo);
577             cd = (openwire_conv_data*)conversation_get_proto_data(conv, proto_openwire);
578             if (!cd)
579             {
580                 guint8 present, type;
581                 gint command_id = 0;
582 
583                 present = tvb_get_guint8(tvb, offset + 10);
584                 type = tvb_get_guint8(tvb, offset + 11);
585                 command_id = tvb_get_ntohl(tvb, offset + 5);
586 
587                 cd = wmem_new(wmem_file_scope(), openwire_conv_data);
588                 cd->caching = FALSE;
589                 cd->tight = FALSE;
590                 if (command_id > (1 << 24))
591                 {
592                     /* If "tight" encoding is enabled, the command_id first byte is non-zero.
593                        This can be misdetected with "loose" encoding if the capture is started after 16 millions commands on the connection,
594                        which we will assume that it happens very rarely.  */
595                     cd->tight = TRUE;
596                 }
597                 else
598                 {
599                     if (present == TRUE && type == OPENWIRE_TYPE_NULL)
600                     {
601                         /* If a cached object is not-null, it should be the "NULL" object.
602                            This can be misdetected with "loose" encoding if the capture is started after 256 cached objects on the connection,
603                            which we will assume that it happens rarely.  */
604                         cd->caching = TRUE;
605                     }
606                 }
607                 conversation_add_proto_data(conv, proto_openwire, cd);
608             }
609         }
610     }
611     else if ((tvb_get_guint8(tvb, 4) == OPENWIRE_KEEP_ALIVE_INFO)
612             && (tvb_captured_length(tvb) == 11))
613     {
614         /* If the capture is started after a long-lived connection is started,
615            a keep-alive command of 11 bytes detects tight encoding (not caching stays unknown).
616         */
617         conversation_t *conv = NULL;
618         openwire_conv_data *cd = NULL;
619         conv = find_or_create_conversation(pinfo);
620         cd = (openwire_conv_data*)conversation_get_proto_data(conv, proto_openwire);
621         if (!cd)
622         {
623             cd = wmem_new(wmem_file_scope(), openwire_conv_data);
624             cd->tight = TRUE;
625             cd->caching = FALSE; /* Dummy value */
626             conversation_add_proto_data(conv, proto_openwire, cd);
627         }
628     }
629 }
630 
631 static gboolean
retrieve_caching(packet_info * pinfo)632 retrieve_caching(packet_info *pinfo)
633 {
634     conversation_t     *conv;
635     openwire_conv_data *cd;
636 
637     conv = find_or_create_conversation(pinfo);
638     cd = (openwire_conv_data*)conversation_get_proto_data(conv, proto_openwire);
639     if (cd) return cd->caching;
640     /* Default : non-caching is recommended */
641     return FALSE;
642 }
643 
644 static gboolean
retrieve_tight(packet_info * pinfo)645 retrieve_tight(packet_info *pinfo)
646 {
647     conversation_t     *conv;
648     openwire_conv_data *cd;
649 
650     conv = find_or_create_conversation(pinfo);
651     cd = (openwire_conv_data*)conversation_get_proto_data(conv, proto_openwire);
652     if (cd && cd->tight) return TRUE;
653     return FALSE;
654 }
655 
656 static int
657 dissect_openwire_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int parentType);
658 
659 static int
dissect_openwire_type(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,int field,int type,int parentType,gboolean nullable)660 dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int field, int type, int parentType, gboolean nullable)
661 {
662     gint        startOffset  = offset;
663     proto_item *boolean_item = NULL;
664     const char *cache_str = "";
665 
666     if (type == OPENWIRE_TYPE_CACHED && retrieve_caching(pinfo) == TRUE && tvb_reported_length_remaining(tvb, offset) >= 3)
667     {
668         guint8 inlined = 0;
669         gint cachedID = 0;
670         proto_item * cached_item = NULL;
671         inlined = tvb_get_guint8(tvb, offset + 0) == TRUE ? TRUE : FALSE;
672         cachedID = tvb_get_ntohs(tvb, offset + 1);
673         cache_str = wmem_strdup_printf(pinfo->pool, " (CachedID: %d)", cachedID);
674         if (openwire_verbose_type)
675         {
676             proto_tree_add_item(tree, hf_openwire_cached_inlined, tvb, offset, 1, ENC_BIG_ENDIAN);
677         }
678         cached_item  = proto_tree_add_item(tree, hf_openwire_cached_id, tvb, offset + 1, 2, ENC_BIG_ENDIAN);
679         if (!openwire_verbose_type)
680         {
681             /* Hide it but allow it in search filters */
682             proto_item_set_hidden(cached_item);
683         }
684         if (inlined == FALSE)
685         {
686             proto_item    *ti;
687             ti = proto_tree_add_item(tree, particularize(field, hf_openwire_type_object), tvb, startOffset, 3, ENC_NA);
688             proto_item_append_text(ti, "%s", cache_str);
689             return 3;
690         }
691         else
692         {
693             offset += 3;
694         }
695     }
696     if (nullable == TRUE && (type == OPENWIRE_TYPE_NESTED || type == OPENWIRE_TYPE_CACHED || type == OPENWIRE_COMMAND_INNER) && tvb_reported_length_remaining(tvb, offset) >= 1)
697     {
698         nullable = tvb_get_guint8(tvb, offset + 0) == FALSE ? TRUE : FALSE;
699         if (openwire_verbose_type)
700         {
701             boolean_item = proto_tree_add_item(tree, hf_openwire_type_notnull, tvb, offset, 1, ENC_BIG_ENDIAN);
702         }
703         validate_boolean(tvb, pinfo, tree, offset, boolean_item);
704         if (nullable == TRUE)
705         {
706             proto_tree_add_item(tree, particularize(field, hf_openwire_none), tvb, offset, 1, ENC_NA);
707             return offset - startOffset + 1;
708         }
709         offset += 1;
710     }
711     if (type == OPENWIRE_COMMAND_INNER && tvb_reported_length_remaining(tvb, offset) >= 1)
712     {
713         proto_item * inner_item = NULL;
714         proto_tree * object_tree = NULL;
715         guint8 iCommand = parentType;
716         iCommand = tvb_get_guint8(tvb, offset + 0);
717         inner_item = proto_tree_add_item(tree, particularize(field, hf_openwire_none), tvb, startOffset, -1, ENC_NA);
718         proto_item_append_text(inner_item, ": %s", val_to_str_ext(iCommand, &openwire_opcode_vals_ext, "Unknown (0x%02x)"));
719         object_tree = proto_item_add_subtree(inner_item, ett_openwire_type);
720         return (1 + dissect_openwire_command(tvb, pinfo, object_tree, offset, parentType));
721     }
722     if ((type == OPENWIRE_TYPE_NESTED || type == OPENWIRE_TYPE_CACHED) && tvb_reported_length_remaining(tvb, offset) >= 1)
723     {
724         type = tvb_get_guint8(tvb, offset + 0);
725         if (openwire_verbose_type)
726         {
727             proto_tree_add_item(tree, hf_openwire_type, tvb, offset, 1, ENC_BIG_ENDIAN);
728         }
729         offset += 1;
730     }
731     if (nullable == TRUE && tvb_reported_length_remaining(tvb, offset) >= 1)
732     {
733         nullable = tvb_get_guint8(tvb, offset + 0) == FALSE ? TRUE : FALSE;
734         if (openwire_verbose_type)
735         {
736             boolean_item = proto_tree_add_item(tree, hf_openwire_type_notnull, tvb, offset, 1, ENC_BIG_ENDIAN);
737         }
738         validate_boolean(tvb, pinfo, tree, offset, boolean_item);
739         if (nullable == TRUE)
740         {
741             proto_tree_add_item(tree, particularize(field, hf_openwire_none), tvb, offset, 1, ENC_NA);
742             return offset - startOffset + 1;
743         }
744         offset += 1;
745     }
746 
747     /* First check for primitives types */
748     if (type == OPENWIRE_TYPE_NULL)
749     {
750         offset += 0;
751     }
752     else if (type == OPENWIRE_TYPE_INTEGER && tvb_reported_length_remaining(tvb, offset) >= 4)
753     {
754         proto_tree_add_item(tree, particularize(field, hf_openwire_type_integer), tvb, offset, 4, ENC_BIG_ENDIAN);
755         offset += 4;
756     }
757     else if (type == OPENWIRE_TYPE_SHORT && tvb_reported_length_remaining(tvb, offset) >= 2)
758     {
759         proto_tree_add_item(tree, particularize(field, hf_openwire_type_short), tvb, offset, 2, ENC_BIG_ENDIAN);
760         offset += 2;
761     }
762     else if (type == OPENWIRE_TYPE_LONG && tvb_reported_length_remaining(tvb, offset) >= 8)
763     {
764         proto_tree_add_item(tree, particularize(field, hf_openwire_type_long), tvb, offset, 8, ENC_BIG_ENDIAN);
765         offset += 8;
766     }
767     else if (type == OPENWIRE_TYPE_BOOLEAN && tvb_reported_length_remaining(tvb, offset) >= 1)
768     {
769         boolean_item = proto_tree_add_item(tree, particularize(field, hf_openwire_type_boolean), tvb, offset, 1, ENC_BIG_ENDIAN);
770         validate_boolean(tvb, pinfo, tree, offset, boolean_item);
771         offset += 1;
772     }
773     else if (type == OPENWIRE_TYPE_BYTE && tvb_reported_length_remaining(tvb, offset) >= 1)
774     {
775         proto_tree_add_item(tree, particularize(field, hf_openwire_type_byte), tvb, offset, 1, ENC_NA);
776         offset += 1;
777     }
778     else if (type == OPENWIRE_TYPE_CHAR && tvb_reported_length_remaining(tvb, offset) >= 2)
779     {
780         proto_tree_add_item(tree, particularize(field, hf_openwire_type_char), tvb, offset, 2, ENC_NA);
781         offset += 2;
782     }
783     else if (type == OPENWIRE_TYPE_FLOAT && tvb_reported_length_remaining(tvb, offset) >= 4)
784     {
785         proto_tree_add_item(tree, particularize(field, hf_openwire_type_float), tvb, offset, 4, ENC_BIG_ENDIAN);
786         offset += 4;
787     }
788     else if (type == OPENWIRE_TYPE_DOUBLE && tvb_reported_length_remaining(tvb, offset) >= 8)
789     {
790         proto_tree_add_item(tree, particularize(field, hf_openwire_type_double), tvb, offset, 8, ENC_BIG_ENDIAN);
791         offset += 8;
792     }
793     else if (type == OPENWIRE_TYPE_STRING && tvb_reported_length_remaining(tvb, offset) >= 2)
794     {
795         gint iStringLength = 0;
796         iStringLength = tvb_get_ntohs(tvb, offset);
797         if (openwire_verbose_type)
798         {
799             proto_tree_add_item(tree, hf_openwire_type_short, tvb, offset, 2, ENC_BIG_ENDIAN);
800         }
801         offset += 2;
802         if (tvb_reported_length_remaining(tvb, offset) >= iStringLength)
803         {
804             proto_tree_add_item(tree, particularize(field, hf_openwire_type_string), tvb, offset, iStringLength, ENC_NA);
805             offset += iStringLength;
806         }
807     }
808     else if (type == OPENWIRE_TYPE_BIG_STRING && tvb_reported_length_remaining(tvb, offset) >= 4)
809     {
810         gint iStringLength = 0;
811         iStringLength = tvb_get_ntohl(tvb, offset);
812         if (openwire_verbose_type)
813         {
814             proto_tree_add_item(tree, hf_openwire_type_integer, tvb, offset, 4, ENC_BIG_ENDIAN);
815         }
816         offset += 4;
817         if (tvb_reported_length_remaining(tvb, offset) >= iStringLength)
818         {
819             proto_tree_add_item(tree, particularize(field, hf_openwire_type_string), tvb, offset, iStringLength, ENC_NA);
820             offset += iStringLength;
821         }
822     }
823     else if (type == OPENWIRE_TYPE_BYTE_ARRAY && tvb_reported_length_remaining(tvb, offset) >= 4)
824     {
825         gint iArrayLength = 0;
826         iArrayLength = tvb_get_ntohl(tvb, offset);
827         if (openwire_verbose_type)
828         {
829             proto_tree_add_item(tree, hf_openwire_type_integer, tvb, offset, 4, ENC_BIG_ENDIAN);
830         }
831         offset += 4;
832         if (tvb_reported_length_remaining(tvb, offset) >= iArrayLength)
833         {
834             proto_item * array_item = NULL;
835             proto_tree * object_tree = NULL;
836             array_item = proto_tree_add_item(tree, particularize(field, hf_openwire_type_bytes), tvb, offset, iArrayLength, ENC_NA);
837             object_tree = proto_item_add_subtree(array_item, ett_openwire_type);
838             if (field == hf_openwire_message_body)
839             {
840                 tvbuff_t* next_tvb = NULL;
841                 if (parentType == OPENWIRE_ACTIVEMQ_TEXT_MESSAGE)
842                 {
843                     dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_none, OPENWIRE_TYPE_BIG_STRING, type, FALSE);
844                     next_tvb = tvb_new_subset_length(tvb, offset, iArrayLength);
845                     add_new_data_source(pinfo, next_tvb, "Body");
846                 }
847                 else if (parentType == OPENWIRE_ACTIVEMQ_MAP_MESSAGE)
848                 {
849                     dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_none, OPENWIRE_TYPE_MAP, type, FALSE);
850                 }
851                 else if (parentType == OPENWIRE_ACTIVEMQ_STREAM_MESSAGE)
852                 {
853                     gint streamOffset = offset;
854                     while (streamOffset < offset + iArrayLength)
855                     {
856                         streamOffset += dissect_openwire_type(tvb, pinfo, object_tree, streamOffset, hf_openwire_none, OPENWIRE_TYPE_NESTED, type, FALSE);
857                     }
858                 }
859                 else if (parentType == OPENWIRE_ACTIVEMQ_BYTES_MESSAGE
860                     || parentType == OPENWIRE_ACTIVEMQ_OBJECT_MESSAGE
861                     || parentType == OPENWIRE_ACTIVEMQ_BLOB_MESSAGE)
862                 {
863                     next_tvb = tvb_new_subset_length(tvb, offset, iArrayLength);
864                     add_new_data_source(pinfo, next_tvb, "Body");
865                     expert_add_info(pinfo, array_item, &ei_openwire_body_type_not_supported);
866                 }
867             }
868             else if (field == hf_openwire_message_properties)
869             {
870                 dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_none, OPENWIRE_TYPE_MAP, type, FALSE);
871             }
872             offset += iArrayLength;
873         }
874     }
875     else if (tvb_reported_length_remaining(tvb, offset) >= 1)
876     {
877         /* Check for complex types */
878         proto_tree    *object_tree;
879         proto_item    *ti;
880         ti = proto_tree_add_item(tree, particularize(field, hf_openwire_type_object), tvb, startOffset, -1, ENC_NA);
881         proto_item_append_text(ti, ": %s", val_to_str_ext(type, &openwire_type_vals_ext, "Unknown (0x%02x)"));
882         proto_item_append_text(ti, "%s", cache_str);
883 
884         object_tree = proto_item_add_subtree(ti, ett_openwire_type);
885 
886         if (type == OPENWIRE_TYPE_OBJECT_ARRAY && tvb_reported_length_remaining(tvb, offset) >= 2)
887         {
888             gint iArrayLength;
889             int iArrayItem = 0;
890             iArrayLength = tvb_get_ntohs(tvb, offset);
891             if (openwire_verbose_type)
892             {
893                 proto_tree_add_item(object_tree, hf_openwire_type_short, tvb, offset + 0, 2, ENC_BIG_ENDIAN);
894             }
895             proto_item_append_text(ti, " (Size : %d)", iArrayLength);
896             offset += 2;
897             for (iArrayItem = 0; iArrayItem < iArrayLength; iArrayItem++)
898             {
899                 if (tvb_reported_length_remaining(tvb, offset) >= 0)
900                 {
901                     offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_none, OPENWIRE_TYPE_NESTED, type, TRUE);
902                 }
903             }
904         }
905         else if (type == OPENWIRE_TYPE_MAP && tvb_reported_length_remaining(tvb, offset) >= 4)
906         {
907             int iMapItem = 0;
908             int iMapLength = 0;
909             iMapLength = tvb_get_ntohl(tvb, offset);
910             if (openwire_verbose_type)
911             {
912                 proto_tree_add_item(object_tree, hf_openwire_map_length, tvb, offset, 4, ENC_BIG_ENDIAN);
913             }
914             proto_item_append_text(ti, " (Size : %d)", iMapLength);
915             offset += 4;
916             for (iMapItem = 0; (iMapItem < iMapLength) && (tvb_reported_length_remaining(tvb, offset) > 0); iMapItem++)
917             {
918                 proto_item * map_entry;
919                 proto_tree * entry_tree;
920                 gint entryStartOffset = offset;
921 
922                 map_entry = proto_tree_add_item(object_tree, hf_openwire_map_entry, tvb, offset, 0, ENC_NA);
923                 entry_tree = proto_item_add_subtree(map_entry, ett_openwire_type);
924 
925                 /* Key */
926                 offset += dissect_openwire_type(tvb, pinfo, entry_tree, offset, hf_openwire_map_key, OPENWIRE_TYPE_STRING, type, FALSE);
927                 /* Value */
928                 offset += dissect_openwire_type(tvb, pinfo, entry_tree, offset, hf_openwire_none, OPENWIRE_TYPE_NESTED, type, FALSE);
929                 proto_item_set_len(map_entry, offset - entryStartOffset);
930             }
931         }
932         else if (type == OPENWIRE_TYPE_THROWABLE && tvb_reported_length_remaining(tvb, offset) >= 2)
933         {
934             gint iStackTraceDepth, iStackTraceItem;
935             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_throwable_class, OPENWIRE_TYPE_STRING, type, TRUE);
936             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_throwable_message, OPENWIRE_TYPE_STRING, type, TRUE);
937             iStackTraceDepth = tvb_get_ntohs(tvb, offset);
938             if (openwire_verbose_type)
939             {
940                 proto_tree_add_item(tree, hf_openwire_type_short, tvb, offset, 2, ENC_BIG_ENDIAN);
941             }
942             offset += 2;
943             if (iStackTraceDepth  > 0)
944             {
945                 for (iStackTraceItem = 0; iStackTraceItem < iStackTraceDepth; iStackTraceItem++)
946                 {
947                     proto_item    *element;
948                     proto_tree    *element_tree;
949                     gint startElementOffset = offset;
950                     element = proto_tree_add_item(object_tree, hf_openwire_throwable_element, tvb, startElementOffset, -1, ENC_NA);
951                     element_tree = proto_item_add_subtree(element, ett_openwire_type);
952 
953                     if (tvb_reported_length_remaining(tvb, offset) >= 0)
954                     {
955                         offset += dissect_openwire_type(tvb, pinfo, element_tree, offset, hf_openwire_throwable_classname, OPENWIRE_TYPE_STRING, type, TRUE);
956                         offset += dissect_openwire_type(tvb, pinfo, element_tree, offset, hf_openwire_throwable_methodname, OPENWIRE_TYPE_STRING, type, TRUE);
957                         offset += dissect_openwire_type(tvb, pinfo, element_tree, offset, hf_openwire_throwable_filename, OPENWIRE_TYPE_STRING, type, TRUE);
958                         offset += dissect_openwire_type(tvb, pinfo, element_tree, offset, hf_openwire_throwable_linenumber, OPENWIRE_TYPE_INTEGER, type, FALSE);
959                         proto_item_set_len(element, offset - startElementOffset);
960                     }
961                 }
962                 offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_exceptionresponse_exception, OPENWIRE_TYPE_THROWABLE, type, TRUE);
963             }
964         }
965         else if (type == OPENWIRE_TYPE_LIST && tvb_reported_length_remaining(tvb, offset) >= 4)
966         {
967             /* TODO (unused) */
968         }
969         else if (type == OPENWIRE_CONNECTION_ID && tvb_reported_length_remaining(tvb, offset) >= 1)
970         {
971             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_connectionid_value, OPENWIRE_TYPE_STRING, type, TRUE);
972         }
973         else if (type == OPENWIRE_SESSION_ID && tvb_reported_length_remaining(tvb, offset) >= 2)
974         {
975             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_sessionid_connectionid, OPENWIRE_TYPE_STRING, type, TRUE);
976             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_sessionid_value, OPENWIRE_TYPE_LONG, type, FALSE);
977         }
978         else if (type == OPENWIRE_CONSUMER_ID && tvb_reported_length_remaining(tvb, offset) >= 3)
979         {
980             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_consumerid_connectionid, OPENWIRE_TYPE_STRING, type, TRUE);
981             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_consumerid_value, OPENWIRE_TYPE_LONG, type, FALSE);
982             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_consumerid_sessionid, OPENWIRE_TYPE_LONG, type, FALSE);
983         }
984         else if (type == OPENWIRE_PRODUCER_ID && tvb_reported_length_remaining(tvb, offset) >= 3)
985         {
986             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_producerid_connectionid, OPENWIRE_TYPE_STRING, type, TRUE);
987             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_producerid_value, OPENWIRE_TYPE_LONG, type, FALSE);
988             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_producerid_sessionid, OPENWIRE_TYPE_LONG, type, FALSE);
989         }
990         else if (type == OPENWIRE_BROKER_ID && tvb_reported_length_remaining(tvb, offset) >= 1)
991         {
992             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_brokerid_value, OPENWIRE_TYPE_STRING, type, TRUE);
993         }
994         else if (type == OPENWIRE_MESSAGE_ID && tvb_reported_length_remaining(tvb, offset) >= 3)
995         {
996             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_messageid_producerid, OPENWIRE_TYPE_CACHED, type, TRUE);
997             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_messageid_producersequenceid, OPENWIRE_TYPE_LONG, type, FALSE);
998             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_messageid_brokersequenceid, OPENWIRE_TYPE_LONG, type, FALSE);
999         }
1000         else if (type == OPENWIRE_ACTIVEMQ_LOCAL_TRANSACTION_ID && tvb_reported_length_remaining(tvb, offset) >= 2)
1001         {
1002             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_localtransactionid_value, OPENWIRE_TYPE_LONG, type, FALSE);
1003             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_localtransactionid_connectionid, OPENWIRE_TYPE_CACHED, type, TRUE);
1004         }
1005         else if (type == OPENWIRE_ACTIVEMQ_XA_TRANSACTION_ID && tvb_reported_length_remaining(tvb, offset) >= 3)
1006         {
1007             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_xatransactionid_formatid, OPENWIRE_TYPE_INTEGER, type, FALSE);
1008             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_xatransactionid_globaltransactionid, OPENWIRE_TYPE_BYTE_ARRAY, type, TRUE);
1009             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_xatransactionid_branchqualifier, OPENWIRE_TYPE_BYTE_ARRAY, type, TRUE);
1010         }
1011         else if ((type == OPENWIRE_ACTIVEMQ_QUEUE
1012             || type == OPENWIRE_ACTIVEMQ_TOPIC
1013             || type == OPENWIRE_ACTIVEMQ_TEMP_QUEUE
1014             || type == OPENWIRE_ACTIVEMQ_TEMP_TOPIC)
1015             && tvb_reported_length_remaining(tvb, offset) >= 1)
1016         {
1017             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_destination_name, OPENWIRE_TYPE_STRING, type, TRUE);
1018         }
1019         else if (type == OPENWIRE_ACTIVEMQ_MESSAGE
1020                 || type == OPENWIRE_ACTIVEMQ_BYTES_MESSAGE
1021                 || type == OPENWIRE_ACTIVEMQ_MAP_MESSAGE
1022                 || type == OPENWIRE_ACTIVEMQ_OBJECT_MESSAGE
1023                 || type == OPENWIRE_ACTIVEMQ_STREAM_MESSAGE
1024                 || type == OPENWIRE_ACTIVEMQ_TEXT_MESSAGE
1025                 || type == OPENWIRE_ACTIVEMQ_BLOB_MESSAGE)
1026         {
1027             if (parentType != type)
1028             {
1029                 offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_command_id, OPENWIRE_TYPE_INTEGER, type, FALSE);
1030                 offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_command_response_required, OPENWIRE_TYPE_BOOLEAN, type, FALSE);
1031             }
1032             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_producerid, OPENWIRE_TYPE_CACHED, type, TRUE);
1033             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_destination, OPENWIRE_TYPE_CACHED, type, TRUE);
1034             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_transactionid, OPENWIRE_TYPE_CACHED, type, TRUE);
1035             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_originaldestination, OPENWIRE_TYPE_CACHED, type, TRUE);
1036             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_messageid, OPENWIRE_TYPE_NESTED, type, TRUE);
1037             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_originaldestinationid, OPENWIRE_TYPE_CACHED, type, TRUE);
1038             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_groupid, OPENWIRE_TYPE_STRING, type, TRUE);
1039             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_groupsequence, OPENWIRE_TYPE_INTEGER, type, FALSE);
1040             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_correlationid, OPENWIRE_TYPE_STRING, type, TRUE);
1041             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_persistent, OPENWIRE_TYPE_BOOLEAN, type, FALSE);
1042             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_expiration, OPENWIRE_TYPE_LONG, type, FALSE);
1043             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_priority, OPENWIRE_TYPE_BYTE, type, FALSE);
1044             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_replyto, OPENWIRE_TYPE_NESTED, type, TRUE);
1045             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_timestamp, OPENWIRE_TYPE_LONG, type, FALSE);
1046             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_type, OPENWIRE_TYPE_STRING, type, TRUE);
1047             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_body, OPENWIRE_TYPE_BYTE_ARRAY, type, TRUE);
1048             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_properties, OPENWIRE_TYPE_BYTE_ARRAY, type, TRUE);
1049             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_datastructure, OPENWIRE_COMMAND_INNER, type, TRUE);
1050             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_targetconsumerid, OPENWIRE_TYPE_CACHED, type, TRUE);
1051             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_compressed, OPENWIRE_TYPE_BOOLEAN, type, FALSE);
1052             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_redeliverycount, OPENWIRE_TYPE_INTEGER, type, FALSE);
1053             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_brokerpath, OPENWIRE_TYPE_OBJECT_ARRAY, type, TRUE);
1054             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_arrival, OPENWIRE_TYPE_LONG, type, FALSE);
1055             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_userid, OPENWIRE_TYPE_STRING, type, TRUE);
1056             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_receivedbydfbridge, OPENWIRE_TYPE_BOOLEAN, type, FALSE);
1057             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_droppable, OPENWIRE_TYPE_BOOLEAN, type, FALSE);
1058             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_cluster, OPENWIRE_TYPE_OBJECT_ARRAY, type, TRUE);
1059             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_brokerintime, OPENWIRE_TYPE_LONG, type, FALSE);
1060             offset += dissect_openwire_type(tvb, pinfo, object_tree, offset, hf_openwire_message_brokerouttime, OPENWIRE_TYPE_LONG, type, FALSE);
1061         }
1062         else if (tvb_reported_length_remaining(tvb, offset) > 0)
1063         {
1064             expert_add_info_format(pinfo, object_tree, &ei_openwire_type_not_supported, "OpenWire type not supported by Wireshark : %d", type);
1065             offset += tvb_captured_length_remaining(tvb, offset);
1066         }
1067         proto_item_set_len(ti, offset - startOffset);
1068 
1069     }
1070     return (offset - startOffset);
1071 }
1072 
1073 static int
dissect_openwire_command(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,int parentType)1074 dissect_openwire_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int parentType)
1075 {
1076     gint   startOffset = offset;
1077     guint8 iCommand;
1078 
1079     iCommand = tvb_get_guint8(tvb, offset + 0);
1080 
1081     proto_tree_add_item(tree, hf_openwire_command, tvb, offset + 0, 1, ENC_BIG_ENDIAN);
1082     offset += 1;
1083 
1084     if (iCommand == OPENWIRE_WIREFORMAT_INFO)
1085     {
1086         if (tvb_reported_length_remaining(tvb, offset) >= 17)
1087         {
1088             proto_tree_add_item(tree, hf_openwire_wireformatinfo_magic, tvb, offset + 0, 8, ENC_ASCII|ENC_NA);
1089             proto_tree_add_item(tree, hf_openwire_wireformatinfo_version, tvb, offset + 8, 4, ENC_BIG_ENDIAN);
1090             proto_tree_add_item(tree, hf_openwire_wireformatinfo_data, tvb, offset + 12, 1, ENC_BIG_ENDIAN);
1091             proto_tree_add_item(tree, hf_openwire_wireformatinfo_length, tvb, offset + 13, 4, ENC_BIG_ENDIAN);
1092             offset += 17;
1093             offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_none, OPENWIRE_TYPE_MAP, iCommand, FALSE);
1094         }
1095     }
1096     else
1097     {
1098         if (tvb_reported_length_remaining(tvb, offset) >= 5)
1099         {
1100             proto_tree_add_item(tree, hf_openwire_command_id, tvb, offset, 4, ENC_BIG_ENDIAN);
1101             proto_tree_add_item(tree, hf_openwire_command_response_required, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
1102             offset += 5;
1103             if (iCommand == OPENWIRE_SHUTDOWN_INFO || iCommand == OPENWIRE_KEEP_ALIVE_INFO  || iCommand == OPENWIRE_FLUSH_COMMAND)
1104             {
1105                 /* No additional fields */
1106             }
1107             else if (iCommand == OPENWIRE_SESSION_INFO)
1108             {
1109                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_sessioninfo_sessionid, OPENWIRE_TYPE_CACHED, iCommand, TRUE);
1110             }
1111             else if (iCommand == OPENWIRE_DESTINATION_INFO)
1112             {
1113                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_destinationinfo_connectionid, OPENWIRE_TYPE_CACHED, iCommand, TRUE);
1114                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_destinationinfo_destination, OPENWIRE_TYPE_CACHED, iCommand, TRUE);
1115                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_destinationinfo_operationtype, OPENWIRE_TYPE_BYTE, iCommand, FALSE);
1116                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_destinationinfo_timeout, OPENWIRE_TYPE_LONG, iCommand, FALSE);
1117                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_destinationinfo_brokerpath, OPENWIRE_TYPE_OBJECT_ARRAY, iCommand, TRUE);
1118             }
1119             else if (iCommand == OPENWIRE_CONNECTION_INFO)
1120             {
1121                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_connectioninfo_connectionid, OPENWIRE_TYPE_CACHED, iCommand, TRUE);
1122                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_connectioninfo_clientid, OPENWIRE_TYPE_STRING, iCommand, TRUE);
1123                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_connectioninfo_password, OPENWIRE_TYPE_STRING, iCommand, TRUE);
1124                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_connectioninfo_username, OPENWIRE_TYPE_STRING, iCommand, TRUE);
1125                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_connectioninfo_brokerpath, OPENWIRE_TYPE_OBJECT_ARRAY, iCommand, TRUE);
1126                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_connectioninfo_brokermasterconnector, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1127                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_connectioninfo_manageable, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1128                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_connectioninfo_clientmaster, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1129                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_connectioninfo_faulttolerant, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1130                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_connectioninfo_failoverreconnect, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1131             }
1132             else if (iCommand == OPENWIRE_CONNECTION_CONTROL)
1133             {
1134                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_connectioncontrol_close, OPENWIRE_TYPE_BOOLEAN, iCommand, TRUE);
1135                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_connectioncontrol_exit, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1136                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_connectioncontrol_faulttolerant, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1137                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_connectioncontrol_resume, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1138                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_connectioncontrol_suspend, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1139                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_connectioncontrol_connectedbrokers, OPENWIRE_TYPE_STRING, iCommand, TRUE);
1140                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_connectioncontrol_reconnectto, OPENWIRE_TYPE_STRING, iCommand, TRUE);
1141                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_connectioncontrol_rebalanceconnection, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1142             }
1143             else if (iCommand == OPENWIRE_CONSUMER_INFO)
1144             {
1145                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumerinfo_consumerid, OPENWIRE_TYPE_CACHED, iCommand, TRUE);
1146                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumerinfo_browser, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1147                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumerinfo_destination, OPENWIRE_TYPE_CACHED, iCommand, TRUE);
1148                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumerinfo_prefetchsize, OPENWIRE_TYPE_INTEGER, iCommand, FALSE);
1149                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumerinfo_maximumpendingmessagelimit, OPENWIRE_TYPE_INTEGER, iCommand, FALSE);
1150                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumerinfo_dispatchasync, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1151                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumerinfo_selector, OPENWIRE_TYPE_STRING, iCommand, TRUE);
1152                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumerinfo_subscriptionname, OPENWIRE_TYPE_STRING, iCommand, TRUE);
1153                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumerinfo_nolocal, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1154                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumerinfo_exclusive, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1155                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumerinfo_retroactive, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1156                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumerinfo_priority, OPENWIRE_TYPE_BYTE, iCommand, TRUE);
1157                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumerinfo_brokerpath, OPENWIRE_TYPE_OBJECT_ARRAY, iCommand, TRUE);
1158                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumerinfo_additionalpredicate, OPENWIRE_TYPE_NESTED, iCommand, TRUE);
1159                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumerinfo_networksubscription, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1160                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumerinfo_optimizedacknowledge, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1161                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumerinfo_norangeacks, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1162                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumerinfo_networkconsumerpath, OPENWIRE_TYPE_OBJECT_ARRAY, iCommand, TRUE);
1163             }
1164             else if (iCommand == OPENWIRE_PRODUCER_INFO)
1165             {
1166                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_producerinfo_producerid, OPENWIRE_TYPE_CACHED, iCommand, TRUE);
1167                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_producerinfo_destination, OPENWIRE_TYPE_CACHED, iCommand, TRUE);
1168                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_producerinfo_brokerpath, OPENWIRE_TYPE_OBJECT_ARRAY, iCommand, TRUE);
1169                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_producerinfo_dispatchasync, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1170                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_producerinfo_windowsize, OPENWIRE_TYPE_INTEGER, iCommand, FALSE);
1171             }
1172             else if (iCommand == OPENWIRE_CONSUMER_CONTROL)
1173             {
1174                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumercontrol_destination, OPENWIRE_TYPE_NESTED, iCommand, TRUE);
1175                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumercontrol_close, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1176                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumercontrol_consumerid, OPENWIRE_TYPE_NESTED, iCommand, TRUE);
1177                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumercontrol_prefetch, OPENWIRE_TYPE_INTEGER, iCommand, FALSE);
1178                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumercontrol_flush, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1179                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumercontrol_start, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1180                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_consumercontrol_stop, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1181             }
1182             else if (iCommand == OPENWIRE_BROKER_INFO)
1183             {
1184                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_brokerinfo_brokerid, OPENWIRE_TYPE_CACHED, iCommand, TRUE);
1185                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_brokerinfo_brokerurl, OPENWIRE_TYPE_STRING, iCommand, TRUE);
1186                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_brokerinfo_peerbrokerinfos, OPENWIRE_TYPE_OBJECT_ARRAY, iCommand, TRUE);
1187                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_brokerinfo_brokername, OPENWIRE_TYPE_STRING, iCommand, TRUE);
1188                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_brokerinfo_slavebroker, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1189                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_brokerinfo_masterbroker, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1190                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_brokerinfo_faulttolerantconfiguration, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1191                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_brokerinfo_duplexconnection, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1192                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_brokerinfo_networkconnection, OPENWIRE_TYPE_BOOLEAN, iCommand, FALSE);
1193                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_brokerinfo_connectionid, OPENWIRE_TYPE_LONG, iCommand, FALSE);
1194                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_brokerinfo_brokeruploadurl, OPENWIRE_TYPE_STRING, iCommand, TRUE);
1195                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_brokerinfo_networkproperties, OPENWIRE_TYPE_STRING, iCommand, TRUE);
1196             }
1197             else if (iCommand == OPENWIRE_TRANSACTION_INFO)
1198             {
1199                 guint8 iTransactionType;
1200                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_transactioninfo_connectionid, OPENWIRE_TYPE_CACHED, iCommand, TRUE);
1201                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_transactioninfo_transactionid, OPENWIRE_TYPE_CACHED, iCommand, TRUE);
1202                 if (tvb_reported_length_remaining(tvb, offset) >= 1)
1203                 {
1204                     iTransactionType = tvb_get_guint8(tvb, offset);
1205                     offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_transactioninfo_type, OPENWIRE_TYPE_BYTE, iCommand, FALSE);
1206                     proto_item_append_text(tree, " (%s)", val_to_str_ext(iTransactionType, &openwire_transaction_type_vals_ext, "Unknown (0x%02x)"));
1207                 }
1208             }
1209             else if (iCommand == OPENWIRE_PRODUCER_ACK)
1210             {
1211                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_producerack_producerid, OPENWIRE_TYPE_NESTED, iCommand, TRUE);
1212                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_producerack_size, OPENWIRE_TYPE_INTEGER, iCommand, FALSE);
1213             }
1214             else if (iCommand == OPENWIRE_REMOVE_INFO)
1215             {
1216                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_removeinfo_objectid, OPENWIRE_TYPE_CACHED, iCommand, TRUE);
1217                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_removeinfo_lastdeliveredsequenceid, OPENWIRE_TYPE_LONG, iCommand, FALSE);
1218             }
1219             else if (iCommand == OPENWIRE_REMOVE_SUBSCRIPTION_INFO)
1220             {
1221                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_removesubscriptioninfo_connectionid, OPENWIRE_TYPE_CACHED, iCommand, TRUE);
1222                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_removesubscriptioninfo_subscriptionname, OPENWIRE_TYPE_STRING, iCommand, TRUE);
1223                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_removesubscriptioninfo_clientid, OPENWIRE_TYPE_STRING, iCommand, TRUE);
1224             }
1225             else if (iCommand == OPENWIRE_MESSAGE_DISPATCH)
1226             {
1227                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_messagedispatch_consumerid, OPENWIRE_TYPE_CACHED, iCommand, TRUE);
1228                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_messagedispatch_destination, OPENWIRE_TYPE_CACHED, iCommand, TRUE);
1229                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_messagedispatch_message, OPENWIRE_TYPE_NESTED, iCommand, TRUE);
1230                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_messagedispatch_redeliverycounter, OPENWIRE_TYPE_INTEGER, iCommand, FALSE);
1231             }
1232             else if (iCommand == OPENWIRE_MESSAGE_ACK)
1233             {
1234                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_messageack_destination, OPENWIRE_TYPE_CACHED, iCommand, TRUE);
1235                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_messageack_transactionid, OPENWIRE_TYPE_CACHED, iCommand, TRUE);
1236                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_messageack_consumerid, OPENWIRE_TYPE_CACHED, iCommand, TRUE);
1237                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_messageack_acktype, OPENWIRE_TYPE_BYTE, iCommand, FALSE);
1238                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_messageack_firstmessageid, OPENWIRE_TYPE_NESTED, iCommand, TRUE);
1239                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_messageack_lastmessageid, OPENWIRE_TYPE_NESTED, iCommand, TRUE);
1240                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_messageack_messagecount, OPENWIRE_TYPE_INTEGER, iCommand, FALSE);
1241             }
1242             else if (iCommand == OPENWIRE_MESSAGE_PULL)
1243             {
1244                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_messagepull_consumerid, OPENWIRE_TYPE_CACHED, iCommand, TRUE);
1245                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_messagepull_destinationid, OPENWIRE_TYPE_CACHED, iCommand, TRUE);
1246                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_messagepull_timeout, OPENWIRE_TYPE_LONG, iCommand, FALSE);
1247                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_messagepull_correlationid, OPENWIRE_TYPE_STRING, iCommand, TRUE);
1248                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_messagepull_messageid, OPENWIRE_TYPE_NESTED, iCommand, TRUE);
1249             }
1250             else if (iCommand == OPENWIRE_RESPONSE)
1251             {
1252                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_response_correlationid, OPENWIRE_TYPE_INTEGER, iCommand, FALSE);
1253             }
1254             else if (iCommand == OPENWIRE_DATA_RESPONSE)
1255             {
1256                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_response_correlationid, OPENWIRE_TYPE_INTEGER, iCommand, FALSE);
1257                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_dataresponse_data, OPENWIRE_COMMAND_INNER, iCommand, TRUE);
1258             }
1259             else if (iCommand == OPENWIRE_CONNECTION_ERROR)
1260             {
1261                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_connectionerror_exception, OPENWIRE_TYPE_THROWABLE, iCommand, TRUE);
1262                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_connectionerror_connectionid, OPENWIRE_TYPE_NESTED, iCommand, TRUE);
1263             }
1264             else if (iCommand == OPENWIRE_EXCEPTION_RESPONSE)
1265             {
1266                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_response_correlationid, OPENWIRE_TYPE_INTEGER, iCommand, FALSE);
1267                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_exceptionresponse_exception, OPENWIRE_TYPE_THROWABLE, iCommand, TRUE);
1268             }
1269             else if (iCommand == OPENWIRE_CONTROL_COMMAND)
1270             {
1271                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_controlcommand_command, OPENWIRE_TYPE_STRING, iCommand, TRUE);
1272             }
1273             else if (iCommand == OPENWIRE_ACTIVEMQ_MESSAGE
1274                     || iCommand == OPENWIRE_ACTIVEMQ_BYTES_MESSAGE
1275                     || iCommand == OPENWIRE_ACTIVEMQ_MAP_MESSAGE
1276                     || iCommand == OPENWIRE_ACTIVEMQ_OBJECT_MESSAGE
1277                     || iCommand == OPENWIRE_ACTIVEMQ_STREAM_MESSAGE
1278                     || iCommand == OPENWIRE_ACTIVEMQ_TEXT_MESSAGE
1279                     || iCommand == OPENWIRE_ACTIVEMQ_BLOB_MESSAGE)
1280             {
1281                 offset += dissect_openwire_type(tvb, pinfo, tree, offset, hf_openwire_none, iCommand, parentType, FALSE);
1282             }
1283             else if (tvb_reported_length_remaining(tvb, offset) > 0)
1284             {
1285                 expert_add_info_format(pinfo, tree, &ei_openwire_command_not_supported, "OpenWire command not supported by Wireshark: %d", iCommand);
1286             }
1287         }
1288     }
1289     return (offset - startOffset);
1290 }
1291 
1292 static int
dissect_openwire(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data _U_)1293 dissect_openwire(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1294 {
1295     gint        offset            = 0;
1296 
1297     col_set_str(pinfo->cinfo, COL_PROTOCOL, "OpenWire");
1298     col_clear(pinfo->cinfo, COL_INFO);
1299 
1300     if (tvb_reported_length_remaining(tvb, offset) >= 5)
1301     {
1302         guint8      iCommand;
1303         proto_tree *openwireroot_tree;
1304         proto_item *ti;
1305         gboolean    caching;
1306 
1307         iCommand = tvb_get_guint8(tvb, offset + 4);
1308 
1309         col_append_sep_str(pinfo->cinfo, COL_INFO, " | ",
1310                             val_to_str_ext(iCommand, &openwire_opcode_vals_ext, "Unknown (0x%02x)"));
1311         col_set_fence(pinfo->cinfo, COL_INFO);
1312 
1313         detect_protocol_options(tvb, pinfo, offset, iCommand);
1314 
1315         ti = proto_tree_add_item(tree, proto_openwire, tvb, offset, -1, ENC_NA);
1316         proto_item_append_text(ti, " (%s)", val_to_str_ext(iCommand, &openwire_opcode_vals_ext, "Unknown (0x%02x)"));
1317         openwireroot_tree = proto_item_add_subtree(ti, ett_openwire);
1318 
1319         proto_tree_add_item(openwireroot_tree, hf_openwire_length, tvb, offset + 0, 4, ENC_BIG_ENDIAN);
1320 
1321         /* Abort dissection if tight encoding is enabled*/
1322         if (iCommand != OPENWIRE_WIREFORMAT_INFO && retrieve_tight(pinfo) == TRUE)
1323         {
1324             proto_tree_add_item(openwireroot_tree, hf_openwire_command, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
1325             expert_add_info(pinfo, openwireroot_tree, &ei_openwire_tight_encoding_not_supported);
1326             return tvb_captured_length(tvb);
1327         }
1328 
1329         caching = retrieve_caching(pinfo);
1330         if (caching)
1331         {
1332             proto_tree_add_boolean(openwireroot_tree, hf_openwire_cached_enabled, tvb, offset, 0, caching);
1333         }
1334 
1335         offset += 4;
1336         offset += dissect_openwire_command(tvb, pinfo, openwireroot_tree, offset, iCommand);
1337         if (tvb_reported_length_remaining(tvb, offset) > 0)
1338         {
1339             expert_add_info_format(pinfo, tree, &ei_openwire_command_not_supported, "OpenWire command fields unknown to Wireshark: %d", iCommand);
1340         }
1341     }
1342 
1343     return tvb_captured_length(tvb);
1344 }
1345 
1346 static guint
get_openwire_pdu_len(packet_info * pinfo _U_,tvbuff_t * tvb,int offset,void * data _U_)1347 get_openwire_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
1348 {
1349     return (tvb_get_ntohl(tvb, offset) + 4);
1350 }
1351 
1352 static int
dissect_openwire_tcp(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data)1353 dissect_openwire_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
1354 {
1355     tcp_dissect_pdus(tvb, pinfo, tree, openwire_desegment, 5, get_openwire_pdu_len, dissect_openwire, data);
1356     return tvb_captured_length(tvb);
1357 }
1358 
1359 
1360 static gboolean
dissect_openwire_heur(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data)1361 dissect_openwire_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
1362 {
1363     conversation_t *conversation;
1364     gboolean        detected = FALSE;
1365 
1366     if (tvb_reported_length(tvb) == 10 || tvb_reported_length(tvb) == 11)
1367     {
1368         /* KeepAlive is sent by default every 30 second.  It is 10 bytes (loose) or 11 bytes (tight) long. */
1369         if ((tvb_get_guint8(tvb, 4) == OPENWIRE_KEEP_ALIVE_INFO)
1370             && (tvb_get_ntohl(tvb, 0) + 4 == tvb_reported_length(tvb)))
1371         {
1372             detected = TRUE;
1373         }
1374     }
1375     else if (tvb_reported_length(tvb) == 14 || tvb_reported_length(tvb) == 15)
1376     {
1377         /* Response is sent after several commands.  It is 14 bytes (loose) or 15 bytes (tight) long. */
1378         if ((tvb_get_guint8(tvb, 4) == OPENWIRE_RESPONSE)
1379             && (tvb_get_ntohl(tvb, 0) + 4 == tvb_reported_length(tvb)))
1380         {
1381             detected = TRUE;
1382         }
1383     }
1384     else if (tvb_reported_length(tvb) >= 13)
1385     {
1386         /* Only the WIREFORMAT_INFO command contains a "magic". It is the first command sent on a connection.
1387            If the capture was started after this command, a manual "Decode As..." might be required.
1388            */
1389         if (tvb_captured_length(tvb) >= 10
1390             && (tvb_get_guint8(tvb, 4) == OPENWIRE_WIREFORMAT_INFO)
1391             && (tvb_get_ntohl(tvb, 5) == OPENWIRE_MAGIC_PART_1)
1392             && (tvb_get_ntohl(tvb, 9) == OPENWIRE_MAGIC_PART_2))
1393         {
1394             detected = TRUE;
1395         }
1396     }
1397     if (detected)
1398     {
1399         /* Register this dissector for this conversation */
1400         conversation = find_or_create_conversation(pinfo);
1401         conversation_set_dissector(conversation, openwire_tcp_handle);
1402 
1403         /* Dissect the packet */
1404         dissect_openwire(tvb, pinfo, tree, data);
1405         return TRUE;
1406     }
1407     return FALSE;
1408 }
1409 
1410 void
proto_register_openwire(void)1411 proto_register_openwire(void)
1412 {
1413     static hf_register_info hf[] = {
1414      { &hf_openwire_length,
1415         { "Length", "openwire.length", FT_UINT32, BASE_DEC, NULL, 0x0, "OpenWire length", HFILL }},
1416 
1417      { &hf_openwire_command,
1418         { "Command", "openwire.command", FT_UINT8, BASE_DEC, VALS(openwire_opcode_vals), 0x0, "Openwire command", HFILL }},
1419 
1420      { &hf_openwire_command_id,
1421         { "Command Id", "openwire.command.id", FT_UINT32, BASE_DEC, NULL, 0x0, "Openwire command id", HFILL }},
1422 
1423      { &hf_openwire_command_response_required,
1424         { "Command response required", "openwire.command.response_required", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire command response required", HFILL }},
1425 
1426      { &hf_openwire_response_correlationid,
1427         { "CorrelationId", "openwire.response.correlationid", FT_INT32, BASE_DEC, NULL, 0x0, "Openwire Response CorrelationId", HFILL }},
1428 
1429      { &hf_openwire_dataresponse_data,
1430         { "Data", "openwire.responsedata.data", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire ResponseData Data", HFILL }},
1431 
1432      { &hf_openwire_exceptionresponse_exception,
1433         { "Exception", "openwire.exceptionresponse.exception", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire ExceptionResponse Exception", HFILL }},
1434 
1435      { &hf_openwire_connectionerror_exception,
1436         { "Exception", "openwire.connectionerror.exception", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire ConnectionError Exception", HFILL }},
1437 
1438      { &hf_openwire_connectionerror_connectionid,
1439         { "ConnectionId", "openwire.connectionerror.connectionid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire ConnectionError ConnectionId", HFILL }},
1440 
1441      { &hf_openwire_controlcommand_command,
1442         { "Command", "openwire.controlcommand.command", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire ControlCommand Command", HFILL }},
1443 
1444      { &hf_openwire_wireformatinfo_magic,
1445         { "Magic", "openwire.wireformatinfo.magic", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire WireFormatInfo Magic", HFILL }},
1446 
1447      { &hf_openwire_wireformatinfo_version,
1448         { "Version", "openwire.wireformatinfo.version", FT_UINT32, BASE_DEC, NULL, 0x0, "Openwire WireFormatInfo Version", HFILL }},
1449 
1450      { &hf_openwire_wireformatinfo_data,
1451         { "Data", "openwire.wireformatinfo.data", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire WireFormatInfo Data", HFILL }},
1452 
1453      { &hf_openwire_wireformatinfo_length,
1454         { "Length", "openwire.wireformatinfo.length", FT_UINT32, BASE_DEC, NULL, 0x0, "Openwire WireFormatInfo Length", HFILL }},
1455 
1456      { &hf_openwire_sessioninfo_sessionid,
1457         { "SessionId", "openwire.sessioninfo.sessionid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire SessionInfo SessionId", HFILL }},
1458 
1459      { &hf_openwire_destinationinfo_connectionid,
1460         { "ConnectionId", "openwire.destinationinfo.connectionid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire DestinationInfo ConnectionId", HFILL }},
1461 
1462      { &hf_openwire_destinationinfo_destination,
1463         { "Destination", "openwire.destinationinfo.destination", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire DestinationInfo Destination", HFILL }},
1464 
1465      { &hf_openwire_destinationinfo_operationtype,
1466         { "OperationType", "openwire.destinationinfo.operationtype", FT_UINT8, BASE_DEC, VALS(openwire_operation_type_vals), 0x0, "Openwire DestinationInfo OperationType", HFILL }},
1467 
1468      { &hf_openwire_destinationinfo_timeout,
1469         { "Timeout", "openwire.destinationinfo.timeout", FT_INT64, BASE_DEC, NULL, 0x0, "Openwire DestinationInfo Timeout", HFILL }},
1470 
1471      { &hf_openwire_destinationinfo_brokerpath,
1472         { "BrokerPath", "openwire.destinationinfo.brokerpath", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire DestinationInfo BrokerPath", HFILL }},
1473 
1474      { &hf_openwire_brokerinfo_brokerid,
1475         { "BrokerId", "openwire.brokerinfo.brokerid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire BrokerInfo BrokerId", HFILL }},
1476 
1477      { &hf_openwire_brokerinfo_brokerurl,
1478         { "BrokerURL", "openwire.brokerinfo.brokerurl", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire BrokerInfo BrokerURL", HFILL }},
1479 
1480      { &hf_openwire_brokerinfo_peerbrokerinfos,
1481         { "PeerBrokerInfos", "openwire.brokerinfo.peerbrokerinfos", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire BrokerInfo PeerBrokerInfos", HFILL }},
1482 
1483      { &hf_openwire_brokerinfo_brokername,
1484         { "BrokerName", "openwire.brokerinfo.brokername", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire BrokerInfo BrokerName", HFILL }},
1485 
1486      { &hf_openwire_brokerinfo_slavebroker,
1487         { "SlaveBroker", "openwire.brokerinfo.slavebroker", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire BrokerInfo SlaveBroker", HFILL }},
1488 
1489      { &hf_openwire_brokerinfo_masterbroker,
1490         { "MasterBroker", "openwire.brokerinfo.masterbroker", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire BrokerInfo MasterBroker", HFILL }},
1491 
1492      { &hf_openwire_brokerinfo_faulttolerantconfiguration,
1493         { "FaultTolerantConfiguration", "openwire.brokerinfo.faulttolerantconfiguration", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire BrokerInfo FaultTolerantConfiguration", HFILL }},
1494 
1495      { &hf_openwire_brokerinfo_duplexconnection,
1496         { "DuplexConnection", "openwire.brokerinfo.duplexconnection", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire BrokerInfo DuplexConnection", HFILL }},
1497 
1498      { &hf_openwire_brokerinfo_networkconnection,
1499         { "NetworkConnection", "openwire.brokerinfo.networkconnection", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire BrokerInfo NetworkConnection", HFILL }},
1500 
1501      { &hf_openwire_brokerinfo_connectionid,
1502         { "ConnectionId", "openwire.brokerinfo.connectionid", FT_INT64, BASE_DEC, NULL, 0x0, "Openwire BrokerInfo ConnectionId", HFILL }},
1503 
1504      { &hf_openwire_brokerinfo_brokeruploadurl,
1505         { "BrokerUploadUrl", "openwire.brokerinfo.brokeruploadurl", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire BrokerInfo BrokerUploadUrl", HFILL }},
1506 
1507      { &hf_openwire_brokerinfo_networkproperties,
1508         { "NetworkProperties", "openwire.brokerinfo.networkproperties", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire BrokerInfo NetworkProperties", HFILL }},
1509 
1510      { &hf_openwire_connectioninfo_connectionid,
1511         { "ConnectionId", "openwire.connectioninfo.connectionid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire ConnectionInfo ConnectionId", HFILL }},
1512 
1513      { &hf_openwire_connectioninfo_clientid,
1514         { "ClientId", "openwire.connectioninfo.clientid", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire ConnectionInfo ClientId", HFILL }},
1515 
1516      { &hf_openwire_connectioninfo_password,
1517         { "Password", "openwire.connectioninfo.password", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire ConnectionInfo Password", HFILL }},
1518 
1519      { &hf_openwire_connectioninfo_username,
1520         { "UserName", "openwire.connectioninfo.username", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire ConnectionInfo UserName", HFILL }},
1521 
1522      { &hf_openwire_connectioninfo_brokerpath,
1523         { "BrokerPath", "openwire.connectioninfo.brokerpath", FT_BYTES, BASE_NONE, NULL, 0x0, "Openwire ConnectionInfo BrokerPath", HFILL }},
1524 
1525      { &hf_openwire_connectioninfo_brokermasterconnector,
1526         { "BrokerMasterConnector", "openwire.connectioninfo.brokermasterconnector", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ConnectionInfo BrokerMasterConnector", HFILL }},
1527 
1528      { &hf_openwire_connectioninfo_manageable,
1529         { "Manageable", "openwire.connectioninfo.manageable", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ConnectionInfo Manageable", HFILL }},
1530 
1531      { &hf_openwire_connectioninfo_clientmaster,
1532         { "ClientMaster", "openwire.connectioninfo.clientmaster", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ConnectionInfo ClientMaster", HFILL }},
1533 
1534      { &hf_openwire_connectioninfo_faulttolerant,
1535         { "FaultTolerant", "openwire.connectioninfo.faulttolerant", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ConnectionInfo FaultTolerant", HFILL }},
1536 
1537      { &hf_openwire_connectioninfo_failoverreconnect,
1538         { "FailoverReconnect", "openwire.connectioninfo.failoverreconnect", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ConnectionInfo FailoverReconnect", HFILL } },
1539 
1540      { &hf_openwire_consumerinfo_consumerid,
1541         { "ConsumerId", "openwire.consumerinfo.consumerid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire ConsumerInfo ConsumerId", HFILL }},
1542 
1543      { &hf_openwire_consumerinfo_browser,
1544         { "Browser", "openwire.consumerinfo.browser", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ConsumerInfo Browser", HFILL }},
1545 
1546      { &hf_openwire_consumerinfo_destination,
1547         { "Destination", "openwire.consumerinfo.destination", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire ConsumerInfo Destination", HFILL }},
1548 
1549      { &hf_openwire_consumerinfo_prefetchsize,
1550         { "PrefetchSize", "openwire.consumerinfo.prefetchsize", FT_INT32, BASE_DEC, NULL, 0x0, "Openwire ConsumerInfo PrefetchSize", HFILL }},
1551 
1552      { &hf_openwire_consumerinfo_maximumpendingmessagelimit,
1553         { "MaximumPendingMessageLimit", "openwire.consumerinfo.maximumpendingmessagelimit", FT_INT32, BASE_DEC, NULL, 0x0, "Openwire ConsumerInfo MaximumPendingMessageLimit", HFILL }},
1554 
1555      { &hf_openwire_consumerinfo_dispatchasync,
1556         { "DispatchAsync", "openwire.consumerinfo.dispatchasync", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ConsumerInfo DispatchAsync", HFILL }},
1557 
1558      { &hf_openwire_consumerinfo_selector,
1559         { "Selector", "openwire.consumerinfo.selector", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire ConsumerInfo Selector", HFILL }},
1560 
1561      { &hf_openwire_consumerinfo_subscriptionname,
1562         { "SubscriptionName", "openwire.consumerinfo.subscriptionname", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire ConsumerInfo SubscriptionName", HFILL }},
1563 
1564      { &hf_openwire_consumerinfo_nolocal,
1565         { "NoLocal", "openwire.consumerinfo.nolocal", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ConsumerInfo NoLocal", HFILL }},
1566 
1567      { &hf_openwire_consumerinfo_exclusive,
1568         { "Exclusive", "openwire.consumerinfo.exclusive", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ConsumerInfo Exclusive", HFILL }},
1569 
1570      { &hf_openwire_consumerinfo_retroactive,
1571         { "RetroActive", "openwire.consumerinfo.retroactive", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ConsumerInfo RetroActive", HFILL }},
1572 
1573      { &hf_openwire_consumerinfo_priority,
1574         { "Priority", "openwire.consumerinfo.priority", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ConsumerInfo Priority", HFILL }},
1575 
1576      { &hf_openwire_consumerinfo_brokerpath,
1577         { "BrokerPath", "openwire.consumerinfo.brokerpath", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire ConsumerInfo BrokerPath", HFILL }},
1578 
1579      { &hf_openwire_consumerinfo_additionalpredicate,
1580         { "AdditionalPredicate", "openwire.consumerinfo.additionalpredicate", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire ConsumerInfo AdditionalPredicate", HFILL   }},
1581 
1582      { &hf_openwire_consumerinfo_networksubscription,
1583         { "NetworkSubscription", "openwire.consumerinfo.networksubscription", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ConsumerInfo NetworkSubscription", HFILL   }},
1584 
1585      { &hf_openwire_consumerinfo_optimizedacknowledge,
1586         { "OptimizedAcknowledge", "openwire.consumerinfo.optimizedacknowledge", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ConsumerInfo OptimizedAcknowledge",  HFILL }},
1587 
1588      { &hf_openwire_consumerinfo_norangeacks,
1589         { "NoRangeAcks", "openwire.consumerinfo.norangeacks", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ConsumerInfo NoRangeAcks", HFILL }},
1590 
1591      { &hf_openwire_consumerinfo_networkconsumerpath,
1592         { "NetworkConsumerPath", "openwire.consumerinfo.networkconsumerpath", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire ConsumerInfo NetworkConsumerPath", HFILL   }},
1593 
1594      { &hf_openwire_consumercontrol_destination,
1595         { "Destination", "openwire.consumercontrol.destination", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire ConsumerControl Destination", HFILL }},
1596 
1597      { &hf_openwire_consumercontrol_close,
1598         { "Close", "openwire.consumercontrol.close", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ConsumerControl Close", HFILL }},
1599 
1600      { &hf_openwire_consumercontrol_consumerid,
1601         { "ConsumerId", "openwire.consumercontrol.consumerid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire ConsumerControl ConsumerId", HFILL }},
1602 
1603      { &hf_openwire_consumercontrol_prefetch,
1604         { "Prefetch", "openwire.consumercontrol.prefetch", FT_INT32, BASE_DEC, NULL, 0x0, "Openwire ConsumerControl Prefetch", HFILL }},
1605 
1606      { &hf_openwire_consumercontrol_flush,
1607         { "Flush", "openwire.consumercontrol.flush", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ConsumerControl Flush", HFILL }},
1608 
1609      { &hf_openwire_consumercontrol_start,
1610         { "Start", "openwire.consumercontrol.start", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ConsumerControl Start", HFILL }},
1611 
1612      { &hf_openwire_consumercontrol_stop,
1613         { "Stop", "openwire.consumercontrol.stop", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ConsumerControl Stop", HFILL }},
1614 
1615      { &hf_openwire_connectioncontrol_close,
1616         { "Close", "openwire.connectioncontrol.close", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ConnectionControl Close", HFILL }},
1617 
1618      { &hf_openwire_connectioncontrol_exit,
1619         { "Exit", "openwire.connectioncontrol.exit", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ConnectionControl Exit", HFILL }},
1620 
1621      { &hf_openwire_connectioncontrol_faulttolerant,
1622         { "FaultTolerant", "openwire.connectioncontrol.faulttolerant", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ConnectionControl FaultTolerant", HFILL }},
1623 
1624      { &hf_openwire_connectioncontrol_resume,
1625         { "Resume", "openwire.connectioncontrol.resume", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ConnectionControl Resume", HFILL }},
1626 
1627      { &hf_openwire_connectioncontrol_suspend,
1628         { "Suspend", "openwire.connectioncontrol.suspend", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ConnectionControl Suspend", HFILL }},
1629 
1630      { &hf_openwire_connectioncontrol_connectedbrokers,
1631         { "ConnectedBrokers", "openwire.connectioncontrol.connectedbrokers", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire ConnectionControl ConnectedBrokers",  HFILL }},
1632 
1633      { &hf_openwire_connectioncontrol_reconnectto,
1634         { "ReconnectTo", "openwire.connectioncontrol.reconnectto", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire ConnectionControl ReconnectTo", HFILL }},
1635 
1636      { &hf_openwire_connectioncontrol_rebalanceconnection,
1637         { "RebalanceConnection", "openwire.connectioncontrol.rebalanceconnection", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ConnectionControl RebalanceConnection", HFILL }},
1638 
1639      { &hf_openwire_removeinfo_objectid,
1640         { "ObjectId", "openwire.removeinfo.objectid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire RemoveInfo ObjectId", HFILL }},
1641 
1642      { &hf_openwire_removeinfo_lastdeliveredsequenceid,
1643         { "LastDeliveredSequenceId", "openwire.removeinfo.lastdeliveredsequenceid", FT_INT64, BASE_DEC, NULL, 0x0, "Openwire RemoveInfo LastDeliveredSequenceId" ,  HFILL }},
1644 
1645      { &hf_openwire_removesubscriptioninfo_connectionid,
1646         { "ConnectionId", "openwire.removesubscriptioninfo.connectionid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire RemoveSubscriptionInfo ConnectionId", HFILL  } },
1647 
1648      { &hf_openwire_removesubscriptioninfo_subscriptionname,
1649         { "SubscriptionName", "openwire.removesubscriptioninfo.subscriptionname", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire RemoveSubscriptionInfo SubscriptionName", HFILL }},
1650 
1651      { &hf_openwire_removesubscriptioninfo_clientid,
1652         { "ClientId", "openwire.removesubscriptioninfo.clientid", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire RemoveSubscriptionInfo ClientId", HFILL }},
1653 
1654      { &hf_openwire_producerinfo_producerid,
1655         { "ProducerId", "openwire.producerinfo.producerid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire ProducerInfo ProducerId", HFILL }},
1656 
1657      { &hf_openwire_producerinfo_destination,
1658         { "Destination", "openwire.producerinfo.destination", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire ProducerInfo Destination", HFILL }},
1659 
1660      { &hf_openwire_producerinfo_brokerpath,
1661         { "BrokerPath", "openwire.producerinfo.brokerpath", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire ProducerInfo BrokerPath", HFILL }},
1662 
1663      { &hf_openwire_producerinfo_dispatchasync,
1664         { "DispatchAsync", "openwire.producerinfo.dispatchasync", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire ProducerInfo DispatchAsync", HFILL }},
1665 
1666      { &hf_openwire_producerinfo_windowsize,
1667         { "WindowSize", "openwire.producerinfo.windowsize", FT_INT32, BASE_DEC, NULL, 0x0, "Openwire ProducerInfo WindowSize", HFILL }},
1668 
1669      { &hf_openwire_transactioninfo_connectionid,
1670         { "ConnectionId", "openwire.transactioninfo.connectionid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire TransactionInfo ConnectionId", HFILL }},
1671 
1672      { &hf_openwire_transactioninfo_transactionid,
1673         { "TransactionId", "openwire.transactioninfo.transactionid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire TransactionInfo TransactionId", HFILL }},
1674 
1675      { &hf_openwire_transactioninfo_type,
1676         { "Type", "openwire.transactioninfo.type", FT_UINT8, BASE_DEC, VALS(openwire_transaction_type_vals), 0x0, "Openwire TransactionInfo Type", HFILL }},
1677 
1678      { &hf_openwire_producerack_producerid,
1679         { "ProducerId", "openwire.producerack.producerid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire ProducerAck ProducerId", HFILL }},
1680 
1681      { &hf_openwire_producerack_size,
1682         { "Size", "openwire.producerack.size", FT_INT32, BASE_DEC, NULL, 0x0, "Openwire ProducerAck Size", HFILL }},
1683 
1684      { &hf_openwire_messagedispatch_consumerid,
1685         { "ConsumerId", "openwire.messagedispatch.consumerid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire MessageDispatch ConsumerId", HFILL }},
1686 
1687      { &hf_openwire_messagedispatch_destination,
1688         { "Destination", "openwire.messagedispatch.destination", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire MessageDispatch Destination", HFILL }},
1689 
1690      { &hf_openwire_messagedispatch_message,
1691         { "Message", "openwire.messagedispatch.message", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire MessageDispatch Message", HFILL }},
1692 
1693      { &hf_openwire_messagedispatch_redeliverycounter,
1694         { "RedeliveryCounter", "openwire.messagedispatch.redeliverycounter", FT_INT32, BASE_DEC, NULL, 0x0, "Openwire MessageDispatch RedeliveryCounter", HFILL }},
1695 
1696      { &hf_openwire_messageack_destination,
1697         { "Destination", "openwire.messageack.destination", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire MessageAck Destination", HFILL }},
1698 
1699      { &hf_openwire_messageack_transactionid,
1700         { "TransactionId", "openwire.messageack.transactionid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire MessageAck TransactionId", HFILL }},
1701 
1702      { &hf_openwire_messageack_consumerid,
1703         { "ConsumerId", "openwire.messageack.consumerid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire MessageAck ConsumerId", HFILL }},
1704 
1705      { &hf_openwire_messageack_acktype,
1706         { "AckType", "openwire.messageack.acktype", FT_UINT8, BASE_DEC, VALS(openwire_message_ack_type_vals), 0x0, "Openwire MessageAck AckType", HFILL }},
1707 
1708      { &hf_openwire_messageack_firstmessageid,
1709         { "FirstMessageId", "openwire.messageack.firstmessageid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire MessageAck FirstMessageId", HFILL }},
1710 
1711      { &hf_openwire_messageack_lastmessageid,
1712         { "LastMessageId", "openwire.messageack.lastmessageid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire MessageAck LastMessageId", HFILL }},
1713 
1714      { &hf_openwire_messageack_messagecount,
1715         { "MessageCount", "openwire.messageack.messagecount", FT_INT32, BASE_DEC, NULL, 0x0, "Openwire MessageAck MessageCount", HFILL }},
1716 
1717      { &hf_openwire_messagepull_consumerid,
1718         { "ConsumerId", "openwire.messagepull.consumerid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire MessagePull ConsumerId", HFILL }},
1719 
1720      { &hf_openwire_messagepull_destinationid,
1721         { "DestinationId", "openwire.messagepull.destinationid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire MessagePull DestinationId", HFILL }},
1722 
1723      { &hf_openwire_messagepull_timeout,
1724         { "Timeout", "openwire.messagepull.timeout", FT_INT64, BASE_DEC, NULL, 0x0, "Openwire MessagePull Timeout", HFILL }},
1725 
1726      { &hf_openwire_messagepull_correlationid,
1727         { "CorrelationId", "openwire.messagepull.correlationid", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire MessagePull CorrelationId", HFILL }},
1728 
1729      { &hf_openwire_messagepull_messageid,
1730         { "MessageId", "openwire.messagepull.messageid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire MessagePull MessageId", HFILL }},
1731 
1732      { &hf_openwire_message_producerid,
1733         { "ProducerId", "openwire.message.producerid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire message ProducerID", HFILL }},
1734 
1735      { &hf_openwire_message_destination,
1736         { "Destination", "openwire.message.destination", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire message Destination", HFILL }},
1737 
1738      { &hf_openwire_message_transactionid,
1739         { "TransactionId", "openwire.message.transactionid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire message TransactionId", HFILL }},
1740 
1741      { &hf_openwire_message_originaldestination,
1742         { "OriginalDestination", "openwire.message.originaldestination", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire message OriginalDestination", HFILL }},
1743 
1744      { &hf_openwire_message_messageid,
1745         { "MessageId", "openwire.message.messageid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire message MessageId", HFILL }},
1746 
1747      { &hf_openwire_message_originaldestinationid,
1748         { "OriginalDestinationId", "openwire.message.originaldestinationid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire message OriginalDestinationId", HFILL }},
1749 
1750      { &hf_openwire_message_groupid,
1751         { "GroupID", "openwire.message.groupid", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire message GroupID", HFILL }},
1752 
1753      { &hf_openwire_message_groupsequence,
1754         { "GroupSequence", "openwire.message.groupsequence", FT_INT32, BASE_DEC, NULL, 0x0, "Openwire message GroupSequence", HFILL }},
1755 
1756      { &hf_openwire_message_correlationid,
1757         { "CorrelationId", "openwire.message.correlationid", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire message CorrelationID", HFILL }},
1758 
1759      { &hf_openwire_message_persistent,
1760         { "Persistent", "openwire.message.persistent", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire message Persistent", HFILL }},
1761 
1762      { &hf_openwire_message_expiration,
1763         { "Expiration", "openwire.message.expiration", FT_INT64, BASE_DEC, NULL, 0x0, "Openwire message Expiration", HFILL }},
1764 
1765      { &hf_openwire_message_priority,
1766         { "Priority", "openwire.message.priority", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire message Priority", HFILL }},
1767 
1768      { &hf_openwire_message_replyto,
1769         { "ReplyTo", "openwire.message.replyto", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire message ReplyTo", HFILL }},
1770 
1771      { &hf_openwire_message_timestamp,
1772         { "Timestamp", "openwire.message.timestamp", FT_INT64, BASE_DEC, NULL, 0x0, "Openwire message Timestamp", HFILL }},
1773 
1774      { &hf_openwire_message_type,
1775         { "Type", "openwire.message.type", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire message Type", HFILL }},
1776 
1777      { &hf_openwire_message_body,
1778         { "Body", "openwire.message.body", FT_BYTES, BASE_NONE, NULL, 0x0, "Openwire message Body", HFILL }},
1779 
1780      { &hf_openwire_message_properties,
1781         { "Properties", "openwire.message.properties", FT_BYTES, BASE_NONE, NULL, 0x0, "Openwire message Properties", HFILL }},
1782 
1783      { &hf_openwire_message_datastructure,
1784         { "DataStructure", "openwire.message.datastructure", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire message DataStructure", HFILL }},
1785 
1786      { &hf_openwire_message_targetconsumerid,
1787         { "TargetConsumerId", "openwire.message.targetconsumerid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire message TargetConsumerId", HFILL }},
1788 
1789      { &hf_openwire_message_compressed,
1790         { "Compressed", "openwire.message.compressed", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire message Compressed", HFILL }},
1791 
1792      { &hf_openwire_message_redeliverycount,
1793         { "RedeliveryCount", "openwire.message.redeliverycount", FT_INT32, BASE_DEC, NULL, 0x0, "Openwire message RedeliveryCount", HFILL }},
1794 
1795      { &hf_openwire_message_brokerpath,
1796         { "BrokerPath", "openwire.message.brokerpath", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire message BrokerPath", HFILL }},
1797 
1798      { &hf_openwire_message_arrival,
1799         { "Arrival", "openwire.message.arrival", FT_INT64, BASE_DEC, NULL, 0x0, "Openwire message Arrival", HFILL }},
1800 
1801      { &hf_openwire_message_userid,
1802         { "UserID", "openwire.message.userid", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire message UserID", HFILL }},
1803 
1804      { &hf_openwire_message_receivedbydfbridge,
1805         { "ReceivedByDFBridge", "openwire.message.receivedbydfbridge", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire message ReceivedByDFBridge", HFILL }},
1806 
1807      { &hf_openwire_message_droppable,
1808         { "Droppable", "openwire.message.droppable", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire message Droppable", HFILL }},
1809 
1810      { &hf_openwire_message_cluster,
1811         { "Cluster", "openwire.message.cluster", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire message Cluster", HFILL }},
1812 
1813      { &hf_openwire_message_brokerintime,
1814         { "BrokerInTime", "openwire.message.brokerintime", FT_INT64, BASE_DEC, NULL, 0x0, "Openwire message BrokerInTime", HFILL }},
1815 
1816      { &hf_openwire_message_brokerouttime,
1817         { "BrokerOutTime", "openwire.message.brokerouttime", FT_INT64, BASE_DEC, NULL, 0x0, "Openwire message BrokerOutTime", HFILL }},
1818 
1819      { &hf_openwire_producerid_connectionid,
1820         { "ConnectionId", "openwire.producerid.connectionid", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire ProducerId ConnectionId", HFILL }},
1821 
1822      { &hf_openwire_producerid_value,
1823         { "Value", "openwire.producerid.value", FT_INT64, BASE_DEC, NULL, 0x0, "Openwire ProducerId Value", HFILL }},
1824 
1825      { &hf_openwire_producerid_sessionid,
1826         { "SessionId", "openwire.producerid.sessionid", FT_INT64, BASE_DEC, NULL, 0x0, "Openwire ProducerId SessionId", HFILL }},
1827 
1828      { &hf_openwire_consumerid_connectionid,
1829         { "ConnectionId", "openwire.consumerid.connectionid", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire ConsumerId ConnectionId", HFILL }},
1830 
1831      { &hf_openwire_consumerid_value,
1832         { "Value", "openwire.consumerid.value", FT_INT64, BASE_DEC, NULL, 0x0, "Openwire ConsumerId Value", HFILL }},
1833 
1834      { &hf_openwire_consumerid_sessionid,
1835         { "SessionId", "openwire.consumerid.sessionid", FT_INT64, BASE_DEC, NULL, 0x0, "Openwire ConsumerId SessionId", HFILL }},
1836 
1837      { &hf_openwire_destination_name,
1838         { "Name", "openwire.destination.name", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire Destination Name", HFILL }},
1839 
1840      { &hf_openwire_messageid_producerid,
1841         { "ProducerId", "openwire.messageid.producerid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire MessageId ProducerId", HFILL }},
1842 
1843      { &hf_openwire_messageid_producersequenceid,
1844         { "ProducerSequenceId", "openwire.messageid.producersequenceid", FT_INT64, BASE_DEC, NULL, 0x0, "Openwire MessageId ProducerSequenceId", HFILL }},
1845 
1846      { &hf_openwire_messageid_brokersequenceid,
1847         { "BrokerSequenceId", "openwire.messageid.brokersequenceid", FT_INT64, BASE_DEC, NULL, 0x0, "Openwire MessageId BrokerSequenceId", HFILL }},
1848 
1849      { &hf_openwire_connectionid_value,
1850         { "Value", "openwire.connectionid.value", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire ConnectionId Value", HFILL }},
1851 
1852      { &hf_openwire_sessionid_connectionid,
1853         { "Connection", "openwire.sessionid.connectionid", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire SessionId ConnectionId", HFILL }},
1854 
1855      { &hf_openwire_sessionid_value,
1856         { "Value", "openwire.sessionid.value", FT_INT64, BASE_DEC, NULL, 0x0, "Openwire SessionId Value", HFILL }},
1857 
1858      { &hf_openwire_brokerid_value,
1859         { "Value", "openwire.brokerid.value", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire BrokerId Value", HFILL }},
1860 
1861      { &hf_openwire_localtransactionid_value,
1862         { "Value", "openwire.localtransactionid.value", FT_INT64, BASE_DEC, NULL, 0x0, "Openwire LocalTransactionId Value", HFILL }},
1863 
1864      { &hf_openwire_localtransactionid_connectionid,
1865         { "ConnectionId", "openwire.localtransactionid.connectionid", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire LocalTransactionId ConnecctionId", HFILL }},
1866 
1867      { &hf_openwire_xatransactionid_formatid,
1868         { "FormatId", "openwire.xatransactionid.formatid", FT_INT32, BASE_DEC, NULL, 0x0, "Openwire XATransactionId FormatId", HFILL }},
1869 
1870      { &hf_openwire_xatransactionid_globaltransactionid,
1871         { "GlobalTransactionId", "openwire.xatransactionid.globaltransactionid", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire XATransactionId GlobalTransactionId", HFILL }},
1872 
1873      { &hf_openwire_xatransactionid_branchqualifier,
1874         { "BranchQualifier", "openwire.xatransactionid.branchqualifier", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire XATransactionId BranchQualifier", HFILL }},
1875 
1876      { &hf_openwire_none,
1877         { "Generic field", "openwire.generic", FT_BYTES, BASE_NONE, NULL, 0x0, "Openwire integer type", HFILL }},
1878 
1879      { &hf_openwire_map_length,
1880         { "Length", "openwire.map.length", FT_INT32, BASE_DEC, NULL, 0x0, "Openwire map length", HFILL }},
1881 
1882      { &hf_openwire_map_key,
1883         { "Key", "openwire.map.key", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire map Key", HFILL }},
1884 
1885      { &hf_openwire_map_entry,
1886         { "Entry", "openwire.map.entry", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire map Entry", HFILL }},
1887 
1888      { &hf_openwire_throwable_class,
1889         { "Class", "openwire.throwable.class", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire Throwable Class", HFILL }},
1890 
1891      { &hf_openwire_throwable_message,
1892         { "Message", "openwire.throwable.message", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire Throwable Message", HFILL }},
1893 
1894      { &hf_openwire_throwable_element,
1895         { "Element", "openwire.throwable.element", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire Throwable Element", HFILL }},
1896 
1897      { &hf_openwire_throwable_classname,
1898         { "ClassName", "openwire.throwable.classname", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire Throwable ClassName", HFILL }},
1899 
1900      { &hf_openwire_throwable_methodname,
1901         { "MethodName", "openwire.throwable.methodname", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire Throwable MethodName", HFILL }},
1902 
1903      { &hf_openwire_throwable_filename,
1904         { "FileName", "openwire.throwable.filename", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire Throwable FileName", HFILL }},
1905 
1906      { &hf_openwire_throwable_linenumber,
1907         { "LineNumber", "openwire.throwable.linenumber", FT_UINT32, BASE_DEC, NULL, 0x0, "Openwire Throwable LineNumber", HFILL }},
1908 
1909      { &hf_openwire_type_integer,
1910         { "Integer", "openwire.type.integer", FT_INT32, BASE_DEC, NULL, 0x0, "Openwire Integer type", HFILL }},
1911 
1912      { &hf_openwire_type_short,
1913         { "Short", "openwire.type.short", FT_INT32, BASE_DEC, NULL, 0x0, "Openwire Short type", HFILL }},
1914 
1915      { &hf_openwire_type_string,
1916         { "String", "openwire.type.string", FT_STRINGZ, BASE_NONE, NULL, 0x0, "Openwire String type", HFILL }},
1917 
1918      { &hf_openwire_type_bytes,
1919         { "Bytes", "openwire.type.bytes", FT_BYTES, BASE_NONE, NULL, 0x0, "Openwire Bytes type", HFILL }},
1920 
1921      { &hf_openwire_type_boolean,
1922         { "Boolean", "openwire.type.boolean", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire Boolean type", HFILL }},
1923 
1924      { &hf_openwire_type_byte,
1925         { "Byte", "openwire.type.byte", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire Byte type", HFILL }},
1926 
1927      { &hf_openwire_type_char,
1928         { "Char", "openwire.type.char", FT_UINT16, BASE_DEC, NULL, 0x0, "Openwire Char type", HFILL }},
1929 
1930      { &hf_openwire_type_long,
1931         { "Long", "openwire.type.long", FT_INT64, BASE_DEC, NULL, 0x0, "Openwire Cong type", HFILL }},
1932 
1933      { &hf_openwire_type_float,
1934         { "Float", "openwire.type.float", FT_FLOAT, BASE_NONE, NULL, 0x0, "Openwire Float type", HFILL }},
1935 
1936      { &hf_openwire_type_double,
1937         { "Double", "openwire.type.double", FT_DOUBLE, BASE_NONE, NULL, 0x0, "Openwire Double type", HFILL }},
1938 
1939      { &hf_openwire_type_notnull,
1940         { "NotNull", "openwire.type.notnull", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire NotNull type", HFILL }},
1941 
1942      { &hf_openwire_cached_inlined,
1943         { "Inlined", "openwire.cached.inlined", FT_UINT8, BASE_DEC, NULL, 0x0, "Openwire Cached Inlined", HFILL }},
1944 
1945      { &hf_openwire_cached_id,
1946         { "CachedID", "openwire.cached.id", FT_UINT16, BASE_DEC, NULL, 0x0, "Openwire Cached ID", HFILL }},
1947 
1948      { &hf_openwire_cached_enabled,
1949         { "CachedEnabled", "openwire.cached.enabled", FT_BOOLEAN, BASE_NONE, NULL, 0x0, "Openwire Cached Enabled", HFILL }},
1950 
1951      { &hf_openwire_type_object,
1952         { "Object", "openwire.type.object", FT_NONE, BASE_NONE, NULL, 0x0, "Openwire object", HFILL }},
1953 
1954      { &hf_openwire_type,
1955         { "Type", "openwire.type", FT_UINT8, BASE_DEC, VALS(openwire_type_vals), 0x0, "Openwire type", HFILL }}
1956 
1957     };
1958     static gint *ett[] = {
1959         &ett_openwire,
1960         &ett_openwire_type
1961     };
1962 
1963     static ei_register_info ei[] = {
1964         { &ei_openwire_encoding_not_supported, { "openwire.encoding_not_supported", PI_PROTOCOL, PI_WARN, "OpenWire encoding not supported by Wireshark or dissector bug", EXPFILL }},
1965         { &ei_openwire_body_type_not_supported, { "openwire.body_type_not_supported", PI_UNDECODED, PI_NOTE, "OpenWire body type not supported by Wireshark", EXPFILL }},
1966         { &ei_openwire_type_not_supported, { "openwire.type.not_supported", PI_UNDECODED, PI_NOTE, "OpenWire type not supported by Wireshark", EXPFILL }},
1967         { &ei_openwire_command_not_supported, { "openwire.command.not_supported", PI_UNDECODED, PI_NOTE, "OpenWire command not supported by Wireshark", EXPFILL }},
1968         { &ei_openwire_tight_encoding_not_supported, { "openwire.tight_encoding_not_supported", PI_UNDECODED, PI_NOTE, "OpenWire tight encoding not supported by Wireshark", EXPFILL }},
1969     };
1970 
1971     module_t *openwire_module;
1972     expert_module_t* expert_openwire;
1973 
1974     proto_openwire = proto_register_protocol("OpenWire", "OpenWire", "openwire");
1975     proto_register_field_array(proto_openwire, hf, array_length(hf));
1976     proto_register_subtree_array(ett, array_length(ett));
1977     expert_openwire = expert_register_protocol(proto_openwire);
1978     expert_register_field_array(expert_openwire, ei, array_length(ei));
1979 
1980     openwire_module = prefs_register_protocol(proto_openwire, NULL);
1981     prefs_register_bool_preference(openwire_module, "desegment",
1982         "Reassemble Openwire messages spanning multiple TCP segments",
1983         "Whether the Openwire dissector should reassemble messages spanning multiple TCP segments."
1984         " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
1985         &openwire_desegment);
1986     prefs_register_bool_preference(openwire_module, "verbose_type",
1987         "Show verbose type information",
1988         "Whether verbose type and length information are displayed in the protocol tree",
1989         &openwire_verbose_type);
1990 }
1991 
1992 void
proto_reg_handoff_openwire(void)1993 proto_reg_handoff_openwire(void)
1994 {
1995     heur_dissector_add("tcp", dissect_openwire_heur, "OpenWire over TCP", "openwire_tcp", proto_openwire, HEURISTIC_ENABLE);
1996     openwire_tcp_handle = create_dissector_handle(dissect_openwire_tcp, proto_openwire);
1997     dissector_add_for_decode_as_with_preference("tcp.port", openwire_tcp_handle);
1998 }
1999 
2000 /*
2001  * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
2002  *
2003  * Local variables:
2004  * c-basic-offset: 4
2005  * tab-width: 8
2006  * indent-tabs-mode: nil
2007  * End:
2008  *
2009  * vi: set shiftwidth=4 tabstop=8 expandtab:
2010  * :indentSize=4:tabSize=8:noTabs=true:
2011  */
2012