MSWSP: fix dissect_mswsp_smb()
[wireshark-wip.git] / epan / dissectors / packet-glusterd.c
blobdf6eaba2208536c2ddacbe4feb9b7e2e0314e22d
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 * $Id$
9 * Wireshark - Network traffic analyzer
10 * By Gerald Combs <gerald@wireshark.org>
11 * Copyright 1998 Gerald Combs
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 * References to source files point in general to the glusterfs sources.
29 * There is currently no RFC or other document where the protocol is
30 * completely described. The glusterfs sources can be found at:
31 * - http://git.gluster.com/?p=glusterfs.git
32 * - https://github.com/gluster/glusterfs
34 * The coding-style is roughly the same as the one use in the Linux kernel,
35 * see http://www.kernel.org/doc/Documentation/CodingStyle.
38 #include "config.h"
40 #include <glib.h>
41 #include <epan/packet.h>
43 #include "packet-rpc.h"
44 #include "packet-gluster.h"
46 /* Initialize the protocol and registered fields */
47 static gint proto_glusterd = -1;
48 static gint proto_gd_mgmt = -1;
49 static gint proto_gd_brick = -1;
50 static gint proto_gd_friend = -1;
52 /* programs and procedures */
53 static gint hf_gd_mgmt_proc = -1;
54 static gint hf_gd_mgmt_2_proc = -1;
55 static gint hf_gd_mgmt_brick_2_proc = -1;
56 static gint hf_glusterd_friend_proc = -1;
58 /* fields used by multiple programs/procedures */
59 static gint hf_glusterd_dict = -1;
60 static gint hf_glusterd_op = -1;
61 static gint hf_glusterd_op_errstr = -1;
62 static gint hf_glusterd_uuid = -1;
63 static gint hf_glusterd_hostname = -1;
64 static gint hf_glusterd_port = -1;
65 static gint hf_glusterd_vols = -1;
66 static gint hf_glusterd_buf = -1;
67 static gint hf_glusterd_name = -1;
69 /* Initialize the subtree pointers */
70 static gint ett_gd_mgmt = -1;
71 static gint ett_gd_brick = -1;
72 static gint ett_gd_friend = -1;
74 /* the UUID is the same as a GlusterFS GFID, except it's encoded per byte */
75 static int
76 gluster_gd_mgmt_dissect_uuid(tvbuff_t *tvb, proto_tree *tree, int hfindex,
77 int offset)
79 if (tree) {
80 e_guid_t uuid;
81 int start_offset = offset;
83 uuid.data1 = (tvb_get_ntohl(tvb, offset) & 0xff) << 24 |
84 (tvb_get_ntohl(tvb, offset+4) & 0xff) << 16 |
85 (tvb_get_ntohl(tvb, offset+8) & 0xff) << 8 |
86 (tvb_get_ntohl(tvb, offset+12) & 0xff);
87 offset += 16;
88 uuid.data2 = (tvb_get_ntohl(tvb, offset) & 0xff) << 8 |
89 (tvb_get_ntohl(tvb, offset+4) & 0xff);
90 offset += 8;
91 uuid.data3 = (tvb_get_ntohl(tvb, offset) & 0xff) << 8 |
92 (tvb_get_ntohl(tvb, offset+4) & 0xff);
93 offset += 8;
94 uuid.data4[0] = tvb_get_ntohl(tvb, offset);
95 offset += 4;
96 uuid.data4[1] = tvb_get_ntohl(tvb, offset);
97 offset += 4;
98 uuid.data4[2] = tvb_get_ntohl(tvb, offset);
99 offset += 4;
100 uuid.data4[3] = tvb_get_ntohl(tvb, offset);
101 offset += 4;
102 uuid.data4[4] = tvb_get_ntohl(tvb, offset);
103 offset += 4;
104 uuid.data4[5] = tvb_get_ntohl(tvb, offset);
105 offset += 4;
106 uuid.data4[6] = tvb_get_ntohl(tvb, offset);
107 offset += 4;
108 uuid.data4[7] = tvb_get_ntohl(tvb, offset);
109 offset += 4;
110 proto_tree_add_guid(tree, hfindex, tvb, start_offset, 4*16, &uuid);
111 } else
112 offset += 16 * 4;
114 return offset;
117 static int
118 gluster_gd_mgmt_probe_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
119 proto_tree *tree, void* data _U_)
121 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
122 offset);
123 offset = dissect_rpc_string(tvb, tree, hf_glusterd_hostname, offset,
124 NULL);
125 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_port, offset);
126 offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree, data);
128 return offset;
131 static int
132 gluster_gd_mgmt_probe_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
133 proto_tree *tree, void* data _U_)
135 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
136 offset);
137 offset = dissect_rpc_string(tvb, tree, hf_glusterd_hostname, offset,
138 NULL);
139 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_port, offset);
141 return offset;
144 static int
145 gluster_gd_mgmt_friend_add_reply(tvbuff_t *tvb, int offset,
146 packet_info *pinfo, proto_tree *tree, void* data _U_)
148 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
149 offset);
150 offset = dissect_rpc_string(tvb, tree, hf_glusterd_hostname, offset,
151 NULL);
152 offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree, data);
153 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_port, offset);
155 return offset;
158 static int
159 gluster_gd_mgmt_friend_add_call(tvbuff_t *tvb, int offset,
160 packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
162 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
163 offset);
164 offset = dissect_rpc_string(tvb, tree, hf_glusterd_hostname, offset,
165 NULL);
166 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_port, offset);
167 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_vols, offset);
169 return offset;
172 /* gluster_gd_mgmt_cluster_lock_reply is used for LOCK and UNLOCK */
173 static int
174 gluster_gd_mgmt_cluster_lock_reply(tvbuff_t *tvb, int offset,
175 packet_info *pinfo, proto_tree *tree, void* data _U_)
177 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
178 offset);
179 offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree, data);
181 return offset;
184 /* gluster_gd_mgmt_cluster_lock_call is used for LOCK and UNLOCK */
185 static int
186 gluster_gd_mgmt_cluster_lock_call(tvbuff_t *tvb, int offset,
187 packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
189 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
190 offset);
192 return offset;
195 static int
196 gluster_gd_mgmt_stage_op_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
197 proto_tree *tree, void* data _U_)
199 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
200 offset);
201 offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree, data);
202 offset = dissect_rpc_string(tvb, tree, hf_glusterd_op_errstr, offset,
203 NULL);
204 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset);
205 return offset;
208 static int
209 gluster_gd_mgmt_stage_op_call(tvbuff_t *tvb, int offset,
210 packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
212 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
213 offset);
214 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_op, offset);
215 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset);
217 return offset;
220 static int
221 gluster_gd_mgmt_commit_op_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
222 proto_tree *tree, void* data _U_)
224 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
225 offset);
226 offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree, data);
227 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_buf, offset);
228 offset = dissect_rpc_string(tvb, tree, hf_glusterd_op_errstr, offset,
229 NULL);
230 return offset;
233 static int
234 gluster_gd_mgmt_commit_op_call(tvbuff_t *tvb, int offset,
235 packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
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, int offset,
248 packet_info *pinfo, proto_tree *tree, void* data _U_)
250 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
251 offset);
252 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_op, offset);
253 offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree, data);
255 return offset;
258 static int
259 gluster_gd_mgmt_friend_update_call(tvbuff_t *tvb, int offset,
260 packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
262 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
263 offset);
264 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_vols,
265 offset);
266 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_port, offset);
268 return offset;
271 /* Below procedure is used for version 2 */
272 static int
273 glusterd_mgmt_2_cluster_lock_reply(tvbuff_t *tvb, int offset,
274 packet_info *pinfo, proto_tree *tree, void* data _U_)
276 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
277 offset);
278 offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree, data);
280 return offset;
283 /* glusterd__mgmt_2_cluster_lock_call is used for LOCK and UNLOCK */
284 static int
285 glusterd_mgmt_2_cluster_lock_call(tvbuff_t *tvb, int offset,
286 packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
288 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
289 offset);
291 return offset;
294 static int
295 glusterd_mgmt_2_stage_op_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
296 proto_tree *tree, void* data _U_)
298 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
299 offset);
300 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_op, offset);
301 offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree, data);
302 offset = dissect_rpc_string(tvb, tree, hf_glusterd_op_errstr, offset,
303 NULL);
304 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset);
306 return offset;
309 static int
310 glusterd_mgmt_2_stage_op_call(tvbuff_t *tvb, int offset,
311 packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
313 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
314 offset);
315 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_op, offset);
316 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset);
318 return offset;
321 static int
322 glusterd_mgmt_2_commit_op_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
323 proto_tree *tree, void* data _U_)
325 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
326 offset);
327 offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree, data);
328 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_buf, offset);
329 offset = dissect_rpc_string(tvb, tree, hf_glusterd_op_errstr, offset,
330 NULL);
332 return offset;
335 static int
336 glusterd_mgmt_2_commit_op_call(tvbuff_t *tvb, int offset,
337 packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
339 offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid,
340 offset);
341 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_op, offset);
342 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_buf, offset);
344 return offset;
347 /* Brick management common function */
349 static int
350 glusterd_brick_2_common_reply(tvbuff_t *tvb, int offset, packet_info *pinfo,
351 proto_tree *tree, void* data _U_)
353 offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree, data);
354 offset = dissect_rpc_string(tvb, tree, hf_glusterd_op_errstr, offset,
355 NULL);
356 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset);
358 return offset;
361 static int
362 glusterd_brick_2_common_call(tvbuff_t *tvb, int offset,
363 packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
365 offset = dissect_rpc_string(tvb, tree, hf_glusterd_name, offset,
366 NULL);
367 offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_op, offset);
368 offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset);
370 return offset;
374 * GD_MGMT_PROGRAM
375 * - xlators/mgmt/glusterd/src/glusterd-handler.c: "GlusterD svc mgmt"
376 * - xlators/mgmt/glusterd/src/glusterd-rpc-ops.c: "glusterd clnt mgmt"
378 static const vsff gd_mgmt_proc[] = {
379 { GD_MGMT_NULL, "NULL", NULL, NULL },
381 GD_MGMT_PROBE_QUERY, "PROBE_QUERY",
382 gluster_gd_mgmt_probe_call, gluster_gd_mgmt_probe_reply
385 GD_MGMT_FRIEND_ADD, "FRIEND_ADD",
386 gluster_gd_mgmt_friend_add_call,
387 gluster_gd_mgmt_friend_add_reply
390 GD_MGMT_CLUSTER_LOCK, "CLUSTER_LOCK",
391 gluster_gd_mgmt_cluster_lock_call,
392 gluster_gd_mgmt_cluster_lock_reply
395 GD_MGMT_CLUSTER_UNLOCK, "CLUSTER_UNLOCK",
396 /* UNLOCK seems to be the same a LOCK, re-use the function */
397 gluster_gd_mgmt_cluster_lock_call,
398 gluster_gd_mgmt_cluster_lock_reply
401 GD_MGMT_STAGE_OP, "STAGE_OP",
402 gluster_gd_mgmt_stage_op_call, gluster_gd_mgmt_stage_op_reply
405 GD_MGMT_COMMIT_OP, "COMMIT_OP",
406 gluster_gd_mgmt_commit_op_call, gluster_gd_mgmt_commit_op_reply
408 { GD_MGMT_FRIEND_REMOVE, "FRIEND_REMOVE", NULL, NULL},
410 GD_MGMT_FRIEND_UPDATE, "FRIEND_UPDATE",
411 gluster_gd_mgmt_friend_update_call,
412 gluster_gd_mgmt_friend_update_reply
414 { GD_MGMT_CLI_PROBE, "CLI_PROBE", NULL, NULL},
415 { GD_MGMT_CLI_DEPROBE, "CLI_DEPROBE", NULL, NULL},
416 { GD_MGMT_CLI_LIST_FRIENDS, "CLI_LIST_FRIENDS", NULL, NULL},
417 { GD_MGMT_CLI_CREATE_VOLUME, "CLI_CREATE_VOLUME", NULL, NULL},
418 { GD_MGMT_CLI_GET_VOLUME, "CLI_GET_VOLUME", NULL, NULL},
419 { GD_MGMT_CLI_DELETE_VOLUME, "CLI_DELETE_VOLUME", NULL, NULL},
420 { GD_MGMT_CLI_START_VOLUME, "CLI_START_VOLUME", NULL, NULL},
421 { GD_MGMT_CLI_STOP_VOLUME, "CLI_STOP_VOLUME", NULL, NULL},
422 { GD_MGMT_CLI_RENAME_VOLUME, "CLI_RENAME_VOLUME", NULL, NULL},
423 { GD_MGMT_CLI_DEFRAG_VOLUME, "CLI_DEFRAG_VOLUME", NULL, NULL},
424 { GD_MGMT_CLI_SET_VOLUME, "CLI_DEFRAG_VOLUME", NULL, NULL},
425 { GD_MGMT_CLI_ADD_BRICK, "CLI_ADD_BRICK", NULL, NULL},
426 { GD_MGMT_CLI_REMOVE_BRICK, "CLI_REMOVE_BRICK", NULL, NULL},
427 { GD_MGMT_CLI_REPLACE_BRICK, "CLI_REPLACE_BRICK", NULL, NULL},
428 { GD_MGMT_CLI_LOG_FILENAME, "CLI_LOG_FILENAME", NULL, NULL},
429 { GD_MGMT_CLI_LOG_LOCATE, "CLI_LOG_LOCATE", NULL, NULL},
430 { GD_MGMT_CLI_LOG_ROTATE, "CLI_LOG_ROTATE", NULL, NULL},
431 { GD_MGMT_CLI_SYNC_VOLUME, "CLI_SYNC_VOLUME", NULL, NULL},
432 { GD_MGMT_CLI_RESET_VOLUME, "CLI_RESET_VOLUME", NULL, NULL},
433 { GD_MGMT_CLI_FSM_LOG, "CLI_FSM_LOG", NULL, NULL},
434 { GD_MGMT_CLI_GSYNC_SET, "CLI_GSYNC_SET", NULL, NULL},
435 { GD_MGMT_CLI_PROFILE_VOLUME, "CLI_PROFILE_VOLUME", NULL, NULL},
436 { GD_MGMT_BRICK_OP, "BRICK_OP", NULL, NULL},
437 { GD_MGMT_CLI_LOG_LEVEL, "CLI_LOG_LEVEL", NULL, NULL},
438 { GD_MGMT_CLI_STATUS_VOLUME, "CLI_STATUS_VOLUME", NULL, NULL},
439 { 0, NULL, NULL, NULL}
442 static const vsff gd_mgmt_2_proc[] = {
443 { GLUSTERD_MGMT_2_NULL, "NULL", NULL, NULL},
445 GLUSTERD_MGMT_2_CLUSTER_LOCK, "CLUSTER_LOCK",
446 glusterd_mgmt_2_cluster_lock_call,
447 glusterd_mgmt_2_cluster_lock_reply
450 GLUSTERD_MGMT_2_CLUSTER_UNLOCK, "CLUSTER_UNLOCK",
451 /* UNLOCK seems to be the same a LOCK, re-use the function */
452 glusterd_mgmt_2_cluster_lock_call,
453 glusterd_mgmt_2_cluster_lock_reply
456 GLUSTERD_MGMT_2_STAGE_OP, "STAGE_OP",
457 glusterd_mgmt_2_stage_op_call, glusterd_mgmt_2_stage_op_reply
460 GLUSTERD_MGMT_2_COMMIT_OP, "COMMIT_OP",
461 glusterd_mgmt_2_commit_op_call, glusterd_mgmt_2_commit_op_reply
463 { 0, NULL, NULL, NULL}
466 static const vsff gd_mgmt_brick_2_proc[] = {
467 { GLUSTERD_2_BRICK_NULL, "NULL", NULL , NULL }, /* 0 */
469 GLUSTERD_2_BRICK_TERMINATE, "TERMINATE",
470 glusterd_brick_2_common_call, glusterd_brick_2_common_reply
473 GLUSTERD_2_BRICK_XLATOR_INFO, "XLATOR_INFO",
474 glusterd_brick_2_common_call, glusterd_brick_2_common_reply
477 GLUSTERD_2_BRICK_XLATOR_OP, "XLATOR_OP" ,
478 glusterd_brick_2_common_call, glusterd_brick_2_common_reply
481 GLUSTERD_2_BRICK_STATUS, "STATUS",
482 glusterd_brick_2_common_call, glusterd_brick_2_common_reply
485 GLUSTERD_2_BRICK_OP, "OP",
486 glusterd_brick_2_common_call, glusterd_brick_2_common_reply
489 GLUSTERD_2_BRICK_XLATOR_DEFRAG, "XLATOR_DEFRAG",
490 glusterd_brick_2_common_call, glusterd_brick_2_common_reply
493 GLUSTERD_2_NODE_PROFILE, "NODE_PROFILE",
494 glusterd_brick_2_common_call, glusterd_brick_2_common_reply
497 GLUSTERD_2_NODE_STATUS, "NODE_STATUS",
498 glusterd_brick_2_common_call, glusterd_brick_2_common_reply
500 { 0, NULL, NULL, NULL }
503 static const vsff glusterd_friend_proc[] = {
504 { GLUSTERD_FRIEND_NULL, "NULL" , NULL , NULL },
505 { GLUSTERD_PROBE_QUERY, "PROBE_QUERY" , NULL , NULL },
506 { GLUSTERD_FRIEND_ADD, "ADD" , NULL , NULL },
507 { GLUSTERD_FRIEND_REMOVE, "REMOVE", NULL , NULL },
508 { GLUSTERD_FRIEND_UPDATE, "UPDATE" , NULL , NULL },
509 { 0, NULL, NULL, NULL }
512 static const value_string gd_mgmt_proc_vals[] = {
513 { GD_MGMT_NULL, "NULL" },
514 { GD_MGMT_PROBE_QUERY, "PROBE_QUERY" },
515 { GD_MGMT_FRIEND_ADD, "FRIEND_ADD" },
516 { GD_MGMT_CLUSTER_LOCK, "CLUSTER_LOCK" },
517 { GD_MGMT_CLUSTER_UNLOCK, "CLUSTER_UNLOCK" },
518 { GD_MGMT_STAGE_OP, "STAGE_OP" },
519 { GD_MGMT_COMMIT_OP, "COMMIT_OP" },
520 { GD_MGMT_FRIEND_REMOVE, "FRIEND_REMOVE" },
521 { GD_MGMT_FRIEND_UPDATE, "FRIEND_UPDATE" },
522 { GD_MGMT_CLI_PROBE, "CLI_PROBE" },
523 { GD_MGMT_CLI_DEPROBE, "CLI_DEPROBE" },
524 { GD_MGMT_CLI_LIST_FRIENDS, "CLI_LIST_FRIENDS" },
525 { GD_MGMT_CLI_CREATE_VOLUME, "CLI_CREATE_VOLUME" },
526 { GD_MGMT_CLI_GET_VOLUME, "CLI_GET_VOLUME" },
527 { GD_MGMT_CLI_DELETE_VOLUME, "CLI_DELETE_VOLUME" },
528 { GD_MGMT_CLI_START_VOLUME, "CLI_START_VOLUME" },
529 { GD_MGMT_CLI_STOP_VOLUME, "CLI_STOP_VOLUME" },
530 { GD_MGMT_CLI_RENAME_VOLUME, "CLI_RENAME_VOLUME" },
531 { GD_MGMT_CLI_DEFRAG_VOLUME, "CLI_DEFRAG_VOLUME" },
532 { GD_MGMT_CLI_SET_VOLUME, "CLI_DEFRAG_VOLUME" },
533 { GD_MGMT_CLI_ADD_BRICK, "CLI_ADD_BRICK" },
534 { GD_MGMT_CLI_REMOVE_BRICK, "CLI_REMOVE_BRICK" },
535 { GD_MGMT_CLI_REPLACE_BRICK, "CLI_REPLACE_BRICK" },
536 { GD_MGMT_CLI_LOG_FILENAME, "CLI_LOG_FILENAME" },
537 { GD_MGMT_CLI_LOG_LOCATE, "CLI_LOG_LOCATE" },
538 { GD_MGMT_CLI_LOG_ROTATE, "CLI_LOG_ROTATE" },
539 { GD_MGMT_CLI_SYNC_VOLUME, "CLI_SYNC_VOLUME" },
540 { GD_MGMT_CLI_RESET_VOLUME, "CLI_RESET_VOLUME" },
541 { GD_MGMT_CLI_FSM_LOG, "CLI_FSM_LOG" },
542 { GD_MGMT_CLI_GSYNC_SET, "CLI_GSYNC_SET" },
543 { GD_MGMT_CLI_PROFILE_VOLUME, "CLI_PROFILE_VOLUME" },
544 { GD_MGMT_BRICK_OP, "BRICK_OP" },
545 { GD_MGMT_CLI_LOG_LEVEL, "CLI_LOG_LEVEL" },
546 { GD_MGMT_CLI_STATUS_VOLUME, "CLI_STATUS_VOLUME" },
547 { 0, NULL }
549 static value_string_ext gd_mgmt_proc_vals_ext = VALUE_STRING_EXT_INIT(gd_mgmt_proc_vals);
551 static const value_string gd_mgmt_2_proc_vals[] = {
552 { GLUSTERD_MGMT_2_NULL , "NULL" },
553 { GLUSTERD_MGMT_2_CLUSTER_LOCK, "CLUSTER_LOCK" },
554 { GLUSTERD_MGMT_2_CLUSTER_UNLOCK, "CLUSTER_UNLOCK" },
555 { GLUSTERD_MGMT_2_STAGE_OP, "STAGE_OP"},
556 { GLUSTERD_MGMT_2_COMMIT_OP, " GLUSTERD_MGMT_COMMIT_OP"},
557 { 0, NULL }
559 static value_string_ext gd_mgmt_2_proc_vals_ext = VALUE_STRING_EXT_INIT(gd_mgmt_2_proc_vals);
561 static const value_string gd_mgmt_brick_2_proc_vals[] = {
562 { GLUSTERD_2_BRICK_NULL, "NULL" }, /* 0 */
563 { GLUSTERD_2_BRICK_TERMINATE, "TERMINATE" },
564 { GLUSTERD_2_BRICK_XLATOR_INFO, "XLATOR_INFO" },
565 { GLUSTERD_2_BRICK_XLATOR_OP, "XLATOR_OP" },
566 { GLUSTERD_2_BRICK_STATUS, "STATUS" },
567 { GLUSTERD_2_BRICK_OP, "OP" },
568 { GLUSTERD_2_BRICK_XLATOR_DEFRAG, "XLATOR_DEFRAG" },
569 { GLUSTERD_2_NODE_PROFILE, "GLUSTERD_2_NODE_PROFILE" },
570 { GLUSTERD_2_NODE_STATUS, "GLUSTERD_2_NODE_PROFILE" },
571 { 0, NULL }
573 static value_string_ext gd_mgmt_brick_2_proc_vals_ext = VALUE_STRING_EXT_INIT(gd_mgmt_brick_2_proc_vals);
575 static const value_string glusterd_op_vals[] = {
576 { GD_OP_NONE, "NONE" },
577 { GD_OP_CREATE_VOLUME, "CREATE_VOLUME" },
578 { GD_OP_START_BRICK, "START_BRICK" },
579 { GD_OP_STOP_BRICK, "STOP_BRICK" },
580 { GD_OP_DELETE_VOLUME, "DELETE_VOLUME" },
581 { GD_OP_START_VOLUME, "START_VOLUME" },
582 { GD_OP_STOP_VOLUME, "STOP_VOLUME" },
583 { GD_OP_DEFRAG_VOLUME, "DEFRAG_VOLUME" },
584 { GD_OP_ADD_BRICK, "ADD_BRICK" },
585 { GD_OP_REMOVE_BRICK, "REMOVE_BRICK" },
586 { GD_OP_REPLACE_BRICK, "REPLACE_BRICK" },
587 { GD_OP_SET_VOLUME, "SET_VOLUME" },
588 { GD_OP_RESET_VOLUME, "RESET_VOLUME" },
589 { GD_OP_SYNC_VOLUME, "SYNC_VOLUME" },
590 { GD_OP_LOG_ROTATE, "LOG_ROTATE" },
591 { GD_OP_GSYNC_SET, "GSYNC_SET" },
592 { GD_OP_PROFILE_VOLUME, "PROFILE_VOLUME" },
593 { GD_OP_QUOTA, "QUOTA" },
594 { GD_OP_STATUS_VOLUME, "STATUS_VOLUME" },
595 { GD_OP_REBALANCE, "REBALANCE" },
596 { GD_OP_HEAL_VOLUME, "HEAL_VOLUME" },
597 { GD_OP_STATEDUMP_VOLUME, "STATEDUMP_VOLUME" },
598 { GD_OP_LIST_VOLUME, "LIST_VOLUME" },
599 { GD_OP_CLEARLOCKS_VOLUME, "CLEARLOCKS_VOLUME" },
600 { GD_OP_DEFRAG_BRICK_VOLUME, "DEFRAG_BRICK_VOLUME" },
601 { 0, NULL }
603 static value_string_ext glusterd_op_vals_ext = VALUE_STRING_EXT_INIT(glusterd_op_vals);
605 static const value_string glusterd_friend_proc_vals[] = {
606 { GLUSTERD_FRIEND_NULL, "NULL" },
607 { GLUSTERD_PROBE_QUERY, "PROBE_QUERY" },
608 { GLUSTERD_FRIEND_ADD, "ADD" },
609 { GLUSTERD_FRIEND_REMOVE, "REMOVE" },
610 { GLUSTERD_FRIEND_UPDATE, "UPDATE" },
611 { 0, NULL }
613 static value_string_ext glusterd_friend_proc_vals_ext = VALUE_STRING_EXT_INIT(glusterd_friend_proc_vals);
615 void
616 proto_register_gluster_gd_mgmt(void)
618 /* Setup list of header fields See Section 1.6.1 for details */
619 static hf_register_info hf[] = {
620 /* programs */
621 { &hf_gd_mgmt_proc,
622 { "Gluster Daemon Management", "glusterd.mgmt.proc",
623 FT_UINT32, BASE_DEC | BASE_EXT_STRING, &gd_mgmt_proc_vals_ext,
624 0, NULL, HFILL }
626 { &hf_gd_mgmt_2_proc,
627 { "Gluster Daemon Management", "glusterd.mgmt.proc",
628 FT_UINT32, BASE_DEC | BASE_EXT_STRING, &gd_mgmt_2_proc_vals_ext,
629 0, NULL, HFILL }
631 { &hf_gd_mgmt_brick_2_proc,
632 { "Gluster Daemon Brick Operations",
633 "glusterd.brick.proc", FT_UINT32, BASE_DEC | BASE_EXT_STRING,
634 &gd_mgmt_brick_2_proc_vals_ext, 0, NULL,
635 HFILL }
637 { &hf_glusterd_friend_proc ,
638 { "Gluster Daemon Friend Operations",
639 "glusterd.friend.proc", FT_UINT32, BASE_DEC | BASE_EXT_STRING,
640 &glusterd_friend_proc_vals_ext, 0, NULL,
641 HFILL }
643 { &hf_glusterd_dict,
644 { "Dict", "glusterd.dict", FT_STRING, BASE_NONE,
645 NULL, 0, NULL, HFILL }
647 { &hf_glusterd_op,
648 { "Operation", "glusterd.op", FT_UINT32, BASE_DEC | BASE_EXT_STRING,
649 &glusterd_op_vals_ext, 0, NULL, HFILL }
651 { &hf_glusterd_op_errstr,
652 { "Error", "glusterd.op_errstr", FT_STRING,
653 BASE_NONE, NULL, 0, NULL, HFILL }
655 { &hf_glusterd_uuid,
656 { "UUID", "glusterd.uuid", FT_GUID,
657 BASE_NONE, NULL, 0, NULL, HFILL }
659 { &hf_glusterd_hostname,
660 { "Hostname", "glusterd.hostname", FT_STRING,
661 BASE_NONE, NULL, 0, NULL, HFILL }
663 { &hf_glusterd_port,
664 { "Port", "glusterd.port", FT_INT32, BASE_DEC,
665 NULL, 0, NULL, HFILL }
667 { &hf_glusterd_vols,
668 { "Volumes", "glusterd.vols", FT_STRING, BASE_NONE,
669 NULL, 0, NULL, HFILL }
671 { &hf_glusterd_buf,
672 { "Buffer", "glusterd.buffer", FT_STRING, BASE_NONE,
673 NULL, 0, NULL, HFILL }
675 { &hf_glusterd_name,
676 { "Name", "glusterd.name", FT_STRING, BASE_NONE,
677 NULL, 0, NULL, HFILL }
681 /* Setup protocol subtree array */
682 static gint *ett[] = {
683 &ett_gd_mgmt,
684 &ett_gd_brick,
685 &ett_gd_friend
688 /* Register the protocol name and description */
689 proto_glusterd = proto_register_protocol("Gluster Daemon", "GlusterD",
690 "glusterd");
691 proto_register_subtree_array(ett, array_length(ett));
692 proto_register_field_array(proto_glusterd, hf, array_length(hf));
694 proto_gd_mgmt = proto_register_protocol("Gluster Daemon Management",
695 "GlusterD Management", "glusterd.mgmt");
696 proto_gd_brick = proto_register_protocol(
697 "Gluster Daemon Brick Operations",
698 "GlusterD Brick", "glusterd.brick");
699 proto_gd_friend = proto_register_protocol(
700 "Gluster Daemon Friend Operations",
701 "GlusterD Friend", "glusterd.friend");
704 void
705 proto_reg_handoff_gluster_gd_mgmt(void)
707 rpc_init_prog(proto_gd_mgmt, GD_MGMT_PROGRAM, ett_gd_mgmt);
708 rpc_init_proc_table(GD_MGMT_PROGRAM, 1, gd_mgmt_proc, hf_gd_mgmt_proc);
709 rpc_init_proc_table(GD_MGMT_PROGRAM, 2, gd_mgmt_2_proc,
710 hf_gd_mgmt_2_proc);
712 rpc_init_prog(proto_gd_brick, GD_BRICK_PROGRAM, ett_gd_brick);
713 rpc_init_proc_table(GD_BRICK_PROGRAM, 2, gd_mgmt_brick_2_proc,
714 hf_gd_mgmt_brick_2_proc);
715 rpc_init_prog(proto_gd_friend, GD_FRIEND_PROGRAM, ett_gd_friend);
716 rpc_init_proc_table(GD_FRIEND_PROGRAM, 2,glusterd_friend_proc,
717 hf_glusterd_friend_proc);