Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-glusterd.c
blob05636504454bfe3aaeb898ef0e9b1f726cc42a50
1 /* packet-gluster_glusterd.c
2 * Routines for Gluster Daemon Management dissection
3 * Copyright 2012, Niels de Vos <ndevos@redhat.com>
4 * With contributions from:
5 * Shreedhara LG <shreedharlg@gmail.com>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * SPDX-License-Identifier: GPL-2.0-or-later
14 * References to source files point in general to the glusterfs sources.
15 * There is currently no RFC or other document where the protocol is
16 * completely described. The glusterfs sources can be found at:
17 * - https://github.com/gluster/glusterfs
19 * The coding-style is roughly the same as the one use in the Linux kernel,
20 * see http://www.kernel.org/doc/Documentation/CodingStyle.
23 #include "config.h"
25 #include <epan/packet.h>
27 #include "packet-rpc.h"
28 #include "packet-gluster.h"
30 void proto_register_gluster_gd_mgmt(void);
31 void proto_reg_handoff_gluster_gd_mgmt(void);
33 /* Initialize the protocol and registered fields */
34 static int proto_glusterd;
35 static int proto_gd_mgmt;
36 static int proto_gd_brick;
37 static int proto_gd_friend;
39 /* programs and procedures */
40 static int hf_gd_mgmt_proc;
41 static int hf_gd_mgmt_2_proc;
42 static int hf_gd_mgmt_3_proc;
43 static int hf_gd_mgmt_brick_2_proc;
44 static int hf_glusterd_friend_proc;
46 /* fields used by multiple programs/procedures */
47 static int hf_glusterd_dict;
48 static int hf_glusterd_op;
49 static int hf_glusterd_op_ret;
50 static int hf_glusterd_op_errstr;
51 static int hf_glusterd_uuid;
52 static int hf_glusterd_tnx_id;
53 static int hf_glusterd_hostname;
54 static int hf_glusterd_port;
55 static int hf_glusterd_vols;
56 static int hf_glusterd_buf;
57 static int hf_glusterd_name;
59 /* Initialize the subtree pointers */
60 static int ett_gd_mgmt;
61 static int ett_gd_brick;
62 static int ett_gd_friend;
64 /* the UUID is the same as a GlusterFS GFID, except it's encoded per byte */
65 static int
66 gluster_gd_mgmt_dissect_uuid(tvbuff_t *tvb, proto_tree *tree, int hfindex,
67 int offset)
69 if (tree) {
70 e_guid_t uuid;
71 int start_offset = offset;
73 uuid.data1 = (tvb_get_ntohl(tvb, offset) & 0xff) << 24 |
74 (tvb_get_ntohl(tvb, offset+4) & 0xff) << 16 |
75 (tvb_get_ntohl(tvb, offset+8) & 0xff) << 8 |
76 (tvb_get_ntohl(tvb, offset+12) & 0xff);
77 offset += 16;
78 uuid.data2 = (tvb_get_ntohl(tvb, offset) & 0xff) << 8 |
79 (tvb_get_ntohl(tvb, offset+4) & 0xff);
80 offset += 8;
81 uuid.data3 = (tvb_get_ntohl(tvb, offset) & 0xff) << 8 |
82 (tvb_get_ntohl(tvb, offset+4) & 0xff);
83 offset += 8;
84 uuid.data4[0] = tvb_get_ntohl(tvb, offset);
85 offset += 4;
86 uuid.data4[1] = tvb_get_ntohl(tvb, offset);
87 offset += 4;
88 uuid.data4[2] = tvb_get_ntohl(tvb, offset);
89 offset += 4;
90 uuid.data4[3] = tvb_get_ntohl(tvb, offset);
91 offset += 4;
92 uuid.data4[4] = tvb_get_ntohl(tvb, offset);
93 offset += 4;
94 uuid.data4[5] = tvb_get_ntohl(tvb, offset);
95 offset += 4;
96 uuid.data4[6] = tvb_get_ntohl(tvb, offset);
97 offset += 4;
98 uuid.data4[7] = tvb_get_ntohl(tvb, offset);
99 offset += 4;
100 proto_tree_add_guid(tree, hfindex, tvb, start_offset, 4*16, &uuid);
101 } else
102 offset += 16 * 4;
104 return offset;
107 static int
108 gluster_gd_mgmt_probe_reply(tvbuff_t *tvb, packet_info *pinfo,
109 proto_tree *tree, void* data)
111 int offset = 0;
113 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
114 offset);
115 offset = dissect_rpc_string(tvb, tree, hf_glusterd_hostname, offset,
116 NULL);
117 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_port, offset);
118 offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree, data);
120 return offset;
123 static int
124 gluster_gd_mgmt_probe_call(tvbuff_t *tvb, packet_info *pinfo _U_,
125 proto_tree *tree, void* data _U_)
127 int offset = 0;
128 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
129 offset);
130 offset = dissect_rpc_string(tvb, tree, hf_glusterd_hostname, offset,
131 NULL);
132 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_port, offset);
134 return offset;
137 static int
138 gluster_gd_mgmt_friend_add_reply(tvbuff_t *tvb,
139 packet_info *pinfo, proto_tree *tree, void* data)
141 int offset = 0;
143 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
144 offset);
145 offset = dissect_rpc_string(tvb, tree, hf_glusterd_hostname, offset,
146 NULL);
147 offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree, data);
148 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_port, offset);
150 return offset;
153 static int
154 gluster_gd_mgmt_friend_add_call(tvbuff_t *tvb,
155 packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
157 int offset = 0;
159 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
160 offset);
161 offset = dissect_rpc_string(tvb, tree, hf_glusterd_hostname, offset,
162 NULL);
163 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_port, offset);
164 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_vols, offset);
166 return offset;
169 /* gluster_gd_mgmt_cluster_lock_reply is used for LOCK and UNLOCK */
170 static int
171 gluster_gd_mgmt_cluster_lock_reply(tvbuff_t *tvb,
172 packet_info *pinfo, proto_tree *tree, void* data)
174 int offset = 0;
176 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
177 offset);
178 offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree, data);
180 return offset;
183 /* gluster_gd_mgmt_cluster_lock_call is used for LOCK and UNLOCK */
184 static int
185 gluster_gd_mgmt_cluster_lock_call(tvbuff_t *tvb,
186 packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
188 return gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid, 0);
191 static int
192 gluster_gd_mgmt_stage_op_reply(tvbuff_t *tvb, packet_info *pinfo,
193 proto_tree *tree, void* data)
195 int offset = 0;
196 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
197 offset);
198 offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree, data);
199 offset = dissect_rpc_string(tvb, tree, hf_glusterd_op_errstr, offset,
200 NULL);
201 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset);
202 return offset;
205 static int
206 gluster_gd_mgmt_stage_op_call(tvbuff_t *tvb,
207 packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
209 int offset = 0;
210 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
211 offset);
212 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_op, offset);
213 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset);
215 return offset;
218 static int
219 gluster_gd_mgmt_commit_op_reply(tvbuff_t *tvb, packet_info *pinfo,
220 proto_tree *tree, void* data)
222 int offset = 0;
223 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
224 offset);
225 offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree, data);
226 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_buf, offset);
227 offset = dissect_rpc_string(tvb, tree, hf_glusterd_op_errstr, offset,
228 NULL);
229 return offset;
232 static int
233 gluster_gd_mgmt_commit_op_call(tvbuff_t *tvb,
234 packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
236 int offset = 0;
237 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
238 offset);
239 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_op, offset);
240 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_buf,
241 offset);
243 return offset;
246 static int
247 gluster_gd_mgmt_friend_update_reply(tvbuff_t *tvb,
248 packet_info *pinfo, proto_tree *tree, void* data)
250 int offset = 0;
251 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
252 offset);
253 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_op, offset);
254 offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree, data);
256 return offset;
259 static int
260 gluster_gd_mgmt_friend_update_call(tvbuff_t *tvb,
261 packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
263 int offset = 0;
264 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
265 offset);
266 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_vols,
267 offset);
268 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_port, offset);
270 return offset;
273 /* Below procedure is used for version 2 */
274 static int
275 glusterd_mgmt_2_cluster_lock_reply(tvbuff_t *tvb,
276 packet_info *pinfo, proto_tree *tree, void* data)
278 int offset = 0;
279 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
280 offset);
281 offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree, data);
283 return offset;
286 /* glusterd__mgmt_2_cluster_lock_call is used for LOCK and UNLOCK */
287 static int
288 glusterd_mgmt_2_cluster_lock_call(tvbuff_t *tvb,
289 packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
291 return gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid, 0);
294 static int
295 glusterd_mgmt_2_stage_op_reply(tvbuff_t *tvb, packet_info *pinfo,
296 proto_tree *tree, void* data)
298 int offset = 0;
299 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
300 offset);
301 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_op, offset);
302 offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree, data);
303 offset = dissect_rpc_string(tvb, tree, hf_glusterd_op_errstr, offset,
304 NULL);
305 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset);
307 return offset;
310 static int
311 glusterd_mgmt_2_stage_op_call(tvbuff_t *tvb,
312 packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
314 int offset = 0;
315 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
316 offset);
317 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_op, offset);
318 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset);
320 return offset;
323 static int
324 glusterd_mgmt_2_commit_op_reply(tvbuff_t *tvb, packet_info *pinfo,
325 proto_tree *tree, void* data)
327 int offset = 0;
328 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
329 offset);
330 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_op, offset);
331 offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree, data);
332 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_buf, offset);
333 offset = dissect_rpc_string(tvb, tree, hf_glusterd_op_errstr, offset,
334 NULL);
336 return offset;
339 static int
340 glusterd_mgmt_2_commit_op_call(tvbuff_t *tvb,
341 packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
343 int offset = 0;
344 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
345 offset);
346 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_op, offset);
347 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_buf, offset);
349 return offset;
352 /* glusterd_mgmt_3_lock_call is used for LOCK and UNLOCK */
353 static int
354 glusterd_mgmt_3_lock_call(tvbuff_t *tvb, packet_info *pinfo _U_,
355 proto_tree *tree, void* data _U_)
357 int offset = 0;
358 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
359 offset);
360 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_tnx_id,
361 offset);
362 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_op, offset);
363 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset);
365 return offset;
368 static int
369 glusterd_mgmt_3_lock_reply(tvbuff_t *tvb, packet_info *pinfo,
370 proto_tree *tree, void* data)
372 int offset = 0;
373 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
374 offset);
375 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_tnx_id,
376 offset);
377 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset);
378 offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree, data);
379 return offset;
382 static int
383 glusterd_mgmt_3_pre_val_call(tvbuff_t *tvb,
384 packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
386 int offset = 0;
387 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
388 offset);
389 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_op, offset);
390 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset);
392 return offset;
395 static int
396 glusterd_mgmt_3_pre_val_reply(tvbuff_t *tvb, packet_info *pinfo,
397 proto_tree *tree, void* data)
399 int offset = 0;
400 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
401 offset);
402 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_op, offset);
403 offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree, data);
404 offset = dissect_rpc_string(tvb, tree, hf_glusterd_op_errstr, offset,
405 NULL);
406 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset);
407 return offset;
410 static int
411 glusterd_mgmt_3_commit_reply(tvbuff_t *tvb, packet_info *pinfo,
412 proto_tree *tree, void* data)
414 int offset = 0;
415 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
416 offset);
417 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_op, offset);
418 offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree, data);
419 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset);
420 offset = dissect_rpc_string(tvb, tree, hf_glusterd_op_errstr, offset,
421 NULL);
422 return offset;
425 static int
426 glusterd_mgmt_3_post_val_call(tvbuff_t *tvb,
427 packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
429 int offset = 0;
430 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
431 offset);
432 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_op, offset);
433 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_op_ret, offset);
434 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset);
436 return offset;
440 /* Brick management common function */
442 static int
443 glusterd_brick_2_common_reply(tvbuff_t *tvb, packet_info *pinfo,
444 proto_tree *tree, void* data)
446 int offset = 0;
447 offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree, data);
448 offset = dissect_rpc_string(tvb, tree, hf_glusterd_op_errstr, offset,
449 NULL);
450 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset);
452 return offset;
455 static int
456 glusterd_brick_2_common_call(tvbuff_t *tvb,
457 packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
459 int offset = 0;
460 offset = dissect_rpc_string(tvb, tree, hf_glusterd_name, offset,
461 NULL);
462 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_op, offset);
463 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset);
465 return offset;
469 * GD_MGMT_PROGRAM
470 * - xlators/mgmt/glusterd/src/glusterd-handler.c: "GlusterD svc mgmt"
471 * - xlators/mgmt/glusterd/src/glusterd-rpc-ops.c: "glusterd clnt mgmt"
473 static const vsff gd_mgmt_proc[] = {
475 GD_MGMT_NULL, "NULL",
476 dissect_rpc_void, dissect_rpc_void
479 GD_MGMT_PROBE_QUERY, "PROBE_QUERY",
480 gluster_gd_mgmt_probe_call, gluster_gd_mgmt_probe_reply
483 GD_MGMT_FRIEND_ADD, "FRIEND_ADD",
484 gluster_gd_mgmt_friend_add_call,
485 gluster_gd_mgmt_friend_add_reply
488 GD_MGMT_CLUSTER_LOCK, "CLUSTER_LOCK",
489 gluster_gd_mgmt_cluster_lock_call,
490 gluster_gd_mgmt_cluster_lock_reply
493 GD_MGMT_CLUSTER_UNLOCK, "CLUSTER_UNLOCK",
494 /* UNLOCK seems to be the same a LOCK, re-use the function */
495 gluster_gd_mgmt_cluster_lock_call,
496 gluster_gd_mgmt_cluster_lock_reply
499 GD_MGMT_STAGE_OP, "STAGE_OP",
500 gluster_gd_mgmt_stage_op_call, gluster_gd_mgmt_stage_op_reply
503 GD_MGMT_COMMIT_OP, "COMMIT_OP",
504 gluster_gd_mgmt_commit_op_call, gluster_gd_mgmt_commit_op_reply
506 { GD_MGMT_FRIEND_REMOVE, "FRIEND_REMOVE", dissect_rpc_unknown, dissect_rpc_unknown},
508 GD_MGMT_FRIEND_UPDATE, "FRIEND_UPDATE",
509 gluster_gd_mgmt_friend_update_call,
510 gluster_gd_mgmt_friend_update_reply
512 { GD_MGMT_CLI_PROBE, "CLI_PROBE", dissect_rpc_unknown, dissect_rpc_unknown},
513 { GD_MGMT_CLI_DEPROBE, "CLI_DEPROBE", dissect_rpc_unknown, dissect_rpc_unknown},
514 { GD_MGMT_CLI_LIST_FRIENDS, "CLI_LIST_FRIENDS", dissect_rpc_unknown, dissect_rpc_unknown},
515 { GD_MGMT_CLI_CREATE_VOLUME, "CLI_CREATE_VOLUME", dissect_rpc_unknown, dissect_rpc_unknown},
516 { GD_MGMT_CLI_GET_VOLUME, "CLI_GET_VOLUME", dissect_rpc_unknown, dissect_rpc_unknown},
517 { GD_MGMT_CLI_DELETE_VOLUME, "CLI_DELETE_VOLUME", dissect_rpc_unknown, dissect_rpc_unknown},
518 { GD_MGMT_CLI_START_VOLUME, "CLI_START_VOLUME", dissect_rpc_unknown, dissect_rpc_unknown},
519 { GD_MGMT_CLI_STOP_VOLUME, "CLI_STOP_VOLUME", dissect_rpc_unknown, dissect_rpc_unknown},
520 { GD_MGMT_CLI_RENAME_VOLUME, "CLI_RENAME_VOLUME", dissect_rpc_unknown, dissect_rpc_unknown},
521 { GD_MGMT_CLI_DEFRAG_VOLUME, "CLI_DEFRAG_VOLUME", dissect_rpc_unknown, dissect_rpc_unknown},
522 { GD_MGMT_CLI_SET_VOLUME, "CLI_DEFRAG_VOLUME", dissect_rpc_unknown, dissect_rpc_unknown},
523 { GD_MGMT_CLI_ADD_BRICK, "CLI_ADD_BRICK", dissect_rpc_unknown, dissect_rpc_unknown},
524 { GD_MGMT_CLI_REMOVE_BRICK, "CLI_REMOVE_BRICK", dissect_rpc_unknown, dissect_rpc_unknown},
525 { GD_MGMT_CLI_REPLACE_BRICK, "CLI_REPLACE_BRICK", dissect_rpc_unknown, dissect_rpc_unknown},
526 { GD_MGMT_CLI_LOG_FILENAME, "CLI_LOG_FILENAME", dissect_rpc_unknown, dissect_rpc_unknown},
527 { GD_MGMT_CLI_LOG_LOCATE, "CLI_LOG_LOCATE", dissect_rpc_unknown, dissect_rpc_unknown},
528 { GD_MGMT_CLI_LOG_ROTATE, "CLI_LOG_ROTATE", dissect_rpc_unknown, dissect_rpc_unknown},
529 { GD_MGMT_CLI_SYNC_VOLUME, "CLI_SYNC_VOLUME", dissect_rpc_unknown, dissect_rpc_unknown},
530 { GD_MGMT_CLI_RESET_VOLUME, "CLI_RESET_VOLUME", dissect_rpc_unknown, dissect_rpc_unknown},
531 { GD_MGMT_CLI_FSM_LOG, "CLI_FSM_LOG", dissect_rpc_unknown, dissect_rpc_unknown},
532 { GD_MGMT_CLI_GSYNC_SET, "CLI_GSYNC_SET", dissect_rpc_unknown, dissect_rpc_unknown},
533 { GD_MGMT_CLI_PROFILE_VOLUME, "CLI_PROFILE_VOLUME", dissect_rpc_unknown, dissect_rpc_unknown},
534 { GD_MGMT_BRICK_OP, "BRICK_OP", dissect_rpc_unknown, dissect_rpc_unknown},
535 { GD_MGMT_CLI_LOG_LEVEL, "CLI_LOG_LEVEL", dissect_rpc_unknown, dissect_rpc_unknown},
536 { GD_MGMT_CLI_STATUS_VOLUME, "CLI_STATUS_VOLUME", dissect_rpc_unknown, dissect_rpc_unknown},
537 { 0, NULL, NULL, NULL}
540 static const vsff gd_mgmt_2_proc[] = {
542 GLUSTERD_MGMT_2_NULL, "NULL",
543 dissect_rpc_void, dissect_rpc_void
546 GLUSTERD_MGMT_2_CLUSTER_LOCK, "CLUSTER_LOCK",
547 glusterd_mgmt_2_cluster_lock_call,
548 glusterd_mgmt_2_cluster_lock_reply
551 GLUSTERD_MGMT_2_CLUSTER_UNLOCK, "CLUSTER_UNLOCK",
552 /* UNLOCK seems to be the same a LOCK, re-use the function */
553 glusterd_mgmt_2_cluster_lock_call,
554 glusterd_mgmt_2_cluster_lock_reply
557 GLUSTERD_MGMT_2_STAGE_OP, "STAGE_OP",
558 glusterd_mgmt_2_stage_op_call, glusterd_mgmt_2_stage_op_reply
561 GLUSTERD_MGMT_2_COMMIT_OP, "COMMIT_OP",
562 glusterd_mgmt_2_commit_op_call, glusterd_mgmt_2_commit_op_reply
564 { 0, NULL, NULL, NULL}
567 static const vsff gd_mgmt_3_proc[] = {
569 GLUSTERD_MGMT_3_NULL, "NULL",
570 dissect_rpc_void, dissect_rpc_void
573 GLUSTERD_MGMT_3_LOCK, "LOCK",
574 glusterd_mgmt_3_lock_call,
575 glusterd_mgmt_3_lock_reply
578 GLUSTERD_MGMT_3_PRE_VALIDATE, "PRE_VALIDATE",
579 glusterd_mgmt_3_pre_val_call,
580 glusterd_mgmt_3_pre_val_reply
583 GLUSTERD_MGMT_3_BRICK_OP, "BRICK_OP",
584 glusterd_mgmt_3_pre_val_call,
585 glusterd_mgmt_3_pre_val_reply
588 GLUSTERD_MGMT_3_COMMIT, "COMMIT",
589 glusterd_mgmt_3_pre_val_call,
590 glusterd_mgmt_3_commit_reply
593 GLUSTERD_MGMT_3_POST_VALIDATE, "POST_VALIDATE",
594 glusterd_mgmt_3_post_val_call,
595 glusterd_mgmt_3_pre_val_reply
598 GLUSTERD_MGMT_3_UNLOCK, "UNLOCK",
599 /* UNLOCK seems to be the same a LOCK, re-use the function */
600 glusterd_mgmt_3_lock_call,
601 glusterd_mgmt_3_lock_reply
603 { 0, NULL, NULL, NULL}
606 static const rpc_prog_vers_info glusterd_mgmt_vers_info[] = {
607 { 1, gd_mgmt_proc, &hf_gd_mgmt_proc },
608 { 2, gd_mgmt_2_proc, &hf_gd_mgmt_2_proc },
609 { 3, gd_mgmt_3_proc, &hf_gd_mgmt_3_proc }
612 static const vsff gd_mgmt_brick_2_proc[] = {
614 GLUSTERD_2_BRICK_NULL, "NULL",
615 dissect_rpc_void, dissect_rpc_void
618 GLUSTERD_2_BRICK_TERMINATE, "TERMINATE",
619 glusterd_brick_2_common_call, glusterd_brick_2_common_reply
622 GLUSTERD_2_BRICK_XLATOR_INFO, "XLATOR_INFO",
623 glusterd_brick_2_common_call, glusterd_brick_2_common_reply
626 GLUSTERD_2_BRICK_XLATOR_OP, "XLATOR_OP" ,
627 glusterd_brick_2_common_call, glusterd_brick_2_common_reply
630 GLUSTERD_2_BRICK_STATUS, "STATUS",
631 glusterd_brick_2_common_call, glusterd_brick_2_common_reply
634 GLUSTERD_2_BRICK_OP, "OP",
635 glusterd_brick_2_common_call, glusterd_brick_2_common_reply
638 GLUSTERD_2_BRICK_XLATOR_DEFRAG, "XLATOR_DEFRAG",
639 glusterd_brick_2_common_call, glusterd_brick_2_common_reply
642 GLUSTERD_2_NODE_PROFILE, "NODE_PROFILE",
643 glusterd_brick_2_common_call, glusterd_brick_2_common_reply
646 GLUSTERD_2_NODE_STATUS, "NODE_STATUS",
647 glusterd_brick_2_common_call, glusterd_brick_2_common_reply
649 { 0, NULL, NULL, NULL }
652 static const rpc_prog_vers_info gd_mgmt_brick_vers_info[] = {
653 { 2, gd_mgmt_brick_2_proc, &hf_gd_mgmt_brick_2_proc },
656 static const vsff glusterd_friend_proc[] = {
657 { GLUSTERD_FRIEND_NULL, "NULL" , dissect_rpc_void , dissect_rpc_void },
658 { GLUSTERD_PROBE_QUERY, "PROBE_QUERY" , dissect_rpc_unknown , dissect_rpc_unknown },
659 { GLUSTERD_FRIEND_ADD, "ADD" , dissect_rpc_unknown , dissect_rpc_unknown },
660 { GLUSTERD_FRIEND_REMOVE, "REMOVE", dissect_rpc_unknown , dissect_rpc_unknown },
661 { GLUSTERD_FRIEND_UPDATE, "UPDATE" , dissect_rpc_unknown , dissect_rpc_unknown },
662 { 0, NULL, NULL, NULL }
665 static const rpc_prog_vers_info glusterd_friend_vers_info[] = {
666 { 2, glusterd_friend_proc, &hf_glusterd_friend_proc },
669 static const value_string gd_mgmt_proc_vals[] = {
670 { GD_MGMT_NULL, "NULL" },
671 { GD_MGMT_PROBE_QUERY, "PROBE_QUERY" },
672 { GD_MGMT_FRIEND_ADD, "FRIEND_ADD" },
673 { GD_MGMT_CLUSTER_LOCK, "CLUSTER_LOCK" },
674 { GD_MGMT_CLUSTER_UNLOCK, "CLUSTER_UNLOCK" },
675 { GD_MGMT_STAGE_OP, "STAGE_OP" },
676 { GD_MGMT_COMMIT_OP, "COMMIT_OP" },
677 { GD_MGMT_FRIEND_REMOVE, "FRIEND_REMOVE" },
678 { GD_MGMT_FRIEND_UPDATE, "FRIEND_UPDATE" },
679 { GD_MGMT_CLI_PROBE, "CLI_PROBE" },
680 { GD_MGMT_CLI_DEPROBE, "CLI_DEPROBE" },
681 { GD_MGMT_CLI_LIST_FRIENDS, "CLI_LIST_FRIENDS" },
682 { GD_MGMT_CLI_CREATE_VOLUME, "CLI_CREATE_VOLUME" },
683 { GD_MGMT_CLI_GET_VOLUME, "CLI_GET_VOLUME" },
684 { GD_MGMT_CLI_DELETE_VOLUME, "CLI_DELETE_VOLUME" },
685 { GD_MGMT_CLI_START_VOLUME, "CLI_START_VOLUME" },
686 { GD_MGMT_CLI_STOP_VOLUME, "CLI_STOP_VOLUME" },
687 { GD_MGMT_CLI_RENAME_VOLUME, "CLI_RENAME_VOLUME" },
688 { GD_MGMT_CLI_DEFRAG_VOLUME, "CLI_DEFRAG_VOLUME" },
689 { GD_MGMT_CLI_SET_VOLUME, "CLI_DEFRAG_VOLUME" },
690 { GD_MGMT_CLI_ADD_BRICK, "CLI_ADD_BRICK" },
691 { GD_MGMT_CLI_REMOVE_BRICK, "CLI_REMOVE_BRICK" },
692 { GD_MGMT_CLI_REPLACE_BRICK, "CLI_REPLACE_BRICK" },
693 { GD_MGMT_CLI_LOG_FILENAME, "CLI_LOG_FILENAME" },
694 { GD_MGMT_CLI_LOG_LOCATE, "CLI_LOG_LOCATE" },
695 { GD_MGMT_CLI_LOG_ROTATE, "CLI_LOG_ROTATE" },
696 { GD_MGMT_CLI_SYNC_VOLUME, "CLI_SYNC_VOLUME" },
697 { GD_MGMT_CLI_RESET_VOLUME, "CLI_RESET_VOLUME" },
698 { GD_MGMT_CLI_FSM_LOG, "CLI_FSM_LOG" },
699 { GD_MGMT_CLI_GSYNC_SET, "CLI_GSYNC_SET" },
700 { GD_MGMT_CLI_PROFILE_VOLUME, "CLI_PROFILE_VOLUME" },
701 { GD_MGMT_BRICK_OP, "BRICK_OP" },
702 { GD_MGMT_CLI_LOG_LEVEL, "CLI_LOG_LEVEL" },
703 { GD_MGMT_CLI_STATUS_VOLUME, "CLI_STATUS_VOLUME" },
704 { 0, NULL }
706 static value_string_ext gd_mgmt_proc_vals_ext = VALUE_STRING_EXT_INIT(gd_mgmt_proc_vals);
708 static const value_string gd_mgmt_2_proc_vals[] = {
709 { GLUSTERD_MGMT_2_NULL, "NULL" },
710 { GLUSTERD_MGMT_2_CLUSTER_LOCK, "CLUSTER_LOCK" },
711 { GLUSTERD_MGMT_2_CLUSTER_UNLOCK, "CLUSTER_UNLOCK" },
712 { GLUSTERD_MGMT_2_STAGE_OP, "STAGE_OP"},
713 { GLUSTERD_MGMT_2_COMMIT_OP, "COMMIT_OP"},
714 { 0, NULL }
716 static value_string_ext gd_mgmt_2_proc_vals_ext = VALUE_STRING_EXT_INIT(gd_mgmt_2_proc_vals);
718 static const value_string gd_mgmt_3_proc_vals[] = {
719 { GLUSTERD_MGMT_3_NULL, "NULL" },
720 { GLUSTERD_MGMT_3_LOCK, "LOCK" },
721 { GLUSTERD_MGMT_3_UNLOCK, "UNLOCK" },
722 { 0, NULL }
724 static value_string_ext gd_mgmt_3_proc_vals_ext = VALUE_STRING_EXT_INIT(gd_mgmt_3_proc_vals);
726 static const value_string gd_mgmt_brick_2_proc_vals[] = {
727 { GLUSTERD_2_BRICK_NULL, "NULL" }, /* 0 */
728 { GLUSTERD_2_BRICK_TERMINATE, "TERMINATE" },
729 { GLUSTERD_2_BRICK_XLATOR_INFO, "XLATOR_INFO" },
730 { GLUSTERD_2_BRICK_XLATOR_OP, "XLATOR_OP" },
731 { GLUSTERD_2_BRICK_STATUS, "STATUS" },
732 { GLUSTERD_2_BRICK_OP, "OP" },
733 { GLUSTERD_2_BRICK_XLATOR_DEFRAG, "XLATOR_DEFRAG" },
734 { GLUSTERD_2_NODE_PROFILE, "NODE_PROFILE" },
735 { GLUSTERD_2_NODE_STATUS, "NODE_PROFILE" },
736 { 0, NULL }
738 static value_string_ext gd_mgmt_brick_2_proc_vals_ext = VALUE_STRING_EXT_INIT(gd_mgmt_brick_2_proc_vals);
740 static const value_string glusterd_op_vals[] = {
741 { GD_OP_NONE, "NONE" },
742 { GD_OP_CREATE_VOLUME, "CREATE_VOLUME" },
743 { GD_OP_START_BRICK, "START_BRICK" },
744 { GD_OP_STOP_BRICK, "STOP_BRICK" },
745 { GD_OP_DELETE_VOLUME, "DELETE_VOLUME" },
746 { GD_OP_START_VOLUME, "START_VOLUME" },
747 { GD_OP_STOP_VOLUME, "STOP_VOLUME" },
748 { GD_OP_DEFRAG_VOLUME, "DEFRAG_VOLUME" },
749 { GD_OP_ADD_BRICK, "ADD_BRICK" },
750 { GD_OP_REMOVE_BRICK, "REMOVE_BRICK" },
751 { GD_OP_REPLACE_BRICK, "REPLACE_BRICK" },
752 { GD_OP_SET_VOLUME, "SET_VOLUME" },
753 { GD_OP_RESET_VOLUME, "RESET_VOLUME" },
754 { GD_OP_SYNC_VOLUME, "SYNC_VOLUME" },
755 { GD_OP_LOG_ROTATE, "LOG_ROTATE" },
756 { GD_OP_GSYNC_SET, "GSYNC_SET" },
757 { GD_OP_PROFILE_VOLUME, "PROFILE_VOLUME" },
758 { GD_OP_QUOTA, "QUOTA" },
759 { GD_OP_STATUS_VOLUME, "STATUS_VOLUME" },
760 { GD_OP_REBALANCE, "REBALANCE" },
761 { GD_OP_HEAL_VOLUME, "HEAL_VOLUME" },
762 { GD_OP_STATEDUMP_VOLUME, "STATEDUMP_VOLUME" },
763 { GD_OP_LIST_VOLUME, "LIST_VOLUME" },
764 { GD_OP_CLEARLOCKS_VOLUME, "CLEARLOCKS_VOLUME" },
765 { GD_OP_DEFRAG_BRICK_VOLUME, "DEFRAG_BRICK_VOLUME" },
766 { GD_OP_COPY_FILE, "Copy File" },
767 { GD_OP_SYS_EXEC, "Execute system commands" },
768 { GD_OP_GSYNC_CREATE, "Geo-replication Create" },
769 { GD_OP_SNAP, "Snapshot" },
770 { 0, NULL }
772 static value_string_ext glusterd_op_vals_ext = VALUE_STRING_EXT_INIT(glusterd_op_vals);
774 static const value_string glusterd_friend_proc_vals[] = {
775 { GLUSTERD_FRIEND_NULL, "NULL" },
776 { GLUSTERD_PROBE_QUERY, "PROBE_QUERY" },
777 { GLUSTERD_FRIEND_ADD, "ADD" },
778 { GLUSTERD_FRIEND_REMOVE, "REMOVE" },
779 { GLUSTERD_FRIEND_UPDATE, "UPDATE" },
780 { 0, NULL }
782 static value_string_ext glusterd_friend_proc_vals_ext = VALUE_STRING_EXT_INIT(glusterd_friend_proc_vals);
784 void
785 proto_register_gluster_gd_mgmt(void)
787 /* Setup list of header fields See Section 1.6.1 for details */
788 static hf_register_info hf[] = {
789 /* programs */
790 { &hf_gd_mgmt_proc,
791 { "Gluster Daemon Management", "glusterd.mgmt.proc",
792 FT_UINT32, BASE_DEC | BASE_EXT_STRING, &gd_mgmt_proc_vals_ext,
793 0, NULL, HFILL }
795 { &hf_gd_mgmt_2_proc,
796 { "Gluster Daemon Management", "glusterd.mgmt.proc",
797 FT_UINT32, BASE_DEC | BASE_EXT_STRING, &gd_mgmt_2_proc_vals_ext,
798 0, NULL, HFILL }
800 { &hf_gd_mgmt_3_proc,
801 { "Gluster Daemon Management", "glusterd.mgmt.proc",
802 FT_UINT32, BASE_DEC | BASE_EXT_STRING, &gd_mgmt_3_proc_vals_ext,
803 0, NULL, HFILL }
805 { &hf_gd_mgmt_brick_2_proc,
806 { "Gluster Daemon Brick Operations",
807 "glusterd.brick.proc", FT_UINT32, BASE_DEC | BASE_EXT_STRING,
808 &gd_mgmt_brick_2_proc_vals_ext, 0, NULL,
809 HFILL }
811 { &hf_glusterd_friend_proc ,
812 { "Gluster Daemon Friend Operations",
813 "glusterd.friend.proc", FT_UINT32, BASE_DEC | BASE_EXT_STRING,
814 &glusterd_friend_proc_vals_ext, 0, NULL,
815 HFILL }
817 { &hf_glusterd_dict,
818 { "Dict", "glusterd.dict", FT_STRING, BASE_NONE,
819 NULL, 0, NULL, HFILL }
821 { &hf_glusterd_op,
822 { "Operation", "glusterd.op", FT_UINT32, BASE_DEC | BASE_EXT_STRING,
823 &glusterd_op_vals_ext, 0, NULL, HFILL }
825 { &hf_glusterd_op_ret,
826 { "Return of previous operation", "glusterd.op_ret",
827 FT_UINT32, BASE_DEC, NULL , 0, NULL, HFILL }
829 { &hf_glusterd_op_errstr,
830 { "Error", "glusterd.op_errstr", FT_STRING,
831 BASE_NONE, NULL, 0, NULL, HFILL }
833 { &hf_glusterd_uuid,
834 { "UUID", "glusterd.uuid", FT_GUID,
835 BASE_NONE, NULL, 0, NULL, HFILL }
837 { &hf_glusterd_tnx_id,
838 { "Transaction ID", "glusterd.tnx_id", FT_GUID,
839 BASE_NONE, NULL, 0, NULL, HFILL }
841 { &hf_glusterd_hostname,
842 { "Hostname", "glusterd.hostname", FT_STRING,
843 BASE_NONE, NULL, 0, NULL, HFILL }
845 { &hf_glusterd_port,
846 { "Port", "glusterd.port", FT_INT32, BASE_DEC,
847 NULL, 0, NULL, HFILL }
849 { &hf_glusterd_vols,
850 { "Volumes", "glusterd.vols", FT_STRING, BASE_NONE,
851 NULL, 0, NULL, HFILL }
853 { &hf_glusterd_buf,
854 { "Buffer", "glusterd.buffer", FT_STRING, BASE_NONE,
855 NULL, 0, NULL, HFILL }
857 { &hf_glusterd_name,
858 { "Name", "glusterd.name", FT_STRING, BASE_NONE,
859 NULL, 0, NULL, HFILL }
863 /* Setup protocol subtree array */
864 static int *ett[] = {
865 &ett_gd_mgmt,
866 &ett_gd_brick,
867 &ett_gd_friend
870 /* Register the protocol name and description */
871 proto_glusterd = proto_register_protocol("Gluster Daemon", "GlusterD", "glusterd");
872 proto_register_subtree_array(ett, array_length(ett));
873 proto_register_field_array(proto_glusterd, hf, array_length(hf));
875 proto_gd_mgmt = proto_register_protocol_in_name_only("Gluster Daemon Management",
876 "GlusterD Management", "glusterd.mgmt", proto_glusterd, FT_PROTOCOL);
877 proto_gd_brick = proto_register_protocol_in_name_only(
878 "Gluster Daemon Brick Operations",
879 "GlusterD Brick", "glusterd.brick", proto_glusterd, FT_PROTOCOL);
880 proto_gd_friend = proto_register_protocol_in_name_only(
881 "Gluster Daemon Friend Operations",
882 "GlusterD Friend", "glusterd.friend", proto_glusterd, FT_PROTOCOL);
885 void
886 proto_reg_handoff_gluster_gd_mgmt(void)
888 rpc_init_prog(proto_gd_mgmt, GD_MGMT_PROGRAM, ett_gd_mgmt,
889 G_N_ELEMENTS(glusterd_mgmt_vers_info), glusterd_mgmt_vers_info);
891 rpc_init_prog(proto_gd_brick, GD_BRICK_PROGRAM, ett_gd_brick,
892 G_N_ELEMENTS(gd_mgmt_brick_vers_info), gd_mgmt_brick_vers_info);
894 rpc_init_prog(proto_gd_friend, GD_FRIEND_PROGRAM, ett_gd_friend,
895 G_N_ELEMENTS(glusterd_friend_vers_info), glusterd_friend_vers_info);
899 * Editor modelines - https://www.wireshark.org/tools/modelines.html
901 * Local variables:
902 * c-basic-offset: 8
903 * tab-width: 8
904 * indent-tabs-mode: t
905 * End:
907 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
908 * :indentSize=8:tabSize=8:noTabs=false: