#include <epan/prefs.h>
#include <epan/to_str.h>
#include <epan/proto_data.h>
+#include <wsutil/str_util.h>
#include "packet-tcp.h"
#include "packet-ssl.h"
#define AMQP_PORT 5672
static guint amqps_port = 5671; /* AMQP over TLS/SSL */
-/* Generic defines */
-
-#define AMQP_INCREMENT(offset, addend, bound) {\
- THROW_ON( \
- (((unsigned)(offset) + (unsigned)(addend)) < (unsigned)(offset)) || \
- (((unsigned)(offset) + (unsigned)(addend)) > (unsigned)(bound )) \
- , ReportedBoundsError); \
- offset += (addend); \
-}
-
/*
* This dissector handles AMQP 0-9, 0-10 and 1.0. The conversation structure
* contains the version being run - it's only really reliably detected at
/* Private functions */
-static int
-dissect_amqp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data);
-
-static void
-check_amqp_version(tvbuff_t *tvb, amqp_conv *conn);
-
-static guint
-get_amqp_1_0_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset, void* data);
-
-static guint
-dissect_amqp_1_0_list(tvbuff_t *tvb,
- packet_info *pinfo,
- int offset,
- int bound,
- proto_item *item,
- int hf_amqp_type,
- guint32 hf_amqp_subtype_count,
- const int **hf_amqp_subtypes,
- const char *name);
-
-static guint
-dissect_amqp_1_0_map(tvbuff_t *tvb,
- packet_info *pinfo,
- int offset,
- int bound,
- proto_item *item,
- int hf_amqp_type,
- const char *name);
-
-static guint
-dissect_amqp_1_0_array(tvbuff_t *tvb,
- packet_info *pinfo,
- int offset,
- int bound,
- proto_item *item,
- int hf_amqp_type,
- guint32 hf_amqp_subtype_count,
- const int **hf_amqp_subtypes,
- const char *name);
-
-static guint
-get_amqp_0_10_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset, void* data);
-
-static guint
-get_amqp_0_9_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset, void* data);
-
-static void
-dissect_amqp_0_9_field_table(tvbuff_t *tvb, packet_info *pinfo, int offset, guint length, proto_item *item);
-
-static void
-dissect_amqp_0_9_field_array(tvbuff_t *tvb, packet_info *pinfo, int offset, guint length, proto_item *item);
-
static guint
dissect_amqp_0_9_field_value(tvbuff_t *tvb, packet_info *pinfo, int offset, guint length,
const char *name, proto_tree *field_table_tree);
static void
-dissect_amqp_0_10_map(tvbuff_t *tvb,
- int offset,
- int bound,
- int length,
- proto_item *item);
+dissect_amqp_0_10_struct32(tvbuff_t *tvb, packet_info *pinfo, proto_item *ti);
-static void
-dissect_amqp_0_10_xid (tvbuff_t *tvb,
- int offset,
- guint16 xid_length,
- proto_item *ti);
+static amqp_channel_t*
+get_conversation_channel(conversation_t *conv, guint16 channel_num);
static void
-dissect_amqp_0_10_connection(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_tree *tree,
- int offset, guint16 length);
+record_msg_delivery(tvbuff_t *tvb, packet_info *pinfo, guint16 channel_num,
+ guint64 delivery_tag);
static void
-dissect_amqp_0_10_session(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_tree *tree,
- int offset, guint16 length);
+record_msg_delivery_c(conversation_t *conv, amqp_channel_t *channel,
+ tvbuff_t *tvb, packet_info *pinfo, guint64 delivery_tag);
static void
-dissect_amqp_0_10_execution(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_tree *tree,
- int offset, guint16 length);
+record_delivery_ack(tvbuff_t *tvb, packet_info *pinfo, guint16 channel_num,
+ guint64 delivery_tag, gboolean multiple);
static void
-dissect_amqp_0_10_message(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_tree *tree,
- int offset, guint16 length);
+record_delivery_ack_c(conversation_t *conv, amqp_channel_t *channel,
+ tvbuff_t *tvb, packet_info *pinfo, guint64 delivery_tag, gboolean multiple);
static void
-dissect_amqp_0_10_tx(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_tree *tree,
- int offset, guint16 length);
+generate_msg_reference(tvbuff_t *tvb, packet_info *pinfo, proto_tree *prop_tree);
static void
-dissect_amqp_0_10_dtx(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_tree *tree,
- int offset, guint16 length);
+generate_ack_reference(tvbuff_t *tvb, packet_info *pinfo, proto_tree *prop_tree);
-static void
-dissect_amqp_0_10_exchange(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_tree *tree,
- int offset, guint16 length);
+/* AMQP 0-10 type decoding information */
-static void
-dissect_amqp_0_10_queue(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_tree *tree,
- int offset, guint16 length);
+typedef int (*type_formatter)(tvbuff_t *tvb,
+ guint offset, /* In tvb where data starts */
+ guint length, /* Length of data, if known */
+ const char **value); /* Receive formatted val */
+struct amqp_typeinfo {
+ guint8 typecode; /* From AMQP 0-10 spec */
+ const char *amqp_typename;
+ type_formatter formatter;
+ guint known_size;
+};
-static void
-dissect_amqp_0_10_file(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_tree *tree,
- int offset, guint16 length);
+/* AMQP 1-0 type decoding information */
-static void
-dissect_amqp_0_10_stream(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_tree *tree,
- int offset, guint16 length);
+typedef int (*type_dissector)(tvbuff_t *tvb,
+ packet_info *pinfo,
+ guint offset, /* In tvb where data starts */
+ guint length, /* Length of data, if known */
+ proto_item *item,
+ int hf_amqp_type);
-static void
-dissect_amqp_0_10_struct32(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
- int offset, guint32 struct_length);
+struct amqp1_typeinfo {
+ guint8 typecode; /* From AMQP 0-10 spec */
+ const char *amqp_typename;
+ const int ftype;
+ guint known_size;
+ type_dissector dissector;
+ type_formatter formatter;
+};
-static guint32
-dissect_amqp_1_0_AMQP_frame(tvbuff_t *tvb,
- guint offset,
- guint16 bound,
- proto_item *amqp_tree,
- packet_info *pinfo,
- const gchar **method_name);
+struct amqp_synonym_types_t {
+ const int *hf_none; /* Must be of type FT_NONE */
+ const int *hf_uint; /* FT_UINT */
+ const int *hf_str; /* FT_STRING */
+ const int *hf_bin; /* FT_BYTES */
+ const int *hf_guid; /* FT_GUID */
+};
-static guint32
-dissect_amqp_1_0_SASL_frame(tvbuff_t *tvb,
- guint offset,
- guint16 bound,
- proto_item *amqp_tree,
- packet_info *pinfo,
- const gchar **method_name);
+/* struct for field interpreting format code (i.e. 0x70 for msg.header) to relevant hf_* variable
+ * (here hf_amqp_1_0_messageHeader). If the type is list, next 2 struct items specify how to
+ * interpret list items (in terms of hf_* variable)
+ */
+struct amqp_defined_types_t {
+ const int format_code;
+ int *hf_amqp_type;
+ guint32 hf_amqp_subtype_count;
+ const int **hf_amqp_subtypes;
+};
-static int
-dissect_amqp_1_0_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_);
+/* functions for decoding 1.0 type and/or value */
-static int
-dissect_amqp_0_10_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_);
-static int
-dissect_amqp_0_9_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_);
+static struct amqp1_typeinfo* decode_fixed_type(guint8 code);
-static int
-dissect_amqp_0_9_method_connection_start(tvbuff_t *tvb, packet_info *pinfo,
- int offset, proto_tree *args_tree);
+static void
+get_amqp_1_0_value_formatter(tvbuff_t *tvb,
+ packet_info *pinfo,
+ guint8 code,
+ int offset,
+ int hf_amqp_type,
+ const char *name,
+ guint32 hf_amqp_subtype_count,
+ const int **hf_amqp_subtypes,
+ guint *length_size,
+ proto_item *item);
-static int
-dissect_amqp_0_9_method_connection_start_ok(tvbuff_t *tvb, packet_info *pinfo,
- int offset, proto_tree *args_tree);
+static guint
+get_amqp_1_0_type_formatter(tvbuff_t *tvb,
+ int offset,
+ int *hf_amqp_type,
+ const char **name,
+ guint32 *hf_amqp_subtype_count,
+ const int ***hf_amqp_subtypes,
+ guint *length_size);
-static int
-dissect_amqp_0_9_method_connection_secure(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+static void
+get_amqp_1_0_type_value_formatter(tvbuff_t *tvb,
+ packet_info *pinfo,
+ int offset,
+ int hf_amqp_type,
+ const char *name,
+ guint *length_size,
+ proto_item *item);
-static int
-dissect_amqp_0_9_method_connection_secure_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+/* functions for decoding particular primitive types */
static int
-dissect_amqp_0_9_method_connection_tune(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+dissect_amqp_1_0_fixed(tvbuff_t *tvb, packet_info *pinfo,
+ guint offset, guint length,
+ proto_item *item, int hf_amqp_type);
static int
-dissect_amqp_0_9_method_connection_tune_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+dissect_amqp_1_0_variable(tvbuff_t *tvb, packet_info *pinfo,
+ guint offset, guint length,
+ proto_item *item, int hf_amqp_type);
static int
-dissect_amqp_0_9_method_connection_open(tvbuff_t *tvb, packet_info *pinfo,
- int offset, proto_tree *args_tree);
+dissect_amqp_1_0_timestamp(tvbuff_t *tvb, packet_info *pinfo _U_,
+ guint offset, guint length,
+ proto_item *item, int hf_amqp_type);
static int
-dissect_amqp_0_9_method_connection_open_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+dissect_amqp_1_0_skip(tvbuff_t *tvb _U_, packet_info *pinfo _U_,
+ guint offset _U_, guint length _U_,
+ proto_item *item _U_, int hf_amqp_type _U_);
static int
-dissect_amqp_0_9_method_connection_redirect(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+dissect_amqp_1_0_zero(tvbuff_t *tvb _U_, packet_info *pinfo _U_,
+ guint offset _U_, guint length _U_,
+ proto_item *item _U_, int hf_amqp_type _U_);
static int
-dissect_amqp_0_9_method_connection_close(tvbuff_t *tvb, packet_info *pinfo,
- int offset, proto_tree *args_tree);
+dissect_amqp_1_0_true(tvbuff_t *tvb, packet_info *pinfo,
+ guint offset, guint length _U_,
+ proto_item *item, int hf_amqp_type);
static int
-dissect_amqp_0_9_method_connection_close_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+dissect_amqp_1_0_false(tvbuff_t *tvb, packet_info *pinfo,
+ guint offset, guint length _U_,
+ proto_item *item, int hf_amqp_type);
static int
-dissect_amqp_0_9_method_connection_blocked(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+format_amqp_1_0_null(tvbuff_t *tvb _U_,
+ guint offset, guint length _U_,
+ const char **value _U_);
static int
-dissect_amqp_0_9_method_connection_unblocked(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+format_amqp_1_0_boolean_true(tvbuff_t *tvb, guint offset, guint length _U_,
+ const char **value);
static int
-dissect_amqp_0_9_method_channel_open(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+format_amqp_1_0_boolean_false(tvbuff_t *tvb, guint offset, guint length _U_,
+ const char **value);
static int
-dissect_amqp_0_9_method_channel_open_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+format_amqp_1_0_boolean(tvbuff_t *tvb, guint offset, guint length _U_,
+ const char **value);
static int
-dissect_amqp_0_9_method_channel_flow(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+format_amqp_1_0_uint(tvbuff_t *tvb, guint offset, guint length,
+ const char **value);
static int
-dissect_amqp_0_9_method_channel_flow_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+format_amqp_1_0_int(tvbuff_t *tvb, guint offset, guint length,
+ const char **value);
static int
-dissect_amqp_0_9_method_channel_close(guint16 channel_num, tvbuff_t *tvb,
- packet_info *pinfo, int offset, proto_tree *args_tree);
+format_amqp_1_0_float(tvbuff_t *tvb, guint offset, guint length _U_,
+ const char **value);
static int
-dissect_amqp_0_9_method_channel_close_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+format_amqp_1_0_double(tvbuff_t *tvb, guint offset, guint length _U_,
+ const char **value);
static int
-dissect_amqp_0_9_method_channel_resume(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+format_amqp_1_0_decimal(tvbuff_t *tvb _U_, guint offset _U_, guint length,
+ const char **value);
static int
-dissect_amqp_0_9_method_channel_ping(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+format_amqp_1_0_char(tvbuff_t *tvb, guint offset, guint length _U_,
+ const char **value);
static int
-dissect_amqp_0_9_method_channel_pong(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+format_amqp_1_0_timestamp(tvbuff_t *tvb, guint offset, guint length _U_,
+ const char **value);
static int
-dissect_amqp_0_9_method_channel_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+format_amqp_1_0_uuid(tvbuff_t *tvb, guint offset, guint length _U_,
+ const char **value);
static int
-dissect_amqp_0_9_method_access_request(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+format_amqp_1_0_bin(tvbuff_t *tvb, guint offset, guint length,
+ const char **value);
static int
-dissect_amqp_0_9_method_access_request_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+format_amqp_1_0_str(tvbuff_t *tvb, guint offset, guint length,
+ const char **value);
static int
-dissect_amqp_0_9_method_exchange_declare(tvbuff_t *tvb, packet_info *pinfo,
- int offset, proto_tree *args_tree);
+format_amqp_1_0_symbol(tvbuff_t *tvb, guint offset, guint length,
+ const char **value);
-static int
-dissect_amqp_0_9_method_exchange_declare_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+static gboolean
+get_amqp_0_10_type_formatter(guint8 code,
+ const char **name,
+ type_formatter *decoder,
+ guint *length_size);
static int
-dissect_amqp_0_9_method_exchange_bind(tvbuff_t *tvb, packet_info *pinfo,
- int offset, proto_tree *args_tree);
+format_amqp_0_10_bin(tvbuff_t *tvb,
+ guint offset, guint length,
+ const char **value);
static int
-dissect_amqp_0_9_method_exchange_bind_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+format_amqp_0_10_int(tvbuff_t *tvb,
+ guint offset, guint length,
+ const char **value);
static int
-dissect_amqp_0_9_method_exchange_delete(tvbuff_t *tvb, packet_info *pinfo,
- int offset, proto_tree *args_tree);
+format_amqp_0_10_uint(tvbuff_t *tvb,
+ guint offset, guint length,
+ const char **value);
static int
-dissect_amqp_0_9_method_exchange_delete_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+format_amqp_0_10_char(tvbuff_t *tvb,
+ guint offset, guint length,
+ const char **value);
static int
-dissect_amqp_0_9_method_queue_declare(tvbuff_t *tvb, packet_info *pinfo,
- int offset, proto_tree *args_tree);
+format_amqp_0_10_boolean(tvbuff_t *tvb,
+ guint offset, guint length,
+ const char **value);
static int
-dissect_amqp_0_9_method_queue_declare_ok(tvbuff_t *tvb, packet_info *pinfo,
- int offset, proto_tree *args_tree);
+format_amqp_0_10_vbin(tvbuff_t *tvb,
+ guint offset, guint length,
+ const char **value);
static int
-dissect_amqp_0_9_method_queue_bind(tvbuff_t *tvb, packet_info *pinfo,
- int offset, proto_tree *args_tree);
+format_amqp_0_10_str(tvbuff_t *tvb,
+ guint offset, guint length,
+ const char **value);
-static int
-dissect_amqp_0_9_method_queue_bind_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+static void
+format_amqp_0_10_sequence_set(tvbuff_t *tvb, guint offset, guint length,
+ proto_item *item);
-static int
-dissect_amqp_0_9_method_queue_unbind(tvbuff_t *tvb, packet_info *pinfo,
- int offset, proto_tree *args_tree);
+/* Various handles */
-static int
-dissect_amqp_0_9_method_queue_unbind_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
+static int proto_amqp = -1;
-static int
-dissect_amqp_0_9_method_queue_purge(tvbuff_t *tvb, packet_info *pinfo,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_queue_purge_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_queue_delete(tvbuff_t *tvb, packet_info *pinfo,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_queue_delete_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_basic_qos(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_basic_qos_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_basic_consume(tvbuff_t *tvb, packet_info *pinfo,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_basic_consume_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_basic_cancel(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_basic_cancel_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_basic_publish(guint16 channel_num,
- tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_basic_return(tvbuff_t *tvb, packet_info *pinfo,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_basic_deliver(guint16 channel_num,
- tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_basic_get(tvbuff_t *tvb, packet_info *pinfo,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_basic_get_ok(guint16 channel_num,
- tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_basic_get_empty(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_basic_ack(guint16 channel_num,
- tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_basic_reject(guint16 channel_num,
- tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_basic_recover_async(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_basic_recover(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_basic_recover_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_basic_nack(guint16 channel_num,
- tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_file_qos(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_file_qos_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_file_consume(tvbuff_t *tvb, packet_info *pinfo,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_file_consume_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_file_cancel(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_file_cancel_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_file_open(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_file_open_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_file_stage(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_file_publish(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_file_return(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_file_deliver(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_file_ack(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_file_reject(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_stream_qos(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_stream_qos_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_stream_consume(tvbuff_t *tvb, packet_info *pinfo,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_stream_consume_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_stream_cancel(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_stream_cancel_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_stream_publish(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_stream_return(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_stream_deliver(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_tx_select(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_tx_select_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_tx_commit(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_tx_commit_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_tx_rollback(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_tx_rollback_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_dtx_select(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_dtx_select_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_dtx_start(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_dtx_start_ok(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_tunnel_request(tvbuff_t *tvb, packet_info *pinfo,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_confirm_select(tvbuff_t *tvb,
- int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_method_confirm_select_ok(guint16 channel_num,
- tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *args_tree);
-
-static int
-dissect_amqp_0_9_content_header_basic(tvbuff_t *tvb, packet_info *pinfo,
- int offset, proto_tree *prop_tree);
-
-static int
-dissect_amqp_0_9_content_header_file(tvbuff_t *tvb, packet_info *pinfo,
- int offset, proto_tree *prop_tree);
-
-static int
-dissect_amqp_0_9_content_header_stream(tvbuff_t *tvb, packet_info *pinfo,
- int offset, proto_tree *prop_tree);
-
-static int
-dissect_amqp_0_9_content_header_tunnel(tvbuff_t *tvb, packet_info *pifo,
- int offset, proto_tree *prop_tree);
-
-static amqp_channel_t*
-get_conversation_channel(conversation_t *conv, guint16 channel_num);
-
-static void
-record_msg_delivery(tvbuff_t *tvb, packet_info *pinfo, guint16 channel_num,
- guint64 delivery_tag);
-
-static void
-record_msg_delivery_c(conversation_t *conv, amqp_channel_t *channel,
- tvbuff_t *tvb, packet_info *pinfo, guint64 delivery_tag);
-
-static void
-record_delivery_ack(tvbuff_t *tvb, packet_info *pinfo, guint16 channel_num,
- guint64 delivery_tag, gboolean multiple);
-
-static void
-record_delivery_ack_c(conversation_t *conv, amqp_channel_t *channel,
- tvbuff_t *tvb, packet_info *pinfo, guint64 delivery_tag, gboolean multiple);
-
-static void
-generate_msg_reference(tvbuff_t *tvb, packet_info *pinfo, proto_tree *prop_tree);
-
-static void
-generate_ack_reference(tvbuff_t *tvb, packet_info *pinfo, proto_tree *prop_tree);
-
-/* AMQP 0-10 type decoding information */
-
-typedef int (*type_formatter)(tvbuff_t *tvb,
- guint offset, /* In tvb where data starts */
- guint bound, /* Last byte in tvb */
- guint length, /* Length of data, if known */
- const char **value); /* Receive formatted val */
-struct amqp_typeinfo {
- guint8 typecode; /* From AMQP 0-10 spec */
- const char *amqp_typename;
- type_formatter formatter;
- guint known_size;
-};
-
-/* AMQP 1-0 type decoding information */
-
-typedef int (*type_dissector)(tvbuff_t *tvb,
- packet_info *pinfo,
- guint offset, /* In tvb where data starts */
- guint bound, /* Last byte in tvb */
- guint length, /* Length of data, if known */
- proto_item *item,
- int hf_amqp_type);
-
-struct amqp1_typeinfo {
- guint8 typecode; /* From AMQP 0-10 spec */
- const char *amqp_typename;
- const int ftype;
- guint known_size;
- type_dissector dissector;
- type_formatter formatter;
-};
-
-struct amqp_synonym_types_t {
- const int *hf_none; /* Must be of type FT_NONE */
- const int *hf_uint; /* FT_UINT */
- const int *hf_str; /* FT_STRING */
- const int *hf_bin; /* FT_BYTES */
- const int *hf_guid; /* FT_GUID */
-};
-
-/* struct for field interpreting format code (i.e. 0x70 for msg.header) to relevant hf_* variable
- * (here hf_amqp_1_0_messageHeader). If the type is list, next 2 struct items specify how to
- * interpret list items (in terms of hf_* variable)
- */
-struct amqp_defined_types_t {
- const int format_code;
- int *hf_amqp_type;
- guint32 hf_amqp_subtype_count;
- const int **hf_amqp_subtypes;
-};
-
-/* functions for decoding 1.0 type and/or value */
-
-
-static struct amqp1_typeinfo* decode_fixed_type(guint8 code);
-
-static void
-get_amqp_1_0_value_formatter(tvbuff_t *tvb,
- packet_info *pinfo,
- guint8 code,
- int offset,
- int bound,
- int hf_amqp_type,
- const char *name,
- guint32 hf_amqp_subtype_count,
- const int **hf_amqp_subtypes,
- guint *length_size,
- proto_item *item);
-
-static guint
-get_amqp_1_0_type_formatter(tvbuff_t *tvb,
- int offset,
- int bound,
- int *hf_amqp_type,
- const char **name,
- guint32 *hf_amqp_subtype_count,
- const int ***hf_amqp_subtypes,
- guint *length_size);
-
-static void
-get_amqp_1_0_type_value_formatter(tvbuff_t *tvb,
- packet_info *pinfo,
- int offset,
- int bound,
- int hf_amqp_type,
- const char *name,
- guint *length_size,
- proto_item *item);
-
-/* functions for decoding particular primitive types */
-
-static int
-dissect_amqp_1_0_fixed(tvbuff_t *tvb, packet_info *pinfo,
- guint offset, guint bound _U_, guint length,
- proto_item *item, int hf_amqp_type);
-
-static int
-dissect_amqp_1_0_variable(tvbuff_t *tvb, packet_info *pinfo,
- guint offset, guint bound, guint length,
- proto_item *item, int hf_amqp_type);
-
-static int
-dissect_amqp_1_0_timestamp(tvbuff_t *tvb, packet_info *pinfo _U_,
- guint offset, guint bound _U_, guint length,
- proto_item *item, int hf_amqp_type);
-
-static int
-dissect_amqp_1_0_skip(tvbuff_t *tvb _U_, packet_info *pinfo _U_,
- guint offset _U_, guint bound _U_, guint length _U_,
- proto_item *item _U_, int hf_amqp_type _U_);
-
-static int
-dissect_amqp_1_0_zero(tvbuff_t *tvb _U_, packet_info *pinfo _U_,
- guint offset _U_, guint bound _U_, guint length _U_,
- proto_item *item _U_, int hf_amqp_type _U_);
-
-static int
-dissect_amqp_1_0_true(tvbuff_t *tvb, packet_info *pinfo,
- guint offset, guint bound _U_, guint length _U_,
- proto_item *item, int hf_amqp_type);
-
-static int
-dissect_amqp_1_0_false(tvbuff_t *tvb, packet_info *pinfo,
- guint offset, guint bound _U_, guint length _U_,
- proto_item *item, int hf_amqp_type);
-
-static int
-format_amqp_1_0_null(tvbuff_t *tvb _U_,
- guint offset, guint bound _U_, guint length _U_,
- const char **value _U_);
-
-static int
-format_amqp_1_0_boolean_true(tvbuff_t *tvb,
- guint offset, guint bound _U_, guint length _U_,
- const char **value);
-
-static int
-format_amqp_1_0_boolean_false(tvbuff_t *tvb,
- guint offset, guint bound _U_, guint length _U_,
- const char **value);
-
-static int
-format_amqp_1_0_boolean(tvbuff_t *tvb,
- guint offset, guint bound _U_, guint length _U_,
- const char **value);
-
-static int
-format_amqp_1_0_uint(tvbuff_t *tvb,
- guint offset, guint bound _U_, guint length,
- const char **value);
-
-static int
-format_amqp_1_0_int(tvbuff_t *tvb,
- guint offset, guint bound _U_, guint length,
- const char **value);
-
-static int
-format_amqp_1_0_float(tvbuff_t *tvb,
- guint offset, guint bound _U_, guint length _U_,
- const char **value);
-
-static int
-format_amqp_1_0_double(tvbuff_t *tvb,
- guint offset, guint bound _U_, guint length _U_,
- const char **value);
-
-static int
-format_amqp_1_0_decimal(tvbuff_t *tvb _U_,
- guint offset _U_, guint bound _U_, guint length,
- const char **value);
-
-static int
-format_amqp_1_0_char(tvbuff_t *tvb,
- guint offset, guint bound _U_, guint length _U_,
- const char **value);
-
-static int
-format_amqp_1_0_timestamp(tvbuff_t *tvb,
- guint offset, guint bound _U_, guint length _U_,
- const char **value);
-
-static int
-format_amqp_1_0_uuid(tvbuff_t *tvb,
- guint offset, guint bound _U_, guint length _U_,
- const char **value);
-
-static int
-format_amqp_1_0_bin(tvbuff_t *tvb,
- guint offset, guint bound _U_, guint length,
- const char **value);
-
-static int
-format_amqp_1_0_str(tvbuff_t *tvb,
- guint offset, guint bound, guint length,
- const char **value);
-
-static int
-format_amqp_1_0_symbol(tvbuff_t *tvb,
- guint offset, guint bound, guint length,
- const char **value);
-
-static gboolean
-get_amqp_0_10_type_formatter(guint8 code,
- const char **name,
- type_formatter *decoder,
- guint *length_size);
-
-static int
-format_amqp_0_10_bin(tvbuff_t *tvb,
- guint offset, guint bound, guint length,
- const char **value);
-
-static int
-format_amqp_0_10_int(tvbuff_t *tvb,
- guint offset, guint bound, guint length,
- const char **value);
-
-static int
-format_amqp_0_10_uint(tvbuff_t *tvb,
- guint offset, guint bound, guint length,
- const char **value);
-
-static int
-format_amqp_0_10_char(tvbuff_t *tvb,
- guint offset, guint bound, guint length,
- const char **value);
-
-static int
-format_amqp_0_10_boolean(tvbuff_t *tvb,
- guint offset, guint bound, guint length,
- const char **value);
-
-static int
-format_amqp_0_10_vbin(tvbuff_t *tvb,
- guint offset, guint bound, guint length,
- const char **value);
-
-static int
-format_amqp_0_10_str(tvbuff_t *tvb,
- guint offset, guint bound, guint length,
- const char **value);
-
-static void
-format_amqp_0_10_sequence_set(tvbuff_t *tvb, guint offset, guint length,
- proto_item *item);
-
-/* Various handles */
-
-static int proto_amqp = -1;
-static const char* element_suffix [] = {"", "s"}; /* to distinguish singular/plural in "list of 1 item" vs. "list of 2 items" */
-
-/* 1.0 handles */
+/* 1.0 handles */
static int hf_amqp_1_0_size = -1;
static int hf_amqp_1_0_doff = -1;
* i.e. sasl.init method has 3 arguments in a list (mechanism, init.response, hostname)
* so when dissecting sasl.init arguments list, identify the list items with
* corresponding hf_* variable */
-const int* hf_amqp_1_0_sasl_mechanisms_items[] = { &hf_amqp_1_0_mechanisms };
-const int* hf_amqp_1_0_sasl_init_items[] = { &hf_amqp_1_0_mechanism,
+static const int* amqp_1_0_sasl_mechanisms_items[] = { &hf_amqp_1_0_mechanisms };
+static const int* amqp_1_0_sasl_init_items[] = { &hf_amqp_1_0_mechanism,
&hf_amqp_1_0_initResponse,
&hf_amqp_1_0_hostname };
-const int* hf_amqp_1_0_sasl_challenge_items[] = { &hf_amqp_1_0_saslChallenge };
-const int* hf_amqp_1_0_sasl_response_items[] = { &hf_amqp_1_0_saslResponse };
-const int* hf_amqp_1_0_sasl_outcome_items[] = { &hf_amqp_1_0_saslCode,
+static const int* amqp_1_0_sasl_challenge_items[] = { &hf_amqp_1_0_saslChallenge };
+static const int* amqp_1_0_sasl_response_items[] = { &hf_amqp_1_0_saslResponse };
+static const int* amqp_1_0_sasl_outcome_items[] = { &hf_amqp_1_0_saslCode,
&hf_amqp_1_0_saslAdditionalData };
-const int* hf_amqp_1_0_amqp_open_items[] = { &hf_amqp_1_0_containerId,
+static const int* amqp_1_0_amqp_open_items[] = { &hf_amqp_1_0_containerId,
&hf_amqp_1_0_hostname,
&hf_amqp_1_0_maxFrameSize,
&hf_amqp_1_0_channelMax,
&hf_amqp_1_0_offeredCapabilities,
&hf_amqp_1_0_desiredCapabilities,
&hf_amqp_1_0_properties };
-const int* hf_amqp_1_0_amqp_begin_items[] = { &hf_amqp_1_0_remoteChannel,
+static const int* amqp_1_0_amqp_begin_items[] = { &hf_amqp_1_0_remoteChannel,
&hf_amqp_1_0_nextOutgoingId,
&hf_amqp_1_0_incomingWindow,
&hf_amqp_1_0_outgoingWindow,
&hf_amqp_1_0_offeredCapabilities,
&hf_amqp_1_0_desiredCapabilities,
&hf_amqp_1_0_properties };
-const int* hf_amqp_1_0_amqp_attach_items[] = { &hf_amqp_1_0_name,
+static const int* amqp_1_0_amqp_attach_items[] = { &hf_amqp_1_0_name,
&hf_amqp_1_0_handle,
&hf_amqp_1_0_role,
&hf_amqp_1_0_sndSettleMode,
&hf_amqp_1_0_offeredCapabilities,
&hf_amqp_1_0_desiredCapabilities,
&hf_amqp_1_0_properties };
-const int* hf_amqp_1_0_amqp_flow_items[] = { &hf_amqp_1_0_nextIncomingId,
+static const int* amqp_1_0_amqp_flow_items[] = { &hf_amqp_1_0_nextIncomingId,
&hf_amqp_1_0_incomingWindow,
&hf_amqp_1_0_nextOutgoingId,
&hf_amqp_1_0_outgoingWindow,
&hf_amqp_1_0_drain,
&hf_amqp_1_0_echo,
&hf_amqp_1_0_properties };
-const int* hf_amqp_1_0_amqp_transfer_items[] = { &hf_amqp_1_0_handle,
+static const int* amqp_1_0_amqp_transfer_items[] = { &hf_amqp_1_0_handle,
&hf_amqp_1_0_deliveryId,
&hf_amqp_1_0_deliveryTag,
&hf_amqp_1_0_messageFormat,
&hf_amqp_1_0_resume,
&hf_amqp_1_0_aborted,
&hf_amqp_1_0_batchable };
-const int* hf_amqp_1_0_amqp_disposition_items[] = { &hf_amqp_1_0_role,
+static const int* amqp_1_0_amqp_disposition_items[] = { &hf_amqp_1_0_role,
&hf_amqp_1_0_first,
&hf_amqp_1_0_last,
&hf_amqp_1_0_settled,
&hf_amqp_1_0_state,
&hf_amqp_1_0_batchable };
-const int* hf_amqp_1_0_amqp_detach_items[] = { &hf_amqp_1_0_handle,
+static const int* amqp_1_0_amqp_detach_items[] = { &hf_amqp_1_0_handle,
&hf_amqp_1_0_closed,
&hf_amqp_1_0_error };
-const int* hf_amqp_1_0_amqp_end_items[] = { &hf_amqp_1_0_error };
-const int* hf_amqp_1_0_amqp_close_items[] = { &hf_amqp_1_0_error };
-const int* hf_amqp_1_0_error_items[] = { &hf_amqp_1_0_condition,
+static const int* amqp_1_0_amqp_end_items[] = { &hf_amqp_1_0_error };
+static const int* amqp_1_0_amqp_close_items[] = { &hf_amqp_1_0_error };
+static const int* amqp_1_0_error_items[] = { &hf_amqp_1_0_condition,
&hf_amqp_1_0_description,
&hf_amqp_1_0_info };
-const int* hf_amqp_1_0_messageHeader_items[] = { &hf_amqp_1_0_durable,
+static const int* amqp_1_0_messageHeader_items[] = { &hf_amqp_1_0_durable,
&hf_amqp_1_0_priority,
&hf_amqp_1_0_ttl,
&hf_amqp_1_0_firstAcquirer,
&hf_amqp_1_0_deliveryCount };
-const int* hf_amqp_1_0_received_items[] = { &hf_amqp_1_0_sectionNumber,
+static const int* amqp_1_0_received_items[] = { &hf_amqp_1_0_sectionNumber,
&hf_amqp_1_0_sectionOffset };
-const int* hf_amqp_1_0_rejected_items[] = { &hf_amqp_1_0_error };
-const int* hf_amqp_1_0_modified_items[] = { &hf_amqp_1_0_deliveryFailed,
+static const int* amqp_1_0_rejected_items[] = { &hf_amqp_1_0_error };
+static const int* amqp_1_0_modified_items[] = { &hf_amqp_1_0_deliveryFailed,
&hf_amqp_1_0_undeliverableHere,
&hf_amqp_1_0_messageAnnotations };
-const int* hf_amqp_1_0_source_items[] = { &hf_amqp_1_0_address,
+static const int* amqp_1_0_source_items[] = { &hf_amqp_1_0_address,
&hf_amqp_1_0_terminusDurable,
&hf_amqp_1_0_expiryPolicy,
&hf_amqp_1_0_timeout,
&hf_amqp_1_0_defaultOutcome,
&hf_amqp_1_0_outcomes,
&hf_amqp_1_0_capabilities };
-const int* hf_amqp_1_0_target_items[] = { &hf_amqp_1_0_address,
+static const int* amqp_1_0_target_items[] = { &hf_amqp_1_0_address,
&hf_amqp_1_0_terminusDurable,
&hf_amqp_1_0_expiryPolicy,
&hf_amqp_1_0_timeout,
&hf_amqp_1_0_dynamic,
&hf_amqp_1_0_dynamicNodeProperties,
&hf_amqp_1_0_capabilities };
-const int* hf_amqp_1_0_messageProperties_items[] = { &hf_amqp_1_0_messageId,
+static const int* amqp_1_0_messageProperties_items[] = { &hf_amqp_1_0_messageId,
&hf_amqp_1_0_userId,
&hf_amqp_1_0_to,
&hf_amqp_1_0_subject,
&hf_amqp_1_0_groupId,
&hf_amqp_1_0_groupSequence,
&hf_amqp_1_0_replyToGroupId };
-const int* hf_amqp_1_0_coordinator_items[] = { &hf_amqp_1_0_capabilities };
-const int* hf_amqp_1_0_declare_items[] = { &hf_amqp_1_0_globalId };
-const int* hf_amqp_1_0_discharge_items[] = { &hf_amqp_1_0_txnId,
+static const int* amqp_1_0_coordinator_items[] = { &hf_amqp_1_0_capabilities };
+static const int* amqp_1_0_declare_items[] = { &hf_amqp_1_0_globalId };
+static const int* amqp_1_0_discharge_items[] = { &hf_amqp_1_0_txnId,
&hf_amqp_1_0_fail };
-const int* hf_amqp_1_0_declared_items[] = { &hf_amqp_1_0_txnId };
-const int* hf_amqp_1_0_transactionalState_items[] = { &hf_amqp_1_0_txnId,
+static const int* amqp_1_0_declared_items[] = { &hf_amqp_1_0_txnId };
+static const int* amqp_1_0_transactionalState_items[] = { &hf_amqp_1_0_txnId,
&hf_amqp_1_0_outcome };
/* 0-10 handles */
static int hf_amqp_0_10_argument_packing_flags = -1;
static int hf_amqp_0_10_session_header = -1;
static int hf_amqp_0_10_session_header_sync = -1;
-static int hf_amqp_0_10_undissected_struct32 = -1;
+static int hf_amqp_0_10_struct32_size = -1;
+static int hf_amqp_0_10_struct32 = -1;
+static int hf_amqp_0_10_struct32_padding = -1;
+static int hf_amqp_0_10_struct32_class = -1;
+static int hf_amqp_0_10_struct32_struct = -1;
+static int hf_amqp_0_10_array_type = -1;
+static int hf_amqp_0_10_array_element_count = -1;
+static int hf_amqp_0_10_array_string = -1;
static int hf_amqp_0_10_message_body = -1;
static int hf_amqp_0_10_dtx_xid = -1;
static int hf_amqp_0_10_dtx_xid_format = -1;
static int hf_amqp_0_10_struct_stream_properties_priority = -1;
static int hf_amqp_0_10_struct_stream_properties_timestamp = -1;
static int hf_amqp_0_10_method_session_attach_name = -1;
+static int hf_amqp_0_10_method_session_attach_name_size = -1;
static int hf_amqp_0_10_method_session_attach_force = -1;
static int hf_amqp_0_10_method_session_detached_code = -1;
static int hf_amqp_0_10_method_session_timeout = -1;
static int hf_amqp_0_10_method_stream_deliver_exchange = -1;
static int hf_amqp_0_10_method_stream_deliver_queue = -1;
static int hf_amqp_channel = -1;
+static int hf_amqp_reserved = -1;
static int hf_amqp_0_9_type = -1;
static int hf_amqp_0_9_length = -1;
static int hf_amqp_0_9_method_class_id = -1;
static int hf_amqp_header_tunnel_data_name = -1;
static int hf_amqp_header_tunnel_durable = -1;
static int hf_amqp_header_tunnel_broadcast = -1;
+static int hf_amqp_0_10_dtx_xa_status = -1;
static int hf_amqp_payload = -1;
static int hf_amqp_init_protocol = -1;
static int hf_amqp_init_id = -1;
static int hf_amqp_init_version_revision = -1;
static int hf_amqp_message_in = -1;
static int hf_amqp_ack_in = -1;
+static int hf_amqp_method_connection_start_server_properties_size = -1;
+static int hf_amqp_0_10_method_connection_start_mechanisms_size = -1;
+static int hf_amqp_0_10_method_connection_start_locales_size = -1;
+static int hf_amqp_method_connection_start_ok_client_properties_size = -1;
+static int hf_amqp_0_10_method_connection_open_capabilities_size = -1;
+static int hf_amqp_0_10_method_connection_open_ok_known_hosts_size = -1;
+static int hf_amqp_0_10_method_connection_redirect_known_hosts_size = -1;
+static int hf_amqp_0_10_method_execution_error_info_size = -1;
+static int hf_amqp_0_10_method_exchange_declare_arguments_size = -1;
+static int hf_amqp_0_10_method_queue_declare_arguments_size = -1;
+static int hf_amqp_0_10_method_file_consume_arguments_size = -1;
+static int hf_amqp_0_10_method_stream_consume_arguments_size = -1;
+static int hf_amqp_0_10_struct_message_properties_application_headers_size = -1;
+static int hf_amqp_0_10_struct_file_properties_headers_size = -1;
+static int hf_amqp_0_10_struct_stream_properties_headers_size = -1;
+static int hf_amqp_0_10_struct_dtx_recover_result_size = -1;
static gint ett_amqp = -1;
static gint ett_header = -1;
static gint ett_amqp_init = -1;
static gint ett_amqp_0_10_map = -1;
static gint ett_amqp_0_10_array = -1;
+static gint ett_amqp_0_10_struct = -1;
static gint ett_amqp_1_0_list = -1;
static gint ett_amqp_1_0_array = -1;
static gint ett_amqp_1_0_map = -1;
static expert_field ei_amqp_unknown_basic_method = EI_INIT;
static expert_field ei_amqp_unknown_frame_type = EI_INIT;
static expert_field ei_amqp_field_short = EI_INIT;
-/* static expert_field ei_amqp_bad_length = EI_INIT; */
+static expert_field ei_amqp_bad_length = EI_INIT;
static expert_field ei_amqp_unknown_command_class = EI_INIT;
static expert_field ei_amqp_unknown_tunnel_method = EI_INIT;
static expert_field ei_amqp_unknown_confirm_method = EI_INIT;
static expert_field ei_amqp_unknown_amqp_command = EI_INIT;
static expert_field ei_amqp_unknown_amqp_type = EI_INIT;
static expert_field ei_amqp_invalid_number_of_params = EI_INIT;
+static expert_field ei_amqp_size_exceeds_65K = EI_INIT;
static expert_field ei_amqp_amqp_1_0_frame_length_exceeds_65K = EI_INIT;
+static expert_field ei_amqp_array_type_unknown = EI_INIT;
+
/* Various enumerations */
static const value_string amqp_1_0_SASL_code_value [] = {
{0, NULL}
};
+static const value_string amqp_0_10_struct32_vals[] = {
+ { ((AMQP_0_10_CLASS_MESSAGE << 8) | (AMQP_0_10_STRUCT_MESSAGE_DELIVERY_PROPERTIES)), "message.delivery-properties" },
+ { ((AMQP_0_10_CLASS_MESSAGE << 8) | (AMQP_0_10_STRUCT_MESSAGE_FRAGMENT_PROPERTIES)), "message.fragment-properties" },
+ { ((AMQP_0_10_CLASS_MESSAGE << 8) | (AMQP_0_10_STRUCT_MESSAGE_MESSAGE_PROPERTIES)), "message.message-properties" },
+ { ((AMQP_0_10_CLASS_MESSAGE << 8) | (AMQP_0_10_STRUCT_MESSAGE_ACQUIRED)), "message.acquired" },
+ { ((AMQP_0_10_CLASS_MESSAGE << 8) | (AMQP_0_10_STRUCT_MESSAGE_RESUME_RESULT)), "message.resume-result" },
+ { ((AMQP_0_10_CLASS_DTX << 8) | (AMQP_0_10_STRUCT_DTX_XA_RESULT)), "dtx.xa-status" },
+ { ((AMQP_0_10_CLASS_DTX << 8) | (AMQP_0_10_STRUCT_DTX_RECOVER_RESULT)), "dtx.recover-result" },
+ { ((AMQP_0_10_CLASS_EXCHANGE << 8) | (AMQP_0_10_STRUCT_EXCHANGE_QUERY_RESULT)), "exchange.exchange-query-result" },
+ { ((AMQP_0_10_CLASS_EXCHANGE << 8) | (AMQP_0_10_STRUCT_EXCHANGE_BOUND_RESULT)), "exchange.exchange-bound-result" },
+ { ((AMQP_0_10_CLASS_QUEUE << 8) | (AMQP_0_10_STRUCT_QUEUE_QUERY_RESULT)), "queue.queue-query-result" },
+ { ((AMQP_0_10_CLASS_FILE << 8) | (AMQP_0_10_STRUCT_FILE_PROPERTIES)), "file.file-properties" },
+ { ((AMQP_0_10_CLASS_STREAM << 8) | (AMQP_0_10_STRUCT_STREAM_PROPERTIES)), "stream.stream-properties" },
+ { 0, NULL }
+};
+
static const value_string amqp_0_9_frame_types [] = {
{AMQP_0_9_FRAME_TYPE_METHOD, "Method"},
{AMQP_0_9_FRAME_TYPE_CONTENT_HEADER, "Content header"},
{0, NULL}
};
+static const value_string amqp_0_10_array_type_vals [] = {
+ {AMQP_0_10_TYPE_STR16, "str16"},
+ {AMQP_0_10_TYPE_STRUCT32, "struct32"},
+ {0, NULL}
+};
+
static const value_string amqp_method_confirm_methods [] = {
{10, "Select"},
{11, "Select-Ok"},
/* see explanation at declaration of amqp_defined_types_t */
static struct amqp_defined_types_t amqp_1_0_defined_types[] = {
- {AMQP_1_0_AMQP_TYPE_ERROR, &hf_amqp_1_0_error, 3, hf_amqp_1_0_error_items },
- {AMQP_1_0_AMQP_TYPE_HEADER, &hf_amqp_1_0_messageHeader, 5, hf_amqp_1_0_messageHeader_items },
+ {AMQP_1_0_AMQP_TYPE_ERROR, &hf_amqp_1_0_error, 3, amqp_1_0_error_items },
+ {AMQP_1_0_AMQP_TYPE_HEADER, &hf_amqp_1_0_messageHeader, 5, amqp_1_0_messageHeader_items },
{AMQP_1_0_AMQP_TYPE_DELIVERY_ANNOTATIONS, &hf_amqp_1_0_deliveryAnnotations, 0, NULL },
{AMQP_1_0_AMQP_TYPE_MESSAGE_ANNOTATIONS, &hf_amqp_1_0_messageAnnotations, 0, NULL },
- {AMQP_1_0_AMQP_TYPE_PROPERTIES, &hf_amqp_1_0_messageProperties, 13, hf_amqp_1_0_messageProperties_items },
+ {AMQP_1_0_AMQP_TYPE_PROPERTIES, &hf_amqp_1_0_messageProperties, 13, amqp_1_0_messageProperties_items },
{AMQP_1_0_AMQP_TYPE_APPLICATION_PROPERTIES, &hf_amqp_1_0_applicationProperties, 0, NULL },
{AMQP_1_0_AMQP_TYPE_DATA, &hf_amqp_1_0_data, 0, NULL },
{AMQP_1_0_AMQP_TYPE_AMQP_SEQUENCE, &hf_amqp_1_0_amqp_sequence, 0, NULL },
{AMQP_1_0_AMQP_TYPE_AMQP_VALUE, &hf_amqp_1_0_amqp_value, 0, NULL },
{AMQP_1_0_AMQP_TYPE_FOOTER, &hf_amqp_1_0_footer, 0, NULL },
- {AMQP_1_0_AMQP_TYPE_RECEIVED, &hf_amqp_1_0_received, 2, hf_amqp_1_0_received_items },
+ {AMQP_1_0_AMQP_TYPE_RECEIVED, &hf_amqp_1_0_received, 2, amqp_1_0_received_items },
{AMQP_1_0_AMQP_TYPE_ACCEPTED, &hf_amqp_1_0_accepted, 0, NULL },
- {AMQP_1_0_AMQP_TYPE_REJECTED, &hf_amqp_1_0_rejected, 1, hf_amqp_1_0_rejected_items },
+ {AMQP_1_0_AMQP_TYPE_REJECTED, &hf_amqp_1_0_rejected, 1, amqp_1_0_rejected_items },
{AMQP_1_0_AMQP_TYPE_RELEASED, &hf_amqp_1_0_released, 0, NULL },
- {AMQP_1_0_AMQP_TYPE_MODIFIED, &hf_amqp_1_0_modified, 3, hf_amqp_1_0_modified_items },
- {AMQP_1_0_AMQP_TYPE_SOURCE, &hf_amqp_1_0_source, 11, hf_amqp_1_0_source_items },
- {AMQP_1_0_AMQP_TYPE_TARGET, &hf_amqp_1_0_target, 7, hf_amqp_1_0_target_items },
+ {AMQP_1_0_AMQP_TYPE_MODIFIED, &hf_amqp_1_0_modified, 3, amqp_1_0_modified_items },
+ {AMQP_1_0_AMQP_TYPE_SOURCE, &hf_amqp_1_0_source, 11, amqp_1_0_source_items },
+ {AMQP_1_0_AMQP_TYPE_TARGET, &hf_amqp_1_0_target, 7, amqp_1_0_target_items },
{AMQP_1_0_AMQP_TYPE_DELETE_ON_CLOSE, &hf_amqp_1_0_deleteOnClose, 0, NULL },
{AMQP_1_0_AMQP_TYPE_DELETE_ON_NO_LINKS, &hf_amqp_1_0_deleteOnNoLinks, 0, NULL },
{AMQP_1_0_AMQP_TYPE_DELETE_ON_NO_MESSAGE, &hf_amqp_1_0_deleteOnNoMessages, 0, NULL },
{AMQP_1_0_AMQP_TYPE_DELETE_ON_NO_LINKS_OR_MESSAGE, &hf_amqp_1_0_deleteOnNoLinksOrMessages, 0, NULL },
- {AMQP_1_0_AMQP_TYPE_COORDINATOR, &hf_amqp_1_0_coordinator, 1, hf_amqp_1_0_coordinator_items },
- {AMQP_1_0_AMQP_TYPE_DECLARE, &hf_amqp_1_0_declare, 1, hf_amqp_1_0_declare_items },
- {AMQP_1_0_AMQP_TYPE_DISCHARGE, &hf_amqp_1_0_discharge, 2, hf_amqp_1_0_discharge_items },
- {AMQP_1_0_AMQP_TYPE_DECLARED, &hf_amqp_1_0_declared, 1, hf_amqp_1_0_declared_items },
- {AMQP_1_0_AMQP_TYPE_TRANSACTIONAL_STATE, &hf_amqp_1_0_transactionalState, 2, hf_amqp_1_0_transactionalState_items },
+ {AMQP_1_0_AMQP_TYPE_COORDINATOR, &hf_amqp_1_0_coordinator, 1, amqp_1_0_coordinator_items },
+ {AMQP_1_0_AMQP_TYPE_DECLARE, &hf_amqp_1_0_declare, 1, amqp_1_0_declare_items },
+ {AMQP_1_0_AMQP_TYPE_DISCHARGE, &hf_amqp_1_0_discharge, 2, amqp_1_0_discharge_items },
+ {AMQP_1_0_AMQP_TYPE_DECLARED, &hf_amqp_1_0_declared, 1, amqp_1_0_declared_items },
+ {AMQP_1_0_AMQP_TYPE_TRANSACTIONAL_STATE, &hf_amqp_1_0_transactionalState, 2, amqp_1_0_transactionalState_items },
{ 0, NULL, 0, NULL }
};
-/* Main dissection routine */
-
-static int
-dissect_amqp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
-{
- conversation_t *conv;
- amqp_conv *conn;
-
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "AMQP");
- col_clear(pinfo->cinfo, COL_INFO);
-
- /* We need at least 8 bytes to check the protocol and get the frame size */
- if (tvb_reported_length (tvb) < 8) {
- /* But at this moment we don't know how much we will need */
- pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
- return -1; /* need more data */
- }
-
- /* Find (or build) conversation to remember the protocol version */
- conv = find_or_create_conversation(pinfo);
- conn = (amqp_conv *)conversation_get_proto_data(conv, proto_amqp);
- if (conn == NULL) {
- conn = wmem_new0(wmem_file_scope(), amqp_conv);
- conn->channels = wmem_map_new(wmem_file_scope(), g_direct_hash, g_direct_equal);
- conversation_add_proto_data(conv, proto_amqp, conn);
- }
- check_amqp_version(tvb, conn);
- switch(conn->version) {
- case AMQP_V0_9:
- tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 7, get_amqp_0_9_message_len,
- dissect_amqp_0_9_frame, data);
- break;
- case AMQP_V0_10:
- tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 8, get_amqp_0_10_message_len,
- dissect_amqp_0_10_frame, data);
- break;
- case AMQP_V1_0:
- tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 8, get_amqp_1_0_message_len,
- dissect_amqp_1_0_frame, data);
- break;
- default:
- col_append_str(pinfo->cinfo, COL_INFO, "AMQP (unknown version)");
- col_set_fence(pinfo->cinfo, COL_INFO);
- break;
- }
-
- return tvb_captured_length(tvb);
-}
-
static void
check_amqp_version(tvbuff_t *tvb, amqp_conv *conn)
{
return;
}
+
static guint
get_amqp_1_0_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
int offset, void *data _U_)
return length + 8;
}
+
/* Dissection routine for AMQP 0-9 field tables */
static void
return AMQP_0_10_SIZE_MAX(size);
}
+static guint
+amqp_0_10_get_32bit_size_new(proto_tree* tree, packet_info* pinfo, tvbuff_t *tvb, int hf, int offset) {
+ guint size;
+ proto_item* ti;
+
+ ti = proto_tree_add_item_ret_uint(tree, hf, tvb, offset, 4, ENC_BIG_ENDIAN, &size);
+ if (size > 0xFFFF)
+ {
+ expert_add_info(pinfo, ti, &ei_amqp_size_exceeds_65K);
+ size = 0xFFFF;
+ }
+
+ return size;
+}
+
/* Dissection routine for AMQP 0-10 maps */
static void
-dissect_amqp_0_10_map(tvbuff_t *tvb,
- int offset, /* Start of map in tvb */
- int bound, /* How far into tvb we can go */
- int length, /* Length of map */
- proto_item *item)
+dissect_amqp_0_10_map(tvbuff_t *tvb, proto_item *item)
{
proto_item *map_tree;
guint namelen, size;
const char *name;
const char *amqp_typename;
const char *value;
- guint32 field_count;
+ guint32 i, field_count;
+ int offset = 0;
type_formatter formatter;
map_tree = proto_item_add_subtree(item, ett_amqp_0_10_map);
field_count = tvb_get_ntohl(tvb, offset);
- AMQP_INCREMENT(offset, 4, bound);
- length -= 4;
+ offset += 4;
proto_item_append_text(item, " (%d entries)", field_count);
- while ((field_count > 0) && (length > 0)) {
+ for (i = 0; ((i < field_count) && (tvb_reported_length_remaining(tvb, offset) > 0)); i++) {
guint field_length = 0;
guint field_start = offset;
namelen = tvb_get_guint8(tvb, offset);
- AMQP_INCREMENT(offset, 1, bound);
- length -= 1;
+ offset += 1;
name = (char*) tvb_get_string_enc(wmem_packet_scope(), tvb, offset, namelen, ENC_UTF_8|ENC_NA);
- AMQP_INCREMENT(offset, namelen, bound);
- length -= namelen;
+ offset += namelen;
type = tvb_get_guint8(tvb, offset);
- AMQP_INCREMENT(offset, 1, bound);
- length -= 1;
+ offset += 1;
if (get_amqp_0_10_type_formatter(type, &amqp_typename, &formatter, &size)) {
- field_length = formatter(tvb, offset, bound, size, &value); /* includes var 'length' field if var field */
+ field_length = formatter(tvb, offset, size, &value); /* includes var 'length' field if var field */
field_length = AMQP_0_10_SIZE_MAX(field_length);
proto_tree_add_none_format(map_tree,
hf_amqp_field,
1 + namelen + 1 + field_length,
"%s (%s): %s",
name, amqp_typename, value);
- AMQP_INCREMENT(offset, field_length, bound);
- length -= field_length;
+ offset += field_length;
}
else { /* type not found in table: Do special processing */
guint size_field_len = 0;
} /* default */
} /* switch (type) */
- AMQP_INCREMENT(offset, (size_field_len + field_length), bound);
- length -= (size_field_len + field_length);
+ offset += (size_field_len + field_length);
}
-
- field_count -= 1;
}
}
/* Dissection routine for AMQP 0-10 maps */
-
static void
dissect_amqp_0_10_array(tvbuff_t *tvb,
packet_info *pinfo,
int offset, /* Start of array in tvb */
- int bound, /* How far into tvb we can go */
- int length, /* Length of array */
proto_item *item)
{
- proto_item *array_tree;
- proto_item *sub;
- guint8 type;
+ proto_item *array_item, *type_item, *struct_item;
+ proto_tree *array_tree;
guint16 len16;
- const char *amqp_typename;
- const char *value;
- int element_start;
- int externally_formatted;
- guint32 element_count;
+ guint32 type, i, element_count;
guint32 struct_length;
+ tvbuff_t *next_tvb;
- array_tree = 0;
- type = tvb_get_guint8(tvb, offset);
- AMQP_INCREMENT(offset, 1, bound);
- length -= 1;
- element_count = tvb_get_ntohl(tvb, offset);
- AMQP_INCREMENT(offset, 4, bound);
- length -= 4;
- proto_item_append_text(item, " (array of %d element%s)", element_count, element_suffix[element_count!=1]);
- if (element_count > 1)
- array_tree = proto_item_add_subtree(item, ett_amqp_0_10_array);
- while ((element_count > 0) && (length > 0)) {
- element_start = offset;
- externally_formatted = 0;
+ element_count = tvb_get_ntohl(tvb, offset+1);
+ array_tree = proto_tree_add_subtree_format(item, tvb, offset, 5, ett_amqp_0_10_array, &array_item, "Array of %d element%s)", element_count, plurality(element_count, "", "s"));
+
+ type_item = proto_tree_add_item_ret_uint(array_tree, hf_amqp_0_10_array_type, tvb, offset, 1, ENC_NA, &type);
+ offset += 1;
+ proto_tree_add_item_ret_uint(array_tree, hf_amqp_0_10_array_element_count, tvb, offset, 4, ENC_BIG_ENDIAN, &element_count);
+ offset += 4;
+
+ for (i = 0; ((i < element_count) && (tvb_reported_length_remaining(tvb, offset) > 0)); i++) {
switch (type) {
case AMQP_0_10_TYPE_STR16:
- amqp_typename = "str16";
len16 = tvb_get_ntohs(tvb, offset);
- AMQP_INCREMENT(offset, 2, bound);
- length -= 2;
- value = (char*) tvb_get_string_enc(wmem_packet_scope(), tvb, offset, len16, ENC_UTF_8|ENC_NA);
- AMQP_INCREMENT(offset, len16, bound);
- length -= len16;
+ proto_tree_add_item(array_tree, hf_amqp_0_10_array_string, tvb, offset, 2, ENC_UTF_8|ENC_BIG_ENDIAN);
+ offset += (2 + len16);
break;
case AMQP_0_10_TYPE_STRUCT32:
- amqp_typename = "struct32";
- value = "structure";
- externally_formatted = 1;
- struct_length = amqp_0_10_get_32bit_size(tvb, offset);
- AMQP_INCREMENT(offset, 4, bound);
- length -= 4;
- array_tree = proto_item_add_subtree(item, ett_amqp_0_10_array);
- sub = proto_tree_add_none_format(array_tree, hf_amqp_field, tvb,
- element_start,
- offset - element_start,
- "(%s): ", amqp_typename);
- dissect_amqp_0_10_struct32(tvb, pinfo, sub, offset, struct_length);
- AMQP_INCREMENT(offset, struct_length, bound);
- length -= struct_length;
+ struct_length = amqp_0_10_get_32bit_size_new(array_tree, pinfo, tvb, hf_amqp_0_10_struct32_size, offset);
+ offset += 4;
+
+ array_tree = proto_item_add_subtree(array_item, ett_amqp_0_10_array);
+ struct_item = proto_tree_add_item(array_tree,
+ hf_amqp_0_10_struct32,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_item_set_len(struct_item, struct_length);
+
+ if (struct_length > (guint32)tvb_reported_length_remaining(tvb, offset))
+ {
+ next_tvb = tvb_new_subset_remaining(tvb, offset);
+ }
+ else
+ {
+ next_tvb = tvb_new_subset_length(tvb, offset, struct_length);
+ }
+ dissect_amqp_0_10_struct32(next_tvb, pinfo, struct_item);
+ offset += struct_length;
break;
default:
- proto_tree_add_none_format(array_tree, hf_amqp_field, tvb,
- element_start,
- offset - element_start,
- "(unknown type %d)",
- type);
+ expert_add_info(pinfo, type_item, &ei_amqp_array_type_unknown);
/* Don't bother continuing through the loop: we don't know how
* much to increment the offset by and the type doesn't change
* so there's nothing interesting to do...
*/
return;
}
-
- element_count -= 1;
- if (externally_formatted)
- continue;
-
- if (array_tree != 0) {
- proto_tree_add_none_format(array_tree, hf_amqp_field, tvb,
- element_start,
- offset - element_start,
- "(%s): %s",
- amqp_typename,
- value);
- }
- else {
- proto_item_append_text(item, ": (%s): %s", amqp_typename, value);
- }
}
}
static void
dissect_amqp_0_10_xid (tvbuff_t *tvb,
int offset,
- guint16 xid_length,
proto_item *ti)
{
proto_item *xid_tree;
guint8 flag1/*, flag2*/;
- guint8 len8;
- int max_length;
- max_length = offset + xid_length;
xid_tree = proto_item_add_subtree(ti, ett_args);
flag1 = tvb_get_guint8(tvb, offset);
/*flag2 = tvb_get_guint8(tvb, offset+1);*/
proto_tree_add_item(xid_tree, hf_amqp_0_10_argument_packing_flags,
tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, max_length);
+ offset += 2;
if (flag1 & 0x01) {
/* format (uint32) */
proto_tree_add_item(xid_tree,
hf_amqp_0_10_dtx_xid_format,
tvb, offset, 4, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 4, max_length);
+ offset += 4;
}
if (flag1 & 0x02) {
/* global-id (vbin8) */
- len8 = tvb_get_guint8(tvb, offset);
proto_tree_add_item(xid_tree,
hf_amqp_0_10_dtx_xid_global_id,
- tvb, offset + 1, len8, ENC_NA);
- AMQP_INCREMENT(offset, (1 + len8), max_length);
+ tvb, offset, 1, ENC_NA);
+ offset += (1 + tvb_get_guint8(tvb, offset));
}
if (flag1 & 0x04) {
/* branch-id (vbin8) */
- len8 = tvb_get_guint8(tvb, offset);
proto_tree_add_item(xid_tree,
hf_amqp_0_10_dtx_xid_branch_id,
- tvb, offset + 1, len8, ENC_NA);
- AMQP_INCREMENT(offset, (1 + len8), max_length);
+ tvb, offset, 1, ENC_NA);
+ /* offset += (1 + tvb_get_guint8(tvb, offset)); */
}
}
static void
dissect_amqp_0_10_connection(tvbuff_t *tvb,
packet_info *pinfo,
- proto_tree *tree,
- int offset, guint16 length)
+ proto_tree *tree)
{
proto_item *args_tree;
proto_item *ti;
guint32 arg_length;
int flags_offset;
const gchar *method_name;
+ int offset = 0;
+ tvbuff_t *next_tvb;
method = tvb_get_guint8(tvb, offset+1);
method_name = val_to_str_const(method, amqp_0_10_connection_methods,
"<invalid connection method>");
- col_append_str(pinfo->cinfo, COL_INFO, method_name);
- col_append_str(pinfo->cinfo, COL_INFO, " ");
+ col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", method_name);
col_set_fence(pinfo->cinfo, COL_INFO);
proto_tree_add_item(tree, hf_amqp_0_10_connection_method,
tvb, offset+1, 1, ENC_BIG_ENDIAN);
+ offset += 2;
ti = proto_tree_add_item(tree, hf_amqp_method_arguments,
- tvb, offset + 2, length - 2, ENC_NA);
+ tvb, offset, -1, ENC_NA);
args_tree = proto_item_add_subtree(ti, ett_args);
- AMQP_INCREMENT(offset, 2, length);
/*
* The flag bits are a simple bit string, not a net-byte-order
* field. tvb_get_bits16() doesn't know how to do little-endian
flags_item = proto_tree_add_item(args_tree,
hf_amqp_0_10_argument_packing_flags,
tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
+ offset += 2;
switch (method) {
case AMQP_0_10_METHOD_CONNECTION_START:
if ((flag1 & ~0x07) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
if (flag1 & 0x01) {
/* server-properties (map) */
- arg_length = amqp_0_10_get_32bit_size(tvb, offset);
- AMQP_INCREMENT(offset, 4, length);
+ arg_length = amqp_0_10_get_32bit_size_new(args_tree, pinfo, tvb, hf_amqp_method_connection_start_server_properties_size, offset);
+ offset += 4;
ti = proto_tree_add_item(args_tree,
hf_amqp_method_connection_start_server_properties,
tvb,
offset,
arg_length, ENC_NA);
- dissect_amqp_0_10_map (tvb,
- offset,
- offset + arg_length,
- arg_length,
- ti);
- AMQP_INCREMENT(offset, arg_length, length);
+ if (arg_length > (guint32)tvb_reported_length_remaining(tvb, offset))
+ {
+ next_tvb = tvb_new_subset_remaining(tvb, offset);
+ }
+ else
+ {
+ next_tvb = tvb_new_subset_length(tvb, offset, arg_length);
+ }
+ dissect_amqp_0_10_map (next_tvb, ti);
+ offset += arg_length;
}
if (flag1 & 0x02) {
/* mechanisms (str16-array) */
- arg_length = amqp_0_10_get_32bit_size(tvb, offset);
- AMQP_INCREMENT(offset, 4, length);
+ arg_length = amqp_0_10_get_32bit_size_new(args_tree, pinfo, tvb, hf_amqp_0_10_method_connection_start_mechanisms_size, offset);
+ offset += 4;
ti = proto_tree_add_item(args_tree,
hf_amqp_0_10_method_connection_start_mechanisms,
tvb,
dissect_amqp_0_10_array (tvb,
pinfo,
offset,
- offset + arg_length,
- arg_length,
ti);
- AMQP_INCREMENT(offset, arg_length, length);
+ offset += arg_length;
}
if (flag1 & 0x04) {
/* locales (str16-array) */
- arg_length = amqp_0_10_get_32bit_size(tvb, offset);
- AMQP_INCREMENT(offset, 4, length);
+ arg_length = amqp_0_10_get_32bit_size_new(args_tree, pinfo, tvb, hf_amqp_0_10_method_connection_start_locales_size, offset);
+ offset += 4;
ti = proto_tree_add_item(args_tree,
hf_amqp_0_10_method_connection_start_locales,
tvb,
dissect_amqp_0_10_array (tvb,
pinfo,
offset,
- offset + arg_length,
- arg_length,
ti);
- AMQP_INCREMENT(offset, arg_length, length);
+ /* offset += arg_length; */
}
break;
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
if (flag1 & 0x01) {
/* client-properties (map) */
- arg_length = amqp_0_10_get_32bit_size(tvb, offset);
- AMQP_INCREMENT(offset, 4, length);
+ arg_length = amqp_0_10_get_32bit_size_new(args_tree, pinfo, tvb, hf_amqp_method_connection_start_ok_client_properties_size, offset);
+ offset += 4;
ti = proto_tree_add_item(args_tree,
hf_amqp_method_connection_start_ok_client_properties,
tvb,
offset,
arg_length, ENC_NA);
- dissect_amqp_0_10_map (tvb,
- offset,
- offset + arg_length,
- arg_length,
- ti);
- AMQP_INCREMENT(offset, arg_length, length);
+ if (arg_length > (guint32)tvb_reported_length_remaining(tvb, offset))
+ {
+ next_tvb = tvb_new_subset_remaining(tvb, offset);
+ }
+ else
+ {
+ next_tvb = tvb_new_subset_length(tvb, offset, arg_length);
+ }
+ dissect_amqp_0_10_map (next_tvb, ti);
+ offset += arg_length;
}
if (flag1 & 0x02) {
/* mechanism (str8) */
proto_tree_add_item(args_tree,
hf_amqp_method_connection_start_ok_mechanism,
- tvb, offset + 1, tvb_get_guint8(tvb, offset),
- ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, 1 + tvb_get_guint8(tvb, offset), length);
+ tvb, offset, 1,
+ ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
}
if (flag1 & 0x04) {
/* response (vbin32) */
proto_tree_add_item(args_tree,
hf_amqp_method_connection_start_ok_response,
- tvb, offset + 4, amqp_0_10_get_32bit_size(tvb, offset),
- ENC_NA);
- AMQP_INCREMENT(offset, 4 + amqp_0_10_get_32bit_size(tvb, offset), length);
+ tvb, offset, 4,
+ ENC_BIG_ENDIAN);
+ offset += (4 + tvb_get_ntohl(tvb, offset));
}
if (flag1 & 0x08) {
/* locale (str8) */
proto_tree_add_item(args_tree,
hf_amqp_method_connection_start_ok_locale,
- tvb, offset + 1, tvb_get_guint8(tvb, offset),
- ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, 1 + tvb_get_guint8(tvb, offset), length);
+ tvb, offset + 1, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ /* offset += (1 + tvb_get_guint8(tvb, offset)); */
}
break;
/* challenge (vbin32) */
proto_tree_add_item(args_tree,
hf_amqp_method_connection_secure_challenge,
- tvb, offset + 4, amqp_0_10_get_32bit_size(tvb, offset),
- ENC_NA);
- AMQP_INCREMENT(offset, 4 + amqp_0_10_get_32bit_size(tvb, offset), length);
+ tvb, offset, 4,
+ ENC_BIG_ENDIAN);
+ /* offset += (4 + tvb_get_ntohl(tvb, offset)); */
}
break;
/* response (vbin32) */
proto_tree_add_item(args_tree,
hf_amqp_method_connection_secure_ok_response,
- tvb, offset + 4, amqp_0_10_get_32bit_size(tvb, offset),
- ENC_NA);
- AMQP_INCREMENT(offset, 4 + amqp_0_10_get_32bit_size(tvb, offset), length);
+ tvb, offset, 4,
+ ENC_BIG_ENDIAN);
+ /* offset += (4 + tvb_get_ntohl(tvb, offset)); */
}
break;
proto_tree_add_item(args_tree,
hf_amqp_method_connection_tune_channel_max,
tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
+ offset += 2;
}
if (flag1 & 0x02) {
/* max-frame-size (uint16) */
proto_tree_add_item(args_tree,
hf_amqp_0_10_method_connection_tune_frame_max,
tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
+ offset += 2;
}
if (flag1 & 0x04) {
/* heartbeat-min (uint16) */
proto_tree_add_item(args_tree,
hf_amqp_0_10_method_connection_tune_heartbeat_min,
tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
+ offset += 2;
}
if (flag1 & 0x08) {
/* heartbeat-max (uint16) */
proto_tree_add_item(args_tree,
hf_amqp_0_10_method_connection_tune_heartbeat_max,
tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
+ /* offset += 2; */
}
break;
if ((flag1 & ~0x07) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
if (flag1 & 0x01) {
- /* channel-max (uint16) */
- proto_tree_add_item(args_tree,
- hf_amqp_method_connection_tune_ok_channel_max,
- tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
- }
- if (flag1 & 0x02) {
- /* max-frame-size (uint16) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_connection_tune_ok_frame_max,
- tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
- }
- if (flag1 & 0x04) {
- /* heartbeat (uint16) */
- proto_tree_add_item(args_tree,
- hf_amqp_method_connection_tune_ok_heartbeat,
- tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
- }
- break;
-
- case AMQP_0_10_METHOD_CONNECTION_OPEN:
- if ((flag1 & ~0x07) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) {
- /* virtual-host (str8) */
- proto_tree_add_item(args_tree,
- hf_amqp_method_connection_open_virtual_host,
- tvb,
- offset + 1,
- tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, tvb_get_guint8(tvb, offset) + 1, length);
- }
- if (flag1 & 0x02) {
- /* capabilities (str16-array) */
- arg_length = amqp_0_10_get_32bit_size(tvb, offset);
- AMQP_INCREMENT(offset, 4, length);
- ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_connection_open_capabilities,
- tvb,
- offset,
- arg_length, ENC_ASCII|ENC_NA);
- dissect_amqp_0_10_array (tvb,
- pinfo,
- offset,
- offset + arg_length,
- arg_length,
- ti);
- AMQP_INCREMENT(offset, arg_length, length);
- }
- /*
- * 3rd argument is an optional bit, insist.
- */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_connection_open_insist,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- break;
-
- case AMQP_0_10_METHOD_CONNECTION_OPEN_OK:
- if ((flag1 & ~0x01) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) {
- /* known-hosts (amqp-host-array) */
- arg_length = amqp_0_10_get_32bit_size(tvb, offset);
- AMQP_INCREMENT(offset, 4, length);
- ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_connection_open_ok_known_hosts,
- tvb,
- offset,
- arg_length, ENC_NA);
- dissect_amqp_0_10_array (tvb,
- pinfo,
- offset,
- offset + arg_length,
- arg_length,
- ti);
- AMQP_INCREMENT(offset, arg_length, length);
- }
- break;
-
- case AMQP_0_10_METHOD_CONNECTION_REDIRECT:
- if ((flag1 & ~0x03) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) {
- /* host (amqp-host-url [str16]) */
- proto_tree_add_item(args_tree,
- hf_amqp_method_connection_redirect_host,
- tvb, offset + 2, tvb_get_ntohs(tvb, offset),
- ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, 2 + tvb_get_ntohs(tvb, offset), length);
- }
- if (flag1 & 0x02) {
- /* known-hosts (amqp-host-array) */
- arg_length = amqp_0_10_get_32bit_size(tvb, offset);
- AMQP_INCREMENT(offset, 4, length);
- ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_connection_redirect_known_hosts,
- tvb,
- offset,
- arg_length, ENC_NA);
- dissect_amqp_0_10_array (tvb,
- pinfo,
- offset,
- offset + arg_length,
- arg_length,
- ti);
- AMQP_INCREMENT(offset, arg_length, length);
- }
- break;
-
- case AMQP_0_10_METHOD_CONNECTION_HEARTBEAT:
- break;
-
- case AMQP_0_10_METHOD_CONNECTION_CLOSE:
- if ((flag1 & ~0x03) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) {
- /* reply-code (uint16) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_connection_close_reply_code,
- tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
- }
- if (flag1 & 0x02) {
- /* reply-text (str8) */
- proto_tree_add_item(args_tree,
- hf_amqp_method_connection_close_reply_text,
- tvb, offset + 1, tvb_get_guint8(tvb, offset),
- ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, 1 + tvb_get_guint8(tvb, offset), length);
- }
- break;
-
- case AMQP_0_10_METHOD_CONNECTION_CLOSE_OK:
- break;
- }
-}
-
-static void
-dissect_amqp_0_10_session(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_tree *tree,
- int offset, guint16 length)
-{
- proto_item *args_tree;
- proto_item *ti;
- proto_item *flags_item;
- guint8 method;
- guint8 flag1, flag2;
- guint16 size;
- guint32 array_size;
- int flags_offset;
- const gchar *method_name;
-
- method = tvb_get_guint8(tvb, offset+1);
- method_name = val_to_str_const(method, amqp_0_10_session_methods,
- "<invalid session method>");
- col_append_str(pinfo->cinfo, COL_INFO, method_name);
- col_append_str(pinfo->cinfo, COL_INFO, " ");
- col_set_fence(pinfo->cinfo, COL_INFO);
-
- proto_tree_add_item(tree, hf_amqp_0_10_session_method,
- tvb, offset+1, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
-
- ti = proto_tree_add_item(tree, hf_amqp_method_arguments,
- tvb, offset, length - 2, ENC_NA);
- args_tree = proto_item_add_subtree(ti, ett_args);
- /*
- * The flag bits are a simple bit string, not a net-byte-order
- * field. tvb_get_bits16() doesn't know how to do little-endian
- * at this time, so just pick out two bytes.
- */
- flags_offset = offset;
- flag1 = tvb_get_guint8(tvb, offset);
- flag2 = tvb_get_guint8(tvb, offset+1);
- flags_item = proto_tree_add_item(args_tree,
- hf_amqp_0_10_argument_packing_flags,
- tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
- switch (method) {
- case AMQP_0_10_METHOD_SESSION_ATTACH:
- if ((flag1 & ~0x03) || ((flag2 != 0)))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) {
- /* name (vbin16) */
- size = tvb_get_ntohs(tvb, offset);
- AMQP_INCREMENT(offset, 2, length);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_session_attach_name,
- tvb, offset, size, ENC_NA);
- AMQP_INCREMENT(offset, size, length);
- }
- /*
- * 2nd argument is an optional bit, force.
- */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_session_attach_force,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- break;
-
- case AMQP_0_10_METHOD_SESSION_ATTACHED:
- case AMQP_0_10_METHOD_SESSION_DETACH:
- if ((flag1 != 0x01) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) {
- /* name (vbin16) */
- size = tvb_get_ntohs(tvb, offset);
- AMQP_INCREMENT(offset, 2, length);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_session_attach_name,
- tvb, offset, size, ENC_NA);
- AMQP_INCREMENT(offset, size, length);
- }
- break;
-
- case AMQP_0_10_METHOD_SESSION_DETACHED:
- if ((flag1 & ~0x03) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) {
- /* name (vbin16) */
- size = tvb_get_ntohs(tvb, offset);
- AMQP_INCREMENT(offset, 2, length);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_session_attach_name,
- tvb, offset, size, ENC_NA);
- AMQP_INCREMENT(offset, size, length);
- }
- if (flag1 & 0x02) {
- /* code (detach-code [uint8]) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_session_detached_code,
- tvb, offset, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 1, length);
- }
- break;
-
- case AMQP_0_10_METHOD_SESSION_REQUEST_TIMEOUT:
- case AMQP_0_10_METHOD_SESSION_TIMEOUT:
- if ((flag1 & ~0x01) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) {
- /* timeout (uint32) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_session_timeout,
- tvb, offset, 4, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 4, length);
- }
- break;
-
- case AMQP_0_10_METHOD_SESSION_COMMAND_POINT:
- if ((flag1 & ~0x03) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) {
- /* command-id (sequence-no [uint32]) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_session_command_point_id,
- tvb, offset, 4, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 4, length);
- }
- if (flag1 & 0x02) {
- /* command-offset (uint64) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_session_command_point_offset,
- tvb, offset, 8, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 8, length);
- }
- break;
-
- case AMQP_0_10_METHOD_SESSION_EXPECTED:
- if ((flag1 & ~0x03) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) {
- /* commands (commands [sequence-set]) */
- size = tvb_get_ntohs(tvb, offset);
- ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_session_commands,
- tvb, offset, size + 2, ENC_NA);
- AMQP_INCREMENT(offset, 2, length);
- format_amqp_0_10_sequence_set(tvb, offset, size, ti);
- AMQP_INCREMENT(offset, size, length);
- }
- if (flag1 & 0x02) {
- /* fragments (command-fragments [array of command-fragment]) */
- array_size = amqp_0_10_get_32bit_size(tvb, offset);
- ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_session_fragments,
- tvb, offset, array_size + 4, ENC_NA);
- AMQP_INCREMENT(offset, 4, length);
- dissect_amqp_0_10_array(tvb,
- pinfo,
- offset,
- offset + array_size,
- length,
- ti);
- AMQP_INCREMENT(offset, array_size, length);
- }
- break;
-
- case AMQP_0_10_METHOD_SESSION_CONFIRMED:
- if ((flag1 & ~0x03) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) {
- /* commands (commands [sequence-set]) */
- size = tvb_get_ntohs(tvb, offset);
- ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_session_commands,
- tvb, offset, size + 2, ENC_NA);
- AMQP_INCREMENT(offset, 2, length);
- format_amqp_0_10_sequence_set(tvb, offset, size, ti);
- AMQP_INCREMENT(offset, size, length);
+ /* channel-max (uint16) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_method_connection_tune_ok_channel_max,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += 2;
}
if (flag1 & 0x02) {
- /* fragments (command-fragments [array of command-fragment]) */
- array_size = amqp_0_10_get_32bit_size(tvb, offset);
- ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_session_fragments,
- tvb, offset, array_size + 4, ENC_NA);
- AMQP_INCREMENT(offset, 4, length);
- dissect_amqp_0_10_array(tvb,
- pinfo,
- offset,
- offset + array_size,
- length,
- ti);
- AMQP_INCREMENT(offset, array_size, length);
+ /* max-frame-size (uint16) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_connection_tune_ok_frame_max,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += 2;
+ }
+ if (flag1 & 0x04) {
+ /* heartbeat (uint16) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_method_connection_tune_ok_heartbeat,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ /* offset += 2; */
}
break;
- case AMQP_0_10_METHOD_SESSION_COMPLETED:
- if ((flag1 & ~0x03) || (flag2 != 0))
+ case AMQP_0_10_METHOD_CONNECTION_OPEN:
+ if ((flag1 & ~0x07) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
if (flag1 & 0x01) {
- /* commands (commands [sequence-set]) */
- size = tvb_get_ntohs(tvb, offset);
+ /* virtual-host (str8) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_method_connection_open_virtual_host,
+ tvb,
+ offset,
+ 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag1 & 0x02) {
+ /* capabilities (str16-array) */
+ arg_length = amqp_0_10_get_32bit_size_new(args_tree, pinfo, tvb, hf_amqp_0_10_method_connection_open_capabilities_size, offset);
+ offset += 4;
ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_session_commands,
- tvb, offset, size + 2, ENC_NA);
- AMQP_INCREMENT(offset, 2, length);
- format_amqp_0_10_sequence_set(tvb, offset, size, ti);
- AMQP_INCREMENT(offset, size, length);
+ hf_amqp_0_10_method_connection_open_capabilities,
+ tvb,
+ offset,
+ arg_length, ENC_ASCII|ENC_NA);
+ dissect_amqp_0_10_array (tvb,
+ pinfo,
+ offset,
+ ti);
+ /* offset += arg_length; */
}
/*
- * 2nd argument is an optional bit, timely-reply.
+ * 3rd argument is an optional bit, insist.
*/
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_session_completed_timely,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- break;
-
- case AMQP_0_10_METHOD_SESSION_KNOWN_COMPLETED:
- if ((flag1 & ~0x01) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) {
- /* commands (commands [sequence-set]) */
- size = tvb_get_ntohs(tvb, offset);
- ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_session_commands,
- tvb, offset, size + 2, ENC_NA);
- AMQP_INCREMENT(offset, 2, length);
- format_amqp_0_10_sequence_set(tvb, offset, size, ti);
- AMQP_INCREMENT(offset, size, length);
- }
- break;
-
- case AMQP_0_10_METHOD_SESSION_FLUSH:
- if ((flag1 & ~0x07) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_session_flush_expected,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_session_flush_confirmed,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_session_flush_completed,
+ hf_amqp_0_10_method_connection_open_insist,
tvb, flags_offset, 1, ENC_BIG_ENDIAN);
break;
- case AMQP_0_10_METHOD_SESSION_GAP:
+ case AMQP_0_10_METHOD_CONNECTION_OPEN_OK:
if ((flag1 & ~0x01) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
if (flag1 & 0x01) {
- /* commands (commands [sequence-set]) */
- size = tvb_get_ntohs(tvb, offset);
+ /* known-hosts (amqp-host-array) */
+ arg_length = amqp_0_10_get_32bit_size_new(args_tree, pinfo, tvb, hf_amqp_0_10_method_connection_open_ok_known_hosts_size, offset);
+ offset += 4;
ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_session_commands,
- tvb, offset, size + 2, ENC_NA);
- AMQP_INCREMENT(offset, 2, length);
- format_amqp_0_10_sequence_set(tvb, offset, size, ti);
- AMQP_INCREMENT(offset, size, length);
+ hf_amqp_0_10_method_connection_open_ok_known_hosts,
+ tvb,
+ offset,
+ arg_length, ENC_NA);
+ dissect_amqp_0_10_array (tvb,
+ pinfo,
+ offset,
+ ti);
+ /* offset += arg_length; */
}
break;
- }
-}
-
-static void
-dissect_amqp_0_10_execution(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_tree *tree,
- int offset, guint16 length)
-{
- proto_item *args_tree;
- proto_item *ti;
- proto_item *flags_item;
- guint8 amqp_class = 0, method;
- guint8 flag1, flag2;
- guint16 size;
- guint32 struct_size;
- int class_hf;
- const gchar *method_name;
-
- method = tvb_get_guint8(tvb, offset+1);
- method_name = val_to_str_const(method, amqp_0_10_execution_methods,
- "<invalid execution method>");
- col_append_str(pinfo->cinfo, COL_INFO, method_name);
- col_append_str(pinfo->cinfo, COL_INFO, " ");
- col_set_fence(pinfo->cinfo, COL_INFO);
-
- proto_tree_add_item(tree, hf_amqp_0_10_execution_method,
- tvb, offset+1, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
- /*
- * Session header is 2 bytes; one that tells that it's 1 byte long, then
- * the byte itself. Bit 0 is sync.
- */
- flag1 = tvb_get_guint8(tvb, offset);
- flag2 = tvb_get_guint8(tvb, offset+1);
- ti = proto_tree_add_item(tree, hf_amqp_0_10_session_header, tvb, offset, 2, ENC_BIG_ENDIAN);
- if ((flag1 != 1) || ((flag2 & 0xfe) != 0))
- proto_item_append_text(ti, " (Invalid)");
- else
- proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync,
- tvb, offset + 1, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
-
- ti = proto_tree_add_item(tree, hf_amqp_method_arguments,
- tvb, offset, length - 4, ENC_NA);
- args_tree = proto_item_add_subtree(ti, ett_args);
- /*
- * The flag bits are a simple bit string, not a net-byte-order
- * field. tvb_get_bits16() doesn't know how to do little-endian
- * at this time, so just pick out two bytes.
- */
- flag1 = tvb_get_guint8(tvb, offset);
- flag2 = tvb_get_guint8(tvb, offset+1);
- flags_item = proto_tree_add_item(args_tree,
- hf_amqp_0_10_argument_packing_flags,
- tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
- switch (method) {
- case AMQP_0_10_METHOD_EXECUTION_SYNC:
- if ((flag1 != 0) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- break;
-
- case AMQP_0_10_METHOD_EXECUTION_RESULT:
+ case AMQP_0_10_METHOD_CONNECTION_REDIRECT:
if ((flag1 & ~0x03) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
if (flag1 & 0x01) {
- /* command-id (sequence-no [uint32]) */
+ /* host (amqp-host-url [str16]) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_execution_command_id,
- tvb, offset, 4, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 4, length);
+ hf_amqp_method_connection_redirect_host,
+ tvb, offset, 2,
+ ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (2 + tvb_get_ntohs(tvb, offset));
}
if (flag1 & 0x02) {
- /* value (struct32) */
- struct_size = amqp_0_10_get_32bit_size(tvb, offset);
- AMQP_INCREMENT(offset, 4, length);
+ /* known-hosts (amqp-host-array) */
+ arg_length = amqp_0_10_get_32bit_size_new(args_tree, pinfo, tvb, hf_amqp_0_10_method_connection_redirect_known_hosts_size, offset);
+ offset += 4;
ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_undissected_struct32,
- tvb, offset, struct_size, ENC_NA);
- dissect_amqp_0_10_struct32(tvb, pinfo, ti, offset, struct_size);
- AMQP_INCREMENT(offset, struct_size, length);
+ hf_amqp_0_10_method_connection_redirect_known_hosts,
+ tvb,
+ offset,
+ arg_length, ENC_NA);
+ dissect_amqp_0_10_array (tvb,
+ pinfo,
+ offset,
+ ti);
+ /* offset += arg_length; */
}
break;
- case AMQP_0_10_METHOD_EXECUTION_EXCEPTION:
- if ((flag1 & ~0x7f) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) {
- /* error-code (error-code [uint16]) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_execution_exception_error,
- tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
- }
- if (flag1 & 0x02) {
- /* command-id (sequence-no [uint32]) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_execution_command_id,
- tvb, offset, 4, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 4, length);
- }
- if (flag1 & 0x04) {
- /* class-code (uint8) */
- amqp_class = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree, hf_amqp_0_10_class,
- tvb, offset, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 1, length);
- }
- if (flag1 & 0x08) {
- /* command-code (uint8) */
- switch(amqp_class) {
- case AMQP_0_10_CLASS_CONNECTION:
- class_hf = hf_amqp_0_10_connection_method;
- break;
- case AMQP_0_10_CLASS_SESSION:
- class_hf = hf_amqp_0_10_session_method;
- break;
- case AMQP_0_10_CLASS_EXECUTION:
- class_hf = hf_amqp_0_10_execution_method;
- break;
- case AMQP_0_10_CLASS_MESSAGE:
- class_hf = hf_amqp_0_10_message_method;
- break;
- case AMQP_0_10_CLASS_TX:
- class_hf = hf_amqp_0_10_tx_method;
- break;
- case AMQP_0_10_CLASS_DTX:
- class_hf = hf_amqp_0_10_dtx_method;
- break;
- case AMQP_0_10_CLASS_EXCHANGE:
- class_hf = hf_amqp_0_10_exchange_method;
- break;
- case AMQP_0_10_CLASS_QUEUE:
- class_hf = hf_amqp_0_10_queue_method;
- break;
- case AMQP_0_10_CLASS_FILE:
- class_hf = hf_amqp_0_10_file_method;
- break;
- case AMQP_0_10_CLASS_STREAM:
- class_hf = hf_amqp_0_10_stream_method;
- break;
- default:
- class_hf = -1;
- break;
- }
- if (class_hf != -1)
- proto_tree_add_item(args_tree, class_hf,
- tvb, offset, 1, ENC_BIG_ENDIAN);
- else
- expert_add_info_format(pinfo, args_tree, &ei_amqp_invalid_class_code, "Invalid class code %x", amqp_class);
- AMQP_INCREMENT(offset, 1, length);
- }
- if (flag1 & 0x10) {
- /* field-index (uint8) */
- proto_tree_add_item(args_tree, hf_amqp_0_10_method_execution_field_index,
- tvb, offset, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 1, length);
- }
- if (flag1 & 0x20) {
- /* description (str16) */
- size = tvb_get_ntohs(tvb, offset);
- proto_tree_add_item(args_tree, hf_amqp_0_10_method_execution_description,
- tvb, offset + 2, size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (2 + size), length);
+ case AMQP_0_10_METHOD_CONNECTION_HEARTBEAT:
+ break;
+
+ case AMQP_0_10_METHOD_CONNECTION_CLOSE:
+ if ((flag1 & ~0x03) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) {
+ /* reply-code (uint16) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_connection_close_reply_code,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += 2;
}
- if (flag1 & 0x40) {
- /* error-info (map) */
- struct_size = amqp_0_10_get_32bit_size(tvb, offset);
- AMQP_INCREMENT(offset, 4, length);
- ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_execution_error_info,
- tvb,
- offset,
- struct_size, ENC_NA);
- dissect_amqp_0_10_map (tvb,
- offset,
- offset + struct_size,
- struct_size,
- ti);
- AMQP_INCREMENT(offset, struct_size, length);
+ if (flag1 & 0x02) {
+ /* reply-text (str8) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_method_connection_close_reply_text,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ /* offset + (1 + tvb_get_guint8(tvb, offset)); */
}
break;
+
+ case AMQP_0_10_METHOD_CONNECTION_CLOSE_OK:
+ break;
}
}
static void
-dissect_amqp_0_10_message(tvbuff_t *tvb,
+dissect_amqp_0_10_session(tvbuff_t *tvb,
packet_info *pinfo,
- proto_tree *tree,
- int offset, guint16 length)
+ proto_tree *tree)
{
proto_item *args_tree;
proto_item *ti;
proto_item *flags_item;
- guint8 method, str_size;
+ guint8 method;
guint8 flag1, flag2;
- guint16 size;
- guint32 map_size;
+ guint32 size;
+ guint32 array_size;
int flags_offset;
const gchar *method_name;
+ int offset = 0;
method = tvb_get_guint8(tvb, offset+1);
- method_name = val_to_str_const(method, amqp_0_10_message_methods,
- "<invalid message method>");
- col_append_str(pinfo->cinfo, COL_INFO, method_name);
- col_append_str(pinfo->cinfo, COL_INFO, " ");
+ method_name = val_to_str_const(method, amqp_0_10_session_methods,
+ "<invalid session method>");
+ col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", method_name);
col_set_fence(pinfo->cinfo, COL_INFO);
- proto_tree_add_item(tree, hf_amqp_0_10_message_method,
+ proto_tree_add_item(tree, hf_amqp_0_10_session_method,
tvb, offset+1, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
- /*
- * Session header is 2 bytes; one that tells that it's 1 byte long, then
- * the byte itself. Bit 0 is sync.
- */
- flag1 = tvb_get_guint8(tvb, offset);
- flag2 = tvb_get_guint8(tvb, offset+1);
- ti = proto_tree_add_item(tree, hf_amqp_0_10_session_header, tvb, offset, 2, ENC_BIG_ENDIAN);
- if ((flag1 != 1) || ((flag2 & 0xfe) != 0))
- proto_item_append_text(ti, " (Invalid)");
- else
- proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync,
- tvb, offset + 1, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
+ offset += 2;
ti = proto_tree_add_item(tree, hf_amqp_method_arguments,
- tvb, offset, length - 4, ENC_NA);
+ tvb, offset, -1, ENC_NA);
args_tree = proto_item_add_subtree(ti, ett_args);
/*
* The flag bits are a simple bit string, not a net-byte-order
flags_item = proto_tree_add_item(args_tree,
hf_amqp_0_10_argument_packing_flags,
tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
+ offset += 2;
switch (method) {
- case AMQP_0_10_METHOD_MESSAGE_TRANSFER:
- if ((flag1 & ~0x07) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* destination (str8) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_transfer_destination,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
- if (flag1 & 0x02) { /* accept-mode (accept-mode [uint8]) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_transfer_accept_mode,
- tvb, offset, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 1, length);
- }
- if (flag1 & 0x04) { /* acquire-mode (acquire-mode [uint8]) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_transfer_acquire_mode,
- tvb, offset, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 1, length);
- }
- break;
-
- case AMQP_0_10_METHOD_MESSAGE_ACCEPT:
- if ((flag1 & ~0x01) || (flag2 != 0))
+ case AMQP_0_10_METHOD_SESSION_ATTACH:
+ if ((flag1 & ~0x03) || ((flag2 != 0)))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
if (flag1 & 0x01) {
- /* transfers (session.commands [sequence-set]) */
- size = tvb_get_ntohs(tvb, offset);
- ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_accept_transfers,
- tvb, offset, size + 2, ENC_NA);
- AMQP_INCREMENT(offset, 2, length);
- format_amqp_0_10_sequence_set(tvb, offset, size, ti);
- AMQP_INCREMENT(offset, size, length);
+ /* name (vbin16) */
+ proto_tree_add_item_ret_uint(args_tree, hf_amqp_0_10_method_session_attach_name_size,
+ tvb, offset, 2, ENC_BIG_ENDIAN, &size);
+ offset += 2;
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_session_attach_name,
+ tvb, offset, size, ENC_NA);
+ /* offset += size; */
}
+ /*
+ * 2nd argument is an optional bit, force.
+ */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_session_attach_force,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
break;
- case AMQP_0_10_METHOD_MESSAGE_REJECT:
- if ((flag1 & ~0x07) || (flag2 != 0))
+ case AMQP_0_10_METHOD_SESSION_ATTACHED:
+ case AMQP_0_10_METHOD_SESSION_DETACH:
+ if ((flag1 != 0x01) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
if (flag1 & 0x01) {
- /* transfers (session.commands [sequence-set]) */
- size = tvb_get_ntohs(tvb, offset);
- ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_accept_transfers,
- tvb, offset, size + 2, ENC_NA);
- AMQP_INCREMENT(offset, 2, length);
- format_amqp_0_10_sequence_set(tvb, offset, size, ti);
- AMQP_INCREMENT(offset, size, length);
- }
- if (flag1 & 0x02) { /* reject-code (reject-code [uint16]) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_transfer_reject_code,
- tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
- }
- if (flag1 & 0x04) { /* text (str8) */
- str_size = tvb_get_guint8(tvb, offset);
+ /* name (vbin16) */
+ proto_tree_add_item_ret_uint(args_tree, hf_amqp_0_10_method_session_attach_name_size,
+ tvb, offset, 2, ENC_BIG_ENDIAN, &size);
+ offset += 2;
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_reject_text,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
+ hf_amqp_0_10_method_session_attach_name,
+ tvb, offset, size, ENC_NA);
+ /* offset += size; */
}
break;
- case AMQP_0_10_METHOD_MESSAGE_RELEASE:
+ case AMQP_0_10_METHOD_SESSION_DETACHED:
if ((flag1 & ~0x03) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
if (flag1 & 0x01) {
- /* transfers (session.commands [sequence-set]) */
- size = tvb_get_ntohs(tvb, offset);
+ /* name (vbin16) */
+ proto_tree_add_item_ret_uint(args_tree, hf_amqp_0_10_method_session_attach_name_size,
+ tvb, offset, 2, ENC_BIG_ENDIAN, &size);
+ offset += 2;
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_accept_transfers,
- tvb, offset, size + 2, ENC_NA);
- AMQP_INCREMENT(offset, 2, length);
- format_amqp_0_10_sequence_set(tvb, offset, size, ti);
- AMQP_INCREMENT(offset, size, length);
+ hf_amqp_0_10_method_session_attach_name,
+ tvb, offset, size, ENC_NA);
+ offset += size;
+ }
+ if (flag1 & 0x02) {
+ /* code (detach-code [uint8]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_session_detached_code,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ /* offset += 1; */
}
- /*
- * 2nd argument is an optional bit, set-redelivered.
- */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_release_set_redelivered,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
break;
- case AMQP_0_10_METHOD_MESSAGE_ACQUIRE:
+ case AMQP_0_10_METHOD_SESSION_REQUEST_TIMEOUT:
+ case AMQP_0_10_METHOD_SESSION_TIMEOUT:
if ((flag1 & ~0x01) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
if (flag1 & 0x01) {
- /* transfers (session.commands [sequence-set]) */
- size = tvb_get_ntohs(tvb, offset);
+ /* timeout (uint32) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_accept_transfers,
- tvb, offset, size + 2, ENC_NA);
- AMQP_INCREMENT(offset, 2, length);
- format_amqp_0_10_sequence_set(tvb, offset, size, ti);
- AMQP_INCREMENT(offset, size, length);
+ hf_amqp_0_10_method_session_timeout,
+ tvb, offset, 4, ENC_BIG_ENDIAN);
+ /* offset += 4; */
}
break;
- case AMQP_0_10_METHOD_MESSAGE_RESUME:
+ case AMQP_0_10_METHOD_SESSION_COMMAND_POINT:
if ((flag1 & ~0x03) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
if (flag1 & 0x01) {
- /* destination (destination [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
+ /* command-id (sequence-no [uint32]) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_dest,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, 1 + str_size, length);
+ hf_amqp_0_10_method_session_command_point_id,
+ tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += 4;
}
if (flag1 & 0x02) {
- /* resume-id (resume-id [str16]) */
- size = tvb_get_ntohs(tvb, offset);
+ /* command-offset (uint64) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_resume_id,
- tvb, offset + 2, size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, 2 + size, length);
+ hf_amqp_0_10_method_session_command_point_offset,
+ tvb, offset, 8, ENC_BIG_ENDIAN);
+ /* offset += 8; */
}
break;
- case AMQP_0_10_METHOD_MESSAGE_SUBSCRIBE:
- if (flag2 != 0)
+ case AMQP_0_10_METHOD_SESSION_EXPECTED:
+ if ((flag1 & ~0x03) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
if (flag1 & 0x01) {
- /* queue (queue.name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_subscribe_queue,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, 1 + str_size, length);
- }
- if (flag1 & 0x02) {
- /* destination (destination [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_dest,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, 1 + str_size, length);
- }
- if (flag1 & 0x04) { /* accept-mode (accept-mode [uint8]) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_transfer_accept_mode,
- tvb, offset, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 1, length);
- }
- if (flag1 & 0x08) { /* acquire-mode (acquire-mode [uint8]) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_transfer_acquire_mode,
- tvb, offset, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 1, length);
- }
- /*
- * 5th argument is an optional bit, exclusive.
- */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_subscribe_exclusive,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- if (flag1 & 0x20) {
- /* resume-id (resume-id [str16]) */
+ /* commands (commands [sequence-set]) */
size = tvb_get_ntohs(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_resume_id,
- tvb, offset, 2 + size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, 2 + size, length);
- }
- if (flag1 & 0x40) {
- /* resume-ttl (uint64) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_subscribe_resume_ttl,
- tvb, offset, 8, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 8, length);
- }
- if (flag1 & 0x80) {
- /* arguments (map) */
- map_size = amqp_0_10_get_32bit_size(tvb, offset);
ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_subscribe_args,
- tvb,
- offset,
- 4 + map_size, ENC_NA);
- dissect_amqp_0_10_map (tvb,
- offset + 4,
- offset + 4 + map_size,
- map_size,
- ti);
- AMQP_INCREMENT(offset, 4 + map_size, length);
+ hf_amqp_0_10_method_session_commands,
+ tvb, offset, size + 2, ENC_NA);
+ offset += 2;
+ format_amqp_0_10_sequence_set(tvb, offset, size, ti);
+ offset += size;
}
- break;
-
- case AMQP_0_10_METHOD_MESSAGE_CANCEL:
- if ((flag1 & ~0x01) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) {
- /* destination (destination [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_dest,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, 1 + str_size, length);
+ if (flag1 & 0x02) {
+ /* fragments (command-fragments [array of command-fragment]) */
+ array_size = amqp_0_10_get_32bit_size(tvb, offset);
+ ti = proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_session_fragments,
+ tvb, offset, array_size + 4, ENC_NA);
+ offset += 4;
+ dissect_amqp_0_10_array(tvb,
+ pinfo,
+ offset,
+ ti);
+ /* offset += array_size; */
}
break;
- case AMQP_0_10_METHOD_MESSAGE_SET_FLOW_MODE:
+ case AMQP_0_10_METHOD_SESSION_CONFIRMED:
if ((flag1 & ~0x03) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
if (flag1 & 0x01) {
- /* destination (destination [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_dest,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, 1 + str_size, length);
+ /* commands (commands [sequence-set]) */
+ size = tvb_get_ntohs(tvb, offset);
+ ti = proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_session_commands,
+ tvb, offset, size + 2, ENC_NA);
+ offset += 2;
+ format_amqp_0_10_sequence_set(tvb, offset, size, ti);
+ offset += size;
}
if (flag1 & 0x02) {
- /* flow-mode (flow-mode [uint8]) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_flow_mode,
- tvb, offset, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 1, length);
+ /* fragments (command-fragments [array of command-fragment]) */
+ array_size = amqp_0_10_get_32bit_size(tvb, offset);
+ ti = proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_session_fragments,
+ tvb, offset, array_size + 4, ENC_NA);
+ offset += 4;
+ dissect_amqp_0_10_array(tvb,
+ pinfo,
+ offset,
+ ti);
+ /* offset += array_size; */
}
break;
- case AMQP_0_10_METHOD_MESSAGE_FLOW:
- if ((flag1 & ~0x07) || (flag2 != 0))
+ case AMQP_0_10_METHOD_SESSION_COMPLETED:
+ if ((flag1 & ~0x03) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
if (flag1 & 0x01) {
- /* destination (destination [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_dest,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, 1 + str_size, length);
- }
- if (flag1 & 0x02) {
- /* unit (credit-unit [uint8]) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_credit_unit,
- tvb, offset, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 1, length);
- }
- if (flag1 & 0x04) {
- /* value (uint32) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_credit_value,
- tvb, offset, 4, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 4, length);
+ /* commands (commands [sequence-set]) */
+ size = tvb_get_ntohs(tvb, offset);
+ ti = proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_session_commands,
+ tvb, offset, size + 2, ENC_NA);
+ offset += 2;
+ format_amqp_0_10_sequence_set(tvb, offset, size, ti);
+ /* offset += size; */
}
+ /*
+ * 2nd argument is an optional bit, timely-reply.
+ */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_session_completed_timely,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
break;
- case AMQP_0_10_METHOD_MESSAGE_FLUSH:
+ case AMQP_0_10_METHOD_SESSION_KNOWN_COMPLETED:
if ((flag1 & ~0x01) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
if (flag1 & 0x01) {
- /* destination (destination [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_dest,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, 1 + str_size, length);
+ /* commands (commands [sequence-set]) */
+ size = tvb_get_ntohs(tvb, offset);
+ ti = proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_session_commands,
+ tvb, offset, size + 2, ENC_NA);
+ offset += 2;
+ format_amqp_0_10_sequence_set(tvb, offset, size, ti);
+ /* offset += size; */
}
break;
- case AMQP_0_10_METHOD_MESSAGE_STOP:
+ case AMQP_0_10_METHOD_SESSION_FLUSH:
+ if ((flag1 & ~0x07) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_session_flush_expected,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_session_flush_confirmed,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_session_flush_completed,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ break;
+
+ case AMQP_0_10_METHOD_SESSION_GAP:
if ((flag1 & ~0x01) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
if (flag1 & 0x01) {
- /* destination (destination [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_dest,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, 1 + str_size, length);
+ /* commands (commands [sequence-set]) */
+ size = tvb_get_ntohs(tvb, offset);
+ ti = proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_session_commands,
+ tvb, offset, size + 2, ENC_NA);
+ offset += 2;
+ format_amqp_0_10_sequence_set(tvb, offset, size, ti);
+ /* offset += size; */
}
break;
- }
-}
-
-static void
-dissect_amqp_0_10_tx(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_tree *tree,
- int offset, guint16 length)
-{
- guint8 method;
- guint8 flag1, flag2;
- const gchar *method_name;
- proto_item *ti;
-
- method = tvb_get_guint8(tvb, offset+1);
- method_name = val_to_str_const(method, amqp_0_10_tx_methods,
- "<invalid tx method>");
- col_append_str(pinfo->cinfo, COL_INFO, method_name);
- col_append_str(pinfo->cinfo, COL_INFO, " ");
- col_set_fence(pinfo->cinfo, COL_INFO);
-
- proto_tree_add_item(tree, hf_amqp_0_10_tx_method,
- tvb, offset+1, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
- /*
- * Session header is 2 bytes; one that tells that it's 1 byte long, then
- * the byte itself. Bit 0 is sync.
- */
- flag1 = tvb_get_guint8(tvb, offset);
- flag2 = tvb_get_guint8(tvb, offset+1);
- ti = proto_tree_add_item(tree, hf_amqp_0_10_session_header, tvb, offset, 2, ENC_BIG_ENDIAN);
- if ((flag1 != 1) || ((flag2 & 0xfe) != 0))
- proto_item_append_text(ti, " (Invalid)");
- else
- proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync,
- tvb, offset + 1, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
- /* No args on any method in this class */
+ }
}
static void
-dissect_amqp_0_10_dtx(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_tree *tree,
- int offset, guint16 length)
+dissect_amqp_0_10_execution(tvbuff_t *tvb,
+ packet_info *pinfo,
+ proto_tree *tree)
{
proto_item *args_tree;
proto_item *ti;
proto_item *flags_item;
- guint8 method;
+ guint8 amqp_class = 0, method;
guint8 flag1, flag2;
- guint16 xid_length;
- int flags_offset;
+ guint32 struct_size;
+ int class_hf;
const gchar *method_name;
+ int offset = 0;
+ tvbuff_t *next_tvb;
method = tvb_get_guint8(tvb, offset+1);
- method_name = val_to_str_const(method, amqp_0_10_dtx_methods,
- "<invalid dtx method>");
- col_append_str(pinfo->cinfo, COL_INFO, method_name);
- col_append_str(pinfo->cinfo, COL_INFO, " ");
+ method_name = val_to_str_const(method, amqp_0_10_execution_methods,
+ "<invalid execution method>");
+ col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", method_name);
col_set_fence(pinfo->cinfo, COL_INFO);
- proto_tree_add_item(tree, hf_amqp_0_10_dtx_method,
+ proto_tree_add_item(tree, hf_amqp_0_10_execution_method,
tvb, offset+1, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
+ offset += 2;
/*
* Session header is 2 bytes; one that tells that it's 1 byte long, then
* the byte itself. Bit 0 is sync.
else
proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync,
tvb, offset + 1, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
-
- /* No args for dtx.select or dtx.recover */
- if ((method == AMQP_0_10_METHOD_DTX_SELECT) ||
- (method == AMQP_0_10_METHOD_DTX_RECOVER))
- return;
+ offset += 2;
ti = proto_tree_add_item(tree, hf_amqp_method_arguments,
- tvb, offset, length - 4, ENC_NA);
+ tvb, offset, -1, ENC_NA);
args_tree = proto_item_add_subtree(ti, ett_args);
-
/*
* The flag bits are a simple bit string, not a net-byte-order
* field. tvb_get_bits16() doesn't know how to do little-endian
* at this time, so just pick out two bytes.
*/
- flags_offset = offset;
flag1 = tvb_get_guint8(tvb, offset);
flag2 = tvb_get_guint8(tvb, offset+1);
flags_item = proto_tree_add_item(args_tree,
hf_amqp_0_10_argument_packing_flags,
tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
+ offset += 2;
switch (method) {
- case AMQP_0_10_METHOD_DTX_START:
- if ((flag1 & ~0x07) || (flag2 != 0))
+ case AMQP_0_10_METHOD_EXECUTION_SYNC:
+ if ((flag1 != 0) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* xid (xid) */
- xid_length = tvb_get_ntohs(tvb, offset);
- AMQP_INCREMENT(offset, 2, length);
- ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_dtx_xid,
- tvb,
- offset - 2,
- xid_length + 2, ENC_NA);
- dissect_amqp_0_10_xid (tvb,
- offset,
- xid_length,
- ti);
- AMQP_INCREMENT(offset, xid_length, length);
- }
- /*
- * 2nd, 3rd arguments are optional bits.
- */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_dtx_start_join,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_dtx_start_resume,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
-
break;
- case AMQP_0_10_METHOD_DTX_END:
- if ((flag1 & ~0x07) || (flag2 != 0))
+ case AMQP_0_10_METHOD_EXECUTION_RESULT:
+ if ((flag1 & ~0x03) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* xid (xid) */
- xid_length = tvb_get_ntohs(tvb, offset);
- AMQP_INCREMENT(offset, 2, length);
+ if (flag1 & 0x01) {
+ /* command-id (sequence-no [uint32]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_execution_command_id,
+ tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += 4;
+ }
+ if (flag1 & 0x02) {
+ /* value (struct32) */
+ struct_size = amqp_0_10_get_32bit_size_new(args_tree, pinfo, tvb, hf_amqp_0_10_struct32_size, offset);
+ offset += 4;
+
ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_dtx_xid,
- tvb,
- offset - 2,
- xid_length + 2, ENC_NA);
- dissect_amqp_0_10_xid (tvb,
- offset,
- xid_length,
- ti);
- AMQP_INCREMENT(offset, xid_length, length);
+ hf_amqp_0_10_struct32,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_item_set_len(ti, struct_size);
+ if (struct_size > (guint32)tvb_reported_length_remaining(tvb, offset))
+ {
+ next_tvb = tvb_new_subset_remaining(tvb, offset);
+ }
+ else
+ {
+ next_tvb = tvb_new_subset_length(tvb, offset, struct_size);
+ }
+ dissect_amqp_0_10_struct32(next_tvb, pinfo, ti);
+ /* offset += struct_size; */
}
- /*
- * 2nd, 3rd arguments are optional bits.
- */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_dtx_end_fail,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_dtx_end_suspend,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
break;
- case AMQP_0_10_METHOD_DTX_COMMIT:
- if ((flag1 & ~0x03) || (flag2 != 0))
+ case AMQP_0_10_METHOD_EXECUTION_EXCEPTION:
+ if ((flag1 & ~0x7f) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* xid (xid) */
- xid_length = tvb_get_ntohs(tvb, offset);
- AMQP_INCREMENT(offset, 2, length);
- ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_dtx_xid,
- tvb,
- offset - 2,
- xid_length + 2, ENC_NA);
- dissect_amqp_0_10_xid (tvb,
- offset,
- xid_length,
- ti);
- AMQP_INCREMENT(offset, xid_length, length);
+ if (flag1 & 0x01) {
+ /* error-code (error-code [uint16]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_execution_exception_error,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += 2;
+ }
+ if (flag1 & 0x02) {
+ /* command-id (sequence-no [uint32]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_execution_command_id,
+ tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += 4;
+ }
+ if (flag1 & 0x04) {
+ /* class-code (uint8) */
+ amqp_class = tvb_get_guint8(tvb, offset);
+ proto_tree_add_item(args_tree, hf_amqp_0_10_class,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
+ }
+ if (flag1 & 0x08) {
+ /* command-code (uint8) */
+ switch(amqp_class) {
+ case AMQP_0_10_CLASS_CONNECTION:
+ class_hf = hf_amqp_0_10_connection_method;
+ break;
+ case AMQP_0_10_CLASS_SESSION:
+ class_hf = hf_amqp_0_10_session_method;
+ break;
+ case AMQP_0_10_CLASS_EXECUTION:
+ class_hf = hf_amqp_0_10_execution_method;
+ break;
+ case AMQP_0_10_CLASS_MESSAGE:
+ class_hf = hf_amqp_0_10_message_method;
+ break;
+ case AMQP_0_10_CLASS_TX:
+ class_hf = hf_amqp_0_10_tx_method;
+ break;
+ case AMQP_0_10_CLASS_DTX:
+ class_hf = hf_amqp_0_10_dtx_method;
+ break;
+ case AMQP_0_10_CLASS_EXCHANGE:
+ class_hf = hf_amqp_0_10_exchange_method;
+ break;
+ case AMQP_0_10_CLASS_QUEUE:
+ class_hf = hf_amqp_0_10_queue_method;
+ break;
+ case AMQP_0_10_CLASS_FILE:
+ class_hf = hf_amqp_0_10_file_method;
+ break;
+ case AMQP_0_10_CLASS_STREAM:
+ class_hf = hf_amqp_0_10_stream_method;
+ break;
+ default:
+ class_hf = -1;
+ break;
+ }
+ if (class_hf != -1)
+ proto_tree_add_item(args_tree, class_hf,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ else
+ expert_add_info_format(pinfo, args_tree, &ei_amqp_invalid_class_code, "Invalid class code %x", amqp_class);
+ offset += 1;
}
- /*
- * 2nd argument is an optional bit.
- */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_dtx_commit_one_phase,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- break;
-
- case AMQP_0_10_METHOD_DTX_FORGET:
- case AMQP_0_10_METHOD_DTX_GET_TIMEOUT:
- case AMQP_0_10_METHOD_DTX_PREPARE:
- case AMQP_0_10_METHOD_DTX_ROLLBACK:
- if ((flag1 & ~0x01) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* xid (xid) */
- xid_length = tvb_get_ntohs(tvb, offset);
- AMQP_INCREMENT(offset, 2, length);
- ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_dtx_xid,
- tvb,
- offset - 2,
- xid_length + 2, ENC_NA);
- dissect_amqp_0_10_xid (tvb,
- offset,
- xid_length,
- ti);
- AMQP_INCREMENT(offset, xid_length, length);
+ if (flag1 & 0x10) {
+ /* field-index (uint8) */
+ proto_tree_add_item(args_tree, hf_amqp_0_10_method_execution_field_index,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
}
- break;
-
- case AMQP_0_10_METHOD_DTX_SET_TIMEOUT:
- if ((flag1 & ~0x03) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* xid (xid) */
- xid_length = tvb_get_ntohs(tvb, offset);
- AMQP_INCREMENT(offset, 2, length);
+ if (flag1 & 0x20) {
+ /* description (str16) */
+ proto_tree_add_item(args_tree, hf_amqp_0_10_method_execution_description,
+ tvb, offset, 2, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (2 + tvb_get_ntohs(tvb, offset));
+ }
+ if (flag1 & 0x40) {
+ /* error-info (map) */
+ struct_size = amqp_0_10_get_32bit_size_new(args_tree, pinfo, tvb, hf_amqp_0_10_method_execution_error_info_size, offset);
+ offset += 4;
ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_dtx_xid,
+ hf_amqp_0_10_method_execution_error_info,
tvb,
- offset - 2,
- xid_length + 2, ENC_NA);
- dissect_amqp_0_10_xid (tvb,
- offset,
- xid_length,
- ti);
- AMQP_INCREMENT(offset, xid_length, length);
- }
- if (flag1 & 0x02) { /* timeout (uint32) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_dtx_set_timeout_timeout,
- tvb, offset, 4, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 4, length);
+ offset,
+ struct_size, ENC_NA);
+ if (struct_size > (guint32)tvb_reported_length_remaining(tvb, offset))
+ {
+ next_tvb = tvb_new_subset_remaining(tvb, offset);
+ }
+ else
+ {
+ next_tvb = tvb_new_subset_length(tvb, offset, struct_size);
+ }
+ dissect_amqp_0_10_map (next_tvb, ti);
+ /* offset += struct_size; */
}
break;
-
}
}
static void
-dissect_amqp_0_10_exchange(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_tree *tree,
- int offset, guint16 length)
+dissect_amqp_0_10_message(tvbuff_t *tvb,
+ packet_info *pinfo,
+ proto_tree *tree)
{
proto_item *args_tree;
proto_item *ti;
proto_item *flags_item;
guint8 method;
guint8 flag1, flag2;
- guint8 str_size;
- guint32 map_length;
+ guint16 size;
+ guint32 map_size;
int flags_offset;
const gchar *method_name;
+ int offset = 0;
+ tvbuff_t *next_tvb;
method = tvb_get_guint8(tvb, offset+1);
- method_name = val_to_str_const(method, amqp_0_10_exchange_methods,
- "<invalid exchange method>");
- col_append_str(pinfo->cinfo, COL_INFO, method_name);
- col_append_str(pinfo->cinfo, COL_INFO, " ");
+ method_name = val_to_str_const(method, amqp_0_10_message_methods,
+ "<invalid message method>");
+ col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", method_name);
col_set_fence(pinfo->cinfo, COL_INFO);
- proto_tree_add_item(tree, hf_amqp_0_10_exchange_method,
+ proto_tree_add_item(tree, hf_amqp_0_10_message_method,
tvb, offset+1, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
+ offset += 2;
+
/*
* Session header is 2 bytes; one that tells that it's 1 byte long, then
* the byte itself. Bit 0 is sync.
else
proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync,
tvb, offset + 1, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
+ offset += 2;
ti = proto_tree_add_item(tree, hf_amqp_method_arguments,
- tvb, offset, length - 4, ENC_NA);
+ tvb, offset, -1, ENC_NA);
args_tree = proto_item_add_subtree(ti, ett_args);
-
/*
* The flag bits are a simple bit string, not a net-byte-order
* field. tvb_get_bits16() doesn't know how to do little-endian
flags_item = proto_tree_add_item(args_tree,
hf_amqp_0_10_argument_packing_flags,
tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
+ offset += 2;
switch (method) {
- case AMQP_0_10_METHOD_EXCHANGE_DECLARE:
- if ((flag1 & ~0x7f) || (flag2 != 0))
+ case AMQP_0_10_METHOD_MESSAGE_TRANSFER:
+ if ((flag1 & ~0x07) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* exchange (name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
+ if (flag1 & 0x01) { /* destination (str8) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_exchange_declare_exchange,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
+ hf_amqp_0_10_method_message_transfer_destination,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
}
- if (flag1 & 0x02) { /* type (str8) */
- str_size = tvb_get_guint8(tvb, offset);
+ if (flag1 & 0x02) { /* accept-mode (accept-mode [uint8]) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_exchange_declare_type,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
+ hf_amqp_0_10_method_message_transfer_accept_mode,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
}
- if (flag1 & 0x04) { /* alternate-exchange (name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
+ if (flag1 & 0x04) { /* acquire-mode (acquire-mode [uint8]) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_exchange_declare_alt_exchange,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
+ hf_amqp_0_10_method_message_transfer_acquire_mode,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ /* offset += 1; */
+ }
+ break;
+
+ case AMQP_0_10_METHOD_MESSAGE_ACCEPT:
+ if ((flag1 & ~0x01) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) {
+ /* transfers (session.commands [sequence-set]) */
+ size = tvb_get_ntohs(tvb, offset);
+ ti = proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_message_accept_transfers,
+ tvb, offset, size + 2, ENC_NA);
+ offset += 2;
+ format_amqp_0_10_sequence_set(tvb, offset, size, ti);
+ /* offset += size; */
+ }
+ break;
+
+ case AMQP_0_10_METHOD_MESSAGE_REJECT:
+ if ((flag1 & ~0x07) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) {
+ /* transfers (session.commands [sequence-set]) */
+ size = tvb_get_ntohs(tvb, offset);
+ ti = proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_message_accept_transfers,
+ tvb, offset, size + 2, ENC_NA);
+ offset += 2;
+ format_amqp_0_10_sequence_set(tvb, offset, size, ti);
+ offset += size;
+ }
+ if (flag1 & 0x02) { /* reject-code (reject-code [uint16]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_message_transfer_reject_code,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += 2;
+ }
+ if (flag1 & 0x04) { /* text (str8) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_message_reject_text,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ /* offset += (1 + tvb_get_guint8(tvb, offset)); */
+ }
+ break;
+
+ case AMQP_0_10_METHOD_MESSAGE_RELEASE:
+ if ((flag1 & ~0x03) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) {
+ /* transfers (session.commands [sequence-set]) */
+ size = tvb_get_ntohs(tvb, offset);
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_message_accept_transfers,
+ tvb, offset, size + 2, ENC_NA);
+ offset += 2;
+ format_amqp_0_10_sequence_set(tvb, offset, size, ti);
+ /* offset += size; */
}
/*
- * 4th-6th arguments are optional bits.
+ * 2nd argument is an optional bit, set-redelivered.
*/
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_exchange_declare_passive,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_exchange_declare_durable,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_exchange_declare_auto_delete,
+ hf_amqp_0_10_method_message_release_set_redelivered,
tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- if (flag1 & 0x40) { /* arguments (map) */
- map_length = amqp_0_10_get_32bit_size(tvb, offset);
- AMQP_INCREMENT(offset, 4, length);
- ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_exchange_declare_arguments,
- tvb,
- offset - 4,
- map_length + 4, ENC_NA);
- dissect_amqp_0_10_map (tvb,
- offset,
- offset + map_length,
- map_length,
- ti);
- AMQP_INCREMENT(offset, map_length, length);
+ break;
+
+ case AMQP_0_10_METHOD_MESSAGE_ACQUIRE:
+ if ((flag1 & ~0x01) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) {
+ /* transfers (session.commands [sequence-set]) */
+ size = tvb_get_ntohs(tvb, offset);
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_message_accept_transfers,
+ tvb, offset, size + 2, ENC_NA);
+ offset += 2;
+ format_amqp_0_10_sequence_set(tvb, offset, size, ti);
+ /* offset += size; */
}
break;
- case AMQP_0_10_METHOD_EXCHANGE_DELETE:
+ case AMQP_0_10_METHOD_MESSAGE_RESUME:
if ((flag1 & ~0x03) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* exchange (name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
+ if (flag1 & 0x01) {
+ /* destination (destination [str8]) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_exchange_declare_exchange,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
+ hf_amqp_0_10_method_message_dest,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag1 & 0x02) {
+ /* resume-id (resume-id [str16]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_message_resume_id,
+ tvb, offset, 2, ENC_ASCII|ENC_BIG_ENDIAN);
+ /* offset += (2 + tvb_get_ntohs(tvb, offset)); */
+ }
+ break;
+
+ case AMQP_0_10_METHOD_MESSAGE_SUBSCRIBE:
+ if (flag2 != 0)
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) {
+ /* queue (queue.name [str8]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_message_subscribe_queue,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag1 & 0x02) {
+ /* destination (destination [str8]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_message_dest,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag1 & 0x04) { /* accept-mode (accept-mode [uint8]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_message_transfer_accept_mode,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
+ }
+ if (flag1 & 0x08) { /* acquire-mode (acquire-mode [uint8]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_message_transfer_acquire_mode,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
+ }
+ /*
+ * 5th argument is an optional bit, exclusive.
+ */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_message_subscribe_exclusive,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ if (flag1 & 0x20) {
+ /* resume-id (resume-id [str16]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_message_resume_id,
+ tvb, offset, 2, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (2 + tvb_get_ntohs(tvb, offset));
+ }
+ if (flag1 & 0x40) {
+ /* resume-ttl (uint64) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_message_subscribe_resume_ttl,
+ tvb, offset, 8, ENC_BIG_ENDIAN);
+ offset += 8;
+ }
+ if (flag1 & 0x80) {
+ /* arguments (map) */
+ map_size = amqp_0_10_get_32bit_size(tvb, offset);
+ ti = proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_message_subscribe_args,
+ tvb,
+ offset,
+ 4 + map_size, ENC_NA);
+ if (map_size > (guint32)tvb_reported_length_remaining(tvb, offset))
+ {
+ next_tvb = tvb_new_subset_remaining(tvb, offset);
+ }
+ else
+ {
+ next_tvb = tvb_new_subset_length(tvb, offset, map_size);
+ }
+ dissect_amqp_0_10_map (next_tvb, ti);
+ /* offset += (4 + map_size); */
}
- /*
- * 2nd argument is an optional bit.
- */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_exchange_delete_if_unused,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
break;
- case AMQP_0_10_METHOD_EXCHANGE_QUERY:
+ case AMQP_0_10_METHOD_MESSAGE_CANCEL:
if ((flag1 & ~0x01) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* exchange (name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
+ if (flag1 & 0x01) {
+ /* destination (destination [str8]) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_exchange_declare_exchange,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
+ hf_amqp_0_10_method_message_dest,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ /* offset += (1 + tvb_get_guint8(tvb, offset)); */
}
break;
- case AMQP_0_10_METHOD_EXCHANGE_BIND:
- if ((flag1 & ~0x0f) || (flag2 != 0))
+ case AMQP_0_10_METHOD_MESSAGE_SET_FLOW_MODE:
+ if ((flag1 & ~0x03) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* queue (queue.name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_exchange_bind_queue,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
- if (flag1 & 0x02) { /* exchange (name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
+ if (flag1 & 0x01) {
+ /* destination (destination [str8]) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_exchange_declare_exchange,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
+ hf_amqp_0_10_method_message_dest,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
}
- if (flag1 & 0x04) { /* binding-key (str8) */
- str_size = tvb_get_guint8(tvb, offset);
+ if (flag1 & 0x02) {
+ /* flow-mode (flow-mode [uint8]) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_exchange_binding_key,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
- if (flag1 & 0x08) { /* arguments (map) */
- map_length = amqp_0_10_get_32bit_size(tvb, offset);
- AMQP_INCREMENT(offset, 4, length);
- ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_exchange_declare_arguments,
- tvb,
- offset - 4,
- map_length + 4, ENC_NA);
- dissect_amqp_0_10_map (tvb,
- offset,
- offset + map_length,
- map_length,
- ti);
- AMQP_INCREMENT(offset, map_length, length);
+ hf_amqp_0_10_method_message_flow_mode,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ /* offset += 1; */
}
break;
- case AMQP_0_10_METHOD_EXCHANGE_UNBIND:
+ case AMQP_0_10_METHOD_MESSAGE_FLOW:
if ((flag1 & ~0x07) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* queue (queue.name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
+ if (flag1 & 0x01) {
+ /* destination (destination [str8]) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_exchange_bind_queue,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
+ hf_amqp_0_10_method_message_dest,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
}
- if (flag1 & 0x02) { /* exchange (name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
+ if (flag1 & 0x02) {
+ /* unit (credit-unit [uint8]) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_exchange_declare_exchange,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
+ hf_amqp_0_10_method_message_credit_unit,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
}
- if (flag1 & 0x04) { /* binding-key (str8) */
- str_size = tvb_get_guint8(tvb, offset);
+ if (flag1 & 0x04) {
+ /* value (uint32) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_exchange_binding_key,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
+ hf_amqp_0_10_method_message_credit_value,
+ tvb, offset, 4, ENC_BIG_ENDIAN);
+ /* offset += 4; */
}
break;
- case AMQP_0_10_METHOD_EXCHANGE_BOUND:
- if ((flag1 & ~0x0f) || (flag2 != 0))
+ case AMQP_0_10_METHOD_MESSAGE_FLUSH:
+ if ((flag1 & ~0x01) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* exchange (name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_exchange_declare_exchange,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
- if (flag1 & 0x02) { /* queue (queue.name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
+ if (flag1 & 0x01) {
+ /* destination (destination [str8]) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_exchange_bind_queue,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
+ hf_amqp_0_10_method_message_dest,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ /* offset += (1 + tvb_get_guint8(tvb, offset)); */
}
- if (flag1 & 0x04) { /* binding-key (str8) */
- str_size = tvb_get_guint8(tvb, offset);
+ break;
+
+ case AMQP_0_10_METHOD_MESSAGE_STOP:
+ if ((flag1 & ~0x01) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) {
+ /* destination (destination [str8]) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_exchange_binding_key,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
- if (flag1 & 0x08) { /* arguments (map) */
- map_length = amqp_0_10_get_32bit_size(tvb, offset);
- AMQP_INCREMENT(offset, 4, length);
- ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_exchange_declare_arguments,
- tvb,
- offset - 4,
- map_length + 4, ENC_NA);
- dissect_amqp_0_10_map (tvb,
- offset,
- offset + map_length,
- map_length,
- ti);
- AMQP_INCREMENT(offset, map_length, length);
+ hf_amqp_0_10_method_message_dest,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ /* offset += (1 + tvb_get_guint8(tvb, offset)); */
}
break;
}
}
static void
-dissect_amqp_0_10_queue(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_tree *tree,
- int offset, guint16 length)
+dissect_amqp_0_10_tx(tvbuff_t *tvb,
+ packet_info *pinfo,
+ proto_tree *tree)
{
- proto_item *args_tree;
- proto_item *ti;
- proto_item *flags_item;
guint8 method;
guint8 flag1, flag2;
- guint8 str_size;
- guint32 map_length;
- int flags_offset;
const gchar *method_name;
+ proto_item *ti;
+ int offset = 1;
method = tvb_get_guint8(tvb, offset+1);
- method_name = val_to_str_const(method, amqp_0_10_queue_methods,
- "<invalid queue method>");
- col_append_str(pinfo->cinfo, COL_INFO, method_name);
- col_append_str(pinfo->cinfo, COL_INFO, " ");
+ method_name = val_to_str_const(method, amqp_0_10_tx_methods,
+ "<invalid tx method>");
+ col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", method_name);
col_set_fence(pinfo->cinfo, COL_INFO);
- proto_tree_add_item(tree, hf_amqp_0_10_queue_method,
+ proto_tree_add_item(tree, hf_amqp_0_10_tx_method,
tvb, offset+1, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
+ offset += 2;
/*
* Session header is 2 bytes; one that tells that it's 1 byte long, then
* the byte itself. Bit 0 is sync.
else
proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync,
tvb, offset + 1, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
-
- ti = proto_tree_add_item(tree, hf_amqp_method_arguments,
- tvb, offset, length - 4, ENC_NA);
- args_tree = proto_item_add_subtree(ti, ett_args);
-
- /*
- * The flag bits are a simple bit string, not a net-byte-order
- * field. tvb_get_bits16() doesn't know how to do little-endian
- * at this time, so just pick out two bytes.
- */
- flags_offset = offset;
- flag1 = tvb_get_guint8(tvb, offset);
- flag2 = tvb_get_guint8(tvb, offset+1);
- flags_item = proto_tree_add_item(args_tree,
- hf_amqp_0_10_argument_packing_flags,
- tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
- switch (method) {
- case AMQP_0_10_METHOD_QUEUE_DECLARE:
- if ((flag1 & ~0x7f) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* queue (name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_queue_name,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
- if (flag1 & 0x02) { /* alternate-exchange (exchange.name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_queue_alt_exchange,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
- /*
- * 3rd-6th arguments are optional bits.
- */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_queue_declare_passive,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_queue_declare_durable,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_queue_declare_exclusive,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_queue_declare_auto_delete,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- if (flag1 & 0x40) { /* arguments (map) */
- map_length = amqp_0_10_get_32bit_size(tvb, offset);
- AMQP_INCREMENT(offset, 4, length);
- ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_queue_declare_arguments,
- tvb,
- offset - 4,
- map_length + 4, ENC_NA);
- dissect_amqp_0_10_map (tvb,
- offset,
- offset + map_length,
- map_length,
- ti);
- AMQP_INCREMENT(offset, map_length, length);
- }
- break;
-
- case AMQP_0_10_METHOD_QUEUE_DELETE:
- if ((flag1 & ~0x07) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* queue (name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_queue_name,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
- /*
- * 2nd-3rd arguments are optional bits.
- */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_queue_delete_if_unused,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_queue_delete_if_empty,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- break;
-
- case AMQP_0_10_METHOD_QUEUE_PURGE:
- if ((flag1 & ~0x01) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* queue (name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_queue_name,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
- break;
+ /* offset += 2; */
- case AMQP_0_10_METHOD_QUEUE_QUERY:
- if ((flag1 & ~0x01) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* queue (name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_queue_name,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
- break;
- }
+ /* No args on any method in this class */
}
static void
-dissect_amqp_0_10_file(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_tree *tree,
- int offset, guint16 length)
+dissect_amqp_0_10_dtx(tvbuff_t *tvb,
+ packet_info *pinfo,
+ proto_tree *tree)
{
proto_item *args_tree;
proto_item *ti;
proto_item *flags_item;
guint8 method;
guint8 flag1, flag2;
- guint8 str_size;
- guint32 map_length;
+ guint16 xid_length;
int flags_offset;
const gchar *method_name;
+ int offset = 0;
method = tvb_get_guint8(tvb, offset+1);
- method_name = val_to_str_const(method, amqp_0_10_file_methods,
- "<invalid file method>");
- col_append_str(pinfo->cinfo, COL_INFO, method_name);
- col_append_str(pinfo->cinfo, COL_INFO, " ");
+ method_name = val_to_str_const(method, amqp_0_10_dtx_methods,
+ "<invalid dtx method>");
+ col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", method_name);
col_set_fence(pinfo->cinfo, COL_INFO);
- proto_tree_add_item(tree, hf_amqp_0_10_file_method,
+ proto_tree_add_item(tree, hf_amqp_0_10_dtx_method,
tvb, offset+1, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
+ offset += 2;
/*
* Session header is 2 bytes; one that tells that it's 1 byte long, then
* the byte itself. Bit 0 is sync.
else
proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync,
tvb, offset + 1, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
-
- ti = proto_tree_add_item(tree, hf_amqp_method_arguments,
- tvb, offset, length - 4, ENC_NA);
- args_tree = proto_item_add_subtree(ti, ett_args);
-
- /*
- * The flag bits are a simple bit string, not a net-byte-order
- * field. tvb_get_bits16() doesn't know how to do little-endian
- * at this time, so just pick out two bytes.
- */
- flags_offset = offset;
- flag1 = tvb_get_guint8(tvb, offset);
- flag2 = tvb_get_guint8(tvb, offset+1);
- flags_item = proto_tree_add_item(args_tree,
- hf_amqp_0_10_argument_packing_flags,
- tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
- switch (method) {
- case AMQP_0_10_METHOD_FILE_QOS:
- if ((flag1 & ~0x07) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* prefetch-size (uint32) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_qos_prefetch_size,
- tvb, offset, 4, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 4, length);
- }
- if (flag1 & 0x02) { /* prefetch-count (uint16) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_qos_prefetch_count,
- tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
- }
- /*
- * 3rd argument is an optional bit.
- */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_qos_global,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- break;
+ offset += 2;
- case AMQP_0_10_METHOD_FILE_QOS_OK:
- case AMQP_0_10_METHOD_FILE_STAGE:
- /* No args */
- break;
+ /* No args for dtx.select or dtx.recover */
+ if ((method == AMQP_0_10_METHOD_DTX_SELECT) ||
+ (method == AMQP_0_10_METHOD_DTX_RECOVER))
+ return;
- case AMQP_0_10_METHOD_FILE_CONSUME:
- if ((flag1 & ~0x7f) || (flag2 != 0))
+ ti = proto_tree_add_item(tree, hf_amqp_method_arguments,
+ tvb, offset, -1, ENC_NA);
+ args_tree = proto_item_add_subtree(ti, ett_args);
+
+ /*
+ * The flag bits are a simple bit string, not a net-byte-order
+ * field. tvb_get_bits16() doesn't know how to do little-endian
+ * at this time, so just pick out two bytes.
+ */
+ flags_offset = offset;
+ flag1 = tvb_get_guint8(tvb, offset);
+ flag2 = tvb_get_guint8(tvb, offset+1);
+ flags_item = proto_tree_add_item(args_tree,
+ hf_amqp_0_10_argument_packing_flags,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += 2;
+ switch (method) {
+ case AMQP_0_10_METHOD_DTX_START:
+ if ((flag1 & ~0x07) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* queue (queue.name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_queue_name,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
- if (flag1 & 0x02) { /* consumer-tag (str8) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_consumer_tag,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
- /*
- * 3rd-6th arguments are optional bits.
- */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_consume_no_local,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_consume_no_ack,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_consume_exclusive,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_consume_nowait,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- if (flag1 & 0x40) { /* arguments (map) */
- map_length = amqp_0_10_get_32bit_size(tvb, offset);
- AMQP_INCREMENT(offset, 4, length);
+ if (flag1 & 0x01) { /* xid (xid) */
+ xid_length = tvb_get_ntohs(tvb, offset);
+ offset += 2;
ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_consume_arguments,
+ hf_amqp_0_10_dtx_xid,
tvb,
- offset - 4,
- map_length + 4, ENC_NA);
- dissect_amqp_0_10_map (tvb,
+ offset - 2,
+ xid_length + 2, ENC_NA);
+ dissect_amqp_0_10_xid (tvb,
offset,
- offset + map_length,
- map_length,
ti);
- AMQP_INCREMENT(offset, map_length, length);
- }
- break;
-
- case AMQP_0_10_METHOD_FILE_CONSUME_OK:
- case AMQP_0_10_METHOD_FILE_CANCEL:
- if ((flag1 & ~0x01) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* consumer-tag (str8) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_consumer_tag,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
- break;
-
- case AMQP_0_10_METHOD_FILE_OPEN:
- if ((flag1 & ~0x03) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* identifier (str8) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_identifier,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
- if (flag1 & 0x02) { /* content-size (uint64) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_open_content_size,
- tvb, offset, 8, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 8, length);
- }
- break;
-
- case AMQP_0_10_METHOD_FILE_OPEN_OK:
- if ((flag1 & ~0x01) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* staged-size (uint64) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_open_ok_staged_size,
- tvb, offset, 8, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 8, length);
- }
- break;
-
- case AMQP_0_10_METHOD_FILE_PUBLISH:
- if ((flag1 & ~0x1f) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* exchange (exchange.name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_publish_exchange,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
- if (flag1 & 0x02) { /* routing-key (str8) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_publish_routing_key,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
+ /* offset += xid_length; */
}
/*
- * 3rd-4th arguments are optional bits.
+ * 2nd, 3rd arguments are optional bits.
*/
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_publish_mandatory,
+ hf_amqp_0_10_method_dtx_start_join,
tvb, flags_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_publish_immediate,
+ hf_amqp_0_10_method_dtx_start_resume,
tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- if (flag1 & 0x10) { /* identifier (str8) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_identifier,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
- break;
- case AMQP_0_10_METHOD_FILE_RETURN:
- if ((flag1 & ~0x0f) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* reply-code (return-code [uint16]) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_return_reply_code,
- tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
- }
- if (flag1 & 0x02) { /* reply-text (str8) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_return_reply_text,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
- if (flag1 & 0x04) { /* exchange (exchange.name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_return_exchange,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
- if (flag1 & 0x08) { /* routing-key (str8) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_return_routing_key,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
break;
- case AMQP_0_10_METHOD_FILE_DELIVER:
- if ((flag1 & ~0x3f) || (flag2 != 0))
+ case AMQP_0_10_METHOD_DTX_END:
+ if ((flag1 & ~0x07) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* consumer-tag (str8) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_deliver_consumer_tag,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
- if (flag1 & 0x02) { /* delivery-tag (uint64) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_deliver_delivery_tag,
- tvb, offset, 8, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 8, length);
+ if (flag1 & 0x01) { /* xid (xid) */
+ xid_length = tvb_get_ntohs(tvb, offset);
+ offset += 2;
+ ti = proto_tree_add_item(args_tree,
+ hf_amqp_0_10_dtx_xid,
+ tvb,
+ offset - 2,
+ xid_length + 2, ENC_NA);
+ dissect_amqp_0_10_xid (tvb,
+ offset,
+ ti);
+ /* offset += xid_length; */
}
/*
- * 3rd argument is an optional bit.
+ * 2nd, 3rd arguments are optional bits.
*/
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_deliver_redelivered,
+ hf_amqp_0_10_method_dtx_end_fail,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_dtx_end_suspend,
tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- if (flag1 & 0x08) { /* exchange (exchange.name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_deliver_exchange,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
- if (flag1 & 0x10) { /* routing-key (str8) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_deliver_routing_key,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
- if (flag1 & 0x20) { /* identifier (str8) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_identifier,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
break;
- case AMQP_0_10_METHOD_FILE_ACK:
+ case AMQP_0_10_METHOD_DTX_COMMIT:
if ((flag1 & ~0x03) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* delivery-tag (uint64) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_ack_delivery_tag,
- tvb, offset, 8, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 8, length);
+ if (flag1 & 0x01) { /* xid (xid) */
+ xid_length = tvb_get_ntohs(tvb, offset);
+ offset += 2;
+ ti = proto_tree_add_item(args_tree,
+ hf_amqp_0_10_dtx_xid,
+ tvb,
+ offset - 2,
+ xid_length + 2, ENC_NA);
+ dissect_amqp_0_10_xid (tvb,
+ offset,
+ ti);
+ /* offset += xid_length; */
}
/*
* 2nd argument is an optional bit.
*/
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_ack_multiple,
+ hf_amqp_0_10_method_dtx_commit_one_phase,
tvb, flags_offset, 1, ENC_BIG_ENDIAN);
break;
- case AMQP_0_10_METHOD_FILE_REJECT:
+ case AMQP_0_10_METHOD_DTX_FORGET:
+ case AMQP_0_10_METHOD_DTX_GET_TIMEOUT:
+ case AMQP_0_10_METHOD_DTX_PREPARE:
+ case AMQP_0_10_METHOD_DTX_ROLLBACK:
+ if ((flag1 & ~0x01) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) { /* xid (xid) */
+ xid_length = tvb_get_ntohs(tvb, offset);
+ offset += 2;
+ ti = proto_tree_add_item(args_tree,
+ hf_amqp_0_10_dtx_xid,
+ tvb,
+ offset - 2,
+ xid_length + 2, ENC_NA);
+ dissect_amqp_0_10_xid (tvb,
+ offset,
+ ti);
+ /* offset += xid_length; */
+ }
+ break;
+
+ case AMQP_0_10_METHOD_DTX_SET_TIMEOUT:
if ((flag1 & ~0x03) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* delivery-tag (uint64) */
+ if (flag1 & 0x01) { /* xid (xid) */
+ xid_length = tvb_get_ntohs(tvb, offset);
+ offset += 2;
+ ti = proto_tree_add_item(args_tree,
+ hf_amqp_0_10_dtx_xid,
+ tvb,
+ offset - 2,
+ xid_length + 2, ENC_NA);
+ dissect_amqp_0_10_xid (tvb,
+ offset,
+ ti);
+ offset += xid_length;
+ }
+ if (flag1 & 0x02) { /* timeout (uint32) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_reject_delivery_tag,
- tvb, offset, 8, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 8, length);
+ hf_amqp_0_10_method_dtx_set_timeout_timeout,
+ tvb, offset, 4, ENC_BIG_ENDIAN);
+ /* offset += 2; */
}
- /*
- * 2nd argument is an optional bit.
- */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_file_reject_requeue,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
break;
+
}
}
static void
-dissect_amqp_0_10_stream(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_tree *tree,
- int offset, guint16 length)
+dissect_amqp_0_10_exchange(tvbuff_t *tvb,
+ packet_info *pinfo,
+ proto_tree *tree)
{
proto_item *args_tree;
proto_item *ti;
proto_item *flags_item;
guint8 method;
guint8 flag1, flag2;
- guint8 str_size;
guint32 map_length;
int flags_offset;
const gchar *method_name;
+ int offset = 0;
+ tvbuff_t *next_tvb;
method = tvb_get_guint8(tvb, offset+1);
- method_name = val_to_str_const(method, amqp_0_10_stream_methods,
- "<invalid stream method>");
- col_append_str(pinfo->cinfo, COL_INFO, method_name);
- col_append_str(pinfo->cinfo, COL_INFO, " ");
+ method_name = val_to_str_const(method, amqp_0_10_exchange_methods,
+ "<invalid exchange method>");
+ col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", method_name);
col_set_fence(pinfo->cinfo, COL_INFO);
- proto_tree_add_item(tree, hf_amqp_0_10_stream_method,
+ proto_tree_add_item(tree, hf_amqp_0_10_exchange_method,
tvb, offset+1, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
+ offset += 2;
/*
* Session header is 2 bytes; one that tells that it's 1 byte long, then
* the byte itself. Bit 0 is sync.
else
proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync,
tvb, offset + 1, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
+ offset += 2;
ti = proto_tree_add_item(tree, hf_amqp_method_arguments,
- tvb, offset, length - 4, ENC_NA);
+ tvb, offset, -1, ENC_NA);
args_tree = proto_item_add_subtree(ti, ett_args);
/*
flags_item = proto_tree_add_item(args_tree,
hf_amqp_0_10_argument_packing_flags,
tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
+ offset += 2;
switch (method) {
- case AMQP_0_10_METHOD_STREAM_QOS:
- if ((flag1 & ~0x0f) || (flag2 != 0))
+ case AMQP_0_10_METHOD_EXCHANGE_DECLARE:
+ if ((flag1 & ~0x7f) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* prefetch-size (uint32) */
+ if (flag1 & 0x01) { /* exchange (name [str8]) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_stream_qos_prefetch_size,
- tvb, offset, 4, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 4, length);
+ hf_amqp_0_10_method_exchange_declare_exchange,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
}
- if (flag1 & 0x02) { /* prefetch-count (uint16) */
+ if (flag1 & 0x02) { /* type (str8) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_stream_qos_prefetch_count,
- tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
+ hf_amqp_0_10_method_exchange_declare_type,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
}
- if (flag1 & 0x04) { /* consume-rate (uint32) */
+ if (flag1 & 0x04) { /* alternate-exchange (name [str8]) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_stream_qos_prefetch_size,
- tvb, offset, 4, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 4, length);
+ hf_amqp_0_10_method_exchange_declare_alt_exchange,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
}
/*
- * 4th argument is an optional bit.
+ * 4th-6th arguments are optional bits.
*/
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_stream_qos_global,
+ hf_amqp_0_10_method_exchange_declare_passive,
tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_exchange_declare_durable,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_exchange_declare_auto_delete,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ if (flag1 & 0x40) { /* arguments (map) */
+ map_length = amqp_0_10_get_32bit_size_new(args_tree, pinfo, tvb, hf_amqp_0_10_method_exchange_declare_arguments_size, offset);
+ offset += 4;
+ ti = proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_exchange_declare_arguments,
+ tvb,
+ offset,
+ map_length, ENC_NA);
+ if (map_length > (guint32)tvb_reported_length_remaining(tvb, offset))
+ {
+ next_tvb = tvb_new_subset_remaining(tvb, offset);
+ }
+ else
+ {
+ next_tvb = tvb_new_subset_length(tvb, offset, map_length);
+ }
+ dissect_amqp_0_10_map (next_tvb, ti);
+ /* offset += map_length; */
+ }
break;
- case AMQP_0_10_METHOD_STREAM_QOS_OK:
- /* No args */
- break;
-
- case AMQP_0_10_METHOD_STREAM_CONSUME:
- if ((flag1 & ~0x3f) || (flag2 != 0))
+ case AMQP_0_10_METHOD_EXCHANGE_DELETE:
+ if ((flag1 & ~0x03) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* queue (queue.name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_queue_name,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
- if (flag1 & 0x02) { /* consumer-tag (str8) */
- str_size = tvb_get_guint8(tvb, offset);
+ if (flag1 & 0x01) { /* exchange (name [str8]) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_stream_consumer_tag,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
+ hf_amqp_0_10_method_exchange_declare_exchange,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ /* offset += (1 + tvb_get_guint8(tvb, offset)); */
}
/*
- * 3rd-5th arguments are optional bits.
+ * 2nd argument is an optional bit.
*/
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_stream_consume_no_local,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_stream_consume_exclusive,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_stream_consume_nowait,
+ hf_amqp_0_10_method_exchange_delete_if_unused,
tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- if (flag1 & 0x20) { /* arguments (map) */
- map_length = amqp_0_10_get_32bit_size(tvb, offset);
- AMQP_INCREMENT(offset, 4, length);
- ti = proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_stream_consume_arguments,
- tvb,
- offset - 4,
- map_length + 4, ENC_NA);
- dissect_amqp_0_10_map (tvb,
- offset,
- offset + map_length,
- map_length,
- ti);
- AMQP_INCREMENT(offset, map_length, length);
- }
break;
- case AMQP_0_10_METHOD_STREAM_CONSUME_OK:
- case AMQP_0_10_METHOD_STREAM_CANCEL:
+ case AMQP_0_10_METHOD_EXCHANGE_QUERY:
if ((flag1 & ~0x01) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* consumer-tag (str8) */
- str_size = tvb_get_guint8(tvb, offset);
+ if (flag1 & 0x01) { /* exchange (name [str8]) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_stream_consumer_tag,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
+ hf_amqp_0_10_method_exchange_declare_exchange,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ /* offset += (1 + tvb_get_guint8(tvb, offset)); */
}
break;
- case AMQP_0_10_METHOD_STREAM_PUBLISH:
+ case AMQP_0_10_METHOD_EXCHANGE_BIND:
if ((flag1 & ~0x0f) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* exchange (exchange.name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
+ if (flag1 & 0x01) { /* queue (queue.name [str8]) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_stream_publish_exchange,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
+ hf_amqp_0_10_method_exchange_bind_queue,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
}
- if (flag1 & 0x02) { /* routing-key (str8) */
- str_size = tvb_get_guint8(tvb, offset);
+ if (flag1 & 0x02) { /* exchange (name [str8]) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_stream_publish_routing_key,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
+ hf_amqp_0_10_method_exchange_declare_exchange,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag1 & 0x04) { /* binding-key (str8) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_exchange_binding_key,
+ tvb, offset, 1, ENC_ASCII|ENC_NA);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag1 & 0x08) { /* arguments (map) */
+ map_length = amqp_0_10_get_32bit_size_new(args_tree, pinfo, tvb, hf_amqp_0_10_method_exchange_declare_arguments_size, offset);
+ offset += 4;
+ ti = proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_exchange_declare_arguments,
+ tvb,
+ offset,
+ map_length, ENC_NA);
+ if (map_length > (guint32)tvb_reported_length_remaining(tvb, offset))
+ {
+ next_tvb = tvb_new_subset_remaining(tvb, offset);
+ }
+ else
+ {
+ next_tvb = tvb_new_subset_length(tvb, offset, map_length);
+ }
+ dissect_amqp_0_10_map (next_tvb, ti);
+ /* offset += map_length; */
}
- /*
- * 3rd-4th arguments are optional bits.
- */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_stream_publish_mandatory,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_stream_publish_immediate,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
break;
- case AMQP_0_10_METHOD_STREAM_RETURN:
- if ((flag1 & ~0x0f) || (flag2 != 0))
+ case AMQP_0_10_METHOD_EXCHANGE_UNBIND:
+ if ((flag1 & ~0x07) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* reply-code (return-code [uint16]) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_stream_return_reply_code,
- tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 2, length);
- }
- if (flag1 & 0x02) { /* reply-text (str8) */
- str_size = tvb_get_guint8(tvb, offset);
+ if (flag1 & 0x01) { /* queue (queue.name [str8]) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_stream_return_reply_text,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
+ hf_amqp_0_10_method_exchange_bind_queue,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
}
- if (flag1 & 0x04) { /* exchange (exchange.name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
+ if (flag1 & 0x02) { /* exchange (name [str8]) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_stream_return_exchange,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
+ hf_amqp_0_10_method_exchange_declare_exchange,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
}
- if (flag1 & 0x08) { /* routing-key (str8) */
- str_size = tvb_get_guint8(tvb, offset);
+ if (flag1 & 0x04) { /* binding-key (str8) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_stream_return_routing_key,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
+ hf_amqp_0_10_method_exchange_binding_key,
+ tvb, offset, 1, ENC_ASCII|ENC_NA);
+ /* offset += (1 + tvb_get_guint8(tvb, offset)); */
}
break;
- case AMQP_0_10_METHOD_STREAM_DELIVER:
+ case AMQP_0_10_METHOD_EXCHANGE_BOUND:
if ((flag1 & ~0x0f) || (flag2 != 0))
expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- if (flag1 & 0x01) { /* consumer-tag (str8) */
- str_size = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_stream_deliver_consumer_tag,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
- }
- if (flag1 & 0x02) { /* delivery-tag (uint64) */
+ if (flag1 & 0x01) { /* exchange (name [str8]) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_stream_deliver_delivery_tag,
- tvb, offset, 8, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 8, length);
+ hf_amqp_0_10_method_exchange_declare_exchange,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
}
- if (flag1 & 0x04) { /* exchange (exchange.name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
+ if (flag1 & 0x02) { /* queue (queue.name [str8]) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_stream_deliver_exchange,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
+ hf_amqp_0_10_method_exchange_bind_queue,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
}
- if (flag1 & 0x08) { /* queue (queue.name [str8]) */
- str_size = tvb_get_guint8(tvb, offset);
+ if (flag1 & 0x04) { /* binding-key (str8) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_stream_deliver_queue,
- tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + str_size), length);
+ hf_amqp_0_10_method_exchange_binding_key,
+ tvb, offset, 1, ENC_ASCII|ENC_NA);
+ offset += (1 + tvb_get_guint8(tvb, offset));
}
- break;
- }
-}
-
-static void
-dissect_amqp_0_10_struct_delivery_properties(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_tree *tree,
- int offset,
- guint32 struct_length)
-{
- proto_item *args_tree;
- proto_item *flags_item;
- guint8 flag1, flag2;
- guint8 len8;
- guint16 len16;
- guint64 timestamp;
- int flags_offset;
- int max_length;
- nstime_t tv;
-
- max_length = offset + AMQP_0_10_SIZE_MAX(struct_length);
- args_tree = proto_item_add_subtree(tree, ett_args);
- AMQP_INCREMENT(offset, 2, max_length); /* Skip class and struct codes */
- flags_offset = offset;
- flag1 = tvb_get_guint8(tvb, offset);
- flag2 = tvb_get_guint8(tvb, offset+1);
- flags_item = proto_tree_add_item(args_tree,
- hf_amqp_0_10_argument_packing_flags,
- tvb, offset, 2, ENC_BIG_ENDIAN);
- if (flag2 & ~0x0f)
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- AMQP_INCREMENT(offset, 2, max_length);
-
- /* First 3 fields are bits */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_struct_delivery_properties_discard_unroutable,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_struct_delivery_properties_immediate,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_struct_delivery_properties_redelivered,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- if (flag1 & 0x08) {
- /* delivery-priority (delivery-priority [uint8]) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_struct_delivery_properties_priority,
- tvb, offset, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 1, max_length);
- }
- if (flag1 & 0x10) {
- /* delivery-mode (delivery-mode [uint8]) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_struct_delivery_properties_mode,
- tvb, offset, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 1, max_length);
- }
- if (flag1 & 0x20) {
- /* ttl (uint64) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_struct_delivery_properties_ttl,
- tvb, offset, 8, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 8, max_length);
- }
- if (flag1 & 0x40) {
- /* timestamp (datetime [uint64]) */
- timestamp = tvb_get_ntoh64(tvb, offset);
- tv.secs = (time_t)timestamp;
- tv.nsecs = 0;
- proto_tree_add_time(args_tree,
- hf_amqp_0_10_struct_delivery_properties_timestamp,
- tvb, offset, 8, &tv);
- AMQP_INCREMENT(offset, 8, max_length);
- }
- if (flag1 & 0x80) {
- /* expiration (datetime [uint64]) */
- timestamp = tvb_get_ntoh64(tvb, offset);
- tv.secs = (time_t)timestamp;
- tv.nsecs = 0;
- proto_tree_add_time(args_tree,
- hf_amqp_0_10_struct_delivery_properties_expiration,
- tvb, offset, 8, &tv);
- AMQP_INCREMENT(offset, 8, max_length);
- }
- if (flag2 & 0x01) {
- /* exchange (exchange.name [str8]) */
- len8 = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_struct_delivery_properties_exchange,
- tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + len8), max_length);
- }
- if (flag2 & 0x02) {
- /* routing-key (str8) */
- len8 = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_struct_delivery_properties_routing_key,
- tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + len8), max_length);
- }
- if (flag2 & 0x04) {
- /* resume-id (resume-id [str16]) */
- len16 = tvb_get_ntohs(tvb, offset);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_method_message_resume_id,
- tvb, offset + 2, len16, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (2 + len16), max_length);
- }
- if (flag2 & 0x08) {
- /* resume-ttl (uint64) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_struct_delivery_properties_resume_ttl,
- tvb, offset, 8, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 8, max_length);
+ if (flag1 & 0x08) { /* arguments (map) */
+ map_length = amqp_0_10_get_32bit_size_new(args_tree, pinfo, tvb, hf_amqp_0_10_method_exchange_declare_arguments_size, offset);
+ offset += 4;
+ ti = proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_exchange_declare_arguments,
+ tvb,
+ offset,
+ map_length, ENC_NA);
+ if (map_length > (guint32)tvb_reported_length_remaining(tvb, offset))
+ {
+ next_tvb = tvb_new_subset_remaining(tvb, offset);
+ }
+ else
+ {
+ next_tvb = tvb_new_subset_length(tvb, offset, map_length);
+ }
+ dissect_amqp_0_10_map (next_tvb, ti);
+ /* offset += map_length; */
+ }
+ break;
}
}
static void
-dissect_amqp_0_10_struct_fragment_properties(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_tree *tree,
- int offset,
- guint32 struct_length)
+dissect_amqp_0_10_queue(tvbuff_t *tvb,
+ packet_info *pinfo,
+ proto_tree *tree)
{
- proto_item *args_tree;
- proto_item *flags_item;
- guint8 flag1, flag2;
- int flags_offset;
- int max_length;
+ proto_item *args_tree;
+ proto_item *ti;
+ proto_item *flags_item;
+ guint8 method;
+ guint8 flag1, flag2;
+ guint32 map_length;
+ int flags_offset;
+ const gchar *method_name;
+ int offset = 0;
+ tvbuff_t *next_tvb;
- max_length = offset + AMQP_0_10_SIZE_MAX(struct_length);
- args_tree = proto_item_add_subtree(tree, ett_args);
- AMQP_INCREMENT(offset, 2, max_length); /* Skip class and struct codes */
- flags_offset = offset;
+ method = tvb_get_guint8(tvb, offset+1);
+ method_name = val_to_str_const(method, amqp_0_10_queue_methods,
+ "<invalid queue method>");
+ col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", method_name);
+ col_set_fence(pinfo->cinfo, COL_INFO);
+
+ proto_tree_add_item(tree, hf_amqp_0_10_queue_method,
+ tvb, offset+1, 1, ENC_BIG_ENDIAN);
+ offset += 2;
+ /*
+ * Session header is 2 bytes; one that tells that it's 1 byte long, then
+ * the byte itself. Bit 0 is sync.
+ */
flag1 = tvb_get_guint8(tvb, offset);
flag2 = tvb_get_guint8(tvb, offset+1);
- flags_item = proto_tree_add_item(args_tree,
- hf_amqp_0_10_argument_packing_flags,
- tvb, offset, 2, ENC_BIG_ENDIAN);
- if ((flag1 & ~0x07) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- AMQP_INCREMENT(offset, 2, max_length);
-
- /* First 2 fields are bits */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_struct_fragment_properties_first,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_struct_fragment_properties_last,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- if (flag1 & 0x04) {
- /* fragment-size (uint64) */
- proto_tree_add_item(args_tree,
- hf_amqp_0_10_struct_fragment_properties_size,
- tvb, offset, 8, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 8, max_length);
- }
-}
+ ti = proto_tree_add_item(tree, hf_amqp_0_10_session_header, tvb, offset, 2, ENC_BIG_ENDIAN);
+ if ((flag1 != 1) || ((flag2 & 0xfe) != 0))
+ proto_item_append_text(ti, " (Invalid)");
+ else
+ proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync,
+ tvb, offset + 1, 1, ENC_BIG_ENDIAN);
+ offset += 2;
-static void
-dissect_amqp_0_10_struct_message_properties(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_tree *tree,
- int offset,
- guint32 struct_length)
-{
- proto_item *ti;
- proto_item *frag;
- proto_item *args_tree;
- proto_item *flags_item, *subflags_item;
- guint8 flag1, flag2;
- guint8 subflag1, subflag2;
- guint8 len8;
- guint16 len16;
- guint32 map_length;
- e_guid_t uuid;
- int max_length;
+ ti = proto_tree_add_item(tree, hf_amqp_method_arguments,
+ tvb, offset, -1, ENC_NA);
+ args_tree = proto_item_add_subtree(ti, ett_args);
- max_length = offset + AMQP_0_10_SIZE_MAX(struct_length);
- frag = proto_item_add_subtree(tree, ett_args);
- AMQP_INCREMENT(offset, 2, max_length); /* Skip class and struct codes */
+ /*
+ * The flag bits are a simple bit string, not a net-byte-order
+ * field. tvb_get_bits16() doesn't know how to do little-endian
+ * at this time, so just pick out two bytes.
+ */
+ flags_offset = offset;
flag1 = tvb_get_guint8(tvb, offset);
flag2 = tvb_get_guint8(tvb, offset+1);
- flags_item = proto_tree_add_item(frag,
+ flags_item = proto_tree_add_item(args_tree,
hf_amqp_0_10_argument_packing_flags,
tvb, offset, 2, ENC_BIG_ENDIAN);
- if (flag2 & ~0x01)
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- AMQP_INCREMENT(offset, 2, max_length);
- if (flag1 & 0x01) {
- /* content-length (uint64) */
- proto_tree_add_item(frag,
- hf_amqp_0_10_struct_message_properties_content_len,
- tvb, offset, 8, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 8, max_length);
- }
- if (flag1 & 0x02) {
- /* message-id (uuid) */
- tvb_get_guid(tvb, offset, &uuid, ENC_BIG_ENDIAN);
- proto_tree_add_guid(frag,
- hf_amqp_0_10_struct_message_properties_message_id,
- tvb, offset, 16, &uuid);
- AMQP_INCREMENT(offset, 16, max_length);
- }
- if (flag1 & 0x04) {
- /* correlation-id (vbin16) */
- len16 = tvb_get_ntohs(tvb, offset);
- proto_tree_add_item(frag,
- hf_amqp_0_10_struct_message_properties_correlation,
- tvb, offset + 2, len16, ENC_NA);
- AMQP_INCREMENT(offset, (2 + len16), max_length);
- }
- if (flag1 & 0x08) {
- /* reply-to (reply-to) */
- /* This is another struct, length 2, packing 2 */
- len16 = tvb_get_ntohs(tvb, offset);
- AMQP_INCREMENT(offset, 2, max_length);
- ti = proto_tree_add_item(frag,
- hf_amqp_0_10_struct_message_properties_reply_to,
- tvb, offset, len16, ENC_NA);
- args_tree = proto_item_add_subtree(ti, ett_args);
- subflags_item = proto_tree_add_item(args_tree,
- hf_amqp_0_10_argument_packing_flags,
- tvb, offset, 2, ENC_BIG_ENDIAN);
- subflag1 = tvb_get_guint8(tvb, offset);
- subflag2 = tvb_get_guint8(tvb, offset + 1);
- if ((subflag1 & ~0x03) || (subflag2 != 0))
- expert_add_info(pinfo, subflags_item, &ei_amqp_bad_flag_value);
- AMQP_INCREMENT(offset, 2, max_length);
- if (subflag1 & 0x01) {
- /* exchange (str8) */
- len8 = tvb_get_guint8(tvb, offset);
+ offset += 2;
+ switch (method) {
+ case AMQP_0_10_METHOD_QUEUE_DECLARE:
+ if ((flag1 & ~0x7f) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) { /* queue (name [str8]) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_struct_reply_to_exchange,
- tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + len8), max_length);
+ hf_amqp_0_10_method_queue_name,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
}
- if (subflag1 & 0x02) {
- /* routing-key (str8) */
- len8 = tvb_get_guint8(tvb, offset);
+ if (flag1 & 0x02) { /* alternate-exchange (exchange.name [str8]) */
proto_tree_add_item(args_tree,
- hf_amqp_0_10_struct_reply_to_routing_key,
- tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + len8), max_length);
+ hf_amqp_0_10_method_queue_alt_exchange,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
}
- }
- if (flag1 & 0x10) {
- /* content-type (str8) */
- len8 = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(frag,
- hf_amqp_0_10_struct_message_properties_content_type,
- tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + len8), max_length);
- }
- if (flag1 & 0x20) {
- /* content-encoding (str8) */
- len8 = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(frag,
- hf_amqp_0_10_struct_message_properties_content_encoding,
- tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + len8), max_length);
- }
- if (flag1 & 0x40) {
- /* user-id (vbin16 ) */
- len16 = tvb_get_ntohs(tvb, offset);
- proto_tree_add_item(frag,
- hf_amqp_0_10_struct_message_properties_user_id,
- tvb, offset + 2, len16, ENC_NA);
- AMQP_INCREMENT(offset, (2 + len16), max_length);
- }
- if (flag1 & 0x80) {
- /* app-id (vbin16 ) */
- len16 = tvb_get_ntohs(tvb, offset);
- proto_tree_add_item(frag,
- hf_amqp_0_10_struct_message_properties_app_id,
- tvb, offset + 2, len16, ENC_NA);
- AMQP_INCREMENT(offset, (2 + len16), max_length);
- }
- if (flag2 & 0x01) {
- /* application-headers (map) */
- map_length = amqp_0_10_get_32bit_size(tvb, offset);
- AMQP_INCREMENT(offset, 4, max_length);
- ti = proto_tree_add_item(frag,
- hf_amqp_0_10_struct_message_properties_application_headers,
- tvb,
- offset,
- map_length, ENC_NA);
- dissect_amqp_0_10_map (tvb,
- offset,
- offset + map_length,
- map_length,
- ti);
- AMQP_INCREMENT(offset, map_length, max_length);
- }
-}
+ /*
+ * 3rd-6th arguments are optional bits.
+ */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_queue_declare_passive,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_queue_declare_durable,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_queue_declare_exclusive,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_queue_declare_auto_delete,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ if (flag1 & 0x40) { /* arguments (map) */
+ map_length = amqp_0_10_get_32bit_size_new(args_tree, pinfo, tvb, hf_amqp_0_10_method_queue_declare_arguments_size, offset);
+ offset += 4;
+ ti = proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_queue_declare_arguments,
+ tvb,
+ offset,
+ map_length, ENC_NA);
+ if (map_length > (guint32)tvb_reported_length_remaining(tvb, offset))
+ {
+ next_tvb = tvb_new_subset_remaining(tvb, offset);
+ }
+ else
+ {
+ next_tvb = tvb_new_subset_length(tvb, offset, map_length);
+ }
+ dissect_amqp_0_10_map (next_tvb, ti);
+ /* offset += map_length; */
+ }
+ break;
-static void
-dissect_amqp_0_10_struct_exchange_query_result(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_item *tree,
- int offset,
- guint32 struct_length)
-{
- proto_item *ti;
- proto_item *result;
- proto_item *flags_item;
- guint8 flag1, flag2;
- guint8 len8;
- guint32 map_length;
- int flags_offset;
- int max_length;
+ case AMQP_0_10_METHOD_QUEUE_DELETE:
+ if ((flag1 & ~0x07) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) { /* queue (name [str8]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_queue_name,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ /* offset += (1 + tvb_get_guint8(tvb, offset)); */
+ }
+ /*
+ * 2nd-3rd arguments are optional bits.
+ */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_queue_delete_if_unused,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_queue_delete_if_empty,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ break;
- max_length = offset + AMQP_0_10_SIZE_MAX(struct_length);
- result = proto_item_add_subtree(tree, ett_args);
- AMQP_INCREMENT(offset, 2, max_length); /* Skip class and struct codes */
- flags_offset = offset;
- flag1 = tvb_get_guint8(tvb, offset);
- flag2 = tvb_get_guint8(tvb, offset+1);
- flags_item = proto_tree_add_item(result,
- hf_amqp_0_10_argument_packing_flags,
- tvb, offset, 2, ENC_BIG_ENDIAN);
- if (flag2 & ~0x0f)
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- AMQP_INCREMENT(offset, 2, max_length);
- if (flag1 & 0x01) {
- /* type (str8) */
- len8 = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(result,
- hf_amqp_0_10_method_exchange_declare_type,
- tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + len8), max_length);
- }
- proto_tree_add_item(result,
- hf_amqp_0_10_struct_exchange_query_result_durable,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(result,
- hf_amqp_0_10_struct_exchange_query_result_not_found,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- if (flag1 & 0x08) {
- /* arguments (map) */
- map_length = amqp_0_10_get_32bit_size(tvb, offset);
- AMQP_INCREMENT(offset, 4, max_length);
- ti = proto_tree_add_item(result,
- hf_amqp_0_10_method_exchange_declare_arguments,
- tvb,
- offset - 4,
- map_length + 4, ENC_NA);
- dissect_amqp_0_10_map (tvb,
- offset,
- offset + map_length,
- map_length,
- ti);
- AMQP_INCREMENT(offset, map_length, max_length);
+ case AMQP_0_10_METHOD_QUEUE_PURGE:
+ if ((flag1 & ~0x01) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) { /* queue (name [str8]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_queue_name,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ /* offset += (1 + tvb_get_guint8(tvb, offset)); */
+ }
+ break;
+
+ case AMQP_0_10_METHOD_QUEUE_QUERY:
+ if ((flag1 & ~0x01) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) { /* queue (name [str8]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_queue_name,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ /* offset += (1 + tvb_get_guint8(tvb, offset)); */
+ }
+ break;
}
}
static void
-dissect_amqp_0_10_struct_queue_query_result(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_item *tree,
- int offset,
- guint32 struct_length)
+dissect_amqp_0_10_file(tvbuff_t *tvb,
+ packet_info *pinfo,
+ proto_tree *tree)
{
- proto_item *ti;
- proto_item *result;
- proto_item *flags_item;
- guint8 flag1, flag2;
- guint8 len8;
- guint32 map_length;
- int flags_offset;
- int max_length;
+ proto_item *args_tree;
+ proto_item *ti;
+ proto_item *flags_item;
+ guint8 method;
+ guint8 flag1, flag2;
+ guint32 map_length;
+ int flags_offset;
+ const gchar *method_name;
+ int offset = 0;
+ tvbuff_t *next_tvb;
- max_length = offset + AMQP_0_10_SIZE_MAX(struct_length);
- result = proto_item_add_subtree(tree, ett_args);
- AMQP_INCREMENT(offset, 2, max_length); /* Skip class and struct codes */
+ method = tvb_get_guint8(tvb, offset+1);
+ method_name = val_to_str_const(method, amqp_0_10_file_methods,
+ "<invalid file method>");
+ col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", method_name);
+ col_set_fence(pinfo->cinfo, COL_INFO);
+
+ proto_tree_add_item(tree, hf_amqp_0_10_file_method,
+ tvb, offset+1, 1, ENC_BIG_ENDIAN);
+ offset += 2;
+ /*
+ * Session header is 2 bytes; one that tells that it's 1 byte long, then
+ * the byte itself. Bit 0 is sync.
+ */
+ flag1 = tvb_get_guint8(tvb, offset);
+ flag2 = tvb_get_guint8(tvb, offset+1);
+ ti = proto_tree_add_item(tree, hf_amqp_0_10_session_header, tvb, offset, 2, ENC_BIG_ENDIAN);
+ if ((flag1 != 1) || ((flag2 & 0xfe) != 0))
+ proto_item_append_text(ti, " (Invalid)");
+ else
+ proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync,
+ tvb, offset + 1, 1, ENC_BIG_ENDIAN);
+ offset += 2;
+
+ ti = proto_tree_add_item(tree, hf_amqp_method_arguments,
+ tvb, offset, -1, ENC_NA);
+ args_tree = proto_item_add_subtree(ti, ett_args);
+
+ /*
+ * The flag bits are a simple bit string, not a net-byte-order
+ * field. tvb_get_bits16() doesn't know how to do little-endian
+ * at this time, so just pick out two bytes.
+ */
flags_offset = offset;
flag1 = tvb_get_guint8(tvb, offset);
flag2 = tvb_get_guint8(tvb, offset+1);
- flags_item = proto_tree_add_item(result,
+ flags_item = proto_tree_add_item(args_tree,
hf_amqp_0_10_argument_packing_flags,
tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += 2;
+ switch (method) {
+ case AMQP_0_10_METHOD_FILE_QOS:
+ if ((flag1 & ~0x07) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) { /* prefetch-size (uint32) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_qos_prefetch_size,
+ tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += 4;
+ }
+ if (flag1 & 0x02) { /* prefetch-count (uint16) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_qos_prefetch_count,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ /* offset += 2; */
+ }
+ /*
+ * 3rd argument is an optional bit.
+ */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_qos_global,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ break;
- if (flag2 != 0)
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- AMQP_INCREMENT(offset, 2, max_length);
- if (flag1 & 0x01) {
- /* queue (name [str8]) */
- len8 = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(result,
- hf_amqp_0_10_method_queue_name,
- tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + len8), max_length);
- }
- if (flag1 & 0x02) { /* alternate-exchange (exchange.name [str8]) */
- len8 = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(result,
- hf_amqp_0_10_method_queue_alt_exchange,
- tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + len8), max_length);
- }
- /*
- * 3rd-5th arguments are optional bits.
- */
- proto_tree_add_item(result,
- hf_amqp_0_10_struct_queue_query_result_durable,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(result,
- hf_amqp_0_10_struct_queue_query_result_exclusive,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(result,
- hf_amqp_0_10_struct_queue_query_result_auto_delete,
- tvb, flags_offset, 1, ENC_BIG_ENDIAN);
- if (flag1 & 0x20) { /* arguments (map) */
- map_length = amqp_0_10_get_32bit_size(tvb, offset);
- AMQP_INCREMENT(offset, 4, max_length);
- ti = proto_tree_add_item(result,
- hf_amqp_0_10_method_queue_declare_arguments,
- tvb,
- offset - 4,
- map_length + 4, ENC_NA);
- dissect_amqp_0_10_map (tvb,
- offset,
- offset + map_length,
- map_length,
- ti);
- AMQP_INCREMENT(offset, (int)map_length, max_length);
- }
- if (flag1 & 0x40) { /* message-count (uint32) */
- proto_tree_add_item(result,
- hf_amqp_0_10_struct_queue_query_result_message_count,
- tvb, offset, 4, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 4, max_length);
- }
- if (flag1 & 0x80) { /* subscriber-count (uint32) */
- proto_tree_add_item(result,
- hf_amqp_0_10_struct_queue_query_result_subscriber_count,
- tvb, offset, 4, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 4, max_length);
+ case AMQP_0_10_METHOD_FILE_QOS_OK:
+ case AMQP_0_10_METHOD_FILE_STAGE:
+ /* No args */
+ break;
+
+ case AMQP_0_10_METHOD_FILE_CONSUME:
+ if ((flag1 & ~0x7f) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) { /* queue (queue.name [str8]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_queue_name,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag1 & 0x02) { /* consumer-tag (str8) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_consumer_tag,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ /*
+ * 3rd-6th arguments are optional bits.
+ */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_consume_no_local,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_consume_no_ack,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_consume_exclusive,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_consume_nowait,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ if (flag1 & 0x40) { /* arguments (map) */
+ map_length = amqp_0_10_get_32bit_size_new(args_tree, pinfo, tvb, hf_amqp_0_10_method_file_consume_arguments_size, offset);
+ offset += 4;
+ ti = proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_consume_arguments,
+ tvb,
+ offset,
+ map_length, ENC_NA);
+ if (map_length > (guint32)tvb_reported_length_remaining(tvb, offset))
+ {
+ next_tvb = tvb_new_subset_remaining(tvb, offset);
+ }
+ else
+ {
+ next_tvb = tvb_new_subset_length(tvb, offset, map_length);
+ }
+ dissect_amqp_0_10_map (next_tvb, ti);
+ /* offset += map_length; */
+ }
+ break;
+
+ case AMQP_0_10_METHOD_FILE_CONSUME_OK:
+ case AMQP_0_10_METHOD_FILE_CANCEL:
+ if ((flag1 & ~0x01) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) { /* consumer-tag (str8) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_consumer_tag,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ /* offset += (1 + tvb_get_guint8(tvb, offset)); */
+ }
+ break;
+
+ case AMQP_0_10_METHOD_FILE_OPEN:
+ if ((flag1 & ~0x03) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) { /* identifier (str8) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_identifier,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag1 & 0x02) { /* content-size (uint64) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_open_content_size,
+ tvb, offset, 8, ENC_BIG_ENDIAN);
+ /* offset += 8; */
+ }
+ break;
+
+ case AMQP_0_10_METHOD_FILE_OPEN_OK:
+ if ((flag1 & ~0x01) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) { /* staged-size (uint64) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_open_ok_staged_size,
+ tvb, offset, 8, ENC_BIG_ENDIAN);
+ /* offset += 8; */
+ }
+ break;
+
+ case AMQP_0_10_METHOD_FILE_PUBLISH:
+ if ((flag1 & ~0x1f) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) { /* exchange (exchange.name [str8]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_publish_exchange,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag1 & 0x02) { /* routing-key (str8) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_publish_routing_key,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ /*
+ * 3rd-4th arguments are optional bits.
+ */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_publish_mandatory,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_publish_immediate,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ if (flag1 & 0x10) { /* identifier (str8) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_identifier,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ /* offset += (1 + tvb_get_guint8(tvb, offset)); */
+ }
+ break;
+
+ case AMQP_0_10_METHOD_FILE_RETURN:
+ if ((flag1 & ~0x0f) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) { /* reply-code (return-code [uint16]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_return_reply_code,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += 2;
+ }
+ if (flag1 & 0x02) { /* reply-text (str8) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_return_reply_text,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag1 & 0x04) { /* exchange (exchange.name [str8]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_return_exchange,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag1 & 0x08) { /* routing-key (str8) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_return_routing_key,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ /* offset += (1 + tvb_get_guint8(tvb, offset)); */
+ }
+ break;
+
+ case AMQP_0_10_METHOD_FILE_DELIVER:
+ if ((flag1 & ~0x3f) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) { /* consumer-tag (str8) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_deliver_consumer_tag,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag1 & 0x02) { /* delivery-tag (uint64) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_deliver_delivery_tag,
+ tvb, offset, 8, ENC_BIG_ENDIAN);
+ offset += 8;
+ }
+ /*
+ * 3rd argument is an optional bit.
+ */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_deliver_redelivered,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ if (flag1 & 0x08) { /* exchange (exchange.name [str8]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_deliver_exchange,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag1 & 0x10) { /* routing-key (str8) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_deliver_routing_key,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag1 & 0x20) { /* identifier (str8) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_identifier,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ /* offset += (1 + tvb_get_guint8(tvb, offset)); */
+ }
+ break;
+
+ case AMQP_0_10_METHOD_FILE_ACK:
+ if ((flag1 & ~0x03) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) { /* delivery-tag (uint64) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_ack_delivery_tag,
+ tvb, offset, 8, ENC_BIG_ENDIAN);
+ /* offset += 8; */
+ }
+ /*
+ * 2nd argument is an optional bit.
+ */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_ack_multiple,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ break;
+
+ case AMQP_0_10_METHOD_FILE_REJECT:
+ if ((flag1 & ~0x03) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) { /* delivery-tag (uint64) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_reject_delivery_tag,
+ tvb, offset, 8, ENC_BIG_ENDIAN);
+ /* offset += 8; */
+ }
+ /*
+ * 2nd argument is an optional bit.
+ */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_file_reject_requeue,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ break;
}
}
static void
-dissect_amqp_0_10_struct_file_properties(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_tree *tree,
- int offset,
- guint32 struct_length)
+dissect_amqp_0_10_stream(tvbuff_t *tvb,
+ packet_info *pinfo,
+ proto_tree *tree)
{
- proto_item *ti;
- proto_item *props;
- proto_item *flags_item;
- guint8 flag1, flag2;
- guint8 len8;
- guint32 map_length;
- guint64 timestamp;
- int max_length;
- nstime_t tv;
+ proto_item *args_tree;
+ proto_item *ti;
+ proto_item *flags_item;
+ guint8 method;
+ guint8 flag1, flag2;
+ guint32 map_length;
+ int flags_offset;
+ const gchar *method_name;
+ int offset = 0;
+ tvbuff_t *next_tvb;
- max_length = offset + AMQP_0_10_SIZE_MAX(struct_length);
- props = proto_item_add_subtree(tree, ett_args);
- AMQP_INCREMENT(offset, 2, max_length); /* Skip class and struct codes */
+ method = tvb_get_guint8(tvb, offset+1);
+ method_name = val_to_str_const(method, amqp_0_10_stream_methods,
+ "<invalid stream method>");
+ col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", method_name);
+ col_set_fence(pinfo->cinfo, COL_INFO);
+
+ proto_tree_add_item(tree, hf_amqp_0_10_stream_method,
+ tvb, offset+1, 1, ENC_BIG_ENDIAN);
+ offset += 2;
+ /*
+ * Session header is 2 bytes; one that tells that it's 1 byte long, then
+ * the byte itself. Bit 0 is sync.
+ */
flag1 = tvb_get_guint8(tvb, offset);
flag2 = tvb_get_guint8(tvb, offset+1);
- flags_item = proto_tree_add_item(props,
- hf_amqp_0_10_argument_packing_flags,
- tvb, offset, 2, ENC_BIG_ENDIAN);
- if (flag2 & ~0x01)
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- AMQP_INCREMENT(offset, 2, max_length);
- if (flag1 & 0x01) {
- /* content-type (str8) */
- len8 = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(props,
- hf_amqp_0_10_struct_file_properties_content_type,
- tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + len8), max_length);
- }
- if (flag1 & 0x02) {
- /* content-encoding (str8) */
- len8 = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(props,
- hf_amqp_0_10_struct_file_properties_content_encoding,
- tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + len8), max_length);
- }
- if (flag1 & 0x04) {
- /* headers (map) */
- map_length = amqp_0_10_get_32bit_size(tvb, offset);
- AMQP_INCREMENT(offset, 4, max_length);
- ti = proto_tree_add_item(props,
- hf_amqp_0_10_struct_file_properties_headers,
- tvb,
- offset,
- map_length, ENC_NA);
- dissect_amqp_0_10_map (tvb,
- offset,
- offset + map_length,
- map_length,
- ti);
- AMQP_INCREMENT(offset, map_length, max_length);
- }
- if (flag1 & 0x08) {
- /* priority (uint8) */
- proto_tree_add_item(props,
- hf_amqp_0_10_struct_file_properties_priority,
- tvb, offset, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 1, max_length);
- }
- if (flag1 & 0x10) {
- /* reply-to (str8) */
- len8 = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(props,
- hf_amqp_0_10_struct_file_properties_reply_to,
- tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + len8), max_length);
- }
- if (flag1 & 0x20) {
- /* message-id (str8) */
- len8 = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(props,
- hf_amqp_0_10_struct_file_properties_message_id,
- tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + len8), max_length);
- }
- if (flag1 & 0x40) {
- /* filename (str8) */
- len8 = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(props,
- hf_amqp_0_10_struct_file_properties_filename,
- tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + len8), max_length);
- }
- if (flag1 & 0x80) {
- /* timestamp (datetime [uint64]) */
- timestamp = tvb_get_ntoh64(tvb, offset);
- tv.secs = (time_t)timestamp;
- tv.nsecs = 0;
- proto_tree_add_time(props,
- hf_amqp_0_10_struct_file_properties_timestamp,
- tvb, offset, 8, &tv);
- AMQP_INCREMENT(offset, 8, max_length);
- }
- if (flag2 & 0x01) {
- /* cluster-id (str8) */
- len8 = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(props,
- hf_amqp_0_10_struct_file_properties_cluster_id,
- tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + len8), max_length);
- }
-}
+ ti = proto_tree_add_item(tree, hf_amqp_0_10_session_header, tvb, offset, 2, ENC_BIG_ENDIAN);
+ if ((flag1 != 1) || ((flag2 & 0xfe) != 0))
+ proto_item_append_text(ti, " (Invalid)");
+ else
+ proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync,
+ tvb, offset + 1, 1, ENC_BIG_ENDIAN);
+ offset += 2;
-static void
-dissect_amqp_0_10_struct_stream_properties(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_tree *tree,
- int offset,
- guint32 struct_length)
-{
- proto_item *ti;
- proto_item *props;
- proto_item *flags_item;
- guint8 flag1, flag2;
- guint8 len8;
- guint32 map_length;
- guint64 timestamp;
- int max_length;
- nstime_t tv;
+ ti = proto_tree_add_item(tree, hf_amqp_method_arguments,
+ tvb, offset, -1, ENC_NA);
+ args_tree = proto_item_add_subtree(ti, ett_args);
- max_length = offset + AMQP_0_10_SIZE_MAX(struct_length);
- props = proto_item_add_subtree(tree, ett_args);
- AMQP_INCREMENT(offset, 2, max_length); /* Skip class and struct codes */
+ /*
+ * The flag bits are a simple bit string, not a net-byte-order
+ * field. tvb_get_bits16() doesn't know how to do little-endian
+ * at this time, so just pick out two bytes.
+ */
+ flags_offset = offset;
flag1 = tvb_get_guint8(tvb, offset);
flag2 = tvb_get_guint8(tvb, offset+1);
- flags_item = proto_tree_add_item(props,
+ flags_item = proto_tree_add_item(args_tree,
hf_amqp_0_10_argument_packing_flags,
tvb, offset, 2, ENC_BIG_ENDIAN);
- if ((flag1 & ~0x1f) || (flag2 != 0))
- expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
- AMQP_INCREMENT(offset, 2, max_length);
- if (flag1 & 0x01) {
- /* content-type (str8) */
- len8 = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(props,
- hf_amqp_0_10_struct_stream_properties_content_type,
- tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + len8), max_length);
- }
- if (flag1 & 0x02) {
- /* content-encoding (str8) */
- len8 = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(props,
- hf_amqp_0_10_struct_stream_properties_content_encoding,
- tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, (1 + len8), max_length);
- }
- if (flag1 & 0x04) {
- /* headers (map) */
- map_length = amqp_0_10_get_32bit_size(tvb, offset);
- AMQP_INCREMENT(offset, 4, max_length);
- ti = proto_tree_add_item(props,
- hf_amqp_0_10_struct_stream_properties_headers,
- tvb,
- offset,
- map_length, ENC_NA);
- dissect_amqp_0_10_map (tvb,
- offset,
- offset + map_length,
- map_length,
- ti);
- AMQP_INCREMENT(offset, map_length, max_length);
- }
- if (flag1 & 0x08) {
- /* priority (uint8) */
- proto_tree_add_item(props,
- hf_amqp_0_10_struct_stream_properties_priority,
- tvb, offset, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 1, max_length);
- }
- if (flag1 & 0x10) {
- /* timestamp (datetime [uint64]) */
- timestamp = tvb_get_ntoh64(tvb, offset);
- tv.secs = (time_t)timestamp;
- tv.nsecs = 0;
- proto_tree_add_time(props,
- hf_amqp_0_10_struct_stream_properties_timestamp,
- tvb, offset, 8, &tv);
- AMQP_INCREMENT(offset, 8, max_length);
- }
-}
-
-static void
-dissect_amqp_0_10_struct32(tvbuff_t *tvb,
- packet_info *pinfo,
- proto_tree *tree,
- int offset,
- guint32 struct_length)
-{
- guint8 class_code;
- guint8 struct_code;
- guint8 flag1;
- guint16 size;
- guint16 value;
- guint32 array_length;
- guint32 consumed;
- proto_tree *ti;
- proto_tree *result;
-
- consumed = 0;
- class_code = tvb_get_guint8(tvb, offset);
- struct_code = tvb_get_guint8(tvb, offset + 1);
-
- switch(class_code) {
- case AMQP_0_10_CLASS_MESSAGE:
- switch (struct_code) {
- case AMQP_0_10_STRUCT_MESSAGE_DELIVERY_PROPERTIES:
- proto_item_set_text(tree, "message.delivery-properties");
- dissect_amqp_0_10_struct_delivery_properties(tvb,
- pinfo,
- tree,
- offset,
- struct_length);
- break;
- case AMQP_0_10_STRUCT_MESSAGE_FRAGMENT_PROPERTIES:
- proto_item_set_text(tree, "message.fragment-properties");
- dissect_amqp_0_10_struct_fragment_properties(tvb,
- pinfo,
- tree,
- offset,
- struct_length);
- break;
- case AMQP_0_10_STRUCT_MESSAGE_MESSAGE_PROPERTIES:
- proto_item_set_text(tree, "message.message-properties");
- dissect_amqp_0_10_struct_message_properties(tvb,
- pinfo,
- tree,
- offset,
- struct_length);
- break;
- case AMQP_0_10_STRUCT_MESSAGE_ACQUIRED:
- proto_item_set_text(tree, "message.acquired");
- result = proto_item_add_subtree(tree, ett_args);
- AMQP_INCREMENT(consumed, 2, struct_length); /* Class/type codes */
- offset += 2;
- flag1 = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(result, hf_amqp_0_10_argument_packing_flags,
- tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(consumed, 2, struct_length);
- offset += 2;
- if (flag1 & 0x01) {
- /* transfers (commands [sequence-set]) */
- size = tvb_get_ntohs(tvb, offset);
- ti = proto_tree_add_item(result,
- hf_amqp_0_10_struct_acquired_transfers,
- tvb, offset, size + 2, ENC_NA);
- format_amqp_0_10_sequence_set(tvb, offset + 2, size, ti);
- }
- break;
- case AMQP_0_10_STRUCT_MESSAGE_RESUME_RESULT:
- proto_item_set_text(tree, "message.resume-result");
- result = proto_item_add_subtree(tree, ett_args);
- AMQP_INCREMENT(consumed, 2, struct_length); /* Class/type codes */
- offset += 2;
- flag1 = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(result, hf_amqp_0_10_argument_packing_flags,
+ offset += 2;
+ switch (method) {
+ case AMQP_0_10_METHOD_STREAM_QOS:
+ if ((flag1 & ~0x0f) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) { /* prefetch-size (uint32) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_stream_qos_prefetch_size,
+ tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += 4;
+ }
+ if (flag1 & 0x02) { /* prefetch-count (uint16) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_stream_qos_prefetch_count,
tvb, offset, 2, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(consumed, 2, struct_length);
offset += 2;
- if (flag1 & 0x01) {
- /* offset (uint64) */
- proto_tree_add_item(result,
- hf_amqp_0_10_struct_resume_result_offset,
- tvb, offset, 8, ENC_BIG_ENDIAN);
- }
- break;
}
+ if (flag1 & 0x04) { /* consume-rate (uint32) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_stream_qos_prefetch_size,
+ tvb, offset, 4, ENC_BIG_ENDIAN);
+ /* offset += 4; */
+ }
+ /*
+ * 4th argument is an optional bit.
+ */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_stream_qos_global,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
break;
- case AMQP_0_10_CLASS_DTX:
- switch (struct_code) {
- case AMQP_0_10_STRUCT_DTX_XA_RESULT:
- AMQP_INCREMENT(consumed, 2, struct_length); /* Class/type codes */
- offset += 2;
- /*flag1 = tvb_get_guint8(tvb, offset);*/
- AMQP_INCREMENT(consumed, 2, struct_length); /* Packing bytes */
- offset += 2;
- value = tvb_get_ntohs(tvb, offset);
- AMQP_INCREMENT(consumed, 2, struct_length); /* xa status value */
- /*offset += 2;*/
- proto_item_set_text(tree, "dtx.xa-status: %s",
- val_to_str(value,
- amqp_0_10_xa_status,
- "Invalid xa-status %d"));
- break;
+ case AMQP_0_10_METHOD_STREAM_QOS_OK:
+ /* No args */
+ break;
- case AMQP_0_10_STRUCT_DTX_RECOVER_RESULT:
- proto_item_set_text(tree, "dtx.recover-result");
- AMQP_INCREMENT(consumed, 2, struct_length); /* Class/type codes */
- offset += 2;
- /*flag1 = tvb_get_guint8(tvb, offset);*/
- AMQP_INCREMENT(consumed, 2, struct_length); /* Packing bytes */
- offset += 2;
- array_length = amqp_0_10_get_32bit_size(tvb, offset);
- AMQP_INCREMENT(consumed, 4, struct_length);
+ case AMQP_0_10_METHOD_STREAM_CONSUME:
+ if ((flag1 & ~0x3f) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) { /* queue (queue.name [str8]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_queue_name,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag1 & 0x02) { /* consumer-tag (str8) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_stream_consumer_tag,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ /*
+ * 3rd-5th arguments are optional bits.
+ */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_stream_consume_no_local,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_stream_consume_exclusive,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_stream_consume_nowait,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ if (flag1 & 0x20) { /* arguments (map) */
+ map_length = amqp_0_10_get_32bit_size_new(args_tree, pinfo, tvb, hf_amqp_0_10_method_stream_consume_arguments_size, offset);
offset += 4;
- dissect_amqp_0_10_array(tvb,
- pinfo,
- offset,
- offset + array_length,
- array_length,
- tree);
- break;
+ ti = proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_stream_consume_arguments,
+ tvb,
+ offset,
+ map_length, ENC_NA);
+ if (map_length > (guint32)tvb_reported_length_remaining(tvb, offset))
+ {
+ next_tvb = tvb_new_subset_remaining(tvb, offset);
+ }
+ else
+ {
+ next_tvb = tvb_new_subset_length(tvb, offset, map_length);
+ }
+ dissect_amqp_0_10_map (next_tvb, ti);
+ /* offset += map_length; */
}
break;
- case AMQP_0_10_CLASS_EXCHANGE:
- switch (struct_code) {
- case AMQP_0_10_STRUCT_EXCHANGE_QUERY_RESULT:
- proto_item_set_text(tree, "exchange.exchange-query-result");
- dissect_amqp_0_10_struct_exchange_query_result(tvb,
- pinfo,
- tree,
- offset,
- struct_length);
- break;
-
- case AMQP_0_10_STRUCT_EXCHANGE_BOUND_RESULT:
- proto_item_set_text(tree, "exchange.exchange-bound-result");
- result = proto_item_add_subtree(tree, ett_args);
- AMQP_INCREMENT(consumed, 2, struct_length); /* Class/type codes */
- offset += 2;
- proto_tree_add_item(result,
- hf_amqp_0_10_struct_exchange_bound_result_exchange_not_found,
- tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(result,
- hf_amqp_0_10_struct_exchange_bound_result_queue_not_found,
- tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(result,
- hf_amqp_0_10_struct_exchange_bound_result_queue_not_matched,
- tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(result,
- hf_amqp_0_10_struct_exchange_bound_result_key_not_matched,
- tvb, offset, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(result,
- hf_amqp_0_10_struct_exchange_bound_result_args_not_matched,
- tvb, offset, 1, ENC_BIG_ENDIAN);
- break;
+ case AMQP_0_10_METHOD_STREAM_CONSUME_OK:
+ case AMQP_0_10_METHOD_STREAM_CANCEL:
+ if ((flag1 & ~0x01) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) { /* consumer-tag (str8) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_stream_consumer_tag,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ /* offset += (1 + tvb_get_guint8(tvb, offset)); */
}
break;
- case AMQP_0_10_CLASS_QUEUE:
- switch (struct_code) {
- case AMQP_0_10_STRUCT_QUEUE_QUERY_RESULT:
- proto_item_set_text(tree, "queue.queue-query-result");
- dissect_amqp_0_10_struct_queue_query_result(tvb,
- pinfo,
- tree,
- offset,
- struct_length);
- break;
+ case AMQP_0_10_METHOD_STREAM_PUBLISH:
+ if ((flag1 & ~0x0f) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) { /* exchange (exchange.name [str8]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_stream_publish_exchange,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
}
- break;
-
- case AMQP_0_10_CLASS_FILE:
- switch (struct_code) {
- case AMQP_0_10_STRUCT_FILE_PROPERTIES:
- proto_item_set_text(tree, "file.file-properties");
- dissect_amqp_0_10_struct_file_properties(tvb,
- pinfo,
- tree,
- offset,
- struct_length);
- break;
+ if (flag1 & 0x02) { /* routing-key (str8) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_stream_publish_routing_key,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ /* offset += (1 + tvb_get_guint8(tvb, offset)); */
}
+ /*
+ * 3rd-4th arguments are optional bits.
+ */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_stream_publish_mandatory,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_stream_publish_immediate,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
break;
- case AMQP_0_10_CLASS_STREAM:
- switch (struct_code) {
- case AMQP_0_10_STRUCT_STREAM_PROPERTIES:
- proto_item_set_text(tree, "stream.stream-properties");
- dissect_amqp_0_10_struct_stream_properties(tvb,
- pinfo,
- tree,
- offset,
- struct_length);
- break;
+ case AMQP_0_10_METHOD_STREAM_RETURN:
+ if ((flag1 & ~0x0f) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) { /* reply-code (return-code [uint16]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_stream_return_reply_code,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += 2;
+ }
+ if (flag1 & 0x02) { /* reply-text (str8) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_stream_return_reply_text,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag1 & 0x04) { /* exchange (exchange.name [str8]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_stream_return_exchange,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag1 & 0x08) { /* routing-key (str8) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_stream_return_routing_key,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ /* offset += (1 + tvb_get_guint8(tvb, offset)); */
}
break;
- }
-}
-
-/* decodes AMQP 1.0 list
- * arguments:
- * tvb: obvious
- * pinfo: obvious
- * offset: obvious
- * bound: boundary within that the list has to end
- * item: obvious
- * hf_amqp_type: what hf_* type is the list itself
- * hf_amqp_subtype_count: length of hf_amqp_subtypes
- * hf_amqp_subtypes: what hf_* types are the list items
- * name: what to show for unformatted content
- */
-static guint
-dissect_amqp_1_0_list(tvbuff_t *tvb,
- packet_info *pinfo,
- int offset,
- int bound,
- proto_item *item,
- int hf_amqp_type,
- guint32 hf_amqp_subtype_count,
- const int **hf_amqp_subtypes,
- const char *name)
-{
- proto_item *list_tree;
- guint8 type;
- guint8 count_len;
- guint32 element_count;
- guint32 element_size;
- guint32 decoded_element_size;
- guint32 orig_offset;
- guint32 decoded_elements;
- int hf_amqp_item;
-
- list_tree = 0;
- decoded_elements = 0;
- orig_offset = offset;
-
- if (proto_registrar_get_ftype(hf_amqp_type) != FT_NONE)
- {
- expert_add_info_format(pinfo, item, &ei_amqp_unknown_amqp_type,
- "Unexpected list type at frame position %d of field \"%s\"",
- offset,
- name ? name : proto_registrar_get_name(hf_amqp_type));
- return bound-orig_offset;
- }
- type = tvb_get_guint8(tvb, offset);
- AMQP_INCREMENT(offset, 1, bound);
- switch (type) {
- case AMQP_1_0_TYPE_LIST0:
- count_len = 0;
- element_size = 0;
- element_count = 0;
- break;
- case AMQP_1_0_TYPE_LIST8:
- count_len = 1;
- element_size = tvb_get_guint8(tvb, offset);
- element_count = tvb_get_guint8(tvb, offset+count_len);
- break;
- case AMQP_1_0_TYPE_LIST32:
- count_len = 4;
- element_size = tvb_get_ntohl(tvb, offset);
- element_count = tvb_get_ntohl(tvb, offset+count_len);
- break;
- default:
- proto_tree_add_none_format(list_tree, hf_amqp_1_0_list, tvb,
- offset-1,
- 1,
- "(unknown type %d)",
- type);
- expert_add_info_format(pinfo,
- list_tree,
- &ei_amqp_unknown_amqp_type,
- "Unknown AMQP list type %d",
- type);
- return bound-orig_offset;
+ case AMQP_0_10_METHOD_STREAM_DELIVER:
+ if ((flag1 & ~0x0f) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ if (flag1 & 0x01) { /* consumer-tag (str8) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_stream_deliver_consumer_tag,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag1 & 0x02) { /* delivery-tag (uint64) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_stream_deliver_delivery_tag,
+ tvb, offset, 8, ENC_BIG_ENDIAN);
+ offset += 8;
+ }
+ if (flag1 & 0x04) { /* exchange (exchange.name [str8]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_stream_deliver_exchange,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag1 & 0x08) { /* queue (queue.name [str8]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_stream_deliver_queue,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ /* offset += (1 + tvb_get_guint8(tvb, offset)); */
+ }
+ break;
}
+}
- list_tree = proto_tree_add_none_format(item,
- hf_amqp_type,
- tvb,
- offset-1,
- element_size+1+count_len,
- "%s",
- name ? name : proto_registrar_get_name(hf_amqp_type));
- AMQP_INCREMENT(offset, count_len*2, bound);
+static void
+dissect_amqp_0_10_struct_delivery_properties(tvbuff_t *tvb,
+ packet_info *pinfo,
+ proto_tree *tree)
+{
+ proto_item *args_tree;
+ proto_item *flags_item;
+ guint8 flag1, flag2;
+ guint64 timestamp;
+ int flags_offset;
+ nstime_t tv;
+ int offset = 0;
- if (element_count > 0)
- list_tree = proto_item_add_subtree(list_tree, ett_amqp_1_0_list);
- /* display the item count for custom lists only
- * standard structures contain NULL items, so the real element count is different */
- if (hf_amqp_subtype_count == 0)
- proto_item_append_text(list_tree, " (list of %d element%s)", element_count, element_suffix[element_count!=1]);
+ args_tree = proto_item_add_subtree(tree, ett_args);
+ offset += 2; /* Skip class and struct codes */
+ flags_offset = offset;
+ flag1 = tvb_get_guint8(tvb, offset);
+ flag2 = tvb_get_guint8(tvb, offset+1);
+ flags_item = proto_tree_add_item(args_tree,
+ hf_amqp_0_10_argument_packing_flags,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ if (flag2 & ~0x0f)
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ offset += 2;
- if (element_count > element_size)
- {
- expert_add_info_format(pinfo,
- list_tree,
- &ei_amqp_invalid_number_of_params,
- "Number of list elements (%d) bigger than list size (%d)",
- element_count, element_size);
- return bound-orig_offset;
+ /* First 3 fields are bits */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_struct_delivery_properties_discard_unroutable,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_struct_delivery_properties_immediate,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_struct_delivery_properties_redelivered,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ if (flag1 & 0x08) {
+ /* delivery-priority (delivery-priority [uint8]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_struct_delivery_properties_priority,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
}
-
- while ((element_count > 0) && (offset < bound)) {
- decoded_element_size = 0;
- if (decoded_elements<hf_amqp_subtype_count)
- hf_amqp_item = *(hf_amqp_subtypes[decoded_elements]);
- else
- hf_amqp_item = hf_amqp_1_0_list; /* dynamic item */
- get_amqp_1_0_type_value_formatter(tvb,
- pinfo,
- offset,
- bound,
- hf_amqp_item,
- NULL,
- &decoded_element_size,
- list_tree);
- element_count -= 1;
- decoded_elements += 1;
- AMQP_INCREMENT(offset, decoded_element_size, bound);
+ if (flag1 & 0x10) {
+ /* delivery-mode (delivery-mode [uint8]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_struct_delivery_properties_mode,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
+ }
+ if (flag1 & 0x20) {
+ /* ttl (uint64) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_struct_delivery_properties_ttl,
+ tvb, offset, 8, ENC_BIG_ENDIAN);
+ offset += 8;
+ }
+ if (flag1 & 0x40) {
+ /* timestamp (datetime [uint64]) */
+ timestamp = tvb_get_ntoh64(tvb, offset);
+ tv.secs = (time_t)timestamp;
+ tv.nsecs = 0;
+ proto_tree_add_time(args_tree,
+ hf_amqp_0_10_struct_delivery_properties_timestamp,
+ tvb, offset, 8, &tv);
+ offset += 8;
+ }
+ if (flag1 & 0x80) {
+ /* expiration (datetime [uint64]) */
+ timestamp = tvb_get_ntoh64(tvb, offset);
+ tv.secs = (time_t)timestamp;
+ tv.nsecs = 0;
+ proto_tree_add_time(args_tree,
+ hf_amqp_0_10_struct_delivery_properties_expiration,
+ tvb, offset, 8, &tv);
+ offset += 8;
+ }
+ if (flag2 & 0x01) {
+ /* exchange (exchange.name [str8]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_struct_delivery_properties_exchange,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag2 & 0x02) {
+ /* routing-key (str8) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_struct_delivery_properties_routing_key,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag2 & 0x04) {
+ /* resume-id (resume-id [str16]) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_method_message_resume_id,
+ tvb, offset, 2, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (2 + tvb_get_ntohs(tvb, offset));
+ }
+ if (flag2 & 0x08) {
+ /* resume-ttl (uint64) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_struct_delivery_properties_resume_ttl,
+ tvb, offset, 8, ENC_BIG_ENDIAN);
+ /* offset += 8; */
}
- if (element_count > 0)
- expert_add_info_format(pinfo,
- list_tree,
- &ei_amqp_invalid_number_of_params,
- "Number of list elements (%d) not matching number of decoded elements (%d)",
- element_count+decoded_elements, decoded_elements);
- return offset-orig_offset;
}
-/* decodes AMQP 1.0 map
- * arguments: see dissect_amqp_1_0_list
- */
-static guint
-dissect_amqp_1_0_map(tvbuff_t *tvb,
- packet_info *pinfo,
- int offset,
- int bound,
- proto_item *item,
- int hf_amqp_type,
- const char *name)
+static void
+dissect_amqp_0_10_struct_fragment_properties(tvbuff_t *tvb,
+ packet_info *pinfo,
+ proto_tree *tree)
{
- proto_item *map_tree;
- guint8 type;
- guint8 count_len;
- guint32 element_count;
- guint32 element_size;
- struct amqp1_typeinfo* element_type;
- guint32 decoded_element_size;
- guint32 orig_offset;
- const char *value = NULL;
+ proto_item *args_tree;
+ proto_item *flags_item;
+ guint8 flag1, flag2;
+ int flags_offset;
+ int offset = 0;
- map_tree = 0;
- orig_offset = offset;
+ args_tree = proto_item_add_subtree(tree, ett_args);
+ offset += 2; /* Skip class and struct codes */
+ flags_offset = offset;
+ flag1 = tvb_get_guint8(tvb, offset);
+ flag2 = tvb_get_guint8(tvb, offset+1);
+ flags_item = proto_tree_add_item(args_tree,
+ hf_amqp_0_10_argument_packing_flags,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ if ((flag1 & ~0x07) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ offset += 2;
- if (proto_registrar_get_ftype(hf_amqp_type) != FT_NONE)
- {
- expert_add_info_format(pinfo, item, &ei_amqp_unknown_amqp_type,
- "Unexpected map type at frame position %d of field \"%s\"",
- offset,
- name ? name : proto_registrar_get_name(hf_amqp_type));
- return bound-orig_offset;
+ /* First 2 fields are bits */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_struct_fragment_properties_first,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_struct_fragment_properties_last,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ if (flag1 & 0x04) {
+ /* fragment-size (uint64) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_struct_fragment_properties_size,
+ tvb, offset, 8, ENC_BIG_ENDIAN);
+ /* offset += 8; */
+ }
+}
+
+static void
+dissect_amqp_0_10_struct_message_properties(tvbuff_t *tvb,
+ packet_info *pinfo,
+ proto_tree *tree)
+{
+ proto_item *ti;
+ proto_item *frag;
+ proto_item *args_tree;
+ proto_item *flags_item, *subflags_item;
+ guint8 flag1, flag2;
+ guint8 subflag1, subflag2;
+ guint16 len16;
+ guint32 map_length;
+ int offset = 0;
+ tvbuff_t *next_tvb;
+
+ frag = proto_item_add_subtree(tree, ett_args);
+ offset += 2; /* Skip class and struct codes */
+ flag1 = tvb_get_guint8(tvb, offset);
+ flag2 = tvb_get_guint8(tvb, offset+1);
+ flags_item = proto_tree_add_item(frag,
+ hf_amqp_0_10_argument_packing_flags,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ if (flag2 & ~0x01)
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ offset += 2;
+ if (flag1 & 0x01) {
+ /* content-length (uint64) */
+ proto_tree_add_item(frag,
+ hf_amqp_0_10_struct_message_properties_content_len,
+ tvb, offset, 8, ENC_BIG_ENDIAN);
+ offset += 8;
+ }
+ if (flag1 & 0x02) {
+ /* message-id (uuid) */
+ proto_tree_add_item(frag,
+ hf_amqp_0_10_struct_message_properties_message_id,
+ tvb, offset, 16, ENC_BIG_ENDIAN);
+ offset += 16;
+ }
+ if (flag1 & 0x04) {
+ /* correlation-id (vbin16) */
+ proto_tree_add_item(frag,
+ hf_amqp_0_10_struct_message_properties_correlation,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += (2 + tvb_get_ntohs(tvb, offset));
+ }
+ if (flag1 & 0x08) {
+ /* reply-to (reply-to) */
+ /* This is another struct, length 2, packing 2 */
+ len16 = tvb_get_ntohs(tvb, offset);
+ offset += 2;
+ ti = proto_tree_add_item(frag,
+ hf_amqp_0_10_struct_message_properties_reply_to,
+ tvb, offset, len16, ENC_NA);
+ args_tree = proto_item_add_subtree(ti, ett_args);
+ subflags_item = proto_tree_add_item(args_tree,
+ hf_amqp_0_10_argument_packing_flags,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ subflag1 = tvb_get_guint8(tvb, offset);
+ subflag2 = tvb_get_guint8(tvb, offset + 1);
+ if ((subflag1 & ~0x03) || (subflag2 != 0))
+ expert_add_info(pinfo, subflags_item, &ei_amqp_bad_flag_value);
+ offset += 2;
+ if (subflag1 & 0x01) {
+ /* exchange (str8) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_struct_reply_to_exchange,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (subflag1 & 0x02) {
+ /* routing-key (str8) */
+ proto_tree_add_item(args_tree,
+ hf_amqp_0_10_struct_reply_to_routing_key,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
}
-
- type = tvb_get_guint8(tvb, offset);
- AMQP_INCREMENT(offset, 1, bound);
- switch (type) {
- case AMQP_1_0_TYPE_MAP8:
- count_len = 1;
- element_size = tvb_get_guint8(tvb, offset);
- element_count = tvb_get_guint8(tvb, offset+count_len);
- break;
- case AMQP_1_0_TYPE_MAP32:
- count_len = 4;
- element_size = tvb_get_ntohl(tvb, offset);
- element_count = tvb_get_ntohl(tvb, offset+count_len);
- break;
- default:
- proto_tree_add_none_format(map_tree, hf_amqp_1_0_map, tvb,
- offset-1,
- 1,
- "(unknown type %d)",
- type);
- expert_add_info_format(pinfo,
- map_tree,
- &ei_amqp_unknown_amqp_type,
- "Unknown AMQP map type %d",
- type);
- return bound-orig_offset;
+ if (flag1 & 0x10) {
+ /* content-type (str8) */
+ proto_tree_add_item(frag,
+ hf_amqp_0_10_struct_message_properties_content_type,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
}
-
- map_tree = proto_tree_add_none_format(item,
- hf_amqp_type,
- tvb,
- offset-1,
- element_size+1+count_len,
- "%s",
- name ? name : proto_registrar_get_name(hf_amqp_type));
- AMQP_INCREMENT(offset, count_len*2, bound);
-
- if (element_count > 0)
- map_tree = proto_item_add_subtree(map_tree, ett_amqp_1_0_map);
- if (element_count%2==1) {
- expert_add_info_format(pinfo,
- map_tree,
- &ei_amqp_invalid_number_of_params,
- "Odd number of map items: %d",
- element_count);
- return bound-orig_offset;
+ if (flag1 & 0x20) {
+ /* content-encoding (str8) */
+ proto_tree_add_item(frag,
+ hf_amqp_0_10_struct_message_properties_content_encoding,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
}
-
- if (element_count > element_size)
- {
- expert_add_info_format(pinfo,
- map_tree,
- &ei_amqp_invalid_number_of_params,
- "Number of map elements (%d) bigger than map size (%d)",
- element_count, element_size);
- return bound-orig_offset;
+ if (flag1 & 0x40) {
+ /* user-id (vbin16 ) */
+ proto_tree_add_item(frag,
+ hf_amqp_0_10_struct_message_properties_user_id,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += (2 + tvb_get_ntohs(tvb, offset));
}
-
- proto_item_append_text(map_tree,
- " (map of %d element%s)",
- (element_count/2),
- element_suffix[(element_count/2)!=1]);
-
- while (element_count > 0) {
- if (element_count%2 == 0) { /* decode key */
- element_type = decode_fixed_type(tvb_get_guint8(tvb, offset));
- if (element_type)
- {
- decoded_element_size=element_type->formatter(tvb, offset+1, bound, element_type->known_size, &value);
- AMQP_INCREMENT(offset, decoded_element_size+1, bound);
- }
- else
- { /* can't decode key type */
- proto_tree_add_none_format(map_tree, hf_amqp_1_0_map, tvb,
- offset,
- 1,
- "(unknown map key type %d)",
- tvb_get_guint8(tvb, offset));
- expert_add_info_format(pinfo,
- map_tree,
- &ei_amqp_unknown_amqp_type,
- "Unknown AMQP map key type %d",
- tvb_get_guint8(tvb, offset));
- AMQP_INCREMENT(offset, 1, bound);
- }
+ if (flag1 & 0x80) {
+ /* app-id (vbin16 ) */
+ proto_tree_add_item(frag,
+ hf_amqp_0_10_struct_message_properties_app_id,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += (2 + tvb_get_ntohs(tvb, offset));
+ }
+ if (flag2 & 0x01) {
+ /* application-headers (map) */
+ map_length = amqp_0_10_get_32bit_size_new(frag, pinfo, tvb, hf_amqp_0_10_struct_message_properties_application_headers_size, offset);
+ offset += 4;
+ ti = proto_tree_add_item(frag,
+ hf_amqp_0_10_struct_message_properties_application_headers,
+ tvb,
+ offset,
+ map_length, ENC_NA);
+ if (map_length > (guint32)tvb_reported_length_remaining(tvb, offset))
+ {
+ next_tvb = tvb_new_subset_remaining(tvb, offset);
}
- else { /* decode value */
- get_amqp_1_0_type_value_formatter(tvb,
- pinfo,
- offset,
- bound,
- hf_amqp_1_0_list, /* dynamic item */
- value,
- &decoded_element_size,
- map_tree);
- AMQP_INCREMENT(offset, decoded_element_size, bound);
+ else
+ {
+ next_tvb = tvb_new_subset_length(tvb, offset, map_length);
}
- element_count--;
+ dissect_amqp_0_10_map (next_tvb, ti);
+ /* offset += map_length; */
}
- return offset-orig_offset;
}
-/* decodes AMQP 1.0 array
- * arguments: see dissect_amqp_1_0_list
- */
-static guint
-dissect_amqp_1_0_array(tvbuff_t *tvb,
- packet_info *pinfo,
- int offset,
- int bound,
- proto_item *item,
- int hf_amqp_type,
- guint32 hf_amqp_subtype_count,
- const int **hf_amqp_subtypes,
- const char *name)
+static void
+dissect_amqp_0_10_struct_exchange_query_result(tvbuff_t *tvb,
+ packet_info *pinfo,
+ proto_item *tree)
{
- proto_item *array_tree;
- guint8 type;
- guint8 count_len;
- guint32 element_count;
- guint32 element_size;
- guint32 element_type;
- guint32 decoded_element_size;
- guint32 orig_offset;
- guint32 decoded_elements;
- int hf_amqp_item;
- guint32 hf_amqp_subtype_count_array = 0;
- const int **hf_amqp_subtypes_array = NULL;
- const char *type_name_array = NULL;
-
- array_tree = 0;
- decoded_elements = 0;
- orig_offset = offset;
-
- if (proto_registrar_get_ftype(hf_amqp_type) != FT_NONE)
- {
- expert_add_info_format(pinfo, item, &ei_amqp_unknown_amqp_type,
- "Unexpected array type at frame position %d of field \"%s\"",
- offset,
- name ? name : proto_registrar_get_name(hf_amqp_type));
- return bound-orig_offset;
- }
-
- type = tvb_get_guint8(tvb, offset);
- AMQP_INCREMENT(offset, 1, bound);
- switch (type) {
- case AMQP_1_0_TYPE_ARRAY8:
- count_len = 1;
- element_size = tvb_get_guint8(tvb, offset);
- element_count = tvb_get_guint8(tvb, offset+count_len);
- break;
- case AMQP_1_0_TYPE_ARRAY32:
- count_len = 4;
- element_size = tvb_get_ntohl(tvb, offset);
- element_count = tvb_get_ntohl(tvb, offset+count_len);
- break;
- default:
- proto_tree_add_none_format(array_tree, hf_amqp_1_0_list, tvb,
- offset-1,
- 1,
- "(unknown type %d)",
- type);
- expert_add_info_format(pinfo,
- array_tree,
- &ei_amqp_unknown_amqp_type,
- "Unknown AMQP array type %d",
- type);
- return bound-orig_offset;
- }
-
- element_type = get_amqp_1_0_type_formatter(tvb,
- offset+count_len*2,
- bound,
- &hf_amqp_type,
- &type_name_array,
- &hf_amqp_subtype_count_array,
- &hf_amqp_subtypes_array,
- &decoded_element_size);
-
- array_tree = proto_tree_add_none_format(item,
- hf_amqp_type,
- tvb,
- offset-1,
- element_size+1+count_len,
- "%s",
- name ? name : proto_registrar_get_name(hf_amqp_type));
- AMQP_INCREMENT(offset, count_len*2+decoded_element_size, bound);
-
- if (element_count > 0)
- array_tree = proto_item_add_subtree(array_tree, ett_amqp_1_0_array);
- /* display the item count for custom arrays only
- * standard structures contain NULL items, so the real element count is different */
- if (hf_amqp_subtype_count == 0)
- proto_item_append_text(array_tree, " (array of %d element%s)", element_count, element_suffix[element_count!=1]);
+ proto_item *ti;
+ proto_item *result;
+ proto_item *flags_item;
+ guint8 flag1, flag2;
+ guint32 map_length;
+ int flags_offset;
+ int offset = 0;
+ tvbuff_t *next_tvb;
- if (element_count > element_size)
- {
- expert_add_info_format(pinfo,
- array_tree,
- &ei_amqp_invalid_number_of_params,
- "Number of array elements (%d) bigger than array size (%d)",
- element_count, element_size);
- return bound-orig_offset;
+ result = proto_item_add_subtree(tree, ett_args);
+ offset += 2; /* Skip class and struct codes */
+ flags_offset = offset;
+ flag1 = tvb_get_guint8(tvb, offset);
+ flag2 = tvb_get_guint8(tvb, offset+1);
+ flags_item = proto_tree_add_item(result,
+ hf_amqp_0_10_argument_packing_flags,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ if (flag2 & ~0x0f)
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ offset += 2;
+ if (flag1 & 0x01) {
+ /* type (str8) */
+ proto_tree_add_item(result,
+ hf_amqp_0_10_method_exchange_declare_type,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
}
-
- while ((element_count > 0) && (offset < bound)) {
- decoded_element_size = 0;
- if (decoded_elements<hf_amqp_subtype_count)
- hf_amqp_item = *(hf_amqp_subtypes[decoded_elements]);
+ proto_tree_add_item(result,
+ hf_amqp_0_10_struct_exchange_query_result_durable,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(result,
+ hf_amqp_0_10_struct_exchange_query_result_not_found,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ if (flag1 & 0x08) {
+ /* arguments (map) */
+ map_length = amqp_0_10_get_32bit_size_new(result, pinfo, tvb, hf_amqp_0_10_method_exchange_declare_arguments_size, offset);
+ offset += 4;
+ ti = proto_tree_add_item(result,
+ hf_amqp_0_10_method_exchange_declare_arguments,
+ tvb,
+ offset,
+ map_length, ENC_NA);
+ if (map_length > (guint32)tvb_reported_length_remaining(tvb, offset))
+ {
+ next_tvb = tvb_new_subset_remaining(tvb, offset);
+ }
else
- hf_amqp_item = hf_amqp_1_0_list; /* dynamic item */
- get_amqp_1_0_value_formatter(tvb,
- pinfo,
- element_type, /* code */
- offset,
- offset+element_size, /* bound */
- hf_amqp_item,
- (proto_registrar_get_nth(hf_amqp_type))->name, /* name */
- hf_amqp_subtype_count_array, /* subitem list count */
- hf_amqp_subtypes_array, /* subitem list hf_.. list */
- &decoded_element_size,
- array_tree);
- element_count -= 1;
- decoded_elements += 1;
- if (decoded_element_size==0)
- decoded_element_size=1; /* necessary for 0x40 or similar values where value_formatter returns size of _value_ 0 (type=1 not counted) */
- AMQP_INCREMENT(offset, decoded_element_size, bound);
+ {
+ next_tvb = tvb_new_subset_length(tvb, offset, map_length);
+ }
+ dissect_amqp_0_10_map (next_tvb, ti);
+ /* offset += map_length; */
}
- if (element_count > 0)
- expert_add_info_format(pinfo,
- array_tree,
- &ei_amqp_invalid_number_of_params,
- "Number of array elements (%d) not matching number of decoded elements (%d)",
- element_count+decoded_elements, decoded_elements);
- return offset-orig_offset;
}
-/* decodes AMQP 1.0 AMQP performative (open, attach, transfer or so)
- * arguments:
- * tvb, offset, length, amqp_tree, pinfo: obvious
- * method_name: what to print to col_append_str method in dissect_amqp_1_0_frame
- */
-static guint32
-dissect_amqp_1_0_AMQP_frame(tvbuff_t *tvb,
- guint offset,
- guint16 bound,
- proto_item *amqp_tree,
- packet_info *pinfo,
- const gchar **method_name)
+static void
+dissect_amqp_0_10_struct_queue_query_result(tvbuff_t *tvb,
+ packet_info *pinfo,
+ proto_item *tree)
{
- proto_item *args_tree;
- guint32 arg_length = 0;
- guint8 method;
- guint orig_offset = offset;
+ proto_item *ti;
+ proto_item *result;
+ proto_item *flags_item;
+ guint8 flag1, flag2;
+ guint32 map_length;
+ int flags_offset;
+ int offset = 0;
+ tvbuff_t *next_tvb;
- if (bound == offset) { /* empty keepalive sent */
- *method_name = "(empty)";
- return 0;
+ result = proto_item_add_subtree(tree, ett_args);
+ offset += 2; /* Skip class and struct codes */
+ flags_offset = offset;
+ flag1 = tvb_get_guint8(tvb, offset);
+ flag2 = tvb_get_guint8(tvb, offset+1);
+ flags_item = proto_tree_add_item(result,
+ hf_amqp_0_10_argument_packing_flags,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+
+ if (flag2 != 0)
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ offset += 2;
+ if (flag1 & 0x01) {
+ /* queue (name [str8]) */
+ proto_tree_add_item(result,
+ hf_amqp_0_10_method_queue_name,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
}
- args_tree = proto_item_add_subtree(amqp_tree, ett_args);
- method = tvb_get_guint8(tvb, offset+2);
- *method_name = val_to_str_const(method, amqp_1_0_AMQP_performatives,
- "<invalid AMQP performative>");
- proto_tree_add_item(args_tree, hf_amqp_1_0_amqp_performative, tvb, offset+2, 1, ENC_BIG_ENDIAN);
- AMQP_INCREMENT(offset, 3, bound); /* descriptor-constructor & fixed_one length & AMQP performative code */
- switch(method) {
- case AMQP_1_0_AMQP_OPEN:
- arg_length = dissect_amqp_1_0_list(tvb,
- pinfo,
- offset,
- bound,
- args_tree,
- hf_amqp_method_arguments,
- 10, hf_amqp_1_0_amqp_open_items, NULL);
- break;
- case AMQP_1_0_AMQP_BEGIN:
- arg_length = dissect_amqp_1_0_list(tvb,
- pinfo,
- offset,
- bound,
- args_tree,
- hf_amqp_method_arguments,
- 8, hf_amqp_1_0_amqp_begin_items, NULL);
- break;
- case AMQP_1_0_AMQP_ATTACH:
- arg_length = dissect_amqp_1_0_list(tvb,
- pinfo,
- offset,
- bound,
- args_tree,
- hf_amqp_method_arguments,
- 14, hf_amqp_1_0_amqp_attach_items, NULL);
- break;
- case AMQP_1_0_AMQP_FLOW:
- arg_length = dissect_amqp_1_0_list(tvb,
- pinfo,
- offset,
- bound,
- args_tree,
- hf_amqp_method_arguments,
- 11, hf_amqp_1_0_amqp_flow_items, NULL);
- break;
- case AMQP_1_0_AMQP_TRANSFER:
- arg_length = dissect_amqp_1_0_list(tvb,
- pinfo,
- offset,
- bound,
- args_tree,
- hf_amqp_method_arguments,
- 11, hf_amqp_1_0_amqp_transfer_items, NULL);
- /* now decode message header, annotations, properties and data */
- while (offset+arg_length < bound) {
- AMQP_INCREMENT(offset, arg_length, bound);
- get_amqp_1_0_type_value_formatter(tvb,
- pinfo,
- offset,
- bound,
- hf_amqp_1_0_list, /* dynamic item */
- NULL,
- &arg_length,
- args_tree);
- }
- break;
- case AMQP_1_0_AMQP_DISPOSITION:
- arg_length = dissect_amqp_1_0_list(tvb,
- pinfo,
- offset,
- bound,
- args_tree,
- hf_amqp_method_arguments,
- 6, hf_amqp_1_0_amqp_disposition_items, NULL);
- break;
- case AMQP_1_0_AMQP_DETACH:
- arg_length = dissect_amqp_1_0_list(tvb,
- pinfo,
- offset,
- bound,
- args_tree,
- hf_amqp_method_arguments,
- 3, hf_amqp_1_0_amqp_detach_items, NULL);
- break;
- case AMQP_1_0_AMQP_END:
- arg_length = dissect_amqp_1_0_list(tvb,
- pinfo,
- offset,
- bound,
- args_tree,
- hf_amqp_method_arguments,
- 1, hf_amqp_1_0_amqp_end_items, NULL);
- break;
- case AMQP_1_0_AMQP_CLOSE:
- arg_length = dissect_amqp_1_0_list(tvb,
- pinfo,
- offset,
- bound,
- args_tree,
- hf_amqp_method_arguments,
- 1, hf_amqp_1_0_amqp_close_items, NULL);
- break;
- default:
- expert_add_info_format(pinfo,
- amqp_tree,
- &ei_amqp_unknown_amqp_command,
- "Unknown AMQP performative %d",
- tvb_get_guint8(tvb, offset + 2));
- return bound-orig_offset;
+ if (flag1 & 0x02) { /* alternate-exchange (exchange.name [str8]) */
+ proto_tree_add_item(result,
+ hf_amqp_0_10_method_queue_alt_exchange,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ /*
+ * 3rd-5th arguments are optional bits.
+ */
+ proto_tree_add_item(result,
+ hf_amqp_0_10_struct_queue_query_result_durable,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(result,
+ hf_amqp_0_10_struct_queue_query_result_exclusive,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(result,
+ hf_amqp_0_10_struct_queue_query_result_auto_delete,
+ tvb, flags_offset, 1, ENC_BIG_ENDIAN);
+ if (flag1 & 0x20) { /* arguments (map) */
+ map_length = amqp_0_10_get_32bit_size_new(result, pinfo, tvb, hf_amqp_0_10_method_queue_declare_arguments_size, offset);
+ offset += 4;
+ ti = proto_tree_add_item(result,
+ hf_amqp_0_10_method_queue_declare_arguments,
+ tvb,
+ offset,
+ map_length, ENC_NA);
+ if (map_length > (guint32)tvb_reported_length_remaining(tvb, offset))
+ {
+ next_tvb = tvb_new_subset_remaining(tvb, offset);
+ }
+ else
+ {
+ next_tvb = tvb_new_subset_length(tvb, offset, map_length);
+ }
+ dissect_amqp_0_10_map (next_tvb, ti);
+ offset += map_length;
+ }
+ if (flag1 & 0x40) { /* message-count (uint32) */
+ proto_tree_add_item(result,
+ hf_amqp_0_10_struct_queue_query_result_message_count,
+ tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += 4;
+ }
+ if (flag1 & 0x80) { /* subscriber-count (uint32) */
+ proto_tree_add_item(result,
+ hf_amqp_0_10_struct_queue_query_result_subscriber_count,
+ tvb, offset, 4, ENC_BIG_ENDIAN);
+ /* offset += 4; */
}
- return (arg_length) + (offset-orig_offset);
}
-/* decodes AMQP 1.0 SASL methods (mechanisms offer, challenge, response,..)
- * arguments: see dissect_amqp_1_0_AMQP_frame
- */
-static guint32
-dissect_amqp_1_0_SASL_frame(tvbuff_t *tvb,
- guint offset,
- guint16 bound,
- proto_item *amqp_tree,
- packet_info *pinfo,
- const gchar **method_name)
+static void
+dissect_amqp_0_10_struct_file_properties(tvbuff_t *tvb,
+ packet_info *pinfo,
+ proto_tree *tree)
{
- proto_item *args_tree;
- guint32 arg_length = 0;
- guint8 method;
- guint orig_offset = offset;
-
- args_tree = proto_item_add_subtree(amqp_tree, ett_args);
- method = tvb_get_guint8(tvb, offset+2);
- *method_name = val_to_str_const(method, amqp_1_0_SASL_methods,
- "<invalid SASL method>");
- proto_tree_add_item(args_tree, hf_amqp_1_0_sasl_method, tvb, offset+2, 1, ENC_BIG_ENDIAN);
+ proto_item *ti;
+ proto_item *props;
+ proto_item *flags_item;
+ guint8 flag1, flag2;
+ guint32 map_length;
+ guint64 timestamp;
+ int offset = 0;
+ nstime_t tv;
+ tvbuff_t *next_tvb;
- AMQP_INCREMENT(offset, 3, bound); /* descriptor-constructor & fixed_one length & SASL method code */
- switch(method) {
- case AMQP_1_0_SASL_MECHANISMS:
- arg_length = dissect_amqp_1_0_list(tvb,
- pinfo,
- offset,
- bound,
- args_tree,
- hf_amqp_method_arguments,
- 1, hf_amqp_1_0_sasl_mechanisms_items, NULL);
- break;
- case AMQP_1_0_SASL_INIT:
- arg_length = dissect_amqp_1_0_list(tvb,
- pinfo,
- offset,
- bound,
- args_tree,
- hf_amqp_method_arguments,
- 3, hf_amqp_1_0_sasl_init_items, NULL);
- break;
- case AMQP_1_0_SASL_CHALLENGE:
- arg_length = dissect_amqp_1_0_list(tvb,
- pinfo,
- offset,
- bound,
- args_tree,
- hf_amqp_method_arguments,
- 1, hf_amqp_1_0_sasl_challenge_items, NULL);
- break;
- case AMQP_1_0_SASL_RESPONSE:
- arg_length = dissect_amqp_1_0_list(tvb,
- pinfo,
- offset,
- bound,
- args_tree,
- hf_amqp_method_arguments,
- 1, hf_amqp_1_0_sasl_response_items, NULL);
- break;
- case AMQP_1_0_SASL_OUTCOME:
- arg_length = dissect_amqp_1_0_list(tvb,
- pinfo,
- offset,
- bound,
- args_tree,
- hf_amqp_method_arguments,
- 2, hf_amqp_1_0_sasl_outcome_items, NULL);
- break;
- default:
- expert_add_info_format(pinfo,
- amqp_tree,
- &ei_amqp_unknown_sasl_command,
- "Unknown SASL command %d",
- tvb_get_guint8(tvb, offset + 2));
- return bound-orig_offset;
+ props = proto_item_add_subtree(tree, ett_args);
+ offset += 2; /* Skip class and struct codes */
+ flag1 = tvb_get_guint8(tvb, offset);
+ flag2 = tvb_get_guint8(tvb, offset+1);
+ flags_item = proto_tree_add_item(props,
+ hf_amqp_0_10_argument_packing_flags,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ if (flag2 & ~0x01)
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ offset += 2;
+ if (flag1 & 0x01) {
+ /* content-type (str8) */
+ proto_tree_add_item(props,
+ hf_amqp_0_10_struct_file_properties_content_type,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag1 & 0x02) {
+ /* content-encoding (str8) */
+ proto_tree_add_item(props,
+ hf_amqp_0_10_struct_file_properties_content_encoding,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag1 & 0x04) {
+ /* headers (map) */
+ map_length = amqp_0_10_get_32bit_size_new(props, pinfo, tvb, hf_amqp_0_10_struct_file_properties_headers_size, offset);
+ offset += 4;
+ ti = proto_tree_add_item(props,
+ hf_amqp_0_10_struct_file_properties_headers,
+ tvb,
+ offset,
+ map_length, ENC_NA);
+ if (map_length > (guint32)tvb_reported_length_remaining(tvb, offset))
+ {
+ next_tvb = tvb_new_subset_remaining(tvb, offset);
+ }
+ else
+ {
+ next_tvb = tvb_new_subset_length(tvb, offset, map_length);
+ }
+ dissect_amqp_0_10_map (next_tvb, ti);
+ offset += map_length;
+ }
+ if (flag1 & 0x08) {
+ /* priority (uint8) */
+ proto_tree_add_item(props,
+ hf_amqp_0_10_struct_file_properties_priority,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
+ }
+ if (flag1 & 0x10) {
+ /* reply-to (str8) */
+ proto_tree_add_item(props,
+ hf_amqp_0_10_struct_file_properties_reply_to,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag1 & 0x20) {
+ /* message-id (str8) */
+ proto_tree_add_item(props,
+ hf_amqp_0_10_struct_file_properties_message_id,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag1 & 0x40) {
+ /* filename (str8) */
+ proto_tree_add_item(props,
+ hf_amqp_0_10_struct_file_properties_filename,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
+ }
+ if (flag1 & 0x80) {
+ /* timestamp (datetime [uint64]) */
+ timestamp = tvb_get_ntoh64(tvb, offset);
+ tv.secs = (time_t)timestamp;
+ tv.nsecs = 0;
+ proto_tree_add_time(props,
+ hf_amqp_0_10_struct_file_properties_timestamp,
+ tvb, offset, 8, &tv);
+ offset += 8;
+ }
+ if (flag2 & 0x01) {
+ /* cluster-id (str8) */
+ proto_tree_add_item(props,
+ hf_amqp_0_10_struct_file_properties_cluster_id,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ /* offset += (1 + tvb_get_guint8(tvb, offset)); */
}
- return (arg_length) + (offset-orig_offset);
}
-static int
-dissect_amqp_1_0_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
+static void
+dissect_amqp_0_10_struct_stream_properties(tvbuff_t *tvb,
+ packet_info *pinfo,
+ proto_tree *tree)
{
- proto_item *ti = NULL;
- proto_item *amqp_tree = NULL;
- guint8 frame_type;
- guint16 length;
- guint32 arg_length = 0;
- guint offset;
- const gchar *method_name = NULL;
-
- col_clear(pinfo->cinfo, COL_INFO);
-
- /* Heuristic - protocol initialisation frame starts with 'AMQP' followed by 0x0 */
- if (tvb_memeql(tvb, 0, "AMQP", 4) == 0) {
- guint8 proto_major;
- guint8 proto_minor;
- guint8 proto_revision;
- wmem_strbuf_t *strbuf;
-
- proto_major = tvb_get_guint8(tvb, 5);
- proto_minor = tvb_get_guint8(tvb, 6);
- proto_revision = tvb_get_guint8(tvb, 7);
- strbuf = wmem_strbuf_new_label(wmem_packet_scope());
- wmem_strbuf_append_printf(strbuf,
- "Protocol-Header%s %d-%d-%d ",
- (tvb_get_guint8(tvb, 4)==0x2) ? "(TLS)" : "", /* frame type = 2 => TLS */
- proto_major,
- proto_minor,
- proto_revision);
- col_append_str(pinfo->cinfo, COL_INFO, wmem_strbuf_get_str(strbuf));
- col_set_fence(pinfo->cinfo, COL_INFO);
+ proto_item *ti;
+ proto_item *props;
+ proto_item *flags_item;
+ guint8 flag1, flag2;
+ guint32 map_length;
+ guint64 timestamp;
+ int offset = 0;
+ nstime_t tv;
+ tvbuff_t *next_tvb;
- if (tree) {
- ti = proto_tree_add_item(tree, proto_amqp, tvb, 0, -1, ENC_NA);
- amqp_tree = proto_item_add_subtree(ti, ett_amqp_init);
- proto_tree_add_item(amqp_tree, hf_amqp_init_protocol, tvb, 0, 4, ENC_ASCII|ENC_NA);
- proto_tree_add_item(amqp_tree, hf_amqp_init_id, tvb, 4, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(amqp_tree, hf_amqp_init_version_major, tvb, 5, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(amqp_tree, hf_amqp_init_version_minor, tvb, 6, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(amqp_tree, hf_amqp_init_version_revision, tvb, 7, 1, ENC_BIG_ENDIAN);
- }
- return 8;
+ props = proto_item_add_subtree(tree, ett_args);
+ offset += 2; /* Skip class and struct codes */
+ flag1 = tvb_get_guint8(tvb, offset);
+ flag2 = tvb_get_guint8(tvb, offset+1);
+ flags_item = proto_tree_add_item(props,
+ hf_amqp_0_10_argument_packing_flags,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ if ((flag1 & ~0x1f) || (flag2 != 0))
+ expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
+ offset += 2;
+ if (flag1 & 0x01) {
+ /* content-type (str8) */
+ proto_tree_add_item(props,
+ hf_amqp_0_10_struct_stream_properties_content_type,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
}
-
- /* Protocol frame */
- if (tree) {
- /* frame header */
- ti = proto_tree_add_item(tree, proto_amqp, tvb, 0, -1, ENC_NA);
- amqp_tree = proto_item_add_subtree(ti, ett_amqp);
- proto_tree_add_item(amqp_tree, hf_amqp_1_0_size, tvb, 0, 4, ENC_BIG_ENDIAN);
- proto_tree_add_item(amqp_tree, hf_amqp_1_0_doff, tvb, 4, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(amqp_tree, hf_amqp_1_0_type, tvb, 5, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(amqp_tree, hf_amqp_channel, tvb, 6, 2, ENC_BIG_ENDIAN);
+ if (flag1 & 0x02) {
+ /* content-encoding (str8) */
+ proto_tree_add_item(props,
+ hf_amqp_0_10_struct_stream_properties_content_encoding,
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
}
-
- /* XXX: The original code used only the low-order 16 bits of the 32 bit length
- * field from the PDU as the length to dissect */
- {
- guint length32;
- length32 = tvb_get_ntohl(tvb, 0);
- length = (length32 < 0x10000U) ? length32 : 0xFFFFU;
- if (length32 > length) {
- expert_add_info(pinfo, ti, &ei_amqp_amqp_1_0_frame_length_exceeds_65K);
+ if (flag1 & 0x04) {
+ /* headers (map) */
+ map_length = amqp_0_10_get_32bit_size_new(props, pinfo, tvb, hf_amqp_0_10_struct_stream_properties_headers_size, offset);
+ offset += 4;
+ ti = proto_tree_add_item(props,
+ hf_amqp_0_10_struct_stream_properties_headers,
+ tvb,
+ offset,
+ map_length, ENC_NA);
+ if (map_length > (guint32)tvb_reported_length_remaining(tvb, offset))
+ {
+ next_tvb = tvb_new_subset_remaining(tvb, offset);
+ }
+ else
+ {
+ next_tvb = tvb_new_subset_length(tvb, offset, map_length);
}
+ dissect_amqp_0_10_map (next_tvb, ti);
+ offset += map_length;
}
-
- offset = 4*tvb_get_guint8(tvb,4); /* i.e. 4*DOFF */
- frame_type = tvb_get_guint8(tvb, 5);
- THROW_ON((length < offset), ReportedBoundsError);
-
- switch(frame_type) {
- case AMQP_1_0_AMQP_FRAME:
- arg_length = dissect_amqp_1_0_AMQP_frame(tvb, offset, length, amqp_tree, pinfo, &method_name);
- break;
- case AMQP_1_0_SASL_FRAME:
- arg_length = dissect_amqp_1_0_SASL_frame(tvb, offset, length, amqp_tree, pinfo, &method_name);
- break;
- case AMQP_1_0_TLS_FRAME:
- /* should not occur, this is handled in '(tvb_memeql(tvb, 0, "AMQP", 4) == 0)' test above */
- break;
- default:
- expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_frame_type, "Unknown frame type %d", frame_type);
+ if (flag1 & 0x08) {
+ /* priority (uint8) */
+ proto_tree_add_item(props,
+ hf_amqp_0_10_struct_stream_properties_priority,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
+ }
+ if (flag1 & 0x10) {
+ /* timestamp (datetime [uint64]) */
+ timestamp = tvb_get_ntoh64(tvb, offset);
+ tv.secs = (time_t)timestamp;
+ tv.nsecs = 0;
+ proto_tree_add_time(props,
+ hf_amqp_0_10_struct_stream_properties_timestamp,
+ tvb, offset, 8, &tv);
+ /* offset += 8; */
}
- AMQP_INCREMENT(offset, arg_length, length);
- col_append_str(pinfo->cinfo, COL_INFO, method_name);
- col_append_str(pinfo->cinfo, COL_INFO, " ");
- col_set_fence(pinfo->cinfo, COL_INFO);
- return tvb_reported_length(tvb);
}
-static int
-dissect_amqp_0_10_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
+static void
+dissect_amqp_0_10_struct32(tvbuff_t *tvb,
+ packet_info *pinfo,
+ proto_item *ti)
{
- proto_item *ti;
- proto_item *amqp_tree = NULL;
- guint8 frame_type;
- guint16 length;
- guint32 struct_length;
- guint offset;
-
- /* Heuristic - protocol initialisation frame starts with 'AMQP' */
- if (tvb_memeql(tvb, 0, "AMQP", 4) == 0) {
- guint8 proto_major;
- guint8 proto_minor;
- wmem_strbuf_t *strbuf;
-
- proto_major = tvb_get_guint8(tvb, 6);
- proto_minor = tvb_get_guint8(tvb, 7);
- strbuf = wmem_strbuf_new_label(wmem_packet_scope());
- wmem_strbuf_append_printf(strbuf,
- "Protocol-Header %d-%d ",
- proto_major,
- proto_minor);
- col_append_str(pinfo->cinfo, COL_INFO, wmem_strbuf_get_str(strbuf));
- col_set_fence(pinfo->cinfo, COL_INFO);
-
- if (tree) {
- ti = proto_tree_add_item(tree, proto_amqp, tvb, 0, -1, ENC_NA);
- amqp_tree = proto_item_add_subtree(ti, ett_amqp_init);
- proto_tree_add_item(amqp_tree, hf_amqp_init_protocol, tvb, 0, 4, ENC_ASCII|ENC_NA);
- proto_tree_add_item(amqp_tree, hf_amqp_init_id_major, tvb, 4, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(amqp_tree, hf_amqp_init_id_minor, tvb, 5, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(amqp_tree, hf_amqp_init_version_major, tvb, 6, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(amqp_tree, hf_amqp_init_version_minor, tvb, 7, 1, ENC_BIG_ENDIAN);
- }
- return 8;
- }
+ guint32 class_code, struct_code;
+ guint8 flag1;
+ guint16 size;
+ proto_item *ti2, *result;
+ proto_tree *tree;
+ int offset = 0;
- /* Protocol frame */
- if (tree) {
- ti = proto_tree_add_item(tree, proto_amqp, tvb, 0, -1, ENC_NA);
- amqp_tree = proto_item_add_subtree(ti, ett_amqp);
- proto_tree_add_item(amqp_tree, hf_amqp_0_10_format, tvb, 0, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(amqp_tree, hf_amqp_0_10_position, tvb, 0, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(amqp_tree, hf_amqp_0_10_type, tvb, 1, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(amqp_tree, hf_amqp_0_10_size, tvb, 2, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(amqp_tree, hf_amqp_0_10_track, tvb, 5, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(amqp_tree, hf_amqp_channel, tvb, 6, 2, ENC_BIG_ENDIAN);
- }
+ tree = proto_item_add_subtree(ti, ett_args);
- frame_type = tvb_get_guint8(tvb, 1);
- length = tvb_get_ntohs(tvb, 2);
- offset = 12;
- THROW_ON((length <= 13), ReportedBoundsError);
+ proto_tree_add_item_ret_uint(tree, hf_amqp_0_10_struct32_class, tvb, offset, 1, ENC_NA, &class_code);
+ proto_tree_add_item_ret_uint(tree, hf_amqp_0_10_struct32_struct, tvb, offset+1, 1, ENC_NA, &struct_code);
- switch(frame_type) {
- case AMQP_0_10_FRAME_COMMAND:
- /* Fall through */
- case AMQP_0_10_FRAME_CONTROL:
- proto_tree_add_item(amqp_tree, hf_amqp_0_10_class, tvb, offset+0, 1, ENC_BIG_ENDIAN);
- switch(tvb_get_guint8(tvb, offset + 0)) {
- case AMQP_0_10_CLASS_CONNECTION:
- dissect_amqp_0_10_connection(tvb, pinfo, amqp_tree,
- offset, length);
- break;
- case AMQP_0_10_CLASS_SESSION:
- dissect_amqp_0_10_session(tvb, pinfo, amqp_tree,
- offset, length);
- break;
- case AMQP_0_10_CLASS_EXECUTION:
- dissect_amqp_0_10_execution(tvb, pinfo, amqp_tree,
- offset, length);
- break;
- case AMQP_0_10_CLASS_MESSAGE:
- dissect_amqp_0_10_message(tvb, pinfo, amqp_tree,
- offset, length);
+ switch(class_code) {
+ case AMQP_0_10_CLASS_MESSAGE:
+ switch (struct_code) {
+ case AMQP_0_10_STRUCT_MESSAGE_DELIVERY_PROPERTIES:
+ dissect_amqp_0_10_struct_delivery_properties(tvb,
+ pinfo,
+ tree);
break;
- case AMQP_0_10_CLASS_TX:
- dissect_amqp_0_10_tx(tvb, pinfo, amqp_tree,
- offset, length);
+ case AMQP_0_10_STRUCT_MESSAGE_FRAGMENT_PROPERTIES:
+ dissect_amqp_0_10_struct_fragment_properties(tvb,
+ pinfo,
+ tree);
break;
- case AMQP_0_10_CLASS_DTX:
- dissect_amqp_0_10_dtx(tvb, pinfo, amqp_tree,
- offset, length);
+ case AMQP_0_10_STRUCT_MESSAGE_MESSAGE_PROPERTIES:
+ dissect_amqp_0_10_struct_message_properties(tvb,
+ pinfo,
+ tree);
break;
- case AMQP_0_10_CLASS_EXCHANGE:
- dissect_amqp_0_10_exchange(tvb, pinfo, amqp_tree,
- offset, length);
+ case AMQP_0_10_STRUCT_MESSAGE_ACQUIRED:
+ result = proto_item_add_subtree(tree, ett_args);
+ offset += 2; /* Class/type codes */
+ flag1 = tvb_get_guint8(tvb, offset);
+ proto_tree_add_item(result, hf_amqp_0_10_argument_packing_flags,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += 2;
+ if (flag1 & 0x01) {
+ /* transfers (commands [sequence-set]) */
+ size = tvb_get_ntohs(tvb, offset);
+ ti2 = proto_tree_add_item(result,
+ hf_amqp_0_10_struct_acquired_transfers,
+ tvb, offset, size + 2, ENC_NA);
+ format_amqp_0_10_sequence_set(tvb, offset + 2, size, ti2);
+ }
break;
- case AMQP_0_10_CLASS_QUEUE:
- dissect_amqp_0_10_queue(tvb, pinfo, amqp_tree,
- offset, length);
+ case AMQP_0_10_STRUCT_MESSAGE_RESUME_RESULT:
+ result = proto_item_add_subtree(tree, ett_args);
+ offset += 2; /* Class/type codes */
+ flag1 = tvb_get_guint8(tvb, offset);
+ proto_tree_add_item(result, hf_amqp_0_10_argument_packing_flags,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ offset += 2;
+ if (flag1 & 0x01) {
+ /* offset (uint64) */
+ proto_tree_add_item(result,
+ hf_amqp_0_10_struct_resume_result_offset,
+ tvb, offset, 8, ENC_BIG_ENDIAN);
+ }
break;
- case AMQP_0_10_CLASS_FILE:
- dissect_amqp_0_10_file(tvb, pinfo, amqp_tree,
- offset, length);
+ }
+ break;
+
+ case AMQP_0_10_CLASS_DTX:
+ switch (struct_code) {
+ case AMQP_0_10_STRUCT_DTX_XA_RESULT:
+ offset += 2; /* Class/type codes */
+ /*flag1 = tvb_get_guint8(tvb, offset);*/
+ proto_tree_add_item(tree, hf_amqp_0_10_struct32_padding, tvb, offset, 2, ENC_NA);
+ offset += 2;
+ proto_tree_add_item(tree, hf_amqp_0_10_dtx_xa_status, tvb, offset, 2, ENC_BIG_ENDIAN);
break;
- case AMQP_0_10_CLASS_STREAM:
- dissect_amqp_0_10_stream(tvb, pinfo, amqp_tree,
- offset, length);
+
+ case AMQP_0_10_STRUCT_DTX_RECOVER_RESULT:
+ offset += 2; /* Class/type codes */
+ proto_tree_add_item(tree, hf_amqp_0_10_struct32_padding, tvb, offset, 2, ENC_NA);
+ offset += 2;
+ amqp_0_10_get_32bit_size_new(tree, pinfo, tvb, hf_amqp_0_10_struct_dtx_recover_result_size, offset);
+ offset += 4;
+ dissect_amqp_0_10_array(tvb,
+ pinfo,
+ offset,
+ tree);
break;
- default:
- expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_command_class, "Unknown command/control class %d", tvb_get_guint8(tvb, offset + 0));
}
break;
- case AMQP_0_10_FRAME_HEADER:
- col_append_str(pinfo->cinfo, COL_INFO, "header ");
- col_set_fence(pinfo->cinfo, COL_INFO);
- do {
- struct_length = amqp_0_10_get_32bit_size(tvb, offset);
- AMQP_INCREMENT(offset, 4, length);
+ case AMQP_0_10_CLASS_EXCHANGE:
+ switch (struct_code) {
+ case AMQP_0_10_STRUCT_EXCHANGE_QUERY_RESULT:
+ dissect_amqp_0_10_struct_exchange_query_result(tvb,
+ pinfo,
+ tree);
+ break;
- ti = proto_tree_add_item(amqp_tree,
- hf_amqp_0_10_undissected_struct32,
- tvb, offset, struct_length, ENC_NA);
- dissect_amqp_0_10_struct32(tvb, pinfo, ti, offset, struct_length);
- AMQP_INCREMENT(offset, struct_length, length);
- } while (offset < length);
+ case AMQP_0_10_STRUCT_EXCHANGE_BOUND_RESULT:
+ result = proto_item_add_subtree(tree, ett_args);
+ offset += 2; /* Class/type codes */
+ proto_tree_add_item(result,
+ hf_amqp_0_10_struct_exchange_bound_result_exchange_not_found,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(result,
+ hf_amqp_0_10_struct_exchange_bound_result_queue_not_found,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(result,
+ hf_amqp_0_10_struct_exchange_bound_result_queue_not_matched,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(result,
+ hf_amqp_0_10_struct_exchange_bound_result_key_not_matched,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(result,
+ hf_amqp_0_10_struct_exchange_bound_result_args_not_matched,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ break;
+ }
break;
- case AMQP_0_10_FRAME_BODY:
- col_append_str(pinfo->cinfo, COL_INFO, "message-body ");
- col_set_fence(pinfo->cinfo, COL_INFO);
- proto_tree_add_item(amqp_tree,
- hf_amqp_0_10_message_body,
- tvb, offset, length - 12, ENC_NA);
+ case AMQP_0_10_CLASS_QUEUE:
+ switch (struct_code) {
+ case AMQP_0_10_STRUCT_QUEUE_QUERY_RESULT:
+ dissect_amqp_0_10_struct_queue_query_result(tvb, pinfo, tree);
+ break;
+ }
break;
- default:
- expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_frame_type, "Unknown frame type %d", frame_type);
- }
+ case AMQP_0_10_CLASS_FILE:
+ switch (struct_code) {
+ case AMQP_0_10_STRUCT_FILE_PROPERTIES:
+ dissect_amqp_0_10_struct_file_properties(tvb, pinfo, tree);
+ break;
+ }
+ break;
- return tvb_reported_length(tvb);
+ case AMQP_0_10_CLASS_STREAM:
+ switch (struct_code) {
+ case AMQP_0_10_STRUCT_STREAM_PROPERTIES:
+ dissect_amqp_0_10_struct_stream_properties(tvb, pinfo, tree);
+ break;
+ }
+ break;
+ }
}
-/* Dissection routine for AMQP 0-9 frames */
-
-static int
-dissect_amqp_0_9_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
+/* decodes AMQP 1.0 list
+ * arguments:
+ * tvb: obvious
+ * pinfo: obvious
+ * offset: obvious
+ * bound: boundary within that the list has to end
+ * item: obvious
+ * hf_amqp_type: what hf_* type is the list itself
+ * hf_amqp_subtype_count: length of hf_amqp_subtypes
+ * hf_amqp_subtypes: what hf_* types are the list items
+ * name: what to show for unformatted content
+ */
+static guint
+dissect_amqp_1_0_list(tvbuff_t *tvb,
+ packet_info *pinfo,
+ int offset,
+ proto_item *item,
+ int hf_amqp_type,
+ guint32 hf_amqp_subtype_count,
+ const int **hf_amqp_subtypes,
+ const char *name)
{
- proto_item *ti;
- proto_item *amqp_tree = NULL;
- proto_item *args_tree;
- proto_item *prop_tree;
- guint length;
- guint8 frame_type;
- guint16 channel_num, class_id, method_id;
-
- /* Heuristic - protocol initialisation frame starts with 'AMQP' */
- if (tvb_memeql(tvb, 0, "AMQP", 4) == 0) {
- guint8 proto_id, proto_major, proto_minor;
- wmem_strbuf_t *strbuf;
-
- proto_id = tvb_get_guint8(tvb, 5);
- proto_major = tvb_get_guint8(tvb, 6);
- proto_minor = tvb_get_guint8(tvb, 7);
- strbuf = wmem_strbuf_new_label(wmem_packet_scope());
- wmem_strbuf_append_printf(strbuf,
- "Protocol-Header %u-%u-%u",
- proto_id,
- proto_major,
- proto_minor);
- col_append_str(pinfo->cinfo, COL_INFO, wmem_strbuf_get_str(strbuf));
- col_set_fence(pinfo->cinfo, COL_INFO);
+ proto_item *list_tree;
+ guint8 type;
+ guint8 count_len;
+ guint32 i, element_count;
+ guint32 element_size;
+ guint32 decoded_element_size;
+ guint32 orig_offset;
+ guint32 decoded_elements;
+ int hf_amqp_item;
- if (tree) {
- ti = proto_tree_add_item(tree, proto_amqp, tvb, 0, -1, ENC_NA);
- amqp_tree = proto_item_add_subtree(ti, ett_amqp_init);
- proto_tree_add_item(amqp_tree, hf_amqp_init_protocol, tvb, 0, 4, ENC_ASCII|ENC_NA);
- proto_tree_add_item(amqp_tree, hf_amqp_init_id_major, tvb, 4, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(amqp_tree, hf_amqp_init_id_minor, tvb, 5, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(amqp_tree, hf_amqp_init_version_major, tvb, 6, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(amqp_tree, hf_amqp_init_version_minor, tvb, 7, 1, ENC_BIG_ENDIAN);
- }
- return 8;
- }
+ list_tree = 0;
+ decoded_elements = 0;
+ orig_offset = offset;
- if (tree) {
- ti = proto_tree_add_item(tree, proto_amqp, tvb, 0, -1, ENC_NA);
- amqp_tree = proto_item_add_subtree(ti, ett_amqp);
- proto_tree_add_item(amqp_tree, hf_amqp_0_9_type, tvb, 0, 1, ENC_BIG_ENDIAN);
- proto_tree_add_item(amqp_tree, hf_amqp_channel, tvb, 1, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(amqp_tree, hf_amqp_0_9_length, tvb, 3, 4, ENC_BIG_ENDIAN);
+ type = tvb_get_guint8(tvb, offset);
+ offset += 1;
+ switch (type) {
+ case AMQP_1_0_TYPE_LIST0:
+ count_len = 0;
+ element_size = 0;
+ element_count = 0;
+ break;
+ case AMQP_1_0_TYPE_LIST8:
+ count_len = 1;
+ element_size = tvb_get_guint8(tvb, offset);
+ element_count = tvb_get_guint8(tvb, offset+count_len);
+ break;
+ case AMQP_1_0_TYPE_LIST32:
+ count_len = 4;
+ element_size = tvb_get_ntohl(tvb, offset);
+ element_count = tvb_get_ntohl(tvb, offset+count_len);
+ break;
+ default:
+ proto_tree_add_none_format(list_tree, hf_amqp_1_0_list, tvb,
+ offset-1,
+ 1,
+ "(unknown type %d)",
+ type);
+ expert_add_info_format(pinfo,
+ list_tree,
+ &ei_amqp_unknown_amqp_type,
+ "Unknown AMQP list type %d",
+ type);
+ return 0;
}
- frame_type = tvb_get_guint8(tvb, 0);
- channel_num = tvb_get_ntohs(tvb, 1);
- length = tvb_get_ntohl(tvb, 3);
+ list_tree = proto_tree_add_none_format(item,
+ hf_amqp_type,
+ tvb,
+ offset-1,
+ element_size+1+count_len,
+ "%s",
+ name ? name : proto_registrar_get_name(hf_amqp_type));
+ offset += (count_len*2);
- switch (frame_type) {
- case AMQP_0_9_FRAME_TYPE_METHOD:
- class_id = tvb_get_ntohs(tvb, 7);
- proto_tree_add_item(amqp_tree, hf_amqp_0_9_method_class_id,
- tvb, 7, 2, ENC_BIG_ENDIAN);
- switch (class_id) {
- case AMQP_0_9_CLASS_CONNECTION:
- method_id = tvb_get_ntohs(tvb, 9);
- proto_tree_add_item(amqp_tree, hf_amqp_method_connection_method_id,
- tvb, 9, 2, ENC_BIG_ENDIAN);
- ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
- tvb, 11, length - 4, ENC_NA);
- args_tree = proto_item_add_subtree(ti, ett_args);
- col_append_fstr(pinfo->cinfo, COL_INFO, "Connection.%s ",
- val_to_str( method_id, amqp_method_connection_methods, "Unknown (%u)"));
- switch (method_id) {
- case AMQP_0_9_METHOD_CONNECTION_START:
- dissect_amqp_0_9_method_connection_start(tvb,
- pinfo, 11, args_tree);
- break;
- case AMQP_0_9_METHOD_CONNECTION_START_OK:
- dissect_amqp_0_9_method_connection_start_ok(tvb,
- pinfo, 11, args_tree);
- break;
- case AMQP_0_9_METHOD_CONNECTION_SECURE:
- dissect_amqp_0_9_method_connection_secure(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_CONNECTION_SECURE_OK:
- dissect_amqp_0_9_method_connection_secure_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_CONNECTION_TUNE:
- dissect_amqp_0_9_method_connection_tune(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_CONNECTION_TUNE_OK:
- dissect_amqp_0_9_method_connection_tune_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_CONNECTION_OPEN:
- dissect_amqp_0_9_method_connection_open(tvb,
- pinfo, 11, args_tree);
- break;
- case AMQP_0_9_METHOD_CONNECTION_OPEN_OK:
- dissect_amqp_0_9_method_connection_open_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_CONNECTION_REDIRECT:
- dissect_amqp_0_9_method_connection_redirect(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_CONNECTION_CLOSE:
- dissect_amqp_0_9_method_connection_close(tvb,
- pinfo, 11, args_tree);
- break;
- case AMQP_0_9_METHOD_CONNECTION_CLOSE_OK:
- dissect_amqp_0_9_method_connection_close_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_CONNECTION_BLOCKED:
- dissect_amqp_0_9_method_connection_blocked(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_CONNECTION_UNBLOCKED:
- dissect_amqp_0_9_method_connection_unblocked(tvb,
- 11, args_tree);
- break;
- default:
- expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_connection_method, "Unknown connection method %u", method_id);
- }
- break;
- case AMQP_0_9_CLASS_CHANNEL:
- method_id = tvb_get_ntohs(tvb, 9);
- proto_tree_add_item(amqp_tree, hf_amqp_method_channel_method_id,
- tvb, 9, 2, ENC_BIG_ENDIAN);
- ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
- tvb, 11, length - 4, ENC_NA);
- args_tree = proto_item_add_subtree(ti, ett_args);
+ if (element_count > 0)
+ list_tree = proto_item_add_subtree(list_tree, ett_amqp_1_0_list);
+ /* display the item count for custom lists only
+ * standard structures contain NULL items, so the real element count is different */
+ if (hf_amqp_subtype_count == 0)
+ proto_item_append_text(list_tree, " (list of %d element%s)", element_count, plurality(element_count, "", "s"));
- col_append_fstr(pinfo->cinfo, COL_INFO, "Channel.%s ",
- val_to_str( method_id, amqp_method_channel_methods, "Unknown (%u)"));
+ if (element_count > element_size)
+ {
+ expert_add_info_format(pinfo,
+ list_tree,
+ &ei_amqp_invalid_number_of_params,
+ "Number of list elements (%d) bigger than list size (%d)",
+ element_count, element_size);
+ return 0;
+ }
- switch (method_id) {
- case AMQP_0_9_METHOD_CHANNEL_OPEN:
- dissect_amqp_0_9_method_channel_open(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_CHANNEL_OPEN_OK:
- dissect_amqp_0_9_method_channel_open_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_CHANNEL_FLOW:
- dissect_amqp_0_9_method_channel_flow(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_CHANNEL_FLOW_OK:
- dissect_amqp_0_9_method_channel_flow_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_CHANNEL_CLOSE:
- dissect_amqp_0_9_method_channel_close(channel_num, tvb,
- pinfo, 11, args_tree);
- break;
- case AMQP_0_9_METHOD_CHANNEL_CLOSE_OK:
- dissect_amqp_0_9_method_channel_close_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_CHANNEL_RESUME:
- dissect_amqp_0_9_method_channel_resume(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_CHANNEL_PING:
- dissect_amqp_0_9_method_channel_ping(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_CHANNEL_PONG:
- dissect_amqp_0_9_method_channel_pong(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_CHANNEL_OK:
- dissect_amqp_0_9_method_channel_ok(tvb,
- 11, args_tree);
- break;
- default:
- expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_channel_method, "Unknown channel method %u", method_id);
- }
- break;
- case AMQP_0_9_CLASS_ACCESS:
- method_id = tvb_get_ntohs(tvb, 9);
- proto_tree_add_item(amqp_tree, hf_amqp_method_access_method_id,
- tvb, 9, 2, ENC_BIG_ENDIAN);
- ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
- tvb, 11, length - 4, ENC_NA);
- args_tree = proto_item_add_subtree(ti, ett_args);
- switch (method_id) {
- case AMQP_0_9_METHOD_ACCESS_REQUEST:
- dissect_amqp_0_9_method_access_request(tvb,
- 11, args_tree);
- col_append_str(pinfo->cinfo, COL_INFO,
- "Access.Request ");
- break;
- case AMQP_0_9_METHOD_ACCESS_REQUEST_OK:
- dissect_amqp_0_9_method_access_request_ok(tvb,
- 11, args_tree);
- col_append_str(pinfo->cinfo, COL_INFO,
- "Access.Request-Ok ");
- break;
- default:
- expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_access_method, "Unknown access method %u", method_id);
- }
- break;
- case AMQP_0_9_CLASS_EXCHANGE:
- method_id = tvb_get_ntohs(tvb, 9);
- proto_tree_add_item(amqp_tree, hf_amqp_method_exchange_method_id,
- tvb, 9, 2, ENC_BIG_ENDIAN);
- ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
- tvb, 11, length - 4, ENC_NA);
- args_tree = proto_item_add_subtree(ti, ett_args);
- col_append_fstr(pinfo->cinfo, COL_INFO, "Exchange.%s ",
- val_to_str( method_id, amqp_method_exchange_methods, "Unknown (%u)"));
- switch (method_id) {
- case AMQP_0_9_METHOD_EXCHANGE_DECLARE:
- dissect_amqp_0_9_method_exchange_declare(tvb,
- pinfo, 11, args_tree);
- break;
- case AMQP_0_9_METHOD_EXCHANGE_DECLARE_OK:
- dissect_amqp_0_9_method_exchange_declare_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_EXCHANGE_BIND:
- dissect_amqp_0_9_method_exchange_bind(tvb,
- pinfo, 11, args_tree);
- break;
- case AMQP_0_9_METHOD_EXCHANGE_BIND_OK:
- dissect_amqp_0_9_method_exchange_bind_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_EXCHANGE_DELETE:
- dissect_amqp_0_9_method_exchange_delete(tvb,
- pinfo, 11, args_tree);
- break;
- case AMQP_0_9_METHOD_EXCHANGE_DELETE_OK:
- dissect_amqp_0_9_method_exchange_delete_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_EXCHANGE_UNBIND:
- /* the same parameters as in bind */
- dissect_amqp_0_9_method_exchange_bind(tvb,
- pinfo, 11, args_tree);
- break;
- case AMQP_0_9_METHOD_EXCHANGE_UNBIND_OK:
- /* the same parameters as in bind-ok */
- dissect_amqp_0_9_method_exchange_bind_ok(tvb,
- 11, args_tree);
- break;
- default:
- expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_exchange_method, "Unknown exchange method %u", method_id);
- }
- break;
- case AMQP_0_9_CLASS_QUEUE:
- method_id = tvb_get_ntohs(tvb, 9);
- proto_tree_add_item(amqp_tree, hf_amqp_method_queue_method_id,
- tvb, 9, 2, ENC_BIG_ENDIAN);
- ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
- tvb, 11, length - 4, ENC_NA);
- args_tree = proto_item_add_subtree(ti, ett_args);
- col_append_fstr(pinfo->cinfo, COL_INFO, "Queue.%s ",
- val_to_str( method_id, amqp_method_queue_methods, "Unknown (%u)"));
+ for (i = 0; ((i < element_count) && (tvb_reported_length_remaining(tvb, offset) > 0)); i++) {
+ decoded_element_size = 0;
+ if (decoded_elements<hf_amqp_subtype_count)
+ hf_amqp_item = *(hf_amqp_subtypes[decoded_elements]);
+ else
+ hf_amqp_item = hf_amqp_1_0_list; /* dynamic item */
+ get_amqp_1_0_type_value_formatter(tvb,
+ pinfo,
+ offset,
+ hf_amqp_item,
+ NULL,
+ &decoded_element_size,
+ list_tree);
+ decoded_elements += 1;
+ offset += decoded_element_size;
+ }
+ if (i != element_count)
+ expert_add_info_format(pinfo,
+ list_tree,
+ &ei_amqp_invalid_number_of_params,
+ "Number of list elements (%d) not matching number of decoded elements (%d)",
+ element_count+decoded_elements, decoded_elements);
+ return offset-orig_offset;
+}
- switch (method_id) {
- case AMQP_0_9_METHOD_QUEUE_DECLARE:
- dissect_amqp_0_9_method_queue_declare(tvb,
- pinfo, 11, args_tree);
- break;
- case AMQP_0_9_METHOD_QUEUE_DECLARE_OK:
- dissect_amqp_0_9_method_queue_declare_ok(tvb,
- pinfo, 11, args_tree);
- break;
- case AMQP_0_9_METHOD_QUEUE_BIND:
- dissect_amqp_0_9_method_queue_bind(tvb,
- pinfo, 11, args_tree);
- break;
- case AMQP_0_9_METHOD_QUEUE_BIND_OK:
- dissect_amqp_0_9_method_queue_bind_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_QUEUE_UNBIND:
- dissect_amqp_0_9_method_queue_unbind(tvb,
- pinfo, 11, args_tree);
- break;
- case AMQP_0_9_METHOD_QUEUE_UNBIND_OK:
- dissect_amqp_0_9_method_queue_unbind_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_QUEUE_PURGE:
- dissect_amqp_0_9_method_queue_purge(tvb,
- pinfo, 11, args_tree);
- break;
- case AMQP_0_9_METHOD_QUEUE_PURGE_OK:
- dissect_amqp_0_9_method_queue_purge_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_QUEUE_DELETE:
- dissect_amqp_0_9_method_queue_delete(tvb,
- pinfo, 11, args_tree);
- break;
- case AMQP_0_9_METHOD_QUEUE_DELETE_OK:
- dissect_amqp_0_9_method_queue_delete_ok(tvb,
- 11, args_tree);
- break;
- default:
- expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_queue_method, "Unknown queue method %u", method_id);
+/* decodes AMQP 1.0 map
+ * arguments: see dissect_amqp_1_0_list
+ */
+static guint
+dissect_amqp_1_0_map(tvbuff_t *tvb,
+ packet_info *pinfo,
+ int offset,
+ proto_item *item,
+ int hf_amqp_type,
+ const char *name)
+{
+ proto_item *map_tree;
+ guint8 type;
+ guint8 count_len;
+ guint32 element_count;
+ guint32 element_size;
+ struct amqp1_typeinfo* element_type;
+ guint32 decoded_element_size;
+ guint32 orig_offset;
+ const char *value = NULL;
+
+ map_tree = 0;
+ orig_offset = offset;
+
+ type = tvb_get_guint8(tvb, offset);
+ offset += 1;
+ switch (type) {
+ case AMQP_1_0_TYPE_MAP8:
+ count_len = 1;
+ element_size = tvb_get_guint8(tvb, offset);
+ element_count = tvb_get_guint8(tvb, offset+count_len);
+ break;
+ case AMQP_1_0_TYPE_MAP32:
+ count_len = 4;
+ element_size = tvb_get_ntohl(tvb, offset);
+ element_count = tvb_get_ntohl(tvb, offset+count_len);
+ break;
+ default:
+ proto_tree_add_none_format(map_tree, hf_amqp_1_0_map, tvb,
+ offset-1,
+ 1,
+ "(unknown type %d)",
+ type);
+ expert_add_info_format(pinfo,
+ map_tree,
+ &ei_amqp_unknown_amqp_type,
+ "Unknown AMQP map type %d",
+ type);
+ return tvb_reported_length_remaining(tvb, orig_offset);
+ }
+
+ map_tree = proto_tree_add_none_format(item,
+ hf_amqp_type,
+ tvb,
+ offset-1,
+ element_size+1+count_len,
+ "%s",
+ name ? name : proto_registrar_get_name(hf_amqp_type));
+ offset += (count_len*2);
+
+ if (element_count > 0)
+ map_tree = proto_item_add_subtree(map_tree, ett_amqp_1_0_map);
+ if (element_count%2==1) {
+ expert_add_info_format(pinfo,
+ map_tree,
+ &ei_amqp_invalid_number_of_params,
+ "Odd number of map items: %d",
+ element_count);
+ return tvb_reported_length_remaining(tvb, orig_offset);
+ }
+
+ if (element_count > element_size)
+ {
+ expert_add_info_format(pinfo,
+ map_tree,
+ &ei_amqp_invalid_number_of_params,
+ "Number of map elements (%d) bigger than map size (%d)",
+ element_count, element_size);
+ return tvb_reported_length_remaining(tvb, orig_offset);
+ }
+
+ proto_item_append_text(map_tree,
+ " (map of %d element%s)",
+ (element_count/2),
+ plurality(element_count/2, "", "s"));
+
+ while ((element_count > 0) && (tvb_reported_length_remaining(tvb, offset) > 0)) {
+ if (element_count%2 == 0) { /* decode key */
+ element_type = decode_fixed_type(tvb_get_guint8(tvb, offset));
+ if (element_type)
+ {
+ decoded_element_size=element_type->formatter(tvb, offset+1, element_type->known_size, &value);
+ offset += (decoded_element_size+1);
}
- break;
- case AMQP_0_9_CLASS_BASIC:
- method_id = tvb_get_ntohs(tvb, 9);
- proto_tree_add_item(amqp_tree, hf_amqp_method_basic_method_id,
- tvb, 9, 2, ENC_BIG_ENDIAN);
- ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
- tvb, 11, length - 4, ENC_NA);
- args_tree = proto_item_add_subtree(ti, ett_args);
+ else
+ { /* can't decode key type */
+ proto_tree_add_none_format(map_tree, hf_amqp_1_0_map, tvb,
+ offset,
+ 1,
+ "(unknown map key type %d)",
+ tvb_get_guint8(tvb, offset));
+ expert_add_info_format(pinfo,
+ map_tree,
+ &ei_amqp_unknown_amqp_type,
+ "Unknown AMQP map key type %d",
+ tvb_get_guint8(tvb, offset));
+ offset += 1;
+ }
+ }
+ else { /* decode value */
+ get_amqp_1_0_type_value_formatter(tvb,
+ pinfo,
+ offset,
+ hf_amqp_1_0_list, /* dynamic item */
+ value,
+ &decoded_element_size,
+ map_tree);
+ offset += decoded_element_size;
+ }
+ element_count--;
+ }
+ return offset-orig_offset;
+}
- col_append_fstr(pinfo->cinfo, COL_INFO, "Basic.%s ",
- val_to_str( method_id, amqp_method_basic_methods, "Unknown (%u)"));
+/* decodes AMQP 1.0 array
+ * arguments: see dissect_amqp_1_0_list
+ */
+static guint
+dissect_amqp_1_0_array(tvbuff_t *tvb,
+ packet_info *pinfo,
+ int offset,
+ proto_item *item,
+ int hf_amqp_type,
+ guint32 hf_amqp_subtype_count,
+ const int **hf_amqp_subtypes,
+ const char *name)
+{
+ proto_item *array_tree;
+ guint8 type;
+ guint8 count_len;
+ guint32 i, element_count;
+ guint32 element_size;
+ guint32 element_type;
+ guint32 decoded_element_size;
+ guint32 orig_offset;
+ guint32 decoded_elements;
+ int hf_amqp_item;
+ guint32 hf_amqp_subtype_count_array = 0;
+ const int **hf_amqp_subtypes_array = NULL;
+ const char *type_name_array = NULL;
- switch (method_id) {
- case AMQP_0_9_METHOD_BASIC_QOS:
- dissect_amqp_0_9_method_basic_qos(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_BASIC_QOS_OK:
- dissect_amqp_0_9_method_basic_qos_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_BASIC_CONSUME:
- dissect_amqp_0_9_method_basic_consume(tvb,
- pinfo, 11, args_tree);
- break;
- case AMQP_0_9_METHOD_BASIC_CONSUME_OK:
- dissect_amqp_0_9_method_basic_consume_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_BASIC_CANCEL:
- dissect_amqp_0_9_method_basic_cancel(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_BASIC_CANCEL_OK:
- dissect_amqp_0_9_method_basic_cancel_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_BASIC_PUBLISH:
- dissect_amqp_0_9_method_basic_publish(channel_num, tvb,
- pinfo, 11, args_tree);
- generate_ack_reference(tvb, pinfo, amqp_tree);
- break;
- case AMQP_0_9_METHOD_BASIC_RETURN:
- dissect_amqp_0_9_method_basic_return(tvb,
- pinfo, 11, args_tree);
- break;
- case AMQP_0_9_METHOD_BASIC_DELIVER:
- dissect_amqp_0_9_method_basic_deliver(channel_num, tvb,
- pinfo, 11, args_tree);
- generate_ack_reference(tvb, pinfo, amqp_tree);
- break;
- case AMQP_0_9_METHOD_BASIC_GET:
- dissect_amqp_0_9_method_basic_get(tvb,
- pinfo, 11, args_tree);
- break;
- case AMQP_0_9_METHOD_BASIC_GET_OK:
- dissect_amqp_0_9_method_basic_get_ok(channel_num, tvb,
- pinfo, 11, args_tree);
- generate_ack_reference(tvb, pinfo, amqp_tree);
- break;
- case AMQP_0_9_METHOD_BASIC_GET_EMPTY:
- dissect_amqp_0_9_method_basic_get_empty(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_BASIC_ACK:
- dissect_amqp_0_9_method_basic_ack(channel_num, tvb,
- pinfo, 11, args_tree);
- generate_msg_reference(tvb, pinfo, amqp_tree);
- break;
- case AMQP_0_9_METHOD_BASIC_REJECT:
- dissect_amqp_0_9_method_basic_reject(channel_num, tvb,
- pinfo, 11, args_tree);
- generate_msg_reference(tvb, pinfo, amqp_tree);
- break;
- case AMQP_0_9_METHOD_BASIC_RECOVER_ASYNC:
- dissect_amqp_0_9_method_basic_recover_async(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_BASIC_RECOVER:
- dissect_amqp_0_9_method_basic_recover(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_BASIC_RECOVER_OK:
- dissect_amqp_0_9_method_basic_recover_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_BASIC_NACK:
- dissect_amqp_0_9_method_basic_nack(channel_num, tvb,
- pinfo, 11, args_tree);
- generate_msg_reference(tvb, pinfo, amqp_tree);
- break;
- default:
- expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_basic_method, "Unknown basic method %u", method_id);
+ array_tree = 0;
+ decoded_elements = 0;
+ orig_offset = offset;
+
+ type = tvb_get_guint8(tvb, offset);
+ offset += 1;
+ switch (type) {
+ case AMQP_1_0_TYPE_ARRAY8:
+ count_len = 1;
+ element_size = tvb_get_guint8(tvb, offset);
+ element_count = tvb_get_guint8(tvb, offset+count_len);
+ break;
+ case AMQP_1_0_TYPE_ARRAY32:
+ count_len = 4;
+ element_size = tvb_get_ntohl(tvb, offset);
+ element_count = tvb_get_ntohl(tvb, offset+count_len);
+ break;
+ default:
+ proto_tree_add_none_format(array_tree, hf_amqp_1_0_list, tvb,
+ offset-1,
+ 1,
+ "(unknown type %d)",
+ type);
+ expert_add_info_format(pinfo,
+ array_tree,
+ &ei_amqp_unknown_amqp_type,
+ "Unknown AMQP array type %d",
+ type);
+ return tvb_reported_length_remaining(tvb, orig_offset);
+ }
+
+ element_type = get_amqp_1_0_type_formatter(tvb,
+ offset+count_len*2,
+ &hf_amqp_type,
+ &type_name_array,
+ &hf_amqp_subtype_count_array,
+ &hf_amqp_subtypes_array,
+ &decoded_element_size);
+
+ array_tree = proto_tree_add_none_format(item,
+ hf_amqp_type,
+ tvb,
+ offset-1,
+ element_size+1+count_len,
+ "%s",
+ name ? name : proto_registrar_get_name(hf_amqp_type));
+ offset += (count_len*2+decoded_element_size);
+
+ if (element_count > 0)
+ array_tree = proto_item_add_subtree(array_tree, ett_amqp_1_0_array);
+ /* display the item count for custom arrays only
+ * standard structures contain NULL items, so the real element count is different */
+ if (hf_amqp_subtype_count == 0)
+ proto_item_append_text(array_tree, " (array of %d element%s)", element_count, plurality(element_count, "", "s"));
+
+ if (element_count > element_size)
+ {
+ expert_add_info_format(pinfo,
+ array_tree,
+ &ei_amqp_invalid_number_of_params,
+ "Number of array elements (%d) bigger than array size (%d)",
+ element_count, element_size);
+ return tvb_reported_length_remaining(tvb, orig_offset);
+ }
+
+ for (i = 0; ((i < element_count) && (tvb_reported_length_remaining(tvb, offset) > 0)); i++) {
+ decoded_element_size = 0;
+ if (decoded_elements<hf_amqp_subtype_count)
+ hf_amqp_item = *(hf_amqp_subtypes[decoded_elements]);
+ else
+ hf_amqp_item = hf_amqp_1_0_list; /* dynamic item */
+ get_amqp_1_0_value_formatter(tvb,
+ pinfo,
+ element_type, /* code */
+ offset,
+ hf_amqp_item,
+ (proto_registrar_get_nth(hf_amqp_type))->name, /* name */
+ hf_amqp_subtype_count_array, /* subitem list count */
+ hf_amqp_subtypes_array, /* subitem list hf_.. list */
+ &decoded_element_size,
+ array_tree);
+ decoded_elements += 1;
+ if (decoded_element_size==0)
+ decoded_element_size=1; /* necessary for 0x40 or similar values where value_formatter returns size of _value_ 0 (type=1 not counted) */
+ offset += decoded_element_size;
+ }
+ if (i != element_count)
+ expert_add_info_format(pinfo,
+ array_tree,
+ &ei_amqp_invalid_number_of_params,
+ "Number of array elements (%d) not matching number of decoded elements (%d)",
+ element_count+decoded_elements, decoded_elements);
+ return offset-orig_offset;
+}
+
+/* decodes AMQP 1.0 AMQP performative (open, attach, transfer or so)
+ * arguments:
+ * tvb, offset, length, amqp_tree, pinfo: obvious
+ * method_name: what to print to col_append_str method in dissect_amqp_1_0_frame
+ */
+static void
+dissect_amqp_1_0_AMQP_frame(tvbuff_t *tvb,
+ proto_item *amqp_item,
+ packet_info *pinfo)
+{
+ proto_item *args_tree;
+ guint32 arg_length = 0;
+ guint32 method;
+ gint offset = 0;
+ proto_item* ti;
+
+ args_tree = proto_item_add_subtree(amqp_item, ett_args);
+
+ if (tvb_reported_length(tvb) == 0) { /* empty keepalive sent */
+ col_append_fstr(pinfo->cinfo, COL_INFO, "(empty)");
+ col_set_fence(pinfo->cinfo, COL_INFO);
+ return;
+ }
+
+ ti = proto_tree_add_item_ret_uint(args_tree, hf_amqp_1_0_amqp_performative, tvb, offset+2, 1, ENC_BIG_ENDIAN, &method);
+ col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(method, amqp_1_0_AMQP_performatives, "<invalid AMQP performative>"));
+ col_set_fence(pinfo->cinfo, COL_INFO);
+
+ offset += 3; /* descriptor-constructor & fixed_one length & AMQP performative code */
+ switch(method) {
+ case AMQP_1_0_AMQP_OPEN:
+ dissect_amqp_1_0_list(tvb,
+ pinfo,
+ offset,
+ args_tree,
+ hf_amqp_method_arguments,
+ 10, amqp_1_0_amqp_open_items, NULL);
+ break;
+ case AMQP_1_0_AMQP_BEGIN:
+ dissect_amqp_1_0_list(tvb,
+ pinfo,
+ offset,
+ args_tree,
+ hf_amqp_method_arguments,
+ 8, amqp_1_0_amqp_begin_items, NULL);
+ break;
+ case AMQP_1_0_AMQP_ATTACH:
+ dissect_amqp_1_0_list(tvb,
+ pinfo,
+ offset,
+ args_tree,
+ hf_amqp_method_arguments,
+ 14, amqp_1_0_amqp_attach_items, NULL);
+ break;
+ case AMQP_1_0_AMQP_FLOW:
+ dissect_amqp_1_0_list(tvb,
+ pinfo,
+ offset,
+ args_tree,
+ hf_amqp_method_arguments,
+ 11, amqp_1_0_amqp_flow_items, NULL);
+ break;
+ case AMQP_1_0_AMQP_TRANSFER:
+ arg_length = dissect_amqp_1_0_list(tvb,
+ pinfo,
+ offset,
+ args_tree,
+ hf_amqp_method_arguments,
+ 11, amqp_1_0_amqp_transfer_items, NULL);
+
+ /* now decode message header, annotations, properties and data */
+ while ((arg_length > 0) && (tvb_reported_length_remaining(tvb, offset + arg_length) > 0)) {
+ offset += arg_length;
+ get_amqp_1_0_type_value_formatter(tvb,
+ pinfo,
+ offset,
+ hf_amqp_1_0_list, /* dynamic item */
+ NULL,
+ &arg_length,
+ args_tree);
}
break;
- case AMQP_0_9_CLASS_FILE:
- method_id = tvb_get_ntohs(tvb, 9);
- proto_tree_add_item(amqp_tree, hf_amqp_method_file_method_id,
- tvb, 9, 2, ENC_BIG_ENDIAN);
- ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
- tvb, 11, length - 4, ENC_NA);
- args_tree = proto_item_add_subtree(ti, ett_args);
+ case AMQP_1_0_AMQP_DISPOSITION:
+ dissect_amqp_1_0_list(tvb,
+ pinfo,
+ offset,
+ args_tree,
+ hf_amqp_method_arguments,
+ 6, amqp_1_0_amqp_disposition_items, NULL);
+ break;
+ case AMQP_1_0_AMQP_DETACH:
+ dissect_amqp_1_0_list(tvb,
+ pinfo,
+ offset,
+ args_tree,
+ hf_amqp_method_arguments,
+ 3, amqp_1_0_amqp_detach_items, NULL);
+ break;
+ case AMQP_1_0_AMQP_END:
+ dissect_amqp_1_0_list(tvb,
+ pinfo,
+ offset,
+ args_tree,
+ hf_amqp_method_arguments,
+ 1, amqp_1_0_amqp_end_items, NULL);
+ break;
+ case AMQP_1_0_AMQP_CLOSE:
+ dissect_amqp_1_0_list(tvb,
+ pinfo,
+ offset,
+ args_tree,
+ hf_amqp_method_arguments,
+ 1, amqp_1_0_amqp_close_items, NULL);
+ break;
+ default:
+ expert_add_info_format(pinfo,
+ ti,
+ &ei_amqp_unknown_amqp_command,
+ "Unknown AMQP performative %d",
+ method);
+ }
+}
- col_append_fstr(pinfo->cinfo, COL_INFO, "File.%s ",
- val_to_str( method_id, amqp_method_file_methods, "Unknown (%u)"));
+/* decodes AMQP 1.0 SASL methods (mechanisms offer, challenge, response,..)
+ * arguments: see dissect_amqp_1_0_AMQP_frame
+ */
+static void
+dissect_amqp_1_0_SASL_frame(tvbuff_t *tvb,
+ proto_item *amqp_item,
+ packet_info *pinfo)
+{
+ proto_item *args_tree;
+ guint32 method;
+ gint offset = 0;
+ proto_item *ti;
- switch (method_id) {
- case AMQP_0_9_METHOD_FILE_QOS:
- dissect_amqp_0_9_method_file_qos(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_FILE_QOS_OK:
- dissect_amqp_0_9_method_file_qos_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_FILE_CONSUME:
- dissect_amqp_0_9_method_file_consume(tvb,
- pinfo, 11, args_tree);
- break;
- case AMQP_0_9_METHOD_FILE_CONSUME_OK:
- dissect_amqp_0_9_method_file_consume_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_FILE_CANCEL:
- dissect_amqp_0_9_method_file_cancel(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_FILE_CANCEL_OK:
- dissect_amqp_0_9_method_file_cancel_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_FILE_OPEN:
- dissect_amqp_0_9_method_file_open(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_FILE_OPEN_OK:
- dissect_amqp_0_9_method_file_open_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_FILE_STAGE:
- dissect_amqp_0_9_method_file_stage(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_FILE_PUBLISH:
- dissect_amqp_0_9_method_file_publish(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_FILE_RETURN:
- dissect_amqp_0_9_method_file_return(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_FILE_DELIVER:
- dissect_amqp_0_9_method_file_deliver(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_FILE_ACK:
- dissect_amqp_0_9_method_file_ack(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_FILE_REJECT:
- dissect_amqp_0_9_method_file_reject(tvb,
- 11, args_tree);
- break;
- default:
- expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_file_method, "Unknown file method %u", method_id);
- }
+ args_tree = proto_item_add_subtree(amqp_item, ett_args);
+ ti = proto_tree_add_item_ret_uint(args_tree, hf_amqp_1_0_sasl_method, tvb, offset+2, 1, ENC_BIG_ENDIAN, &method);
+
+ col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", val_to_str_const(method, amqp_1_0_SASL_methods, "<invalid SASL method>"));
+ col_set_fence(pinfo->cinfo, COL_INFO);
+
+ offset += 3; /* descriptor-constructor & fixed_one length & SASL method code */
+ switch(method) {
+ case AMQP_1_0_SASL_MECHANISMS:
+ dissect_amqp_1_0_list(tvb,
+ pinfo,
+ offset,
+ args_tree,
+ hf_amqp_method_arguments,
+ 1, amqp_1_0_sasl_mechanisms_items, NULL);
break;
- case AMQP_0_9_CLASS_STREAM:
- method_id = tvb_get_ntohs(tvb, 9);
- proto_tree_add_item(amqp_tree, hf_amqp_method_stream_method_id,
- tvb, 9, 2, ENC_BIG_ENDIAN);
- ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
- tvb, 11, length - 4, ENC_NA);
- args_tree = proto_item_add_subtree(ti, ett_args);
+ case AMQP_1_0_SASL_INIT:
+ dissect_amqp_1_0_list(tvb,
+ pinfo,
+ offset,
+ args_tree,
+ hf_amqp_method_arguments,
+ 3, amqp_1_0_sasl_init_items, NULL);
+ break;
+ case AMQP_1_0_SASL_CHALLENGE:
+ dissect_amqp_1_0_list(tvb,
+ pinfo,
+ offset,
+ args_tree,
+ hf_amqp_method_arguments,
+ 1, amqp_1_0_sasl_challenge_items, NULL);
+ break;
+ case AMQP_1_0_SASL_RESPONSE:
+ dissect_amqp_1_0_list(tvb,
+ pinfo,
+ offset,
+ args_tree,
+ hf_amqp_method_arguments,
+ 1, amqp_1_0_sasl_response_items, NULL);
+ break;
+ case AMQP_1_0_SASL_OUTCOME:
+ dissect_amqp_1_0_list(tvb,
+ pinfo,
+ offset,
+ args_tree,
+ hf_amqp_method_arguments,
+ 2, amqp_1_0_sasl_outcome_items, NULL);
+ break;
+ default:
+ expert_add_info_format(pinfo,
+ ti,
+ &ei_amqp_unknown_sasl_command,
+ "Unknown SASL command %d",
+ method);
+ }
+}
+
+static int
+dissect_amqp_1_0_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
+{
+ proto_item *ti, *size_item;
+ proto_tree *amqp_tree;
+ guint8 frame_type;
+ guint32 length;
+ guint offset;
+ tvbuff_t *next_tvb;
+
+ col_clear(pinfo->cinfo, COL_INFO);
+
+ /* Heuristic - protocol initialisation frame starts with 'AMQP' followed by 0x0 */
+ if (tvb_memeql(tvb, 0, "AMQP", 4) == 0) {
+ guint8 proto_major;
+ guint8 proto_minor;
+ guint8 proto_revision;
+
+ proto_major = tvb_get_guint8(tvb, 5);
+ proto_minor = tvb_get_guint8(tvb, 6);
+ proto_revision = tvb_get_guint8(tvb, 7);
+ col_append_fstr(pinfo->cinfo, COL_INFO, "Protocol-Header%s %d-%d-%d ",
+ (tvb_get_guint8(tvb, 4)==0x2) ? "(TLS)" : "", /* frame type = 2 => TLS */
+ proto_major,
+ proto_minor,
+ proto_revision);
+ col_set_fence(pinfo->cinfo, COL_INFO);
+
+ if (tree) {
+ ti = proto_tree_add_item(tree, proto_amqp, tvb, 0, -1, ENC_NA);
+ amqp_tree = proto_item_add_subtree(ti, ett_amqp_init);
+ proto_tree_add_item(amqp_tree, hf_amqp_init_protocol, tvb, 0, 4, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(amqp_tree, hf_amqp_init_id, tvb, 4, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(amqp_tree, hf_amqp_init_version_major, tvb, 5, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(amqp_tree, hf_amqp_init_version_minor, tvb, 6, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(amqp_tree, hf_amqp_init_version_revision, tvb, 7, 1, ENC_BIG_ENDIAN);
+ }
+ return 8;
+ }
+
+ /* Protocol frame */
+
+ /* frame header */
+ ti = proto_tree_add_item(tree, proto_amqp, tvb, 0, -1, ENC_NA);
+ amqp_tree = proto_item_add_subtree(ti, ett_amqp);
+ size_item = proto_tree_add_item_ret_uint(amqp_tree, hf_amqp_1_0_size, tvb, 0, 4, ENC_BIG_ENDIAN, &length);
+ proto_tree_add_item(amqp_tree, hf_amqp_1_0_doff, tvb, 4, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(amqp_tree, hf_amqp_1_0_type, tvb, 5, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(amqp_tree, hf_amqp_channel, tvb, 6, 2, ENC_BIG_ENDIAN);
+
+ /* XXX: The original code used only the low-order 16 bits of the 32 bit length
+ * field from the PDU as the length to dissect */
+ if (length > 0xFFFF)
+ {
+ length = 0xFFFF;
+ expert_add_info(pinfo, size_item, &ei_amqp_amqp_1_0_frame_length_exceeds_65K);
+ }
+
+ offset = 4*tvb_get_guint8(tvb,4); /* i.e. 4*DOFF */
+ frame_type = tvb_get_guint8(tvb, 5);
+ if (length < offset) {
+ expert_add_info(pinfo, size_item, &ei_amqp_bad_length);
+ return 8;
+ }
+
+ if (length > (guint32)tvb_reported_length_remaining(tvb, offset))
+ {
+ next_tvb = tvb_new_subset_remaining(tvb, offset);
+ }
+ else
+ {
+ next_tvb = tvb_new_subset_length(tvb, offset, length);
+ }
+
+ switch(frame_type) {
+ case AMQP_1_0_AMQP_FRAME:
+ dissect_amqp_1_0_AMQP_frame(next_tvb, amqp_tree, pinfo);
+ break;
+ case AMQP_1_0_SASL_FRAME:
+ dissect_amqp_1_0_SASL_frame(next_tvb, amqp_tree, pinfo);
+ break;
+ case AMQP_1_0_TLS_FRAME:
+ /* should not occur, this is handled in '(tvb_memeql(tvb, 0, "AMQP", 4) == 0)' test above */
+ break;
+ default:
+ expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_frame_type, "Unknown frame type %d", frame_type);
+ }
+
+ return tvb_reported_length(tvb);
+}
+
+static int
+dissect_amqp_0_10_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
+{
+ proto_item *ti;
+ proto_item *amqp_tree = NULL;
+ guint8 frame_type;
+ guint16 length;
+ guint32 struct_length;
+ guint offset;
+ tvbuff_t *next_tvb;
- col_append_fstr(pinfo->cinfo, COL_INFO, "Stream.%s ",
- val_to_str( method_id, amqp_method_stream_methods, "Unknown (%u)"));
+ /* Heuristic - protocol initialisation frame starts with 'AMQP' */
+ if (tvb_memeql(tvb, 0, "AMQP", 4) == 0) {
+ guint8 proto_major;
+ guint8 proto_minor;
- switch (method_id) {
- case AMQP_0_9_METHOD_STREAM_QOS:
- dissect_amqp_0_9_method_stream_qos(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_STREAM_QOS_OK:
- dissect_amqp_0_9_method_stream_qos_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_STREAM_CONSUME:
- dissect_amqp_0_9_method_stream_consume(tvb,
- pinfo, 11, args_tree);
- break;
- case AMQP_0_9_METHOD_STREAM_CONSUME_OK:
- dissect_amqp_0_9_method_stream_consume_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_STREAM_CANCEL:
- dissect_amqp_0_9_method_stream_cancel(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_STREAM_CANCEL_OK:
- dissect_amqp_0_9_method_stream_cancel_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_STREAM_PUBLISH:
- dissect_amqp_0_9_method_stream_publish(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_STREAM_RETURN:
- dissect_amqp_0_9_method_stream_return(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_STREAM_DELIVER:
- dissect_amqp_0_9_method_stream_deliver(tvb,
- 11, args_tree);
- break;
- default:
- expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_stream_method, "Unknown stream method %u", method_id);
- }
- break;
- case AMQP_0_9_CLASS_TX:
- method_id = tvb_get_ntohs(tvb, 9);
- proto_tree_add_item(amqp_tree, hf_amqp_method_tx_method_id,
- tvb, 9, 2, ENC_BIG_ENDIAN);
- ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
- tvb, 11, length - 4, ENC_NA);
- args_tree = proto_item_add_subtree(ti, ett_args);
+ proto_major = tvb_get_guint8(tvb, 6);
+ proto_minor = tvb_get_guint8(tvb, 7);
+ col_append_fstr(pinfo->cinfo, COL_INFO, "Protocol-Header %d-%d ",
+ proto_major,
+ proto_minor);
+ col_set_fence(pinfo->cinfo, COL_INFO);
- col_append_fstr(pinfo->cinfo, COL_INFO, "Tx.%s ",
- val_to_str( method_id, amqp_method_tx_methods, "Unknown (%u)"));
+ if (tree) {
+ ti = proto_tree_add_item(tree, proto_amqp, tvb, 0, -1, ENC_NA);
+ amqp_tree = proto_item_add_subtree(ti, ett_amqp_init);
+ proto_tree_add_item(amqp_tree, hf_amqp_init_protocol, tvb, 0, 4, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(amqp_tree, hf_amqp_init_id_major, tvb, 4, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(amqp_tree, hf_amqp_init_id_minor, tvb, 5, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(amqp_tree, hf_amqp_init_version_major, tvb, 6, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(amqp_tree, hf_amqp_init_version_minor, tvb, 7, 1, ENC_BIG_ENDIAN);
+ }
+ return 8;
+ }
- switch (method_id) {
- case AMQP_0_9_METHOD_TX_SELECT:
- dissect_amqp_0_9_method_tx_select(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_TX_SELECT_OK:
- dissect_amqp_0_9_method_tx_select_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_TX_COMMIT:
- dissect_amqp_0_9_method_tx_commit(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_TX_COMMIT_OK:
- dissect_amqp_0_9_method_tx_commit_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_TX_ROLLBACK:
- dissect_amqp_0_9_method_tx_rollback(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_TX_ROLLBACK_OK:
- dissect_amqp_0_9_method_tx_rollback_ok(tvb,
- 11, args_tree);
- break;
- default:
- expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_tx_method, "Unknown tx method %u", method_id);
- }
- break;
- case AMQP_0_9_CLASS_DTX:
- method_id = tvb_get_ntohs(tvb, 9);
- proto_tree_add_item(amqp_tree, hf_amqp_method_dtx_method_id,
- tvb, 9, 2, ENC_BIG_ENDIAN);
- ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
- tvb, 11, length - 4, ENC_NA);
- args_tree = proto_item_add_subtree(ti, ett_args);
+ /* Protocol frame */
+ if (tree) {
+ ti = proto_tree_add_item(tree, proto_amqp, tvb, 0, -1, ENC_NA);
+ amqp_tree = proto_item_add_subtree(ti, ett_amqp);
+ proto_tree_add_item(amqp_tree, hf_amqp_0_10_format, tvb, 0, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(amqp_tree, hf_amqp_0_10_position, tvb, 0, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(amqp_tree, hf_amqp_0_10_type, tvb, 1, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(amqp_tree, hf_amqp_0_10_size, tvb, 2, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(amqp_tree, hf_amqp_0_10_track, tvb, 5, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(amqp_tree, hf_amqp_channel, tvb, 6, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(amqp_tree, hf_amqp_reserved, tvb, 8, 4, ENC_BIG_ENDIAN);
+ }
- col_append_fstr(pinfo->cinfo, COL_INFO, "Dtx.%s ",
- val_to_str( method_id, amqp_method_dtx_methods, "Unknown (%u)"));
+ frame_type = tvb_get_guint8(tvb, 1);
+ length = tvb_get_ntohs(tvb, 2);
+ offset = 12;
+ next_tvb = tvb_new_subset_remaining(tvb, offset);
- switch (method_id) {
- case AMQP_0_9_METHOD_DTX_SELECT:
- dissect_amqp_0_9_method_dtx_select(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_DTX_SELECT_OK:
- dissect_amqp_0_9_method_dtx_select_ok(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_DTX_START:
- dissect_amqp_0_9_method_dtx_start(tvb,
- 11, args_tree);
- break;
- case AMQP_0_9_METHOD_DTX_START_OK:
- dissect_amqp_0_9_method_dtx_start_ok(tvb,
- 11, args_tree);
- break;
- default:
- expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_dtx_method, "Unknown dtx method %u", method_id);
- }
+ switch(frame_type) {
+ case AMQP_0_10_FRAME_COMMAND:
+ /* Fall through */
+ case AMQP_0_10_FRAME_CONTROL:
+ proto_tree_add_item(amqp_tree, hf_amqp_0_10_class, tvb, offset+0, 1, ENC_BIG_ENDIAN);
+ switch(tvb_get_guint8(tvb, offset + 0)) {
+ case AMQP_0_10_CLASS_CONNECTION:
+ dissect_amqp_0_10_connection(next_tvb, pinfo, amqp_tree);
break;
- case AMQP_0_9_CLASS_TUNNEL:
- method_id = tvb_get_ntohs(tvb, 9);
- proto_tree_add_item(amqp_tree, hf_amqp_method_tunnel_method_id,
- tvb, 9, 2, ENC_BIG_ENDIAN);
- ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
- tvb, 11, length - 4, ENC_NA);
- args_tree = proto_item_add_subtree(ti, ett_args);
- switch (method_id) {
- case AMQP_0_9_METHOD_TUNNEL_REQUEST:
- dissect_amqp_0_9_method_tunnel_request(tvb,
- pinfo, 11, args_tree);
- col_append_str(pinfo->cinfo, COL_INFO,
- "Tunnel.Request ");
- break;
- default:
- expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_tunnel_method, "Unknown tunnel method %u", method_id);
- }
+ case AMQP_0_10_CLASS_SESSION:
+ dissect_amqp_0_10_session(next_tvb, pinfo, amqp_tree);
break;
- case AMQP_0_9_CLASS_CONFIRM:
- method_id = tvb_get_ntohs(tvb, 9);
- proto_tree_add_item(amqp_tree, hf_amqp_method_confirm_method_id,
- tvb, 9, 2, ENC_BIG_ENDIAN);
- ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
- tvb, 11, length - 4, ENC_NA);
- args_tree = proto_item_add_subtree(ti, ett_args);
- switch (method_id) {
- case AMQP_0_9_METHOD_CONFIRM_SELECT:
- dissect_amqp_0_9_method_confirm_select(tvb,
- 11, args_tree);
- col_append_str(pinfo->cinfo, COL_INFO,
- "Confirm.Select ");
- break;
- case AMQP_0_9_METHOD_CONFIRM_SELECT_OK:
- dissect_amqp_0_9_method_confirm_select_ok(channel_num, tvb, pinfo,
- 11, args_tree);
- col_append_str(pinfo->cinfo, COL_INFO,
- "Confirm.Select-Ok ");
- break;
- default:
- expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_confirm_method, "Unknown confirm method %u", method_id);
- }
+ case AMQP_0_10_CLASS_EXECUTION:
+ dissect_amqp_0_10_execution(next_tvb, pinfo, amqp_tree);
break;
- default:
- expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_method_class, "Unknown method class %u", class_id);
- }
- break;
- case AMQP_0_9_FRAME_TYPE_CONTENT_HEADER:
- class_id = tvb_get_ntohs(tvb, 7);
- proto_tree_add_item(amqp_tree, hf_amqp_header_class_id,
- tvb, 7, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(amqp_tree, hf_amqp_header_weight,
- tvb, 9, 2, ENC_BIG_ENDIAN);
- proto_tree_add_item(amqp_tree, hf_amqp_header_body_size,
- tvb, 11, 8, ENC_BIG_ENDIAN);
- proto_tree_add_item(amqp_tree, hf_amqp_header_property_flags,
- tvb, 19, 2, ENC_BIG_ENDIAN);
- ti = proto_tree_add_item(amqp_tree, hf_amqp_header_properties,
- tvb, 21, length - 14, ENC_NA);
- prop_tree = proto_item_add_subtree(ti, ett_props);
- col_append_str(pinfo->cinfo, COL_INFO, "Content-Header ");
- switch (class_id) {
- case AMQP_0_9_CLASS_BASIC:
- dissect_amqp_0_9_content_header_basic(tvb,
- pinfo, 21, prop_tree);
+ case AMQP_0_10_CLASS_MESSAGE:
+ dissect_amqp_0_10_message(next_tvb, pinfo, amqp_tree);
break;
- case AMQP_0_9_CLASS_FILE:
- dissect_amqp_0_9_content_header_file(tvb,
- pinfo, 21, prop_tree);
+ case AMQP_0_10_CLASS_TX:
+ dissect_amqp_0_10_tx(next_tvb, pinfo, amqp_tree);
break;
- case AMQP_0_9_CLASS_STREAM:
- dissect_amqp_0_9_content_header_stream(tvb,
- pinfo, 21, prop_tree);
+ case AMQP_0_10_CLASS_DTX:
+ dissect_amqp_0_10_dtx(next_tvb, pinfo, amqp_tree);
break;
- case AMQP_0_9_CLASS_TUNNEL:
- dissect_amqp_0_9_content_header_tunnel(tvb,
- pinfo, 21, prop_tree);
+ case AMQP_0_10_CLASS_EXCHANGE:
+ dissect_amqp_0_10_exchange(next_tvb, pinfo, amqp_tree);
+ break;
+ case AMQP_0_10_CLASS_QUEUE:
+ dissect_amqp_0_10_queue(next_tvb, pinfo, amqp_tree);
+ break;
+ case AMQP_0_10_CLASS_FILE:
+ dissect_amqp_0_10_file(next_tvb, pinfo, amqp_tree);
+ break;
+ case AMQP_0_10_CLASS_STREAM:
+ dissect_amqp_0_10_stream(next_tvb, pinfo, amqp_tree);
break;
default:
- expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_header_class, "Unknown header class %u", class_id);
+ expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_command_class, "Unknown command/control class %d", tvb_get_guint8(tvb, offset + 0));
+ }
+ break;
+
+ case AMQP_0_10_FRAME_HEADER:
+ col_append_str(pinfo->cinfo, COL_INFO, "header ");
+ col_set_fence(pinfo->cinfo, COL_INFO);
+ while (tvb_reported_length_remaining(tvb, offset) > 0)
+ {
+ struct_length = amqp_0_10_get_32bit_size_new(amqp_tree, pinfo, tvb, hf_amqp_0_10_struct32_size, offset);
+ offset += 4;
+
+ ti = proto_tree_add_item(amqp_tree,
+ hf_amqp_0_10_struct32,
+ tvb, offset, 2, ENC_BIG_ENDIAN);
+ proto_item_set_len(ti, struct_length);
+ if (struct_length > (guint32)tvb_reported_length_remaining(tvb, offset))
+ {
+ next_tvb = tvb_new_subset_remaining(tvb, offset);
+ }
+ else
+ {
+ next_tvb = tvb_new_subset_length(tvb, offset, struct_length);
+ }
+ dissect_amqp_0_10_struct32(next_tvb, pinfo, ti);
+ offset += struct_length;
}
break;
- case AMQP_0_9_FRAME_TYPE_CONTENT_BODY:
- proto_tree_add_item(amqp_tree, hf_amqp_payload,
- tvb, 7, length, ENC_NA);
- col_append_str(pinfo->cinfo, COL_INFO, "Content-Body ");
- break;
- case AMQP_0_9_FRAME_TYPE_HEARTBEAT:
- col_append_str(pinfo->cinfo, COL_INFO,
- "Heartbeat ");
+
+ case AMQP_0_10_FRAME_BODY:
+ col_append_str(pinfo->cinfo, COL_INFO, "message-body ");
+ col_set_fence(pinfo->cinfo, COL_INFO);
+ proto_tree_add_item(amqp_tree,
+ hf_amqp_0_10_message_body,
+ tvb, offset, length - 12, ENC_NA);
break;
+
default:
- expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_frame_type, "Unknown frame type %u", frame_type);
+ expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_frame_type, "Unknown frame type %d", frame_type);
}
- col_set_fence(pinfo->cinfo, COL_INFO);
return tvb_reported_length(tvb);
}
+
/* Dissection routine for method Connection.Start */
static int
/* mechanism (shortstr) */
proto_tree_add_item(args_tree, hf_amqp_method_connection_start_ok_mechanism,
- tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
- offset += 1 + tvb_get_guint8(tvb, offset);
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
/* response (longstr) */
proto_tree_add_item(args_tree, hf_amqp_method_connection_start_ok_response,
- tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
- offset += 4 + tvb_get_ntohl(tvb, offset);
+ tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += (4 + tvb_get_ntohl(tvb, offset));
/* locale (shortstr) */
proto_tree_add_item(args_tree, hf_amqp_method_connection_start_ok_locale,
- tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
- offset += 1 + tvb_get_guint8(tvb, offset);
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
return offset;
}
{
/* challenge (longstr) */
proto_tree_add_item(args_tree, hf_amqp_method_connection_secure_challenge,
- tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
- offset += 4 + tvb_get_ntohl(tvb, offset);
+ tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += (4 + tvb_get_ntohl(tvb, offset));
return offset;
}
{
/* response (longstr) */
proto_tree_add_item(args_tree, hf_amqp_method_connection_secure_ok_response,
- tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
- offset += 4 + tvb_get_ntohl(tvb, offset);
+ tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset += (4 + tvb_get_ntohl(tvb, offset));
return offset;
}
const guint8* vhost;
/* virtual-host (shortstr) */
proto_tree_add_item_ret_string(args_tree, hf_amqp_method_connection_open_virtual_host,
- tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA, wmem_packet_scope(), &vhost);
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN, wmem_packet_scope(), &vhost);
col_append_fstr(pinfo->cinfo, COL_INFO, "vhost=%s ", vhost);
- offset += 1 + tvb_get_guint8(tvb, offset);
+ offset += (1 + tvb_get_guint8(tvb, offset));
/* capabilities (shortstr) */
proto_tree_add_item(args_tree, hf_amqp_0_9_method_connection_open_capabilities,
{
/* host (shortstr) */
proto_tree_add_item(args_tree, hf_amqp_method_connection_redirect_host,
- tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
- offset += 1 + tvb_get_guint8(tvb, offset);
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN);
+ offset += (1 + tvb_get_guint8(tvb, offset));
/* known-hosts (shortstr) */
proto_tree_add_item(args_tree, hf_amqp_0_9_method_connection_redirect_known_hosts,
/* reply-text (shortstr) */
proto_tree_add_item_ret_string(args_tree, hf_amqp_method_connection_close_reply_text,
- tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA, wmem_packet_scope(), &reply);
+ tvb, offset, 1, ENC_ASCII|ENC_BIG_ENDIAN, wmem_packet_scope(), &reply);
col_append_fstr(pinfo->cinfo, COL_INFO, "reply=%s ", reply);
- offset += 1 + tvb_get_guint8(tvb, offset);
+ offset += (1 + tvb_get_guint8(tvb, offset));
/* class-id (short) */
proto_tree_add_item(args_tree, hf_amqp_method_connection_close_class_id,
}
prop_flags <<= 1;
- if (prop_flags & 0x8000) {
- /* headers (table) */
- ti = proto_tree_add_item(prop_tree, hf_amqp_header_stream_headers,
- tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
- dissect_amqp_0_9_field_table(tvb, pinfo, offset + 4, tvb_get_ntohl(tvb, offset), ti);
- offset += 4 + tvb_get_ntohl(tvb, offset);
- }
- prop_flags <<= 1;
+ if (prop_flags & 0x8000) {
+ /* headers (table) */
+ ti = proto_tree_add_item(prop_tree, hf_amqp_header_stream_headers,
+ tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
+ dissect_amqp_0_9_field_table(tvb, pinfo, offset + 4, tvb_get_ntohl(tvb, offset), ti);
+ offset += 4 + tvb_get_ntohl(tvb, offset);
+ }
+ prop_flags <<= 1;
+
+ if (prop_flags & 0x8000) {
+ /* priority (octet) */
+ proto_tree_add_item(prop_tree, hf_amqp_header_stream_priority,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
+ }
+ prop_flags <<= 1;
+
+ if (prop_flags & 0x8000) {
+ /* timestamp (timestamp) */
+ tv.secs = (time_t)tvb_get_ntoh64(tvb, offset);
+ tv.nsecs = 0;
+ proto_tree_add_time(prop_tree, hf_amqp_header_stream_timestamp,
+ tvb, offset, 8, &tv);
+ offset += 8;
+ }
+ /*prop_flags <<= 1;*/
+
+ return offset;
+}
+
+/* Dissection routine for content headers of class tunnel */
+
+static int
+dissect_amqp_0_9_content_header_tunnel(tvbuff_t *tvb, packet_info *pinfo,
+ int offset, proto_tree *prop_tree)
+{
+ proto_item *ti;
+ guint16 prop_flags;
+
+ prop_flags = tvb_get_ntohs(tvb, 19);
+
+ if (prop_flags & 0x8000) {
+ /* headers (table) */
+ ti = proto_tree_add_item(prop_tree, hf_amqp_header_tunnel_headers,
+ tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
+ dissect_amqp_0_9_field_table(tvb, pinfo, offset + 4, tvb_get_ntohl(tvb, offset), ti);
+ offset += 4 + tvb_get_ntohl(tvb, offset);
+ }
+ prop_flags <<= 1;
+
+ if (prop_flags & 0x8000) {
+ /* proxy-name (shortstr) */
+ proto_tree_add_item(prop_tree, hf_amqp_header_tunnel_proxy_name,
+ tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
+ offset += 1 + tvb_get_guint8(tvb, offset);
+ }
+ prop_flags <<= 1;
+
+ if (prop_flags & 0x8000) {
+ /* data-name (shortstr) */
+ proto_tree_add_item(prop_tree, hf_amqp_header_tunnel_data_name,
+ tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
+ offset += 1 + tvb_get_guint8(tvb, offset);
+ }
+ prop_flags <<= 1;
+
+ if (prop_flags & 0x8000) {
+ /* durable (octet) */
+ proto_tree_add_item(prop_tree, hf_amqp_header_tunnel_durable,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
+ }
+ prop_flags <<= 1;
+
+ if (prop_flags & 0x8000) {
+ /* broadcast (octet) */
+ proto_tree_add_item(prop_tree, hf_amqp_header_tunnel_broadcast,
+ tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset += 1;
+ }
+ /*prop_flags <<= 1;*/
+
+ return offset;
+}
+
+/* Dissection routine for AMQP 0-9 frames */
+
+static int
+dissect_amqp_0_9_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
+{
+ proto_item *ti;
+ proto_item *amqp_tree = NULL;
+ proto_item *args_tree;
+ proto_item *prop_tree;
+ guint length;
+ guint8 frame_type;
+ guint16 channel_num, class_id, method_id;
+
+ /* Heuristic - protocol initialisation frame starts with 'AMQP' */
+ if (tvb_memeql(tvb, 0, "AMQP", 4) == 0) {
+ guint8 proto_id, proto_major, proto_minor;
+
+ proto_id = tvb_get_guint8(tvb, 5);
+ proto_major = tvb_get_guint8(tvb, 6);
+ proto_minor = tvb_get_guint8(tvb, 7);
+ col_append_fstr(pinfo->cinfo, COL_INFO, "Protocol-Header %u-%u-%u",
+ proto_id,
+ proto_major,
+ proto_minor);
+ col_set_fence(pinfo->cinfo, COL_INFO);
+
+ if (tree) {
+ ti = proto_tree_add_item(tree, proto_amqp, tvb, 0, -1, ENC_NA);
+ amqp_tree = proto_item_add_subtree(ti, ett_amqp_init);
+ proto_tree_add_item(amqp_tree, hf_amqp_init_protocol, tvb, 0, 4, ENC_ASCII|ENC_NA);
+ proto_tree_add_item(amqp_tree, hf_amqp_init_id_major, tvb, 4, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(amqp_tree, hf_amqp_init_id_minor, tvb, 5, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(amqp_tree, hf_amqp_init_version_major, tvb, 6, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(amqp_tree, hf_amqp_init_version_minor, tvb, 7, 1, ENC_BIG_ENDIAN);
+ }
+ return 8;
+ }
+
+ if (tree) {
+ ti = proto_tree_add_item(tree, proto_amqp, tvb, 0, -1, ENC_NA);
+ amqp_tree = proto_item_add_subtree(ti, ett_amqp);
+ proto_tree_add_item(amqp_tree, hf_amqp_0_9_type, tvb, 0, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(amqp_tree, hf_amqp_channel, tvb, 1, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(amqp_tree, hf_amqp_0_9_length, tvb, 3, 4, ENC_BIG_ENDIAN);
+ }
+
+ frame_type = tvb_get_guint8(tvb, 0);
+ channel_num = tvb_get_ntohs(tvb, 1);
+ length = tvb_get_ntohl(tvb, 3);
+
+ switch (frame_type) {
+ case AMQP_0_9_FRAME_TYPE_METHOD:
+ class_id = tvb_get_ntohs(tvb, 7);
+ proto_tree_add_item(amqp_tree, hf_amqp_0_9_method_class_id,
+ tvb, 7, 2, ENC_BIG_ENDIAN);
+ switch (class_id) {
+ case AMQP_0_9_CLASS_CONNECTION:
+ method_id = tvb_get_ntohs(tvb, 9);
+ proto_tree_add_item(amqp_tree, hf_amqp_method_connection_method_id,
+ tvb, 9, 2, ENC_BIG_ENDIAN);
+ ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
+ tvb, 11, length - 4, ENC_NA);
+ args_tree = proto_item_add_subtree(ti, ett_args);
+ col_append_fstr(pinfo->cinfo, COL_INFO, "Connection.%s ",
+ val_to_str( method_id, amqp_method_connection_methods, "Unknown (%u)"));
+ switch (method_id) {
+ case AMQP_0_9_METHOD_CONNECTION_START:
+ dissect_amqp_0_9_method_connection_start(tvb,
+ pinfo, 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_CONNECTION_START_OK:
+ dissect_amqp_0_9_method_connection_start_ok(tvb,
+ pinfo, 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_CONNECTION_SECURE:
+ dissect_amqp_0_9_method_connection_secure(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_CONNECTION_SECURE_OK:
+ dissect_amqp_0_9_method_connection_secure_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_CONNECTION_TUNE:
+ dissect_amqp_0_9_method_connection_tune(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_CONNECTION_TUNE_OK:
+ dissect_amqp_0_9_method_connection_tune_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_CONNECTION_OPEN:
+ dissect_amqp_0_9_method_connection_open(tvb,
+ pinfo, 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_CONNECTION_OPEN_OK:
+ dissect_amqp_0_9_method_connection_open_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_CONNECTION_REDIRECT:
+ dissect_amqp_0_9_method_connection_redirect(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_CONNECTION_CLOSE:
+ dissect_amqp_0_9_method_connection_close(tvb,
+ pinfo, 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_CONNECTION_CLOSE_OK:
+ dissect_amqp_0_9_method_connection_close_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_CONNECTION_BLOCKED:
+ dissect_amqp_0_9_method_connection_blocked(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_CONNECTION_UNBLOCKED:
+ dissect_amqp_0_9_method_connection_unblocked(tvb,
+ 11, args_tree);
+ break;
+ default:
+ expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_connection_method, "Unknown connection method %u", method_id);
+ }
+ break;
+ case AMQP_0_9_CLASS_CHANNEL:
+ method_id = tvb_get_ntohs(tvb, 9);
+ proto_tree_add_item(amqp_tree, hf_amqp_method_channel_method_id,
+ tvb, 9, 2, ENC_BIG_ENDIAN);
+ ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
+ tvb, 11, length - 4, ENC_NA);
+ args_tree = proto_item_add_subtree(ti, ett_args);
+
+ col_append_fstr(pinfo->cinfo, COL_INFO, "Channel.%s ",
+ val_to_str( method_id, amqp_method_channel_methods, "Unknown (%u)"));
+
+ switch (method_id) {
+ case AMQP_0_9_METHOD_CHANNEL_OPEN:
+ dissect_amqp_0_9_method_channel_open(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_CHANNEL_OPEN_OK:
+ dissect_amqp_0_9_method_channel_open_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_CHANNEL_FLOW:
+ dissect_amqp_0_9_method_channel_flow(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_CHANNEL_FLOW_OK:
+ dissect_amqp_0_9_method_channel_flow_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_CHANNEL_CLOSE:
+ dissect_amqp_0_9_method_channel_close(channel_num, tvb,
+ pinfo, 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_CHANNEL_CLOSE_OK:
+ dissect_amqp_0_9_method_channel_close_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_CHANNEL_RESUME:
+ dissect_amqp_0_9_method_channel_resume(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_CHANNEL_PING:
+ dissect_amqp_0_9_method_channel_ping(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_CHANNEL_PONG:
+ dissect_amqp_0_9_method_channel_pong(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_CHANNEL_OK:
+ dissect_amqp_0_9_method_channel_ok(tvb,
+ 11, args_tree);
+ break;
+ default:
+ expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_channel_method, "Unknown channel method %u", method_id);
+ }
+ break;
+ case AMQP_0_9_CLASS_ACCESS:
+ method_id = tvb_get_ntohs(tvb, 9);
+ proto_tree_add_item(amqp_tree, hf_amqp_method_access_method_id,
+ tvb, 9, 2, ENC_BIG_ENDIAN);
+ ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
+ tvb, 11, length - 4, ENC_NA);
+ args_tree = proto_item_add_subtree(ti, ett_args);
+ switch (method_id) {
+ case AMQP_0_9_METHOD_ACCESS_REQUEST:
+ dissect_amqp_0_9_method_access_request(tvb,
+ 11, args_tree);
+ col_append_str(pinfo->cinfo, COL_INFO,
+ "Access.Request ");
+ break;
+ case AMQP_0_9_METHOD_ACCESS_REQUEST_OK:
+ dissect_amqp_0_9_method_access_request_ok(tvb,
+ 11, args_tree);
+ col_append_str(pinfo->cinfo, COL_INFO,
+ "Access.Request-Ok ");
+ break;
+ default:
+ expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_access_method, "Unknown access method %u", method_id);
+ }
+ break;
+ case AMQP_0_9_CLASS_EXCHANGE:
+ method_id = tvb_get_ntohs(tvb, 9);
+ proto_tree_add_item(amqp_tree, hf_amqp_method_exchange_method_id,
+ tvb, 9, 2, ENC_BIG_ENDIAN);
+ ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
+ tvb, 11, length - 4, ENC_NA);
+ args_tree = proto_item_add_subtree(ti, ett_args);
+ col_append_fstr(pinfo->cinfo, COL_INFO, "Exchange.%s ",
+ val_to_str( method_id, amqp_method_exchange_methods, "Unknown (%u)"));
+ switch (method_id) {
+ case AMQP_0_9_METHOD_EXCHANGE_DECLARE:
+ dissect_amqp_0_9_method_exchange_declare(tvb,
+ pinfo, 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_EXCHANGE_DECLARE_OK:
+ dissect_amqp_0_9_method_exchange_declare_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_EXCHANGE_BIND:
+ dissect_amqp_0_9_method_exchange_bind(tvb,
+ pinfo, 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_EXCHANGE_BIND_OK:
+ dissect_amqp_0_9_method_exchange_bind_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_EXCHANGE_DELETE:
+ dissect_amqp_0_9_method_exchange_delete(tvb,
+ pinfo, 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_EXCHANGE_DELETE_OK:
+ dissect_amqp_0_9_method_exchange_delete_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_EXCHANGE_UNBIND:
+ /* the same parameters as in bind */
+ dissect_amqp_0_9_method_exchange_bind(tvb,
+ pinfo, 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_EXCHANGE_UNBIND_OK:
+ /* the same parameters as in bind-ok */
+ dissect_amqp_0_9_method_exchange_bind_ok(tvb,
+ 11, args_tree);
+ break;
+ default:
+ expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_exchange_method, "Unknown exchange method %u", method_id);
+ }
+ break;
+ case AMQP_0_9_CLASS_QUEUE:
+ method_id = tvb_get_ntohs(tvb, 9);
+ proto_tree_add_item(amqp_tree, hf_amqp_method_queue_method_id,
+ tvb, 9, 2, ENC_BIG_ENDIAN);
+ ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
+ tvb, 11, length - 4, ENC_NA);
+ args_tree = proto_item_add_subtree(ti, ett_args);
+ col_append_fstr(pinfo->cinfo, COL_INFO, "Queue.%s ",
+ val_to_str( method_id, amqp_method_queue_methods, "Unknown (%u)"));
- if (prop_flags & 0x8000) {
- /* priority (octet) */
- proto_tree_add_item(prop_tree, hf_amqp_header_stream_priority,
- tvb, offset, 1, ENC_BIG_ENDIAN);
- offset += 1;
- }
- prop_flags <<= 1;
+ switch (method_id) {
+ case AMQP_0_9_METHOD_QUEUE_DECLARE:
+ dissect_amqp_0_9_method_queue_declare(tvb,
+ pinfo, 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_QUEUE_DECLARE_OK:
+ dissect_amqp_0_9_method_queue_declare_ok(tvb,
+ pinfo, 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_QUEUE_BIND:
+ dissect_amqp_0_9_method_queue_bind(tvb,
+ pinfo, 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_QUEUE_BIND_OK:
+ dissect_amqp_0_9_method_queue_bind_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_QUEUE_UNBIND:
+ dissect_amqp_0_9_method_queue_unbind(tvb,
+ pinfo, 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_QUEUE_UNBIND_OK:
+ dissect_amqp_0_9_method_queue_unbind_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_QUEUE_PURGE:
+ dissect_amqp_0_9_method_queue_purge(tvb,
+ pinfo, 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_QUEUE_PURGE_OK:
+ dissect_amqp_0_9_method_queue_purge_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_QUEUE_DELETE:
+ dissect_amqp_0_9_method_queue_delete(tvb,
+ pinfo, 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_QUEUE_DELETE_OK:
+ dissect_amqp_0_9_method_queue_delete_ok(tvb,
+ 11, args_tree);
+ break;
+ default:
+ expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_queue_method, "Unknown queue method %u", method_id);
+ }
+ break;
+ case AMQP_0_9_CLASS_BASIC:
+ method_id = tvb_get_ntohs(tvb, 9);
+ proto_tree_add_item(amqp_tree, hf_amqp_method_basic_method_id,
+ tvb, 9, 2, ENC_BIG_ENDIAN);
+ ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
+ tvb, 11, length - 4, ENC_NA);
+ args_tree = proto_item_add_subtree(ti, ett_args);
- if (prop_flags & 0x8000) {
- /* timestamp (timestamp) */
- tv.secs = (time_t)tvb_get_ntoh64(tvb, offset);
- tv.nsecs = 0;
- proto_tree_add_time(prop_tree, hf_amqp_header_stream_timestamp,
- tvb, offset, 8, &tv);
- offset += 8;
- }
- /*prop_flags <<= 1;*/
+ col_append_fstr(pinfo->cinfo, COL_INFO, "Basic.%s ",
+ val_to_str( method_id, amqp_method_basic_methods, "Unknown (%u)"));
- return offset;
-}
+ switch (method_id) {
+ case AMQP_0_9_METHOD_BASIC_QOS:
+ dissect_amqp_0_9_method_basic_qos(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_BASIC_QOS_OK:
+ dissect_amqp_0_9_method_basic_qos_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_BASIC_CONSUME:
+ dissect_amqp_0_9_method_basic_consume(tvb,
+ pinfo, 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_BASIC_CONSUME_OK:
+ dissect_amqp_0_9_method_basic_consume_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_BASIC_CANCEL:
+ dissect_amqp_0_9_method_basic_cancel(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_BASIC_CANCEL_OK:
+ dissect_amqp_0_9_method_basic_cancel_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_BASIC_PUBLISH:
+ dissect_amqp_0_9_method_basic_publish(channel_num, tvb,
+ pinfo, 11, args_tree);
+ generate_ack_reference(tvb, pinfo, amqp_tree);
+ break;
+ case AMQP_0_9_METHOD_BASIC_RETURN:
+ dissect_amqp_0_9_method_basic_return(tvb,
+ pinfo, 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_BASIC_DELIVER:
+ dissect_amqp_0_9_method_basic_deliver(channel_num, tvb,
+ pinfo, 11, args_tree);
+ generate_ack_reference(tvb, pinfo, amqp_tree);
+ break;
+ case AMQP_0_9_METHOD_BASIC_GET:
+ dissect_amqp_0_9_method_basic_get(tvb,
+ pinfo, 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_BASIC_GET_OK:
+ dissect_amqp_0_9_method_basic_get_ok(channel_num, tvb,
+ pinfo, 11, args_tree);
+ generate_ack_reference(tvb, pinfo, amqp_tree);
+ break;
+ case AMQP_0_9_METHOD_BASIC_GET_EMPTY:
+ dissect_amqp_0_9_method_basic_get_empty(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_BASIC_ACK:
+ dissect_amqp_0_9_method_basic_ack(channel_num, tvb,
+ pinfo, 11, args_tree);
+ generate_msg_reference(tvb, pinfo, amqp_tree);
+ break;
+ case AMQP_0_9_METHOD_BASIC_REJECT:
+ dissect_amqp_0_9_method_basic_reject(channel_num, tvb,
+ pinfo, 11, args_tree);
+ generate_msg_reference(tvb, pinfo, amqp_tree);
+ break;
+ case AMQP_0_9_METHOD_BASIC_RECOVER_ASYNC:
+ dissect_amqp_0_9_method_basic_recover_async(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_BASIC_RECOVER:
+ dissect_amqp_0_9_method_basic_recover(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_BASIC_RECOVER_OK:
+ dissect_amqp_0_9_method_basic_recover_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_BASIC_NACK:
+ dissect_amqp_0_9_method_basic_nack(channel_num, tvb,
+ pinfo, 11, args_tree);
+ generate_msg_reference(tvb, pinfo, amqp_tree);
+ break;
+ default:
+ expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_basic_method, "Unknown basic method %u", method_id);
+ }
+ break;
+ case AMQP_0_9_CLASS_FILE:
+ method_id = tvb_get_ntohs(tvb, 9);
+ proto_tree_add_item(amqp_tree, hf_amqp_method_file_method_id,
+ tvb, 9, 2, ENC_BIG_ENDIAN);
+ ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
+ tvb, 11, length - 4, ENC_NA);
+ args_tree = proto_item_add_subtree(ti, ett_args);
-/* Dissection routine for content headers of class tunnel */
+ col_append_fstr(pinfo->cinfo, COL_INFO, "File.%s ",
+ val_to_str( method_id, amqp_method_file_methods, "Unknown (%u)"));
-static int
-dissect_amqp_0_9_content_header_tunnel(tvbuff_t *tvb, packet_info *pinfo,
- int offset, proto_tree *prop_tree)
-{
- proto_item *ti;
- guint16 prop_flags;
+ switch (method_id) {
+ case AMQP_0_9_METHOD_FILE_QOS:
+ dissect_amqp_0_9_method_file_qos(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_FILE_QOS_OK:
+ dissect_amqp_0_9_method_file_qos_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_FILE_CONSUME:
+ dissect_amqp_0_9_method_file_consume(tvb,
+ pinfo, 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_FILE_CONSUME_OK:
+ dissect_amqp_0_9_method_file_consume_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_FILE_CANCEL:
+ dissect_amqp_0_9_method_file_cancel(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_FILE_CANCEL_OK:
+ dissect_amqp_0_9_method_file_cancel_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_FILE_OPEN:
+ dissect_amqp_0_9_method_file_open(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_FILE_OPEN_OK:
+ dissect_amqp_0_9_method_file_open_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_FILE_STAGE:
+ dissect_amqp_0_9_method_file_stage(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_FILE_PUBLISH:
+ dissect_amqp_0_9_method_file_publish(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_FILE_RETURN:
+ dissect_amqp_0_9_method_file_return(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_FILE_DELIVER:
+ dissect_amqp_0_9_method_file_deliver(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_FILE_ACK:
+ dissect_amqp_0_9_method_file_ack(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_FILE_REJECT:
+ dissect_amqp_0_9_method_file_reject(tvb,
+ 11, args_tree);
+ break;
+ default:
+ expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_file_method, "Unknown file method %u", method_id);
+ }
+ break;
+ case AMQP_0_9_CLASS_STREAM:
+ method_id = tvb_get_ntohs(tvb, 9);
+ proto_tree_add_item(amqp_tree, hf_amqp_method_stream_method_id,
+ tvb, 9, 2, ENC_BIG_ENDIAN);
+ ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
+ tvb, 11, length - 4, ENC_NA);
+ args_tree = proto_item_add_subtree(ti, ett_args);
- prop_flags = tvb_get_ntohs(tvb, 19);
+ col_append_fstr(pinfo->cinfo, COL_INFO, "Stream.%s ",
+ val_to_str( method_id, amqp_method_stream_methods, "Unknown (%u)"));
- if (prop_flags & 0x8000) {
- /* headers (table) */
- ti = proto_tree_add_item(prop_tree, hf_amqp_header_tunnel_headers,
- tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
- dissect_amqp_0_9_field_table(tvb, pinfo, offset + 4, tvb_get_ntohl(tvb, offset), ti);
- offset += 4 + tvb_get_ntohl(tvb, offset);
- }
- prop_flags <<= 1;
+ switch (method_id) {
+ case AMQP_0_9_METHOD_STREAM_QOS:
+ dissect_amqp_0_9_method_stream_qos(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_STREAM_QOS_OK:
+ dissect_amqp_0_9_method_stream_qos_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_STREAM_CONSUME:
+ dissect_amqp_0_9_method_stream_consume(tvb,
+ pinfo, 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_STREAM_CONSUME_OK:
+ dissect_amqp_0_9_method_stream_consume_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_STREAM_CANCEL:
+ dissect_amqp_0_9_method_stream_cancel(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_STREAM_CANCEL_OK:
+ dissect_amqp_0_9_method_stream_cancel_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_STREAM_PUBLISH:
+ dissect_amqp_0_9_method_stream_publish(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_STREAM_RETURN:
+ dissect_amqp_0_9_method_stream_return(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_STREAM_DELIVER:
+ dissect_amqp_0_9_method_stream_deliver(tvb,
+ 11, args_tree);
+ break;
+ default:
+ expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_stream_method, "Unknown stream method %u", method_id);
+ }
+ break;
+ case AMQP_0_9_CLASS_TX:
+ method_id = tvb_get_ntohs(tvb, 9);
+ proto_tree_add_item(amqp_tree, hf_amqp_method_tx_method_id,
+ tvb, 9, 2, ENC_BIG_ENDIAN);
+ ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
+ tvb, 11, length - 4, ENC_NA);
+ args_tree = proto_item_add_subtree(ti, ett_args);
- if (prop_flags & 0x8000) {
- /* proxy-name (shortstr) */
- proto_tree_add_item(prop_tree, hf_amqp_header_tunnel_proxy_name,
- tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
- offset += 1 + tvb_get_guint8(tvb, offset);
- }
- prop_flags <<= 1;
+ col_append_fstr(pinfo->cinfo, COL_INFO, "Tx.%s ",
+ val_to_str( method_id, amqp_method_tx_methods, "Unknown (%u)"));
- if (prop_flags & 0x8000) {
- /* data-name (shortstr) */
- proto_tree_add_item(prop_tree, hf_amqp_header_tunnel_data_name,
- tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
- offset += 1 + tvb_get_guint8(tvb, offset);
- }
- prop_flags <<= 1;
+ switch (method_id) {
+ case AMQP_0_9_METHOD_TX_SELECT:
+ dissect_amqp_0_9_method_tx_select(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_TX_SELECT_OK:
+ dissect_amqp_0_9_method_tx_select_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_TX_COMMIT:
+ dissect_amqp_0_9_method_tx_commit(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_TX_COMMIT_OK:
+ dissect_amqp_0_9_method_tx_commit_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_TX_ROLLBACK:
+ dissect_amqp_0_9_method_tx_rollback(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_TX_ROLLBACK_OK:
+ dissect_amqp_0_9_method_tx_rollback_ok(tvb,
+ 11, args_tree);
+ break;
+ default:
+ expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_tx_method, "Unknown tx method %u", method_id);
+ }
+ break;
+ case AMQP_0_9_CLASS_DTX:
+ method_id = tvb_get_ntohs(tvb, 9);
+ proto_tree_add_item(amqp_tree, hf_amqp_method_dtx_method_id,
+ tvb, 9, 2, ENC_BIG_ENDIAN);
+ ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
+ tvb, 11, length - 4, ENC_NA);
+ args_tree = proto_item_add_subtree(ti, ett_args);
- if (prop_flags & 0x8000) {
- /* durable (octet) */
- proto_tree_add_item(prop_tree, hf_amqp_header_tunnel_durable,
- tvb, offset, 1, ENC_BIG_ENDIAN);
- offset += 1;
- }
- prop_flags <<= 1;
+ col_append_fstr(pinfo->cinfo, COL_INFO, "Dtx.%s ",
+ val_to_str( method_id, amqp_method_dtx_methods, "Unknown (%u)"));
- if (prop_flags & 0x8000) {
- /* broadcast (octet) */
- proto_tree_add_item(prop_tree, hf_amqp_header_tunnel_broadcast,
- tvb, offset, 1, ENC_BIG_ENDIAN);
- offset += 1;
+ switch (method_id) {
+ case AMQP_0_9_METHOD_DTX_SELECT:
+ dissect_amqp_0_9_method_dtx_select(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_DTX_SELECT_OK:
+ dissect_amqp_0_9_method_dtx_select_ok(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_DTX_START:
+ dissect_amqp_0_9_method_dtx_start(tvb,
+ 11, args_tree);
+ break;
+ case AMQP_0_9_METHOD_DTX_START_OK:
+ dissect_amqp_0_9_method_dtx_start_ok(tvb,
+ 11, args_tree);
+ break;
+ default:
+ expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_dtx_method, "Unknown dtx method %u", method_id);
+ }
+ break;
+ case AMQP_0_9_CLASS_TUNNEL:
+ method_id = tvb_get_ntohs(tvb, 9);
+ proto_tree_add_item(amqp_tree, hf_amqp_method_tunnel_method_id,
+ tvb, 9, 2, ENC_BIG_ENDIAN);
+ ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
+ tvb, 11, length - 4, ENC_NA);
+ args_tree = proto_item_add_subtree(ti, ett_args);
+ switch (method_id) {
+ case AMQP_0_9_METHOD_TUNNEL_REQUEST:
+ dissect_amqp_0_9_method_tunnel_request(tvb,
+ pinfo, 11, args_tree);
+ col_append_str(pinfo->cinfo, COL_INFO,
+ "Tunnel.Request ");
+ break;
+ default:
+ expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_tunnel_method, "Unknown tunnel method %u", method_id);
+ }
+ break;
+ case AMQP_0_9_CLASS_CONFIRM:
+ method_id = tvb_get_ntohs(tvb, 9);
+ proto_tree_add_item(amqp_tree, hf_amqp_method_confirm_method_id,
+ tvb, 9, 2, ENC_BIG_ENDIAN);
+ ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
+ tvb, 11, length - 4, ENC_NA);
+ args_tree = proto_item_add_subtree(ti, ett_args);
+ switch (method_id) {
+ case AMQP_0_9_METHOD_CONFIRM_SELECT:
+ dissect_amqp_0_9_method_confirm_select(tvb,
+ 11, args_tree);
+ col_append_str(pinfo->cinfo, COL_INFO,
+ "Confirm.Select ");
+ break;
+ case AMQP_0_9_METHOD_CONFIRM_SELECT_OK:
+ dissect_amqp_0_9_method_confirm_select_ok(channel_num, tvb, pinfo,
+ 11, args_tree);
+ col_append_str(pinfo->cinfo, COL_INFO,
+ "Confirm.Select-Ok ");
+ break;
+ default:
+ expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_confirm_method, "Unknown confirm method %u", method_id);
+ }
+ break;
+ default:
+ expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_method_class, "Unknown method class %u", class_id);
+ }
+ break;
+ case AMQP_0_9_FRAME_TYPE_CONTENT_HEADER:
+ class_id = tvb_get_ntohs(tvb, 7);
+ proto_tree_add_item(amqp_tree, hf_amqp_header_class_id,
+ tvb, 7, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(amqp_tree, hf_amqp_header_weight,
+ tvb, 9, 2, ENC_BIG_ENDIAN);
+ proto_tree_add_item(amqp_tree, hf_amqp_header_body_size,
+ tvb, 11, 8, ENC_BIG_ENDIAN);
+ proto_tree_add_item(amqp_tree, hf_amqp_header_property_flags,
+ tvb, 19, 2, ENC_BIG_ENDIAN);
+ ti = proto_tree_add_item(amqp_tree, hf_amqp_header_properties,
+ tvb, 21, length - 14, ENC_NA);
+ prop_tree = proto_item_add_subtree(ti, ett_props);
+ col_append_str(pinfo->cinfo, COL_INFO, "Content-Header ");
+ switch (class_id) {
+ case AMQP_0_9_CLASS_BASIC:
+ dissect_amqp_0_9_content_header_basic(tvb,
+ pinfo, 21, prop_tree);
+ break;
+ case AMQP_0_9_CLASS_FILE:
+ dissect_amqp_0_9_content_header_file(tvb,
+ pinfo, 21, prop_tree);
+ break;
+ case AMQP_0_9_CLASS_STREAM:
+ dissect_amqp_0_9_content_header_stream(tvb,
+ pinfo, 21, prop_tree);
+ break;
+ case AMQP_0_9_CLASS_TUNNEL:
+ dissect_amqp_0_9_content_header_tunnel(tvb,
+ pinfo, 21, prop_tree);
+ break;
+ default:
+ expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_header_class, "Unknown header class %u", class_id);
+ }
+ break;
+ case AMQP_0_9_FRAME_TYPE_CONTENT_BODY:
+ proto_tree_add_item(amqp_tree, hf_amqp_payload,
+ tvb, 7, length, ENC_NA);
+ col_append_str(pinfo->cinfo, COL_INFO, "Content-Body ");
+ break;
+ case AMQP_0_9_FRAME_TYPE_HEARTBEAT:
+ col_append_str(pinfo->cinfo, COL_INFO,
+ "Heartbeat ");
+ break;
+ default:
+ expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_frame_type, "Unknown frame type %u", frame_type);
}
- /*prop_flags <<= 1;*/
- return offset;
+ col_set_fence(pinfo->cinfo, COL_INFO);
+ return tvb_reported_length(tvb);
}
static amqp_channel_t*
packet_info *pinfo,
guint8 code,
int offset,
- int bound,
int hf_amqp_type,
const char *name,
guint32 hf_amqp_subtype_count,
{
/* we know the field as well its type, use native dissectors */
*length_size = element_type->dissector(tvb, pinfo,
- offset, bound,
+ offset,
element_type->known_size,
item, hf_amqp_type);
}
else
{
/* multi-type and custom fileds must be converted to a string */
- *length_size = element_type->formatter(tvb, offset, bound, element_type->known_size, &value);
+ *length_size = element_type->formatter(tvb, offset, element_type->known_size, &value);
if (code/16 > 0x9) /* variable width code is 0xa[0-9] or 0xb[0-9] */
/* shift to right to skip the variable length indicator */
*length_size = dissect_amqp_1_0_list(tvb,
pinfo,
offset-1, /* "-1" due to decode type again in the method */
- bound,
item,
hf_amqp_type,
hf_amqp_subtype_count,
case AMQP_1_0_TYPE_MAP8:
case AMQP_1_0_TYPE_MAP32:
/* "-1" due to decode type again in the method */
- *length_size = dissect_amqp_1_0_map(tvb, pinfo, offset-1, bound, item, hf_amqp_type, name)-1;
+ *length_size = dissect_amqp_1_0_map(tvb, pinfo, offset-1, item, hf_amqp_type, name)-1;
break;
case AMQP_1_0_TYPE_ARRAY8:
case AMQP_1_0_TYPE_ARRAY32:
*length_size = dissect_amqp_1_0_array(tvb,
pinfo,
offset-1, /* "-1" due to decode type again in the method */
- bound,
item,
hf_amqp_type,
hf_amqp_subtype_count,
"Unknown AMQP type %d (0x%x) of field \"%s\"",
code, code,
name ? name : proto_registrar_get_name(hf_amqp_type));
- *length_size = bound-offset; /* to stop dissecting */
+ *length_size = tvb_reported_length_remaining(tvb, offset); /* to stop dissecting */
break;
}
}
static guint
get_amqp_1_0_type_formatter(tvbuff_t *tvb,
int offset,
- int bound,
int *hf_amqp_type,
const char **name,
guint32 *hf_amqp_subtype_count,
guint orig_offset = offset;
code = tvb_get_guint8(tvb, offset);
- AMQP_INCREMENT(offset, 1, bound);
+ offset += 1;
if (code == AMQP_1_0_TYPE_DESCRIPTOR_CONSTRUCTOR) {
format_code_type = tvb_get_guint8(tvb, offset);
- AMQP_INCREMENT(offset, 1, bound);
+ offset += 1;
if (format_code_type%16==0xf) { /* i.e. format codes like %x5F %x00-FF */
- AMQP_INCREMENT(offset, 1, bound);
+ offset += 1;
}
switch (format_code_type/16) {
case 4: /* empty */
/* TODO: somehow set code = next_128_bytes */
break;
case 0xa: /* variable-one */
- format_len = format_amqp_1_0_str(tvb, offset, bound, 1, name);
+ format_len = format_amqp_1_0_str(tvb, offset, 1, name);
break;
case 0xb: /* variable-four */
- format_len = format_amqp_1_0_str(tvb, offset, bound, 4, name);
+ format_len = format_amqp_1_0_str(tvb, offset, 4, name);
break;
/* TODO: could be type compound? or array? */
}
- AMQP_INCREMENT(offset, format_len, bound);
+ offset += format_len;
for (i = 0; amqp_1_0_defined_types[i].format_code != 0x00; ++i) {
if (amqp_1_0_defined_types[i].format_code == code) {
*hf_amqp_type = *(amqp_1_0_defined_types[i].hf_amqp_type);
}
/* now take the real primitive format code */
code = tvb_get_guint8(tvb, offset);
- AMQP_INCREMENT(offset, 1, bound);
+ offset += 1;
}
*length_size = (offset-orig_offset);
return code;
get_amqp_1_0_type_value_formatter(tvbuff_t *tvb,
packet_info *pinfo,
int offset,
- int bound,
int hf_amqp_type, /* what to print in GUI if name==NULL */
const char *name, /* what to print in GUI */
guint *length_size, /* decoded length */
code = get_amqp_1_0_type_formatter(tvb,
offset,
- bound,
&hf_amqp_type,
&type_name,
&hf_amqp_subtype_count,
format_name = wmem_strdup_printf(wmem_packet_scope(), "%s : %s", name, type_name);
}
}
- AMQP_INCREMENT(offset, type_length_size, bound);
+ offset += type_length_size;
get_amqp_1_0_value_formatter(tvb,
pinfo,
code,
offset,
- bound,
hf_amqp_type,
format_name,
hf_amqp_subtype_count,
static int
dissect_amqp_1_0_fixed(tvbuff_t *tvb, packet_info *pinfo _U_,
- guint offset, guint bound _U_, guint length,
+ guint offset, guint length,
proto_item *item, int hf_amqp_type)
{
proto_tree_add_item(item, hf_amqp_type, tvb, offset, length, ENC_BIG_ENDIAN);
static int
dissect_amqp_1_0_variable(tvbuff_t *tvb, packet_info *pinfo,
- guint offset, guint bound, guint length,
+ guint offset, guint length,
proto_item *item, int hf_amqp_type)
{
guint bin_length;
"Invalid size of length indicator %d!", length);
return length;
}
- AMQP_INCREMENT(offset, length, bound);
+ offset += length;
proto_tree_add_item(item, hf_amqp_type, tvb, offset, bin_length, ENC_NA);
return length+bin_length;
static int
dissect_amqp_1_0_timestamp(tvbuff_t *tvb, packet_info *pinfo _U_,
- guint offset, guint bound _U_, guint length,
+ guint offset, guint length,
proto_item *item, int hf_amqp_type)
{
nstime_t nstime;
static int
dissect_amqp_1_0_skip(tvbuff_t *tvb _U_, packet_info *pinfo _U_,
- guint offset _U_, guint bound _U_, guint length _U_,
+ guint offset _U_, guint length _U_,
proto_item *item _U_, int hf_amqp_type _U_)
{
/* null value means the respective field is omitted */
static int
dissect_amqp_1_0_zero(tvbuff_t *tvb, packet_info *pinfo,
- guint offset, guint bound _U_, guint length _U_,
+ guint offset, guint length _U_,
proto_item *item, int hf_amqp_type)
{
switch(proto_registrar_get_ftype(hf_amqp_type))
static int
dissect_amqp_1_0_true(tvbuff_t *tvb, packet_info *pinfo _U_,
- guint offset, guint bound _U_, guint length _U_,
+ guint offset, guint length _U_,
proto_item *item, int hf_amqp_type)
{
proto_tree_add_boolean(item, hf_amqp_type, tvb, offset-1, 1, TRUE);
static int
dissect_amqp_1_0_false(tvbuff_t *tvb, packet_info *pinfo _U_,
- guint offset, guint bound _U_, guint length _U_,
+ guint offset, guint length _U_,
proto_item *item, int hf_amqp_type)
{
proto_tree_add_boolean(item, hf_amqp_type, tvb, offset-1, 1, FALSE);
static int
format_amqp_1_0_null(tvbuff_t *tvb _U_,
- guint offset _U_, guint bound _U_, guint length _U_,
+ guint offset _U_, guint length _U_,
const char **value)
{
*value = "(null)";
static int
format_amqp_1_0_boolean_true(tvbuff_t *tvb _U_,
- guint offset _U_, guint bound _U_, guint length _U_,
+ guint offset _U_, guint length _U_,
const char **value)
{
*value = wmem_strdup(wmem_packet_scope(), "true");
static int
format_amqp_1_0_boolean_false(tvbuff_t *tvb _U_,
- guint offset _U_, guint bound _U_, guint length _U_,
+ guint offset _U_, guint length _U_,
const char **value)
{
*value = wmem_strdup(wmem_packet_scope(), "false");
static int
format_amqp_1_0_boolean(tvbuff_t *tvb,
- guint offset, guint bound _U_, guint length _U_,
+ guint offset, guint length _U_,
const char **value)
{
guint8 val;
/* this covers ubyte, ushort, uint and ulong */
static int
format_amqp_1_0_uint(tvbuff_t *tvb,
- guint offset, guint bound _U_, guint length,
+ guint offset, guint length,
const char **value)
{
guint64 val;
/* this covers byte, short, int and long */
static int
format_amqp_1_0_int(tvbuff_t *tvb,
- guint offset, guint bound _U_, guint length,
+ guint offset, guint length,
const char **value)
{
gint64 val;
}
static int
-format_amqp_1_0_float(tvbuff_t *tvb,
- guint offset, guint bound _U_, guint length _U_,
+format_amqp_1_0_float(tvbuff_t *tvb, guint offset, guint length _U_,
const char **value)
{
float floatval;
}
static int
-format_amqp_1_0_double(tvbuff_t *tvb,
- guint offset, guint bound _U_, guint length _U_,
+format_amqp_1_0_double(tvbuff_t *tvb, guint offset, guint length _U_,
const char **value)
{
double doubleval;
}
static int
-format_amqp_1_0_decimal(tvbuff_t *tvb _U_,
- guint offset _U_, guint bound _U_, guint length,
+format_amqp_1_0_decimal(tvbuff_t *tvb _U_, guint offset _U_, guint length,
const char **value)
{
/* TODO: this requires the _Decimal32 datatype from ISO/IEC TR 24732
}
static int
-format_amqp_1_0_char(tvbuff_t *tvb,
- guint offset, guint bound _U_, guint length _U_,
+format_amqp_1_0_char(tvbuff_t *tvb, guint offset, guint length _U_,
const char **value)
{
/* one UTF-32BE encoded Unicode character */
}
static int
-format_amqp_1_0_timestamp(tvbuff_t *tvb,
- guint offset, guint bound _U_, guint length _U_,
+format_amqp_1_0_timestamp(tvbuff_t *tvb, guint offset, guint length _U_,
const char **value)
{
nstime_t nstime;
}
static int
-format_amqp_1_0_uuid(tvbuff_t *tvb,
- guint offset, guint bound _U_, guint length _U_,
+format_amqp_1_0_uuid(tvbuff_t *tvb, guint offset, guint length _U_,
const char **value)
{
e_guid_t uuid;
static int
format_amqp_1_0_bin(tvbuff_t *tvb,
- guint offset, guint bound, guint length,
+ guint offset, guint length,
const char **value)
{
guint bin_length;
*value = wmem_strdup_printf(wmem_packet_scope(), "Invalid binary length size %d!", length);
return length;
}
- AMQP_INCREMENT(offset, length, bound);
+ offset += length;
*value = tvb_bytes_to_str(wmem_packet_scope(), tvb, offset, bin_length);
return (length+bin_length);
}
static int
format_amqp_1_0_str(tvbuff_t *tvb,
- guint offset, guint bound, guint length,
+ guint offset, guint length,
const char **value)
{
guint string_length;
*value = wmem_strdup_printf(wmem_packet_scope(), "Invalid string length size %d!", length);
return length;
}
- AMQP_INCREMENT(offset, length, bound);
+ offset += length;
*value = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, string_length, ENC_UTF_8|ENC_NA);
- AMQP_INCREMENT(offset, string_length, bound);
+ /* offset += string_length; */
return (string_length + length);
}
static int
format_amqp_1_0_symbol(tvbuff_t *tvb,
- guint offset, guint bound, guint length,
+ guint offset, guint length,
const char **value)
{
guint symbol_length;
*value = wmem_strdup_printf(wmem_packet_scope(), "Invalid symbol length size %d!", length);
return length;
}
- AMQP_INCREMENT(offset, length, bound);
+ offset += length;
*value = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, symbol_length, ENC_ASCII|ENC_NA);
- AMQP_INCREMENT(offset, symbol_length, bound);
+ /* offset += symbol_length; */
return (symbol_length + length);
}
static int
format_amqp_0_10_bin(tvbuff_t *tvb,
- guint offset, guint bound _U_, guint length,
+ guint offset, guint length,
const char **value)
{
*value = tvb_bytes_to_str(wmem_packet_scope(), tvb, offset, length);
static int
format_amqp_0_10_int(tvbuff_t *tvb,
- guint offset, guint bound _U_, guint length,
+ guint offset, guint length,
const char **value)
{
int val;
static int
format_amqp_0_10_uint(tvbuff_t *tvb,
- guint offset, guint bound _U_, guint length,
+ guint offset, guint length,
const char **value)
{
unsigned int val;
static int
format_amqp_0_10_char(tvbuff_t *tvb,
- guint offset, guint bound _U_, guint length _U_,
+ guint offset, guint length _U_,
const char **value)
{
*value = tvb_format_text(tvb, offset, 1);
static int
format_amqp_0_10_boolean(tvbuff_t *tvb,
- guint offset, guint bound _U_, guint length _U_,
+ guint offset, guint length _U_,
const char **value)
{
guint8 val;
static int
format_amqp_0_10_vbin(tvbuff_t *tvb,
- guint offset, guint bound, guint length,
+ guint offset, guint length,
const char **value)
{
guint bin_length;
*value = wmem_strdup_printf(wmem_packet_scope(), "Invalid vbin length size %d!", length);
return length;
}
- AMQP_INCREMENT(offset, length, bound);
+ offset += length;
*value = tvb_bytes_to_str(wmem_packet_scope(), tvb, offset, bin_length);
- AMQP_INCREMENT(offset, bin_length, bound);
+ /* offset += bin_length; */
return (bin_length + length);
}
static int
format_amqp_0_10_str(tvbuff_t *tvb,
- guint offset, guint bound, guint length,
+ guint offset, guint length,
const char **value)
{
guint string_length;
*value = wmem_strdup_printf(wmem_packet_scope(), "Invalid string length size %d!", length);
return length;
}
- AMQP_INCREMENT(offset, length, bound);
+ offset += length;
*value = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, string_length, ENC_UTF_8|ENC_NA);
- AMQP_INCREMENT(offset, string_length, bound);
+ /* offset += string_length; */
return (string_length + length);
}
format_amqp_0_10_sequence_set(tvbuff_t *tvb, guint offset, guint length,
proto_item *item)
{
- gint values;
+ guint i, values;
/* Must be 4-byte values */
if ((length % 4) != 0) {
values);
}
proto_item_append_text(item, " [");
- while(values > 0) {
+ for (i = 0; i < values; i += 2) {
proto_item_append_text(item, "(%u, %u)%s",
tvb_get_ntohl(tvb, offset),
tvb_get_ntohl(tvb, offset + 4),
- values > 2 ? ", " : "");
+ (i < (values - 2)) ? ", " : "");
offset += 8;
- values -= 2;
+ length -= 8;
}
proto_item_append_text(item, "]");
}
+/* Main dissection routine */
+
+static int
+dissect_amqp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
+{
+ conversation_t *conv;
+ amqp_conv *conn;
+
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "AMQP");
+ col_clear(pinfo->cinfo, COL_INFO);
+
+ /* We need at least 8 bytes to check the protocol and get the frame size */
+ if (tvb_reported_length (tvb) < 8) {
+ /* But at this moment we don't know how much we will need */
+ pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
+ return -1; /* need more data */
+ }
+
+ /* Find (or build) conversation to remember the protocol version */
+ conv = find_or_create_conversation(pinfo);
+ conn = (amqp_conv *)conversation_get_proto_data(conv, proto_amqp);
+ if (conn == NULL) {
+ conn = wmem_new0(wmem_file_scope(), amqp_conv);
+ conn->channels = wmem_map_new(wmem_file_scope(), g_direct_hash, g_direct_equal);
+ conversation_add_proto_data(conv, proto_amqp, conn);
+ }
+ check_amqp_version(tvb, conn);
+ switch(conn->version) {
+ case AMQP_V0_9:
+ tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 7, get_amqp_0_9_message_len,
+ dissect_amqp_0_9_frame, data);
+ break;
+ case AMQP_V0_10:
+ tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 8, get_amqp_0_10_message_len,
+ dissect_amqp_0_10_frame, data);
+ break;
+ case AMQP_V1_0:
+ tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 8, get_amqp_1_0_message_len,
+ dissect_amqp_1_0_frame, data);
+ break;
+ default:
+ col_append_str(pinfo->cinfo, COL_INFO, "AMQP (unknown version)");
+ col_set_fence(pinfo->cinfo, COL_INFO);
+ break;
+ }
+
+ return tvb_captured_length(tvb);
+}
+
/* Basic registration functions */
void
"Implementation-specific xid format code", HFILL}},
{&hf_amqp_0_10_dtx_xid_global_id, {
"Global-id", "amqp.dtx.xid.global-id",
- FT_BYTES, BASE_NONE, NULL, 0x0,
+ FT_UINT_BYTES, BASE_NONE, NULL, 0x0,
"Global transaction id", HFILL}},
{&hf_amqp_0_10_dtx_xid_branch_id, {
"Branch-id", "amqp.dtx.xid.branch-id",
- FT_BYTES, BASE_NONE, NULL, 0x0,
+ FT_UINT_BYTES, BASE_NONE, NULL, 0x0,
"Transaction branch qualifier", HFILL}},
- {&hf_amqp_0_10_undissected_struct32, {
- "(undissected struct)", "amqp.undissected",
- FT_NONE, BASE_NONE, NULL, 0x0,
- "Message header struct not yet dissected", HFILL}},
+ {&hf_amqp_0_10_struct32_size, {
+ "Size", "amqp.struct32_size",
+ FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}},
+ {&hf_amqp_0_10_struct32, {
+ "struct", "amqp.struct32",
+ FT_UINT16, BASE_HEX, VALS(amqp_0_10_struct32_vals), 0x0,
+ NULL, HFILL}},
+ {&hf_amqp_0_10_struct32_class, {
+ "Class", "amqp.struct32.class",
+ FT_UINT8, BASE_DEC, VALS(amqp_0_10_class), 0x0,
+ NULL, HFILL}},
+ {&hf_amqp_0_10_struct32_struct, {
+ "Struct", "amqp.struct32.struct",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}},
+ {&hf_amqp_0_10_struct32_padding, {
+ "Padding", "amqp.struct32.padding",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL}},
+ {&hf_amqp_0_10_array_type, {
+ "Type", "amqp.array.type",
+ FT_UINT8, BASE_DEC, VALS(amqp_0_10_array_type_vals), 0x0,
+ NULL, HFILL}},
+ {&hf_amqp_0_10_array_element_count, {
+ "Element count", "amqp.array.element_count",
+ FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}},
+ {&hf_amqp_0_10_array_string, {
+ "String", "amqp.array.string",
+ FT_UINT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL}},
{&hf_amqp_0_10_struct_delivery_properties_discard_unroutable, {
"Discard-unroutable", "amqp.message.delivery-properties.discard-unroutable",
FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01,
"Expiration time calculated by broker", HFILL}},
{&hf_amqp_0_10_struct_delivery_properties_exchange, {
"Exchange", "amqp.message.delivery-properties.exchange",
- FT_STRING, BASE_NONE, NULL, 0x0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0x0,
"Originating exchange", HFILL}},
{&hf_amqp_0_10_struct_delivery_properties_routing_key, {
"Routing-key", "amqp.message.delivery-properties.routing-key",
- FT_STRING, BASE_NONE, NULL, 0x0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0x0,
"Message routing key", HFILL}},
{&hf_amqp_0_10_struct_delivery_properties_resume_ttl, {
"Resume-ttl", "amqp.message.delivery-properties.resume-ttl",
NULL, HFILL}},
{&hf_amqp_0_10_struct_message_properties_correlation, {
"Correlation-id", "amqp.message.message-properties.correlation-id",
- FT_BYTES, BASE_NONE, NULL, 0x0,
+ FT_UINT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL}},
{&hf_amqp_0_10_struct_message_properties_reply_to, {
"Reply-to", "amqp.message.message-properties.reply-to",
"Address to reply to", HFILL}},
{&hf_amqp_0_10_struct_message_properties_content_type, {
"Content-type", "amqp.message.message-properties.content-type",
- FT_STRING, BASE_NONE, NULL, 0x0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0x0,
"MIME content type", HFILL}},
{&hf_amqp_0_10_struct_message_properties_content_encoding, {
"Content-encoding", "amqp.message.message-properties.content-encoding",
- FT_STRING, BASE_NONE, NULL, 0x0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0x0,
"MIME content encoding method", HFILL}},
{&hf_amqp_0_10_struct_message_properties_user_id, {
"User-id", "amqp.message.message-properties.user-id",
- FT_BYTES, BASE_NONE, NULL, 0x0,
+ FT_UINT_BYTES, BASE_NONE, NULL, 0x0,
"Creating user id", HFILL}},
{&hf_amqp_0_10_struct_message_properties_app_id, {
"App-id", "amqp.message.message-properties.app-id",
- FT_BYTES, BASE_NONE, NULL, 0x0,
+ FT_UINT_BYTES, BASE_NONE, NULL, 0x0,
"Creating user id", HFILL}},
{&hf_amqp_0_10_struct_message_properties_application_headers, {
"Application-headers", "amqp.message.message-properties.application-headers",
"Application-private headers", HFILL}},
{&hf_amqp_0_10_struct_reply_to_exchange, {
"Exchange", "amqp.message.message-properties.reply-to.exchange",
- FT_STRING, BASE_NONE, NULL, 0x0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0x0,
"Exchange to reply to", HFILL}},
{&hf_amqp_0_10_struct_reply_to_routing_key, {
"Routing-key", "amqp.message.message-properties.reply-to.routing-key",
- FT_STRING, BASE_NONE, NULL, 0x0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0x0,
"Routing key to reply with", HFILL}},
{&hf_amqp_0_10_struct_acquired_transfers, {
"Transfers", "amqp.message.acquired.transfers",
"Number of subscribers for the queue", HFILL}},
{&hf_amqp_0_10_struct_file_properties_content_type, {
"Content-type", "amqp.file.file-properties.content-type",
- FT_STRING, BASE_NONE, NULL, 0x0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0x0,
"MIME content type", HFILL}},
{&hf_amqp_0_10_struct_file_properties_content_encoding, {
"Content-encoding", "amqp.file.file-properties.content-encoding",
- FT_STRING, BASE_NONE, NULL, 0x0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0x0,
"MIME content encoding", HFILL}},
{&hf_amqp_0_10_struct_file_properties_headers, {
"Headers", "amqp.file.file-properties.headers",
"Message priority, 0 to 9", HFILL}},
{&hf_amqp_0_10_struct_file_properties_reply_to, {
"Reply-to", "amqp.file.file-properties.reply-to",
- FT_STRING, BASE_NONE, NULL, 0x0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0x0,
"Destination to reply to", HFILL}},
{&hf_amqp_0_10_struct_file_properties_message_id, {
"Message-id", "amqp.file.file-properties.message-id",
- FT_STRING, BASE_NONE, NULL, 0x0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0x0,
"Application message identifier", HFILL}},
{&hf_amqp_0_10_struct_file_properties_filename, {
"Filename", "amqp.file.file-properties.filename",
- FT_STRING, BASE_NONE, NULL, 0x0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0x0,
"Message filename", HFILL}},
{&hf_amqp_0_10_struct_file_properties_timestamp, {
"Timestamp", "amqp.file.file-properties.timestamp",
"Message timestamp", HFILL}},
{&hf_amqp_0_10_struct_file_properties_cluster_id, {
"Cluster-id", "amqp.file.file-properties.cluster-id",
- FT_STRING, BASE_NONE, NULL, 0x0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0x0,
"Intra-cluster routing identifier", HFILL}},
{&hf_amqp_0_10_struct_stream_properties_content_type, {
"Content-type", "amqp.stream.stream-properties.content-type",
- FT_STRING, BASE_NONE, NULL, 0x0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0x0,
"MIME content type", HFILL}},
{&hf_amqp_0_10_struct_stream_properties_content_encoding, {
"Content-encoding", "amqp.stream.stream-properties.content-encoding",
- FT_STRING, BASE_NONE, NULL, 0x0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0x0,
"MIME content encoding", HFILL}},
{&hf_amqp_0_10_struct_stream_properties_headers, {
"Headers", "amqp.stream.stream-properties.headers",
FT_BOOLEAN, 8, TFS(&amqp_0_10_session_header_sync), 0x01,
"Sync requested", HFILL}},
{&hf_amqp_0_10_method_session_attach_name, {
- "Name", "amqp.session.attach.name",
+ "Session Name", "amqp.session.attach.name",
FT_BYTES, BASE_NONE, NULL, 0x0,
- "Session name", HFILL}},
+ NULL, HFILL}},
+ {&hf_amqp_0_10_method_session_attach_name_size, {
+ "Size", "amqp.session.attach.name.size",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ NULL, HFILL}},
{&hf_amqp_0_10_method_session_attach_force, {
- "Force", "amqp.session.attach.force",
+ "Session forced", "amqp.session.attach.force",
FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
- "Session forced", HFILL}},
+ NULL, HFILL}},
{&hf_amqp_0_10_method_session_detached_code, {
"Code", "amqp.session.detached.code",
FT_UINT8, BASE_DEC, VALS(amqp_0_10_method_session_detached_codes), 0x0,
"0-based index of exceptional field", HFILL}},
{&hf_amqp_0_10_method_execution_description, {
"Description", "amqp.execution.exception.description",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Description of exception", HFILL}},
{&hf_amqp_0_10_method_execution_error_info, {
"Error-info", "amqp.execution.exception.error-info",
"client-properties", HFILL}},
{&hf_amqp_0_10_method_message_transfer_destination, {
"Description", "amqp.message.transfer.destination",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Message destination", HFILL}},
{&hf_amqp_0_10_method_message_transfer_accept_mode, {
"Accept-mode", "amqp.message.transfer.accept-mode",
"Message reject code", HFILL}},
{&hf_amqp_0_10_method_message_reject_text, {
"Text", "amqp.message.reject.text",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Reject description", HFILL}},
{&hf_amqp_0_10_method_message_release_set_redelivered, {
"Set-redelivered", "amqp.message.release.set-redelivered",
"Mark redelivered on next transfer from queue", HFILL}},
{&hf_amqp_0_10_method_message_dest, {
"Destination", "amqp.message.destination",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Message destination", HFILL}},
{&hf_amqp_0_10_method_message_resume_id, {
"Resume-Id", "amqp.message.resume.id",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Message id to resume", HFILL}},
{&hf_amqp_0_10_method_message_subscribe_queue, {
"Queue", "amqp.message.subscribe.queue",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Queue to subscribe to", HFILL}},
{&hf_amqp_0_10_method_message_subscribe_exclusive, {
"Exclusive", "amqp.message.subscribe.exclusive",
"Transaction timeout value in seconds", HFILL}},
{&hf_amqp_0_10_method_exchange_declare_exchange, {
"Exchange", "amqp.exchange.declare.exchange",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Exchange to declare", HFILL}},
{&hf_amqp_0_10_method_exchange_declare_type, {
"Type", "amqp.exchange.declare.type",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Type of exchange to declare", HFILL}},
{&hf_amqp_0_10_method_exchange_declare_alt_exchange, {
"Alternate-exchange", "amqp.exchange.declare.alternate-exchange",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Alternate exchange for unroutable messages", HFILL}},
{&hf_amqp_0_10_method_exchange_declare_passive, {
"Passive", "amqp.exchange.declare.passive",
"Delete exchange only if it has no queue bindings", HFILL}},
{&hf_amqp_0_10_method_exchange_bind_queue, {
"Queue", "amqp.exchange.bind.queue",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Queue to bind to", HFILL}},
{&hf_amqp_0_10_method_exchange_binding_key, {
"Binding-key", "amqp.exchange.bind.binding-key",
"Binding between exchange and queue", HFILL}},
{&hf_amqp_0_10_method_queue_name, {
"Queue", "amqp.queue.declare.queue",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Queue name", HFILL}},
{&hf_amqp_0_10_method_queue_alt_exchange, {
"Alternate-exchange", "amqp.queue.declare.alternate-exchange",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
NULL, HFILL}},
{&hf_amqp_0_10_method_queue_declare_passive, {
"Passive", "amqp.queue.declare.passive",
"Apply QoS to entire connection", HFILL}},
{&hf_amqp_0_10_method_file_consumer_tag, {
"Consumer-tag", "amqp.file.consumer-tag",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Consumer tag", HFILL}},
{&hf_amqp_0_10_method_file_consume_no_local, {
"No-local", "amqp.file.consume.no-local",
"Arguments for consuming", HFILL}},
{&hf_amqp_0_10_method_file_identifier, {
"Identifier", "amqp.file.identifier",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Staging identifier", HFILL}},
{&hf_amqp_0_10_method_file_open_content_size, {
"Content-size", "amqp.file.open.content-size",
"Amount of previously staged content in octets", HFILL}},
{&hf_amqp_0_10_method_file_publish_exchange, {
"Exchange", "amqp.file.publish.exchange",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Exchange to publish to", HFILL}},
{&hf_amqp_0_10_method_file_publish_routing_key, {
"Routing-key", "amqp.file.publish.routing-key",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Message routing key", HFILL}},
{&hf_amqp_0_10_method_file_publish_mandatory, {
"Mandatory", "amqp.file.publish.mandatory",
NULL, HFILL}},
{&hf_amqp_0_10_method_file_return_reply_text, {
"Reply-text", "amqp.file.return.reply-text",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Localized reply text", HFILL}},
{&hf_amqp_0_10_method_file_return_exchange, {
"Exchange", "amqp.file.return.exchange",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Exchange the original message was published to", HFILL}},
{&hf_amqp_0_10_method_file_return_routing_key, {
"Routing-key", "amqp.file.return.routing-key",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Message routing key", HFILL}},
{&hf_amqp_0_10_method_file_deliver_consumer_tag, {
"Consumer-tag", "amqp.file.deliver.consumer-tag",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
NULL, HFILL}},
{&hf_amqp_0_10_method_file_deliver_delivery_tag, {
"Delivery-tag", "amqp.file.deliver.delivery-tag",
"Possible duplicate delivery", HFILL}},
{&hf_amqp_0_10_method_file_deliver_exchange, {
"Exchange", "amqp.file.deliver.exchange",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Exchange the original message was published to", HFILL}},
{&hf_amqp_0_10_method_file_deliver_routing_key, {
"Routing-key", "amqp.file.deliver.routing-key",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Message routing key", HFILL}},
{&hf_amqp_0_10_method_file_ack_delivery_tag, {
"Delivery-tag", "amqp.file.ack.delivery-tag",
"Apply QoS to entire connection", HFILL}},
{&hf_amqp_0_10_method_stream_consumer_tag, {
"Consumer-tag", "amqp.stream.consumer-tag",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
NULL, HFILL}},
{&hf_amqp_0_10_method_stream_consume_no_local, {
"No-local", "amqp.stream.consume.no-local",
"Arguments for consuming", HFILL}},
{&hf_amqp_0_10_method_stream_publish_exchange, {
"Exchange", "amqp.stream.publish.exchange",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Exchange to publish to", HFILL}},
{&hf_amqp_0_10_method_stream_publish_routing_key, {
"Routing-key", "amqp.stream.publish.routing-key",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Message routing key", HFILL}},
{&hf_amqp_0_10_method_stream_publish_mandatory, {
"Mandatory", "amqp.stream.publish.mandatory",
NULL, HFILL}},
{&hf_amqp_0_10_method_stream_return_reply_text, {
"Reply-text", "amqp.stream.return.reply-text",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Localized reply text", HFILL}},
{&hf_amqp_0_10_method_stream_return_exchange, {
"Exchange", "amqp.stream.return.exchange",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Exchange the original message was published to", HFILL}},
{&hf_amqp_0_10_method_stream_return_routing_key, {
"Routing-key", "amqp.stream.return.routing-key",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Message routing key", HFILL}},
{&hf_amqp_0_10_method_stream_deliver_consumer_tag, {
"Consumer-tag", "amqp.stream.deliver.consumer-tag",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
NULL, HFILL}},
{&hf_amqp_0_10_method_stream_deliver_delivery_tag, {
"Delivery-tag", "amqp.stream.deliver.delivery-tag",
"Server-assigned, session-specific delivery tag", HFILL}},
{&hf_amqp_0_10_method_stream_deliver_exchange, {
"Exchange", "amqp.stream.deliver.exchange",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Exchange the original message was published to", HFILL}},
{&hf_amqp_0_10_method_stream_deliver_queue, {
"Queue", "amqp.stream.deliver.queue",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
"Name of the queue the message came from", HFILL}},
{&hf_amqp_channel, {
"Channel", "amqp.channel",
FT_UINT16, BASE_DEC, NULL, 0x0,
"Channel ID", HFILL}},
+ {&hf_amqp_reserved, {
+ "Reserved", "amqp.reserved",
+ FT_UINT32, BASE_HEX, NULL, 0x0,
+ NULL, HFILL}},
{&hf_amqp_0_9_type, {
"Type", "amqp.type",
FT_UINT8, BASE_DEC, VALS(amqp_0_9_frame_types), 0x0,
NULL, HFILL}},
{&hf_amqp_method_connection_start_ok_mechanism, {
"Mechanism", "amqp.method.arguments.mechanism",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
NULL, HFILL}},
{&hf_amqp_method_connection_start_ok_response, {
"Response", "amqp.method.arguments.response",
- FT_BYTES, BASE_NONE, NULL, 0,
+ FT_UINT_BYTES, BASE_NONE, NULL, 0,
NULL, HFILL}},
{&hf_amqp_method_connection_start_ok_locale, {
"Locale", "amqp.method.arguments.locale",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
NULL, HFILL}},
{&hf_amqp_method_connection_secure_challenge, {
"Challenge", "amqp.method.arguments.challenge",
- FT_BYTES, BASE_NONE, NULL, 0,
+ FT_UINT_BYTES, BASE_NONE, NULL, 0,
NULL, HFILL}},
{&hf_amqp_method_connection_secure_ok_response, {
"Response", "amqp.method.arguments.response",
- FT_BYTES, BASE_NONE, NULL, 0,
+ FT_UINT_BYTES, BASE_NONE, NULL, 0,
NULL, HFILL}},
{&hf_amqp_method_connection_tune_channel_max, {
"Channel-Max", "amqp.method.arguments.channel_max",
NULL, HFILL}},
{&hf_amqp_method_connection_open_virtual_host, {
"Virtual-Host", "amqp.method.arguments.virtual_host",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
NULL, HFILL}},
{&hf_amqp_0_9_method_connection_open_capabilities, {
"Capabilities", "amqp.method.arguments.capabilities",
"Equivalent or alternate hosts for reconnection", HFILL}},
{&hf_amqp_method_connection_redirect_host, {
"Host", "amqp.method.arguments.host",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
NULL, HFILL}},
{&hf_amqp_0_9_method_connection_redirect_known_hosts, {
"Known-Hosts", "amqp.method.arguments.known_hosts",
"Close reason", HFILL}},
{&hf_amqp_method_connection_close_reply_text, {
"Reply-Text", "amqp.method.arguments.reply_text",
- FT_STRING, BASE_NONE, NULL, 0,
+ FT_UINT_STRING, BASE_NONE, NULL, 0,
NULL, HFILL}},
{&hf_amqp_method_connection_close_class_id, {
"Class-Id", "amqp.method.arguments.class_id",
"Broadcast", "amqp.method.properties.broadcast",
FT_UINT8, BASE_DEC, NULL, 0,
NULL, HFILL}},
+ {&hf_amqp_0_10_dtx_xa_status, {
+ "dtx.xa-status", "amqp.method.properties.broadcast",
+ FT_UINT16, BASE_DEC, VALS(amqp_0_10_xa_status), 0,
+ NULL, HFILL}},
{&hf_amqp_payload, {
"Payload", "amqp.payload",
FT_BYTES, BASE_NONE, NULL, 0,
{&hf_amqp_ack_in, {
"Ack in frame", "amqp.ack_in",
FT_FRAMENUM, BASE_NONE, NULL, 0,
- NULL, HFILL}}
+ NULL, HFILL}},
+ {&hf_amqp_method_connection_start_server_properties_size, {
+ "Size", "amqp.method.connection_start.server_properties.size",
+ FT_UINT32, BASE_DEC, NULL, 0,
+ NULL, HFILL}},
+ {&hf_amqp_0_10_method_connection_start_mechanisms_size, {
+ "Size", "amqp.method.connection_start.server_properties.size",
+ FT_UINT32, BASE_DEC, NULL, 0,
+ NULL, HFILL}},
+ {&hf_amqp_0_10_method_connection_start_locales_size, {
+ "Size", "amqp.method.connection_start.locales.size",
+ FT_UINT32, BASE_DEC, NULL, 0,
+ NULL, HFILL}},
+ {&hf_amqp_method_connection_start_ok_client_properties_size, {
+ "Size", "amqp.method.connection_start.ok_client_properties.size",
+ FT_UINT32, BASE_DEC, NULL, 0,
+ NULL, HFILL}},
+ {&hf_amqp_0_10_method_connection_open_capabilities_size, {
+ "Size", "amqp.method.connection_open.capabilities.size",
+ FT_UINT32, BASE_DEC, NULL, 0,
+ NULL, HFILL}},
+ {&hf_amqp_0_10_method_connection_open_ok_known_hosts_size, {
+ "Size", "amqp.method.connection_open.ok_known_hosts.size",
+ FT_UINT32, BASE_DEC, NULL, 0,
+ NULL, HFILL}},
+ {&hf_amqp_0_10_method_connection_redirect_known_hosts_size, {
+ "Size", "amqp.method.connection_redirect.known_hosts.size",
+ FT_UINT32, BASE_DEC, NULL, 0,
+ NULL, HFILL}},
+ {&hf_amqp_0_10_method_execution_error_info_size, {
+ "Size", "amqp.method.execution.error_info.size",
+ FT_UINT32, BASE_DEC, NULL, 0,
+ NULL, HFILL}},
+ {&hf_amqp_0_10_method_exchange_declare_arguments_size, {
+ "Size", "amqp.method.exchange.declare_argument.size",
+ FT_UINT32, BASE_DEC, NULL, 0,
+ NULL, HFILL}},
+ {&hf_amqp_0_10_method_queue_declare_arguments_size, {
+ "Size", "amqp.method.queue.declare_argument.size",
+ FT_UINT32, BASE_DEC, NULL, 0,
+ NULL, HFILL}},
+ {&hf_amqp_0_10_method_file_consume_arguments_size, {
+ "Size", "amqp.method.file.consume_arguments.size",
+ FT_UINT32, BASE_DEC, NULL, 0,
+ NULL, HFILL}},
+ {&hf_amqp_0_10_method_stream_consume_arguments_size, {
+ "Size", "amqp.method.stream.consume_arguments.size",
+ FT_UINT32, BASE_DEC, NULL, 0,
+ NULL, HFILL}},
+ {&hf_amqp_0_10_struct_message_properties_application_headers_size, {
+ "Size", "amqp.struct.message_properties.application_headers.size",
+ FT_UINT32, BASE_DEC, NULL, 0,
+ NULL, HFILL}},
+ {&hf_amqp_0_10_struct_file_properties_headers_size, {
+ "Size", "amqp.struct.file.properties_headers.size",
+ FT_UINT32, BASE_DEC, NULL, 0,
+ NULL, HFILL}},
+ {&hf_amqp_0_10_struct_stream_properties_headers_size, {
+ "Size", "amqp.struct.stream.properties_headers.size",
+ FT_UINT32, BASE_DEC, NULL, 0,
+ NULL, HFILL}},
+ {&hf_amqp_0_10_struct_dtx_recover_result_size, {
+ "Size", "amqp.struct.dtx_recover.result.size",
+ FT_UINT32, BASE_DEC, NULL, 0,
+ NULL, HFILL}},
};
/* Setup of protocol subtree array */
&ett_amqp_init,
&ett_amqp_0_10_map,
&ett_amqp_0_10_array,
+ &ett_amqp_0_10_struct,
&ett_amqp_1_0_array,
&ett_amqp_1_0_map,
&ett_amqp_1_0_list
{ &ei_amqp_channel_error, { "amqp.channel.error", PI_RESPONSE_CODE, PI_WARN, "Channel error", EXPFILL }},
{ &ei_amqp_message_undeliverable, { "amqp.message.undeliverable", PI_RESPONSE_CODE, PI_WARN, "Message was not delivered", EXPFILL }},
{ &ei_amqp_bad_flag_value, { "amqp.bad_flag_value", PI_PROTOCOL, PI_WARN, "Bad flag value", EXPFILL }},
-#if 0
{ &ei_amqp_bad_length, { "amqp.bad_length", PI_MALFORMED, PI_ERROR, "Bad frame length", EXPFILL }},
-#endif
{ &ei_amqp_field_short, { "amqp.field_short", PI_PROTOCOL, PI_ERROR, "Field is cut off by the end of the field table", EXPFILL }},
{ &ei_amqp_invalid_class_code, { "amqp.unknown.class_code", PI_PROTOCOL, PI_WARN, "Invalid class code", EXPFILL }},
{ &ei_amqp_unknown_command_class, { "amqp.unknown.command_class", PI_PROTOCOL, PI_ERROR, "Unknown command/control class", EXPFILL }},
{ &ei_amqp_unknown_amqp_type, { "amqp.unknown.amqp_type", PI_PROTOCOL, PI_ERROR, "Unknown AMQP type", EXPFILL }},
{ &ei_amqp_invalid_number_of_params, { "amqp.invalid.params_number", PI_PROTOCOL, PI_ERROR, "Invalid number of parameters", EXPFILL }},
{ &ei_amqp_amqp_1_0_frame_length_exceeds_65K, { "amqp.amqp_1_0_frame_length_exceeds_65K", PI_PROTOCOL, PI_WARN, "Frame length exceeds 65K; Dissection limited to 65K", EXPFILL}},
+ { &ei_amqp_size_exceeds_65K, { "amqp.size_exceeds_65K", PI_PROTOCOL, PI_WARN, "Size field exceeds 65K; Dissection limited to 65K", EXPFILL}},
+ { &ei_amqp_array_type_unknown, { "amqp.array_type_unknown", PI_PROTOCOL, PI_WARN, "Array type unknown", EXPFILL}},
};
expert_module_t* expert_amqp;