summaryrefslogtreecommitdiff
path: root/wireshark
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@hq.newdream.net>2009-09-03 17:40:30 -0700
committerYehuda Sadeh <yehuda@hq.newdream.net>2009-09-03 17:40:30 -0700
commitcbd2ac570a75e23ca07d5ba3e2d73f883198d7a6 (patch)
treea052e5feb9f238196847313b7f2a34c52226b244 /wireshark
parent43426ddc367bfcad4ea67b7a96e838d5fc7af01f (diff)
downloadceph-cbd2ac570a75e23ca07d5ba3e2d73f883198d7a6.tar.gz
wireshark: keep plugin code outside of the patch
Diffstat (limited to 'wireshark')
-rw-r--r--wireshark/ceph/Makefile.am126
-rw-r--r--wireshark/ceph/Makefile.common32
-rw-r--r--wireshark/ceph/Makefile.nmake100
-rw-r--r--wireshark/ceph/ceph_fs.h917
-rw-r--r--wireshark/ceph/crc32c.h14
-rw-r--r--wireshark/ceph/moduleinfo.h16
-rw-r--r--wireshark/ceph/moduleinfo.nmake28
-rw-r--r--wireshark/ceph/msgr.h156
-rw-r--r--wireshark/ceph/packet-ceph.c1162
-rw-r--r--wireshark/ceph/plugin.c28
-rw-r--r--wireshark/ceph/plugin.rc.in34
-rw-r--r--wireshark/ceph/rados.h428
-rw-r--r--wireshark/ceph/sctp_crc32.c728
-rw-r--r--wireshark/wireshark.patch2755
14 files changed, 3769 insertions, 2755 deletions
diff --git a/wireshark/ceph/Makefile.am b/wireshark/ceph/Makefile.am
new file mode 100644
index 00000000000..76b3e7a11b2
--- /dev/null
+++ b/wireshark/ceph/Makefile.am
@@ -0,0 +1,126 @@
+# Makefile.am
+# Automake file for Cisco SS7 Session Management plugin
+# Copyright 2004, Duncan Sargeant <dunc-ethereal@rcpt.to>
+#
+# $Id: Makefile.am 24488 2008-02-27 16:18:30Z stig $
+#
+# Wireshark - Network traffic analyzer
+# By Gerald Combs <gerald@wireshark.org>
+# Copyright 1998 Gerald Combs
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+INCLUDES = -I$(top_srcdir) -I$(includedir)
+
+include Makefile.common
+
+
+if HAVE_WARNINGS_AS_ERRORS
+AM_CFLAGS = -Werror
+endif
+
+plugindir = @plugindir@
+
+plugin_LTLIBRARIES = ceph.la
+ceph_la_SOURCES = \
+ plugin.c \
+ moduleinfo.h \
+ $(DISSECTOR_SRC) \
+ $(DISSECTOR_INCLUDES)
+ceph_la_LDFLAGS = -module -avoid-version
+ceph_la_LIBADD = @PLUGIN_LIBS@
+
+# Libs must be cleared, or else libtool won't create a shared module.
+# If your module needs to be linked against any particular libraries,
+# add them here.
+LIBS =
+
+#
+# Build plugin.c, which contains the plugin version[] string, a
+# function plugin_register() that calls the register routines for all
+# protocols, and a function plugin_reg_handoff() that calls the handoff
+# registration routines for all protocols.
+#
+# We do this by scanning sources. If that turns out to be too slow,
+# maybe we could just require every .o file to have an register routine
+# of a given name (packet-aarp.o -> proto_register_aarp, etc.).
+#
+# Formatting conventions: The name of the proto_register_* routines an
+# proto_reg_handoff_* routines must start in column zero, or must be
+# preceded only by "void " starting in column zero, and must not be
+# inside #if.
+#
+# DISSECTOR_SRC is assumed to have all the files that need to be scanned.
+#
+# For some unknown reason, having a big "for" loop in the Makefile
+# to scan all the files doesn't work with some "make"s; they seem to
+# pass only the first few names in the list to the shell, for some
+# reason.
+#
+# Therefore, we have a script to generate the plugin.c file.
+# The shell script runs slowly, as multiple greps and seds are run
+# for each input file; this is especially slow on Windows. Therefore,
+# if Python is present (as indicated by PYTHON being defined), we run
+# a faster Python script to do that work instead.
+#
+# The first argument is the directory in which the source files live.
+# The second argument is "plugin", to indicate that we should build
+# a plugin.c file for a plugin.
+# All subsequent arguments are the files to scan.
+#
+plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \
+ $(top_srcdir)/tools/make-dissector-reg.py
+ @if test -n "$(PYTHON)"; then \
+ echo Making plugin.c with python ; \
+ $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \
+ plugin $(DISSECTOR_SRC) ; \
+ else \
+ echo Making plugin.c with shell script ; \
+ $(top_srcdir)/tools/make-dissector-reg $(srcdir) \
+ $(plugin_src) plugin $(DISSECTOR_SRC) ; \
+ fi
+
+#
+# Currently plugin.c can be included in the distribution because
+# we always build all protocol dissectors. We used to have to check
+# whether or not to build the snmp dissector. If we again need to
+# variably build something, making plugin.c non-portable, uncomment
+# the dist-hook line below.
+#
+# Oh, yuk. We don't want to include "plugin.c" in the distribution, as
+# its contents depend on the configuration, and therefore we want it
+# to be built when the first "make" is done; however, Automake insists
+# on putting *all* source into the distribution.
+#
+# We work around this by having a "dist-hook" rule that deletes
+# "plugin.c", so that "dist" won't pick it up.
+#
+#dist-hook:
+# @rm -f $(distdir)/plugin.c
+
+CLEANFILES = \
+ ceph \
+ *~
+
+MAINTAINERCLEANFILES = \
+ Makefile.in \
+ plugin.c
+
+EXTRA_DIST = \
+ Makefile.common \
+ Makefile.nmake \
+ moduleinfo.nmake \
+ plugin.rc.in
diff --git a/wireshark/ceph/Makefile.common b/wireshark/ceph/Makefile.common
new file mode 100644
index 00000000000..b8a8f155314
--- /dev/null
+++ b/wireshark/ceph/Makefile.common
@@ -0,0 +1,32 @@
+# Makefile.common for Cisco SS7 Session Management plugin
+# Contains the stuff from Makefile.am and Makefile.nmake that is
+# a) common to both files and
+# b) portable between both files
+#
+# $Id: Makefile.common 18197 2006-05-21 05:12:17Z sahlberg $
+#
+# Wireshark - Network traffic analyzer
+# By Gerald Combs <gerald@wireshark.org>
+# Copyright 1998 Gerald Combs
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# the name of the plugin
+PLUGIN_NAME = ceph
+
+# the dissector sources (without any helpers)
+DISSECTOR_SRC = \
+ sctp_crc32.c \
+ packet-ceph.c
diff --git a/wireshark/ceph/Makefile.nmake b/wireshark/ceph/Makefile.nmake
new file mode 100644
index 00000000000..857e4354bc3
--- /dev/null
+++ b/wireshark/ceph/Makefile.nmake
@@ -0,0 +1,100 @@
+# Makefile.nmake
+# nmake file for Wireshark plugin
+#
+# $Id: Makefile.nmake 24520 2008-03-01 12:31:01Z jake $
+#
+
+include ..\..\config.nmake
+include moduleinfo.nmake
+
+include Makefile.common
+
+CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
+ /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
+
+.c.obj::
+ $(CC) $(CFLAGS) -Fd.\ -c $<
+
+LDFLAGS = $(PLUGIN_LDFLAGS)
+
+!IFDEF ENABLE_LIBWIRESHARK
+LINK_PLUGIN_WITH=..\..\epan\libwireshark.lib
+CFLAGS=/DHAVE_WIN32_LIBWIRESHARK_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS)
+
+DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj)
+
+DISSECTOR_SUPPORT_OBJECTS = $(DISSECTOR_SUPPORT_SRC:.c=.obj)
+
+OBJECTS = $(DISSECTOR_OBJECTS) $(DISSECTOR_SUPPORT_OBJECTS) plugin.obj
+
+RESOURCE=$(PLUGIN_NAME).res
+
+all: $(PLUGIN_NAME).dll
+
+$(PLUGIN_NAME).rc : moduleinfo.nmake
+ sed -e s/@PLUGIN_NAME@/$(PLUGIN_NAME)/ \
+ -e s/@RC_MODULE_VERSION@/$(RC_MODULE_VERSION)/ \
+ -e s/@RC_VERSION@/$(RC_VERSION)/ \
+ -e s/@MODULE_VERSION@/$(MODULE_VERSION)/ \
+ -e s/@PACKAGE@/$(PACKAGE)/ \
+ -e s/@VERSION@/$(VERSION)/ \
+ -e s/@MSVC_VARIANT@/$(MSVC_VARIANT)/ \
+ < plugin.rc.in > $@
+
+$(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLUGIN_WITH) $(RESOURCE)
+ link -dll /out:$(PLUGIN_NAME).dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
+ $(GLIB_LIBS) $(RESOURCE)
+
+#
+# Build plugin.c, which contains the plugin version[] string, a
+# function plugin_register() that calls the register routines for all
+# protocols, and a function plugin_reg_handoff() that calls the handoff
+# registration routines for all protocols.
+#
+# We do this by scanning sources. If that turns out to be too slow,
+# maybe we could just require every .o file to have an register routine
+# of a given name (packet-aarp.o -> proto_register_aarp, etc.).
+#
+# Formatting conventions: The name of the proto_register_* routines an
+# proto_reg_handoff_* routines must start in column zero, or must be
+# preceded only by "void " starting in column zero, and must not be
+# inside #if.
+#
+# DISSECTOR_SRC is assumed to have all the files that need to be scanned.
+#
+# For some unknown reason, having a big "for" loop in the Makefile
+# to scan all the files doesn't work with some "make"s; they seem to
+# pass only the first few names in the list to the shell, for some
+# reason.
+#
+# Therefore, we have a script to generate the plugin.c file.
+# The shell script runs slowly, as multiple greps and seds are run
+# for each input file; this is especially slow on Windows. Therefore,
+# if Python is present (as indicated by PYTHON being defined), we run
+# a faster Python script to do that work instead.
+#
+# The first argument is the directory in which the source files live.
+# The second argument is "plugin", to indicate that we should build
+# a plugin.c file for a plugin.
+# All subsequent arguments are the files to scan.
+#
+!IFDEF PYTHON
+plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg.py
+ @echo Making plugin.c (using python)
+ @$(PYTHON) "../../tools/make-dissector-reg.py" . plugin $(DISSECTOR_SRC)
+!ELSE
+plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
+ @echo Making plugin.c (using sh)
+ @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC)
+!ENDIF
+
+!ENDIF
+
+clean:
+ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
+ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
+ $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
+
+distclean: clean
+
+maintainer-clean: distclean
diff --git a/wireshark/ceph/ceph_fs.h b/wireshark/ceph/ceph_fs.h
new file mode 100644
index 00000000000..27a5a26a0d4
--- /dev/null
+++ b/wireshark/ceph/ceph_fs.h
@@ -0,0 +1,917 @@
+/*
+ * ceph_fs.h - Ceph constants and data types to share between kernel and
+ * user space.
+ *
+ * Most types in this file are defined as little-endian, and are
+ * primarily intended to describe data structures that pass over the
+ * wire or that are stored on disk.
+ *
+ * LGPL2
+ */
+
+#ifndef _FS_CEPH_CEPH_FS_H
+#define _FS_CEPH_CEPH_FS_H
+
+#include "msgr.h"
+#include "rados.h"
+
+/*
+ * subprotocol versions. when specific messages types or high-level
+ * protocols change, bump the affected components. we keep rev
+ * internal cluster protocols separately from the public,
+ * client-facing protocol.
+ */
+#define CEPH_OSD_PROTOCOL 7 /* cluster internal */
+#define CEPH_MDS_PROTOCOL 9 /* cluster internal */
+#define CEPH_MON_PROTOCOL 4 /* cluster internal */
+#define CEPH_OSDC_PROTOCOL 20 /* server/client */
+#define CEPH_MDSC_PROTOCOL 28 /* server/client */
+#define CEPH_MONC_PROTOCOL 14 /* server/client */
+
+
+#define CEPH_INO_ROOT 1
+
+/* arbitrary limit on max # of monitors (cluster of 3 is typical) */
+#define CEPH_MAX_MON 31
+
+
+/*
+ * "Frags" are a way to describe a subset of a 32-bit number space,
+ * using a mask and a value to match against that mask. Any given frag
+ * (subset of the number space) can be partitioned into 2^n sub-frags.
+ *
+ * Frags are encoded into a 32-bit word:
+ * 8 upper bits = "bits"
+ * 24 lower bits = "value"
+ * (We could go to 5+27 bits, but who cares.)
+ *
+ * We use the _most_ significant bits of the 24 bit value. This makes
+ * values logically sort.
+ *
+ * Unfortunately, because the "bits" field is still in the high bits, we
+ * can't sort encoded frags numerically. However, it does allow you
+ * to feed encoded frags as values into frag_contains_value.
+ */
+static inline __u32 frag_make(__u32 b, __u32 v)
+{
+ return (b << 24) |
+ (v & (0xffffffu << (24-b)) & 0xffffffu);
+}
+static inline __u32 frag_bits(__u32 f)
+{
+ return f >> 24;
+}
+static inline __u32 frag_value(__u32 f)
+{
+ return f & 0xffffffu;
+}
+static inline __u32 frag_mask(__u32 f)
+{
+ return (0xffffffu << (24-frag_bits(f))) & 0xffffffu;
+}
+static inline __u32 frag_mask_shift(__u32 f)
+{
+ return 24 - frag_bits(f);
+}
+
+static inline int frag_contains_value(__u32 f, __u32 v)
+{
+ return (v & frag_mask(f)) == frag_value(f);
+}
+static inline int frag_contains_frag(__u32 f, __u32 sub)
+{
+ /* is sub as specific as us, and contained by us? */
+ return frag_bits(sub) >= frag_bits(f) &&
+ (frag_value(sub) & frag_mask(f)) == frag_value(f);
+}
+
+static inline __u32 frag_parent(__u32 f)
+{
+ return frag_make(frag_bits(f) - 1,
+ frag_value(f) & (frag_mask(f) << 1));
+}
+static inline int frag_is_left_child(__u32 f)
+{
+ return frag_bits(f) > 0 &&
+ (frag_value(f) & (0x1000000 >> frag_bits(f))) == 0;
+}
+static inline int frag_is_right_child(__u32 f)
+{
+ return frag_bits(f) > 0 &&
+ (frag_value(f) & (0x1000000 >> frag_bits(f))) == 1;
+}
+static inline __u32 frag_sibling(__u32 f)
+{
+ return frag_make(frag_bits(f),
+ frag_value(f) ^ (0x1000000 >> frag_bits(f)));
+}
+static inline __u32 frag_left_child(__u32 f)
+{
+ return frag_make(frag_bits(f)+1, frag_value(f));
+}
+static inline __u32 frag_right_child(__u32 f)
+{
+ return frag_make(frag_bits(f)+1,
+ frag_value(f) | (0x1000000 >> (1+frag_bits(f))));
+}
+static inline __u32 frag_make_child(__u32 f, int by, int i)
+{
+ int newbits = frag_bits(f) + by;
+ return frag_make(newbits,
+ frag_value(f) | (i << (24 - newbits)));
+}
+static inline int frag_is_leftmost(__u32 f)
+{
+ return frag_value(f) == 0;
+}
+static inline int frag_is_rightmost(__u32 f)
+{
+ return frag_value(f) == frag_mask(f);
+}
+static inline __u32 frag_next(__u32 f)
+{
+ return frag_make(frag_bits(f),
+ frag_value(f) + (0x1000000 >> frag_bits(f)));
+}
+
+/*
+ * comparator to sort frags logically, as when traversing the
+ * number space in ascending order...
+ */
+static inline int frag_compare(__u32 a, __u32 b)
+{
+ unsigned va = frag_value(a);
+ unsigned vb = frag_value(b);
+ if (va < vb)
+ return -1;
+ if (va > vb)
+ return 1;
+ va = frag_bits(a);
+ vb = frag_bits(b);
+ if (va < vb)
+ return -1;
+ if (va > vb)
+ return 1;
+ return 0;
+}
+
+
+/*
+ * ceph_file_layout - describe data layout for a file/inode
+ */
+struct ceph_file_layout {
+ /* file -> object mapping */
+ __le32 fl_stripe_unit; /* stripe unit, in bytes. must be multiple
+ of page size. */
+ __le32 fl_stripe_count; /* over this many objects */
+ __le32 fl_object_size; /* until objects are this big, then move to
+ new objects */
+ __le32 fl_cas_hash; /* 0 = none; 1 = sha256 */
+
+ /* pg -> disk layout */
+ __le32 fl_object_stripe_unit; /* for per-object parity, if any */
+
+ /* object -> pg layout */
+ __le32 fl_pg_preferred; /* preferred primary for pg (-1 for none) */
+ __le32 fl_pg_pool; /* namespace, crush ruleset, rep level */
+} __attribute__ ((packed));
+
+#define ceph_file_layout_su(l) ((__s32)le32_to_cpu((l).fl_stripe_unit))
+#define ceph_file_layout_stripe_count(l) \
+ ((__s32)le32_to_cpu((l).fl_stripe_count))
+#define ceph_file_layout_object_size(l) ((__s32)le32_to_cpu((l).fl_object_size))
+#define ceph_file_layout_cas_hash(l) ((__s32)le32_to_cpu((l).fl_cas_hash))
+#define ceph_file_layout_object_su(l) \
+ ((__s32)le32_to_cpu((l).fl_object_stripe_unit))
+#define ceph_file_layout_pg_preferred(l) \
+ ((__s32)le32_to_cpu((l).fl_pg_preferred))
+#define ceph_file_layout_pg_pool(l) \
+ ((__s32)le32_to_cpu((l).fl_pg_pool))
+
+#define ceph_file_layout_stripe_width(l) (le32_to_cpu((l).fl_stripe_unit) * \
+ le32_to_cpu((l).fl_stripe_count))
+
+/* "period" == bytes before i start on a new set of objects */
+#define ceph_file_layout_period(l) (le32_to_cpu((l).fl_object_size) * \
+ le32_to_cpu((l).fl_stripe_count))
+
+
+
+/*
+ * string hash.
+ *
+ * taken from Linux, tho we should probably take care to use this one
+ * in case the upstream hash changes.
+ */
+
+/* Name hashing routines. Initial hash value */
+/* Hash courtesy of the R5 hash in reiserfs modulo sign bits */
+#define ceph_init_name_hash() 0
+
+/* partial hash update function. Assume roughly 4 bits per character */
+static inline unsigned long
+ceph_partial_name_hash(unsigned long c, unsigned long prevhash)
+{
+ return (prevhash + (c << 4) + (c >> 4)) * 11;
+}
+
+/*
+ * Finally: cut down the number of bits to a int value (and try to avoid
+ * losing bits)
+ */
+static inline unsigned long ceph_end_name_hash(unsigned long hash)
+{
+ return (unsigned int) hash;
+}
+
+/* Compute the hash for a name string. */
+static inline unsigned int
+ceph_full_name_hash(const char *name, unsigned int len)
+{
+ unsigned long hash = ceph_init_name_hash();
+ while (len--)
+ hash = ceph_partial_name_hash(*name++, hash);
+ return ceph_end_name_hash(hash);
+}
+
+
+
+/*********************************************
+ * message layer
+ */
+
+/*
+ * message types
+ */
+
+/* misc */
+#define CEPH_MSG_SHUTDOWN 1
+#define CEPH_MSG_PING 2
+
+/* client <-> monitor */
+#define CEPH_MSG_MON_MAP 4
+#define CEPH_MSG_MON_GET_MAP 5
+#define CEPH_MSG_CLIENT_MOUNT 10
+#define CEPH_MSG_CLIENT_MOUNT_ACK 11
+#define CEPH_MSG_CLIENT_UNMOUNT 12
+#define CEPH_MSG_STATFS 13
+#define CEPH_MSG_STATFS_REPLY 14
+
+/* client <-> mds */
+#define CEPH_MSG_MDS_GETMAP 20
+#define CEPH_MSG_MDS_MAP 21
+
+#define CEPH_MSG_CLIENT_SESSION 22
+#define CEPH_MSG_CLIENT_RECONNECT 23
+
+#define CEPH_MSG_CLIENT_REQUEST 24
+#define CEPH_MSG_CLIENT_REQUEST_FORWARD 25
+#define CEPH_MSG_CLIENT_REPLY 26
+#define CEPH_MSG_CLIENT_CAPS 0x310
+#define CEPH_MSG_CLIENT_LEASE 0x311
+#define CEPH_MSG_CLIENT_SNAP 0x312
+#define CEPH_MSG_CLIENT_CAPRELEASE 0x313
+
+/* osd */
+#define CEPH_MSG_OSD_GETMAP 40
+#define CEPH_MSG_OSD_MAP 41
+#define CEPH_MSG_OSD_OP 42
+#define CEPH_MSG_OSD_OPREPLY 43
+
+
+struct ceph_mon_statfs {
+ __le64 have_version;
+ ceph_fsid_t fsid;
+ __le64 tid;
+} __attribute__ ((packed));
+
+struct ceph_statfs {
+ __le64 kb, kb_used, kb_avail;
+ __le64 num_objects;
+} __attribute__ ((packed));
+
+struct ceph_mon_statfs_reply {
+ ceph_fsid_t fsid;
+ __le64 tid;
+ __le64 version;
+ struct ceph_statfs st;
+} __attribute__ ((packed));
+
+struct ceph_osd_getmap {
+ __le64 have_version;
+ ceph_fsid_t fsid;
+ __le32 start;
+} __attribute__ ((packed));
+
+struct ceph_mds_getmap {
+ __le64 have_version;
+ ceph_fsid_t fsid;
+} __attribute__ ((packed));
+
+struct ceph_client_mount {
+ __le64 have_version;
+} __attribute__ ((packed));
+
+struct ceph_client_unmount {
+ __le64 have_version;
+} __attribute__ ((packed));
+
+/*
+ * mds states
+ * > 0 -> in
+ * <= 0 -> out
+ */
+#define CEPH_MDS_STATE_DNE 0 /* down, does not exist. */
+#define CEPH_MDS_STATE_STOPPED -1 /* down, once existed, but no subtrees.
+ empty log. */
+#define CEPH_MDS_STATE_BOOT -4 /* up, boot announcement. */
+#define CEPH_MDS_STATE_STANDBY -5 /* up, idle. waiting for assignment. */
+#define CEPH_MDS_STATE_CREATING -6 /* up, creating MDS instance. */
+#define CEPH_MDS_STATE_STARTING -7 /* up, starting previously stopped mds. */
+#define CEPH_MDS_STATE_STANDBY_REPLAY -8 /* up, tailing active node's journal */
+
+#define CEPH_MDS_STATE_REPLAY 8 /* up, replaying journal. */
+#define CEPH_MDS_STATE_RESOLVE 9 /* up, disambiguating distributed
+ operations (import, rename, etc.) */
+#define CEPH_MDS_STATE_RECONNECT 10 /* up, reconnect to clients */
+#define CEPH_MDS_STATE_REJOIN 11 /* up, rejoining distributed cache */
+#define CEPH_MDS_STATE_CLIENTREPLAY 12 /* up, replaying client operations */
+#define CEPH_MDS_STATE_ACTIVE 13 /* up, active */
+#define CEPH_MDS_STATE_STOPPING 14 /* up, but exporting metadata */
+
+static inline const char *ceph_mds_state_name(int s)
+{
+ switch (s) {
+ /* down and out */
+ case CEPH_MDS_STATE_DNE: return "down:dne";
+ case CEPH_MDS_STATE_STOPPED: return "down:stopped";
+ /* up and out */
+ case CEPH_MDS_STATE_BOOT: return "up:boot";
+ case CEPH_MDS_STATE_STANDBY: return "up:standby";
+ case CEPH_MDS_STATE_STANDBY_REPLAY: return "up:standby-replay";
+ case CEPH_MDS_STATE_CREATING: return "up:creating";
+ case CEPH_MDS_STATE_STARTING: return "up:starting";
+ /* up and in */
+ case CEPH_MDS_STATE_REPLAY: return "up:replay";
+ case CEPH_MDS_STATE_RESOLVE: return "up:resolve";
+ case CEPH_MDS_STATE_RECONNECT: return "up:reconnect";
+ case CEPH_MDS_STATE_REJOIN: return "up:rejoin";
+ case CEPH_MDS_STATE_CLIENTREPLAY: return "up:clientreplay";
+ case CEPH_MDS_STATE_ACTIVE: return "up:active";
+ case CEPH_MDS_STATE_STOPPING: return "up:stopping";
+ default: return "";
+ }
+ return NULL;
+}
+
+
+/*
+ * metadata lock types.
+ * - these are bitmasks.. we can compose them
+ * - they also define the lock ordering by the MDS
+ * - a few of these are internal to the mds
+ */
+#define CEPH_LOCK_DN 1
+#define CEPH_LOCK_ISNAP 2
+#define CEPH_LOCK_IVERSION 4 /* mds internal */
+#define CEPH_LOCK_IFILE 8 /* mds internal */
+#define CEPH_LOCK_IAUTH 32
+#define CEPH_LOCK_ILINK 64
+#define CEPH_LOCK_IDFT 128 /* dir frag tree */
+#define CEPH_LOCK_INEST 256 /* mds internal */
+#define CEPH_LOCK_IXATTR 512
+#define CEPH_LOCK_INO 2048 /* immutable inode bits; not a lock */
+
+/* client_session ops */
+enum {
+ CEPH_SESSION_REQUEST_OPEN,
+ CEPH_SESSION_OPEN,
+ CEPH_SESSION_REQUEST_CLOSE,
+ CEPH_SESSION_CLOSE,
+ CEPH_SESSION_REQUEST_RENEWCAPS,
+ CEPH_SESSION_RENEWCAPS,
+ CEPH_SESSION_STALE,
+ CEPH_SESSION_RECALL_STATE,
+};
+
+static inline const char *ceph_session_op_name(int op)
+{
+ switch (op) {
+ case CEPH_SESSION_REQUEST_OPEN: return "request_open";
+ case CEPH_SESSION_OPEN: return "open";
+ case CEPH_SESSION_REQUEST_CLOSE: return "request_close";
+ case CEPH_SESSION_CLOSE: return "close";
+ case CEPH_SESSION_REQUEST_RENEWCAPS: return "request_renewcaps";
+ case CEPH_SESSION_RENEWCAPS: return "renewcaps";
+ case CEPH_SESSION_STALE: return "stale";
+ case CEPH_SESSION_RECALL_STATE: return "recall_state";
+ default: return "???";
+ }
+}
+
+struct ceph_mds_session_head {
+ __le32 op;
+ __le64 seq;
+ struct ceph_timespec stamp;
+ __le32 max_caps, max_leases;
+} __attribute__ ((packed));
+
+/* client_request */
+/*
+ * metadata ops.
+ * & 0x001000 -> write op
+ * & 0x010000 -> follow symlink (e.g. stat(), not lstat()).
+ & & 0x100000 -> use weird ino/path trace
+ */
+#define CEPH_MDS_OP_WRITE 0x001000
+enum {
+ CEPH_MDS_OP_LOOKUP = 0x00100,
+ CEPH_MDS_OP_GETATTR = 0x00101,
+ CEPH_MDS_OP_LOOKUPHASH = 0x00102,
+ CEPH_MDS_OP_LOOKUPPARENT = 0x00103,
+
+ CEPH_MDS_OP_SETXATTR = 0x01105,
+ CEPH_MDS_OP_RMXATTR = 0x01106,
+ CEPH_MDS_OP_SETLAYOUT = 0x01107,
+ CEPH_MDS_OP_SETATTR = 0x01108,
+
+ CEPH_MDS_OP_MKNOD = 0x01201,
+ CEPH_MDS_OP_LINK = 0x01202,
+ CEPH_MDS_OP_UNLINK = 0x01203,
+ CEPH_MDS_OP_RENAME = 0x01204,
+ CEPH_MDS_OP_MKDIR = 0x01220,
+ CEPH_MDS_OP_RMDIR = 0x01221,
+ CEPH_MDS_OP_SYMLINK = 0x01222,
+
+ CEPH_MDS_OP_CREATE = 0x00301,
+ CEPH_MDS_OP_OPEN = 0x00302,
+ CEPH_MDS_OP_READDIR = 0x00305,
+
+ CEPH_MDS_OP_LOOKUPSNAP = 0x00400,
+ CEPH_MDS_OP_MKSNAP = 0x01400,
+ CEPH_MDS_OP_RMSNAP = 0x01401,
+ CEPH_MDS_OP_LSSNAP = 0x00402,
+};
+
+static inline const char *ceph_mds_op_name(int op)
+{
+ switch (op) {
+ case CEPH_MDS_OP_LOOKUP: return "lookup";
+ case CEPH_MDS_OP_LOOKUPHASH: return "lookuphash";
+ case CEPH_MDS_OP_LOOKUPPARENT: return "lookupparent";
+ case CEPH_MDS_OP_GETATTR: return "getattr";
+ case CEPH_MDS_OP_SETXATTR: return "setxattr";
+ case CEPH_MDS_OP_SETATTR: return "setattr";
+ case CEPH_MDS_OP_RMXATTR: return "rmxattr";
+ case CEPH_MDS_OP_READDIR: return "readdir";
+ case CEPH_MDS_OP_MKNOD: return "mknod";
+ case CEPH_MDS_OP_LINK: return "link";
+ case CEPH_MDS_OP_UNLINK: return "unlink";
+ case CEPH_MDS_OP_RENAME: return "rename";
+ case CEPH_MDS_OP_MKDIR: return "mkdir";
+ case CEPH_MDS_OP_RMDIR: return "rmdir";
+ case CEPH_MDS_OP_SYMLINK: return "symlink";
+ case CEPH_MDS_OP_CREATE: return "create";
+ case CEPH_MDS_OP_OPEN: return "open";
+ case CEPH_MDS_OP_LOOKUPSNAP: return "lookupsnap";
+ case CEPH_MDS_OP_LSSNAP: return "lssnap";
+ case CEPH_MDS_OP_MKSNAP: return "mksnap";
+ case CEPH_MDS_OP_RMSNAP: return "rmsnap";
+ default: return "???";
+ }
+}
+
+#define CEPH_SETATTR_MODE 1
+#define CEPH_SETATTR_UID 2
+#define CEPH_SETATTR_GID 4
+#define CEPH_SETATTR_MTIME 8
+#define CEPH_SETATTR_ATIME 16
+#define CEPH_SETATTR_SIZE 32
+#define CEPH_SETATTR_CTIME 64
+
+union ceph_mds_request_args {
+ struct {
+ __le32 mask; /* CEPH_CAP_* */
+ } __attribute__ ((packed)) getattr;
+ struct {
+ __le32 mode;
+ __le32 uid;
+ __le32 gid;
+ struct ceph_timespec mtime;
+ struct ceph_timespec atime;
+ __le64 size, old_size;
+ __le32 mask; /* CEPH_SETATTR_* */
+ } __attribute__ ((packed)) setattr;
+ struct {
+ __le32 frag;
+ __le32 max_entries;
+ } __attribute__ ((packed)) readdir;
+ struct {
+ __le32 mode;
+ __le32 rdev;
+ } __attribute__ ((packed)) mknod;
+ struct {
+ __le32 mode;
+ } __attribute__ ((packed)) mkdir;
+ struct {
+ __le32 flags;
+ __le32 mode;
+ } __attribute__ ((packed)) open;
+ struct {
+ __le32 flags;
+ } __attribute__ ((packed)) setxattr;
+ struct {
+ struct ceph_file_layout layout;
+ } __attribute__ ((packed)) setlayout;
+} __attribute__ ((packed));
+
+#define CEPH_MDS_FLAG_REPLAY 1 /* this is a replayed op */
+#define CEPH_MDS_FLAG_WANT_DENTRY 2 /* want dentry in reply */
+
+struct ceph_mds_request_head {
+ __le64 tid, oldest_client_tid;
+ __le32 mdsmap_epoch; /* on client */
+ __le32 flags;
+ __u8 num_retry, num_fwd;
+ __le16 num_releases;
+ __le32 op;
+ __le32 caller_uid, caller_gid;
+ __le64 ino; /* use this ino for openc, mkdir, mknod, etc. */
+ union ceph_mds_request_args args;
+} __attribute__ ((packed));
+
+struct ceph_mds_request_release {
+ __le64 ino, cap_id;
+ __le32 caps, wanted;
+ __le32 seq, issue_seq, mseq;
+ __le32 dname_seq;
+ __le32 dname_len; /* if releasing a dentry lease; string follows. */
+} __attribute__ ((packed));
+
+/* client reply */
+struct ceph_mds_reply_head {
+ __le64 tid;
+ __le32 op;
+ __le32 result;
+ __le32 mdsmap_epoch;
+ __u8 safe;
+ __u8 is_dentry, is_target;
+} __attribute__ ((packed));
+
+/* one for each node split */
+struct ceph_frag_tree_split {
+ __le32 frag; /* this frag splits... */
+ __le32 by; /* ...by this many bits */
+} __attribute__ ((packed));
+
+struct ceph_frag_tree_head {
+ __le32 nsplits;
+ struct ceph_frag_tree_split splits[];
+} __attribute__ ((packed));
+
+struct ceph_mds_reply_cap {
+ __le32 caps, wanted;
+ __le64 cap_id;
+ __le32 seq, mseq;
+ __le64 realm;
+ __le32 ttl_ms; /* ttl, in ms. if readonly and unwanted. */
+ __u8 flags;
+} __attribute__ ((packed));
+
+#define CEPH_CAP_FLAG_AUTH 1
+
+struct ceph_mds_reply_inode {
+ __le64 ino;
+ __le64 snapid;
+ __le32 rdev;
+ __le64 version;
+ struct ceph_mds_reply_cap cap;
+ struct ceph_file_layout layout;
+ struct ceph_timespec ctime, mtime, atime;
+ __le32 time_warp_seq;
+ __le64 size, max_size, truncate_size;
+ __le32 truncate_seq;
+ __le32 mode, uid, gid;
+ __le32 nlink;
+ __le64 files, subdirs, rbytes, rfiles, rsubdirs; /* dir stats */
+ struct ceph_timespec rctime;
+ __le64 xattr_version;
+ struct ceph_frag_tree_head fragtree;
+} __attribute__ ((packed));
+/* followed by frag array, then symlink string, then xattr blob */
+
+/* reply_lease follows dname, and reply_inode */
+struct ceph_mds_reply_lease {
+ __le16 mask;
+ __le32 duration_ms;
+ __le32 seq;
+} __attribute__ ((packed));
+
+struct ceph_mds_reply_dirfrag {
+ __le32 frag; /* fragment */
+ __le32 auth; /* auth mds, if this is a delegation point */
+ __le32 ndist; /* number of mds' this is replicated on */
+ __le32 dist[];
+} __attribute__ ((packed));
+
+/* file access modes */
+#define CEPH_FILE_MODE_PIN 0
+#define CEPH_FILE_MODE_RD 1
+#define CEPH_FILE_MODE_WR 2
+#define CEPH_FILE_MODE_RDWR 3 /* RD | WR */
+#define CEPH_FILE_MODE_LAZY 4 /* lazy io */
+#define CEPH_FILE_MODE_NUM 8 /* bc these are bit fields.. mostly */
+
+static inline int ceph_flags_to_mode(int flags)
+{
+#ifdef O_DIRECTORY /* fixme */
+ if ((flags & O_DIRECTORY) == O_DIRECTORY)
+ return CEPH_FILE_MODE_PIN;
+#endif
+#ifdef O_LAZY
+ if (flags & O_LAZY)
+ return CEPH_FILE_MODE_LAZY;
+#endif
+ if ((flags & O_APPEND) == O_APPEND)
+ flags |= O_WRONLY;
+
+ flags &= O_ACCMODE;
+ if ((flags & O_RDWR) == O_RDWR)
+ return CEPH_FILE_MODE_RDWR;
+ if ((flags & O_WRONLY) == O_WRONLY)
+ return CEPH_FILE_MODE_WR;
+ return CEPH_FILE_MODE_RD;
+}
+
+
+/* capability bits */
+#define CEPH_CAP_PIN 1 /* no specific capabilities beyond the pin */
+
+/* generic cap bits */
+#define CEPH_CAP_GSHARED 1 /* client can reads */
+#define CEPH_CAP_GEXCL 2 /* client can read and update */
+#define CEPH_CAP_GCACHE 4 /* (file) client can cache reads */
+#define CEPH_CAP_GRD 8 /* (file) client can read */
+#define CEPH_CAP_GWR 16 /* (file) client can write */
+#define CEPH_CAP_GBUFFER 32 /* (file) client can buffer writes */
+#define CEPH_CAP_GWREXTEND 64 /* (file) client can extend EOF */
+#define CEPH_CAP_GLAZYIO 128 /* (file) client can perform lazy io */
+
+/* per-lock shift */
+#define CEPH_CAP_SAUTH 2
+#define CEPH_CAP_SLINK 4
+#define CEPH_CAP_SXATTR 6
+#define CEPH_CAP_SFILE 8 /* goes at the end (uses >2 cap bits) */
+
+#define CEPH_CAP_BITS 16
+
+/* composed values */
+#define CEPH_CAP_AUTH_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SAUTH)
+#define CEPH_CAP_AUTH_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SAUTH)
+#define CEPH_CAP_LINK_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SLINK)
+#define CEPH_CAP_LINK_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SLINK)
+#define CEPH_CAP_XATTR_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SXATTR)
+#define CEPH_CAP_XATTR_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SXATTR)
+#define CEPH_CAP_FILE(x) (x << CEPH_CAP_SFILE)
+#define CEPH_CAP_FILE_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SFILE)
+#define CEPH_CAP_FILE_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SFILE)
+#define CEPH_CAP_FILE_CACHE (CEPH_CAP_GCACHE << CEPH_CAP_SFILE)
+#define CEPH_CAP_FILE_RD (CEPH_CAP_GRD << CEPH_CAP_SFILE)
+#define CEPH_CAP_FILE_WR (CEPH_CAP_GWR << CEPH_CAP_SFILE)
+#define CEPH_CAP_FILE_BUFFER (CEPH_CAP_GBUFFER << CEPH_CAP_SFILE)
+#define CEPH_CAP_FILE_WREXTEND (CEPH_CAP_GWREXTEND << CEPH_CAP_SFILE)
+#define CEPH_CAP_FILE_LAZYIO (CEPH_CAP_GLAZYIO << CEPH_CAP_SFILE)
+
+/* cap masks (for getattr) */
+#define CEPH_STAT_CAP_INODE CEPH_CAP_PIN
+#define CEPH_STAT_CAP_TYPE CEPH_CAP_PIN /* mode >> 12 */
+#define CEPH_STAT_CAP_SYMLINK CEPH_CAP_PIN
+#define CEPH_STAT_CAP_UID CEPH_CAP_AUTH_SHARED
+#define CEPH_STAT_CAP_GID CEPH_CAP_AUTH_SHARED
+#define CEPH_STAT_CAP_MODE CEPH_CAP_AUTH_SHARED
+#define CEPH_STAT_CAP_NLINK CEPH_CAP_LINK_SHARED
+#define CEPH_STAT_CAP_LAYOUT CEPH_CAP_FILE_SHARED
+#define CEPH_STAT_CAP_MTIME CEPH_CAP_FILE_SHARED
+#define CEPH_STAT_CAP_SIZE CEPH_CAP_FILE_SHARED
+#define CEPH_STAT_CAP_ATIME CEPH_CAP_FILE_SHARED /* fixme */
+#define CEPH_STAT_CAP_XATTR CEPH_CAP_XATTR_SHARED
+#define CEPH_STAT_CAP_INODE_ALL (CEPH_CAP_PIN | \
+ CEPH_CAP_AUTH_SHARED | \
+ CEPH_CAP_LINK_SHARED | \
+ CEPH_CAP_FILE_SHARED | \
+ CEPH_CAP_XATTR_SHARED)
+
+#define CEPH_CAP_ANY_SHARED (CEPH_CAP_AUTH_SHARED | \
+ CEPH_CAP_LINK_SHARED | \
+ CEPH_CAP_XATTR_SHARED | \
+ CEPH_CAP_FILE_SHARED)
+#define CEPH_CAP_ANY_RD (CEPH_CAP_ANY_SHARED | CEPH_CAP_FILE_RD | \
+ CEPH_CAP_FILE_CACHE)
+
+#define CEPH_CAP_ANY_EXCL (CEPH_CAP_AUTH_EXCL | \
+ CEPH_CAP_LINK_EXCL | \
+ CEPH_CAP_XATTR_EXCL | \
+ CEPH_CAP_FILE_EXCL)
+#define CEPH_CAP_ANY_FILE_WR (CEPH_CAP_FILE_WR | CEPH_CAP_FILE_BUFFER | \
+ CEPH_CAP_FILE_EXCL)
+#define CEPH_CAP_ANY_WR (CEPH_CAP_ANY_EXCL | CEPH_CAP_ANY_FILE_WR)
+#define CEPH_CAP_ANY (CEPH_CAP_ANY_RD | CEPH_CAP_ANY_EXCL | \
+ CEPH_CAP_ANY_FILE_WR | CEPH_CAP_PIN)
+
+#define CEPH_CAP_LOCKS (CEPH_LOCK_IFILE | CEPH_LOCK_IAUTH | CEPH_LOCK_ILINK | \
+ CEPH_LOCK_IXATTR)
+
+static inline int ceph_caps_for_mode(int mode)
+{
+ switch (mode) {
+ case CEPH_FILE_MODE_PIN:
+ return CEPH_CAP_PIN;
+ case CEPH_FILE_MODE_RD:
+ return CEPH_CAP_PIN | CEPH_CAP_FILE_SHARED |
+ CEPH_CAP_FILE_RD | CEPH_CAP_FILE_CACHE;
+ case CEPH_FILE_MODE_RDWR:
+ return CEPH_CAP_PIN | CEPH_CAP_FILE_SHARED |
+ CEPH_CAP_FILE_EXCL |
+ CEPH_CAP_FILE_RD | CEPH_CAP_FILE_CACHE |
+ CEPH_CAP_FILE_WR | CEPH_CAP_FILE_BUFFER |
+ CEPH_CAP_AUTH_SHARED | CEPH_CAP_AUTH_EXCL |
+ CEPH_CAP_XATTR_SHARED | CEPH_CAP_XATTR_EXCL;
+ case CEPH_FILE_MODE_WR:
+ return CEPH_CAP_PIN | CEPH_CAP_FILE_SHARED |
+ CEPH_CAP_FILE_EXCL |
+ CEPH_CAP_FILE_WR | CEPH_CAP_FILE_BUFFER |
+ CEPH_CAP_AUTH_SHARED | CEPH_CAP_AUTH_EXCL |
+ CEPH_CAP_XATTR_SHARED | CEPH_CAP_XATTR_EXCL;
+ }
+ return 0;
+}
+
+enum {
+ CEPH_CAP_OP_GRANT, /* mds->client grant */
+ CEPH_CAP_OP_REVOKE, /* mds->client revoke */
+ CEPH_CAP_OP_TRUNC, /* mds->client trunc notify */
+ CEPH_CAP_OP_EXPORT, /* mds has exported the cap */
+ CEPH_CAP_OP_IMPORT, /* mds has imported the cap from specified mds */
+ CEPH_CAP_OP_UPDATE, /* client->mds update */
+ CEPH_CAP_OP_DROP, /* client->mds drop cap bits */
+ CEPH_CAP_OP_FLUSH, /* client->mds cap writeback */
+ CEPH_CAP_OP_FLUSH_ACK, /* mds->client flushed */
+ CEPH_CAP_OP_FLUSHSNAP, /* client->mds flush snapped metadata */
+ CEPH_CAP_OP_FLUSHSNAP_ACK, /* mds->client flushed snapped metadata */
+ CEPH_CAP_OP_RELEASE, /* client->mds release (clean) cap */
+ CEPH_CAP_OP_RENEW, /* client->mds renewal request */
+};
+
+static inline const char *ceph_cap_op_name(int op)
+{
+ switch (op) {
+ case CEPH_CAP_OP_GRANT: return "grant";
+ case CEPH_CAP_OP_REVOKE: return "revoke";
+ case CEPH_CAP_OP_TRUNC: return "trunc";
+ case CEPH_CAP_OP_EXPORT: return "export";
+ case CEPH_CAP_OP_IMPORT: return "import";
+ case CEPH_CAP_OP_UPDATE: return "update";
+ case CEPH_CAP_OP_DROP: return "drop";
+ case CEPH_CAP_OP_FLUSH: return "flush";
+ case CEPH_CAP_OP_FLUSH_ACK: return "flush_ack";
+ case CEPH_CAP_OP_FLUSHSNAP: return "flushsnap";
+ case CEPH_CAP_OP_FLUSHSNAP_ACK: return "flushsnap_ack";
+ case CEPH_CAP_OP_RELEASE: return "release";
+ case CEPH_CAP_OP_RENEW: return "renew";
+ default: return "???";
+ }
+}
+
+/*
+ * caps message, used for capability callbacks, acks, requests, etc.
+ */
+struct ceph_mds_caps {
+ __le32 op;
+ __le64 ino, realm;
+ __le64 cap_id;
+ __le32 seq, issue_seq;
+ __le32 caps, wanted, dirty;
+ __le32 migrate_seq;
+ __le64 snap_follows;
+ __le32 snap_trace_len;
+ __le32 ttl_ms; /* for IMPORT op only */
+ __le64 client_tid; /* for FLUSH(SNAP) -> FLUSH(SNAP)_ACK */
+
+ /* authlock */
+ __le32 uid, gid, mode;
+
+ /* linklock */
+ __le32 nlink;
+
+ /* xattrlock */
+ __le32 xattr_len;
+ __le64 xattr_version;
+
+ /* filelock */
+ __le64 size, max_size, truncate_size;
+ __le32 truncate_seq;
+ struct ceph_timespec mtime, atime, ctime;
+ struct ceph_file_layout layout;
+ __le32 time_warp_seq;
+} __attribute__ ((packed));
+
+struct ceph_mds_cap_release {
+ __le32 num;
+} __attribute__ ((packed));
+
+struct ceph_mds_cap_item {
+ __le64 ino;
+ __le64 cap_id;
+ __le32 migrate_seq, seq;
+} __attribute__ ((packed));
+
+#define CEPH_MDS_LEASE_REVOKE 1 /* mds -> client */
+#define CEPH_MDS_LEASE_RELEASE 2 /* client -> mds */
+#define CEPH_MDS_LEASE_RENEW 3 /* client <-> mds */
+#define CEPH_MDS_LEASE_REVOKE_ACK 4 /* client -> mds */
+
+static inline const char *ceph_lease_op_name(int o)
+{
+ switch (o) {
+ case CEPH_MDS_LEASE_REVOKE: return "revoke";
+ case CEPH_MDS_LEASE_RELEASE: return "release";
+ case CEPH_MDS_LEASE_RENEW: return "renew";
+ case CEPH_MDS_LEASE_REVOKE_ACK: return "revoke_ack";
+ default: return "???";
+ }
+}
+
+struct ceph_mds_lease {
+ __u8 action;
+ __le16 mask;
+ __le64 ino;
+ __le64 first, last;
+ __le32 seq;
+ __le32 duration_ms; /* duration of renewal */
+} __attribute__ ((packed));
+/* followed by a __le32+string for dname */
+
+
+/* client reconnect */
+struct ceph_mds_cap_reconnect {
+ __le64 cap_id;
+ __le32 wanted;
+ __le32 issued;
+ __le64 size;
+ struct ceph_timespec mtime, atime;
+ __le64 snaprealm;
+ __le64 pathbase;
+} __attribute__ ((packed));
+/* followed by encoded string */
+
+struct ceph_mds_snaprealm_reconnect {
+ __le64 ino;
+ __le64 seq;
+ __le64 parent; /* parent realm */
+} __attribute__ ((packed));
+
+/*
+ * snaps
+ */
+enum {
+ CEPH_SNAP_OP_UPDATE, /* CREATE or DESTROY */
+ CEPH_SNAP_OP_CREATE,
+ CEPH_SNAP_OP_DESTROY,
+ CEPH_SNAP_OP_SPLIT,
+};
+
+static inline const char *ceph_snap_op_name(int o)
+{
+ switch (o) {
+ case CEPH_SNAP_OP_UPDATE: return "update";
+ case CEPH_SNAP_OP_CREATE: return "create";
+ case CEPH_SNAP_OP_DESTROY: return "destroy";
+ case CEPH_SNAP_OP_SPLIT: return "split";
+ default: return "???";
+ }
+}
+
+struct ceph_mds_snap_head {
+ __le32 op;
+ __le64 split;
+ __le32 num_split_inos;
+ __le32 num_split_realms;
+ __le32 trace_len;
+} __attribute__ ((packed));
+/* followed by split ino list, then split realms, then the trace blob */
+
+/*
+ * encode info about a snaprealm, as viewed by a client
+ */
+struct ceph_mds_snap_realm {
+ __le64 ino; /* ino */
+ __le64 created; /* snap: when created */
+ __le64 parent; /* ino: parent realm */
+ __le64 parent_since; /* snap: same parent since */
+ __le64 seq; /* snap: version */
+ __le32 num_snaps;
+ __le32 num_prior_parent_snaps;
+} __attribute__ ((packed));
+/* followed by my snap list, then prior parent snap list */
+
+#endif
diff --git a/wireshark/ceph/crc32c.h b/wireshark/ceph/crc32c.h
new file mode 100644
index 00000000000..6c66e49c2ad
--- /dev/null
+++ b/wireshark/ceph/crc32c.h
@@ -0,0 +1,14 @@
+#ifndef __CEPH_CRC32C
+#define __CEPH_CRC32C
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+uint32_t crc32c_le(uint32_t crc, unsigned char const *data, unsigned length);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/wireshark/ceph/moduleinfo.h b/wireshark/ceph/moduleinfo.h
new file mode 100644
index 00000000000..1218fcf6fec
--- /dev/null
+++ b/wireshark/ceph/moduleinfo.h
@@ -0,0 +1,16 @@
+/* Included *after* config.h, in order to re-define these macros */
+
+#ifdef PACKAGE
+#undef PACKAGE
+#endif
+
+/* Name of package */
+#define PACKAGE "ceph"
+
+
+#ifdef VERSION
+#undef VERSION
+#endif
+
+/* Version number of package */
+#define VERSION "0.0.1"
diff --git a/wireshark/ceph/moduleinfo.nmake b/wireshark/ceph/moduleinfo.nmake
new file mode 100644
index 00000000000..ff67c25b40b
--- /dev/null
+++ b/wireshark/ceph/moduleinfo.nmake
@@ -0,0 +1,28 @@
+#
+# $Id: moduleinfo.nmake 20158 2006-12-19 22:23:37Z jake $
+#
+
+# The name
+PACKAGE=ceph
+
+# The version
+MODULE_VERSION_MAJOR=0
+MODULE_VERSION_MINOR=0
+MODULE_VERSION_MICRO=1
+MODULE_VERSION_EXTRA=0
+
+#
+# The RC_VERSION should be comma-separated, not dot-separated,
+# as per Graham Bloice's message in
+#
+# http://www.ethereal.com/lists/ethereal-dev/200303/msg00283.html
+#
+# "The RC_VERSION variable in config.nmake should be comma separated.
+# This allows the resources to be built correctly and the version
+# number to be correctly displayed in the explorer properties dialog
+# for the executables, and XP's tooltip, rather than 0.0.0.0."
+#
+
+MODULE_VERSION=$(MODULE_VERSION_MAJOR).$(MODULE_VERSION_MINOR).$(MODULE_VERSION_MICRO).$(MODULE_VERSION_EXTRA)
+RC_MODULE_VERSION=$(MODULE_VERSION_MAJOR),$(MODULE_VERSION_MINOR),$(MODULE_VERSION_MICRO),$(MODULE_VERSION_EXTRA)
+
diff --git a/wireshark/ceph/msgr.h b/wireshark/ceph/msgr.h
new file mode 100644
index 00000000000..52d2555743f
--- /dev/null
+++ b/wireshark/ceph/msgr.h
@@ -0,0 +1,156 @@
+#ifndef __MSGR_H
+#define __MSGR_H
+
+/*
+ * Data types for message passing layer used by Ceph.
+ */
+
+#define CEPH_MON_PORT 6789 /* default monitor port */
+
+/*
+ * client-side processes will try to bind to ports in this
+ * range, simply for the benefit of tools like nmap or wireshark
+ * that would like to identify the protocol.
+ */
+#define CEPH_PORT_FIRST 6789
+#define CEPH_PORT_START 6800 /* non-monitors start here */
+#define CEPH_PORT_LAST 6900
+
+/*
+ * tcp connection banner. include a protocol version. and adjust
+ * whenever the wire protocol changes. try to keep this string length
+ * constant.
+ */
+#define CEPH_BANNER "ceph 014\n"
+#define CEPH_BANNER_MAX_LEN 30
+
+
+/*
+ * Rollover-safe type and comparator for 32-bit sequence numbers.
+ * Comparator returns -1, 0, or 1.
+ */
+typedef __u32 ceph_seq_t;
+
+static inline __s32 ceph_seq_cmp(__u32 a, __u32 b)
+{
+ return (__s32)a - (__s32)b;
+}
+
+
+/*
+ * entity_name -- logical name for a process participating in the
+ * network, e.g. 'mds0' or 'osd3'.
+ */
+struct ceph_entity_name {
+ __le32 type;
+ __le32 num;
+} __attribute__ ((packed));
+
+#define CEPH_ENTITY_TYPE_MON 1
+#define CEPH_ENTITY_TYPE_MDS 2
+#define CEPH_ENTITY_TYPE_OSD 3
+#define CEPH_ENTITY_TYPE_CLIENT 4
+#define CEPH_ENTITY_TYPE_ADMIN 5
+
+/*
+ * entity_addr -- network address
+ */
+struct ceph_entity_addr {
+ __le32 erank; /* entity's rank in process */
+ __le32 nonce; /* unique id for process (e.g. pid) */
+ struct sockaddr_in ipaddr;
+} __attribute__ ((packed));
+
+static inline bool ceph_entity_addr_is_local(const struct ceph_entity_addr *a,
+ const struct ceph_entity_addr *b)
+{
+ return a->nonce == b->nonce &&
+ a->ipaddr.sin_addr.s_addr == b->ipaddr.sin_addr.s_addr;
+}
+
+static inline bool ceph_entity_addr_equal(const struct ceph_entity_addr *a,
+ const struct ceph_entity_addr *b)
+{
+ return memcmp(a, b, sizeof(*a)) == 0;
+}
+
+struct ceph_entity_inst {
+ struct ceph_entity_name name;
+ struct ceph_entity_addr addr;
+} __attribute__ ((packed));
+
+
+/* used by message exchange protocol */
+#define CEPH_MSGR_TAG_READY 1 /* server->client: ready for messages */
+#define CEPH_MSGR_TAG_RESETSESSION 2 /* server->client: reset, try again */
+#define CEPH_MSGR_TAG_WAIT 3 /* server->client: wait for racing
+ incoming connection */
+#define CEPH_MSGR_TAG_RETRY_SESSION 4 /* server->client + cseq: try again
+ with higher cseq */
+#define CEPH_MSGR_TAG_RETRY_GLOBAL 5 /* server->client + gseq: try again
+ with higher gseq */
+#define CEPH_MSGR_TAG_CLOSE 6 /* closing pipe */
+#define CEPH_MSGR_TAG_MSG 10 /* message */
+#define CEPH_MSGR_TAG_ACK 11 /* message ack */
+
+
+/*
+ * connection negotiation
+ */
+struct ceph_msg_connect {
+ __le32 host_type; /* CEPH_ENTITY_TYPE_* */
+ __le32 global_seq;
+ __le32 connect_seq;
+ __u8 flags;
+} __attribute__ ((packed));
+
+struct ceph_msg_connect_reply {
+ __u8 tag;
+ __le32 global_seq;
+ __le32 connect_seq;
+ __u8 flags;
+} __attribute__ ((packed));
+
+#define CEPH_MSG_CONNECT_LOSSY 1 /* messages i send may be safely dropped */
+
+
+/*
+ * message header
+ */
+struct ceph_msg_header {
+ __le64 seq; /* message seq# for this session */
+ __le16 type; /* message type */
+ __le16 priority; /* priority. higher value == higher priority */
+
+ __le32 front_len; /* bytes in main payload */
+ __le32 middle_len;/* bytes in middle payload */
+ __le32 data_len; /* bytes of data payload */
+ __le16 data_off; /* sender: include full offset;
+ receiver: mask against ~PAGE_MASK */
+
+ __u8 mon_protocol, monc_protocol; /* protocol versions, */
+ __u8 osd_protocol, osdc_protocol; /* internal and public */
+ __u8 mds_protocol, mdsc_protocol;
+
+ struct ceph_entity_inst src, orig_src, dst;
+ __le32 crc; /* header crc32c */
+} __attribute__ ((packed));
+
+#define CEPH_MSG_PRIO_LOW 64
+#define CEPH_MSG_PRIO_DEFAULT 127
+#define CEPH_MSG_PRIO_HIGH 196
+#define CEPH_MSG_PRIO_HIGHEST 255
+
+/*
+ * follows data payload
+ */
+struct ceph_msg_footer {
+ __le32 flags;
+ __le32 front_crc, middle_crc, data_crc;
+} __attribute__ ((packed));
+
+#define CEPH_MSG_FOOTER_ABORTED (1<<0) /* drop this message */
+#define CEPH_MSG_FOOTER_NOCRC (1<<1) /* no data crc */
+
+
+#endif
diff --git a/wireshark/ceph/packet-ceph.c b/wireshark/ceph/packet-ceph.c
new file mode 100644
index 00000000000..0b2f688185f
--- /dev/null
+++ b/wireshark/ceph/packet-ceph.c
@@ -0,0 +1,1162 @@
+/* packet-ceph.c
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdio.h>
+#include <glib.h>
+#include <epan/packet.h>
+#include <epan/dissectors/packet-tcp.h>
+
+// this is needed for ceph_fs to compile in userland
+#ifdef _MSC_VER
+typedef char __s8;
+typedef short __s16;
+typedef int __s32;
+typedef __int64 __s64;
+typedef unsigned char __u8;
+typedef unsigned short __u16;
+typedef unsigned int __u32;
+typedef unsigned __int64 __u64;
+typedef __u16 __le16;
+typedef __u32 __le32;
+typedef __u64 __le64;
+#define __attribute__(x)
+#define O_ACCMODE (O_RDONLY | O_RDWR | O_WRONLY)
+#include <winsock.h>
+#else
+#include <netinet/in.h>
+#include <linux/types.h>
+#endif
+typedef int bool;
+
+#define le16_to_cpu(x) (x)
+#define le32_to_cpu(x) (x)
+#define le64_to_cpu(x) (x)
+
+typedef guint32 uint32_t;
+
+#include <fcntl.h>
+#include <string.h>
+
+#ifdef _MSC_VER
+#pragma pack(1)
+#endif
+#include "ceph_fs.h"
+#ifdef _MSC_VER
+#pragma pack()
+#endif
+
+#include "crc32c.h"
+
+
+
+#include <string.h>
+
+#define PROTO_TAG_CEPH "CEPH"
+
+/* Wireshark ID of the CEPH protocol */
+static int proto_ceph = -1;
+
+
+
+/* These are the handles of our subdissectors */
+static dissector_handle_t data_handle=NULL;
+
+static dissector_handle_t ceph_handle;
+static void dissect_ceph(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+
+static guint32 global_ceph_min_port = 6789;
+static guint32 global_ceph_max_port = 6810;
+
+static guint32 global_ceph_min_mon_port = 6789;
+static guint32 global_ceph_max_mon_port = 6799;
+
+#define DEST_PORT_CEPH ((pinfo->destport >= global_ceph_min_port) && (pinfo->destport <= global_ceph_max_port))
+
+#define PORT_IS_MON(port) ((port >= global_ceph_min_mon_port) && (port <= global_ceph_max_mon_port))
+#define PORT_IS_MDS(port) ((port >= global_ceph_min_mds_port) && (port <= global_ceph_max_mds_port))
+#define PORT_IS_OSD(port) ((port >= global_ceph_min_osd_port) && (port <= global_ceph_max_osd_port))
+
+#define IS_ENTITY(cmp, port1, port2) (cmp(port1) || cmp(port2))
+
+#define IS_MON(pinfo) IS_ENTITY(PORT_IS_MON, pinfo->srcport, pinfo->destport)
+#define IS_MDS(pinfo) IS_ENTITY(PORT_IS_MDS, pinfo->srcport, pinfo->destport)
+#define IS_OSD(pinfo) IS_ENTITY(PORT_IS_OSD, pinfo->srcport, pinfo->destport)
+
+#define MON_STR "mon"
+#define MDS_STR "mds"
+#define OSD_STR "osd"
+
+#define FMT_INO "0x%.16llx"
+
+#define PROTO_ADD_TEXT(type, s, field, modifier)\
+ proto_tree_add_text(tree, tvb, offset + offsetof(type, field), sizeof(s->field), "" #field ": " modifier, s->field);
+
+#define PROTO_ADD_ITEM(tree, type, hf, s, field) \
+ proto_tree_add_item(tree, hf, tvb, offset + offsetof(type, field), sizeof(s->field), TRUE);
+
+#define CTIME_BUF_LEN 128
+
+#define PROTO_ADD_TIME(tvb, tree, type, offset, head, field, name) \
+ do { \
+ time_t time; \
+ time = head->field.tv_sec; \
+ proto_tree_add_text(tree, tvb, offset + offsetof(type, field), \
+ sizeof(head->field), "" #name ": %s (%d ns)", ctime(&time), head->field.tv_nsec); \
+ } while (0)
+
+static const value_string packettypenames[] = {
+ { 1, "Shutdown" },
+ { 2, "Ping" },
+ { 4, "Mon Map" },
+ { 5, "Mon Get Map" },
+ { 10, "Client Mount" },
+ { 11, "Client Mount Ack" },
+ { 12, "Client Unmount" },
+ { 13, "Statfs" },
+ { 20, "MDS Get Map" },
+ { 21, "MDS Map" },
+ { 22, "Client Session" },
+ { 23, "Client Reconnect" },
+ { 24, "Client Request" },
+ { 25, "Client Request Forward" },
+ { 26, "Client Reply" },
+ { 0x310, "Client Caps" },
+ { 0x311, "Client Lease" },
+ { 0x312, "Client Snap" },
+ { 40, "OSD Get Map" },
+ { 41, "OSD Map" },
+ { 42, "OSD Op" },
+ { 43, "OSD Op Reply" },
+ { 0, NULL }
+};
+
+#define ACK_MSG_SIZE 5
+#define TVB_MSG_HEADER_POS(x) (1 + offsetof(struct ceph_msg_header, x))
+#define TVB_IS_ACK(ofs) (tvb_get_guint8(tvb, ofs) == CEPH_MSGR_TAG_ACK)
+#define TVB_MSG_FIELD(func, tvb, ofs, field) func(tvb, ofs + (TVB_IS_ACK(ofs) ? ACK_MSG_SIZE : 0) + TVB_MSG_HEADER_POS(field))
+
+/* The following hf_* variables are used to hold the Wireshark IDs of
+* our header fields; they are filled out when we call
+* proto_register_field_array() in proto_register_ceph()
+*/
+/** Kts attempt at defining the protocol */
+static gint hf_ceph = -1;
+static gint hf_ceph_mds_op = -1;
+static gint hf_ceph_header = -1;
+static gint hf_ceph_banner = -1;
+static gint hf_ceph_entity_addr = -1;
+static gint hf_ceph_entity_type = -1;
+static gint hf_ceph_entity_num = -1;
+static gint hf_ceph_fsid = -1;
+static gint hf_ceph_banner_magic = -1;
+static gint hf_ceph_banner_version = -1;
+static gint hf_ceph_connect_erank = -1;
+static gint hf_ceph_connect_nonce = -1;
+static gint hf_ceph_sockaddr_in = -1;
+static gint hf_ceph_connect_host_type = -1;
+static gint hf_ceph_connect_tag = -1;
+static gint hf_ceph_connect_global_seq = -1;
+static gint hf_ceph_connect_connect_seq = -1;
+static gint hf_ceph_connect_flags = -1;
+static gint hf_ceph_length = -1;
+static gint hf_ceph_type = -1;
+static gint hf_ceph_text = -1;
+static gint hf_ceph_path = -1;
+static gint hf_sin_family = -1;
+static gint hf_sin_port = -1;
+static gint hf_sin_addr = -1;
+static gint hf_ceph_hdr_tag = -1;
+static gint hf_ceph_hdr_seq_ack = -1;
+static gint hf_ceph_hdr_seq = -1;
+static gint hf_ceph_hdr_type = -1;
+static gint hf_ceph_hdr_priority = -1;
+static gint hf_ceph_hdr_mon_protocol = -1;
+static gint hf_ceph_hdr_osd_protocol = -1;
+static gint hf_ceph_hdr_mds_protocol = -1;
+static gint hf_ceph_hdr_client_protocol = -1;
+static gint hf_ceph_hdr_front_len = -1;
+static gint hf_ceph_hdr_middle_len = -1;
+static gint hf_ceph_hdr_data_off = -1;
+static gint hf_ceph_hdr_data_len = -1;
+static gint hf_ceph_data = -1;
+static gint hf_ceph_front = -1;
+static gint hf_ceph_hdr_src = -1;
+static gint hf_ceph_hdr_orig_src = -1;
+static gint hf_ceph_hdr_dst = -1;
+static gint hf_ceph_hdr_crc = -1;
+static gint hf_ceph_footer = -1;
+static gint hf_ceph_footer_flags = -1;
+static gint hf_ceph_footer_front_crc = -1;
+static gint hf_ceph_footer_middle_crc = -1;
+static gint hf_ceph_footer_data_crc = -1;
+
+
+/* These are the ids of the subtrees that we may be creating */
+static gint ett_ceph = -1;
+static gint ett_ceph_header = -1;
+static gint ett_ceph_banner = -1;
+static gint ett_ceph_entity_addr = -1;
+static gint ett_ceph_length = -1;
+static gint ett_ceph_type = -1;
+static gint ett_ceph_text = -1;
+static gint ett_ceph_front = -1;
+static gint ett_ceph_data = -1;
+static gint ett_ceph_footer = -1;
+
+
+void proto_reg_handoff_ceph(void)
+{
+ static gboolean initialized=FALSE;
+ static guint32 port;
+
+ if (!initialized) {
+ data_handle = find_dissector("data");
+ ceph_handle = create_dissector_handle(dissect_ceph, proto_ceph);
+ for (port = global_ceph_min_port; port <= global_ceph_max_port; port++)
+ dissector_add("tcp.port", port, ceph_handle);
+ }
+
+}
+
+void proto_register_ceph (void)
+{
+ /* A header field is something you can search/filter on.
+ *
+ * We create a structure to register our fields. It consists of an
+ * array of hf_register_info structures, each of which are of the format
+ * {&(field id), {name, abbrev, type, display, strings, bitmask, blurb, HFILL}}.
+ */
+ static hf_register_info hf[] = {
+ { &hf_ceph,
+ { "Data", "ceph.data", FT_NONE, BASE_NONE, NULL, 0x0,
+ "CEPH PDU", HFILL }},
+ { &hf_ceph_header,
+ { "Header", "ceph.header", FT_NONE, BASE_NONE, NULL, 0x0,
+ "CEPH Header", HFILL }},
+ { &hf_ceph_banner,
+ { "Ceph Banner", "ceph.connect.banner", FT_STRING, BASE_NONE, NULL, 0x0,
+ "Ceph Banner", HFILL }},
+ { &hf_ceph_entity_type,
+ { "Ceph Entity Type", "ceph.entity.type", FT_UINT32, BASE_DEC, NULL, 0x0,
+ "Ceph Entity Type", HFILL }},
+ { &hf_ceph_entity_num,
+ { "Ceph Entity Num", "ceph.entity.num", FT_UINT32, BASE_DEC, NULL, 0x0,
+ "Ceph Entity Num", HFILL }},
+ { &hf_ceph_entity_addr,
+ { "Ceph Entity Addr", "ceph.entity.addr", FT_NONE, BASE_NONE, NULL, 0x0,
+ "Ceph Entity Addr", HFILL }},
+ { &hf_ceph_fsid,
+ { "Ceph FSID", "ceph.fsid", FT_NONE, BASE_NONE, NULL, 0x0,
+ "Ceph FSID", HFILL }},
+ { &hf_ceph_banner_magic,
+ { "Ceph Banner Magic", "ceph.connect.banner.magic", FT_STRING, BASE_NONE, NULL, 0x0,
+ "Ceph Banner Magic", HFILL }},
+ { &hf_ceph_banner_version,
+ { "Ceph Banner Version", "ceph.connect.banner.ver", FT_STRING, BASE_NONE, NULL, 0x0,
+ "Ceph Banner", HFILL }},
+ { &hf_ceph_connect_erank,
+ { "erank", "ceph.connect.erank", FT_UINT32, BASE_HEX, NULL, 0x0,
+ "connect: erank", HFILL }},
+ { &hf_ceph_connect_nonce,
+ { "nonce", "ceph.connect.nonce", FT_UINT32, BASE_HEX, NULL, 0x0,
+ "connect: nonce", HFILL }},
+ { &hf_ceph_sockaddr_in,
+ { "sockaddr_in", "ceph.sockaddr_in", FT_NONE, BASE_NONE, NULL, 0x0,
+ "sockaddr_in", HFILL }},
+ { &hf_sin_family,
+ { "sin_family", "ceph.sin_family", FT_UINT16, BASE_HEX, NULL, 0x0,
+ "sockaddr_in: sin_family", HFILL }},
+ { &hf_sin_port,
+ { "sin_port", "ceph.sin_port", FT_UINT16, BASE_DEC, NULL, 0x0,
+ "sockaddr_in: sin_port", HFILL }},
+ { &hf_sin_addr,
+ { "ip addr", "ceph.addr", FT_IPv4, BASE_NONE, NULL, 0x0,
+ "sockaddr_in: ip addr", HFILL }},
+ { &hf_ceph_connect_host_type,
+ { "host_type", "ceph.connect.host_type", FT_UINT32, BASE_DEC, NULL, 0x0,
+ "connect: host_type", HFILL }},
+ { &hf_ceph_connect_tag,
+ { "tag", "ceph.connect.tag", FT_UINT8, BASE_DEC, NULL, 0x0,
+ "connect: tag", HFILL }},
+ { &hf_ceph_mds_op,
+ { "mds op", "ceph.mds.op", FT_UINT32, BASE_HEX, NULL, 0x0,
+ "ceph: mds op", HFILL }},
+ { &hf_ceph_connect_global_seq,
+ { "global_seq", "ceph.connect.global_seq", FT_UINT32, BASE_DEC, NULL, 0x0,
+ "connect: global_seq", HFILL }},
+ { &hf_ceph_connect_connect_seq,
+ { "connect_seq", "ceph.connect.connect_seq", FT_UINT32, BASE_DEC, NULL, 0x0,
+ "connect: connect_seq", HFILL }},
+ { &hf_ceph_connect_flags,
+ { "flags", "ceph.connect.flags", FT_UINT8, BASE_HEX, NULL, 0x0,
+ "connect: flags", HFILL }},
+ { &hf_ceph_length,
+ { "Package Length", "ceph.len", FT_UINT32, BASE_DEC, NULL, 0x0,
+ "Package Length", HFILL }},
+ { &hf_ceph_type,
+ { "Type", "ceph.type", FT_UINT8, BASE_DEC, VALS(packettypenames), 0x0,
+ "Package Type", HFILL }},
+ { &hf_ceph_text,
+ { "Text", "ceph.text", FT_STRING, BASE_NONE, NULL, 0x0,
+ "Text", HFILL }},
+ { &hf_ceph_path,
+ { "path", "ceph.path", FT_STRING, BASE_NONE, NULL, 0x0,
+ "path", HFILL }},
+ { &hf_ceph_hdr_tag,
+ { "tag", "ceph.tag", FT_UINT8, BASE_DEC, NULL, 0x0,
+ "hdr: tag", HFILL }},
+ { &hf_ceph_hdr_seq_ack,
+ { "ack seq", "ceph.ack.seq", FT_UINT32, BASE_DEC, NULL, 0x0,
+ "ack: seq", HFILL }},
+ { &hf_ceph_hdr_seq,
+ { "seq", "ceph.seq", FT_UINT64, BASE_DEC, NULL, 0x0,
+ "hdr: seq", HFILL }},
+ { &hf_ceph_hdr_type,
+ { "type", "ceph.type", FT_UINT16, BASE_HEX, NULL, 0x0,
+ "hdr: type", HFILL }},
+ { &hf_ceph_hdr_priority,
+ { "priority", "ceph.priority", FT_UINT16, BASE_DEC, NULL, 0x0,
+ "hdr: priority", HFILL }},
+ { &hf_ceph_hdr_mon_protocol,
+ { "mon_protocol", "ceph.mon_protocol", FT_UINT16, BASE_DEC, NULL, 0x0,
+ "hdr: mon_protocol", HFILL }},
+ { &hf_ceph_hdr_osd_protocol,
+ { "osd_protocol", "ceph.osd_protocol", FT_UINT16, BASE_DEC, NULL, 0x0,
+ "hdr: osd_protocol", HFILL }},
+ { &hf_ceph_hdr_mds_protocol,
+ { "mds_protocol", "ceph.mds_protocol", FT_UINT16, BASE_DEC, NULL, 0x0,
+ "hdr: mds_protocol", HFILL }},
+ { &hf_ceph_hdr_client_protocol,
+ { "client_protocol", "ceph.client_protocol", FT_UINT16, BASE_DEC, NULL, 0x0,
+ "hdr: client_protocol", HFILL }},
+ { &hf_ceph_hdr_front_len,
+ { "front_len", "ceph.front_len", FT_UINT32, BASE_DEC, NULL, 0x0,
+ "hdr: front_len", HFILL }},
+ { &hf_ceph_hdr_middle_len,
+ { "middle_len", "ceph.middle_len", FT_UINT32, BASE_DEC, NULL, 0x0,
+ "hdr: middle_len", HFILL }},
+ { &hf_ceph_hdr_data_off,
+ { "data_off", "ceph.data_off", FT_UINT32, BASE_DEC, NULL, 0x0,
+ "hdr: data_off", HFILL }},
+ { &hf_ceph_hdr_data_len,
+ { "data_len", "ceph.data_len", FT_UINT32, BASE_DEC, NULL, 0x0,
+ "hdr: data_len", HFILL }},
+ { &hf_ceph_hdr_src,
+ { "src", "ceph.src", FT_NONE, BASE_NONE, NULL, 0x0,
+ "hdr: src", HFILL }},
+ { &hf_ceph_hdr_orig_src,
+ { "orig_src", "ceph.orig_src", FT_NONE, BASE_NONE, NULL, 0x0,
+ "hdr: orig_src", HFILL }},
+ { &hf_ceph_hdr_dst,
+ { "dst", "ceph.dst", FT_NONE, BASE_NONE, NULL, 0x0,
+ "hdr: dst", HFILL }},
+ { &hf_ceph_hdr_crc,
+ { "crc", "ceph.crc", FT_UINT32, BASE_HEX, NULL, 0x0,
+ "hdr: crc", HFILL }},
+ { &hf_ceph_front,
+ { "Front", "ceph.front", FT_NONE, BASE_NONE, NULL, 0x0,
+ "Ceph Front", HFILL }},
+ { &hf_ceph_data,
+ { "Data", "ceph.data", FT_NONE, BASE_HEX, NULL, 0x0,
+ "Ceph Data", HFILL }},
+ { &hf_ceph_footer,
+ { "Footer", "ceph.footer", FT_NONE, BASE_HEX, NULL, 0x0,
+ "Ceph Footer", HFILL }},
+ { &hf_ceph_footer_flags,
+ { "flags", "ceph.footer.flags", FT_UINT32, BASE_HEX, NULL, 0x0,
+ "footer: flags", HFILL }},
+ { &hf_ceph_footer_front_crc,
+ { "front_crc", "ceph.footer.front_crc", FT_UINT32, BASE_HEX, NULL, 0x0,
+ "footer: front_crc", HFILL }},
+ { &hf_ceph_footer_middle_crc,
+ { "middle_crc", "ceph.footer.middle_crc", FT_UINT32, BASE_HEX, NULL, 0x0,
+ "footer: middle_crc", HFILL }},
+ { &hf_ceph_footer_data_crc,
+ { "data_crc", "ceph.footer.data_crc", FT_UINT32, BASE_HEX, NULL, 0x0,
+ "footer: data_crc", HFILL }},
+ };
+ static gint *ett[] = {
+ &ett_ceph,
+ &ett_ceph_header,
+ &ett_ceph_banner,
+ &ett_ceph_length,
+ &ett_ceph_entity_addr,
+ &ett_ceph_type,
+ &ett_ceph_text,
+ &ett_ceph_data,
+ &ett_ceph_front,
+ &ett_ceph_footer
+ };
+ //if (proto_ceph == -1) { /* execute protocol initialization only once */
+ proto_ceph = proto_register_protocol ("CEPH Protocol", "CEPH", "ceph");
+
+ proto_register_field_array (proto_ceph, hf, array_length (hf));
+ proto_register_subtree_array (ett, array_length (ett));
+ register_dissector("ceph", dissect_ceph, proto_ceph);
+ //}
+}
+
+static guint32 dissect_sockaddr_in(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
+{
+ proto_tree *ceph_sockaddr_tree = NULL;
+ proto_item *ceph_sub_item = NULL;
+ proto_item *ceph_item = proto_tree_get_parent(tree);
+
+ ceph_sockaddr_tree = proto_item_add_subtree(ceph_item, ett_ceph);
+
+ ceph_sub_item = proto_tree_add_item( tree, hf_ceph_sockaddr_in, tvb, offset, 16, TRUE );
+ ceph_sockaddr_tree = proto_item_add_subtree(ceph_sub_item, ett_ceph);
+
+ proto_tree_add_item(ceph_sockaddr_tree, hf_sin_family, tvb, offset, 2, TRUE);
+ proto_tree_add_item(ceph_sockaddr_tree, hf_sin_port, tvb, offset+2, 2, TRUE);
+ proto_tree_add_item(ceph_sockaddr_tree, hf_sin_addr, tvb, offset+4, 4, FALSE);
+ offset += 16;
+ return offset;
+}
+
+static guint32 dissect_ceph_banner(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
+{
+ proto_tree *ceph_banner_tree = NULL;
+ proto_item *ceph_sub_item = NULL;
+
+ ceph_sub_item = proto_tree_add_item( tree, hf_ceph_banner, tvb, offset, 8, TRUE );
+ ceph_banner_tree = proto_item_add_subtree(ceph_sub_item, ett_ceph);
+
+ proto_tree_add_item(ceph_banner_tree, hf_ceph_banner_magic, tvb, offset, 4, TRUE);
+ proto_tree_add_item(ceph_banner_tree, hf_ceph_banner_version, tvb, offset+4, 4, TRUE);
+
+ return offset+9;
+}
+
+static guint32 dissect_ceph_entity_addr(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
+{
+ proto_tree *ceph_entity_tree = NULL;
+ proto_item *ceph_sub_item = NULL;
+
+ ceph_sub_item = proto_tree_add_item( tree, hf_ceph_entity_addr, tvb, offset, sizeof(struct ceph_entity_addr), TRUE );
+ ceph_entity_tree = proto_item_add_subtree(ceph_sub_item, ett_ceph);
+ proto_tree_add_item(ceph_entity_tree, hf_ceph_connect_erank, tvb, offset, 4, TRUE);
+ proto_tree_add_item(ceph_entity_tree, hf_ceph_connect_nonce, tvb, offset+4, 4, TRUE);
+ offset = dissect_sockaddr_in(tvb, ceph_entity_tree, offset+8);
+#if 0
+ proto_tree_add_item(ceph_entity_tree, hf_ceph_connect_host_type, tvb, offset, 4, TRUE);
+ offset += 4;
+#endif
+
+ return offset;
+}
+
+static guint32 dissect_ceph_fsid(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
+{
+ proto_tree *ceph_entity_tree = NULL;
+ proto_item *ceph_sub_item = NULL;
+ ceph_fsid_t *fsid;
+
+ fsid = (ceph_fsid_t *)tvb_get_ptr(tvb, offset, sizeof(ceph_fsid_t));
+
+ ceph_sub_item = proto_tree_add_item( tree, hf_ceph_fsid, tvb, offset, sizeof(struct ceph_entity_addr), TRUE );
+ ceph_entity_tree = proto_item_add_subtree(ceph_sub_item, ett_ceph);
+
+ proto_tree_add_item(ceph_entity_tree, hf_ceph_connect_erank, tvb, offset, 4, TRUE);
+ proto_tree_add_item(ceph_entity_tree, hf_ceph_connect_nonce, tvb, offset+4, 4, TRUE);
+
+ proto_tree_add_text(tree, tvb, 0,
+ sizeof(ceph_fsid_t), "fsid: " FMT_INO "." FMT_INO, ((unsigned long long *)fsid->fsid)[0], ((unsigned long long *)fsid->fsid)[1]);
+
+ offset += sizeof(ceph_fsid_t);
+
+ return offset;
+}
+
+static guint32 dissect_ceph_entity_inst(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
+{
+ proto_tree *ceph_entity_tree = NULL;
+ proto_item *ceph_sub_item = NULL;
+
+ ceph_sub_item = proto_tree_add_item( tree, hf_ceph_entity_addr, tvb, offset, sizeof(struct ceph_entity_addr), TRUE );
+ ceph_entity_tree = proto_item_add_subtree(ceph_sub_item, ett_ceph);
+ proto_tree_add_item(ceph_entity_tree, hf_ceph_entity_type, tvb, offset, 4, TRUE);
+ proto_tree_add_item(ceph_entity_tree, hf_ceph_entity_num, tvb, offset+4, 4, TRUE);
+ offset += 8;
+ offset = dissect_ceph_entity_addr(tvb, ceph_entity_tree, offset);
+ return offset;
+}
+
+static guint32 dissect_ceph_footer(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint32 data_crc)
+{
+ proto_tree *ceph_footer_tree = NULL;
+ proto_item *ceph_sub_item = NULL;
+ proto_item *data_crc_item = NULL;
+
+ ceph_sub_item = proto_tree_add_item( tree, hf_ceph_footer, tvb, offset, sizeof(struct ceph_msg_footer), TRUE );
+ ceph_footer_tree = proto_item_add_subtree(ceph_sub_item, ett_ceph);
+ proto_tree_add_item(ceph_footer_tree, hf_ceph_footer_flags, tvb, offset, 4, TRUE);
+ proto_tree_add_item(ceph_footer_tree, hf_ceph_footer_front_crc, tvb, offset+4, 4, TRUE);
+ proto_tree_add_item(ceph_footer_tree, hf_ceph_footer_middle_crc, tvb, offset+8, 4, TRUE);
+ data_crc_item = proto_tree_add_item(ceph_footer_tree, hf_ceph_footer_data_crc, tvb, offset+12, 4, TRUE);
+ proto_item_append_text(data_crc_item, " (calculated %x)", data_crc);
+
+ offset += 12;
+ return offset;
+}
+
+static guint32 dissect_ceph_client_connect(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
+{
+ proto_tree *ceph_header_tree = NULL;
+ proto_item *ceph_sub_item = NULL;
+ proto_item *ceph_item = proto_tree_get_parent(tree);
+
+ offset = dissect_ceph_banner(tvb, tree, offset);
+
+ ceph_header_tree = proto_item_add_subtree(ceph_item, ett_ceph);
+
+ ceph_sub_item = proto_tree_add_item( tree, hf_ceph_header, tvb, offset, -1, TRUE );
+ ceph_header_tree = proto_item_add_subtree(ceph_sub_item, ett_ceph);
+
+ offset = dissect_ceph_entity_addr(tvb, ceph_header_tree, offset);
+ proto_tree_add_item(ceph_header_tree, hf_ceph_connect_host_type, tvb, offset, 4, TRUE);
+ offset += 4;
+ proto_tree_add_item(ceph_header_tree, hf_ceph_connect_global_seq, tvb, offset, 4, TRUE);
+ proto_tree_add_item(ceph_header_tree, hf_ceph_connect_connect_seq, tvb, offset+4, 4, TRUE);
+ proto_tree_add_item(ceph_header_tree, hf_ceph_connect_flags, tvb, offset+8, 1, TRUE);
+ offset += 8;
+ return offset;
+}
+
+static guint32 dissect_ceph_server_connect(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
+{
+ proto_tree *ceph_header_tree = NULL;
+ proto_item *ceph_sub_item = NULL;
+ proto_item *ceph_item = proto_tree_get_parent(tree);
+
+ offset = dissect_ceph_banner(tvb, tree, offset);
+
+ ceph_header_tree = proto_item_add_subtree(ceph_item, ett_ceph);
+
+ ceph_sub_item = proto_tree_add_item( tree, hf_ceph_header, tvb, offset, -1, TRUE );
+ ceph_header_tree = proto_item_add_subtree(ceph_sub_item, ett_ceph);
+
+ offset = dissect_ceph_entity_addr(tvb, ceph_header_tree, offset);
+
+ proto_tree_add_item(ceph_header_tree, hf_ceph_hdr_tag, tvb, offset, 1, TRUE);
+ offset += 1;
+ proto_tree_add_item(ceph_header_tree, hf_ceph_connect_global_seq, tvb, offset, 4, TRUE);
+ proto_tree_add_item(ceph_header_tree, hf_ceph_connect_connect_seq, tvb, offset+4, 4, TRUE);
+ proto_tree_add_item(ceph_header_tree, hf_ceph_connect_flags, tvb, offset+8, 1, TRUE);
+ return offset;
+}
+
+static guint32 dissect_ceph_file_layout(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
+{
+ guint32 orig_ofs = offset;
+ struct ceph_file_layout *lo;
+
+ lo = (struct ceph_file_layout *)tvb_get_ptr(tvb, offset, sizeof(struct ceph_file_layout));
+
+ PROTO_ADD_TEXT(struct ceph_file_layout, lo, fl_stripe_unit, "%d");
+ PROTO_ADD_TEXT(struct ceph_file_layout, lo, fl_stripe_count, "%d");
+ PROTO_ADD_TEXT(struct ceph_file_layout, lo, fl_object_size, "%d");
+ PROTO_ADD_TEXT(struct ceph_file_layout, lo, fl_cas_hash, "%d");
+ PROTO_ADD_TEXT(struct ceph_file_layout, lo, fl_object_stripe_unit, "%d");
+ PROTO_ADD_TEXT(struct ceph_file_layout, lo, fl_pg_preferred, "%d");
+ PROTO_ADD_TEXT(struct ceph_file_layout, lo, fl_pg_pool, "%u");
+
+ return orig_ofs + sizeof(struct ceph_mds_reply_head);
+}
+#if 0
+static int dissect_ceph_filepath(tvbuff_t *tvb, proto_tree *tree, guint32 offset, char **path, guint64 *ino)
+{
+ guint32 len;
+ const char *p = NULL;
+
+ *ino = tvb_get_letoh64(tvb, offset);
+ proto_tree_add_text(tree, tvb, offset, sizeof(*ino), "inode: " FMT_INO, *ino);
+ offset += sizeof(*ino);
+ len = tvb_get_letohl(tvb, offset);
+ proto_tree_add_text(tree, tvb, offset, sizeof(len), "len: %d", len);
+ offset += sizeof(len);
+
+ if (len) {
+ p = tvb_get_ptr(tvb, offset, len);
+ *path = malloc(len+1);
+ if (*path) {
+ memcpy(*path, p, len);
+ (*path)[len] = '\0';
+ proto_tree_add_item(tree, hf_ceph_path, tvb, offset, len, TRUE);
+ }
+ }
+
+ offset += len;
+
+ return offset;
+}
+#endif
+static guint32 dissect_ceph_mon_statfs(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
+{
+ struct ceph_mon_statfs *req;
+
+ req = (struct ceph_mon_statfs *)tvb_get_ptr(tvb, offset, sizeof(struct ceph_mon_statfs));
+
+ dissect_ceph_fsid(tvb, tree, offset + offsetof(struct ceph_mon_statfs, fsid));
+ PROTO_ADD_TEXT(struct ceph_mon_statfs, req, tid, "%lld");
+
+ return offset + sizeof(struct ceph_mon_statfs);
+}
+
+static guint32 dissect_ceph_mon_statfs_reply(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
+{
+ struct ceph_mon_statfs_reply *req;
+
+ req = (struct ceph_mon_statfs_reply *)tvb_get_ptr(tvb, offset, sizeof(struct ceph_mon_statfs_reply));
+
+ dissect_ceph_fsid(tvb, tree, offset + offsetof(struct ceph_mon_statfs_reply, fsid));
+ PROTO_ADD_TEXT(struct ceph_mon_statfs_reply, req, tid, "%lld");
+ PROTO_ADD_TEXT(struct ceph_mon_statfs_reply, req, st.kb, "%lld");
+ PROTO_ADD_TEXT(struct ceph_mon_statfs_reply, req, st.kb_used, "%lld");
+ PROTO_ADD_TEXT(struct ceph_mon_statfs_reply, req, st.kb_avail, "%lld");
+ PROTO_ADD_TEXT(struct ceph_mon_statfs_reply, req, st.num_objects, "%lld");
+
+ return offset + sizeof(struct ceph_mon_statfs_reply);
+}
+
+static guint32 dissect_ceph_client_osd_getmap(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
+{
+ struct ceph_osd_getmap *req;
+
+ req = (struct ceph_osd_getmap *)tvb_get_ptr(tvb, offset, sizeof(struct ceph_osd_getmap));
+
+ dissect_ceph_fsid(tvb, tree, offset + offsetof(struct ceph_osd_getmap, fsid));
+ PROTO_ADD_TEXT(struct ceph_osd_getmap, req, start, "%d");
+
+ return offset + sizeof(struct ceph_osd_getmap);
+}
+
+static guint32 dissect_ceph_client_mds_getmap(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
+{
+ struct ceph_mds_getmap *req;
+
+ req = (struct ceph_mds_getmap *)tvb_get_ptr(tvb, offset, sizeof(struct ceph_mds_getmap));
+
+ PROTO_ADD_TEXT(struct ceph_mds_getmap, req, have_version, "%lld");
+ dissect_ceph_fsid(tvb, tree, offset + offsetof(struct ceph_mds_getmap, fsid));
+
+ return offset + sizeof(struct ceph_mds_getmap);
+}
+
+static guint32 dissect_ceph_client_mds_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset)
+{
+ struct ceph_mds_request_head *head;
+ proto_item *item;
+
+ head = (struct ceph_mds_request_head *)tvb_get_ptr(tvb, offset, sizeof(struct ceph_mds_request_head));
+
+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, tid, "%lld");
+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, oldest_client_tid, "%lld");
+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, mdsmap_epoch, "%d");
+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, num_retry, "%d");
+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, num_fwd, "%d");
+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, num_releases, "%d");
+
+ item = proto_tree_add_item(tree, hf_ceph_mds_op, tvb, offset+offsetof(struct ceph_mds_request_head, op), sizeof(head->op), TRUE);
+ proto_item_append_text(item, " (%s)", ceph_mds_op_name(head->op));
+
+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, caller_uid, "%d");
+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, caller_gid, "%d");
+
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", ceph_mds_op_name(head->op));
+ }
+
+ /* FIXME */
+ switch (head->op) {
+ case CEPH_MDS_OP_LOOKUP:
+// PROTO_ADD_TEXT(struct ceph_mds_request_head, head, args.lookup.mask, "0x%.4x");
+ break;
+ case CEPH_MDS_OP_SETXATTR:
+ break;
+ case CEPH_MDS_OP_SETLAYOUT:
+ dissect_ceph_file_layout(tvb, tree, offset + offsetof(struct ceph_mds_request_head, args.setlayout.layout));
+ break;
+ case CEPH_MDS_OP_SETATTR:
+ break;
+ case CEPH_MDS_OP_MKNOD:
+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, args.mknod.mode, "0%.5o");
+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, args.mknod.rdev, "%d");
+ break;
+ case CEPH_MDS_OP_OPEN:
+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, args.open.flags, "%x");
+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, args.open.mode, "0%.5o");
+ break;
+ case CEPH_MDS_OP_MKDIR:
+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, args.mkdir.mode, "0%.5o");
+ break;
+ case CEPH_MDS_OP_RMXATTR:
+ case CEPH_MDS_OP_LINK:
+ case CEPH_MDS_OP_UNLINK:
+ case CEPH_MDS_OP_RENAME:
+ case CEPH_MDS_OP_RMDIR:
+ case CEPH_MDS_OP_SYMLINK:
+ case CEPH_MDS_OP_LSSNAP:
+ case CEPH_MDS_OP_MKSNAP:
+ case CEPH_MDS_OP_RMSNAP:
+ break;
+ }
+
+ offset += sizeof(struct ceph_mds_request_head);
+#if 0
+ if (head->op == CEPH_MDS_OP_FINDINODE) {
+
+ } else {
+ guint64 ino1, ino2;
+ char *s1 = NULL, *s2 = NULL;
+
+ offset = dissect_ceph_filepath(tvb, tree, offset, &s1, &ino1);
+ offset = dissect_ceph_filepath(tvb, tree, offset, &s2, &ino2);
+
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ if (s1)
+ col_append_fstr(pinfo->cinfo, COL_INFO, " %s", s1);
+ if (s2)
+ col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", s2);
+ }
+
+
+
+ }
+#endif
+ return offset;
+}
+
+static guint32 dissect_ceph_client_mds_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset)
+{
+ guint32 orig_ofs = offset;
+ struct ceph_mds_reply_head *head;
+
+ head = (struct ceph_mds_reply_head *)tvb_get_ptr(tvb, offset, sizeof(struct ceph_mds_reply_head));
+
+ PROTO_ADD_TEXT(struct ceph_mds_reply_head, head, tid, "%lld");
+
+ proto_tree_add_text(tree, tvb, offsetof(struct ceph_mds_reply_head, op),
+ sizeof(head->op), "op: %d (%s)", head->op, ceph_mds_op_name(head->op));
+
+ PROTO_ADD_TEXT(struct ceph_mds_reply_head, head, result, "%d");
+ PROTO_ADD_TEXT(struct ceph_mds_reply_head, head, mdsmap_epoch, "%d");
+
+
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", ceph_mds_op_name(head->op));
+ }
+
+ return orig_ofs + sizeof(struct ceph_mds_reply_head);
+}
+
+static guint32 dissect_ceph_client_mds_lease_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset)
+{
+ guint32 orig_ofs = offset;
+ struct ceph_mds_lease *head;
+ static char *lease_action[] = { "", "revoke", "release", "renew" };
+
+ head = (struct ceph_mds_lease *)tvb_get_ptr(tvb, offset, sizeof(struct ceph_mds_lease));
+
+ PROTO_ADD_TEXT(struct ceph_mds_lease, head, action, "%d");
+ PROTO_ADD_TEXT(struct ceph_mds_lease, head, mask, "%.4x");
+ PROTO_ADD_TEXT(struct ceph_mds_lease, head, ino, FMT_INO);
+ PROTO_ADD_TEXT(struct ceph_mds_lease, head, first, "%lld");
+ PROTO_ADD_TEXT(struct ceph_mds_lease, head, last, "%lld");
+
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ if (head->action < 4) {
+ col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", lease_action[head->action]);
+ }
+ }
+
+ return orig_ofs + sizeof(struct ceph_mds_lease);
+}
+
+static guint32 dissect_ceph_client_mds_caps_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset)
+{
+ guint32 orig_ofs = offset;
+ struct ceph_mds_caps *head;
+
+ head = (struct ceph_mds_caps *)tvb_get_ptr(tvb, offset, sizeof(struct ceph_mds_caps));
+
+ PROTO_ADD_TEXT(struct ceph_mds_caps, head, op, "%d");
+ PROTO_ADD_TEXT(struct ceph_mds_caps, head, ino, FMT_INO);
+ PROTO_ADD_TEXT(struct ceph_mds_caps, head, seq, "%d");
+ PROTO_ADD_TEXT(struct ceph_mds_caps, head, caps, "%d");
+ PROTO_ADD_TEXT(struct ceph_mds_caps, head, wanted, "%d");
+ PROTO_ADD_TEXT(struct ceph_mds_caps, head, size, "%llu");
+ PROTO_ADD_TEXT(struct ceph_mds_caps, head, max_size, "%llu");
+ PROTO_ADD_TEXT(struct ceph_mds_caps, head, truncate_seq, "%d");
+ PROTO_ADD_TEXT(struct ceph_mds_caps, head, migrate_seq, "%d");
+ PROTO_ADD_TEXT(struct ceph_mds_caps, head, time_warp_seq, "%u");
+ PROTO_ADD_TEXT(struct ceph_mds_caps, head, snap_follows, "%llu");
+ PROTO_ADD_TEXT(struct ceph_mds_caps, head, snap_trace_len, "%d");
+
+#define CAPS_REQ_ADD_TIME(field) PROTO_ADD_TIME(tvb, tree, struct ceph_mds_caps, offset, head, field, field)
+ CAPS_REQ_ADD_TIME(mtime);
+ CAPS_REQ_ADD_TIME(atime);
+ CAPS_REQ_ADD_TIME(ctime);
+
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", ceph_cap_op_name(head->op));
+ }
+
+ return orig_ofs + sizeof(struct ceph_mds_caps);
+}
+
+static guint32 dissect_ceph_client_front(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset, guint16 type)
+{
+ switch (type) {
+ case CEPH_MSG_STATFS:
+ offset = dissect_ceph_mon_statfs(tvb, tree, offset);
+ break;
+ case CEPH_MSG_STATFS_REPLY:
+ offset = dissect_ceph_mon_statfs_reply(tvb, tree, offset);
+ break;
+ case CEPH_MSG_CLIENT_REQUEST: /* mds request */
+ offset = dissect_ceph_client_mds_request(tvb, pinfo, tree, offset);
+ break;
+ case CEPH_MSG_CLIENT_REPLY:
+ offset = dissect_ceph_client_mds_reply(tvb, pinfo, tree, offset);
+ break;
+ case CEPH_MSG_CLIENT_LEASE:
+ offset = dissect_ceph_client_mds_lease_request(tvb, pinfo, tree, offset);
+ break;
+ case CEPH_MSG_CLIENT_CAPS:
+ offset = dissect_ceph_client_mds_caps_request(tvb, pinfo, tree, offset);
+ break;
+ case CEPH_MSG_OSD_GETMAP:
+ offset = dissect_ceph_client_osd_getmap(tvb, tree, offset);
+ break;
+ case CEPH_MSG_MDS_GETMAP:
+ offset = dissect_ceph_client_mds_getmap(tvb, tree, offset);
+ break;
+ default:
+ break;
+ }
+ return offset;
+}
+
+static guint32 dissect_ceph_generic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset)
+{
+ proto_tree *ceph_header_tree = NULL;
+ proto_item *ceph_sub_item = NULL;
+ proto_item *ceph_item = proto_tree_get_parent(tree);
+ guint32 front_len, middle_len, data_len;
+ guint8 tag;
+ guint32 orig_ofs = offset;
+ guint16 type;
+ guint64 seq;
+ struct ceph_msg_header *header;
+ unsigned int data_crc = 0;
+
+ ceph_header_tree = proto_item_add_subtree(ceph_item, ett_ceph);
+
+ ceph_sub_item = proto_tree_add_item( tree, hf_ceph_header, tvb, offset, -1, TRUE );
+ ceph_header_tree = proto_item_add_subtree(ceph_sub_item, ett_ceph);
+
+ tag = tvb_get_guint8(tvb, offset);
+
+ if (tag == CEPH_MSGR_TAG_ACK) {
+ proto_tree_add_item(ceph_header_tree, hf_ceph_hdr_tag, tvb, offset, 1, TRUE);
+ proto_tree_add_item(ceph_header_tree, hf_ceph_hdr_seq_ack, tvb, offset+1, 4, TRUE);
+ offset += ACK_MSG_SIZE;
+ }
+
+ proto_tree_add_item(ceph_header_tree, hf_ceph_hdr_tag, tvb, offset, 1, TRUE);
+ offset++;
+
+ header = (struct ceph_msg_header *)tvb_get_ptr(tvb, offset, sizeof(struct ceph_msg_header));
+
+ PROTO_ADD_ITEM(ceph_header_tree, struct ceph_msg_header, hf_ceph_hdr_seq, header, seq);
+ PROTO_ADD_ITEM(ceph_header_tree, struct ceph_msg_header, hf_ceph_hdr_type, header, type);
+ PROTO_ADD_ITEM(ceph_header_tree, struct ceph_msg_header, hf_ceph_hdr_priority, header, priority);
+ PROTO_ADD_ITEM(ceph_header_tree, struct ceph_msg_header, hf_ceph_hdr_mon_protocol, header, mon_protocol);
+ PROTO_ADD_ITEM(ceph_header_tree, struct ceph_msg_header, hf_ceph_hdr_osd_protocol, header, osd_protocol);
+ PROTO_ADD_ITEM(ceph_header_tree, struct ceph_msg_header, hf_ceph_hdr_mds_protocol, header, mds_protocol);
+ PROTO_ADD_ITEM(ceph_header_tree, struct ceph_msg_header, hf_ceph_hdr_front_len, header, front_len);
+ PROTO_ADD_ITEM(ceph_header_tree, struct ceph_msg_header, hf_ceph_hdr_middle_len, header, middle_len);
+ PROTO_ADD_ITEM(ceph_header_tree, struct ceph_msg_header, hf_ceph_hdr_data_off, header, data_off);
+ PROTO_ADD_ITEM(ceph_header_tree, struct ceph_msg_header, hf_ceph_hdr_data_len, header, data_len);
+ dissect_ceph_entity_inst(tvb, ceph_header_tree, offset + offsetof(struct ceph_msg_header, src));
+ dissect_ceph_entity_inst(tvb, ceph_header_tree, offset + offsetof(struct ceph_msg_header, orig_src));
+ dissect_ceph_entity_inst(tvb, ceph_header_tree, offset + offsetof(struct ceph_msg_header, dst));
+ PROTO_ADD_ITEM(ceph_header_tree, struct ceph_msg_header, hf_ceph_hdr_crc, header, crc);
+
+ offset += sizeof(struct ceph_msg_header);
+
+ type = TVB_MSG_FIELD(tvb_get_letohl, tvb, orig_ofs, type);
+ seq = TVB_MSG_FIELD(tvb_get_letoh64, tvb, orig_ofs, seq);
+ front_len = TVB_MSG_FIELD(tvb_get_letohs, tvb, orig_ofs, front_len);
+ middle_len = TVB_MSG_FIELD(tvb_get_letohs, tvb, orig_ofs, middle_len);
+ data_len = TVB_MSG_FIELD(tvb_get_letohl, tvb, orig_ofs, data_len);
+
+ if (front_len) {
+ /* ceph_sub_item = proto_tree_add_item( tree, hf_ceph_front, tvb, offset, front_len, TRUE );
+ offset += front_len; */
+
+ dissect_ceph_client_front(tvb, pinfo, tree, offset, type);
+ offset += front_len;
+ }
+
+ if (middle_len) {
+ offset += middle_len;
+ }
+
+ if (data_len) {
+ char *data;
+ ceph_sub_item = proto_tree_add_item( tree, hf_ceph_data, tvb, offset, data_len, TRUE );
+ data = (char *)tvb_get_ptr(tvb, offset, data_len);
+
+ data_crc = crc32c_le(0, data, data_len);
+
+ offset += data_len;
+ }
+
+ offset = dissect_ceph_footer(tvb, tree, offset, data_crc);
+
+ return offset;
+}
+
+static const char *entity_name_by_type(int type)
+{
+ if (type < 4)
+ return "???";
+
+ if (type < 20)
+ return "mon";
+
+ if (type < 30)
+ return "mds";
+
+ if (type < 50)
+ return "osd";
+
+ if (type < 0x300)
+ return "???";
+
+ if (type < 0x400)
+ return "mds";
+
+ return "???";
+}
+
+static void
+dissect_ceph_client(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+
+ proto_item *ceph_item = NULL;
+ proto_tree *ceph_tree = NULL;
+ guint16 type = 0;
+ const guchar *ptr;
+ guint32 pos = 0;
+ int have_banner = 0;
+
+ if (check_col(pinfo->cinfo, COL_PROTOCOL))
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_CEPH);
+ /* Clear out stuff in the info column */
+ if(check_col(pinfo->cinfo,COL_INFO)){
+ col_clear(pinfo->cinfo,COL_INFO);
+ }
+
+ ptr = tvb_get_ptr(tvb, pos, 9);
+ if (ptr && memcmp(ptr, "ceph", 4) == 0) {
+ have_banner = 1;
+ pos += 9;
+ }
+
+ // This is not a good way of dissecting packets. The tvb length should
+ // be sanity checked so we aren't going past the actual size of the buffer.
+ type = tvb_get_guint8( tvb, 4 ); // Get the type byte
+
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ const char *entity_str = NULL;
+
+ if (have_banner) {
+ if (IS_MON(pinfo))
+ entity_str = MON_STR;
+ else
+ entity_str = "???";
+
+ col_add_fstr(pinfo->cinfo, COL_INFO, "[%s] Connect Request", entity_str);
+ } else {
+ type = TVB_MSG_FIELD(tvb_get_letohl, tvb, 0, type);
+ entity_str = entity_name_by_type(type);
+ col_add_fstr(pinfo->cinfo, COL_INFO, "[%s] %s",
+ entity_str,
+ val_to_str(type, packettypenames, "Unknown Type:0x%02x"));
+ }
+ }
+
+ if (tree) { /* we are being asked for details */
+ guint32 offset = 0;
+
+ ceph_item = proto_tree_add_item(tree, proto_ceph, tvb, 0, -1, TRUE);
+ ceph_tree = proto_item_add_subtree(ceph_item, ett_ceph);
+ if (have_banner) { /* this is a connect message */
+ offset = dissect_ceph_client_connect(tvb, ceph_tree, offset);
+ } else {
+ offset = dissect_ceph_generic(tvb, pinfo, ceph_tree, offset);
+ }
+ }
+}
+
+static void
+dissect_ceph_server(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+
+ proto_item *ceph_item = NULL;
+ proto_tree *ceph_tree = NULL;
+ guint16 type = 0;
+ const guchar *ptr;
+ guint32 pos = 0;
+ int have_banner = 0;
+
+ if (check_col(pinfo->cinfo, COL_PROTOCOL))
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_CEPH);
+ /* Clear out stuff in the info column */
+ if(check_col(pinfo->cinfo,COL_INFO)){
+ col_clear(pinfo->cinfo,COL_INFO);
+ }
+
+ ptr = tvb_get_ptr(tvb, pos, 9);
+ if (ptr && memcmp(ptr, "ceph", 4) == 0) {
+ have_banner = 1;
+ pos += 9;
+ }
+
+ // This is not a good way of dissecting packets. The tvb length should
+ // be sanity checked so we aren't going past the actual size of the buffer.
+ type = tvb_get_guint8( tvb, 4 ); // Get the type byte
+
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ const char *entity_str;
+ if (IS_MON(pinfo))
+ entity_str = MON_STR;
+ else
+ entity_str = "???";
+ if (have_banner) {
+ col_add_fstr(pinfo->cinfo, COL_INFO, "[%s] Connect Response", entity_str);
+ } else {
+ type = TVB_MSG_FIELD(tvb_get_letohl, tvb, 0, type);
+ entity_str = entity_name_by_type(type);
+ col_add_fstr(pinfo->cinfo, COL_INFO, "[%s] %s",
+ entity_str,
+ val_to_str(type, packettypenames, "Unknown Type:0x%02x"));
+ }
+ }
+
+ if (tree) { /* we are being asked for details */
+ guint32 offset = 0;
+
+ ceph_item = proto_tree_add_item(tree, proto_ceph, tvb, 0, -1, TRUE);
+ ceph_tree = proto_item_add_subtree(ceph_item, ett_ceph);
+
+ if (have_banner) {
+ offset = dissect_ceph_server_connect(tvb, ceph_tree, offset);
+ } else {
+ offset = dissect_ceph_generic(tvb, pinfo, ceph_tree, offset);
+ }
+ }
+}
+
+static void
+dissect_ceph_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+ if (DEST_PORT_CEPH)
+ dissect_ceph_client(tvb, pinfo, tree);
+ else
+ dissect_ceph_server(tvb, pinfo, tree);
+}
+
+static guint dissect_ceph_acks(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+ guint32 offset = 0;
+
+ if (check_col(pinfo->cinfo, COL_PROTOCOL))
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_CEPH);
+ /* Clear out stuff in the info column */
+ if(check_col(pinfo->cinfo,COL_INFO)){
+ col_clear(pinfo->cinfo,COL_INFO);
+ col_add_fstr(pinfo->cinfo, COL_INFO, "Ack");
+ }
+ if (tree) {
+ proto_tree_add_item(tree, proto_ceph, tvb, 0, 5, TRUE);
+ proto_tree_add_item(tree, hf_ceph_hdr_tag, tvb, offset, 1, TRUE);
+ proto_tree_add_item(tree, hf_ceph_hdr_seq_ack, tvb, offset+1, 4, TRUE);
+ offset += 5;
+ }
+
+ return offset;
+}
+
+/* determine PDU length of protocol ceph */
+static guint get_ceph_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset)
+{
+ const char *ptr;
+ guint32 len;
+ guint32 pos = 0;
+
+ ptr = tvb_get_ptr(tvb, offset, /* sizeof(CEPH_BANNER) */tvb->length-offset);
+ if (ptr && memcmp(ptr, "ceph", 4) == 0) {
+ if (DEST_PORT_CEPH) {
+ len = sizeof(CEPH_BANNER) - 1 +
+ sizeof(struct ceph_entity_addr) +
+ sizeof(struct ceph_msg_connect);
+ } else
+ len = sizeof(CEPH_BANNER) - 1 +
+ sizeof(struct ceph_entity_addr) +
+ sizeof(struct ceph_msg_connect_reply);
+
+ return len;
+ }
+
+ if (*ptr == CEPH_MSGR_TAG_ACK)
+ pos = ACK_MSG_SIZE;
+
+ len = pos + (guint)1 + sizeof(struct ceph_msg_header) +
+ TVB_MSG_FIELD(tvb_get_letohl, tvb, offset, front_len) +
+ TVB_MSG_FIELD(tvb_get_letohl, tvb, offset, data_len) +
+ sizeof(struct ceph_msg_footer);
+
+ if (!*ptr)
+ return 0;
+ return len;
+}
+
+
+static void dissect_ceph(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+ const char *ptr;
+
+ ptr = tvb_get_ptr(tvb, 0, 6);
+
+ if ((*ptr == CEPH_MSGR_TAG_MSG) ||
+ (memcmp(ptr, CEPH_BANNER, 4) == 0) ||
+ ((ptr[0] == CEPH_MSGR_TAG_ACK) && (ptr[5] == CEPH_MSGR_TAG_MSG))
+ ) {
+ tcp_dissect_pdus(tvb, pinfo, tree, TRUE, TVB_MSG_HEADER_POS(src),
+ get_ceph_message_len, dissect_ceph_message);
+ } else {
+ dissect_ceph_acks(tvb, pinfo, tree);
+ }
+}
+
diff --git a/wireshark/ceph/plugin.c b/wireshark/ceph/plugin.c
new file mode 100644
index 00000000000..0306fcc6a8d
--- /dev/null
+++ b/wireshark/ceph/plugin.c
@@ -0,0 +1,28 @@
+/* Do not modify this file. */
+/* It is created automatically by the Makefile. */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <gmodule.h>
+
+#include "moduleinfo.h"
+
+#ifndef ENABLE_STATIC
+G_MODULE_EXPORT const gchar version[] = VERSION;
+
+/* Start the functions we need for the plugin stuff */
+
+G_MODULE_EXPORT void
+plugin_register (void)
+{
+ {extern void proto_register_ceph (void); proto_register_ceph ();}
+}
+
+G_MODULE_EXPORT void
+plugin_reg_handoff(void)
+{
+ {extern void proto_reg_handoff_ceph (void); proto_reg_handoff_ceph ();}
+}
+#endif
diff --git a/wireshark/ceph/plugin.rc.in b/wireshark/ceph/plugin.rc.in
new file mode 100644
index 00000000000..b1e22ef3732
--- /dev/null
+++ b/wireshark/ceph/plugin.rc.in
@@ -0,0 +1,34 @@
+#include "winver.h"
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION @RC_MODULE_VERSION@
+ PRODUCTVERSION @RC_VERSION@
+ FILEFLAGSMASK 0x0L
+#ifdef _DEBUG
+ FILEFLAGS VS_FF_PRERELEASE+VS_FF_DEBUG
+#else
+ FILEFLAGS VS_FF_PRERELEASE
+#endif
+ FILEOS VOS_NT_WINDOWS32
+ FILETYPE VFT_DLL
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "The Wireshark developer community, http://www.wireshark.org/\0"
+ VALUE "FileDescription", "@PACKAGE@ dissector\0"
+ VALUE "FileVersion", "@MODULE_VERSION@\0"
+ VALUE "InternalName", "@PACKAGE@ @MODULE_VERSION@\0"
+ VALUE "LegalCopyright", "Copyright © 1998 Gerald Combs <gerald@wireshark.org>, Gilbert Ramirez <gram@alumni.rice.edu> and others\0"
+ VALUE "OriginalFilename", "@PLUGIN_NAME@.dll\0"
+ VALUE "ProductName", "Wireshark\0"
+ VALUE "ProductVersion", "@VERSION@\0"
+ VALUE "Comments", "Build with @MSVC_VARIANT@\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
diff --git a/wireshark/ceph/rados.h b/wireshark/ceph/rados.h
new file mode 100644
index 00000000000..d6067072797
--- /dev/null
+++ b/wireshark/ceph/rados.h
@@ -0,0 +1,428 @@
+// -*- mode:C; tab-width:8; c-basic-offset:8; indent-tabs-mode:t -*-
+// vim: ts=8 sw=8 smarttab
+
+#ifndef __RADOS_H
+#define __RADOS_H
+
+/*
+ * Data types for RADOS, the distributed object storage layer used by
+ * the Ceph file system.
+ */
+
+#include "msgr.h"
+
+/*
+ * fs id
+ */
+typedef struct { unsigned char fsid[16]; } ceph_fsid_t;
+
+static inline int ceph_fsid_compare(const ceph_fsid_t *a,
+ const ceph_fsid_t *b)
+{
+ return memcmp(a, b, sizeof(*a));
+}
+
+/*
+ * ino, object, etc.
+ */
+typedef __le64 ceph_snapid_t;
+#define CEPH_MAXSNAP ((__u64)(-3))
+#define CEPH_SNAPDIR ((__u64)(-1))
+#define CEPH_NOSNAP ((__u64)(-2))
+
+struct ceph_timespec {
+ __le32 tv_sec;
+ __le32 tv_nsec;
+} __attribute__ ((packed));
+
+
+/*
+ * object layout - how objects are mapped into PGs
+ */
+#define CEPH_OBJECT_LAYOUT_HASH 1
+#define CEPH_OBJECT_LAYOUT_LINEAR 2
+#define CEPH_OBJECT_LAYOUT_HASHINO 3
+
+/*
+ * pg layout -- how PGs are mapped onto (sets of) OSDs
+ */
+#define CEPH_PG_LAYOUT_CRUSH 0
+#define CEPH_PG_LAYOUT_HASH 1
+#define CEPH_PG_LAYOUT_LINEAR 2
+#define CEPH_PG_LAYOUT_HYBRID 3
+
+
+/*
+ * placement group.
+ * we encode this into one __le64.
+ */
+#define CEPH_PG_TYPE_REP 1
+#define CEPH_PG_TYPE_RAID4 2
+union ceph_pg {
+ __u64 pg64;
+ struct {
+ __s16 preferred; /* preferred primary osd */
+ __u16 ps; /* placement seed */
+ __u32 pool; /* implies crush ruleset */
+ } pg;
+} __attribute__ ((packed));
+
+#define ceph_pg_is_rep(pg) ((pg).pg.type == CEPH_PG_TYPE_REP)
+#define ceph_pg_is_raid4(pg) ((pg).pg.type == CEPH_PG_TYPE_RAID4)
+
+/*
+ * pg_pool is a set of pgs storing a pool of objects
+ *
+ * pg_num -- base number of pseudorandomly placed pgs
+ *
+ * pgp_num -- effective number when calculating pg placement. this
+ * is used for pg_num increases. new pgs result in data being "split"
+ * into new pgs. for this to proceed smoothly, new pgs are intiially
+ * colocated with their parents; that is, pgp_num doesn't increase
+ * until the new pgs have successfully split. only _then_ are the new
+ * pgs placed independently.
+ *
+ * lpg_num -- localized pg count (per device). replicas are randomly
+ * selected.
+ *
+ * lpgp_num -- as above.
+ */
+struct ceph_pg_pool {
+ __u8 type;
+ __u8 size;
+ __u8 crush_ruleset;
+ __le32 pg_num, pgp_num;
+ __le32 lpg_num, lpgp_num;
+ __le32 last_change; /* most recent epoch changed */
+ __le64 snap_seq;
+ __le32 snap_epoch;
+ __le32 num_snaps;
+ __le32 num_removed_snap_intervals;
+} __attribute__ ((packed));
+
+/*
+ * stable_mod func is used to control number of placement groups.
+ * similar to straight-up modulo, but produces a stable mapping as b
+ * increases over time. b is the number of bins, and bmask is the
+ * containing power of 2 minus 1.
+ *
+ * b <= bmask and bmask=(2**n)-1
+ * e.g., b=12 -> bmask=15, b=123 -> bmask=127
+ */
+static inline int ceph_stable_mod(int x, int b, int bmask)
+{
+ if ((x & bmask) < b)
+ return x & bmask;
+ else
+ return x & (bmask >> 1);
+}
+
+/*
+ * object layout - how a given object should be stored.
+ */
+struct ceph_object_layout {
+ __le64 ol_pgid; /* raw pg, with _full_ ps precision. */
+ __le32 ol_stripe_unit;
+} __attribute__ ((packed));
+
+/*
+ * compound epoch+version, used by storage layer to serialize mutations
+ */
+struct ceph_eversion {
+ __le32 epoch;
+ __le64 version;
+} __attribute__ ((packed));
+
+/*
+ * osd map bits
+ */
+
+/* status bits */
+#define CEPH_OSD_EXISTS 1
+#define CEPH_OSD_UP 2
+
+/* osd weights. fixed point value: 0x10000 == 1.0 ("in"), 0 == "out" */
+#define CEPH_OSD_IN 0x10000
+#define CEPH_OSD_OUT 0
+
+
+/*
+ * osd map flag bits
+ */
+#define CEPH_OSDMAP_NEARFULL (1<<0) /* sync writes (near ENOSPC) */
+#define CEPH_OSDMAP_FULL (1<<1) /* no data writes (ENOSPC) */
+#define CEPH_OSDMAP_PAUSERD (1<<2) /* pause all reads */
+#define CEPH_OSDMAP_PAUSEWR (1<<3) /* pause all writes */
+#define CEPH_OSDMAP_PAUSEREC (1<<4) /* pause recovery */
+
+/*
+ * osd ops
+ */
+#define CEPH_OSD_OP_MODE 0xf000
+#define CEPH_OSD_OP_MODE_RD 0x1000
+#define CEPH_OSD_OP_MODE_WR 0x2000
+#define CEPH_OSD_OP_MODE_RMW 0x3000
+#define CEPH_OSD_OP_MODE_SUB 0x4000
+#define CEPH_OSD_OP_MODE_EXEC 0x8000
+
+#define CEPH_OSD_OP_TYPE 0x0f00
+#define CEPH_OSD_OP_TYPE_LOCK 0x0100
+#define CEPH_OSD_OP_TYPE_DATA 0x0200
+#define CEPH_OSD_OP_TYPE_ATTR 0x0300
+#define CEPH_OSD_OP_TYPE_EXEC 0x0400
+#define CEPH_OSD_OP_TYPE_PG 0x0500
+
+enum {
+ /** data **/
+ /* read */
+ CEPH_OSD_OP_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 1,
+ CEPH_OSD_OP_STAT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 2,
+
+ /* fancy read */
+ CEPH_OSD_OP_MASKTRUNC = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 4,
+
+ /* write */
+ CEPH_OSD_OP_WRITE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 1,
+ CEPH_OSD_OP_WRITEFULL = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 2,
+ CEPH_OSD_OP_TRUNCATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 3,
+ CEPH_OSD_OP_ZERO = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 4,
+ CEPH_OSD_OP_DELETE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 5,
+
+ /* fancy write */
+ CEPH_OSD_OP_APPEND = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 6,
+ CEPH_OSD_OP_STARTSYNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 7,
+ CEPH_OSD_OP_SETTRUNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 8,
+ CEPH_OSD_OP_TRIMTRUNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 9,
+
+ CEPH_OSD_OP_TMAPUP = CEPH_OSD_OP_MODE_RMW | CEPH_OSD_OP_TYPE_DATA | 10,
+ CEPH_OSD_OP_TMAPPUT = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 11,
+ CEPH_OSD_OP_TMAPGET = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 12,
+
+ CEPH_OSD_OP_CREATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 13,
+
+ /** attrs **/
+ /* read */
+ CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1,
+ CEPH_OSD_OP_GETXATTRS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 2,
+
+ /* write */
+ CEPH_OSD_OP_SETXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 1,
+ CEPH_OSD_OP_SETXATTRS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 2,
+ CEPH_OSD_OP_RESETXATTRS = CEPH_OSD_OP_MODE_WR|CEPH_OSD_OP_TYPE_ATTR | 3,
+ CEPH_OSD_OP_RMXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 4,
+
+ /** subop **/
+ CEPH_OSD_OP_PULL = CEPH_OSD_OP_MODE_SUB | 1,
+ CEPH_OSD_OP_PUSH = CEPH_OSD_OP_MODE_SUB | 2,
+ CEPH_OSD_OP_BALANCEREADS = CEPH_OSD_OP_MODE_SUB | 3,
+ CEPH_OSD_OP_UNBALANCEREADS = CEPH_OSD_OP_MODE_SUB | 4,
+ CEPH_OSD_OP_SCRUB = CEPH_OSD_OP_MODE_SUB | 5,
+
+ /** lock **/
+ CEPH_OSD_OP_WRLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 1,
+ CEPH_OSD_OP_WRUNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 2,
+ CEPH_OSD_OP_RDLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 3,
+ CEPH_OSD_OP_RDUNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 4,
+ CEPH_OSD_OP_UPLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 5,
+ CEPH_OSD_OP_DNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 6,
+
+ /** exec **/
+ CEPH_OSD_OP_CALL = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_EXEC | 1,
+
+ /** pg **/
+ CEPH_OSD_OP_PGLS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_PG | 1,
+};
+
+static inline int ceph_osd_op_type_lock(int op)
+{
+ return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_LOCK;
+}
+static inline int ceph_osd_op_type_data(int op)
+{
+ return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_DATA;
+}
+static inline int ceph_osd_op_type_attr(int op)
+{
+ return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_ATTR;
+}
+static inline int ceph_osd_op_type_exec(int op)
+{
+ return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_EXEC;
+}
+static inline int ceph_osd_op_type_pg(int op)
+{
+ return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_PG;
+}
+
+static inline int ceph_osd_op_mode_subop(int op)
+{
+ return (op & CEPH_OSD_OP_MODE) == CEPH_OSD_OP_MODE_SUB;
+}
+static inline int ceph_osd_op_mode_read(int op)
+{
+ return (op & CEPH_OSD_OP_MODE) == CEPH_OSD_OP_MODE_RD;
+}
+static inline int ceph_osd_op_mode_modify(int op)
+{
+ return (op & CEPH_OSD_OP_MODE) == CEPH_OSD_OP_MODE_WR;
+}
+
+#define CEPH_OSD_TMAP_HDR 'h'
+#define CEPH_OSD_TMAP_SET 's'
+#define CEPH_OSD_TMAP_RM 'r'
+
+static inline const char *ceph_osd_op_name(int op)
+{
+ switch (op) {
+ case CEPH_OSD_OP_READ: return "read";
+ case CEPH_OSD_OP_STAT: return "stat";
+
+ case CEPH_OSD_OP_MASKTRUNC: return "masktrunc";
+
+ case CEPH_OSD_OP_WRITE: return "write";
+ case CEPH_OSD_OP_DELETE: return "delete";
+ case CEPH_OSD_OP_TRUNCATE: return "truncate";
+ case CEPH_OSD_OP_ZERO: return "zero";
+ case CEPH_OSD_OP_WRITEFULL: return "writefull";
+
+ case CEPH_OSD_OP_APPEND: return "append";
+ case CEPH_OSD_OP_STARTSYNC: return "startsync";
+ case CEPH_OSD_OP_SETTRUNC: return "settrunc";
+ case CEPH_OSD_OP_TRIMTRUNC: return "trimtrunc";
+
+ case CEPH_OSD_OP_TMAPUP: return "tmapup";
+ case CEPH_OSD_OP_TMAPGET: return "tmapget";
+ case CEPH_OSD_OP_TMAPPUT: return "tmapput";
+
+ case CEPH_OSD_OP_GETXATTR: return "getxattr";
+ case CEPH_OSD_OP_GETXATTRS: return "getxattrs";
+ case CEPH_OSD_OP_SETXATTR: return "setxattr";
+ case CEPH_OSD_OP_SETXATTRS: return "setxattrs";
+ case CEPH_OSD_OP_RESETXATTRS: return "resetxattrs";
+ case CEPH_OSD_OP_RMXATTR: return "rmxattr";
+
+ case CEPH_OSD_OP_PULL: return "pull";
+ case CEPH_OSD_OP_PUSH: return "push";
+ case CEPH_OSD_OP_BALANCEREADS: return "balance-reads";
+ case CEPH_OSD_OP_UNBALANCEREADS: return "unbalance-reads";
+ case CEPH_OSD_OP_SCRUB: return "scrub";
+
+ case CEPH_OSD_OP_WRLOCK: return "wrlock";
+ case CEPH_OSD_OP_WRUNLOCK: return "wrunlock";
+ case CEPH_OSD_OP_RDLOCK: return "rdlock";
+ case CEPH_OSD_OP_RDUNLOCK: return "rdunlock";
+ case CEPH_OSD_OP_UPLOCK: return "uplock";
+ case CEPH_OSD_OP_DNLOCK: return "dnlock";
+
+ case CEPH_OSD_OP_CALL: return "call";
+
+ case CEPH_OSD_OP_PGLS: return "pgls";
+
+ default: return "???";
+ }
+}
+
+
+/*
+ * osd op flags
+ *
+ * An op may be READ, WRITE, or READ|WRITE.
+ */
+enum {
+ CEPH_OSD_FLAG_ACK = 1, /* want (or is) "ack" ack */
+ CEPH_OSD_FLAG_ONNVRAM = 2, /* want (or is) "onnvram" ack */
+ CEPH_OSD_FLAG_ONDISK = 4, /* want (or is) "ondisk" ack */
+ CEPH_OSD_FLAG_RETRY = 8, /* resend attempt */
+ CEPH_OSD_FLAG_READ = 16, /* op may read */
+ CEPH_OSD_FLAG_WRITE = 32, /* op may write */
+ CEPH_OSD_FLAG_ORDERSNAP = 64, /* EOLDSNAP if snapc is out of order */
+ CEPH_OSD_FLAG_PEERSTAT = 128, /* msg includes osd_peer_stat */
+ CEPH_OSD_FLAG_BALANCE_READS = 256,
+ CEPH_OSD_FLAG_PARALLELEXEC = 512, /* execute op in parallel */
+ CEPH_OSD_FLAG_PGOP = 1024, /* pg op, no object */
+};
+
+enum {
+ CEPH_OSD_OP_FLAG_EXCL = 1,
+};
+
+#define EOLDSNAPC ERESTART /* ORDERSNAP flag set; writer has old snapc*/
+#define EBLACKLISTED ESHUTDOWN /* blacklisted */
+
+/*
+ * an individual object operation. each may be accompanied by some data
+ * payload
+ */
+struct ceph_osd_op {
+ __le16 op;
+ union {
+ struct {
+ __le64 offset, length;
+ } __attribute__ ((packed));
+ struct {
+ __le32 name_len;
+ __le32 value_len;
+ } __attribute__ ((packed));
+ struct {
+ __le64 truncate_size;
+ __le32 truncate_seq;
+ } __attribute__ ((packed));
+ struct {
+ __u8 class_len;
+ __u8 method_len;
+ __u8 argc;
+ __le32 indata_len;
+ } __attribute__ ((packed));
+ struct {
+ __le64 pgls_cookie, count;
+ } __attribute__ ((packed));
+ struct {
+ __le32 flags;
+ } __attribute__ ((packed));
+ };
+ __le32 payload_len;
+} __attribute__ ((packed));
+
+/*
+ * osd request message header. each request may include multiple
+ * ceph_osd_op object operations.
+ */
+struct ceph_osd_request_head {
+ __le64 tid;
+ __le32 client_inc;
+ struct ceph_object_layout layout;
+ __le32 osdmap_epoch;
+
+ __le32 flags;
+
+ struct ceph_timespec mtime;
+ struct ceph_eversion reassert_version; /* if we are replaying op */
+
+ __le32 object_len;
+ __le32 ticket_len;
+
+ __le64 snapid;
+ __le64 snap_seq; /* writer's snap context */
+ __le32 num_snaps;
+
+ __le16 num_ops;
+ struct ceph_osd_op ops[]; /* followed by ops[], obj, ticket, snaps */
+} __attribute__ ((packed));
+
+struct ceph_osd_reply_head {
+ __le64 tid;
+ __le32 client_inc;
+ __le32 flags;
+ struct ceph_object_layout layout;
+ __le32 osdmap_epoch;
+ struct ceph_eversion reassert_version;
+
+ __le32 result;
+
+ __le32 object_len;
+ __le32 num_ops;
+ struct ceph_osd_op ops[0]; /* ops[], object */
+} __attribute__ ((packed));
+
+
+#endif
diff --git a/wireshark/ceph/sctp_crc32.c b/wireshark/ceph/sctp_crc32.c
new file mode 100644
index 00000000000..43c06b4c6c9
--- /dev/null
+++ b/wireshark/ceph/sctp_crc32.c
@@ -0,0 +1,728 @@
+/*-
+ * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * a) Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * b) Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the distribution.
+ *
+ * c) Neither the name of Cisco Systems, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* $KAME: sctp_crc32.c,v 1.12 2005/03/06 16:04:17 itojun Exp $ */
+
+
+//#include <sys/cdefs.h>
+
+#include <glib.h>
+
+typedef guint8 uint8_t;
+typedef guint32 uint32_t;
+typedef unsigned long uintptr_t;
+
+
+
+#ifndef SCTP_USE_ADLER32
+
+
+/**
+ *
+ * Routine Description:
+ *
+ * Computes the CRC32c checksum for the specified buffer using the slicing by 8
+ * algorithm over 64 bit quantities.
+ *
+ * Arguments:
+ *
+ * p_running_crc - pointer to the initial or final remainder value
+ * used in CRC computations. It should be set to
+ * non-NULL if the mode argument is equal to CONT or END
+ * p_buf - the packet buffer where crc computations are being performed
+ * length - the length of p_buf in bytes
+ * init_bytes - the number of initial bytes that need to be procesed before
+ * aligning p_buf to multiples of 4 bytes
+ * mode - can be any of the following: BEGIN, CONT, END, BODY, ALIGN
+ *
+ * Return value:
+ *
+ * The computed CRC32c value
+ */
+
+
+/*
+ * Copyright (c) 2004-2006 Intel Corporation - All Rights Reserved
+ *
+ *
+ * This software program is licensed subject to the BSD License, available at
+ * http://www.opensource.org/licenses/bsd-license.html.
+ *
+ * Abstract:
+ *
+ * Tables for software CRC generation
+ */
+
+/*
+ * The following CRC lookup table was generated automagically using the
+ * following model parameters:
+ *
+ * Generator Polynomial = ................. 0x1EDC6F41 Generator Polynomial
+ * Length = .......... 32 bits Reflected Bits = ....................... TRUE
+ * Table Generation Offset = .............. 32 bits Number of Slices =
+ * ..................... 8 slices Slice Lengths = ........................ 8
+ * 8 8 8 8 8 8 8 Directory Name = ....................... .\ File Name =
+ * ............................ 8x256_tables.c
+ */
+
+uint32_t sctp_crc_tableil8_o32[256] =
+{
+ 0x00000000, 0xF26B8303, 0xE13B70F7, 0x1350F3F4, 0xC79A971F, 0x35F1141C, 0x26A1E7E8, 0xD4CA64EB,
+ 0x8AD958CF, 0x78B2DBCC, 0x6BE22838, 0x9989AB3B, 0x4D43CFD0, 0xBF284CD3, 0xAC78BF27, 0x5E133C24,
+ 0x105EC76F, 0xE235446C, 0xF165B798, 0x030E349B, 0xD7C45070, 0x25AFD373, 0x36FF2087, 0xC494A384,
+ 0x9A879FA0, 0x68EC1CA3, 0x7BBCEF57, 0x89D76C54, 0x5D1D08BF, 0xAF768BBC, 0xBC267848, 0x4E4DFB4B,
+ 0x20BD8EDE, 0xD2D60DDD, 0xC186FE29, 0x33ED7D2A, 0xE72719C1, 0x154C9AC2, 0x061C6936, 0xF477EA35,
+ 0xAA64D611, 0x580F5512, 0x4B5FA6E6, 0xB93425E5, 0x6DFE410E, 0x9F95C20D, 0x8CC531F9, 0x7EAEB2FA,
+ 0x30E349B1, 0xC288CAB2, 0xD1D83946, 0x23B3BA45, 0xF779DEAE, 0x05125DAD, 0x1642AE59, 0xE4292D5A,
+ 0xBA3A117E, 0x4851927D, 0x5B016189, 0xA96AE28A, 0x7DA08661, 0x8FCB0562, 0x9C9BF696, 0x6EF07595,
+ 0x417B1DBC, 0xB3109EBF, 0xA0406D4B, 0x522BEE48, 0x86E18AA3, 0x748A09A0, 0x67DAFA54, 0x95B17957,
+ 0xCBA24573, 0x39C9C670, 0x2A993584, 0xD8F2B687, 0x0C38D26C, 0xFE53516F, 0xED03A29B, 0x1F682198,
+ 0x5125DAD3, 0xA34E59D0, 0xB01EAA24, 0x42752927, 0x96BF4DCC, 0x64D4CECF, 0x77843D3B, 0x85EFBE38,
+ 0xDBFC821C, 0x2997011F, 0x3AC7F2EB, 0xC8AC71E8, 0x1C661503, 0xEE0D9600, 0xFD5D65F4, 0x0F36E6F7,
+ 0x61C69362, 0x93AD1061, 0x80FDE395, 0x72966096, 0xA65C047D, 0x5437877E, 0x4767748A, 0xB50CF789,
+ 0xEB1FCBAD, 0x197448AE, 0x0A24BB5A, 0xF84F3859, 0x2C855CB2, 0xDEEEDFB1, 0xCDBE2C45, 0x3FD5AF46,
+ 0x7198540D, 0x83F3D70E, 0x90A324FA, 0x62C8A7F9, 0xB602C312, 0x44694011, 0x5739B3E5, 0xA55230E6,
+ 0xFB410CC2, 0x092A8FC1, 0x1A7A7C35, 0xE811FF36, 0x3CDB9BDD, 0xCEB018DE, 0xDDE0EB2A, 0x2F8B6829,
+ 0x82F63B78, 0x709DB87B, 0x63CD4B8F, 0x91A6C88C, 0x456CAC67, 0xB7072F64, 0xA457DC90, 0x563C5F93,
+ 0x082F63B7, 0xFA44E0B4, 0xE9141340, 0x1B7F9043, 0xCFB5F4A8, 0x3DDE77AB, 0x2E8E845F, 0xDCE5075C,
+ 0x92A8FC17, 0x60C37F14, 0x73938CE0, 0x81F80FE3, 0x55326B08, 0xA759E80B, 0xB4091BFF, 0x466298FC,
+ 0x1871A4D8, 0xEA1A27DB, 0xF94AD42F, 0x0B21572C, 0xDFEB33C7, 0x2D80B0C4, 0x3ED04330, 0xCCBBC033,
+ 0xA24BB5A6, 0x502036A5, 0x4370C551, 0xB11B4652, 0x65D122B9, 0x97BAA1BA, 0x84EA524E, 0x7681D14D,
+ 0x2892ED69, 0xDAF96E6A, 0xC9A99D9E, 0x3BC21E9D, 0xEF087A76, 0x1D63F975, 0x0E330A81, 0xFC588982,
+ 0xB21572C9, 0x407EF1CA, 0x532E023E, 0xA145813D, 0x758FE5D6, 0x87E466D5, 0x94B49521, 0x66DF1622,
+ 0x38CC2A06, 0xCAA7A905, 0xD9F75AF1, 0x2B9CD9F2, 0xFF56BD19, 0x0D3D3E1A, 0x1E6DCDEE, 0xEC064EED,
+ 0xC38D26C4, 0x31E6A5C7, 0x22B65633, 0xD0DDD530, 0x0417B1DB, 0xF67C32D8, 0xE52CC12C, 0x1747422F,
+ 0x49547E0B, 0xBB3FFD08, 0xA86F0EFC, 0x5A048DFF, 0x8ECEE914, 0x7CA56A17, 0x6FF599E3, 0x9D9E1AE0,
+ 0xD3D3E1AB, 0x21B862A8, 0x32E8915C, 0xC083125F, 0x144976B4, 0xE622F5B7, 0xF5720643, 0x07198540,
+ 0x590AB964, 0xAB613A67, 0xB831C993, 0x4A5A4A90, 0x9E902E7B, 0x6CFBAD78, 0x7FAB5E8C, 0x8DC0DD8F,
+ 0xE330A81A, 0x115B2B19, 0x020BD8ED, 0xF0605BEE, 0x24AA3F05, 0xD6C1BC06, 0xC5914FF2, 0x37FACCF1,
+ 0x69E9F0D5, 0x9B8273D6, 0x88D28022, 0x7AB90321, 0xAE7367CA, 0x5C18E4C9, 0x4F48173D, 0xBD23943E,
+ 0xF36E6F75, 0x0105EC76, 0x12551F82, 0xE03E9C81, 0x34F4F86A, 0xC69F7B69, 0xD5CF889D, 0x27A40B9E,
+ 0x79B737BA, 0x8BDCB4B9, 0x988C474D, 0x6AE7C44E, 0xBE2DA0A5, 0x4C4623A6, 0x5F16D052, 0xAD7D5351
+};
+
+/*
+ * end of the CRC lookup table crc_tableil8_o32
+ */
+
+
+
+/*
+ * The following CRC lookup table was generated automagically using the
+ * following model parameters:
+ *
+ * Generator Polynomial = ................. 0x1EDC6F41 Generator Polynomial
+ * Length = .......... 32 bits Reflected Bits = ....................... TRUE
+ * Table Generation Offset = .............. 32 bits Number of Slices =
+ * ..................... 8 slices Slice Lengths = ........................ 8
+ * 8 8 8 8 8 8 8 Directory Name = ....................... .\ File Name =
+ * ............................ 8x256_tables.c
+ */
+
+uint32_t sctp_crc_tableil8_o40[256] =
+{
+ 0x00000000, 0x13A29877, 0x274530EE, 0x34E7A899, 0x4E8A61DC, 0x5D28F9AB, 0x69CF5132, 0x7A6DC945,
+ 0x9D14C3B8, 0x8EB65BCF, 0xBA51F356, 0xA9F36B21, 0xD39EA264, 0xC03C3A13, 0xF4DB928A, 0xE7790AFD,
+ 0x3FC5F181, 0x2C6769F6, 0x1880C16F, 0x0B225918, 0x714F905D, 0x62ED082A, 0x560AA0B3, 0x45A838C4,
+ 0xA2D13239, 0xB173AA4E, 0x859402D7, 0x96369AA0, 0xEC5B53E5, 0xFFF9CB92, 0xCB1E630B, 0xD8BCFB7C,
+ 0x7F8BE302, 0x6C297B75, 0x58CED3EC, 0x4B6C4B9B, 0x310182DE, 0x22A31AA9, 0x1644B230, 0x05E62A47,
+ 0xE29F20BA, 0xF13DB8CD, 0xC5DA1054, 0xD6788823, 0xAC154166, 0xBFB7D911, 0x8B507188, 0x98F2E9FF,
+ 0x404E1283, 0x53EC8AF4, 0x670B226D, 0x74A9BA1A, 0x0EC4735F, 0x1D66EB28, 0x298143B1, 0x3A23DBC6,
+ 0xDD5AD13B, 0xCEF8494C, 0xFA1FE1D5, 0xE9BD79A2, 0x93D0B0E7, 0x80722890, 0xB4958009, 0xA737187E,
+ 0xFF17C604, 0xECB55E73, 0xD852F6EA, 0xCBF06E9D, 0xB19DA7D8, 0xA23F3FAF, 0x96D89736, 0x857A0F41,
+ 0x620305BC, 0x71A19DCB, 0x45463552, 0x56E4AD25, 0x2C896460, 0x3F2BFC17, 0x0BCC548E, 0x186ECCF9,
+ 0xC0D23785, 0xD370AFF2, 0xE797076B, 0xF4359F1C, 0x8E585659, 0x9DFACE2E, 0xA91D66B7, 0xBABFFEC0,
+ 0x5DC6F43D, 0x4E646C4A, 0x7A83C4D3, 0x69215CA4, 0x134C95E1, 0x00EE0D96, 0x3409A50F, 0x27AB3D78,
+ 0x809C2506, 0x933EBD71, 0xA7D915E8, 0xB47B8D9F, 0xCE1644DA, 0xDDB4DCAD, 0xE9537434, 0xFAF1EC43,
+ 0x1D88E6BE, 0x0E2A7EC9, 0x3ACDD650, 0x296F4E27, 0x53028762, 0x40A01F15, 0x7447B78C, 0x67E52FFB,
+ 0xBF59D487, 0xACFB4CF0, 0x981CE469, 0x8BBE7C1E, 0xF1D3B55B, 0xE2712D2C, 0xD69685B5, 0xC5341DC2,
+ 0x224D173F, 0x31EF8F48, 0x050827D1, 0x16AABFA6, 0x6CC776E3, 0x7F65EE94, 0x4B82460D, 0x5820DE7A,
+ 0xFBC3FAF9, 0xE861628E, 0xDC86CA17, 0xCF245260, 0xB5499B25, 0xA6EB0352, 0x920CABCB, 0x81AE33BC,
+ 0x66D73941, 0x7575A136, 0x419209AF, 0x523091D8, 0x285D589D, 0x3BFFC0EA, 0x0F186873, 0x1CBAF004,
+ 0xC4060B78, 0xD7A4930F, 0xE3433B96, 0xF0E1A3E1, 0x8A8C6AA4, 0x992EF2D3, 0xADC95A4A, 0xBE6BC23D,
+ 0x5912C8C0, 0x4AB050B7, 0x7E57F82E, 0x6DF56059, 0x1798A91C, 0x043A316B, 0x30DD99F2, 0x237F0185,
+ 0x844819FB, 0x97EA818C, 0xA30D2915, 0xB0AFB162, 0xCAC27827, 0xD960E050, 0xED8748C9, 0xFE25D0BE,
+ 0x195CDA43, 0x0AFE4234, 0x3E19EAAD, 0x2DBB72DA, 0x57D6BB9F, 0x447423E8, 0x70938B71, 0x63311306,
+ 0xBB8DE87A, 0xA82F700D, 0x9CC8D894, 0x8F6A40E3, 0xF50789A6, 0xE6A511D1, 0xD242B948, 0xC1E0213F,
+ 0x26992BC2, 0x353BB3B5, 0x01DC1B2C, 0x127E835B, 0x68134A1E, 0x7BB1D269, 0x4F567AF0, 0x5CF4E287,
+ 0x04D43CFD, 0x1776A48A, 0x23910C13, 0x30339464, 0x4A5E5D21, 0x59FCC556, 0x6D1B6DCF, 0x7EB9F5B8,
+ 0x99C0FF45, 0x8A626732, 0xBE85CFAB, 0xAD2757DC, 0xD74A9E99, 0xC4E806EE, 0xF00FAE77, 0xE3AD3600,
+ 0x3B11CD7C, 0x28B3550B, 0x1C54FD92, 0x0FF665E5, 0x759BACA0, 0x663934D7, 0x52DE9C4E, 0x417C0439,
+ 0xA6050EC4, 0xB5A796B3, 0x81403E2A, 0x92E2A65D, 0xE88F6F18, 0xFB2DF76F, 0xCFCA5FF6, 0xDC68C781,
+ 0x7B5FDFFF, 0x68FD4788, 0x5C1AEF11, 0x4FB87766, 0x35D5BE23, 0x26772654, 0x12908ECD, 0x013216BA,
+ 0xE64B1C47, 0xF5E98430, 0xC10E2CA9, 0xD2ACB4DE, 0xA8C17D9B, 0xBB63E5EC, 0x8F844D75, 0x9C26D502,
+ 0x449A2E7E, 0x5738B609, 0x63DF1E90, 0x707D86E7, 0x0A104FA2, 0x19B2D7D5, 0x2D557F4C, 0x3EF7E73B,
+ 0xD98EEDC6, 0xCA2C75B1, 0xFECBDD28, 0xED69455F, 0x97048C1A, 0x84A6146D, 0xB041BCF4, 0xA3E32483
+};
+
+/*
+ * end of the CRC lookup table crc_tableil8_o40
+ */
+
+
+
+/*
+ * The following CRC lookup table was generated automagically using the
+ * following model parameters:
+ *
+ * Generator Polynomial = ................. 0x1EDC6F41 Generator Polynomial
+ * Length = .......... 32 bits Reflected Bits = ....................... TRUE
+ * Table Generation Offset = .............. 32 bits Number of Slices =
+ * ..................... 8 slices Slice Lengths = ........................ 8
+ * 8 8 8 8 8 8 8 Directory Name = ....................... .\ File Name =
+ * ............................ 8x256_tables.c
+ */
+
+uint32_t sctp_crc_tableil8_o48[256] =
+{
+ 0x00000000, 0xA541927E, 0x4F6F520D, 0xEA2EC073, 0x9EDEA41A, 0x3B9F3664, 0xD1B1F617, 0x74F06469,
+ 0x38513EC5, 0x9D10ACBB, 0x773E6CC8, 0xD27FFEB6, 0xA68F9ADF, 0x03CE08A1, 0xE9E0C8D2, 0x4CA15AAC,
+ 0x70A27D8A, 0xD5E3EFF4, 0x3FCD2F87, 0x9A8CBDF9, 0xEE7CD990, 0x4B3D4BEE, 0xA1138B9D, 0x045219E3,
+ 0x48F3434F, 0xEDB2D131, 0x079C1142, 0xA2DD833C, 0xD62DE755, 0x736C752B, 0x9942B558, 0x3C032726,
+ 0xE144FB14, 0x4405696A, 0xAE2BA919, 0x0B6A3B67, 0x7F9A5F0E, 0xDADBCD70, 0x30F50D03, 0x95B49F7D,
+ 0xD915C5D1, 0x7C5457AF, 0x967A97DC, 0x333B05A2, 0x47CB61CB, 0xE28AF3B5, 0x08A433C6, 0xADE5A1B8,
+ 0x91E6869E, 0x34A714E0, 0xDE89D493, 0x7BC846ED, 0x0F382284, 0xAA79B0FA, 0x40577089, 0xE516E2F7,
+ 0xA9B7B85B, 0x0CF62A25, 0xE6D8EA56, 0x43997828, 0x37691C41, 0x92288E3F, 0x78064E4C, 0xDD47DC32,
+ 0xC76580D9, 0x622412A7, 0x880AD2D4, 0x2D4B40AA, 0x59BB24C3, 0xFCFAB6BD, 0x16D476CE, 0xB395E4B0,
+ 0xFF34BE1C, 0x5A752C62, 0xB05BEC11, 0x151A7E6F, 0x61EA1A06, 0xC4AB8878, 0x2E85480B, 0x8BC4DA75,
+ 0xB7C7FD53, 0x12866F2D, 0xF8A8AF5E, 0x5DE93D20, 0x29195949, 0x8C58CB37, 0x66760B44, 0xC337993A,
+ 0x8F96C396, 0x2AD751E8, 0xC0F9919B, 0x65B803E5, 0x1148678C, 0xB409F5F2, 0x5E273581, 0xFB66A7FF,
+ 0x26217BCD, 0x8360E9B3, 0x694E29C0, 0xCC0FBBBE, 0xB8FFDFD7, 0x1DBE4DA9, 0xF7908DDA, 0x52D11FA4,
+ 0x1E704508, 0xBB31D776, 0x511F1705, 0xF45E857B, 0x80AEE112, 0x25EF736C, 0xCFC1B31F, 0x6A802161,
+ 0x56830647, 0xF3C29439, 0x19EC544A, 0xBCADC634, 0xC85DA25D, 0x6D1C3023, 0x8732F050, 0x2273622E,
+ 0x6ED23882, 0xCB93AAFC, 0x21BD6A8F, 0x84FCF8F1, 0xF00C9C98, 0x554D0EE6, 0xBF63CE95, 0x1A225CEB,
+ 0x8B277743, 0x2E66E53D, 0xC448254E, 0x6109B730, 0x15F9D359, 0xB0B84127, 0x5A968154, 0xFFD7132A,
+ 0xB3764986, 0x1637DBF8, 0xFC191B8B, 0x595889F5, 0x2DA8ED9C, 0x88E97FE2, 0x62C7BF91, 0xC7862DEF,
+ 0xFB850AC9, 0x5EC498B7, 0xB4EA58C4, 0x11ABCABA, 0x655BAED3, 0xC01A3CAD, 0x2A34FCDE, 0x8F756EA0,
+ 0xC3D4340C, 0x6695A672, 0x8CBB6601, 0x29FAF47F, 0x5D0A9016, 0xF84B0268, 0x1265C21B, 0xB7245065,
+ 0x6A638C57, 0xCF221E29, 0x250CDE5A, 0x804D4C24, 0xF4BD284D, 0x51FCBA33, 0xBBD27A40, 0x1E93E83E,
+ 0x5232B292, 0xF77320EC, 0x1D5DE09F, 0xB81C72E1, 0xCCEC1688, 0x69AD84F6, 0x83834485, 0x26C2D6FB,
+ 0x1AC1F1DD, 0xBF8063A3, 0x55AEA3D0, 0xF0EF31AE, 0x841F55C7, 0x215EC7B9, 0xCB7007CA, 0x6E3195B4,
+ 0x2290CF18, 0x87D15D66, 0x6DFF9D15, 0xC8BE0F6B, 0xBC4E6B02, 0x190FF97C, 0xF321390F, 0x5660AB71,
+ 0x4C42F79A, 0xE90365E4, 0x032DA597, 0xA66C37E9, 0xD29C5380, 0x77DDC1FE, 0x9DF3018D, 0x38B293F3,
+ 0x7413C95F, 0xD1525B21, 0x3B7C9B52, 0x9E3D092C, 0xEACD6D45, 0x4F8CFF3B, 0xA5A23F48, 0x00E3AD36,
+ 0x3CE08A10, 0x99A1186E, 0x738FD81D, 0xD6CE4A63, 0xA23E2E0A, 0x077FBC74, 0xED517C07, 0x4810EE79,
+ 0x04B1B4D5, 0xA1F026AB, 0x4BDEE6D8, 0xEE9F74A6, 0x9A6F10CF, 0x3F2E82B1, 0xD50042C2, 0x7041D0BC,
+ 0xAD060C8E, 0x08479EF0, 0xE2695E83, 0x4728CCFD, 0x33D8A894, 0x96993AEA, 0x7CB7FA99, 0xD9F668E7,
+ 0x9557324B, 0x3016A035, 0xDA386046, 0x7F79F238, 0x0B899651, 0xAEC8042F, 0x44E6C45C, 0xE1A75622,
+ 0xDDA47104, 0x78E5E37A, 0x92CB2309, 0x378AB177, 0x437AD51E, 0xE63B4760, 0x0C158713, 0xA954156D,
+ 0xE5F54FC1, 0x40B4DDBF, 0xAA9A1DCC, 0x0FDB8FB2, 0x7B2BEBDB, 0xDE6A79A5, 0x3444B9D6, 0x91052BA8
+};
+
+/*
+ * end of the CRC lookup table crc_tableil8_o48
+ */
+
+
+
+/*
+ * The following CRC lookup table was generated automagically using the
+ * following model parameters:
+ *
+ * Generator Polynomial = ................. 0x1EDC6F41 Generator Polynomial
+ * Length = .......... 32 bits Reflected Bits = ....................... TRUE
+ * Table Generation Offset = .............. 32 bits Number of Slices =
+ * ..................... 8 slices Slice Lengths = ........................ 8
+ * 8 8 8 8 8 8 8 Directory Name = ....................... .\ File Name =
+ * ............................ 8x256_tables.c
+ */
+
+uint32_t sctp_crc_tableil8_o56[256] =
+{
+ 0x00000000, 0xDD45AAB8, 0xBF672381, 0x62228939, 0x7B2231F3, 0xA6679B4B, 0xC4451272, 0x1900B8CA,
+ 0xF64463E6, 0x2B01C95E, 0x49234067, 0x9466EADF, 0x8D665215, 0x5023F8AD, 0x32017194, 0xEF44DB2C,
+ 0xE964B13D, 0x34211B85, 0x560392BC, 0x8B463804, 0x924680CE, 0x4F032A76, 0x2D21A34F, 0xF06409F7,
+ 0x1F20D2DB, 0xC2657863, 0xA047F15A, 0x7D025BE2, 0x6402E328, 0xB9474990, 0xDB65C0A9, 0x06206A11,
+ 0xD725148B, 0x0A60BE33, 0x6842370A, 0xB5079DB2, 0xAC072578, 0x71428FC0, 0x136006F9, 0xCE25AC41,
+ 0x2161776D, 0xFC24DDD5, 0x9E0654EC, 0x4343FE54, 0x5A43469E, 0x8706EC26, 0xE524651F, 0x3861CFA7,
+ 0x3E41A5B6, 0xE3040F0E, 0x81268637, 0x5C632C8F, 0x45639445, 0x98263EFD, 0xFA04B7C4, 0x27411D7C,
+ 0xC805C650, 0x15406CE8, 0x7762E5D1, 0xAA274F69, 0xB327F7A3, 0x6E625D1B, 0x0C40D422, 0xD1057E9A,
+ 0xABA65FE7, 0x76E3F55F, 0x14C17C66, 0xC984D6DE, 0xD0846E14, 0x0DC1C4AC, 0x6FE34D95, 0xB2A6E72D,
+ 0x5DE23C01, 0x80A796B9, 0xE2851F80, 0x3FC0B538, 0x26C00DF2, 0xFB85A74A, 0x99A72E73, 0x44E284CB,
+ 0x42C2EEDA, 0x9F874462, 0xFDA5CD5B, 0x20E067E3, 0x39E0DF29, 0xE4A57591, 0x8687FCA8, 0x5BC25610,
+ 0xB4868D3C, 0x69C32784, 0x0BE1AEBD, 0xD6A40405, 0xCFA4BCCF, 0x12E11677, 0x70C39F4E, 0xAD8635F6,
+ 0x7C834B6C, 0xA1C6E1D4, 0xC3E468ED, 0x1EA1C255, 0x07A17A9F, 0xDAE4D027, 0xB8C6591E, 0x6583F3A6,
+ 0x8AC7288A, 0x57828232, 0x35A00B0B, 0xE8E5A1B3, 0xF1E51979, 0x2CA0B3C1, 0x4E823AF8, 0x93C79040,
+ 0x95E7FA51, 0x48A250E9, 0x2A80D9D0, 0xF7C57368, 0xEEC5CBA2, 0x3380611A, 0x51A2E823, 0x8CE7429B,
+ 0x63A399B7, 0xBEE6330F, 0xDCC4BA36, 0x0181108E, 0x1881A844, 0xC5C402FC, 0xA7E68BC5, 0x7AA3217D,
+ 0x52A0C93F, 0x8FE56387, 0xEDC7EABE, 0x30824006, 0x2982F8CC, 0xF4C75274, 0x96E5DB4D, 0x4BA071F5,
+ 0xA4E4AAD9, 0x79A10061, 0x1B838958, 0xC6C623E0, 0xDFC69B2A, 0x02833192, 0x60A1B8AB, 0xBDE41213,
+ 0xBBC47802, 0x6681D2BA, 0x04A35B83, 0xD9E6F13B, 0xC0E649F1, 0x1DA3E349, 0x7F816A70, 0xA2C4C0C8,
+ 0x4D801BE4, 0x90C5B15C, 0xF2E73865, 0x2FA292DD, 0x36A22A17, 0xEBE780AF, 0x89C50996, 0x5480A32E,
+ 0x8585DDB4, 0x58C0770C, 0x3AE2FE35, 0xE7A7548D, 0xFEA7EC47, 0x23E246FF, 0x41C0CFC6, 0x9C85657E,
+ 0x73C1BE52, 0xAE8414EA, 0xCCA69DD3, 0x11E3376B, 0x08E38FA1, 0xD5A62519, 0xB784AC20, 0x6AC10698,
+ 0x6CE16C89, 0xB1A4C631, 0xD3864F08, 0x0EC3E5B0, 0x17C35D7A, 0xCA86F7C2, 0xA8A47EFB, 0x75E1D443,
+ 0x9AA50F6F, 0x47E0A5D7, 0x25C22CEE, 0xF8878656, 0xE1873E9C, 0x3CC29424, 0x5EE01D1D, 0x83A5B7A5,
+ 0xF90696D8, 0x24433C60, 0x4661B559, 0x9B241FE1, 0x8224A72B, 0x5F610D93, 0x3D4384AA, 0xE0062E12,
+ 0x0F42F53E, 0xD2075F86, 0xB025D6BF, 0x6D607C07, 0x7460C4CD, 0xA9256E75, 0xCB07E74C, 0x16424DF4,
+ 0x106227E5, 0xCD278D5D, 0xAF050464, 0x7240AEDC, 0x6B401616, 0xB605BCAE, 0xD4273597, 0x09629F2F,
+ 0xE6264403, 0x3B63EEBB, 0x59416782, 0x8404CD3A, 0x9D0475F0, 0x4041DF48, 0x22635671, 0xFF26FCC9,
+ 0x2E238253, 0xF36628EB, 0x9144A1D2, 0x4C010B6A, 0x5501B3A0, 0x88441918, 0xEA669021, 0x37233A99,
+ 0xD867E1B5, 0x05224B0D, 0x6700C234, 0xBA45688C, 0xA345D046, 0x7E007AFE, 0x1C22F3C7, 0xC167597F,
+ 0xC747336E, 0x1A0299D6, 0x782010EF, 0xA565BA57, 0xBC65029D, 0x6120A825, 0x0302211C, 0xDE478BA4,
+ 0x31035088, 0xEC46FA30, 0x8E647309, 0x5321D9B1, 0x4A21617B, 0x9764CBC3, 0xF54642FA, 0x2803E842
+};
+
+/*
+ * end of the CRC lookup table crc_tableil8_o56
+ */
+
+
+
+/*
+ * The following CRC lookup table was generated automagically using the
+ * following model parameters:
+ *
+ * Generator Polynomial = ................. 0x1EDC6F41 Generator Polynomial
+ * Length = .......... 32 bits Reflected Bits = ....................... TRUE
+ * Table Generation Offset = .............. 32 bits Number of Slices =
+ * ..................... 8 slices Slice Lengths = ........................ 8
+ * 8 8 8 8 8 8 8 Directory Name = ....................... .\ File Name =
+ * ............................ 8x256_tables.c
+ */
+
+uint32_t sctp_crc_tableil8_o64[256] =
+{
+ 0x00000000, 0x38116FAC, 0x7022DF58, 0x4833B0F4, 0xE045BEB0, 0xD854D11C, 0x906761E8, 0xA8760E44,
+ 0xC5670B91, 0xFD76643D, 0xB545D4C9, 0x8D54BB65, 0x2522B521, 0x1D33DA8D, 0x55006A79, 0x6D1105D5,
+ 0x8F2261D3, 0xB7330E7F, 0xFF00BE8B, 0xC711D127, 0x6F67DF63, 0x5776B0CF, 0x1F45003B, 0x27546F97,
+ 0x4A456A42, 0x725405EE, 0x3A67B51A, 0x0276DAB6, 0xAA00D4F2, 0x9211BB5E, 0xDA220BAA, 0xE2336406,
+ 0x1BA8B557, 0x23B9DAFB, 0x6B8A6A0F, 0x539B05A3, 0xFBED0BE7, 0xC3FC644B, 0x8BCFD4BF, 0xB3DEBB13,
+ 0xDECFBEC6, 0xE6DED16A, 0xAEED619E, 0x96FC0E32, 0x3E8A0076, 0x069B6FDA, 0x4EA8DF2E, 0x76B9B082,
+ 0x948AD484, 0xAC9BBB28, 0xE4A80BDC, 0xDCB96470, 0x74CF6A34, 0x4CDE0598, 0x04EDB56C, 0x3CFCDAC0,
+ 0x51EDDF15, 0x69FCB0B9, 0x21CF004D, 0x19DE6FE1, 0xB1A861A5, 0x89B90E09, 0xC18ABEFD, 0xF99BD151,
+ 0x37516AAE, 0x0F400502, 0x4773B5F6, 0x7F62DA5A, 0xD714D41E, 0xEF05BBB2, 0xA7360B46, 0x9F2764EA,
+ 0xF236613F, 0xCA270E93, 0x8214BE67, 0xBA05D1CB, 0x1273DF8F, 0x2A62B023, 0x625100D7, 0x5A406F7B,
+ 0xB8730B7D, 0x806264D1, 0xC851D425, 0xF040BB89, 0x5836B5CD, 0x6027DA61, 0x28146A95, 0x10050539,
+ 0x7D1400EC, 0x45056F40, 0x0D36DFB4, 0x3527B018, 0x9D51BE5C, 0xA540D1F0, 0xED736104, 0xD5620EA8,
+ 0x2CF9DFF9, 0x14E8B055, 0x5CDB00A1, 0x64CA6F0D, 0xCCBC6149, 0xF4AD0EE5, 0xBC9EBE11, 0x848FD1BD,
+ 0xE99ED468, 0xD18FBBC4, 0x99BC0B30, 0xA1AD649C, 0x09DB6AD8, 0x31CA0574, 0x79F9B580, 0x41E8DA2C,
+ 0xA3DBBE2A, 0x9BCAD186, 0xD3F96172, 0xEBE80EDE, 0x439E009A, 0x7B8F6F36, 0x33BCDFC2, 0x0BADB06E,
+ 0x66BCB5BB, 0x5EADDA17, 0x169E6AE3, 0x2E8F054F, 0x86F90B0B, 0xBEE864A7, 0xF6DBD453, 0xCECABBFF,
+ 0x6EA2D55C, 0x56B3BAF0, 0x1E800A04, 0x269165A8, 0x8EE76BEC, 0xB6F60440, 0xFEC5B4B4, 0xC6D4DB18,
+ 0xABC5DECD, 0x93D4B161, 0xDBE70195, 0xE3F66E39, 0x4B80607D, 0x73910FD1, 0x3BA2BF25, 0x03B3D089,
+ 0xE180B48F, 0xD991DB23, 0x91A26BD7, 0xA9B3047B, 0x01C50A3F, 0x39D46593, 0x71E7D567, 0x49F6BACB,
+ 0x24E7BF1E, 0x1CF6D0B2, 0x54C56046, 0x6CD40FEA, 0xC4A201AE, 0xFCB36E02, 0xB480DEF6, 0x8C91B15A,
+ 0x750A600B, 0x4D1B0FA7, 0x0528BF53, 0x3D39D0FF, 0x954FDEBB, 0xAD5EB117, 0xE56D01E3, 0xDD7C6E4F,
+ 0xB06D6B9A, 0x887C0436, 0xC04FB4C2, 0xF85EDB6E, 0x5028D52A, 0x6839BA86, 0x200A0A72, 0x181B65DE,
+ 0xFA2801D8, 0xC2396E74, 0x8A0ADE80, 0xB21BB12C, 0x1A6DBF68, 0x227CD0C4, 0x6A4F6030, 0x525E0F9C,
+ 0x3F4F0A49, 0x075E65E5, 0x4F6DD511, 0x777CBABD, 0xDF0AB4F9, 0xE71BDB55, 0xAF286BA1, 0x9739040D,
+ 0x59F3BFF2, 0x61E2D05E, 0x29D160AA, 0x11C00F06, 0xB9B60142, 0x81A76EEE, 0xC994DE1A, 0xF185B1B6,
+ 0x9C94B463, 0xA485DBCF, 0xECB66B3B, 0xD4A70497, 0x7CD10AD3, 0x44C0657F, 0x0CF3D58B, 0x34E2BA27,
+ 0xD6D1DE21, 0xEEC0B18D, 0xA6F30179, 0x9EE26ED5, 0x36946091, 0x0E850F3D, 0x46B6BFC9, 0x7EA7D065,
+ 0x13B6D5B0, 0x2BA7BA1C, 0x63940AE8, 0x5B856544, 0xF3F36B00, 0xCBE204AC, 0x83D1B458, 0xBBC0DBF4,
+ 0x425B0AA5, 0x7A4A6509, 0x3279D5FD, 0x0A68BA51, 0xA21EB415, 0x9A0FDBB9, 0xD23C6B4D, 0xEA2D04E1,
+ 0x873C0134, 0xBF2D6E98, 0xF71EDE6C, 0xCF0FB1C0, 0x6779BF84, 0x5F68D028, 0x175B60DC, 0x2F4A0F70,
+ 0xCD796B76, 0xF56804DA, 0xBD5BB42E, 0x854ADB82, 0x2D3CD5C6, 0x152DBA6A, 0x5D1E0A9E, 0x650F6532,
+ 0x081E60E7, 0x300F0F4B, 0x783CBFBF, 0x402DD013, 0xE85BDE57, 0xD04AB1FB, 0x9879010F, 0xA0686EA3
+};
+
+/*
+ * end of the CRC lookup table crc_tableil8_o64
+ */
+
+
+
+/*
+ * The following CRC lookup table was generated automagically using the
+ * following model parameters:
+ *
+ * Generator Polynomial = ................. 0x1EDC6F41 Generator Polynomial
+ * Length = .......... 32 bits Reflected Bits = ....................... TRUE
+ * Table Generation Offset = .............. 32 bits Number of Slices =
+ * ..................... 8 slices Slice Lengths = ........................ 8
+ * 8 8 8 8 8 8 8 Directory Name = ....................... .\ File Name =
+ * ............................ 8x256_tables.c
+ */
+
+uint32_t sctp_crc_tableil8_o72[256] =
+{
+ 0x00000000, 0xEF306B19, 0xDB8CA0C3, 0x34BCCBDA, 0xB2F53777, 0x5DC55C6E, 0x697997B4, 0x8649FCAD,
+ 0x6006181F, 0x8F367306, 0xBB8AB8DC, 0x54BAD3C5, 0xD2F32F68, 0x3DC34471, 0x097F8FAB, 0xE64FE4B2,
+ 0xC00C303E, 0x2F3C5B27, 0x1B8090FD, 0xF4B0FBE4, 0x72F90749, 0x9DC96C50, 0xA975A78A, 0x4645CC93,
+ 0xA00A2821, 0x4F3A4338, 0x7B8688E2, 0x94B6E3FB, 0x12FF1F56, 0xFDCF744F, 0xC973BF95, 0x2643D48C,
+ 0x85F4168D, 0x6AC47D94, 0x5E78B64E, 0xB148DD57, 0x370121FA, 0xD8314AE3, 0xEC8D8139, 0x03BDEA20,
+ 0xE5F20E92, 0x0AC2658B, 0x3E7EAE51, 0xD14EC548, 0x570739E5, 0xB83752FC, 0x8C8B9926, 0x63BBF23F,
+ 0x45F826B3, 0xAAC84DAA, 0x9E748670, 0x7144ED69, 0xF70D11C4, 0x183D7ADD, 0x2C81B107, 0xC3B1DA1E,
+ 0x25FE3EAC, 0xCACE55B5, 0xFE729E6F, 0x1142F576, 0x970B09DB, 0x783B62C2, 0x4C87A918, 0xA3B7C201,
+ 0x0E045BEB, 0xE13430F2, 0xD588FB28, 0x3AB89031, 0xBCF16C9C, 0x53C10785, 0x677DCC5F, 0x884DA746,
+ 0x6E0243F4, 0x813228ED, 0xB58EE337, 0x5ABE882E, 0xDCF77483, 0x33C71F9A, 0x077BD440, 0xE84BBF59,
+ 0xCE086BD5, 0x213800CC, 0x1584CB16, 0xFAB4A00F, 0x7CFD5CA2, 0x93CD37BB, 0xA771FC61, 0x48419778,
+ 0xAE0E73CA, 0x413E18D3, 0x7582D309, 0x9AB2B810, 0x1CFB44BD, 0xF3CB2FA4, 0xC777E47E, 0x28478F67,
+ 0x8BF04D66, 0x64C0267F, 0x507CEDA5, 0xBF4C86BC, 0x39057A11, 0xD6351108, 0xE289DAD2, 0x0DB9B1CB,
+ 0xEBF65579, 0x04C63E60, 0x307AF5BA, 0xDF4A9EA3, 0x5903620E, 0xB6330917, 0x828FC2CD, 0x6DBFA9D4,
+ 0x4BFC7D58, 0xA4CC1641, 0x9070DD9B, 0x7F40B682, 0xF9094A2F, 0x16392136, 0x2285EAEC, 0xCDB581F5,
+ 0x2BFA6547, 0xC4CA0E5E, 0xF076C584, 0x1F46AE9D, 0x990F5230, 0x763F3929, 0x4283F2F3, 0xADB399EA,
+ 0x1C08B7D6, 0xF338DCCF, 0xC7841715, 0x28B47C0C, 0xAEFD80A1, 0x41CDEBB8, 0x75712062, 0x9A414B7B,
+ 0x7C0EAFC9, 0x933EC4D0, 0xA7820F0A, 0x48B26413, 0xCEFB98BE, 0x21CBF3A7, 0x1577387D, 0xFA475364,
+ 0xDC0487E8, 0x3334ECF1, 0x0788272B, 0xE8B84C32, 0x6EF1B09F, 0x81C1DB86, 0xB57D105C, 0x5A4D7B45,
+ 0xBC029FF7, 0x5332F4EE, 0x678E3F34, 0x88BE542D, 0x0EF7A880, 0xE1C7C399, 0xD57B0843, 0x3A4B635A,
+ 0x99FCA15B, 0x76CCCA42, 0x42700198, 0xAD406A81, 0x2B09962C, 0xC439FD35, 0xF08536EF, 0x1FB55DF6,
+ 0xF9FAB944, 0x16CAD25D, 0x22761987, 0xCD46729E, 0x4B0F8E33, 0xA43FE52A, 0x90832EF0, 0x7FB345E9,
+ 0x59F09165, 0xB6C0FA7C, 0x827C31A6, 0x6D4C5ABF, 0xEB05A612, 0x0435CD0B, 0x308906D1, 0xDFB96DC8,
+ 0x39F6897A, 0xD6C6E263, 0xE27A29B9, 0x0D4A42A0, 0x8B03BE0D, 0x6433D514, 0x508F1ECE, 0xBFBF75D7,
+ 0x120CEC3D, 0xFD3C8724, 0xC9804CFE, 0x26B027E7, 0xA0F9DB4A, 0x4FC9B053, 0x7B757B89, 0x94451090,
+ 0x720AF422, 0x9D3A9F3B, 0xA98654E1, 0x46B63FF8, 0xC0FFC355, 0x2FCFA84C, 0x1B736396, 0xF443088F,
+ 0xD200DC03, 0x3D30B71A, 0x098C7CC0, 0xE6BC17D9, 0x60F5EB74, 0x8FC5806D, 0xBB794BB7, 0x544920AE,
+ 0xB206C41C, 0x5D36AF05, 0x698A64DF, 0x86BA0FC6, 0x00F3F36B, 0xEFC39872, 0xDB7F53A8, 0x344F38B1,
+ 0x97F8FAB0, 0x78C891A9, 0x4C745A73, 0xA344316A, 0x250DCDC7, 0xCA3DA6DE, 0xFE816D04, 0x11B1061D,
+ 0xF7FEE2AF, 0x18CE89B6, 0x2C72426C, 0xC3422975, 0x450BD5D8, 0xAA3BBEC1, 0x9E87751B, 0x71B71E02,
+ 0x57F4CA8E, 0xB8C4A197, 0x8C786A4D, 0x63480154, 0xE501FDF9, 0x0A3196E0, 0x3E8D5D3A, 0xD1BD3623,
+ 0x37F2D291, 0xD8C2B988, 0xEC7E7252, 0x034E194B, 0x8507E5E6, 0x6A378EFF, 0x5E8B4525, 0xB1BB2E3C
+};
+
+/*
+ * end of the CRC lookup table crc_tableil8_o72
+ */
+
+
+
+/*
+ * The following CRC lookup table was generated automagically using the
+ * following model parameters:
+ *
+ * Generator Polynomial = ................. 0x1EDC6F41 Generator Polynomial
+ * Length = .......... 32 bits Reflected Bits = ....................... TRUE
+ * Table Generation Offset = .............. 32 bits Number of Slices =
+ * ..................... 8 slices Slice Lengths = ........................ 8
+ * 8 8 8 8 8 8 8 Directory Name = ....................... .\ File Name =
+ * ............................ 8x256_tables.c
+ */
+
+uint32_t sctp_crc_tableil8_o80[256] =
+{
+ 0x00000000, 0x68032CC8, 0xD0065990, 0xB8057558, 0xA5E0C5D1, 0xCDE3E919, 0x75E69C41, 0x1DE5B089,
+ 0x4E2DFD53, 0x262ED19B, 0x9E2BA4C3, 0xF628880B, 0xEBCD3882, 0x83CE144A, 0x3BCB6112, 0x53C84DDA,
+ 0x9C5BFAA6, 0xF458D66E, 0x4C5DA336, 0x245E8FFE, 0x39BB3F77, 0x51B813BF, 0xE9BD66E7, 0x81BE4A2F,
+ 0xD27607F5, 0xBA752B3D, 0x02705E65, 0x6A7372AD, 0x7796C224, 0x1F95EEEC, 0xA7909BB4, 0xCF93B77C,
+ 0x3D5B83BD, 0x5558AF75, 0xED5DDA2D, 0x855EF6E5, 0x98BB466C, 0xF0B86AA4, 0x48BD1FFC, 0x20BE3334,
+ 0x73767EEE, 0x1B755226, 0xA370277E, 0xCB730BB6, 0xD696BB3F, 0xBE9597F7, 0x0690E2AF, 0x6E93CE67,
+ 0xA100791B, 0xC90355D3, 0x7106208B, 0x19050C43, 0x04E0BCCA, 0x6CE39002, 0xD4E6E55A, 0xBCE5C992,
+ 0xEF2D8448, 0x872EA880, 0x3F2BDDD8, 0x5728F110, 0x4ACD4199, 0x22CE6D51, 0x9ACB1809, 0xF2C834C1,
+ 0x7AB7077A, 0x12B42BB2, 0xAAB15EEA, 0xC2B27222, 0xDF57C2AB, 0xB754EE63, 0x0F519B3B, 0x6752B7F3,
+ 0x349AFA29, 0x5C99D6E1, 0xE49CA3B9, 0x8C9F8F71, 0x917A3FF8, 0xF9791330, 0x417C6668, 0x297F4AA0,
+ 0xE6ECFDDC, 0x8EEFD114, 0x36EAA44C, 0x5EE98884, 0x430C380D, 0x2B0F14C5, 0x930A619D, 0xFB094D55,
+ 0xA8C1008F, 0xC0C22C47, 0x78C7591F, 0x10C475D7, 0x0D21C55E, 0x6522E996, 0xDD279CCE, 0xB524B006,
+ 0x47EC84C7, 0x2FEFA80F, 0x97EADD57, 0xFFE9F19F, 0xE20C4116, 0x8A0F6DDE, 0x320A1886, 0x5A09344E,
+ 0x09C17994, 0x61C2555C, 0xD9C72004, 0xB1C40CCC, 0xAC21BC45, 0xC422908D, 0x7C27E5D5, 0x1424C91D,
+ 0xDBB77E61, 0xB3B452A9, 0x0BB127F1, 0x63B20B39, 0x7E57BBB0, 0x16549778, 0xAE51E220, 0xC652CEE8,
+ 0x959A8332, 0xFD99AFFA, 0x459CDAA2, 0x2D9FF66A, 0x307A46E3, 0x58796A2B, 0xE07C1F73, 0x887F33BB,
+ 0xF56E0EF4, 0x9D6D223C, 0x25685764, 0x4D6B7BAC, 0x508ECB25, 0x388DE7ED, 0x808892B5, 0xE88BBE7D,
+ 0xBB43F3A7, 0xD340DF6F, 0x6B45AA37, 0x034686FF, 0x1EA33676, 0x76A01ABE, 0xCEA56FE6, 0xA6A6432E,
+ 0x6935F452, 0x0136D89A, 0xB933ADC2, 0xD130810A, 0xCCD53183, 0xA4D61D4B, 0x1CD36813, 0x74D044DB,
+ 0x27180901, 0x4F1B25C9, 0xF71E5091, 0x9F1D7C59, 0x82F8CCD0, 0xEAFBE018, 0x52FE9540, 0x3AFDB988,
+ 0xC8358D49, 0xA036A181, 0x1833D4D9, 0x7030F811, 0x6DD54898, 0x05D66450, 0xBDD31108, 0xD5D03DC0,
+ 0x8618701A, 0xEE1B5CD2, 0x561E298A, 0x3E1D0542, 0x23F8B5CB, 0x4BFB9903, 0xF3FEEC5B, 0x9BFDC093,
+ 0x546E77EF, 0x3C6D5B27, 0x84682E7F, 0xEC6B02B7, 0xF18EB23E, 0x998D9EF6, 0x2188EBAE, 0x498BC766,
+ 0x1A438ABC, 0x7240A674, 0xCA45D32C, 0xA246FFE4, 0xBFA34F6D, 0xD7A063A5, 0x6FA516FD, 0x07A63A35,
+ 0x8FD9098E, 0xE7DA2546, 0x5FDF501E, 0x37DC7CD6, 0x2A39CC5F, 0x423AE097, 0xFA3F95CF, 0x923CB907,
+ 0xC1F4F4DD, 0xA9F7D815, 0x11F2AD4D, 0x79F18185, 0x6414310C, 0x0C171DC4, 0xB412689C, 0xDC114454,
+ 0x1382F328, 0x7B81DFE0, 0xC384AAB8, 0xAB878670, 0xB66236F9, 0xDE611A31, 0x66646F69, 0x0E6743A1,
+ 0x5DAF0E7B, 0x35AC22B3, 0x8DA957EB, 0xE5AA7B23, 0xF84FCBAA, 0x904CE762, 0x2849923A, 0x404ABEF2,
+ 0xB2828A33, 0xDA81A6FB, 0x6284D3A3, 0x0A87FF6B, 0x17624FE2, 0x7F61632A, 0xC7641672, 0xAF673ABA,
+ 0xFCAF7760, 0x94AC5BA8, 0x2CA92EF0, 0x44AA0238, 0x594FB2B1, 0x314C9E79, 0x8949EB21, 0xE14AC7E9,
+ 0x2ED97095, 0x46DA5C5D, 0xFEDF2905, 0x96DC05CD, 0x8B39B544, 0xE33A998C, 0x5B3FECD4, 0x333CC01C,
+ 0x60F48DC6, 0x08F7A10E, 0xB0F2D456, 0xD8F1F89E, 0xC5144817, 0xAD1764DF, 0x15121187, 0x7D113D4F
+};
+
+/*
+ * end of the CRC lookup table crc_tableil8_o80
+ */
+
+
+
+/*
+ * The following CRC lookup table was generated automagically using the
+ * following model parameters:
+ *
+ * Generator Polynomial = ................. 0x1EDC6F41 Generator Polynomial
+ * Length = .......... 32 bits Reflected Bits = ....................... TRUE
+ * Table Generation Offset = .............. 32 bits Number of Slices =
+ * ..................... 8 slices Slice Lengths = ........................ 8
+ * 8 8 8 8 8 8 8 Directory Name = ....................... .\ File Name =
+ * ............................ 8x256_tables.c
+ */
+
+uint32_t sctp_crc_tableil8_o88[256] =
+{
+ 0x00000000, 0x493C7D27, 0x9278FA4E, 0xDB448769, 0x211D826D, 0x6821FF4A, 0xB3657823, 0xFA590504,
+ 0x423B04DA, 0x0B0779FD, 0xD043FE94, 0x997F83B3, 0x632686B7, 0x2A1AFB90, 0xF15E7CF9, 0xB86201DE,
+ 0x847609B4, 0xCD4A7493, 0x160EF3FA, 0x5F328EDD, 0xA56B8BD9, 0xEC57F6FE, 0x37137197, 0x7E2F0CB0,
+ 0xC64D0D6E, 0x8F717049, 0x5435F720, 0x1D098A07, 0xE7508F03, 0xAE6CF224, 0x7528754D, 0x3C14086A,
+ 0x0D006599, 0x443C18BE, 0x9F789FD7, 0xD644E2F0, 0x2C1DE7F4, 0x65219AD3, 0xBE651DBA, 0xF759609D,
+ 0x4F3B6143, 0x06071C64, 0xDD439B0D, 0x947FE62A, 0x6E26E32E, 0x271A9E09, 0xFC5E1960, 0xB5626447,
+ 0x89766C2D, 0xC04A110A, 0x1B0E9663, 0x5232EB44, 0xA86BEE40, 0xE1579367, 0x3A13140E, 0x732F6929,
+ 0xCB4D68F7, 0x827115D0, 0x593592B9, 0x1009EF9E, 0xEA50EA9A, 0xA36C97BD, 0x782810D4, 0x31146DF3,
+ 0x1A00CB32, 0x533CB615, 0x8878317C, 0xC1444C5B, 0x3B1D495F, 0x72213478, 0xA965B311, 0xE059CE36,
+ 0x583BCFE8, 0x1107B2CF, 0xCA4335A6, 0x837F4881, 0x79264D85, 0x301A30A2, 0xEB5EB7CB, 0xA262CAEC,
+ 0x9E76C286, 0xD74ABFA1, 0x0C0E38C8, 0x453245EF, 0xBF6B40EB, 0xF6573DCC, 0x2D13BAA5, 0x642FC782,
+ 0xDC4DC65C, 0x9571BB7B, 0x4E353C12, 0x07094135, 0xFD504431, 0xB46C3916, 0x6F28BE7F, 0x2614C358,
+ 0x1700AEAB, 0x5E3CD38C, 0x857854E5, 0xCC4429C2, 0x361D2CC6, 0x7F2151E1, 0xA465D688, 0xED59ABAF,
+ 0x553BAA71, 0x1C07D756, 0xC743503F, 0x8E7F2D18, 0x7426281C, 0x3D1A553B, 0xE65ED252, 0xAF62AF75,
+ 0x9376A71F, 0xDA4ADA38, 0x010E5D51, 0x48322076, 0xB26B2572, 0xFB575855, 0x2013DF3C, 0x692FA21B,
+ 0xD14DA3C5, 0x9871DEE2, 0x4335598B, 0x0A0924AC, 0xF05021A8, 0xB96C5C8F, 0x6228DBE6, 0x2B14A6C1,
+ 0x34019664, 0x7D3DEB43, 0xA6796C2A, 0xEF45110D, 0x151C1409, 0x5C20692E, 0x8764EE47, 0xCE589360,
+ 0x763A92BE, 0x3F06EF99, 0xE44268F0, 0xAD7E15D7, 0x572710D3, 0x1E1B6DF4, 0xC55FEA9D, 0x8C6397BA,
+ 0xB0779FD0, 0xF94BE2F7, 0x220F659E, 0x6B3318B9, 0x916A1DBD, 0xD856609A, 0x0312E7F3, 0x4A2E9AD4,
+ 0xF24C9B0A, 0xBB70E62D, 0x60346144, 0x29081C63, 0xD3511967, 0x9A6D6440, 0x4129E329, 0x08159E0E,
+ 0x3901F3FD, 0x703D8EDA, 0xAB7909B3, 0xE2457494, 0x181C7190, 0x51200CB7, 0x8A648BDE, 0xC358F6F9,
+ 0x7B3AF727, 0x32068A00, 0xE9420D69, 0xA07E704E, 0x5A27754A, 0x131B086D, 0xC85F8F04, 0x8163F223,
+ 0xBD77FA49, 0xF44B876E, 0x2F0F0007, 0x66337D20, 0x9C6A7824, 0xD5560503, 0x0E12826A, 0x472EFF4D,
+ 0xFF4CFE93, 0xB67083B4, 0x6D3404DD, 0x240879FA, 0xDE517CFE, 0x976D01D9, 0x4C2986B0, 0x0515FB97,
+ 0x2E015D56, 0x673D2071, 0xBC79A718, 0xF545DA3F, 0x0F1CDF3B, 0x4620A21C, 0x9D642575, 0xD4585852,
+ 0x6C3A598C, 0x250624AB, 0xFE42A3C2, 0xB77EDEE5, 0x4D27DBE1, 0x041BA6C6, 0xDF5F21AF, 0x96635C88,
+ 0xAA7754E2, 0xE34B29C5, 0x380FAEAC, 0x7133D38B, 0x8B6AD68F, 0xC256ABA8, 0x19122CC1, 0x502E51E6,
+ 0xE84C5038, 0xA1702D1F, 0x7A34AA76, 0x3308D751, 0xC951D255, 0x806DAF72, 0x5B29281B, 0x1215553C,
+ 0x230138CF, 0x6A3D45E8, 0xB179C281, 0xF845BFA6, 0x021CBAA2, 0x4B20C785, 0x906440EC, 0xD9583DCB,
+ 0x613A3C15, 0x28064132, 0xF342C65B, 0xBA7EBB7C, 0x4027BE78, 0x091BC35F, 0xD25F4436, 0x9B633911,
+ 0xA777317B, 0xEE4B4C5C, 0x350FCB35, 0x7C33B612, 0x866AB316, 0xCF56CE31, 0x14124958, 0x5D2E347F,
+ 0xE54C35A1, 0xAC704886, 0x7734CFEF, 0x3E08B2C8, 0xC451B7CC, 0x8D6DCAEB, 0x56294D82, 0x1F1530A5
+};
+
+/*
+ * end of the CRC lookup table crc_tableil8_o88
+ */
+
+static uint32_t
+sctp_crc32c_sb8_64_bit(uint32_t crc,
+ unsigned char const *p_buf,
+ uint32_t length,
+ uint32_t offset)
+{
+ uint32_t li;
+ uint32_t term1, term2;
+ uint32_t running_length;
+ uint32_t end_bytes;
+ uint32_t init_bytes;
+
+ init_bytes = (4-offset) & 0x3;
+
+ if (init_bytes > length)
+ init_bytes = length;
+
+ running_length = ((length - init_bytes) / 8) * 8;
+ end_bytes = length - init_bytes - running_length;
+
+ for (li = 0; li < init_bytes; li++)
+ crc = sctp_crc_tableil8_o32[(crc ^ *p_buf++) & 0x000000FF] ^
+ (crc >> 8);
+ for (li = 0; li < running_length / 8; li++) {
+#if BYTE_ORDER == BIG_ENDIAN
+ crc ^= *p_buf++;
+ crc ^= (*p_buf++) << 8;
+ crc ^= (*p_buf++) << 16;
+ crc ^= (*p_buf++) << 24;
+#else
+ crc ^= *(uint32_t *) p_buf;
+ p_buf += 4;
+#endif
+ term1 = sctp_crc_tableil8_o88[crc & 0x000000FF] ^
+ sctp_crc_tableil8_o80[(crc >> 8) & 0x000000FF];
+ term2 = crc >> 16;
+ crc = term1 ^
+ sctp_crc_tableil8_o72[term2 & 0x000000FF] ^
+ sctp_crc_tableil8_o64[(term2 >> 8) & 0x000000FF];
+
+#if BYTE_ORDER == BIG_ENDIAN
+ crc ^= sctp_crc_tableil8_o56[*p_buf++];
+ crc ^= sctp_crc_tableil8_o48[*p_buf++];
+ crc ^= sctp_crc_tableil8_o40[*p_buf++];
+ crc ^= sctp_crc_tableil8_o32[*p_buf++];
+#else
+ term1 = sctp_crc_tableil8_o56[(*(uint32_t *) p_buf) & 0x000000FF] ^
+ sctp_crc_tableil8_o48[((*(uint32_t *) p_buf) >> 8) & 0x000000FF];
+
+ term2 = (*(uint32_t *) p_buf) >> 16;
+ crc = crc ^
+ term1 ^
+ sctp_crc_tableil8_o40[term2 & 0x000000FF] ^
+ sctp_crc_tableil8_o32[(term2 >> 8) & 0x000000FF];
+ p_buf += 4;
+#endif
+ }
+ for (li = 0; li < end_bytes; li++)
+ crc = sctp_crc_tableil8_o32[(crc ^ *p_buf++) & 0x000000FF] ^
+ (crc >> 8);
+ return crc;
+}
+
+
+/**
+ *
+ * Routine Description:
+ *
+ * warms the tables
+ *
+ * Arguments:
+ *
+ * none
+ *
+ * Return value:
+ *
+ * none
+ */
+uint32_t
+update_crc32(uint32_t crc32c,
+ unsigned char const *buffer,
+ unsigned int length)
+{
+ uint32_t offset;
+
+ if (length == 0) {
+ return (crc32c);
+ }
+ offset = ((uintptr_t) buffer) & 0x3;
+ return (sctp_crc32c_sb8_64_bit(crc32c, buffer, length, offset));
+}
+
+uint32_t sctp_crc_c[256] = {
+ 0x00000000, 0xF26B8303, 0xE13B70F7, 0x1350F3F4,
+ 0xC79A971F, 0x35F1141C, 0x26A1E7E8, 0xD4CA64EB,
+ 0x8AD958CF, 0x78B2DBCC, 0x6BE22838, 0x9989AB3B,
+ 0x4D43CFD0, 0xBF284CD3, 0xAC78BF27, 0x5E133C24,
+ 0x105EC76F, 0xE235446C, 0xF165B798, 0x030E349B,
+ 0xD7C45070, 0x25AFD373, 0x36FF2087, 0xC494A384,
+ 0x9A879FA0, 0x68EC1CA3, 0x7BBCEF57, 0x89D76C54,
+ 0x5D1D08BF, 0xAF768BBC, 0xBC267848, 0x4E4DFB4B,
+ 0x20BD8EDE, 0xD2D60DDD, 0xC186FE29, 0x33ED7D2A,
+ 0xE72719C1, 0x154C9AC2, 0x061C6936, 0xF477EA35,
+ 0xAA64D611, 0x580F5512, 0x4B5FA6E6, 0xB93425E5,
+ 0x6DFE410E, 0x9F95C20D, 0x8CC531F9, 0x7EAEB2FA,
+ 0x30E349B1, 0xC288CAB2, 0xD1D83946, 0x23B3BA45,
+ 0xF779DEAE, 0x05125DAD, 0x1642AE59, 0xE4292D5A,
+ 0xBA3A117E, 0x4851927D, 0x5B016189, 0xA96AE28A,
+ 0x7DA08661, 0x8FCB0562, 0x9C9BF696, 0x6EF07595,
+ 0x417B1DBC, 0xB3109EBF, 0xA0406D4B, 0x522BEE48,
+ 0x86E18AA3, 0x748A09A0, 0x67DAFA54, 0x95B17957,
+ 0xCBA24573, 0x39C9C670, 0x2A993584, 0xD8F2B687,
+ 0x0C38D26C, 0xFE53516F, 0xED03A29B, 0x1F682198,
+ 0x5125DAD3, 0xA34E59D0, 0xB01EAA24, 0x42752927,
+ 0x96BF4DCC, 0x64D4CECF, 0x77843D3B, 0x85EFBE38,
+ 0xDBFC821C, 0x2997011F, 0x3AC7F2EB, 0xC8AC71E8,
+ 0x1C661503, 0xEE0D9600, 0xFD5D65F4, 0x0F36E6F7,
+ 0x61C69362, 0x93AD1061, 0x80FDE395, 0x72966096,
+ 0xA65C047D, 0x5437877E, 0x4767748A, 0xB50CF789,
+ 0xEB1FCBAD, 0x197448AE, 0x0A24BB5A, 0xF84F3859,
+ 0x2C855CB2, 0xDEEEDFB1, 0xCDBE2C45, 0x3FD5AF46,
+ 0x7198540D, 0x83F3D70E, 0x90A324FA, 0x62C8A7F9,
+ 0xB602C312, 0x44694011, 0x5739B3E5, 0xA55230E6,
+ 0xFB410CC2, 0x092A8FC1, 0x1A7A7C35, 0xE811FF36,
+ 0x3CDB9BDD, 0xCEB018DE, 0xDDE0EB2A, 0x2F8B6829,
+ 0x82F63B78, 0x709DB87B, 0x63CD4B8F, 0x91A6C88C,
+ 0x456CAC67, 0xB7072F64, 0xA457DC90, 0x563C5F93,
+ 0x082F63B7, 0xFA44E0B4, 0xE9141340, 0x1B7F9043,
+ 0xCFB5F4A8, 0x3DDE77AB, 0x2E8E845F, 0xDCE5075C,
+ 0x92A8FC17, 0x60C37F14, 0x73938CE0, 0x81F80FE3,
+ 0x55326B08, 0xA759E80B, 0xB4091BFF, 0x466298FC,
+ 0x1871A4D8, 0xEA1A27DB, 0xF94AD42F, 0x0B21572C,
+ 0xDFEB33C7, 0x2D80B0C4, 0x3ED04330, 0xCCBBC033,
+ 0xA24BB5A6, 0x502036A5, 0x4370C551, 0xB11B4652,
+ 0x65D122B9, 0x97BAA1BA, 0x84EA524E, 0x7681D14D,
+ 0x2892ED69, 0xDAF96E6A, 0xC9A99D9E, 0x3BC21E9D,
+ 0xEF087A76, 0x1D63F975, 0x0E330A81, 0xFC588982,
+ 0xB21572C9, 0x407EF1CA, 0x532E023E, 0xA145813D,
+ 0x758FE5D6, 0x87E466D5, 0x94B49521, 0x66DF1622,
+ 0x38CC2A06, 0xCAA7A905, 0xD9F75AF1, 0x2B9CD9F2,
+ 0xFF56BD19, 0x0D3D3E1A, 0x1E6DCDEE, 0xEC064EED,
+ 0xC38D26C4, 0x31E6A5C7, 0x22B65633, 0xD0DDD530,
+ 0x0417B1DB, 0xF67C32D8, 0xE52CC12C, 0x1747422F,
+ 0x49547E0B, 0xBB3FFD08, 0xA86F0EFC, 0x5A048DFF,
+ 0x8ECEE914, 0x7CA56A17, 0x6FF599E3, 0x9D9E1AE0,
+ 0xD3D3E1AB, 0x21B862A8, 0x32E8915C, 0xC083125F,
+ 0x144976B4, 0xE622F5B7, 0xF5720643, 0x07198540,
+ 0x590AB964, 0xAB613A67, 0xB831C993, 0x4A5A4A90,
+ 0x9E902E7B, 0x6CFBAD78, 0x7FAB5E8C, 0x8DC0DD8F,
+ 0xE330A81A, 0x115B2B19, 0x020BD8ED, 0xF0605BEE,
+ 0x24AA3F05, 0xD6C1BC06, 0xC5914FF2, 0x37FACCF1,
+ 0x69E9F0D5, 0x9B8273D6, 0x88D28022, 0x7AB90321,
+ 0xAE7367CA, 0x5C18E4C9, 0x4F48173D, 0xBD23943E,
+ 0xF36E6F75, 0x0105EC76, 0x12551F82, 0xE03E9C81,
+ 0x34F4F86A, 0xC69F7B69, 0xD5CF889D, 0x27A40B9E,
+ 0x79B737BA, 0x8BDCB4B9, 0x988C474D, 0x6AE7C44E,
+ 0xBE2DA0A5, 0x4C4623A6, 0x5F16D052, 0xAD7D5351,
+};
+
+
+#define SCTP_CRC32C(c,d) (c=(c>>8)^sctp_crc_c[(c^(d))&0xFF])
+
+uint32_t
+old_update_crc32(uint32_t crc32c,
+ unsigned char const *buffer,
+ unsigned int length)
+{
+ unsigned int i;
+
+ for (i = 0; i < length; i++) {
+ SCTP_CRC32C(crc32c, buffer[i]);
+ }
+ return (crc32c);
+}
+
+
+uint32_t
+sctp_csum_finalize(uint32_t crc32c)
+{
+ uint32_t result;
+
+#if BYTE_ORDER == BIG_ENDIAN
+ uint8_t byte0, byte1, byte2, byte3;
+
+#endif
+ /* Complement the result */
+ result = ~crc32c;
+#if BYTE_ORDER == BIG_ENDIAN
+ /*
+ * For BIG-ENDIAN.. aka Motorola byte order the result is in
+ * little-endian form. So we must manually swap the bytes. Then we
+ * can call htonl() which does nothing...
+ */
+ byte0 = result & 0x000000ff;
+ byte1 = (result >> 8) & 0x000000ff;
+ byte2 = (result >> 16) & 0x000000ff;
+ byte3 = (result >> 24) & 0x000000ff;
+ crc32c = ((byte0 << 24) | (byte1 << 16) | (byte2 << 8) | byte3);
+#else
+ /*
+ * For INTEL platforms the result comes out in network order. No
+ * htonl is required or the swap above. So we optimize out both the
+ * htonl and the manual swap above.
+ */
+ crc32c = result;
+#endif
+ return (crc32c);
+}
+
+uint32_t crc32c_le(uint32_t crc, unsigned char const *data, unsigned length)
+{
+ return update_crc32(crc, data, length);
+}
+
+
+#endif
diff --git a/wireshark/wireshark.patch b/wireshark/wireshark.patch
index c63626bbee8..7e061c2cb1e 100644
--- a/wireshark/wireshark.patch
+++ b/wireshark/wireshark.patch
@@ -22,2761 +22,6 @@ Index: Makefile.am
-dlopen plugins/ciscosm/ciscosm.la \
-dlopen plugins/docsis/docsis.la \
-dlopen plugins/enttec/enttec.la \
-Index: plugins/ceph/Makefile.common
-===================================================================
---- plugins/ceph/Makefile.common (revision 0)
-+++ plugins/ceph/Makefile.common (revision 0)
-@@ -0,0 +1,31 @@
-+# Makefile.common for Cisco SS7 Session Management plugin
-+# Contains the stuff from Makefile.am and Makefile.nmake that is
-+# a) common to both files and
-+# b) portable between both files
-+#
-+# $Id: Makefile.common 18197 2006-05-21 05:12:17Z sahlberg $
-+#
-+# Wireshark - Network traffic analyzer
-+# By Gerald Combs <gerald@wireshark.org>
-+# Copyright 1998 Gerald Combs
-+#
-+# This program is free software; you can redistribute it and/or
-+# modify it under the terms of the GNU General Public License
-+# as published by the Free Software Foundation; either version 2
-+# of the License, or (at your option) any later version.
-+#
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+# GNU General Public License for more details.
-+#
-+# You should have received a copy of the GNU General Public License
-+# along with this program; if not, write to the Free Software
-+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+
-+# the name of the plugin
-+PLUGIN_NAME = ceph
-+
-+# the dissector sources (without any helpers)
-+DISSECTOR_SRC = \
-+ packet-ceph.c
-Index: plugins/ceph/packet-ceph.c
-===================================================================
---- plugins/ceph/packet-ceph.c (revision 0)
-+++ plugins/ceph/packet-ceph.c (revision 0)
-@@ -0,0 +1,1155 @@
-+/* packet-ceph.c
-+* This program is free software; you can redistribute it and/or
-+* modify it under the terms of the GNU General Public License
-+* as published by the Free Software Foundation; either version 2
-+* of the License, or (at your option) any later version.
-+*
-+* This program is distributed in the hope that it will be useful,
-+* but WITHOUT ANY WARRANTY; without even the implied warranty of
-+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+* GNU General Public License for more details.
-+*
-+* You should have received a copy of the GNU General Public License
-+* along with this program; if not, write to the Free Software
-+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+*/
-+
-+#ifdef HAVE_CONFIG_H
-+# include "config.h"
-+#endif
-+
-+#include <stdio.h>
-+#include <glib.h>
-+#include <epan/packet.h>
-+#include <epan/dissectors/packet-tcp.h>
-+
-+// this is needed for ceph_fs to compile in userland
-+#ifdef _MSC_VER
-+typedef char __s8;
-+typedef short __s16;
-+typedef int __s32;
-+typedef __int64 __s64;
-+typedef unsigned char __u8;
-+typedef unsigned short __u16;
-+typedef unsigned int __u32;
-+typedef unsigned __int64 __u64;
-+typedef __u16 __le16;
-+typedef __u32 __le32;
-+typedef __u64 __le64;
-+#define __attribute__(x)
-+#define O_ACCMODE (O_RDONLY | O_RDWR | O_WRONLY)
-+#include <winsock.h>
-+#else
-+#include <netinet/in.h>
-+#include <linux/types.h>
-+#endif
-+typedef int bool;
-+
-+#define le16_to_cpu(x) (x)
-+#define le32_to_cpu(x) (x)
-+#define le64_to_cpu(x) (x)
-+
-+#include <fcntl.h>
-+#include <string.h>
-+
-+#ifdef _MSC_VER
-+#pragma pack(1)
-+#endif
-+#include "ceph_fs.h"
-+#ifdef _MSC_VER
-+#pragma pack()
-+#endif
-+
-+
-+
-+#include <string.h>
-+
-+#define PROTO_TAG_CEPH "CEPH"
-+
-+/* Wireshark ID of the CEPH protocol */
-+static int proto_ceph = -1;
-+
-+
-+
-+/* These are the handles of our subdissectors */
-+static dissector_handle_t data_handle=NULL;
-+
-+static dissector_handle_t ceph_handle;
-+static void dissect_ceph(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-+
-+static guint32 global_ceph_min_port = 12340;
-+static guint32 global_ceph_max_port = 12369;
-+
-+static guint32 global_ceph_min_mon_port = 12340;
-+static guint32 global_ceph_max_mon_port = 12349;
-+static guint32 global_ceph_min_mds_port = 12350;
-+static guint32 global_ceph_max_mds_port = 12359;
-+static guint32 global_ceph_min_osd_port = 12360;
-+static guint32 global_ceph_max_osd_port = 12369;
-+
-+#define DEST_PORT_CEPH ((pinfo->destport >= global_ceph_min_port) && (pinfo->destport <= global_ceph_max_port))
-+
-+#define PORT_IS_MON(port) ((port >= global_ceph_min_mon_port) && (port <= global_ceph_max_mon_port))
-+#define PORT_IS_MDS(port) ((port >= global_ceph_min_mds_port) && (port <= global_ceph_max_mds_port))
-+#define PORT_IS_OSD(port) ((port >= global_ceph_min_osd_port) && (port <= global_ceph_max_osd_port))
-+
-+#define IS_ENTITY(cmp, port1, port2) (cmp(port1) || cmp(port2))
-+
-+#define IS_MON(pinfo) IS_ENTITY(PORT_IS_MON, pinfo->srcport, pinfo->destport)
-+#define IS_MDS(pinfo) IS_ENTITY(PORT_IS_MDS, pinfo->srcport, pinfo->destport)
-+#define IS_OSD(pinfo) IS_ENTITY(PORT_IS_OSD, pinfo->srcport, pinfo->destport)
-+
-+#define MON_STR "mon"
-+#define MDS_STR "mds"
-+#define OSD_STR "osd"
-+
-+#define FMT_INO "0x%.16llx"
-+
-+#define PROTO_ADD_TEXT(type, s, field, modifier)\
-+ proto_tree_add_text(tree, tvb, offset + offsetof(type, field), sizeof(s->field), "" #field ": " modifier, s->field);
-+
-+#define CTIME_BUF_LEN 128
-+
-+#define PROTO_ADD_TIME(tvb, tree, type, offset, head, field, name) \
-+ do { \
-+ time_t time; \
-+ time = head->field.tv_sec; \
-+ proto_tree_add_text(tree, tvb, offset + offsetof(type, field), \
-+ sizeof(head->field), "" #name ": %s (%d ns)", ctime(&time), head->field.tv_nsec); \
-+ } while (0)
-+
-+static const value_string packettypenames[] = {
-+ { 1, "Shutdown" },
-+ { 2, "Ping" },
-+ { 4, "Mon Map" },
-+ { 5, "Mon Get Map" },
-+ { 10, "Client Mount" },
-+ { 11, "Client Unmount" },
-+ { 12, "Statfs" },
-+ { 13, "Statfs Reply" },
-+ { 20, "MDS Get Map" },
-+ { 21, "MDS Map" },
-+ { 22, "Client Session" },
-+ { 23, "Client Reconnect" },
-+ { 24, "Client Request" },
-+ { 25, "Client Request Forward" },
-+ { 26, "Client Reply" },
-+ { 0x310, "Client Caps" },
-+ { 0x311, "Client Lease" },
-+ { 0x312, "Client Snap" },
-+ { 40, "OSD Get Map" },
-+ { 41, "OSD Map" },
-+ { 42, "OSD Op" },
-+ { 43, "OSD Op Reply" },
-+ { 0, NULL }
-+};
-+
-+#define ACK_MSG_SIZE 5
-+#define TVB_MSG_HEADER_POS(x) (1 + offsetof(struct ceph_msg_header, x))
-+#define TVB_IS_ACK(ofs) (tvb_get_guint8(tvb, ofs) == CEPH_MSGR_TAG_ACK)
-+#define TVB_MSG_FIELD(func, tvb, ofs, field) func(tvb, ofs + (TVB_IS_ACK(ofs) ? ACK_MSG_SIZE : 0) + TVB_MSG_HEADER_POS(field))
-+
-+/* The following hf_* variables are used to hold the Wireshark IDs of
-+* our header fields; they are filled out when we call
-+* proto_register_field_array() in proto_register_ceph()
-+*/
-+/** Kts attempt at defining the protocol */
-+static gint hf_ceph = -1;
-+static gint hf_ceph_mds_op = -1;
-+static gint hf_ceph_header = -1;
-+static gint hf_ceph_banner = -1;
-+static gint hf_ceph_entity_addr = -1;
-+static gint hf_ceph_entity_type = -1;
-+static gint hf_ceph_entity_num = -1;
-+static gint hf_ceph_fsid = -1;
-+static gint hf_ceph_banner_magic = -1;
-+static gint hf_ceph_banner_version = -1;
-+static gint hf_ceph_connect_erank = -1;
-+static gint hf_ceph_connect_nonce = -1;
-+static gint hf_ceph_sockaddr_in = -1;
-+static gint hf_ceph_connect_host_type = -1;
-+static gint hf_ceph_connect_tag = -1;
-+static gint hf_ceph_connect_global_seq = -1;
-+static gint hf_ceph_connect_connect_seq = -1;
-+static gint hf_ceph_connect_flags = -1;
-+static gint hf_ceph_length = -1;
-+static gint hf_ceph_type = -1;
-+static gint hf_ceph_text = -1;
-+static gint hf_ceph_path = -1;
-+static gint hf_sin_family = -1;
-+static gint hf_sin_port = -1;
-+static gint hf_sin_addr = -1;
-+static gint hf_ceph_hdr_tag = -1;
-+static gint hf_ceph_hdr_seq_ack = -1;
-+static gint hf_ceph_hdr_seq = -1;
-+static gint hf_ceph_hdr_type = -1;
-+static gint hf_ceph_hdr_priority = -1;
-+static gint hf_ceph_hdr_mon_protocol = -1;
-+static gint hf_ceph_hdr_osd_protocol = -1;
-+static gint hf_ceph_hdr_mds_protocol = -1;
-+static gint hf_ceph_hdr_client_protocol = -1;
-+static gint hf_ceph_hdr_front_len = -1;
-+static gint hf_ceph_hdr_data_off = -1;
-+static gint hf_ceph_hdr_data_len = -1;
-+static gint hf_ceph_data = -1;
-+static gint hf_ceph_front = -1;
-+static gint hf_ceph_hdr_src = -1;
-+static gint hf_ceph_hdr_orig_src = -1;
-+static gint hf_ceph_hdr_dst = -1;
-+static gint hf_ceph_hdr_crc = -1;
-+static gint hf_ceph_footer = -1;
-+static gint hf_ceph_footer_flags = -1;
-+static gint hf_ceph_footer_front_crc = -1;
-+static gint hf_ceph_footer_data_crc = -1;
-+
-+
-+/* These are the ids of the subtrees that we may be creating */
-+static gint ett_ceph = -1;
-+static gint ett_ceph_header = -1;
-+static gint ett_ceph_banner = -1;
-+static gint ett_ceph_entity_addr = -1;
-+static gint ett_ceph_length = -1;
-+static gint ett_ceph_type = -1;
-+static gint ett_ceph_text = -1;
-+static gint ett_ceph_front = -1;
-+static gint ett_ceph_data = -1;
-+static gint ett_ceph_footer = -1;
-+
-+
-+void proto_reg_handoff_ceph(void)
-+{
-+ static gboolean initialized=FALSE;
-+ static guint32 port;
-+
-+ if (!initialized) {
-+ data_handle = find_dissector("data");
-+ ceph_handle = create_dissector_handle(dissect_ceph, proto_ceph);
-+ for (port = global_ceph_min_port; port <= global_ceph_max_port; port++)
-+ dissector_add("tcp.port", port, ceph_handle);
-+ }
-+
-+}
-+
-+void proto_register_ceph (void)
-+{
-+ /* A header field is something you can search/filter on.
-+ *
-+ * We create a structure to register our fields. It consists of an
-+ * array of hf_register_info structures, each of which are of the format
-+ * {&(field id), {name, abbrev, type, display, strings, bitmask, blurb, HFILL}}.
-+ */
-+ static hf_register_info hf[] = {
-+ { &hf_ceph,
-+ { "Data", "ceph.data", FT_NONE, BASE_NONE, NULL, 0x0,
-+ "CEPH PDU", HFILL }},
-+ { &hf_ceph_header,
-+ { "Header", "ceph.header", FT_NONE, BASE_NONE, NULL, 0x0,
-+ "CEPH Header", HFILL }},
-+ { &hf_ceph_banner,
-+ { "Ceph Banner", "ceph.connect.banner", FT_STRING, BASE_NONE, NULL, 0x0,
-+ "Ceph Banner", HFILL }},
-+ { &hf_ceph_entity_type,
-+ { "Ceph Entity Type", "ceph.entity.type", FT_UINT32, BASE_DEC, NULL, 0x0,
-+ "Ceph Entity Type", HFILL }},
-+ { &hf_ceph_entity_num,
-+ { "Ceph Entity Num", "ceph.entity.num", FT_UINT32, BASE_DEC, NULL, 0x0,
-+ "Ceph Entity Num", HFILL }},
-+ { &hf_ceph_entity_addr,
-+ { "Ceph Entity Addr", "ceph.entity.addr", FT_NONE, BASE_NONE, NULL, 0x0,
-+ "Ceph Entity Addr", HFILL }},
-+ { &hf_ceph_fsid,
-+ { "Ceph FSID", "ceph.fsid", FT_NONE, BASE_NONE, NULL, 0x0,
-+ "Ceph FSID", HFILL }},
-+ { &hf_ceph_banner_magic,
-+ { "Ceph Banner Magic", "ceph.connect.banner.magic", FT_STRING, BASE_NONE, NULL, 0x0,
-+ "Ceph Banner Magic", HFILL }},
-+ { &hf_ceph_banner_version,
-+ { "Ceph Banner Version", "ceph.connect.banner.ver", FT_STRING, BASE_NONE, NULL, 0x0,
-+ "Ceph Banner", HFILL }},
-+ { &hf_ceph_connect_erank,
-+ { "erank", "ceph.connect.erank", FT_UINT32, BASE_HEX, NULL, 0x0,
-+ "connect: erank", HFILL }},
-+ { &hf_ceph_connect_nonce,
-+ { "nonce", "ceph.connect.nonce", FT_UINT32, BASE_HEX, NULL, 0x0,
-+ "connect: nonce", HFILL }},
-+ { &hf_ceph_sockaddr_in,
-+ { "sockaddr_in", "ceph.sockaddr_in", FT_NONE, BASE_NONE, NULL, 0x0,
-+ "sockaddr_in", HFILL }},
-+ { &hf_sin_family,
-+ { "sin_family", "ceph.sin_family", FT_UINT16, BASE_HEX, NULL, 0x0,
-+ "sockaddr_in: sin_family", HFILL }},
-+ { &hf_sin_port,
-+ { "sin_port", "ceph.sin_port", FT_UINT16, BASE_DEC, NULL, 0x0,
-+ "sockaddr_in: sin_port", HFILL }},
-+ { &hf_sin_addr,
-+ { "ip addr", "ceph.addr", FT_IPv4, BASE_NONE, NULL, 0x0,
-+ "sockaddr_in: ip addr", HFILL }},
-+ { &hf_ceph_connect_host_type,
-+ { "host_type", "ceph.connect.host_type", FT_UINT32, BASE_DEC, NULL, 0x0,
-+ "connect: host_type", HFILL }},
-+ { &hf_ceph_connect_tag,
-+ { "tag", "ceph.connect.tag", FT_UINT8, BASE_DEC, NULL, 0x0,
-+ "connect: tag", HFILL }},
-+ { &hf_ceph_mds_op,
-+ { "mds op", "ceph.mds.op", FT_UINT32, BASE_HEX, NULL, 0x0,
-+ "ceph: mds op", HFILL }},
-+ { &hf_ceph_connect_global_seq,
-+ { "global_seq", "ceph.connect.global_seq", FT_UINT32, BASE_DEC, NULL, 0x0,
-+ "connect: global_seq", HFILL }},
-+ { &hf_ceph_connect_connect_seq,
-+ { "connect_seq", "ceph.connect.connect_seq", FT_UINT32, BASE_DEC, NULL, 0x0,
-+ "connect: connect_seq", HFILL }},
-+ { &hf_ceph_connect_flags,
-+ { "flags", "ceph.connect.flags", FT_UINT8, BASE_HEX, NULL, 0x0,
-+ "connect: flags", HFILL }},
-+ { &hf_ceph_length,
-+ { "Package Length", "ceph.len", FT_UINT32, BASE_DEC, NULL, 0x0,
-+ "Package Length", HFILL }},
-+ { &hf_ceph_type,
-+ { "Type", "ceph.type", FT_UINT8, BASE_DEC, VALS(packettypenames), 0x0,
-+ "Package Type", HFILL }},
-+ { &hf_ceph_text,
-+ { "Text", "ceph.text", FT_STRING, BASE_NONE, NULL, 0x0,
-+ "Text", HFILL }},
-+ { &hf_ceph_path,
-+ { "path", "ceph.path", FT_STRING, BASE_NONE, NULL, 0x0,
-+ "path", HFILL }},
-+ { &hf_ceph_hdr_tag,
-+ { "tag", "ceph.tag", FT_UINT8, BASE_DEC, NULL, 0x0,
-+ "hdr: tag", HFILL }},
-+ { &hf_ceph_hdr_seq_ack,
-+ { "ack seq", "ceph.ack.seq", FT_UINT32, BASE_DEC, NULL, 0x0,
-+ "ack: seq", HFILL }},
-+ { &hf_ceph_hdr_seq,
-+ { "seq", "ceph.seq", FT_UINT64, BASE_DEC, NULL, 0x0,
-+ "hdr: seq", HFILL }},
-+ { &hf_ceph_hdr_type,
-+ { "type", "ceph.type", FT_UINT16, BASE_HEX, NULL, 0x0,
-+ "hdr: type", HFILL }},
-+ { &hf_ceph_hdr_priority,
-+ { "priority", "ceph.priority", FT_UINT16, BASE_DEC, NULL, 0x0,
-+ "hdr: priority", HFILL }},
-+ { &hf_ceph_hdr_mon_protocol,
-+ { "mon_protocol", "ceph.mon_protocol", FT_UINT16, BASE_DEC, NULL, 0x0,
-+ "hdr: mon_protocol", HFILL }},
-+ { &hf_ceph_hdr_osd_protocol,
-+ { "osd_protocol", "ceph.osd_protocol", FT_UINT16, BASE_DEC, NULL, 0x0,
-+ "hdr: osd_protocol", HFILL }},
-+ { &hf_ceph_hdr_mds_protocol,
-+ { "mds_protocol", "ceph.mds_protocol", FT_UINT16, BASE_DEC, NULL, 0x0,
-+ "hdr: mds_protocol", HFILL }},
-+ { &hf_ceph_hdr_client_protocol,
-+ { "client_protocol", "ceph.client_protocol", FT_UINT16, BASE_DEC, NULL, 0x0,
-+ "hdr: client_protocol", HFILL }},
-+ { &hf_ceph_hdr_front_len,
-+ { "front_len", "ceph.front_len", FT_UINT32, BASE_DEC, NULL, 0x0,
-+ "hdr: front_len", HFILL }},
-+ { &hf_ceph_hdr_data_off,
-+ { "data_off", "ceph.data_off", FT_UINT32, BASE_DEC, NULL, 0x0,
-+ "hdr: data_off", HFILL }},
-+ { &hf_ceph_hdr_data_len,
-+ { "data_len", "ceph.data_len", FT_UINT32, BASE_DEC, NULL, 0x0,
-+ "hdr: data_len", HFILL }},
-+ { &hf_ceph_hdr_src,
-+ { "src", "ceph.src", FT_NONE, BASE_NONE, NULL, 0x0,
-+ "hdr: src", HFILL }},
-+ { &hf_ceph_hdr_orig_src,
-+ { "orig_src", "ceph.orig_src", FT_NONE, BASE_NONE, NULL, 0x0,
-+ "hdr: orig_src", HFILL }},
-+ { &hf_ceph_hdr_dst,
-+ { "dst", "ceph.dst", FT_NONE, BASE_NONE, NULL, 0x0,
-+ "hdr: dst", HFILL }},
-+ { &hf_ceph_hdr_crc,
-+ { "crc", "ceph.crc", FT_UINT32, BASE_HEX, NULL, 0x0,
-+ "hdr: crc", HFILL }},
-+ { &hf_ceph_front,
-+ { "Front", "ceph.front", FT_NONE, BASE_NONE, NULL, 0x0,
-+ "Ceph Front", HFILL }},
-+ { &hf_ceph_data,
-+ { "Data", "ceph.data", FT_NONE, BASE_HEX, NULL, 0x0,
-+ "Ceph Data", HFILL }},
-+ { &hf_ceph_footer,
-+ { "Footer", "ceph.footer", FT_NONE, BASE_HEX, NULL, 0x0,
-+ "Ceph Footer", HFILL }},
-+ { &hf_ceph_footer_flags,
-+ { "flags", "ceph.footer.flags", FT_UINT32, BASE_HEX, NULL, 0x0,
-+ "footer: flags", HFILL }},
-+ { &hf_ceph_footer_front_crc,
-+ { "front_crc", "ceph.footer.front_crc", FT_UINT32, BASE_HEX, NULL, 0x0,
-+ "footer: front_crc", HFILL }},
-+ { &hf_ceph_footer_data_crc,
-+ { "data_crc", "ceph.footer.data_crc", FT_UINT32, BASE_HEX, NULL, 0x0,
-+ "footer: data_crc", HFILL }},
-+ };
-+ static gint *ett[] = {
-+ &ett_ceph,
-+ &ett_ceph_header,
-+ &ett_ceph_banner,
-+ &ett_ceph_length,
-+ &ett_ceph_entity_addr,
-+ &ett_ceph_type,
-+ &ett_ceph_text,
-+ &ett_ceph_data,
-+ &ett_ceph_front,
-+ &ett_ceph_footer
-+ };
-+ //if (proto_ceph == -1) { /* execute protocol initialization only once */
-+ proto_ceph = proto_register_protocol ("CEPH Protocol", "CEPH", "ceph");
-+
-+ proto_register_field_array (proto_ceph, hf, array_length (hf));
-+ proto_register_subtree_array (ett, array_length (ett));
-+ register_dissector("ceph", dissect_ceph, proto_ceph);
-+ //}
-+}
-+
-+static guint32 dissect_sockaddr_in(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
-+{
-+ proto_tree *ceph_sockaddr_tree = NULL;
-+ proto_item *ceph_sub_item = NULL;
-+ proto_item *ceph_item = proto_tree_get_parent(tree);
-+
-+ ceph_sockaddr_tree = proto_item_add_subtree(ceph_item, ett_ceph);
-+
-+ ceph_sub_item = proto_tree_add_item( tree, hf_ceph_sockaddr_in, tvb, offset, 16, TRUE );
-+ ceph_sockaddr_tree = proto_item_add_subtree(ceph_sub_item, ett_ceph);
-+
-+ proto_tree_add_item(ceph_sockaddr_tree, hf_sin_family, tvb, offset, 2, TRUE);
-+ proto_tree_add_item(ceph_sockaddr_tree, hf_sin_port, tvb, offset+2, 2, TRUE);
-+ proto_tree_add_item(ceph_sockaddr_tree, hf_sin_addr, tvb, offset+4, 4, FALSE);
-+ offset += 16;
-+ return offset;
-+}
-+
-+static guint32 dissect_ceph_banner(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
-+{
-+ proto_tree *ceph_banner_tree = NULL;
-+ proto_item *ceph_sub_item = NULL;
-+
-+ ceph_sub_item = proto_tree_add_item( tree, hf_ceph_banner, tvb, offset, 8, TRUE );
-+ ceph_banner_tree = proto_item_add_subtree(ceph_sub_item, ett_ceph);
-+
-+ proto_tree_add_item(ceph_banner_tree, hf_ceph_banner_magic, tvb, offset, 4, TRUE);
-+ proto_tree_add_item(ceph_banner_tree, hf_ceph_banner_version, tvb, offset+4, 4, TRUE);
-+
-+ return offset+9;
-+}
-+
-+static guint32 dissect_ceph_entity_addr(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
-+{
-+ proto_tree *ceph_entity_tree = NULL;
-+ proto_item *ceph_sub_item = NULL;
-+
-+ ceph_sub_item = proto_tree_add_item( tree, hf_ceph_entity_addr, tvb, offset, sizeof(struct ceph_entity_addr), TRUE );
-+ ceph_entity_tree = proto_item_add_subtree(ceph_sub_item, ett_ceph);
-+ proto_tree_add_item(ceph_entity_tree, hf_ceph_connect_erank, tvb, offset, 4, TRUE);
-+ proto_tree_add_item(ceph_entity_tree, hf_ceph_connect_nonce, tvb, offset+4, 4, TRUE);
-+ offset = dissect_sockaddr_in(tvb, ceph_entity_tree, offset+8);
-+#if 0
-+ proto_tree_add_item(ceph_entity_tree, hf_ceph_connect_host_type, tvb, offset, 4, TRUE);
-+ offset += 4;
-+#endif
-+
-+ return offset;
-+}
-+
-+static guint32 dissect_ceph_fsid(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
-+{
-+ proto_tree *ceph_entity_tree = NULL;
-+ proto_item *ceph_sub_item = NULL;
-+ struct ceph_fsid *fsid;
-+
-+ fsid = (struct ceph_fsid *)tvb_get_ptr(tvb, offset, sizeof(struct ceph_fsid));
-+
-+ ceph_sub_item = proto_tree_add_item( tree, hf_ceph_fsid, tvb, offset, sizeof(struct ceph_entity_addr), TRUE );
-+ ceph_entity_tree = proto_item_add_subtree(ceph_sub_item, ett_ceph);
-+
-+ proto_tree_add_item(ceph_entity_tree, hf_ceph_connect_erank, tvb, offset, 4, TRUE);
-+ proto_tree_add_item(ceph_entity_tree, hf_ceph_connect_nonce, tvb, offset+4, 4, TRUE);
-+
-+ proto_tree_add_text(tree, tvb, offsetof(struct ceph_fsid, major),
-+ sizeof(fsid->major), "major: " FMT_INO, fsid->major);
-+ proto_tree_add_text(tree, tvb, offsetof(struct ceph_fsid, minor),
-+ sizeof(fsid->minor), "minor: " FMT_INO, fsid->minor);
-+
-+ offset += sizeof(struct ceph_fsid);
-+
-+ return offset;
-+}
-+
-+static guint32 dissect_ceph_entity_inst(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
-+{
-+ proto_tree *ceph_entity_tree = NULL;
-+ proto_item *ceph_sub_item = NULL;
-+
-+ ceph_sub_item = proto_tree_add_item( tree, hf_ceph_entity_addr, tvb, offset, sizeof(struct ceph_entity_addr), TRUE );
-+ ceph_entity_tree = proto_item_add_subtree(ceph_sub_item, ett_ceph);
-+ proto_tree_add_item(ceph_entity_tree, hf_ceph_entity_type, tvb, offset, 4, TRUE);
-+ proto_tree_add_item(ceph_entity_tree, hf_ceph_entity_num, tvb, offset+4, 4, TRUE);
-+ offset += 8;
-+ offset = dissect_ceph_entity_addr(tvb, ceph_entity_tree, offset);
-+ return offset;
-+}
-+
-+static guint32 dissect_ceph_footer(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
-+{
-+ proto_tree *ceph_footer_tree = NULL;
-+ proto_item *ceph_sub_item = NULL;
-+
-+ ceph_sub_item = proto_tree_add_item( tree, hf_ceph_footer, tvb, offset, sizeof(struct ceph_msg_footer), TRUE );
-+ ceph_footer_tree = proto_item_add_subtree(ceph_sub_item, ett_ceph);
-+ proto_tree_add_item(ceph_footer_tree, hf_ceph_footer_flags, tvb, offset, 4, TRUE);
-+ proto_tree_add_item(ceph_footer_tree, hf_ceph_footer_front_crc, tvb, offset+4, 4, TRUE);
-+ proto_tree_add_item(ceph_footer_tree, hf_ceph_footer_data_crc, tvb, offset+8, 4, TRUE);
-+ offset += 12;
-+ return offset;
-+}
-+
-+static guint32 dissect_ceph_client_connect(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
-+{
-+ proto_tree *ceph_header_tree = NULL;
-+ proto_item *ceph_sub_item = NULL;
-+ proto_item *ceph_item = proto_tree_get_parent(tree);
-+
-+ offset = dissect_ceph_banner(tvb, tree, offset);
-+
-+ ceph_header_tree = proto_item_add_subtree(ceph_item, ett_ceph);
-+
-+ ceph_sub_item = proto_tree_add_item( tree, hf_ceph_header, tvb, offset, -1, TRUE );
-+ ceph_header_tree = proto_item_add_subtree(ceph_sub_item, ett_ceph);
-+
-+ offset = dissect_ceph_entity_addr(tvb, ceph_header_tree, offset);
-+ proto_tree_add_item(ceph_header_tree, hf_ceph_connect_host_type, tvb, offset, 4, TRUE);
-+ offset += 4;
-+ proto_tree_add_item(ceph_header_tree, hf_ceph_connect_global_seq, tvb, offset, 4, TRUE);
-+ proto_tree_add_item(ceph_header_tree, hf_ceph_connect_connect_seq, tvb, offset+4, 4, TRUE);
-+ proto_tree_add_item(ceph_header_tree, hf_ceph_connect_flags, tvb, offset+8, 1, TRUE);
-+ offset += 8;
-+ return offset;
-+}
-+
-+static guint32 dissect_ceph_server_connect(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
-+{
-+ proto_tree *ceph_header_tree = NULL;
-+ proto_item *ceph_sub_item = NULL;
-+ proto_item *ceph_item = proto_tree_get_parent(tree);
-+
-+ offset = dissect_ceph_banner(tvb, tree, offset);
-+
-+ ceph_header_tree = proto_item_add_subtree(ceph_item, ett_ceph);
-+
-+ ceph_sub_item = proto_tree_add_item( tree, hf_ceph_header, tvb, offset, -1, TRUE );
-+ ceph_header_tree = proto_item_add_subtree(ceph_sub_item, ett_ceph);
-+
-+ offset = dissect_ceph_entity_addr(tvb, ceph_header_tree, offset);
-+
-+ proto_tree_add_item(ceph_header_tree, hf_ceph_hdr_tag, tvb, offset, 1, TRUE);
-+ offset += 1;
-+ proto_tree_add_item(ceph_header_tree, hf_ceph_connect_global_seq, tvb, offset, 4, TRUE);
-+ proto_tree_add_item(ceph_header_tree, hf_ceph_connect_connect_seq, tvb, offset+4, 4, TRUE);
-+ proto_tree_add_item(ceph_header_tree, hf_ceph_connect_flags, tvb, offset+8, 1, TRUE);
-+ return offset;
-+}
-+
-+static guint32 dissect_ceph_file_layout(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
-+{
-+ guint32 orig_ofs = offset;
-+ struct ceph_file_layout *lo;
-+
-+ lo = (struct ceph_file_layout *)tvb_get_ptr(tvb, offset, sizeof(struct ceph_file_layout));
-+
-+ PROTO_ADD_TEXT(struct ceph_file_layout, lo, fl_stripe_unit, "%d");
-+ PROTO_ADD_TEXT(struct ceph_file_layout, lo, fl_stripe_count, "%d");
-+ PROTO_ADD_TEXT(struct ceph_file_layout, lo, fl_object_size, "%d");
-+ PROTO_ADD_TEXT(struct ceph_file_layout, lo, fl_cas_hash, "%d");
-+ PROTO_ADD_TEXT(struct ceph_file_layout, lo, fl_object_stripe_unit, "%d");
-+ PROTO_ADD_TEXT(struct ceph_file_layout, lo, fl_pg_preferred, "%d");
-+ PROTO_ADD_TEXT(struct ceph_file_layout, lo, fl_pg_type, "%u");
-+ PROTO_ADD_TEXT(struct ceph_file_layout, lo, fl_pg_size, "%u");
-+ PROTO_ADD_TEXT(struct ceph_file_layout, lo, fl_pg_pool, "%u");
-+
-+ return orig_ofs + sizeof(struct ceph_mds_reply_head);
-+}
-+
-+static int dissect_ceph_filepath(tvbuff_t *tvb, proto_tree *tree, guint32 offset, char **path, guint64 *ino)
-+{
-+ guint32 len;
-+ const char *p = NULL;
-+
-+ *ino = tvb_get_letoh64(tvb, offset);
-+ proto_tree_add_text(tree, tvb, offset, sizeof(*ino), "inode: " FMT_INO, *ino);
-+ offset += sizeof(*ino);
-+ len = tvb_get_letohl(tvb, offset);
-+ proto_tree_add_text(tree, tvb, offset, sizeof(len), "len: %d", len);
-+ offset += sizeof(len);
-+
-+ if (len) {
-+ p = tvb_get_ptr(tvb, offset, len);
-+ *path = malloc(len+1);
-+ if (*path) {
-+ memcpy(*path, p, len);
-+ (*path)[len] = '\0';
-+ proto_tree_add_item(tree, hf_ceph_path, tvb, offset, len, TRUE);
-+ }
-+ }
-+
-+ offset += len;
-+
-+ return offset;
-+}
-+
-+static guint32 dissect_ceph_mon_statfs(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
-+{
-+ struct ceph_mon_statfs *req;
-+
-+ req = (struct ceph_mon_statfs *)tvb_get_ptr(tvb, offset, sizeof(struct ceph_mon_statfs));
-+
-+ dissect_ceph_fsid(tvb, tree, offset + offsetof(struct ceph_mon_statfs, fsid));
-+ PROTO_ADD_TEXT(struct ceph_mon_statfs, req, tid, "%lld");
-+
-+ return offset + sizeof(struct ceph_mon_statfs);
-+}
-+
-+static guint32 dissect_ceph_mon_statfs_reply(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
-+{
-+ struct ceph_mon_statfs_reply *req;
-+
-+ req = (struct ceph_mon_statfs_reply *)tvb_get_ptr(tvb, offset, sizeof(struct ceph_mon_statfs_reply));
-+
-+ dissect_ceph_fsid(tvb, tree, offset + offsetof(struct ceph_mon_statfs_reply, fsid));
-+ PROTO_ADD_TEXT(struct ceph_mon_statfs_reply, req, tid, "%lld");
-+ PROTO_ADD_TEXT(struct ceph_mon_statfs_reply, req, st.f_total, "%lld");
-+ PROTO_ADD_TEXT(struct ceph_mon_statfs_reply, req, st.f_free, "%lld");
-+ PROTO_ADD_TEXT(struct ceph_mon_statfs_reply, req, st.f_avail, "%lld");
-+ PROTO_ADD_TEXT(struct ceph_mon_statfs_reply, req, st.f_objects, "%lld");
-+
-+ return offset + sizeof(struct ceph_mon_statfs_reply);
-+}
-+
-+static guint32 dissect_ceph_client_osd_getmap(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
-+{
-+ struct ceph_osd_getmap *req;
-+
-+ req = (struct ceph_osd_getmap *)tvb_get_ptr(tvb, offset, sizeof(struct ceph_osd_getmap));
-+
-+ dissect_ceph_fsid(tvb, tree, offset + offsetof(struct ceph_osd_getmap, fsid));
-+ PROTO_ADD_TEXT(struct ceph_osd_getmap, req, start, "%d");
-+
-+ return offset + sizeof(struct ceph_osd_getmap);
-+}
-+
-+static guint32 dissect_ceph_client_mds_getmap(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
-+{
-+ struct ceph_mds_getmap *req;
-+
-+ req = (struct ceph_mds_getmap *)tvb_get_ptr(tvb, offset, sizeof(struct ceph_mds_getmap));
-+
-+ dissect_ceph_fsid(tvb, tree, offset + offsetof(struct ceph_mds_getmap, fsid));
-+ PROTO_ADD_TEXT(struct ceph_mds_getmap, req, want, "%d");
-+
-+ return offset + sizeof(struct ceph_mds_getmap);
-+}
-+
-+static guint32 dissect_ceph_client_mds_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset)
-+{
-+ struct ceph_mds_request_head *head;
-+ proto_item *item;
-+
-+ head = (struct ceph_mds_request_head *)tvb_get_ptr(tvb, offset, sizeof(struct ceph_mds_request_head));
-+
-+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, tid, "%lld");
-+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, oldest_client_tid, "%lld");
-+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, mdsmap_epoch, "%d");
-+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, num_fwd, "%d");
-+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, retry_attempt, "%d");
-+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, mds_wants_replica_in_dirino, "%lld");
-+
-+ item = proto_tree_add_item(tree, hf_ceph_mds_op, tvb, offset+offsetof(struct ceph_mds_request_head, op), sizeof(head->op), TRUE);
-+ proto_item_append_text(item, " (%s)", ceph_mds_op_name(head->op));
-+
-+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, caller_uid, "%d");
-+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, caller_gid, "%d");
-+
-+ if (check_col(pinfo->cinfo, COL_INFO)) {
-+ col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", ceph_mds_op_name(head->op));
-+ }
-+
-+ switch (head->op) {
-+ case CEPH_MDS_OP_FINDINODE:
-+ break;
-+ case CEPH_MDS_OP_STAT:
-+ case CEPH_MDS_OP_LSTAT:
-+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, args.stat.mask, "0x%.4x");
-+ break;
-+ case CEPH_MDS_OP_LUTIME:
-+ case CEPH_MDS_OP_UTIME:
-+#define MDS_REQ_ADD_TIME(field) PROTO_ADD_TIME(tvb, tree, struct ceph_mds_request_head, offset, head, args.utime.field, field)
-+ MDS_REQ_ADD_TIME(mtime);
-+ MDS_REQ_ADD_TIME(atime);
-+ MDS_REQ_ADD_TIME(ctime);
-+ break;
-+ case CEPH_MDS_OP_CHMOD:
-+ case CEPH_MDS_OP_LCHMOD:
-+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, args.chmod.mode, "0%.5o");
-+ break;
-+ case CEPH_MDS_OP_CHOWN:
-+ case CEPH_MDS_OP_LCHOWN:
-+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, args.chown.uid, "%d");
-+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, args.chown.gid, "%d");
-+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, args.chown.mask, "0x%.4x");
-+ break;
-+ case CEPH_MDS_OP_LSETLAYOUT:
-+ dissect_ceph_file_layout(tvb, tree, offset + offsetof(struct ceph_mds_request_head, args.setlayout.layout));
-+ break;
-+ case CEPH_MDS_OP_SETXATTR:
-+ case CEPH_MDS_OP_LSETXATTR:
-+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, args.setxattr.flags, "0x%.4x");
-+ break;
-+ case CEPH_MDS_OP_READDIR:
-+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, args.readdir.frag, "%d");
-+ break;
-+ case CEPH_MDS_OP_MKNOD:
-+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, args.mknod.mode, "0%.5o");
-+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, args.mknod.rdev, "%d");
-+ break;
-+ case CEPH_MDS_OP_OPEN:
-+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, args.open.flags, "%x");
-+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, args.open.mode, "0%.5o");
-+ break;
-+ case CEPH_MDS_OP_LTRUNCATE:
-+ case CEPH_MDS_OP_TRUNCATE:
-+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, args.truncate.length, "%lld");
-+ break;
-+ case CEPH_MDS_OP_MKDIR:
-+ PROTO_ADD_TEXT(struct ceph_mds_request_head, head, args.mkdir.mode, "0%.5o");
-+ break;
-+ case CEPH_MDS_OP_RMXATTR:
-+ case CEPH_MDS_OP_LRMXATTR:
-+ case CEPH_MDS_OP_LINK:
-+ case CEPH_MDS_OP_UNLINK:
-+ case CEPH_MDS_OP_RENAME:
-+ case CEPH_MDS_OP_RMDIR:
-+ case CEPH_MDS_OP_SYMLINK:
-+ case CEPH_MDS_OP_FSYNC:
-+ case CEPH_MDS_OP_LSSNAP:
-+ case CEPH_MDS_OP_MKSNAP:
-+ case CEPH_MDS_OP_RMSNAP:
-+ break;
-+ }
-+
-+ offset += sizeof(struct ceph_mds_request_head);
-+
-+ if (head->op == CEPH_MDS_OP_FINDINODE) {
-+
-+ } else {
-+ guint64 ino1, ino2;
-+ char *s1 = NULL, *s2 = NULL;
-+
-+ offset = dissect_ceph_filepath(tvb, tree, offset, &s1, &ino1);
-+ offset = dissect_ceph_filepath(tvb, tree, offset, &s2, &ino2);
-+
-+ if (check_col(pinfo->cinfo, COL_INFO)) {
-+ if (s1)
-+ col_append_fstr(pinfo->cinfo, COL_INFO, " %s", s1);
-+ if (s2)
-+ col_append_fstr(pinfo->cinfo, COL_INFO, " -> %s", s2);
-+ }
-+
-+
-+
-+ }
-+
-+ return offset;
-+}
-+
-+static guint32 dissect_ceph_client_mds_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset)
-+{
-+ guint32 orig_ofs = offset;
-+ struct ceph_mds_reply_head *head;
-+
-+ head = (struct ceph_mds_reply_head *)tvb_get_ptr(tvb, offset, sizeof(struct ceph_mds_reply_head));
-+
-+ PROTO_ADD_TEXT(struct ceph_mds_reply_head, head, tid, "%lld");
-+
-+ proto_tree_add_text(tree, tvb, offsetof(struct ceph_mds_reply_head, op),
-+ sizeof(head->op), "op: %d (%s)", head->op, ceph_mds_op_name(head->op));
-+
-+ PROTO_ADD_TEXT(struct ceph_mds_reply_head, head, result, "%d");
-+ PROTO_ADD_TEXT(struct ceph_mds_reply_head, head, file_caps, "%d");
-+ PROTO_ADD_TEXT(struct ceph_mds_reply_head, head, file_caps_seq, "%d");
-+ PROTO_ADD_TEXT(struct ceph_mds_reply_head, head, file_caps_mseq, "%d");
-+ PROTO_ADD_TEXT(struct ceph_mds_reply_head, head, mdsmap_epoch, "%d");
-+
-+
-+ if (check_col(pinfo->cinfo, COL_INFO)) {
-+ col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", ceph_mds_op_name(head->op));
-+ }
-+
-+ return orig_ofs + sizeof(struct ceph_mds_reply_head);
-+}
-+
-+static guint32 dissect_ceph_client_mds_lease_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset)
-+{
-+ guint32 orig_ofs = offset;
-+ struct ceph_mds_lease *head;
-+ static char *lease_action[] = { "", "revoke", "release", "renew" };
-+
-+ head = (struct ceph_mds_lease *)tvb_get_ptr(tvb, offset, sizeof(struct ceph_mds_lease));
-+
-+ PROTO_ADD_TEXT(struct ceph_mds_lease, head, action, "%d");
-+ PROTO_ADD_TEXT(struct ceph_mds_lease, head, mask, "%.4x");
-+ PROTO_ADD_TEXT(struct ceph_mds_lease, head, ino, FMT_INO);
-+ PROTO_ADD_TEXT(struct ceph_mds_lease, head, first, "%lld");
-+ PROTO_ADD_TEXT(struct ceph_mds_lease, head, last, "%lld");
-+
-+ if (check_col(pinfo->cinfo, COL_INFO)) {
-+ if (head->action < 4) {
-+ col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", lease_action[head->action]);
-+ }
-+ }
-+
-+ return orig_ofs + sizeof(struct ceph_mds_lease);
-+}
-+
-+static guint32 dissect_ceph_client_mds_caps_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset)
-+{
-+ guint32 orig_ofs = offset;
-+ struct ceph_mds_caps *head;
-+
-+ head = (struct ceph_mds_caps *)tvb_get_ptr(tvb, offset, sizeof(struct ceph_mds_caps));
-+
-+ PROTO_ADD_TEXT(struct ceph_mds_caps, head, op, "%d");
-+ PROTO_ADD_TEXT(struct ceph_mds_caps, head, ino, FMT_INO);
-+ PROTO_ADD_TEXT(struct ceph_mds_caps, head, seq, "%d");
-+ PROTO_ADD_TEXT(struct ceph_mds_caps, head, caps, "%d");
-+ PROTO_ADD_TEXT(struct ceph_mds_caps, head, wanted, "%d");
-+ PROTO_ADD_TEXT(struct ceph_mds_caps, head, size, "%llu");
-+ PROTO_ADD_TEXT(struct ceph_mds_caps, head, max_size, "%llu");
-+ PROTO_ADD_TEXT(struct ceph_mds_caps, head, truncate_seq, "%lld");
-+ PROTO_ADD_TEXT(struct ceph_mds_caps, head, migrate_seq, "%d");
-+ PROTO_ADD_TEXT(struct ceph_mds_caps, head, time_warp_seq, "%llu");
-+ PROTO_ADD_TEXT(struct ceph_mds_caps, head, snap_follows, "%llu");
-+ PROTO_ADD_TEXT(struct ceph_mds_caps, head, snap_trace_len, "%d");
-+
-+#define CAPS_REQ_ADD_TIME(field) PROTO_ADD_TIME(tvb, tree, struct ceph_mds_caps, offset, head, field, field)
-+ CAPS_REQ_ADD_TIME(mtime);
-+ CAPS_REQ_ADD_TIME(atime);
-+ CAPS_REQ_ADD_TIME(ctime);
-+
-+ if (check_col(pinfo->cinfo, COL_INFO)) {
-+ col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", ceph_cap_op_name(head->op));
-+ }
-+
-+ return orig_ofs + sizeof(struct ceph_mds_caps);
-+}
-+
-+static guint32 dissect_ceph_client_front(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset, guint16 type)
-+{
-+ switch (type) {
-+ case CEPH_MSG_STATFS:
-+ offset = dissect_ceph_mon_statfs(tvb, tree, offset);
-+ break;
-+ case CEPH_MSG_STATFS_REPLY:
-+ offset = dissect_ceph_mon_statfs_reply(tvb, tree, offset);
-+ break;
-+ case CEPH_MSG_CLIENT_REQUEST: /* mds request */
-+ offset = dissect_ceph_client_mds_request(tvb, pinfo, tree, offset);
-+ break;
-+ case CEPH_MSG_CLIENT_REPLY:
-+ offset = dissect_ceph_client_mds_reply(tvb, pinfo, tree, offset);
-+ break;
-+ case CEPH_MSG_CLIENT_LEASE:
-+ offset = dissect_ceph_client_mds_lease_request(tvb, pinfo, tree, offset);
-+ break;
-+ case CEPH_MSG_CLIENT_CAPS:
-+ offset = dissect_ceph_client_mds_caps_request(tvb, pinfo, tree, offset);
-+ break;
-+ case CEPH_MSG_OSD_GETMAP:
-+ offset = dissect_ceph_client_osd_getmap(tvb, tree, offset);
-+ break;
-+ case CEPH_MSG_MDS_GETMAP:
-+ offset = dissect_ceph_client_mds_getmap(tvb, tree, offset);
-+ break;
-+ default:
-+ break;
-+ }
-+ return offset;
-+}
-+
-+static guint32 dissect_ceph_generic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset)
-+{
-+ proto_tree *ceph_header_tree = NULL;
-+ proto_item *ceph_sub_item = NULL;
-+ proto_item *ceph_item = proto_tree_get_parent(tree);
-+ guint32 front_len, data_len;
-+ guint8 tag;
-+ guint32 orig_ofs = offset;
-+ guint16 type;
-+ guint64 seq;
-+
-+ ceph_header_tree = proto_item_add_subtree(ceph_item, ett_ceph);
-+
-+ ceph_sub_item = proto_tree_add_item( tree, hf_ceph_header, tvb, offset, -1, TRUE );
-+ ceph_header_tree = proto_item_add_subtree(ceph_sub_item, ett_ceph);
-+
-+ tag = tvb_get_guint8(tvb, offset);
-+
-+ if (tag == CEPH_MSGR_TAG_ACK) {
-+ proto_tree_add_item(ceph_header_tree, hf_ceph_hdr_tag, tvb, offset, 1, TRUE);
-+ proto_tree_add_item(ceph_header_tree, hf_ceph_hdr_seq_ack, tvb, offset+1, 4, TRUE);
-+ offset += ACK_MSG_SIZE;
-+ }
-+
-+ proto_tree_add_item(ceph_header_tree, hf_ceph_hdr_tag, tvb, offset, 1, TRUE);
-+ proto_tree_add_item(ceph_header_tree, hf_ceph_hdr_seq, tvb, offset+1, 8, TRUE);
-+ offset += 9;
-+ proto_tree_add_item(ceph_header_tree, hf_ceph_hdr_type, tvb, offset, 2, TRUE);
-+ offset += 2;
-+ proto_tree_add_item(ceph_header_tree, hf_ceph_hdr_priority, tvb, offset, 2, TRUE);
-+ proto_tree_add_item(ceph_header_tree, hf_ceph_hdr_mon_protocol, tvb, offset+2, 2, TRUE);
-+ proto_tree_add_item(ceph_header_tree, hf_ceph_hdr_osd_protocol, tvb, offset+4, 2, TRUE);
-+ proto_tree_add_item(ceph_header_tree, hf_ceph_hdr_mds_protocol, tvb, offset+6, 2, TRUE);
-+ proto_tree_add_item(ceph_header_tree, hf_ceph_hdr_client_protocol, tvb, offset+8, 2, TRUE);
-+ offset += 10;
-+ proto_tree_add_item(ceph_header_tree, hf_ceph_hdr_front_len, tvb, offset, 4, TRUE);
-+ proto_tree_add_item(ceph_header_tree, hf_ceph_hdr_data_off, tvb, offset+4, 4, TRUE);
-+ proto_tree_add_item(ceph_header_tree, hf_ceph_hdr_data_len, tvb, offset+8, 4, TRUE);
-+ offset += 12;
-+ offset = dissect_ceph_entity_inst(tvb, ceph_header_tree, offset);
-+ offset = dissect_ceph_entity_inst(tvb, ceph_header_tree, offset);
-+ offset = dissect_ceph_entity_inst(tvb, ceph_header_tree, offset);
-+ proto_tree_add_item(ceph_header_tree, hf_ceph_hdr_crc, tvb, offset, 4, TRUE);
-+ offset += 4;
-+
-+ front_len = TVB_MSG_FIELD(tvb_get_letohs, tvb, orig_ofs, front_len);
-+ type = TVB_MSG_FIELD(tvb_get_letohl, tvb, orig_ofs, type);
-+
-+ seq = TVB_MSG_FIELD(tvb_get_letoh64, tvb, orig_ofs, seq);
-+
-+ if (front_len) {
-+ /* ceph_sub_item = proto_tree_add_item( tree, hf_ceph_front, tvb, offset, front_len, TRUE );
-+ offset += front_len; */
-+
-+ offset = dissect_ceph_client_front(tvb, pinfo, tree, offset, type);
-+/*
-+ } else {
-+ ceph_sub_item = proto_tree_add_item( tree, hf_ceph_front, tvb, offset, front_len, TRUE );
-+ offset += front_len;
-+ } */
-+ }
-+
-+ data_len = TVB_MSG_FIELD(tvb_get_letohl, tvb, orig_ofs, data_len);
-+ if (data_len) {
-+ ceph_sub_item = proto_tree_add_item( tree, hf_ceph_data, tvb, offset, data_len, TRUE );
-+ offset += data_len;
-+ }
-+
-+ offset = dissect_ceph_footer(tvb, tree, offset);
-+
-+ return offset;
-+}
-+
-+static void
-+dissect_ceph_client(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
-+{
-+
-+ proto_item *ceph_item = NULL;
-+ proto_tree *ceph_tree = NULL;
-+ guint16 type = 0;
-+ const guchar *ptr;
-+ guint32 pos = 0;
-+ int have_banner = 0;
-+
-+ if (check_col(pinfo->cinfo, COL_PROTOCOL))
-+ col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_CEPH);
-+ /* Clear out stuff in the info column */
-+ if(check_col(pinfo->cinfo,COL_INFO)){
-+ col_clear(pinfo->cinfo,COL_INFO);
-+ }
-+
-+ ptr = tvb_get_ptr(tvb, pos, 9);
-+ if (ptr && memcmp(ptr, "ceph", 4) == 0) {
-+ have_banner = 1;
-+ pos += 9;
-+ }
-+
-+ // This is not a good way of dissecting packets. The tvb length should
-+ // be sanity checked so we aren't going past the actual size of the buffer.
-+ type = tvb_get_guint8( tvb, 4 ); // Get the type byte
-+
-+ if (check_col(pinfo->cinfo, COL_INFO)) {
-+ char *entity_str = NULL;
-+ if (IS_MON(pinfo))
-+ entity_str = MON_STR;
-+ else if (IS_MDS(pinfo))
-+ entity_str = MDS_STR;
-+ else if (IS_OSD(pinfo))
-+ entity_str = OSD_STR;
-+ else
-+ entity_str = "???";
-+ if (have_banner) {
-+ col_add_fstr(pinfo->cinfo, COL_INFO, "[%s] Connect Request", entity_str);
-+ } else {
-+ type = TVB_MSG_FIELD(tvb_get_letohl, tvb, 0, type);
-+ col_add_fstr(pinfo->cinfo, COL_INFO, "[%s] %s",
-+ entity_str,
-+ val_to_str(type, packettypenames, "Unknown Type:0x%02x"));
-+ }
-+ }
-+
-+ if (tree) { /* we are being asked for details */
-+ guint32 offset = 0;
-+
-+ ceph_item = proto_tree_add_item(tree, proto_ceph, tvb, 0, -1, TRUE);
-+ ceph_tree = proto_item_add_subtree(ceph_item, ett_ceph);
-+ if (have_banner) { /* this is a connect message */
-+ offset = dissect_ceph_client_connect(tvb, ceph_tree, offset);
-+ } else {
-+ offset = dissect_ceph_generic(tvb, pinfo, ceph_tree, offset);
-+ }
-+ }
-+}
-+
-+static void
-+dissect_ceph_server(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
-+{
-+
-+ proto_item *ceph_item = NULL;
-+ proto_tree *ceph_tree = NULL;
-+ guint16 type = 0;
-+ const guchar *ptr;
-+ guint32 pos = 0;
-+ int have_banner = 0;
-+
-+ if (check_col(pinfo->cinfo, COL_PROTOCOL))
-+ col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_CEPH);
-+ /* Clear out stuff in the info column */
-+ if(check_col(pinfo->cinfo,COL_INFO)){
-+ col_clear(pinfo->cinfo,COL_INFO);
-+ }
-+
-+ ptr = tvb_get_ptr(tvb, pos, 9);
-+ if (ptr && memcmp(ptr, "ceph", 4) == 0) {
-+ have_banner = 1;
-+ pos += 9;
-+ }
-+
-+ // This is not a good way of dissecting packets. The tvb length should
-+ // be sanity checked so we aren't going past the actual size of the buffer.
-+ type = tvb_get_guint8( tvb, 4 ); // Get the type byte
-+
-+ if (check_col(pinfo->cinfo, COL_INFO)) {
-+ char *entity_str = NULL;
-+ if (IS_MON(pinfo))
-+ entity_str = MON_STR;
-+ else if (IS_MDS(pinfo))
-+ entity_str = MDS_STR;
-+ else if (IS_OSD(pinfo))
-+ entity_str = OSD_STR;
-+ else
-+ entity_str = "???";
-+ if (have_banner) {
-+ col_add_fstr(pinfo->cinfo, COL_INFO, "[%s] Connect Response", entity_str);
-+ } else {
-+ type = TVB_MSG_FIELD(tvb_get_letohl, tvb, 0, type);
-+ col_add_fstr(pinfo->cinfo, COL_INFO, "[%s] %s",
-+ entity_str,
-+ val_to_str(type, packettypenames, "Unknown Type:0x%02x"));
-+ }
-+ }
-+
-+ if (tree) { /* we are being asked for details */
-+ guint32 offset = 0;
-+
-+ ceph_item = proto_tree_add_item(tree, proto_ceph, tvb, 0, -1, TRUE);
-+ ceph_tree = proto_item_add_subtree(ceph_item, ett_ceph);
-+
-+ if (have_banner) {
-+ offset = dissect_ceph_server_connect(tvb, ceph_tree, offset);
-+ } else {
-+ offset = dissect_ceph_generic(tvb, pinfo, ceph_tree, offset);
-+ }
-+ }
-+}
-+
-+static void
-+dissect_ceph_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
-+{
-+ if (DEST_PORT_CEPH)
-+ dissect_ceph_client(tvb, pinfo, tree);
-+ else
-+ dissect_ceph_server(tvb, pinfo, tree);
-+}
-+
-+static guint dissect_ceph_acks(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
-+{
-+ guint32 offset = 0;
-+
-+ if (check_col(pinfo->cinfo, COL_PROTOCOL))
-+ col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_CEPH);
-+ /* Clear out stuff in the info column */
-+ if(check_col(pinfo->cinfo,COL_INFO)){
-+ col_clear(pinfo->cinfo,COL_INFO);
-+ col_add_fstr(pinfo->cinfo, COL_INFO, "Ack");
-+ }
-+ if (tree) {
-+ proto_tree_add_item(tree, proto_ceph, tvb, 0, 5, TRUE);
-+ proto_tree_add_item(tree, hf_ceph_hdr_tag, tvb, offset, 1, TRUE);
-+ proto_tree_add_item(tree, hf_ceph_hdr_seq_ack, tvb, offset+1, 4, TRUE);
-+ offset += 5;
-+ }
-+
-+ return offset;
-+}
-+
-+/* determine PDU length of protocol ceph */
-+static guint get_ceph_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset)
-+{
-+ const char *ptr;
-+ guint32 len;
-+ guint32 pos = 0;
-+
-+ ptr = tvb_get_ptr(tvb, offset, /* sizeof(CEPH_BANNER) */tvb->length-offset);
-+ if (ptr && memcmp(ptr, "ceph", 4) == 0) {
-+ if (DEST_PORT_CEPH) {
-+ len = sizeof(CEPH_BANNER) - 1 +
-+ sizeof(struct ceph_entity_addr) +
-+ sizeof(struct ceph_msg_connect);
-+ } else
-+ len = sizeof(CEPH_BANNER) - 1 +
-+ sizeof(struct ceph_entity_addr) +
-+ sizeof(struct ceph_msg_connect_reply);
-+
-+ return len;
-+ }
-+
-+ if (*ptr == CEPH_MSGR_TAG_ACK)
-+ pos = ACK_MSG_SIZE;
-+
-+ len = pos + (guint)1 + sizeof(struct ceph_msg_header) +
-+ TVB_MSG_FIELD(tvb_get_letohl, tvb, offset, front_len) +
-+ TVB_MSG_FIELD(tvb_get_letohl, tvb, offset, data_len) +
-+ sizeof(struct ceph_msg_footer);
-+
-+ if (!*ptr)
-+ return 0;
-+ return len;
-+}
-+
-+
-+static void dissect_ceph(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
-+{
-+ const char *ptr;
-+
-+ ptr = tvb_get_ptr(tvb, 0, 6);
-+
-+ if ((*ptr == CEPH_MSGR_TAG_MSG) ||
-+ (memcmp(ptr, CEPH_BANNER, 4) == 0) ||
-+ ((ptr[0] == CEPH_MSGR_TAG_ACK) && (ptr[5] == CEPH_MSGR_TAG_MSG))
-+ ) {
-+ tcp_dissect_pdus(tvb, pinfo, tree, TRUE, TVB_MSG_HEADER_POS(src),
-+ get_ceph_message_len, dissect_ceph_message);
-+ } else {
-+ dissect_ceph_acks(tvb, pinfo, tree);
-+ }
-+}
-+
-Index: plugins/ceph/plugin.rc.in
-===================================================================
---- plugins/ceph/plugin.rc.in (revision 0)
-+++ plugins/ceph/plugin.rc.in (revision 0)
-@@ -0,0 +1,34 @@
-+#include "winver.h"
-+
-+VS_VERSION_INFO VERSIONINFO
-+ FILEVERSION @RC_MODULE_VERSION@
-+ PRODUCTVERSION @RC_VERSION@
-+ FILEFLAGSMASK 0x0L
-+#ifdef _DEBUG
-+ FILEFLAGS VS_FF_PRERELEASE+VS_FF_DEBUG
-+#else
-+ FILEFLAGS VS_FF_PRERELEASE
-+#endif
-+ FILEOS VOS_NT_WINDOWS32
-+ FILETYPE VFT_DLL
-+BEGIN
-+ BLOCK "StringFileInfo"
-+ BEGIN
-+ BLOCK "040904b0"
-+ BEGIN
-+ VALUE "CompanyName", "The Wireshark developer community, http://www.wireshark.org/\0"
-+ VALUE "FileDescription", "@PACKAGE@ dissector\0"
-+ VALUE "FileVersion", "@MODULE_VERSION@\0"
-+ VALUE "InternalName", "@PACKAGE@ @MODULE_VERSION@\0"
-+ VALUE "LegalCopyright", "Copyright � 1998 Gerald Combs <gerald@wireshark.org>, Gilbert Ramirez <gram@alumni.rice.edu> and others\0"
-+ VALUE "OriginalFilename", "@PLUGIN_NAME@.dll\0"
-+ VALUE "ProductName", "Wireshark\0"
-+ VALUE "ProductVersion", "@VERSION@\0"
-+ VALUE "Comments", "Build with @MSVC_VARIANT@\0"
-+ END
-+ END
-+ BLOCK "VarFileInfo"
-+ BEGIN
-+ VALUE "Translation", 0x409, 1200
-+ END
-+END
-Index: plugins/ceph/Makefile.nmake
-===================================================================
---- plugins/ceph/Makefile.nmake (revision 0)
-+++ plugins/ceph/Makefile.nmake (revision 0)
-@@ -0,0 +1,100 @@
-+# Makefile.nmake
-+# nmake file for Wireshark plugin
-+#
-+# $Id: Makefile.nmake 24520 2008-03-01 12:31:01Z jake $
-+#
-+
-+include ..\..\config.nmake
-+include moduleinfo.nmake
-+
-+include Makefile.common
-+
-+CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) \
-+ /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
-+
-+.c.obj::
-+ $(CC) $(CFLAGS) -Fd.\ -c $<
-+
-+LDFLAGS = $(PLUGIN_LDFLAGS)
-+
-+!IFDEF ENABLE_LIBWIRESHARK
-+LINK_PLUGIN_WITH=..\..\epan\libwireshark.lib
-+CFLAGS=/DHAVE_WIN32_LIBWIRESHARK_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS)
-+
-+DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj)
-+
-+DISSECTOR_SUPPORT_OBJECTS = $(DISSECTOR_SUPPORT_SRC:.c=.obj)
-+
-+OBJECTS = $(DISSECTOR_OBJECTS) $(DISSECTOR_SUPPORT_OBJECTS) plugin.obj
-+
-+RESOURCE=$(PLUGIN_NAME).res
-+
-+all: $(PLUGIN_NAME).dll
-+
-+$(PLUGIN_NAME).rc : moduleinfo.nmake
-+ sed -e s/@PLUGIN_NAME@/$(PLUGIN_NAME)/ \
-+ -e s/@RC_MODULE_VERSION@/$(RC_MODULE_VERSION)/ \
-+ -e s/@RC_VERSION@/$(RC_VERSION)/ \
-+ -e s/@MODULE_VERSION@/$(MODULE_VERSION)/ \
-+ -e s/@PACKAGE@/$(PACKAGE)/ \
-+ -e s/@VERSION@/$(VERSION)/ \
-+ -e s/@MSVC_VARIANT@/$(MSVC_VARIANT)/ \
-+ < plugin.rc.in > $@
-+
-+$(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLUGIN_WITH) $(RESOURCE)
-+ link -dll /out:$(PLUGIN_NAME).dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
-+ $(GLIB_LIBS) $(RESOURCE)
-+
-+#
-+# Build plugin.c, which contains the plugin version[] string, a
-+# function plugin_register() that calls the register routines for all
-+# protocols, and a function plugin_reg_handoff() that calls the handoff
-+# registration routines for all protocols.
-+#
-+# We do this by scanning sources. If that turns out to be too slow,
-+# maybe we could just require every .o file to have an register routine
-+# of a given name (packet-aarp.o -> proto_register_aarp, etc.).
-+#
-+# Formatting conventions: The name of the proto_register_* routines an
-+# proto_reg_handoff_* routines must start in column zero, or must be
-+# preceded only by "void " starting in column zero, and must not be
-+# inside #if.
-+#
-+# DISSECTOR_SRC is assumed to have all the files that need to be scanned.
-+#
-+# For some unknown reason, having a big "for" loop in the Makefile
-+# to scan all the files doesn't work with some "make"s; they seem to
-+# pass only the first few names in the list to the shell, for some
-+# reason.
-+#
-+# Therefore, we have a script to generate the plugin.c file.
-+# The shell script runs slowly, as multiple greps and seds are run
-+# for each input file; this is especially slow on Windows. Therefore,
-+# if Python is present (as indicated by PYTHON being defined), we run
-+# a faster Python script to do that work instead.
-+#
-+# The first argument is the directory in which the source files live.
-+# The second argument is "plugin", to indicate that we should build
-+# a plugin.c file for a plugin.
-+# All subsequent arguments are the files to scan.
-+#
-+!IFDEF PYTHON
-+plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg.py
-+ @echo Making plugin.c (using python)
-+ @$(PYTHON) "../../tools/make-dissector-reg.py" . plugin $(DISSECTOR_SRC)
-+!ELSE
-+plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg
-+ @echo Making plugin.c (using sh)
-+ @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC)
-+!ENDIF
-+
-+!ENDIF
-+
-+clean:
-+ rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
-+ $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
-+ $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
-+
-+distclean: clean
-+
-+maintainer-clean: distclean
-Index: plugins/ceph/moduleinfo.h
-===================================================================
---- plugins/ceph/moduleinfo.h (revision 0)
-+++ plugins/ceph/moduleinfo.h (revision 0)
-@@ -0,0 +1,16 @@
-+/* Included *after* config.h, in order to re-define these macros */
-+
-+#ifdef PACKAGE
-+#undef PACKAGE
-+#endif
-+
-+/* Name of package */
-+#define PACKAGE "ceph"
-+
-+
-+#ifdef VERSION
-+#undef VERSION
-+#endif
-+
-+/* Version number of package */
-+#define VERSION "0.0.1"
-Index: plugins/ceph/Makefile.am
-===================================================================
---- plugins/ceph/Makefile.am (revision 0)
-+++ plugins/ceph/Makefile.am (revision 0)
-@@ -0,0 +1,126 @@
-+# Makefile.am
-+# Automake file for Cisco SS7 Session Management plugin
-+# Copyright 2004, Duncan Sargeant <dunc-ethereal@rcpt.to>
-+#
-+# $Id: Makefile.am 24488 2008-02-27 16:18:30Z stig $
-+#
-+# Wireshark - Network traffic analyzer
-+# By Gerald Combs <gerald@wireshark.org>
-+# Copyright 1998 Gerald Combs
-+#
-+# This program is free software; you can redistribute it and/or
-+# modify it under the terms of the GNU General Public License
-+# as published by the Free Software Foundation; either version 2
-+# of the License, or (at your option) any later version.
-+#
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+# GNU General Public License for more details.
-+#
-+# You should have received a copy of the GNU General Public License
-+# along with this program; if not, write to the Free Software
-+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+#
-+
-+INCLUDES = -I$(top_srcdir) -I$(includedir)
-+
-+include Makefile.common
-+
-+
-+if HAVE_WARNINGS_AS_ERRORS
-+AM_CFLAGS = -Werror
-+endif
-+
-+plugindir = @plugindir@
-+
-+plugin_LTLIBRARIES = ceph.la
-+ceph_la_SOURCES = \
-+ plugin.c \
-+ moduleinfo.h \
-+ $(DISSECTOR_SRC) \
-+ $(DISSECTOR_INCLUDES)
-+ceph_la_LDFLAGS = -module -avoid-version
-+ceph_la_LIBADD = @PLUGIN_LIBS@
-+
-+# Libs must be cleared, or else libtool won't create a shared module.
-+# If your module needs to be linked against any particular libraries,
-+# add them here.
-+LIBS =
-+
-+#
-+# Build plugin.c, which contains the plugin version[] string, a
-+# function plugin_register() that calls the register routines for all
-+# protocols, and a function plugin_reg_handoff() that calls the handoff
-+# registration routines for all protocols.
-+#
-+# We do this by scanning sources. If that turns out to be too slow,
-+# maybe we could just require every .o file to have an register routine
-+# of a given name (packet-aarp.o -> proto_register_aarp, etc.).
-+#
-+# Formatting conventions: The name of the proto_register_* routines an
-+# proto_reg_handoff_* routines must start in column zero, or must be
-+# preceded only by "void " starting in column zero, and must not be
-+# inside #if.
-+#
-+# DISSECTOR_SRC is assumed to have all the files that need to be scanned.
-+#
-+# For some unknown reason, having a big "for" loop in the Makefile
-+# to scan all the files doesn't work with some "make"s; they seem to
-+# pass only the first few names in the list to the shell, for some
-+# reason.
-+#
-+# Therefore, we have a script to generate the plugin.c file.
-+# The shell script runs slowly, as multiple greps and seds are run
-+# for each input file; this is especially slow on Windows. Therefore,
-+# if Python is present (as indicated by PYTHON being defined), we run
-+# a faster Python script to do that work instead.
-+#
-+# The first argument is the directory in which the source files live.
-+# The second argument is "plugin", to indicate that we should build
-+# a plugin.c file for a plugin.
-+# All subsequent arguments are the files to scan.
-+#
-+plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \
-+ $(top_srcdir)/tools/make-dissector-reg.py
-+ @if test -n "$(PYTHON)"; then \
-+ echo Making plugin.c with python ; \
-+ $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \
-+ plugin $(DISSECTOR_SRC) ; \
-+ else \
-+ echo Making plugin.c with shell script ; \
-+ $(top_srcdir)/tools/make-dissector-reg $(srcdir) \
-+ $(plugin_src) plugin $(DISSECTOR_SRC) ; \
-+ fi
-+
-+#
-+# Currently plugin.c can be included in the distribution because
-+# we always build all protocol dissectors. We used to have to check
-+# whether or not to build the snmp dissector. If we again need to
-+# variably build something, making plugin.c non-portable, uncomment
-+# the dist-hook line below.
-+#
-+# Oh, yuk. We don't want to include "plugin.c" in the distribution, as
-+# its contents depend on the configuration, and therefore we want it
-+# to be built when the first "make" is done; however, Automake insists
-+# on putting *all* source into the distribution.
-+#
-+# We work around this by having a "dist-hook" rule that deletes
-+# "plugin.c", so that "dist" won't pick it up.
-+#
-+#dist-hook:
-+# @rm -f $(distdir)/plugin.c
-+
-+CLEANFILES = \
-+ ceph \
-+ *~
-+
-+MAINTAINERCLEANFILES = \
-+ Makefile.in \
-+ plugin.c
-+
-+EXTRA_DIST = \
-+ Makefile.common \
-+ Makefile.nmake \
-+ moduleinfo.nmake \
-+ plugin.rc.in
-Index: plugins/ceph/moduleinfo.nmake
-===================================================================
---- plugins/ceph/moduleinfo.nmake (revision 0)
-+++ plugins/ceph/moduleinfo.nmake (revision 0)
-@@ -0,0 +1,28 @@
-+#
-+# $Id: moduleinfo.nmake 20158 2006-12-19 22:23:37Z jake $
-+#
-+
-+# The name
-+PACKAGE=ceph
-+
-+# The version
-+MODULE_VERSION_MAJOR=0
-+MODULE_VERSION_MINOR=0
-+MODULE_VERSION_MICRO=1
-+MODULE_VERSION_EXTRA=0
-+
-+#
-+# The RC_VERSION should be comma-separated, not dot-separated,
-+# as per Graham Bloice's message in
-+#
-+# http://www.ethereal.com/lists/ethereal-dev/200303/msg00283.html
-+#
-+# "The RC_VERSION variable in config.nmake should be comma separated.
-+# This allows the resources to be built correctly and the version
-+# number to be correctly displayed in the explorer properties dialog
-+# for the executables, and XP's tooltip, rather than 0.0.0.0."
-+#
-+
-+MODULE_VERSION=$(MODULE_VERSION_MAJOR).$(MODULE_VERSION_MINOR).$(MODULE_VERSION_MICRO).$(MODULE_VERSION_EXTRA)
-+RC_MODULE_VERSION=$(MODULE_VERSION_MAJOR),$(MODULE_VERSION_MINOR),$(MODULE_VERSION_MICRO),$(MODULE_VERSION_EXTRA)
-+
-Index: plugins/ceph/ceph_fs.h
-===================================================================
---- plugins/ceph/ceph_fs.h (revision 0)
-+++ plugins/ceph/ceph_fs.h (revision 0)
-@@ -0,0 +1,1225 @@
-+/*
-+ * ceph_fs.h - Ceph constants and data types to share between kernel and
-+ * user space.
-+ *
-+ * LGPL2
-+ */
-+
-+#ifndef _FS_CEPH_CEPH_FS_H
-+#define _FS_CEPH_CEPH_FS_H
-+
-+
-+#define CEPH_MON_PORT 12345
-+
-+/*
-+ * Max file size is a policy choice; in reality we are limited
-+ * by 2^64.
-+ */
-+#define CEPH_FILE_MAX_SIZE (1ULL << 40) /* 1 TB */
-+
-+/*
-+ * tcp connection banner. include a protocol version. and adjust
-+ * whenever the wire protocol changes. try to keep this string length
-+ * constant.
-+ */
-+#define CEPH_BANNER "ceph 008\n"
-+#define CEPH_BANNER_MAX_LEN 30
-+
-+/*
-+ * subprotocol versions. when specific messages types or high-level
-+ * protocols change, bump the affected components.
-+ */
-+#define CEPH_OSD_PROTOCOL 3
-+#define CEPH_MDS_PROTOCOL 2
-+#define CEPH_MON_PROTOCOL 2
-+#define CEPH_CLIENT_PROTOCOL 1
-+#define CEPH_ONDISK_FORMAT 1
-+
-+/*
-+ * types in this file are defined as little-endian, and are
-+ * primarily intended to describe data structures that pass
-+ * over the wire or that are stored on disk.
-+ */
-+
-+/*
-+ * some basics
-+ */
-+typedef __le64 ceph_version_t;
-+typedef __le64 ceph_tid_t; /* transaction id */
-+typedef __le32 ceph_epoch_t;
-+
-+
-+/*
-+ * fs id
-+ */
-+struct ceph_fsid {
-+ __le64 major;
-+ __le64 minor;
-+} __attribute__ ((packed));
-+
-+static inline int ceph_fsid_equal(const struct ceph_fsid *a,
-+ const struct ceph_fsid *b)
-+{
-+ return a->major == b->major && a->minor == b->minor;
-+}
-+
-+
-+/*
-+ * ino, object, etc.
-+ */
-+#define CEPH_INO_ROOT 1
-+
-+typedef __le64 ceph_snapid_t;
-+#define CEPH_MAXSNAP ((__u64)(-3))
-+#define CEPH_SNAPDIR ((__u64)(-1))
-+#define CEPH_NOSNAP ((__u64)(-2))
-+
-+struct ceph_object {
-+ union {
-+ __u8 raw[20]; /* fits a sha1 hash */
-+ struct {
-+ __le64 ino; /* inode "file" identifier */
-+ __le32 bno; /* "block" (object) in that "file" */
-+ __le64 snap; /* snapshot id. usually NOSNAP. */
-+ } __attribute__ ((packed));
-+ };
-+} __attribute__ ((packed));
-+
-+struct ceph_timespec {
-+ __le32 tv_sec;
-+ __le32 tv_nsec;
-+} __attribute__ ((packed));
-+
-+
-+/*
-+ * "Frags" are a way to describe a subset of a 32-bit number space,
-+ * using a mask and a value to match against that mask. Any given frag
-+ * (subset of the number space) can be partitioned into 2^n sub-frags.
-+ *
-+ * Frags are encoded into a 32-bit word:
-+ * 8 upper bits = "bits"
-+ * 24 lower bits = "value"
-+ * (We could go to 5+27 bits, but who cares.)
-+ *
-+ * We use the _most_ significant bits of the 24 bit value. This makes
-+ * values logically sort.
-+ *
-+ * Unfortunately, because the "bits" field is still in the high bits, we
-+ * can't sort encoded frags numerically. However, it does allow you
-+ * to feed encoded frags as values into frag_contains_value.
-+ */
-+static inline __u32 frag_make(__u32 b, __u32 v)
-+{
-+ return (b << 24) |
-+ (v & (0xffffffu << (24-b)) & 0xffffffu);
-+}
-+static inline __u32 frag_bits(__u32 f)
-+{
-+ return f >> 24;
-+}
-+static inline __u32 frag_value(__u32 f)
-+{
-+ return f & 0xffffffu;
-+}
-+static inline __u32 frag_mask(__u32 f)
-+{
-+ return (0xffffffu << (24-frag_bits(f))) & 0xffffffu;
-+}
-+static inline __u32 frag_mask_shift(__u32 f)
-+{
-+ return 24 - frag_bits(f);
-+}
-+
-+static inline int frag_contains_value(__u32 f, __u32 v)
-+{
-+ return (v & frag_mask(f)) == frag_value(f);
-+}
-+static inline int frag_contains_frag(__u32 f, __u32 sub)
-+{
-+ /* is sub as specific as us, and contained by us? */
-+ return frag_bits(sub) >= frag_bits(f) &&
-+ (frag_value(sub) & frag_mask(f)) == frag_value(f);
-+}
-+
-+static inline __u32 frag_parent(__u32 f)
-+{
-+ return frag_make(frag_bits(f) - 1,
-+ frag_value(f) & (frag_mask(f) << 1));
-+}
-+static inline int frag_is_left_child(__u32 f)
-+{
-+ return frag_bits(f) > 0 &&
-+ (frag_value(f) & (0x1000000 >> frag_bits(f))) == 0;
-+}
-+static inline int frag_is_right_child(__u32 f)
-+{
-+ return frag_bits(f) > 0 &&
-+ (frag_value(f) & (0x1000000 >> frag_bits(f))) == 1;
-+}
-+static inline __u32 frag_sibling(__u32 f)
-+{
-+ return frag_make(frag_bits(f),
-+ frag_value(f) ^ (0x1000000 >> frag_bits(f)));
-+}
-+static inline __u32 frag_left_child(__u32 f)
-+{
-+ return frag_make(frag_bits(f)+1, frag_value(f));
-+}
-+static inline __u32 frag_right_child(__u32 f)
-+{
-+ return frag_make(frag_bits(f)+1,
-+ frag_value(f) | (0x1000000 >> (1+frag_bits(f))));
-+}
-+static inline __u32 frag_make_child(__u32 f, int by, int i)
-+{
-+ int newbits = frag_bits(f) + by;
-+ return frag_make(newbits,
-+ frag_value(f) | (i << (24 - newbits)));
-+}
-+static inline int frag_is_leftmost(__u32 f)
-+{
-+ return frag_value(f) == 0;
-+}
-+static inline int frag_is_rightmost(__u32 f)
-+{
-+ return frag_value(f) == frag_mask(f);
-+}
-+static inline __u32 frag_next(__u32 f)
-+{
-+ return frag_make(frag_bits(f),
-+ frag_value(f) + (0x1000000 >> frag_bits(f)));
-+}
-+
-+/*
-+ * comparator to sort frags logically, as when traversing the
-+ * number space in ascending order...
-+ */
-+static inline int frag_compare(__u32 a, __u32 b)
-+{
-+ unsigned va = frag_value(a);
-+ unsigned vb = frag_value(b);
-+ if (va < vb)
-+ return -1;
-+ if (va > vb)
-+ return 1;
-+ va = frag_bits(a);
-+ vb = frag_bits(b);
-+ if (va < vb)
-+ return -1;
-+ if (va > vb)
-+ return 1;
-+ return 0;
-+}
-+
-+/*
-+ * object layout - how objects are mapped into PGs
-+ */
-+#define CEPH_OBJECT_LAYOUT_HASH 1
-+#define CEPH_OBJECT_LAYOUT_LINEAR 2
-+#define CEPH_OBJECT_LAYOUT_HASHINO 3
-+
-+/*
-+ * pg layout -- how PGs are mapped onto (sets of) OSDs
-+ */
-+#define CEPH_PG_LAYOUT_CRUSH 0
-+#define CEPH_PG_LAYOUT_HASH 1
-+#define CEPH_PG_LAYOUT_LINEAR 2
-+#define CEPH_PG_LAYOUT_HYBRID 3
-+
-+/*
-+ * ceph_file_layout - describe data layout for a file/inode
-+ */
-+struct ceph_file_layout {
-+ /* file -> object mapping */
-+ __le32 fl_stripe_unit; /* stripe unit, in bytes. must be multiple
-+ of page size. */
-+ __le32 fl_stripe_count; /* over this many objects */
-+ __le32 fl_object_size; /* until objects are this big, then move to
-+ new objects */
-+ __le32 fl_cas_hash; /* 0 = none; 1 = sha256 */
-+
-+ /* pg -> disk layout */
-+ __le32 fl_object_stripe_unit; /* for per-object parity, if any */
-+
-+ /* object -> pg layout */
-+ __le32 fl_pg_preferred; /* preferred primary for pg (-1 for none) */
-+ __u8 fl_pg_type; /* pg type; see PG_TYPE_* */
-+ __u8 fl_pg_size; /* pg size (num replicas, etc.) */
-+ __u8 fl_pg_pool; /* implies crush ruleset AND object namespace */
-+} __attribute__ ((packed));
-+
-+#define ceph_file_layout_su(l) ((__s32)le32_to_cpu((l).fl_stripe_unit))
-+#define ceph_file_layout_stripe_count(l) \
-+ ((__s32)le32_to_cpu((l).fl_stripe_count))
-+#define ceph_file_layout_object_size(l) ((__s32)le32_to_cpu((l).fl_object_size))
-+#define ceph_file_layout_cas_hash(l) ((__s32)le32_to_cpu((l).fl_cas_hash))
-+#define ceph_file_layout_object_su(l) \
-+ ((__s32)le32_to_cpu((l).fl_object_stripe_unit))
-+#define ceph_file_layout_pg_preferred(l) \
-+ ((__s32)le32_to_cpu((l).fl_pg_preferred))
-+
-+#define ceph_file_layout_stripe_width(l) (le32_to_cpu((l).fl_stripe_unit) * \
-+ le32_to_cpu((l).fl_stripe_count))
-+
-+/* "period" == bytes before i start on a new set of objects */
-+#define ceph_file_layout_period(l) (le32_to_cpu((l).fl_object_size) * \
-+ le32_to_cpu((l).fl_stripe_count))
-+
-+/*
-+ * placement group.
-+ * we encode this into one __le64.
-+ */
-+#define CEPH_PG_TYPE_REP 1
-+#define CEPH_PG_TYPE_RAID4 2
-+union ceph_pg {
-+ __u64 pg64;
-+ struct {
-+ __s16 preferred; /* preferred primary osd */
-+ __u16 ps; /* placement seed */
-+ __u8 __pad;
-+ __u8 size;
-+ __u8 pool; /* implies crush ruleset */
-+ __u8 type;
-+ } pg;
-+} __attribute__ ((packed));
-+
-+#define ceph_pg_is_rep(pg) ((pg).pg.type == CEPH_PG_TYPE_REP)
-+#define ceph_pg_is_raid4(pg) ((pg).pg.type == CEPH_PG_TYPE_RAID4)
-+
-+/*
-+ * stable_mod func is used to control number of placement groups.
-+ * similar to straight-up modulo, but produces a stable mapping as b
-+ * increases over time. b is the number of bins, and bmask is the
-+ * containing power of 2 minus 1.
-+ *
-+ * b <= bmask and bmask=(2**n)-1
-+ * e.g., b=12 -> bmask=15, b=123 -> bmask=127
-+ */
-+static inline int ceph_stable_mod(int x, int b, int bmask)
-+{
-+ if ((x & bmask) < b)
-+ return x & bmask;
-+ else
-+ return x & (bmask >> 1);
-+}
-+
-+/*
-+ * object layout - how a given object should be stored.
-+ */
-+struct ceph_object_layout {
-+ __le64 ol_pgid; /* raw pg, with _full_ ps precision. */
-+ __le32 ol_stripe_unit;
-+} __attribute__ ((packed));
-+
-+/*
-+ * compound epoch+version, used by storage layer to serialize mutations
-+ */
-+struct ceph_eversion {
-+ ceph_epoch_t epoch;
-+ __le64 version;
-+} __attribute__ ((packed));
-+
-+/*
-+ * osd map bits
-+ */
-+
-+/* status bits */
-+#define CEPH_OSD_EXISTS 1
-+#define CEPH_OSD_UP 2
-+#define CEPH_OSD_CLEAN 4 /* as in, clean shutdown */
-+
-+/* osd weights. fixed point value: 0x10000 == 1.0 ("in"), 0 == "out" */
-+#define CEPH_OSD_IN 0x10000
-+#define CEPH_OSD_OUT 0
-+
-+
-+/*
-+ * string hash.
-+ *
-+ * taken from Linux, tho we should probably take care to use this one
-+ * in case the upstream hash changes.
-+ */
-+
-+/* Name hashing routines. Initial hash value */
-+/* Hash courtesy of the R5 hash in reiserfs modulo sign bits */
-+#define ceph_init_name_hash() 0
-+
-+/* partial hash update function. Assume roughly 4 bits per character */
-+static inline unsigned long
-+ceph_partial_name_hash(unsigned long c, unsigned long prevhash)
-+{
-+ return (prevhash + (c << 4) + (c >> 4)) * 11;
-+}
-+
-+/*
-+ * Finally: cut down the number of bits to a int value (and try to avoid
-+ * losing bits)
-+ */
-+static inline unsigned long ceph_end_name_hash(unsigned long hash)
-+{
-+ return (unsigned int) hash;
-+}
-+
-+/* Compute the hash for a name string. */
-+static inline unsigned int
-+ceph_full_name_hash(const char *name, unsigned int len)
-+{
-+ unsigned long hash = ceph_init_name_hash();
-+ while (len--)
-+ hash = ceph_partial_name_hash(*name++, hash);
-+ return ceph_end_name_hash(hash);
-+}
-+
-+
-+
-+/*********************************************
-+ * message layer
-+ */
-+
-+/*
-+ * entity_name
-+ */
-+struct ceph_entity_name {
-+ __le32 type;
-+ __le32 num;
-+} __attribute__ ((packed));
-+
-+#define CEPH_ENTITY_TYPE_MON 1
-+#define CEPH_ENTITY_TYPE_MDS 2
-+#define CEPH_ENTITY_TYPE_OSD 3
-+#define CEPH_ENTITY_TYPE_CLIENT 4
-+#define CEPH_ENTITY_TYPE_ADMIN 5
-+
-+/* used by message exchange protocol */
-+#define CEPH_MSGR_TAG_READY 1 /* server->client: ready for messages */
-+#define CEPH_MSGR_TAG_RESETSESSION 2 /* server->client: reset, try again */
-+#define CEPH_MSGR_TAG_WAIT 3 /* server->client: wait for racing
-+ incoming connection */
-+#define CEPH_MSGR_TAG_RETRY_SESSION 4 /* server->client + cseq: try again
-+ with higher cseq */
-+#define CEPH_MSGR_TAG_RETRY_GLOBAL 5 /* server->client + gseq: try again
-+ with higher gseq */
-+#define CEPH_MSGR_TAG_CLOSE 6 /* closing pipe */
-+#define CEPH_MSGR_TAG_MSG 10 /* message */
-+#define CEPH_MSGR_TAG_ACK 11 /* message ack */
-+
-+
-+/*
-+ * entity_addr -- network address
-+ */
-+struct ceph_entity_addr {
-+ __le32 erank; /* entity's rank in process */
-+ __le32 nonce; /* unique id for process (e.g. pid) */
-+ struct sockaddr_in ipaddr;
-+} __attribute__ ((packed));
-+
-+static inline bool ceph_entity_addr_is_local(const struct ceph_entity_addr *a,
-+ const struct ceph_entity_addr *b)
-+{
-+ return le32_to_cpu(a->nonce) == le32_to_cpu(b->nonce) &&
-+ a->ipaddr.sin_addr.s_addr == b->ipaddr.sin_addr.s_addr;
-+}
-+
-+static inline bool ceph_entity_addr_equal(const struct ceph_entity_addr *a,
-+ const struct ceph_entity_addr *b)
-+{
-+ return memcmp(a, b, sizeof(*a)) == 0;
-+}
-+
-+struct ceph_entity_inst {
-+ struct ceph_entity_name name;
-+ struct ceph_entity_addr addr;
-+} __attribute__ ((packed));
-+
-+
-+/*
-+ * connection negotiation
-+ */
-+struct ceph_msg_connect {
-+ __le32 host_type; /* CEPH_ENTITY_TYPE_* */
-+ __le32 global_seq;
-+ __le32 connect_seq;
-+ __u8 flags;
-+} __attribute__ ((packed));
-+
-+struct ceph_msg_connect_reply {
-+ __u8 tag;
-+ __le32 global_seq;
-+ __le32 connect_seq;
-+ __u8 flags;
-+} __attribute__ ((packed));
-+
-+#define CEPH_MSG_CONNECT_LOSSY 1 /* messages i send may be safely dropped */
-+
-+
-+/*
-+ * message header
-+ */
-+struct ceph_msg_header {
-+ __le64 seq; /* message seq# for this session */
-+ __le16 type; /* message type */
-+ __le16 priority; /* priority. higher value == higher priority */
-+ __le16 mon_protocol, osd_protocol, mds_protocol,
-+ client_protocol; /* protocol versions */
-+ __le32 front_len; /* bytes in main payload */
-+ __le32 data_off; /* sender: include full offset;
-+ receiver: mask against ~PAGE_MASK */
-+ __le32 data_len; /* bytes of data payload */
-+ struct ceph_entity_inst src, orig_src, dst;
-+ __le32 crc; /* header crc32c */
-+} __attribute__ ((packed));
-+
-+#define CEPH_MSG_PRIO_LOW 64
-+#define CEPH_MSG_PRIO_DEFAULT 127
-+#define CEPH_MSG_PRIO_HIGH 196
-+#define CEPH_MSG_PRIO_HIGHEST 255
-+
-+/*
-+ * follows data payload
-+ */
-+struct ceph_msg_footer {
-+ __le32 flags;
-+ __le32 front_crc;
-+ __le32 data_crc;
-+} __attribute__ ((packed));
-+
-+#define CEPH_MSG_FOOTER_ABORTED (1<<0) /* drop this message */
-+#define CEPH_MSG_FOOTER_NOCRC (1<<1) /* no data crc */
-+
-+
-+/*
-+ * message types
-+ */
-+
-+/* misc */
-+#define CEPH_MSG_SHUTDOWN 1
-+#define CEPH_MSG_PING 2
-+
-+/* client <-> monitor */
-+#define CEPH_MSG_MON_MAP 4
-+#define CEPH_MSG_MON_GET_MAP 5
-+#define CEPH_MSG_CLIENT_MOUNT 10
-+#define CEPH_MSG_CLIENT_UNMOUNT 11
-+#define CEPH_MSG_STATFS 12
-+#define CEPH_MSG_STATFS_REPLY 13
-+
-+/* client <-> mds */
-+#define CEPH_MSG_MDS_GETMAP 20
-+#define CEPH_MSG_MDS_MAP 21
-+
-+#define CEPH_MSG_CLIENT_SESSION 22
-+#define CEPH_MSG_CLIENT_RECONNECT 23
-+
-+#define CEPH_MSG_CLIENT_REQUEST 24
-+#define CEPH_MSG_CLIENT_REQUEST_FORWARD 25
-+#define CEPH_MSG_CLIENT_REPLY 26
-+#define CEPH_MSG_CLIENT_CAPS 0x310
-+#define CEPH_MSG_CLIENT_LEASE 0x311
-+#define CEPH_MSG_CLIENT_SNAP 0x312
-+
-+/* osd */
-+#define CEPH_MSG_OSD_GETMAP 40
-+#define CEPH_MSG_OSD_MAP 41
-+#define CEPH_MSG_OSD_OP 42
-+#define CEPH_MSG_OSD_OPREPLY 43
-+
-+
-+struct ceph_mon_statfs {
-+ struct ceph_fsid fsid;
-+ __le64 tid;
-+};
-+
-+struct ceph_statfs {
-+ __le64 f_total;
-+ __le64 f_free; /* used = total - free (KB) */
-+ __le64 f_avail; /* usable */
-+ __le64 f_objects;
-+};
-+
-+struct ceph_mon_statfs_reply {
-+ struct ceph_fsid fsid;
-+ __le64 tid;
-+ struct ceph_statfs st;
-+};
-+
-+struct ceph_osd_getmap {
-+ struct ceph_fsid fsid;
-+ __le32 start;
-+} __attribute__ ((packed));
-+
-+struct ceph_mds_getmap {
-+ struct ceph_fsid fsid;
-+ __le32 want;
-+} __attribute__ ((packed));
-+
-+
-+/*
-+ * mds states
-+ * > 0 -> in
-+ * <= 0 -> out
-+ */
-+#define CEPH_MDS_STATE_DNE 0 /* down, does not exist. */
-+#define CEPH_MDS_STATE_STOPPED -1 /* down, once existed, but no subtrees.
-+ empty log. */
-+#define CEPH_MDS_STATE_DESTROYING -2 /* down, existing, semi-destroyed. */
-+#define CEPH_MDS_STATE_FAILED 3 /* down, needs to be recovered. */
-+
-+#define CEPH_MDS_STATE_BOOT -4 /* up, boot announcement. */
-+#define CEPH_MDS_STATE_STANDBY -5 /* up, idle. waiting for assignment. */
-+#define CEPH_MDS_STATE_CREATING -6 /* up, creating MDS instance. */
-+#define CEPH_MDS_STATE_STARTING -7 /* up, starting previously stopped mds. */
-+
-+#define CEPH_MDS_STATE_REPLAY 8 /* up, replaying journal. */
-+#define CEPH_MDS_STATE_RESOLVE 9 /* up, disambiguating distributed
-+ operations (import, rename, etc.) */
-+#define CEPH_MDS_STATE_RECONNECT 10 /* up, reconnect to clients */
-+#define CEPH_MDS_STATE_REJOIN 11 /* up, rejoining distributed cache */
-+#define CEPH_MDS_STATE_ACTIVE 12 /* up, active */
-+#define CEPH_MDS_STATE_STOPPING 13 /* up, but exporting metadata */
-+
-+
-+/*
-+ * metadata lock types.
-+ * - these are bitmasks.. we can compose them
-+ * - they also define the lock ordering by the MDS
-+ * - a few of these are internal to the mds
-+ */
-+#define CEPH_LOCK_DN 1
-+#define CEPH_LOCK_ISNAP 2
-+#define CEPH_LOCK_IVERSION 4 /* mds internal */
-+#define CEPH_LOCK_IFILE 8 /* mds internal */
-+#define CEPH_LOCK_IDIR 16 /* mds internal */
-+#define CEPH_LOCK_IAUTH 32
-+#define CEPH_LOCK_ILINK 64
-+#define CEPH_LOCK_IDFT 128 /* dir frag tree */
-+#define CEPH_LOCK_INEST 256 /* mds internal */
-+#define CEPH_LOCK_IXATTR 512
-+#define CEPH_LOCK_INO 2048 /* immutable inode bits; not a lock */
-+
-+/* alias for either filelock or dirlock */
-+#define CEPH_LOCK_ICONTENT (CEPH_LOCK_IFILE|CEPH_LOCK_IDIR)
-+
-+/*
-+ * stat masks are defined in terms of the locks that cover inode fields.
-+ */
-+#define CEPH_STAT_MASK_INODE CEPH_LOCK_INO
-+#define CEPH_STAT_MASK_TYPE CEPH_LOCK_INO /* mode >> 12 */
-+#define CEPH_STAT_MASK_SYMLINK CEPH_LOCK_INO
-+#define CEPH_STAT_MASK_UID CEPH_LOCK_IAUTH
-+#define CEPH_STAT_MASK_GID CEPH_LOCK_IAUTH
-+#define CEPH_STAT_MASK_MODE CEPH_LOCK_IAUTH
-+#define CEPH_STAT_MASK_NLINK CEPH_LOCK_ILINK
-+#define CEPH_STAT_MASK_LAYOUT CEPH_LOCK_ICONTENT
-+#define CEPH_STAT_MASK_MTIME CEPH_LOCK_ICONTENT
-+#define CEPH_STAT_MASK_SIZE CEPH_LOCK_ICONTENT
-+#define CEPH_STAT_MASK_ATIME CEPH_LOCK_ICONTENT /* fixme */
-+#define CEPH_STAT_MASK_XATTR CEPH_LOCK_IXATTR
-+#define CEPH_STAT_MASK_INODE_ALL (CEPH_LOCK_ICONTENT | CEPH_LOCK_IAUTH | \
-+ CEPH_LOCK_ILINK | CEPH_LOCK_INO)
-+
-+/* client_session ops */
-+enum {
-+ CEPH_SESSION_REQUEST_OPEN,
-+ CEPH_SESSION_OPEN,
-+ CEPH_SESSION_REQUEST_CLOSE,
-+ CEPH_SESSION_CLOSE,
-+ CEPH_SESSION_REQUEST_RENEWCAPS,
-+ CEPH_SESSION_RENEWCAPS,
-+ CEPH_SESSION_STALE,
-+};
-+
-+static inline const char *ceph_session_op_name(int op)
-+{
-+ switch (op) {
-+ case CEPH_SESSION_REQUEST_OPEN: return "request_open";
-+ case CEPH_SESSION_OPEN: return "open";
-+ case CEPH_SESSION_REQUEST_CLOSE: return "request_close";
-+ case CEPH_SESSION_CLOSE: return "close";
-+ case CEPH_SESSION_REQUEST_RENEWCAPS: return "request_renewcaps";
-+ case CEPH_SESSION_RENEWCAPS: return "renewcaps";
-+ case CEPH_SESSION_STALE: return "stale";
-+ default: return "???";
-+ }
-+}
-+
-+struct ceph_mds_session_head {
-+ __le32 op;
-+ __le64 seq;
-+ struct ceph_timespec stamp;
-+} __attribute__ ((packed));
-+
-+/* client_request */
-+/*
-+ * metadata ops.
-+ * & 0x001000 -> write op
-+ * & 0x010000 -> follow symlink (e.g. stat(), not lstat()).
-+ & & 0x100000 -> use weird ino/path trace
-+ */
-+#define CEPH_MDS_OP_WRITE 0x001000
-+#define CEPH_MDS_OP_FOLLOW_LINK 0x010000
-+#define CEPH_MDS_OP_INO_PATH 0x100000
-+enum {
-+ CEPH_MDS_OP_FINDINODE = 0x100100,
-+
-+ CEPH_MDS_OP_LSTAT = 0x00100,
-+ CEPH_MDS_OP_LUTIME = 0x01101,
-+ CEPH_MDS_OP_LCHMOD = 0x01102,
-+ CEPH_MDS_OP_LCHOWN = 0x01103,
-+ CEPH_MDS_OP_LSETXATTR = 0x01104,
-+ CEPH_MDS_OP_LRMXATTR = 0x01105,
-+ CEPH_MDS_OP_LSETLAYOUT = 0x01106,
-+
-+ CEPH_MDS_OP_STAT = 0x10100,
-+ CEPH_MDS_OP_UTIME = 0x11101,
-+ CEPH_MDS_OP_CHMOD = 0x11102,
-+ CEPH_MDS_OP_CHOWN = 0x11103,
-+ CEPH_MDS_OP_SETXATTR = 0x11104,
-+ CEPH_MDS_OP_RMXATTR = 0x11105,
-+
-+ CEPH_MDS_OP_MKNOD = 0x01201,
-+ CEPH_MDS_OP_LINK = 0x01202,
-+ CEPH_MDS_OP_UNLINK = 0x01203,
-+ CEPH_MDS_OP_RENAME = 0x01204,
-+ CEPH_MDS_OP_MKDIR = 0x01220,
-+ CEPH_MDS_OP_RMDIR = 0x01221,
-+ CEPH_MDS_OP_SYMLINK = 0x01222,
-+
-+ CEPH_MDS_OP_OPEN = 0x10302,
-+ CEPH_MDS_OP_TRUNCATE = 0x11303,
-+ CEPH_MDS_OP_LTRUNCATE = 0x01303,
-+ CEPH_MDS_OP_FSYNC = 0x00304,
-+ CEPH_MDS_OP_READDIR = 0x00305,
-+
-+ CEPH_MDS_OP_MKSNAP = 0x01400,
-+ CEPH_MDS_OP_RMSNAP = 0x01401,
-+ CEPH_MDS_OP_LSSNAP = 0x00402,
-+};
-+
-+static inline const char *ceph_mds_op_name(int op)
-+{
-+ switch (op) {
-+ case CEPH_MDS_OP_FINDINODE: return "findinode";
-+ case CEPH_MDS_OP_STAT: return "stat";
-+ case CEPH_MDS_OP_LSTAT: return "lstat";
-+ case CEPH_MDS_OP_UTIME: return "utime";
-+ case CEPH_MDS_OP_LUTIME: return "lutime";
-+ case CEPH_MDS_OP_CHMOD: return "chmod";
-+ case CEPH_MDS_OP_LCHMOD: return "lchmod";
-+ case CEPH_MDS_OP_CHOWN: return "chown";
-+ case CEPH_MDS_OP_LCHOWN: return "lchown";
-+ case CEPH_MDS_OP_LSETLAYOUT: return "lsetlayout";
-+ case CEPH_MDS_OP_SETXATTR: return "setxattr";
-+ case CEPH_MDS_OP_LSETXATTR: return "lsetxattr";
-+ case CEPH_MDS_OP_RMXATTR: return "rmxattr";
-+ case CEPH_MDS_OP_LRMXATTR: return "lrmxattr";
-+ case CEPH_MDS_OP_READDIR: return "readdir";
-+ case CEPH_MDS_OP_MKNOD: return "mknod";
-+ case CEPH_MDS_OP_LINK: return "link";
-+ case CEPH_MDS_OP_UNLINK: return "unlink";
-+ case CEPH_MDS_OP_RENAME: return "rename";
-+ case CEPH_MDS_OP_MKDIR: return "mkdir";
-+ case CEPH_MDS_OP_RMDIR: return "rmdir";
-+ case CEPH_MDS_OP_SYMLINK: return "symlink";
-+ case CEPH_MDS_OP_OPEN: return "open";
-+ case CEPH_MDS_OP_TRUNCATE: return "truncate";
-+ case CEPH_MDS_OP_LTRUNCATE: return "ltruncate";
-+ case CEPH_MDS_OP_FSYNC: return "fsync";
-+ case CEPH_MDS_OP_LSSNAP: return "lssnap";
-+ case CEPH_MDS_OP_MKSNAP: return "mksnap";
-+ case CEPH_MDS_OP_RMSNAP: return "rmsnap";
-+ default: return "???";
-+ }
-+}
-+
-+struct ceph_mds_request_head {
-+ ceph_tid_t tid, oldest_client_tid;
-+ ceph_epoch_t mdsmap_epoch; /* on client */
-+ __le32 num_fwd;
-+ __le32 retry_attempt;
-+ __le64 mds_wants_replica_in_dirino;
-+ __le32 op;
-+ __le32 caller_uid, caller_gid;
-+
-+ union {
-+ struct {
-+ __le32 mask;
-+ } __attribute__ ((packed)) stat;
-+ struct {
-+ __le32 mask;
-+ } __attribute__ ((packed)) fstat;
-+ struct {
-+ __le32 frag;
-+ } __attribute__ ((packed)) readdir;
-+ struct {
-+ struct ceph_timespec mtime;
-+ struct ceph_timespec atime;
-+ struct ceph_timespec ctime;
-+ __le32 mask;
-+ } __attribute__ ((packed)) utime;
-+ struct {
-+ __le32 mode;
-+ } __attribute__ ((packed)) chmod;
-+ struct {
-+ __le32 uid;
-+ __le32 gid;
-+ __le32 mask;
-+ } __attribute__ ((packed)) chown;
-+ struct {
-+ __le32 mode;
-+ __le32 rdev;
-+ } __attribute__ ((packed)) mknod;
-+ struct {
-+ __le32 mode;
-+ } __attribute__ ((packed)) mkdir;
-+ struct {
-+ __le32 flags;
-+ __le32 mode;
-+ } __attribute__ ((packed)) open;
-+ struct {
-+ __le64 length;
-+ } __attribute__ ((packed)) truncate;
-+ struct {
-+ __le32 flags;
-+ } __attribute__ ((packed)) setxattr;
-+ struct {
-+ struct ceph_file_layout layout;
-+ } __attribute__ ((packed)) setlayout;
-+ } __attribute__ ((packed)) args;
-+} __attribute__ ((packed));
-+
-+/* masks for utimes() */
-+#define CEPH_UTIME_ATIME 1
-+#define CEPH_UTIME_MTIME 2
-+#define CEPH_UTIME_CTIME 4
-+
-+/* masks for chown */
-+#define CEPH_CHOWN_UID 1
-+#define CEPH_CHOWN_GID 2
-+
-+struct ceph_inopath_item {
-+ __le64 ino;
-+ __le32 dname_hash;
-+} __attribute__ ((packed));
-+
-+/* client reply */
-+struct ceph_mds_reply_head {
-+ ceph_tid_t tid;
-+ __le32 op;
-+ __le32 result;
-+ __le32 file_caps;
-+ __le32 file_caps_seq;
-+ __le32 file_caps_mseq;
-+ __le32 mdsmap_epoch;
-+} __attribute__ ((packed));
-+
-+/* one for each node split */
-+struct ceph_frag_tree_split {
-+ __le32 frag; /* this frag splits... */
-+ __le32 by; /* ...by this many bits */
-+} __attribute__ ((packed));
-+
-+struct ceph_frag_tree_head {
-+ __le32 nsplits;
-+ struct ceph_frag_tree_split splits[];
-+} __attribute__ ((packed));
-+
-+struct ceph_mds_reply_inode {
-+ __le64 ino;
-+ __le64 snapid;
-+ __le64 version;
-+ struct ceph_file_layout layout;
-+ struct ceph_timespec ctime, mtime, atime;
-+ __le64 time_warp_seq;
-+ __le32 rdev;
-+ __le32 mode, uid, gid;
-+ __le32 nlink;
-+ __le64 size, max_size, truncate_seq;
-+ __le64 files, subdirs, rbytes, rfiles, rsubdirs; /* dir stats */
-+ struct ceph_timespec rctime;
-+ struct ceph_frag_tree_head fragtree;
-+} __attribute__ ((packed));
-+/* followed by frag array, then symlink string, then xattr blob */
-+
-+/* reply_lease follows dname, and reply_inode */
-+struct ceph_mds_reply_lease {
-+ __le16 mask;
-+ __le32 duration_ms;
-+} __attribute__ ((packed));
-+
-+struct ceph_mds_reply_dirfrag {
-+ __le32 frag; /* fragment */
-+ __le32 auth; /* auth mds, if this is a delegation point */
-+ __le32 ndist; /* number of mds' this is replicated on */
-+ __le32 dist[];
-+} __attribute__ ((packed));
-+
-+/* file access modes */
-+#define CEPH_FILE_MODE_PIN 0
-+#define CEPH_FILE_MODE_RD 1
-+#define CEPH_FILE_MODE_WR 2
-+#define CEPH_FILE_MODE_RDWR 3 /* RD | WR */
-+#define CEPH_FILE_MODE_LAZY 4 /* lazy io */
-+#define CEPH_FILE_MODE_NUM 8 /* bc these are bit fields.. mostly */
-+
-+static inline int ceph_flags_to_mode(int flags)
-+{
-+#ifdef O_DIRECTORY /* fixme */
-+ if ((flags & O_DIRECTORY) == O_DIRECTORY)
-+ return CEPH_FILE_MODE_PIN;
-+#endif
-+#ifdef O_LAZY
-+ if (flags & O_LAZY)
-+ return CEPH_FILE_MODE_LAZY;
-+#endif
-+ if ((flags & O_APPEND) == O_APPEND)
-+ flags |= O_WRONLY;
-+
-+ flags &= O_ACCMODE;
-+ if ((flags & O_RDWR) == O_RDWR)
-+ return CEPH_FILE_MODE_RDWR;
-+ if ((flags & O_WRONLY) == O_WRONLY)
-+ return CEPH_FILE_MODE_WR;
-+ return CEPH_FILE_MODE_RD;
-+}
-+
-+/* client file caps */
-+#define CEPH_CAP_PIN 1 /* no specific capabilities beyond the pin */
-+#define CEPH_CAP_RDCACHE 2 /* client can cache reads */
-+#define CEPH_CAP_RD 4 /* client can read */
-+#define CEPH_CAP_WR 8 /* client can write */
-+#define CEPH_CAP_WRBUFFER 16 /* client can buffer writes */
-+#define CEPH_CAP_WREXTEND 32 /* client can extend EOF */
-+#define CEPH_CAP_LAZYIO 64 /* client can perform lazy io */
-+#define CEPH_CAP_EXCL 128 /* exclusive/loner access */
-+
-+static inline int ceph_caps_for_mode(int mode)
-+{
-+ switch (mode) {
-+ case CEPH_FILE_MODE_PIN:
-+ return CEPH_CAP_PIN;
-+ case CEPH_FILE_MODE_RD:
-+ return CEPH_CAP_PIN |
-+ CEPH_CAP_RD | CEPH_CAP_RDCACHE;
-+ case CEPH_FILE_MODE_RDWR:
-+ return CEPH_CAP_PIN |
-+ CEPH_CAP_RD | CEPH_CAP_RDCACHE |
-+ CEPH_CAP_WR | CEPH_CAP_WRBUFFER |
-+ CEPH_CAP_EXCL;
-+ case CEPH_FILE_MODE_WR:
-+ return CEPH_CAP_PIN |
-+ CEPH_CAP_WR | CEPH_CAP_WRBUFFER |
-+ CEPH_CAP_EXCL;
-+ }
-+ return 0;
-+}
-+
-+enum {
-+ CEPH_CAP_OP_GRANT, /* mds->client grant */
-+ CEPH_CAP_OP_TRUNC, /* mds->client trunc notify */
-+ CEPH_CAP_OP_EXPORT, /* mds has exported the cap */
-+ CEPH_CAP_OP_IMPORT, /* mds has imported the cap from specified mds */
-+ CEPH_CAP_OP_RELEASED, /* mds->client close out cap */
-+ CEPH_CAP_OP_FLUSHEDSNAP, /* mds->client flushed snap */
-+ CEPH_CAP_OP_ACK, /* client->mds ack (if prior grant was recall) */
-+ CEPH_CAP_OP_REQUEST, /* client->mds request (update wanted bits) */
-+ CEPH_CAP_OP_FLUSHSNAP, /* client->mds flush snapped metadata */
-+ CEPH_CAP_OP_RELEASE, /* client->mds request release cap */
-+};
-+
-+static inline const char *ceph_cap_op_name(int op)
-+{
-+ switch (op) {
-+ case CEPH_CAP_OP_GRANT: return "grant";
-+ case CEPH_CAP_OP_TRUNC: return "trunc";
-+ case CEPH_CAP_OP_EXPORT: return "export";
-+ case CEPH_CAP_OP_IMPORT: return "import";
-+ case CEPH_CAP_OP_RELEASED: return "released";
-+ case CEPH_CAP_OP_FLUSHEDSNAP: return "flushedsnap";
-+ case CEPH_CAP_OP_ACK: return "ack";
-+ case CEPH_CAP_OP_REQUEST: return "request";
-+ case CEPH_CAP_OP_FLUSHSNAP: return "flushsnap";
-+ case CEPH_CAP_OP_RELEASE: return "release";
-+ default: return "???";
-+ }
-+}
-+
-+/*
-+ * caps message, used for capability callbacks, acks, requests, etc.
-+ */
-+struct ceph_mds_caps {
-+ __le32 op;
-+ __le64 ino;
-+ __le32 seq;
-+ __le32 caps, wanted;
-+ __le64 size, max_size;
-+ __le64 truncate_seq;
-+ __le32 migrate_seq;
-+ struct ceph_timespec mtime, atime, ctime;
-+ struct ceph_file_layout layout;
-+ __le64 time_warp_seq;
-+ __le64 snap_follows;
-+ __le32 snap_trace_len;
-+} __attribute__ ((packed));
-+
-+
-+#define CEPH_MDS_LEASE_REVOKE 1 /* mds -> client */
-+#define CEPH_MDS_LEASE_RELEASE 2 /* client -> mds */
-+#define CEPH_MDS_LEASE_RENEW 3 /* client <-> mds */
-+
-+struct ceph_mds_lease {
-+ __u8 action;
-+ __le16 mask;
-+ __le64 ino;
-+ __le64 first, last;
-+} __attribute__ ((packed));
-+/* followed by a __le32+string for dname */
-+
-+
-+/* client reconnect */
-+struct ceph_mds_cap_reconnect {
-+ __le32 wanted;
-+ __le32 issued;
-+ __le64 size;
-+ struct ceph_timespec mtime, atime;
-+ __le64 snaprealm;
-+} __attribute__ ((packed));
-+/* followed by encoded string */
-+
-+struct ceph_mds_snaprealm_reconnect {
-+ __le64 ino;
-+ __le64 seq;
-+ __le64 parent; /* parent realm */
-+} __attribute__ ((packed));
-+
-+/*
-+ * snaps
-+ */
-+enum {
-+ CEPH_SNAP_OP_UPDATE, /* CREATE or DESTROY */
-+ CEPH_SNAP_OP_CREATE,
-+ CEPH_SNAP_OP_DESTROY,
-+ CEPH_SNAP_OP_SPLIT,
-+};
-+
-+static inline const char *ceph_snap_op_name(int o)
-+{
-+ switch (o) {
-+ case CEPH_SNAP_OP_UPDATE: return "update";
-+ case CEPH_SNAP_OP_CREATE: return "create";
-+ case CEPH_SNAP_OP_DESTROY: return "destroy";
-+ case CEPH_SNAP_OP_SPLIT: return "split";
-+ default: return "???";
-+ }
-+}
-+
-+struct ceph_mds_snap_head {
-+ __le32 op;
-+ __le64 split;
-+ __le32 num_split_inos;
-+ __le32 num_split_realms;
-+ __le32 trace_len;
-+} __attribute__ ((packed));
-+/* followed by split ino list, then split realms, then the trace blob */
-+
-+/*
-+ * encode info about a snaprealm, as viewed by a client
-+ */
-+struct ceph_mds_snap_realm {
-+ __le64 ino; /* ino */
-+ __le64 created; /* snap: when created */
-+ __le64 parent; /* ino: parent realm */
-+ __le64 parent_since; /* snap: same parent since */
-+ __le64 seq; /* snap: version */
-+ __le32 num_snaps;
-+ __le32 num_prior_parent_snaps;
-+} __attribute__ ((packed));
-+/* followed by my snap list, then prior parent snap list */
-+
-+/*
-+ * osd map flag bits
-+ */
-+#define CEPH_OSDMAP_NEARFULL (1<<0) /* sync writes (near ENOSPC) */
-+#define CEPH_OSDMAP_FULL (1<<1) /* no data writes (ENOSPC) */
-+
-+/*
-+ * osd ops
-+ */
-+#define CEPH_OSD_OP_MODE 0xf000
-+#define CEPH_OSD_OP_MODE_RD 0x1000
-+#define CEPH_OSD_OP_MODE_WR 0x2000
-+#define CEPH_OSD_OP_MODE_SUB 0x4000
-+
-+#define CEPH_OSD_OP_TYPE 0x0f00
-+#define CEPH_OSD_OP_TYPE_LOCK 0x0100
-+#define CEPH_OSD_OP_TYPE_DATA 0x0200
-+#define CEPH_OSD_OP_TYPE_ATTR 0x0300
-+
-+enum {
-+ /* read */
-+ CEPH_OSD_OP_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 1,
-+ CEPH_OSD_OP_STAT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 2,
-+
-+ CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1,
-+ CEPH_OSD_OP_GETXATTRS = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 2,
-+
-+ /* subop */
-+ CEPH_OSD_OP_PULL = CEPH_OSD_OP_MODE_SUB | 1,
-+ CEPH_OSD_OP_PUSH = CEPH_OSD_OP_MODE_SUB | 2,
-+ CEPH_OSD_OP_BALANCEREADS = CEPH_OSD_OP_MODE_SUB | 3,
-+ CEPH_OSD_OP_UNBALANCEREADS = CEPH_OSD_OP_MODE_SUB | 4,
-+
-+ /* object data */
-+ CEPH_OSD_OP_WRITE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 1,
-+ CEPH_OSD_OP_WRITEFULL = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 2,
-+ CEPH_OSD_OP_TRUNCATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 3,
-+ CEPH_OSD_OP_ZERO = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 4,
-+ CEPH_OSD_OP_DELETE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 5,
-+
-+ /* object attrs */
-+ CEPH_OSD_OP_SETXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 1,
-+ CEPH_OSD_OP_SETXATTRS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 2,
-+ CEPH_OSD_OP_RESETXATTRS= CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 3,
-+ CEPH_OSD_OP_RMXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 4,
-+
-+ /* lock */
-+ CEPH_OSD_OP_WRLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 1,
-+ CEPH_OSD_OP_WRUNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 2,
-+ CEPH_OSD_OP_RDLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 3,
-+ CEPH_OSD_OP_RDUNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 4,
-+ CEPH_OSD_OP_UPLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 5,
-+ CEPH_OSD_OP_DNLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 6,
-+
-+ /* fancy read */
-+ CEPH_OSD_OP_GREP = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 3,
-+
-+ /* fancy write */
-+ CEPH_OSD_OP_APPEND = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 6,
-+};
-+
-+static inline int ceph_osd_op_type_lock(int op)
-+{
-+ return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_LOCK;
-+}
-+static inline int ceph_osd_op_type_data(int op)
-+{
-+ return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_DATA;
-+}
-+static inline int ceph_osd_op_type_attr(int op)
-+{
-+ return (op & CEPH_OSD_OP_TYPE) == CEPH_OSD_OP_TYPE_ATTR;
-+}
-+
-+static inline int ceph_osd_op_mode_subop(int op)
-+{
-+ return (op & CEPH_OSD_OP_MODE) == CEPH_OSD_OP_MODE_SUB;
-+}
-+static inline int ceph_osd_op_mode_read(int op)
-+{
-+ return (op & CEPH_OSD_OP_MODE) == CEPH_OSD_OP_MODE_RD;
-+}
-+static inline int ceph_osd_op_mode_modify(int op)
-+{
-+ return (op & CEPH_OSD_OP_MODE) == CEPH_OSD_OP_MODE_WR;
-+}
-+
-+static inline const char *ceph_osd_op_name(int op)
-+{
-+ switch (op) {
-+ case CEPH_OSD_OP_READ: return "read";
-+ case CEPH_OSD_OP_STAT: return "stat";
-+
-+ case CEPH_OSD_OP_WRITE: return "write";
-+ case CEPH_OSD_OP_DELETE: return "delete";
-+ case CEPH_OSD_OP_TRUNCATE: return "truncate";
-+ case CEPH_OSD_OP_ZERO: return "zero";
-+ case CEPH_OSD_OP_WRITEFULL: return "writefull";
-+
-+ case CEPH_OSD_OP_SETXATTR: return "setxattr";
-+ case CEPH_OSD_OP_SETXATTRS: return "setxattrs";
-+ case CEPH_OSD_OP_RESETXATTRS: return "resetxattrs";
-+ case CEPH_OSD_OP_RMXATTR: return "rmxattr";
-+
-+ case CEPH_OSD_OP_WRLOCK: return "wrlock";
-+ case CEPH_OSD_OP_WRUNLOCK: return "wrunlock";
-+ case CEPH_OSD_OP_RDLOCK: return "rdlock";
-+ case CEPH_OSD_OP_RDUNLOCK: return "rdunlock";
-+ case CEPH_OSD_OP_UPLOCK: return "uplock";
-+ case CEPH_OSD_OP_DNLOCK: return "dnlock";
-+
-+ case CEPH_OSD_OP_PULL: return "pull";
-+ case CEPH_OSD_OP_PUSH: return "push";
-+ case CEPH_OSD_OP_BALANCEREADS: return "balance-reads";
-+ case CEPH_OSD_OP_UNBALANCEREADS: return "unbalance-reads";
-+
-+ default: return "???";
-+ }
-+}
-+
-+
-+/*
-+ * osd op flags
-+ */
-+enum {
-+ CEPH_OSD_OP_ACK = 1, /* want (or is) "ack" ack */
-+ CEPH_OSD_OP_SAFE = 2, /* want (or is) "safe" ack */
-+ CEPH_OSD_OP_RETRY = 4, /* resend attempt */
-+ CEPH_OSD_OP_INCLOCK_FAIL = 8, /* fail on inclock collision */
-+ CEPH_OSD_OP_MODIFY = 16, /* op is/was a mutation */
-+ CEPH_OSD_OP_ACKNVRAM = 32, /* ACK when stable in NVRAM, not RAM */
-+ CEPH_OSD_OP_ORDERSNAP = 64, /* EOLDSNAP if snapc is out of order */
-+ CEPH_OSD_OP_PEERSTAT = 128, /* msg includes osd_peer_stat */
-+ CEPH_OSD_OP_BALANCE_READS = 256,
-+};
-+
-+#define EOLDSNAPC 44 /* ORDERSNAP flag set and writer has old snap context*/
-+
-+struct ceph_osd_op {
-+ __le16 op;
-+ union {
-+ struct {
-+ __le64 offset, length;
-+ };
-+ struct {
-+ __le32 name_len;
-+ __le32 value_len;
-+ };
-+ };
-+} __attribute__ ((packed));
-+
-+struct ceph_osd_request_head {
-+ ceph_tid_t tid;
-+ __le32 client_inc;
-+ struct ceph_object oid;
-+ struct ceph_object_layout layout;
-+ ceph_epoch_t osdmap_epoch;
-+
-+ __le32 flags;
-+ __le32 inc_lock;
-+
-+ struct ceph_eversion reassert_version;
-+
-+ /* writer's snap context */
-+ __le64 snap_seq;
-+ __le32 num_snaps;
-+
-+ /* read or mutation */
-+ __le16 num_ops;
-+ __u16 object_type;
-+ struct ceph_osd_op ops[]; /* followed by snaps */
-+} __attribute__ ((packed));
-+
-+struct ceph_osd_reply_head {
-+ ceph_tid_t tid;
-+ __le32 flags;
-+ struct ceph_object oid;
-+ struct ceph_object_layout layout;
-+ ceph_epoch_t osdmap_epoch;
-+ struct ceph_eversion reassert_version;
-+
-+ __le32 result;
-+
-+ __le32 num_ops;
-+ struct ceph_osd_op ops[0];
-+} __attribute__ ((packed));
-+
-+#endif
Index: plugins/Makefile.nmake
===================================================================
--- plugins/Makefile.nmake (revision 26859)