Wireshark  4.3.0
The Wireshark network protocol analyzer
packet-gluster.h
1 /* packet-gluster.h
2  * Header for gluster dissection
3  * Copyright 2012, Niels de Vos <ndevos@redhat.com>
4  * With contributions from:
5  * Shreedhara LG <shreedharlg@gmail.com>
6  *
7  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
9  * Copyright 1998 Gerald Combs
10  *
11  * SPDX-License-Identifier: GPL-2.0-or-later
12  *
13  *
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  * - http://git.gluster.com/?p=glusterfs.git
18  * - https://github.com/gluster/glusterfs
19  *
20  * The coding-style is roughly the same as the one use in the Linux kernel,
21  * see http://www.kernel.org/doc/Documentation/CodingStyle.
22  */
23 
24 #ifndef __PACKET_GLUSTER_H__
25 #define __PACKET_GLUSTER_H__
26 
27 #define GLUSTER_PORT 24007
28 
29 /* most of this comes from rpc/rpc-lib/src/protocol-common.h
30  * Some versions are commented with a user-visible version, others are not.
31  * Some programs were introduced starting version 2.
32  *
33  * Older versions were removed from the sources.
34  * One patch that did this is at http://review.gluster.com/610
35  */
36 #define GLUSTERD1_MGMT_PROGRAM 1298433
37 /* only available in version 1 */
38 
39 #define GLUSTERFS_PROGRAM 4867634 /* same as GD_BRICK_PROGRAM */
40 /* only available in version 1 (replaced by GD_BRICK_PROGRAM) */
41 
42 /* rpc/rpc-lib/src/xdr-common.h */
43 #define GLUSTER_DUMP_PROGRAM 123451501
44 /* only available in version 1 */
45 
46 #define GLUSTER_HNDSK_PROGRAM 14398633
47 /* only available in version 1 (0.0.1) */
48 
49 #define GLUSTER_PMAP_PROGRAM 34123456
50 /* only available in version 1 */
51 
52 #define GLUSTER_CBK_PROGRAM 52743234
53 /* only available in version 1 (0.0.1) */
54 
55 #define GLUSTER3_1_FOP_PROGRAM 1298437
56 /* available in version 310 (3.1.0) */
57 
58 #define GD_MGMT_PROGRAM 1238433
59 /* available in version 1, 2 and 3 */
60 
61 #define GD_FRIEND_PROGRAM 1238437
62 /* only available in version 2 (0.0.2) */
63 
64 #define GLUSTER_CLI_PROGRAM 1238463
65 /* available in version 1 (0.0.1) and 2 (0.0.2) */
66 
67 #define GD_BRICK_PROGRAM 4867634
68 /* only available in version 2 (supersedes GLUSTERFS_PROGRAM) */
69 
70 /* GD_MGMT_PROGRAM */
71 enum gf_mgmt_procnum {
72  GD_MGMT_NULL = 0,
73  GD_MGMT_PROBE_QUERY,
74  GD_MGMT_FRIEND_ADD,
75  GD_MGMT_CLUSTER_LOCK,
76  GD_MGMT_CLUSTER_UNLOCK,
77  GD_MGMT_STAGE_OP,
78  GD_MGMT_COMMIT_OP,
79  GD_MGMT_FRIEND_REMOVE,
80  GD_MGMT_FRIEND_UPDATE,
81  GD_MGMT_CLI_PROBE,
82  GD_MGMT_CLI_DEPROBE,
83  GD_MGMT_CLI_LIST_FRIENDS,
84  GD_MGMT_CLI_CREATE_VOLUME,
85  GD_MGMT_CLI_GET_VOLUME,
86  GD_MGMT_CLI_DELETE_VOLUME,
87  GD_MGMT_CLI_START_VOLUME,
88  GD_MGMT_CLI_STOP_VOLUME,
89  GD_MGMT_CLI_RENAME_VOLUME,
90  GD_MGMT_CLI_DEFRAG_VOLUME,
91  GD_MGMT_CLI_SET_VOLUME,
92  GD_MGMT_CLI_ADD_BRICK,
93  GD_MGMT_CLI_REMOVE_BRICK,
94  GD_MGMT_CLI_REPLACE_BRICK,
95  GD_MGMT_CLI_LOG_FILENAME,
96  GD_MGMT_CLI_LOG_LOCATE,
97  GD_MGMT_CLI_LOG_ROTATE,
98  GD_MGMT_CLI_SYNC_VOLUME,
99  GD_MGMT_CLI_RESET_VOLUME,
100  GD_MGMT_CLI_FSM_LOG,
101  GD_MGMT_CLI_GSYNC_SET,
102  GD_MGMT_CLI_PROFILE_VOLUME,
103  GD_MGMT_BRICK_OP,
104  GD_MGMT_CLI_LOG_LEVEL,
105  GD_MGMT_CLI_STATUS_VOLUME,
106  GD_MGMT_MAXVALUE
107 };
108 
109 /* GLUSTER_CLI_PROGRAM */
110 enum gluster_cli_procnum {
111  GLUSTER_CLI_NULL = 0,
112  GLUSTER_CLI_PROBE,
113  GLUSTER_CLI_DEPROBE,
114  GLUSTER_CLI_LIST_FRIENDS,
115  GLUSTER_CLI_CREATE_VOLUME,
116  GLUSTER_CLI_GET_VOLUME,
117  GLUSTER_CLI_GET_NEXT_VOLUME,
118  GLUSTER_CLI_DELETE_VOLUME,
119  GLUSTER_CLI_START_VOLUME,
120  GLUSTER_CLI_STOP_VOLUME,
121  GLUSTER_CLI_RENAME_VOLUME,
122  GLUSTER_CLI_DEFRAG_VOLUME,
123  GLUSTER_CLI_SET_VOLUME,
124  GLUSTER_CLI_ADD_BRICK,
125  GLUSTER_CLI_REMOVE_BRICK,
126  GLUSTER_CLI_REPLACE_BRICK,
127  GLUSTER_CLI_LOG_FILENAME,
128  GLUSTER_CLI_LOG_LOCATE,
129  GLUSTER_CLI_LOG_ROTATE,
130  GLUSTER_CLI_GETSPEC,
131  GLUSTER_CLI_PMAP_PORTBYBRICK,
132  GLUSTER_CLI_SYNC_VOLUME,
133  GLUSTER_CLI_RESET_VOLUME,
134  GLUSTER_CLI_FSM_LOG,
135  GLUSTER_CLI_GSYNC_SET,
136  GLUSTER_CLI_PROFILE_VOLUME,
137  GLUSTER_CLI_QUOTA,
138  GLUSTER_CLI_TOP_VOLUME,
139  GLUSTER_CLI_GETWD,
140  GLUSTER_CLI_LOG_LEVEL,
141  GLUSTER_CLI_STATUS_VOLUME,
142  GLUSTER_CLI_MOUNT,
143  GLUSTER_CLI_UMOUNT,
144  GLUSTER_CLI_HEAL_VOLUME,
145  GLUSTER_CLI_STATEDUMP_VOLUME,
146  GLUSTER_CLI_MAXVALUE
147 };
148 
149 /* GLUSTER_CLI_PROGRAM 2 */
150 enum gluster_cli_2_procnum {
151  GLUSTER_CLI_2_NULL = 0, /* 0 */
152  GLUSTER_CLI_2_PROBE,
153  GLUSTER_CLI_2_DEPROBE,
154  GLUSTER_CLI_2_LIST_FRIENDS,
155  GLUSTER_CLI_2_CREATE_VOLUME,
156  GLUSTER_CLI_2_GET_VOLUME,
157  GLUSTER_CLI_2_GET_NEXT_VOLUME,
158  GLUSTER_CLI_2_DELETE_VOLUME,
159  GLUSTER_CLI_2_START_VOLUME,
160  GLUSTER_CLI_2_STOP_VOLUME,
161  GLUSTER_CLI_2_RENAME_VOLUME,
162  GLUSTER_CLI_2_DEFRAG_VOLUME,
163  GLUSTER_CLI_2_SET_VOLUME,
164  GLUSTER_CLI_2_ADD_BRICK,
165  GLUSTER_CLI_2_REMOVE_BRICK,
166  GLUSTER_CLI_2_REPLACE_BRICK,
167  GLUSTER_CLI_2_LOG_ROTATE,
168  GLUSTER_CLI_2_GETSPEC,
169  GLUSTER_CLI_2_PMAP_PORTBYBRICK,
170  GLUSTER_CLI_2_SYNC_VOLUME,
171  GLUSTER_CLI_2_RESET_VOLUME,
172  GLUSTER_CLI_2_FSM_LOG,
173  GLUSTER_CLI_2_GSYNC_SET,
174  GLUSTER_CLI_2_PROFILE_VOLUME,
175  GLUSTER_CLI_2_QUOTA,
176  GLUSTER_CLI_2_TOP_VOLUME,
177  GLUSTER_CLI_2_GETWD,
178  GLUSTER_CLI_2_STATUS_VOLUME,
179  GLUSTER_CLI_2_STATUS_ALL,
180  GLUSTER_CLI_2_MOUNT,
181  GLUSTER_CLI_2_UMOUNT,
182  GLUSTER_CLI_2_HEAL_VOLUME,
183  GLUSTER_CLI_2_STATEDUMP_VOLUME,
184  GLUSTER_CLI_2_LIST_VOLUME,
185  GLUSTER_CLI_2_CLRLOCKS_VOLUME,
186  GLUSTER_CLI_2_MAXVALUE
187 };
188 
189 
190 /* GLUSTER_DUMP_PROGRAM */
191 enum gluster_prog_dump_procs {
192  GF_DUMP_NULL = 0,
193  GF_DUMP_DUMP,
194  GF_DUMP_MAXVALUE
195 };
196 
197 /* GLUSTERD1_MGMT_PROGRAM */
198 enum glusterd_mgmt_procnum {
199  GLUSTERD_MGMT_NULL = 0,
200  GLUSTERD_MGMT_PROBE_QUERY,
201  GLUSTERD_MGMT_FRIEND_ADD,
202  GLUSTERD_MGMT_CLUSTER_LOCK,
203  GLUSTERD_MGMT_CLUSTER_UNLOCK,
204  GLUSTERD_MGMT_STAGE_OP,
205  GLUSTERD_MGMT_COMMIT_OP,
206  GLUSTERD_MGMT_FRIEND_REMOVE,
207  GLUSTERD_MGMT_FRIEND_UPDATE,
208  GLUSTERD_MGMT_MAXVALUE
209 };
210 
211 /* GLUSTERD1_MGMT_PROGRAM for version 2*/
212 enum glusterd_mgmt_2_procnum {
213  GLUSTERD_MGMT_2_NULL = 0, /* 0 */
214  GLUSTERD_MGMT_2_CLUSTER_LOCK,
215  GLUSTERD_MGMT_2_CLUSTER_UNLOCK,
216  GLUSTERD_MGMT_2_STAGE_OP,
217  GLUSTERD_MGMT_2_COMMIT_OP,
218  GLUSTERD_MGMT_2_MAXVALUE
219 };
220 
221 /* GLUSTERD1_MGMT_PROGRAM for version 3 */
222 enum glusterd_mgmt_3_procnum {
223  GLUSTERD_MGMT_3_NULL = 0,
224  GLUSTERD_MGMT_3_LOCK,
225  GLUSTERD_MGMT_3_PRE_VALIDATE,
226  GLUSTERD_MGMT_3_BRICK_OP,
227  GLUSTERD_MGMT_3_COMMIT,
228  GLUSTERD_MGMT_3_POST_VALIDATE,
229  GLUSTERD_MGMT_3_UNLOCK,
230  GLUSTERD_MGMT_3_MAXVALUE
231 };
232 
233 /* GLUSTERFS_PROGRAM */
234 enum gf_brick_procnum {
235  GF_BRICK_NULL = 0,
236  GF_BRICK_TERMINATE,
237  GF_BRICK_XLATOR_INFO,
238  GF_BRICK_XLATOR_HEAL,
239  GF_BRICK_MAXVALUE
240 };
241 
242 /* GLUSTER_HNDSK_PROGRAM for version 1 and 2*/
243 enum gluster_prog_hndsk_procs {
244  GF_HNDSK_NULL = 0,
245  GF_HNDSK_SETVOLUME,
246  GF_HNDSK_GETSPEC,
247  GF_HNDSK_PING,
248  GF_HNDSK_SET_LK_VER,
249  GF_HNDSK_EVENT_NOTIFY,
250  GF_HNDSK_GET_VOLUME_INFO,
251  GF_HNDSK_MAXVALUE
252 };
253 
254 /* GLUSTER_PMAP_PROGRAM */
255 enum gf_pmap_procnum {
256  GF_PMAP_NULL = 0,
257  GF_PMAP_PORTBYBRICK,
258  GF_PMAP_BRICKBYPORT,
259  GF_PMAP_SIGNUP,
260  GF_PMAP_SIGNIN,
261  GF_PMAP_SIGNOUT,
262  GF_PMAP_MAXVALUE
263 };
264 
265 /* GD_BRICK_PROGRAM */
266 enum glusterd_brick_procnum {
267  GLUSTERD_BRICK_NULL = 0,
268  GLUSTERD_BRICK_TERMINATE,
269  GLUSTERD_BRICK_XLATOR_INFO,
270  GLUSTERD_BRICK_XLATOR_HEAL,
271  GLUSTERD_BRICK_OP,
272  GLUSTERD_BRICK_MAXVALUE
273 };
274 
275 /* "rpc/rpc-lib/src/protocol-common.h" line 174 of 228 */
276 enum glusterd_brick_2_procnum {
277  GLUSTERD_2_BRICK_NULL, /* 0 */
278  GLUSTERD_2_BRICK_TERMINATE,
279  GLUSTERD_2_BRICK_XLATOR_INFO,
280  GLUSTERD_2_BRICK_XLATOR_OP,
281  GLUSTERD_2_BRICK_STATUS,
282  GLUSTERD_2_BRICK_OP,
283  GLUSTERD_2_BRICK_XLATOR_DEFRAG,
284  GLUSTERD_2_NODE_PROFILE,
285  GLUSTERD_2_NODE_STATUS,
286  GLUSTERD_2_BRICK_MAXVALUE
287 };
288 
289 
290 /* GLUSTER_CBK_PROGRAM */
291 enum gf_cbk_procnum {
292  GF_CBK_NULL = 0,
293  GF_CBK_FETCHSPEC,
294  GF_CBK_INO_FLUSH,
295  GF_CBK_EVENT_NOTIFY,
296  GF_CBK_GET_SNAPS,
297  GF_CBK_CACHE_INVALIDATION,
298  GF_CBK_MAXVALUE
299 };
300 
301 /* GD_FRIEND_PROGRAM defined in "rpc/rpc-lib/src/protocol-common.h" */
302 enum glusterd_friend_procnum {
303  GLUSTERD_FRIEND_NULL, /* 0 */
304  GLUSTERD_PROBE_QUERY,
305  GLUSTERD_FRIEND_ADD,
306  GLUSTERD_FRIEND_REMOVE,
307  GLUSTERD_FRIEND_UPDATE,
308  GLUSTERD_FRIEND_MAXVALUE
309 };
310 
311 enum gf_fop_procnum {
312  GFS3_OP_NULL = 0,
313  GFS3_OP_STAT,
314  GFS3_OP_READLINK,
315  GFS3_OP_MKNOD,
316  GFS3_OP_MKDIR,
317  GFS3_OP_UNLINK,
318  GFS3_OP_RMDIR,
319  GFS3_OP_SYMLINK,
320  GFS3_OP_RENAME,
321  GFS3_OP_LINK,
322  GFS3_OP_TRUNCATE,
323  GFS3_OP_OPEN,
324  GFS3_OP_READ,
325  GFS3_OP_WRITE,
326  GFS3_OP_STATFS,
327  GFS3_OP_FLUSH,
328  GFS3_OP_FSYNC,
329  GFS3_OP_SETXATTR,
330  GFS3_OP_GETXATTR,
331  GFS3_OP_REMOVEXATTR,
332  GFS3_OP_OPENDIR,
333  GFS3_OP_FSYNCDIR,
334  GFS3_OP_ACCESS,
335  GFS3_OP_CREATE,
336  GFS3_OP_FTRUNCATE,
337  GFS3_OP_FSTAT,
338  GFS3_OP_LK,
339  GFS3_OP_LOOKUP,
340  GFS3_OP_READDIR,
341  GFS3_OP_INODELK,
342  GFS3_OP_FINODELK,
343  GFS3_OP_ENTRYLK,
344  GFS3_OP_FENTRYLK,
345  GFS3_OP_XATTROP,
346  GFS3_OP_FXATTROP,
347  GFS3_OP_FGETXATTR,
348  GFS3_OP_FSETXATTR,
349  GFS3_OP_RCHECKSUM,
350  GFS3_OP_SETATTR,
351  GFS3_OP_FSETATTR,
352  GFS3_OP_READDIRP,
353  GFS3_OP_FORGET,
354  GFS3_OP_RELEASE,
355  GFS3_OP_RELEASEDIR,
356  GFS3_OP_FREMOVEXATTR,
357  GFS3_OP_FALLOCATE,
358  GFS3_OP_DISCARD,
359  GFS3_OP_ZEROFILL,
360  GFS3_OP_IPC,
361  GFS3_OP_SEEK,
362  GFS3_OP_MAXVALUE
363 };
364 
365 /* dir-entry types from libglusterfs/src/compat.h */
366 enum gluster_entry_types {
367  GLUSTER_DT_UNKNOWN = 0,
368  GLUSTER_DT_FIFO = 1,
369  GLUSTER_DT_CHR = 2,
370  GLUSTER_DT_DIR = 4,
371  GLUSTER_DT_BLK = 6,
372  GLUSTER_DT_REG = 8,
373  GLUSTER_DT_LNK = 10,
374  GLUSTER_DT_SOCK = 12,
375  GLUSTER_DT_WHT = 14
376 };
377 
378 
379 /* LOCKING operators come from libglusterfs/src/glusterfs.h */
380 
381 /* based on original enum glusterfs_lk_cmds_t */
382 enum gluster_lk_cmds {
383  GF_LK_GETLK = 0,
384  GF_LK_SETLK,
385  GF_LK_SETLKW,
386  GF_LK_RESLK_LCK,
387  GF_LK_RESLK_LCKW,
388  GF_LK_RESLK_UNLCK,
389  GF_LK_GETLK_FD
390 };
391 
392 /* based on original enum glusterfs_lk_types_t */
393 enum gluster_lk_types {
394  GF_LK_F_RDLCK = 0,
395  GF_LK_F_WRLCK,
396  GF_LK_F_UNLCK,
397  GF_LK_EOL
398 };
399 
400 enum gluster_lk_whence {
401  GF_LK_SEEK_SET = 0,
402  GF_LK_SEEK_CUR,
403  GF_LK_SEEK_END
404 };
405 
406 enum gluster_seek_whence {
407  GF_SEEK_DATA = 0,
408  GF_SEEK_HOLE
409 };
410 
411 /* based on enum glusterd_op_ from xlators/mgmt/glusterd/src/glusterd.h */
412 enum glusterd_ops {
413  GD_OP_NONE = 0,
414  GD_OP_CREATE_VOLUME,
415  GD_OP_START_BRICK,
416  GD_OP_STOP_BRICK,
417  GD_OP_DELETE_VOLUME,
418  GD_OP_START_VOLUME,
419  GD_OP_STOP_VOLUME,
420  GD_OP_DEFRAG_VOLUME,
421  GD_OP_ADD_BRICK,
422  GD_OP_REMOVE_BRICK,
423  GD_OP_REPLACE_BRICK,
424  GD_OP_SET_VOLUME,
425  GD_OP_RESET_VOLUME,
426  GD_OP_SYNC_VOLUME,
427  GD_OP_LOG_ROTATE,
428  GD_OP_GSYNC_SET,
429  GD_OP_PROFILE_VOLUME,
430  GD_OP_QUOTA,
431  GD_OP_STATUS_VOLUME,
432  GD_OP_REBALANCE,
433  GD_OP_HEAL_VOLUME,
434  GD_OP_STATEDUMP_VOLUME,
435  GD_OP_LIST_VOLUME,
436  GD_OP_CLEARLOCKS_VOLUME,
437  GD_OP_DEFRAG_BRICK_VOLUME,
438  GD_OP_COPY_FILE,
439  GD_OP_SYS_EXEC,
440  GD_OP_GSYNC_CREATE,
441  GD_OP_SNAP,
442  GD_OP_MAX
443 };
444 
445 /* based on enum gf_upcall_event_ from libglusterfs/src/upcall-utils.h */
446 enum gf_upcall_event {
447  GF_UPCALL_EVENT_NULL,
448  GF_UPCALL_CACHE_INVALIDATION,
449 };
450 
451 extern int
452 gluster_rpc_dissect_dict(proto_tree *tree, tvbuff_t *tvb, int hfindex,
453  int offset);
454 
455 extern int
456 gluster_dissect_common_reply(tvbuff_t *tvb, int offset,
457  packet_info *pinfo, proto_tree *tree, void* data _U_);
458 extern int
459 glusterfs_gfs3_3_op_common_reply(tvbuff_t *tvb,
460  packet_info *pinfo, proto_tree *tree, void* data _U_);
461 
462 extern int
463 glusterfs_rpc_dissect_gf_iatt(proto_tree *tree, tvbuff_t *tvb, int hfindex,
464  int offset);
465 #endif /* __PACKET_GLUSTER_H__ */
Definition: packet_info.h:44
Definition: proto.h:904
Definition: tvbuff-int.h:35