HACK: 2nd try to match RowsetProperties
[wireshark-wip.git] / epan / dissectors / packet-hazelcast.c
blob73533e5c5b7315a64e6f4bcc1065d8252196e003
1 /*
2 * packet-hazelcast.c
3 * dissector for hazelcast wire protocol
4 * Paul Erkkila <paul.erkkila@level3.com>
6 * Website: http://www.hazelcast.com/
8 * reversed from this code:
9 * http://code.google.com/p/hazelcast/source/browse/branches/1.9.4/hazelcast/src/main/java/com/hazelcast/nio/Packet.java
11 * $Id$
13 * Wireshark - Network traffic analyzer
14 * By Gerald Combs <gerald@wireshark.org>
15 * Copyright 1998 Gerald Combs
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2 of the License, or
20 * (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License along
28 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
34 #include "config.h"
36 #include <epan/packet.h>
37 #include <epan/prefs.h>
38 #include <epan/tap.h>
39 #include <packet-tcp.h>
42 static int proto_hazelcast = -1;
43 static int hazelcast_tap = -1;
45 static int hf_hazelcast_headerLength = -1;
46 static int hf_hazelcast_headerKeyLength = -1;
47 static int hf_hazelcast_headerValueLength = -1;
48 static int hf_hazelcast_headerVersion = -1;
50 static int hf_hazelcast_operation = -1;
51 static int hf_hazelcast_blockID = -1;
52 static int hf_hazelcast_threadID = -1;
53 static int hf_hazelcast_timeout = -1;
54 static int hf_hazelcast_ttl = -1;
55 static int hf_hazelcast_txnID = -1;
56 static int hf_hazelcast_longValue = -1;
57 static int hf_hazelcast_version = -1;
58 static int hf_hazelcast_lockCount = -1;
59 static int hf_hazelcast_lockAddrIP = -1;
60 static int hf_hazelcast_lockAddrPort = -1;
61 static int hf_hazelcast_callID = -1;
62 static int hf_hazelcast_responseType = -1;
63 static int hf_hazelcast_nameLength = -1;
64 static int hf_hazelcast_name = -1;
65 static int hf_hazelcast_indexCount = -1;
66 static int hf_hazelcast_keyPartitionHash = -1;
67 static int hf_hazelcast_valuePartitionHash = -1;
68 static int hf_hazelcast_keys = -1;
69 static int hf_hazelcast_values = -1;
71 /* flags */
72 static int hf_hazelcast_flags = -1;
74 #define HAZELCAST_LOCKCOUNT_FLAG (1 << 0)
75 #define HAZELCAST_TIMEOUT_FLAG (1 << 1)
76 #define HAZELCAST_TTL_FLAG (1 << 2)
77 #define HAZELCAST_TXN_FLAG (1 << 3)
78 #define HAZELCAST_LONGVALUE_FLAG (1 << 4)
79 #define HAZELCAST_VERSION_FLAG (1 << 5)
80 #define HAZELCAST_CLIENT_FLAG (1 << 6)
81 #define HAZELCAST_LOCKADDRNULL_FLAG (1 << 7)
83 static int hf_hazelcast_flags_lockCount = -1;
84 static int hf_hazelcast_flags_timeout = -1;
85 static int hf_hazelcast_flags_ttl = -1;
86 static int hf_hazelcast_flags_txn = -1;
87 static int hf_hazelcast_flags_longValue = -1;
88 static int hf_hazelcast_flags_version = -1;
89 static int hf_hazelcast_flags_client = -1;
90 static int hf_hazelcast_flags_lockAddrNull = -1;
93 static gint ett_hazelcast = -1;
94 static gint ett_hazelcast_flags = -1;
96 /* prefs */
97 static gboolean hazelcast_desegment = TRUE;
98 static guint gPORT_PREF = 5701;
100 static const value_string operationTypes[] = {
101 {0, "NONE"},
102 {1, "RESPONSE"},
103 {2, "LOG"},
104 {3, "HEARTBEAT"},
105 {4, "JOIN_CHECK"},
106 {5, "REMOTELY_PROCESS"},
107 {6, "REMOTELY_PROCESS_AND_RESPOND"},
108 {7, "REMOTELY_CALLABLE_BOOLEAN"},
109 {8, "REMOTELY_CALLABLE_OBJECT"},
110 {9, "EVENT"},
111 {10, "EXECUTE"},
112 {11, "CANCEL_EXECUTION"},
113 {12, "ADD_LISTENER"},
114 {13, "ADD_LISTENER_NO_RESPONSE"},
115 {14, "REMOVE_LISTENER"},
116 {15, "BLOCKING_ADD_KEY"},
117 {16, "BLOCKING_REMOVE_KEY"},
118 {17, "BLOCKING_OFFER_KEY"},
119 {18, "BLOCKING_GENERATE_KEY"},
120 {19, "BLOCKING_ITERATE"},
121 {20, "BLOCKING_SIZE"},
122 {21, "BLOCKING_TAKE_KEY"},
123 {22, "BLOCKING_CANCEL_TAKE_KEY"},
124 {23, "BLOCKING_SET"},
125 {24, "BLOCKING_PEEK_KEY"},
126 {25, "BLOCKING_GET_KEY_BY_INDEX"},
127 {26, "BLOCKING_GET_INDEX_BY_KEY"},
128 {27, "BLOCKING_QUEUE_POLL"},
129 {28, "BLOCKING_QUEUE_OFFER"},
130 {29, "BLOCKING_QUEUE_SIZE"},
131 {30, "BLOCKING_QUEUE_PEEK"},
132 {31, "BLOCKING_QUEUE_REMOVE"},
133 {32, "TOPIC_PUBLISH"},
134 {33, "ATOMIC_NUMBER_ADD_AND_GET"},
135 {34, "ATOMIC_NUMBER_GET_AND_ADD"},
136 {35, "ATOMIC_NUMBER_GET_AND_SET"},
137 {36, "ATOMIC_NUMBER_COMPARE_AND_SET"},
138 {37, "CONCURRENT_MAP_PUT"},
139 {38, "CONCURRENT_MAP_PUT_ALL"},
140 {39, "CONCURRENT_MAP_PUT_TRANSIENT"},
141 {40, "CONCURRENT_MAP_SET"},
142 {41, "CONCURRENT_MAP_MERGE"},
143 {42, "CONCURRENT_MAP_ASYNC_MERGE"},
144 {43, "CONCURRENT_MAP_WAN_MERGE"},
145 {44, "CONCURRENT_MAP_TRY_PUT"},
146 {45, "CONCURRENT_MAP_PUT_AND_UNLOCK"},
147 {46, "CONCURRENT_MAP_GET"},
148 {47, "CONCURRENT_MAP_GET_ALL"},
149 {48, "CONCURRENT_MAP_REMOVE"},
150 {49, "CONCURRENT_MAP_TRY_REMOVE"},
151 {50, "CONCURRENT_MAP_REMOVE_ITEM"},
152 {51, "CONCURRENT_MAP_GET_MAP_ENTRY"},
153 {52, "CONCURRENT_MAP_GET_DATA_RECORD_ENTRY"},
154 {53, "CONCURRENT_MAP_BLOCK_INFO"},
155 {54, "CONCURRENT_MAP_BLOCK_MIGRATION_CHECK"},
156 {55, "CONCURRENT_MAP_SIZE"},
157 {56, "CONCURRENT_MAP_CONTAINS_KEY"},
158 {57, "CONCURRENT_MAP_CONTAINS_ENTRY"},
159 {58, "CONCURRENT_MAP_ITERATE_ENTRIES"},
160 {59, "CONCURRENT_MAP_ITERATE_KEYS"},
161 {60, "CONCURRENT_MAP_ITERATE_KEYS_ALL"},
162 {61, "CONCURRENT_MAP_ITERATE_VALUES"},
163 {62, "CONCURRENT_MAP_LOCK"},
164 {63, "CONCURRENT_MAP_LOCK_MAP"},
165 {64, "CONCURRENT_MAP_UNLOCK"},
166 {65, "CONCURRENT_MAP_FORCE_UNLOCK"},
167 {66, "CONCURRENT_MAP_UNLOCK_MAP"},
168 {67, "CONCURRENT_MAP_BLOCKS"},
169 {68, "CONCURRENT_MAP_CONTAINS_VALUE"},
170 {69, "CONCURRENT_MAP_PUT_IF_ABSENT"},
171 {70, "CONCURRENT_MAP_REMOVE_IF_SAME"},
172 {71, "CONCURRENT_MAP_REPLACE_IF_NOT_NULL"},
173 {72, "CONCURRENT_MAP_REPLACE_IF_SAME"},
174 {73, "CONCURRENT_MAP_TRY_LOCK_AND_GET"},
175 {74, "CONCURRENT_MAP_ADD_TO_LIST"},
176 {75, "CONCURRENT_MAP_ADD_TO_SET"},
177 {76, "CONCURRENT_MAP_MIGRATE_RECORD"},
178 {77, "CONCURRENT_MAP_PUT_MULTI"},
179 {78, "CONCURRENT_MAP_REMOVE_MULTI"},
180 {79, "CONCURRENT_MAP_VALUE_COUNT"},
181 {80, "CONCURRENT_MAP_BACKUP_PUT"},
182 {81, "CONCURRENT_MAP_BACKUP_REMOVE"},
183 {82, "CONCURRENT_MAP_BACKUP_REMOVE_MULTI"},
184 {83, "CONCURRENT_MAP_BACKUP_LOCK"},
185 {84, "CONCURRENT_MAP_BACKUP_ADD"},
186 {85, "CONCURRENT_MAP_INVALIDATE"},
187 {86, "CONCURRENT_MAP_EVICT"},
188 {87, "CONCURRENT_MAP_FLUSH"},
189 {88, "TRANSACTION_BEGIN"},
190 {89, "TRANSACTION_COMMIT"},
191 {90, "TRANSACTION_ROLLBACK"},
192 {91, "DESTROY"},
193 {92, "GET_ID"},
194 {93, "NEW_ID"},
195 {94, "ADD_INDEX"},
196 {95, "GET_INSTANCES"},
197 {96, "GET_MEMBERS"},
198 {97, "GET_CLUSTER_TIME"},
199 {98, "CLIENT_AUTHENTICATE"},
200 {99, "CLIENT_ADD_INSTANCE_LISTENER"},
201 {100, "CLIENT_GET_PARTITIONS"},
202 {101, "BLOCKING_QUEUE_REMAINING_CAPACITY"},
203 {102, "BLOCKING_QUEUE_ENTRIES"},
204 {103, "COUNT_DOWN_LATCH_AWAIT"},
205 {104, "COUNT_DOWN_LATCH_COUNT_DOWN"},
206 {105, "COUNT_DOWN_LATCH_DESTROY"},
207 {106, "COUNT_DOWN_LATCH_GET_COUNT"},
208 {107, "COUNT_DOWN_LATCH_GET_OWNER"},
209 {108, "COUNT_DOWN_LATCH_SET_COUNT"},
210 {109, "SEMAPHORE_ATTACH_DETACH_PERMITS"},
211 {110, "SEMAPHORE_CANCEL_ACQUIRE"},
212 {111, "SEMAPHORE_DESTROY"},
213 {112, "SEMAPHORE_DRAIN_PERMITS"},
214 {113, "SEMAPHORE_GET_ATTACHED_PERMITS"},
215 {114, "SEMAPHORE_GET_AVAILABLE_PERMITS"},
216 {115, "SEMAPHORE_REDUCE_PERMITS"},
217 {116, "SEMAPHORE_RELEASE"},
218 {117, "SEMAPHORE_TRY_ACQUIRE"},
219 {118, "LOCK_LOCK"},
220 {119, "LOCK_UNLOCK"},
221 {120, "LOCK_FORCE_UNLOCK"},
222 {0 , NULL}
224 static value_string_ext operationTypes_ext = VALUE_STRING_EXT_INIT(operationTypes);
226 static const value_string responseTypes[] = {
227 {2, "RESPONSE_NONE"},
228 {3, "RESPONSE_SUCCESS"},
229 {4, "RESPONSE_FAILURE"},
230 {5, "RESPONSE_REDO"},
231 {0, NULL}
233 static value_string_ext responseTypes_ext = VALUE_STRING_EXT_INIT(responseTypes);
238 /* Get the length of a single HAZELCAST message */
239 static guint get_hazelcast_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset) {
241 guint messageLength;
242 guint headerKeyLength;
243 guint headerValueLength;
245 messageLength = tvb_get_ntohl(tvb, offset);
247 headerKeyLength = tvb_get_ntohl(tvb, offset+4);
249 headerValueLength = tvb_get_ntohl(tvb, offset+8);
252 * * That length doesn't include the length of the header itself add that in.
254 return messageLength + headerKeyLength + headerValueLength + 13;
258 static int dissect_hazelcast_message(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) {
260 guint8 version;
262 guint8 flags;
263 guint8 operation;
265 guint8 lockCountFlag;
266 guint8 timeoutFlag;
267 guint8 ttlFlag;
268 guint8 txnFlag;
269 guint8 longValueFlag;
270 guint8 versionFlag;
271 guint8 lockAddrNullFlag;
273 guint32 nameLength;
274 guint32 keyLength;
275 guint32 valueLength;
276 gint offset = 0;
278 proto_tree *hcast_tree = NULL;
279 proto_tree *flag_tree = NULL;
281 proto_item *tf = NULL;
283 /* Make entries in Protocol column and Info column on summary display */
284 col_set_str(pinfo->cinfo, COL_PROTOCOL, "HAZELCAST");
285 col_set_str(pinfo->cinfo, COL_INFO, "Hazelcast distributed object goodness");
287 if (tree) {
289 proto_item *ti = NULL;
290 ti = proto_tree_add_item(tree, proto_hazelcast, tvb, 0, -1, ENC_NA);
292 hcast_tree = proto_item_add_subtree(ti, ett_hazelcast);
294 if (tvb_length_remaining(tvb, 0) < 13) {
295 col_set_str(pinfo->cinfo, COL_INFO, "Hazelcast too short");
296 return 0;
299 version = tvb_get_guint8(tvb, 12);
300 if ( version != 6 ) {
301 col_set_str(pinfo->cinfo, COL_INFO, "Hazelcast unsupported version");
302 return 12;
305 proto_tree_add_item(hcast_tree, hf_hazelcast_headerLength, tvb, offset, 4, ENC_BIG_ENDIAN);
306 offset += 4;
307 proto_tree_add_item(hcast_tree, hf_hazelcast_headerKeyLength, tvb, offset, 4, ENC_BIG_ENDIAN);
308 keyLength = tvb_get_ntohl(tvb, offset);
309 offset += 4;
310 proto_tree_add_item(hcast_tree, hf_hazelcast_headerValueLength, tvb, offset, 4, ENC_BIG_ENDIAN);
311 valueLength = tvb_get_ntohl(tvb, offset);
312 offset += 4;
313 proto_tree_add_item(hcast_tree, hf_hazelcast_headerVersion, tvb, offset, 1, ENC_BIG_ENDIAN);
314 offset += 1;
317 proto_tree_add_item(hcast_tree, hf_hazelcast_operation, tvb, offset, 1, ENC_BIG_ENDIAN);
318 operation = tvb_get_guint8(tvb, offset);
319 col_add_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str(operation, operationTypes, "Unknown (0x%02x)"));
320 offset += 1;
322 proto_tree_add_item(hcast_tree, hf_hazelcast_blockID, tvb, offset, 4, ENC_BIG_ENDIAN);
323 offset += 4;
324 proto_tree_add_item(hcast_tree, hf_hazelcast_threadID, tvb, offset, 4, ENC_BIG_ENDIAN);
325 offset += 4;
327 flags = tvb_get_guint8(tvb, offset);
329 tf = proto_tree_add_item(hcast_tree, hf_hazelcast_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
331 flag_tree = proto_item_add_subtree(tf, ett_hazelcast_flags);
333 proto_tree_add_item(flag_tree, hf_hazelcast_flags_lockCount, tvb, offset, 1, ENC_BIG_ENDIAN);
334 proto_tree_add_item(flag_tree, hf_hazelcast_flags_timeout, tvb, offset, 1, ENC_BIG_ENDIAN);
335 proto_tree_add_item(flag_tree, hf_hazelcast_flags_ttl, tvb, offset, 1, ENC_BIG_ENDIAN);
336 proto_tree_add_item(flag_tree, hf_hazelcast_flags_txn, tvb, offset, 1, ENC_BIG_ENDIAN);
337 proto_tree_add_item(flag_tree, hf_hazelcast_flags_longValue, tvb, offset, 1, ENC_BIG_ENDIAN);
338 proto_tree_add_item(flag_tree, hf_hazelcast_flags_version, tvb, offset, 1, ENC_BIG_ENDIAN);
339 proto_tree_add_item(flag_tree, hf_hazelcast_flags_client, tvb, offset, 1, ENC_BIG_ENDIAN);
340 proto_tree_add_item(flag_tree, hf_hazelcast_flags_lockAddrNull, tvb, offset, 1, ENC_BIG_ENDIAN);
343 lockCountFlag = flags & HAZELCAST_LOCKCOUNT_FLAG;
344 timeoutFlag = flags & HAZELCAST_TIMEOUT_FLAG;
345 ttlFlag = flags & HAZELCAST_TTL_FLAG;
346 txnFlag = flags & HAZELCAST_TXN_FLAG;
347 longValueFlag = flags & HAZELCAST_LONGVALUE_FLAG;
348 versionFlag = flags & HAZELCAST_VERSION_FLAG;
349 lockAddrNullFlag = flags & HAZELCAST_LOCKADDRNULL_FLAG;
351 offset += 1;
354 if ( lockCountFlag ) {
355 proto_tree_add_item(hcast_tree, hf_hazelcast_lockCount, tvb, offset, 4, ENC_BIG_ENDIAN);
356 offset += 4;
359 if ( timeoutFlag ) {
360 proto_tree_add_item(hcast_tree, hf_hazelcast_timeout, tvb, offset, 8, ENC_BIG_ENDIAN);
361 offset += 8;
364 if ( ttlFlag ) {
365 proto_tree_add_item(hcast_tree, hf_hazelcast_ttl, tvb, offset, 8, ENC_BIG_ENDIAN);
366 offset += 8;
369 if ( txnFlag ) {
370 proto_tree_add_item(hcast_tree, hf_hazelcast_txnID, tvb, offset, 8, ENC_BIG_ENDIAN);
371 offset += 8;
374 if ( longValueFlag ) {
375 proto_tree_add_item(hcast_tree, hf_hazelcast_longValue, tvb, offset, 8, ENC_BIG_ENDIAN);
376 offset += 8;
379 if ( versionFlag ) {
380 proto_tree_add_item(hcast_tree, hf_hazelcast_version, tvb, offset, 8, ENC_BIG_ENDIAN);
381 offset += 8;
384 if ( lockAddrNullFlag == 0 ) {
385 proto_tree_add_item(hcast_tree, hf_hazelcast_lockAddrIP, tvb, offset, 4, ENC_BIG_ENDIAN);
386 offset += 4;
387 proto_tree_add_item(hcast_tree, hf_hazelcast_lockAddrPort, tvb, offset, 4, ENC_BIG_ENDIAN);
388 offset += 4;
391 proto_tree_add_item(hcast_tree, hf_hazelcast_callID, tvb, offset, 8, ENC_BIG_ENDIAN);
392 offset += 8;
394 proto_tree_add_item(hcast_tree, hf_hazelcast_responseType, tvb, offset, 1, ENC_BIG_ENDIAN);
395 offset += 1;
397 proto_tree_add_item(hcast_tree, hf_hazelcast_nameLength, tvb, offset, 4, ENC_BIG_ENDIAN);
398 nameLength = tvb_get_ntohl(tvb, offset);
399 offset += 4;
401 if ( nameLength > 0 ) {
402 proto_tree_add_item(hcast_tree, hf_hazelcast_name, tvb, offset, nameLength, ENC_ASCII);
403 offset += nameLength;
406 proto_tree_add_item(hcast_tree, hf_hazelcast_indexCount, tvb, offset, 1, ENC_BIG_ENDIAN);
407 offset += 1;
409 proto_tree_add_item(hcast_tree, hf_hazelcast_keyPartitionHash, tvb, offset, 4, ENC_BIG_ENDIAN);
410 offset += 4;
412 proto_tree_add_item(hcast_tree, hf_hazelcast_valuePartitionHash, tvb, offset, 4, ENC_BIG_ENDIAN);
413 offset += 4;
415 if ( keyLength > 0 ) {
416 proto_tree_add_item(hcast_tree, hf_hazelcast_keys, tvb, offset, keyLength, ENC_NA);
417 offset += keyLength;
420 if ( valueLength > 0 ) {
421 proto_tree_add_item(hcast_tree, hf_hazelcast_values, tvb, offset, valueLength, ENC_NA);
422 /*offset += valueLength;*/
425 return tvb_length(tvb);
429 * Code to actually dissect the packets
431 * this really just works in TCP reassembly and calls the real dissector
434 static int dissect_hazelcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) {
436 tcp_dissect_pdus(tvb, pinfo, tree, hazelcast_desegment, 13, get_hazelcast_message_len, dissect_hazelcast_message, data);
437 return tvb_length(tvb);
440 void proto_register_hazelcast(void) {
442 static hf_register_info hf[] = {
444 { &hf_hazelcast_headerLength,
445 { "Hazelcast hdr length", "hazelcast.hdr.length", FT_UINT32, BASE_DEC, NULL, 0x0, "header length", HFILL }
447 { &hf_hazelcast_headerKeyLength,
448 { "Hazelcast hdr key length", "hazelcast.hdr.keylength", FT_UINT32, BASE_DEC, NULL, 0x0, "header key length", HFILL }
450 { &hf_hazelcast_headerValueLength,
451 { "Hazelcast hdr value length", "hazelcast.hdr.valuelength", FT_UINT32, BASE_DEC, NULL, 0x0, "header value length", HFILL }
453 { &hf_hazelcast_headerVersion,
454 { "Hazelcast hdr version", "hazelcast.hdr.version", FT_UINT8, BASE_DEC, NULL, 0x0, "header version", HFILL }
456 { &hf_hazelcast_operation,
457 { "Hazelcast operation", "hazelcast.operation", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &operationTypes_ext, 0x0, "operation", HFILL }
459 { &hf_hazelcast_blockID,
460 { "Hazelcast blockID", "hazelcast.blockID", FT_UINT32, BASE_HEX, NULL, 0x0, "blockID", HFILL }
462 { &hf_hazelcast_threadID,
463 { "Hazelcast threadID", "hazelcast.threadID", FT_UINT32, BASE_DEC, NULL, 0x0, "threadID", HFILL }
465 { &hf_hazelcast_flags,
466 { "hazelcast flags", "hazelcast.flags", FT_UINT32, BASE_HEX, NULL, 0x0, "flags", HFILL }
468 { &hf_hazelcast_flags_lockCount,
469 { "hazelcast lockCount flag", "hazelcast.flags.lockCount", FT_BOOLEAN, 8, NULL, HAZELCAST_LOCKCOUNT_FLAG, NULL, HFILL }
471 { &hf_hazelcast_flags_timeout,
472 { "hazelcast timeout flag", "hazelcast.flags.timeout", FT_BOOLEAN, 8, NULL, HAZELCAST_TIMEOUT_FLAG, NULL, HFILL }
474 { &hf_hazelcast_flags_ttl,
475 { "hazelcast ttl flag", "hazelcast.flags.ttl", FT_BOOLEAN, 8, NULL, HAZELCAST_TTL_FLAG, NULL, HFILL }
477 { &hf_hazelcast_flags_txn,
478 { "hazelcast txn flag", "hazelcast.flags.txn", FT_BOOLEAN, 8, NULL, HAZELCAST_TXN_FLAG, NULL, HFILL }
480 { &hf_hazelcast_flags_longValue,
481 { "hazelcast longValue flag", "hazelcast.flags.longValue", FT_BOOLEAN, 8, NULL, HAZELCAST_LONGVALUE_FLAG, NULL, HFILL }
483 { &hf_hazelcast_flags_version,
484 { "hazelcast version flag", "hazelcast.flags.version", FT_BOOLEAN, 8, NULL, HAZELCAST_VERSION_FLAG, NULL, HFILL }
486 { &hf_hazelcast_flags_client,
487 { "hazelcast client flag", "hazelcast.flags.client", FT_BOOLEAN, 8, NULL, HAZELCAST_CLIENT_FLAG, NULL, HFILL }
489 { &hf_hazelcast_flags_lockAddrNull,
490 { "hazelcast lockAddrNull flag", "hazelcast.flags.lockAddrNull", FT_BOOLEAN, 8, NULL, HAZELCAST_LOCKADDRNULL_FLAG, NULL, HFILL }
492 { &hf_hazelcast_timeout,
493 { "hazelcast timeout", "hazelcast.timeout", FT_UINT64, BASE_DEC, NULL, 0x0, "timeout", HFILL }
495 { &hf_hazelcast_ttl,
496 { "hazelcast ttl", "hazelcast.ttl", FT_UINT64, BASE_DEC, NULL, 0x0, "ttl", HFILL }
498 { &hf_hazelcast_longValue,
499 { "hazelcast longValue", "hazelcast.longValue", FT_UINT64, BASE_DEC, NULL, 0x0, "longValue", HFILL }
501 { &hf_hazelcast_txnID,
502 { "hazelcast txnID", "hazelcast.txnID", FT_UINT64, BASE_DEC, NULL, 0x0, "txnID", HFILL }
504 { &hf_hazelcast_version,
505 { "hazelcast version", "hazelcast.version", FT_UINT64, BASE_DEC, NULL, 0x0, "version", HFILL }
507 { &hf_hazelcast_lockCount,
508 { "hazelcast lockCount", "hazelcast.lockCount", FT_UINT32, BASE_DEC, NULL, 0x0, "lockCount", HFILL }
510 { &hf_hazelcast_lockAddrIP,
511 { "hazelcast lock address IP", "hazelcast.lockaddr.ip", FT_IPv4, BASE_NONE, NULL, 0x0, "lockAddrIP", HFILL }
513 { &hf_hazelcast_lockAddrPort,
514 { "hazelcast lock address Port", "hazelcast.lockaddr.port", FT_UINT32, BASE_DEC, NULL, 0x0, "lockAddrPort", HFILL }
516 { &hf_hazelcast_callID,
517 { "hazelcast callID", "hazelcast.callID", FT_INT64, BASE_DEC, NULL, 0x0, "callID", HFILL }
519 { &hf_hazelcast_responseType,
520 { "hazelcast response type", "hazelcast.responseType", FT_UINT8, BASE_DEC|BASE_EXT_STRING, &responseTypes_ext, 0x0, "responseType", HFILL }
522 { &hf_hazelcast_nameLength,
523 { "hazelcast name length", "hazelcast.nameLength", FT_UINT32, BASE_DEC, NULL, 0x0, "nameLength", HFILL }
525 { &hf_hazelcast_name,
526 { "hazelcast name", "hazelcast.name", FT_STRING, BASE_NONE, NULL, 0x0, "name", HFILL }
528 { &hf_hazelcast_indexCount,
529 { "hazelcast indexCount", "hazelcast.indexCount", FT_UINT8, BASE_DEC, NULL, 0x0, "indexCount", HFILL }
531 { &hf_hazelcast_keyPartitionHash,
532 { "hazelcast keyPartitionHash", "hazelcast.keyPartitionHash", FT_UINT32, BASE_HEX, NULL, 0x0, "keyPartitionHash", HFILL }
534 { &hf_hazelcast_valuePartitionHash,
535 { "hazelcast valuePartitionHash", "hazelcast.valuePartitionHash", FT_UINT32, BASE_HEX, NULL, 0x0, "valuePartitionHash", HFILL }
537 { &hf_hazelcast_keys,
538 { "hazelcast keys", "hazelcast.keys", FT_BYTES, BASE_NONE, NULL, 0x0, "keys", HFILL }
540 { &hf_hazelcast_values,
541 { "hazelcast values", "hazelcast.values", FT_BYTES, BASE_NONE, NULL, 0x0, "values", HFILL }
546 /* Setup protocol subtree array */
547 static gint *ett[] = {
548 &ett_hazelcast,
549 &ett_hazelcast_flags
552 module_t *hazelcast_module;
555 proto_hazelcast = proto_register_protocol (
556 "Hazelcast Wire Protocol", /* name */
557 "HAZELCAST", /* short name */
558 "hzlcst" /* abbrev */
561 proto_register_field_array(proto_hazelcast, hf, array_length(hf));
562 proto_register_subtree_array(ett, array_length(ett));
564 hazelcast_module = prefs_register_protocol(proto_hazelcast, NULL);
566 prefs_register_bool_preference(hazelcast_module, "desegment",
567 "Reassemble hazelcast messages spanning multiple TCP segments",
568 "Whether the hazel dissector should reassemble messages spanning multiple TCP segments."
569 " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
570 &hazelcast_desegment);
572 prefs_register_uint_preference(hazelcast_module, "tcp.port",
573 "Hazelcast TCP Port",
574 " Hazelcast TCP port if other than the default",
576 &gPORT_PREF);
578 hazelcast_tap = register_tap("hzlcst");
583 void
584 proto_reg_handoff_hazelcast(void) {
585 static gboolean initialized = FALSE;
586 static dissector_handle_t hazelcast_handle;
587 static int currentPort;
589 if (!initialized) {
590 hazelcast_handle = new_create_dissector_handle(dissect_hazelcast, proto_hazelcast);
591 initialized = TRUE;
592 } else {
593 dissector_delete_uint("tcp.port", currentPort, hazelcast_handle);
596 currentPort = gPORT_PREF;
597 dissector_add_uint("tcp.port", currentPort, hazelcast_handle);
601 * Editor modelines - http://www.wireshark.org/tools/modelines.html
603 * Local variables:
604 * c-basic-offset: 4
605 * tab-width: 8
606 * indent-tabs-mode: nil
607 * End:
609 * vi: set shiftwidth=4 tabstop=8 expandtab:
610 * :indentSize=4:tabSize=8:noTabs=true: