From Pavel Moravec via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9612
[metze/wireshark/wip.git] / epan / dissectors / packet-amqp.c
1 /* packet-amqp.c
2  *
3  * AMQP v0-9, 0-10 Wireshark dissector
4  *
5  * Author: Martin Sustrik <sustrik@imatix.com> (AMQP 0-9)
6  * Author: Steve Huston <shuston@riverace.com> (extended for AMQP 0-10)
7  * Author: Pavel Moravec <pmoravec@redhat.com> (extended for AMQP 1.0)
8  *
9  * Copyright (c) 1996-2007 iMatix Corporation
10  *
11  * $Id$
12  *
13  * Wireshark - Network traffic analyzer
14  * By Gerald Combs <gerald@wireshark.org>
15  * Copyright 1998 Gerald Combs
16  *
17  * This program is free software; you can redistribute it and/or
18  * modify it under the terms of the GNU General Public License
19  * as published by the Free Software Foundation; either version 2
20  * of the License, or (at your option) any later version.
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program; if not, write to the Free Software
29  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30  */
31
32 /*
33  * See
34  *
35  *     http://www.amqp.org/resources/download
36  *
37  * for specifications for various versions of the AMQP protocol.
38  */
39
40 #include "config.h"
41
42 #include <glib.h>
43 #include <epan/packet.h>
44 #include <epan/exceptions.h>
45 #include <epan/expert.h>
46 #include <epan/wmem/wmem.h>
47 #include "packet-tcp.h"
48
49 /*  Generic data  */
50
51 static int amqp_port = 5672;
52
53 /*  Generic defines  */
54
55 #define AMQP_INCREMENT(offset, addend, bound) {\
56     offset += (addend);\
57     THROW_ON((offset > bound), ReportedBoundsError);  \
58 }
59
60 /*
61  * This dissector handles AMQP 0-9, 0-10 and 1.0. The conversation structure
62  * contains the version being run - it's only really reliably detected at
63  * protocol init. If this dissector starts in the middle of a conversation
64  * it will try to figure it out, but conversation start is the best.
65  */
66
67 /* #define AMQP_V0_8           1 */
68 #define AMQP_V0_9           2
69 /* #define AMQP_V0_91          3 */
70 #define AMQP_V0_10          4
71 #define AMQP_V1_0           5
72 typedef struct {
73     guint8 version;
74 } amqp_conv;
75
76 #define MAX_BUFFER 256
77
78 /* 0-9 defines */
79
80 #define AMQP_0_9_FRAME_TYPE_METHOD                                      1
81 #define AMQP_0_9_FRAME_TYPE_CONTENT_HEADER                              2
82 #define AMQP_0_9_FRAME_TYPE_CONTENT_BODY                                3
83 #define AMQP_0_9_FRAME_TYPE_OOB_METHOD                                  4
84 #define AMQP_0_9_FRAME_TYPE_OOB_CONTENT_HEADER                          5
85 #define AMQP_0_9_FRAME_TYPE_OOB_CONTENT_BODY                            6
86 #define AMQP_0_9_FRAME_TYPE_TRACE                                       7
87 #define AMQP_0_9_FRAME_TYPE_HEARTBEAT                                   8
88
89 #define AMQP_0_9_CLASS_CONNECTION                                      10
90 #define AMQP_0_9_CLASS_CHANNEL                                         20
91 #define AMQP_0_9_CLASS_ACCESS                                          30
92 #define AMQP_0_9_CLASS_EXCHANGE                                        40
93 #define AMQP_0_9_CLASS_QUEUE                                           50
94 #define AMQP_0_9_CLASS_BASIC                                           60
95 #define AMQP_0_9_CLASS_FILE                                            70
96 #define AMQP_0_9_CLASS_STREAM                                          80
97 #define AMQP_0_9_CLASS_TX                                              90
98 #define AMQP_0_9_CLASS_DTX                                            100
99 #define AMQP_0_9_CLASS_TUNNEL                                         110
100
101 #define AMQP_0_9_METHOD_CONNECTION_START                               10
102 #define AMQP_0_9_METHOD_CONNECTION_START_OK                            11
103 #define AMQP_0_9_METHOD_CONNECTION_SECURE                              20
104 #define AMQP_0_9_METHOD_CONNECTION_SECURE_OK                           21
105 #define AMQP_0_9_METHOD_CONNECTION_TUNE                                30
106 #define AMQP_0_9_METHOD_CONNECTION_TUNE_OK                             31
107 #define AMQP_0_9_METHOD_CONNECTION_OPEN                                40
108 #define AMQP_0_9_METHOD_CONNECTION_OPEN_OK                             41
109 #define AMQP_0_9_METHOD_CONNECTION_REDIRECT                            42
110 #define AMQP_0_9_METHOD_CONNECTION_CLOSE                               50
111 #define AMQP_0_9_METHOD_CONNECTION_CLOSE_OK                            51
112
113 #define AMQP_0_9_METHOD_CHANNEL_OPEN                                   10
114 #define AMQP_0_9_METHOD_CHANNEL_OPEN_OK                                11
115 #define AMQP_0_9_METHOD_CHANNEL_FLOW                                   20
116 #define AMQP_0_9_METHOD_CHANNEL_FLOW_OK                                21
117 #define AMQP_0_9_METHOD_CHANNEL_CLOSE                                  40
118 #define AMQP_0_9_METHOD_CHANNEL_CLOSE_OK                               41
119 #define AMQP_0_9_METHOD_CHANNEL_RESUME                                 50
120 #define AMQP_0_9_METHOD_CHANNEL_PING                                   60
121 #define AMQP_0_9_METHOD_CHANNEL_PONG                                   70
122 #define AMQP_0_9_METHOD_CHANNEL_OK                                     80
123
124 #define AMQP_0_9_METHOD_ACCESS_REQUEST                                 10
125 #define AMQP_0_9_METHOD_ACCESS_REQUEST_OK                              11
126
127 #define AMQP_0_9_METHOD_EXCHANGE_DECLARE                               10
128 #define AMQP_0_9_METHOD_EXCHANGE_DECLARE_OK                            11
129 #define AMQP_0_9_METHOD_EXCHANGE_DELETE                                20
130 #define AMQP_0_9_METHOD_EXCHANGE_DELETE_OK                             21
131 #define AMQP_0_9_METHOD_EXCHANGE_BIND                                  30
132 #define AMQP_0_9_METHOD_EXCHANGE_BIND_OK                               31
133
134 #define AMQP_0_9_METHOD_QUEUE_DECLARE                                  10
135 #define AMQP_0_9_METHOD_QUEUE_DECLARE_OK                               11
136 #define AMQP_0_9_METHOD_QUEUE_BIND                                     20
137 #define AMQP_0_9_METHOD_QUEUE_BIND_OK                                  21
138 #define AMQP_0_9_METHOD_QUEUE_UNBIND                                   50
139 #define AMQP_0_9_METHOD_QUEUE_UNBIND_OK                                51
140 #define AMQP_0_9_METHOD_QUEUE_PURGE                                    30
141 #define AMQP_0_9_METHOD_QUEUE_PURGE_OK                                 31
142 #define AMQP_0_9_METHOD_QUEUE_DELETE                                   40
143 #define AMQP_0_9_METHOD_QUEUE_DELETE_OK                                41
144
145 #define AMQP_0_9_METHOD_BASIC_QOS                                      10
146 #define AMQP_0_9_METHOD_BASIC_QOS_OK                                   11
147 #define AMQP_0_9_METHOD_BASIC_CONSUME                                  20
148 #define AMQP_0_9_METHOD_BASIC_CONSUME_OK                               21
149 #define AMQP_0_9_METHOD_BASIC_CANCEL                                   30
150 #define AMQP_0_9_METHOD_BASIC_CANCEL_OK                                31
151 #define AMQP_0_9_METHOD_BASIC_PUBLISH                                  40
152 #define AMQP_0_9_METHOD_BASIC_RETURN                                   50
153 #define AMQP_0_9_METHOD_BASIC_DELIVER                                  60
154 #define AMQP_0_9_METHOD_BASIC_GET                                      70
155 #define AMQP_0_9_METHOD_BASIC_GET_OK                                   71
156 #define AMQP_0_9_METHOD_BASIC_GET_EMPTY                                72
157 #define AMQP_0_9_METHOD_BASIC_ACK                                      80
158 #define AMQP_0_9_METHOD_BASIC_REJECT                                   90
159 #define AMQP_0_9_METHOD_BASIC_RECOVER                                 100
160
161 #define AMQP_0_9_METHOD_FILE_QOS                                       10
162 #define AMQP_0_9_METHOD_FILE_QOS_OK                                    11
163 #define AMQP_0_9_METHOD_FILE_CONSUME                                   20
164 #define AMQP_0_9_METHOD_FILE_CONSUME_OK                                21
165 #define AMQP_0_9_METHOD_FILE_CANCEL                                    30
166 #define AMQP_0_9_METHOD_FILE_CANCEL_OK                                 31
167 #define AMQP_0_9_METHOD_FILE_OPEN                                      40
168 #define AMQP_0_9_METHOD_FILE_OPEN_OK                                   41
169 #define AMQP_0_9_METHOD_FILE_STAGE                                     50
170 #define AMQP_0_9_METHOD_FILE_PUBLISH                                   60
171 #define AMQP_0_9_METHOD_FILE_RETURN                                    70
172 #define AMQP_0_9_METHOD_FILE_DELIVER                                   80
173 #define AMQP_0_9_METHOD_FILE_ACK                                       90
174 #define AMQP_0_9_METHOD_FILE_REJECT                                   100
175
176 #define AMQP_0_9_METHOD_STREAM_QOS                                     10
177 #define AMQP_0_9_METHOD_STREAM_QOS_OK                                  11
178 #define AMQP_0_9_METHOD_STREAM_CONSUME                                 20
179 #define AMQP_0_9_METHOD_STREAM_CONSUME_OK                              21
180 #define AMQP_0_9_METHOD_STREAM_CANCEL                                  30
181 #define AMQP_0_9_METHOD_STREAM_CANCEL_OK                               31
182 #define AMQP_0_9_METHOD_STREAM_PUBLISH                                 40
183 #define AMQP_0_9_METHOD_STREAM_RETURN                                  50
184 #define AMQP_0_9_METHOD_STREAM_DELIVER                                 60
185
186 #define AMQP_0_9_METHOD_TX_SELECT                                      10
187 #define AMQP_0_9_METHOD_TX_SELECT_OK                                   11
188 #define AMQP_0_9_METHOD_TX_COMMIT                                      20
189 #define AMQP_0_9_METHOD_TX_COMMIT_OK                                   21
190 #define AMQP_0_9_METHOD_TX_ROLLBACK                                    30
191 #define AMQP_0_9_METHOD_TX_ROLLBACK_OK                                 31
192
193 #define AMQP_0_9_METHOD_DTX_SELECT                                     10
194 #define AMQP_0_9_METHOD_DTX_SELECT_OK                                  11
195 #define AMQP_0_9_METHOD_DTX_START                                      20
196 #define AMQP_0_9_METHOD_DTX_START_OK                                   21
197
198 #define AMQP_0_9_METHOD_TUNNEL_REQUEST                                 10
199
200 /* AMQP 1.0 values */
201
202 #define AMQP_1_0_AMQP_FRAME 0
203 #define AMQP_1_0_SASL_FRAME 1
204 #define AMQP_1_0_TLS_FRAME  2
205
206 #define AMQP_1_0_AMQP_OPEN        0x10
207 #define AMQP_1_0_AMQP_BEGIN       0x11
208 #define AMQP_1_0_AMQP_ATTACH      0x12
209 #define AMQP_1_0_AMQP_FLOW        0x13
210 #define AMQP_1_0_AMQP_TRANSFER    0x14
211 #define AMQP_1_0_AMQP_DISPOSITION 0x15
212 #define AMQP_1_0_AMQP_DETACH      0x16
213 #define AMQP_1_0_AMQP_END         0x17
214 #define AMQP_1_0_AMQP_CLOSE       0x18
215
216 #define AMQP_1_0_SASL_MECHANISMS 0x40
217 #define AMQP_1_0_SASL_INIT       0x41
218 #define AMQP_1_0_SASL_CHALLENGE  0x42
219 #define AMQP_1_0_SASL_RESPONSE   0x43
220 #define AMQP_1_0_SASL_OUTCOME    0x44
221
222 #define AMQP_1_0_AMQP_TYPE_ERROR 0x1d
223 #define AMQP_1_0_AMQP_TYPE_HEADER 0x70
224 #define AMQP_1_0_AMQP_TYPE_DELIVERY_ANNOTATIONS 0x71
225 #define AMQP_1_0_AMQP_TYPE_MESSAGE_ANNOTATIONS 0x72
226 #define AMQP_1_0_AMQP_TYPE_PROPERTIES 0x73
227 #define AMQP_1_0_AMQP_TYPE_APPLICATION_PROPERTIES 0x74
228 #define AMQP_1_0_AMQP_TYPE_DATA 0x75
229 #define AMQP_1_0_AMQP_TYPE_AMQP_SEQUENCE 0x76
230 #define AMQP_1_0_AMQP_TYPE_AMQP_VALUE 0x77
231 #define AMQP_1_0_AMQP_TYPE_FOOTER 0x78
232 #define AMQP_1_0_AMQP_TYPE_RECEIVED 0x23
233 #define AMQP_1_0_AMQP_TYPE_ACCEPTED 0x24
234 #define AMQP_1_0_AMQP_TYPE_REJECTED 0x25
235 #define AMQP_1_0_AMQP_TYPE_RELEASED 0x26
236 #define AMQP_1_0_AMQP_TYPE_MODIFIED 0x27
237 #define AMQP_1_0_AMQP_TYPE_SOURCE 0x28
238 #define AMQP_1_0_AMQP_TYPE_TARGET 0x29
239 #define AMQP_1_0_AMQP_TYPE_DELETE_ON_CLOSE 0x2b
240 #define AMQP_1_0_AMQP_TYPE_DELETE_ON_NO_LINKS 0x2c
241 #define AMQP_1_0_AMQP_TYPE_DELETE_ON_NO_MESSAGE 0x2d
242 #define AMQP_1_0_AMQP_TYPE_DELETE_ON_NO_LINKS_OR_MESSAGE 0x2e
243 #define AMQP_1_0_AMQP_TYPE_COORDINATOR 0x30
244 #define AMQP_1_0_AMQP_TYPE_DECLARE 0x31
245 #define AMQP_1_0_AMQP_TYPE_DISCHARGE 0x32
246 #define AMQP_1_0_AMQP_TYPE_DECLARED 0x33
247 #define AMQP_1_0_AMQP_TYPE_TRANSACTIONAL_STATE 0x34
248
249 #define AMQP_1_0_TYPE_DESCRIPTOR_CONSTRUCTOR 0x00
250
251 #define AMQP_1_0_TYPE_LIST0   0x45
252 #define AMQP_1_0_TYPE_LIST8   0xc0
253 #define AMQP_1_0_TYPE_LIST32   0xd0
254 #define AMQP_1_0_TYPE_MAP8   0xc1
255 #define AMQP_1_0_TYPE_MAP32   0xd1
256 #define AMQP_1_0_TYPE_ARRAY8   0xe0
257 #define AMQP_1_0_TYPE_ARRAY32   0xf0
258
259 /* AMQP 0-10 values */
260
261 #define AMQP_0_10_FRAME_CONTROL  0
262 #define AMQP_0_10_FRAME_COMMAND  1
263 #define AMQP_0_10_FRAME_HEADER   2
264 #define AMQP_0_10_FRAME_BODY     3
265
266 #define AMQP_0_10_TYPE_STR16     0x95
267 #define AMQP_0_10_TYPE_MAP       0xa8
268 #define AMQP_0_10_TYPE_LIST      0xa9
269 #define AMQP_0_10_TYPE_ARRAY     0xaa
270 #define AMQP_0_10_TYPE_STRUCT32  0xab
271
272 #define AMQP_0_10_CLASS_CONNECTION           0x01
273 #define AMQP_0_10_METHOD_CONNECTION_START          0x01
274 #define AMQP_0_10_METHOD_CONNECTION_START_OK       0x02
275 #define AMQP_0_10_METHOD_CONNECTION_SECURE         0x03
276 #define AMQP_0_10_METHOD_CONNECTION_SECURE_OK      0x04
277 #define AMQP_0_10_METHOD_CONNECTION_TUNE           0x05
278 #define AMQP_0_10_METHOD_CONNECTION_TUNE_OK        0x06
279 #define AMQP_0_10_METHOD_CONNECTION_OPEN           0x07
280 #define AMQP_0_10_METHOD_CONNECTION_OPEN_OK        0x08
281 #define AMQP_0_10_METHOD_CONNECTION_REDIRECT       0x09
282 #define AMQP_0_10_METHOD_CONNECTION_HEARTBEAT      0x0a
283 #define AMQP_0_10_METHOD_CONNECTION_CLOSE          0x0b
284 #define AMQP_0_10_METHOD_CONNECTION_CLOSE_OK       0x0c
285
286 #define AMQP_0_10_CLASS_SESSION              0x02
287 #define AMQP_0_10_METHOD_SESSION_ATTACH            0x01
288 #define AMQP_0_10_METHOD_SESSION_ATTACHED          0x02
289 #define AMQP_0_10_METHOD_SESSION_DETACH            0x03
290 #define AMQP_0_10_METHOD_SESSION_DETACHED          0x04
291 #define AMQP_0_10_METHOD_SESSION_REQUEST_TIMEOUT   0x05
292 #define AMQP_0_10_METHOD_SESSION_TIMEOUT           0x06
293 #define AMQP_0_10_METHOD_SESSION_COMMAND_POINT     0x07
294 #define AMQP_0_10_METHOD_SESSION_EXPECTED          0x08
295 #define AMQP_0_10_METHOD_SESSION_CONFIRMED         0x09
296 #define AMQP_0_10_METHOD_SESSION_COMPLETED         0x0a
297 #define AMQP_0_10_METHOD_SESSION_KNOWN_COMPLETED   0x0b
298 #define AMQP_0_10_METHOD_SESSION_FLUSH             0x0c
299 #define AMQP_0_10_METHOD_SESSION_GAP               0x0d
300
301 #define AMQP_0_10_CLASS_EXECUTION            0x03
302 #define AMQP_0_10_METHOD_EXECUTION_SYNC            0x01
303 #define AMQP_0_10_METHOD_EXECUTION_RESULT          0x02
304 #define AMQP_0_10_METHOD_EXECUTION_EXCEPTION       0x03
305
306 #define AMQP_0_10_CLASS_MESSAGE              0x04
307 #define AMQP_0_10_STRUCT_MESSAGE_DELIVERY_PROPERTIES   0x01
308 #define AMQP_0_10_STRUCT_MESSAGE_FRAGMENT_PROPERTIES   0x02
309 #define AMQP_0_10_STRUCT_MESSAGE_MESSAGE_PROPERTIES    0x03
310 #define AMQP_0_10_STRUCT_MESSAGE_ACQUIRED              0x04
311 #define AMQP_0_10_STRUCT_MESSAGE_RESUME_RESULT         0x05
312 #define AMQP_0_10_METHOD_MESSAGE_TRANSFER          0x01
313 #define AMQP_0_10_METHOD_MESSAGE_ACCEPT            0x02
314 #define AMQP_0_10_METHOD_MESSAGE_REJECT            0x03
315 #define AMQP_0_10_METHOD_MESSAGE_RELEASE           0x04
316 #define AMQP_0_10_METHOD_MESSAGE_ACQUIRE           0x05
317 #define AMQP_0_10_METHOD_MESSAGE_RESUME            0x06
318 #define AMQP_0_10_METHOD_MESSAGE_SUBSCRIBE         0x07
319 #define AMQP_0_10_METHOD_MESSAGE_CANCEL            0x08
320 #define AMQP_0_10_METHOD_MESSAGE_SET_FLOW_MODE     0x09
321 #define AMQP_0_10_METHOD_MESSAGE_FLOW              0x0a
322 #define AMQP_0_10_METHOD_MESSAGE_FLUSH             0x0b
323 #define AMQP_0_10_METHOD_MESSAGE_STOP              0x0c
324
325 #define AMQP_0_10_CLASS_TX                   0x05
326 #define AMQP_0_10_METHOD_TX_SELECT                 0x01
327 #define AMQP_0_10_METHOD_TX_COMMIT                 0x02
328 #define AMQP_0_10_METHOD_TX_ROLLBACK               0x03
329
330 #define AMQP_0_10_CLASS_DTX                  0x06
331 #define AMQP_0_10_STRUCT_DTX_XA_RESULT          0x01
332 #define AMQP_0_10_STRUCT_DTX_RECOVER_RESULT     0x03
333 #define AMQP_0_10_METHOD_DTX_SELECT                0x01
334 #define AMQP_0_10_METHOD_DTX_START                 0x02
335 #define AMQP_0_10_METHOD_DTX_END                   0x03
336 #define AMQP_0_10_METHOD_DTX_COMMIT                0x04
337 #define AMQP_0_10_METHOD_DTX_FORGET                0x05
338 #define AMQP_0_10_METHOD_DTX_GET_TIMEOUT           0x06
339 #define AMQP_0_10_METHOD_DTX_PREPARE               0x07
340 #define AMQP_0_10_METHOD_DTX_RECOVER               0x08
341 #define AMQP_0_10_METHOD_DTX_ROLLBACK              0x09
342 #define AMQP_0_10_METHOD_DTX_SET_TIMEOUT           0x0a
343
344 #define AMQP_0_10_CLASS_EXCHANGE             0x07
345 #define AMQP_0_10_STRUCT_EXCHANGE_QUERY_RESULT  0x01
346 #define AMQP_0_10_STRUCT_EXCHANGE_BOUND_RESULT  0x02
347 #define AMQP_0_10_METHOD_EXCHANGE_DECLARE          0x01
348 #define AMQP_0_10_METHOD_EXCHANGE_DELETE           0x02
349 #define AMQP_0_10_METHOD_EXCHANGE_QUERY            0x03
350 #define AMQP_0_10_METHOD_EXCHANGE_BIND             0x04
351 #define AMQP_0_10_METHOD_EXCHANGE_UNBIND           0x05
352 #define AMQP_0_10_METHOD_EXCHANGE_BOUND            0x06
353
354 #define AMQP_0_10_CLASS_QUEUE                0x08
355 #define AMQP_0_10_STRUCT_QUEUE_QUERY_RESULT     0x01
356 #define AMQP_0_10_METHOD_QUEUE_DECLARE             0x01
357 #define AMQP_0_10_METHOD_QUEUE_DELETE              0x02
358 #define AMQP_0_10_METHOD_QUEUE_PURGE               0x03
359 #define AMQP_0_10_METHOD_QUEUE_QUERY               0x04
360
361 #define AMQP_0_10_CLASS_FILE                 0x09
362 #define AMQP_0_10_STRUCT_FILE_PROPERTIES        0x01
363 #define AMQP_0_10_METHOD_FILE_QOS                  0x01
364 #define AMQP_0_10_METHOD_FILE_QOS_OK               0x02
365 #define AMQP_0_10_METHOD_FILE_CONSUME              0x03
366 #define AMQP_0_10_METHOD_FILE_CONSUME_OK           0x04
367 #define AMQP_0_10_METHOD_FILE_CANCEL               0x05
368 #define AMQP_0_10_METHOD_FILE_OPEN                 0x06
369 #define AMQP_0_10_METHOD_FILE_OPEN_OK              0x07
370 #define AMQP_0_10_METHOD_FILE_STAGE                0x08
371 #define AMQP_0_10_METHOD_FILE_PUBLISH              0x09
372 #define AMQP_0_10_METHOD_FILE_RETURN               0x0a
373 #define AMQP_0_10_METHOD_FILE_DELIVER              0x0b
374 #define AMQP_0_10_METHOD_FILE_ACK                  0x0c
375 #define AMQP_0_10_METHOD_FILE_REJECT               0x0d
376
377 #define AMQP_0_10_CLASS_STREAM               0x0a
378 #define AMQP_0_10_STRUCT_STREAM_PROPERTIES      0x01
379 #define AMQP_0_10_METHOD_STREAM_QOS                0x01
380 #define AMQP_0_10_METHOD_STREAM_QOS_OK             0x02
381 #define AMQP_0_10_METHOD_STREAM_CONSUME            0x03
382 #define AMQP_0_10_METHOD_STREAM_CONSUME_OK         0x04
383 #define AMQP_0_10_METHOD_STREAM_CANCEL             0x05
384 #define AMQP_0_10_METHOD_STREAM_PUBLISH            0x06
385 #define AMQP_0_10_METHOD_STREAM_RETURN             0x07
386 #define AMQP_0_10_METHOD_STREAM_DELIVER            0x08
387
388 /*  Private functions  */
389
390 static void
391 dissect_amqp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
392
393 static void
394 check_amqp_version(tvbuff_t *tvb, amqp_conv *conn);
395
396 static guint
397 get_amqp_1_0_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset);
398
399 static guint
400 dissect_amqp_1_0_list(tvbuff_t *tvb,
401                       packet_info *pinfo,
402                       int offset,
403                       int bound,
404                       proto_item *item,
405                       int hf_amqp_type,
406                       int hf_amqp_subtype_count,
407                       const int **hf_amqp_subtypes,
408                       const char *name);
409
410 static guint
411 dissect_amqp_1_0_map(tvbuff_t *tvb,
412                      packet_info *pinfo,
413                      int offset,
414                      int bound,
415                      proto_item *item,
416                      int hf_amqp_type,
417                      const char *name);
418
419 static guint
420 dissect_amqp_1_0_array(tvbuff_t *tvb,
421                        packet_info *pinfo,
422                        int offset,
423                        int bound,
424                        proto_item *item,
425                        int hf_amqp_type,
426                        int hf_amqp_subtype_count,
427                        const int **hf_amqp_subtypes,
428                        const char *name);
429
430 static guint
431 get_amqp_0_10_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset);
432
433 static guint
434 get_amqp_0_9_message_len(packet_info *pinfo, tvbuff_t *tvb, int offset);
435
436 static void
437 dissect_amqp_0_9_field_table(tvbuff_t *tvb, packet_info *pinfo, int offset, guint length, proto_item *item);
438
439 static void
440 dissect_amqp_0_10_map(tvbuff_t *tvb,
441                       int offset,
442                       int bound,
443                       int length,
444                       proto_item *item);
445
446 static void
447 dissect_amqp_0_10_xid (tvbuff_t *tvb,
448                        int offset,
449                        guint16 xid_length,
450                        proto_item *ti);
451
452 static void
453 dissect_amqp_0_10_connection(tvbuff_t *tvb,
454                              packet_info *pinfo,
455                              proto_tree *tree,
456                              int offset, guint16 length);
457
458 static void
459 dissect_amqp_0_10_session(tvbuff_t *tvb,
460                           packet_info *pinfo,
461                           proto_tree *tree,
462                           int offset, guint16 length);
463
464 static void
465 dissect_amqp_0_10_execution(tvbuff_t *tvb,
466                             packet_info *pinfo,
467                             proto_tree *tree,
468                             int offset, guint16 length);
469
470 static void
471 dissect_amqp_0_10_message(tvbuff_t *tvb,
472                           packet_info *pinfo,
473                           proto_tree *tree,
474                           int offset, guint16 length);
475
476 static void
477 dissect_amqp_0_10_tx(tvbuff_t *tvb,
478                      packet_info *pinfo,
479                      proto_tree *tree,
480                      int offset, guint16 length);
481
482 static void
483 dissect_amqp_0_10_dtx(tvbuff_t *tvb,
484                       packet_info *pinfo,
485                       proto_tree *tree,
486                       int offset, guint16 length);
487
488 static void
489 dissect_amqp_0_10_exchange(tvbuff_t *tvb,
490                            packet_info *pinfo,
491                            proto_tree *tree,
492                            int offset, guint16 length);
493
494 static void
495 dissect_amqp_0_10_queue(tvbuff_t *tvb,
496                         packet_info *pinfo,
497                         proto_tree *tree,
498                         int offset, guint16 length);
499
500 static void
501 dissect_amqp_0_10_file(tvbuff_t *tvb,
502                        packet_info *pinfo,
503                        proto_tree *tree,
504                        int offset, guint16 length);
505
506 static void
507 dissect_amqp_0_10_stream(tvbuff_t *tvb,
508                          packet_info *pinfo,
509                          proto_tree *tree,
510                          int offset, guint16 length);
511
512 static void
513 dissect_amqp_0_10_struct32(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
514                            int offset, guint32 struct_length);
515
516 static guint32
517 dissect_amqp_1_0_AMQP_frame(tvbuff_t *tvb,
518                             guint offset,
519                             guint16 bound,
520                             proto_item *amqp_tree,
521                             packet_info *pinfo,
522                             const gchar **method_name);
523
524 static guint32
525 dissect_amqp_1_0_SASL_frame(tvbuff_t *tvb,
526                             guint offset,
527                             guint16 bound,
528                             proto_item *amqp_tree,
529                             packet_info *pinfo,
530                             const gchar **method_name);
531
532 static int
533 dissect_amqp_1_0_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_);
534
535 static int
536 dissect_amqp_0_10_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_);
537
538 static int
539 dissect_amqp_0_9_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_);
540
541 static int
542 dissect_amqp_0_9_method_connection_start(tvbuff_t *tvb, packet_info *pinfo,
543     int offset, proto_tree *args_tree);
544
545 static int
546 dissect_amqp_0_9_method_connection_start_ok(tvbuff_t *tvb, packet_info *pinfo,
547     int offset, proto_tree *args_tree);
548
549 static int
550 dissect_amqp_0_9_method_connection_secure(tvbuff_t *tvb,
551     int offset, proto_tree *args_tree);
552
553 static int
554 dissect_amqp_0_9_method_connection_secure_ok(tvbuff_t *tvb,
555     int offset, proto_tree *args_tree);
556
557 static int
558 dissect_amqp_0_9_method_connection_tune(tvbuff_t *tvb,
559     int offset, proto_tree *args_tree);
560
561 static int
562 dissect_amqp_0_9_method_connection_tune_ok(tvbuff_t *tvb,
563     int offset, proto_tree *args_tree);
564
565 static int
566 dissect_amqp_0_9_method_connection_open(tvbuff_t *tvb,
567     int offset, proto_tree *args_tree);
568
569 static int
570 dissect_amqp_0_9_method_connection_open_ok(tvbuff_t *tvb,
571     int offset, proto_tree *args_tree);
572
573 static int
574 dissect_amqp_0_9_method_connection_redirect(tvbuff_t *tvb,
575     int offset, proto_tree *args_tree);
576
577 static int
578 dissect_amqp_0_9_method_connection_close(tvbuff_t *tvb,
579     int offset, proto_tree *args_tree);
580
581 static int
582 dissect_amqp_0_9_method_connection_close_ok(tvbuff_t *tvb,
583     int offset, proto_tree *args_tree);
584
585 static int
586 dissect_amqp_0_9_method_channel_open(tvbuff_t *tvb,
587     int offset, proto_tree *args_tree);
588
589 static int
590 dissect_amqp_0_9_method_channel_open_ok(tvbuff_t *tvb,
591     int offset, proto_tree *args_tree);
592
593 static int
594 dissect_amqp_0_9_method_channel_flow(tvbuff_t *tvb,
595     int offset, proto_tree *args_tree);
596
597 static int
598 dissect_amqp_0_9_method_channel_flow_ok(tvbuff_t *tvb,
599     int offset, proto_tree *args_tree);
600
601 static int
602 dissect_amqp_0_9_method_channel_close(tvbuff_t *tvb,
603     int offset, proto_tree *args_tree);
604
605 static int
606 dissect_amqp_0_9_method_channel_close_ok(tvbuff_t *tvb,
607     int offset, proto_tree *args_tree);
608
609 static int
610 dissect_amqp_0_9_method_channel_resume(tvbuff_t *tvb,
611     int offset, proto_tree *args_tree);
612
613 static int
614 dissect_amqp_0_9_method_channel_ping(tvbuff_t *tvb,
615     int offset, proto_tree *args_tree);
616
617 static int
618 dissect_amqp_0_9_method_channel_pong(tvbuff_t *tvb,
619     int offset, proto_tree *args_tree);
620
621 static int
622 dissect_amqp_0_9_method_channel_ok(tvbuff_t *tvb,
623     int offset, proto_tree *args_tree);
624
625 static int
626 dissect_amqp_0_9_method_access_request(tvbuff_t *tvb,
627     int offset, proto_tree *args_tree);
628
629 static int
630 dissect_amqp_0_9_method_access_request_ok(tvbuff_t *tvb,
631     int offset, proto_tree *args_tree);
632
633 static int
634 dissect_amqp_0_9_method_exchange_declare(tvbuff_t *tvb, packet_info *pinfo,
635     int offset, proto_tree *args_tree);
636
637 static int
638 dissect_amqp_0_9_method_exchange_declare_ok(tvbuff_t *tvb,
639     int offset, proto_tree *args_tree);
640
641 static int
642 dissect_amqp_0_9_method_exchange_bind(tvbuff_t *tvb, packet_info *pinfo,
643     int offset, proto_tree *args_tree);
644
645 static int
646 dissect_amqp_0_9_method_exchange_bind_ok(tvbuff_t *tvb,
647     int offset, proto_tree *args_tree);
648
649 static int
650 dissect_amqp_0_9_method_exchange_delete(tvbuff_t *tvb,
651     int offset, proto_tree *args_tree);
652
653 static int
654 dissect_amqp_0_9_method_exchange_delete_ok(tvbuff_t *tvb,
655     int offset, proto_tree *args_tree);
656
657 static int
658 dissect_amqp_0_9_method_queue_declare(tvbuff_t *tvb, packet_info *pinfo,
659     int offset, proto_tree *args_tree);
660
661 static int
662 dissect_amqp_0_9_method_queue_declare_ok(tvbuff_t *tvb,
663     int offset, proto_tree *args_tree);
664
665 static int
666 dissect_amqp_0_9_method_queue_bind(tvbuff_t *tvb, packet_info *pinfo,
667     int offset, proto_tree *args_tree);
668
669 static int
670 dissect_amqp_0_9_method_queue_bind_ok(tvbuff_t *tvb,
671     int offset, proto_tree *args_tree);
672
673 static int
674 dissect_amqp_0_9_method_queue_unbind(tvbuff_t *tvb, packet_info *pinfo,
675     int offset, proto_tree *args_tree);
676
677 static int
678 dissect_amqp_0_9_method_queue_unbind_ok(tvbuff_t *tvb,
679     int offset, proto_tree *args_tree);
680
681 static int
682 dissect_amqp_0_9_method_queue_purge(tvbuff_t *tvb,
683     int offset, proto_tree *args_tree);
684
685 static int
686 dissect_amqp_0_9_method_queue_purge_ok(tvbuff_t *tvb,
687     int offset, proto_tree *args_tree);
688
689 static int
690 dissect_amqp_0_9_method_queue_delete(tvbuff_t *tvb,
691     int offset, proto_tree *args_tree);
692
693 static int
694 dissect_amqp_0_9_method_queue_delete_ok(tvbuff_t *tvb,
695     int offset, proto_tree *args_tree);
696
697 static int
698 dissect_amqp_0_9_method_basic_qos(tvbuff_t *tvb,
699     int offset, proto_tree *args_tree);
700
701 static int
702 dissect_amqp_0_9_method_basic_qos_ok(tvbuff_t *tvb,
703     int offset, proto_tree *args_tree);
704
705 static int
706 dissect_amqp_0_9_method_basic_consume(tvbuff_t *tvb, packet_info *pinfo,
707     int offset, proto_tree *args_tree);
708
709 static int
710 dissect_amqp_0_9_method_basic_consume_ok(tvbuff_t *tvb,
711     int offset, proto_tree *args_tree);
712
713 static int
714 dissect_amqp_0_9_method_basic_cancel(tvbuff_t *tvb,
715     int offset, proto_tree *args_tree);
716
717 static int
718 dissect_amqp_0_9_method_basic_cancel_ok(tvbuff_t *tvb,
719     int offset, proto_tree *args_tree);
720
721 static int
722 dissect_amqp_0_9_method_basic_publish(tvbuff_t *tvb,
723     int offset, proto_tree *args_tree);
724
725 static int
726 dissect_amqp_0_9_method_basic_return(tvbuff_t *tvb,
727     int offset, proto_tree *args_tree);
728
729 static int
730 dissect_amqp_0_9_method_basic_deliver(tvbuff_t *tvb,
731     int offset, proto_tree *args_tree);
732
733 static int
734 dissect_amqp_0_9_method_basic_get(tvbuff_t *tvb,
735     int offset, proto_tree *args_tree);
736
737 static int
738 dissect_amqp_0_9_method_basic_get_ok(tvbuff_t *tvb,
739     int offset, proto_tree *args_tree);
740
741 static int
742 dissect_amqp_0_9_method_basic_get_empty(tvbuff_t *tvb,
743     int offset, proto_tree *args_tree);
744
745 static int
746 dissect_amqp_0_9_method_basic_ack(tvbuff_t *tvb,
747     int offset, proto_tree *args_tree);
748
749 static int
750 dissect_amqp_0_9_method_basic_reject(tvbuff_t *tvb,
751     int offset, proto_tree *args_tree);
752
753 static int
754 dissect_amqp_0_9_method_basic_recover(tvbuff_t *tvb,
755     int offset, proto_tree *args_tree);
756
757 static int
758 dissect_amqp_0_9_method_file_qos(tvbuff_t *tvb,
759     int offset, proto_tree *args_tree);
760
761 static int
762 dissect_amqp_0_9_method_file_qos_ok(tvbuff_t *tvb,
763     int offset, proto_tree *args_tree);
764
765 static int
766 dissect_amqp_0_9_method_file_consume(tvbuff_t *tvb, packet_info *pinfo,
767     int offset, proto_tree *args_tree);
768
769 static int
770 dissect_amqp_0_9_method_file_consume_ok(tvbuff_t *tvb,
771     int offset, proto_tree *args_tree);
772
773 static int
774 dissect_amqp_0_9_method_file_cancel(tvbuff_t *tvb,
775     int offset, proto_tree *args_tree);
776
777 static int
778 dissect_amqp_0_9_method_file_cancel_ok(tvbuff_t *tvb,
779     int offset, proto_tree *args_tree);
780
781 static int
782 dissect_amqp_0_9_method_file_open(tvbuff_t *tvb,
783     int offset, proto_tree *args_tree);
784
785 static int
786 dissect_amqp_0_9_method_file_open_ok(tvbuff_t *tvb,
787     int offset, proto_tree *args_tree);
788
789 static int
790 dissect_amqp_0_9_method_file_stage(tvbuff_t *tvb,
791     int offset, proto_tree *args_tree);
792
793 static int
794 dissect_amqp_0_9_method_file_publish(tvbuff_t *tvb,
795     int offset, proto_tree *args_tree);
796
797 static int
798 dissect_amqp_0_9_method_file_return(tvbuff_t *tvb,
799     int offset, proto_tree *args_tree);
800
801 static int
802 dissect_amqp_0_9_method_file_deliver(tvbuff_t *tvb,
803     int offset, proto_tree *args_tree);
804
805 static int
806 dissect_amqp_0_9_method_file_ack(tvbuff_t *tvb,
807     int offset, proto_tree *args_tree);
808
809 static int
810 dissect_amqp_0_9_method_file_reject(tvbuff_t *tvb,
811     int offset, proto_tree *args_tree);
812
813 static int
814 dissect_amqp_0_9_method_stream_qos(tvbuff_t *tvb,
815     int offset, proto_tree *args_tree);
816
817 static int
818 dissect_amqp_0_9_method_stream_qos_ok(tvbuff_t *tvb,
819     int offset, proto_tree *args_tree);
820
821 static int
822 dissect_amqp_0_9_method_stream_consume(tvbuff_t *tvb, packet_info *pinfo,
823     int offset, proto_tree *args_tree);
824
825 static int
826 dissect_amqp_0_9_method_stream_consume_ok(tvbuff_t *tvb,
827     int offset, proto_tree *args_tree);
828
829 static int
830 dissect_amqp_0_9_method_stream_cancel(tvbuff_t *tvb,
831     int offset, proto_tree *args_tree);
832
833 static int
834 dissect_amqp_0_9_method_stream_cancel_ok(tvbuff_t *tvb,
835     int offset, proto_tree *args_tree);
836
837 static int
838 dissect_amqp_0_9_method_stream_publish(tvbuff_t *tvb,
839     int offset, proto_tree *args_tree);
840
841 static int
842 dissect_amqp_0_9_method_stream_return(tvbuff_t *tvb,
843     int offset, proto_tree *args_tree);
844
845 static int
846 dissect_amqp_0_9_method_stream_deliver(tvbuff_t *tvb,
847     int offset, proto_tree *args_tree);
848
849 static int
850 dissect_amqp_0_9_method_tx_select(tvbuff_t *tvb,
851     int offset, proto_tree *args_tree);
852
853 static int
854 dissect_amqp_0_9_method_tx_select_ok(tvbuff_t *tvb,
855     int offset, proto_tree *args_tree);
856
857 static int
858 dissect_amqp_0_9_method_tx_commit(tvbuff_t *tvb,
859     int offset, proto_tree *args_tree);
860
861 static int
862 dissect_amqp_0_9_method_tx_commit_ok(tvbuff_t *tvb,
863     int offset, proto_tree *args_tree);
864
865 static int
866 dissect_amqp_0_9_method_tx_rollback(tvbuff_t *tvb,
867     int offset, proto_tree *args_tree);
868
869 static int
870 dissect_amqp_0_9_method_tx_rollback_ok(tvbuff_t *tvb,
871     int offset, proto_tree *args_tree);
872
873 static int
874 dissect_amqp_0_9_method_dtx_select(tvbuff_t *tvb,
875     int offset, proto_tree *args_tree);
876
877 static int
878 dissect_amqp_0_9_method_dtx_select_ok(tvbuff_t *tvb,
879     int offset, proto_tree *args_tree);
880
881 static int
882 dissect_amqp_0_9_method_dtx_start(tvbuff_t *tvb,
883     int offset, proto_tree *args_tree);
884
885 static int
886 dissect_amqp_0_9_method_dtx_start_ok(tvbuff_t *tvb,
887     int offset, proto_tree *args_tree);
888
889 static int
890 dissect_amqp_0_9_method_tunnel_request(tvbuff_t *tvb, packet_info *pinfo,
891     int offset, proto_tree *args_tree);
892
893 static int
894 dissect_amqp_0_9_content_header_basic(tvbuff_t *tvb, packet_info *pinfo,
895     int offset, proto_tree *prop_tree);
896
897 static int
898 dissect_amqp_0_9_content_header_file(tvbuff_t *tvb, packet_info *pinfo,
899     int offset, proto_tree *prop_tree);
900
901 static int
902 dissect_amqp_0_9_content_header_stream(tvbuff_t *tvb, packet_info *pinfo,
903     int offset, proto_tree *prop_tree);
904
905 static int
906 dissect_amqp_0_9_content_header_tunnel(tvbuff_t *tvb, packet_info *pifo,
907     int offset, proto_tree *prop_tree);
908
909 /*  AMQP 0-10 type decoding information  */
910
911 typedef int (*type_formatter)(tvbuff_t *tvb,
912                               guint offset,        /* In tvb where data starts */
913                               guint bound,         /* Last byte in tvb */
914                               guint length,        /* Length of data, if known */
915                               const char **value); /* Receive formatted val */
916 struct amqp_typeinfo {
917     guint8          typecode;   /* From AMQP 0-10 spec */
918     const char     *amqp_typename;
919     type_formatter  formatter;
920     guint           known_size;
921 };
922
923 /*  AMQP 1-0 type decoding information  */
924
925 /*  struct for field interpreting format code (i.e. 0x70 for msg.header) to relevant hf_* variable
926  *  (here hf_amqp_1_0_messageHeader). If the type is list, next 2 struct items specify how to
927  *  interpret list items (in terms of hf_* variable)
928  */
929 struct amqp_defined_types_t {
930     const int format_code;
931     int       *hf_amqp_type;
932     int       hf_amqp_subtype_count;
933     const int **hf_amqp_subtypes;
934 };
935
936 /* functions for decoding 1.0 type and/or value */
937
938 static gboolean decode_fixed_type(tvbuff_t *tvb,
939                                   guint8 code,
940                                   int offset,
941                                   int bound,
942                                   guint8 *type_width_size,
943                                   guint *length_size,
944                                   const char **type_name,
945                                   const char **value);
946
947 static proto_item*
948 add_1_0_proto_item(proto_item *item,
949              tvbuff_t *tvb,
950              int offset,
951              int length,
952              int hf_amqp_type,
953              const char *no_format_value);
954
955 static void
956 get_amqp_1_0_value_formatter(tvbuff_t *tvb,
957                              packet_info *pinfo,
958                              guint8 code,
959                              int offset,
960                              int bound,
961                              int hf_amqp_type,
962                              const char *name,
963                              int hf_amqp_subtype_count,
964                              const int **hf_amqp_subtypes,
965                              guint *length_size,
966                              proto_item *item);
967
968 static guint
969 get_amqp_1_0_type_formatter(tvbuff_t *tvb,
970                             int offset,
971                             int bound,
972                             int *hf_amqp_type,
973                             const char **name,
974                             int *hf_amqp_subtype_count,
975                             const int ***hf_amqp_subtypes,
976                             guint *length_size);
977
978 static void
979 get_amqp_1_0_type_value_formatter(tvbuff_t *tvb,
980                                   packet_info *pinfo,
981                                   int offset,
982                                   int bound,
983                                   int hf_amqp_type,
984                                   const char *name,
985                                   guint *length_size,
986                                   proto_item *item);
987
988 /* functions for decoding particular primitive types */
989
990 static int
991 format_amqp_1_0_null(tvbuff_t *tvb _U_,
992                      guint offset, guint bound _U_, guint length _U_,
993                      const char **value _U_);
994
995 static int
996 format_amqp_1_0_boolean_true(tvbuff_t *tvb,
997                              guint offset, guint bound _U_, guint length _U_,
998                              const char **value);
999
1000 static int
1001 format_amqp_1_0_boolean_false(tvbuff_t *tvb,
1002                               guint offset, guint bound _U_, guint length _U_,
1003                               const char **value);
1004
1005 static int
1006 format_amqp_1_0_boolean(tvbuff_t *tvb,
1007                         guint offset, guint bound _U_, guint length _U_,
1008                         const char **value);
1009
1010 static int
1011 format_amqp_1_0_uint(tvbuff_t *tvb,
1012                      guint offset, guint bound _U_, guint length,
1013                      const char **value);
1014
1015 static int
1016 format_amqp_1_0_int(tvbuff_t *tvb,
1017                     guint offset, guint bound _U_, guint length,
1018                     const char **value);
1019
1020 static int
1021 format_amqp_1_0_float(tvbuff_t *tvb,
1022                       guint offset, guint bound _U_, guint length _U_,
1023                       const char **value);
1024
1025 static int
1026 format_amqp_1_0_double(tvbuff_t *tvb,
1027                        guint offset, guint bound _U_, guint length _U_,
1028                        const char **value);
1029
1030 static int
1031 format_amqp_1_0_char(tvbuff_t *tvb,
1032                      guint offset, guint bound _U_, guint length _U_,
1033                      const char **value);
1034
1035 static int
1036 format_amqp_1_0_timestamp(tvbuff_t *tvb,
1037                           guint offset, guint bound _U_, guint length _U_,
1038                           const char **value);
1039
1040 static int
1041 format_amqp_1_0_uuid(tvbuff_t *tvb,
1042                      guint offset, guint bound _U_, guint length _U_,
1043                      const char **value);
1044
1045 static int
1046 format_amqp_1_0_bin(tvbuff_t *tvb,
1047                     guint offset, guint bound _U_, guint length,
1048                     const char **value);
1049
1050 static int
1051 format_amqp_1_0_str(tvbuff_t *tvb,
1052                     guint offset, guint bound, guint length,
1053                     const char **value);
1054
1055 static int
1056 format_amqp_1_0_symbol(tvbuff_t *tvb,
1057                        guint offset, guint bound, guint length,
1058                        const char **value);
1059
1060 static gboolean
1061 get_amqp_0_10_type_formatter(guint8 code,
1062                              const char **name,
1063                              type_formatter *decoder,
1064                              guint *length_size);
1065
1066 static int
1067 format_amqp_0_10_bin(tvbuff_t *tvb,
1068                      guint offset, guint bound, guint length,
1069                      const char **value);
1070
1071 static int
1072 format_amqp_0_10_int(tvbuff_t *tvb,
1073                      guint offset, guint bound, guint length,
1074                      const char **value);
1075
1076 static int
1077 format_amqp_0_10_uint(tvbuff_t *tvb,
1078                       guint offset, guint bound, guint length,
1079                       const char **value);
1080
1081 static int
1082 format_amqp_0_10_char(tvbuff_t *tvb,
1083                       guint offset, guint bound, guint length,
1084                       const char **value);
1085
1086 static int
1087 format_amqp_0_10_boolean(tvbuff_t *tvb,
1088                          guint offset, guint bound, guint length,
1089                          const char **value);
1090
1091 static int
1092 format_amqp_0_10_vbin(tvbuff_t *tvb,
1093                       guint offset, guint bound, guint length,
1094                       const char **value);
1095
1096 static int
1097 format_amqp_0_10_str(tvbuff_t *tvb,
1098                      guint offset, guint bound, guint length,
1099                      const char **value);
1100
1101 static void
1102 format_amqp_0_10_sequence_set(tvbuff_t *tvb, guint offset, guint length,
1103                               proto_item *item);
1104
1105 /*  Various handles  */
1106
1107 static int proto_amqp = -1;
1108 static const char* element_suffix [] = {"", "s"}; /* to distinguish singular/plural in "list of 1 item" vs. "list of 2 items" */
1109
1110 /* 1.0 handles */
1111
1112 static int hf_amqp_1_0_size = -1;
1113 static int hf_amqp_1_0_doff = -1;
1114 static int hf_amqp_1_0_type = -1;
1115 static int hf_amqp_1_0_containerId = -1;
1116 static int hf_amqp_1_0_hostname = -1;
1117 static int hf_amqp_1_0_maxFrameSize = -1;
1118 static int hf_amqp_1_0_channelMax = -1;
1119 static int hf_amqp_1_0_idleTimeOut = -1;
1120 static int hf_amqp_1_0_outgoingLocales = -1;
1121 static int hf_amqp_1_0_incomingLocales = -1;
1122 static int hf_amqp_1_0_offeredCapabilities = -1;
1123 static int hf_amqp_1_0_desiredCapabilities = -1;
1124 static int hf_amqp_1_0_properties = -1;
1125 static int hf_amqp_1_0_remoteChannel = -1;
1126 static int hf_amqp_1_0_nextOutgoingId = -1;
1127 static int hf_amqp_1_0_incomingWindow = -1;
1128 static int hf_amqp_1_0_outgoingWindow = -1;
1129 static int hf_amqp_1_0_handleMax = -1;
1130 static int hf_amqp_1_0_name = -1;
1131 static int hf_amqp_1_0_handle = -1;
1132 static int hf_amqp_1_0_role = -1;
1133 static int hf_amqp_1_0_sndSettleMode = -1;
1134 static int hf_amqp_1_0_rcvSettleMode = -1;
1135 static int hf_amqp_1_0_source = -1;
1136 static int hf_amqp_1_0_target = -1;
1137 static int hf_amqp_1_0_deleteOnClose = -1;
1138 static int hf_amqp_1_0_deleteOnNoLinks = -1;
1139 static int hf_amqp_1_0_deleteOnNoMessages = -1;
1140 static int hf_amqp_1_0_deleteOnNoLinksOrMessages = -1;
1141 static int hf_amqp_1_0_coordinator = -1;
1142 static int hf_amqp_1_0_declare = -1;
1143 static int hf_amqp_1_0_globalId = -1;
1144 static int hf_amqp_1_0_discharge = -1;
1145 static int hf_amqp_1_0_txnId = -1;
1146 static int hf_amqp_1_0_fail = -1;
1147 static int hf_amqp_1_0_declared = -1;
1148 static int hf_amqp_1_0_transactionalState = -1;
1149 static int hf_amqp_1_0_outcome = -1;
1150 static int hf_amqp_1_0_unsettled = -1;
1151 static int hf_amqp_1_0_incompleteUnsettled = -1;
1152 static int hf_amqp_1_0_initialDeliveryCount = -1;
1153 static int hf_amqp_1_0_maxMessageSize = -1;
1154 static int hf_amqp_1_0_nextIncomingId = -1;
1155 static int hf_amqp_1_0_deliveryCount = -1;
1156 static int hf_amqp_1_0_sectionNumber = -1;
1157 static int hf_amqp_1_0_sectionOffset = -1;
1158 static int hf_amqp_1_0_deliveryFailed = -1;
1159 static int hf_amqp_1_0_undeliverableHere = -1;
1160 static int hf_amqp_1_0_linkCredit = -1;
1161 static int hf_amqp_1_0_available = -1;
1162 static int hf_amqp_1_0_drain = -1;
1163 static int hf_amqp_1_0_echo = -1;
1164 static int hf_amqp_1_0_deliveryId = -1;
1165 static int hf_amqp_1_0_deliveryTag = -1;
1166 static int hf_amqp_1_0_messageFormat = -1;
1167 static int hf_amqp_1_0_settled = -1;
1168 static int hf_amqp_1_0_more = -1;
1169 static int hf_amqp_1_0_state = -1;
1170 static int hf_amqp_1_0_resume = -1;
1171 static int hf_amqp_1_0_aborted = -1;
1172 static int hf_amqp_1_0_batchable = -1;
1173 static int hf_amqp_1_0_first = -1;
1174 static int hf_amqp_1_0_last = -1;
1175 static int hf_amqp_1_0_closed = -1;
1176 static int hf_amqp_1_0_amqp_performative = -1;
1177 static int hf_amqp_1_0_error = -1;
1178 static int hf_amqp_1_0_messageHeader = -1;
1179 static int hf_amqp_1_0_deliveryAnnotations = -1;
1180 static int hf_amqp_1_0_messageAnnotations = -1;
1181 static int hf_amqp_1_0_messageProperties = -1;
1182 static int hf_amqp_1_0_applicationProperties = -1;
1183 static int hf_amqp_1_0_data = -1;
1184 static int hf_amqp_1_0_amqp_sequence = -1;
1185 static int hf_amqp_1_0_amqp_value = -1;
1186 static int hf_amqp_1_0_footer = -1;
1187 static int hf_amqp_1_0_received = -1;
1188 static int hf_amqp_1_0_accepted = -1;
1189 static int hf_amqp_1_0_rejected = -1;
1190 static int hf_amqp_1_0_released = -1;
1191 static int hf_amqp_1_0_modified = -1;
1192 static int hf_amqp_1_0_condition = -1;
1193 static int hf_amqp_1_0_description = -1;
1194 static int hf_amqp_1_0_info = -1;
1195 static int hf_amqp_1_0_address = -1;
1196 static int hf_amqp_1_0_durable = -1;
1197 static int hf_amqp_1_0_terminusDurable = -1;
1198 static int hf_amqp_1_0_priority = -1;
1199 static int hf_amqp_1_0_ttl = -1;
1200 static int hf_amqp_1_0_firstAcquirer = -1;
1201 static int hf_amqp_1_0_expiryPolicy = -1;
1202 static int hf_amqp_1_0_timeout = -1;
1203 static int hf_amqp_1_0_dynamic = -1;
1204 static int hf_amqp_1_0_dynamicNodeProperties = -1;
1205 static int hf_amqp_1_0_distributionMode = -1;
1206 static int hf_amqp_1_0_filter = -1;
1207 static int hf_amqp_1_0_defaultOutcome = -1;
1208 static int hf_amqp_1_0_outcomes = -1;
1209 static int hf_amqp_1_0_capabilities = -1;
1210 static int hf_amqp_1_0_messageId = -1;
1211 static int hf_amqp_1_0_userId = -1;
1212 static int hf_amqp_1_0_to = -1;
1213 static int hf_amqp_1_0_subject = -1;
1214 static int hf_amqp_1_0_replyTo = -1;
1215 static int hf_amqp_1_0_correlationId = -1;
1216 static int hf_amqp_1_0_contentType = -1;
1217 static int hf_amqp_1_0_contentEncoding = -1;
1218 static int hf_amqp_1_0_absoluteExpiryTime = -1;
1219 static int hf_amqp_1_0_creationTime = -1;
1220 static int hf_amqp_1_0_groupId = -1;
1221 static int hf_amqp_1_0_groupSequence = -1;
1222 static int hf_amqp_1_0_replyToGroupId = -1;
1223 static int hf_amqp_1_0_sasl_method = -1;
1224 static int hf_amqp_1_0_mechanisms = -1;
1225 static int hf_amqp_1_0_mechanism = -1;
1226 static int hf_amqp_1_0_initResponse = -1;
1227 static int hf_amqp_1_0_saslChallenge = -1;
1228 static int hf_amqp_1_0_saslResponse = -1;
1229 static int hf_amqp_1_0_saslCode = -1;
1230 static int hf_amqp_1_0_saslAdditionalData = -1;
1231 static int hf_amqp_1_0_list = -1;
1232 static int hf_amqp_1_0_map = -1;
1233 static int hf_amqp_1_0_array = -1;
1234 /* sub-hf_* variables for variant sub-types */
1235 static int hf_amqp_1_0_hostname_str = -1;
1236 static int hf_amqp_1_0_maxFrameSize_1 = -1;
1237 static int hf_amqp_1_0_maxFrameSize_4 = -1;
1238 static int hf_amqp_1_0_incomingWindow_1 = -1;
1239 static int hf_amqp_1_0_incomingWindow_4 = -1;
1240 static int hf_amqp_1_0_outgoingWindow_1 = -1;
1241 static int hf_amqp_1_0_outgoingWindow_4 = -1;
1242 static int hf_amqp_1_0_linkCredit_1 = -1;
1243 static int hf_amqp_1_0_linkCredit_4 = -1;
1244 static int hf_amqp_1_0_available_1 = -1;
1245 static int hf_amqp_1_0_available_4 = -1;
1246 static int hf_amqp_1_0_deliveryCount_1 = -1;
1247 static int hf_amqp_1_0_deliveryCount_4 = -1;
1248 static int hf_amqp_1_0_sectionNumber_1 = -1;
1249 static int hf_amqp_1_0_sectionNumber_4 = -1;
1250 static int hf_amqp_1_0_idleTimeOut_1 = -1;
1251 static int hf_amqp_1_0_idleTimeOut_4 = -1;
1252 static int hf_amqp_1_0_outgoingLocales_sym = -1;
1253 static int hf_amqp_1_0_incomingLocales_sym = -1;
1254 static int hf_amqp_1_0_offeredCapabilities_sym = -1;
1255 static int hf_amqp_1_0_desiredCapabilities_sym = -1;
1256 static int hf_amqp_1_0_nextIncomingId_1 = -1;
1257 static int hf_amqp_1_0_nextIncomingId_4 = -1;
1258 static int hf_amqp_1_0_sectionOffset_1 = -1;
1259 static int hf_amqp_1_0_sectionOffset_8 = -1;
1260 static int hf_amqp_1_0_maxMessageSize_1 = -1;
1261 static int hf_amqp_1_0_maxMessageSize_8 = -1;
1262 static int hf_amqp_1_0_nextOutgoingId_1 = -1;
1263 static int hf_amqp_1_0_nextOutgoingId_4 = -1;
1264 static int hf_amqp_1_0_deliveryId_1 = -1;
1265 static int hf_amqp_1_0_deliveryId_4 = -1;
1266 static int hf_amqp_1_0_deliveryTag_bin = -1;
1267 static int hf_amqp_1_0_messageFormat_1 = -1;
1268 static int hf_amqp_1_0_messageFormat_4 = -1;
1269 static int hf_amqp_1_0_first_1 = -1;
1270 static int hf_amqp_1_0_first_4 = -1;
1271 static int hf_amqp_1_0_last_1 = -1;
1272 static int hf_amqp_1_0_last_4 = -1;
1273 static int hf_amqp_1_0_remoteChannel_2 = -1;
1274 static int hf_amqp_1_0_handleMax_1 = -1;
1275 static int hf_amqp_1_0_handleMax_4 = -1;
1276 static int hf_amqp_1_0_handle_1 = -1;
1277 static int hf_amqp_1_0_handle_4 = -1;
1278 static int hf_amqp_1_0_sndSettleMode_1 = -1;
1279 static int hf_amqp_1_0_rcvSettleMode_1 = -1;
1280 static int hf_amqp_1_0_initialDeliveryCount_1 = -1;
1281 static int hf_amqp_1_0_initialDeliveryCount_4 = -1;
1282 static int hf_amqp_1_0_description_str = -1;
1283 static int hf_amqp_1_0_address_str = -1;
1284 static int hf_amqp_1_0_terminusDurable_1 = -1;
1285 static int hf_amqp_1_0_terminusDurable_4 = -1;
1286 static int hf_amqp_1_0_priority_1 = -1;
1287 static int hf_amqp_1_0_ttl_1 = -1;
1288 static int hf_amqp_1_0_ttl_4 = -1;
1289 static int hf_amqp_1_0_expiryPolicy_sym = -1;
1290 static int hf_amqp_1_0_timeout_1 = -1;
1291 static int hf_amqp_1_0_timeout_4 = -1;
1292 static int hf_amqp_1_0_distributionMode_sym = -1;
1293 static int hf_amqp_1_0_outcomes_sym = -1;
1294 static int hf_amqp_1_0_capabilities_sym = -1;
1295 static int hf_amqp_1_0_messageId_1 = -1;
1296 static int hf_amqp_1_0_messageId_str = -1;
1297 static int hf_amqp_1_0_messageId_bin = -1;
1298 static int hf_amqp_1_0_messageId_uuid = -1;
1299 static int hf_amqp_1_0_messageId_8 = -1;
1300 static int hf_amqp_1_0_correlationId_1 = -1;
1301 static int hf_amqp_1_0_correlationId_str = -1;
1302 static int hf_amqp_1_0_correlationId_bin = -1;
1303 static int hf_amqp_1_0_correlationId_uuid = -1;
1304 static int hf_amqp_1_0_correlationId_8 = -1;
1305 static int hf_amqp_1_0_userId_bin = -1;
1306 static int hf_amqp_1_0_to_str = -1;
1307 static int hf_amqp_1_0_subject_str = -1;
1308 static int hf_amqp_1_0_replyTo_str = -1;
1309 static int hf_amqp_1_0_contentType_sym = -1;
1310 static int hf_amqp_1_0_contentEncoding_sym = -1;
1311 static int hf_amqp_1_0_absoluteExpiryTime_timestamp = -1;
1312 static int hf_amqp_1_0_creationTime_timestamp = -1;
1313 static int hf_amqp_1_0_groupId_str = -1;
1314 static int hf_amqp_1_0_groupSequence_1 = -1;
1315 static int hf_amqp_1_0_groupSequence_4 = -1;
1316 static int hf_amqp_1_0_replyToGroupId_str = -1;
1317 static int hf_amqp_1_0_mechanisms_sym = -1;
1318 static int hf_amqp_1_0_initResponse_bin = -1;
1319 static int hf_amqp_1_0_saslAdditionalData_bin = -1;
1320
1321 /* Many AMQP variables can have value in either 0,1,2,4,8 or 16 bytes, depending on particular type.
1322  * To distinguish it among hf_amqp_1_0_* variables, table below "translates" original hf_amqp_1_0_*
1323  * variable to the proper one based on format code subcategory
1324  */
1325
1326 const int* hf_amqp_1_0_hostname_[] = { &hf_amqp_1_0_hostname, &hf_amqp_1_0_hostname_str, NULL, NULL, NULL, NULL };
1327 const int* hf_amqp_1_0_maxFrameSize_[] = { &hf_amqp_1_0_maxFrameSize, &hf_amqp_1_0_maxFrameSize_1, NULL, &hf_amqp_1_0_maxFrameSize_4, NULL, NULL };
1328 const int* hf_amqp_1_0_incomingWindow_[] = { &hf_amqp_1_0_incomingWindow, &hf_amqp_1_0_incomingWindow_1, NULL, &hf_amqp_1_0_incomingWindow_4, NULL, NULL };
1329 const int* hf_amqp_1_0_outgoingWindow_[] = { &hf_amqp_1_0_outgoingWindow, &hf_amqp_1_0_outgoingWindow_1, NULL, &hf_amqp_1_0_outgoingWindow_4, NULL, NULL };
1330 const int* hf_amqp_1_0_linkCredit_[] = { &hf_amqp_1_0_linkCredit, &hf_amqp_1_0_linkCredit_1, NULL, &hf_amqp_1_0_linkCredit_4, NULL, NULL };
1331 const int* hf_amqp_1_0_available_[] = { &hf_amqp_1_0_available, &hf_amqp_1_0_available_1, NULL, &hf_amqp_1_0_available_4, NULL, NULL };
1332 const int* hf_amqp_1_0_deliveryCount_[] = { &hf_amqp_1_0_deliveryCount, &hf_amqp_1_0_deliveryCount_1, NULL, &hf_amqp_1_0_deliveryCount_4, NULL, NULL };
1333 const int* hf_amqp_1_0_sectionNumber_[] = { &hf_amqp_1_0_sectionNumber, &hf_amqp_1_0_sectionNumber_1, NULL, &hf_amqp_1_0_sectionNumber_4, NULL, NULL };
1334 const int* hf_amqp_1_0_idleTimeOut_[] = { &hf_amqp_1_0_idleTimeOut, &hf_amqp_1_0_idleTimeOut_1, NULL, &hf_amqp_1_0_idleTimeOut_4, NULL, NULL };
1335 const int* hf_amqp_1_0_outgoingLocales_[] = { &hf_amqp_1_0_outgoingLocales, &hf_amqp_1_0_outgoingLocales_sym, NULL, &hf_amqp_1_0_outgoingLocales_sym, NULL, NULL };
1336 const int* hf_amqp_1_0_incomingLocales_[] = { &hf_amqp_1_0_incomingLocales, &hf_amqp_1_0_incomingLocales_sym, NULL, &hf_amqp_1_0_incomingLocales_sym, NULL, NULL };
1337 const int* hf_amqp_1_0_offeredCapabilities_[] = { &hf_amqp_1_0_offeredCapabilities, &hf_amqp_1_0_offeredCapabilities_sym, NULL, &hf_amqp_1_0_offeredCapabilities_sym, NULL, NULL };
1338 const int* hf_amqp_1_0_desiredCapabilities_[] = { &hf_amqp_1_0_desiredCapabilities, &hf_amqp_1_0_desiredCapabilities_sym, NULL, &hf_amqp_1_0_desiredCapabilities_sym, NULL, NULL };
1339 const int* hf_amqp_1_0_nextIncomingId_[] = { &hf_amqp_1_0_nextIncomingId, &hf_amqp_1_0_nextIncomingId_1, NULL, &hf_amqp_1_0_nextIncomingId_4, NULL, NULL };
1340 const int* hf_amqp_1_0_sectionOffset_[] = { &hf_amqp_1_0_sectionOffset, &hf_amqp_1_0_sectionOffset_1, NULL, NULL, &hf_amqp_1_0_sectionOffset_8, NULL };
1341 const int* hf_amqp_1_0_maxMessageSize_[] = { &hf_amqp_1_0_maxMessageSize, &hf_amqp_1_0_maxMessageSize_1, NULL, NULL, &hf_amqp_1_0_maxMessageSize_8, NULL };
1342 const int* hf_amqp_1_0_nextOutgoingId_[] = { &hf_amqp_1_0_nextOutgoingId, &hf_amqp_1_0_nextOutgoingId_1, NULL, &hf_amqp_1_0_nextOutgoingId_4, NULL, NULL };
1343 const int* hf_amqp_1_0_deliveryId_[] = { &hf_amqp_1_0_deliveryId, &hf_amqp_1_0_deliveryId_1, NULL, &hf_amqp_1_0_deliveryId_4, NULL, NULL };
1344 const int* hf_amqp_1_0_deliveryTag_[] = { &hf_amqp_1_0_deliveryTag, &hf_amqp_1_0_deliveryTag_bin, NULL, NULL, NULL, NULL };
1345 const int* hf_amqp_1_0_messageFormat_[] = { &hf_amqp_1_0_messageFormat, &hf_amqp_1_0_messageFormat_1, NULL, &hf_amqp_1_0_messageFormat_4, NULL, NULL };
1346 const int* hf_amqp_1_0_first_[] = { &hf_amqp_1_0_first, &hf_amqp_1_0_first_1, NULL, &hf_amqp_1_0_first_4, NULL, NULL };
1347 const int* hf_amqp_1_0_last_[] = { &hf_amqp_1_0_last, &hf_amqp_1_0_last_1, NULL, &hf_amqp_1_0_last_4, NULL, NULL };
1348 const int* hf_amqp_1_0_remoteChannel_[] = { &hf_amqp_1_0_remoteChannel, NULL, &hf_amqp_1_0_remoteChannel_2, NULL, NULL, NULL };
1349 const int* hf_amqp_1_0_handleMax_[] = { &hf_amqp_1_0_handleMax, &hf_amqp_1_0_handleMax_1, NULL, &hf_amqp_1_0_handleMax_4, NULL, NULL };
1350 const int* hf_amqp_1_0_handle_[] = { &hf_amqp_1_0_handle, &hf_amqp_1_0_handle_1, NULL, &hf_amqp_1_0_handle_4, NULL, NULL };
1351 const int* hf_amqp_1_0_sndSettleMode_[] = { &hf_amqp_1_0_sndSettleMode, &hf_amqp_1_0_sndSettleMode_1, NULL, NULL, NULL, NULL };
1352 const int* hf_amqp_1_0_rcvSettleMode_[] = { &hf_amqp_1_0_rcvSettleMode, &hf_amqp_1_0_rcvSettleMode_1, NULL, NULL, NULL, NULL };
1353 const int* hf_amqp_1_0_initialDeliveryCount_[] = { &hf_amqp_1_0_initialDeliveryCount, &hf_amqp_1_0_initialDeliveryCount_1, NULL, &hf_amqp_1_0_initialDeliveryCount_4, NULL, NULL };
1354 const int* hf_amqp_1_0_description_[] = { &hf_amqp_1_0_description, &hf_amqp_1_0_description_str, NULL, NULL, NULL, NULL };
1355 const int* hf_amqp_1_0_address_[] = { &hf_amqp_1_0_address, &hf_amqp_1_0_address_str, NULL, NULL, NULL, NULL };
1356 const int* hf_amqp_1_0_terminusDurable_[] = { &hf_amqp_1_0_terminusDurable, &hf_amqp_1_0_terminusDurable_1, NULL, &hf_amqp_1_0_terminusDurable_4, NULL, NULL };
1357 const int* hf_amqp_1_0_priority_[] = { &hf_amqp_1_0_priority, &hf_amqp_1_0_priority_1, NULL, NULL, NULL, NULL };
1358 const int* hf_amqp_1_0_ttl_[] = { &hf_amqp_1_0_ttl, &hf_amqp_1_0_ttl_1, NULL, &hf_amqp_1_0_ttl_4, NULL, NULL };
1359 const int* hf_amqp_1_0_expiryPolicy_[] = { &hf_amqp_1_0_expiryPolicy, &hf_amqp_1_0_expiryPolicy_sym, NULL, &hf_amqp_1_0_expiryPolicy_sym, NULL, NULL };
1360 const int* hf_amqp_1_0_timeout_[] = { &hf_amqp_1_0_timeout, &hf_amqp_1_0_timeout_1, NULL, &hf_amqp_1_0_timeout_4, NULL, NULL };
1361 const int* hf_amqp_1_0_distributionMode_[] = { &hf_amqp_1_0_distributionMode, &hf_amqp_1_0_distributionMode_sym, NULL, &hf_amqp_1_0_distributionMode_sym, NULL, NULL };
1362 const int* hf_amqp_1_0_outcomes_[] = { &hf_amqp_1_0_outcomes, &hf_amqp_1_0_outcomes_sym, NULL, &hf_amqp_1_0_outcomes_sym, NULL, NULL };
1363 const int* hf_amqp_1_0_capabilities_[] = { &hf_amqp_1_0_capabilities, &hf_amqp_1_0_capabilities_sym, NULL, &hf_amqp_1_0_capabilities_sym, NULL, NULL };
1364 const int* hf_amqp_1_0_messageId_[] = { &hf_amqp_1_0_messageId, &hf_amqp_1_0_messageId_1, &hf_amqp_1_0_messageId_str, &hf_amqp_1_0_messageId_bin, &hf_amqp_1_0_messageId_8, &hf_amqp_1_0_messageId_uuid };
1365 const int* hf_amqp_1_0_correlationId_[] = { &hf_amqp_1_0_correlationId, &hf_amqp_1_0_correlationId_1, &hf_amqp_1_0_correlationId_str, &hf_amqp_1_0_correlationId_bin, &hf_amqp_1_0_correlationId_8, &hf_amqp_1_0_correlationId_uuid };
1366 const int* hf_amqp_1_0_userId_[] = { &hf_amqp_1_0_userId, &hf_amqp_1_0_userId_bin, NULL, NULL, NULL, NULL };
1367 const int* hf_amqp_1_0_to_[] = { &hf_amqp_1_0_to, &hf_amqp_1_0_to_str, NULL, NULL, NULL, NULL };
1368 const int* hf_amqp_1_0_subject_[] = { &hf_amqp_1_0_subject, &hf_amqp_1_0_subject_str, NULL, NULL, NULL, NULL };
1369 const int* hf_amqp_1_0_replyTo_[] = { &hf_amqp_1_0_replyTo, &hf_amqp_1_0_replyTo_str, NULL, NULL, NULL, NULL };
1370 const int* hf_amqp_1_0_contentType_[] = { &hf_amqp_1_0_contentType, &hf_amqp_1_0_contentType_sym, NULL, &hf_amqp_1_0_contentType_sym, NULL, NULL };
1371 const int* hf_amqp_1_0_contentEncoding_[] = { &hf_amqp_1_0_contentEncoding, &hf_amqp_1_0_contentEncoding_sym, NULL, &hf_amqp_1_0_contentEncoding_sym, NULL, NULL };
1372 const int* hf_amqp_1_0_absoluteExpiryTime_[] = { &hf_amqp_1_0_absoluteExpiryTime, NULL, NULL, NULL, &hf_amqp_1_0_absoluteExpiryTime_timestamp, NULL };
1373 const int* hf_amqp_1_0_creationTime_[] = { &hf_amqp_1_0_creationTime, NULL, NULL, NULL, &hf_amqp_1_0_creationTime_timestamp, NULL };
1374 const int* hf_amqp_1_0_groupId_[] = { &hf_amqp_1_0_groupId, &hf_amqp_1_0_groupId_str, NULL, NULL, NULL, NULL };
1375 const int* hf_amqp_1_0_groupSequence_[] = { &hf_amqp_1_0_groupSequence, &hf_amqp_1_0_groupSequence_1, NULL, &hf_amqp_1_0_groupSequence_4, NULL, NULL };
1376 const int* hf_amqp_1_0_replyToGroupId_[] = { &hf_amqp_1_0_replyToGroupId, &hf_amqp_1_0_replyToGroupId_str, NULL, NULL, NULL, NULL };
1377 const int* hf_amqp_1_0_mechanisms_[] = { &hf_amqp_1_0_mechanisms, &hf_amqp_1_0_mechanisms_sym, NULL, &hf_amqp_1_0_mechanisms_sym, NULL, NULL };
1378 const int* hf_amqp_1_0_initResponse_[] = { &hf_amqp_1_0_initResponse, &hf_amqp_1_0_initResponse_bin, NULL, NULL, NULL, NULL };
1379 const int* hf_amqp_1_0_saslAdditionalData_[] = { &hf_amqp_1_0_saslAdditionalData, &hf_amqp_1_0_saslAdditionalData_bin, NULL, NULL, NULL, NULL };
1380
1381 const int** subtypes_for_hf_amqp_1_0[] = {
1382   NULL, /* hf_amqp_1_0_size */
1383   NULL, /* hf_amqp_1_0_doff */
1384   NULL, /* hf_amqp_1_0_type */
1385   NULL, /* hf_amqp_1_0_amqp_performative */
1386   NULL, /* hf_amqp_1_0_sasl_method */
1387   NULL, /* hf_amqp_1_0_list */
1388   NULL, /* hf_amqp_1_0_map */
1389   NULL, /* hf_amqp_1_0_array */
1390   NULL, /* hf_amqp_1_0_containerId - mandatory string */
1391   hf_amqp_1_0_hostname_,
1392   hf_amqp_1_0_maxFrameSize_,
1393   NULL, /* hf_amqp_1_0_channelMax_,*/
1394   hf_amqp_1_0_idleTimeOut_,
1395   hf_amqp_1_0_outgoingLocales_,
1396   hf_amqp_1_0_incomingLocales_,
1397   hf_amqp_1_0_offeredCapabilities_,
1398   hf_amqp_1_0_desiredCapabilities_,
1399   NULL, /* hf_amqp_1_0_properties */
1400   hf_amqp_1_0_nextIncomingId_,
1401   hf_amqp_1_0_deliveryCount_,
1402   hf_amqp_1_0_sectionNumber_,
1403   hf_amqp_1_0_sectionOffset_,
1404   NULL, /* hf_amqp_1_0_deliveryFailed */
1405   NULL, /* hf_amqp_1_0_undeliverableHere */
1406   hf_amqp_1_0_linkCredit_,
1407   hf_amqp_1_0_available_,
1408   NULL, /* hf_amqp_1_0_drain */
1409   NULL, /* hf_amqp_1_0_echo */
1410   hf_amqp_1_0_deliveryId_,
1411   hf_amqp_1_0_deliveryTag_,
1412   hf_amqp_1_0_messageFormat_,
1413   NULL, /* hf_amqp_1_0_settled */
1414   NULL, /* hf_amqp_1_0_more */
1415   NULL, /* hf_amqp_1_0_state */
1416   NULL, /* hf_amqp_1_0_resume */
1417   NULL, /* hf_amqp_1_0_aborted */
1418   NULL, /* hf_amqp_1_0_batchable */
1419   hf_amqp_1_0_first_,
1420   hf_amqp_1_0_last_,
1421   NULL, /* hf_amqp_1_0_closed */
1422   hf_amqp_1_0_remoteChannel_,
1423   hf_amqp_1_0_nextOutgoingId_,
1424   hf_amqp_1_0_incomingWindow_,
1425   hf_amqp_1_0_outgoingWindow_,
1426   hf_amqp_1_0_handleMax_,
1427   NULL, /* hf_amqp_1_0_name */
1428   hf_amqp_1_0_handle_,
1429   NULL, /* hf_amqp_1_0_role */
1430   hf_amqp_1_0_sndSettleMode_,
1431   hf_amqp_1_0_rcvSettleMode_,
1432   NULL, /* hf_amqp_1_0_source */
1433   NULL, /* hf_amqp_1_0_target */
1434   NULL, /* hf_amqp_1_0_deleteOnClose */
1435   NULL, /* hf_amqp_1_0_deleteOnNoLinks */
1436   NULL, /* hf_amqp_1_0_deleteOnNoMessages */
1437   NULL, /* hf_amqp_1_0_deleteOnNoLinksOrMessages */
1438   NULL, /* hf_amqp_1_0_coordinator */
1439   NULL, /* hf_amqp_1_0_declare */
1440   NULL, /* hf_amqp_1_0_globalId */
1441   NULL, /* hf_amqp_1_0_discharge */
1442   NULL, /* hf_amqp_1_0_txnId */
1443   NULL, /* hf_amqp_1_0_fail */
1444   NULL, /* hf_amqp_1_0_declared */
1445   NULL, /* hf_amqp_1_0_transactionalState */
1446   NULL, /* hf_amqp_1_0_outcome */
1447   NULL, /* hf_amqp_1_0_unsettled */
1448   NULL, /* hf_amqp_1_0_incompleteUnsettled */
1449   hf_amqp_1_0_initialDeliveryCount_,
1450   hf_amqp_1_0_maxMessageSize_,
1451   NULL, /* hf_amqp_1_0_error */
1452   NULL, /* hf_amqp_1_0_messageHeader */
1453   NULL, /* hf_amqp_1_0_messageProperties */
1454   NULL, /* hf_amqp_1_0_deliveryAnnotations */
1455   NULL, /* hf_amqp_1_0_messageAnnotations */
1456   NULL, /* hf_amqp_1_0_applicationProperties */
1457   NULL, /* hf_amqp_1_0_data */
1458   NULL, /* hf_amqp_1_0_amqp_sequence */
1459   NULL, /* hf_amqp_1_0_amqp_value */
1460   NULL, /* hf_amqp_1_0_footer */
1461   NULL, /* hf_amqp_1_0_received */
1462   NULL, /* hf_amqp_1_0_accepted */
1463   NULL, /* hf_amqp_1_0_rejected */
1464   NULL, /* hf_amqp_1_0_released */
1465   NULL, /* hf_amqp_1_0_modified */
1466   NULL, /* hf_amqp_1_0_condition */
1467   hf_amqp_1_0_description_,
1468   NULL, /* hf_amqp_1_0_info */
1469   hf_amqp_1_0_address_,
1470   NULL, /* hf_amqp_1_0_durable */
1471   hf_amqp_1_0_terminusDurable_,
1472   hf_amqp_1_0_priority_,
1473   hf_amqp_1_0_ttl_,
1474   NULL, /* hf_amqp_1_0_firstAcquirer */
1475   hf_amqp_1_0_expiryPolicy_,
1476   hf_amqp_1_0_timeout_,
1477   NULL, /* hf_amqp_1_0_dynamic */
1478   NULL, /* hf_amqp_1_0_dynamicNodeProperties */
1479   hf_amqp_1_0_distributionMode_,
1480   NULL, /* hf_amqp_1_0_filter */
1481   NULL, /* hf_amqp_1_0_defaultOutcome */
1482   hf_amqp_1_0_outcomes_,
1483   hf_amqp_1_0_capabilities_,
1484   hf_amqp_1_0_messageId_,
1485   hf_amqp_1_0_userId_,
1486   hf_amqp_1_0_to_,
1487   hf_amqp_1_0_subject_,
1488   hf_amqp_1_0_replyTo_,
1489   hf_amqp_1_0_correlationId_,
1490   hf_amqp_1_0_contentType_,
1491   hf_amqp_1_0_contentEncoding_,
1492   hf_amqp_1_0_absoluteExpiryTime_,
1493   hf_amqp_1_0_creationTime_,
1494   hf_amqp_1_0_groupId_,
1495   hf_amqp_1_0_groupSequence_,
1496   hf_amqp_1_0_replyToGroupId_,
1497   hf_amqp_1_0_mechanisms_,
1498   NULL, /* hf_amqp_1_0_mechanism */
1499   hf_amqp_1_0_initResponse_,
1500   NULL, /* hf_amqp_1_0_saslChallenge */
1501   NULL, /* hf_amqp_1_0_saslResponse */
1502   NULL, /* hf_amqp_1_0_saslCode */
1503   hf_amqp_1_0_saslAdditionalData_
1504 };
1505
1506 /* fields with hf_* types for list items;
1507  * i.e. sasl.init method has 3 arguments in a list (mechanism, init.response, hostname)
1508  * so when dissecting sasl.init arguments list, identify the list items with
1509  * corresponding hf_* variable */
1510 const int* hf_amqp_1_0_sasl_mechanisms_items[] = { &hf_amqp_1_0_mechanisms };
1511 const int* hf_amqp_1_0_sasl_init_items[] = { &hf_amqp_1_0_mechanism,
1512                                              &hf_amqp_1_0_initResponse,
1513                                              &hf_amqp_1_0_hostname };
1514 const int* hf_amqp_1_0_sasl_challenge_items[] = { &hf_amqp_1_0_saslChallenge };
1515 const int* hf_amqp_1_0_sasl_response_items[] = { &hf_amqp_1_0_saslResponse };
1516 const int* hf_amqp_1_0_sasl_outcome_items[] = { &hf_amqp_1_0_saslCode,
1517                                                 &hf_amqp_1_0_saslAdditionalData };
1518 const int* hf_amqp_1_0_amqp_open_items[] = { &hf_amqp_1_0_containerId,
1519                                              &hf_amqp_1_0_hostname,
1520                                              &hf_amqp_1_0_maxFrameSize,
1521                                              &hf_amqp_1_0_channelMax,
1522                                              &hf_amqp_1_0_idleTimeOut,
1523                                              &hf_amqp_1_0_outgoingLocales,
1524                                              &hf_amqp_1_0_incomingLocales,
1525                                              &hf_amqp_1_0_offeredCapabilities,
1526                                              &hf_amqp_1_0_desiredCapabilities,
1527                                              &hf_amqp_1_0_properties };
1528 const int* hf_amqp_1_0_amqp_begin_items[] = { &hf_amqp_1_0_remoteChannel,
1529                                               &hf_amqp_1_0_nextOutgoingId,
1530                                               &hf_amqp_1_0_incomingWindow,
1531                                               &hf_amqp_1_0_outgoingWindow,
1532                                               &hf_amqp_1_0_handleMax,
1533                                               &hf_amqp_1_0_offeredCapabilities,
1534                                               &hf_amqp_1_0_desiredCapabilities,
1535                                               &hf_amqp_1_0_properties };
1536 const int* hf_amqp_1_0_amqp_attach_items[] = { &hf_amqp_1_0_name,
1537                                                &hf_amqp_1_0_handle,
1538                                                &hf_amqp_1_0_role,
1539                                                &hf_amqp_1_0_sndSettleMode,
1540                                                &hf_amqp_1_0_rcvSettleMode,
1541                                                &hf_amqp_1_0_source,
1542                                                &hf_amqp_1_0_target,
1543                                                &hf_amqp_1_0_unsettled,
1544                                                &hf_amqp_1_0_incompleteUnsettled,
1545                                                &hf_amqp_1_0_initialDeliveryCount,
1546                                                &hf_amqp_1_0_maxMessageSize,
1547                                                &hf_amqp_1_0_offeredCapabilities,
1548                                                &hf_amqp_1_0_desiredCapabilities,
1549                                                &hf_amqp_1_0_properties };
1550 const int* hf_amqp_1_0_amqp_flow_items[] = { &hf_amqp_1_0_nextIncomingId,
1551                                              &hf_amqp_1_0_incomingWindow,
1552                                              &hf_amqp_1_0_nextOutgoingId,
1553                                              &hf_amqp_1_0_outgoingWindow,
1554                                              &hf_amqp_1_0_handle,
1555                                              &hf_amqp_1_0_deliveryCount,
1556                                              &hf_amqp_1_0_linkCredit,
1557                                              &hf_amqp_1_0_available,
1558                                              &hf_amqp_1_0_drain,
1559                                              &hf_amqp_1_0_echo,
1560                                              &hf_amqp_1_0_properties };
1561 const int* hf_amqp_1_0_amqp_transfer_items[] = { &hf_amqp_1_0_handle,
1562                                                  &hf_amqp_1_0_deliveryId,
1563                                                  &hf_amqp_1_0_deliveryTag,
1564                                                  &hf_amqp_1_0_messageFormat,
1565                                                  &hf_amqp_1_0_settled,
1566                                                  &hf_amqp_1_0_more,
1567                                                  &hf_amqp_1_0_rcvSettleMode,
1568                                                  &hf_amqp_1_0_state,
1569                                                  &hf_amqp_1_0_resume,
1570                                                  &hf_amqp_1_0_aborted,
1571                                                  &hf_amqp_1_0_batchable };
1572 const int* hf_amqp_1_0_amqp_disposition_items[] = { &hf_amqp_1_0_role,
1573                                                     &hf_amqp_1_0_first,
1574                                                     &hf_amqp_1_0_last,
1575                                                     &hf_amqp_1_0_settled,
1576                                                     &hf_amqp_1_0_state,
1577                                                     &hf_amqp_1_0_batchable };
1578 const int* hf_amqp_1_0_amqp_detach_items[] = { &hf_amqp_1_0_handle,
1579                                                &hf_amqp_1_0_closed,
1580                                                &hf_amqp_1_0_error };
1581 const int* hf_amqp_1_0_amqp_end_items[] = { &hf_amqp_1_0_error };
1582 const int* hf_amqp_1_0_amqp_close_items[] = { &hf_amqp_1_0_error };
1583 const int* hf_amqp_1_0_error_items[] = { &hf_amqp_1_0_condition,
1584                                          &hf_amqp_1_0_description,
1585                                          &hf_amqp_1_0_info };
1586 const int* hf_amqp_1_0_messageHeader_items[] = { &hf_amqp_1_0_durable,
1587                                                  &hf_amqp_1_0_priority,
1588                                                  &hf_amqp_1_0_ttl,
1589                                                  &hf_amqp_1_0_firstAcquirer,
1590                                                  &hf_amqp_1_0_deliveryCount };
1591 const int* hf_amqp_1_0_received_items[] = { &hf_amqp_1_0_sectionNumber,
1592                                             &hf_amqp_1_0_sectionOffset };
1593 const int* hf_amqp_1_0_rejected_items[] = { &hf_amqp_1_0_error };
1594 const int* hf_amqp_1_0_modified_items[] = { &hf_amqp_1_0_deliveryFailed,
1595                                             &hf_amqp_1_0_undeliverableHere,
1596                                             &hf_amqp_1_0_messageAnnotations };
1597 const int* hf_amqp_1_0_source_items[] = { &hf_amqp_1_0_address,
1598                                           &hf_amqp_1_0_terminusDurable,
1599                                           &hf_amqp_1_0_expiryPolicy,
1600                                           &hf_amqp_1_0_timeout,
1601                                           &hf_amqp_1_0_dynamic,
1602                                           &hf_amqp_1_0_dynamicNodeProperties,
1603                                           &hf_amqp_1_0_distributionMode,
1604                                           &hf_amqp_1_0_filter,
1605                                           &hf_amqp_1_0_defaultOutcome,
1606                                           &hf_amqp_1_0_outcomes,
1607                                           &hf_amqp_1_0_capabilities };
1608 const int* hf_amqp_1_0_target_items[] = { &hf_amqp_1_0_address,
1609                                           &hf_amqp_1_0_terminusDurable,
1610                                           &hf_amqp_1_0_expiryPolicy,
1611                                           &hf_amqp_1_0_timeout,
1612                                           &hf_amqp_1_0_dynamic,
1613                                           &hf_amqp_1_0_dynamicNodeProperties,
1614                                           &hf_amqp_1_0_capabilities };
1615 const int* hf_amqp_1_0_messageProperties_items[] = { &hf_amqp_1_0_messageId,
1616                                                      &hf_amqp_1_0_userId,
1617                                                      &hf_amqp_1_0_to,
1618                                                      &hf_amqp_1_0_subject,
1619                                                      &hf_amqp_1_0_replyTo,
1620                                                      &hf_amqp_1_0_correlationId,
1621                                                      &hf_amqp_1_0_contentType,
1622                                                      &hf_amqp_1_0_contentEncoding,
1623                                                      &hf_amqp_1_0_absoluteExpiryTime,
1624                                                      &hf_amqp_1_0_creationTime,
1625                                                      &hf_amqp_1_0_groupId,
1626                                                      &hf_amqp_1_0_groupSequence,
1627                                                      &hf_amqp_1_0_replyToGroupId };
1628 const int* hf_amqp_1_0_coordinator_items[] = { &hf_amqp_1_0_capabilities };
1629 const int* hf_amqp_1_0_declare_items[] = { &hf_amqp_1_0_globalId };
1630 const int* hf_amqp_1_0_discharge_items[] = { &hf_amqp_1_0_txnId,
1631                                              &hf_amqp_1_0_fail };
1632 const int* hf_amqp_1_0_declared_items[] = { &hf_amqp_1_0_txnId };
1633 const int* hf_amqp_1_0_transactionalState_items[] = { &hf_amqp_1_0_txnId,
1634                                                       &hf_amqp_1_0_outcome };
1635
1636 /* 0-10 handles */
1637
1638 static int hf_amqp_0_10_format = -1;
1639 static int hf_amqp_0_10_position = -1;
1640 static int hf_amqp_0_10_type = -1;
1641 static int hf_amqp_0_10_size = -1;
1642 static int hf_amqp_0_10_track = -1;
1643 static int hf_amqp_0_10_class = -1;
1644 static int hf_amqp_0_10_connection_method = -1;
1645 static int hf_amqp_0_10_session_method = -1;
1646 static int hf_amqp_0_10_execution_method = -1;
1647 static int hf_amqp_0_10_message_method = -1;
1648 static int hf_amqp_0_10_tx_method = -1;
1649 static int hf_amqp_0_10_dtx_method = -1;
1650 static int hf_amqp_0_10_exchange_method = -1;
1651 static int hf_amqp_0_10_queue_method = -1;
1652 static int hf_amqp_0_10_file_method = -1;
1653 static int hf_amqp_0_10_stream_method = -1;
1654 static int hf_amqp_0_10_argument_packing_flags = -1;
1655 static int hf_amqp_0_10_session_header_sync = -1;
1656 static int hf_amqp_0_10_undissected_struct32 = -1;
1657 static int hf_amqp_0_10_message_body = -1;
1658 static int hf_amqp_0_10_dtx_xid = -1;
1659 static int hf_amqp_0_10_dtx_xid_format = -1;
1660 static int hf_amqp_0_10_dtx_xid_global_id = -1;
1661 static int hf_amqp_0_10_dtx_xid_branch_id = -1;
1662 static int hf_amqp_0_10_struct_delivery_properties_discard_unroutable = -1;
1663 static int hf_amqp_0_10_struct_delivery_properties_immediate = -1;
1664 static int hf_amqp_0_10_struct_delivery_properties_redelivered = -1;
1665 static int hf_amqp_0_10_struct_delivery_properties_priority = -1;
1666 static int hf_amqp_0_10_struct_delivery_properties_mode = -1;
1667 static int hf_amqp_0_10_struct_delivery_properties_ttl = -1;
1668 static int hf_amqp_0_10_struct_delivery_properties_timestamp = -1;
1669 static int hf_amqp_0_10_struct_delivery_properties_expiration = -1;
1670 static int hf_amqp_0_10_struct_delivery_properties_exchange = -1;
1671 static int hf_amqp_0_10_struct_delivery_properties_routing_key = -1;
1672 static int hf_amqp_0_10_struct_delivery_properties_resume_ttl = -1;
1673 static int hf_amqp_0_10_struct_fragment_properties_first = -1;
1674 static int hf_amqp_0_10_struct_fragment_properties_last = -1;
1675 static int hf_amqp_0_10_struct_fragment_properties_size = -1;
1676 /* static int hf_amqp_0_10_struct_message_properties = -1; */
1677 static int hf_amqp_0_10_struct_message_properties_content_len = -1;
1678 static int hf_amqp_0_10_struct_message_properties_message_id = -1;
1679 static int hf_amqp_0_10_struct_message_properties_correlation = -1;
1680 static int hf_amqp_0_10_struct_message_properties_reply_to = -1;
1681 static int hf_amqp_0_10_struct_message_properties_content_type = -1;
1682 static int hf_amqp_0_10_struct_message_properties_content_encoding = -1;
1683 static int hf_amqp_0_10_struct_message_properties_user_id = -1;
1684 static int hf_amqp_0_10_struct_message_properties_app_id = -1;
1685 static int hf_amqp_0_10_struct_message_properties_application_headers = -1;
1686 static int hf_amqp_0_10_struct_reply_to_exchange = -1;
1687 static int hf_amqp_0_10_struct_reply_to_routing_key = -1;
1688 static int hf_amqp_0_10_struct_acquired_transfers = -1;
1689 static int hf_amqp_0_10_struct_resume_result_offset = -1;
1690 static int hf_amqp_0_10_struct_exchange_query_result_durable = -1;
1691 static int hf_amqp_0_10_struct_exchange_query_result_not_found = -1;
1692 static int hf_amqp_0_10_struct_exchange_bound_result_exchange_not_found = -1;
1693 static int hf_amqp_0_10_struct_exchange_bound_result_queue_not_found = -1;
1694 static int hf_amqp_0_10_struct_exchange_bound_result_queue_not_matched = -1;
1695 static int hf_amqp_0_10_struct_exchange_bound_result_key_not_matched = -1;
1696 static int hf_amqp_0_10_struct_exchange_bound_result_args_not_matched = -1;
1697 static int hf_amqp_0_10_struct_queue_query_result_durable = -1;
1698 static int hf_amqp_0_10_struct_queue_query_result_exclusive = -1;
1699 static int hf_amqp_0_10_struct_queue_query_result_auto_delete = -1;
1700 static int hf_amqp_0_10_struct_queue_query_result_message_count = -1;
1701 static int hf_amqp_0_10_struct_queue_query_result_subscriber_count = -1;
1702 static int hf_amqp_0_10_struct_file_properties_content_type = -1;
1703 static int hf_amqp_0_10_struct_file_properties_content_encoding = -1;
1704 static int hf_amqp_0_10_struct_file_properties_headers = -1;
1705 static int hf_amqp_0_10_struct_file_properties_priority = -1;
1706 static int hf_amqp_0_10_struct_file_properties_reply_to = -1;
1707 static int hf_amqp_0_10_struct_file_properties_message_id = -1;
1708 static int hf_amqp_0_10_struct_file_properties_filename = -1;
1709 static int hf_amqp_0_10_struct_file_properties_timestamp = -1;
1710 static int hf_amqp_0_10_struct_file_properties_cluster_id = -1;
1711 static int hf_amqp_0_10_struct_stream_properties_content_type = -1;
1712 static int hf_amqp_0_10_struct_stream_properties_content_encoding = -1;
1713 static int hf_amqp_0_10_struct_stream_properties_headers = -1;
1714 static int hf_amqp_0_10_struct_stream_properties_priority = -1;
1715 static int hf_amqp_0_10_struct_stream_properties_timestamp = -1;
1716 static int hf_amqp_0_10_method_session_attach_name = -1;
1717 static int hf_amqp_0_10_method_session_attach_force = -1;
1718 static int hf_amqp_0_10_method_session_detached_code = -1;
1719 static int hf_amqp_0_10_method_session_timeout = -1;
1720 static int hf_amqp_0_10_method_session_completed_timely = -1;
1721 static int hf_amqp_0_10_method_session_flush_expected = -1;
1722 static int hf_amqp_0_10_method_session_flush_confirmed = -1;
1723 static int hf_amqp_0_10_method_session_flush_completed = -1;
1724 static int hf_amqp_0_10_method_session_command_point_id = -1;
1725 static int hf_amqp_0_10_method_session_command_point_offset = -1;
1726 static int hf_amqp_0_10_method_session_commands = -1;
1727 static int hf_amqp_0_10_method_session_fragments = -1;
1728 static int hf_amqp_0_10_method_execution_command_id = -1;
1729 static int hf_amqp_0_10_method_execution_exception_error = -1;
1730 static int hf_amqp_0_10_method_execution_field_index = -1;
1731 static int hf_amqp_0_10_method_execution_description = -1;
1732 static int hf_amqp_0_10_method_execution_error_info = -1;
1733 static int hf_amqp_0_10_method_message_transfer_destination = -1;
1734 static int hf_amqp_0_10_method_message_transfer_accept_mode = -1;
1735 static int hf_amqp_0_10_method_message_transfer_acquire_mode = -1;
1736 static int hf_amqp_0_10_method_message_accept_transfers = -1;
1737 static int hf_amqp_0_10_method_message_transfer_reject_code = -1;
1738 static int hf_amqp_0_10_method_message_reject_text = -1;
1739 static int hf_amqp_0_10_method_message_release_set_redelivered = -1;
1740 static int hf_amqp_0_10_method_message_dest = -1;
1741 static int hf_amqp_0_10_method_message_resume_id = -1;
1742 static int hf_amqp_0_10_method_message_subscribe_queue = -1;
1743 static int hf_amqp_0_10_method_message_subscribe_exclusive = -1;
1744 static int hf_amqp_0_10_method_message_subscribe_resume_ttl = -1;
1745 static int hf_amqp_0_10_method_message_subscribe_args = -1;
1746 static int hf_amqp_0_10_method_message_flow_mode = -1;
1747 static int hf_amqp_0_10_method_message_credit_unit = -1;
1748 static int hf_amqp_0_10_method_message_credit_value = -1;
1749 static int hf_amqp_0_10_method_dtx_start_join = -1;
1750 static int hf_amqp_0_10_method_dtx_start_resume = -1;
1751 static int hf_amqp_0_10_method_dtx_end_fail = -1;
1752 static int hf_amqp_0_10_method_dtx_end_suspend = -1;
1753 static int hf_amqp_0_10_method_dtx_commit_one_phase = -1;
1754 static int hf_amqp_0_10_method_dtx_set_timeout_timeout = -1;
1755 static int hf_amqp_0_10_method_exchange_declare_exchange = -1;
1756 static int hf_amqp_0_10_method_exchange_declare_type = -1;
1757 static int hf_amqp_0_10_method_exchange_declare_alt_exchange = -1;
1758 static int hf_amqp_0_10_method_exchange_declare_passive = -1;
1759 static int hf_amqp_0_10_method_exchange_declare_durable = -1;
1760 static int hf_amqp_0_10_method_exchange_declare_auto_delete = -1;
1761 static int hf_amqp_0_10_method_exchange_declare_arguments = -1;
1762 static int hf_amqp_0_10_method_exchange_delete_if_unused = -1;
1763 static int hf_amqp_0_10_method_exchange_bind_queue = -1;
1764 static int hf_amqp_0_10_method_exchange_binding_key = -1;
1765 static int hf_amqp_0_10_method_queue_name = -1;
1766 static int hf_amqp_0_10_method_queue_alt_exchange = -1;
1767 static int hf_amqp_0_10_method_queue_declare_passive = -1;
1768 static int hf_amqp_0_10_method_queue_declare_durable = -1;
1769 static int hf_amqp_0_10_method_queue_declare_exclusive = -1;
1770 static int hf_amqp_0_10_method_queue_declare_auto_delete = -1;
1771 static int hf_amqp_0_10_method_queue_declare_arguments = -1;
1772 static int hf_amqp_0_10_method_queue_delete_if_unused = -1;
1773 static int hf_amqp_0_10_method_queue_delete_if_empty = -1;
1774 static int hf_amqp_0_10_method_file_qos_prefetch_size = -1;
1775 static int hf_amqp_0_10_method_file_qos_prefetch_count = -1;
1776 static int hf_amqp_0_10_method_file_qos_global = -1;
1777 static int hf_amqp_0_10_method_file_consumer_tag = -1;
1778 static int hf_amqp_0_10_method_file_consume_no_local = -1;
1779 static int hf_amqp_0_10_method_file_consume_no_ack = -1;
1780 static int hf_amqp_0_10_method_file_consume_exclusive = -1;
1781 static int hf_amqp_0_10_method_file_consume_nowait = -1;
1782 static int hf_amqp_0_10_method_file_consume_arguments = -1;
1783 static int hf_amqp_0_10_method_file_identifier = -1;
1784 static int hf_amqp_0_10_method_file_open_content_size = -1;
1785 static int hf_amqp_0_10_method_file_open_ok_staged_size = -1;
1786 static int hf_amqp_0_10_method_file_publish_exchange = -1;
1787 static int hf_amqp_0_10_method_file_publish_routing_key = -1;
1788 static int hf_amqp_0_10_method_file_publish_mandatory = -1;
1789 static int hf_amqp_0_10_method_file_publish_immediate = -1;
1790 static int hf_amqp_0_10_method_file_return_reply_code = -1;
1791 static int hf_amqp_0_10_method_file_return_reply_text = -1;
1792 static int hf_amqp_0_10_method_file_return_exchange = -1;
1793 static int hf_amqp_0_10_method_file_return_routing_key = -1;
1794 static int hf_amqp_0_10_method_file_deliver_consumer_tag = -1;
1795 static int hf_amqp_0_10_method_file_deliver_delivery_tag = -1;
1796 static int hf_amqp_0_10_method_file_deliver_redelivered = -1;
1797 static int hf_amqp_0_10_method_file_deliver_exchange = -1;
1798 static int hf_amqp_0_10_method_file_deliver_routing_key = -1;
1799 static int hf_amqp_0_10_method_file_ack_delivery_tag = -1;
1800 static int hf_amqp_0_10_method_file_ack_multiple = -1;
1801 static int hf_amqp_0_10_method_file_reject_delivery_tag = -1;
1802 static int hf_amqp_0_10_method_file_reject_requeue = -1;
1803 static int hf_amqp_0_10_method_stream_qos_prefetch_size = -1;
1804 static int hf_amqp_0_10_method_stream_qos_prefetch_count = -1;
1805 /* static int hf_amqp_0_10_method_stream_qos_consume_rate = -1; */
1806 static int hf_amqp_0_10_method_stream_qos_global = -1;
1807 static int hf_amqp_0_10_method_stream_consumer_tag = -1;
1808 static int hf_amqp_0_10_method_stream_consume_no_local = -1;
1809 static int hf_amqp_0_10_method_stream_consume_exclusive = -1;
1810 static int hf_amqp_0_10_method_stream_consume_nowait = -1;
1811 static int hf_amqp_0_10_method_stream_consume_arguments = -1;
1812 static int hf_amqp_0_10_method_stream_publish_exchange = -1;
1813 static int hf_amqp_0_10_method_stream_publish_routing_key = -1;
1814 static int hf_amqp_0_10_method_stream_publish_mandatory = -1;
1815 static int hf_amqp_0_10_method_stream_publish_immediate = -1;
1816 static int hf_amqp_0_10_method_stream_return_reply_code = -1;
1817 static int hf_amqp_0_10_method_stream_return_reply_text = -1;
1818 static int hf_amqp_0_10_method_stream_return_exchange = -1;
1819 static int hf_amqp_0_10_method_stream_return_routing_key = -1;
1820 static int hf_amqp_0_10_method_stream_deliver_consumer_tag = -1;
1821 static int hf_amqp_0_10_method_stream_deliver_delivery_tag = -1;
1822 static int hf_amqp_0_10_method_stream_deliver_exchange = -1;
1823 static int hf_amqp_0_10_method_stream_deliver_queue = -1;
1824 static int hf_amqp_channel = -1;
1825 static int hf_amqp_0_9_type = -1;
1826 static int hf_amqp_0_9_length = -1;
1827 static int hf_amqp_0_9_method_class_id = -1;
1828 static int hf_amqp_method_connection_method_id = -1;
1829 static int hf_amqp_method_channel_method_id = -1;
1830 static int hf_amqp_method_access_method_id = -1;
1831 static int hf_amqp_method_exchange_method_id = -1;
1832 static int hf_amqp_method_queue_method_id = -1;
1833 static int hf_amqp_method_basic_method_id = -1;
1834 static int hf_amqp_method_file_method_id = -1;
1835 static int hf_amqp_method_stream_method_id = -1;
1836 static int hf_amqp_method_tx_method_id = -1;
1837 static int hf_amqp_method_dtx_method_id = -1;
1838 static int hf_amqp_method_tunnel_method_id = -1;
1839 static int hf_amqp_method_arguments = -1;
1840 static int hf_amqp_method_connection_start_version_major = -1;
1841 static int hf_amqp_method_connection_start_version_minor = -1;
1842 static int hf_amqp_method_connection_start_server_properties = -1;
1843 static int hf_amqp_0_9_method_connection_start_mechanisms = -1;
1844 static int hf_amqp_0_10_method_connection_start_mechanisms = -1;
1845 static int hf_amqp_0_9_method_connection_start_locales = -1;
1846 static int hf_amqp_0_10_method_connection_start_locales = -1;
1847 static int hf_amqp_method_connection_start_ok_client_properties = -1;
1848 static int hf_amqp_method_connection_start_ok_mechanism = -1;
1849 static int hf_amqp_method_connection_start_ok_response = -1;
1850 static int hf_amqp_method_connection_start_ok_locale = -1;
1851 static int hf_amqp_method_connection_secure_challenge = -1;
1852 static int hf_amqp_method_connection_secure_ok_response = -1;
1853 static int hf_amqp_method_connection_tune_channel_max = -1;
1854 static int hf_amqp_0_9_method_connection_tune_frame_max = -1;
1855 static int hf_amqp_0_10_method_connection_tune_frame_max = -1;
1856 static int hf_amqp_0_9_method_connection_tune_heartbeat = -1;
1857 static int hf_amqp_0_10_method_connection_tune_heartbeat_min = -1;
1858 static int hf_amqp_0_10_method_connection_tune_heartbeat_max = -1;
1859 static int hf_amqp_method_connection_tune_ok_channel_max = -1;
1860 static int hf_amqp_0_9_method_connection_tune_ok_frame_max = -1;
1861 static int hf_amqp_0_10_method_connection_tune_ok_frame_max = -1;
1862 static int hf_amqp_method_connection_tune_ok_heartbeat = -1;
1863 static int hf_amqp_method_connection_open_virtual_host = -1;
1864 static int hf_amqp_0_9_method_connection_open_capabilities = -1;
1865 static int hf_amqp_0_10_method_connection_open_capabilities = -1;
1866 static int hf_amqp_0_9_method_connection_open_insist = -1;
1867 static int hf_amqp_0_10_method_connection_open_insist = -1;
1868 static int hf_amqp_0_9_method_connection_open_ok_known_hosts = -1;
1869 static int hf_amqp_0_10_method_connection_open_ok_known_hosts = -1;
1870 static int hf_amqp_method_connection_redirect_host = -1;
1871 static int hf_amqp_0_9_method_connection_redirect_known_hosts = -1;
1872 static int hf_amqp_0_10_method_connection_redirect_known_hosts = -1;
1873 static int hf_amqp_0_9_method_connection_close_reply_code = -1;
1874 static int hf_amqp_0_10_method_connection_close_reply_code = -1;
1875 static int hf_amqp_method_connection_close_reply_text = -1;
1876 static int hf_amqp_method_connection_close_class_id = -1;
1877 static int hf_amqp_method_connection_close_method_id = -1;
1878 static int hf_amqp_method_channel_open_out_of_band = -1;
1879 static int hf_amqp_method_channel_open_ok_channel_id = -1;
1880 static int hf_amqp_method_channel_flow_active = -1;
1881 static int hf_amqp_method_channel_flow_ok_active = -1;
1882 static int hf_amqp_method_channel_close_reply_code = -1;
1883 static int hf_amqp_method_channel_close_reply_text = -1;
1884 static int hf_amqp_method_channel_close_class_id = -1;
1885 static int hf_amqp_method_channel_close_method_id = -1;
1886 static int hf_amqp_method_channel_resume_channel_id = -1;
1887 static int hf_amqp_method_access_request_realm = -1;
1888 static int hf_amqp_method_access_request_exclusive = -1;
1889 static int hf_amqp_method_access_request_passive = -1;
1890 static int hf_amqp_method_access_request_active = -1;
1891 static int hf_amqp_method_access_request_write = -1;
1892 static int hf_amqp_method_access_request_read = -1;
1893 static int hf_amqp_method_access_request_ok_ticket = -1;
1894 static int hf_amqp_method_exchange_declare_ticket = -1;
1895 static int hf_amqp_method_exchange_declare_exchange = -1;
1896 static int hf_amqp_method_exchange_declare_type = -1;
1897 static int hf_amqp_method_exchange_declare_passive = -1;
1898 static int hf_amqp_method_exchange_declare_durable = -1;
1899 static int hf_amqp_method_exchange_declare_auto_delete = -1;
1900 static int hf_amqp_method_exchange_declare_internal = -1;
1901 static int hf_amqp_method_exchange_declare_nowait = -1;
1902 static int hf_amqp_method_exchange_declare_arguments = -1;
1903 static int hf_amqp_method_exchange_bind_destination = -1;
1904 static int hf_amqp_method_exchange_bind_source = -1;
1905 static int hf_amqp_method_exchange_bind_routing_key = -1;
1906 static int hf_amqp_method_exchange_bind_nowait = -1;
1907 static int hf_amqp_method_exchange_bind_arguments = -1;
1908 static int hf_amqp_method_exchange_delete_ticket = -1;
1909 static int hf_amqp_method_exchange_delete_exchange = -1;
1910 static int hf_amqp_method_exchange_delete_if_unused = -1;
1911 static int hf_amqp_method_exchange_delete_nowait = -1;
1912 static int hf_amqp_method_queue_declare_ticket = -1;
1913 static int hf_amqp_method_queue_declare_queue = -1;
1914 static int hf_amqp_method_queue_declare_passive = -1;
1915 static int hf_amqp_method_queue_declare_durable = -1;
1916 static int hf_amqp_method_queue_declare_exclusive = -1;
1917 static int hf_amqp_method_queue_declare_auto_delete = -1;
1918 static int hf_amqp_method_queue_declare_nowait = -1;
1919 static int hf_amqp_method_queue_declare_arguments = -1;
1920 static int hf_amqp_method_queue_declare_ok_queue = -1;
1921 static int hf_amqp_method_queue_declare_ok_message_count = -1;
1922 static int hf_amqp_method_queue_declare_ok_consumer_count = -1;
1923 static int hf_amqp_method_queue_bind_ticket = -1;
1924 static int hf_amqp_method_queue_bind_queue = -1;
1925 static int hf_amqp_method_queue_bind_exchange = -1;
1926 static int hf_amqp_method_queue_bind_routing_key = -1;
1927 static int hf_amqp_method_queue_bind_nowait = -1;
1928 static int hf_amqp_method_queue_bind_arguments = -1;
1929 static int hf_amqp_method_queue_unbind_ticket = -1;
1930 static int hf_amqp_method_queue_unbind_queue = -1;
1931 static int hf_amqp_method_queue_unbind_exchange = -1;
1932 static int hf_amqp_method_queue_unbind_routing_key = -1;
1933 static int hf_amqp_method_queue_unbind_arguments = -1;
1934 static int hf_amqp_method_queue_purge_ticket = -1;
1935 static int hf_amqp_method_queue_purge_queue = -1;
1936 static int hf_amqp_method_queue_purge_nowait = -1;
1937 static int hf_amqp_method_queue_purge_ok_message_count = -1;
1938 static int hf_amqp_method_queue_delete_ticket = -1;
1939 static int hf_amqp_method_queue_delete_queue = -1;
1940 static int hf_amqp_method_queue_delete_if_unused = -1;
1941 static int hf_amqp_method_queue_delete_if_empty = -1;
1942 static int hf_amqp_method_queue_delete_nowait = -1;
1943 static int hf_amqp_method_queue_delete_ok_message_count = -1;
1944 static int hf_amqp_method_basic_qos_prefetch_size = -1;
1945 static int hf_amqp_method_basic_qos_prefetch_count = -1;
1946 static int hf_amqp_method_basic_qos_global = -1;
1947 static int hf_amqp_method_basic_consume_ticket = -1;
1948 static int hf_amqp_method_basic_consume_queue = -1;
1949 static int hf_amqp_method_basic_consume_consumer_tag = -1;
1950 static int hf_amqp_method_basic_consume_no_local = -1;
1951 static int hf_amqp_method_basic_consume_no_ack = -1;
1952 static int hf_amqp_method_basic_consume_exclusive = -1;
1953 static int hf_amqp_method_basic_consume_nowait = -1;
1954 static int hf_amqp_method_basic_consume_filter = -1;
1955 static int hf_amqp_method_basic_consume_ok_consumer_tag = -1;
1956 static int hf_amqp_method_basic_cancel_consumer_tag = -1;
1957 static int hf_amqp_method_basic_cancel_nowait = -1;
1958 static int hf_amqp_method_basic_cancel_ok_consumer_tag = -1;
1959 static int hf_amqp_method_basic_publish_ticket = -1;
1960 static int hf_amqp_method_basic_publish_exchange = -1;
1961 static int hf_amqp_method_basic_publish_routing_key = -1;
1962 static int hf_amqp_method_basic_publish_mandatory = -1;
1963 static int hf_amqp_method_basic_publish_immediate = -1;
1964 static int hf_amqp_method_basic_return_reply_code = -1;
1965 static int hf_amqp_method_basic_return_reply_text = -1;
1966 static int hf_amqp_method_basic_return_exchange = -1;
1967 static int hf_amqp_method_basic_return_routing_key = -1;
1968 static int hf_amqp_method_basic_deliver_consumer_tag = -1;
1969 static int hf_amqp_method_basic_deliver_delivery_tag = -1;
1970 static int hf_amqp_method_basic_deliver_redelivered = -1;
1971 static int hf_amqp_method_basic_deliver_exchange = -1;
1972 static int hf_amqp_method_basic_deliver_routing_key = -1;
1973 static int hf_amqp_method_basic_get_ticket = -1;
1974 static int hf_amqp_method_basic_get_queue = -1;
1975 static int hf_amqp_method_basic_get_no_ack = -1;
1976 static int hf_amqp_method_basic_get_ok_delivery_tag = -1;
1977 static int hf_amqp_method_basic_get_ok_redelivered = -1;
1978 static int hf_amqp_method_basic_get_ok_exchange = -1;
1979 static int hf_amqp_method_basic_get_ok_routing_key = -1;
1980 static int hf_amqp_method_basic_get_ok_message_count = -1;
1981 static int hf_amqp_method_basic_get_empty_cluster_id = -1;
1982 static int hf_amqp_method_basic_ack_delivery_tag = -1;
1983 static int hf_amqp_method_basic_ack_multiple = -1;
1984 static int hf_amqp_method_basic_reject_delivery_tag = -1;
1985 static int hf_amqp_method_basic_reject_requeue = -1;
1986 static int hf_amqp_method_basic_recover_requeue = -1;
1987 static int hf_amqp_method_file_qos_prefetch_size = -1;
1988 static int hf_amqp_method_file_qos_prefetch_count = -1;
1989 static int hf_amqp_method_file_qos_global = -1;
1990 static int hf_amqp_method_file_consume_ticket = -1;
1991 static int hf_amqp_method_file_consume_queue = -1;
1992 static int hf_amqp_method_file_consume_consumer_tag = -1;
1993 static int hf_amqp_method_file_consume_no_local = -1;
1994 static int hf_amqp_method_file_consume_no_ack = -1;
1995 static int hf_amqp_method_file_consume_exclusive = -1;
1996 static int hf_amqp_method_file_consume_nowait = -1;
1997 static int hf_amqp_method_file_consume_filter = -1;
1998 static int hf_amqp_method_file_consume_ok_consumer_tag = -1;
1999 static int hf_amqp_method_file_cancel_consumer_tag = -1;
2000 static int hf_amqp_method_file_cancel_nowait = -1;
2001 static int hf_amqp_method_file_cancel_ok_consumer_tag = -1;
2002 static int hf_amqp_method_file_open_identifier = -1;
2003 static int hf_amqp_method_file_open_content_size = -1;
2004 static int hf_amqp_method_file_open_ok_staged_size = -1;
2005 static int hf_amqp_method_file_publish_ticket = -1;
2006 static int hf_amqp_method_file_publish_exchange = -1;
2007 static int hf_amqp_method_file_publish_routing_key = -1;
2008 static int hf_amqp_method_file_publish_mandatory = -1;
2009 static int hf_amqp_method_file_publish_immediate = -1;
2010 static int hf_amqp_method_file_publish_identifier = -1;
2011 static int hf_amqp_method_file_return_reply_code = -1;
2012 static int hf_amqp_method_file_return_reply_text = -1;
2013 static int hf_amqp_method_file_return_exchange = -1;
2014 static int hf_amqp_method_file_return_routing_key = -1;
2015 static int hf_amqp_method_file_deliver_consumer_tag = -1;
2016 static int hf_amqp_method_file_deliver_delivery_tag = -1;
2017 static int hf_amqp_method_file_deliver_redelivered = -1;
2018 static int hf_amqp_method_file_deliver_exchange = -1;
2019 static int hf_amqp_method_file_deliver_routing_key = -1;
2020 static int hf_amqp_method_file_deliver_identifier = -1;
2021 static int hf_amqp_method_file_ack_delivery_tag = -1;
2022 static int hf_amqp_method_file_ack_multiple = -1;
2023 static int hf_amqp_method_file_reject_delivery_tag = -1;
2024 static int hf_amqp_method_file_reject_requeue = -1;
2025 static int hf_amqp_method_stream_qos_prefetch_size = -1;
2026 static int hf_amqp_method_stream_qos_prefetch_count = -1;
2027 static int hf_amqp_method_stream_qos_consume_rate = -1;
2028 static int hf_amqp_method_stream_qos_global = -1;
2029 static int hf_amqp_method_stream_consume_ticket = -1;
2030 static int hf_amqp_method_stream_consume_queue = -1;
2031 static int hf_amqp_method_stream_consume_consumer_tag = -1;
2032 static int hf_amqp_method_stream_consume_no_local = -1;
2033 static int hf_amqp_method_stream_consume_exclusive = -1;
2034 static int hf_amqp_method_stream_consume_nowait = -1;
2035 static int hf_amqp_method_stream_consume_filter = -1;
2036 static int hf_amqp_method_stream_consume_ok_consumer_tag = -1;
2037 static int hf_amqp_method_stream_cancel_consumer_tag = -1;
2038 static int hf_amqp_method_stream_cancel_nowait = -1;
2039 static int hf_amqp_method_stream_cancel_ok_consumer_tag = -1;
2040 static int hf_amqp_method_stream_publish_ticket = -1;
2041 static int hf_amqp_method_stream_publish_exchange = -1;
2042 static int hf_amqp_method_stream_publish_routing_key = -1;
2043 static int hf_amqp_method_stream_publish_mandatory = -1;
2044 static int hf_amqp_method_stream_publish_immediate = -1;
2045 static int hf_amqp_method_stream_return_reply_code = -1;
2046 static int hf_amqp_method_stream_return_reply_text = -1;
2047 static int hf_amqp_method_stream_return_exchange = -1;
2048 static int hf_amqp_method_stream_return_routing_key = -1;
2049 static int hf_amqp_method_stream_deliver_consumer_tag = -1;
2050 static int hf_amqp_method_stream_deliver_delivery_tag = -1;
2051 static int hf_amqp_method_stream_deliver_exchange = -1;
2052 static int hf_amqp_method_stream_deliver_queue = -1;
2053 static int hf_amqp_method_dtx_start_dtx_identifier = -1;
2054 static int hf_amqp_method_tunnel_request_meta_data = -1;
2055 static int hf_amqp_field = -1;
2056 static int hf_amqp_header_class_id = -1;
2057 static int hf_amqp_header_weight = -1;
2058 static int hf_amqp_header_body_size = -1;
2059 static int hf_amqp_header_property_flags = -1;
2060 static int hf_amqp_header_properties = -1;
2061 static int hf_amqp_header_basic_content_type = -1;
2062 static int hf_amqp_header_basic_content_encoding = -1;
2063 static int hf_amqp_header_basic_headers = -1;
2064 static int hf_amqp_header_basic_delivery_mode = -1;
2065 static int hf_amqp_header_basic_priority = -1;
2066 static int hf_amqp_header_basic_correlation_id = -1;
2067 static int hf_amqp_header_basic_reply_to = -1;
2068 static int hf_amqp_header_basic_expiration = -1;
2069 static int hf_amqp_header_basic_message_id = -1;
2070 static int hf_amqp_header_basic_timestamp = -1;
2071 static int hf_amqp_header_basic_type = -1;
2072 static int hf_amqp_header_basic_user_id = -1;
2073 static int hf_amqp_header_basic_app_id = -1;
2074 static int hf_amqp_header_basic_cluster_id = -1;
2075 static int hf_amqp_header_file_content_type = -1;
2076 static int hf_amqp_header_file_content_encoding = -1;
2077 static int hf_amqp_header_file_headers = -1;
2078 static int hf_amqp_header_file_priority = -1;
2079 static int hf_amqp_header_file_reply_to = -1;
2080 static int hf_amqp_header_file_message_id = -1;
2081 static int hf_amqp_header_file_filename = -1;
2082 static int hf_amqp_header_file_timestamp = -1;
2083 static int hf_amqp_header_file_cluster_id = -1;
2084 static int hf_amqp_header_stream_content_type = -1;
2085 static int hf_amqp_header_stream_content_encoding = -1;
2086 static int hf_amqp_header_stream_headers = -1;
2087 static int hf_amqp_header_stream_priority = -1;
2088 static int hf_amqp_header_stream_timestamp = -1;
2089 static int hf_amqp_header_tunnel_headers = -1;
2090 static int hf_amqp_header_tunnel_proxy_name = -1;
2091 static int hf_amqp_header_tunnel_data_name = -1;
2092 static int hf_amqp_header_tunnel_durable = -1;
2093 static int hf_amqp_header_tunnel_broadcast = -1;
2094 static int hf_amqp_payload = -1;
2095 static int hf_amqp_init_protocol = -1;
2096 static int hf_amqp_init_id = -1;
2097 static int hf_amqp_init_id_major = -1;
2098 static int hf_amqp_init_id_minor = -1;
2099 static int hf_amqp_init_version_major = -1;
2100 static int hf_amqp_init_version_minor = -1;
2101 static int hf_amqp_init_version_revision = -1;
2102
2103 static gint ett_amqp = -1;
2104 static gint ett_header = -1;
2105 static gint ett_args = -1;
2106 static gint ett_props = -1;
2107 static gint ett_field_table = -1;
2108 static gint ett_amqp_init = -1;
2109 static gint ett_amqp_0_10_map = -1;
2110 static gint ett_amqp_0_10_array = -1;
2111 static gint ett_amqp_1_0_list = -1;
2112 static gint ett_amqp_1_0_array = -1;
2113 static gint ett_amqp_1_0_map = -1;
2114
2115 static expert_field ei_amqp_bad_flag_value = EI_INIT;
2116 static expert_field ei_amqp_unknown_stream_method = EI_INIT;
2117 static expert_field ei_amqp_unknown_basic_method = EI_INIT;
2118 static expert_field ei_amqp_unknown_frame_type = EI_INIT;
2119 static expert_field ei_amqp_field_short = EI_INIT;
2120 static expert_field ei_amqp_bad_length = EI_INIT;
2121 static expert_field ei_amqp_unknown_command_class = EI_INIT;
2122 static expert_field ei_amqp_unknown_tunnel_method = EI_INIT;
2123 static expert_field ei_amqp_invalid_class_code = EI_INIT;
2124 static expert_field ei_amqp_unknown_access_method = EI_INIT;
2125 static expert_field ei_amqp_unknown_tx_method = EI_INIT;
2126 static expert_field ei_amqp_unknown_header_class = EI_INIT;
2127 static expert_field ei_amqp_unknown_connection_method = EI_INIT;
2128 static expert_field ei_amqp_unknown_queue_method = EI_INIT;
2129 static expert_field ei_amqp_unknown_channel_method = EI_INIT;
2130 static expert_field ei_amqp_unknown_dtx_method = EI_INIT;
2131 static expert_field ei_amqp_unknown_method_class = EI_INIT;
2132 static expert_field ei_amqp_unknown_file_method = EI_INIT;
2133 static expert_field ei_amqp_unknown_exchange_method = EI_INIT;
2134 static expert_field ei_amqp_unknown_sasl_command = EI_INIT;
2135 static expert_field ei_amqp_unknown_amqp_command = EI_INIT;
2136 static expert_field ei_amqp_unknown_amqp_type = EI_INIT;
2137 static expert_field ei_amqp_invalid_number_of_params = EI_INIT;
2138
2139 /*  Various enumerations  */
2140
2141 static const value_string amqp_1_0_SASL_code_value [] = {
2142     {0, "ok"},
2143     {1, "auth"},
2144     {2, "sys"},
2145     {3, "sys-perm"},
2146     {4, "sys-temp"},
2147     {0, NULL}
2148 };
2149
2150 static const value_string amqp_1_0_role_value [] = {
2151     {0x40, "null"},
2152     {0x41, "receiver"},
2153     {0x42, "sender"},
2154     {0, NULL}
2155 };
2156
2157 static const value_string amqp_1_0_sndSettleMode_value[] = {
2158     {0, "unsettled"},
2159     {1, "settled"},
2160     {2, "mixed"},
2161     {0, NULL}
2162 };
2163
2164 static const value_string amqp_1_0_rcvSettleMode_value[] = {
2165     {0, "first"},
2166     {1, "second"},
2167     {0, NULL}
2168 };
2169
2170 static const value_string amqp_1_0_durable_value[] = {
2171     {0, "none"},
2172     {1, "configuration"},
2173     {2, "unsettled-state"},
2174     {0, NULL}
2175 };
2176
2177 static const value_string amqp_1_0_AMQP_performatives [] = {
2178     {AMQP_1_0_AMQP_OPEN,        "open"},
2179     {AMQP_1_0_AMQP_BEGIN,       "begin"},
2180     {AMQP_1_0_AMQP_ATTACH,      "attach"},
2181     {AMQP_1_0_AMQP_FLOW,        "flow"},
2182     {AMQP_1_0_AMQP_TRANSFER,    "transfer"},
2183     {AMQP_1_0_AMQP_DISPOSITION, "disposition"},
2184     {AMQP_1_0_AMQP_DETACH,      "detach"},
2185     {AMQP_1_0_AMQP_END,         "end"},
2186     {AMQP_1_0_AMQP_CLOSE,       "close"},
2187     {0, NULL}
2188 };
2189
2190 static const value_string amqp_1_0_SASL_methods [] = {
2191     {AMQP_1_0_SASL_MECHANISMS, "sasl.mechanisms"},
2192     {AMQP_1_0_SASL_INIT,       "sasl.init"},
2193     {AMQP_1_0_SASL_CHALLENGE,  "sasl.challenge"},
2194     {AMQP_1_0_SASL_RESPONSE,   "sasl.response"},
2195     {AMQP_1_0_SASL_OUTCOME,    "sasl.outcome"},
2196     {0, NULL}
2197 };
2198
2199 static const value_string amqp_1_0_type [] = {
2200     {AMQP_1_0_AMQP_FRAME, "AMQP"},
2201     {AMQP_1_0_SASL_FRAME, "SASL"},
2202     {AMQP_1_0_TLS_FRAME,  "TLS"},
2203     {0, NULL}
2204 };
2205
2206 static const value_string amqp_1_0_encoding_width0 [] = {
2207     {0x40, "null"},
2208     {0x41, "true"},
2209     {0x42, "false"},
2210     {0x43, "0"},
2211     {0x44, "0"},
2212     {0x45, "empty list"},
2213     {0, NULL}
2214 };
2215
2216 static const value_string amqp_0_10_frame_position [] = {
2217     {0x00,  "----"},
2218     {0x01,  "---e"},
2219     {0x02,  "--b-"},
2220     {0x03,  "--be"},
2221     {0x04,  "-E--"},
2222     {0x05,  "-E-e"},
2223     {0x06,  "-Eb-"},
2224     {0x07,  "-Ebe"},
2225     {0x08,  "B---"},
2226     {0x09,  "B--e"},
2227     {0x0a,  "B-b-"},
2228     {0x0b,  "B-be"},
2229     {0x0c,  "BE--"},
2230     {0x0d,  "BE-e"},
2231     {0x0e,  "BEb-"},
2232     {0x0f,  "BEbe"},
2233     {0, NULL}
2234 };
2235
2236 static const value_string amqp_0_10_frame_types [] = {
2237     {0,     "Control"},
2238     {1,     "Command"},
2239     {2,     "Header"},
2240     {3,     "Body"},
2241     {0, NULL}
2242 };
2243
2244 static const value_string amqp_0_10_frame_tracks [] = {
2245     {0,     "Control"},
2246     {1,     "Command"},
2247     {0, NULL}
2248 };
2249
2250 static const value_string amqp_0_10_class [] = {
2251     {AMQP_0_10_CLASS_CONNECTION,  "Connection"},
2252     {AMQP_0_10_CLASS_SESSION,     "Session"},
2253     {AMQP_0_10_CLASS_EXECUTION,   "Execution"},
2254     {AMQP_0_10_CLASS_MESSAGE,     "Message"},
2255     {AMQP_0_10_CLASS_TX,          "Tx"},
2256     {AMQP_0_10_CLASS_DTX,         "Dtx"},
2257     {AMQP_0_10_CLASS_EXCHANGE,    "Exchange"},
2258     {AMQP_0_10_CLASS_QUEUE,       "Queue"},
2259     {AMQP_0_10_CLASS_FILE,        "File"},
2260     {AMQP_0_10_CLASS_STREAM,      "Stream"},
2261     {0, NULL}
2262 };
2263
2264 static const value_string amqp_0_10_connection_methods [] = {
2265     {AMQP_0_10_METHOD_CONNECTION_START,     "connection.start"},
2266     {AMQP_0_10_METHOD_CONNECTION_START_OK,  "connection.start-ok"},
2267     {AMQP_0_10_METHOD_CONNECTION_SECURE,    "connection.secure"},
2268     {AMQP_0_10_METHOD_CONNECTION_SECURE_OK, "connection.secure-ok"},
2269     {AMQP_0_10_METHOD_CONNECTION_TUNE,      "connection.tune"},
2270     {AMQP_0_10_METHOD_CONNECTION_TUNE_OK,   "connection.tune-ok"},
2271     {AMQP_0_10_METHOD_CONNECTION_OPEN,      "connection.open"},
2272     {AMQP_0_10_METHOD_CONNECTION_OPEN_OK,   "connection.open-ok"},
2273     {AMQP_0_10_METHOD_CONNECTION_REDIRECT,  "connection.redirect"},
2274     {AMQP_0_10_METHOD_CONNECTION_HEARTBEAT, "connection.heartbeat"},
2275     {AMQP_0_10_METHOD_CONNECTION_CLOSE,     "connection.close"},
2276     {AMQP_0_10_METHOD_CONNECTION_CLOSE_OK,  "connection.close-ok"},
2277     {0, NULL}
2278 };
2279
2280 static const value_string amqp_0_10_session_methods [] = {
2281     {AMQP_0_10_METHOD_SESSION_ATTACH,           "session.attach"},
2282     {AMQP_0_10_METHOD_SESSION_ATTACHED,         "session.attached"},
2283     {AMQP_0_10_METHOD_SESSION_DETACH,           "session.detach"},
2284     {AMQP_0_10_METHOD_SESSION_DETACHED,         "session.detached"},
2285     {AMQP_0_10_METHOD_SESSION_REQUEST_TIMEOUT,  "session.request-timeout"},
2286     {AMQP_0_10_METHOD_SESSION_TIMEOUT,          "session.timeout"},
2287     {AMQP_0_10_METHOD_SESSION_COMMAND_POINT,    "session.command-point"},
2288     {AMQP_0_10_METHOD_SESSION_EXPECTED,         "session.expected"},
2289     {AMQP_0_10_METHOD_SESSION_CONFIRMED,        "session.confirmed"},
2290     {AMQP_0_10_METHOD_SESSION_COMPLETED,        "session.completed"},
2291     {AMQP_0_10_METHOD_SESSION_KNOWN_COMPLETED,  "session.known-completed"},
2292     {AMQP_0_10_METHOD_SESSION_FLUSH,            "session.flush"},
2293     {AMQP_0_10_METHOD_SESSION_GAP,              "session.gap"},
2294     {0, NULL}
2295 };
2296
2297 static const value_string amqp_0_10_execution_methods [] = {
2298     {AMQP_0_10_METHOD_EXECUTION_SYNC,       "execution.sync"},
2299     {AMQP_0_10_METHOD_EXECUTION_RESULT,     "execution.result"},
2300     {AMQP_0_10_METHOD_EXECUTION_EXCEPTION,  "execution.exception"},
2301     {0, NULL}
2302 };
2303
2304 static const value_string amqp_0_10_message_methods [] = {
2305     {AMQP_0_10_METHOD_MESSAGE_TRANSFER,      "message.transfer"},
2306     {AMQP_0_10_METHOD_MESSAGE_ACCEPT,        "message.accept"},
2307     {AMQP_0_10_METHOD_MESSAGE_REJECT,        "message.reject"},
2308     {AMQP_0_10_METHOD_MESSAGE_RELEASE,       "message.release"},
2309     {AMQP_0_10_METHOD_MESSAGE_ACQUIRE,       "message.acquire"},
2310     {AMQP_0_10_METHOD_MESSAGE_RESUME,        "message.resume"},
2311     {AMQP_0_10_METHOD_MESSAGE_SUBSCRIBE,     "message.subscribe"},
2312     {AMQP_0_10_METHOD_MESSAGE_CANCEL,        "message.cancel"},
2313     {AMQP_0_10_METHOD_MESSAGE_SET_FLOW_MODE, "message.set-flow-mode"},
2314     {AMQP_0_10_METHOD_MESSAGE_FLOW,          "message.flow"},
2315     {AMQP_0_10_METHOD_MESSAGE_FLUSH,         "message.flush"},
2316     {AMQP_0_10_METHOD_MESSAGE_STOP,          "message.stop"},
2317     {0, NULL}
2318 };
2319
2320 static const value_string amqp_0_10_tx_methods [] = {
2321     {AMQP_0_10_METHOD_TX_SELECT,    "tx.select"},
2322     {AMQP_0_10_METHOD_TX_COMMIT,    "tx.commit"},
2323     {AMQP_0_10_METHOD_TX_ROLLBACK,  "tx.rollback"},
2324     {0, NULL}
2325 };
2326
2327 static const value_string amqp_0_10_dtx_methods [] = {
2328     {AMQP_0_10_METHOD_DTX_SELECT,       "dtx.select"},
2329     {AMQP_0_10_METHOD_DTX_START,        "dtx.start"},
2330     {AMQP_0_10_METHOD_DTX_END,          "dtx.end"},
2331     {AMQP_0_10_METHOD_DTX_COMMIT,       "dtx.commit"},
2332     {AMQP_0_10_METHOD_DTX_FORGET,       "dtx.forget"},
2333     {AMQP_0_10_METHOD_DTX_GET_TIMEOUT,  "dtx.get-timeout"},
2334     {AMQP_0_10_METHOD_DTX_PREPARE,      "dtx.prepare"},
2335     {AMQP_0_10_METHOD_DTX_RECOVER,      "dtx.recover"},
2336     {AMQP_0_10_METHOD_DTX_ROLLBACK,     "dtx.rollback"},
2337     {AMQP_0_10_METHOD_DTX_SET_TIMEOUT,  "dtx.set-timeout"},
2338     {0, NULL}
2339 };
2340
2341 static const value_string amqp_0_10_exchange_methods [] = {
2342     {AMQP_0_10_METHOD_EXCHANGE_DECLARE,  "exchange.declare"},
2343     {AMQP_0_10_METHOD_EXCHANGE_DELETE,   "exchange.delete"},
2344     {AMQP_0_10_METHOD_EXCHANGE_QUERY,    "exchange.query"},
2345     {AMQP_0_10_METHOD_EXCHANGE_BIND,     "exchange.bind"},
2346     {AMQP_0_10_METHOD_EXCHANGE_UNBIND,   "exchange.unbind"},
2347     {AMQP_0_10_METHOD_EXCHANGE_BOUND,    "exchange.bound"},
2348     {0, NULL}
2349 };
2350
2351 static const value_string amqp_0_10_queue_methods [] = {
2352     {AMQP_0_10_METHOD_QUEUE_DECLARE,  "queue.declare"},
2353     {AMQP_0_10_METHOD_QUEUE_DELETE,   "queue.delete"},
2354     {AMQP_0_10_METHOD_QUEUE_PURGE,    "queue.purge"},
2355     {AMQP_0_10_METHOD_QUEUE_QUERY,    "queue.query"},
2356     {0, NULL}
2357 };
2358
2359 static const value_string amqp_0_10_file_methods [] = {
2360     {AMQP_0_10_METHOD_FILE_QOS,         "file.qos"},
2361     {AMQP_0_10_METHOD_FILE_QOS_OK,      "file.qos-ok"},
2362     {AMQP_0_10_METHOD_FILE_CONSUME,     "file.consume"},
2363     {AMQP_0_10_METHOD_FILE_CONSUME_OK,  "file.consume-ok"},
2364     {AMQP_0_10_METHOD_FILE_CANCEL,      "file.cancel"},
2365     {AMQP_0_10_METHOD_FILE_OPEN,        "file.open"},
2366     {AMQP_0_10_METHOD_FILE_OPEN_OK,     "file.open-ok"},
2367     {AMQP_0_10_METHOD_FILE_STAGE,       "file.stage"},
2368     {AMQP_0_10_METHOD_FILE_PUBLISH,     "file.publish"},
2369     {AMQP_0_10_METHOD_FILE_RETURN,      "file.return"},
2370     {AMQP_0_10_METHOD_FILE_DELIVER,     "file.deliver"},
2371     {AMQP_0_10_METHOD_FILE_ACK,         "file.ack"},
2372     {AMQP_0_10_METHOD_FILE_REJECT,      "file.reject"},
2373     {0, NULL}
2374 };
2375
2376 static const value_string amqp_0_10_stream_methods [] = {
2377     {AMQP_0_10_METHOD_STREAM_QOS,         "stream.qos"},
2378     {AMQP_0_10_METHOD_STREAM_QOS_OK,      "stream.qos-ok"},
2379     {AMQP_0_10_METHOD_STREAM_CONSUME,     "stream.consume"},
2380     {AMQP_0_10_METHOD_STREAM_CONSUME_OK,  "stream.consume-ok"},
2381     {AMQP_0_10_METHOD_STREAM_CANCEL,      "stream.cancel"},
2382     {AMQP_0_10_METHOD_STREAM_PUBLISH,     "stream.publish"},
2383     {AMQP_0_10_METHOD_STREAM_RETURN,      "stream.return"},
2384     {AMQP_0_10_METHOD_STREAM_DELIVER,     "stream.deliver"},
2385     {0, NULL}
2386 };
2387
2388 static const value_string amqp_0_10_method_connection_close_reply_codes [] = {
2389     {200,   "normal"},
2390     {320,   "connection-forced"},
2391     {402,   "invalid-path"},
2392     {501,   "framing-error"},
2393     {0, NULL}
2394 };
2395
2396 static const true_false_string amqp_0_10_session_header_sync = {
2397     "notification requested", "notification NOT requested"
2398 };
2399
2400 static const value_string amqp_0_10_method_session_detached_codes [] = {
2401     {0,    "normal"},
2402     {1,    "session-busy"},
2403     {2,    "transport-busy"},
2404     {3,    "not-attached"},
2405     {4,    "unknown-ids"},
2406     {0, NULL}
2407 };
2408
2409 static const value_string amqp_0_10_method_execution_exception_errors [] = {
2410     {403,   "unauthorized-access"},
2411     {404,   "not-found"},
2412     {405,   "resource-locked"},
2413     {406,   "precondition-failed"},
2414     {408,   "resource-deleted"},
2415     {409,   "illegal-state"},
2416     {503,   "command-invalid"},
2417     {506,   "resource-limit-exceeded"},
2418     {530,   "not-allowed"},
2419     {531,   "illegal-argument"},
2420     {540,   "not-implemented"},
2421     {541,   "internal-error"},
2422     {542,   "invalid-argument"},
2423     {0, NULL}
2424 };
2425
2426 static const value_string amqp_0_10_message_transfer_accept_modes [] = {
2427     {0,    "explicit"},
2428     {1,    "none"},
2429     {0, NULL}
2430 };
2431
2432 static const value_string amqp_0_10_message_transfer_acquire_modes [] = {
2433     {0,    "pre-acquired"},
2434     {1,    "not-acquired"},
2435     {0, NULL}
2436 };
2437
2438 static const value_string amqp_0_10_message_transfer_reject_codes [] = {
2439     {0,    "unspecified"},
2440     {1,    "unroutable"},
2441     {2,    "immediate"},
2442     {0, NULL}
2443 };
2444
2445 static const value_string amqp_0_10_message_flow_modes [] = {
2446     {0,    "credit"},
2447     {1,    "window"},
2448     {0, NULL}
2449 };
2450
2451 static const value_string amqp_0_10_message_credit_units [] = {
2452     {0,    "message"},
2453     {1,    "byte"},
2454     {0, NULL}
2455 };
2456
2457 static const value_string amqp_0_10_xa_status [] = {
2458     {0,    "Normal execution completion. (xa-ok)"},
2459     {1,    "The rollback was caused for an unspecified reason. (xa-rbrollback)"},
2460     {2,    "A transaction branch took too long. (xa-rbtimeout)"},
2461     {3,    "The transaction branch may have been heuristically completed. (xa-heurhaz)"},
2462     {4,    "The transaction branch has been heuristically committed. (xa-heurcom)"},
2463     {5,    "The transaction branch has been heuristically rolled back. (xa-heurrb)"},
2464     {6,    "The transaction branch has been heuristically committed and rolled back. (xa-heurmix)"},
2465     {7,    "The transaction branch was read-only and has been committed. (xa-rdonly)"},
2466     {0, NULL}
2467 };
2468
2469 static const value_string amqp_0_10_struct_delivery_properties_priorities [] = {
2470     {0,    "lowest"},
2471     {1,    "lower"},
2472     {2,    "low"},
2473     {3,    "below-average"},
2474     {4,    "medium"},
2475     {5,    "above-average"},
2476     {6,    "high"},
2477     {7,    "higher"},
2478     {8,    "very-high"},
2479     {9,    "highest"},
2480     {0, NULL}
2481 };
2482
2483 static const value_string amqp_0_10_struct_delivery_properties_modes [] = {
2484     {1,    "non-persistent"},
2485     {2,    "persistent"},
2486     {0, NULL}
2487 };
2488
2489 static const value_string amqp_0_10_file_return_codes [] = {
2490     {311,    "content-too-large"},
2491     {312,    "no-route"},
2492     {313,    "no-consumers"},
2493     {0, NULL}
2494 };
2495
2496 static const value_string amqp_0_10_stream_return_codes [] = {
2497     {311,    "content-too-large"},
2498     {312,    "no-route"},
2499     {313,    "no-consumers"},
2500     {0, NULL}
2501 };
2502
2503 static const value_string amqp_0_9_frame_types [] = {
2504     {AMQP_0_9_FRAME_TYPE_METHOD,             "Method"},
2505     {AMQP_0_9_FRAME_TYPE_CONTENT_HEADER,     "Content header"},
2506     {AMQP_0_9_FRAME_TYPE_CONTENT_BODY,       "Content body"},
2507     {AMQP_0_9_FRAME_TYPE_OOB_METHOD,         "OOB Method"},
2508     {AMQP_0_9_FRAME_TYPE_OOB_CONTENT_HEADER, "OOB Content header"},
2509     {AMQP_0_9_FRAME_TYPE_OOB_CONTENT_BODY,   "OOB Content body"},
2510     {AMQP_0_9_FRAME_TYPE_TRACE ,             "Trace"},
2511     {AMQP_0_9_FRAME_TYPE_HEARTBEAT,          "Heartbeat"},
2512     {0, NULL}
2513 };
2514
2515 static const value_string amqp_0_9_method_classes [] = {
2516     {AMQP_0_9_CLASS_CONNECTION, "Connection"},
2517     {AMQP_0_9_CLASS_CHANNEL,    "Channel"},
2518     {AMQP_0_9_CLASS_ACCESS,     "Access"},
2519     {AMQP_0_9_CLASS_EXCHANGE,   "Exchange"},
2520     {AMQP_0_9_CLASS_QUEUE,      "Queue"},
2521     {AMQP_0_9_CLASS_BASIC,      "Basic"},
2522     {AMQP_0_9_CLASS_FILE,       "File"},
2523     {AMQP_0_9_CLASS_STREAM,     "Stream"},
2524     {AMQP_0_9_CLASS_TX,         "Tx"},
2525     {AMQP_0_9_CLASS_DTX,        "Dtx"},
2526     {AMQP_0_9_CLASS_TUNNEL,     "Tunnel"},
2527     {0, NULL}
2528 };
2529
2530 static const value_string amqp_method_connection_methods [] = {
2531     {10, "Start"},
2532     {11, "Start-Ok"},
2533     {20, "Secure"},
2534     {21, "Secure-Ok"},
2535     {30, "Tune"},
2536     {31, "Tune-Ok"},
2537     {40, "Open"},
2538     {41, "Open-Ok"},
2539     {42, "Redirect"},
2540     {50, "Close"},
2541     {51, "Close-Ok"},
2542     {0, NULL}
2543 };
2544
2545 static const value_string amqp_method_channel_methods [] = {
2546     {10, "Open"},
2547     {11, "Open-Ok"},
2548     {20, "Flow"},
2549     {21, "Flow-Ok"},
2550     {40, "Close"},
2551     {41, "Close-Ok"},
2552     {50, "Resume"},
2553     {60, "Ping"},
2554     {70, "Pong"},
2555     {80, "Ok"},
2556     {0, NULL}
2557 };
2558
2559 static const value_string amqp_method_access_methods [] = {
2560     {10, "Request"},
2561     {11, "Request-Ok"},
2562     {0, NULL}
2563 };
2564
2565 static const value_string amqp_method_exchange_methods [] = {
2566     {10, "Declare"},
2567     {11, "Declare-Ok"},
2568     {20, "Delete"},
2569     {21, "Delete-Ok"},
2570     {30, "Bind"},
2571     {31, "Bind-Ok"},
2572     {0, NULL}
2573 };
2574
2575 static const value_string amqp_method_queue_methods [] = {
2576     {10, "Declare"},
2577     {11, "Declare-Ok"},
2578     {20, "Bind"},
2579     {21, "Bind-Ok"},
2580     {50, "Unbind"},
2581     {51, "Unbind-Ok"},
2582     {30, "Purge"},
2583     {31, "Purge-Ok"},
2584     {40, "Delete"},
2585     {41, "Delete-Ok"},
2586     {0, NULL}
2587 };
2588
2589 static const value_string amqp_method_basic_methods [] = {
2590     {10, "Qos"},
2591     {11, "Qos-Ok"},
2592     {20, "Consume"},
2593     {21, "Consume-Ok"},
2594     {30, "Cancel"},
2595     {31, "Cancel-Ok"},
2596     {40, "Publish"},
2597     {50, "Return"},
2598     {60, "Deliver"},
2599     {70, "Get"},
2600     {71, "Get-Ok"},
2601     {72, "Get-Empty"},
2602     {80, "Ack"},
2603     {90, "Reject"},
2604     {100, "Recover"},
2605     {0, NULL}
2606 };
2607
2608 static const value_string amqp_method_file_methods [] = {
2609     {10, "Qos"},
2610     {11, "Qos-Ok"},
2611     {20, "Consume"},
2612     {21, "Consume-Ok"},
2613     {30, "Cancel"},
2614     {31, "Cancel-Ok"},
2615     {40, "Open"},
2616     {41, "Open-Ok"},
2617     {50, "Stage"},
2618     {60, "Publish"},
2619     {70, "Return"},
2620     {80, "Deliver"},
2621     {90, "Ack"},
2622     {100, "Reject"},
2623     {0, NULL}
2624 };
2625
2626 static const value_string amqp_method_stream_methods [] = {
2627     {10, "Qos"},
2628     {11, "Qos-Ok"},
2629     {20, "Consume"},
2630     {21, "Consume-Ok"},
2631     {30, "Cancel"},
2632     {31, "Cancel-Ok"},
2633     {40, "Publish"},
2634     {50, "Return"},
2635     {60, "Deliver"},
2636     {0, NULL}
2637 };
2638
2639 static const value_string amqp_method_tx_methods [] = {
2640     {10, "Select"},
2641     {11, "Select-Ok"},
2642     {20, "Commit"},
2643     {21, "Commit-Ok"},
2644     {30, "Rollback"},
2645     {31, "Rollback-Ok"},
2646     {0, NULL}
2647 };
2648
2649 static const value_string amqp_method_dtx_methods [] = {
2650     {10, "Select"},
2651     {11, "Select-Ok"},
2652     {20, "Start"},
2653     {21, "Start-Ok"},
2654     {0, NULL}
2655 };
2656
2657 static const value_string amqp_method_tunnel_methods [] = {
2658     {10, "Request"},
2659     {0, NULL}
2660 };
2661
2662 /*  AMQP 0-10 Type Info  */
2663 static struct amqp_typeinfo amqp_0_10_fixed_types[] = {
2664     { 0x00, "bin8",    format_amqp_0_10_bin,     1 },
2665     { 0x01, "int8",    format_amqp_0_10_int,     1 },
2666     { 0x02, "uint8",   format_amqp_0_10_uint,    1 },
2667     { 0x04, "char",    format_amqp_0_10_char,    1 },
2668     { 0x08, "boolean", format_amqp_0_10_boolean, 1 },
2669     { 0x10, "bin16",   format_amqp_0_10_bin,     2 },
2670     { 0x11, "int16",   format_amqp_0_10_int,     2 },
2671     { 0x12, "uint16",  format_amqp_0_10_uint,    2 },
2672     { 0x20, "bin32",   format_amqp_0_10_bin,     4 },
2673     { 0x21, "int32",   format_amqp_0_10_int,     4 },
2674     { 0x22, "uint32",  format_amqp_0_10_uint,    4 },
2675     { 0xff, "end", 0, 0 }
2676 };
2677
2678 static struct amqp_typeinfo amqp_0_10_var_types[] = {
2679     { 0x80, "vbin8",   format_amqp_0_10_vbin, 1 },
2680     { 0x95, "str16",   format_amqp_0_10_str, 2 },
2681     { 0xff, "end", 0, 0 }
2682 };
2683
2684 /*  AMQP 1.0 Type Info  */
2685 static struct amqp_typeinfo amqp_1_0_fixed_types[] = {
2686     { 0x40, "null",       format_amqp_1_0_null,         0 },
2687     { 0x41, "bool",       format_amqp_1_0_boolean_true, 0 },
2688     { 0x42, "bool",       format_amqp_1_0_boolean_false,0 },
2689     { 0x56, "bool",       format_amqp_1_0_boolean,      1 },
2690     { 0x50, "ubyte",      format_amqp_1_0_uint,         1 },
2691     { 0x60, "ushort",     format_amqp_1_0_uint,         2 },
2692     { 0x70, "uint",       format_amqp_1_0_uint,         4 },
2693     { 0x52, "smalluint",  format_amqp_1_0_uint,         1 },
2694     { 0x43, "uint0",      format_amqp_1_0_uint,         0 },
2695     { 0x80, "ulong",      format_amqp_1_0_uint,         8 },
2696     { 0x53, "smallulong", format_amqp_1_0_uint,         1 },
2697     { 0x44, "ulong0",     format_amqp_1_0_uint,         0 },
2698     { 0x51, "byte",       format_amqp_1_0_int,          1 },
2699     { 0x61, "short",      format_amqp_1_0_int,          2 },
2700     { 0x71, "int",        format_amqp_1_0_int,          4 },
2701     { 0x54, "smallint",   format_amqp_1_0_int,          1 },
2702     { 0x81, "long",       format_amqp_1_0_int,          8 },
2703     { 0x55, "smalllong",  format_amqp_1_0_int,          1 },
2704     { 0x72, "float",      format_amqp_1_0_float,        4 },
2705     { 0x82, "double",     format_amqp_1_0_double,       8 },
2706     { 0x73, "char",       format_amqp_1_0_char,         4 },
2707     { 0x83, "timestamp",  format_amqp_1_0_timestamp,    8 },
2708     { 0x98, "uuid",       format_amqp_1_0_uuid,         16 },
2709     { 0xa0, "vbin8",      format_amqp_1_0_bin,          1 },
2710     { 0xb0, "vbin32",     format_amqp_1_0_bin,          4 },
2711     { 0xa1, "str8-utf8",  format_amqp_1_0_str,          1 },
2712     { 0xb1, "str32-utf8", format_amqp_1_0_str,          4 },
2713     { 0xa3, "sym8",       format_amqp_1_0_symbol,       1 },
2714     { 0xb3, "sym32",      format_amqp_1_0_symbol,       4 },
2715     { 0xff, "end", 0, 0 }
2716 };
2717
2718 /* see explanation at declaration of amqp_defined_types_t */
2719 static struct amqp_defined_types_t amqp_1_0_defined_types[] = {
2720     {AMQP_1_0_AMQP_TYPE_ERROR,                  &hf_amqp_1_0_error,                 3, hf_amqp_1_0_error_items },
2721     {AMQP_1_0_AMQP_TYPE_HEADER,                 &hf_amqp_1_0_messageHeader,         5, hf_amqp_1_0_messageHeader_items },
2722     {AMQP_1_0_AMQP_TYPE_DELIVERY_ANNOTATIONS,   &hf_amqp_1_0_deliveryAnnotations,   0, NULL },
2723     {AMQP_1_0_AMQP_TYPE_MESSAGE_ANNOTATIONS,    &hf_amqp_1_0_messageAnnotations,    0, NULL },
2724     {AMQP_1_0_AMQP_TYPE_PROPERTIES,             &hf_amqp_1_0_messageProperties,     13, hf_amqp_1_0_messageProperties_items },
2725     {AMQP_1_0_AMQP_TYPE_APPLICATION_PROPERTIES, &hf_amqp_1_0_applicationProperties, 0, NULL },
2726     {AMQP_1_0_AMQP_TYPE_DATA,                   &hf_amqp_1_0_data,                  0, NULL },
2727     {AMQP_1_0_AMQP_TYPE_AMQP_SEQUENCE,          &hf_amqp_1_0_amqp_sequence,         0, NULL },
2728     {AMQP_1_0_AMQP_TYPE_AMQP_VALUE,             &hf_amqp_1_0_amqp_value,            0, NULL },
2729     {AMQP_1_0_AMQP_TYPE_FOOTER,                 &hf_amqp_1_0_footer,                0, NULL },
2730     {AMQP_1_0_AMQP_TYPE_RECEIVED,               &hf_amqp_1_0_received,              2, hf_amqp_1_0_received_items },
2731     {AMQP_1_0_AMQP_TYPE_ACCEPTED,               &hf_amqp_1_0_accepted,              0, NULL },
2732     {AMQP_1_0_AMQP_TYPE_REJECTED,               &hf_amqp_1_0_rejected,              1, hf_amqp_1_0_rejected_items },
2733     {AMQP_1_0_AMQP_TYPE_RELEASED,               &hf_amqp_1_0_released,              0, NULL },
2734     {AMQP_1_0_AMQP_TYPE_MODIFIED,               &hf_amqp_1_0_modified,              3, hf_amqp_1_0_modified_items },
2735     {AMQP_1_0_AMQP_TYPE_SOURCE,                 &hf_amqp_1_0_source,                11, hf_amqp_1_0_source_items },
2736     {AMQP_1_0_AMQP_TYPE_TARGET,                 &hf_amqp_1_0_target,                7, hf_amqp_1_0_target_items },
2737     {AMQP_1_0_AMQP_TYPE_DELETE_ON_CLOSE,        &hf_amqp_1_0_deleteOnClose,         0, NULL },
2738     {AMQP_1_0_AMQP_TYPE_DELETE_ON_NO_LINKS,     &hf_amqp_1_0_deleteOnNoLinks,       0, NULL },
2739     {AMQP_1_0_AMQP_TYPE_DELETE_ON_NO_MESSAGE,   &hf_amqp_1_0_deleteOnNoMessages,    0, NULL },
2740     {AMQP_1_0_AMQP_TYPE_DELETE_ON_NO_LINKS_OR_MESSAGE, &hf_amqp_1_0_deleteOnNoLinksOrMessages, 0, NULL },
2741     {AMQP_1_0_AMQP_TYPE_COORDINATOR,            &hf_amqp_1_0_coordinator,           1, hf_amqp_1_0_coordinator_items },
2742     {AMQP_1_0_AMQP_TYPE_DECLARE,                &hf_amqp_1_0_declare,               1, hf_amqp_1_0_declare_items },
2743     {AMQP_1_0_AMQP_TYPE_DISCHARGE,              &hf_amqp_1_0_discharge,             2, hf_amqp_1_0_discharge_items },
2744     {AMQP_1_0_AMQP_TYPE_DECLARED,               &hf_amqp_1_0_declared,              1, hf_amqp_1_0_declared_items },
2745     {AMQP_1_0_AMQP_TYPE_TRANSACTIONAL_STATE,    &hf_amqp_1_0_transactionalState,    2, hf_amqp_1_0_transactionalState_items },
2746     { 0, NULL, 0, NULL }
2747 };
2748
2749 /*  Main dissection routine  */
2750
2751 static void
2752 dissect_amqp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
2753 {
2754     conversation_t *conv;
2755     amqp_conv *conn;
2756     guint fixed_length;
2757     guint (*length_getter)(packet_info *, tvbuff_t *, int);
2758     new_dissector_t dissector;
2759
2760     /*  Minimal frame size is 8 bytes - smaller frames are malformed  */
2761     if (tvb_reported_length (tvb) < 8) {
2762         expert_add_info_format(pinfo, NULL, &ei_amqp_bad_length, "Require frame at least 8 bytes long");
2763         return;
2764     }
2765
2766     /* Find (or build) conversation to remember the protocol version */
2767     conv = find_or_create_conversation(pinfo);
2768     conn = (amqp_conv *)conversation_get_proto_data(conv, proto_amqp);
2769     if (conn == NULL) {
2770         conn = wmem_new0(wmem_file_scope(), amqp_conv);
2771         conversation_add_proto_data(conv, proto_amqp, conn);
2772     }
2773     check_amqp_version(tvb, conn);
2774     switch(conn->version) {
2775     case AMQP_V0_9:
2776         length_getter = &get_amqp_0_9_message_len;
2777         dissector = dissect_amqp_0_9_frame;
2778         fixed_length = 7;
2779         break;
2780     case AMQP_V0_10:
2781         length_getter = &get_amqp_0_10_message_len;
2782         dissector = dissect_amqp_0_10_frame;
2783         fixed_length = 8;
2784         break;
2785     case AMQP_V1_0:
2786         length_getter = &get_amqp_1_0_message_len;
2787         dissector = dissect_amqp_1_0_frame;
2788         fixed_length = 8;
2789         break;
2790     default:
2791         col_append_str(pinfo->cinfo, COL_INFO, "AMQP (unknown version)");
2792         col_set_fence(pinfo->cinfo, COL_INFO);
2793         return;
2794     }
2795     tcp_dissect_pdus(tvb, pinfo, tree, TRUE, fixed_length,
2796                      length_getter, dissector, NULL);
2797 }
2798
2799 static void
2800 check_amqp_version(tvbuff_t *tvb, amqp_conv *conn)
2801 {
2802     guint32 f0_9_length;
2803
2804     /*
2805      * If we already know and the version and this isn't a protocol header,
2806      * return ok. 0-10 and up can run protocol headers in each direction,
2807      * so if it looks like a protocol header, snag the version even if one
2808      * is already recorded. Multi-protocol brokers can negotiate down.
2809      */
2810     if ((conn->version != 0) && (tvb_get_guint8(tvb, 0) != 'A'))
2811         return;
2812
2813     if (tvb_memeql(tvb, 0, "AMQP", 4) == 0) {
2814         /* AMQP 0-* has protocol major/minor in 6th/7th byte, while AMQP 1.0
2815          * has it in 5th/6th byte (7th is revision)
2816          */
2817         guint8 fivth_byte;
2818         guint8 sixth_byte;
2819         guint8 seventh_byte;
2820
2821         fivth_byte = tvb_get_guint8(tvb, 5);
2822         sixth_byte = tvb_get_guint8(tvb, 6);
2823         seventh_byte = tvb_get_guint8(tvb, 7);
2824         if ((fivth_byte == 1) && (sixth_byte == 0) && (seventh_byte == 0))
2825             conn->version = AMQP_V1_0;
2826         else if (sixth_byte == 0) {
2827             if (seventh_byte == 9)
2828                 conn->version = AMQP_V0_9;
2829             else if (seventh_byte == 10)
2830                 conn->version = AMQP_V0_10;
2831         }
2832         return;
2833     }
2834
2835     /*
2836      * It's not a protocol header and the AMQP version isn't known. Try to
2837      * deduce it from the content. First indicator is the frame length. 0-9
2838      * has a 32-bit length in octets 3-7. If the frame length is the same
2839      * as the PDU length and there's a frame end where it should be, this
2840      * is 0-9. Else, higher version. 0-10 has 5th octet 0x00 while 1.0 has
2841      * there at least 2 (DOFF) - use this fact to determine.
2842      */
2843     f0_9_length = tvb_get_ntohl(tvb, 3) + 7 + 1; /* Add header and end */
2844     if ((f0_9_length == tvb_reported_length(tvb)) &&
2845         (tvb_get_guint8(tvb, f0_9_length - 1) == 0xCE))
2846         conn->version = AMQP_V0_9;
2847     else if (tvb_get_guint8(tvb, 4) == 0x00)
2848         conn->version = AMQP_V0_10;
2849     else
2850         conn->version = AMQP_V1_0;
2851     return;
2852 }
2853
2854 static guint
2855 get_amqp_1_0_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
2856 {
2857     /*  Heuristic - protocol initialisation frame starts with 'AMQP'  */
2858     if (tvb_memeql(tvb, offset, "AMQP", 4) == 0)
2859         return 8;
2860     return (guint) tvb_get_ntohl(tvb, offset);
2861 }
2862
2863 static guint
2864 get_amqp_0_10_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
2865 {
2866     /*  Heuristic - protocol initialisation frame starts with 'AMQP'  */
2867     if (tvb_memeql(tvb, offset, "AMQP", 4) == 0)
2868         return 8;
2869
2870     return (guint) tvb_get_ntohs(tvb, offset + 2);
2871 }
2872
2873 static guint
2874 get_amqp_0_9_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
2875 {
2876     guint32 length;
2877
2878     /*  Heuristic - protocol initialisation frame starts with 'AMQP'  */
2879     if (tvb_memeql(tvb, offset, "AMQP", 4) == 0)
2880         return 8;
2881
2882     /*
2883      * XXX - the location of the length differs from protocol version to
2884      * protocol version; for now, we only handle version 0-9, and we
2885      * clamp the length at 1MB so we don't go nuts if we get a bogus
2886      * length due to dissecting the wrong version (or getting a malformed
2887      * packet).
2888      */
2889     length = tvb_get_ntohl(tvb, offset + 3);
2890     if (length > 1048576)
2891         length = 1048576;
2892     return length + 8;
2893 }
2894
2895 /*  Dissection routine for AMQP 0-9 field tables  */
2896
2897 static void
2898 dissect_amqp_0_9_field_table(tvbuff_t *tvb, packet_info *pinfo, int offset, guint length, proto_item *item)
2899 {
2900     proto_tree *field_table_tree;
2901     guint       namelen, vallen;
2902     guint8      type;
2903     const char *name;
2904     const char *amqp_typename;
2905     const char *value;
2906     int         field_start;
2907
2908     field_table_tree = proto_item_add_subtree(item, ett_amqp);
2909
2910     while (length != 0) {
2911         field_start = offset;
2912         namelen = tvb_get_guint8(tvb, offset);
2913         offset += 1;
2914         length -= 1;
2915         if (length < namelen)
2916             goto too_short;
2917         name = (char*) tvb_get_string_enc(wmem_packet_scope(), tvb, offset, namelen, ENC_UTF_8|ENC_NA);
2918         offset += namelen;
2919         length -= namelen;
2920         if (length < 1)
2921             goto too_short;
2922         type = tvb_get_guint8(tvb, offset);
2923         offset += 1;
2924         length -= 1;
2925         switch (type) {
2926         case 'S':
2927             amqp_typename = "string";
2928             if (length < 4)
2929                 goto too_short;
2930             vallen  = tvb_get_ntohl(tvb, offset);
2931             offset += 4;
2932             length -= 4;
2933             if (length < vallen)
2934                 goto too_short;
2935             /*
2936              * The spec says a long string can contain "any data"; could
2937              * this be binary?
2938              */
2939             value  = (char*) tvb_get_string_enc(wmem_packet_scope(), tvb, offset, vallen, ENC_UTF_8|ENC_NA);
2940             offset += vallen;
2941             length -= vallen;
2942             break;
2943         case 'I':
2944             amqp_typename = "integer";
2945             if (length < 4)
2946                 goto too_short;
2947             value  = wmem_strdup_printf(wmem_packet_scope(), "%d", tvb_get_ntohl(tvb, offset));
2948             offset += 4;
2949             length -= 4;
2950             break;
2951         case 'D':
2952             amqp_typename = "decimal";
2953             if (length < 5)
2954                 goto too_short;
2955             value   = "...";
2956             offset += 5;
2957             length -= 5;
2958             break;
2959         case 'T':
2960             amqp_typename =  "timestamp";
2961             if (length < 8)
2962                 goto too_short;
2963             value   = "...";
2964             offset += 8;
2965             length -= 8;
2966             break;
2967         case 'F':
2968             /*  TODO: make it recursive here  */
2969             amqp_typename =  "field table";
2970             if (length < 4)
2971                 goto too_short;
2972             vallen  = tvb_get_ntohl(tvb, offset);
2973             offset += 4;
2974             length -= 4;
2975             value = "...";
2976             if (length < vallen)
2977                 goto too_short;
2978             offset += vallen;
2979             length -= vallen;
2980             break;
2981         case 'V':
2982             amqp_typename = "void";
2983             value = "";
2984             break;
2985         case 'A':
2986             /*  TODO: make it recursive here  */
2987             amqp_typename = "array";
2988             if (length < 4)
2989                 goto too_short;
2990             vallen  = tvb_get_ntohl(tvb, offset);
2991             offset += 4;
2992             length -= 4;
2993             value = "...";
2994             if (length < vallen)
2995                 goto too_short;
2996             offset += vallen;
2997             length -= vallen;
2998             break;
2999         default:
3000             amqp_typename = "";
3001             value = NULL;
3002             break;
3003         }
3004
3005         if (value != NULL)
3006             proto_tree_add_none_format(field_table_tree, hf_amqp_field, tvb,
3007                                        field_start, offset - field_start,
3008                                        "%s (%s): %s", name, amqp_typename,
3009                                        value);
3010         else
3011             proto_tree_add_none_format(field_table_tree, hf_amqp_field, tvb,
3012                                        field_start, offset - field_start,
3013                                        "%s: unknown type %x (%c)",
3014                                        name, type, type);
3015     }
3016     return;
3017
3018 too_short:
3019     proto_tree_add_expert(field_table_tree, pinfo, &ei_amqp_field_short, tvb, field_start, offset - field_start);
3020     return;
3021 }
3022
3023 /*  Dissection routine for AMQP 0-10 maps  */
3024
3025 static void
3026 dissect_amqp_0_10_map(tvbuff_t *tvb,
3027                       int offset,          /* Start of map in tvb */
3028                       int bound,           /* How far into tvb we can go */
3029                       int length,          /* Length of map */
3030                       proto_item *item)
3031 {
3032     proto_item     *map_tree;
3033     guint           namelen, size;
3034     guint8          type;
3035     const char     *name;
3036     const char     *amqp_typename;
3037     const char     *value;
3038     gint            field_start, field_length;
3039     guint32         field_count;
3040     type_formatter  formatter;
3041
3042     field_length = 0;
3043     map_tree = proto_item_add_subtree(item, ett_amqp_0_10_map);
3044     field_count = tvb_get_ntohl(tvb, offset);
3045     AMQP_INCREMENT(offset, 4, bound);
3046     length -= 4;
3047     proto_item_append_text(item, " (%d entries)", field_count);
3048     while ((field_count > 0) && (length > 0)) {
3049         field_start = offset;
3050         namelen = tvb_get_guint8(tvb, offset);
3051         AMQP_INCREMENT(offset, 1, bound);
3052         length -= 1;
3053         name = (char*) tvb_get_string_enc(wmem_packet_scope(), tvb, offset, namelen, ENC_UTF_8|ENC_NA);
3054         AMQP_INCREMENT(offset, namelen, bound);
3055         length -= namelen;
3056         type = tvb_get_guint8(tvb, offset);
3057         AMQP_INCREMENT(offset, 1, bound);
3058         length -= 1;
3059         if (get_amqp_0_10_type_formatter(type, &amqp_typename, &formatter, &size)) {
3060             field_length = formatter(tvb, offset, bound, size, &value);
3061             proto_tree_add_none_format(map_tree,
3062                                        hf_amqp_field,
3063                                        tvb,
3064                                        field_start,
3065                                        field_length,
3066                                        "%s (%s): %s",
3067                                        name, amqp_typename, value);
3068             AMQP_INCREMENT(offset, field_length, bound);
3069             length -= field_length;
3070         }
3071         else {
3072             switch (type) {
3073             case AMQP_0_10_TYPE_MAP:
3074             case AMQP_0_10_TYPE_LIST:
3075             case AMQP_0_10_TYPE_ARRAY:
3076                 field_length = tvb_get_ntohl(tvb, offset);
3077                 proto_tree_add_none_format(map_tree, hf_amqp_field,
3078                                            tvb, field_start, field_length,
3079                                            "%s (composite): %d bytes",
3080                                            name, field_length);
3081                 AMQP_INCREMENT(offset, field_length, bound);
3082                 length -= field_length;
3083                 break;
3084
3085             default:
3086                 amqp_typename = "unimplemented";
3087                 if ((type & 0x80) == 0) {
3088                     field_length = 2 ^ ((type & 0x70) >> 4);
3089                 }
3090                 else if ((type & 0xd0) == 0xd0) {
3091                     field_length = 9;
3092                 }
3093                 else if ((type & 0xc0) == 0xc0) {
3094                     field_length = 5;
3095                 }
3096                 else if ((type & 0x80) == 0x80) {
3097                     switch (2 ^ ((type & 0x70) >> 4)) {
3098                     case 1:
3099                         field_length += tvb_get_guint8(tvb, offset);
3100                         break;
3101                     case 2:
3102                         field_length += tvb_get_ntohs(tvb, offset);
3103                         break;
3104                     case 4:
3105                         field_length += tvb_get_ntohl(tvb, offset);
3106                         break;
3107                     default:
3108                         field_length = 1;    /* Reserved... skip 1 */
3109                         amqp_typename = "reserved";
3110                         break;
3111                     }
3112                 }
3113                 else {
3114                     field_length = 1;    /* Reserved... skip 1 */
3115                     amqp_typename = "reserved";
3116                 }
3117                 proto_tree_add_none_format(map_tree, hf_amqp_field,
3118                                            tvb, field_start, field_length,
3119                                            "%s (%s): %d bytes",
3120                                            name, amqp_typename, field_length);
3121                 AMQP_INCREMENT(offset, field_length, bound);
3122                 length -= field_length;
3123             }
3124         }
3125
3126         field_count -= 1;
3127     }
3128 }
3129
3130 /*  Dissection routine for AMQP 0-10 maps  */
3131
3132 static void
3133 dissect_amqp_0_10_array(tvbuff_t *tvb,
3134                         packet_info *pinfo,
3135                         int offset,          /* Start of array in tvb */
3136                         int bound,           /* How far into tvb we can go */
3137                         int length,          /* Length of array */
3138                         proto_item *item)
3139 {
3140     proto_item *array_tree;
3141     proto_item *sub;
3142     guint8      type;
3143     guint16     len16;
3144     const char *amqp_typename;
3145     const char *value;
3146     int         element_start;
3147     int         externally_formatted;
3148     guint32     element_count;
3149     guint32     struct_length;
3150
3151     array_tree = 0;
3152     type = tvb_get_guint8(tvb, offset);
3153     AMQP_INCREMENT(offset, 1, bound);
3154     length -= 1;
3155     element_count = tvb_get_ntohl(tvb, offset);
3156     AMQP_INCREMENT(offset, 4, bound);
3157     length -= 4;
3158     proto_item_append_text(item, " (array of %d element%s)", element_count, element_suffix[element_count!=1]);
3159     if (element_count > 1)
3160         array_tree = proto_item_add_subtree(item, ett_amqp_0_10_array);
3161     while ((element_count > 0) && (length > 0)) {
3162         element_start = offset;
3163         externally_formatted = 0;
3164         switch (type) {
3165         case AMQP_0_10_TYPE_STR16:
3166             amqp_typename = "str16";
3167             len16 = tvb_get_ntohs(tvb, offset);
3168             AMQP_INCREMENT(offset, 2, bound);
3169             length -= 2;
3170             value   = (char*) tvb_get_string_enc(wmem_packet_scope(), tvb, offset, len16, ENC_UTF_8|ENC_NA);
3171             AMQP_INCREMENT(offset, len16, bound);
3172             length -= len16;
3173             break;
3174
3175         case AMQP_0_10_TYPE_STRUCT32:
3176             amqp_typename = "struct32";
3177             value = "structure";
3178             externally_formatted = 1;
3179             struct_length = tvb_get_ntohl(tvb, offset);
3180             AMQP_INCREMENT(offset, 4, bound);
3181             length -= 4;
3182             /*
3183              * Always add a tree for structs - the struct formatter will
3184              * change the item text to the struct type then add elements to it.
3185              */
3186             if (array_tree == 0)
3187                 array_tree = proto_item_add_subtree(item, ett_amqp_0_10_array);
3188             sub = proto_tree_add_none_format(array_tree, hf_amqp_field, tvb,
3189                                              element_start,
3190                                              offset - element_start,
3191                                              "(%s): ", amqp_typename);
3192             dissect_amqp_0_10_struct32(tvb, pinfo, sub, offset, struct_length);
3193             AMQP_INCREMENT(offset, struct_length, bound);
3194             length -= struct_length;
3195             break;
3196
3197         default:
3198             proto_tree_add_none_format(array_tree, hf_amqp_field, tvb,
3199                                        element_start,
3200                                        offset - element_start,
3201                                        "(unknown type %d)",
3202                                        type);
3203             /*  Don't bother continuing through the loop: we don't know how
3204              *  much to increment the offset by and the type doesn't change
3205              *  so there's nothing interesting to do...
3206              */
3207             return;
3208         }
3209
3210         element_count -= 1;
3211         if (externally_formatted)
3212             continue;
3213
3214         if (array_tree != 0) {
3215             proto_tree_add_none_format(array_tree, hf_amqp_field, tvb,
3216                                        element_start,
3217                                        offset - element_start,
3218                                        "(%s): %s",
3219                                        amqp_typename,
3220                                        value);
3221         }
3222         else {
3223             proto_item_append_text(item, ": (%s): %s", amqp_typename, value);
3224         }
3225     }
3226 }
3227
3228 static void
3229 dissect_amqp_0_10_xid (tvbuff_t *tvb,
3230                        int offset,
3231                        guint16 xid_length,
3232                        proto_item *ti)
3233 {
3234     proto_item *xid_tree;
3235     guint8      flag1/*, flag2*/;
3236     guint8      len8;
3237     int         max_length;
3238
3239     max_length = offset + xid_length;
3240     xid_tree = proto_item_add_subtree(ti, ett_args);
3241     flag1 = tvb_get_guint8(tvb, offset);
3242     /*flag2 = tvb_get_guint8(tvb, offset+1);*/
3243     proto_tree_add_item(xid_tree, hf_amqp_0_10_argument_packing_flags,
3244                         tvb, offset, 2, ENC_BIG_ENDIAN);
3245     AMQP_INCREMENT(offset, 2, max_length);
3246     if (flag1 & 0x01) {
3247         /*  format (uint32) */
3248         proto_tree_add_item(xid_tree,
3249                             hf_amqp_0_10_dtx_xid_format,
3250                             tvb, offset, 4, ENC_BIG_ENDIAN);
3251         AMQP_INCREMENT(offset, 4, max_length);
3252     }
3253     if (flag1 & 0x02) {
3254         /* global-id (vbin8) */
3255         len8 = tvb_get_guint8(tvb, offset);
3256         if ((offset + 1 + len8) > max_length)
3257             THROW(ReportedBoundsError);
3258         proto_tree_add_item(xid_tree,
3259                             hf_amqp_0_10_dtx_xid_global_id,
3260                             tvb, offset + 1, len8, ENC_NA);
3261         AMQP_INCREMENT(offset, (1 + len8), max_length);
3262     }
3263     if (flag1 & 0x04) {
3264         /* branch-id (vbin8) */
3265         len8 = tvb_get_guint8(tvb, offset);
3266         if ((offset + 1 + len8) > max_length)
3267             THROW(ReportedBoundsError);
3268         proto_tree_add_item(xid_tree,
3269                             hf_amqp_0_10_dtx_xid_branch_id,
3270                             tvb, offset + 1, len8, ENC_NA);
3271         AMQP_INCREMENT(offset, (1 + len8), max_length);
3272     }
3273 }
3274
3275 /*  Dissection routine for AMQP 0-10 frames  */
3276
3277 static void
3278 dissect_amqp_0_10_connection(tvbuff_t *tvb,
3279                              packet_info *pinfo,
3280                              proto_tree *tree,
3281                              int offset, guint16 length)
3282 {
3283     proto_item  *args_tree;
3284     proto_item  *ti;
3285     proto_item  *flags_item;
3286     guint8       method;
3287     guint8       flag1, flag2;  /* args struct packing flags */
3288     guint32      arg_length;
3289     int          flags_offset;
3290     const gchar *method_name;
3291
3292     method = tvb_get_guint8(tvb, offset+1);
3293     method_name = val_to_str_const(method, amqp_0_10_connection_methods,
3294                                    "<invalid connection method>");
3295     col_append_str(pinfo->cinfo, COL_INFO, method_name);
3296     col_append_str(pinfo->cinfo, COL_INFO, " ");
3297     col_set_fence(pinfo->cinfo,  COL_INFO);
3298
3299     proto_tree_add_item(tree, hf_amqp_0_10_connection_method,
3300                         tvb, offset+1, 1, ENC_BIG_ENDIAN);
3301     ti = proto_tree_add_item(tree, hf_amqp_method_arguments,
3302                              tvb, offset + 2, length - 2, ENC_NA);
3303     args_tree = proto_item_add_subtree(ti, ett_args);
3304     AMQP_INCREMENT(offset, 2, length);
3305     /*
3306      * The flag bits are a simple bit string, not a net-byte-order
3307      * field. tvb_get_bits16() doesn't know how to do little-endian
3308      * at this time, so just pick out two bytes.
3309      */
3310     flags_offset = offset;
3311     flag1 = tvb_get_guint8(tvb, offset);
3312     flag2 = tvb_get_guint8(tvb, offset+1);
3313     flags_item = proto_tree_add_item(args_tree,
3314                                      hf_amqp_0_10_argument_packing_flags,
3315                                      tvb, offset, 2, ENC_BIG_ENDIAN);
3316     AMQP_INCREMENT(offset, 2, length);
3317     switch (method) {
3318     case AMQP_0_10_METHOD_CONNECTION_START:
3319         if ((flag1 & ~0x07) || (flag2 != 0))
3320             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
3321         if (flag1 & 0x01) {
3322             /*  server-properties (map)  */
3323             arg_length = tvb_get_ntohl(tvb, offset);
3324             AMQP_INCREMENT(offset, 4, length);
3325             ti = proto_tree_add_item(args_tree,
3326                                      hf_amqp_method_connection_start_server_properties,
3327                                      tvb,
3328                                      offset,
3329                                      arg_length, ENC_NA);
3330             dissect_amqp_0_10_map (tvb,
3331                                    offset,
3332                                    offset + arg_length,
3333                                    arg_length,
3334                                    ti);
3335             AMQP_INCREMENT(offset, arg_length, length);
3336         }
3337         if (flag1 & 0x02) {
3338             /*  mechanisms (str16-array)  */
3339             arg_length = tvb_get_ntohl(tvb, offset);
3340             AMQP_INCREMENT(offset, 4, length);
3341             ti = proto_tree_add_item(args_tree,
3342                                      hf_amqp_0_10_method_connection_start_mechanisms,
3343                                      tvb,
3344                                      offset,
3345                                      arg_length, ENC_NA);
3346             dissect_amqp_0_10_array (tvb,
3347                                      pinfo,
3348                                      offset,
3349                                      offset + arg_length,
3350                                      arg_length,
3351                                      ti);
3352             AMQP_INCREMENT(offset, arg_length, length);
3353         }
3354         if (flag1 & 0x04) {
3355             /*  locales (str16-array)  */
3356             arg_length = tvb_get_ntohl(tvb, offset);
3357             AMQP_INCREMENT(offset, 4, length);
3358             ti = proto_tree_add_item(args_tree,
3359                                      hf_amqp_0_10_method_connection_start_locales,
3360                                      tvb,
3361                                      offset,
3362                                      arg_length, ENC_NA);
3363             dissect_amqp_0_10_array (tvb,
3364                                      pinfo,
3365                                      offset,
3366                                      offset + arg_length,
3367                                      arg_length,
3368                                      ti);
3369             AMQP_INCREMENT(offset, arg_length, length);
3370         }
3371         break;
3372
3373     case AMQP_0_10_METHOD_CONNECTION_START_OK:
3374         if ((flag1 & ~0x0f) || (flag2 != 0))
3375             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
3376         if (flag1 & 0x01) {
3377             /*  client-properties (map)  */
3378             arg_length = tvb_get_ntohl(tvb, offset);
3379             AMQP_INCREMENT(offset, 4, length);
3380             ti = proto_tree_add_item(args_tree,
3381                                      hf_amqp_method_connection_start_ok_client_properties,
3382                                      tvb,
3383                                      offset,
3384                                      arg_length, ENC_NA);
3385             dissect_amqp_0_10_map (tvb,
3386                                    offset,
3387                                    offset + arg_length,
3388                                    arg_length,
3389                                    ti);
3390             AMQP_INCREMENT(offset, arg_length, length);
3391         }
3392         if (flag1 & 0x02) {
3393             /*  mechanism (str8)  */
3394             proto_tree_add_item(args_tree,
3395                                 hf_amqp_method_connection_start_ok_mechanism,
3396                                 tvb, offset + 1, tvb_get_guint8(tvb, offset),
3397                                 ENC_ASCII|ENC_NA);
3398             AMQP_INCREMENT(offset, 1 + tvb_get_guint8(tvb, offset), length);
3399         }
3400         if (flag1 & 0x04) {
3401             /*  response (vbin32)  */
3402             proto_tree_add_item(args_tree,
3403                                 hf_amqp_method_connection_start_ok_response,
3404                                 tvb, offset + 4, tvb_get_ntohl(tvb, offset),
3405                                 ENC_NA);
3406             AMQP_INCREMENT(offset, 4 + tvb_get_ntohl(tvb, offset), length);
3407         }
3408         if (flag1 & 0x08) {
3409             /*  locale (str8)  */
3410             proto_tree_add_item(args_tree,
3411                                 hf_amqp_method_connection_start_ok_locale,
3412                                 tvb, offset + 1, tvb_get_guint8(tvb, offset),
3413                                 ENC_ASCII|ENC_NA);
3414             AMQP_INCREMENT(offset, 1 + tvb_get_guint8(tvb, offset), length);
3415         }
3416         break;
3417
3418     case AMQP_0_10_METHOD_CONNECTION_SECURE:
3419         if ((flag1 & ~0x01) || (flag2 != 0))
3420             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
3421         if (flag1 & 0x01) {
3422             /*  challenge (vbin32)  */
3423             proto_tree_add_item(args_tree,
3424                                 hf_amqp_method_connection_secure_challenge,
3425                                 tvb, offset + 4, tvb_get_ntohl(tvb, offset),
3426                                 ENC_NA);
3427             AMQP_INCREMENT(offset, 4 + tvb_get_ntohl(tvb, offset), length);
3428         }
3429         break;
3430
3431     case AMQP_0_10_METHOD_CONNECTION_SECURE_OK:
3432         if ((flag1 & ~0x01) || (flag2 != 0))
3433             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
3434         if (flag1 & 0x01) {
3435             /*  response (vbin32)  */
3436             proto_tree_add_item(args_tree,
3437                                 hf_amqp_method_connection_secure_ok_response,
3438                                 tvb, offset + 4, tvb_get_ntohl(tvb, offset),
3439                                 ENC_NA);
3440             AMQP_INCREMENT(offset, 4 + tvb_get_ntohl(tvb, offset), length);
3441         }
3442         break;
3443
3444     case AMQP_0_10_METHOD_CONNECTION_TUNE:
3445         if ((flag1 & ~0x0f) || (flag2 != 0))
3446             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
3447         if (flag1 & 0x01) {
3448             /*  channel-max (uint16)  */
3449             proto_tree_add_item(args_tree,
3450                                 hf_amqp_method_connection_tune_channel_max,
3451                                 tvb, offset, 2, ENC_BIG_ENDIAN);
3452             AMQP_INCREMENT(offset, 2, length);
3453         }
3454         if (flag1 & 0x02) {
3455             /*  max-frame-size (uint16)  */
3456             proto_tree_add_item(args_tree,
3457                                 hf_amqp_0_10_method_connection_tune_frame_max,
3458                                 tvb, offset, 2, ENC_BIG_ENDIAN);
3459             AMQP_INCREMENT(offset, 2, length);
3460         }
3461         if (flag1 & 0x04) {
3462             /*  heartbeat-min (uint16)  */
3463             proto_tree_add_item(args_tree,
3464                                 hf_amqp_0_10_method_connection_tune_heartbeat_min,
3465                                 tvb, offset, 2, ENC_BIG_ENDIAN);
3466             AMQP_INCREMENT(offset, 2, length);
3467         }
3468         if (flag1 & 0x08) {
3469             /*  heartbeat-max (uint16)  */
3470             proto_tree_add_item(args_tree,
3471                                 hf_amqp_0_10_method_connection_tune_heartbeat_max,
3472                                 tvb, offset, 2, ENC_BIG_ENDIAN);
3473             AMQP_INCREMENT(offset, 2, length);
3474         }
3475         break;
3476
3477     case AMQP_0_10_METHOD_CONNECTION_TUNE_OK:
3478         if ((flag1 & ~0x07) || (flag2 != 0))
3479             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
3480         if (flag1 & 0x01) {
3481             /*  channel-max (uint16)  */
3482             proto_tree_add_item(args_tree,
3483                                 hf_amqp_method_connection_tune_ok_channel_max,
3484                                 tvb, offset, 2, ENC_BIG_ENDIAN);
3485             AMQP_INCREMENT(offset, 2, length);
3486         }
3487         if (flag1 & 0x02) {
3488             /*  max-frame-size (uint16)  */
3489             proto_tree_add_item(args_tree,
3490                                 hf_amqp_0_10_method_connection_tune_ok_frame_max,
3491                                 tvb, offset, 2, ENC_BIG_ENDIAN);
3492             AMQP_INCREMENT(offset, 2, length);
3493         }
3494         if (flag1 & 0x04) {
3495             /*  heartbeat (uint16)  */
3496             proto_tree_add_item(args_tree,
3497                                 hf_amqp_method_connection_tune_ok_heartbeat,
3498                                 tvb, offset, 2, ENC_BIG_ENDIAN);
3499             AMQP_INCREMENT(offset, 2, length);
3500         }
3501         break;
3502
3503     case AMQP_0_10_METHOD_CONNECTION_OPEN:
3504         if ((flag1 & ~0x07) || (flag2 != 0))
3505             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
3506         if (flag1 & 0x01) {
3507             /*  virtual-host (str8)  */
3508             proto_tree_add_item(args_tree,
3509                                      hf_amqp_method_connection_open_virtual_host,
3510                                      tvb,
3511                                      offset + 1,
3512                                      tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
3513             AMQP_INCREMENT(offset, tvb_get_guint8(tvb, offset) + 1, length);
3514         }
3515         if (flag1 & 0x02) {
3516             /*  capabilities (str16-array)  */
3517             arg_length = tvb_get_ntohl(tvb, offset);
3518             AMQP_INCREMENT(offset, 4, length);
3519             ti = proto_tree_add_item(args_tree,
3520                                      hf_amqp_0_10_method_connection_open_capabilities,
3521                                      tvb,
3522                                      offset,
3523                                      arg_length, ENC_NA);
3524             dissect_amqp_0_10_array (tvb,
3525                                      pinfo,
3526                                      offset,
3527                                      offset + arg_length,
3528                                      arg_length,
3529                                      ti);
3530             AMQP_INCREMENT(offset, arg_length, length);
3531         }
3532         /*
3533          * 3rd argument is an optional bit, insist.
3534          */
3535         proto_tree_add_item(args_tree,
3536                             hf_amqp_0_10_method_connection_open_insist,
3537                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
3538         break;
3539
3540     case AMQP_0_10_METHOD_CONNECTION_OPEN_OK:
3541         if ((flag1 & ~0x01) || (flag2 != 0))
3542             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
3543         if (flag1 & 0x01) {
3544             /*  known-hosts (amqp-host-array)  */
3545             arg_length = tvb_get_ntohl(tvb, offset);
3546             AMQP_INCREMENT(offset, 4, length);
3547             ti = proto_tree_add_item(args_tree,
3548                                      hf_amqp_0_10_method_connection_open_ok_known_hosts,
3549                                      tvb,
3550                                      offset,
3551                                      arg_length, ENC_NA);
3552             dissect_amqp_0_10_array (tvb,
3553                                      pinfo,
3554                                      offset,
3555                                      offset + arg_length,
3556                                      arg_length,
3557                                      ti);
3558             AMQP_INCREMENT(offset, arg_length, length);
3559         }
3560         break;
3561
3562     case AMQP_0_10_METHOD_CONNECTION_REDIRECT:
3563         if ((flag1 & ~0x03) || (flag2 != 0))
3564             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
3565         if (flag1 & 0x01) {
3566             /*  host (amqp-host-url [str16])  */
3567             proto_tree_add_item(args_tree,
3568                                 hf_amqp_method_connection_redirect_host,
3569                                 tvb, offset + 2, tvb_get_ntohs(tvb, offset),
3570                                 ENC_ASCII|ENC_NA);
3571             AMQP_INCREMENT(offset, 2 + tvb_get_ntohs(tvb, offset), length);
3572         }
3573         if (flag1 & 0x02) {
3574             /*  known-hosts (amqp-host-array)  */
3575             arg_length = tvb_get_ntohl(tvb, offset);
3576             AMQP_INCREMENT(offset, 4, length);
3577             ti = proto_tree_add_item(args_tree,
3578                                      hf_amqp_0_10_method_connection_redirect_known_hosts,
3579                                      tvb,
3580                                      offset,
3581                                      arg_length, ENC_NA);
3582             dissect_amqp_0_10_array (tvb,
3583                                      pinfo,
3584                                      offset,
3585                                      offset + arg_length,
3586                                      arg_length,
3587                                      ti);
3588             AMQP_INCREMENT(offset, arg_length, length);
3589         }
3590         break;
3591
3592     case AMQP_0_10_METHOD_CONNECTION_HEARTBEAT:
3593         break;
3594
3595     case AMQP_0_10_METHOD_CONNECTION_CLOSE:
3596         if ((flag1 & ~0x03) || (flag2 != 0))
3597             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
3598         if (flag1 & 0x01) {
3599             /*  reply-code (uint16)  */
3600             proto_tree_add_item(args_tree,
3601                                 hf_amqp_0_10_method_connection_close_reply_code,
3602                                 tvb, offset, 2, ENC_BIG_ENDIAN);
3603             AMQP_INCREMENT(offset, 2, length);
3604         }
3605         if (flag1 & 0x02) {
3606             /*  reply-text (str8)  */
3607             proto_tree_add_item(args_tree,
3608                                 hf_amqp_method_connection_close_reply_text,
3609                                 tvb, offset + 1, tvb_get_guint8(tvb, offset),
3610                                 ENC_ASCII|ENC_NA);
3611             AMQP_INCREMENT(offset, 1 + tvb_get_guint8(tvb, offset), length);
3612         }
3613         break;
3614
3615     case AMQP_0_10_METHOD_CONNECTION_CLOSE_OK:
3616         break;
3617     }
3618 }
3619
3620 static void
3621 dissect_amqp_0_10_session(tvbuff_t *tvb,
3622                           packet_info *pinfo,
3623                           proto_tree *tree,
3624                           int offset, guint16 length)
3625 {
3626     proto_item  *args_tree;
3627     proto_item  *ti;
3628     proto_item  *flags_item;
3629     guint8       method;
3630     guint8       flag1, flag2;
3631     guint16      size;
3632     guint32      array_size;
3633     int          flags_offset;
3634     const gchar *method_name;
3635
3636     method = tvb_get_guint8(tvb, offset+1);
3637     method_name = val_to_str_const(method, amqp_0_10_session_methods,
3638                                    "<invalid session method>");
3639     col_append_str(pinfo->cinfo, COL_INFO, method_name);
3640     col_append_str(pinfo->cinfo, COL_INFO, " ");
3641     col_set_fence(pinfo->cinfo, COL_INFO);
3642
3643     proto_tree_add_item(tree, hf_amqp_0_10_session_method,
3644                         tvb, offset+1, 1, ENC_BIG_ENDIAN);
3645     AMQP_INCREMENT(offset, 2, length);
3646
3647     ti = proto_tree_add_item(tree, hf_amqp_method_arguments,
3648                              tvb, offset, length - 2, ENC_NA);
3649     args_tree = proto_item_add_subtree(ti, ett_args);
3650     /*
3651      * The flag bits are a simple bit string, not a net-byte-order
3652      * field. tvb_get_bits16() doesn't know how to do little-endian
3653      * at this time, so just pick out two bytes.
3654      */
3655     flags_offset = offset;
3656     flag1 = tvb_get_guint8(tvb, offset);
3657     flag2 = tvb_get_guint8(tvb, offset+1);
3658     flags_item = proto_tree_add_item(args_tree,
3659                                      hf_amqp_0_10_argument_packing_flags,
3660                                      tvb, offset, 2, ENC_BIG_ENDIAN);
3661     AMQP_INCREMENT(offset, 2, length);
3662     switch (method) {
3663     case AMQP_0_10_METHOD_SESSION_ATTACH:
3664         if ((flag1 & ~0x03) || ((flag2 != 0)))
3665             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
3666         if (flag1 & 0x01) {
3667             /*  name (vbin16)  */
3668             size = tvb_get_ntohs(tvb, offset);
3669             AMQP_INCREMENT(offset, 2, length);
3670             proto_tree_add_item(args_tree,
3671                                 hf_amqp_0_10_method_session_attach_name,
3672                                 tvb, offset, size, ENC_NA);
3673             AMQP_INCREMENT(offset, size, length);
3674         }
3675         /*
3676          * 2nd argument is an optional bit, force.
3677          */
3678         proto_tree_add_item(args_tree,
3679                             hf_amqp_0_10_method_session_attach_force,
3680                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
3681         break;
3682
3683     case AMQP_0_10_METHOD_SESSION_ATTACHED:
3684     case AMQP_0_10_METHOD_SESSION_DETACH:
3685         if ((flag1 != 0x01) || (flag2 != 0))
3686             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
3687         if (flag1 & 0x01) {
3688             /*  name (vbin16)  */
3689             size = tvb_get_ntohs(tvb, offset);
3690             AMQP_INCREMENT(offset, 2, length);
3691             proto_tree_add_item(args_tree,
3692                                 hf_amqp_0_10_method_session_attach_name,
3693                                 tvb, offset, size, ENC_NA);
3694             AMQP_INCREMENT(offset, size, length);
3695         }
3696         break;
3697
3698     case AMQP_0_10_METHOD_SESSION_DETACHED:
3699         if ((flag1 & ~0x03) || (flag2 != 0))
3700             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
3701         if (flag1 & 0x01) {
3702             /*  name (vbin16)  */
3703             size = tvb_get_ntohs(tvb, offset);
3704             AMQP_INCREMENT(offset, 2, length);
3705             proto_tree_add_item(args_tree,
3706                                 hf_amqp_0_10_method_session_attach_name,
3707                                 tvb, offset, size, ENC_NA);
3708             AMQP_INCREMENT(offset, size, length);
3709         }
3710         if (flag1 & 0x02) {
3711             /*  code (detach-code [uint8]) */
3712             proto_tree_add_item(args_tree,
3713                                 hf_amqp_0_10_method_session_detached_code,
3714                                 tvb, offset, 1, ENC_BIG_ENDIAN);
3715             AMQP_INCREMENT(offset, 1, length);
3716         }
3717         break;
3718
3719     case AMQP_0_10_METHOD_SESSION_REQUEST_TIMEOUT:
3720     case AMQP_0_10_METHOD_SESSION_TIMEOUT:
3721         if ((flag1 & ~0x01) || (flag2 != 0))
3722             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
3723         if (flag1 & 0x01) {
3724             /*  timeout (uint32)  */
3725             proto_tree_add_item(args_tree,
3726                                 hf_amqp_0_10_method_session_timeout,
3727                                 tvb, offset, 4, ENC_BIG_ENDIAN);
3728             AMQP_INCREMENT(offset, 4, length);
3729         }
3730         break;
3731
3732     case AMQP_0_10_METHOD_SESSION_COMMAND_POINT:
3733         if ((flag1 & ~0x03) || (flag2 != 0))
3734             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
3735         if (flag1 & 0x01) {
3736             /*  command-id (sequence-no [uint32])  */
3737             proto_tree_add_item(args_tree,
3738                                 hf_amqp_0_10_method_session_command_point_id,
3739                                 tvb, offset, 4, ENC_BIG_ENDIAN);
3740             AMQP_INCREMENT(offset, 4, length);
3741         }
3742         if (flag1 & 0x02) {
3743             /*  command-offset (uint64) */
3744             proto_tree_add_item(args_tree,
3745                                 hf_amqp_0_10_method_session_command_point_offset,
3746                                 tvb, offset, 8, ENC_BIG_ENDIAN);
3747             AMQP_INCREMENT(offset, 8, length);
3748         }
3749         break;
3750
3751     case AMQP_0_10_METHOD_SESSION_EXPECTED:
3752         if ((flag1 & ~0x03) || (flag2 != 0))
3753             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
3754         if (flag1 & 0x01) {
3755             /*  commands (commands [sequence-set])  */
3756             size = tvb_get_ntohs(tvb, offset);
3757             if ((offset + 2 + size) > length)
3758                 THROW(ReportedBoundsError);
3759             ti = proto_tree_add_item(args_tree,
3760                                      hf_amqp_0_10_method_session_commands,
3761                                      tvb, offset, size + 2, ENC_NA);
3762             AMQP_INCREMENT(offset, 2, length);
3763             format_amqp_0_10_sequence_set(tvb, offset, size, ti);
3764             AMQP_INCREMENT(offset, size + 2, length);
3765         }
3766         if (flag1 & 0x02) {
3767             /*  fragments (command-fragments [array of command-fragment]) */
3768             array_size = tvb_get_ntohl(tvb, offset);
3769             if ((offset + 4 + array_size) > length)
3770                 THROW(ReportedBoundsError);
3771             ti = proto_tree_add_item(args_tree,
3772                                      hf_amqp_0_10_method_session_fragments,
3773                                      tvb, offset, array_size + 4, ENC_NA);
3774             AMQP_INCREMENT(offset, 4, length);
3775             dissect_amqp_0_10_array(tvb,
3776                                     pinfo,
3777                                     offset,
3778                                     offset + array_size,
3779                                     length,
3780                                     ti);
3781             AMQP_INCREMENT(offset, array_size, length);
3782         }
3783         break;
3784
3785     case AMQP_0_10_METHOD_SESSION_CONFIRMED:
3786         if ((flag1 & ~0x03) || (flag2 != 0))
3787             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
3788         if (flag1 & 0x01) {
3789             /*  commands (commands [sequence-set])  */
3790             size = tvb_get_ntohs(tvb, offset);
3791             if ((offset + 2 + size) > length)
3792                 THROW(ReportedBoundsError);
3793             ti = proto_tree_add_item(args_tree,
3794                                      hf_amqp_0_10_method_session_commands,
3795                                      tvb, offset, size + 2, ENC_NA);
3796             AMQP_INCREMENT(offset, 2, length);
3797             format_amqp_0_10_sequence_set(tvb, offset, size, ti);
3798             AMQP_INCREMENT(offset, size + 2, length);
3799         }
3800         if (flag1 & 0x02) {
3801             /*  fragments (command-fragments [array of command-fragment]) */
3802             array_size = tvb_get_ntohl(tvb, offset);
3803             if ((offset + 4 + array_size) > length)
3804                 THROW(ReportedBoundsError);
3805             ti = proto_tree_add_item(args_tree,
3806                                      hf_amqp_0_10_method_session_fragments,
3807                                      tvb, offset, array_size + 4, ENC_NA);
3808             AMQP_INCREMENT(offset, 4, length);
3809             dissect_amqp_0_10_array(tvb,
3810                                     pinfo,
3811                                     offset,
3812                                     offset + array_size,
3813                                     length,
3814                                     ti);
3815             AMQP_INCREMENT(offset, array_size, length);
3816         }
3817         break;
3818
3819     case AMQP_0_10_METHOD_SESSION_COMPLETED:
3820         if ((flag1 & ~0x03) || (flag2 != 0))
3821             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
3822         if (flag1 & 0x01) {
3823             /*  commands (commands [sequence-set])  */
3824             size = tvb_get_ntohs(tvb, offset);
3825             if ((offset + 2 + size) > length)
3826                 THROW(ReportedBoundsError);
3827             ti = proto_tree_add_item(args_tree,
3828                                      hf_amqp_0_10_method_session_commands,
3829                                      tvb, offset, size + 2, ENC_NA);
3830             AMQP_INCREMENT(offset, 2, length);
3831             format_amqp_0_10_sequence_set(tvb, offset, size, ti);
3832             AMQP_INCREMENT(offset, size, length);
3833         }
3834         /*
3835          * 2nd argument is an optional bit, timely-reply.
3836          */
3837         proto_tree_add_item(args_tree,
3838                             hf_amqp_0_10_method_session_completed_timely,
3839                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
3840         break;
3841
3842     case AMQP_0_10_METHOD_SESSION_KNOWN_COMPLETED:
3843         if ((flag1 & ~0x01) || (flag2 != 0))
3844             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
3845         if (flag1 & 0x01) {
3846             /*  commands (commands [sequence-set])  */
3847             size = tvb_get_ntohs(tvb, offset);
3848             if ((offset + 2 + size) > length)
3849                 THROW(ReportedBoundsError);
3850             ti = proto_tree_add_item(args_tree,
3851                                      hf_amqp_0_10_method_session_commands,
3852                                      tvb, offset, size + 2, ENC_NA);
3853             AMQP_INCREMENT(offset, 2, length);
3854             format_amqp_0_10_sequence_set(tvb, offset, size, ti);
3855             AMQP_INCREMENT(offset, size, length);
3856         }
3857         break;
3858
3859     case AMQP_0_10_METHOD_SESSION_FLUSH:
3860         if ((flag1 & ~0x07) || (flag2 != 0))
3861             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
3862         proto_tree_add_item(args_tree,
3863                             hf_amqp_0_10_method_session_flush_expected,
3864                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
3865         proto_tree_add_item(args_tree,
3866                             hf_amqp_0_10_method_session_flush_confirmed,
3867                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
3868         proto_tree_add_item(args_tree,
3869                             hf_amqp_0_10_method_session_flush_completed,
3870                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
3871         break;
3872
3873     case AMQP_0_10_METHOD_SESSION_GAP:
3874         if ((flag1 & ~0x01) || (flag2 != 0))
3875             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
3876         if (flag1 & 0x01) {
3877             /*  commands (commands [sequence-set])  */
3878             size = tvb_get_ntohs(tvb, offset);
3879             if ((offset + 2 + size) > length)
3880                 THROW(ReportedBoundsError);
3881             ti = proto_tree_add_item(args_tree,
3882                                      hf_amqp_0_10_method_session_commands,
3883                                      tvb, offset, size + 2, ENC_NA);
3884             AMQP_INCREMENT(offset, 2, length);
3885             format_amqp_0_10_sequence_set(tvb, offset, size, ti);
3886             AMQP_INCREMENT(offset, size + 2, length);
3887         }
3888         break;
3889
3890     }
3891 }
3892
3893 static void
3894 dissect_amqp_0_10_execution(tvbuff_t *tvb,
3895                             packet_info *pinfo,
3896                             proto_tree *tree,
3897                             int offset, guint16 length)
3898 {
3899     proto_item  *args_tree;
3900     proto_item  *ti;
3901     proto_item  *flags_item;
3902     guint8       amqp_class = 0, method;
3903     guint8       flag1, flag2;
3904     guint16      size;
3905     guint32      struct_size;
3906     int          class_hf;
3907     const gchar *method_name;
3908
3909     method = tvb_get_guint8(tvb, offset+1);
3910     method_name = val_to_str_const(method, amqp_0_10_execution_methods,
3911                                    "<invalid execution method>");
3912     col_append_str(pinfo->cinfo, COL_INFO, method_name);
3913     col_append_str(pinfo->cinfo, COL_INFO, " ");
3914     col_set_fence(pinfo->cinfo, COL_INFO);
3915
3916     proto_tree_add_item(tree, hf_amqp_0_10_execution_method,
3917                         tvb, offset+1, 1, ENC_BIG_ENDIAN);
3918     AMQP_INCREMENT(offset, 2, length);
3919     /*
3920      * Session header is 2 bytes; one that tells that it's 1 byte long, then
3921      * the byte itself. Bit 0 is sync.
3922      */
3923     flag1 = tvb_get_guint8(tvb, offset);
3924     flag2 = tvb_get_guint8(tvb, offset+1);
3925     if ((flag1 != 1) || ((flag2 & 0xfe) != 0))
3926         proto_tree_add_text(tree, tvb, offset, 2, "Invalid session header");
3927     else
3928         proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync,
3929                             tvb, offset + 1, 1, ENC_BIG_ENDIAN);
3930     AMQP_INCREMENT(offset, 2, length);
3931
3932     ti = proto_tree_add_item(tree, hf_amqp_method_arguments,
3933                              tvb, offset, length - 4, ENC_NA);
3934     args_tree = proto_item_add_subtree(ti, ett_args);
3935     /*
3936      * The flag bits are a simple bit string, not a net-byte-order
3937      * field. tvb_get_bits16() doesn't know how to do little-endian
3938      * at this time, so just pick out two bytes.
3939      */
3940     flag1 = tvb_get_guint8(tvb, offset);
3941     flag2 = tvb_get_guint8(tvb, offset+1);
3942     flags_item = proto_tree_add_item(args_tree,
3943                                      hf_amqp_0_10_argument_packing_flags,
3944                                      tvb, offset, 2, ENC_BIG_ENDIAN);
3945     AMQP_INCREMENT(offset, 2, length);
3946     switch (method) {
3947     case AMQP_0_10_METHOD_EXECUTION_SYNC:
3948         if ((flag1 != 0) || (flag2 != 0))
3949             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
3950         break;
3951
3952     case AMQP_0_10_METHOD_EXECUTION_RESULT:
3953         if ((flag1 & ~0x03) || (flag2 != 0))
3954             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
3955         if (flag1 & 0x01) {
3956             /*  command-id (sequence-no [uint32])  */
3957             proto_tree_add_item(args_tree,
3958                                 hf_amqp_0_10_method_execution_command_id,
3959                                 tvb, offset, 4, ENC_BIG_ENDIAN);
3960             AMQP_INCREMENT(offset, 4, length);
3961         }
3962         if (flag1 & 0x02) {
3963             /*  value (struct32) */
3964             struct_size = tvb_get_ntohl(tvb, offset);
3965             AMQP_INCREMENT(offset, 4, length);
3966             if ((offset + struct_size) > length)
3967                 THROW(ReportedBoundsError);
3968             ti = proto_tree_add_item(args_tree,
3969                                      hf_amqp_0_10_undissected_struct32,
3970                                      tvb, offset, struct_size, ENC_NA);
3971             dissect_amqp_0_10_struct32(tvb, pinfo, ti, offset, struct_size);
3972             AMQP_INCREMENT(offset, struct_size, length);
3973         }
3974         break;
3975
3976     case AMQP_0_10_METHOD_EXECUTION_EXCEPTION:
3977         if ((flag1 & ~0x7f) || (flag2 != 0))
3978             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
3979         if (flag1 & 0x01) {
3980             /* error-code (error-code [uint16]) */
3981             proto_tree_add_item(args_tree,
3982                                 hf_amqp_0_10_method_execution_exception_error,
3983                                 tvb, offset, 2, ENC_BIG_ENDIAN);
3984             AMQP_INCREMENT(offset, 2, length);
3985         }
3986         if (flag1 & 0x02) {
3987             /*  command-id (sequence-no [uint32])  */
3988             proto_tree_add_item(args_tree,
3989                                 hf_amqp_0_10_method_execution_command_id,
3990                                 tvb, offset, 4, ENC_BIG_ENDIAN);
3991             AMQP_INCREMENT(offset, 4, length);
3992         }
3993         if (flag1 & 0x04) {
3994             /*  class-code (uint8) */
3995             amqp_class = tvb_get_guint8(tvb, offset);
3996             proto_tree_add_item(args_tree, hf_amqp_0_10_class,
3997                                 tvb, offset, 1, ENC_BIG_ENDIAN);
3998             AMQP_INCREMENT(offset, 1, length);
3999         }
4000         if (flag1 & 0x08) {
4001             /*  command-code (uint8) */
4002             switch(amqp_class) {
4003             case AMQP_0_10_CLASS_CONNECTION:
4004                 class_hf = hf_amqp_0_10_connection_method;
4005                 break;
4006             case AMQP_0_10_CLASS_SESSION:
4007                 class_hf = hf_amqp_0_10_session_method;
4008                 break;
4009             case AMQP_0_10_CLASS_EXECUTION:
4010                 class_hf = hf_amqp_0_10_execution_method;
4011                 break;
4012             case AMQP_0_10_CLASS_MESSAGE:
4013                 class_hf = hf_amqp_0_10_message_method;
4014                 break;
4015             case AMQP_0_10_CLASS_TX:
4016                 class_hf = hf_amqp_0_10_tx_method;
4017                 break;
4018             case AMQP_0_10_CLASS_DTX:
4019                 class_hf = hf_amqp_0_10_dtx_method;
4020                 break;
4021             case AMQP_0_10_CLASS_EXCHANGE:
4022                 class_hf = hf_amqp_0_10_exchange_method;
4023                 break;
4024             case AMQP_0_10_CLASS_QUEUE:
4025                 class_hf = hf_amqp_0_10_queue_method;
4026                 break;
4027             case AMQP_0_10_CLASS_FILE:
4028                 class_hf = hf_amqp_0_10_file_method;
4029                 break;
4030             case AMQP_0_10_CLASS_STREAM:
4031                 class_hf = hf_amqp_0_10_stream_method;
4032                 break;
4033             default:
4034                 class_hf = -1;
4035                 break;
4036             }
4037             if (class_hf != -1)
4038                 proto_tree_add_item(args_tree, class_hf,
4039                                     tvb, offset, 1, ENC_BIG_ENDIAN);
4040             else
4041                 expert_add_info_format(pinfo, args_tree, &ei_amqp_invalid_class_code, "Invalid class code %x", amqp_class);
4042             AMQP_INCREMENT(offset, 1, length);
4043         }
4044         if (flag1 & 0x10) {
4045             /*  field-index (uint8) */
4046             proto_tree_add_item(args_tree, hf_amqp_0_10_method_execution_field_index,
4047                                 tvb, offset, 1, ENC_BIG_ENDIAN);
4048             AMQP_INCREMENT(offset, 1, length);
4049         }
4050         if (flag1 & 0x20) {
4051             /*  description (str16) */
4052             size = tvb_get_ntohs(tvb, offset);
4053             if ((offset + 2 + size) > length)
4054                 THROW(ReportedBoundsError);
4055             proto_tree_add_item(args_tree, hf_amqp_0_10_method_execution_description,
4056                                 tvb, offset + 2, size, ENC_ASCII|ENC_NA);
4057             AMQP_INCREMENT(offset, (2 + size), length);
4058         }
4059         if (flag1 & 0x40) {
4060             /*  error-info (map) */
4061             struct_size = tvb_get_ntohl(tvb, offset);
4062             AMQP_INCREMENT(offset, 4, length);
4063             ti = proto_tree_add_item(args_tree,
4064                                      hf_amqp_0_10_method_execution_error_info,
4065                                      tvb,
4066                                      offset,
4067                                      struct_size, ENC_NA);
4068             dissect_amqp_0_10_map (tvb,
4069                                    offset,
4070                                    offset + struct_size,
4071                                    struct_size,
4072                                    ti);
4073             AMQP_INCREMENT(offset, struct_size, length);
4074         }
4075         break;
4076     }
4077 }
4078
4079 static void
4080 dissect_amqp_0_10_message(tvbuff_t *tvb,
4081                           packet_info *pinfo,
4082                           proto_tree *tree,
4083                           int offset, guint16 length)
4084 {
4085     proto_item  *args_tree;
4086     proto_item  *ti;
4087     proto_item  *flags_item;
4088     guint8       method, str_size;
4089     guint8       flag1, flag2;
4090     guint16      size;
4091     guint32      map_size;
4092     int          flags_offset;
4093     const gchar *method_name;
4094
4095     method = tvb_get_guint8(tvb, offset+1);
4096     method_name = val_to_str_const(method, amqp_0_10_message_methods,
4097                                    "<invalid message method>");
4098     col_append_str(pinfo->cinfo, COL_INFO, method_name);
4099     col_append_str(pinfo->cinfo, COL_INFO, " ");
4100     col_set_fence(pinfo->cinfo, COL_INFO);
4101
4102     proto_tree_add_item(tree, hf_amqp_0_10_message_method,
4103                         tvb, offset+1, 1, ENC_BIG_ENDIAN);
4104     AMQP_INCREMENT(offset, 2, length);
4105     /*
4106      * Session header is 2 bytes; one that tells that it's 1 byte long, then
4107      * the byte itself. Bit 0 is sync.
4108      */
4109     flag1 = tvb_get_guint8(tvb, offset);
4110     flag2 = tvb_get_guint8(tvb, offset+1);
4111     if ((flag1 != 1) || ((flag2 & 0xfe) != 0))
4112         proto_tree_add_text(tree, tvb, offset, 2, "Invalid session header");
4113     else
4114         proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync,
4115                             tvb, offset + 1, 1, ENC_BIG_ENDIAN);
4116     AMQP_INCREMENT(offset, 2, length);
4117
4118     ti = proto_tree_add_item(tree, hf_amqp_method_arguments,
4119                              tvb, offset, length - 4, ENC_NA);
4120     args_tree = proto_item_add_subtree(ti, ett_args);
4121     /*
4122      * The flag bits are a simple bit string, not a net-byte-order
4123      * field. tvb_get_bits16() doesn't know how to do little-endian
4124      * at this time, so just pick out two bytes.
4125      */
4126     flags_offset = offset;
4127     flag1 = tvb_get_guint8(tvb, offset);
4128     flag2 = tvb_get_guint8(tvb, offset+1);
4129     flags_item = proto_tree_add_item(args_tree,
4130                                      hf_amqp_0_10_argument_packing_flags,
4131                                      tvb, offset, 2, ENC_BIG_ENDIAN);
4132     AMQP_INCREMENT(offset, 2, length);
4133     switch (method) {
4134     case AMQP_0_10_METHOD_MESSAGE_TRANSFER:
4135         if ((flag1 & ~0x07) || (flag2 != 0))
4136             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
4137         if (flag1 & 0x01) {     /* destination (str8) */
4138             str_size = tvb_get_guint8(tvb, offset);
4139             if ((offset + 1 + str_size) > length)
4140                 THROW(ReportedBoundsError);
4141             proto_tree_add_item(args_tree,
4142                                 hf_amqp_0_10_method_message_transfer_destination,
4143                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4144             AMQP_INCREMENT(offset, (1 + str_size), length);
4145         }
4146         if (flag1 & 0x02) {     /* accept-mode (accept-mode [uint8]) */
4147             proto_tree_add_item(args_tree,
4148                                 hf_amqp_0_10_method_message_transfer_accept_mode,
4149                                 tvb, offset, 1, ENC_BIG_ENDIAN);
4150             AMQP_INCREMENT(offset, 1, length);
4151         }
4152         if (flag1 & 0x04) {     /* acquire-mode (acquire-mode [uint8]) */
4153             proto_tree_add_item(args_tree,
4154                                 hf_amqp_0_10_method_message_transfer_acquire_mode,
4155                                 tvb, offset, 1, ENC_BIG_ENDIAN);
4156             AMQP_INCREMENT(offset, 1, length);
4157         }
4158         break;
4159
4160     case AMQP_0_10_METHOD_MESSAGE_ACCEPT:
4161         if ((flag1 & ~0x01) || (flag2 != 0))
4162             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
4163         if (flag1 & 0x01) {
4164             /*  transfers (session.commands [sequence-set])  */
4165             size = tvb_get_ntohs(tvb, offset);
4166             if ((offset + 2 + size) > length)
4167                 THROW(ReportedBoundsError);
4168             ti = proto_tree_add_item(args_tree,
4169                                      hf_amqp_0_10_method_message_accept_transfers,
4170                                      tvb, offset, size + 2, ENC_NA);
4171             AMQP_INCREMENT(offset, 2, length);
4172             format_amqp_0_10_sequence_set(tvb, offset, size, ti);
4173             AMQP_INCREMENT(offset, size, length);
4174         }
4175         break;
4176
4177     case AMQP_0_10_METHOD_MESSAGE_REJECT:
4178         if ((flag1 & ~0x07) || (flag2 != 0))
4179             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
4180         if (flag1 & 0x01) {
4181             /*  transfers (session.commands [sequence-set])  */
4182             size = tvb_get_ntohs(tvb, offset);
4183             THROW_ON(((offset + 2 + size) > length), ReportedBoundsError);
4184             ti = proto_tree_add_item(args_tree,
4185                                      hf_amqp_0_10_method_message_accept_transfers,
4186                                      tvb, offset, size + 2, ENC_NA);
4187             AMQP_INCREMENT(offset, 2, length);
4188             format_amqp_0_10_sequence_set(tvb, offset, size, ti);
4189             AMQP_INCREMENT(offset, size, length);
4190         }
4191         if (flag1 & 0x02) {     /* reject-code (reject-code [uint16]) */
4192             proto_tree_add_item(args_tree,
4193                                 hf_amqp_0_10_method_message_transfer_reject_code,
4194                                 tvb, offset, 2, ENC_BIG_ENDIAN);
4195             AMQP_INCREMENT(offset, 2, length);
4196         }
4197         if (flag1 & 0x04) {     /* text (str8) */
4198             str_size = tvb_get_guint8(tvb, offset);
4199             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
4200             proto_tree_add_item(args_tree,
4201                                 hf_amqp_0_10_method_message_reject_text,
4202                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4203             AMQP_INCREMENT(offset, (1 + str_size), length);
4204         }
4205         break;
4206
4207     case AMQP_0_10_METHOD_MESSAGE_RELEASE:
4208         if ((flag1 & ~0x03) || (flag2 != 0))
4209             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
4210         if (flag1 & 0x01) {
4211             /*  transfers (session.commands [sequence-set])  */
4212             size = tvb_get_ntohs(tvb, offset);
4213             THROW_ON(((offset + 2 + size) > length), ReportedBoundsError);
4214             proto_tree_add_item(args_tree,
4215                                 hf_amqp_0_10_method_message_accept_transfers,
4216                                 tvb, offset, size + 2, ENC_NA);
4217             AMQP_INCREMENT(offset, 2, length);
4218             format_amqp_0_10_sequence_set(tvb, offset, size, ti);
4219             AMQP_INCREMENT(offset, size, length);
4220         }
4221         /*
4222          * 2nd argument is an optional bit, set-redelivered.
4223          */
4224         proto_tree_add_item(args_tree,
4225                             hf_amqp_0_10_method_message_release_set_redelivered,
4226                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
4227         break;
4228
4229     case AMQP_0_10_METHOD_MESSAGE_ACQUIRE:
4230         if ((flag1 & ~0x01) || (flag2 != 0))
4231             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
4232         if (flag1 & 0x01) {
4233             /*  transfers (session.commands [sequence-set])  */
4234             size = tvb_get_ntohs(tvb, offset);
4235             THROW_ON(((offset + 2 + size) > length), ReportedBoundsError);
4236             proto_tree_add_item(args_tree,
4237                                 hf_amqp_0_10_method_message_accept_transfers,
4238                                 tvb, offset, size + 2, ENC_NA);
4239             AMQP_INCREMENT(offset, 2, length);
4240             format_amqp_0_10_sequence_set(tvb, offset, size, ti);
4241             AMQP_INCREMENT(offset, size, length);
4242         }
4243         break;
4244
4245     case AMQP_0_10_METHOD_MESSAGE_RESUME:
4246         if ((flag1 & ~0x03) || (flag2 != 0))
4247             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
4248         if (flag1 & 0x01) {
4249             /*  destination (destination [str8]) */
4250             str_size = tvb_get_guint8(tvb, offset);
4251             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
4252             proto_tree_add_item(args_tree,
4253                                 hf_amqp_0_10_method_message_dest,
4254                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4255             AMQP_INCREMENT(offset, 1 + str_size, length);
4256         }
4257         if (flag1 & 0x02) {
4258             /*  resume-id (resume-id [str16]) */
4259             size = tvb_get_ntohs(tvb, offset);
4260             THROW_ON(((offset + 2 + size) > length), ReportedBoundsError);
4261             proto_tree_add_item(args_tree,
4262                                 hf_amqp_0_10_method_message_resume_id,
4263                                 tvb, offset + 2, size, ENC_ASCII|ENC_NA);
4264             AMQP_INCREMENT(offset, 2 + size, length);
4265         }
4266         break;
4267
4268     case AMQP_0_10_METHOD_MESSAGE_SUBSCRIBE:
4269         if (flag2 != 0)
4270             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
4271         if (flag1 & 0x01) {
4272             /*  queue (queue.name [str8]) */
4273             str_size = tvb_get_guint8(tvb, offset);
4274             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
4275             proto_tree_add_item(args_tree,
4276                                 hf_amqp_0_10_method_message_subscribe_queue,
4277                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4278             AMQP_INCREMENT(offset, 1 + str_size, length);
4279         }
4280         if (flag1 & 0x02) {
4281             /*  destination (destination [str8]) */
4282             str_size = tvb_get_guint8(tvb, offset);
4283             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
4284             proto_tree_add_item(args_tree,
4285                                 hf_amqp_0_10_method_message_dest,
4286                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4287             AMQP_INCREMENT(offset, 1 + str_size, length);
4288         }
4289         if (flag1 & 0x04) {     /* accept-mode (accept-mode [uint8]) */
4290             proto_tree_add_item(args_tree,
4291                                 hf_amqp_0_10_method_message_transfer_accept_mode,
4292                                 tvb, offset, 1, ENC_BIG_ENDIAN);
4293             AMQP_INCREMENT(offset, 1, length);
4294         }
4295         if (flag1 & 0x08) {     /* acquire-mode (acquire-mode [uint8]) */
4296             proto_tree_add_item(args_tree,
4297                                 hf_amqp_0_10_method_message_transfer_acquire_mode,
4298                                 tvb, offset, 1, ENC_BIG_ENDIAN);
4299             AMQP_INCREMENT(offset, 1, length);
4300         }
4301         /*
4302          * 5th argument is an optional bit, exclusive.
4303          */
4304         proto_tree_add_item(args_tree,
4305                             hf_amqp_0_10_method_message_subscribe_exclusive,
4306                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
4307         if (flag1 & 0x20) {
4308             /*  resume-id (resume-id [str16]) */
4309             size = tvb_get_ntohs(tvb, offset);
4310             THROW_ON(((offset + 2 + size) > length), ReportedBoundsError);
4311             proto_tree_add_item(args_tree,
4312                                 hf_amqp_0_10_method_message_resume_id,
4313                                 tvb, offset, 2 + size, ENC_ASCII|ENC_NA);
4314             AMQP_INCREMENT(offset, 2 + size, length);
4315         }
4316         if (flag1 & 0x40) {
4317             /*  resume-ttl (uint64) */
4318             proto_tree_add_item(args_tree,
4319                                 hf_amqp_0_10_method_message_subscribe_resume_ttl,
4320                                 tvb, offset, 8, ENC_BIG_ENDIAN);
4321             AMQP_INCREMENT(offset, 8, length);
4322         }
4323         if (flag1 & 0x80) {
4324             /*  arguments (map) */
4325             map_size = tvb_get_ntohl(tvb, offset);
4326             THROW_ON(((offset + 4 + map_size) > length), ReportedBoundsError);
4327             ti = proto_tree_add_item(args_tree,
4328                                      hf_amqp_0_10_method_message_subscribe_args,
4329                                      tvb,
4330                                      offset,
4331                                      4 + map_size, ENC_NA);
4332             dissect_amqp_0_10_map (tvb,
4333                                    offset + 4,
4334                                    offset + 4 + map_size,
4335                                    map_size,
4336                                    ti);
4337             AMQP_INCREMENT(offset, 4 + map_size, length);
4338         }
4339         break;
4340
4341     case AMQP_0_10_METHOD_MESSAGE_CANCEL:
4342         if ((flag1 & ~0x01) || (flag2 != 0))
4343             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
4344         if (flag1 & 0x01) {
4345             /*  destination (destination [str8]) */
4346             str_size = tvb_get_guint8(tvb, offset);
4347             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
4348             proto_tree_add_item(args_tree,
4349                                 hf_amqp_0_10_method_message_dest,
4350                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4351             AMQP_INCREMENT(offset, 1 + str_size, length);
4352         }
4353         break;
4354
4355     case AMQP_0_10_METHOD_MESSAGE_SET_FLOW_MODE:
4356         if ((flag1 & ~0x03) || (flag2 != 0))
4357             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
4358         if (flag1 & 0x01) {
4359             /*  destination (destination [str8]) */
4360             str_size = tvb_get_guint8(tvb, offset);
4361             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
4362             proto_tree_add_item(args_tree,
4363                                 hf_amqp_0_10_method_message_dest,
4364                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4365             AMQP_INCREMENT(offset, 1 + str_size, length);
4366         }
4367         if (flag1 & 0x02) {
4368             /*  flow-mode (flow-mode [uint8]) */
4369             proto_tree_add_item(args_tree,
4370                                 hf_amqp_0_10_method_message_flow_mode,
4371                                 tvb, offset, 1, ENC_BIG_ENDIAN);
4372             AMQP_INCREMENT(offset, 1, length);
4373         }
4374         break;
4375
4376     case AMQP_0_10_METHOD_MESSAGE_FLOW:
4377         if ((flag1 & ~0x07) || (flag2 != 0))
4378             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
4379         if (flag1 & 0x01) {
4380             /*  destination (destination [str8]) */
4381             str_size = tvb_get_guint8(tvb, offset);
4382             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
4383             proto_tree_add_item(args_tree,
4384                                 hf_amqp_0_10_method_message_dest,
4385                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4386             AMQP_INCREMENT(offset, 1 + str_size, length);
4387         }
4388         if (flag1 & 0x02) {
4389             /*  unit (credit-unit [uint8]) */
4390             proto_tree_add_item(args_tree,
4391                                 hf_amqp_0_10_method_message_credit_unit,
4392                                 tvb, offset, 1, ENC_BIG_ENDIAN);
4393             AMQP_INCREMENT(offset, 1, length);
4394         }
4395         if (flag1 & 0x04) {
4396             /*  value (uint32) */
4397             proto_tree_add_item(args_tree,
4398                                 hf_amqp_0_10_method_message_credit_value,
4399                                 tvb, offset, 4, ENC_BIG_ENDIAN);
4400             AMQP_INCREMENT(offset, 4, length);
4401         }
4402         break;
4403
4404     case AMQP_0_10_METHOD_MESSAGE_FLUSH:
4405         if ((flag1 & ~0x01) || (flag2 != 0))
4406             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
4407         if (flag1 & 0x01) {
4408             /*  destination (destination [str8]) */
4409             str_size = tvb_get_guint8(tvb, offset);
4410             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
4411             proto_tree_add_item(args_tree,
4412                                 hf_amqp_0_10_method_message_dest,
4413                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4414             AMQP_INCREMENT(offset, 1 + str_size, length);
4415         }
4416         break;
4417
4418     case AMQP_0_10_METHOD_MESSAGE_STOP:
4419         if ((flag1 & ~0x01) || (flag2 != 0))
4420             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
4421         if (flag1 & 0x01) {
4422             /*  destination (destination [str8]) */
4423             str_size = tvb_get_guint8(tvb, offset);
4424             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
4425             proto_tree_add_item(args_tree,
4426                                 hf_amqp_0_10_method_message_dest,
4427                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4428             AMQP_INCREMENT(offset, 1 + str_size, length);
4429         }
4430         break;
4431     }
4432 }
4433
4434 static void
4435 dissect_amqp_0_10_tx(tvbuff_t *tvb,
4436                      packet_info *pinfo,
4437                      proto_tree *tree,
4438                      int offset, guint16 length)
4439 {
4440     guint8       method;
4441     guint8       flag1, flag2;
4442     const gchar *method_name;
4443
4444     method = tvb_get_guint8(tvb, offset+1);
4445     method_name = val_to_str_const(method, amqp_0_10_tx_methods,
4446                                    "<invalid tx method>");
4447     col_append_str(pinfo->cinfo, COL_INFO, method_name);
4448     col_append_str(pinfo->cinfo, COL_INFO, " ");
4449     col_set_fence(pinfo->cinfo, COL_INFO);
4450
4451     proto_tree_add_item(tree, hf_amqp_0_10_tx_method,
4452                         tvb, offset+1, 1, ENC_BIG_ENDIAN);
4453     AMQP_INCREMENT(offset, 2, length);
4454     /*
4455      * Session header is 2 bytes; one that tells that it's 1 byte long, then
4456      * the byte itself. Bit 0 is sync.
4457      */
4458     flag1 = tvb_get_guint8(tvb, offset);
4459     flag2 = tvb_get_guint8(tvb, offset+1);
4460     if ((flag1 != 1) || ((flag2 & 0xfe) != 0))
4461         proto_tree_add_text(tree, tvb, offset, 2, "Invalid session header");
4462     else
4463         proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync,
4464                             tvb, offset + 1, 1, ENC_BIG_ENDIAN);
4465     AMQP_INCREMENT(offset, 2, length);
4466
4467     /* No args on any method in this class */
4468 }
4469
4470 static void
4471 dissect_amqp_0_10_dtx(tvbuff_t *tvb,
4472                       packet_info *pinfo,
4473                       proto_tree *tree,
4474                       int offset, guint16 length)
4475 {
4476     proto_item  *args_tree;
4477     proto_item  *ti;
4478     proto_item  *flags_item;
4479     guint8       method;
4480     guint8       flag1, flag2;
4481     guint16      xid_length;
4482     int          flags_offset;
4483     const gchar *method_name;
4484
4485     method = tvb_get_guint8(tvb, offset+1);
4486     method_name = val_to_str_const(method, amqp_0_10_dtx_methods,
4487                                    "<invalid dtx method>");
4488     col_append_str(pinfo->cinfo, COL_INFO, method_name);
4489     col_append_str(pinfo->cinfo, COL_INFO, " ");
4490     col_set_fence(pinfo->cinfo, COL_INFO);
4491
4492     proto_tree_add_item(tree, hf_amqp_0_10_dtx_method,
4493                         tvb, offset+1, 1, ENC_BIG_ENDIAN);
4494     AMQP_INCREMENT(offset, 2, length);
4495     /*
4496      * Session header is 2 bytes; one that tells that it's 1 byte long, then
4497      * the byte itself. Bit 0 is sync.
4498      */
4499     flag1 = tvb_get_guint8(tvb, offset);
4500     flag2 = tvb_get_guint8(tvb, offset+1);
4501     if ((flag1 != 1) || ((flag2 & 0xfe) != 0))
4502         proto_tree_add_text(tree, tvb, offset, 2, "Invalid session header");
4503     else
4504         proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync,
4505                             tvb, offset + 1, 1, ENC_BIG_ENDIAN);
4506     AMQP_INCREMENT(offset, 2, length);
4507
4508     /* No args for dtx.select or dtx.recover */
4509     if ((method == AMQP_0_10_METHOD_DTX_SELECT) ||
4510         (method == AMQP_0_10_METHOD_DTX_RECOVER))
4511         return;
4512
4513     ti = proto_tree_add_item(tree, hf_amqp_method_arguments,
4514                              tvb, offset, length - 4, ENC_NA);
4515     args_tree = proto_item_add_subtree(ti, ett_args);
4516
4517     /*
4518      * The flag bits are a simple bit string, not a net-byte-order
4519      * field. tvb_get_bits16() doesn't know how to do little-endian
4520      * at this time, so just pick out two bytes.
4521      */
4522     flags_offset = offset;
4523     flag1 = tvb_get_guint8(tvb, offset);
4524     flag2 = tvb_get_guint8(tvb, offset+1);
4525     flags_item = proto_tree_add_item(args_tree,
4526                                      hf_amqp_0_10_argument_packing_flags,
4527                                      tvb, offset, 2, ENC_BIG_ENDIAN);
4528     AMQP_INCREMENT(offset, 2, length);
4529     switch (method) {
4530     case AMQP_0_10_METHOD_DTX_START:
4531         if ((flag1 & ~0x07) || (flag2 != 0))
4532             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
4533         if (flag1 & 0x01) {     /* xid (xid) */
4534             xid_length = tvb_get_ntohs(tvb, offset);
4535             AMQP_INCREMENT(offset, 2, length);
4536             THROW_ON(((offset + xid_length) > length), ReportedBoundsError);
4537             ti = proto_tree_add_item(args_tree,
4538                                      hf_amqp_0_10_dtx_xid,
4539                                      tvb,
4540                                      offset - 2,
4541                                      xid_length + 2, ENC_NA);
4542             dissect_amqp_0_10_xid (tvb,
4543                                    offset,
4544                                    xid_length,
4545                                    ti);
4546             AMQP_INCREMENT(offset, xid_length, length);
4547         }
4548         /*
4549          * 2nd, 3rd arguments are optional bits.
4550          */
4551         proto_tree_add_item(args_tree,
4552                             hf_amqp_0_10_method_dtx_start_join,
4553                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
4554         proto_tree_add_item(args_tree,
4555                             hf_amqp_0_10_method_dtx_start_resume,
4556                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
4557
4558         break;
4559
4560     case AMQP_0_10_METHOD_DTX_END:
4561         if ((flag1 & ~0x07) || (flag2 != 0))
4562             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
4563         if (flag1 & 0x01) {     /* xid (xid) */
4564             xid_length = tvb_get_ntohs(tvb, offset);
4565             AMQP_INCREMENT(offset, 2, length);
4566             THROW_ON(((offset + xid_length) > length), ReportedBoundsError);
4567             ti = proto_tree_add_item(args_tree,
4568                                      hf_amqp_0_10_dtx_xid,
4569                                      tvb,
4570                                      offset - 2,
4571                                      xid_length + 2, ENC_NA);
4572             dissect_amqp_0_10_xid (tvb,
4573                                    offset,
4574                                    xid_length,
4575                                    ti);
4576             AMQP_INCREMENT(offset, xid_length, length);
4577         }
4578         /*
4579          * 2nd, 3rd arguments are optional bits.
4580          */
4581         proto_tree_add_item(args_tree,
4582                             hf_amqp_0_10_method_dtx_end_fail,
4583                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
4584         proto_tree_add_item(args_tree,
4585                             hf_amqp_0_10_method_dtx_end_suspend,
4586                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
4587         break;
4588
4589     case AMQP_0_10_METHOD_DTX_COMMIT:
4590         if ((flag1 & ~0x03) || (flag2 != 0))
4591             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
4592         if (flag1 & 0x01) {     /* xid (xid) */
4593             xid_length = tvb_get_ntohs(tvb, offset);
4594             AMQP_INCREMENT(offset, 2, length);
4595             THROW_ON(((offset + xid_length) > length), ReportedBoundsError);
4596             ti = proto_tree_add_item(args_tree,
4597                                      hf_amqp_0_10_dtx_xid,
4598                                      tvb,
4599                                      offset - 2,
4600                                      xid_length + 2, ENC_NA);
4601             dissect_amqp_0_10_xid (tvb,
4602                                    offset,
4603                                    xid_length,
4604                                    ti);
4605             AMQP_INCREMENT(offset, xid_length, length);
4606         }
4607         /*
4608          * 2nd argument is an optional bit.
4609          */
4610         proto_tree_add_item(args_tree,
4611                             hf_amqp_0_10_method_dtx_commit_one_phase,
4612                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
4613         break;
4614
4615     case AMQP_0_10_METHOD_DTX_FORGET:
4616     case AMQP_0_10_METHOD_DTX_GET_TIMEOUT:
4617     case AMQP_0_10_METHOD_DTX_PREPARE:
4618     case AMQP_0_10_METHOD_DTX_ROLLBACK:
4619         if ((flag1 & ~0x01) || (flag2 != 0))
4620             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
4621         if (flag1 & 0x01) {     /* xid (xid) */
4622             xid_length = tvb_get_ntohs(tvb, offset);
4623             AMQP_INCREMENT(offset, 2, length);
4624             THROW_ON(((offset + xid_length) > length), ReportedBoundsError);
4625             ti = proto_tree_add_item(args_tree,
4626                                      hf_amqp_0_10_dtx_xid,
4627                                      tvb,
4628                                      offset - 2,
4629                                      xid_length + 2, ENC_NA);
4630             dissect_amqp_0_10_xid (tvb,
4631                                    offset,
4632                                    xid_length,
4633                                    ti);
4634             AMQP_INCREMENT(offset, xid_length, length);
4635         }
4636         break;
4637
4638     case AMQP_0_10_METHOD_DTX_SET_TIMEOUT:
4639         if ((flag1 & ~0x03) || (flag2 != 0))
4640             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
4641         if (flag1 & 0x01) {     /* xid (xid) */
4642             xid_length = tvb_get_ntohs(tvb, offset);
4643             AMQP_INCREMENT(offset, 2, length);
4644             THROW_ON(((offset + xid_length) > length), ReportedBoundsError);
4645             ti = proto_tree_add_item(args_tree,
4646                                      hf_amqp_0_10_dtx_xid,
4647                                      tvb,
4648                                      offset - 2,
4649                                      xid_length + 2, ENC_NA);
4650             dissect_amqp_0_10_xid (tvb,
4651                                    offset,
4652                                    xid_length,
4653                                    ti);
4654             AMQP_INCREMENT(offset, xid_length, length);
4655         }
4656         if (flag1 & 0x02) {    /* timeout (uint32) */
4657             proto_tree_add_item(args_tree,
4658                                 hf_amqp_0_10_method_dtx_set_timeout_timeout,
4659                                 tvb, offset, 4, ENC_BIG_ENDIAN);
4660             AMQP_INCREMENT(offset, 4, length);
4661         }
4662         break;
4663
4664     }
4665 }
4666
4667 static void
4668 dissect_amqp_0_10_exchange(tvbuff_t *tvb,
4669                            packet_info *pinfo,
4670                            proto_tree *tree,
4671                            int offset, guint16 length)
4672 {
4673     proto_item  *args_tree;
4674     proto_item  *ti;
4675     proto_item  *flags_item;
4676     guint8       method;
4677     guint8       flag1, flag2;
4678     guint8       str_size;
4679     guint32      map_length;
4680     int          flags_offset;
4681     const gchar *method_name;
4682
4683     method = tvb_get_guint8(tvb, offset+1);
4684     method_name = val_to_str_const(method, amqp_0_10_exchange_methods,
4685                                    "<invalid exchange method>");
4686     col_append_str(pinfo->cinfo, COL_INFO, method_name);
4687     col_append_str(pinfo->cinfo, COL_INFO, " ");
4688     col_set_fence(pinfo->cinfo, COL_INFO);
4689
4690     proto_tree_add_item(tree, hf_amqp_0_10_exchange_method,
4691                         tvb, offset+1, 1, ENC_BIG_ENDIAN);
4692     AMQP_INCREMENT(offset, 2, length);
4693     /*
4694      * Session header is 2 bytes; one that tells that it's 1 byte long, then
4695      * the byte itself. Bit 0 is sync.
4696      */
4697     flag1 = tvb_get_guint8(tvb, offset);
4698     flag2 = tvb_get_guint8(tvb, offset+1);
4699     if ((flag1 != 1) || ((flag2 & 0xfe) != 0))
4700         proto_tree_add_text(tree, tvb, offset, 2, "Invalid session header");
4701     else
4702         proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync,
4703                             tvb, offset + 1, 1, ENC_BIG_ENDIAN);
4704     AMQP_INCREMENT(offset, 2, length);
4705
4706     ti = proto_tree_add_item(tree, hf_amqp_method_arguments,
4707                              tvb, offset, length - 4, ENC_NA);
4708     args_tree = proto_item_add_subtree(ti, ett_args);
4709
4710     /*
4711      * The flag bits are a simple bit string, not a net-byte-order
4712      * field. tvb_get_bits16() doesn't know how to do little-endian
4713      * at this time, so just pick out two bytes.
4714      */
4715     flags_offset = offset;
4716     flag1 = tvb_get_guint8(tvb, offset);
4717     flag2 = tvb_get_guint8(tvb, offset+1);
4718     flags_item = proto_tree_add_item(args_tree,
4719                                      hf_amqp_0_10_argument_packing_flags,
4720                                      tvb, offset, 2, ENC_BIG_ENDIAN);
4721     AMQP_INCREMENT(offset, 2, length);
4722     switch (method) {
4723     case AMQP_0_10_METHOD_EXCHANGE_DECLARE:
4724         if ((flag1 & ~0x7f) || (flag2 != 0))
4725             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
4726         if (flag1 & 0x01) {     /* exchange (name [str8]) */
4727             str_size = tvb_get_guint8(tvb, offset);
4728             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
4729             proto_tree_add_item(args_tree,
4730                                 hf_amqp_0_10_method_exchange_declare_exchange,
4731                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4732             AMQP_INCREMENT(offset, (1 + str_size), length);
4733         }
4734         if (flag1 & 0x02) {     /* type (str8) */
4735             str_size = tvb_get_guint8(tvb, offset);
4736             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
4737             proto_tree_add_item(args_tree,
4738                                 hf_amqp_0_10_method_exchange_declare_type,
4739                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4740             AMQP_INCREMENT(offset, (1 + str_size), length);
4741         }
4742         if (flag1 & 0x04) {     /* alternate-exchange (name [str8]) */
4743             str_size = tvb_get_guint8(tvb, offset);
4744             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
4745             proto_tree_add_item(args_tree,
4746                                 hf_amqp_0_10_method_exchange_declare_alt_exchange,
4747                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4748             AMQP_INCREMENT(offset, (1 + str_size), length);
4749         }
4750         /*
4751          * 4th-6th arguments are optional bits.
4752          */
4753         proto_tree_add_item(args_tree,
4754                             hf_amqp_0_10_method_exchange_declare_passive,
4755                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
4756         proto_tree_add_item(args_tree,
4757                             hf_amqp_0_10_method_exchange_declare_durable,
4758                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
4759         proto_tree_add_item(args_tree,
4760                             hf_amqp_0_10_method_exchange_declare_auto_delete,
4761                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
4762         if (flag1 & 0x40) {     /* arguments (map) */
4763             map_length = tvb_get_ntohl(tvb, offset);
4764             AMQP_INCREMENT(offset, 4, length);
4765             THROW_ON(((offset + map_length) > length), ReportedBoundsError);
4766             ti = proto_tree_add_item(args_tree,
4767                                      hf_amqp_0_10_method_exchange_declare_arguments,
4768                                      tvb,
4769                                      offset - 4,
4770                                      map_length + 4, ENC_NA);
4771             dissect_amqp_0_10_map (tvb,
4772                                    offset,
4773                                    offset + map_length,
4774                                    map_length,
4775                                    ti);
4776             AMQP_INCREMENT(offset, map_length, length);
4777         }
4778         break;
4779
4780     case AMQP_0_10_METHOD_EXCHANGE_DELETE:
4781         if ((flag1 & ~0x03) || (flag2 != 0))
4782             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
4783         if (flag1 & 0x01) {     /* exchange (name [str8]) */
4784             str_size = tvb_get_guint8(tvb, offset);
4785             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
4786             proto_tree_add_item(args_tree,
4787                                 hf_amqp_0_10_method_exchange_declare_exchange,
4788                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4789             AMQP_INCREMENT(offset, (1 + str_size), length);
4790         }
4791         /*
4792          * 2nd argument is an optional bit.
4793          */
4794         proto_tree_add_item(args_tree,
4795                             hf_amqp_0_10_method_exchange_delete_if_unused,
4796                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
4797         break;
4798
4799     case AMQP_0_10_METHOD_EXCHANGE_QUERY:
4800         if ((flag1 & ~0x01) || (flag2 != 0))
4801             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
4802         if (flag1 & 0x01) {     /* exchange (name [str8]) */
4803             str_size = tvb_get_guint8(tvb, offset);
4804             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
4805             proto_tree_add_item(args_tree,
4806                                 hf_amqp_0_10_method_exchange_declare_exchange,
4807                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4808             AMQP_INCREMENT(offset, (1 + str_size), length);
4809         }
4810         break;
4811
4812     case AMQP_0_10_METHOD_EXCHANGE_BIND:
4813         if ((flag1 & ~0x0f) || (flag2 != 0))
4814             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
4815         if (flag1 & 0x01) {     /* queue (queue.name [str8]) */
4816             str_size = tvb_get_guint8(tvb, offset);
4817             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
4818             proto_tree_add_item(args_tree,
4819                                 hf_amqp_0_10_method_exchange_bind_queue,
4820                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4821             AMQP_INCREMENT(offset, (1 + str_size), length);
4822         }
4823         if (flag1 & 0x02) {     /* exchange (name [str8]) */
4824             str_size = tvb_get_guint8(tvb, offset);
4825             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
4826             proto_tree_add_item(args_tree,
4827                                 hf_amqp_0_10_method_exchange_declare_exchange,
4828                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4829             AMQP_INCREMENT(offset, (1 + str_size), length);
4830         }
4831         if (flag1 & 0x04) {     /* binding-key (str8) */
4832             str_size = tvb_get_guint8(tvb, offset);
4833             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
4834             proto_tree_add_item(args_tree,
4835                                 hf_amqp_0_10_method_exchange_binding_key,
4836                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4837             AMQP_INCREMENT(offset, (1 + str_size), length);
4838         }
4839         if (flag1 & 0x08) {     /* arguments (map) */
4840             map_length = tvb_get_ntohl(tvb, offset);
4841             AMQP_INCREMENT(offset, 4, length);
4842             THROW_ON(((offset + map_length) > length), ReportedBoundsError);
4843             ti = proto_tree_add_item(args_tree,
4844                                      hf_amqp_0_10_method_exchange_declare_arguments,
4845                                      tvb,
4846                                      offset - 4,
4847                                      map_length + 4, ENC_NA);
4848             dissect_amqp_0_10_map (tvb,
4849                                    offset,
4850                                    offset + map_length,
4851                                    map_length,
4852                                    ti);
4853             AMQP_INCREMENT(offset, map_length, length);
4854         }
4855         break;
4856
4857     case AMQP_0_10_METHOD_EXCHANGE_UNBIND:
4858         if ((flag1 & ~0x07) || (flag2 != 0))
4859             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
4860         if (flag1 & 0x01) {     /* queue (queue.name [str8]) */
4861             str_size = tvb_get_guint8(tvb, offset);
4862             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
4863             proto_tree_add_item(args_tree,
4864                                 hf_amqp_0_10_method_exchange_bind_queue,
4865                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4866             AMQP_INCREMENT(offset, (1 + str_size), length);
4867         }
4868         if (flag1 & 0x02) {     /* exchange (name [str8]) */
4869             str_size = tvb_get_guint8(tvb, offset);
4870             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
4871             proto_tree_add_item(args_tree,
4872                                 hf_amqp_0_10_method_exchange_declare_exchange,
4873                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4874             AMQP_INCREMENT(offset, (1 + str_size), length);
4875         }
4876         if (flag1 & 0x04) {     /* binding-key (str8) */
4877             str_size = tvb_get_guint8(tvb, offset);
4878             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
4879             proto_tree_add_item(args_tree,
4880                                 hf_amqp_0_10_method_exchange_binding_key,
4881                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4882             AMQP_INCREMENT(offset, (1 + str_size), length);
4883         }
4884         break;
4885
4886     case AMQP_0_10_METHOD_EXCHANGE_BOUND:
4887         if ((flag1 & ~0x0f) || (flag2 != 0))
4888             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
4889         if (flag1 & 0x01) {     /* exchange (name [str8]) */
4890             str_size = tvb_get_guint8(tvb, offset);
4891             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
4892             proto_tree_add_item(args_tree,
4893                                 hf_amqp_0_10_method_exchange_declare_exchange,
4894                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4895             AMQP_INCREMENT(offset, (1 + str_size), length);
4896         }
4897         if (flag1 & 0x02) {     /* queue (queue.name [str8]) */
4898             str_size = tvb_get_guint8(tvb, offset);
4899             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
4900             proto_tree_add_item(args_tree,
4901                                 hf_amqp_0_10_method_exchange_bind_queue,
4902                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4903             AMQP_INCREMENT(offset, (1 + str_size), length);
4904         }
4905         if (flag1 & 0x04) {     /* binding-key (str8) */
4906             str_size = tvb_get_guint8(tvb, offset);
4907             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
4908             proto_tree_add_item(args_tree,
4909                                 hf_amqp_0_10_method_exchange_binding_key,
4910                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4911             AMQP_INCREMENT(offset, (1 + str_size), length);
4912         }
4913         if (flag1 & 0x08) {     /* arguments (map) */
4914             map_length = tvb_get_ntohl(tvb, offset);
4915             AMQP_INCREMENT(offset, 4, length);
4916             THROW_ON(((offset + map_length) > length), ReportedBoundsError);
4917             ti = proto_tree_add_item(args_tree,
4918                                      hf_amqp_0_10_method_exchange_declare_arguments,
4919                                      tvb,
4920                                      offset - 4,
4921                                      map_length + 4, ENC_NA);
4922             dissect_amqp_0_10_map (tvb,
4923                                    offset,
4924                                    offset + map_length,
4925                                    map_length,
4926                                    ti);
4927             AMQP_INCREMENT(offset, map_length, length);
4928         }
4929         break;
4930     }
4931 }
4932
4933 static void
4934 dissect_amqp_0_10_queue(tvbuff_t *tvb,
4935                         packet_info *pinfo,
4936                         proto_tree *tree,
4937                         int offset, guint16 length)
4938 {
4939     proto_item  *args_tree;
4940     proto_item  *ti;
4941     proto_item  *flags_item;
4942     guint8       method;
4943     guint8       flag1, flag2;
4944     guint8       str_size;
4945     guint32      map_length;
4946     int          flags_offset;
4947     const gchar *method_name;
4948
4949     method = tvb_get_guint8(tvb, offset+1);
4950     method_name = val_to_str_const(method, amqp_0_10_queue_methods,
4951                                    "<invalid queue method>");
4952     col_append_str(pinfo->cinfo, COL_INFO, method_name);
4953     col_append_str(pinfo->cinfo, COL_INFO, " ");
4954     col_set_fence(pinfo->cinfo, COL_INFO);
4955
4956     proto_tree_add_item(tree, hf_amqp_0_10_queue_method,
4957                         tvb, offset+1, 1, ENC_BIG_ENDIAN);
4958     AMQP_INCREMENT(offset, 2, length);
4959     /*
4960      * Session header is 2 bytes; one that tells that it's 1 byte long, then
4961      * the byte itself. Bit 0 is sync.
4962      */
4963     flag1 = tvb_get_guint8(tvb, offset);
4964     flag2 = tvb_get_guint8(tvb, offset+1);
4965     if ((flag1 != 1) || ((flag2 & 0xfe) != 0))
4966         proto_tree_add_text(tree, tvb, offset, 2, "Invalid session header");
4967     else
4968         proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync,
4969                             tvb, offset + 1, 1, ENC_BIG_ENDIAN);
4970     AMQP_INCREMENT(offset, 2, length);
4971
4972     ti = proto_tree_add_item(tree, hf_amqp_method_arguments,
4973                              tvb, offset, length - 4, ENC_NA);
4974     args_tree = proto_item_add_subtree(ti, ett_args);
4975
4976     /*
4977      * The flag bits are a simple bit string, not a net-byte-order
4978      * field. tvb_get_bits16() doesn't know how to do little-endian
4979      * at this time, so just pick out two bytes.
4980      */
4981     flags_offset = offset;
4982     flag1 = tvb_get_guint8(tvb, offset);
4983     flag2 = tvb_get_guint8(tvb, offset+1);
4984     flags_item = proto_tree_add_item(args_tree,
4985                                      hf_amqp_0_10_argument_packing_flags,
4986                                      tvb, offset, 2, ENC_BIG_ENDIAN);
4987     AMQP_INCREMENT(offset, 2, length);
4988     switch (method) {
4989     case AMQP_0_10_METHOD_QUEUE_DECLARE:
4990         if ((flag1 & ~0x7f) || (flag2 != 0))
4991             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
4992         if (flag1 & 0x01) {     /* queue (name [str8]) */
4993             str_size = tvb_get_guint8(tvb, offset);
4994             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
4995             proto_tree_add_item(args_tree,
4996                                 hf_amqp_0_10_method_queue_name,
4997                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
4998             AMQP_INCREMENT(offset, (1 + str_size), length);
4999         }
5000         if (flag1 & 0x02) {     /* alternate-exchange (exchange.name [str8]) */
5001             str_size = tvb_get_guint8(tvb, offset);
5002             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5003             proto_tree_add_item(args_tree,
5004                                 hf_amqp_0_10_method_queue_alt_exchange,
5005                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5006             AMQP_INCREMENT(offset, (1 + str_size), length);
5007         }
5008         /*
5009          * 3rd-6th arguments are optional bits.
5010          */
5011         proto_tree_add_item(args_tree,
5012                             hf_amqp_0_10_method_queue_declare_passive,
5013                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5014         proto_tree_add_item(args_tree,
5015                             hf_amqp_0_10_method_queue_declare_durable,
5016                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5017         proto_tree_add_item(args_tree,
5018                             hf_amqp_0_10_method_queue_declare_exclusive,
5019                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5020         proto_tree_add_item(args_tree,
5021                             hf_amqp_0_10_method_queue_declare_auto_delete,
5022                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5023         if (flag1 & 0x40) {     /* arguments (map) */
5024             map_length = tvb_get_ntohl(tvb, offset);
5025             AMQP_INCREMENT(offset, 4, length);
5026             THROW_ON(((offset + map_length) > length), ReportedBoundsError);
5027             ti = proto_tree_add_item(args_tree,
5028                                      hf_amqp_0_10_method_queue_declare_arguments,
5029                                      tvb,
5030                                      offset - 4,
5031                                      map_length + 4, ENC_NA);
5032             dissect_amqp_0_10_map (tvb,
5033                                    offset,
5034                                    offset + map_length,
5035                                    map_length,
5036                                    ti);
5037             AMQP_INCREMENT(offset, map_length, length);
5038         }
5039         break;
5040
5041     case AMQP_0_10_METHOD_QUEUE_DELETE:
5042         if ((flag1 & ~0x07) || (flag2 != 0))
5043             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
5044         if (flag1 & 0x01) {     /* queue (name [str8]) */
5045             str_size = tvb_get_guint8(tvb, offset);
5046             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5047             proto_tree_add_item(args_tree,
5048                                 hf_amqp_0_10_method_queue_name,
5049                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5050             AMQP_INCREMENT(offset, (1 + str_size), length);
5051         }
5052         /*
5053          * 2nd-3rd arguments are optional bits.
5054          */
5055         proto_tree_add_item(args_tree,
5056                             hf_amqp_0_10_method_queue_delete_if_unused,
5057                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5058         proto_tree_add_item(args_tree,
5059                             hf_amqp_0_10_method_queue_delete_if_empty,
5060                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5061         break;
5062
5063     case AMQP_0_10_METHOD_QUEUE_PURGE:
5064         if ((flag1 & ~0x01) || (flag2 != 0))
5065             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
5066         if (flag1 & 0x01) {     /* queue (name [str8]) */
5067             str_size = tvb_get_guint8(tvb, offset);
5068             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5069             proto_tree_add_item(args_tree,
5070                                 hf_amqp_0_10_method_queue_name,
5071                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5072             AMQP_INCREMENT(offset, (1 + str_size), length);
5073         }
5074         break;
5075
5076     case AMQP_0_10_METHOD_QUEUE_QUERY:
5077         if ((flag1 & ~0x01) || (flag2 != 0))
5078             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
5079         if (flag1 & 0x01) {     /* queue (name [str8]) */
5080             str_size = tvb_get_guint8(tvb, offset);
5081             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5082             proto_tree_add_item(args_tree,
5083                                 hf_amqp_0_10_method_queue_name,
5084                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5085             AMQP_INCREMENT(offset, (1 + str_size), length);
5086         }
5087         break;
5088     }
5089 }
5090
5091 static void
5092 dissect_amqp_0_10_file(tvbuff_t *tvb,
5093                        packet_info *pinfo,
5094                        proto_tree *tree,
5095                        int offset, guint16 length)
5096 {
5097     proto_item  *args_tree;
5098     proto_item  *ti;
5099     proto_item  *flags_item;
5100     guint8       method;
5101     guint8       flag1, flag2;
5102     guint8       str_size;
5103     guint32      map_length;
5104     int          flags_offset;
5105     const gchar *method_name;
5106
5107     method = tvb_get_guint8(tvb, offset+1);
5108     method_name = val_to_str_const(method, amqp_0_10_file_methods,
5109                                    "<invalid file method>");
5110     col_append_str(pinfo->cinfo, COL_INFO, method_name);
5111     col_append_str(pinfo->cinfo, COL_INFO, " ");
5112     col_set_fence(pinfo->cinfo, COL_INFO);
5113
5114     proto_tree_add_item(tree, hf_amqp_0_10_file_method,
5115                         tvb, offset+1, 1, ENC_BIG_ENDIAN);
5116     AMQP_INCREMENT(offset, 2, length);
5117     /*
5118      * Session header is 2 bytes; one that tells that it's 1 byte long, then
5119      * the byte itself. Bit 0 is sync.
5120      */
5121     flag1 = tvb_get_guint8(tvb, offset);
5122     flag2 = tvb_get_guint8(tvb, offset+1);
5123     if ((flag1 != 1) || ((flag2 & 0xfe) != 0))
5124         proto_tree_add_text(tree, tvb, offset, 2, "Invalid session header");
5125     else
5126         proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync,
5127                             tvb, offset + 1, 1, ENC_BIG_ENDIAN);
5128     AMQP_INCREMENT(offset, 2, length);
5129
5130     ti = proto_tree_add_item(tree, hf_amqp_method_arguments,
5131                              tvb, offset, length - 4, ENC_NA);
5132     args_tree = proto_item_add_subtree(ti, ett_args);
5133
5134     /*
5135      * The flag bits are a simple bit string, not a net-byte-order
5136      * field. tvb_get_bits16() doesn't know how to do little-endian
5137      * at this time, so just pick out two bytes.
5138      */
5139     flags_offset = offset;
5140     flag1 = tvb_get_guint8(tvb, offset);
5141     flag2 = tvb_get_guint8(tvb, offset+1);
5142     flags_item = proto_tree_add_item(args_tree,
5143                                      hf_amqp_0_10_argument_packing_flags,
5144                                      tvb, offset, 2, ENC_BIG_ENDIAN);
5145     AMQP_INCREMENT(offset, 2, length);
5146     switch (method) {
5147     case AMQP_0_10_METHOD_FILE_QOS:
5148         if ((flag1 & ~0x07) || (flag2 != 0))
5149             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
5150         if (flag1 & 0x01) {     /* prefetch-size (uint32) */
5151             proto_tree_add_item(args_tree,
5152                                 hf_amqp_0_10_method_file_qos_prefetch_size,
5153                                 tvb, offset, 4, ENC_BIG_ENDIAN);
5154             AMQP_INCREMENT(offset, 4, length);
5155         }
5156         if (flag1 & 0x02) {     /* prefetch-count (uint16) */
5157             proto_tree_add_item(args_tree,
5158                                 hf_amqp_0_10_method_file_qos_prefetch_count,
5159                                 tvb, offset, 2, ENC_BIG_ENDIAN);
5160             AMQP_INCREMENT(offset, 2, length);
5161         }
5162         /*
5163          * 3rd argument is an optional bit.
5164          */
5165         proto_tree_add_item(args_tree,
5166                             hf_amqp_0_10_method_file_qos_global,
5167                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5168         break;
5169
5170     case AMQP_0_10_METHOD_FILE_QOS_OK:
5171     case AMQP_0_10_METHOD_FILE_STAGE:
5172         /* No args */
5173         break;
5174
5175     case AMQP_0_10_METHOD_FILE_CONSUME:
5176         if ((flag1 & ~0x7f) || (flag2 != 0))
5177             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
5178         if (flag1 & 0x01) {     /* queue (queue.name [str8]) */
5179             str_size = tvb_get_guint8(tvb, offset);
5180             THROW_ON(((offset + 1 + str_size) <= length), ReportedBoundsError);
5181             proto_tree_add_item(args_tree,
5182                                 hf_amqp_0_10_method_queue_name,
5183                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5184             AMQP_INCREMENT(offset, (1 + str_size), length);
5185         }
5186         if (flag1 & 0x02) {     /* consumer-tag (str8) */
5187             str_size = tvb_get_guint8(tvb, offset);
5188             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5189             proto_tree_add_item(args_tree,
5190                                 hf_amqp_0_10_method_file_consumer_tag,
5191                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5192             AMQP_INCREMENT(offset, (1 + str_size), length);
5193         }
5194         /*
5195          * 3rd-6th arguments are optional bits.
5196          */
5197         proto_tree_add_item(args_tree,
5198                             hf_amqp_0_10_method_file_consume_no_local,
5199                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5200         proto_tree_add_item(args_tree,
5201                             hf_amqp_0_10_method_file_consume_no_ack,
5202                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5203         proto_tree_add_item(args_tree,
5204                             hf_amqp_0_10_method_file_consume_exclusive,
5205                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5206         proto_tree_add_item(args_tree,
5207                             hf_amqp_0_10_method_file_consume_nowait,
5208                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5209         if (flag1 & 0x40) {     /* arguments (map) */
5210             map_length = tvb_get_ntohl(tvb, offset);
5211             AMQP_INCREMENT(offset, 4, length);
5212             THROW_ON(((offset + map_length) > length), ReportedBoundsError);
5213             ti = proto_tree_add_item(args_tree,
5214                                      hf_amqp_0_10_method_file_consume_arguments,
5215                                      tvb,
5216                                      offset - 4,
5217                                      map_length + 4, ENC_NA);
5218             dissect_amqp_0_10_map (tvb,
5219                                    offset,
5220                                    offset + map_length,
5221                                    map_length,
5222                                    ti);
5223             AMQP_INCREMENT(offset, map_length, length);
5224         }
5225         break;
5226
5227     case AMQP_0_10_METHOD_FILE_CONSUME_OK:
5228     case AMQP_0_10_METHOD_FILE_CANCEL:
5229         if ((flag1 & ~0x01) || (flag2 != 0))
5230             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
5231         if (flag1 & 0x01) {     /* consumer-tag (str8) */
5232             str_size = tvb_get_guint8(tvb, offset);
5233             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5234             proto_tree_add_item(args_tree,
5235                                 hf_amqp_0_10_method_file_consumer_tag,
5236                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5237             AMQP_INCREMENT(offset, (1 + str_size), length);
5238         }
5239         break;
5240
5241     case AMQP_0_10_METHOD_FILE_OPEN:
5242         if ((flag1 & ~0x03) || (flag2 != 0))
5243             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
5244         if (flag1 & 0x01) {     /* identifier (str8) */
5245             str_size = tvb_get_guint8(tvb, offset);
5246             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5247             proto_tree_add_item(args_tree,
5248                                 hf_amqp_0_10_method_file_identifier,
5249                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5250             AMQP_INCREMENT(offset, (1 + str_size), length);
5251         }
5252         if (flag1 & 0x02) {     /* content-size (uint64) */
5253             proto_tree_add_item(args_tree,
5254                                 hf_amqp_0_10_method_file_open_content_size,
5255                                 tvb, offset, 8, ENC_BIG_ENDIAN);
5256             AMQP_INCREMENT(offset, 8, length);
5257         }
5258         break;
5259
5260     case AMQP_0_10_METHOD_FILE_OPEN_OK:
5261         if ((flag1 & ~0x01) || (flag2 != 0))
5262             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
5263         if (flag1 & 0x01) {     /* staged-size (uint64) */
5264             proto_tree_add_item(args_tree,
5265                                 hf_amqp_0_10_method_file_open_ok_staged_size,
5266                                 tvb, offset, 8, ENC_BIG_ENDIAN);
5267             AMQP_INCREMENT(offset, 8, length);
5268         }
5269         break;
5270
5271     case AMQP_0_10_METHOD_FILE_PUBLISH:
5272         if ((flag1 & ~0x1f) || (flag2 != 0))
5273             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
5274         if (flag1 & 0x01) {     /* exchange (exchange.name [str8]) */
5275             str_size = tvb_get_guint8(tvb, offset);
5276             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5277             proto_tree_add_item(args_tree,
5278                                 hf_amqp_0_10_method_file_publish_exchange,
5279                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5280             AMQP_INCREMENT(offset, (1 + str_size), length);
5281         }
5282         if (flag1 & 0x02) {     /* routing-key (str8) */
5283             str_size = tvb_get_guint8(tvb, offset);
5284             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5285             proto_tree_add_item(args_tree,
5286                                 hf_amqp_0_10_method_file_publish_routing_key,
5287                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5288             AMQP_INCREMENT(offset, (1 + str_size), length);
5289         }
5290         /*
5291          * 3rd-4th arguments are optional bits.
5292          */
5293         proto_tree_add_item(args_tree,
5294                             hf_amqp_0_10_method_file_publish_mandatory,
5295                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5296         proto_tree_add_item(args_tree,
5297                             hf_amqp_0_10_method_file_publish_immediate,
5298                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5299         if (flag1 & 0x10) {     /* identifier (str8) */
5300             str_size = tvb_get_guint8(tvb, offset);
5301             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5302             proto_tree_add_item(args_tree,
5303                                 hf_amqp_0_10_method_file_identifier,
5304                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5305             AMQP_INCREMENT(offset, (1 + str_size), length);
5306         }
5307         break;
5308
5309     case AMQP_0_10_METHOD_FILE_RETURN:
5310         if ((flag1 & ~0x0f) || (flag2 != 0))
5311             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
5312         if (flag1 & 0x01) {     /* reply-code (return-code [uint16]) */
5313             proto_tree_add_item(args_tree,
5314                                 hf_amqp_0_10_method_file_return_reply_code,
5315                                 tvb, offset, 2, ENC_BIG_ENDIAN);
5316             AMQP_INCREMENT(offset, 2, length);
5317         }
5318         if (flag1 & 0x02) {     /* reply-text (str8) */
5319             str_size = tvb_get_guint8(tvb, offset);
5320             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5321             proto_tree_add_item(args_tree,
5322                                 hf_amqp_0_10_method_file_return_reply_text,
5323                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5324             AMQP_INCREMENT(offset, (1 + str_size), length);
5325         }
5326         if (flag1 & 0x04) {     /* exchange (exchange.name [str8]) */
5327             str_size = tvb_get_guint8(tvb, offset);
5328             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5329             proto_tree_add_item(args_tree,
5330                                 hf_amqp_0_10_method_file_return_exchange,
5331                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5332             AMQP_INCREMENT(offset, (1 + str_size), length);
5333         }
5334         if (flag1 & 0x08) {     /* routing-key (str8) */
5335             str_size = tvb_get_guint8(tvb, offset);
5336             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5337             proto_tree_add_item(args_tree,
5338                                 hf_amqp_0_10_method_file_return_routing_key,
5339                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5340             AMQP_INCREMENT(offset, (1 + str_size), length);
5341         }
5342         break;
5343
5344     case AMQP_0_10_METHOD_FILE_DELIVER:
5345         if ((flag1 & ~0x3f) || (flag2 != 0))
5346             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
5347         if (flag1 & 0x01) {     /* consumer-tag (str8) */
5348             str_size = tvb_get_guint8(tvb, offset);
5349             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5350             proto_tree_add_item(args_tree,
5351                                 hf_amqp_0_10_method_file_deliver_consumer_tag,
5352                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5353             AMQP_INCREMENT(offset, (1 + str_size), length);
5354         }
5355         if (flag1 & 0x02) {     /* delivery-tag (uint64) */
5356             proto_tree_add_item(args_tree,
5357                                 hf_amqp_0_10_method_file_deliver_delivery_tag,
5358                                 tvb, offset, 8, ENC_BIG_ENDIAN);
5359             AMQP_INCREMENT(offset, 8, length);
5360         }
5361         /*
5362          * 3rd argument is an optional bit.
5363          */
5364         proto_tree_add_item(args_tree,
5365                             hf_amqp_0_10_method_file_deliver_redelivered,
5366                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5367         if (flag1 & 0x08) {     /* exchange (exchange.name [str8]) */
5368             str_size = tvb_get_guint8(tvb, offset);
5369             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5370             proto_tree_add_item(args_tree,
5371                                 hf_amqp_0_10_method_file_deliver_exchange,
5372                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5373             AMQP_INCREMENT(offset, (1 + str_size), length);
5374         }
5375         if (flag1 & 0x10) {     /* routing-key (str8) */
5376             str_size = tvb_get_guint8(tvb, offset);
5377             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5378             proto_tree_add_item(args_tree,
5379                                 hf_amqp_0_10_method_file_deliver_routing_key,
5380                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5381             AMQP_INCREMENT(offset, (1 + str_size), length);
5382         }
5383         if (flag1 & 0x20) {     /* identifier (str8) */
5384             str_size = tvb_get_guint8(tvb, offset);
5385             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5386             proto_tree_add_item(args_tree,
5387                                 hf_amqp_0_10_method_file_identifier,
5388                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5389             AMQP_INCREMENT(offset, (1 + str_size), length);
5390         }
5391         break;
5392
5393     case AMQP_0_10_METHOD_FILE_ACK:
5394         if ((flag1 & ~0x03) || (flag2 != 0))
5395             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
5396         if (flag1 & 0x01) {     /* delivery-tag (uint64) */
5397             proto_tree_add_item(args_tree,
5398                                 hf_amqp_0_10_method_file_ack_delivery_tag,
5399                                 tvb, offset, 8, ENC_BIG_ENDIAN);
5400             AMQP_INCREMENT(offset, 8, length);
5401         }
5402         /*
5403          * 2nd argument is an optional bit.
5404          */
5405         proto_tree_add_item(args_tree,
5406                             hf_amqp_0_10_method_file_ack_multiple,
5407                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5408         break;
5409
5410     case AMQP_0_10_METHOD_FILE_REJECT:
5411         if ((flag1 & ~0x03) || (flag2 != 0))
5412             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
5413         if (flag1 & 0x01) {     /* delivery-tag (uint64) */
5414             proto_tree_add_item(args_tree,
5415                                 hf_amqp_0_10_method_file_reject_delivery_tag,
5416                                 tvb, offset, 8, ENC_BIG_ENDIAN);
5417             AMQP_INCREMENT(offset, 8, length);
5418         }
5419         /*
5420          * 2nd argument is an optional bit.
5421          */
5422         proto_tree_add_item(args_tree,
5423                             hf_amqp_0_10_method_file_reject_requeue,
5424                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5425         break;
5426     }
5427 }
5428
5429 static void
5430 dissect_amqp_0_10_stream(tvbuff_t *tvb,
5431                          packet_info *pinfo,
5432                          proto_tree *tree,
5433                          int offset, guint16 length)
5434 {
5435     proto_item  *args_tree;
5436     proto_item  *ti;
5437     proto_item  *flags_item;
5438     guint8       method;
5439     guint8       flag1, flag2;
5440     guint8       str_size;
5441     guint32      map_length;
5442     int          flags_offset;
5443     const gchar *method_name;
5444
5445     method = tvb_get_guint8(tvb, offset+1);
5446     method_name = val_to_str_const(method, amqp_0_10_stream_methods,
5447                                    "<invalid stream method>");
5448     col_append_str(pinfo->cinfo, COL_INFO, method_name);
5449     col_append_str(pinfo->cinfo, COL_INFO, " ");
5450     col_set_fence(pinfo->cinfo, COL_INFO);
5451
5452     proto_tree_add_item(tree, hf_amqp_0_10_stream_method,
5453                         tvb, offset+1, 1, ENC_BIG_ENDIAN);
5454     AMQP_INCREMENT(offset, 2, length);
5455     /*
5456      * Session header is 2 bytes; one that tells that it's 1 byte long, then
5457      * the byte itself. Bit 0 is sync.
5458      */
5459     flag1 = tvb_get_guint8(tvb, offset);
5460     flag2 = tvb_get_guint8(tvb, offset+1);
5461     if ((flag1 != 1) || ((flag2 & 0xfe) != 0))
5462         proto_tree_add_text(tree, tvb, offset, 2, "Invalid session header");
5463     else
5464         proto_tree_add_item(tree, hf_amqp_0_10_session_header_sync,
5465                             tvb, offset + 1, 1, ENC_BIG_ENDIAN);
5466     AMQP_INCREMENT(offset, 2, length);
5467
5468     ti = proto_tree_add_item(tree, hf_amqp_method_arguments,
5469                              tvb, offset, length - 4, ENC_NA);
5470     args_tree = proto_item_add_subtree(ti, ett_args);
5471
5472     /*
5473      * The flag bits are a simple bit string, not a net-byte-order
5474      * field. tvb_get_bits16() doesn't know how to do little-endian
5475      * at this time, so just pick out two bytes.
5476      */
5477     flags_offset = offset;
5478     flag1 = tvb_get_guint8(tvb, offset);
5479     flag2 = tvb_get_guint8(tvb, offset+1);
5480     flags_item = proto_tree_add_item(args_tree,
5481                                      hf_amqp_0_10_argument_packing_flags,
5482                                      tvb, offset, 2, ENC_BIG_ENDIAN);
5483     AMQP_INCREMENT(offset, 2, length);
5484     switch (method) {
5485     case AMQP_0_10_METHOD_STREAM_QOS:
5486         if ((flag1 & ~0x0f) || (flag2 != 0))
5487             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
5488         if (flag1 & 0x01) {     /* prefetch-size (uint32) */
5489             proto_tree_add_item(args_tree,
5490                                 hf_amqp_0_10_method_stream_qos_prefetch_size,
5491                                 tvb, offset, 4, ENC_BIG_ENDIAN);
5492             AMQP_INCREMENT(offset, 4, length);
5493         }
5494         if (flag1 & 0x02) {     /* prefetch-count (uint16) */
5495             proto_tree_add_item(args_tree,
5496                                 hf_amqp_0_10_method_stream_qos_prefetch_count,
5497                                 tvb, offset, 2, ENC_BIG_ENDIAN);
5498             AMQP_INCREMENT(offset, 2, length);
5499         }
5500         if (flag1 & 0x04) {     /* consume-rate (uint32) */
5501             proto_tree_add_item(args_tree,
5502                                 hf_amqp_0_10_method_stream_qos_prefetch_size,
5503                                 tvb, offset, 4, ENC_BIG_ENDIAN);
5504             AMQP_INCREMENT(offset, 4, length);
5505         }
5506         /*
5507          * 4th argument is an optional bit.
5508          */
5509         proto_tree_add_item(args_tree,
5510                             hf_amqp_0_10_method_stream_qos_global,
5511                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5512         break;
5513
5514     case AMQP_0_10_METHOD_STREAM_QOS_OK:
5515         /* No args */
5516         break;
5517
5518     case AMQP_0_10_METHOD_STREAM_CONSUME:
5519         if ((flag1 & ~0x3f) || (flag2 != 0))
5520             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
5521         if (flag1 & 0x01) {     /* queue (queue.name [str8]) */
5522             str_size = tvb_get_guint8(tvb, offset);
5523             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5524             proto_tree_add_item(args_tree,
5525                                 hf_amqp_0_10_method_queue_name,
5526                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5527             AMQP_INCREMENT(offset, (1 + str_size), length);
5528         }
5529         if (flag1 & 0x02) {     /* consumer-tag (str8) */
5530             str_size = tvb_get_guint8(tvb, offset);
5531             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5532             proto_tree_add_item(args_tree,
5533                                 hf_amqp_0_10_method_stream_consumer_tag,
5534                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5535             AMQP_INCREMENT(offset, (1 + str_size), length);
5536         }
5537         /*
5538          * 3rd-5th arguments are optional bits.
5539          */
5540         proto_tree_add_item(args_tree,
5541                             hf_amqp_0_10_method_stream_consume_no_local,
5542                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5543         proto_tree_add_item(args_tree,
5544                             hf_amqp_0_10_method_stream_consume_exclusive,
5545                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5546         proto_tree_add_item(args_tree,
5547                             hf_amqp_0_10_method_stream_consume_nowait,
5548                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5549         if (flag1 & 0x20) {     /* arguments (map) */
5550             map_length = tvb_get_ntohl(tvb, offset);
5551             AMQP_INCREMENT(offset, 4, length);
5552             THROW_ON(((offset + map_length) > length), ReportedBoundsError);
5553             ti = proto_tree_add_item(args_tree,
5554                                      hf_amqp_0_10_method_stream_consume_arguments,
5555                                      tvb,
5556                                      offset - 4,
5557                                      map_length + 4, ENC_NA);
5558             dissect_amqp_0_10_map (tvb,
5559                                    offset,
5560                                    offset + map_length,
5561                                    map_length,
5562                                    ti);
5563             AMQP_INCREMENT(offset, map_length, length);
5564         }
5565         break;
5566
5567     case AMQP_0_10_METHOD_STREAM_CONSUME_OK:
5568     case AMQP_0_10_METHOD_STREAM_CANCEL:
5569         if ((flag1 & ~0x01) || (flag2 != 0))
5570             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
5571         if (flag1 & 0x01) {     /* consumer-tag (str8) */
5572             str_size = tvb_get_guint8(tvb, offset);
5573             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5574             proto_tree_add_item(args_tree,
5575                                 hf_amqp_0_10_method_stream_consumer_tag,
5576                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5577             AMQP_INCREMENT(offset, (1 + str_size), length);
5578         }
5579         break;
5580
5581     case AMQP_0_10_METHOD_STREAM_PUBLISH:
5582         if ((flag1 & ~0x0f) || (flag2 != 0))
5583             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
5584         if (flag1 & 0x01) {     /* exchange (exchange.name [str8]) */
5585             str_size = tvb_get_guint8(tvb, offset);
5586             THROW_ON(((offset + 1 + str_size) <= length), ReportedBoundsError);
5587             proto_tree_add_item(args_tree,
5588                                 hf_amqp_0_10_method_stream_publish_exchange,
5589                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5590             AMQP_INCREMENT(offset, (1 + str_size), length);
5591         }
5592         if (flag1 & 0x02) {     /* routing-key (str8) */
5593             str_size = tvb_get_guint8(tvb, offset);
5594             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5595             proto_tree_add_item(args_tree,
5596                                 hf_amqp_0_10_method_stream_publish_routing_key,
5597                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5598             AMQP_INCREMENT(offset, (1 + str_size), length);
5599         }
5600         /*
5601          * 3rd-4th arguments are optional bits.
5602          */
5603         proto_tree_add_item(args_tree,
5604                             hf_amqp_0_10_method_stream_publish_mandatory,
5605                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5606         proto_tree_add_item(args_tree,
5607                             hf_amqp_0_10_method_stream_publish_immediate,
5608                             tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5609         break;
5610
5611     case AMQP_0_10_METHOD_STREAM_RETURN:
5612         if ((flag1 & ~0x0f) || (flag2 != 0))
5613             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
5614         if (flag1 & 0x01) {     /* reply-code (return-code [uint16]) */
5615             proto_tree_add_item(args_tree,
5616                                 hf_amqp_0_10_method_stream_return_reply_code,
5617                                 tvb, offset, 2, ENC_BIG_ENDIAN);
5618             AMQP_INCREMENT(offset, 2, length);
5619         }
5620         if (flag1 & 0x02) {     /* reply-text (str8) */
5621             str_size = tvb_get_guint8(tvb, offset);
5622             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5623             proto_tree_add_item(args_tree,
5624                                 hf_amqp_0_10_method_stream_return_reply_text,
5625                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5626             AMQP_INCREMENT(offset, (1 + str_size), length);
5627         }
5628         if (flag1 & 0x04) {     /* exchange (exchange.name [str8]) */
5629             str_size = tvb_get_guint8(tvb, offset);
5630             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5631             proto_tree_add_item(args_tree,
5632                                 hf_amqp_0_10_method_stream_return_exchange,
5633                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5634             AMQP_INCREMENT(offset, (1 + str_size), length);
5635         }
5636         if (flag1 & 0x08) {     /* routing-key (str8) */
5637             str_size = tvb_get_guint8(tvb, offset);
5638             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5639             proto_tree_add_item(args_tree,
5640                                 hf_amqp_0_10_method_stream_return_routing_key,
5641                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5642             AMQP_INCREMENT(offset, (1 + str_size), length);
5643         }
5644         break;
5645
5646     case AMQP_0_10_METHOD_STREAM_DELIVER:
5647         if ((flag1 & ~0x0f) || (flag2 != 0))
5648             expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
5649         if (flag1 & 0x01) {     /* consumer-tag (str8) */
5650             str_size = tvb_get_guint8(tvb, offset);
5651             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5652             proto_tree_add_item(args_tree,
5653                                 hf_amqp_0_10_method_stream_deliver_consumer_tag,
5654                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5655             AMQP_INCREMENT(offset, (1 + str_size), length);
5656         }
5657         if (flag1 & 0x02) {     /* delivery-tag (uint64) */
5658             proto_tree_add_item(args_tree,
5659                                 hf_amqp_0_10_method_stream_deliver_delivery_tag,
5660                                 tvb, offset, 8, ENC_BIG_ENDIAN);
5661             AMQP_INCREMENT(offset, 8, length);
5662         }
5663         if (flag1 & 0x04) {     /* exchange (exchange.name [str8]) */
5664             str_size = tvb_get_guint8(tvb, offset);
5665             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5666             proto_tree_add_item(args_tree,
5667                                 hf_amqp_0_10_method_stream_deliver_exchange,
5668                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5669             AMQP_INCREMENT(offset, (1 + str_size), length);
5670         }
5671         if (flag1 & 0x08) {     /* queue (queue.name [str8]) */
5672             str_size = tvb_get_guint8(tvb, offset);
5673             THROW_ON(((offset + 1 + str_size) > length), ReportedBoundsError);
5674             proto_tree_add_item(args_tree,
5675                                 hf_amqp_0_10_method_stream_deliver_queue,
5676                                 tvb, offset + 1, str_size, ENC_ASCII|ENC_NA);
5677             AMQP_INCREMENT(offset, (1 + str_size), length);
5678         }
5679         break;
5680     }
5681 }
5682
5683 static void
5684 dissect_amqp_0_10_struct_delivery_properties(tvbuff_t *tvb,
5685                                              packet_info *pinfo,
5686                                              proto_tree *tree,
5687                                              int offset,
5688                                              guint32 struct_length)
5689 {
5690     proto_item *args_tree;
5691     proto_item *flags_item;
5692     guint8      flag1, flag2;
5693     guint8      len8;
5694     guint16     len16;
5695     guint64     timestamp;
5696     int         flags_offset;
5697     int         max_length;
5698     nstime_t    tv;
5699
5700     max_length = offset + struct_length;
5701     args_tree = proto_item_add_subtree(tree, ett_args);
5702     AMQP_INCREMENT(offset, 2, max_length);  /* Skip class and struct codes */
5703     flags_offset = offset;
5704     flag1 = tvb_get_guint8(tvb, offset);
5705     flag2 = tvb_get_guint8(tvb, offset+1);
5706     flags_item = proto_tree_add_item(args_tree,
5707                                      hf_amqp_0_10_argument_packing_flags,
5708                                      tvb, offset, 2, ENC_BIG_ENDIAN);
5709     if (flag2 & ~0x0f)
5710         expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
5711     AMQP_INCREMENT(offset, 2, max_length);
5712
5713     /* First 3 fields are bits */
5714     proto_tree_add_item(args_tree,
5715                         hf_amqp_0_10_struct_delivery_properties_discard_unroutable,
5716                         tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5717     proto_tree_add_item(args_tree,
5718                         hf_amqp_0_10_struct_delivery_properties_immediate,
5719                         tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5720     proto_tree_add_item(args_tree,
5721                         hf_amqp_0_10_struct_delivery_properties_redelivered,
5722                         tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5723     if (flag1 & 0x08) {
5724         /* delivery-priority (delivery-priority [uint8]) */
5725         proto_tree_add_item(args_tree,
5726                             hf_amqp_0_10_struct_delivery_properties_priority,
5727                             tvb, offset, 1, ENC_BIG_ENDIAN);
5728         AMQP_INCREMENT(offset, 1, max_length);
5729     }
5730     if (flag1 & 0x10) {
5731         /* delivery-mode (delivery-mode [uint8]) */
5732         proto_tree_add_item(args_tree,
5733                             hf_amqp_0_10_struct_delivery_properties_mode,
5734                             tvb, offset, 1, ENC_BIG_ENDIAN);
5735         AMQP_INCREMENT(offset, 1, max_length);
5736     }
5737     if (flag1 & 0x20) {
5738         /* ttl (uint64) */
5739         proto_tree_add_item(args_tree,
5740                             hf_amqp_0_10_struct_delivery_properties_ttl,
5741                             tvb, offset, 8, ENC_BIG_ENDIAN);
5742         AMQP_INCREMENT(offset, 8, max_length);
5743     }
5744     if (flag1 & 0x40) {
5745         /* timestamp (datetime [uint64]) */
5746         timestamp = tvb_get_ntoh64(tvb, offset);
5747         tv.secs = (time_t)timestamp;
5748         tv.nsecs = 0;
5749         proto_tree_add_time(args_tree,
5750                             hf_amqp_0_10_struct_delivery_properties_timestamp,
5751                             tvb, offset, 8, &tv);
5752         AMQP_INCREMENT(offset, 8, max_length);
5753     }
5754     if (flag1 & 0x80) {
5755         /* expiration (datetime [uint64]) */
5756         timestamp = tvb_get_ntoh64(tvb, offset);
5757         tv.secs = (time_t)timestamp;
5758         tv.nsecs = 0;
5759         proto_tree_add_time(args_tree,
5760                             hf_amqp_0_10_struct_delivery_properties_expiration,
5761                             tvb, offset, 8, &tv);
5762         AMQP_INCREMENT(offset, 8, max_length);
5763     }
5764     if (flag2 & 0x01) {
5765         /* exchange (exchange.name [str8]) */
5766         len8 = tvb_get_guint8(tvb, offset);
5767         proto_tree_add_item(args_tree,
5768                             hf_amqp_0_10_struct_delivery_properties_exchange,
5769                             tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
5770         AMQP_INCREMENT(offset, (1 + len8), max_length);
5771     }
5772     if (flag2 & 0x02) {
5773         /* routing-key (str8) */
5774         len8 = tvb_get_guint8(tvb, offset);
5775         proto_tree_add_item(args_tree,
5776                             hf_amqp_0_10_struct_delivery_properties_routing_key,
5777                             tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
5778         AMQP_INCREMENT(offset, (1 + len8), max_length);
5779     }
5780     if (flag2 & 0x04) {
5781         /*  resume-id (resume-id [str16]) */
5782         len16 = tvb_get_ntohs(tvb, offset);
5783         THROW_ON(((offset + 2 + len16) > max_length), ReportedBoundsError);
5784         proto_tree_add_item(args_tree,
5785                             hf_amqp_0_10_method_message_resume_id,
5786                             tvb, offset + 2, len16, ENC_ASCII|ENC_NA);
5787         AMQP_INCREMENT(offset, (2 + len16), max_length);
5788     }
5789     if (flag2 & 0x08) {
5790         /*  resume-ttl (uint64) */
5791         proto_tree_add_item(args_tree,
5792                             hf_amqp_0_10_struct_delivery_properties_resume_ttl,
5793                             tvb, offset, 8, ENC_BIG_ENDIAN);
5794         AMQP_INCREMENT(offset, 8, max_length);
5795     }
5796 }
5797
5798 static void
5799 dissect_amqp_0_10_struct_fragment_properties(tvbuff_t *tvb,
5800                                              packet_info *pinfo,
5801                                              proto_tree *tree,
5802                                              int offset,
5803                                              guint32 struct_length)
5804 {
5805     proto_item *args_tree;
5806     proto_item *flags_item;
5807     guint8      flag1, flag2;
5808     int         flags_offset;
5809     int         max_length;
5810
5811     max_length = offset + struct_length;
5812     args_tree = proto_item_add_subtree(tree, ett_args);
5813     AMQP_INCREMENT(offset, 2, max_length);  /* Skip class and struct codes */
5814     flags_offset = offset;
5815     flag1 = tvb_get_guint8(tvb, offset);
5816     flag2 = tvb_get_guint8(tvb, offset+1);
5817     flags_item = proto_tree_add_item(args_tree,
5818                                      hf_amqp_0_10_argument_packing_flags,
5819                                      tvb, offset, 2, ENC_BIG_ENDIAN);
5820     if ((flag1 & ~0x07) || (flag2 != 0))
5821         expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
5822     AMQP_INCREMENT(offset, 2, max_length);
5823
5824     /* First 2 fields are bits */
5825     proto_tree_add_item(args_tree,
5826                         hf_amqp_0_10_struct_fragment_properties_first,
5827                         tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5828     proto_tree_add_item(args_tree,
5829                         hf_amqp_0_10_struct_fragment_properties_last,
5830                         tvb, flags_offset, 1, ENC_BIG_ENDIAN);
5831     if (flag1 & 0x04) {
5832         /* fragment-size (uint64) */
5833         proto_tree_add_item(args_tree,
5834                             hf_amqp_0_10_struct_fragment_properties_size,
5835                             tvb, offset, 8, ENC_BIG_ENDIAN);
5836         AMQP_INCREMENT(offset, 8, max_length);
5837     }
5838 }
5839
5840 static void
5841 dissect_amqp_0_10_struct_message_properties(tvbuff_t *tvb,
5842                                             packet_info *pinfo,
5843                                             proto_tree *tree,
5844                                             int offset,
5845                                             guint32 struct_length)
5846 {
5847     proto_item *ti;
5848     proto_item *frag;
5849     proto_item *args_tree;
5850     proto_item *flags_item, *subflags_item;
5851     guint8      flag1, flag2;
5852     guint8      subflag1, subflag2;
5853     guint8      len8;
5854     guint16     len16;
5855     guint32     map_length;
5856     e_guid_t    uuid;
5857     int         max_length;
5858
5859     max_length = offset + struct_length;
5860     frag = proto_item_add_subtree(tree, ett_args);
5861     AMQP_INCREMENT(offset, 2, max_length);  /* Skip class and struct codes */
5862     flag1 = tvb_get_guint8(tvb, offset);
5863     flag2 = tvb_get_guint8(tvb, offset+1);
5864     flags_item = proto_tree_add_item(frag,
5865                                      hf_amqp_0_10_argument_packing_flags,
5866                                      tvb, offset, 2, ENC_BIG_ENDIAN);
5867     if (flag2 & ~0x01)
5868         expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
5869     AMQP_INCREMENT(offset, 2, max_length);
5870     if (flag1 & 0x01) {
5871         /*  content-length (uint64) */
5872         proto_tree_add_item(frag,
5873                             hf_amqp_0_10_struct_message_properties_content_len,
5874                             tvb, offset, 8, ENC_BIG_ENDIAN);
5875         AMQP_INCREMENT(offset, 8, max_length);
5876     }
5877     if (flag1 & 0x02) {
5878         /* message-id (uuid) */
5879         tvb_get_guid(tvb, offset, &uuid, ENC_BIG_ENDIAN);
5880         proto_tree_add_guid(frag,
5881                             hf_amqp_0_10_struct_message_properties_message_id,
5882                             tvb, offset, 16, &uuid);
5883         AMQP_INCREMENT(offset, 16, max_length);
5884     }
5885     if (flag1 & 0x04) {
5886         /* correlation-id (vbin16) */
5887         len16 = tvb_get_ntohs(tvb, offset);
5888         proto_tree_add_item(frag,
5889                             hf_amqp_0_10_struct_message_properties_correlation,
5890                             tvb, offset + 2, len16, ENC_NA);
5891         AMQP_INCREMENT(offset, (2 + len16), max_length);
5892     }
5893     if (flag1 & 0x08) {
5894         /* reply-to (reply-to) */
5895         /* This is another struct, length 2, packing 2 */
5896         len16 = tvb_get_ntohs(tvb, offset);
5897         AMQP_INCREMENT(offset, 2, max_length);
5898         ti = proto_tree_add_item(frag,
5899                                  hf_amqp_0_10_struct_message_properties_reply_to,
5900                                  tvb, offset, len16, ENC_NA);
5901         args_tree = proto_item_add_subtree(ti, ett_args);
5902         subflags_item = proto_tree_add_item(args_tree,
5903                                             hf_amqp_0_10_argument_packing_flags,
5904                                             tvb, offset, 2, ENC_BIG_ENDIAN);
5905         subflag1 = tvb_get_guint8(tvb, offset);
5906         subflag2 = tvb_get_guint8(tvb, offset + 1);
5907         if ((subflag1 & ~0x03) || (subflag2 != 0))
5908             expert_add_info(pinfo, subflags_item, &ei_amqp_bad_flag_value);
5909         AMQP_INCREMENT(offset, 2, max_length);
5910         if (subflag1 & 0x01) {
5911             /* exchange (str8) */
5912             len8 = tvb_get_guint8(tvb, offset);
5913             proto_tree_add_item(args_tree,
5914                                 hf_amqp_0_10_struct_reply_to_exchange,
5915                                 tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
5916             AMQP_INCREMENT(offset, (1 + len8), max_length);
5917         }
5918         if (subflag1 & 0x02) {
5919             /* routing-key (str8) */
5920             len8 = tvb_get_guint8(tvb, offset);
5921             proto_tree_add_item(args_tree,
5922                                 hf_amqp_0_10_struct_reply_to_routing_key,
5923                                 tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
5924             AMQP_INCREMENT(offset, (1 + len8), max_length);
5925         }
5926     }
5927     if (flag1 & 0x10) {
5928         /* content-type (str8) */
5929         len8 = tvb_get_guint8(tvb, offset);
5930         proto_tree_add_item(frag,
5931                             hf_amqp_0_10_struct_message_properties_content_type,
5932                             tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
5933         AMQP_INCREMENT(offset, (1 + len8), max_length);
5934     }
5935     if (flag1 & 0x20) {
5936         /* content-encoding (str8) */
5937         len8 = tvb_get_guint8(tvb, offset);
5938         proto_tree_add_item(frag,
5939                             hf_amqp_0_10_struct_message_properties_content_encoding,
5940                             tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
5941         AMQP_INCREMENT(offset, (1 + len8), max_length);
5942     }
5943     if (flag1 & 0x40) {
5944         /* user-id (vbin16 ) */
5945         len16 = tvb_get_ntohs(tvb, offset);
5946         proto_tree_add_item(frag,
5947                             hf_amqp_0_10_struct_message_properties_user_id,
5948                             tvb, offset + 2, len16, ENC_NA);
5949         AMQP_INCREMENT(offset, (2 + len16), max_length);
5950     }
5951     if (flag1 & 0x80) {
5952         /* app-id (vbin16 ) */
5953         len16 = tvb_get_ntohs(tvb, offset);
5954         proto_tree_add_item(frag,
5955                             hf_amqp_0_10_struct_message_properties_app_id,
5956                             tvb, offset + 2, len16, ENC_NA);
5957         AMQP_INCREMENT(offset, (2 + len16), max_length);
5958     }
5959     if (flag2 & 0x01) {
5960         /* application-headers (map) */
5961         map_length = tvb_get_ntohl(tvb, offset);
5962         AMQP_INCREMENT(offset, 4, max_length);
5963         ti = proto_tree_add_item(frag,
5964                                  hf_amqp_0_10_struct_message_properties_application_headers,
5965                                  tvb,
5966                                  offset,
5967                                  map_length, ENC_NA);
5968         dissect_amqp_0_10_map (tvb,
5969                                offset,
5970                                offset + map_length,
5971                                map_length,
5972                                ti);
5973         AMQP_INCREMENT(offset, map_length, max_length);
5974     }
5975 }
5976
5977 static void
5978 dissect_amqp_0_10_struct_exchange_query_result(tvbuff_t *tvb,
5979                                                packet_info *pinfo,
5980                                                proto_item *tree,
5981                                                int offset,
5982                                                guint32 struct_length)
5983 {
5984     proto_item *ti;
5985     proto_item *result;
5986     proto_item *flags_item;
5987     guint8      flag1, flag2;
5988     guint8      len8;
5989     guint32     map_length;
5990     int         flags_offset;
5991     int         max_length;
5992
5993     max_length = offset + struct_length;
5994     result = proto_item_add_subtree(tree, ett_args);
5995     AMQP_INCREMENT(offset, 2, max_length);  /* Skip class and struct codes */
5996     flags_offset = offset;
5997     flag1 = tvb_get_guint8(tvb, offset);
5998     flag2 = tvb_get_guint8(tvb, offset+1);
5999     flags_item = proto_tree_add_item(result,
6000                                      hf_amqp_0_10_argument_packing_flags,
6001                                      tvb, offset, 2, ENC_BIG_ENDIAN);
6002     if (flag2 & ~0x0f)
6003         expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
6004     AMQP_INCREMENT(offset, 2, max_length);
6005     if (flag1 & 0x01) {
6006         /*  type (str8) */
6007         len8 = tvb_get_guint8(tvb, offset);
6008         THROW_ON(((offset + 1 + len8) > max_length), ReportedBoundsError);
6009         proto_tree_add_item(result,
6010                             hf_amqp_0_10_method_exchange_declare_type,
6011                             tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
6012         AMQP_INCREMENT(offset, (1 + len8), max_length);
6013     }
6014     proto_tree_add_item(result,
6015                         hf_amqp_0_10_struct_exchange_query_result_durable,
6016                         tvb, flags_offset, 1, ENC_BIG_ENDIAN);
6017     proto_tree_add_item(result,
6018                         hf_amqp_0_10_struct_exchange_query_result_not_found,
6019                         tvb, flags_offset, 1, ENC_BIG_ENDIAN);
6020     if (flag1 & 0x08) {
6021         /*  arguments (map) */
6022         map_length = tvb_get_ntohl(tvb, offset);
6023         AMQP_INCREMENT(offset, 4, max_length);
6024         THROW_ON(((offset + (int)map_length) > max_length), ReportedBoundsError);
6025         ti = proto_tree_add_item(result,
6026                                  hf_amqp_0_10_method_exchange_declare_arguments,
6027                                  tvb,
6028                                  offset - 4,
6029                                  map_length + 4, ENC_NA);
6030         dissect_amqp_0_10_map (tvb,
6031                                offset,
6032                                offset + map_length,
6033                                map_length,
6034                                ti);
6035         AMQP_INCREMENT(offset, map_length, max_length);
6036     }
6037 }
6038
6039 static void
6040 dissect_amqp_0_10_struct_queue_query_result(tvbuff_t *tvb,
6041                                             packet_info *pinfo,
6042                                             proto_item *tree,
6043                                             int offset,
6044                                             guint32 struct_length)
6045 {
6046     proto_item *ti;
6047     proto_item *result;
6048     proto_item *flags_item;
6049     guint8      flag1, flag2;
6050     guint8      len8;
6051     guint32     map_length;
6052     int         flags_offset;
6053     int         max_length;
6054
6055     max_length = offset + struct_length;
6056     result = proto_item_add_subtree(tree, ett_args);
6057     AMQP_INCREMENT(offset, 2, max_length);  /* Skip class and struct codes */
6058     flags_offset = offset;
6059     flag1 = tvb_get_guint8(tvb, offset);
6060     flag2 = tvb_get_guint8(tvb, offset+1);
6061     flags_item = proto_tree_add_item(result,
6062                                      hf_amqp_0_10_argument_packing_flags,
6063                                      tvb, offset, 2, ENC_BIG_ENDIAN);
6064
6065     if (flag2 != 0)
6066         expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
6067     AMQP_INCREMENT(offset, 2, max_length);
6068     if (flag1 & 0x01) {
6069         /*  queue (name [str8]) */
6070         len8 = tvb_get_guint8(tvb, offset);
6071         THROW_ON(((offset + 1 + len8) > max_length), ReportedBoundsError);
6072         proto_tree_add_item(result,
6073                             hf_amqp_0_10_method_queue_name,
6074                             tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
6075         AMQP_INCREMENT(offset, (1 + len8), max_length);
6076     }
6077     if (flag1 & 0x02) {     /* alternate-exchange (exchange.name [str8]) */
6078         len8 = tvb_get_guint8(tvb, offset);
6079         THROW_ON(((offset + 1 + len8) > max_length), ReportedBoundsError);
6080         proto_tree_add_item(result,
6081                             hf_amqp_0_10_method_queue_alt_exchange,
6082                             tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
6083         AMQP_INCREMENT(offset, (1 + len8), max_length);
6084     }
6085     /*
6086      * 3rd-5th arguments are optional bits.
6087      */
6088     proto_tree_add_item(result,
6089                         hf_amqp_0_10_struct_queue_query_result_durable,
6090                         tvb, flags_offset, 1, ENC_BIG_ENDIAN);
6091     proto_tree_add_item(result,
6092                         hf_amqp_0_10_struct_queue_query_result_exclusive,
6093                         tvb, flags_offset, 1, ENC_BIG_ENDIAN);
6094     proto_tree_add_item(result,
6095                         hf_amqp_0_10_struct_queue_query_result_auto_delete,
6096                         tvb, flags_offset, 1, ENC_BIG_ENDIAN);
6097     if (flag1 & 0x20) {     /* arguments (map) */
6098         map_length = tvb_get_ntohl(tvb, offset);
6099         AMQP_INCREMENT(offset, 4, max_length);
6100         THROW_ON(((offset + (int)map_length) > max_length), ReportedBoundsError);
6101         ti = proto_tree_add_item(result,
6102                                  hf_amqp_0_10_method_queue_declare_arguments,
6103                                  tvb,
6104                                  offset - 4,
6105                                  map_length + 4, ENC_NA);
6106         dissect_amqp_0_10_map (tvb,
6107                                offset,
6108                                offset + map_length,
6109                                map_length,
6110                                ti);
6111         AMQP_INCREMENT(offset, (int)map_length, max_length);
6112     }
6113     if (flag1 & 0x40) {     /* message-count (uint32) */
6114         proto_tree_add_item(result,
6115                             hf_amqp_0_10_struct_queue_query_result_message_count,
6116                             tvb, offset, 4, ENC_BIG_ENDIAN);
6117         AMQP_INCREMENT(offset, 4, max_length);
6118     }
6119     if (flag1 & 0x80) {     /* subscriber-count (uint32) */
6120         proto_tree_add_item(result,
6121                             hf_amqp_0_10_struct_queue_query_result_subscriber_count,
6122                             tvb, offset, 4, ENC_BIG_ENDIAN);
6123         AMQP_INCREMENT(offset, 4, max_length);
6124     }
6125 }
6126
6127 static void
6128 dissect_amqp_0_10_struct_file_properties(tvbuff_t *tvb,
6129                                          packet_info *pinfo,
6130                                          proto_tree *tree,
6131                                          int offset,
6132                                          guint32 struct_length)
6133 {
6134     proto_item *ti;
6135     proto_item *props;
6136     proto_item *flags_item;
6137     guint8      flag1, flag2;
6138     guint8      len8;
6139     guint32     map_length;
6140     guint64     timestamp;
6141     int         max_length;
6142     nstime_t    tv;
6143
6144     max_length = offset + struct_length;
6145     props = proto_item_add_subtree(tree, ett_args);
6146     AMQP_INCREMENT(offset, 2, max_length);  /* Skip class and struct codes */
6147     flag1 = tvb_get_guint8(tvb, offset);
6148     flag2 = tvb_get_guint8(tvb, offset+1);
6149     flags_item = proto_tree_add_item(props,
6150                                      hf_amqp_0_10_argument_packing_flags,
6151                                      tvb, offset, 2, ENC_BIG_ENDIAN);
6152     if (flag2 & ~0x01)
6153         expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
6154     AMQP_INCREMENT(offset, 2, max_length);
6155     if (flag1 & 0x01) {
6156         /*  content-type (str8) */
6157         len8 = tvb_get_guint8(tvb, offset);
6158         proto_tree_add_item(props,
6159                             hf_amqp_0_10_struct_file_properties_content_type,
6160                             tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
6161         AMQP_INCREMENT(offset, (1 + len8), max_length);
6162     }
6163     if (flag1 & 0x02) {
6164         /*  content-encoding (str8) */
6165         len8 = tvb_get_guint8(tvb, offset);
6166         proto_tree_add_item(props,
6167                             hf_amqp_0_10_struct_file_properties_content_encoding,
6168                             tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
6169         AMQP_INCREMENT(offset, (1 + len8), max_length);
6170     }
6171     if (flag1 & 0x04) {
6172         /* headers (map) */
6173         map_length = tvb_get_ntohl(tvb, offset);
6174         AMQP_INCREMENT(offset, 4, max_length);
6175         ti = proto_tree_add_item(props,
6176                                  hf_amqp_0_10_struct_file_properties_headers,
6177                                  tvb,
6178                                  offset,
6179                                  map_length, ENC_NA);
6180         dissect_amqp_0_10_map (tvb,
6181                                offset,
6182                                offset + map_length,
6183                                map_length,
6184                                ti);
6185         AMQP_INCREMENT(offset, map_length, max_length);
6186     }
6187     if (flag1 & 0x08) {
6188         /* priority (uint8) */
6189         proto_tree_add_item(props,
6190                             hf_amqp_0_10_struct_file_properties_priority,
6191                             tvb, offset, 1, ENC_BIG_ENDIAN);
6192         AMQP_INCREMENT(offset, 1, max_length);
6193     }
6194     if (flag1 & 0x10) {
6195         /* reply-to (str8) */
6196         len8 = tvb_get_guint8(tvb, offset);
6197         proto_tree_add_item(props,
6198                             hf_amqp_0_10_struct_file_properties_reply_to,
6199                             tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
6200         AMQP_INCREMENT(offset, (1 + len8), max_length);
6201     }
6202     if (flag1 & 0x20) {
6203         /* message-id (str8) */
6204         len8 = tvb_get_guint8(tvb, offset);
6205         proto_tree_add_item(props,
6206                             hf_amqp_0_10_struct_file_properties_message_id,
6207                             tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
6208         AMQP_INCREMENT(offset, (1 + len8), max_length);
6209     }
6210     if (flag1 & 0x40) {
6211         /* filename (str8) */
6212         len8 = tvb_get_guint8(tvb, offset);
6213         proto_tree_add_item(props,
6214                             hf_amqp_0_10_struct_file_properties_filename,
6215                             tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
6216         AMQP_INCREMENT(offset, (1 + len8), max_length);
6217     }
6218     if (flag1 & 0x80) {
6219         /* timestamp (datetime [uint64]) */
6220         timestamp = tvb_get_ntoh64(tvb, offset);
6221         tv.secs = (time_t)timestamp;
6222         tv.nsecs = 0;
6223         proto_tree_add_time(props,
6224                             hf_amqp_0_10_struct_file_properties_timestamp,
6225                             tvb, offset, 8, &tv);
6226         AMQP_INCREMENT(offset, 8, max_length);
6227     }
6228     if (flag2 & 0x01) {
6229         /* cluster-id (str8) */
6230         len8 = tvb_get_guint8(tvb, offset);
6231         proto_tree_add_item(props,
6232                             hf_amqp_0_10_struct_file_properties_cluster_id,
6233                             tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
6234         AMQP_INCREMENT(offset, (1 + len8), max_length);
6235     }
6236 }
6237
6238 static void
6239 dissect_amqp_0_10_struct_stream_properties(tvbuff_t *tvb,
6240                                            packet_info *pinfo,
6241                                            proto_tree *tree,
6242                                            int offset,
6243                                            guint32 struct_length)
6244 {
6245     proto_item *ti;
6246     proto_item *props;
6247     proto_item *flags_item;
6248     guint8      flag1, flag2;
6249     guint8      len8;
6250     guint32     map_length;
6251     guint64     timestamp;
6252     int         max_length;
6253     nstime_t    tv;
6254
6255     max_length = offset + struct_length;
6256     props = proto_item_add_subtree(tree, ett_args);
6257     AMQP_INCREMENT(offset, 2, max_length);  /* Skip class and struct codes */
6258     flag1 = tvb_get_guint8(tvb, offset);
6259     flag2 = tvb_get_guint8(tvb, offset+1);
6260     flags_item = proto_tree_add_item(props,
6261                                      hf_amqp_0_10_argument_packing_flags,
6262                                      tvb, offset, 2, ENC_BIG_ENDIAN);
6263     if ((flag1 & ~0x1f) || (flag2 != 0))
6264         expert_add_info(pinfo, flags_item, &ei_amqp_bad_flag_value);
6265     AMQP_INCREMENT(offset, 2, max_length);
6266     if (flag1 & 0x01) {
6267         /*  content-type (str8) */
6268         len8 = tvb_get_guint8(tvb, offset);
6269         proto_tree_add_item(props,
6270                             hf_amqp_0_10_struct_stream_properties_content_type,
6271                             tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
6272         AMQP_INCREMENT(offset, (1 + len8), max_length);
6273     }
6274     if (flag1 & 0x02) {
6275         /*  content-encoding (str8) */
6276         len8 = tvb_get_guint8(tvb, offset);
6277         proto_tree_add_item(props,
6278                             hf_amqp_0_10_struct_stream_properties_content_encoding,
6279                             tvb, offset + 1, len8, ENC_ASCII|ENC_NA);
6280         AMQP_INCREMENT(offset, (1 + len8), max_length);
6281     }
6282     if (flag1 & 0x04) {
6283         /* headers (map) */
6284         map_length = tvb_get_ntohl(tvb, offset);
6285         AMQP_INCREMENT(offset, 4, max_length);
6286         ti = proto_tree_add_item(props,
6287                                  hf_amqp_0_10_struct_stream_properties_headers,
6288                                  tvb,
6289                                  offset,
6290                                  map_length, ENC_NA);
6291         dissect_amqp_0_10_map (tvb,
6292                                offset,
6293                                offset + map_length,
6294                                map_length,
6295                                ti);
6296         AMQP_INCREMENT(offset, map_length, max_length);
6297     }
6298     if (flag1 & 0x08) {
6299         /* priority (uint8) */
6300         proto_tree_add_item(props,
6301                             hf_amqp_0_10_struct_stream_properties_priority,
6302                             tvb, offset, 1, ENC_BIG_ENDIAN);
6303         AMQP_INCREMENT(offset, 1, max_length);
6304     }
6305     if (flag1 & 0x10) {
6306         /* timestamp (datetime [uint64]) */
6307         timestamp = tvb_get_ntoh64(tvb, offset);
6308         tv.secs = (time_t)timestamp;
6309         tv.nsecs = 0;
6310         proto_tree_add_time(props,
6311                             hf_amqp_0_10_struct_stream_properties_timestamp,
6312                             tvb, offset, 8, &tv);
6313         AMQP_INCREMENT(offset, 8, max_length);
6314     }
6315 }
6316
6317 static void
6318 dissect_amqp_0_10_struct32(tvbuff_t *tvb,
6319                            packet_info *pinfo,
6320                            proto_tree *tree,
6321                            int offset,
6322                            guint32 struct_length)
6323 {
6324     guint8      class_code;
6325     guint8      struct_code;
6326     guint8      flag1;
6327     guint16     size;
6328     guint16     value;
6329     guint32     array_length;
6330     guint32     consumed;
6331     proto_tree *ti;
6332     proto_tree *result;
6333
6334     consumed    = 0;
6335     class_code  = tvb_get_guint8(tvb, offset);
6336     struct_code = tvb_get_guint8(tvb, offset + 1);
6337
6338     switch(class_code) {
6339     case AMQP_0_10_CLASS_MESSAGE:
6340         switch (struct_code) {
6341         case AMQP_0_10_STRUCT_MESSAGE_DELIVERY_PROPERTIES:
6342             proto_item_set_text(tree, "message.delivery-properties");
6343             dissect_amqp_0_10_struct_delivery_properties(tvb,
6344                                                          pinfo,
6345                                                          tree,
6346                                                          offset,
6347                                                          struct_length);
6348             break;
6349         case AMQP_0_10_STRUCT_MESSAGE_FRAGMENT_PROPERTIES:
6350             proto_item_set_text(tree, "message.fragment-properties");
6351             dissect_amqp_0_10_struct_fragment_properties(tvb,
6352                                                          pinfo,
6353                                                          tree,
6354                                                          offset,
6355                                                          struct_length);
6356             break;
6357         case AMQP_0_10_STRUCT_MESSAGE_MESSAGE_PROPERTIES:
6358             proto_item_set_text(tree, "message.message-properties");
6359             dissect_amqp_0_10_struct_message_properties(tvb,
6360                                                         pinfo,
6361                                                         tree,
6362                                                         offset,
6363                                                         struct_length);
6364             break;
6365         case AMQP_0_10_STRUCT_MESSAGE_ACQUIRED:
6366             proto_item_set_text(tree, "message.acquired");
6367             result = proto_item_add_subtree(tree, ett_args);
6368             AMQP_INCREMENT(consumed, 2, struct_length);  /* Class/type codes */
6369             offset += 2;
6370             flag1 = tvb_get_guint8(tvb, offset);
6371             proto_tree_add_item(result, hf_amqp_0_10_argument_packing_flags,
6372                                 tvb, offset, 2, ENC_BIG_ENDIAN);
6373             AMQP_INCREMENT(consumed, 2, struct_length);
6374             offset += 2;
6375             if (flag1 & 0x01) {
6376                 /*  transfers (commands [sequence-set])  */
6377                 size = tvb_get_ntohs(tvb, offset);
6378                 THROW_ON(((consumed + size) > struct_length), ReportedBoundsError);
6379                 ti = proto_tree_add_item(result,
6380                                          hf_amqp_0_10_struct_acquired_transfers,
6381                                          tvb, offset, size + 2, ENC_NA);
6382                 format_amqp_0_10_sequence_set(tvb, offset + 2, size, ti);
6383             }
6384             break;
6385         case AMQP_0_10_STRUCT_MESSAGE_RESUME_RESULT:
6386             proto_item_set_text(tree, "message.resume-result");
6387             result = proto_item_add_subtree(tree, ett_args);
6388             AMQP_INCREMENT(consumed, 2, struct_length);  /* Class/type codes */
6389             offset += 2;
6390             flag1 = tvb_get_guint8(tvb, offset);
6391             proto_tree_add_item(result, hf_amqp_0_10_argument_packing_flags,
6392                                 tvb, offset, 2, ENC_BIG_ENDIAN);
6393             AMQP_INCREMENT(consumed, 2, struct_length);
6394             offset += 2;
6395             if (flag1 & 0x01) {
6396                 /*  offset (uint64)  */
6397                 proto_tree_add_item(result,
6398                                     hf_amqp_0_10_struct_resume_result_offset,
6399                                     tvb, offset, 8, ENC_BIG_ENDIAN);
6400             }
6401             break;
6402         }
6403         break;
6404
6405     case AMQP_0_10_CLASS_DTX:
6406         switch (struct_code) {
6407         case AMQP_0_10_STRUCT_DTX_XA_RESULT:
6408             AMQP_INCREMENT(consumed, 2, struct_length);  /* Class/type codes */
6409             offset += 2;
6410             /*flag1 = tvb_get_guint8(tvb, offset);*/
6411             AMQP_INCREMENT(consumed, 2, struct_length);  /* Packing bytes */
6412             offset += 2;
6413             value = tvb_get_ntohs(tvb, offset);
6414             AMQP_INCREMENT(consumed, 2, struct_length);  /* xa status value */
6415             /*offset += 2;*/
6416             proto_item_set_text(tree, "dtx.xa-status: %s",
6417                                 val_to_str(value,
6418                                            amqp_0_10_xa_status,
6419                                            "Invalid xa-status %d"));
6420             break;
6421
6422         case AMQP_0_10_STRUCT_DTX_RECOVER_RESULT:
6423             proto_item_set_text(tree, "dtx.recover-result");
6424             AMQP_INCREMENT(consumed, 2, struct_length);  /* Class/type codes */
6425             offset += 2;
6426             /*flag1 = tvb_get_guint8(tvb, offset);*/
6427             AMQP_INCREMENT(consumed, 2, struct_length);  /* Packing bytes */
6428             offset += 2;
6429             array_length = tvb_get_ntohl(tvb, offset);
6430             AMQP_INCREMENT(consumed, 4, struct_length);
6431             offset += 4;
6432             dissect_amqp_0_10_array(tvb,
6433                                     pinfo,
6434                                     offset,
6435                                     offset + array_length,
6436                                     array_length,
6437                                     tree);
6438             break;
6439         }
6440         break;
6441
6442     case AMQP_0_10_CLASS_EXCHANGE:
6443         switch (struct_code) {
6444         case AMQP_0_10_STRUCT_EXCHANGE_QUERY_RESULT:
6445             proto_item_set_text(tree, "exchange.exchange-query-result");
6446             dissect_amqp_0_10_struct_exchange_query_result(tvb,
6447                                                            pinfo,
6448                                                            tree,
6449                                                            offset,
6450                                                            struct_length);
6451             break;
6452
6453         case AMQP_0_10_STRUCT_EXCHANGE_BOUND_RESULT:
6454             proto_item_set_text(tree, "exchange.exchange-bound-result");
6455             result = proto_item_add_subtree(tree, ett_args);
6456             AMQP_INCREMENT(consumed, 2, struct_length);  /* Class/type codes */
6457             offset += 2;
6458             proto_tree_add_item(result,
6459                                 hf_amqp_0_10_struct_exchange_bound_result_exchange_not_found,
6460                                 tvb, offset, 1, ENC_BIG_ENDIAN);
6461             proto_tree_add_item(result,
6462                                 hf_amqp_0_10_struct_exchange_bound_result_queue_not_found,
6463                                 tvb, offset, 1, ENC_BIG_ENDIAN);
6464             proto_tree_add_item(result,
6465                                 hf_amqp_0_10_struct_exchange_bound_result_queue_not_matched,
6466                                 tvb, offset, 1, ENC_BIG_ENDIAN);
6467             proto_tree_add_item(result,
6468                                 hf_amqp_0_10_struct_exchange_bound_result_key_not_matched,
6469                                 tvb, offset, 1, ENC_BIG_ENDIAN);
6470             proto_tree_add_item(result,
6471                                 hf_amqp_0_10_struct_exchange_bound_result_args_not_matched,
6472                                 tvb, offset, 1, ENC_BIG_ENDIAN);
6473             break;
6474         }
6475         break;
6476
6477     case AMQP_0_10_CLASS_QUEUE:
6478         switch (struct_code) {
6479         case AMQP_0_10_STRUCT_QUEUE_QUERY_RESULT:
6480             proto_item_set_text(tree, "queue.queue-query-result");
6481             dissect_amqp_0_10_struct_queue_query_result(tvb,
6482                                                         pinfo,
6483                                                         tree,
6484                                                         offset,
6485                                                         struct_length);
6486             break;
6487         }
6488         break;
6489
6490     case AMQP_0_10_CLASS_FILE:
6491         switch (struct_code) {
6492         case AMQP_0_10_STRUCT_FILE_PROPERTIES:
6493             proto_item_set_text(tree, "file.file-properties");
6494             dissect_amqp_0_10_struct_file_properties(tvb,
6495                                                      pinfo,
6496                                                      tree,
6497                                                      offset,
6498                                                      struct_length);
6499             break;
6500         }
6501         break;
6502
6503     case AMQP_0_10_CLASS_STREAM:
6504         switch (struct_code) {
6505         case AMQP_0_10_STRUCT_STREAM_PROPERTIES:
6506             proto_item_set_text(tree, "stream.stream-properties");
6507             dissect_amqp_0_10_struct_stream_properties(tvb,
6508                                                        pinfo,
6509                                                        tree,
6510                                                        offset,
6511                                                        struct_length);
6512             break;
6513         }
6514         break;
6515     }
6516 }
6517
6518 /* decodes AMQP 1.0 list
6519  * arguments:
6520  *   tvb: obvious
6521  *   pinfo: obvious
6522  *   offset: obvious
6523  *   bound: boundary within that the list has to end
6524  *   item: obvious
6525  *   hf_amqp_type: what hf_* type is the list itself
6526  *   hf_amqp_subtype_count: length of hf_amqp_subtypes
6527  *   hf_amqp_subtypes: what hf_* types are the list items
6528  *   name: what to show for unformatted content
6529  */
6530 static guint
6531 dissect_amqp_1_0_list(tvbuff_t *tvb,
6532                       packet_info *pinfo,
6533                       int offset,
6534                       int bound,
6535                       proto_item *item,
6536                       int hf_amqp_type,
6537                       int hf_amqp_subtype_count,
6538                       const int **hf_amqp_subtypes,
6539                       const char *name)
6540 {
6541     proto_item *list_tree;
6542     guint8      type;
6543     guint8      count_len;
6544     guint32     element_count;
6545     guint32     element_size;
6546     guint32     decoded_element_size;
6547     guint32     orig_offset;
6548     int         decoded_elements;
6549     int         hf_amqp_item;
6550
6551     list_tree = 0;
6552     decoded_elements = 0;
6553     orig_offset = offset;
6554     type = tvb_get_guint8(tvb, offset);
6555     AMQP_INCREMENT(offset, 1, bound);
6556     switch (type) {
6557     case AMQP_1_0_TYPE_LIST0:
6558         count_len = 0;
6559         element_size = 0;
6560         element_count = 0;
6561         break;
6562     case AMQP_1_0_TYPE_LIST8:
6563         count_len = 1;
6564         element_size = tvb_get_guint8(tvb, offset);
6565         element_count = tvb_get_guint8(tvb, offset+count_len);
6566         break;
6567     case AMQP_1_0_TYPE_LIST32:
6568         count_len = 4;
6569         element_size = tvb_get_ntohl(tvb, offset);
6570         element_count = tvb_get_ntohl(tvb, offset+count_len);
6571         break;
6572     default:
6573         proto_tree_add_none_format(list_tree, hf_amqp_1_0_list, tvb,
6574                                    offset-1,
6575                                    1,
6576                                    "(unknown type %d)",
6577                                    type);
6578         expert_add_info_format(pinfo,
6579                                list_tree,
6580                                &ei_amqp_unknown_amqp_type,
6581                                "Unknown AMQP list type %d",
6582                                type);
6583         return bound-orig_offset;
6584     }
6585     AMQP_INCREMENT(offset, count_len*2, bound);
6586     list_tree = add_1_0_proto_item(item,
6587                                    tvb,
6588                                    offset-1-count_len*2,
6589                                    element_size+1+count_len,
6590                                    hf_amqp_type,
6591                                    name);
6592     if (element_count > 0)
6593         list_tree = proto_item_add_subtree(list_tree, ett_amqp_1_0_list);
6594     proto_item_append_text(list_tree, " (list of %d element%s)", element_count, element_suffix[element_count!=1]);
6595
6596     if (element_count > element_size)
6597     {
6598         expert_add_info_format(pinfo,
6599                                list_tree,
6600                                &ei_amqp_invalid_number_of_params,
6601                                "Number of list elements (%d) bigger than list size (%d)",
6602                                element_count, element_size);
6603         return bound-orig_offset;
6604     }
6605
6606     while ((element_count > 0) && (offset < bound)) {
6607         decoded_element_size = 0;
6608         if (decoded_elements<hf_amqp_subtype_count)
6609             hf_amqp_item = *(hf_amqp_subtypes[decoded_elements]);
6610         else
6611             hf_amqp_item = hf_amqp_1_0_list;
6612         get_amqp_1_0_type_value_formatter(tvb,
6613                                           pinfo,
6614                                           offset,
6615                                           bound,
6616                                           hf_amqp_item,
6617                                           NULL,
6618                                           &decoded_element_size,
6619                                           list_tree);
6620         element_count -= 1;
6621         decoded_elements += 1;
6622         AMQP_INCREMENT(offset, decoded_element_size, bound);
6623     }
6624     if (element_count > 0)
6625         expert_add_info_format(pinfo,
6626                                list_tree,
6627                                &ei_amqp_invalid_number_of_params,
6628                                "Number of list elements (%d) not matching number of decoded elements (%d)",
6629                                element_count+decoded_elements, decoded_elements);
6630     return offset-orig_offset;
6631 }
6632
6633 /* decodes AMQP 1.0 map
6634  *  arguments: see dissect_amqp_1_0_list
6635  */
6636 static guint
6637 dissect_amqp_1_0_map(tvbuff_t *tvb,
6638                      packet_info *pinfo,
6639                      int offset,
6640                      int bound,
6641                      proto_item *item,
6642                      int hf_amqp_type,
6643                      const char *name)
6644 {
6645     proto_item *map_tree;
6646     guint8      type;
6647     guint8      count_len;
6648     guint32     element_count;
6649     guint32     element_size;
6650     guint32     decoded_element_size;
6651     guint8      decoded_width_size;
6652     guint32     orig_offset;
6653     const char *type_name = NULL;
6654     const char *value = NULL;
6655
6656     map_tree = 0;
6657     orig_offset = offset;
6658     type = tvb_get_guint8(tvb, offset);
6659     AMQP_INCREMENT(offset, 1, bound);
6660     switch (type) {
6661     case AMQP_1_0_TYPE_MAP8:
6662         count_len = 1;
6663         element_size = tvb_get_guint8(tvb, offset);
6664         element_count = tvb_get_guint8(tvb, offset+count_len);
6665         break;
6666     case AMQP_1_0_TYPE_MAP32:
6667         count_len = 4;
6668         element_size = tvb_get_ntohl(tvb, offset);
6669         element_count = tvb_get_ntohl(tvb, offset+count_len);
6670         break;
6671     default:
6672         proto_tree_add_none_format(map_tree, hf_amqp_1_0_map, tvb,
6673                                    offset-1,
6674                                    1,
6675                                    "(unknown type %d)",
6676                                    type);
6677         expert_add_info_format(pinfo,
6678                                map_tree,
6679                                &ei_amqp_unknown_amqp_type,
6680                                "Unknown AMQP map type %d",
6681                                type);
6682         return bound-orig_offset;
6683     }
6684     AMQP_INCREMENT(offset, count_len*2, bound);
6685     map_tree = add_1_0_proto_item(item,
6686                                   tvb,
6687                                   offset-1-count_len*2,
6688                                   element_size+1+count_len,
6689                                   hf_amqp_type,
6690                                   name);
6691     if (element_count > 0)
6692         map_tree = proto_item_add_subtree(map_tree, ett_amqp_1_0_map);
6693     if (element_count%2==1) {
6694         expert_add_info_format(pinfo,
6695                                map_tree,
6696                                &ei_amqp_invalid_number_of_params,
6697                                "Odd number of map items: %d",
6698                                element_count);
6699         return bound-orig_offset;
6700     }
6701
6702     if (element_count > element_size)
6703     {
6704         expert_add_info_format(pinfo,
6705                                map_tree,
6706                                &ei_amqp_invalid_number_of_params,
6707                                "Number of map elements (%d) bigger than map size (%d)",
6708                                element_count, element_size);
6709         return bound-orig_offset;
6710     }
6711
6712     proto_item_append_text(map_tree,
6713                            " (map of %d element%s)",
6714                            (element_count/2),
6715                            element_suffix[(element_count/2)!=1]);
6716
6717     while (element_count > 0) {
6718         if (element_count%2 == 0) { /* decode key */
6719             if (!decode_fixed_type(tvb,
6720                                    tvb_get_guint8(tvb, offset),
6721                                    offset+1,
6722                                    bound,
6723                                    &decoded_width_size,
6724                                    &decoded_element_size,
6725                                    &type_name,
6726                                    &value)) { /* can't decode key type */
6727                 proto_tree_add_none_format(map_tree, hf_amqp_1_0_map, tvb,
6728                                            offset,
6729                                            1,
6730                                            "(unknown map key type %d)",
6731                                            tvb_get_guint8(tvb, offset));
6732                 expert_add_info_format(pinfo,
6733                                        map_tree,
6734                                        &ei_amqp_unknown_amqp_type,
6735                                        "Unknown AMQP map key type %d",
6736                                        tvb_get_guint8(tvb, offset));
6737                 decoded_element_size=0;
6738             }
6739             AMQP_INCREMENT(offset, decoded_element_size+1, bound);
6740         }
6741         else { /* decode value */
6742             get_amqp_1_0_type_value_formatter(tvb,
6743                                               pinfo,
6744                                               offset,
6745                                               bound,
6746                                               hf_amqp_1_0_map,
6747                                               value,
6748                                               &decoded_element_size,
6749                                               map_tree);
6750             AMQP_INCREMENT(offset, decoded_element_size, bound);
6751         }
6752         element_count--;
6753     }
6754     return offset-orig_offset;
6755 }
6756
6757 /* decodes AMQP 1.0 array
6758  *  arguments: see dissect_amqp_1_0_list
6759  */
6760 static guint
6761 dissect_amqp_1_0_array(tvbuff_t *tvb,
6762                        packet_info *pinfo,
6763                        int offset,
6764                        int bound,
6765                        proto_item *item,
6766                        int hf_amqp_type,
6767                        int hf_amqp_subtype_count,
6768                        const int **hf_amqp_subtypes,
6769                        const char *name)
6770 {
6771     proto_item *array_tree;
6772     guint8      type;
6773     guint8      count_len;
6774     guint32     element_count;
6775     guint32     element_size;
6776     guint32     element_type;
6777     guint32     decoded_element_size;
6778     guint32     orig_offset;
6779     int         decoded_elements;
6780     int         hf_amqp_item;
6781     int         hf_amqp_subtype_count_array = 0;
6782     const int   **hf_amqp_subtypes_array = NULL;
6783     const char  *type_name_array = NULL;
6784
6785     array_tree = 0;
6786     decoded_elements = 0;
6787     orig_offset = offset;
6788     type = tvb_get_guint8(tvb, offset);
6789     AMQP_INCREMENT(offset, 1, bound);
6790     switch (type) {
6791     case AMQP_1_0_TYPE_ARRAY8:
6792         count_len = 1;
6793         element_size = tvb_get_guint8(tvb, offset);
6794         element_count = tvb_get_guint8(tvb, offset+count_len);
6795         break;
6796     case AMQP_1_0_TYPE_ARRAY32:
6797         count_len = 4;
6798         element_size = tvb_get_ntohl(tvb, offset);
6799         element_count = tvb_get_ntohl(tvb, offset+count_len);
6800         break;
6801     default:
6802         proto_tree_add_none_format(array_tree, hf_amqp_1_0_list, tvb,
6803                                    offset-1,
6804                                    1,
6805                                    "(unknown type %d)",
6806                                    type);
6807         expert_add_info_format(pinfo,
6808                                array_tree,
6809                                &ei_amqp_unknown_amqp_type,
6810                                "Unknown AMQP array type %d",
6811                                type);
6812         return bound-orig_offset;
6813     }
6814     element_type = get_amqp_1_0_type_formatter(tvb,
6815                                                offset+count_len*2,
6816                                                bound,
6817                                                &hf_amqp_type,
6818                                                &type_name_array,
6819                                                &hf_amqp_subtype_count_array,
6820                                                &hf_amqp_subtypes_array,
6821                                                &decoded_element_size);
6822     AMQP_INCREMENT(offset, count_len*2+decoded_element_size, bound);
6823     array_tree = add_1_0_proto_item(item,
6824                                     tvb,
6825                                     offset-1-count_len*2-decoded_element_size,
6826                                     element_size+1+count_len,
6827                                     hf_amqp_type,
6828                                     name);
6829
6830     if (element_count > 0)
6831         array_tree = proto_item_add_subtree(array_tree, ett_amqp_1_0_array);
6832     proto_item_append_text(array_tree, " (array of %d element%s)", element_count, element_suffix[element_count!=1]);
6833
6834     if (element_count > element_size)
6835     {
6836         expert_add_info_format(pinfo,
6837                                array_tree,
6838                                &ei_amqp_invalid_number_of_params,
6839                                "Number of array elements (%d) bigger than array size (%d)",
6840                                element_count, element_size);
6841         return bound-orig_offset;
6842     }
6843
6844     while ((element_count > 0) && (offset < bound)) {
6845         decoded_element_size = 0;
6846         if (decoded_elements<hf_amqp_subtype_count)
6847             hf_amqp_item = *(hf_amqp_subtypes[decoded_elements]);
6848         else
6849             hf_amqp_item = hf_amqp_1_0_array;
6850         get_amqp_1_0_value_formatter(tvb,
6851                                      pinfo,
6852                                      element_type, /* code */
6853                                      offset,
6854                                      offset+element_size, /* bound */
6855                                      hf_amqp_item,
6856                                      (proto_registrar_get_nth(hf_amqp_type))->name, /* name */
6857                                      hf_amqp_subtype_count_array, /* subitem list count */
6858                                      hf_amqp_subtypes_array, /* subitem list hf_.. list */
6859                                      &decoded_element_size,
6860                                      array_tree);
6861         element_count -= 1;
6862         decoded_elements += 1;
6863         if (decoded_element_size==0)
6864             decoded_element_size=1; /* necessary for 0x40 or similar values where value_formatter returns size of _value_ 0 (type=1 not counted) */
6865         AMQP_INCREMENT(offset, decoded_element_size, bound);
6866     }
6867     if (element_count > 0)
6868         expert_add_info_format(pinfo,
6869                                array_tree,
6870                                &ei_amqp_invalid_number_of_params,
6871                                "Number of array elements (%d) not matching number of decoded elements (%d)",
6872                                element_count+decoded_elements, decoded_elements);
6873     return offset-orig_offset;
6874 }
6875
6876 /* decodes AMQP 1.0 AMQP performative (open, attach, transfer or so)
6877  * arguments:
6878  *   tvb, offset, length, amqp_tree, pinfo: obvious
6879  *   method_name: what to print to col_append_str method in dissect_amqp_1_0_frame
6880  */
6881 static guint32
6882 dissect_amqp_1_0_AMQP_frame(tvbuff_t *tvb,
6883                             guint offset,
6884                             guint16 bound,
6885                             proto_item *amqp_tree,
6886                             packet_info *pinfo,
6887                             const gchar **method_name)
6888 {
6889     proto_item  *args_tree;
6890     guint32     arg_length = 0;
6891     guint8      method;
6892     guint       orig_offset = offset;
6893
6894     if (bound == offset) { /* empty keepalive sent */
6895         *method_name = "(empty)";
6896         return 0;
6897     }
6898     args_tree = proto_item_add_subtree(amqp_tree, ett_args);
6899     method = tvb_get_guint8(tvb, offset+2);
6900     *method_name = val_to_str_const(method, amqp_1_0_AMQP_performatives,
6901                                     "<invalid AMQP performative>");
6902     proto_tree_add_item(args_tree, hf_amqp_1_0_amqp_performative, tvb, offset+2, 1, ENC_BIG_ENDIAN);
6903     AMQP_INCREMENT(offset, 3, bound); /* descriptor-constructor & fixed_one length & AMQP performative code */
6904     switch(method) {
6905         case AMQP_1_0_AMQP_OPEN:
6906             arg_length = dissect_amqp_1_0_list(tvb,
6907                                                pinfo,
6908                                                offset,
6909                                                bound,
6910                                                args_tree,
6911                                                hf_amqp_method_arguments,
6912                                                10, hf_amqp_1_0_amqp_open_items, NULL);
6913             break;
6914         case AMQP_1_0_AMQP_BEGIN:
6915             arg_length = dissect_amqp_1_0_list(tvb,
6916                                                pinfo,
6917                                                offset,
6918                                                bound,
6919                                                args_tree,
6920                                                hf_amqp_method_arguments,
6921                                                8, hf_amqp_1_0_amqp_begin_items, NULL);
6922             break;
6923         case AMQP_1_0_AMQP_ATTACH:
6924             arg_length = dissect_amqp_1_0_list(tvb,
6925                                                pinfo,
6926                                                offset,
6927                                                bound,
6928                                                args_tree,
6929                                                hf_amqp_method_arguments,
6930                                                14, hf_amqp_1_0_amqp_attach_items, NULL);
6931             break;
6932         case AMQP_1_0_AMQP_FLOW:
6933             arg_length = dissect_amqp_1_0_list(tvb,
6934                                                pinfo,
6935                                                offset,
6936                                                bound,
6937                                                args_tree,
6938                                                hf_amqp_method_arguments,
6939                                                11, hf_amqp_1_0_amqp_flow_items, NULL);
6940             break;
6941         case AMQP_1_0_AMQP_TRANSFER:
6942             arg_length = dissect_amqp_1_0_list(tvb,
6943                                                pinfo,
6944                                                offset,
6945                                                bound,
6946                                                args_tree,
6947                                                hf_amqp_method_arguments,
6948                                                11, hf_amqp_1_0_amqp_transfer_items, NULL);
6949             /* now decode message header, annotations, properties and data */
6950             while (offset+arg_length < bound) {
6951                 AMQP_INCREMENT(offset, arg_length, bound);
6952                 get_amqp_1_0_type_value_formatter(tvb,
6953                                                   pinfo,
6954                                                   offset,
6955                                                   bound,
6956                                                   hf_amqp_method_arguments, /* should be re-written */
6957                                                   NULL,
6958                                                   &arg_length,
6959                                                   args_tree);
6960             }
6961             break;
6962         case AMQP_1_0_AMQP_DISPOSITION:
6963             arg_length = dissect_amqp_1_0_list(tvb,
6964                                                pinfo,
6965                                                offset,
6966                                                bound,
6967                                                args_tree,
6968                                                hf_amqp_method_arguments,
6969                                                6, hf_amqp_1_0_amqp_disposition_items, NULL);
6970             break;
6971         case AMQP_1_0_AMQP_DETACH:
6972             arg_length = dissect_amqp_1_0_list(tvb,
6973                                                pinfo,
6974                                                offset,
6975                                                bound,
6976                                                args_tree,
6977                                                hf_amqp_method_arguments,
6978                                                3, hf_amqp_1_0_amqp_detach_items, NULL);
6979             break;
6980         case AMQP_1_0_AMQP_END:
6981             arg_length = dissect_amqp_1_0_list(tvb,
6982                                                pinfo,
6983                                                offset,
6984                                                bound,
6985                                                args_tree,
6986                                                hf_amqp_method_arguments,
6987                                                1, hf_amqp_1_0_amqp_end_items, NULL);
6988             break;
6989         case AMQP_1_0_AMQP_CLOSE:
6990             arg_length = dissect_amqp_1_0_list(tvb,
6991                                                pinfo,
6992                                                offset,
6993                                                bound,
6994                                                args_tree,
6995                                                hf_amqp_method_arguments,
6996                                                1, hf_amqp_1_0_amqp_close_items, NULL);
6997             break;
6998         default:
6999             expert_add_info_format(pinfo,
7000                                    amqp_tree,
7001                                    &ei_amqp_unknown_amqp_command,
7002                                    "Unknown AMQP performative %d",
7003                                    tvb_get_guint8(tvb, offset + 2));
7004             return bound-orig_offset;
7005     }
7006     return (arg_length) + (offset-orig_offset);
7007 }
7008
7009 /* decodes AMQP 1.0 SASL methods (mechanisms offer, challenge, response,..)
7010  * arguments: see dissect_amqp_1_0_AMQP_frame
7011  */
7012 static guint32
7013 dissect_amqp_1_0_SASL_frame(tvbuff_t *tvb,
7014                             guint offset,
7015                             guint16 bound,
7016                             proto_item *amqp_tree,
7017                             packet_info *pinfo,
7018                             const gchar **method_name)
7019 {
7020     proto_item  *args_tree;
7021     guint32     arg_length = 0;
7022     guint8      method;
7023     guint       orig_offset = offset;
7024
7025     args_tree = proto_item_add_subtree(amqp_tree, ett_args);
7026     method = tvb_get_guint8(tvb, offset+2);
7027     *method_name = val_to_str_const(method, amqp_1_0_SASL_methods,
7028                                     "<invalid SASL method>");
7029     proto_tree_add_item(args_tree, hf_amqp_1_0_sasl_method, tvb, offset+2, 1, ENC_BIG_ENDIAN);
7030
7031     AMQP_INCREMENT(offset, 3, bound); /* descriptor-constructor & fixed_one length & SASL method code */
7032     switch(method) {
7033         case AMQP_1_0_SASL_MECHANISMS:
7034             arg_length = dissect_amqp_1_0_list(tvb,
7035                                                pinfo,
7036                                                offset,
7037                                                bound,
7038                                                args_tree,
7039                                                hf_amqp_method_arguments,
7040                                                1, hf_amqp_1_0_sasl_mechanisms_items, NULL);
7041             break;
7042         case AMQP_1_0_SASL_INIT:
7043             arg_length = dissect_amqp_1_0_list(tvb,
7044                                                pinfo,
7045                                                offset,
7046                                                bound,
7047                                                args_tree,
7048                                                hf_amqp_method_arguments,
7049                                                3, hf_amqp_1_0_sasl_init_items, NULL);
7050             break;
7051          case AMQP_1_0_SASL_CHALLENGE:
7052             arg_length = dissect_amqp_1_0_list(tvb,
7053                                                pinfo,
7054                                                offset,
7055                                                bound,
7056                                                args_tree,
7057                                                hf_amqp_method_arguments,
7058                                                1, hf_amqp_1_0_sasl_challenge_items, NULL);
7059             break;
7060         case AMQP_1_0_SASL_RESPONSE:
7061             arg_length = dissect_amqp_1_0_list(tvb,
7062                                                pinfo,
7063                                                offset,
7064                                                bound,
7065                                                args_tree,
7066                                                hf_amqp_method_arguments,
7067                                                1, hf_amqp_1_0_sasl_response_items, NULL);
7068             break;
7069         case AMQP_1_0_SASL_OUTCOME:
7070             arg_length = dissect_amqp_1_0_list(tvb,
7071                                                pinfo,
7072                                                offset,
7073                                                bound,
7074                                                args_tree,
7075                                                hf_amqp_method_arguments,
7076                                                2, hf_amqp_1_0_sasl_outcome_items, NULL);
7077             break;
7078         default:
7079             expert_add_info_format(pinfo,
7080                                    amqp_tree,
7081                                    &ei_amqp_unknown_sasl_command,
7082                                    "Unknown SASL command %d",
7083                                    tvb_get_guint8(tvb, offset + 2));
7084             return bound-orig_offset;
7085     }
7086     return (arg_length) + (offset-orig_offset);
7087 }
7088
7089 static int
7090 dissect_amqp_1_0_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
7091 {
7092     proto_item  *ti = NULL;
7093     proto_item  *amqp_tree = NULL;
7094     guint8      frame_type;
7095     guint16     length;
7096     guint32     arg_length = 0;
7097     guint       offset;
7098     const gchar *method_name = NULL;
7099
7100 #if 0  /* XXX: Not currently used ?? */
7101     conversation_t *conv;
7102     amqp_conv *conn;
7103
7104     /* Find (or build) conversation to remember the protocol version */
7105     conv = find_or_create_conversation(pinfo);
7106     conn = conversation_get_proto_data(conv, proto_amqp);
7107 #endif
7108
7109     col_clear(pinfo->cinfo, COL_INFO);
7110
7111     /*  Heuristic - protocol initialisation frame starts with 'AMQP' followed by 0x0  */
7112     if (tvb_memeql(tvb, 0, "AMQP", 4) == 0) {
7113         guint8         proto_major;
7114         guint8         proto_minor;
7115         guint8         proto_revision;
7116         wmem_strbuf_t *strbuf;
7117
7118         proto_major    = tvb_get_guint8(tvb, 5);
7119         proto_minor    = tvb_get_guint8(tvb, 6);
7120         proto_revision = tvb_get_guint8(tvb, 7);
7121         strbuf         = wmem_strbuf_new_label(wmem_packet_scope());
7122         wmem_strbuf_append_printf(strbuf,
7123                                   "Protocol-Header%s %d-%d-%d ",
7124                                   (tvb_get_guint8(tvb, 4)==0x2) ? "(TLS)" : "", /* frame type = 2 => TLS */
7125                                   proto_major,
7126                                   proto_minor,
7127                                   proto_revision);
7128         col_append_str(pinfo->cinfo, COL_INFO, wmem_strbuf_get_str(strbuf));
7129         col_set_fence(pinfo->cinfo, COL_INFO);
7130
7131         if (tree) {
7132             ti = proto_tree_add_item(tree, proto_amqp, tvb, 0, -1, ENC_NA);
7133             amqp_tree = proto_item_add_subtree(ti, ett_amqp_init);
7134             proto_tree_add_item(amqp_tree, hf_amqp_init_protocol,         tvb, 0, 4, ENC_ASCII|ENC_NA);
7135             proto_tree_add_item(amqp_tree, hf_amqp_init_id,               tvb, 4, 1, ENC_BIG_ENDIAN);
7136             proto_tree_add_item(amqp_tree, hf_amqp_init_version_major,    tvb, 5, 1, ENC_BIG_ENDIAN);
7137             proto_tree_add_item(amqp_tree, hf_amqp_init_version_minor,    tvb, 6, 1, ENC_BIG_ENDIAN);
7138             proto_tree_add_item(amqp_tree, hf_amqp_init_version_revision, tvb, 7, 1, ENC_BIG_ENDIAN);
7139         }
7140         return 8;
7141     }
7142
7143     /* Protocol frame */
7144     if (tree) {
7145         /* frame header */
7146         ti = proto_tree_add_item(tree, proto_amqp, tvb, 0, -1, ENC_NA);
7147         amqp_tree = proto_item_add_subtree(ti, ett_amqp);
7148         proto_tree_add_item(amqp_tree, hf_amqp_1_0_size, tvb, 0, 4, ENC_BIG_ENDIAN);
7149         proto_tree_add_item(amqp_tree, hf_amqp_1_0_doff, tvb, 4, 1, ENC_BIG_ENDIAN);
7150         proto_tree_add_item(amqp_tree, hf_amqp_1_0_type, tvb, 5, 1, ENC_BIG_ENDIAN);
7151         proto_tree_add_item(amqp_tree, hf_amqp_channel,  tvb, 6, 2, ENC_BIG_ENDIAN);
7152     }
7153
7154     length     = tvb_get_ntohl(tvb, 0);
7155     offset     = 4*tvb_get_guint8(tvb,4); /* i.e. 4*DOFF */
7156     frame_type = tvb_get_guint8(tvb, 5);
7157     THROW_ON((length < offset), ReportedBoundsError);
7158
7159     switch(frame_type) {
7160     case AMQP_1_0_AMQP_FRAME:
7161         arg_length = dissect_amqp_1_0_AMQP_frame(tvb, offset, length, amqp_tree, pinfo, &method_name);
7162         break;
7163     case AMQP_1_0_SASL_FRAME:
7164         arg_length = dissect_amqp_1_0_SASL_frame(tvb, offset, length, amqp_tree, pinfo, &method_name);
7165         break;
7166     case AMQP_1_0_TLS_FRAME:
7167         /* should not occur, this is handled in '(tvb_memeql(tvb, 0, "AMQP", 4) == 0)' test above */
7168         break;
7169     default:
7170         expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_frame_type, "Unknown frame type %d", frame_type);
7171     }
7172     AMQP_INCREMENT(offset, arg_length, length);
7173     col_append_str(pinfo->cinfo, COL_INFO, method_name);
7174     col_append_str(pinfo->cinfo, COL_INFO, " ");
7175     col_set_fence(pinfo->cinfo, COL_INFO);
7176     return tvb_length(tvb);
7177 }
7178
7179 static int
7180 dissect_amqp_0_10_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
7181 {
7182     proto_item *ti;
7183     proto_item *amqp_tree = NULL;
7184     guint8      frame_type;
7185     guint16     length;
7186     guint32     struct_length;
7187     guint       offset;
7188
7189 #if 0  /* XXX: Not currently used ?? */
7190     conversation_t *conv;
7191     amqp_conv *conn;
7192
7193     /* Find (or build) conversation to remember the protocol version */
7194     conv = find_or_create_conversation(pinfo);
7195     conn = conversation_get_proto_data(conv, proto_amqp);
7196 #endif
7197
7198     col_set_str(pinfo->cinfo, COL_PROTOCOL, "AMQP");
7199     col_clear(pinfo->cinfo, COL_INFO);
7200
7201     /*  Heuristic - protocol initialisation frame starts with 'AMQP'  */
7202     if (tvb_memeql(tvb, 0, "AMQP", 4) == 0) {
7203         guint8         proto_major;
7204         guint8         proto_minor;
7205         wmem_strbuf_t *strbuf;
7206
7207         proto_major = tvb_get_guint8(tvb, 6);
7208         proto_minor = tvb_get_guint8(tvb, 7);
7209         strbuf      = wmem_strbuf_new_label(wmem_packet_scope());
7210         wmem_strbuf_append_printf(strbuf,
7211                                   "Protocol-Header %d-%d ",
7212                                   proto_major,
7213                                   proto_minor);
7214         col_append_str(pinfo->cinfo, COL_INFO, wmem_strbuf_get_str(strbuf));
7215         col_set_fence(pinfo->cinfo, COL_INFO);
7216
7217         if (tree) {
7218             ti = proto_tree_add_item(tree, proto_amqp, tvb, 0, -1, ENC_NA);
7219             amqp_tree = proto_item_add_subtree(ti, ett_amqp_init);
7220             proto_tree_add_item(amqp_tree, hf_amqp_init_protocol,      tvb, 0, 4, ENC_ASCII|ENC_NA);
7221             proto_tree_add_item(amqp_tree, hf_amqp_init_id_major,      tvb, 4, 1, ENC_BIG_ENDIAN);
7222             proto_tree_add_item(amqp_tree, hf_amqp_init_id_minor,      tvb, 5, 1, ENC_BIG_ENDIAN);
7223             proto_tree_add_item(amqp_tree, hf_amqp_init_version_major, tvb, 6, 1, ENC_BIG_ENDIAN);
7224             proto_tree_add_item(amqp_tree, hf_amqp_init_version_minor, tvb, 7, 1, ENC_BIG_ENDIAN);
7225         }
7226         return 8;
7227     }
7228
7229     /* Protocol frame */
7230     if (tree) {
7231         ti = proto_tree_add_item(tree, proto_amqp, tvb, 0, -1, ENC_NA);
7232         amqp_tree = proto_item_add_subtree(ti, ett_amqp);
7233         proto_tree_add_item(amqp_tree, hf_amqp_0_10_format,   tvb, 0, 1, ENC_BIG_ENDIAN);
7234         proto_tree_add_item(amqp_tree, hf_amqp_0_10_position, tvb, 0, 1, ENC_BIG_ENDIAN);
7235         proto_tree_add_item(amqp_tree, hf_amqp_0_10_type,     tvb, 1, 1, ENC_BIG_ENDIAN);
7236         proto_tree_add_item(amqp_tree, hf_amqp_0_10_size,     tvb, 2, 2, ENC_BIG_ENDIAN);
7237         proto_tree_add_item(amqp_tree, hf_amqp_0_10_track,    tvb, 5, 1, ENC_BIG_ENDIAN);
7238         proto_tree_add_item(amqp_tree, hf_amqp_channel,       tvb, 6, 2, ENC_BIG_ENDIAN);
7239     }
7240
7241     frame_type = tvb_get_guint8(tvb, 1);
7242     length     = tvb_get_ntohs(tvb, 2);
7243     offset     = 12;
7244     THROW_ON((length <= 13), ReportedBoundsError);
7245
7246     switch(frame_type) {
7247     case AMQP_0_10_FRAME_COMMAND:
7248         /* Fall through */
7249     case AMQP_0_10_FRAME_CONTROL:
7250         proto_tree_add_item(amqp_tree, hf_amqp_0_10_class, tvb, offset+0, 1, ENC_BIG_ENDIAN);
7251         switch(tvb_get_guint8(tvb, offset + 0)) {
7252         case AMQP_0_10_CLASS_CONNECTION:
7253             dissect_amqp_0_10_connection(tvb, pinfo, amqp_tree,
7254                                          offset, length);
7255             break;
7256         case AMQP_0_10_CLASS_SESSION:
7257             dissect_amqp_0_10_session(tvb, pinfo, amqp_tree,
7258                                       offset, length);
7259             break;
7260         case AMQP_0_10_CLASS_EXECUTION:
7261             dissect_amqp_0_10_execution(tvb, pinfo, amqp_tree,
7262                                         offset, length);
7263             break;
7264         case AMQP_0_10_CLASS_MESSAGE:
7265             dissect_amqp_0_10_message(tvb, pinfo, amqp_tree,
7266                                       offset, length);
7267             break;
7268         case AMQP_0_10_CLASS_TX:
7269             dissect_amqp_0_10_tx(tvb, pinfo, amqp_tree,
7270                                  offset, length);
7271             break;
7272         case AMQP_0_10_CLASS_DTX:
7273             dissect_amqp_0_10_dtx(tvb, pinfo, amqp_tree,
7274                                   offset, length);
7275             break;
7276         case AMQP_0_10_CLASS_EXCHANGE:
7277             dissect_amqp_0_10_exchange(tvb, pinfo, amqp_tree,
7278                                        offset, length);
7279             break;
7280         case AMQP_0_10_CLASS_QUEUE:
7281             dissect_amqp_0_10_queue(tvb, pinfo, amqp_tree,
7282                                     offset, length);
7283             break;
7284         case AMQP_0_10_CLASS_FILE:
7285             dissect_amqp_0_10_file(tvb, pinfo, amqp_tree,
7286                                    offset, length);
7287             break;
7288         case AMQP_0_10_CLASS_STREAM:
7289             dissect_amqp_0_10_stream(tvb, pinfo, amqp_tree,
7290                                      offset, length);
7291             break;
7292         default:
7293             expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_command_class, "Unknown command/control class %d", tvb_get_guint8(tvb, offset + 0));
7294         }
7295         break;
7296
7297     case AMQP_0_10_FRAME_HEADER:
7298         col_append_str(pinfo->cinfo, COL_INFO, "header ");
7299         col_set_fence(pinfo->cinfo, COL_INFO);
7300         do {
7301             struct_length = tvb_get_ntohl(tvb, offset);
7302             AMQP_INCREMENT(offset, 4, length);
7303             THROW_ON((offset + struct_length > length), ReportedBoundsError);
7304             THROW_ON((offset + struct_length < offset), ReportedBoundsError);
7305
7306             ti = proto_tree_add_item(amqp_tree,
7307                                      hf_amqp_0_10_undissected_struct32,
7308                                      tvb, offset, struct_length, ENC_NA);
7309             dissect_amqp_0_10_struct32(tvb, pinfo, ti, offset, struct_length);
7310             AMQP_INCREMENT(offset, struct_length, length);
7311         } while (offset < length);
7312         break;
7313
7314     case AMQP_0_10_FRAME_BODY:
7315         col_append_str(pinfo->cinfo, COL_INFO, "message-body ");
7316         col_set_fence(pinfo->cinfo, COL_INFO);
7317         proto_tree_add_item(amqp_tree,
7318                             hf_amqp_0_10_message_body,
7319                             tvb, offset, length - 12, ENC_NA);
7320         break;
7321
7322     default:
7323         expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_frame_type, "Unknown frame type %d", frame_type);
7324     }
7325
7326     return tvb_length(tvb);
7327 }
7328
7329 /*  Dissection routine for AMQP 0-9 frames  */
7330
7331 static int
7332 dissect_amqp_0_9_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
7333 {
7334     proto_item    *ti;
7335     proto_item    *amqp_tree = NULL;
7336     proto_item    *args_tree;
7337     proto_item    *prop_tree;
7338     guint          length;
7339     guint8         frame_type;
7340     guint16        class_id, method_id;
7341
7342     col_set_str(pinfo->cinfo, COL_PROTOCOL, "AMQP");
7343     col_clear(pinfo->cinfo, COL_INFO);
7344
7345     /*  Heuristic - protocol initialisation frame starts with 'AMQP'  */
7346     if (tvb_memeql(tvb, 0, "AMQP", 4) == 0) {
7347         guint8         proto_major;
7348         guint8         proto_minor;
7349         wmem_strbuf_t *strbuf;
7350
7351         proto_major = tvb_get_guint8(tvb, 6);
7352         proto_minor = tvb_get_guint8(tvb, 7);
7353         strbuf = wmem_strbuf_new_label(wmem_packet_scope());
7354         wmem_strbuf_append_printf(strbuf,
7355                                   "Protocol-Header %u-%u",
7356                                   proto_major,
7357                                   proto_minor);
7358         col_append_str(pinfo->cinfo, COL_INFO, wmem_strbuf_get_str(strbuf));
7359         col_set_fence(pinfo->cinfo, COL_INFO);
7360
7361         if (tree) {
7362             ti = proto_tree_add_item(tree, proto_amqp, tvb, 0, -1, ENC_NA);
7363             amqp_tree = proto_item_add_subtree(ti, ett_amqp_init);
7364             proto_tree_add_item(amqp_tree, hf_amqp_init_protocol, tvb, 0, 4, ENC_ASCII|ENC_NA);
7365             proto_tree_add_item(amqp_tree, hf_amqp_init_id_major, tvb, 4, 1, ENC_BIG_ENDIAN);
7366             proto_tree_add_item(amqp_tree, hf_amqp_init_id_minor, tvb, 5, 1, ENC_BIG_ENDIAN);
7367             proto_tree_add_item(amqp_tree, hf_amqp_init_version_major, tvb, 6, 1, ENC_BIG_ENDIAN);
7368             proto_tree_add_item(amqp_tree, hf_amqp_init_version_minor, tvb, 7, 1, ENC_BIG_ENDIAN);
7369         }
7370         return 8;
7371     }
7372
7373     if (tree) {
7374         ti = proto_tree_add_item(tree, proto_amqp, tvb, 0, -1, ENC_NA);
7375         amqp_tree = proto_item_add_subtree(ti, ett_amqp);
7376         proto_tree_add_item(amqp_tree, hf_amqp_0_9_type,   tvb, 0, 1, ENC_BIG_ENDIAN);
7377         proto_tree_add_item(amqp_tree, hf_amqp_channel,    tvb, 1, 2, ENC_BIG_ENDIAN);
7378         proto_tree_add_item(amqp_tree, hf_amqp_0_9_length, tvb, 3, 4, ENC_BIG_ENDIAN);
7379     }
7380
7381     frame_type = tvb_get_guint8(tvb, 0);
7382     length     = tvb_get_ntohl(tvb, 3);
7383
7384     switch (frame_type) {
7385     case AMQP_0_9_FRAME_TYPE_METHOD:
7386         class_id = tvb_get_ntohs(tvb, 7);
7387         proto_tree_add_item(amqp_tree, hf_amqp_0_9_method_class_id,
7388                             tvb, 7, 2, ENC_BIG_ENDIAN);
7389         switch (class_id) {
7390         case AMQP_0_9_CLASS_CONNECTION:
7391             method_id = tvb_get_ntohs(tvb, 9);
7392             proto_tree_add_item(amqp_tree, hf_amqp_method_connection_method_id,
7393                                 tvb, 9, 2, ENC_BIG_ENDIAN);
7394             ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
7395                                      tvb, 11, length - 4, ENC_NA);
7396             args_tree = proto_item_add_subtree(ti, ett_args);
7397             col_append_fstr(pinfo->cinfo, COL_INFO, "Connection.%s",
7398                             val_to_str( method_id, amqp_method_connection_methods, "Unknown (%u)"));
7399             col_set_fence(pinfo->cinfo, COL_INFO);
7400             switch (method_id) {
7401             case AMQP_0_9_METHOD_CONNECTION_START:
7402                 dissect_amqp_0_9_method_connection_start(tvb,
7403                                                          pinfo, 11, args_tree);
7404                 break;
7405             case AMQP_0_9_METHOD_CONNECTION_START_OK:
7406                 dissect_amqp_0_9_method_connection_start_ok(tvb,
7407                                                             pinfo, 11, args_tree);
7408                 break;
7409             case AMQP_0_9_METHOD_CONNECTION_SECURE:
7410                 dissect_amqp_0_9_method_connection_secure(tvb,
7411                                                           11, args_tree);
7412                 break;
7413             case AMQP_0_9_METHOD_CONNECTION_SECURE_OK:
7414                 dissect_amqp_0_9_method_connection_secure_ok(tvb,
7415                                                              11, args_tree);
7416                 break;
7417             case AMQP_0_9_METHOD_CONNECTION_TUNE:
7418                 dissect_amqp_0_9_method_connection_tune(tvb,
7419                                                         11, args_tree);
7420                 break;
7421             case AMQP_0_9_METHOD_CONNECTION_TUNE_OK:
7422                 dissect_amqp_0_9_method_connection_tune_ok(tvb,
7423                                                            11, args_tree);
7424                 break;
7425             case AMQP_0_9_METHOD_CONNECTION_OPEN:
7426                 dissect_amqp_0_9_method_connection_open(tvb,
7427                                                         11, args_tree);
7428                 break;
7429             case AMQP_0_9_METHOD_CONNECTION_OPEN_OK:
7430                 dissect_amqp_0_9_method_connection_open_ok(tvb,
7431                                                            11, args_tree);
7432                 break;
7433             case AMQP_0_9_METHOD_CONNECTION_REDIRECT:
7434                 dissect_amqp_0_9_method_connection_redirect(tvb,
7435                                                             11, args_tree);
7436                 break;
7437             case AMQP_0_9_METHOD_CONNECTION_CLOSE:
7438                 dissect_amqp_0_9_method_connection_close(tvb,
7439                                                          11, args_tree);
7440                 break;
7441             case AMQP_0_9_METHOD_CONNECTION_CLOSE_OK:
7442                 dissect_amqp_0_9_method_connection_close_ok(tvb,
7443                                                             11, args_tree);
7444                 break;
7445             default:
7446                 expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_connection_method, "Unknown connection method %u", method_id);
7447             }
7448             break;
7449         case AMQP_0_9_CLASS_CHANNEL:
7450             method_id = tvb_get_ntohs(tvb, 9);
7451             proto_tree_add_item(amqp_tree, hf_amqp_method_channel_method_id,
7452                                 tvb, 9, 2, ENC_BIG_ENDIAN);
7453             ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
7454                                      tvb, 11, length - 4, ENC_NA);
7455             args_tree = proto_item_add_subtree(ti, ett_args);
7456
7457             col_append_fstr(pinfo->cinfo, COL_INFO, "Channel.%s",
7458                             val_to_str( method_id, amqp_method_channel_methods, "Unknown (%u)"));
7459             col_set_fence(pinfo->cinfo, COL_INFO);
7460
7461             switch (method_id) {
7462             case AMQP_0_9_METHOD_CHANNEL_OPEN:
7463                 dissect_amqp_0_9_method_channel_open(tvb,
7464                                                      11, args_tree);
7465                 break;
7466             case AMQP_0_9_METHOD_CHANNEL_OPEN_OK:
7467                 dissect_amqp_0_9_method_channel_open_ok(tvb,
7468                                                         11, args_tree);
7469                 break;
7470             case AMQP_0_9_METHOD_CHANNEL_FLOW:
7471                 dissect_amqp_0_9_method_channel_flow(tvb,
7472                                                      11, args_tree);
7473                 break;
7474             case AMQP_0_9_METHOD_CHANNEL_FLOW_OK:
7475                 dissect_amqp_0_9_method_channel_flow_ok(tvb,
7476                                                         11, args_tree);
7477                 break;
7478             case AMQP_0_9_METHOD_CHANNEL_CLOSE:
7479                 dissect_amqp_0_9_method_channel_close(tvb,
7480                                                       11, args_tree);
7481                 break;
7482             case AMQP_0_9_METHOD_CHANNEL_CLOSE_OK:
7483                 dissect_amqp_0_9_method_channel_close_ok(tvb,
7484                                                          11, args_tree);
7485                 break;
7486             case AMQP_0_9_METHOD_CHANNEL_RESUME:
7487                 dissect_amqp_0_9_method_channel_resume(tvb,
7488                                                        11, args_tree);
7489                 break;
7490             case AMQP_0_9_METHOD_CHANNEL_PING:
7491                 dissect_amqp_0_9_method_channel_ping(tvb,
7492                                                      11, args_tree);
7493                 break;
7494             case AMQP_0_9_METHOD_CHANNEL_PONG:
7495                 dissect_amqp_0_9_method_channel_pong(tvb,
7496                                                      11, args_tree);
7497                 break;
7498             case AMQP_0_9_METHOD_CHANNEL_OK:
7499                 dissect_amqp_0_9_method_channel_ok(tvb,
7500                                                    11, args_tree);
7501                 break;
7502             default:
7503                 expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_channel_method, "Unknown channel method %u", method_id);
7504             }
7505             break;
7506         case AMQP_0_9_CLASS_ACCESS:
7507             method_id = tvb_get_ntohs(tvb, 9);
7508             proto_tree_add_item(amqp_tree, hf_amqp_method_access_method_id,
7509                                 tvb, 9, 2, ENC_BIG_ENDIAN);
7510             ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
7511                                      tvb, 11, length - 4, ENC_NA);
7512             args_tree = proto_item_add_subtree(ti, ett_args);
7513             switch (method_id) {
7514             case AMQP_0_9_METHOD_ACCESS_REQUEST:
7515                 dissect_amqp_0_9_method_access_request(tvb,
7516                                                        11, args_tree);
7517                 col_append_str(pinfo->cinfo, COL_INFO,
7518                                "Access.Request ");
7519                 col_set_fence(pinfo->cinfo, COL_INFO);
7520                 break;
7521             case AMQP_0_9_METHOD_ACCESS_REQUEST_OK:
7522                 dissect_amqp_0_9_method_access_request_ok(tvb,
7523                                                           11, args_tree);
7524                 col_append_str(pinfo->cinfo, COL_INFO,
7525                                "Access.Request-Ok ");
7526                 col_set_fence(pinfo->cinfo, COL_INFO);
7527                 break;
7528             default:
7529                 expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_access_method, "Unknown access method %u", method_id);
7530             }
7531             break;
7532         case AMQP_0_9_CLASS_EXCHANGE:
7533             method_id = tvb_get_ntohs(tvb, 9);
7534             proto_tree_add_item(amqp_tree, hf_amqp_method_exchange_method_id,
7535                                 tvb, 9, 2, ENC_BIG_ENDIAN);
7536             ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
7537                                      tvb, 11, length - 4, ENC_NA);
7538             args_tree = proto_item_add_subtree(ti, ett_args);
7539             col_append_fstr(pinfo->cinfo, COL_INFO, "Exchange.%s",
7540                             val_to_str( method_id, amqp_method_exchange_methods, "Unknown (%u)"));
7541             col_set_fence(pinfo->cinfo, COL_INFO);
7542             switch (method_id) {
7543             case AMQP_0_9_METHOD_EXCHANGE_DECLARE:
7544                 dissect_amqp_0_9_method_exchange_declare(tvb,
7545                                                          pinfo, 11, args_tree);
7546                 break;
7547             case AMQP_0_9_METHOD_EXCHANGE_DECLARE_OK:
7548                 dissect_amqp_0_9_method_exchange_declare_ok(tvb,
7549                                                             11, args_tree);
7550                 break;
7551             case AMQP_0_9_METHOD_EXCHANGE_BIND:
7552                 dissect_amqp_0_9_method_exchange_bind(tvb,
7553                                                       pinfo, 11, args_tree);
7554                 break;
7555             case AMQP_0_9_METHOD_EXCHANGE_BIND_OK:
7556                 dissect_amqp_0_9_method_exchange_bind_ok(tvb,
7557                                                          11, args_tree);
7558                 break;
7559             case AMQP_0_9_METHOD_EXCHANGE_DELETE:
7560                 dissect_amqp_0_9_method_exchange_delete(tvb,
7561                                                         11, args_tree);
7562                 break;
7563             case AMQP_0_9_METHOD_EXCHANGE_DELETE_OK:
7564                 dissect_amqp_0_9_method_exchange_delete_ok(tvb,
7565                                                            11, args_tree);
7566                 break;
7567             default:
7568                 expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_exchange_method, "Unknown exchange method %u", method_id);
7569             }
7570             break;
7571         case AMQP_0_9_CLASS_QUEUE:
7572             method_id = tvb_get_ntohs(tvb, 9);
7573             proto_tree_add_item(amqp_tree, hf_amqp_method_queue_method_id,
7574                                 tvb, 9, 2, ENC_BIG_ENDIAN);
7575             ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
7576                                      tvb, 11, length - 4, ENC_NA);
7577             args_tree = proto_item_add_subtree(ti, ett_args);
7578             col_append_fstr(pinfo->cinfo, COL_INFO, "Queue.%s",
7579                             val_to_str( method_id, amqp_method_queue_methods, "Unknown (%u)"));
7580             col_set_fence(pinfo->cinfo, COL_INFO);
7581
7582             switch (method_id) {
7583             case AMQP_0_9_METHOD_QUEUE_DECLARE:
7584                 dissect_amqp_0_9_method_queue_declare(tvb,
7585                                                       pinfo, 11, args_tree);
7586                 break;
7587             case AMQP_0_9_METHOD_QUEUE_DECLARE_OK:
7588                 dissect_amqp_0_9_method_queue_declare_ok(tvb,
7589                                                          11, args_tree);
7590                 break;
7591             case AMQP_0_9_METHOD_QUEUE_BIND:
7592                 dissect_amqp_0_9_method_queue_bind(tvb,
7593                                                    pinfo, 11, args_tree);
7594                 break;
7595             case AMQP_0_9_METHOD_QUEUE_BIND_OK:
7596                 dissect_amqp_0_9_method_queue_bind_ok(tvb,
7597                                                       11, args_tree);
7598                 break;
7599             case AMQP_0_9_METHOD_QUEUE_UNBIND:
7600                 dissect_amqp_0_9_method_queue_unbind(tvb,
7601                                                      pinfo, 11, args_tree);
7602                 break;
7603             case AMQP_0_9_METHOD_QUEUE_UNBIND_OK:
7604                 dissect_amqp_0_9_method_queue_unbind_ok(tvb,
7605                                                         11, args_tree);
7606                 break;
7607             case AMQP_0_9_METHOD_QUEUE_PURGE:
7608                 dissect_amqp_0_9_method_queue_purge(tvb,
7609                                                     11, args_tree);
7610                 break;
7611             case AMQP_0_9_METHOD_QUEUE_PURGE_OK:
7612                 dissect_amqp_0_9_method_queue_purge_ok(tvb,
7613                                                        11, args_tree);
7614                 break;
7615             case AMQP_0_9_METHOD_QUEUE_DELETE:
7616                 dissect_amqp_0_9_method_queue_delete(tvb,
7617                                                      11, args_tree);
7618                 break;
7619             case AMQP_0_9_METHOD_QUEUE_DELETE_OK:
7620                 dissect_amqp_0_9_method_queue_delete_ok(tvb,
7621                                                         11, args_tree);
7622                 break;
7623             default:
7624                 expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_queue_method, "Unknown queue method %u", method_id);
7625             }
7626             break;
7627         case AMQP_0_9_CLASS_BASIC:
7628             method_id = tvb_get_ntohs(tvb, 9);
7629             proto_tree_add_item(amqp_tree, hf_amqp_method_basic_method_id,
7630                                 tvb, 9, 2, ENC_BIG_ENDIAN);
7631             ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
7632                                      tvb, 11, length - 4, ENC_NA);
7633             args_tree = proto_item_add_subtree(ti, ett_args);
7634
7635             col_append_fstr(pinfo->cinfo, COL_INFO, "Basic.%s",
7636                             val_to_str( method_id, amqp_method_basic_methods, "Unknown (%u)"));
7637             col_set_fence(pinfo->cinfo, COL_INFO);
7638
7639             switch (method_id) {
7640             case AMQP_0_9_METHOD_BASIC_QOS:
7641                 dissect_amqp_0_9_method_basic_qos(tvb,
7642                                                   11, args_tree);
7643                 break;
7644             case AMQP_0_9_METHOD_BASIC_QOS_OK:
7645                 dissect_amqp_0_9_method_basic_qos_ok(tvb,
7646                                                      11, args_tree);
7647                 break;
7648             case AMQP_0_9_METHOD_BASIC_CONSUME:
7649                 dissect_amqp_0_9_method_basic_consume(tvb,
7650                                                       pinfo, 11, args_tree);
7651                 break;
7652             case AMQP_0_9_METHOD_BASIC_CONSUME_OK:
7653                 dissect_amqp_0_9_method_basic_consume_ok(tvb,
7654                                                          11, args_tree);
7655                 break;
7656             case AMQP_0_9_METHOD_BASIC_CANCEL:
7657                 dissect_amqp_0_9_method_basic_cancel(tvb,
7658                                                      11, args_tree);
7659                 break;
7660             case AMQP_0_9_METHOD_BASIC_CANCEL_OK:
7661                 dissect_amqp_0_9_method_basic_cancel_ok(tvb,
7662                                                         11, args_tree);
7663                 break;
7664             case AMQP_0_9_METHOD_BASIC_PUBLISH:
7665                 dissect_amqp_0_9_method_basic_publish(tvb,
7666                                                       11, args_tree);
7667                 break;
7668             case AMQP_0_9_METHOD_BASIC_RETURN:
7669                 dissect_amqp_0_9_method_basic_return(tvb,
7670                                                      11, args_tree);
7671                 break;
7672             case AMQP_0_9_METHOD_BASIC_DELIVER:
7673                 dissect_amqp_0_9_method_basic_deliver(tvb,
7674                                                       11, args_tree);
7675                 break;
7676             case AMQP_0_9_METHOD_BASIC_GET:
7677                 dissect_amqp_0_9_method_basic_get(tvb,
7678                                                   11, args_tree);
7679                 break;
7680             case AMQP_0_9_METHOD_BASIC_GET_OK:
7681                 dissect_amqp_0_9_method_basic_get_ok(tvb,
7682                                                      11, args_tree);
7683                 break;
7684             case AMQP_0_9_METHOD_BASIC_GET_EMPTY:
7685                 dissect_amqp_0_9_method_basic_get_empty(tvb,
7686                                                         11, args_tree);
7687                 break;
7688             case AMQP_0_9_METHOD_BASIC_ACK:
7689                 dissect_amqp_0_9_method_basic_ack(tvb,
7690                                                   11, args_tree);
7691                 break;
7692             case AMQP_0_9_METHOD_BASIC_REJECT:
7693                 dissect_amqp_0_9_method_basic_reject(tvb,
7694                                                      11, args_tree);
7695                 break;
7696             case AMQP_0_9_METHOD_BASIC_RECOVER:
7697                 dissect_amqp_0_9_method_basic_recover(tvb,
7698                                                       11, args_tree);
7699                 break;
7700             default:
7701                 expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_basic_method, "Unknown basic method %u", method_id);
7702             }
7703             break;
7704         case AMQP_0_9_CLASS_FILE:
7705             method_id = tvb_get_ntohs(tvb, 9);
7706             proto_tree_add_item(amqp_tree, hf_amqp_method_file_method_id,
7707                                 tvb, 9, 2, ENC_BIG_ENDIAN);
7708             ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
7709                                      tvb, 11, length - 4, ENC_NA);
7710             args_tree = proto_item_add_subtree(ti, ett_args);
7711
7712             col_append_fstr(pinfo->cinfo, COL_INFO, "File.%s",
7713                             val_to_str( method_id, amqp_method_file_methods, "Unknown (%u)"));
7714             col_set_fence(pinfo->cinfo, COL_INFO);
7715
7716             switch (method_id) {
7717             case AMQP_0_9_METHOD_FILE_QOS:
7718                 dissect_amqp_0_9_method_file_qos(tvb,
7719                                                  11, args_tree);
7720                 break;
7721             case AMQP_0_9_METHOD_FILE_QOS_OK:
7722                 dissect_amqp_0_9_method_file_qos_ok(tvb,
7723                                                     11, args_tree);
7724                 break;
7725             case AMQP_0_9_METHOD_FILE_CONSUME:
7726                 dissect_amqp_0_9_method_file_consume(tvb,
7727                                                      pinfo, 11, args_tree);
7728                 break;
7729             case AMQP_0_9_METHOD_FILE_CONSUME_OK:
7730                 dissect_amqp_0_9_method_file_consume_ok(tvb,
7731                                                         11, args_tree);
7732                 break;
7733             case AMQP_0_9_METHOD_FILE_CANCEL:
7734                 dissect_amqp_0_9_method_file_cancel(tvb,
7735                                                     11, args_tree);
7736                 break;
7737             case AMQP_0_9_METHOD_FILE_CANCEL_OK:
7738                 dissect_amqp_0_9_method_file_cancel_ok(tvb,
7739                                                        11, args_tree);
7740                 break;
7741             case AMQP_0_9_METHOD_FILE_OPEN:
7742                 dissect_amqp_0_9_method_file_open(tvb,
7743                                                   11, args_tree);
7744                 break;
7745             case AMQP_0_9_METHOD_FILE_OPEN_OK:
7746                 dissect_amqp_0_9_method_file_open_ok(tvb,
7747                                                      11, args_tree);
7748                 break;
7749             case AMQP_0_9_METHOD_FILE_STAGE:
7750                 dissect_amqp_0_9_method_file_stage(tvb,
7751                                                    11, args_tree);
7752                 break;
7753             case AMQP_0_9_METHOD_FILE_PUBLISH:
7754                 dissect_amqp_0_9_method_file_publish(tvb,
7755                                                      11, args_tree);
7756                 break;
7757             case AMQP_0_9_METHOD_FILE_RETURN:
7758                 dissect_amqp_0_9_method_file_return(tvb,
7759                                                     11, args_tree);
7760                 break;
7761             case AMQP_0_9_METHOD_FILE_DELIVER:
7762                 dissect_amqp_0_9_method_file_deliver(tvb,
7763                                                      11, args_tree);
7764                 break;
7765             case AMQP_0_9_METHOD_FILE_ACK:
7766                 dissect_amqp_0_9_method_file_ack(tvb,
7767                                                  11, args_tree);
7768                 break;
7769             case AMQP_0_9_METHOD_FILE_REJECT:
7770                 dissect_amqp_0_9_method_file_reject(tvb,
7771                                                     11, args_tree);
7772                 break;
7773             default:
7774                 expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_file_method, "Unknown file method %u", method_id);
7775             }
7776             break;
7777         case AMQP_0_9_CLASS_STREAM:
7778             method_id = tvb_get_ntohs(tvb, 9);
7779             proto_tree_add_item(amqp_tree, hf_amqp_method_stream_method_id,
7780                                 tvb, 9, 2, ENC_BIG_ENDIAN);
7781             ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
7782                                      tvb, 11, length - 4, ENC_NA);
7783             args_tree = proto_item_add_subtree(ti, ett_args);
7784
7785             col_append_fstr(pinfo->cinfo, COL_INFO, "Stream.%s",
7786                             val_to_str( method_id, amqp_method_stream_methods, "Unknown (%u)"));
7787             col_set_fence(pinfo->cinfo, COL_INFO);
7788
7789             switch (method_id) {
7790             case AMQP_0_9_METHOD_STREAM_QOS:
7791                 dissect_amqp_0_9_method_stream_qos(tvb,
7792                                                    11, args_tree);
7793                 break;
7794             case AMQP_0_9_METHOD_STREAM_QOS_OK:
7795                 dissect_amqp_0_9_method_stream_qos_ok(tvb,
7796                                                       11, args_tree);
7797                 break;
7798             case AMQP_0_9_METHOD_STREAM_CONSUME:
7799                 dissect_amqp_0_9_method_stream_consume(tvb,
7800                                                        pinfo, 11, args_tree);
7801                 break;
7802             case AMQP_0_9_METHOD_STREAM_CONSUME_OK:
7803                 dissect_amqp_0_9_method_stream_consume_ok(tvb,
7804                                                           11, args_tree);
7805                 break;
7806             case AMQP_0_9_METHOD_STREAM_CANCEL:
7807                 dissect_amqp_0_9_method_stream_cancel(tvb,
7808                                                       11, args_tree);
7809                 break;
7810             case AMQP_0_9_METHOD_STREAM_CANCEL_OK:
7811                 dissect_amqp_0_9_method_stream_cancel_ok(tvb,
7812                                                          11, args_tree);
7813                 break;
7814             case AMQP_0_9_METHOD_STREAM_PUBLISH:
7815                 dissect_amqp_0_9_method_stream_publish(tvb,
7816                                                        11, args_tree);
7817                 break;
7818             case AMQP_0_9_METHOD_STREAM_RETURN:
7819                 dissect_amqp_0_9_method_stream_return(tvb,
7820                                                       11, args_tree);
7821                 break;
7822             case AMQP_0_9_METHOD_STREAM_DELIVER:
7823                 dissect_amqp_0_9_method_stream_deliver(tvb,
7824                                                        11, args_tree);
7825                 break;
7826             default:
7827                 expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_stream_method, "Unknown stream method %u", method_id);
7828             }
7829             break;
7830         case AMQP_0_9_CLASS_TX:
7831             method_id = tvb_get_ntohs(tvb, 9);
7832             proto_tree_add_item(amqp_tree, hf_amqp_method_tx_method_id,
7833                                 tvb, 9, 2, ENC_BIG_ENDIAN);
7834             ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
7835                                      tvb, 11, length - 4, ENC_NA);
7836             args_tree = proto_item_add_subtree(ti, ett_args);
7837
7838             col_append_fstr(pinfo->cinfo, COL_INFO, "Tx.%s",
7839                             val_to_str( method_id, amqp_method_tx_methods, "Unknown (%u)"));
7840             col_set_fence(pinfo->cinfo, COL_INFO);
7841
7842             switch (method_id) {
7843             case AMQP_0_9_METHOD_TX_SELECT:
7844                 dissect_amqp_0_9_method_tx_select(tvb,
7845                                                   11, args_tree);
7846                 break;
7847             case AMQP_0_9_METHOD_TX_SELECT_OK:
7848                 dissect_amqp_0_9_method_tx_select_ok(tvb,
7849                                                      11, args_tree);
7850                 break;
7851             case AMQP_0_9_METHOD_TX_COMMIT:
7852                 dissect_amqp_0_9_method_tx_commit(tvb,
7853                                                   11, args_tree);
7854                 break;
7855             case AMQP_0_9_METHOD_TX_COMMIT_OK:
7856                 dissect_amqp_0_9_method_tx_commit_ok(tvb,
7857                                                      11, args_tree);
7858                 break;
7859             case AMQP_0_9_METHOD_TX_ROLLBACK:
7860                 dissect_amqp_0_9_method_tx_rollback(tvb,
7861                                                     11, args_tree);
7862                 break;
7863             case AMQP_0_9_METHOD_TX_ROLLBACK_OK:
7864                 dissect_amqp_0_9_method_tx_rollback_ok(tvb,
7865                                                        11, args_tree);
7866                 break;
7867             default:
7868                 expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_tx_method, "Unknown tx method %u", method_id);
7869             }
7870             break;
7871         case AMQP_0_9_CLASS_DTX:
7872             method_id = tvb_get_ntohs(tvb, 9);
7873             proto_tree_add_item(amqp_tree, hf_amqp_method_dtx_method_id,
7874                                 tvb, 9, 2, ENC_BIG_ENDIAN);
7875             ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
7876                                      tvb, 11, length - 4, ENC_NA);
7877             args_tree = proto_item_add_subtree(ti, ett_args);
7878
7879             col_append_fstr(pinfo->cinfo, COL_INFO, "Dtx.%s",
7880                             val_to_str( method_id, amqp_method_dtx_methods, "Unknown (%u)"));
7881             col_set_fence(pinfo->cinfo, COL_INFO);
7882
7883             switch (method_id) {
7884             case AMQP_0_9_METHOD_DTX_SELECT:
7885                 dissect_amqp_0_9_method_dtx_select(tvb,
7886                                                    11, args_tree);
7887                 break;
7888             case AMQP_0_9_METHOD_DTX_SELECT_OK:
7889                 dissect_amqp_0_9_method_dtx_select_ok(tvb,
7890                                                       11, args_tree);
7891                 break;
7892             case AMQP_0_9_METHOD_DTX_START:
7893                 dissect_amqp_0_9_method_dtx_start(tvb,
7894                                                   11, args_tree);
7895                 break;
7896             case AMQP_0_9_METHOD_DTX_START_OK:
7897                 dissect_amqp_0_9_method_dtx_start_ok(tvb,
7898                                                      11, args_tree);
7899                 break;
7900             default:
7901                 expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_dtx_method, "Unknown dtx method %u", method_id);
7902             }
7903             break;
7904         case AMQP_0_9_CLASS_TUNNEL:
7905             method_id = tvb_get_ntohs(tvb, 9);
7906             proto_tree_add_item(amqp_tree, hf_amqp_method_tunnel_method_id,
7907                                 tvb, 9, 2, ENC_BIG_ENDIAN);
7908             ti = proto_tree_add_item(amqp_tree, hf_amqp_method_arguments,
7909                                      tvb, 11, length - 4, ENC_NA);
7910             args_tree = proto_item_add_subtree(ti, ett_args);
7911             switch (method_id) {
7912             case AMQP_0_9_METHOD_TUNNEL_REQUEST:
7913                 dissect_amqp_0_9_method_tunnel_request(tvb,
7914                                                        pinfo, 11, args_tree);
7915                 col_append_str(pinfo->cinfo, COL_INFO,
7916                                "Tunnel.Request ");
7917                 col_set_fence(pinfo->cinfo, COL_INFO);
7918                 break;
7919             default:
7920                 expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_tunnel_method, "Unknown tunnel method %u", method_id);
7921             }
7922             break;
7923         default:
7924             expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_method_class, "Unknown method class %u", class_id);
7925         }
7926         break;
7927     case AMQP_0_9_FRAME_TYPE_CONTENT_HEADER:
7928         class_id = tvb_get_ntohs(tvb, 7);
7929         proto_tree_add_item(amqp_tree, hf_amqp_header_class_id,
7930                             tvb, 7, 2, ENC_BIG_ENDIAN);
7931         proto_tree_add_item(amqp_tree, hf_amqp_header_weight,
7932                             tvb, 9, 2, ENC_BIG_ENDIAN);
7933         proto_tree_add_item(amqp_tree, hf_amqp_header_body_size,
7934                             tvb, 11, 8, ENC_BIG_ENDIAN);
7935         proto_tree_add_item(amqp_tree, hf_amqp_header_property_flags,
7936                             tvb, 19, 2, ENC_BIG_ENDIAN);
7937         ti = proto_tree_add_item(amqp_tree, hf_amqp_header_properties,
7938                                  tvb, 21, length - 14, ENC_NA);
7939         prop_tree = proto_item_add_subtree(ti, ett_props);
7940         switch (class_id) {
7941         case AMQP_0_9_CLASS_BASIC:
7942             dissect_amqp_0_9_content_header_basic(tvb,
7943                                                   pinfo, 21, prop_tree);
7944             break;
7945         case AMQP_0_9_CLASS_FILE:
7946             dissect_amqp_0_9_content_header_file(tvb,
7947                                                  pinfo, 21, prop_tree);
7948             break;
7949         case AMQP_0_9_CLASS_STREAM:
7950             dissect_amqp_0_9_content_header_stream(tvb,
7951                                                    pinfo, 21, prop_tree);
7952             break;
7953         case AMQP_0_9_CLASS_TUNNEL:
7954             dissect_amqp_0_9_content_header_tunnel(tvb,
7955                                                    pinfo, 21, prop_tree);
7956             break;
7957         default:
7958             expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_header_class, "Unknown header class %u", class_id);
7959         }
7960         col_append_str(pinfo->cinfo, COL_INFO, "Content-Header ");
7961         col_set_fence(pinfo->cinfo, COL_INFO);
7962         break;
7963     case AMQP_0_9_FRAME_TYPE_CONTENT_BODY:
7964         proto_tree_add_item(amqp_tree, hf_amqp_payload,
7965                             tvb, 7, length, ENC_NA);
7966         col_append_str(pinfo->cinfo, COL_INFO, "Content-Body ");
7967         col_set_fence(pinfo->cinfo, COL_INFO);
7968         break;
7969     default:
7970         expert_add_info_format(pinfo, amqp_tree, &ei_amqp_unknown_frame_type, "Unknown frame type %u", frame_type);
7971     }
7972
7973     return tvb_length(tvb);
7974 }
7975
7976 /*  Dissection routine for method Connection.Start                        */
7977
7978 static int
7979 dissect_amqp_0_9_method_connection_start(tvbuff_t *tvb, packet_info *pinfo,
7980     int offset, proto_tree *args_tree)
7981 {
7982     proto_item *ti;
7983
7984     /*  version-major (octet)    */
7985     proto_tree_add_item(args_tree, hf_amqp_method_connection_start_version_major,
7986         tvb, offset, 1, ENC_BIG_ENDIAN);
7987     offset += 1;
7988
7989     /*  version-minor (octet)    */
7990     proto_tree_add_item(args_tree, hf_amqp_method_connection_start_version_minor,
7991         tvb, offset, 1, ENC_BIG_ENDIAN);
7992     offset += 1;
7993
7994     /*  server-properties (table)  */
7995     ti = proto_tree_add_item(
7996         args_tree, hf_amqp_method_connection_start_server_properties,
7997         tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
7998     dissect_amqp_0_9_field_table(tvb, pinfo, offset + 4, tvb_get_ntohl(tvb, offset), ti);
7999     offset += 4 + tvb_get_ntohl(tvb, offset);
8000
8001     /*  mechanisms (longstr)     */
8002     proto_tree_add_item(args_tree, hf_amqp_0_9_method_connection_start_mechanisms,
8003         tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
8004     offset += 4 + tvb_get_ntohl(tvb, offset);
8005
8006     /*  locales (longstr)        */
8007     proto_tree_add_item(args_tree, hf_amqp_0_9_method_connection_start_locales,
8008         tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
8009     offset += 4 + tvb_get_ntohl(tvb, offset);
8010
8011     return offset;
8012 }
8013
8014 /*  Dissection routine for method Connection.Start-Ok                     */
8015
8016 static int
8017 dissect_amqp_0_9_method_connection_start_ok(tvbuff_t *tvb, packet_info *pinfo,
8018     int offset, proto_tree *args_tree)
8019 {
8020     proto_item *ti;
8021
8022     /*  client-properties (table)  */
8023     ti = proto_tree_add_item(
8024         args_tree, hf_amqp_method_connection_start_ok_client_properties,
8025         tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
8026     dissect_amqp_0_9_field_table(tvb, pinfo, offset + 4, tvb_get_ntohl(tvb, offset), ti);
8027     offset += 4 + tvb_get_ntohl(tvb, offset);
8028
8029     /*  mechanism (shortstr)     */
8030     proto_tree_add_item(args_tree, hf_amqp_method_connection_start_ok_mechanism,
8031         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8032     offset += 1 + tvb_get_guint8(tvb, offset);
8033
8034     /*  response (longstr)       */
8035     proto_tree_add_item(args_tree, hf_amqp_method_connection_start_ok_response,
8036         tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
8037     offset += 4 + tvb_get_ntohl(tvb, offset);
8038
8039     /*  locale (shortstr)        */
8040     proto_tree_add_item(args_tree, hf_amqp_method_connection_start_ok_locale,
8041         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8042     offset += 1 + tvb_get_guint8(tvb, offset);
8043
8044     return offset;
8045 }
8046
8047 /*  Dissection routine for method Connection.Secure                       */
8048
8049 static int
8050 dissect_amqp_0_9_method_connection_secure(tvbuff_t *tvb,
8051     int offset, proto_tree *args_tree)
8052 {
8053     /*  challenge (longstr)      */
8054     proto_tree_add_item(args_tree, hf_amqp_method_connection_secure_challenge,
8055         tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
8056     offset += 4 + tvb_get_ntohl(tvb, offset);
8057
8058     return offset;
8059 }
8060
8061 /*  Dissection routine for method Connection.Secure-Ok                    */
8062
8063 static int
8064 dissect_amqp_0_9_method_connection_secure_ok(tvbuff_t *tvb,
8065     int offset, proto_tree *args_tree)
8066 {
8067     /*  response (longstr)       */
8068     proto_tree_add_item(args_tree, hf_amqp_method_connection_secure_ok_response,
8069         tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
8070     offset += 4 + tvb_get_ntohl(tvb, offset);
8071
8072     return offset;
8073 }
8074
8075 /*  Dissection routine for method Connection.Tune                         */
8076
8077 static int
8078 dissect_amqp_0_9_method_connection_tune(tvbuff_t *tvb,
8079     int offset, proto_tree *args_tree)
8080 {
8081     /*  channel-max (short)      */
8082     proto_tree_add_item(args_tree, hf_amqp_method_connection_tune_channel_max,
8083         tvb, offset, 2, ENC_BIG_ENDIAN);
8084     offset += 2;
8085
8086     /*  frame-max (long)         */
8087     proto_tree_add_item(args_tree, hf_amqp_0_9_method_connection_tune_frame_max,
8088         tvb, offset, 4, ENC_BIG_ENDIAN);
8089     offset += 4;
8090
8091     /*  heartbeat (short)        */
8092     proto_tree_add_item(args_tree, hf_amqp_0_9_method_connection_tune_heartbeat,
8093         tvb, offset, 2, ENC_BIG_ENDIAN);
8094     offset += 2;
8095
8096     return offset;
8097 }
8098
8099 /*  Dissection routine for method Connection.Tune-Ok                      */
8100
8101 static int
8102 dissect_amqp_0_9_method_connection_tune_ok(tvbuff_t *tvb,
8103     int offset, proto_tree *args_tree)
8104 {
8105     /*  channel-max (short)      */
8106     proto_tree_add_item(args_tree, hf_amqp_method_connection_tune_ok_channel_max,
8107         tvb, offset, 2, ENC_BIG_ENDIAN);
8108     offset += 2;
8109
8110     /*  frame-max (long)         */
8111     proto_tree_add_item(args_tree, hf_amqp_0_9_method_connection_tune_ok_frame_max,
8112         tvb, offset, 4, ENC_BIG_ENDIAN);
8113     offset += 4;
8114
8115     /*  heartbeat (short)        */
8116     proto_tree_add_item(args_tree, hf_amqp_method_connection_tune_ok_heartbeat,
8117         tvb, offset, 2, ENC_BIG_ENDIAN);
8118     offset += 2;
8119
8120     return offset;
8121 }
8122
8123 /*  Dissection routine for method Connection.Open                         */
8124
8125 static int
8126 dissect_amqp_0_9_method_connection_open(tvbuff_t *tvb,
8127     int offset, proto_tree *args_tree)
8128 {
8129     /*  virtual-host (shortstr)  */
8130     proto_tree_add_item(args_tree, hf_amqp_method_connection_open_virtual_host,
8131         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8132     offset += 1 + tvb_get_guint8(tvb, offset);
8133
8134     /*  capabilities (shortstr)  */
8135     proto_tree_add_item(args_tree, hf_amqp_0_9_method_connection_open_capabilities,
8136         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8137     offset += 1 + tvb_get_guint8(tvb, offset);
8138
8139     /*  insist (bit)             */
8140     proto_tree_add_item(args_tree, hf_amqp_0_9_method_connection_open_insist,
8141         tvb, offset, 1, ENC_BIG_ENDIAN);
8142
8143     return offset;
8144 }
8145
8146 /*  Dissection routine for method Connection.Open-Ok                      */
8147
8148 static int
8149 dissect_amqp_0_9_method_connection_open_ok(tvbuff_t *tvb,
8150     int offset, proto_tree *args_tree)
8151 {
8152     /*  known-hosts (shortstr)   */
8153     proto_tree_add_item(args_tree, hf_amqp_0_9_method_connection_open_ok_known_hosts,
8154         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8155     offset += 1 + tvb_get_guint8(tvb, offset);
8156
8157     return offset;
8158 }
8159
8160 /*  Dissection routine for method Connection.Redirect                     */
8161
8162 static int
8163 dissect_amqp_0_9_method_connection_redirect(tvbuff_t *tvb,
8164     int offset, proto_tree *args_tree)
8165 {
8166     /*  host (shortstr)          */
8167     proto_tree_add_item(args_tree, hf_amqp_method_connection_redirect_host,
8168         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8169     offset += 1 + tvb_get_guint8(tvb, offset);
8170
8171     /*  known-hosts (shortstr)   */
8172     proto_tree_add_item(args_tree, hf_amqp_0_9_method_connection_redirect_known_hosts,
8173         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8174     offset += 1 + tvb_get_guint8(tvb, offset);
8175
8176     return offset;
8177 }
8178
8179 /*  Dissection routine for method Connection.Close                        */
8180
8181 static int
8182 dissect_amqp_0_9_method_connection_close(tvbuff_t *tvb,
8183     int offset, proto_tree *args_tree)
8184 {
8185     /*  reply-code (short)       */
8186     proto_tree_add_item(args_tree, hf_amqp_0_9_method_connection_close_reply_code,
8187         tvb, offset, 2, ENC_BIG_ENDIAN);
8188     offset += 2;
8189
8190     /*  reply-text (shortstr)    */
8191     proto_tree_add_item(args_tree, hf_amqp_method_connection_close_reply_text,
8192         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8193     offset += 1 + tvb_get_guint8(tvb, offset);
8194
8195     /*  class-id (short)         */
8196     proto_tree_add_item(args_tree, hf_amqp_method_connection_close_class_id,
8197         tvb, offset, 2, ENC_BIG_ENDIAN);
8198     offset += 2;
8199
8200     /*  method-id (short)        */
8201     proto_tree_add_item(args_tree, hf_amqp_method_connection_close_method_id,
8202         tvb, offset, 2, ENC_BIG_ENDIAN);
8203     offset += 2;
8204
8205     return offset;
8206 }
8207
8208 /*  Dissection routine for method Connection.Close-Ok                     */
8209
8210 static int
8211 dissect_amqp_0_9_method_connection_close_ok(tvbuff_t *tvb _U_,
8212     int offset, proto_tree *args_tree _U_)
8213 {
8214     return offset;
8215 }
8216
8217 /*  Dissection routine for method Channel.Open                            */
8218
8219 static int
8220 dissect_amqp_0_9_method_channel_open(tvbuff_t *tvb,
8221     int offset, proto_tree *args_tree)
8222 {
8223     /*  out-of-band (shortstr)   */
8224     proto_tree_add_item(args_tree, hf_amqp_method_channel_open_out_of_band,
8225         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8226     offset += 1 + tvb_get_guint8(tvb, offset);
8227
8228     return offset;
8229 }
8230
8231 /*  Dissection routine for method Channel.Open-Ok                         */
8232
8233 static int
8234 dissect_amqp_0_9_method_channel_open_ok(tvbuff_t *tvb,
8235     int offset, proto_tree *args_tree)
8236 {
8237     /*  channel-id (longstr)     */
8238     proto_tree_add_item(args_tree, hf_amqp_method_channel_open_ok_channel_id,
8239         tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
8240     offset += 4 + tvb_get_ntohl(tvb, offset);
8241
8242     return offset;
8243 }
8244
8245 /*  Dissection routine for method Channel.Flow                            */
8246
8247 static int
8248 dissect_amqp_0_9_method_channel_flow(tvbuff_t *tvb,
8249     int offset, proto_tree *args_tree)
8250 {
8251     /*  active (bit)             */
8252     proto_tree_add_item(args_tree, hf_amqp_method_channel_flow_active,
8253         tvb, offset, 1, ENC_BIG_ENDIAN);
8254
8255     return offset;
8256 }
8257
8258 /*  Dissection routine for method Channel.Flow-Ok                         */
8259
8260 static int
8261 dissect_amqp_0_9_method_channel_flow_ok(tvbuff_t *tvb,
8262     int offset, proto_tree *args_tree)
8263 {
8264     /*  active (bit)             */
8265     proto_tree_add_item(args_tree, hf_amqp_method_channel_flow_ok_active,
8266         tvb, offset, 1, ENC_BIG_ENDIAN);
8267
8268     return offset;
8269 }
8270
8271 /*  Dissection routine for method Channel.Close                           */
8272
8273 static int
8274 dissect_amqp_0_9_method_channel_close(tvbuff_t *tvb,
8275     int offset, proto_tree *args_tree)
8276 {
8277     /*  reply-code (short)       */
8278     proto_tree_add_item(args_tree, hf_amqp_method_channel_close_reply_code,
8279         tvb, offset, 2, ENC_BIG_ENDIAN);
8280     offset += 2;
8281
8282     /*  reply-text (shortstr)    */
8283     proto_tree_add_item(args_tree, hf_amqp_method_channel_close_reply_text,
8284         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8285     offset += 1 + tvb_get_guint8(tvb, offset);
8286
8287     /*  class-id (short)         */
8288     proto_tree_add_item(args_tree, hf_amqp_method_channel_close_class_id,
8289         tvb, offset, 2, ENC_BIG_ENDIAN);
8290     offset += 2;
8291
8292     /*  method-id (short)        */
8293     proto_tree_add_item(args_tree, hf_amqp_method_channel_close_method_id,
8294         tvb, offset, 2, ENC_BIG_ENDIAN);
8295     offset += 2;
8296
8297     return offset;
8298 }
8299
8300 /*  Dissection routine for method Channel.Close-Ok                        */
8301
8302 static int
8303 dissect_amqp_0_9_method_channel_close_ok(tvbuff_t *tvb _U_,
8304     int offset, proto_tree *args_tree _U_)
8305 {
8306     return offset;
8307 }
8308
8309 /*  Dissection routine for method Channel.Resume                          */
8310
8311 static int
8312 dissect_amqp_0_9_method_channel_resume(tvbuff_t *tvb,
8313     int offset, proto_tree *args_tree)
8314 {
8315     /*  channel-id (longstr)     */
8316     proto_tree_add_item(args_tree, hf_amqp_method_channel_resume_channel_id,
8317         tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
8318     offset += 4 + tvb_get_ntohl(tvb, offset);
8319
8320     return offset;
8321 }
8322
8323 /*  Dissection routine for method Channel.Ping                            */
8324
8325 static int
8326 dissect_amqp_0_9_method_channel_ping(tvbuff_t *tvb _U_,
8327     int offset, proto_tree *args_tree _U_)
8328 {
8329     return offset;
8330 }
8331
8332 /*  Dissection routine for method Channel.Pong                            */
8333
8334 static int
8335 dissect_amqp_0_9_method_channel_pong(tvbuff_t *tvb _U_,
8336     int offset, proto_tree *args_tree _U_)
8337 {
8338     return offset;
8339 }
8340
8341 /*  Dissection routine for method Channel.Ok                              */
8342
8343 static int
8344 dissect_amqp_0_9_method_channel_ok(tvbuff_t *tvb _U_,
8345     int offset, proto_tree *args_tree _U_)
8346 {
8347     return offset;
8348 }
8349
8350 /*  Dissection routine for method Access.Request                          */
8351
8352 static int
8353 dissect_amqp_0_9_method_access_request(tvbuff_t *tvb,
8354     int offset, proto_tree *args_tree)
8355 {
8356     /*  realm (shortstr)         */
8357     proto_tree_add_item(args_tree, hf_amqp_method_access_request_realm,
8358         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8359     offset += 1 + tvb_get_guint8(tvb, offset);
8360
8361     /*  exclusive (bit)          */
8362     proto_tree_add_item(args_tree, hf_amqp_method_access_request_exclusive,
8363         tvb, offset, 1, ENC_BIG_ENDIAN);
8364
8365     /*  passive (bit)            */
8366     proto_tree_add_item(args_tree, hf_amqp_method_access_request_passive,
8367         tvb, offset, 1, ENC_BIG_ENDIAN);
8368
8369     /*  active (bit)             */
8370     proto_tree_add_item(args_tree, hf_amqp_method_access_request_active,
8371         tvb, offset, 1, ENC_BIG_ENDIAN);
8372
8373     /*  write (bit)              */
8374     proto_tree_add_item(args_tree, hf_amqp_method_access_request_write,
8375         tvb, offset, 1, ENC_BIG_ENDIAN);
8376
8377     /*  read (bit)               */
8378     proto_tree_add_item(args_tree, hf_amqp_method_access_request_read,
8379         tvb, offset, 1, ENC_BIG_ENDIAN);
8380
8381     return offset;
8382 }
8383
8384 /*  Dissection routine for method Access.Request-Ok                       */
8385
8386 static int
8387 dissect_amqp_0_9_method_access_request_ok(tvbuff_t *tvb,
8388     int offset, proto_tree *args_tree)
8389 {
8390     /*  ticket (short)           */
8391     proto_tree_add_item(args_tree, hf_amqp_method_access_request_ok_ticket,
8392         tvb, offset, 2, ENC_BIG_ENDIAN);
8393     offset += 2;
8394
8395     return offset;
8396 }
8397
8398 /*  Dissection routine for method Exchange.Declare                        */
8399
8400 static int
8401 dissect_amqp_0_9_method_exchange_declare(tvbuff_t *tvb, packet_info *pinfo,
8402     int offset, proto_tree *args_tree)
8403 {
8404     proto_item *ti;
8405
8406     /*  ticket (short)           */
8407     proto_tree_add_item(args_tree, hf_amqp_method_exchange_declare_ticket,
8408         tvb, offset, 2, ENC_BIG_ENDIAN);
8409     offset += 2;
8410
8411     /*  exchange (shortstr)      */
8412     proto_tree_add_item(args_tree, hf_amqp_method_exchange_declare_exchange,
8413         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8414     offset += 1 + tvb_get_guint8(tvb, offset);
8415
8416     /*  type (shortstr)          */
8417     proto_tree_add_item(args_tree, hf_amqp_method_exchange_declare_type,
8418         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8419     offset += 1 + tvb_get_guint8(tvb, offset);
8420
8421     /*  passive (bit)            */
8422     proto_tree_add_item(args_tree, hf_amqp_method_exchange_declare_passive,
8423         tvb, offset, 1, ENC_BIG_ENDIAN);
8424
8425     /*  durable (bit)            */
8426     proto_tree_add_item(args_tree, hf_amqp_method_exchange_declare_durable,
8427         tvb, offset, 1, ENC_BIG_ENDIAN);
8428
8429     /*  auto-delete (bit)        */
8430     proto_tree_add_item(args_tree, hf_amqp_method_exchange_declare_auto_delete,
8431         tvb, offset, 1, ENC_BIG_ENDIAN);
8432
8433     /*  internal (bit)           */
8434     proto_tree_add_item(args_tree, hf_amqp_method_exchange_declare_internal,
8435         tvb, offset, 1, ENC_BIG_ENDIAN);
8436
8437     /*  nowait (bit)             */
8438     proto_tree_add_item(args_tree, hf_amqp_method_exchange_declare_nowait,
8439         tvb, offset, 1, ENC_BIG_ENDIAN);
8440
8441     offset += 1;
8442     /*  arguments (table)        */
8443     ti = proto_tree_add_item(
8444         args_tree, hf_amqp_method_exchange_declare_arguments,
8445         tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
8446     dissect_amqp_0_9_field_table(tvb, pinfo, offset + 4, tvb_get_ntohl(tvb, offset), ti);
8447     offset += 4 + tvb_get_ntohl(tvb, offset);
8448
8449     return offset;
8450 }
8451
8452 /*  Dissection routine for method Exchange.Declare-Ok                     */
8453
8454 static int
8455 dissect_amqp_0_9_method_exchange_declare_ok(tvbuff_t *tvb _U_,
8456     int offset, proto_tree *args_tree _U_)
8457 {
8458     return offset;
8459 }
8460
8461 /*  Dissection routine for method Exchange.Bind                           */
8462
8463 static int
8464 dissect_amqp_0_9_method_exchange_bind(tvbuff_t *tvb, packet_info *pinfo,
8465     int offset, proto_tree *args_tree)
8466 {
8467     proto_item *ti;
8468
8469     /*  ticket (short)           */
8470     proto_tree_add_item(args_tree, hf_amqp_method_exchange_declare_ticket,
8471         tvb, offset, 2, ENC_BIG_ENDIAN);
8472     offset += 2;
8473
8474     /*  destination (shortstr)      */
8475     proto_tree_add_item(args_tree, hf_amqp_method_exchange_bind_destination,
8476         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8477     offset += 1 + tvb_get_guint8(tvb, offset);
8478
8479     /*  source (shortstr)      */
8480     proto_tree_add_item(args_tree, hf_amqp_method_exchange_bind_source,
8481         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8482     offset += 1 + tvb_get_guint8(tvb, offset);
8483
8484     /*  routing-key (shortstr)      */
8485     proto_tree_add_item(args_tree, hf_amqp_method_exchange_bind_routing_key,
8486         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8487     offset += 1 + tvb_get_guint8(tvb, offset);
8488
8489     /*  nowait (bit)             */
8490     proto_tree_add_item(args_tree, hf_amqp_method_exchange_bind_nowait,
8491         tvb, offset, 1, ENC_BIG_ENDIAN);
8492     offset += 1;
8493
8494     /*  arguments (table)        */
8495     ti = proto_tree_add_item(
8496         args_tree, hf_amqp_method_exchange_bind_arguments,
8497         tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
8498     dissect_amqp_0_9_field_table(tvb, pinfo, offset + 4, tvb_get_ntohl(tvb, offset), ti);
8499     offset += 4 + tvb_get_ntohl(tvb, offset);
8500
8501     return offset;
8502 }
8503
8504 /*  Dissection routine for method Exchange.Bind-Ok                        */
8505
8506 static int
8507 dissect_amqp_0_9_method_exchange_bind_ok(tvbuff_t *tvb _U_,
8508     int offset, proto_tree *args_tree _U_)
8509 {
8510     return offset;
8511 }
8512
8513 /*  Dissection routine for method Exchange.Delete                         */
8514
8515 static int
8516 dissect_amqp_0_9_method_exchange_delete(tvbuff_t *tvb,
8517     int offset, proto_tree *args_tree)
8518 {
8519     /*  ticket (short)           */
8520     proto_tree_add_item(args_tree, hf_amqp_method_exchange_delete_ticket,
8521         tvb, offset, 2, ENC_BIG_ENDIAN);
8522     offset += 2;
8523
8524     /*  exchange (shortstr)      */
8525     proto_tree_add_item(args_tree, hf_amqp_method_exchange_delete_exchange,
8526         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8527     offset += 1 + tvb_get_guint8(tvb, offset);
8528
8529     /*  if-unused (bit)          */
8530     proto_tree_add_item(args_tree, hf_amqp_method_exchange_delete_if_unused,
8531         tvb, offset, 1, ENC_BIG_ENDIAN);
8532
8533     /*  nowait (bit)             */
8534     proto_tree_add_item(args_tree, hf_amqp_method_exchange_delete_nowait,
8535         tvb, offset, 1, ENC_BIG_ENDIAN);
8536
8537     return offset;
8538 }
8539
8540 /*  Dissection routine for method Exchange.Delete-Ok                      */
8541
8542 static int
8543 dissect_amqp_0_9_method_exchange_delete_ok(tvbuff_t *tvb _U_,
8544     int offset, proto_tree *args_tree _U_)
8545 {
8546     return offset;
8547 }
8548
8549 /*  Dissection routine for method Queue.Declare                           */
8550
8551 static int
8552 dissect_amqp_0_9_method_queue_declare(tvbuff_t *tvb, packet_info *pinfo,
8553     int offset, proto_tree *args_tree)
8554 {
8555     proto_item *ti;
8556
8557     /*  ticket (short)           */
8558     proto_tree_add_item(args_tree, hf_amqp_method_queue_declare_ticket,
8559         tvb, offset, 2, ENC_BIG_ENDIAN);
8560     offset += 2;
8561
8562     /*  queue (shortstr)         */
8563     proto_tree_add_item(args_tree, hf_amqp_method_queue_declare_queue,
8564         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8565     offset += 1 + tvb_get_guint8(tvb, offset);
8566
8567     /*  passive (bit)            */
8568     proto_tree_add_item(args_tree, hf_amqp_method_queue_declare_passive,
8569         tvb, offset, 1, ENC_BIG_ENDIAN);
8570
8571     /*  durable (bit)            */
8572     proto_tree_add_item(args_tree, hf_amqp_method_queue_declare_durable,
8573         tvb, offset, 1, ENC_BIG_ENDIAN);
8574
8575     /*  exclusive (bit)          */
8576     proto_tree_add_item(args_tree, hf_amqp_method_queue_declare_exclusive,
8577         tvb, offset, 1, ENC_BIG_ENDIAN);
8578
8579     /*  auto-delete (bit)        */
8580     proto_tree_add_item(args_tree, hf_amqp_method_queue_declare_auto_delete,
8581         tvb, offset, 1, ENC_BIG_ENDIAN);
8582
8583     /*  nowait (bit)             */
8584     proto_tree_add_item(args_tree, hf_amqp_method_queue_declare_nowait,
8585         tvb, offset, 1, ENC_BIG_ENDIAN);
8586
8587     offset += 1;
8588     /*  arguments (table)        */
8589     ti = proto_tree_add_item(
8590         args_tree, hf_amqp_method_queue_declare_arguments,
8591         tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
8592     dissect_amqp_0_9_field_table(tvb, pinfo, offset + 4, tvb_get_ntohl(tvb, offset), ti);
8593     offset += 4 + tvb_get_ntohl(tvb, offset);
8594
8595     return offset;
8596 }
8597
8598 /*  Dissection routine for method Queue.Declare-Ok                        */
8599
8600 static int
8601 dissect_amqp_0_9_method_queue_declare_ok(tvbuff_t *tvb,
8602     int offset, proto_tree *args_tree)
8603 {
8604     /*  queue (shortstr)         */
8605     proto_tree_add_item(args_tree, hf_amqp_method_queue_declare_ok_queue,
8606         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8607     offset += 1 + tvb_get_guint8(tvb, offset);
8608
8609     /*  message-count (long)     */
8610     proto_tree_add_item(args_tree, hf_amqp_method_queue_declare_ok_message_count,
8611         tvb, offset, 4, ENC_BIG_ENDIAN);
8612     offset += 4;
8613
8614     /*  consumer-count (long)    */
8615     proto_tree_add_item(args_tree, hf_amqp_method_queue_declare_ok_consumer_count,
8616         tvb, offset, 4, ENC_BIG_ENDIAN);
8617     offset += 4;
8618
8619     return offset;
8620 }
8621
8622 /*  Dissection routine for method Queue.Bind                              */
8623
8624 static int
8625 dissect_amqp_0_9_method_queue_bind(tvbuff_t *tvb, packet_info *pinfo,
8626     int offset, proto_tree *args_tree)
8627 {
8628     proto_item *ti;
8629
8630     /*  ticket (short)           */
8631     proto_tree_add_item(args_tree, hf_amqp_method_queue_bind_ticket,
8632         tvb, offset, 2, ENC_BIG_ENDIAN);
8633     offset += 2;
8634
8635     /*  queue (shortstr)         */
8636     proto_tree_add_item(args_tree, hf_amqp_method_queue_bind_queue,
8637         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8638     offset += 1 + tvb_get_guint8(tvb, offset);
8639
8640     /*  exchange (shortstr)      */
8641     proto_tree_add_item(args_tree, hf_amqp_method_queue_bind_exchange,
8642         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8643     offset += 1 + tvb_get_guint8(tvb, offset);
8644
8645     /*  routing-key (shortstr)   */
8646     proto_tree_add_item(args_tree, hf_amqp_method_queue_bind_routing_key,
8647         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8648     offset += 1 + tvb_get_guint8(tvb, offset);
8649
8650     /*  nowait (bit)             */
8651     proto_tree_add_item(args_tree, hf_amqp_method_queue_bind_nowait,
8652         tvb, offset, 1, ENC_BIG_ENDIAN);
8653
8654     offset += 1;
8655     /*  arguments (table)        */
8656     ti = proto_tree_add_item(
8657         args_tree, hf_amqp_method_queue_bind_arguments,
8658         tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
8659     dissect_amqp_0_9_field_table(tvb, pinfo, offset + 4, tvb_get_ntohl(tvb, offset), ti);
8660     offset += 4 + tvb_get_ntohl(tvb, offset);
8661
8662     return offset;
8663 }
8664
8665 /*  Dissection routine for method Queue.Bind-Ok                           */
8666
8667 static int
8668 dissect_amqp_0_9_method_queue_bind_ok(tvbuff_t *tvb _U_,
8669     int offset, proto_tree *args_tree _U_)
8670 {
8671     return offset;
8672 }
8673
8674 /*  Dissection routine for method Queue.Unbind                            */
8675
8676 static int
8677 dissect_amqp_0_9_method_queue_unbind(tvbuff_t *tvb, packet_info *pinfo,
8678     int offset, proto_tree *args_tree)
8679 {
8680     proto_item *ti;
8681
8682     /*  ticket (short)           */
8683     proto_tree_add_item(args_tree, hf_amqp_method_queue_unbind_ticket,
8684         tvb, offset, 2, ENC_BIG_ENDIAN);
8685     offset += 2;
8686
8687     /*  queue (shortstr)         */
8688     proto_tree_add_item(args_tree, hf_amqp_method_queue_unbind_queue,
8689         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8690     offset += 1 + tvb_get_guint8(tvb, offset);
8691
8692     /*  exchange (shortstr)      */
8693     proto_tree_add_item(args_tree, hf_amqp_method_queue_unbind_exchange,
8694         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8695     offset += 1 + tvb_get_guint8(tvb, offset);
8696
8697     /*  routing-key (shortstr)   */
8698     proto_tree_add_item(args_tree, hf_amqp_method_queue_unbind_routing_key,
8699         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8700     offset += 1 + tvb_get_guint8(tvb, offset);
8701
8702     /*  arguments (table)        */
8703     ti = proto_tree_add_item(
8704         args_tree, hf_amqp_method_queue_unbind_arguments,
8705         tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
8706     dissect_amqp_0_9_field_table(tvb, pinfo, offset + 4, tvb_get_ntohl(tvb, offset), ti);
8707     offset += 4 + tvb_get_ntohl(tvb, offset);
8708
8709     return offset;
8710 }
8711
8712 /*  Dissection routine for method Queue.Unbind-Ok                         */
8713
8714 static int
8715 dissect_amqp_0_9_method_queue_unbind_ok(tvbuff_t *tvb _U_,
8716     int offset, proto_tree *args_tree _U_)
8717 {
8718     return offset;
8719 }
8720
8721 /*  Dissection routine for method Queue.Purge                             */
8722
8723 static int
8724 dissect_amqp_0_9_method_queue_purge(tvbuff_t *tvb,
8725     int offset, proto_tree *args_tree)
8726 {
8727     /*  ticket (short)           */
8728     proto_tree_add_item(args_tree, hf_amqp_method_queue_purge_ticket,
8729         tvb, offset, 2, ENC_BIG_ENDIAN);
8730     offset += 2;
8731
8732     /*  queue (shortstr)         */
8733     proto_tree_add_item(args_tree, hf_amqp_method_queue_purge_queue,
8734         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8735     offset += 1 + tvb_get_guint8(tvb, offset);
8736
8737     /*  nowait (bit)             */
8738     proto_tree_add_item(args_tree, hf_amqp_method_queue_purge_nowait,
8739         tvb, offset, 1, ENC_BIG_ENDIAN);
8740
8741     return offset;
8742 }
8743
8744 /*  Dissection routine for method Queue.Purge-Ok                          */
8745
8746 static int
8747 dissect_amqp_0_9_method_queue_purge_ok(tvbuff_t *tvb,
8748     int offset, proto_tree *args_tree)
8749 {
8750     /*  message-count (long)     */
8751     proto_tree_add_item(args_tree, hf_amqp_method_queue_purge_ok_message_count,
8752         tvb, offset, 4, ENC_BIG_ENDIAN);
8753     offset += 4;
8754
8755     return offset;
8756 }
8757
8758 /*  Dissection routine for method Queue.Delete                            */
8759
8760 static int
8761 dissect_amqp_0_9_method_queue_delete(tvbuff_t *tvb,
8762     int offset, proto_tree *args_tree)
8763 {
8764     /*  ticket (short)           */
8765     proto_tree_add_item(args_tree, hf_amqp_method_queue_delete_ticket,
8766         tvb, offset, 2, ENC_BIG_ENDIAN);
8767     offset += 2;
8768
8769     /*  queue (shortstr)         */
8770     proto_tree_add_item(args_tree, hf_amqp_method_queue_delete_queue,
8771         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8772     offset += 1 + tvb_get_guint8(tvb, offset);
8773
8774     /*  if-unused (bit)          */
8775     proto_tree_add_item(args_tree, hf_amqp_method_queue_delete_if_unused,
8776         tvb, offset, 1, ENC_BIG_ENDIAN);
8777
8778     /*  if-empty (bit)           */
8779     proto_tree_add_item(args_tree, hf_amqp_method_queue_delete_if_empty,
8780         tvb, offset, 1, ENC_BIG_ENDIAN);
8781
8782     /*  nowait (bit)             */
8783     proto_tree_add_item(args_tree, hf_amqp_method_queue_delete_nowait,
8784         tvb, offset, 1, ENC_BIG_ENDIAN);
8785
8786     return offset;
8787 }
8788
8789 /*  Dissection routine for method Queue.Delete-Ok                         */
8790
8791 static int
8792 dissect_amqp_0_9_method_queue_delete_ok(tvbuff_t *tvb,
8793     int offset, proto_tree *args_tree)
8794 {
8795     /*  message-count (long)     */
8796     proto_tree_add_item(args_tree, hf_amqp_method_queue_delete_ok_message_count,
8797         tvb, offset, 4, ENC_BIG_ENDIAN);
8798     offset += 4;
8799
8800     return offset;
8801 }
8802
8803 /*  Dissection routine for method Basic.Qos                               */
8804
8805 static int
8806 dissect_amqp_0_9_method_basic_qos(tvbuff_t *tvb,
8807     int offset, proto_tree *args_tree)
8808 {
8809     /*  prefetch-size (long)     */
8810     proto_tree_add_item(args_tree, hf_amqp_method_basic_qos_prefetch_size,
8811         tvb, offset, 4, ENC_BIG_ENDIAN);
8812     offset += 4;
8813
8814     /*  prefetch-count (short)   */
8815     proto_tree_add_item(args_tree, hf_amqp_method_basic_qos_prefetch_count,
8816         tvb, offset, 2, ENC_BIG_ENDIAN);
8817     offset += 2;
8818
8819     /*  global (bit)             */
8820     proto_tree_add_item(args_tree, hf_amqp_method_basic_qos_global,
8821         tvb, offset, 1, ENC_BIG_ENDIAN);
8822
8823     return offset;
8824 }
8825
8826 /*  Dissection routine for method Basic.Qos-Ok                            */
8827
8828 static int
8829 dissect_amqp_0_9_method_basic_qos_ok(tvbuff_t *tvb _U_,
8830     int offset, proto_tree *args_tree _U_)
8831 {
8832     return offset;
8833 }
8834
8835 /*  Dissection routine for method Basic.Consume                           */
8836
8837 static int
8838 dissect_amqp_0_9_method_basic_consume(tvbuff_t *tvb, packet_info *pinfo,
8839     int offset, proto_tree *args_tree)
8840 {
8841     proto_item *ti;
8842
8843     /*  ticket (short)           */
8844     proto_tree_add_item(args_tree, hf_amqp_method_basic_consume_ticket,
8845         tvb, offset, 2, ENC_BIG_ENDIAN);
8846     offset += 2;
8847
8848     /*  queue (shortstr)         */
8849     proto_tree_add_item(args_tree, hf_amqp_method_basic_consume_queue,
8850         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8851     offset += 1 + tvb_get_guint8(tvb, offset);
8852
8853     /*  consumer-tag (shortstr)  */
8854     proto_tree_add_item(args_tree, hf_amqp_method_basic_consume_consumer_tag,
8855         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8856     offset += 1 + tvb_get_guint8(tvb, offset);
8857
8858     /*  no-local (bit)           */
8859     proto_tree_add_item(args_tree, hf_amqp_method_basic_consume_no_local,
8860         tvb, offset, 1, ENC_BIG_ENDIAN);
8861
8862     /*  no-ack (bit)             */
8863     proto_tree_add_item(args_tree, hf_amqp_method_basic_consume_no_ack,
8864         tvb, offset, 1, ENC_BIG_ENDIAN);
8865
8866     /*  exclusive (bit)          */
8867     proto_tree_add_item(args_tree, hf_amqp_method_basic_consume_exclusive,
8868         tvb, offset, 1, ENC_BIG_ENDIAN);
8869
8870     /*  nowait (bit)             */
8871     proto_tree_add_item(args_tree, hf_amqp_method_basic_consume_nowait,
8872         tvb, offset, 1, ENC_BIG_ENDIAN);
8873
8874     offset += 1;
8875     /*  filter (table)           */
8876     ti = proto_tree_add_item(
8877         args_tree, hf_amqp_method_basic_consume_filter,
8878         tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
8879     dissect_amqp_0_9_field_table(tvb, pinfo, offset + 4, tvb_get_ntohl(tvb, offset), ti);
8880     offset += 4 + tvb_get_ntohl(tvb, offset);
8881
8882     return offset;
8883 }
8884
8885 /*  Dissection routine for method Basic.Consume-Ok                        */
8886
8887 static int
8888 dissect_amqp_0_9_method_basic_consume_ok(tvbuff_t *tvb,
8889     int offset, proto_tree *args_tree)
8890 {
8891     /*  consumer-tag (shortstr)  */
8892     proto_tree_add_item(args_tree, hf_amqp_method_basic_consume_ok_consumer_tag,
8893         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8894     offset += 1 + tvb_get_guint8(tvb, offset);
8895
8896     return offset;
8897 }
8898
8899 /*  Dissection routine for method Basic.Cancel                            */
8900
8901 static int
8902 dissect_amqp_0_9_method_basic_cancel(tvbuff_t *tvb,
8903     int offset, proto_tree *args_tree)
8904 {
8905     /*  consumer-tag (shortstr)  */
8906     proto_tree_add_item(args_tree, hf_amqp_method_basic_cancel_consumer_tag,
8907         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8908     offset += 1 + tvb_get_guint8(tvb, offset);
8909
8910     /*  nowait (bit)             */
8911     proto_tree_add_item(args_tree, hf_amqp_method_basic_cancel_nowait,
8912         tvb, offset, 1, ENC_BIG_ENDIAN);
8913
8914     return offset;
8915 }
8916
8917 /*  Dissection routine for method Basic.Cancel-Ok                         */
8918
8919 static int
8920 dissect_amqp_0_9_method_basic_cancel_ok(tvbuff_t *tvb,
8921     int offset, proto_tree *args_tree)
8922 {
8923     /*  consumer-tag (shortstr)  */
8924     proto_tree_add_item(args_tree, hf_amqp_method_basic_cancel_ok_consumer_tag,
8925         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8926     offset += 1 + tvb_get_guint8(tvb, offset);
8927
8928     return offset;
8929 }
8930
8931 /*  Dissection routine for method Basic.Publish                           */
8932
8933 static int
8934 dissect_amqp_0_9_method_basic_publish(tvbuff_t *tvb,
8935     int offset, proto_tree *args_tree)
8936 {
8937     /*  ticket (short)           */
8938     proto_tree_add_item(args_tree, hf_amqp_method_basic_publish_ticket,
8939         tvb, offset, 2, ENC_BIG_ENDIAN);
8940     offset += 2;
8941
8942     /*  exchange (shortstr)      */
8943     proto_tree_add_item(args_tree, hf_amqp_method_basic_publish_exchange,
8944         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8945     offset += 1 + tvb_get_guint8(tvb, offset);
8946
8947     /*  routing-key (shortstr)   */
8948     proto_tree_add_item(args_tree, hf_amqp_method_basic_publish_routing_key,
8949         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8950     offset += 1 + tvb_get_guint8(tvb, offset);
8951
8952     /*  mandatory (bit)          */
8953     proto_tree_add_item(args_tree, hf_amqp_method_basic_publish_mandatory,
8954         tvb, offset, 1, ENC_BIG_ENDIAN);
8955
8956     /*  immediate (bit)          */
8957     proto_tree_add_item(args_tree, hf_amqp_method_basic_publish_immediate,
8958         tvb, offset, 1, ENC_BIG_ENDIAN);
8959
8960     return offset;
8961 }
8962
8963 /*  Dissection routine for method Basic.Return                            */
8964
8965 static int
8966 dissect_amqp_0_9_method_basic_return(tvbuff_t *tvb,
8967     int offset, proto_tree *args_tree)
8968 {
8969     /*  reply-code (short)       */
8970     proto_tree_add_item(args_tree, hf_amqp_method_basic_return_reply_code,
8971         tvb, offset, 2, ENC_BIG_ENDIAN);
8972     offset += 2;
8973
8974     /*  reply-text (shortstr)    */
8975     proto_tree_add_item(args_tree, hf_amqp_method_basic_return_reply_text,
8976         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8977     offset += 1 + tvb_get_guint8(tvb, offset);
8978
8979     /*  exchange (shortstr)      */
8980     proto_tree_add_item(args_tree, hf_amqp_method_basic_return_exchange,
8981         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8982     offset += 1 + tvb_get_guint8(tvb, offset);
8983
8984     /*  routing-key (shortstr)   */
8985     proto_tree_add_item(args_tree, hf_amqp_method_basic_return_routing_key,
8986         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
8987     offset += 1 + tvb_get_guint8(tvb, offset);
8988
8989     return offset;
8990 }
8991
8992 /*  Dissection routine for method Basic.Deliver                           */
8993
8994 static int
8995 dissect_amqp_0_9_method_basic_deliver(tvbuff_t *tvb,
8996     int offset, proto_tree *args_tree)
8997 {
8998     /*  consumer-tag (shortstr)  */
8999     proto_tree_add_item(args_tree, hf_amqp_method_basic_deliver_consumer_tag,
9000         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9001     offset += 1 + tvb_get_guint8(tvb, offset);
9002
9003     /*  delivery-tag (longlong)  */
9004     proto_tree_add_item(args_tree, hf_amqp_method_basic_deliver_delivery_tag,
9005         tvb, offset, 8, ENC_BIG_ENDIAN);
9006     offset += 8;
9007
9008     /*  redelivered (bit)        */
9009     proto_tree_add_item(args_tree, hf_amqp_method_basic_deliver_redelivered,
9010         tvb, offset, 1, ENC_BIG_ENDIAN);
9011
9012     offset += 1;
9013     /*  exchange (shortstr)      */
9014     proto_tree_add_item(args_tree, hf_amqp_method_basic_deliver_exchange,
9015         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9016     offset += 1 + tvb_get_guint8(tvb, offset);
9017
9018     /*  routing-key (shortstr)   */
9019     proto_tree_add_item(args_tree, hf_amqp_method_basic_deliver_routing_key,
9020         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9021     offset += 1 + tvb_get_guint8(tvb, offset);
9022
9023     return offset;
9024 }
9025
9026 /*  Dissection routine for method Basic.Get                               */
9027
9028 static int
9029 dissect_amqp_0_9_method_basic_get(tvbuff_t *tvb,
9030     int offset, proto_tree *args_tree)
9031 {
9032     /*  ticket (short)           */
9033     proto_tree_add_item(args_tree, hf_amqp_method_basic_get_ticket,
9034         tvb, offset, 2, ENC_BIG_ENDIAN);
9035     offset += 2;
9036
9037     /*  queue (shortstr)         */
9038     proto_tree_add_item(args_tree, hf_amqp_method_basic_get_queue,
9039         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9040     offset += 1 + tvb_get_guint8(tvb, offset);
9041
9042     /*  no-ack (bit)             */
9043     proto_tree_add_item(args_tree, hf_amqp_method_basic_get_no_ack,
9044         tvb, offset, 1, ENC_BIG_ENDIAN);
9045
9046     return offset;
9047 }
9048
9049 /*  Dissection routine for method Basic.Get-Ok                            */
9050
9051 static int
9052 dissect_amqp_0_9_method_basic_get_ok(tvbuff_t *tvb,
9053     int offset, proto_tree *args_tree)
9054 {
9055     /*  delivery-tag (longlong)  */
9056     proto_tree_add_item(args_tree, hf_amqp_method_basic_get_ok_delivery_tag,
9057         tvb, offset, 8, ENC_BIG_ENDIAN);
9058     offset += 8;
9059
9060     /*  redelivered (bit)        */
9061     proto_tree_add_item(args_tree, hf_amqp_method_basic_get_ok_redelivered,
9062         tvb, offset, 1, ENC_BIG_ENDIAN);
9063
9064     offset += 1;
9065     /*  exchange (shortstr)      */
9066     proto_tree_add_item(args_tree, hf_amqp_method_basic_get_ok_exchange,
9067         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9068     offset += 1 + tvb_get_guint8(tvb, offset);
9069
9070     /*  routing-key (shortstr)   */
9071     proto_tree_add_item(args_tree, hf_amqp_method_basic_get_ok_routing_key,
9072         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9073     offset += 1 + tvb_get_guint8(tvb, offset);
9074
9075     /*  message-count (long)     */
9076     proto_tree_add_item(args_tree, hf_amqp_method_basic_get_ok_message_count,
9077         tvb, offset, 4, ENC_BIG_ENDIAN);
9078     offset += 4;
9079
9080     return offset;
9081 }
9082
9083 /*  Dissection routine for method Basic.Get-Empty                         */
9084
9085 static int
9086 dissect_amqp_0_9_method_basic_get_empty(tvbuff_t *tvb,
9087     int offset, proto_tree *args_tree)
9088 {
9089     /*  cluster-id (shortstr)    */
9090     proto_tree_add_item(args_tree, hf_amqp_method_basic_get_empty_cluster_id,
9091         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9092     offset += 1 + tvb_get_guint8(tvb, offset);
9093
9094     return offset;
9095 }
9096
9097 /*  Dissection routine for method Basic.Ack                               */
9098
9099 static int
9100 dissect_amqp_0_9_method_basic_ack(tvbuff_t *tvb,
9101     int offset, proto_tree *args_tree)
9102 {
9103     /*  delivery-tag (longlong)  */
9104     proto_tree_add_item(args_tree, hf_amqp_method_basic_ack_delivery_tag,
9105         tvb, offset, 8, ENC_BIG_ENDIAN);
9106     offset += 8;
9107
9108     /*  multiple (bit)           */
9109     proto_tree_add_item(args_tree, hf_amqp_method_basic_ack_multiple,
9110         tvb, offset, 1, ENC_BIG_ENDIAN);
9111
9112     return offset;
9113 }
9114
9115 /*  Dissection routine for method Basic.Reject                            */
9116
9117 static int
9118 dissect_amqp_0_9_method_basic_reject(tvbuff_t *tvb,
9119     int offset, proto_tree *args_tree)
9120 {
9121     /*  delivery-tag (longlong)  */
9122     proto_tree_add_item(args_tree, hf_amqp_method_basic_reject_delivery_tag,
9123         tvb, offset, 8, ENC_BIG_ENDIAN);
9124     offset += 8;
9125
9126     /*  requeue (bit)            */
9127     proto_tree_add_item(args_tree, hf_amqp_method_basic_reject_requeue,
9128         tvb, offset, 1, ENC_BIG_ENDIAN);
9129
9130     return offset;
9131 }
9132
9133 /*  Dissection routine for method Basic.Recover                           */
9134
9135 static int
9136 dissect_amqp_0_9_method_basic_recover(tvbuff_t *tvb,
9137     int offset, proto_tree *args_tree)
9138 {
9139     /*  requeue (bit)            */
9140     proto_tree_add_item(args_tree, hf_amqp_method_basic_recover_requeue,
9141         tvb, offset, 1, ENC_BIG_ENDIAN);
9142
9143     return offset;
9144 }
9145
9146 /*  Dissection routine for method File.Qos                                */
9147
9148 static int
9149 dissect_amqp_0_9_method_file_qos(tvbuff_t *tvb,
9150     int offset, proto_tree *args_tree)
9151 {
9152     /*  prefetch-size (long)     */
9153     proto_tree_add_item(args_tree, hf_amqp_method_file_qos_prefetch_size,
9154         tvb, offset, 4, ENC_BIG_ENDIAN);
9155     offset += 4;
9156
9157     /*  prefetch-count (short)   */
9158     proto_tree_add_item(args_tree, hf_amqp_method_file_qos_prefetch_count,
9159         tvb, offset, 2, ENC_BIG_ENDIAN);
9160     offset += 2;
9161
9162     /*  global (bit)             */
9163     proto_tree_add_item(args_tree, hf_amqp_method_file_qos_global,
9164         tvb, offset, 1, ENC_BIG_ENDIAN);
9165
9166     return offset;
9167 }
9168
9169 /*  Dissection routine for method File.Qos-Ok                             */
9170
9171 static int
9172 dissect_amqp_0_9_method_file_qos_ok(tvbuff_t *tvb _U_,
9173     int offset _U_, proto_tree *args_tree _U_)
9174 {
9175     return offset;
9176 }
9177
9178 /*  Dissection routine for method File.Consume                            */
9179
9180 static int
9181 dissect_amqp_0_9_method_file_consume(tvbuff_t *tvb, packet_info *pinfo,
9182     int offset, proto_tree *args_tree)
9183 {
9184     proto_item *ti;
9185
9186     /*  ticket (short)           */
9187     proto_tree_add_item(args_tree, hf_amqp_method_file_consume_ticket,
9188         tvb, offset, 2, ENC_BIG_ENDIAN);
9189     offset += 2;
9190
9191     /*  queue (shortstr)         */
9192     proto_tree_add_item(args_tree, hf_amqp_method_file_consume_queue,
9193         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9194     offset += 1 + tvb_get_guint8(tvb, offset);
9195
9196     /*  consumer-tag (shortstr)  */
9197     proto_tree_add_item(args_tree, hf_amqp_method_file_consume_consumer_tag,
9198         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9199     offset += 1 + tvb_get_guint8(tvb, offset);
9200
9201     /*  no-local (bit)           */
9202     proto_tree_add_item(args_tree, hf_amqp_method_file_consume_no_local,
9203         tvb, offset, 1, ENC_BIG_ENDIAN);
9204
9205     /*  no-ack (bit)             */
9206     proto_tree_add_item(args_tree, hf_amqp_method_file_consume_no_ack,
9207         tvb, offset, 1, ENC_BIG_ENDIAN);
9208
9209     /*  exclusive (bit)          */
9210     proto_tree_add_item(args_tree, hf_amqp_method_file_consume_exclusive,
9211         tvb, offset, 1, ENC_BIG_ENDIAN);
9212
9213     /*  nowait (bit)             */
9214     proto_tree_add_item(args_tree, hf_amqp_method_file_consume_nowait,
9215         tvb, offset, 1, ENC_BIG_ENDIAN);
9216
9217     offset += 1;
9218     /*  filter (table)           */
9219     ti = proto_tree_add_item(
9220         args_tree, hf_amqp_method_file_consume_filter,
9221         tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
9222     dissect_amqp_0_9_field_table(tvb, pinfo, offset + 4, tvb_get_ntohl(tvb, offset), ti);
9223     offset += 4 + tvb_get_ntohl(tvb, offset);
9224
9225     return offset;
9226 }
9227
9228 /*  Dissection routine for method File.Consume-Ok                         */
9229
9230 static int
9231 dissect_amqp_0_9_method_file_consume_ok(tvbuff_t *tvb,
9232     int offset, proto_tree *args_tree)
9233 {
9234     /*  consumer-tag (shortstr)  */
9235     proto_tree_add_item(args_tree, hf_amqp_method_file_consume_ok_consumer_tag,
9236         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9237     offset += 1 + tvb_get_guint8(tvb, offset);
9238
9239     return offset;
9240 }
9241
9242 /*  Dissection routine for method File.Cancel                             */
9243
9244 static int
9245 dissect_amqp_0_9_method_file_cancel(tvbuff_t *tvb,
9246     int offset, proto_tree *args_tree)
9247 {
9248     /*  consumer-tag (shortstr)  */
9249     proto_tree_add_item(args_tree, hf_amqp_method_file_cancel_consumer_tag,
9250         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9251     offset += 1 + tvb_get_guint8(tvb, offset);
9252
9253     /*  nowait (bit)             */
9254     proto_tree_add_item(args_tree, hf_amqp_method_file_cancel_nowait,
9255         tvb, offset, 1, ENC_BIG_ENDIAN);
9256
9257     return offset;
9258 }
9259
9260 /*  Dissection routine for method File.Cancel-Ok                          */
9261
9262 static int
9263 dissect_amqp_0_9_method_file_cancel_ok(tvbuff_t *tvb,
9264     int offset, proto_tree *args_tree)
9265 {
9266     /*  consumer-tag (shortstr)  */
9267     proto_tree_add_item(args_tree, hf_amqp_method_file_cancel_ok_consumer_tag,
9268         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9269     offset += 1 + tvb_get_guint8(tvb, offset);
9270
9271     return offset;
9272 }
9273
9274 /*  Dissection routine for method File.Open                               */
9275
9276 static int
9277 dissect_amqp_0_9_method_file_open(tvbuff_t *tvb,
9278     int offset, proto_tree *args_tree)
9279 {
9280     /*  identifier (shortstr)    */
9281     proto_tree_add_item(args_tree, hf_amqp_method_file_open_identifier,
9282         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9283     offset += 1 + tvb_get_guint8(tvb, offset);
9284
9285     /*  content-size (longlong)  */
9286     proto_tree_add_item(args_tree, hf_amqp_method_file_open_content_size,
9287         tvb, offset, 8, ENC_BIG_ENDIAN);
9288     offset += 8;
9289
9290     return offset;
9291 }
9292
9293 /*  Dissection routine for method File.Open-Ok                            */
9294
9295 static int
9296 dissect_amqp_0_9_method_file_open_ok(tvbuff_t *tvb,
9297     int offset, proto_tree *args_tree)
9298 {
9299     /*  staged-size (longlong)   */
9300     proto_tree_add_item(args_tree, hf_amqp_method_file_open_ok_staged_size,
9301         tvb, offset, 8, ENC_BIG_ENDIAN);
9302     offset += 8;
9303
9304     return offset;
9305 }
9306
9307 /*  Dissection routine for method File.Stage                              */
9308
9309 static int
9310 dissect_amqp_0_9_method_file_stage(tvbuff_t *tvb _U_,
9311     int offset, proto_tree *args_tree _U_)
9312 {
9313     return offset;
9314 }
9315
9316 /*  Dissection routine for method File.Publish                            */
9317
9318 static int
9319 dissect_amqp_0_9_method_file_publish(tvbuff_t *tvb,
9320     int offset, proto_tree *args_tree)
9321 {
9322     /*  ticket (short)           */
9323     proto_tree_add_item(args_tree, hf_amqp_method_file_publish_ticket,
9324         tvb, offset, 2, ENC_BIG_ENDIAN);
9325     offset += 2;
9326
9327     /*  exchange (shortstr)      */
9328     proto_tree_add_item(args_tree, hf_amqp_method_file_publish_exchange,
9329         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9330     offset += 1 + tvb_get_guint8(tvb, offset);
9331
9332     /*  routing-key (shortstr)   */
9333     proto_tree_add_item(args_tree, hf_amqp_method_file_publish_routing_key,
9334         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9335     offset += 1 + tvb_get_guint8(tvb, offset);
9336
9337     /*  mandatory (bit)          */
9338     proto_tree_add_item(args_tree, hf_amqp_method_file_publish_mandatory,
9339         tvb, offset, 1, ENC_BIG_ENDIAN);
9340
9341     /*  immediate (bit)          */
9342     proto_tree_add_item(args_tree, hf_amqp_method_file_publish_immediate,
9343         tvb, offset, 1, ENC_BIG_ENDIAN);
9344
9345     offset += 1;
9346     /*  identifier (shortstr)    */
9347     proto_tree_add_item(args_tree, hf_amqp_method_file_publish_identifier,
9348         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9349     offset += 1 + tvb_get_guint8(tvb, offset);
9350
9351     return offset;
9352 }
9353
9354 /*  Dissection routine for method File.Return                             */
9355
9356 static int
9357 dissect_amqp_0_9_method_file_return(tvbuff_t *tvb,
9358     int offset, proto_tree *args_tree)
9359 {
9360     /*  reply-code (short)       */
9361     proto_tree_add_item(args_tree, hf_amqp_method_file_return_reply_code,
9362         tvb, offset, 2, ENC_BIG_ENDIAN);
9363     offset += 2;
9364
9365     /*  reply-text (shortstr)    */
9366     proto_tree_add_item(args_tree, hf_amqp_method_file_return_reply_text,
9367         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9368     offset += 1 + tvb_get_guint8(tvb, offset);
9369
9370     /*  exchange (shortstr)      */
9371     proto_tree_add_item(args_tree, hf_amqp_method_file_return_exchange,
9372         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9373     offset += 1 + tvb_get_guint8(tvb, offset);
9374
9375     /*  routing-key (shortstr)   */
9376     proto_tree_add_item(args_tree, hf_amqp_method_file_return_routing_key,
9377         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9378     offset += 1 + tvb_get_guint8(tvb, offset);
9379
9380     return offset;
9381 }
9382
9383 /*  Dissection routine for method File.Deliver                            */
9384
9385 static int
9386 dissect_amqp_0_9_method_file_deliver(tvbuff_t *tvb,
9387     int offset, proto_tree *args_tree)
9388 {
9389     /*  consumer-tag (shortstr)  */
9390     proto_tree_add_item(args_tree, hf_amqp_method_file_deliver_consumer_tag,
9391         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9392     offset += 1 + tvb_get_guint8(tvb, offset);
9393
9394     /*  delivery-tag (longlong)  */
9395     proto_tree_add_item(args_tree, hf_amqp_method_file_deliver_delivery_tag,
9396         tvb, offset, 8, ENC_BIG_ENDIAN);
9397     offset += 8;
9398
9399     /*  redelivered (bit)        */
9400     proto_tree_add_item(args_tree, hf_amqp_method_file_deliver_redelivered,
9401         tvb, offset, 1, ENC_BIG_ENDIAN);
9402
9403     offset += 1;
9404     /*  exchange (shortstr)      */
9405     proto_tree_add_item(args_tree, hf_amqp_method_file_deliver_exchange,
9406         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9407     offset += 1 + tvb_get_guint8(tvb, offset);
9408
9409     /*  routing-key (shortstr)   */
9410     proto_tree_add_item(args_tree, hf_amqp_method_file_deliver_routing_key,
9411         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9412     offset += 1 + tvb_get_guint8(tvb, offset);
9413
9414     /*  identifier (shortstr)    */
9415     proto_tree_add_item(args_tree, hf_amqp_method_file_deliver_identifier,
9416         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9417     offset += 1 + tvb_get_guint8(tvb, offset);
9418
9419     return offset;
9420 }
9421
9422 /*  Dissection routine for method File.Ack                                */
9423
9424 static int
9425 dissect_amqp_0_9_method_file_ack(tvbuff_t *tvb,
9426     int offset, proto_tree *args_tree)
9427 {
9428     /*  delivery-tag (longlong)  */
9429     proto_tree_add_item(args_tree, hf_amqp_method_file_ack_delivery_tag,
9430         tvb, offset, 8, ENC_BIG_ENDIAN);
9431     offset += 8;
9432
9433     /*  multiple (bit)           */
9434     proto_tree_add_item(args_tree, hf_amqp_method_file_ack_multiple,
9435         tvb, offset, 1, ENC_BIG_ENDIAN);
9436
9437     return offset;
9438 }
9439
9440 /*  Dissection routine for method File.Reject                             */
9441
9442 static int
9443 dissect_amqp_0_9_method_file_reject(tvbuff_t *tvb,
9444     int offset, proto_tree *args_tree)
9445 {
9446     /*  delivery-tag (longlong)  */
9447     proto_tree_add_item(args_tree, hf_amqp_method_file_reject_delivery_tag,
9448         tvb, offset, 8, ENC_BIG_ENDIAN);
9449     offset += 8;
9450
9451     /*  requeue (bit)            */
9452     proto_tree_add_item(args_tree, hf_amqp_method_file_reject_requeue,
9453         tvb, offset, 1, ENC_BIG_ENDIAN);
9454
9455     return offset;
9456 }
9457
9458 /*  Dissection routine for method Stream.Qos                              */
9459
9460 static int
9461 dissect_amqp_0_9_method_stream_qos(tvbuff_t *tvb,
9462     int offset, proto_tree *args_tree)
9463 {
9464     /*  prefetch-size (long)     */
9465     proto_tree_add_item(args_tree, hf_amqp_method_stream_qos_prefetch_size,
9466         tvb, offset, 4, ENC_BIG_ENDIAN);
9467     offset += 4;
9468
9469     /*  prefetch-count (short)   */
9470     proto_tree_add_item(args_tree, hf_amqp_method_stream_qos_prefetch_count,
9471         tvb, offset, 2, ENC_BIG_ENDIAN);
9472     offset += 2;
9473
9474     /*  consume-rate (long)      */
9475     proto_tree_add_item(args_tree, hf_amqp_method_stream_qos_consume_rate,
9476         tvb, offset, 4, ENC_BIG_ENDIAN);
9477     offset += 4;
9478
9479     /*  global (bit)             */
9480     proto_tree_add_item(args_tree, hf_amqp_method_stream_qos_global,
9481         tvb, offset, 1, ENC_BIG_ENDIAN);
9482
9483     return offset;
9484 }
9485
9486 /*  Dissection routine for method Stream.Qos-Ok                           */
9487
9488 static int
9489 dissect_amqp_0_9_method_stream_qos_ok(tvbuff_t *tvb _U_,
9490     int offset, proto_tree *args_tree _U_)
9491 {
9492     return offset;
9493 }
9494
9495 /*  Dissection routine for method Stream.Consume                          */
9496
9497 static int
9498 dissect_amqp_0_9_method_stream_consume(tvbuff_t *tvb, packet_info *pinfo,
9499     int offset, proto_tree *args_tree)
9500 {
9501     proto_item *ti;
9502
9503     /*  ticket (short)           */
9504     proto_tree_add_item(args_tree, hf_amqp_method_stream_consume_ticket,
9505         tvb, offset, 2, ENC_BIG_ENDIAN);
9506     offset += 2;
9507
9508     /*  queue (shortstr)         */
9509     proto_tree_add_item(args_tree, hf_amqp_method_stream_consume_queue,
9510         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9511     offset += 1 + tvb_get_guint8(tvb, offset);
9512
9513     /*  consumer-tag (shortstr)  */
9514     proto_tree_add_item(args_tree, hf_amqp_method_stream_consume_consumer_tag,
9515         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9516     offset += 1 + tvb_get_guint8(tvb, offset);
9517
9518     /*  no-local (bit)           */
9519     proto_tree_add_item(args_tree, hf_amqp_method_stream_consume_no_local,
9520         tvb, offset, 1, ENC_BIG_ENDIAN);
9521
9522     /*  exclusive (bit)          */
9523     proto_tree_add_item(args_tree, hf_amqp_method_stream_consume_exclusive,
9524         tvb, offset, 1, ENC_BIG_ENDIAN);
9525
9526     /*  nowait (bit)             */
9527     proto_tree_add_item(args_tree, hf_amqp_method_stream_consume_nowait,
9528         tvb, offset, 1, ENC_BIG_ENDIAN);
9529
9530     offset += 1;
9531     /*  filter (table)           */
9532     ti = proto_tree_add_item(
9533         args_tree, hf_amqp_method_stream_consume_filter,
9534         tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
9535     dissect_amqp_0_9_field_table(tvb, pinfo, offset + 4, tvb_get_ntohl(tvb, offset), ti);
9536     offset += 4 + tvb_get_ntohl(tvb, offset);
9537
9538     return offset;
9539 }
9540
9541 /*  Dissection routine for method Stream.Consume-Ok                       */
9542
9543 static int
9544 dissect_amqp_0_9_method_stream_consume_ok(tvbuff_t *tvb,
9545     int offset, proto_tree *args_tree)
9546 {
9547     /*  consumer-tag (shortstr)  */
9548     proto_tree_add_item(args_tree, hf_amqp_method_stream_consume_ok_consumer_tag,
9549         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9550     offset += 1 + tvb_get_guint8(tvb, offset);
9551
9552     return offset;
9553 }
9554
9555 /*  Dissection routine for method Stream.Cancel                           */
9556
9557 static int
9558 dissect_amqp_0_9_method_stream_cancel(tvbuff_t *tvb,
9559     int offset, proto_tree *args_tree)
9560 {
9561     /*  consumer-tag (shortstr)  */
9562     proto_tree_add_item(args_tree, hf_amqp_method_stream_cancel_consumer_tag,
9563         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9564     offset += 1 + tvb_get_guint8(tvb, offset);
9565
9566     /*  nowait (bit)             */
9567     proto_tree_add_item(args_tree, hf_amqp_method_stream_cancel_nowait,
9568         tvb, offset, 1, ENC_BIG_ENDIAN);
9569
9570     return offset;
9571 }
9572
9573 /*  Dissection routine for method Stream.Cancel-Ok                        */
9574
9575 static int
9576 dissect_amqp_0_9_method_stream_cancel_ok(tvbuff_t *tvb,
9577     int offset, proto_tree *args_tree)
9578 {
9579     /*  consumer-tag (shortstr)  */
9580     proto_tree_add_item(args_tree, hf_amqp_method_stream_cancel_ok_consumer_tag,
9581         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9582     offset += 1 + tvb_get_guint8(tvb, offset);
9583
9584     return offset;
9585 }
9586
9587 /*  Dissection routine for method Stream.Publish                          */
9588
9589 static int
9590 dissect_amqp_0_9_method_stream_publish(tvbuff_t *tvb,
9591     int offset, proto_tree *args_tree)
9592 {
9593     /*  ticket (short)           */
9594     proto_tree_add_item(args_tree, hf_amqp_method_stream_publish_ticket,
9595         tvb, offset, 2, ENC_BIG_ENDIAN);
9596     offset += 2;
9597
9598     /*  exchange (shortstr)      */
9599     proto_tree_add_item(args_tree, hf_amqp_method_stream_publish_exchange,
9600         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9601     offset += 1 + tvb_get_guint8(tvb, offset);
9602
9603     /*  routing-key (shortstr)   */
9604     proto_tree_add_item(args_tree, hf_amqp_method_stream_publish_routing_key,
9605         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9606     offset += 1 + tvb_get_guint8(tvb, offset);
9607
9608     /*  mandatory (bit)          */
9609     proto_tree_add_item(args_tree, hf_amqp_method_stream_publish_mandatory,
9610         tvb, offset, 1, ENC_BIG_ENDIAN);
9611
9612     /*  immediate (bit)          */
9613     proto_tree_add_item(args_tree, hf_amqp_method_stream_publish_immediate,
9614         tvb, offset, 1, ENC_BIG_ENDIAN);
9615
9616     return offset;
9617 }
9618
9619 /*  Dissection routine for method Stream.Return                           */
9620
9621 static int
9622 dissect_amqp_0_9_method_stream_return(tvbuff_t *tvb,
9623     int offset, proto_tree *args_tree)
9624 {
9625     /*  reply-code (short)       */
9626     proto_tree_add_item(args_tree, hf_amqp_method_stream_return_reply_code,
9627         tvb, offset, 2, ENC_BIG_ENDIAN);
9628     offset += 2;
9629
9630     /*  reply-text (shortstr)    */
9631     proto_tree_add_item(args_tree, hf_amqp_method_stream_return_reply_text,
9632         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9633     offset += 1 + tvb_get_guint8(tvb, offset);
9634
9635     /*  exchange (shortstr)      */
9636     proto_tree_add_item(args_tree, hf_amqp_method_stream_return_exchange,
9637         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9638     offset += 1 + tvb_get_guint8(tvb, offset);
9639
9640     /*  routing-key (shortstr)   */
9641     proto_tree_add_item(args_tree, hf_amqp_method_stream_return_routing_key,
9642         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9643     offset += 1 + tvb_get_guint8(tvb, offset);
9644
9645     return offset;
9646 }
9647
9648 /*  Dissection routine for method Stream.Deliver                          */
9649
9650 static int
9651 dissect_amqp_0_9_method_stream_deliver(tvbuff_t *tvb,
9652     int offset, proto_tree *args_tree)
9653 {
9654     /*  consumer-tag (shortstr)  */
9655     proto_tree_add_item(args_tree, hf_amqp_method_stream_deliver_consumer_tag,
9656         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9657     offset += 1 + tvb_get_guint8(tvb, offset);
9658
9659     /*  delivery-tag (longlong)  */
9660     proto_tree_add_item(args_tree, hf_amqp_method_stream_deliver_delivery_tag,
9661         tvb, offset, 8, ENC_BIG_ENDIAN);
9662     offset += 8;
9663
9664     /*  exchange (shortstr)      */
9665     proto_tree_add_item(args_tree, hf_amqp_method_stream_deliver_exchange,
9666         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9667     offset += 1 + tvb_get_guint8(tvb, offset);
9668
9669     /*  queue (shortstr)         */
9670     proto_tree_add_item(args_tree, hf_amqp_method_stream_deliver_queue,
9671         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9672     offset += 1 + tvb_get_guint8(tvb, offset);
9673
9674     return offset;
9675 }
9676
9677 /*  Dissection routine for method Tx.Select                               */
9678
9679 static int
9680 dissect_amqp_0_9_method_tx_select(tvbuff_t *tvb _U_,
9681     int offset, proto_tree *args_tree _U_)
9682 {
9683     return offset;
9684 }
9685
9686 /*  Dissection routine for method Tx.Select-Ok                            */
9687
9688 static int
9689 dissect_amqp_0_9_method_tx_select_ok(tvbuff_t *tvb _U_,
9690     int offset, proto_tree *args_tree _U_)
9691 {
9692     return offset;
9693 }
9694
9695 /*  Dissection routine for method Tx.Commit                               */
9696
9697 static int
9698 dissect_amqp_0_9_method_tx_commit(tvbuff_t *tvb _U_,
9699     int offset, proto_tree *args_tree _U_)
9700 {
9701     return offset;
9702 }
9703
9704 /*  Dissection routine for method Tx.Commit-Ok                            */
9705
9706 static int
9707 dissect_amqp_0_9_method_tx_commit_ok(tvbuff_t *tvb _U_,
9708     int offset, proto_tree *args_tree _U_)
9709 {
9710     return offset;
9711 }
9712
9713 /*  Dissection routine for method Tx.Rollback                             */
9714
9715 static int
9716 dissect_amqp_0_9_method_tx_rollback(tvbuff_t *tvb _U_,
9717     int offset, proto_tree *args_tree _U_)
9718 {
9719     return offset;
9720 }
9721
9722 /*  Dissection routine for method Tx.Rollback-Ok                          */
9723
9724 static int
9725 dissect_amqp_0_9_method_tx_rollback_ok(tvbuff_t *tvb _U_,
9726     int offset, proto_tree *args_tree _U_)
9727 {
9728     return offset;
9729 }
9730
9731 /*  Dissection routine for method Dtx.Select                              */
9732
9733 static int
9734 dissect_amqp_0_9_method_dtx_select(tvbuff_t *tvb _U_,
9735     int offset, proto_tree *args_tree _U_)
9736 {
9737     return offset;
9738 }
9739
9740 /*  Dissection routine for method Dtx.Select-Ok                           */
9741
9742 static int
9743 dissect_amqp_0_9_method_dtx_select_ok(tvbuff_t *tvb _U_,
9744     int offset, proto_tree *args_tree _U_)
9745 {
9746     return offset;
9747 }
9748
9749 /*  Dissection routine for method Dtx.Start                               */
9750
9751 static int
9752 dissect_amqp_0_9_method_dtx_start(tvbuff_t *tvb,
9753     int offset, proto_tree *args_tree)
9754 {
9755     /*  dtx-identifier (shortstr)  */
9756     proto_tree_add_item(args_tree, hf_amqp_method_dtx_start_dtx_identifier,
9757         tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9758     offset += 1 + tvb_get_guint8(tvb, offset);
9759
9760     return offset;
9761 }
9762
9763 /*  Dissection routine for method Dtx.Start-Ok                            */
9764
9765 static int
9766 dissect_amqp_0_9_method_dtx_start_ok(tvbuff_t *tvb _U_,
9767     int offset, proto_tree *args_tree _U_)
9768 {
9769     return offset;
9770 }
9771
9772 /*  Dissection routine for method Tunnel.Request                          */
9773
9774 static int
9775 dissect_amqp_0_9_method_tunnel_request(tvbuff_t *tvb, packet_info *pinfo,
9776     int offset, proto_tree *args_tree)
9777 {
9778     proto_item *ti;
9779
9780     /*  meta-data (table)        */
9781     ti = proto_tree_add_item(
9782         args_tree, hf_amqp_method_tunnel_request_meta_data,
9783         tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
9784     dissect_amqp_0_9_field_table(tvb, pinfo, offset + 4, tvb_get_ntohl(tvb, offset), ti);
9785     offset += 4 + tvb_get_ntohl(tvb, offset);
9786
9787     return offset;
9788 }
9789
9790
9791 /*  Dissection routine for content headers of class basic          */
9792
9793 static int
9794 dissect_amqp_0_9_content_header_basic(tvbuff_t *tvb, packet_info *pinfo,
9795     int offset, proto_tree *prop_tree)
9796 {
9797     proto_item *ti;
9798     guint16     prop_flags;
9799
9800     prop_flags = tvb_get_ntohs(tvb, 19);
9801
9802     if (prop_flags & 0x8000) {
9803         /*  content-type (shortstr)  */
9804         proto_tree_add_item(prop_tree, hf_amqp_header_basic_content_type,
9805             tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9806         offset += 1 + tvb_get_guint8(tvb, offset);
9807     }
9808     prop_flags <<= 1;
9809
9810     if (prop_flags & 0x8000) {
9811         /*  content-encoding (shortstr)  */
9812         proto_tree_add_item(prop_tree, hf_amqp_header_basic_content_encoding,
9813             tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9814         offset += 1 + tvb_get_guint8(tvb, offset);
9815     }
9816     prop_flags <<= 1;
9817
9818     if (prop_flags & 0x8000) {
9819         /*  headers (table)          */
9820         ti = proto_tree_add_item(
9821             prop_tree, hf_amqp_header_basic_headers,
9822             tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
9823         dissect_amqp_0_9_field_table(tvb, pinfo, offset + 4, tvb_get_ntohl(tvb, offset), ti);
9824         offset += 4 + tvb_get_ntohl(tvb, offset);
9825     }
9826     prop_flags <<= 1;
9827
9828     if (prop_flags & 0x8000) {
9829         /*  delivery-mode (octet)    */
9830         proto_tree_add_item(prop_tree, hf_amqp_header_basic_delivery_mode,
9831             tvb, offset, 1, ENC_BIG_ENDIAN);
9832         offset += 1;
9833     }
9834     prop_flags <<= 1;
9835
9836     if (prop_flags & 0x8000) {
9837         /*  priority (octet)         */
9838         proto_tree_add_item(prop_tree, hf_amqp_header_basic_priority,
9839             tvb, offset, 1, ENC_BIG_ENDIAN);
9840         offset += 1;
9841     }
9842     prop_flags <<= 1;
9843
9844     if (prop_flags & 0x8000) {
9845         /*  correlation-id (shortstr)  */
9846         proto_tree_add_item(prop_tree, hf_amqp_header_basic_correlation_id,
9847             tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9848         offset += 1 + tvb_get_guint8(tvb, offset);
9849     }
9850     prop_flags <<= 1;
9851
9852     if (prop_flags & 0x8000) {
9853         /*  reply-to (shortstr)      */
9854         proto_tree_add_item(prop_tree, hf_amqp_header_basic_reply_to,
9855             tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9856         offset += 1 + tvb_get_guint8(tvb, offset);
9857     }
9858     prop_flags <<= 1;
9859
9860     if (prop_flags & 0x8000) {
9861         /*  expiration (shortstr)    */
9862         proto_tree_add_item(prop_tree, hf_amqp_header_basic_expiration,
9863             tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9864         offset += 1 + tvb_get_guint8(tvb, offset);
9865     }
9866     prop_flags <<= 1;
9867
9868     if (prop_flags & 0x8000) {
9869         /*  message-id (shortstr)    */
9870         proto_tree_add_item(prop_tree, hf_amqp_header_basic_message_id,
9871             tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9872         offset += 1 + tvb_get_guint8(tvb, offset);
9873     }
9874     prop_flags <<= 1;
9875
9876     if (prop_flags & 0x8000) {
9877         /*  timestamp (timestamp)    */
9878         proto_tree_add_item(prop_tree, hf_amqp_header_basic_timestamp,
9879             tvb, offset, 8, ENC_BIG_ENDIAN);
9880         offset += 8;
9881     }
9882     prop_flags <<= 1;
9883
9884     if (prop_flags & 0x8000) {
9885         /*  type (shortstr)          */
9886         proto_tree_add_item(prop_tree, hf_amqp_header_basic_type,
9887             tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9888         offset += 1 + tvb_get_guint8(tvb, offset);
9889     }
9890     prop_flags <<= 1;
9891
9892     if (prop_flags & 0x8000) {
9893         /*  user-id (shortstr)       */
9894         proto_tree_add_item(prop_tree, hf_amqp_header_basic_user_id,
9895             tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9896         offset += 1 + tvb_get_guint8(tvb, offset);
9897     }
9898     prop_flags <<= 1;
9899
9900     if (prop_flags & 0x8000) {
9901         /*  app-id (shortstr)        */
9902         proto_tree_add_item(prop_tree, hf_amqp_header_basic_app_id,
9903             tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9904         offset += 1 + tvb_get_guint8(tvb, offset);
9905     }
9906     prop_flags <<= 1;
9907
9908     if (prop_flags & 0x8000) {
9909         /*  cluster-id (shortstr)    */
9910         proto_tree_add_item(prop_tree, hf_amqp_header_basic_cluster_id,
9911             tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9912         offset += 1 + tvb_get_guint8(tvb, offset);
9913     }
9914     /*prop_flags <<= 1;*/
9915
9916     return offset;
9917 }
9918 /*  Dissection routine for content headers of class file           */
9919
9920 static int
9921 dissect_amqp_0_9_content_header_file(tvbuff_t *tvb, packet_info *pinfo,
9922     int offset, proto_tree *prop_tree)
9923 {
9924     proto_item *ti;
9925     guint16     prop_flags;
9926
9927     prop_flags = tvb_get_ntohs(tvb, 19);
9928
9929     if (prop_flags & 0x8000) {
9930         /*  content-type (shortstr)  */
9931         proto_tree_add_item(prop_tree, hf_amqp_header_file_content_type,
9932             tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9933         offset += 1 + tvb_get_guint8(tvb, offset);
9934     }
9935     prop_flags <<= 1;
9936
9937     if (prop_flags & 0x8000) {
9938         /*  content-encoding (shortstr)  */
9939         proto_tree_add_item(prop_tree, hf_amqp_header_file_content_encoding,
9940             tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9941         offset += 1 + tvb_get_guint8(tvb, offset);
9942     }
9943     prop_flags <<= 1;
9944
9945     if (prop_flags & 0x8000) {
9946         /*  headers (table)          */
9947         ti = proto_tree_add_item(prop_tree, hf_amqp_header_file_headers,
9948             tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
9949         dissect_amqp_0_9_field_table(tvb, pinfo, offset + 4, tvb_get_ntohl(tvb, offset), ti);
9950         offset += 4 + tvb_get_ntohl(tvb, offset);
9951     }
9952     prop_flags <<= 1;
9953
9954     if (prop_flags & 0x8000) {
9955         /*  priority (octet)         */
9956         proto_tree_add_item(prop_tree, hf_amqp_header_file_priority,
9957             tvb, offset, 1, ENC_BIG_ENDIAN);
9958         offset += 1;
9959     }
9960     prop_flags <<= 1;
9961
9962     if (prop_flags & 0x8000) {
9963         /*  reply-to (shortstr)      */
9964         proto_tree_add_item(prop_tree, hf_amqp_header_file_reply_to,
9965             tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9966         offset += 1 + tvb_get_guint8(tvb, offset);
9967     }
9968     prop_flags <<= 1;
9969
9970     if (prop_flags & 0x8000) {
9971         /*  message-id (shortstr)    */
9972         proto_tree_add_item(prop_tree, hf_amqp_header_file_message_id,
9973             tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9974         offset += 1 + tvb_get_guint8(tvb, offset);
9975     }
9976     prop_flags <<= 1;
9977
9978     if (prop_flags & 0x8000) {
9979         /*  filename (shortstr)      */
9980         proto_tree_add_item(prop_tree, hf_amqp_header_file_filename,
9981             tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9982         offset += 1 + tvb_get_guint8(tvb, offset);
9983     }
9984     prop_flags <<= 1;
9985
9986     if (prop_flags & 0x8000) {
9987         /*  timestamp (timestamp)    */
9988         proto_tree_add_item(prop_tree, hf_amqp_header_file_timestamp,
9989             tvb, offset, 8, ENC_BIG_ENDIAN);
9990         offset += 8;
9991     }
9992     prop_flags <<= 1;
9993
9994     if (prop_flags & 0x8000) {
9995         /*  cluster-id (shortstr)    */
9996         proto_tree_add_item(prop_tree, hf_amqp_header_file_cluster_id,
9997             tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
9998         offset += 1 + tvb_get_guint8(tvb, offset);
9999     }
10000     /*prop_flags <<= 1;*/
10001
10002     return offset;
10003 }
10004 /*  Dissection routine for content headers of class stream         */
10005
10006 static int
10007 dissect_amqp_0_9_content_header_stream(tvbuff_t *tvb, packet_info *pinfo,
10008     int offset, proto_tree *prop_tree)
10009 {
10010     proto_item *ti;
10011     guint16     prop_flags;
10012
10013     prop_flags = tvb_get_ntohs(tvb, 19);
10014
10015     if (prop_flags & 0x8000) {
10016         /*  content-type (shortstr)  */
10017         proto_tree_add_item(prop_tree, hf_amqp_header_stream_content_type,
10018             tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
10019         offset += 1 + tvb_get_guint8(tvb, offset);
10020     }
10021     prop_flags <<= 1;
10022
10023     if (prop_flags & 0x8000) {
10024         /*  content-encoding (shortstr)  */
10025         proto_tree_add_item(prop_tree, hf_amqp_header_stream_content_encoding,
10026             tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
10027         offset += 1 + tvb_get_guint8(tvb, offset);
10028     }
10029     prop_flags <<= 1;
10030
10031     if (prop_flags & 0x8000) {
10032         /*  headers (table)          */
10033         ti = proto_tree_add_item(prop_tree, hf_amqp_header_stream_headers,
10034             tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
10035         dissect_amqp_0_9_field_table(tvb, pinfo, offset + 4, tvb_get_ntohl(tvb, offset), ti);
10036         offset += 4 + tvb_get_ntohl(tvb, offset);
10037     }
10038     prop_flags <<= 1;
10039
10040     if (prop_flags & 0x8000) {
10041         /*  priority (octet)         */
10042         proto_tree_add_item(prop_tree, hf_amqp_header_stream_priority,
10043             tvb, offset, 1, ENC_BIG_ENDIAN);
10044         offset += 1;
10045     }
10046     prop_flags <<= 1;
10047
10048     if (prop_flags & 0x8000) {
10049         /*  timestamp (timestamp)    */
10050         proto_tree_add_item(prop_tree, hf_amqp_header_stream_timestamp,
10051             tvb, offset, 8, ENC_BIG_ENDIAN);
10052         offset += 8;
10053     }
10054     /*prop_flags <<= 1;*/
10055
10056     return offset;
10057 }
10058
10059 /*  Dissection routine for content headers of class tunnel         */
10060
10061 static int
10062 dissect_amqp_0_9_content_header_tunnel(tvbuff_t *tvb, packet_info *pinfo,
10063     int offset, proto_tree *prop_tree)
10064 {
10065     proto_item *ti;
10066     guint16     prop_flags;
10067
10068     prop_flags = tvb_get_ntohs(tvb, 19);
10069
10070     if (prop_flags & 0x8000) {
10071         /*  headers (table)          */
10072         ti = proto_tree_add_item(prop_tree, hf_amqp_header_tunnel_headers,
10073             tvb, offset + 4, tvb_get_ntohl(tvb, offset), ENC_NA);
10074         dissect_amqp_0_9_field_table(tvb, pinfo, offset + 4, tvb_get_ntohl(tvb, offset), ti);
10075         offset += 4 + tvb_get_ntohl(tvb, offset);
10076     }
10077     prop_flags <<= 1;
10078
10079     if (prop_flags & 0x8000) {
10080         /*  proxy-name (shortstr)    */
10081         proto_tree_add_item(prop_tree, hf_amqp_header_tunnel_proxy_name,
10082             tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
10083         offset += 1 + tvb_get_guint8(tvb, offset);
10084     }
10085     prop_flags <<= 1;
10086
10087     if (prop_flags & 0x8000) {
10088         /*  data-name (shortstr)     */
10089         proto_tree_add_item(prop_tree, hf_amqp_header_tunnel_data_name,
10090             tvb, offset + 1, tvb_get_guint8(tvb, offset), ENC_ASCII|ENC_NA);
10091         offset += 1 + tvb_get_guint8(tvb, offset);
10092     }
10093     prop_flags <<= 1;
10094
10095     if (prop_flags & 0x8000) {
10096         /*  durable (octet)          */
10097         proto_tree_add_item(prop_tree, hf_amqp_header_tunnel_durable,
10098             tvb, offset, 1, ENC_BIG_ENDIAN);
10099         offset += 1;
10100     }
10101     prop_flags <<= 1;
10102
10103     if (prop_flags & 0x8000) {
10104         /*  broadcast (octet)        */
10105         proto_tree_add_item(prop_tree, hf_amqp_header_tunnel_broadcast,
10106             tvb, offset, 1, ENC_BIG_ENDIAN);
10107         offset += 1;
10108     }
10109     /*prop_flags <<= 1;*/
10110
10111     return offset;
10112 }
10113
10114 /*  AMQP 1.0 Type Decoders  */
10115
10116 /* knowing the primitive type (code), this routine decodes its value (using
10117  * amqp_1_0_fixed_types)
10118  * arguments:
10119  *   tvb, code, offset, bound: obvious
10120  *   type_length_size: number of bytes of value length for types with variable width
10121  *   length_size: number of bytes decoded by the routine
10122  *   type_name: string with code type
10123  *   value: string with type value
10124  * return value: true iff code found in fixed sized codes
10125  *               false iff code is list, array or map (or unknown)
10126  */
10127 static gboolean decode_fixed_type(tvbuff_t *tvb,
10128                                   guint8 code,
10129                                   int offset,
10130                                   int bound,
10131                                   guint8 *type_width_size,
10132                                   guint *length_size,
10133                                   const char **type_name,
10134                                   const char **value)
10135 {
10136     int i;
10137     type_formatter formatter;
10138
10139     for (i = 0; amqp_1_0_fixed_types[i].typecode != 0xff; ++i) {
10140         if (amqp_1_0_fixed_types[i].typecode == code) {
10141             *type_name = wmem_strdup(wmem_packet_scope(), amqp_1_0_fixed_types[i].amqp_typename);
10142             formatter   = amqp_1_0_fixed_types[i].formatter;
10143             if (code/16 > 0x9) /* variable width code is 0xa[0-9] or 0xb[0-9] */
10144                 *type_width_size = amqp_1_0_fixed_types[i].known_size;
10145             else
10146                 *type_width_size = 0;
10147             *length_size = formatter(tvb, offset, bound, amqp_1_0_fixed_types[i].known_size, value);
10148             return TRUE;
10149         }
10150     }
10151     return FALSE;
10152 }
10153
10154 static proto_item*
10155 add_1_0_proto_item(proto_item *item,
10156              tvbuff_t *tvb,
10157              int offset,
10158              int length,
10159              int hf_amqp_type,
10160              const char *no_format_value)
10161 {
10162     proto_item *return_item;
10163     if (length==0) /* show type constructor rather */
10164     {
10165         length=1;
10166         offset--;
10167     }
10168
10169     if (no_format_value!=NULL)
10170         return_item = proto_tree_add_none_format(item,
10171                                                  hf_amqp_type,
10172                                                  tvb,
10173                                                  offset,
10174                                                  length,
10175                                                  "%s",
10176                                                  no_format_value);
10177     else
10178         return_item = proto_tree_add_item(item,
10179                                           hf_amqp_type,
10180                                           tvb,
10181                                           offset,
10182                                           length,
10183                                           ENC_NA);
10184     return return_item;
10185 }
10186
10187 /* For given code, the routine decodes its value, format & print output.
10188  * If the code is compound type (array,list,map), it calls relevant
10189  * dissect_* routines for decoding its items
10190  * arguments:
10191  *   tvb, pinfo, code, offset, bound: obvious
10192  *   hf_amqp_type: what hf_* variable corresponds to type of the code
10193  *   name: name of type of this code (applicable to map items and type descriptor
10194  *   hf_amqp_subtype_count: for format code to be list, expected number of list items
10195  *   hf_amqp_subtypes: for format code to be list, field of hf_* variables of list items
10196  *   length_size: decoded length
10197  */
10198 static void
10199 get_amqp_1_0_value_formatter(tvbuff_t *tvb,
10200                              packet_info *pinfo,
10201                              guint8 code,
10202                              int offset,
10203                              int bound,
10204                              int hf_amqp_type,
10205                              const char *name,
10206                              int hf_amqp_subtype_count,
10207                              const int **hf_amqp_subtypes,
10208                              guint *length_size,
10209                              proto_item *item)
10210 {
10211     char *no_format_value = NULL;
10212     const char *type_name = NULL;
10213     const char *value = NULL;
10214     guint8 width_size;
10215     const int *hf_amqp_type_ptr;
10216
10217     if (decode_fixed_type(tvb, code, offset, bound, &width_size, length_size, &type_name, &value))
10218     {
10219         /* if AMQP variable can be of potentialy multiple length, modify hf_amqp_type to proper subtype
10220          * according to code; code=0x4[0-e] means 0 octet length, 0x5[0-e] means 1, 6 means 2, 7 means 4,
10221          * 8 means 8 and 9 means 16 octet length; variable width types decoded with meaning 1  */
10222         if ((hf_amqp_type<=hf_amqp_1_0_saslAdditionalData) &&
10223             (subtypes_for_hf_amqp_1_0[hf_amqp_type-hf_amqp_1_0_size] != NULL))
10224         {
10225           /* message-id and correlation-id can be of so many so different types,
10226            * that the subtypes_for_hf_amqp_1_0 table is different for them */
10227             if ((hf_amqp_type==hf_amqp_1_0_messageId)||(hf_amqp_type==hf_amqp_1_0_correlationId))
10228             {
10229               switch (code) {
10230                 case 0xa1:
10231                 case 0xb1: /* string */
10232                   hf_amqp_type_ptr = subtypes_for_hf_amqp_1_0[hf_amqp_type-hf_amqp_1_0_size][2];
10233                   break;
10234                 case 0xa0:
10235                 case 0xb0: /* binary */
10236                   hf_amqp_type_ptr = subtypes_for_hf_amqp_1_0[hf_amqp_type-hf_amqp_1_0_size][3];
10237                   break;
10238                 default: /* ulong and uuid */
10239                   hf_amqp_type_ptr = subtypes_for_hf_amqp_1_0[hf_amqp_type-hf_amqp_1_0_size][code/16-4];
10240                   break;
10241               }
10242             }
10243             else
10244             {
10245                 hf_amqp_type_ptr = subtypes_for_hf_amqp_1_0[hf_amqp_type-hf_amqp_1_0_size][(code<0xa0)?(code/16-4):(1)];
10246             }
10247             if (hf_amqp_type_ptr==NULL) {
10248                 expert_add_info_format(pinfo,
10249                                        item,
10250                                        &ei_amqp_unknown_amqp_type,
10251                                        "Can't match AMQP type %d(hex=%x, frame position: %d) to list field \"%s\"",
10252                                        code, code,
10253                                        offset,
10254                                        (proto_registrar_get_nth(hf_amqp_type))->name);
10255                 *length_size = bound-offset; /* to stop dissecting */
10256                 return;
10257             }
10258             hf_amqp_type = *hf_amqp_type_ptr;
10259         }
10260         if (name != NULL)
10261         {
10262             no_format_value = (char*) wmem_alloc(wmem_packet_scope(), MAX_BUFFER);
10263             g_snprintf(no_format_value, MAX_BUFFER, "%s (%s): %s", name, type_name, value);
10264         }
10265         else if (hf_amqp_type==hf_amqp_1_0_list)
10266         {
10267             no_format_value = (char*) value;
10268         }
10269         add_1_0_proto_item(item, tvb, offset+width_size, (*length_size)-width_size, hf_amqp_type, no_format_value);
10270     }
10271     else { /* no fixed code, i.e. compound (list, map, array) */
10272         switch (code) {
10273             case AMQP_1_0_TYPE_LIST0:
10274             case AMQP_1_0_TYPE_LIST8:
10275             case AMQP_1_0_TYPE_LIST32:
10276                 *length_size = dissect_amqp_1_0_list(tvb,
10277                                                      pinfo,
10278                                                      offset-1, /* "-1" due to decode type again in the method */
10279                                                      bound,
10280                                                      item,
10281                                                      hf_amqp_type,
10282                                                      hf_amqp_subtype_count,
10283                                                      hf_amqp_subtypes, name)-1; /* "-1" due to decode type again in the method */
10284                 break;
10285             case AMQP_1_0_TYPE_MAP8:
10286             case AMQP_1_0_TYPE_MAP32:
10287                  /* "-1" due to decode type again in the method */
10288                 *length_size = dissect_amqp_1_0_map(tvb, pinfo, offset-1, bound, item, hf_amqp_type, name)-1;
10289                 break;
10290             case AMQP_1_0_TYPE_ARRAY8:
10291             case AMQP_1_0_TYPE_ARRAY32:
10292                 *length_size = dissect_amqp_1_0_array(tvb,
10293                                                       pinfo,
10294                                                       offset-1, /* "-1" due to decode type again in the method */
10295                                                       bound,
10296                                                       item,
10297                                                       hf_amqp_type,
10298                                                       hf_amqp_subtype_count,
10299                                                       hf_amqp_subtypes, name)-1; /* "-1" due to decode type again in the method */
10300                 break;
10301             default:
10302                 expert_add_info_format(pinfo,
10303                                        item,
10304                                        &ei_amqp_unknown_amqp_type,
10305                                        "Unknown AMQP type %d(hex=%x)",
10306                                        code, code);
10307                 *length_size = bound-offset; /* to stop dissecting */
10308                 break;
10309         }
10310     }
10311 }
10312
10313 /* It decodes 1.0 type, including type constructor
10314  * arguments: see get_amqp_1_0_value_formatter
10315  * return code: decoded format code of primitive type
10316  */
10317 static guint
10318 get_amqp_1_0_type_formatter(tvbuff_t *tvb,
10319                             int offset,
10320                             int bound,
10321                             int *hf_amqp_type,
10322                             const char **name,
10323                             int *hf_amqp_subtype_count,
10324                             const int ***hf_amqp_subtypes,
10325                             guint *length_size)
10326 {
10327     int    i;
10328     int    code;
10329     int    format_code_type;
10330     guint  format_len = 0;
10331     guint  orig_offset = offset;
10332
10333     code = tvb_get_guint8(tvb, offset);
10334     AMQP_INCREMENT(offset, 1, bound);
10335     if (code == AMQP_1_0_TYPE_DESCRIPTOR_CONSTRUCTOR) {
10336         format_code_type = tvb_get_guint8(tvb, offset);
10337         AMQP_INCREMENT(offset, 1, bound);
10338         if (format_code_type%16==0xf) { /* i.e. format codes like %x5F %x00-FF */
10339             AMQP_INCREMENT(offset, 1, bound);
10340         }
10341         switch (format_code_type/16) {
10342         case 4: /* empty */
10343             format_len=0;
10344             break;
10345         case 5: /* fixed-one */
10346             format_len=1;
10347             code = (int)tvb_get_guint8(tvb, offset);
10348             break;
10349         case 6: /* fixed-two */
10350             format_len=2;
10351             code = (int)tvb_get_ntohs(tvb, offset);
10352             break;
10353         case 7: /* fixed-four */
10354             format_len=4;
10355             code = (int)tvb_get_ntohl(tvb, offset);
10356             break;
10357         case 8: /* fixed-eight */
10358             format_len=8;
10359             code = (int)tvb_get_ntoh64(tvb, offset);
10360             /* TODO: use a gint64 for 32-bit platforms? we never compare it to
10361              * anything bigger than an int anyways... */
10362             break;
10363         case 9: /* fixed-sixteen */
10364             format_len=16;
10365             /* TODO: somehow set code = next_128_bytes */
10366             break;
10367         case 0xa: /* variable-one */
10368             format_len = format_amqp_1_0_str(tvb, offset, bound, 1, name);
10369             break;
10370         case 0xb: /* variable-four */
10371             format_len = format_amqp_1_0_str(tvb, offset, bound, 4, name);
10372             break;
10373         /* TODO: could be type compound? or array? */
10374         }
10375         AMQP_INCREMENT(offset, format_len, bound);
10376         for (i = 0; amqp_1_0_defined_types[i].format_code != 0x00; ++i) {
10377             if (amqp_1_0_defined_types[i].format_code == code) {
10378                 *hf_amqp_type = *(amqp_1_0_defined_types[i].hf_amqp_type);
10379                 *hf_amqp_subtype_count = amqp_1_0_defined_types[i].hf_amqp_subtype_count;
10380                 *hf_amqp_subtypes = amqp_1_0_defined_types[i].hf_amqp_subtypes;
10381             }
10382         }
10383         /* now take the real primitive format code */
10384         code = tvb_get_guint8(tvb, offset);
10385         AMQP_INCREMENT(offset, 1, bound);
10386     }
10387     *length_size = (offset-orig_offset);
10388     return code;
10389 }
10390
10391 /* It decodes both 1.0 type and its value, in fact it just calls
10392  * get_amqp_1_0_type_formatter and get_amqp_1_0_value_formatter methods
10393  * arguments: see get_amqp_1_0_value_formatter
10394  */
10395 static void
10396 get_amqp_1_0_type_value_formatter(tvbuff_t *tvb,
10397                                   packet_info *pinfo,
10398                                   int offset,
10399                                   int bound,
10400                                   int hf_amqp_type,   /* what to print in GUI if name==NULL */
10401                                   const char *name,   /* what to print in GUI  */
10402                                   guint *length_size, /* decoded length */
10403                                   proto_item *item)
10404 {
10405     int        code;
10406     int        hf_amqp_subtype_count = 0;
10407     const int  **hf_amqp_subtypes = NULL;
10408     const char *type_name = NULL;
10409     char       *format_name = NULL;
10410     guint      type_length_size;
10411
10412     code = get_amqp_1_0_type_formatter(tvb,
10413                                        offset,
10414                                        bound,
10415                                        &hf_amqp_type,
10416                                        &type_name,
10417                                        &hf_amqp_subtype_count,
10418                                        &hf_amqp_subtypes,
10419                                        &type_length_size);
10420     if ((name != NULL) || (type_name != NULL))
10421     {
10422       if (type_name == NULL)
10423         format_name=(char*)name;
10424       else if (name == NULL)
10425         format_name=(char*)format_name;
10426       else
10427       {
10428         format_name = (char*) wmem_alloc(wmem_packet_scope(), MAX_BUFFER);
10429         g_snprintf(format_name, MAX_BUFFER, "%s : %s", name, type_name);
10430       }
10431     }
10432     AMQP_INCREMENT(offset, type_length_size, bound);
10433     get_amqp_1_0_value_formatter(tvb,
10434                                  pinfo,
10435                                  code,
10436                                  offset,
10437                                  bound,
10438                                  hf_amqp_type,
10439                                  format_name,
10440                                  hf_amqp_subtype_count,
10441                                  hf_amqp_subtypes,
10442                                  length_size,
10443                                  item);
10444     *length_size += type_length_size;
10445 }
10446
10447 static int
10448 format_amqp_1_0_null(tvbuff_t *tvb _U_,
10449                       guint offset _U_, guint bound _U_, guint length _U_,
10450                       const char **value _U_)
10451 {
10452     *value = "null";
10453     return 0;
10454 }
10455
10456 static int
10457 format_amqp_1_0_boolean_true(tvbuff_t *tvb _U_,
10458                         guint offset _U_, guint bound _U_, guint length _U_,
10459                         const char **value)
10460 {
10461     *value = wmem_strdup(wmem_packet_scope(), "true");
10462     return 0;
10463 }
10464
10465 static int
10466 format_amqp_1_0_boolean_false(tvbuff_t *tvb _U_,
10467                         guint offset _U_, guint bound _U_, guint length _U_,
10468                         const char **value)
10469 {
10470     *value = wmem_strdup(wmem_packet_scope(), "false");
10471     return 0;
10472 }
10473
10474 static int
10475 format_amqp_1_0_boolean(tvbuff_t *tvb,
10476                         guint offset, guint bound _U_, guint length _U_,
10477                         const char **value)
10478 {
10479     guint8 val;
10480
10481     val = tvb_get_guint8(tvb, offset);
10482     *value = wmem_strdup(wmem_packet_scope(), val ? "true" : "false");
10483     return 1;
10484 }
10485
10486 /* this covers ubyte, ushort, uint and ulong */
10487 static int
10488 format_amqp_1_0_uint(tvbuff_t *tvb,
10489                      guint offset, guint bound _U_, guint length,
10490                      const char **value)
10491 {
10492     guint64 val;
10493
10494     if (length == 0)
10495         val = 0;
10496     else if (length == 1)
10497         val = tvb_get_guint8(tvb, offset);
10498     else if (length == 2)
10499         val = tvb_get_ntohs(tvb, offset);
10500     else if (length == 4)
10501         val = tvb_get_ntohl(tvb, offset);
10502     else if (length == 8)
10503         val = tvb_get_ntoh64(tvb, offset);
10504     else {
10505         *value = wmem_strdup_printf(wmem_packet_scope(), "Invalid uint length %d!", length);
10506         return length;
10507     }
10508     *value = wmem_strdup_printf(wmem_packet_scope(), "%" G_GINT64_MODIFIER "u", val);
10509     return length;
10510 }
10511
10512 /* this covers byte, short, int and long */
10513 static int
10514 format_amqp_1_0_int(tvbuff_t *tvb,
10515                     guint offset, guint bound _U_, guint length,
10516                     const char **value)
10517 {
10518     gint64 val;
10519
10520     if (length == 1)
10521         val = (gint8)tvb_get_guint8(tvb, offset);
10522     else if (length == 2)
10523         val = (gint16)tvb_get_ntohs(tvb, offset);
10524     else if (length == 4)
10525         val = (gint32)tvb_get_ntohl(tvb, offset);
10526     else if (length == 8)
10527         val = (gint64)tvb_get_ntoh64(tvb, offset);
10528     else {
10529         *value = wmem_strdup_printf(wmem_packet_scope(), "Invalid int length %d!", length);
10530         return length;
10531     }
10532     *value = wmem_strdup_printf(wmem_packet_scope(), "%" G_GINT64_MODIFIER "i", val);
10533     return length;
10534 }
10535
10536 static int
10537 format_amqp_1_0_float(tvbuff_t *tvb,
10538                       guint offset, guint bound _U_, guint length _U_,
10539                       const char **value)
10540 {
10541     float floatval;
10542     floatval = tvb_get_letohieee_float(tvb, offset);
10543     *value = wmem_strdup_printf(wmem_packet_scope(), "%f", floatval);
10544     return 4;
10545 }
10546
10547 static int
10548 format_amqp_1_0_double(tvbuff_t *tvb,
10549                        guint offset, guint bound _U_, guint length _U_,
10550                        const char **value)
10551 {
10552     double doubleval;
10553     doubleval = tvb_get_letohieee_double(tvb, offset);
10554     *value = wmem_strdup_printf(wmem_packet_scope(), "%f", doubleval);
10555     return 8;
10556 }
10557
10558 /* TODO: add AMQP 1.0 decimal[32|64|128] primitive types */
10559
10560 static int
10561 format_amqp_1_0_char(tvbuff_t *tvb,
10562                      guint offset, guint bound _U_, guint length _U_,
10563                      const char **value)
10564 {
10565     *value = tvb_format_text(tvb, offset, 1);
10566     return 1;
10567 }
10568
10569 static int
10570 format_amqp_1_0_timestamp(tvbuff_t *tvb,
10571                           guint offset, guint bound _U_, guint length _U_,
10572                           const char **value)
10573 {
10574     *value = wmem_strdup_printf(wmem_packet_scope(), "%" G_GINT64_MODIFIER "d", tvb_get_ntoh64(tvb, offset));
10575     return 8;
10576 }
10577
10578 static int
10579 format_amqp_1_0_uuid(tvbuff_t *tvb,
10580                      guint offset, guint bound _U_, guint length _U_,
10581                      const char **value)
10582 {
10583     e_guid_t uuid;
10584     tvb_get_guid(tvb, offset, &uuid, ENC_BIG_ENDIAN);
10585     *value = tvb_format_text(tvb, offset, 16);
10586     return 1;
10587 }
10588
10589 static int
10590 format_amqp_1_0_bin(tvbuff_t *tvb,
10591                     guint offset, guint bound _U_, guint length,
10592                     const char **value)
10593 {
10594     guint bin_length;
10595
10596     if (length == 1)
10597         bin_length = tvb_get_guint8(tvb, offset);
10598     else if (length == 4)
10599         bin_length = tvb_get_ntohl(tvb, offset);
10600     else {
10601         *value = wmem_strdup_printf(wmem_packet_scope(), "Invalid binary length size %d!", length);
10602         return length;
10603     }
10604     AMQP_INCREMENT(offset, length, bound);
10605     *value = tvb_bytes_to_ep_str(tvb, offset, bin_length);
10606     return (length+bin_length);
10607 }
10608
10609 static int
10610 format_amqp_1_0_str(tvbuff_t *tvb,
10611                     guint offset, guint bound, guint length,
10612                     const char **value)
10613 {
10614     guint string_length;
10615
10616     if (length == 1)
10617         string_length = tvb_get_guint8(tvb, offset);
10618     else if (length == 4)
10619         string_length = tvb_get_ntohl(tvb, offset);
10620     else {
10621         *value = wmem_strdup_printf(wmem_packet_scope(), "Invalid string length size %d!", length);
10622         return length;
10623     }
10624     AMQP_INCREMENT(offset, length, bound);
10625     *value = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, string_length, ENC_UTF_8|ENC_NA);
10626     AMQP_INCREMENT(offset, string_length, bound);
10627     return (string_length + length);
10628 }
10629
10630 static int
10631 format_amqp_1_0_symbol(tvbuff_t *tvb,
10632                        guint offset, guint bound, guint length,
10633                        const char **value)
10634 {
10635     guint symbol_length;
10636     if (length == 1)
10637         symbol_length = tvb_get_guint8(tvb, offset);
10638     else if (length == 4)
10639         symbol_length = tvb_get_ntohl(tvb, offset);
10640     else {
10641         *value = wmem_strdup_printf(wmem_packet_scope(), "Invalid symbol length size %d!", length);
10642         return length;
10643     }
10644     AMQP_INCREMENT(offset, length, bound);
10645     *value = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, symbol_length, ENC_ASCII|ENC_NA);
10646     AMQP_INCREMENT(offset, symbol_length, bound);
10647     return (symbol_length + length);
10648 }
10649
10650
10651 /*  AMQP 0-10 Type Decoders  */
10652
10653 static gboolean
10654 get_amqp_0_10_type_formatter(guint8 code,
10655                              const char **name,
10656                              type_formatter *formatter,
10657                              guint *length_size)
10658 {
10659     int i;
10660     struct amqp_typeinfo *table;
10661
10662     if (code & 0x80)
10663         table = amqp_0_10_var_types;
10664     else
10665         table = amqp_0_10_fixed_types;
10666     for (i = 0; table[i].typecode != 0xff; ++i) {
10667         if (table[i].typecode == code) {
10668             *name        = wmem_strdup(wmem_packet_scope(), table[i].amqp_typename);
10669             *formatter   = table[i].formatter;
10670             *length_size = table[i].known_size;
10671             return TRUE;
10672         }
10673     }
10674     return FALSE;
10675 }
10676
10677 static int
10678 format_amqp_0_10_bin(tvbuff_t *tvb,
10679                      guint offset, guint bound _U_, guint length,
10680                      const char **value)
10681 {
10682     *value = tvb_bytes_to_ep_str(tvb, offset, length);
10683     return length;
10684 }
10685
10686 static int
10687 format_amqp_0_10_int(tvbuff_t *tvb,
10688                      guint offset, guint bound _U_, guint length,
10689                      const char **value)
10690 {
10691     int val;
10692
10693     if (length == 1)
10694         val = (gint8)tvb_get_guint8(tvb, offset);
10695     else if (length == 2)
10696         val = (gint16)tvb_get_ntohs(tvb, offset);
10697     else if (length == 4)
10698         val = (gint32)tvb_get_ntohl(tvb, offset);
10699     else {
10700         *value = wmem_strdup_printf(wmem_packet_scope(), "Invalid int length %d!", length);
10701         return length;
10702     }
10703     *value = wmem_strdup_printf(wmem_packet_scope(), "%d", val);
10704     return length;
10705 }
10706
10707 static int
10708 format_amqp_0_10_uint(tvbuff_t *tvb,
10709                       guint offset, guint bound _U_, guint length,
10710                       const char **value)
10711 {
10712     unsigned int val;
10713
10714     if (length == 1)
10715         val = tvb_get_guint8(tvb, offset);
10716     else if (length == 2)
10717         val = tvb_get_ntohs(tvb, offset);
10718     else if (length == 4)
10719         val = tvb_get_ntohl(tvb, offset);
10720     else {
10721         *value = wmem_strdup_printf(wmem_packet_scope(), "Invalid uint length %d!", length);
10722         return length;
10723     }
10724     *value = wmem_strdup_printf(wmem_packet_scope(), "%u", val);
10725     return length;
10726 }
10727
10728 static int
10729 format_amqp_0_10_char(tvbuff_t *tvb,
10730                       guint offset, guint bound _U_, guint length _U_,
10731                       const char **value)
10732 {
10733     *value = tvb_format_text(tvb, offset, 1);
10734     return 1;
10735 }
10736
10737 static int
10738 format_amqp_0_10_boolean(tvbuff_t *tvb,
10739                          guint offset, guint bound _U_, guint length _U_,
10740                          const char **value)
10741 {
10742     guint8 val;
10743
10744     val = tvb_get_guint8(tvb, offset);
10745     *value = wmem_strdup(wmem_packet_scope(), val ? "true" : "false");
10746     return 1;
10747 }
10748
10749 static int
10750 format_amqp_0_10_vbin(tvbuff_t *tvb,
10751                       guint offset, guint bound, guint length,
10752                       const char **value)
10753 {
10754     guint bin_length;
10755
10756     if (length == 1)
10757         bin_length = tvb_get_guint8(tvb, offset);
10758     else if (length == 2)
10759         bin_length = tvb_get_ntohs(tvb, offset);
10760     else if (length == 4)
10761         bin_length = tvb_get_ntohl(tvb, offset);
10762     else {
10763         *value = wmem_strdup_printf(wmem_packet_scope(), "Invalid vbin length size %d!", length);
10764         return length;
10765     }
10766     AMQP_INCREMENT(offset, length, bound);
10767     *value = tvb_bytes_to_ep_str(tvb, offset, bin_length);
10768     AMQP_INCREMENT(offset, bin_length, bound);
10769     return (bin_length + length);
10770 }
10771
10772 static int
10773 format_amqp_0_10_str(tvbuff_t *tvb,
10774                      guint offset, guint bound, guint length,
10775                      const char **value)
10776 {
10777     guint string_length;
10778
10779     if (length == 1)
10780         string_length = tvb_get_guint8(tvb, offset);
10781     else if (length == 2)
10782         string_length = tvb_get_ntohs(tvb, offset);
10783     else if (length == 4)
10784         string_length = tvb_get_ntohl(tvb, offset);
10785     else {
10786         *value = wmem_strdup_printf(wmem_packet_scope(), "Invalid string length size %d!", length);
10787         return length;
10788     }
10789     AMQP_INCREMENT(offset, length, bound);
10790     *value = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, string_length, ENC_UTF_8|ENC_NA);
10791     AMQP_INCREMENT(offset, string_length, bound);
10792     return (string_length + length);
10793 }
10794
10795 static void
10796 format_amqp_0_10_sequence_set(tvbuff_t *tvb, guint offset, guint length,
10797                               proto_item *item)
10798 {
10799     guint values;
10800
10801     /* Must be 4-byte values */
10802     if ((length % 4) != 0) {
10803         proto_item_append_text(item, "Invalid sequence set length %u",
10804                                length);
10805     }
10806
10807     values = length / 4;
10808     /* There must be pairs of values */
10809     if ((values % 2) != 0) {
10810         proto_item_append_text(item, "Invalid sequence set value count %u",
10811                                values);
10812     }
10813     proto_item_append_text(item, " [");
10814     while(values > 0) {
10815         proto_item_append_text(item, "(%u, %u)%s",
10816                                tvb_get_ntohl(tvb, offset),
10817                                tvb_get_ntohl(tvb, offset + 4),
10818                                values > 2 ? ", " : "");
10819         offset += 8;
10820         values -= 2;
10821     }
10822     proto_item_append_text(item, "]");
10823 }
10824
10825 /*  Basic registration functions  */
10826
10827 void
10828 proto_register_amqp(void)
10829 {
10830     /*
10831      * Setup of field format array. A few of the 0-9 fields are reused
10832      * in 0-10, but there are many separate.
10833      */
10834     static hf_register_info hf[] = {
10835         /* DO NOT CHANGE BELOW hf_amqp_1_0_* VARIABLES ORDERING!
10836          * It is crucial for subtypes_for_hf_amqp_1_0 */
10837         {&hf_amqp_1_0_size, {
10838             "Length", "amqp.length",
10839             FT_UINT32, BASE_DEC, NULL, 0x0,
10840             "Length of the frame", HFILL}},
10841         {&hf_amqp_1_0_doff, {
10842             "Doff", "amqp.doff",
10843             FT_UINT8, BASE_DEC, NULL, 0x0,
10844             "Data offset", HFILL}},
10845         {&hf_amqp_1_0_type, {
10846             "Type", "amqp.type",
10847             FT_UINT8, BASE_DEC, VALS(amqp_1_0_type), 0x0,
10848             "Frame type", HFILL}},
10849         {&hf_amqp_1_0_amqp_performative, {
10850             "Performative", "amqp.performative",
10851             FT_UINT8, BASE_DEC, VALS(amqp_1_0_AMQP_performatives), 0x0,
10852             "AMQP Performative", HFILL}},
10853         {&hf_amqp_1_0_sasl_method, {
10854             "Method", "amqp.sasl.method",
10855             FT_UINT8, BASE_DEC, VALS(amqp_1_0_SASL_methods), 0x0,
10856             "SASL Method", HFILL}},
10857         {&hf_amqp_1_0_list, {
10858             "list-item", "amqp.list",
10859             FT_NONE, BASE_NONE, NULL, 0,
10860             "List item", HFILL}},
10861         {&hf_amqp_1_0_map, {
10862             "map-item", "amqp.map",
10863             FT_NONE, BASE_NONE, NULL, 0,
10864             "Map item", HFILL}},
10865         {&hf_amqp_1_0_array, {
10866             "array-item", "amqp.array",
10867             FT_NONE, BASE_NONE, NULL, 0,
10868             "Array item", HFILL}},
10869         {&hf_amqp_1_0_containerId, {
10870             "Container-Id", "amqp.performative.arguments.containerId",
10871             FT_STRING, BASE_NONE, NULL, 0,
10872             "Container ID", HFILL}},
10873         {&hf_amqp_1_0_hostname, {
10874             "Hostname", "amqp.performative.arguments.hostname",
10875             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10876             NULL, HFILL}},
10877         {&hf_amqp_1_0_maxFrameSize, {
10878             "Max-Frame-Size", "amqp.performative.arguments.maxFrameSize",
10879             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10880             "Max frame size", HFILL}},
10881         {&hf_amqp_1_0_channelMax, {
10882             "Channel-Max", "amqp.performative.arguments.channelMax",
10883             FT_UINT16, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10884             "Channel max", HFILL}},
10885         {&hf_amqp_1_0_idleTimeOut, {
10886             "Idle-Timeout", "amqp.performative.arguments.idleTimeout",
10887             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10888             "Idle timeout", HFILL}},
10889         {&hf_amqp_1_0_outgoingLocales, {
10890             "Outgoing-Locales", "amqp.performative.arguments.outgoingLocales",
10891             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10892             "Outgoing locales", HFILL}},
10893         {&hf_amqp_1_0_incomingLocales, {
10894             "Incoming-Locales", "amqp.performative.arguments.incomingLocales",
10895             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10896             "Incoming locales", HFILL}},
10897         {&hf_amqp_1_0_offeredCapabilities, {
10898             "Offered-Capabilities", "amqp.arguments.offeredCapabilities",
10899             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10900             "Offered capabilities", HFILL}},
10901         {&hf_amqp_1_0_desiredCapabilities, {
10902             "Desired-Capabilities", "amqp.performative.arguments.desiredCapabilities",
10903             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10904             "Desired capabilities", HFILL}},
10905         {&hf_amqp_1_0_properties, {
10906             "Properties", "amqp.performative.arguments.properties",
10907             FT_NONE, BASE_NONE, NULL, 0,
10908             NULL, HFILL}},
10909         {&hf_amqp_1_0_nextIncomingId, {
10910             "Next-Incoming-Id", "amqp.performative.arguments.nextIncomingId",
10911             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10912             "Next incoming id", HFILL}},
10913         {&hf_amqp_1_0_deliveryCount, {
10914             "Delivery-Count", "amqp.performative.arguments.deliveryCount",
10915             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10916             "Delivery count", HFILL}},
10917         {&hf_amqp_1_0_sectionNumber, {
10918             "Section-Number", "amqp.received.sectionNumber",
10919             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10920             "Section number of received message", HFILL}},
10921         {&hf_amqp_1_0_sectionOffset, {
10922             "Section-Offset", "amqp.received.sectionOffset",
10923             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10924             "Section offset of received message", HFILL}},
10925         {&hf_amqp_1_0_deliveryFailed, {
10926             "Delivery-Failed", "amqp.modified.deliveryFailed",
10927             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10928             "Deliver failed", HFILL}},
10929         {&hf_amqp_1_0_undeliverableHere, {
10930             "Undeliverable-Here", "amqp.modified.undeliverableHere",
10931             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10932             "Undeliverable here", HFILL}},
10933         {&hf_amqp_1_0_linkCredit, {
10934             "Link-Credit", "amqp.performative.arguments.linkCredit",
10935             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10936             "Link credit", HFILL}},
10937         {&hf_amqp_1_0_available, {
10938             "Available", "amqp.performative.arguments.available",
10939             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10940             "The number of available messages", HFILL}},
10941         {&hf_amqp_1_0_drain, {
10942             "Drain", "amqp.performative.arguments.drain",
10943             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10944             "Drain mode", HFILL}},
10945         {&hf_amqp_1_0_echo, {
10946             "Echo", "amqp.performative.arguments.echo",
10947             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10948             "Request state from partner", HFILL}},
10949         {&hf_amqp_1_0_deliveryId, {
10950             "Delivery-Id", "amqp.performative.arguments.deliveryId",
10951             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10952             "Delivery id", HFILL}},
10953         {&hf_amqp_1_0_deliveryTag, {
10954             "Delivery-Tag", "amqp.performative.arguments.deliveryTag",
10955             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10956             "Delivery tag", HFILL}},
10957         {&hf_amqp_1_0_messageFormat, {
10958             "Message-Format", "amqp.performative.arguments.messageFormat",
10959             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10960             "Message format", HFILL}},
10961         {&hf_amqp_1_0_settled, {
10962             "Settled", "amqp.performative.arguments.settled",
10963             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10964             NULL, HFILL}},
10965         {&hf_amqp_1_0_more, {
10966             "More", "amqp.performative.arguments.more",
10967             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10968             "The message has more content", HFILL}},
10969         {&hf_amqp_1_0_state, {
10970             "State", "amqp.performative.arguments.state",
10971             FT_NONE, BASE_NONE, NULL, 0,
10972             "State of the delivery at sender", HFILL}},
10973         {&hf_amqp_1_0_resume, {
10974             "Resume", "amqp.performative.arguments.resume",
10975             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10976             "Resumed delivery", HFILL}},
10977         {&hf_amqp_1_0_aborted, {
10978             "Aborted", "amqp.performative.arguments.aborted",
10979             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10980             "Message is aborted", HFILL}},
10981         {&hf_amqp_1_0_batchable, {
10982             "Batchable", "amqp.performative.arguments.batchable",
10983             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10984             "Batchable hint", HFILL}},
10985         {&hf_amqp_1_0_first, {
10986             "First", "amqp.performative.arguments.first",
10987             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10988             "Lower bound of deliveries", HFILL}},
10989         {&hf_amqp_1_0_last, {
10990             "Last", "amqp.performative.arguments.last",
10991             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10992             "Upper bound of deliveries", HFILL}},
10993         {&hf_amqp_1_0_closed, {
10994             "Closed", "amqp.performative.arguments.closed",
10995             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
10996             "Sender closed the link", HFILL}},
10997         {&hf_amqp_1_0_remoteChannel, {
10998             "Remote-Channel", "amqp.performative.arguments.remoteChannel",
10999             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11000             "Remote Channel", HFILL}},
11001         {&hf_amqp_1_0_nextOutgoingId, {
11002             "Next-Outgoing-Id", "amqp.performative.arguments.nextOutgoingId",
11003             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11004             "Next outgoing id", HFILL}},
11005         {&hf_amqp_1_0_incomingWindow, {
11006             "Incoming-Window", "amqp.performative.arguments.incomingWindow",
11007             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11008             "Incoming window", HFILL}},
11009         {&hf_amqp_1_0_outgoingWindow, {
11010             "Outgoing-Window", "amqp.performative.arguments.outgoingWindow",
11011             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11012             "Outgoing window", HFILL}},
11013         {&hf_amqp_1_0_handleMax, {
11014             "Handle-Max", "amqp.performative.arguments.handleMax",
11015             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11016             "Handle max", HFILL}},
11017         {&hf_amqp_1_0_name, {
11018             "Name", "amqp.performative.arguments.name",
11019             FT_STRING, BASE_NONE, NULL, 0,
11020             "Name of the link", HFILL}},
11021         {&hf_amqp_1_0_handle, {
11022             "Handle", "amqp.performative.arguments.handle",
11023             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11024             "Handle for the link while attached", HFILL}},
11025         {&hf_amqp_1_0_role, {
11026             "Role", "amqp.performative.arguments.role",
11027             FT_UINT8, BASE_DEC, VALS(amqp_1_0_role_value), 0,
11028             "Role of the link endpoint", HFILL}},
11029         {&hf_amqp_1_0_sndSettleMode, {
11030             "Send-Settle-Mode", "amqp.performative.arguments.sndSettleMode",
11031             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11032             "Send settle mode", HFILL}},
11033         {&hf_amqp_1_0_rcvSettleMode, {
11034             "Receive-Settle-Mode", "amqp.performative.arguments.rcvSettleMode",
11035             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11036             "Receive settle mode", HFILL}},
11037         {&hf_amqp_1_0_source, {
11038             "Source", "amqp.performative.arguments.source",
11039             FT_NONE, BASE_NONE, NULL, 0,
11040             "Source for messages", HFILL}},
11041         {&hf_amqp_1_0_target, {
11042             "Target", "amqp.performative.arguments.target",
11043             FT_NONE, BASE_NONE, NULL, 0,
11044             "Target for messages", HFILL}},
11045         {&hf_amqp_1_0_deleteOnClose, {
11046             "Delete-On-Close", "amqp.lifetime-policy.deleteOnClose",
11047             FT_NONE, BASE_NONE, NULL, 0,
11048             "Delete on close", HFILL}},
11049         {&hf_amqp_1_0_deleteOnNoLinks, {
11050             "Delete-On-No-Links", "amqp.lifetime-policy.deleteOnNoLinks",
11051             FT_NONE, BASE_NONE, NULL, 0,
11052             "Delete on no links", HFILL}},
11053         {&hf_amqp_1_0_deleteOnNoMessages, {
11054             "Delete-On-No-Messages", "amqp.lifetime-policy.deleteOnNoMessages",
11055             FT_NONE, BASE_NONE, NULL, 0,
11056             "Delete on no messages", HFILL}},
11057         {&hf_amqp_1_0_deleteOnNoLinksOrMessages, {
11058             "Delete-On-No-Links-Or-Messages", "amqp.lifetime-policy.deleteOnNoLinksOrMessages",
11059             FT_NONE, BASE_NONE, NULL, 0,
11060             "Delete on no links or messages", HFILL}},
11061         {&hf_amqp_1_0_coordinator, {
11062             "Coordinator", "amqp.tx.coordinator",
11063             FT_NONE, BASE_NONE, NULL, 0,
11064             "Transaction coordinator", HFILL}},
11065         {&hf_amqp_1_0_declare, {
11066             "Declare", "amqp.tx.declare",
11067             FT_NONE, BASE_NONE, NULL, 0,
11068             "Declare transaction", HFILL}},
11069         {&hf_amqp_1_0_globalId, {
11070             "Global-Id", "amqp.tx.arguments.globalId",
11071             FT_NONE, BASE_NONE, NULL, 0,
11072             "Global id of a transaction", HFILL}},
11073         {&hf_amqp_1_0_discharge, {
11074             "Discharge", "amqp.tx.discharge",
11075             FT_NONE, BASE_NONE, NULL, 0,
11076             "Discharge transaction", HFILL}},
11077         {&hf_amqp_1_0_txnId, {
11078             "Txn-Id", "amqp.tx.arguments.txnId",
11079             FT_BYTES, BASE_NONE, NULL, 0,
11080             "Transaction id", HFILL}},
11081         {&hf_amqp_1_0_fail, {
11082             "Fail", "amqp.tx.arguments.fail",
11083             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11084             "Fail flag of transaction", HFILL}},
11085         {&hf_amqp_1_0_declared, {
11086             "Declared", "amqp.tx.declared",
11087             FT_NONE, BASE_NONE, NULL, 0,
11088             "Declared transaction", HFILL}},
11089         {&hf_amqp_1_0_transactionalState, {
11090             "Transactional-State", "amqp.tx.transactionalState",
11091             FT_NONE, BASE_NONE, NULL, 0,
11092             "Transactional state", HFILL}},
11093         {&hf_amqp_1_0_outcome, {
11094             "Outcome", "amqp.tx.arguments.outcome",
11095             FT_NONE, BASE_NONE, NULL, 0,
11096             "Outcome of transaction", HFILL}},
11097         {&hf_amqp_1_0_unsettled, {
11098             "Unsettled", "amqp.performative.arguments.unsettled",
11099             FT_NONE, BASE_NONE, NULL, 0,
11100             "Unsettled delivery state", HFILL}},
11101         {&hf_amqp_1_0_incompleteUnsettled, {
11102             "Incomplete-Unsettled", "amqp.performative.arguments.incompleteUnsettled",
11103             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11104             "Incomplete unsettled", HFILL}},
11105         {&hf_amqp_1_0_initialDeliveryCount, {
11106             "Initial-Delivery-Count", "amqp.performative.arguments.initDeliveryCount",
11107             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11108             "Initial delivery count", HFILL}},
11109         {&hf_amqp_1_0_maxMessageSize, {
11110             "Max-Message-Size", "amqp.performative.arguments.maxMessageSize",
11111             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11112             "Max message size", HFILL}},
11113         {&hf_amqp_1_0_error, {
11114             "Error", "amqp.performative.arguments.error",
11115             FT_NONE, BASE_NONE, NULL, 0,
11116             "Error in a performative", HFILL}},
11117         {&hf_amqp_1_0_messageHeader, {
11118             "Message-Header", "amqp.header",
11119             FT_NONE, BASE_NONE, NULL, 0,
11120             "Message header", HFILL}},
11121         {&hf_amqp_1_0_messageProperties, {
11122             "Message-Properties", "amqp.properties",
11123             FT_NONE, BASE_NONE, NULL, 0,
11124             "Message properties", HFILL}},
11125         {&hf_amqp_1_0_deliveryAnnotations, {
11126             "Delivery-Annotations", "amqp.deliveryAnnotations",
11127             FT_NONE, BASE_NONE, NULL, 0,
11128             "Delivery annotations", HFILL}},
11129         {&hf_amqp_1_0_messageAnnotations, {
11130             "Message-Annotations", "amqp.messageAnnotations",
11131             FT_NONE, BASE_NONE, NULL, 0,
11132             "Message annotations", HFILL}},
11133         {&hf_amqp_1_0_applicationProperties, {
11134             "Application-Properties", "amqp.applicationProperties",
11135             FT_NONE, BASE_NONE, NULL, 0,
11136             "Application properties", HFILL}},
11137         {&hf_amqp_1_0_data, {
11138             "Data", "amqp.data",
11139             FT_BYTES, BASE_NONE, NULL, 0,
11140             "Opaque binary data", HFILL}},
11141         {&hf_amqp_1_0_amqp_sequence, {
11142             "AMQP-Sequence", "amqp.amqp_sequence",
11143             FT_NONE, BASE_NONE, NULL, 0,
11144             "AMQP sequence", HFILL}},
11145         {&hf_amqp_1_0_amqp_value, {
11146             "AMQP-Value", "amqp.amqp_value",
11147             FT_BYTES, BASE_NONE, NULL, 0,
11148             "AMQP value", HFILL}},
11149         {&hf_amqp_1_0_footer, {
11150             "Footer", "amqp.footer",
11151             FT_NONE, BASE_NONE, NULL, 0,
11152             "Message footer", HFILL}},
11153         {&hf_amqp_1_0_received, {
11154             "Received", "amqp.delivery-state.received",
11155             FT_NONE, BASE_NONE, NULL, 0,
11156             "Received messages", HFILL}},
11157         {&hf_amqp_1_0_accepted, {
11158             "Accepted", "amqp.delivery-state.accepted",
11159             FT_NONE, BASE_NONE, NULL, 0,
11160             "Accepted messages", HFILL}},
11161         {&hf_amqp_1_0_rejected, {
11162             "Rejected", "amqp.delivery-state.rejected",
11163             FT_NONE, BASE_NONE, NULL, 0,
11164             "Rejected messages", HFILL}},
11165         {&hf_amqp_1_0_released, {
11166             "Released", "amqp.delivery-state.released",
11167             FT_NONE, BASE_NONE, NULL, 0,
11168             "Released messages", HFILL}},
11169         {&hf_amqp_1_0_modified, {
11170             "Modified", "amqp.delivery-state.modified",
11171             FT_NONE, BASE_NONE, NULL, 0,
11172             "Modified messages", HFILL}},
11173         {&hf_amqp_1_0_condition, {
11174             "Condition", "amqp.error.condition",
11175             FT_STRING, BASE_NONE, NULL, 0,
11176             "Error condition", HFILL}},
11177         {&hf_amqp_1_0_description, {
11178             "Description", "amqp.error.description",
11179             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11180             "Error description", HFILL}},
11181         {&hf_amqp_1_0_info, {
11182             "Info", "amqp.error.info",
11183             FT_NONE, BASE_NONE, NULL, 0,
11184             "Error info", HFILL}},
11185         {&hf_amqp_1_0_address, {
11186             "Address", "amqp.performative.arguments.address",
11187             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11188             "Address of a node", HFILL}},
11189         {&hf_amqp_1_0_durable, {
11190             "Durable", "amqp.message.durable",
11191             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11192             "Message durability", HFILL}},
11193         {&hf_amqp_1_0_terminusDurable, {
11194             "Terminus-Durable", "amqp.performative.arguments.terminusDurable",
11195             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11196             "Terminus durability", HFILL}},
11197         {&hf_amqp_1_0_priority, {
11198             "Priority", "amqp.message.priority",
11199             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11200             "Message priority", HFILL}},
11201         {&hf_amqp_1_0_ttl, {
11202             "Ttl", "amqp.message.ttl",
11203             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11204             "Time to live", HFILL}},
11205         {&hf_amqp_1_0_firstAcquirer, {
11206             "First-Acquirer", "amqp.message.firstAcquirer",
11207             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11208             "First acquirer", HFILL}},
11209         {&hf_amqp_1_0_expiryPolicy, {
11210             "Expiry-Policy", "amqp.properties.expiryPolicy",
11211             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11212             "Expiry policy", HFILL}},
11213         {&hf_amqp_1_0_timeout, {
11214             "Timeout", "amqp.properties.timeout",
11215             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11216             "Duration that an expiring target will be retained", HFILL}},
11217         {&hf_amqp_1_0_dynamic, {
11218             "Dynamic", "amqp.properties.dynamic",
11219             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11220             "Dynamic creation of a remote node", HFILL}},
11221         {&hf_amqp_1_0_dynamicNodeProperties, {
11222             "Dynamic-Node-Properties", "amqp.properties.dynamicNodeProperties",
11223             FT_NONE, BASE_NONE, NULL, 0,
11224             "Dynamic node properties", HFILL}},
11225         {&hf_amqp_1_0_distributionMode, {
11226             "Distribution-Mode", "amqp.properties.distributionMode",
11227             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11228             "Distribution mode", HFILL}},
11229         {&hf_amqp_1_0_filter, {
11230             "Filter", "amqp.properties.filter",
11231             FT_NONE, BASE_NONE, NULL, 0,
11232             "Predicates to filter messages admitted to the link", HFILL}},
11233         {&hf_amqp_1_0_defaultOutcome, {
11234             "Default-Outcome", "amqp.properties.defaultOutcome",
11235             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11236             "Default outcome", HFILL}},
11237         {&hf_amqp_1_0_outcomes, {
11238             "Outcomes", "amqp.properties.outcomes",
11239             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11240             "Outcomes descriptors for the link", HFILL}},
11241         {&hf_amqp_1_0_capabilities, {
11242             "Capabilities", "amqp.properties.capabilities",
11243             FT_NONE, BASE_NONE, NULL, 0,
11244             "Extension capabilities of the sender", HFILL}},
11245         {&hf_amqp_1_0_messageId, {
11246             "Message-Id", "amqp.message.messageId",
11247             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11248             "Message id", HFILL}},
11249         {&hf_amqp_1_0_userId, {
11250             "User-Id", "amqp.message.userId",
11251             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11252             "User id", HFILL}},
11253         {&hf_amqp_1_0_to, {
11254             "To", "amqp.message.to",
11255             FT_NONE, BASE_NONE, NULL, 0,
11256             "Destination address of the message", HFILL}},
11257         {&hf_amqp_1_0_subject, {
11258             "Subject", "amqp.message.subject",
11259             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11260             "Message subject", HFILL}},
11261         {&hf_amqp_1_0_replyTo, {
11262             "Reply-To", "amqp.message.replyTo",
11263             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11264             "Reply to", HFILL}},
11265         {&hf_amqp_1_0_correlationId, {
11266             "Correlation-Id", "amqp.message.correlationId",
11267             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11268             "Correlation id", HFILL}},
11269         {&hf_amqp_1_0_contentType, {
11270             "Content-Type", "amqp.message.contentType",
11271             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11272             "Content type", HFILL}},
11273         {&hf_amqp_1_0_contentEncoding, {
11274             "Content-Encoding", "amqp.message.contentEncoding",
11275             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11276             "Content encoding", HFILL}},
11277         {&hf_amqp_1_0_absoluteExpiryTime, {
11278             "Expiry-Time", "amqp.message.expiryTime",
11279             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11280             "Absolute expiry time", HFILL}},
11281         {&hf_amqp_1_0_creationTime, {
11282             "Creation-Time", "amqp.message.creationTime",
11283             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11284             "Creation time", HFILL}},
11285         {&hf_amqp_1_0_groupId, {
11286             "Group-Id", "amqp.message.groupId",
11287             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11288             "Croup id", HFILL}},
11289         {&hf_amqp_1_0_groupSequence, {
11290             "Group-Sequence", "amqp.message.groupSequence",
11291             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11292             "Group sequence", HFILL}},
11293         {&hf_amqp_1_0_replyToGroupId, {
11294             "Reply-To-Group-Id", "amqp.message.replyToGroupId",
11295             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11296             "Reply to group id", HFILL}},
11297         {&hf_amqp_1_0_mechanisms, {
11298             "Mechanisms", "amqp.sasl.mechanisms",
11299             FT_NONE, BASE_NONE, NULL, 0,
11300             "Supported security mechanisms", HFILL}},
11301         {&hf_amqp_1_0_mechanism, {
11302             "Mechanism", "amqp.sasl.mechanism",
11303             FT_STRING, BASE_NONE, NULL, 0,
11304             "Chosen security mechanism", HFILL}},
11305         {&hf_amqp_1_0_initResponse, {
11306             "Init-Response", "amqp.sasl.initResponse",
11307             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11308             "Initial response", HFILL}},
11309         {&hf_amqp_1_0_saslChallenge, {
11310             "Challenge", "amqp.sasl.challenge",
11311             FT_BYTES, BASE_NONE, NULL, 0,
11312             "SASL challenge", HFILL}},
11313         {&hf_amqp_1_0_saslResponse, {
11314             "Response", "amqp.sasl.response",
11315             FT_BYTES, BASE_NONE, NULL, 0,
11316             "SASL response", HFILL}},
11317         {&hf_amqp_1_0_saslCode, {
11318             "Code", "amqp.sasl.saslCode",
11319             FT_UINT8, BASE_DEC, VALS(amqp_1_0_SASL_code_value), 0,
11320             "SASL outcome code", HFILL}},
11321         {&hf_amqp_1_0_saslAdditionalData, {
11322             "Additional-Data", "amqp.sasl.addData",
11323             FT_UINT8, BASE_DEC, VALS(amqp_1_0_encoding_width0), 0,
11324             "SASL outcome additional data", HFILL}},
11325         /* further hf_amqp_1_0_* can be re-ordered if required; */
11326         {&hf_amqp_1_0_hostname_str, {
11327             "Hostname", "amqp.performative.arguments.hostname",
11328             FT_STRING, BASE_NONE, NULL, 0,
11329             NULL, HFILL}},
11330         {&hf_amqp_1_0_maxFrameSize_1, {
11331             "Max-Frame-Size", "amqp.performative.arguments.maxFrameSize",
11332             FT_UINT8, BASE_DEC, NULL, 0,
11333             "Max frame size", HFILL}},
11334         {&hf_amqp_1_0_maxFrameSize_4, {
11335             "Max-Frame-Size", "amqp.performative.arguments.maxFrameSize",
11336             FT_UINT32, BASE_DEC, NULL, 0,
11337             "Max frame size", HFILL}},
11338         {&hf_amqp_1_0_incomingWindow_1, {
11339             "Incoming-Window", "amqp.performative.arguments.incomingWindow",
11340             FT_UINT8, BASE_DEC, NULL, 0,
11341             "Incoming window", HFILL}},
11342         {&hf_amqp_1_0_incomingWindow_4, {
11343             "Incoming-Window", "amqp.performative.arguments.incomingWindow",
11344             FT_UINT32, BASE_DEC, NULL, 0,
11345             "Incoming window", HFILL}},
11346         {&hf_amqp_1_0_outgoingWindow_1, {
11347             "Outgoing-Window", "amqp.performative.arguments.outgoingWindow",
11348             FT_UINT8, BASE_DEC, NULL, 0,
11349             "Outgoing window", HFILL}},
11350         {&hf_amqp_1_0_outgoingWindow_4, {
11351             "Outgoing-Window", "amqp.performative.arguments.outgoingWindow",
11352             FT_UINT32, BASE_DEC, NULL, 0,
11353             "Outgoing window", HFILL}},
11354         {&hf_amqp_1_0_linkCredit_1, {
11355             "Link-Credit", "amqp.performative.arguments.linkCredit",
11356             FT_UINT8, BASE_DEC, NULL, 0,
11357             "Link credit", HFILL}},
11358         {&hf_amqp_1_0_linkCredit_4, {
11359             "Link-Credit", "amqp.performative.arguments.linkCredit",
11360             FT_UINT32, BASE_DEC, NULL, 0,
11361             "Link credit", HFILL}},
11362         {&hf_amqp_1_0_available_1, {
11363             "Available", "amqp.performative.arguments.available",
11364             FT_UINT8, BASE_DEC, NULL, 0,
11365             "The number of available messages", HFILL}},
11366         {&hf_amqp_1_0_available_4, {
11367             "Available", "amqp.performative.arguments.available",
11368             FT_UINT32, BASE_DEC, NULL, 0,
11369             "The number of available messages", HFILL}},
11370         {&hf_amqp_1_0_deliveryCount_1, {
11371             "Delivery-Count", "amqp.performative.arguments.deliveryCount",
11372             FT_UINT8, BASE_DEC, NULL, 0,
11373             "Delivery count", HFILL}},
11374         {&hf_amqp_1_0_deliveryCount_4, {
11375             "Delivery-Count", "amqp.performative.arguments.deliveryCount",
11376             FT_UINT32, BASE_DEC, NULL, 0,
11377             "Delivery count", HFILL}},
11378         {&hf_amqp_1_0_sectionNumber_1, {
11379             "Section-Number", "amqp.received.sectionNumber",
11380             FT_UINT8, BASE_DEC, NULL, 0,
11381             "Section number of received message", HFILL}},
11382         {&hf_amqp_1_0_sectionNumber_4, {
11383             "Section-Number", "amqp.received.sectionNumber",
11384             FT_UINT32, BASE_DEC, NULL, 0,
11385             "Section number of received message", HFILL}},
11386         {&hf_amqp_1_0_idleTimeOut_1, {
11387             "Idle-Timeout", "amqp.performative.arguments.idleTimeout",
11388             FT_UINT8, BASE_DEC, NULL, 0,
11389             "Idle timeout", HFILL}},
11390         {&hf_amqp_1_0_idleTimeOut_4, {
11391             "Idle-Timeout", "amqp.performative.arguments.idleTimeout",
11392             FT_UINT32, BASE_DEC, NULL, 0,
11393             "Idle timeout", HFILL}},
11394         {&hf_amqp_1_0_outgoingLocales_sym, {
11395             "Outgoing-Locales", "amqp.performative.arguments.outgoingLocales",
11396             FT_STRING, BASE_NONE, NULL, 0,
11397             "Outgoing locales", HFILL}},
11398         {&hf_amqp_1_0_incomingLocales_sym, {
11399             "Incoming-Locales", "amqp.performative.arguments.incomingLocales",
11400             FT_STRING, BASE_NONE, NULL, 0,
11401             "Incoming locales", HFILL}},
11402         {&hf_amqp_1_0_offeredCapabilities_sym, {
11403             "Offered-Capabilities", "amqp.arguments.offeredCapabilities",
11404             FT_STRING, BASE_NONE, NULL, 0,
11405             "Offered capabilities", HFILL}},
11406         {&hf_amqp_1_0_desiredCapabilities_sym, {
11407             "Desired-Capabilities", "amqp.performative.arguments.desiredCapabilities",
11408             FT_STRING, BASE_NONE, NULL, 0,
11409             "Desired capabilities", HFILL}},
11410         {&hf_amqp_1_0_nextIncomingId_1, {
11411             "Next-Incoming-Id", "amqp.performative.arguments.nextIncomingId",
11412             FT_UINT8, BASE_DEC, NULL, 0,
11413             "Next incoming id", HFILL}},
11414         {&hf_amqp_1_0_nextIncomingId_4, {
11415             "Next-Incoming-Id", "amqp.performative.arguments.nextIncomingId",
11416             FT_UINT32, BASE_DEC, NULL, 0,
11417             "Next incoming id", HFILL}},
11418         {&hf_amqp_1_0_sectionOffset_1, {
11419             "Section-Offset", "amqp.received.sectionOffset",
11420             FT_UINT8, BASE_DEC, NULL, 0,
11421             "Section offset of received message", HFILL}},
11422         {&hf_amqp_1_0_sectionOffset_8, {
11423             "Section-Offset", "amqp.received.sectionOffset",
11424             FT_UINT64, BASE_DEC, NULL, 0,
11425             "Section offset of received message", HFILL}},
11426         {&hf_amqp_1_0_maxMessageSize_1, {
11427             "Max-Message-Size", "amqp.performative.arguments.maxMessageSize",
11428             FT_UINT8, BASE_DEC, NULL, 0,
11429             "Max message size", HFILL}},
11430         {&hf_amqp_1_0_maxMessageSize_8, {
11431             "Max-Message-Size", "amqp.performative.arguments.maxMessageSize",
11432             FT_UINT64, BASE_DEC, NULL, 0,
11433             "Max message size", HFILL}},
11434         {&hf_amqp_1_0_nextOutgoingId_1, {
11435             "Next-Outgoing-Id", "amqp.performative.arguments.nextOutgoingId",
11436             FT_UINT8, BASE_DEC, NULL, 0,
11437             "Next outgoing id", HFILL}},
11438         {&hf_amqp_1_0_nextOutgoingId_4, {
11439             "Next-Outgoing-Id", "amqp.performative.arguments.nextOutgoingId",
11440             FT_UINT16, BASE_DEC, NULL, 0,
11441             "Next outgoing id", HFILL}},
11442         {&hf_amqp_1_0_deliveryId_1, {
11443             "Delivery-Id", "amqp.performative.arguments.deliveryId",
11444             FT_UINT8, BASE_DEC, NULL, 0,
11445             "Delivery id", HFILL}},
11446         {&hf_amqp_1_0_deliveryId_4, {
11447             "Delivery-Id", "amqp.performative.arguments.deliveryId",
11448             FT_UINT16, BASE_DEC, 0, 0,
11449             "Delivery id", HFILL}},
11450         {&hf_amqp_1_0_deliveryTag_bin, {
11451             "Delivery-Tag", "amqp.performative.arguments.deliveryTag",
11452             FT_BYTES, BASE_NONE, NULL, 0,
11453             "Delivery tag", HFILL}},
11454         {&hf_amqp_1_0_messageFormat_1, {
11455             "Message-Format", "amqp.performative.arguments.messageFormat",
11456             FT_UINT8, BASE_DEC, NULL, 0,
11457             "Message format", HFILL}},
11458         {&hf_amqp_1_0_messageFormat_4, {
11459             "Message-Format", "amqp.performative.arguments.messageFormat",
11460             FT_UINT32, BASE_DEC, NULL, 0,
11461             "Message format", HFILL}},
11462         {&hf_amqp_1_0_first_1, {
11463             "First", "amqp.performative.arguments.first",
11464             FT_UINT8, BASE_DEC, NULL, 0,
11465             "Lower bound of deliveries", HFILL}},
11466         {&hf_amqp_1_0_first_4, {
11467             "First", "amqp.performative.arguments.first",
11468             FT_UINT8, BASE_DEC, NULL, 0,
11469             "Lower bound of deliveries", HFILL}},
11470         {&hf_amqp_1_0_last_1, {
11471             "Last", "amqp.performative.arguments.last",
11472             FT_UINT8, BASE_DEC, NULL, 0,
11473             "Upper bound of deliveries", HFILL}},
11474         {&hf_amqp_1_0_last_4, {
11475             "Last", "amqp.performative.arguments.last",
11476             FT_UINT8, BASE_DEC, NULL, 0,
11477             "Upper bound of deliveries", HFILL}},
11478         {&hf_amqp_1_0_remoteChannel_2, {
11479             "Remote-Channel", "amqp.performative.arguments.remoteChannel",
11480             FT_UINT16, BASE_DEC, NULL, 0,
11481             "Remote Channel", HFILL}},
11482         {&hf_amqp_1_0_handleMax_1, {
11483             "Handle-Max", "amqp.performative.arguments.handleMax",
11484             FT_UINT8, BASE_DEC, NULL, 0,
11485             "Handle max", HFILL}},
11486         {&hf_amqp_1_0_handleMax_4, {
11487             "Handle-Max", "amqp.performative.arguments.handleMax",
11488             FT_UINT32, BASE_DEC, NULL, 0,
11489             "Handle max", HFILL}},
11490         {&hf_amqp_1_0_handle_1, {
11491             "Handle", "amqp.performative.arguments.handle",
11492             FT_UINT8, BASE_DEC, NULL, 0,
11493             "Handle for the link while attached", HFILL}},
11494         {&hf_amqp_1_0_handle_4, {
11495             "Handle", "amqp.performative.arguments.handle",
11496             FT_UINT32, BASE_DEC, NULL, 0,
11497             "Handle for the link while attached", HFILL}},
11498         {&hf_amqp_1_0_sndSettleMode_1, {
11499             "Send-Settle-Mode", "amqp.performative.arguments.sndSettleMode",
11500             FT_UINT8, BASE_DEC, VALS(amqp_1_0_sndSettleMode_value), 0,
11501             "Send settle mode", HFILL}},
11502         {&hf_amqp_1_0_rcvSettleMode_1, {
11503             "Receive-Settle-Mode", "amqp.performative.arguments.rcvSettleMode",
11504             FT_UINT8, BASE_DEC, VALS(amqp_1_0_rcvSettleMode_value), 0,
11505             "Receive settle mode", HFILL}},
11506         {&hf_amqp_1_0_initialDeliveryCount_1, {
11507             "Initial-Delivery-Count", "amqp.performative.arguments.initDeliveryCount",
11508             FT_UINT8, BASE_DEC, NULL, 0,
11509             "Initial delivery count", HFILL}},
11510         {&hf_amqp_1_0_initialDeliveryCount_4, {
11511             "Initial-Delivery-Count", "amqp.performative.arguments.initDeliveryCount",
11512             FT_UINT32, BASE_DEC, NULL, 0,
11513             "Initial delivery count", HFILL}},
11514         {&hf_amqp_1_0_description_str, {
11515             "Description", "amqp.error.description",
11516             FT_STRING, BASE_NONE, NULL, 0,
11517             "Error description", HFILL}},
11518         {&hf_amqp_1_0_address_str, {
11519             "Address", "amqp.performative.arguments.address",
11520             FT_STRING, BASE_NONE, NULL, 0,
11521             "Address of a node", HFILL}},
11522         {&hf_amqp_1_0_terminusDurable_1, {
11523             "Terminus-Durable", "amqp.performative.arguments.terminusDurable",
11524             FT_UINT8, BASE_DEC, VALS(amqp_1_0_durable_value), 0,
11525             "Terminus durability", HFILL}},
11526         {&hf_amqp_1_0_terminusDurable_4, {
11527             "Terminus-Durable", "amqp.performative.arguments.terminusDurable",
11528             FT_UINT32, BASE_DEC, VALS(amqp_1_0_durable_value), 0,
11529             "Terminus durability", HFILL}},
11530         {&hf_amqp_1_0_priority_1, {
11531             "Priority", "amqp.message.priority",
11532             FT_UINT8, BASE_DEC, NULL, 0,
11533             "Message priority", HFILL}},
11534         {&hf_amqp_1_0_ttl_1, {
11535             "Ttl", "amqp.message.ttl",
11536             FT_UINT8, BASE_DEC, NULL, 0,
11537             "Time to live", HFILL}},
11538         {&hf_amqp_1_0_ttl_4, {
11539             "Ttl", "amqp.message.ttl",
11540             FT_UINT32, BASE_DEC, NULL, 0,
11541             "Time to live", HFILL}},
11542         {&hf_amqp_1_0_expiryPolicy_sym, {
11543             "Expiry-Policy", "amqp.properties.expiryPolicy",
11544             FT_STRING, BASE_NONE, NULL, 0,
11545             "Expiry policy", HFILL}},
11546         {&hf_amqp_1_0_timeout_1, {
11547             "Timeout", "amqp.properties.timeout",
11548             FT_UINT8, BASE_DEC, NULL, 0,
11549             "Duration that an expiring target will be retained", HFILL}},
11550         {&hf_amqp_1_0_timeout_4, {
11551             "Timeout", "amqp.properties.timeout",
11552             FT_UINT32, BASE_DEC, NULL, 0,
11553             "Duration that an expiring target will be retained", HFILL}},
11554         {&hf_amqp_1_0_distributionMode_sym, {
11555             "Distribution-Mode", "amqp.properties.distributionMode",
11556             FT_STRING, BASE_NONE, NULL, 0,
11557             "Distribution mode", HFILL}},
11558         {&hf_amqp_1_0_outcomes_sym, {
11559             "Outcomes", "amqp.properties.outcomes",
11560             FT_STRING, BASE_NONE, NULL, 0,
11561             "Outcomes descriptors for the link", HFILL}},
11562         {&hf_amqp_1_0_capabilities_sym, {
11563             "Capabilities", "amqp.properties.capabilities",
11564             FT_STRING, BASE_NONE, NULL, 0,
11565             "Extension capabilities of the sender", HFILL}},
11566         {&hf_amqp_1_0_messageId_1, {
11567             "Message-Id", "amqp.message.messageId",
11568             FT_UINT8, BASE_DEC, NULL, 0,
11569             "Message id", HFILL}},
11570         {&hf_amqp_1_0_messageId_str, {
11571             "Message-Id", "amqp.message.messageId",
11572             FT_STRING, BASE_NONE, NULL, 0,
11573             "Message id", HFILL}},
11574         {&hf_amqp_1_0_messageId_bin, {
11575             "Message-Id", "amqp.message.messageId",
11576             FT_BYTES, BASE_NONE, NULL, 0,
11577             "Message id", HFILL}},
11578         {&hf_amqp_1_0_messageId_uuid, {
11579             "Message-Id", "amqp.message.messageId",
11580             FT_GUID, BASE_NONE, NULL, 0,
11581             "Message id", HFILL}},
11582         {&hf_amqp_1_0_messageId_8, {
11583             "Message-Id", "amqp.message.messageId",
11584             FT_UINT64, BASE_DEC, NULL, 0,
11585             "Message id", HFILL}},
11586         {&hf_amqp_1_0_correlationId_1, {
11587             "Correlation-Id", "amqp.message.correlationId",
11588             FT_UINT8, BASE_DEC, NULL, 0,
11589             "Correlation id", HFILL}},
11590         {&hf_amqp_1_0_correlationId_str, {
11591             "Correlation-Id", "amqp.message.correlationId",
11592             FT_STRING, BASE_NONE, NULL, 0,
11593             "Correlation id", HFILL}},
11594         {&hf_amqp_1_0_correlationId_bin, {
11595             "Correlation-Id", "amqp.message.correlationId",
11596             FT_BYTES, BASE_NONE, NULL, 0,
11597             "Correlation id", HFILL}},
11598         {&hf_amqp_1_0_correlationId_uuid, {
11599             "Correlation-Id", "amqp.message.correlationId",
11600             FT_GUID, BASE_NONE, NULL, 0,
11601             "Correlation id", HFILL}},
11602         {&hf_amqp_1_0_correlationId_8, {
11603             "Correlation-Id", "amqp.message.correlationId",
11604             FT_UINT64, BASE_DEC, NULL, 0,
11605             "Correlation id", HFILL}},
11606         {&hf_amqp_1_0_userId_bin, {
11607             "User-Id", "amqp.message.userId",
11608             FT_BYTES, BASE_NONE, NULL, 0,
11609             "User id", HFILL}},
11610         {&hf_amqp_1_0_to_str, {
11611             "To", "amqp.message.to",
11612             FT_STRING, BASE_NONE, NULL, 0,
11613             "Destination address of the message", HFILL}},
11614         {&hf_amqp_1_0_subject_str, {
11615             "Subject", "amqp.message.subject",
11616             FT_STRING, BASE_NONE, NULL, 0,
11617             "Message subject", HFILL}},
11618         {&hf_amqp_1_0_replyTo_str, {
11619             "Reply-To", "amqp.message.replyTo",
11620             FT_STRING, BASE_NONE, NULL, 0,
11621             "Reply to", HFILL}},
11622         {&hf_amqp_1_0_contentType_sym, {
11623             "Content-Type", "amqp.message.contentType",
11624             FT_STRING, BASE_NONE, NULL, 0,
11625             "Content type", HFILL}},
11626         {&hf_amqp_1_0_contentEncoding_sym, {
11627             "Content-Encoding", "amqp.message.contentEncoding",
11628             FT_STRING, BASE_NONE, NULL, 0,
11629             "Content encoding", HFILL}},
11630         {&hf_amqp_1_0_absoluteExpiryTime_timestamp, {
11631             "Expiry-Time", "amqp.message.expiryTime",
11632             FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0,
11633             "Absolute expiry time", HFILL}},
11634         {&hf_amqp_1_0_creationTime_timestamp, {
11635             "Creation-Time", "amqp.message.creationTime",
11636             FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0,
11637             "Creation time", HFILL}},
11638         {&hf_amqp_1_0_groupId_str, {
11639             "Group-Id", "amqp.message.groupId",
11640             FT_STRING, BASE_NONE, NULL, 0,
11641             "Croup id", HFILL}},
11642         {&hf_amqp_1_0_groupSequence_1, {
11643             "Group-Sequence", "amqp.message.groupSequence",
11644             FT_UINT8, BASE_DEC, NULL, 0,
11645             "Group sequence", HFILL}},
11646         {&hf_amqp_1_0_groupSequence_4, {
11647             "Group-Sequence", "amqp.message.groupSequence",
11648             FT_UINT32, BASE_DEC, NULL, 0,
11649             "Group sequence", HFILL}},
11650         {&hf_amqp_1_0_replyToGroupId_str, {
11651             "Reply-To-Group-Id", "amqp.message.replyToGroupId",
11652             FT_STRING, BASE_NONE, NULL, 0,
11653             "Reply to group id", HFILL}},
11654         {&hf_amqp_1_0_mechanisms_sym, {
11655             "Mechanisms", "amqp.sasl.mechanisms",
11656             FT_STRING, BASE_NONE, NULL, 0,
11657             "Supported security mechanisms", HFILL}},
11658         {&hf_amqp_1_0_initResponse_bin, {
11659             "Init-Response", "amqp.sasl.initResponse",
11660             FT_BYTES, BASE_NONE, NULL, 0,
11661             "Initial response", HFILL}},
11662         {&hf_amqp_1_0_saslAdditionalData_bin, {
11663             "Additional-Data", "amqp.sasl.addData",
11664             FT_BYTES, BASE_NONE, NULL, 0,
11665             "SASL outcome additional data", HFILL}},
11666         {&hf_amqp_0_10_format, {
11667             "Format", "amqp.format",
11668             FT_UINT8, BASE_DEC, NULL, 0xc0,
11669             "Framing version", HFILL}},
11670         {&hf_amqp_0_10_position, {
11671             "Position", "amqp.frame-position",
11672             FT_UINT8, BASE_DEC, VALS(amqp_0_10_frame_position), 0x0f,
11673             "Framing position", HFILL}},
11674         {&hf_amqp_0_10_type, {
11675             "Type", "amqp.type",
11676             FT_UINT8, BASE_DEC, VALS(amqp_0_10_frame_types), 0x0,
11677             "Frame type", HFILL}},
11678         {&hf_amqp_0_10_size, {
11679             "Length", "amqp.length",
11680             FT_UINT16, BASE_DEC, NULL, 0x0,
11681             "Length of the frame", HFILL}},
11682         {&hf_amqp_0_10_track, {
11683             "Track", "amqp.track-number",
11684             FT_UINT8, BASE_DEC, VALS(amqp_0_10_frame_tracks), 0x0,
11685             "Track number", HFILL}},
11686         {&hf_amqp_0_10_class, {
11687             "Class", "amqp.class",
11688             FT_UINT8, BASE_DEC, VALS(amqp_0_10_class), 0x0,
11689             "Class ID", HFILL}},
11690         {&hf_amqp_0_10_connection_method, {
11691             "Method", "amqp.connection.method",
11692             FT_UINT8, BASE_DEC, VALS(amqp_0_10_connection_methods), 0x0,
11693             "Connection Class Method", HFILL}},
11694         {&hf_amqp_0_10_session_method, {
11695             "Method", "amqp.session.method",
11696             FT_UINT8, BASE_DEC, VALS(amqp_0_10_session_methods), 0x0,
11697             "Session Class Method", HFILL}},
11698         {&hf_amqp_0_10_execution_method, {
11699             "Method", "amqp.execution.method",
11700             FT_UINT8, BASE_DEC, VALS(amqp_0_10_execution_methods), 0x0,
11701             "Execution Class Method", HFILL}},
11702         {&hf_amqp_0_10_message_method, {
11703             "Method", "amqp.message.method",
11704             FT_UINT8, BASE_DEC, VALS(amqp_0_10_message_methods), 0x0,
11705             "Message Class Method", HFILL}},
11706         {&hf_amqp_0_10_tx_method, {
11707             "Method", "amqp.tx.method",
11708             FT_UINT8, BASE_DEC, VALS(amqp_0_10_tx_methods), 0x0,
11709             "Tx Class Method", HFILL}},
11710         {&hf_amqp_0_10_dtx_method, {
11711             "Method", "amqp.dtx.method",
11712             FT_UINT8, BASE_DEC, VALS(amqp_0_10_dtx_methods), 0x0,
11713             "Dtx Class Method", HFILL}},
11714         {&hf_amqp_0_10_exchange_method, {
11715             "Method", "amqp.exchange.method",
11716             FT_UINT8, BASE_DEC, VALS(amqp_0_10_exchange_methods), 0x0,
11717             "Exchange Class Method", HFILL}},
11718         {&hf_amqp_0_10_queue_method, {
11719             "Method", "amqp.queue.method",
11720             FT_UINT8, BASE_DEC, VALS(amqp_0_10_queue_methods), 0x0,
11721             "Queue Class Method", HFILL}},
11722         {&hf_amqp_0_10_file_method, {
11723             "Method", "amqp.file.method",
11724             FT_UINT8, BASE_DEC, VALS(amqp_0_10_file_methods), 0x0,
11725             "File Class Method", HFILL}},
11726         {&hf_amqp_0_10_stream_method, {
11727             "Method", "amqp.stream.method",
11728             FT_UINT8, BASE_DEC, VALS(amqp_0_10_stream_methods), 0x0,
11729             "Stream Class Method", HFILL}},
11730         {&hf_amqp_0_10_message_body, {
11731             "Message body", "amqp.message-body",
11732             FT_NONE, BASE_NONE, NULL, 0x0,
11733             "Message body content", HFILL}},
11734         {&hf_amqp_0_10_dtx_xid, {
11735             "Xid", "amqp.dtx.xid",
11736             FT_NONE, BASE_NONE, NULL, 0x0,
11737             "Dtx transaction id", HFILL}},
11738         {&hf_amqp_0_10_dtx_xid_format, {
11739             "Format", "amqp.dtx.xid.format",
11740             FT_UINT32, BASE_DEC, NULL, 0x0,
11741             "Implementation-specific xid format code", HFILL}},
11742         {&hf_amqp_0_10_dtx_xid_global_id, {
11743             "Global-id", "amqp.dtx.xid.global-id",
11744             FT_BYTES, BASE_NONE, NULL, 0x0,
11745             "Global transaction id", HFILL}},
11746         {&hf_amqp_0_10_dtx_xid_branch_id, {
11747             "Branch-id", "amqp.dtx.xid.branch-id",
11748             FT_BYTES, BASE_NONE, NULL, 0x0,
11749             "Transaction branch qualifier", HFILL}},
11750         {&hf_amqp_0_10_undissected_struct32, {
11751             "(undissected struct)", "amqp.undissected",
11752             FT_NONE, BASE_NONE, NULL, 0x0,
11753             "Message header struct not yet dissected", HFILL}},
11754         {&hf_amqp_0_10_struct_delivery_properties_discard_unroutable, {
11755             "Discard-unroutable", "amqp.message.delivery-properties.discard-unroutable",
11756             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01,
11757             "Discard message if unroutable", HFILL}},
11758         {&hf_amqp_0_10_struct_delivery_properties_immediate, {
11759             "Immediate", "amqp.message.delivery-properties.immediate",
11760             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
11761             "Consider unroutable if can't be routed immediately", HFILL}},
11762         {&hf_amqp_0_10_struct_delivery_properties_redelivered, {
11763             "Redelivered", "amqp.message.delivery-properties.redelivered",
11764             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04,
11765             "Message may have been previously delivered", HFILL}},
11766         {&hf_amqp_0_10_struct_delivery_properties_priority, {
11767             "Delivery-priority", "amqp.message.delivery-properties.delivery-priority",
11768             FT_UINT8, BASE_DEC, VALS(amqp_0_10_struct_delivery_properties_priorities), 0x0,
11769             "Message delivery priority", HFILL}},
11770         {&hf_amqp_0_10_struct_delivery_properties_mode, {
11771             "Delivery-mode", "amqp.message.delivery-properties.delivery-mode",
11772             FT_UINT8, BASE_DEC, VALS(amqp_0_10_struct_delivery_properties_modes), 0x0,
11773             "Message delivery persistence mode", HFILL}},
11774         {&hf_amqp_0_10_struct_delivery_properties_ttl, {
11775             "TTL", "amqp.message.delivery-properties.ttl",
11776             FT_UINT64, BASE_DEC, NULL, 0x0,
11777             "Message time-to-live in msec", HFILL}},
11778         {&hf_amqp_0_10_struct_delivery_properties_timestamp, {
11779             "Timestamp", "amqp.message.delivery-properties.timestamp",
11780             FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0,
11781             "Time of arrival at broker", HFILL}},
11782         {&hf_amqp_0_10_struct_delivery_properties_expiration, {
11783             "Expiration", "amqp.message.delivery-properties.expiration",
11784             FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0,
11785             "Expiration time calculated by broker", HFILL}},
11786         {&hf_amqp_0_10_struct_delivery_properties_exchange, {
11787             "Exchange", "amqp.message.delivery-properties.exchange",
11788             FT_STRING, BASE_NONE, NULL, 0x0,
11789             "Originating exchange", HFILL}},
11790         {&hf_amqp_0_10_struct_delivery_properties_routing_key, {
11791             "Routing-key", "amqp.message.delivery-properties.routing-key",
11792             FT_STRING, BASE_NONE, NULL, 0x0,
11793             "Message routing key", HFILL}},
11794         {&hf_amqp_0_10_struct_delivery_properties_resume_ttl, {
11795             "Resume-ttl", "amqp.message.delivery-properties.resume-ttl",
11796             FT_UINT64, BASE_DEC, NULL, 0x0,
11797             "TTL to use when resuming", HFILL}},
11798         {&hf_amqp_0_10_struct_fragment_properties_first, {
11799             "First", "amqp.message.fragment-properties.first",
11800             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01,
11801             "Fragment contains the start of the message", HFILL}},
11802         {&hf_amqp_0_10_struct_fragment_properties_last, {
11803             "Last", "amqp.message.fragment-properties.last",
11804             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01,
11805             "Fragment contains the end of the message", HFILL}},
11806         {&hf_amqp_0_10_struct_fragment_properties_size, {
11807             "Fragment-size", "amqp.message.fragment-properties.fragment-size",
11808             FT_UINT64, BASE_DEC, NULL, 0x0,
11809             "Size of the message fragment", HFILL}},
11810 #if 0
11811         {&hf_amqp_0_10_struct_message_properties, {
11812             "message.message-properties", "amqp.message.message-properties",
11813             FT_NONE, BASE_NONE, NULL, 0x0,
11814             "Message properties struct", HFILL}},
11815 #endif
11816         {&hf_amqp_0_10_struct_message_properties_content_len, {
11817             "Content-length", "amqp.message.message-properties.content-length",
11818             FT_UINT64, BASE_DEC, NULL, 0x0,
11819             "Length of associated message", HFILL}},
11820         {&hf_amqp_0_10_struct_message_properties_message_id, {
11821             "Message-id", "amqp.message.message-properties.message-id",
11822             FT_GUID, BASE_NONE, NULL, 0x0,
11823             "Message Id", HFILL}},
11824         {&hf_amqp_0_10_struct_message_properties_correlation, {
11825             "Correlation-id", "amqp.message.message-properties.correlation-id",
11826             FT_BYTES, BASE_NONE, NULL, 0x0,
11827             "Correlation id", HFILL}},
11828         {&hf_amqp_0_10_struct_message_properties_reply_to, {
11829             "Reply-to", "amqp.message.message-properties.reply-to",
11830             FT_NONE, BASE_NONE, NULL, 0x0,
11831             "Address to reply to", HFILL}},
11832         {&hf_amqp_0_10_struct_message_properties_content_type, {
11833             "Content-type", "amqp.message.message-properties.content-type",
11834             FT_STRING, BASE_NONE, NULL, 0x0,
11835             "MIME content type", HFILL}},
11836         {&hf_amqp_0_10_struct_message_properties_content_encoding, {
11837             "Content-encoding", "amqp.message.message-properties.content-encoding",
11838             FT_STRING, BASE_NONE, NULL, 0x0,
11839             "MIME content encoding method", HFILL}},
11840         {&hf_amqp_0_10_struct_message_properties_user_id, {
11841             "User-id", "amqp.message.message-properties.user-id",
11842             FT_BYTES, BASE_NONE, NULL, 0x0,
11843             "Creating user id", HFILL}},
11844         {&hf_amqp_0_10_struct_message_properties_app_id, {
11845             "App-id", "amqp.message.message-properties.app-id",
11846             FT_BYTES, BASE_NONE, NULL, 0x0,
11847             "Creating user id", HFILL}},
11848         {&hf_amqp_0_10_struct_message_properties_application_headers, {
11849             "Application-headers", "amqp.message.message-properties.application-headers",
11850             FT_NONE, BASE_NONE, NULL, 0,
11851             "Application-private headers", HFILL}},
11852         {&hf_amqp_0_10_struct_reply_to_exchange, {
11853             "Exchange", "amqp.message.message-properties.reply-to.exchange",
11854             FT_STRING, BASE_NONE, NULL, 0x0,
11855             "Exchange to reply to", HFILL}},
11856         {&hf_amqp_0_10_struct_reply_to_routing_key, {
11857             "Routing-key", "amqp.message.message-properties.reply-to.routing-key",
11858             FT_STRING, BASE_NONE, NULL, 0x0,
11859             "Routing key to reply with", HFILL}},
11860         {&hf_amqp_0_10_struct_acquired_transfers, {
11861             "Transfers", "amqp.message.acquired.transfers",
11862             FT_NONE, BASE_NONE, NULL, 0x0,
11863             "Command set", HFILL}},
11864         {&hf_amqp_0_10_struct_resume_result_offset, {
11865             "Offset", "amqp.message.resume-result.offset",
11866             FT_UINT64, BASE_DEC, NULL, 0x0,
11867             "Amount of data already transferred", HFILL}},
11868         {&hf_amqp_0_10_struct_exchange_query_result_durable, {
11869             "Durable", "amqp.exchange.exchange-query-result.durable",
11870             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
11871             "Exchange is durable", HFILL}},
11872         {&hf_amqp_0_10_struct_exchange_query_result_not_found, {
11873             "Not-found", "amqp.exchange.exchange-query-result.not-found",
11874             FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x04,
11875             "Exchange was not found", HFILL}},
11876         {&hf_amqp_0_10_struct_exchange_bound_result_exchange_not_found, {
11877             "Exchange-not-found", "amqp.exchange.exchange-bound-result.exchange-not-found",
11878             FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x01,
11879             "Exchange was not found", HFILL}},
11880         {&hf_amqp_0_10_struct_exchange_bound_result_queue_not_found, {
11881             "Queue-not-found", "amqp.exchange.exchange-bound-result.queue-not-found",
11882             FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x02,
11883             "Queue was not found", HFILL}},
11884         {&hf_amqp_0_10_struct_exchange_bound_result_queue_not_matched, {
11885             "Queue-not-matched", "amqp.exchange.exchange-bound-result.queue-not-matched",
11886             FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x04,
11887             "No binding from exchange to queue", HFILL}},
11888         {&hf_amqp_0_10_struct_exchange_bound_result_key_not_matched, {
11889             "Key-not-matched", "amqp.exchange.exchange-bound-result.key-not-matched",
11890             FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x08,
11891             "No binding from exchange with binding-key", HFILL}},
11892         {&hf_amqp_0_10_struct_exchange_bound_result_args_not_matched, {
11893             "Args-not-matched", "amqp.exchange.exchange-bound-result.args-not-matched",
11894             FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x10,
11895             "No binding from exchange with specified arguments", HFILL}},
11896         {&hf_amqp_0_10_struct_queue_query_result_durable, {
11897             "Durable", "amqp.queue.queue-query-result.durable",
11898             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04,
11899             "Queue is durable", HFILL}},
11900         {&hf_amqp_0_10_struct_queue_query_result_exclusive, {
11901             "Exclusive", "amqp.queue.queue-query-result.exclusive",
11902             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08,
11903             "Queue created exclusive-use", HFILL}},
11904         {&hf_amqp_0_10_struct_queue_query_result_auto_delete, {
11905             "Auto-delete", "amqp.queue.queue-query-result.auto-delete",
11906             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10,
11907             "Queue created auto-delete", HFILL}},
11908         {&hf_amqp_0_10_struct_queue_query_result_message_count, {
11909             "Message-count", "amqp.queue.queue-query-result.message-countt",
11910             FT_UINT32, BASE_DEC, NULL, 0x0,
11911             "Number of messages in the queue", HFILL}},
11912         {&hf_amqp_0_10_struct_queue_query_result_subscriber_count, {
11913             "Subscriber-count", "amqp.queue.queue-query-result.subscriber-count",
11914             FT_UINT32, BASE_DEC, NULL, 0x0,
11915             "Number of subscribers for the queue", HFILL}},
11916         {&hf_amqp_0_10_struct_file_properties_content_type, {
11917             "Content-type", "amqp.file.file-properties.content-type",
11918             FT_STRING, BASE_NONE, NULL, 0x0,
11919             "MIME content type", HFILL}},
11920         {&hf_amqp_0_10_struct_file_properties_content_encoding, {
11921             "Content-encoding", "amqp.file.file-properties.content-encoding",
11922             FT_STRING, BASE_NONE, NULL, 0x0,
11923             "MIME content encoding", HFILL}},
11924         {&hf_amqp_0_10_struct_file_properties_headers, {
11925             "Headers", "amqp.file.file-properties.headers",
11926             FT_NONE, BASE_NONE, NULL, 0,
11927             "Message header fields", HFILL}},
11928         {&hf_amqp_0_10_struct_file_properties_priority, {
11929             "Priority", "amqp.file.file-properties.priority",
11930             FT_UINT8, BASE_DEC, NULL, 0,
11931             "Message priority, 0 to 9", HFILL}},
11932         {&hf_amqp_0_10_struct_file_properties_reply_to, {
11933             "Reply-to", "amqp.file.file-properties.reply-to",
11934             FT_STRING, BASE_NONE, NULL, 0x0,
11935             "Destination to reply to", HFILL}},
11936         {&hf_amqp_0_10_struct_file_properties_message_id, {
11937             "Message-id", "amqp.file.file-properties.message-id",
11938             FT_STRING, BASE_NONE, NULL, 0x0,
11939             "Application message identifier", HFILL}},
11940         {&hf_amqp_0_10_struct_file_properties_filename, {
11941             "Filename", "amqp.file.file-properties.filename",
11942             FT_STRING, BASE_NONE, NULL, 0x0,
11943             "Message filename", HFILL}},
11944         {&hf_amqp_0_10_struct_file_properties_timestamp, {
11945             "Timestamp", "amqp.file.file-properties.timestamp",
11946             FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0,
11947             "Message timestamp", HFILL}},
11948         {&hf_amqp_0_10_struct_file_properties_cluster_id, {
11949             "Cluster-id", "amqp.file.file-properties.cluster-id",
11950             FT_STRING, BASE_NONE, NULL, 0x0,
11951             "Intra-cluster routing identifier", HFILL}},
11952         {&hf_amqp_0_10_struct_stream_properties_content_type, {
11953             "Content-type", "amqp.stream.stream-properties.content-type",
11954             FT_STRING, BASE_NONE, NULL, 0x0,
11955             "MIME content type", HFILL}},
11956         {&hf_amqp_0_10_struct_stream_properties_content_encoding, {
11957             "Content-encoding", "amqp.stream.stream-properties.content-encoding",
11958             FT_STRING, BASE_NONE, NULL, 0x0,
11959             "MIME content encoding", HFILL}},
11960         {&hf_amqp_0_10_struct_stream_properties_headers, {
11961             "Headers", "amqp.stream.stream-properties.headers",
11962             FT_NONE, BASE_NONE, NULL, 0,
11963             "Message header fields", HFILL}},
11964         {&hf_amqp_0_10_struct_stream_properties_priority, {
11965             "Priority", "amqp.stream.stream-properties.priority",
11966             FT_UINT8, BASE_DEC, NULL, 0,
11967             "Message priority, 0 to 9", HFILL}},
11968         {&hf_amqp_0_10_struct_stream_properties_timestamp, {
11969             "Timestamp", "amqp.stream.stream-properties.timestamp",
11970             FT_ABSOLUTE_TIME, ABSOLUTE_TIME_UTC, NULL, 0x0,
11971             "Message timestamp", HFILL}},
11972         {&hf_amqp_0_10_argument_packing_flags, {
11973             "Packing Flags", "amqp.struct.packing",
11974             FT_UINT16, BASE_HEX, NULL, 0xffff,
11975             "Argument Struct Packing Flags", HFILL}},
11976         {&hf_amqp_0_10_session_header_sync, {
11977             "Sync", "amqp.session.header.sync",
11978             FT_BOOLEAN, 8, TFS(&amqp_0_10_session_header_sync), 0x01,
11979             "Sync requested", HFILL}},
11980         {&hf_amqp_0_10_method_session_attach_name, {
11981             "Name", "amqp.session.attach.name",
11982             FT_BYTES, BASE_NONE, NULL, 0x0,
11983             "Session name", HFILL}},
11984         {&hf_amqp_0_10_method_session_attach_force, {
11985             "Force", "amqp.session.attach.force",
11986             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
11987             "Session forced", HFILL}},
11988         {&hf_amqp_0_10_method_session_detached_code, {
11989             "Code", "amqp.session.detached.code",
11990             FT_UINT8, BASE_DEC, VALS(amqp_0_10_method_session_detached_codes), 0x0,
11991             "Reason for detach", HFILL}},
11992         {&hf_amqp_0_10_method_session_timeout, {
11993             "Timeout", "amqp.session.timeout",
11994             FT_UINT32, BASE_DEC, NULL, 0x0,
11995             "Session timeout (seconds)", HFILL}},
11996         {&hf_amqp_0_10_method_session_completed_timely, {
11997             "Timely-reply", "amqp.session.completed.timely-reply",
11998             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
11999             "Timely reply requested", HFILL}},
12000         {&hf_amqp_0_10_method_session_flush_expected, {
12001             "Expected", "amqp.session.flush.expected",
12002             FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x01,
12003             "Request notification of expected commands", HFILL}},
12004         {&hf_amqp_0_10_method_session_flush_confirmed, {
12005             "Confirmed", "amqp.session.flush.confirmed",
12006             FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x02,
12007             "Request notification of confirmed commands", HFILL}},
12008         {&hf_amqp_0_10_method_session_flush_completed, {
12009             "Completed", "amqp.session.flush.completed",
12010             FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x04,
12011             "Request notification of completed commands", HFILL}},
12012         {&hf_amqp_0_10_method_session_command_point_id, {
12013             "Command-id", "amqp.session.command_point.command_id",
12014             FT_UINT32, BASE_DEC, NULL, 0x0,
12015             "Next command's sequence number", HFILL}},
12016         {&hf_amqp_0_10_method_session_command_point_offset, {
12017             "Command-offset", "amqp.session.command_point.command_offset",
12018             FT_UINT64, BASE_DEC, NULL, 0x0,
12019             "Byte offset within command", HFILL}},
12020         {&hf_amqp_0_10_method_session_commands, {
12021             "Commands", "amqp.session.expected.commands",
12022             FT_NONE, BASE_NONE, NULL, 0x0,
12023             "Command set", HFILL}},
12024         {&hf_amqp_0_10_method_session_fragments, {
12025             "Fragments", "amqp.session.expected.fragments",
12026             FT_NONE, BASE_NONE, NULL, 0x0,
12027             "Command Fragments", HFILL}},
12028         {&hf_amqp_0_10_method_execution_command_id, {
12029             "Command-id", "amqp.execution.command_id",
12030             FT_UINT32, BASE_DEC, NULL, 0x0,
12031             "Command's sequence number", HFILL}},
12032         {&hf_amqp_0_10_method_execution_exception_error, {
12033             "Error-code", "amqp.execution.exception.error-code",
12034             FT_UINT16, BASE_DEC, VALS(amqp_0_10_method_execution_exception_errors), 0x0,
12035             "Exception error code", HFILL}},
12036         {&hf_amqp_0_10_method_execution_field_index, {
12037             "Field-index", "amqp.execution.exception.field-index",
12038             FT_UINT8, BASE_DEC, NULL, 0x0,
12039             "0-based index of exceptional field", HFILL}},
12040         {&hf_amqp_0_10_method_execution_description, {
12041             "Description", "amqp.execution.exception.description",
12042             FT_STRING, BASE_NONE, NULL, 0,
12043             "Description of exception", HFILL}},
12044         {&hf_amqp_0_10_method_execution_error_info, {
12045             "Error-info", "amqp.execution.exception.error-info",
12046             FT_NONE, BASE_NONE, NULL, 0,
12047             "client-properties", HFILL}},
12048         {&hf_amqp_0_10_method_message_transfer_destination, {
12049             "Description", "amqp.message.transfer.destination",
12050             FT_STRING, BASE_NONE, NULL, 0,
12051             "Message destination", HFILL}},
12052         {&hf_amqp_0_10_method_message_transfer_accept_mode, {
12053             "Accept-mode", "amqp.message.transfer.accept-mode",
12054             FT_UINT8, BASE_DEC, VALS(amqp_0_10_message_transfer_accept_modes), 0x0,
12055             "Message accept mode", HFILL}},
12056         {&hf_amqp_0_10_method_message_transfer_acquire_mode, {
12057             "Acquire-mode", "amqp.message.transfer.acquire-mode",
12058             FT_UINT8, BASE_DEC, VALS(amqp_0_10_message_transfer_acquire_modes), 0x0,
12059             "Message acquire mode", HFILL}},
12060         {&hf_amqp_0_10_method_message_accept_transfers, {
12061             "Commands", "amqp.message.accept.transfers",
12062             FT_NONE, BASE_NONE, NULL, 0x0,
12063             "Previously transferred messages", HFILL}},
12064         {&hf_amqp_0_10_method_message_transfer_reject_code, {
12065             "Reject-code", "amqp.message.reject.reject-code",
12066             FT_UINT8, BASE_DEC, VALS(amqp_0_10_message_transfer_reject_codes), 0x0,
12067             "Message reject code", HFILL}},
12068         {&hf_amqp_0_10_method_message_reject_text, {
12069             "Text", "amqp.message.reject.text",
12070             FT_STRING, BASE_NONE, NULL, 0,
12071             "Reject description", HFILL}},
12072         {&hf_amqp_0_10_method_message_release_set_redelivered, {
12073             "Set-redelivered", "amqp.message.release.set-redelivered",
12074             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
12075             "Mark redelivered on next transfer from queue", HFILL}},
12076         {&hf_amqp_0_10_method_message_dest, {
12077             "Destination", "amqp.message.destination",
12078             FT_STRING, BASE_NONE, NULL, 0,
12079             "Message destination", HFILL}},
12080         {&hf_amqp_0_10_method_message_resume_id, {
12081             "Resume-Id", "amqp.message.resume.id",
12082             FT_STRING, BASE_NONE, NULL, 0,
12083             "Message id to resume", HFILL}},
12084         {&hf_amqp_0_10_method_message_subscribe_queue, {
12085             "Queue", "amqp.message.subscribe.queue",
12086             FT_STRING, BASE_NONE, NULL, 0,
12087             "Queue to subscribe to", HFILL}},
12088         {&hf_amqp_0_10_method_message_subscribe_exclusive, {
12089             "Exclusive", "amqp.message.subscribe.exclusive",
12090             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10,
12091             "Request exclusive subscription", HFILL}},
12092         {&hf_amqp_0_10_method_message_subscribe_resume_ttl, {
12093             "Resume-ttl", "amqp.message.subscribe.resume_ttl",
12094             FT_UINT64, BASE_DEC, NULL, 0x0,
12095             "TTL to use when resuming", HFILL}},
12096         {&hf_amqp_0_10_method_message_subscribe_args, {
12097             "Extended arguments", "amqp.message.subscribe.arguments",
12098             FT_NONE, BASE_NONE, NULL, 0x0,
12099             "Implementation-specific arguments", HFILL}},
12100         {&hf_amqp_0_10_method_message_flow_mode, {
12101             "Flow-mode", "amqp.message.flow-mode",
12102             FT_UINT8, BASE_DEC, VALS(amqp_0_10_message_flow_modes), 0x0,
12103             "Method for allocating message flow credit", HFILL}},
12104         {&hf_amqp_0_10_method_message_credit_unit, {
12105             "Credit-unit", "amqp.message.flow.credit-unit",
12106             FT_UINT8, BASE_DEC, VALS(amqp_0_10_message_credit_units), 0x0,
12107             "Unit of message flow value", HFILL}},
12108         {&hf_amqp_0_10_method_message_credit_value, {
12109             "Value", "amqp.message.flow.value",
12110             FT_UINT32, BASE_DEC, NULL, 0x0,
12111             "Message flow value", HFILL}},
12112         {&hf_amqp_0_10_method_dtx_start_join, {
12113             "Join", "amqp.dtx.start.join",
12114             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
12115             "Join with existing xid", HFILL}},
12116         {&hf_amqp_0_10_method_dtx_start_resume, {
12117             "Resume", "amqp.dtx.start.resume",
12118             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04,
12119             "Resume suspended transaction", HFILL}},
12120         {&hf_amqp_0_10_method_dtx_end_fail, {
12121             "Fail", "amqp.dtx.end.fail",
12122             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
12123             "This portion of work has failed", HFILL}},
12124         {&hf_amqp_0_10_method_dtx_end_suspend, {
12125             "Suspend", "amqp.dtx.end.suspend",
12126             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04,
12127             "Temporarily suspending transaction", HFILL}},
12128         {&hf_amqp_0_10_method_dtx_commit_one_phase, {
12129             "One-phase", "amqp.dtx.commit.one-phase",
12130             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
12131             "Use one-phase optimization", HFILL}},
12132         {&hf_amqp_0_10_method_dtx_set_timeout_timeout, {
12133             "Timeout", "amqp.dtx.set-timeout.timeout",
12134             FT_UINT32, BASE_DEC, NULL, 0x0,
12135             "Transaction timeout value in seconds", HFILL}},
12136         {&hf_amqp_0_10_method_exchange_declare_exchange, {
12137             "Exchange", "amqp.exchange.declare.exchange",
12138             FT_STRING, BASE_NONE, NULL, 0,
12139             "Exchange to declare", HFILL}},
12140         {&hf_amqp_0_10_method_exchange_declare_type, {
12141             "Type", "amqp.exchange.declare.type",
12142             FT_STRING, BASE_NONE, NULL, 0,
12143             "Type of exchange to declare", HFILL}},
12144         {&hf_amqp_0_10_method_exchange_declare_alt_exchange, {
12145             "Alternate-exchange", "amqp.exchange.declare.alternate-exchange",
12146             FT_STRING, BASE_NONE, NULL, 0,
12147             "Alternate exchange for unroutable messages", HFILL}},
12148         {&hf_amqp_0_10_method_exchange_declare_passive, {
12149             "Passive", "amqp.exchange.declare.passive",
12150             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08,
12151             "Do not create the exchange", HFILL}},
12152         {&hf_amqp_0_10_method_exchange_declare_durable, {
12153             "Durable", "amqp.exchange.declare.durable",
12154             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10,
12155             "Create a durable exchange", HFILL}},
12156         {&hf_amqp_0_10_method_exchange_declare_auto_delete, {
12157             "Auto-delete", "amqp.exchange.declare.auto-delete",
12158             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20,
12159             "Delete exchange when last binding removed", HFILL}},
12160         {&hf_amqp_0_10_method_exchange_declare_arguments, {
12161             "Arguments", "amqp.exchange.declare.arguments",
12162             FT_NONE, BASE_NONE, NULL, 0,
12163             "Declaration arguments", HFILL}},
12164         {&hf_amqp_0_10_method_exchange_delete_if_unused, {
12165             "If-unused", "amqp.exchange.delete.if-unused",
12166             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
12167             "Delete exchange only if it has no queue bindings", HFILL}},
12168         {&hf_amqp_0_10_method_exchange_bind_queue, {
12169             "Queue", "amqp.exchange.bind.queue",
12170             FT_STRING, BASE_NONE, NULL, 0,
12171             "Queue to bind to", HFILL}},
12172         {&hf_amqp_0_10_method_exchange_binding_key, {
12173             "Binding-key", "amqp.exchange.bind.binding-key",
12174             FT_STRING, BASE_NONE, NULL, 0,
12175             "Binding between exchange and queue", HFILL}},
12176         {&hf_amqp_0_10_method_queue_name, {
12177             "Queue", "amqp.queue.declare.queue",
12178             FT_STRING, BASE_NONE, NULL, 0,
12179             "Queue name", HFILL}},
12180         {&hf_amqp_0_10_method_queue_alt_exchange, {
12181             "Alternate-exchange", "amqp.queue.declare.alternate-exchange",
12182             FT_STRING, BASE_NONE, NULL, 0,
12183             "Alternate Exchange", HFILL}},
12184         {&hf_amqp_0_10_method_queue_declare_passive, {
12185             "Passive", "amqp.queue.declare.passive",
12186             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04,
12187             "Do not create the queue", HFILL}},
12188         {&hf_amqp_0_10_method_queue_declare_durable, {
12189             "Durable", "amqp.queue.declare.durable",
12190             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08,
12191             "Create a durable queue", HFILL}},
12192         {&hf_amqp_0_10_method_queue_declare_exclusive, {
12193             "Exclusive", "amqp.queue.declare.exclusive",
12194             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10,
12195             "Create a queue usable from only one session", HFILL}},
12196         {&hf_amqp_0_10_method_queue_declare_auto_delete, {
12197             "Auto-delete", "amqp.queue.declare.auto-delete",
12198             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20,
12199             "Delete queue when all uses completed", HFILL}},
12200         {&hf_amqp_0_10_method_queue_declare_arguments, {
12201             "Arguments", "amqp.queue.declare.arguments",
12202             FT_NONE, BASE_NONE, NULL, 0,
12203             "Declaration arguments", HFILL}},
12204         {&hf_amqp_0_10_method_queue_delete_if_unused, {
12205             "If-unused", "amqp.queue.delete.if-unused",
12206             FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x02,
12207             "Delete the queue only if there are no consumers", HFILL}},
12208         {&hf_amqp_0_10_method_queue_delete_if_empty, {
12209             "If-empty", "amqp.queue.delete.if-empty",
12210             FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x04,
12211             "Delete queue only if empty", HFILL}},
12212         {&hf_amqp_0_10_method_file_qos_prefetch_size, {
12213             "Prefetch-size", "amqp.file.qos.prefetch-size",
12214             FT_UINT32, BASE_DEC, NULL, 0x0,
12215             "Pre-fetch window size in octets", HFILL}},
12216         {&hf_amqp_0_10_method_file_qos_prefetch_count, {
12217             "Prefetch-count", "amqp.file.qos.prefetch-count",
12218             FT_UINT16, BASE_DEC, NULL, 0x0,
12219             "Pre-fetch window size in messages", HFILL}},
12220         {&hf_amqp_0_10_method_file_qos_global, {
12221             "Global", "amqp.file.qos.global",
12222             FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x04,
12223             "Apply QoS to entire connection", HFILL}},
12224         {&hf_amqp_0_10_method_file_consumer_tag, {
12225             "Consumer-tag", "amqp.file.consumer-tag",
12226             FT_STRING, BASE_NONE, NULL, 0,
12227             "Consumer tag", HFILL}},
12228         {&hf_amqp_0_10_method_file_consume_no_local, {
12229             "No-local", "amqp.file.consume.no-local",
12230             FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x04,
12231             "Don't send messages to connection that publishes them", HFILL}},
12232         {&hf_amqp_0_10_method_file_consume_no_ack, {
12233             "No-ack", "amqp.file.consume.no-ack",
12234             FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x08,
12235             "No acknowledgement needed", HFILL}},
12236         {&hf_amqp_0_10_method_file_consume_exclusive, {
12237             "Exclusive", "amqp.file.consume.exclusive",
12238             FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x10,
12239             "Request exclusive access", HFILL}},
12240         {&hf_amqp_0_10_method_file_consume_nowait, {
12241             "Nowait", "amqp.file.consume.nowait",
12242             FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x20,
12243             "Do not send a reply", HFILL}},
12244         {&hf_amqp_0_10_method_file_consume_arguments, {
12245             "Arguments", "amqp.file.consume.arguments",
12246             FT_NONE, BASE_NONE, NULL, 0,
12247             "Arguments for consuming", HFILL}},
12248         {&hf_amqp_0_10_method_file_identifier, {
12249             "Identifier", "amqp.file.identifier",
12250             FT_STRING, BASE_NONE, NULL, 0,
12251             "Staging identifier", HFILL}},
12252         {&hf_amqp_0_10_method_file_open_content_size, {
12253             "Content-size", "amqp.file.open.content-size",
12254             FT_UINT64, BASE_DEC, NULL, 0x0,
12255             "Message content size in octets", HFILL}},
12256         {&hf_amqp_0_10_method_file_open_ok_staged_size, {
12257             "Staged-size", "amqp.file.open_ok.staged-size",
12258             FT_UINT64, BASE_DEC, NULL, 0x0,
12259             "Amount of previously staged content in octets", HFILL}},
12260         {&hf_amqp_0_10_method_file_publish_exchange, {
12261             "Exchange", "amqp.file.publish.exchange",
12262             FT_STRING, BASE_NONE, NULL, 0,
12263             "Exchange to publish to", HFILL}},
12264         {&hf_amqp_0_10_method_file_publish_routing_key, {
12265             "Routing-key", "amqp.file.publish.routing-key",
12266             FT_STRING, BASE_NONE, NULL, 0,
12267             "Message routing key", HFILL}},
12268         {&hf_amqp_0_10_method_file_publish_mandatory, {
12269             "Mandatory", "amqp.file.publish.mandatory",
12270             FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x04,
12271             "Mandatory routing", HFILL}},
12272         {&hf_amqp_0_10_method_file_publish_immediate, {
12273             "Immediate", "amqp.file.publish.immediate",
12274             FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x08,
12275             "Request immediate delivery", HFILL}},
12276         {&hf_amqp_0_10_method_file_return_reply_code, {
12277             "Reply-code", "amqp.file.return.reply-code",
12278             FT_UINT16, BASE_DEC, VALS(amqp_0_10_file_return_codes), 0x0,
12279             "Reply code", HFILL}},
12280         {&hf_amqp_0_10_method_file_return_reply_text, {
12281             "Reply-text", "amqp.file.return.reply-text",
12282             FT_STRING, BASE_NONE, NULL, 0,
12283             "Localized reply text", HFILL}},
12284         {&hf_amqp_0_10_method_file_return_exchange, {
12285             "Exchange", "amqp.file.return.exchange",
12286             FT_STRING, BASE_NONE, NULL, 0,
12287             "Exchange the original message was published to", HFILL}},
12288         {&hf_amqp_0_10_method_file_return_routing_key, {
12289             "Routing-key", "amqp.file.return.routing-key",
12290             FT_STRING, BASE_NONE, NULL, 0,
12291             "Message routing key", HFILL}},
12292         {&hf_amqp_0_10_method_file_deliver_consumer_tag, {
12293             "Consumer-tag", "amqp.file.deliver.consumer-tag",
12294             FT_STRING, BASE_NONE, NULL, 0,
12295             "Consumer tag", HFILL}},
12296         {&hf_amqp_0_10_method_file_deliver_delivery_tag, {
12297             "Delivery-tag", "amqp.file.deliver.delivery-tag",
12298             FT_UINT64, BASE_HEX, NULL, 0,
12299             "Server-assigned, session-specific delivery tag", HFILL}},
12300         {&hf_amqp_0_10_method_file_deliver_redelivered, {
12301             "Redelivered", "amqp.file.deliver.redelivered",
12302             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04,
12303             "Possible duplicate delivery", HFILL}},
12304         {&hf_amqp_0_10_method_file_deliver_exchange, {
12305             "Exchange", "amqp.file.deliver.exchange",
12306             FT_STRING, BASE_NONE, NULL, 0,
12307             "Exchange the original message was published to", HFILL}},
12308         {&hf_amqp_0_10_method_file_deliver_routing_key, {
12309             "Routing-key", "amqp.file.deliver.routing-key",
12310             FT_STRING, BASE_NONE, NULL, 0,
12311             "Message routing key", HFILL}},
12312         {&hf_amqp_0_10_method_file_ack_delivery_tag, {
12313             "Delivery-tag", "amqp.file.ack.delivery-tag",
12314             FT_UINT64, BASE_HEX, NULL, 0,
12315             "Identifier of message being acknowledged", HFILL}},
12316         {&hf_amqp_0_10_method_file_ack_multiple, {
12317             "Multiple", "amqp.file.ack.multiple",
12318             FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x02,
12319             "Acknowledge multiple messages", HFILL}},
12320         {&hf_amqp_0_10_method_file_reject_delivery_tag, {
12321             "Delivery-tag", "amqp.file.reject.delivery-tag",
12322             FT_UINT64, BASE_HEX, NULL, 0,
12323             "Identifier of message to be rejected", HFILL}},
12324         {&hf_amqp_0_10_method_file_reject_requeue, {
12325             "Requeue", "amqp.file.reject.multiple",
12326             FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02,
12327             "Requeue the message", HFILL}},
12328         {&hf_amqp_0_10_method_stream_qos_prefetch_size, {
12329             "Prefetch-size", "amqp.stream.qos.prefetch-size",
12330             FT_UINT32, BASE_DEC, NULL, 0x0,
12331             "Pre-fetch window size in octets", HFILL}},
12332         {&hf_amqp_0_10_method_stream_qos_prefetch_count, {
12333             "Prefetch-count", "amqp.stream.qos.prefetch-count",
12334             FT_UINT16, BASE_DEC, NULL, 0x0,
12335             "Pre-fetch window size in messages", HFILL}},
12336 #if 0
12337         {&hf_amqp_0_10_method_stream_qos_consume_rate, {
12338             "Prefetch-size", "amqp.stream.qos.consume_rate",
12339             FT_UINT32, BASE_DEC, NULL, 0x0,
12340             "Desired transfer rate in octets/second", HFILL}},
12341 #endif
12342         {&hf_amqp_0_10_method_stream_qos_global, {
12343             "Global", "amqp.stream.qos.global",
12344             FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x08,
12345             "Apply QoS to entire connection", HFILL}},
12346         {&hf_amqp_0_10_method_stream_consumer_tag, {
12347             "Consumer-tag", "amqp.stream.consumer-tag",
12348             FT_STRING, BASE_NONE, NULL, 0,
12349             "Consumer tag", HFILL}},
12350         {&hf_amqp_0_10_method_stream_consume_no_local, {
12351             "No-local", "amqp.stream.consume.no-local",
12352             FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x04,
12353             "Don't send messages to connection that publishes them", HFILL}},
12354         {&hf_amqp_0_10_method_stream_consume_exclusive, {
12355             "Exclusive", "amqp.stream.consume.exclusive",
12356             FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x08,
12357             "Request exclusive access", HFILL}},
12358         {&hf_amqp_0_10_method_stream_consume_nowait, {
12359             "Nowait", "amqp.stream.consume.nowait",
12360             FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x10,
12361             "Do not send a reply", HFILL}},
12362         {&hf_amqp_0_10_method_stream_consume_arguments, {
12363             "Arguments", "amqp.stream.consume.arguments",
12364             FT_NONE, BASE_NONE, NULL, 0,
12365             "Arguments for consuming", HFILL}},
12366         {&hf_amqp_0_10_method_stream_publish_exchange, {
12367             "Exchange", "amqp.stream.publish.exchange",
12368             FT_STRING, BASE_NONE, NULL, 0,
12369             "Exchange to publish to", HFILL}},
12370         {&hf_amqp_0_10_method_stream_publish_routing_key, {
12371             "Routing-key", "amqp.stream.publish.routing-key",
12372             FT_STRING, BASE_NONE, NULL, 0,
12373             "Message routing key", HFILL}},
12374         {&hf_amqp_0_10_method_stream_publish_mandatory, {
12375             "Mandatory", "amqp.stream.publish.mandatory",
12376             FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x04,
12377             "Mandatory routing", HFILL}},
12378         {&hf_amqp_0_10_method_stream_publish_immediate, {
12379             "Immediate", "amqp.stream.publish.immediate",
12380             FT_BOOLEAN, 8, TFS(&tfs_true_false), 0x08,
12381             "Request immediate delivery", HFILL}},
12382         {&hf_amqp_0_10_method_stream_return_reply_code, {
12383             "Reply-code", "amqp.stream.return.reply-code",
12384             FT_UINT16, BASE_DEC, VALS(amqp_0_10_stream_return_codes), 0x0,
12385             "Reply code", HFILL}},
12386         {&hf_amqp_0_10_method_stream_return_reply_text, {
12387             "Reply-text", "amqp.stream.return.reply-text",
12388             FT_STRING, BASE_NONE, NULL, 0,
12389             "Localized reply text", HFILL}},
12390         {&hf_amqp_0_10_method_stream_return_exchange, {
12391             "Exchange", "amqp.stream.return.exchange",
12392             FT_STRING, BASE_NONE, NULL, 0,
12393             "Exchange the original message was published to", HFILL}},
12394         {&hf_amqp_0_10_method_stream_return_routing_key, {
12395             "Routing-key", "amqp.stream.return.routing-key",
12396             FT_STRING, BASE_NONE, NULL, 0,
12397             "Message routing key", HFILL}},
12398         {&hf_amqp_0_10_method_stream_deliver_consumer_tag, {
12399             "Consumer-tag", "amqp.stream.deliver.consumer-tag",
12400             FT_STRING, BASE_NONE, NULL, 0,
12401             "Consumer tag", HFILL}},
12402         {&hf_amqp_0_10_method_stream_deliver_delivery_tag, {
12403             "Delivery-tag", "amqp.stream.deliver.delivery-tag",
12404             FT_UINT64, BASE_HEX, NULL, 0,
12405             "Server-assigned, session-specific delivery tag", HFILL}},
12406         {&hf_amqp_0_10_method_stream_deliver_exchange, {
12407             "Exchange", "amqp.stream.deliver.exchange",
12408             FT_STRING, BASE_NONE, NULL, 0,
12409             "Exchange the original message was published to", HFILL}},
12410         {&hf_amqp_0_10_method_stream_deliver_queue, {
12411             "Queue", "amqp.stream.deliver.queue",
12412             FT_STRING, BASE_NONE, NULL, 0,
12413             "Name of the queue the message came from", HFILL}},
12414         {&hf_amqp_channel, {
12415             "Channel", "amqp.channel",
12416             FT_UINT16, BASE_DEC, NULL, 0x0,
12417             "Channel ID", HFILL}},
12418         {&hf_amqp_0_9_type, {
12419             "Type", "amqp.type",
12420             FT_UINT8, BASE_DEC, VALS(amqp_0_9_frame_types), 0x0,
12421             "Frame type", HFILL}},
12422         {&hf_amqp_0_9_length, {
12423             "Length", "amqp.length",
12424             FT_UINT32, BASE_DEC, NULL, 0x0,
12425             "Length of the frame", HFILL}},
12426         {&hf_amqp_0_9_method_class_id, {
12427             "Class", "amqp.method.class",
12428             FT_UINT16, BASE_DEC, VALS(amqp_0_9_method_classes), 0x0,
12429             "Class ID", HFILL}},
12430         {&hf_amqp_method_connection_method_id, {
12431             "Method", "amqp.method.method",
12432             FT_UINT16, BASE_DEC, VALS(amqp_method_connection_methods), 0x0,
12433             "Method ID", HFILL}},
12434         {&hf_amqp_method_channel_method_id, {
12435             "Method", "amqp.method.method",
12436             FT_UINT16, BASE_DEC, VALS(amqp_method_channel_methods), 0x0,
12437             "Method ID", HFILL}},
12438         {&hf_amqp_method_access_method_id, {
12439             "Method", "amqp.method.method",
12440             FT_UINT16, BASE_DEC, VALS(amqp_method_access_methods), 0x0,
12441             "Method ID", HFILL}},
12442         {&hf_amqp_method_exchange_method_id, {
12443             "Method", "amqp.method.method",
12444             FT_UINT16, BASE_DEC, VALS(amqp_method_exchange_methods), 0x0,
12445             "Method ID", HFILL}},
12446         {&hf_amqp_method_queue_method_id, {
12447             "Method", "amqp.method.method",
12448             FT_UINT16, BASE_DEC, VALS(amqp_method_queue_methods), 0x0,
12449             "Method ID", HFILL}},
12450         {&hf_amqp_method_basic_method_id, {
12451             "Method", "amqp.method.method",
12452             FT_UINT16, BASE_DEC, VALS(amqp_method_basic_methods), 0x0,
12453             "Method ID", HFILL}},
12454         {&hf_amqp_method_file_method_id, {
12455             "Method", "amqp.method.method",
12456             FT_UINT16, BASE_DEC, VALS(amqp_method_file_methods), 0x0,
12457             "Method ID", HFILL}},
12458         {&hf_amqp_method_stream_method_id, {
12459             "Method", "amqp.method.method",
12460             FT_UINT16, BASE_DEC, VALS(amqp_method_stream_methods), 0x0,
12461             "Method ID", HFILL}},
12462         {&hf_amqp_method_tx_method_id, {
12463             "Method", "amqp.method.method",
12464             FT_UINT16, BASE_DEC, VALS(amqp_method_tx_methods), 0x0,
12465             "Method ID", HFILL}},
12466         {&hf_amqp_method_dtx_method_id, {
12467             "Method", "amqp.method.method",
12468             FT_UINT16, BASE_DEC, VALS(amqp_method_dtx_methods), 0x0,
12469             "Method ID", HFILL}},
12470         {&hf_amqp_method_tunnel_method_id, {
12471             "Method", "amqp.method.method",
12472             FT_UINT16, BASE_DEC, VALS(amqp_method_tunnel_methods), 0x0,
12473             "Method ID", HFILL}},
12474         {&hf_amqp_method_arguments, {
12475             "Arguments", "amqp.method.arguments",
12476             FT_NONE, BASE_NONE, NULL, 0x0,
12477             "Method arguments", HFILL}},
12478         {&hf_amqp_method_connection_start_version_major, {
12479             "Version-Major", "amqp.method.arguments.version_major",
12480             FT_UINT8, BASE_DEC, NULL, 0,
12481             NULL, HFILL}},
12482         {&hf_amqp_method_connection_start_version_minor, {
12483             "Version-Minor", "amqp.method.arguments.version_minor",
12484             FT_UINT8, BASE_DEC, NULL, 0,
12485             NULL, HFILL}},
12486         {&hf_amqp_method_connection_start_server_properties, {
12487             "Server-Properties", "amqp.method.arguments.server_properties",
12488             FT_NONE, BASE_NONE, NULL, 0,
12489             NULL, HFILL}},
12490         {&hf_amqp_0_9_method_connection_start_mechanisms, {
12491             "Mechanisms", "amqp.method.arguments.mechanisms",
12492             FT_BYTES, BASE_NONE, NULL, 0,
12493             NULL, HFILL}},
12494         {&hf_amqp_0_10_method_connection_start_mechanisms, {
12495             "Mechanisms", "amqp.method.arguments.mechanisms",
12496             FT_NONE, BASE_NONE, NULL, 0,
12497             "Supported security mechanisms", HFILL}},
12498         {&hf_amqp_0_9_method_connection_start_locales, {
12499             "Locales", "amqp.method.arguments.locales",
12500             FT_BYTES, BASE_NONE, NULL, 0,
12501             NULL, HFILL}},
12502         {&hf_amqp_0_10_method_connection_start_locales, {
12503             "Locales", "amqp.method.arguments.locales",
12504             FT_NONE, BASE_NONE, NULL, 0,
12505             "Supported message locales", HFILL}},
12506         {&hf_amqp_method_connection_start_ok_client_properties, {
12507             "Client-Properties", "amqp.method.arguments.client_properties",
12508             FT_NONE, BASE_NONE, NULL, 0,
12509             NULL, HFILL}},
12510         {&hf_amqp_method_connection_start_ok_mechanism, {
12511             "Mechanism", "amqp.method.arguments.mechanism",
12512             FT_STRING, BASE_NONE, NULL, 0,
12513             NULL, HFILL}},
12514         {&hf_amqp_method_connection_start_ok_response, {
12515             "Response", "amqp.method.arguments.response",
12516             FT_BYTES, BASE_NONE, NULL, 0,
12517             NULL, HFILL}},
12518         {&hf_amqp_method_connection_start_ok_locale, {
12519             "Locale", "amqp.method.arguments.locale",
12520             FT_STRING, BASE_NONE, NULL, 0,
12521             NULL, HFILL}},
12522         {&hf_amqp_method_connection_secure_challenge, {
12523             "Challenge", "amqp.method.arguments.challenge",
12524             FT_BYTES, BASE_NONE, NULL, 0,
12525             NULL, HFILL}},
12526         {&hf_amqp_method_connection_secure_ok_response, {
12527             "Response", "amqp.method.arguments.response",
12528             FT_BYTES, BASE_NONE, NULL, 0,
12529             NULL, HFILL}},
12530         {&hf_amqp_method_connection_tune_channel_max, {
12531             "Channel-Max", "amqp.method.arguments.channel_max",
12532              FT_UINT16, BASE_DEC, NULL, 0,
12533             NULL, HFILL}},
12534         {&hf_amqp_0_9_method_connection_tune_frame_max, {
12535             "Frame-Max", "amqp.method.arguments.frame_max",
12536             FT_UINT32, BASE_DEC, NULL, 0,
12537             NULL, HFILL}},
12538         {&hf_amqp_0_10_method_connection_tune_frame_max, {
12539             "Frame-Max", "amqp.method.arguments.frame_max",
12540             FT_UINT16, BASE_DEC, NULL, 0,
12541             "Server-proposed maximum frame size", HFILL}},
12542         {&hf_amqp_0_9_method_connection_tune_heartbeat, {
12543             "Heartbeat", "amqp.method.arguments.heartbeat",
12544              FT_UINT16, BASE_DEC, NULL, 0,
12545             NULL, HFILL}},
12546         {&hf_amqp_0_10_method_connection_tune_heartbeat_min, {
12547             "Heartbeat-Min", "amqp.method.arguments.heartbeat_min",
12548              FT_UINT16, BASE_DEC, NULL, 0,
12549             "Minimum heartbeat delay (seconds)", HFILL}},
12550         {&hf_amqp_0_10_method_connection_tune_heartbeat_max, {
12551             "Heartbeat-Max", "amqp.method.arguments.heartbeat_max",
12552              FT_UINT16, BASE_DEC, NULL, 0,
12553             "Maximum heartbeat delay (seconds)", HFILL}},
12554         {&hf_amqp_method_connection_tune_ok_channel_max, {
12555             "Channel-Max", "amqp.method.arguments.channel_max",
12556              FT_UINT16, BASE_DEC, NULL, 0,
12557             NULL, HFILL}},
12558         {&hf_amqp_0_9_method_connection_tune_ok_frame_max, {
12559             "Frame-Max", "amqp.method.arguments.frame_max",
12560             FT_UINT32, BASE_DEC, NULL, 0,
12561             NULL, HFILL}},
12562         {&hf_amqp_0_10_method_connection_tune_ok_frame_max, {
12563             "Frame-Max", "amqp.method.arguments.frame_max",
12564             FT_UINT16, BASE_DEC, NULL, 0,
12565             "Negotiated maximum frame size", HFILL}},
12566         {&hf_amqp_method_connection_tune_ok_heartbeat, {
12567             "Heartbeat", "amqp.method.arguments.heartbeat",
12568              FT_UINT16, BASE_DEC, NULL, 0,
12569             NULL, HFILL}},
12570         {&hf_amqp_method_connection_open_virtual_host, {
12571             "Virtual-Host", "amqp.method.arguments.virtual_host",
12572             FT_STRING, BASE_NONE, NULL, 0,
12573             NULL, HFILL}},
12574         {&hf_amqp_0_9_method_connection_open_capabilities, {
12575             "Capabilities", "amqp.method.arguments.capabilities",
12576             FT_STRING, BASE_NONE, NULL, 0,
12577             NULL, HFILL}},
12578         {&hf_amqp_0_10_method_connection_open_capabilities, {
12579             "Capabilities", "amqp.method.arguments.capabilities",
12580             FT_NONE, BASE_NONE, NULL, 0,
12581             "Required capabilities", HFILL}},
12582         {&hf_amqp_0_9_method_connection_open_insist, {
12583             "Insist", "amqp.method.arguments.insist",
12584             FT_BOOLEAN, 8, NULL, 0x01,
12585             NULL, HFILL}},
12586         {&hf_amqp_0_10_method_connection_open_insist, {
12587             "Insist", "amqp.method.arguments.insist",
12588             FT_BOOLEAN, 8, NULL, 0x04,
12589             "Client insists on this server", HFILL}},
12590         {&hf_amqp_0_9_method_connection_open_ok_known_hosts, {
12591             "Known-Hosts", "amqp.method.arguments.known_hosts",
12592             FT_STRING, BASE_NONE, NULL, 0,
12593             NULL, HFILL}},
12594         {&hf_amqp_0_10_method_connection_open_ok_known_hosts, {
12595             "Known-Hosts", "amqp.method.arguments.known_hosts",
12596             FT_NONE, BASE_NONE, NULL, 0,
12597             "Equivalent or alternate hosts for reconnection", HFILL}},
12598         {&hf_amqp_method_connection_redirect_host, {
12599             "Host", "amqp.method.arguments.host",
12600             FT_STRING, BASE_NONE, NULL, 0,
12601             NULL, HFILL}},
12602         {&hf_amqp_0_9_method_connection_redirect_known_hosts, {
12603             "Known-Hosts", "amqp.method.arguments.known_hosts",
12604             FT_STRING, BASE_NONE, NULL, 0,
12605             NULL, HFILL}},
12606         {&hf_amqp_0_10_method_connection_redirect_known_hosts, {
12607             "Known-Hosts", "amqp.method.arguments.known_hosts",
12608             FT_NONE, BASE_NONE, NULL, 0,
12609             "Equivalent or alternate hosts to redirect to", HFILL}},
12610         {&hf_amqp_0_9_method_connection_close_reply_code, {
12611             "Reply-Code", "amqp.method.arguments.reply_code",
12612              FT_UINT16, BASE_DEC, NULL, 0,
12613             NULL, HFILL}},
12614         {&hf_amqp_0_10_method_connection_close_reply_code, {
12615             "Reply-Code", "amqp.method.arguments.reply_code",
12616              FT_UINT16, BASE_DEC,
12617             VALS(amqp_0_10_method_connection_close_reply_codes), 0,
12618             "Close reason", HFILL}},
12619         {&hf_amqp_method_connection_close_reply_text, {
12620             "Reply-Text", "amqp.method.arguments.reply_text",
12621             FT_STRING, BASE_NONE, NULL, 0,
12622             NULL, HFILL}},
12623         {&hf_amqp_method_connection_close_class_id, {
12624             "Class-Id", "amqp.method.arguments.class_id",
12625              FT_UINT16, BASE_DEC, NULL, 0,
12626             NULL, HFILL}},
12627         {&hf_amqp_method_connection_close_method_id, {
12628             "Method-Id", "amqp.method.arguments.method_id",
12629              FT_UINT16, BASE_DEC, NULL, 0,
12630             NULL, HFILL}},
12631         {&hf_amqp_method_channel_open_out_of_band, {
12632             "Out-Of-Band", "amqp.method.arguments.out_of_band",
12633             FT_STRING, BASE_NONE, NULL, 0,
12634             NULL, HFILL}},
12635         {&hf_amqp_method_channel_open_ok_channel_id, {
12636             "Channel-Id", "amqp.method.arguments.channel_id",
12637             FT_BYTES, BASE_NONE, NULL, 0,
12638             NULL, HFILL}},
12639         {&hf_amqp_method_channel_flow_active, {
12640             "Active", "amqp.method.arguments.active",
12641             FT_BOOLEAN, 8, NULL, 0x01,
12642             NULL, HFILL}},
12643         {&hf_amqp_method_channel_flow_ok_active, {
12644             "Active", "amqp.method.arguments.active",
12645             FT_BOOLEAN, 8, NULL, 0x01,
12646             NULL, HFILL}},
12647         {&hf_amqp_method_channel_close_reply_code, {
12648             "Reply-Code", "amqp.method.arguments.reply_code",
12649              FT_UINT16, BASE_DEC, NULL, 0,
12650             NULL, HFILL}},
12651         {&hf_amqp_method_channel_close_reply_text, {
12652             "Reply-Text", "amqp.method.arguments.reply_text",
12653             FT_STRING, BASE_NONE, NULL, 0,
12654             NULL, HFILL}},
12655         {&hf_amqp_method_channel_close_class_id, {
12656             "Class-Id", "amqp.method.arguments.class_id",
12657              FT_UINT16, BASE_DEC, NULL, 0,
12658             NULL, HFILL}},
12659         {&hf_amqp_method_channel_close_method_id, {
12660             "Method-Id", "amqp.method.arguments.method_id",
12661              FT_UINT16, BASE_DEC, NULL, 0,
12662             NULL, HFILL}},
12663         {&hf_amqp_method_channel_resume_channel_id, {
12664             "Channel-Id", "amqp.method.arguments.channel_id",
12665             FT_BYTES, BASE_NONE, NULL, 0,
12666             NULL, HFILL}},
12667         {&hf_amqp_method_access_request_realm, {
12668             "Realm", "amqp.method.arguments.realm",
12669             FT_STRING, BASE_NONE, NULL, 0,
12670             NULL, HFILL}},
12671         {&hf_amqp_method_access_request_exclusive, {
12672             "Exclusive", "amqp.method.arguments.exclusive",
12673             FT_BOOLEAN, 8, NULL, 0x01,
12674             NULL, HFILL}},
12675         {&hf_amqp_method_access_request_passive, {
12676             "Passive", "amqp.method.arguments.passive",
12677             FT_BOOLEAN, 8, NULL, 0x02,
12678             NULL, HFILL}},
12679         {&hf_amqp_method_access_request_active, {
12680             "Active", "amqp.method.arguments.active",
12681             FT_BOOLEAN, 8, NULL, 0x04,
12682             NULL, HFILL}},
12683         {&hf_amqp_method_access_request_write, {
12684             "Write", "amqp.method.arguments.write",
12685             FT_BOOLEAN, 8, NULL, 0x08,
12686             NULL, HFILL}},
12687         {&hf_amqp_method_access_request_read, {
12688             "Read", "amqp.method.arguments.read",
12689             FT_BOOLEAN, 8, NULL, 0x10,
12690             NULL, HFILL}},
12691         {&hf_amqp_method_access_request_ok_ticket, {
12692             "Ticket", "amqp.method.arguments.ticket",
12693              FT_UINT16, BASE_DEC, NULL, 0,
12694             NULL, HFILL}},
12695         {&hf_amqp_method_exchange_declare_ticket, {
12696             "Ticket", "amqp.method.arguments.ticket",
12697              FT_UINT16, BASE_DEC, NULL, 0,
12698             NULL, HFILL}},
12699         {&hf_amqp_method_exchange_declare_exchange, {
12700             "Exchange", "amqp.method.arguments.exchange",
12701             FT_STRING, BASE_NONE, NULL, 0,
12702             NULL, HFILL}},
12703         {&hf_amqp_method_exchange_declare_type, {
12704             "Type", "amqp.method.arguments.type",
12705             FT_STRING, BASE_NONE, NULL, 0,
12706             NULL, HFILL}},
12707         {&hf_amqp_method_exchange_declare_passive, {
12708             "Passive", "amqp.method.arguments.passive",
12709             FT_BOOLEAN, 8, NULL, 0x01,
12710             NULL, HFILL}},
12711         {&hf_amqp_method_exchange_declare_durable, {
12712             "Durable", "amqp.method.arguments.durable",
12713             FT_BOOLEAN, 8, NULL, 0x02,
12714             NULL, HFILL}},
12715         {&hf_amqp_method_exchange_declare_auto_delete, {
12716             "Auto-Delete", "amqp.method.arguments.auto_delete",
12717             FT_BOOLEAN, 8, NULL, 0x04,
12718             NULL, HFILL}},
12719         {&hf_amqp_method_exchange_declare_internal, {
12720             "Internal", "amqp.method.arguments.internal",
12721             FT_BOOLEAN, 8, NULL, 0x08,
12722             NULL, HFILL}},
12723         {&hf_amqp_method_exchange_declare_nowait, {
12724             "Nowait", "amqp.method.arguments.nowait",
12725             FT_BOOLEAN, 8, NULL, 0x10,
12726             NULL, HFILL}},
12727         {&hf_amqp_method_exchange_declare_arguments, {
12728             "Arguments", "amqp.method.arguments.arguments",
12729             FT_NONE, BASE_NONE, NULL, 0,
12730             NULL, HFILL}},
12731         {&hf_amqp_method_exchange_bind_destination, {
12732             "Destination", "amqp.method.arguments.destination",
12733             FT_STRING, BASE_NONE, NULL, 0,
12734             NULL, HFILL}},
12735         {&hf_amqp_method_exchange_bind_source, {
12736             "Destination", "amqp.method.arguments.source",
12737             FT_STRING, BASE_NONE, NULL, 0,
12738             NULL, HFILL}},
12739         {&hf_amqp_method_exchange_bind_routing_key, {
12740             "Routing-Key", "amqp.method.arguments.routing_key",
12741             FT_STRING, BASE_NONE, NULL, 0,
12742             NULL, HFILL}},
12743         {&hf_amqp_method_exchange_bind_nowait, {
12744             "Nowait", "amqp.method.arguments.nowait",
12745             FT_BOOLEAN, 8, NULL, 0x01,
12746             NULL, HFILL}},
12747         {&hf_amqp_method_exchange_bind_arguments, {
12748             "Arguments", "amqp.method.arguments.arguments",
12749             FT_NONE, BASE_NONE, NULL, 0,
12750             NULL, HFILL}},
12751         {&hf_amqp_method_exchange_delete_ticket, {
12752             "Ticket", "amqp.method.arguments.ticket",
12753              FT_UINT16, BASE_DEC, NULL, 0,
12754             NULL, HFILL}},
12755         {&hf_amqp_method_exchange_delete_exchange, {
12756             "Exchange", "amqp.method.arguments.exchange",
12757             FT_STRING, BASE_NONE, NULL, 0,
12758             NULL, HFILL}},
12759         {&hf_amqp_method_exchange_delete_if_unused, {
12760             "If-Unused", "amqp.method.arguments.if_unused",
12761             FT_BOOLEAN, 8, NULL, 0x01,
12762             NULL, HFILL}},
12763         {&hf_amqp_method_exchange_delete_nowait, {
12764             "Nowait", "amqp.method.arguments.nowait",
12765             FT_BOOLEAN, 8, NULL, 0x02,
12766             NULL, HFILL}},
12767         {&hf_amqp_method_queue_declare_ticket, {
12768             "Ticket", "amqp.method.arguments.ticket",
12769              FT_UINT16, BASE_DEC, NULL, 0,
12770             NULL, HFILL}},
12771         {&hf_amqp_method_queue_declare_queue, {
12772             "Queue", "amqp.method.arguments.queue",
12773             FT_STRING, BASE_NONE, NULL, 0,
12774             NULL, HFILL}},
12775         {&hf_amqp_method_queue_declare_passive, {
12776             "Passive", "amqp.method.arguments.passive",
12777             FT_BOOLEAN, 8, NULL, 0x01,
12778             NULL, HFILL}},
12779         {&hf_amqp_method_queue_declare_durable, {
12780             "Durable", "amqp.method.arguments.durable",
12781             FT_BOOLEAN, 8, NULL, 0x02,
12782             NULL, HFILL}},
12783         {&hf_amqp_method_queue_declare_exclusive, {
12784             "Exclusive", "amqp.method.arguments.exclusive",
12785             FT_BOOLEAN, 8, NULL, 0x04,
12786             NULL, HFILL}},
12787         {&hf_amqp_method_queue_declare_auto_delete, {
12788             "Auto-Delete", "amqp.method.arguments.auto_delete",
12789             FT_BOOLEAN, 8, NULL, 0x08,
12790             NULL, HFILL}},
12791         {&hf_amqp_method_queue_declare_nowait, {
12792             "Nowait", "amqp.method.arguments.nowait",
12793             FT_BOOLEAN, 8, NULL, 0x10,
12794             NULL, HFILL}},
12795         {&hf_amqp_method_queue_declare_arguments, {
12796             "Arguments", "amqp.method.arguments.arguments",
12797             FT_NONE, BASE_NONE, NULL, 0,
12798             NULL, HFILL}},
12799         {&hf_amqp_method_queue_declare_ok_queue, {
12800             "Queue", "amqp.method.arguments.queue",
12801             FT_STRING, BASE_NONE, NULL, 0,
12802             NULL, HFILL}},
12803         {&hf_amqp_method_queue_declare_ok_message_count, {
12804             "Message-Count", "amqp.method.arguments.message_count",
12805             FT_UINT32, BASE_DEC, NULL, 0,
12806             NULL, HFILL}},
12807         {&hf_amqp_method_queue_declare_ok_consumer_count, {
12808             "Consumer-Count", "amqp.method.arguments.consumer_count",
12809             FT_UINT32, BASE_DEC, NULL, 0,
12810             NULL, HFILL}},
12811         {&hf_amqp_method_queue_bind_ticket, {
12812             "Ticket", "amqp.method.arguments.ticket",
12813              FT_UINT16, BASE_DEC, NULL, 0,
12814             NULL, HFILL}},
12815         {&hf_amqp_method_queue_bind_queue, {
12816             "Queue", "amqp.method.arguments.queue",
12817             FT_STRING, BASE_NONE, NULL, 0,
12818             NULL, HFILL}},
12819         {&hf_amqp_method_queue_bind_exchange, {
12820             "Exchange", "amqp.method.arguments.exchange",
12821             FT_STRING, BASE_NONE, NULL, 0,
12822             NULL, HFILL}},
12823         {&hf_amqp_method_queue_bind_routing_key, {
12824             "Routing-Key", "amqp.method.arguments.routing_key",
12825             FT_STRING, BASE_NONE, NULL, 0,
12826             NULL, HFILL}},
12827         {&hf_amqp_method_queue_bind_nowait, {
12828             "Nowait", "amqp.method.arguments.nowait",
12829             FT_BOOLEAN, 8, NULL, 0x01,
12830             NULL, HFILL}},
12831         {&hf_amqp_method_queue_bind_arguments, {
12832             "Arguments", "amqp.method.arguments.arguments",
12833             FT_NONE, BASE_NONE, NULL, 0,
12834             NULL, HFILL}},
12835         {&hf_amqp_method_queue_unbind_ticket, {
12836             "Ticket", "amqp.method.arguments.ticket",
12837              FT_UINT16, BASE_DEC, NULL, 0,
12838             NULL, HFILL}},
12839         {&hf_amqp_method_queue_unbind_queue, {
12840             "Queue", "amqp.method.arguments.queue",
12841             FT_STRING, BASE_NONE, NULL, 0,
12842             NULL, HFILL}},
12843         {&hf_amqp_method_queue_unbind_exchange, {
12844             "Exchange", "amqp.method.arguments.exchange",
12845             FT_STRING, BASE_NONE, NULL, 0,
12846             NULL, HFILL}},
12847         {&hf_amqp_method_queue_unbind_routing_key, {
12848             "Routing-Key", "amqp.method.arguments.routing_key",
12849             FT_STRING, BASE_NONE, NULL, 0,
12850             NULL, HFILL}},
12851         {&hf_amqp_method_queue_unbind_arguments, {
12852             "Arguments", "amqp.method.arguments.arguments",
12853             FT_NONE, BASE_NONE, NULL, 0,
12854             NULL, HFILL}},
12855         {&hf_amqp_method_queue_purge_ticket, {
12856             "Ticket", "amqp.method.arguments.ticket",
12857              FT_UINT16, BASE_DEC, NULL, 0,
12858             NULL, HFILL}},
12859         {&hf_amqp_method_queue_purge_queue, {
12860             "Queue", "amqp.method.arguments.queue",
12861             FT_STRING, BASE_NONE, NULL, 0,
12862             NULL, HFILL}},
12863         {&hf_amqp_method_queue_purge_nowait, {
12864             "Nowait", "amqp.method.arguments.nowait",
12865             FT_BOOLEAN, 8, NULL, 0x01,
12866             NULL, HFILL}},
12867         {&hf_amqp_method_queue_purge_ok_message_count, {
12868             "Message-Count", "amqp.method.arguments.message_count",
12869             FT_UINT32, BASE_DEC, NULL, 0,
12870             NULL, HFILL}},
12871         {&hf_amqp_method_queue_delete_ticket, {
12872             "Ticket", "amqp.method.arguments.ticket",
12873              FT_UINT16, BASE_DEC, NULL, 0,
12874             NULL, HFILL}},
12875         {&hf_amqp_method_queue_delete_queue, {
12876             "Queue", "amqp.method.arguments.queue",
12877             FT_STRING, BASE_NONE, NULL, 0,
12878             NULL, HFILL}},
12879         {&hf_amqp_method_queue_delete_if_unused, {
12880             "If-Unused", "amqp.method.arguments.if_unused",
12881             FT_BOOLEAN, 8, NULL, 0x01,
12882             NULL, HFILL}},
12883         {&hf_amqp_method_queue_delete_if_empty, {
12884             "If-Empty", "amqp.method.arguments.if_empty",
12885             FT_BOOLEAN, 8, NULL, 0x02,
12886             NULL, HFILL}},
12887         {&hf_amqp_method_queue_delete_nowait, {
12888             "Nowait", "amqp.method.arguments.nowait",
12889             FT_BOOLEAN, 8, NULL, 0x04,
12890             NULL, HFILL}},
12891         {&hf_amqp_method_queue_delete_ok_message_count, {
12892             "Message-Count", "amqp.method.arguments.message_count",
12893             FT_UINT32, BASE_DEC, NULL, 0,
12894             NULL, HFILL}},
12895         {&hf_amqp_method_basic_qos_prefetch_size, {
12896             "Prefetch-Size", "amqp.method.arguments.prefetch_size",
12897             FT_UINT32, BASE_DEC, NULL, 0,
12898             NULL, HFILL}},
12899         {&hf_amqp_method_basic_qos_prefetch_count, {
12900             "Prefetch-Count", "amqp.method.arguments.prefetch_count",
12901              FT_UINT16, BASE_DEC, NULL, 0,
12902             NULL, HFILL}},
12903         {&hf_amqp_method_basic_qos_global, {
12904             "Global", "amqp.method.arguments.global",
12905             FT_BOOLEAN, 8, NULL, 0x01,
12906             NULL, HFILL}},
12907         {&hf_amqp_method_basic_consume_ticket, {
12908             "Ticket", "amqp.method.arguments.ticket",
12909              FT_UINT16, BASE_DEC, NULL, 0,
12910             NULL, HFILL}},
12911         {&hf_amqp_method_basic_consume_queue, {
12912             "Queue", "amqp.method.arguments.queue",
12913             FT_STRING, BASE_NONE, NULL, 0,
12914             NULL, HFILL}},
12915         {&hf_amqp_method_basic_consume_consumer_tag, {
12916             "Consumer-Tag", "amqp.method.arguments.consumer_tag",
12917             FT_STRING, BASE_NONE, NULL, 0,
12918             NULL, HFILL}},
12919         {&hf_amqp_method_basic_consume_no_local, {
12920             "No-Local", "amqp.method.arguments.no_local",
12921             FT_BOOLEAN, 8, NULL, 0x01,
12922             NULL, HFILL}},
12923         {&hf_amqp_method_basic_consume_no_ack, {
12924             "No-Ack", "amqp.method.arguments.no_ack",
12925             FT_BOOLEAN, 8, NULL, 0x02,
12926             NULL, HFILL}},
12927         {&hf_amqp_method_basic_consume_exclusive, {
12928             "Exclusive", "amqp.method.arguments.exclusive",
12929             FT_BOOLEAN, 8, NULL, 0x04,
12930             NULL, HFILL}},
12931         {&hf_amqp_method_basic_consume_nowait, {
12932             "Nowait", "amqp.method.arguments.nowait",
12933             FT_BOOLEAN, 8, NULL, 0x08,
12934             NULL, HFILL}},
12935         {&hf_amqp_method_basic_consume_filter, {
12936             "Filter", "amqp.method.arguments.filter",
12937             FT_NONE, BASE_NONE, NULL, 0,
12938             NULL, HFILL}},
12939         {&hf_amqp_method_basic_consume_ok_consumer_tag, {
12940             "Consumer-Tag", "amqp.method.arguments.consumer_tag",
12941             FT_STRING, BASE_NONE, NULL, 0,
12942             NULL, HFILL}},
12943         {&hf_amqp_method_basic_cancel_consumer_tag, {
12944             "Consumer-Tag", "amqp.method.arguments.consumer_tag",
12945             FT_STRING, BASE_NONE, NULL, 0,
12946             NULL, HFILL}},
12947         {&hf_amqp_method_basic_cancel_nowait, {
12948             "Nowait", "amqp.method.arguments.nowait",
12949             FT_BOOLEAN, 8, NULL, 0x01,
12950             NULL, HFILL}},
12951         {&hf_amqp_method_basic_cancel_ok_consumer_tag, {
12952             "Consumer-Tag", "amqp.method.arguments.consumer_tag",
12953             FT_STRING, BASE_NONE, NULL, 0,
12954             NULL, HFILL}},
12955         {&hf_amqp_method_basic_publish_ticket, {
12956             "Ticket", "amqp.method.arguments.ticket",
12957              FT_UINT16, BASE_DEC, NULL, 0,
12958             NULL, HFILL}},
12959         {&hf_amqp_method_basic_publish_exchange, {
12960             "Exchange", "amqp.method.arguments.exchange",
12961             FT_STRING, BASE_NONE, NULL, 0,
12962             NULL, HFILL}},
12963         {&hf_amqp_method_basic_publish_routing_key, {
12964             "Routing-Key", "amqp.method.arguments.routing_key",
12965             FT_STRING, BASE_NONE, NULL, 0,
12966             NULL, HFILL}},
12967         {&hf_amqp_method_basic_publish_mandatory, {
12968             "Mandatory", "amqp.method.arguments.mandatory",
12969             FT_BOOLEAN, 8, NULL, 0x01,
12970             NULL, HFILL}},
12971         {&hf_amqp_method_basic_publish_immediate, {
12972             "Immediate", "amqp.method.arguments.immediate",
12973             FT_BOOLEAN, 8, NULL, 0x02,
12974             NULL, HFILL}},
12975         {&hf_amqp_method_basic_return_reply_code, {
12976             "Reply-Code", "amqp.method.arguments.reply_code",
12977              FT_UINT16, BASE_DEC, NULL, 0,
12978             NULL, HFILL}},
12979         {&hf_amqp_method_basic_return_reply_text, {
12980             "Reply-Text", "amqp.method.arguments.reply_text",
12981             FT_STRING, BASE_NONE, NULL, 0,
12982             NULL, HFILL}},
12983         {&hf_amqp_method_basic_return_exchange, {
12984             "Exchange", "amqp.method.arguments.exchange",
12985             FT_STRING, BASE_NONE, NULL, 0,
12986             NULL, HFILL}},
12987         {&hf_amqp_method_basic_return_routing_key, {
12988             "Routing-Key", "amqp.method.arguments.routing_key",
12989             FT_STRING, BASE_NONE, NULL, 0,
12990             NULL, HFILL}},
12991         {&hf_amqp_method_basic_deliver_consumer_tag, {
12992             "Consumer-Tag", "amqp.method.arguments.consumer_tag",
12993             FT_STRING, BASE_NONE, NULL, 0,
12994             NULL, HFILL}},
12995         {&hf_amqp_method_basic_deliver_delivery_tag, {
12996             "Delivery-Tag", "amqp.method.arguments.delivery_tag",
12997             FT_UINT64, BASE_DEC, NULL, 0,
12998             NULL, HFILL}},
12999         {&hf_amqp_method_basic_deliver_redelivered, {
13000             "Redelivered", "amqp.method.arguments.redelivered",
13001             FT_BOOLEAN, 8, NULL, 0x01,
13002             NULL, HFILL}},
13003         {&hf_amqp_method_basic_deliver_exchange, {
13004             "Exchange", "amqp.method.arguments.exchange",
13005             FT_STRING, BASE_NONE, NULL, 0,
13006             NULL, HFILL}},
13007         {&hf_amqp_method_basic_deliver_routing_key, {
13008             "Routing-Key", "amqp.method.arguments.routing_key",
13009             FT_STRING, BASE_NONE, NULL, 0,
13010             NULL, HFILL}},
13011         {&hf_amqp_method_basic_get_ticket, {
13012             "Ticket", "amqp.method.arguments.ticket",
13013              FT_UINT16, BASE_DEC, NULL, 0,
13014             NULL, HFILL}},
13015         {&hf_amqp_method_basic_get_queue, {
13016             "Queue", "amqp.method.arguments.queue",
13017             FT_STRING, BASE_NONE, NULL, 0,
13018             NULL, HFILL}},
13019         {&hf_amqp_method_basic_get_no_ack, {
13020             "No-Ack", "amqp.method.arguments.no_ack",
13021             FT_BOOLEAN, 8, NULL, 0x01,
13022             NULL, HFILL}},
13023         {&hf_amqp_method_basic_get_ok_delivery_tag, {
13024             "Delivery-Tag", "amqp.method.arguments.delivery_tag",
13025             FT_UINT64, BASE_DEC, NULL, 0,
13026             NULL, HFILL}},
13027         {&hf_amqp_method_basic_get_ok_redelivered, {
13028             "Redelivered", "amqp.method.arguments.redelivered",
13029             FT_BOOLEAN, 8, NULL, 0x01,
13030             NULL, HFILL}},
13031         {&hf_amqp_method_basic_get_ok_exchange, {
13032             "Exchange", "amqp.method.arguments.exchange",
13033             FT_STRING, BASE_NONE, NULL, 0,
13034             NULL, HFILL}},
13035         {&hf_amqp_method_basic_get_ok_routing_key, {
13036             "Routing-Key", "amqp.method.arguments.routing_key",
13037             FT_STRING, BASE_NONE, NULL, 0,
13038             NULL, HFILL}},
13039         {&hf_amqp_method_basic_get_ok_message_count, {
13040             "Message-Count", "amqp.method.arguments.message_count",
13041             FT_UINT32, BASE_DEC, NULL, 0,
13042             NULL, HFILL}},
13043         {&hf_amqp_method_basic_get_empty_cluster_id, {
13044             "Cluster-Id", "amqp.method.arguments.cluster_id",
13045             FT_STRING, BASE_NONE, NULL, 0,
13046             NULL, HFILL}},
13047         {&hf_amqp_method_basic_ack_delivery_tag, {
13048             "Delivery-Tag", "amqp.method.arguments.delivery_tag",
13049             FT_UINT64, BASE_DEC, NULL, 0,
13050             NULL, HFILL}},
13051         {&hf_amqp_method_basic_ack_multiple, {
13052             "Multiple", "amqp.method.arguments.multiple",
13053             FT_BOOLEAN, 8, NULL, 0x01,
13054             NULL, HFILL}},
13055         {&hf_amqp_method_basic_reject_delivery_tag, {
13056             "Delivery-Tag", "amqp.method.arguments.delivery_tag",
13057             FT_UINT64, BASE_DEC, NULL, 0,
13058             NULL, HFILL}},
13059         {&hf_amqp_method_basic_reject_requeue, {
13060             "Requeue", "amqp.method.arguments.requeue",
13061             FT_BOOLEAN, 8, NULL, 0x01,
13062             NULL, HFILL}},
13063         {&hf_amqp_method_basic_recover_requeue, {
13064             "Requeue", "amqp.method.arguments.requeue",
13065             FT_BOOLEAN, 8, NULL, 0x01,
13066             NULL, HFILL}},
13067         {&hf_amqp_method_file_qos_prefetch_size, {
13068             "Prefetch-Size", "amqp.method.arguments.prefetch_size",
13069             FT_UINT32, BASE_DEC, NULL, 0,
13070             NULL, HFILL}},
13071         {&hf_amqp_method_file_qos_prefetch_count, {
13072             "Prefetch-Count", "amqp.method.arguments.prefetch_count",
13073              FT_UINT16, BASE_DEC, NULL, 0,
13074             NULL, HFILL}},
13075         {&hf_amqp_method_file_qos_global, {
13076             "Global", "amqp.method.arguments.global",
13077             FT_BOOLEAN, 8, NULL, 0x01,
13078             NULL, HFILL}},
13079         {&hf_amqp_method_file_consume_ticket, {
13080             "Ticket", "amqp.method.arguments.ticket",
13081              FT_UINT16, BASE_DEC, NULL, 0,
13082             NULL, HFILL}},
13083         {&hf_amqp_method_file_consume_queue, {
13084             "Queue", "amqp.method.arguments.queue",
13085             FT_STRING, BASE_NONE, NULL, 0,
13086             NULL, HFILL}},
13087         {&hf_amqp_method_file_consume_consumer_tag, {
13088             "Consumer-Tag", "amqp.method.arguments.consumer_tag",
13089             FT_STRING, BASE_NONE, NULL, 0,
13090             NULL, HFILL}},
13091         {&hf_amqp_method_file_consume_no_local, {
13092             "No-Local", "amqp.method.arguments.no_local",
13093             FT_BOOLEAN, 8, NULL, 0x01,
13094             NULL, HFILL}},
13095         {&hf_amqp_method_file_consume_no_ack, {
13096             "No-Ack", "amqp.method.arguments.no_ack",
13097             FT_BOOLEAN, 8, NULL, 0x02,
13098             NULL, HFILL}},
13099         {&hf_amqp_method_file_consume_exclusive, {
13100             "Exclusive", "amqp.method.arguments.exclusive",
13101             FT_BOOLEAN, 8, NULL, 0x04,
13102             NULL, HFILL}},
13103         {&hf_amqp_method_file_consume_nowait, {
13104             "Nowait", "amqp.method.arguments.nowait",
13105             FT_BOOLEAN, 8, NULL, 0x08,
13106             NULL, HFILL}},
13107         {&hf_amqp_method_file_consume_filter, {
13108             "Filter", "amqp.method.arguments.filter",
13109             FT_NONE, BASE_NONE, NULL, 0,
13110             NULL, HFILL}},
13111         {&hf_amqp_method_file_consume_ok_consumer_tag, {
13112             "Consumer-Tag", "amqp.method.arguments.consumer_tag",
13113             FT_STRING, BASE_NONE, NULL, 0,
13114             NULL, HFILL}},
13115         {&hf_amqp_method_file_cancel_consumer_tag, {
13116             "Consumer-Tag", "amqp.method.arguments.consumer_tag",
13117             FT_STRING, BASE_NONE, NULL, 0,
13118             NULL, HFILL}},
13119         {&hf_amqp_method_file_cancel_nowait, {
13120             "Nowait", "amqp.method.arguments.nowait",
13121             FT_BOOLEAN, 8, NULL, 0x01,
13122             NULL, HFILL}},
13123         {&hf_amqp_method_file_cancel_ok_consumer_tag, {
13124             "Consumer-Tag", "amqp.method.arguments.consumer_tag",
13125             FT_STRING, BASE_NONE, NULL, 0,
13126             NULL, HFILL}},
13127         {&hf_amqp_method_file_open_identifier, {
13128             "Identifier", "amqp.method.arguments.identifier",
13129             FT_STRING, BASE_NONE, NULL, 0,
13130             NULL, HFILL}},
13131         {&hf_amqp_method_file_open_content_size, {
13132             "Content-Size", "amqp.method.arguments.content_size",
13133             FT_UINT64, BASE_DEC, NULL, 0,
13134             NULL, HFILL}},
13135         {&hf_amqp_method_file_open_ok_staged_size, {
13136             "Staged-Size", "amqp.method.arguments.staged_size",
13137             FT_UINT64, BASE_DEC, NULL, 0,
13138             NULL, HFILL}},
13139         {&hf_amqp_method_file_publish_ticket, {
13140             "Ticket", "amqp.method.arguments.ticket",
13141              FT_UINT16, BASE_DEC, NULL, 0,
13142             NULL, HFILL}},
13143         {&hf_amqp_method_file_publish_exchange, {
13144             "Exchange", "amqp.method.arguments.exchange",
13145             FT_STRING, BASE_NONE, NULL, 0,
13146             NULL, HFILL}},
13147         {&hf_amqp_method_file_publish_routing_key, {
13148             "Routing-Key", "amqp.method.arguments.routing_key",
13149             FT_STRING, BASE_NONE, NULL, 0,
13150             NULL, HFILL}},
13151         {&hf_amqp_method_file_publish_mandatory, {
13152             "Mandatory", "amqp.method.arguments.mandatory",
13153             FT_BOOLEAN, 8, NULL, 0x01,
13154             NULL, HFILL}},
13155         {&hf_amqp_method_file_publish_immediate, {
13156             "Immediate", "amqp.method.arguments.immediate",
13157             FT_BOOLEAN, 8, NULL, 0x02,
13158             NULL, HFILL}},
13159         {&hf_amqp_method_file_publish_identifier, {
13160             "Identifier", "amqp.method.arguments.identifier",
13161             FT_STRING, BASE_NONE, NULL, 0,
13162             NULL, HFILL}},
13163         {&hf_amqp_method_file_return_reply_code, {
13164             "Reply-Code", "amqp.method.arguments.reply_code",
13165              FT_UINT16, BASE_DEC, NULL, 0,
13166             NULL, HFILL}},
13167         {&hf_amqp_method_file_return_reply_text, {
13168             "Reply-Text", "amqp.method.arguments.reply_text",
13169             FT_STRING, BASE_NONE, NULL, 0,
13170             NULL, HFILL}},
13171         {&hf_amqp_method_file_return_exchange, {
13172             "Exchange", "amqp.method.arguments.exchange",
13173             FT_STRING, BASE_NONE, NULL, 0,
13174             NULL, HFILL}},
13175         {&hf_amqp_method_file_return_routing_key, {
13176             "Routing-Key", "amqp.method.arguments.routing_key",
13177             FT_STRING, BASE_NONE, NULL, 0,
13178             NULL, HFILL}},
13179         {&hf_amqp_method_file_deliver_consumer_tag, {
13180             "Consumer-Tag", "amqp.method.arguments.consumer_tag",
13181             FT_STRING, BASE_NONE, NULL, 0,
13182             NULL, HFILL}},
13183         {&hf_amqp_method_file_deliver_delivery_tag, {
13184             "Delivery-Tag", "amqp.method.arguments.delivery_tag",
13185             FT_UINT64, BASE_DEC, NULL, 0,
13186             NULL, HFILL}},
13187         {&hf_amqp_method_file_deliver_redelivered, {
13188             "Redelivered", "amqp.method.arguments.redelivered",
13189             FT_BOOLEAN, 8, NULL, 0x01,
13190             NULL, HFILL}},
13191         {&hf_amqp_method_file_deliver_exchange, {
13192             "Exchange", "amqp.method.arguments.exchange",
13193             FT_STRING, BASE_NONE, NULL, 0,
13194             NULL, HFILL}},
13195         {&hf_amqp_method_file_deliver_routing_key, {
13196             "Routing-Key", "amqp.method.arguments.routing_key",
13197             FT_STRING, BASE_NONE, NULL, 0,
13198             NULL, HFILL}},
13199         {&hf_amqp_method_file_deliver_identifier, {
13200             "Identifier", "amqp.method.arguments.identifier",
13201             FT_STRING, BASE_NONE, NULL, 0,
13202             NULL, HFILL}},
13203         {&hf_amqp_method_file_ack_delivery_tag, {
13204             "Delivery-Tag", "amqp.method.arguments.delivery_tag",
13205             FT_UINT64, BASE_DEC, NULL, 0,
13206             NULL, HFILL}},
13207         {&hf_amqp_method_file_ack_multiple, {
13208             "Multiple", "amqp.method.arguments.multiple",
13209             FT_BOOLEAN, 8, NULL, 0x01,
13210             NULL, HFILL}},
13211         {&hf_amqp_method_file_reject_delivery_tag, {
13212             "Delivery-Tag", "amqp.method.arguments.delivery_tag",
13213             FT_UINT64, BASE_DEC, NULL, 0,
13214             NULL, HFILL}},
13215         {&hf_amqp_method_file_reject_requeue, {
13216             "Requeue", "amqp.method.arguments.requeue",
13217             FT_BOOLEAN, 8, NULL, 0x01,
13218             NULL, HFILL}},
13219         {&hf_amqp_method_stream_qos_prefetch_size, {
13220             "Prefetch-Size", "amqp.method.arguments.prefetch_size",
13221             FT_UINT32, BASE_DEC, NULL, 0,
13222             NULL, HFILL}},
13223         {&hf_amqp_method_stream_qos_prefetch_count, {
13224             "Prefetch-Count", "amqp.method.arguments.prefetch_count",
13225              FT_UINT16, BASE_DEC, NULL, 0,
13226             NULL, HFILL}},
13227         {&hf_amqp_method_stream_qos_consume_rate, {
13228             "Consume-Rate", "amqp.method.arguments.consume_rate",
13229             FT_UINT32, BASE_DEC, NULL, 0,
13230             NULL, HFILL}},
13231         {&hf_amqp_method_stream_qos_global, {
13232             "Global", "amqp.method.arguments.global",
13233             FT_BOOLEAN, 8, NULL, 0x01,
13234             NULL, HFILL}},
13235         {&hf_amqp_method_stream_consume_ticket, {
13236             "Ticket", "amqp.method.arguments.ticket",
13237              FT_UINT16, BASE_DEC, NULL, 0,
13238             NULL, HFILL}},
13239         {&hf_amqp_method_stream_consume_queue, {
13240             "Queue", "amqp.method.arguments.queue",
13241             FT_STRING, BASE_NONE, NULL, 0,
13242             NULL, HFILL}},
13243         {&hf_amqp_method_stream_consume_consumer_tag, {
13244             "Consumer-Tag", "amqp.method.arguments.consumer_tag",
13245             FT_STRING, BASE_NONE, NULL, 0,
13246             NULL, HFILL}},
13247         {&hf_amqp_method_stream_consume_no_local, {
13248             "No-Local", "amqp.method.arguments.no_local",
13249             FT_BOOLEAN, 8, NULL, 0x01,
13250             NULL, HFILL}},
13251         {&hf_amqp_method_stream_consume_exclusive, {
13252             "Exclusive", "amqp.method.arguments.exclusive",
13253             FT_BOOLEAN, 8, NULL, 0x02,
13254             NULL, HFILL}},
13255         {&hf_amqp_method_stream_consume_nowait, {
13256             "Nowait", "amqp.method.arguments.nowait",
13257             FT_BOOLEAN, 8, NULL, 0x04,
13258             NULL, HFILL}},
13259         {&hf_amqp_method_stream_consume_filter, {
13260             "Filter", "amqp.method.arguments.filter",
13261             FT_NONE, BASE_NONE, NULL, 0,
13262             NULL, HFILL}},
13263         {&hf_amqp_method_stream_consume_ok_consumer_tag, {
13264             "Consumer-Tag", "amqp.method.arguments.consumer_tag",
13265             FT_STRING, BASE_NONE, NULL, 0,
13266             NULL, HFILL}},
13267         {&hf_amqp_method_stream_cancel_consumer_tag, {
13268             "Consumer-Tag", "amqp.method.arguments.consumer_tag",
13269             FT_STRING, BASE_NONE, NULL, 0,
13270             NULL, HFILL}},
13271         {&hf_amqp_method_stream_cancel_nowait, {
13272             "Nowait", "amqp.method.arguments.nowait",
13273             FT_BOOLEAN, 8, NULL, 0x01,
13274             NULL, HFILL}},
13275         {&hf_amqp_method_stream_cancel_ok_consumer_tag, {
13276             "Consumer-Tag", "amqp.method.arguments.consumer_tag",
13277             FT_STRING, BASE_NONE, NULL, 0,
13278             NULL, HFILL}},
13279         {&hf_amqp_method_stream_publish_ticket, {
13280             "Ticket", "amqp.method.arguments.ticket",
13281              FT_UINT16, BASE_DEC, NULL, 0,
13282             NULL, HFILL}},
13283         {&hf_amqp_method_stream_publish_exchange, {
13284             "Exchange", "amqp.method.arguments.exchange",
13285             FT_STRING, BASE_NONE, NULL, 0,
13286             NULL, HFILL}},
13287         {&hf_amqp_method_stream_publish_routing_key, {
13288             "Routing-Key", "amqp.method.arguments.routing_key",
13289             FT_STRING, BASE_NONE, NULL, 0,
13290             NULL, HFILL}},
13291         {&hf_amqp_method_stream_publish_mandatory, {
13292             "Mandatory", "amqp.method.arguments.mandatory",
13293             FT_BOOLEAN, 8, NULL, 0x01,
13294             NULL, HFILL}},
13295         {&hf_amqp_method_stream_publish_immediate, {
13296             "Immediate", "amqp.method.arguments.immediate",
13297             FT_BOOLEAN, 8, NULL, 0x02,
13298             NULL, HFILL}},
13299         {&hf_amqp_method_stream_return_reply_code, {
13300             "Reply-Code", "amqp.method.arguments.reply_code",
13301              FT_UINT16, BASE_DEC, NULL, 0,
13302             NULL, HFILL}},
13303         {&hf_amqp_method_stream_return_reply_text, {
13304             "Reply-Text", "amqp.method.arguments.reply_text",
13305             FT_STRING, BASE_NONE, NULL, 0,
13306             NULL, HFILL}},
13307         {&hf_amqp_method_stream_return_exchange, {
13308             "Exchange", "amqp.method.arguments.exchange",
13309             FT_STRING, BASE_NONE, NULL, 0,
13310             NULL, HFILL}},
13311         {&hf_amqp_method_stream_return_routing_key, {
13312             "Routing-Key", "amqp.method.arguments.routing_key",
13313             FT_STRING, BASE_NONE, NULL, 0,
13314             NULL, HFILL}},
13315         {&hf_amqp_method_stream_deliver_consumer_tag, {
13316             "Consumer-Tag", "amqp.method.arguments.consumer_tag",
13317             FT_STRING, BASE_NONE, NULL, 0,
13318             NULL, HFILL}},
13319         {&hf_amqp_method_stream_deliver_delivery_tag, {
13320             "Delivery-Tag", "amqp.method.arguments.delivery_tag",
13321             FT_UINT64, BASE_DEC, NULL, 0,
13322             NULL, HFILL}},
13323         {&hf_amqp_method_stream_deliver_exchange, {
13324             "Exchange", "amqp.method.arguments.exchange",
13325             FT_STRING, BASE_NONE, NULL, 0,
13326             NULL, HFILL}},
13327         {&hf_amqp_method_stream_deliver_queue, {
13328             "Queue", "amqp.method.arguments.queue",
13329             FT_STRING, BASE_NONE, NULL, 0,
13330             NULL, HFILL}},
13331         {&hf_amqp_method_dtx_start_dtx_identifier, {
13332             "Dtx-Identifier", "amqp.method.arguments.dtx_identifier",
13333             FT_STRING, BASE_NONE, NULL, 0,
13334             NULL, HFILL}},
13335         {&hf_amqp_method_tunnel_request_meta_data, {
13336             "Meta-Data", "amqp.method.arguments.meta_data",
13337             FT_NONE, BASE_NONE, NULL, 0,
13338             NULL, HFILL}},
13339         {&hf_amqp_field, {
13340             "AMQP", "amqp.field",
13341             FT_NONE, BASE_NONE, NULL, 0,
13342             NULL, HFILL}},
13343         {&hf_amqp_header_class_id, {
13344             "Class ID", "amqp.header.class",
13345             FT_UINT16, BASE_DEC, VALS(amqp_0_9_method_classes), 0,
13346             NULL, HFILL}},
13347         {&hf_amqp_header_weight, {
13348             "Weight", "amqp.header.weight",
13349             FT_UINT16, BASE_DEC, NULL, 0,
13350             NULL, HFILL}},
13351         {&hf_amqp_header_body_size, {
13352             "Body size", "amqp.header.body-size",
13353             FT_UINT64, BASE_DEC, NULL, 0,
13354             NULL, HFILL}},
13355         {&hf_amqp_header_property_flags, {
13356             "Property flags", "amqp.header.property-flags",
13357             FT_UINT16, BASE_HEX, NULL, 0,
13358             NULL, HFILL}},
13359         {&hf_amqp_header_properties, {
13360             "Properties", "amqp.header.properties",
13361             FT_NONE, BASE_NONE, NULL, 0x0,
13362             "Message properties", HFILL}},
13363         {&hf_amqp_header_basic_content_type, {
13364             "Content-Type", "amqp.method.properties.content_type",
13365             FT_STRING, BASE_NONE, NULL, 0,
13366             NULL, HFILL}},
13367         {&hf_amqp_header_basic_content_encoding, {
13368             "Content-Encoding", "amqp.method.properties.content_encoding",
13369             FT_STRING, BASE_NONE, NULL, 0,
13370             NULL, HFILL}},
13371         {&hf_amqp_header_basic_headers, {
13372             "Headers", "amqp.method.properties.headers",
13373             FT_NONE, BASE_NONE, NULL, 0,
13374             NULL, HFILL}},
13375         {&hf_amqp_header_basic_delivery_mode, {
13376             "Delivery-Mode", "amqp.method.properties.delivery_mode",
13377             FT_UINT8, BASE_DEC, NULL, 0,
13378             NULL, HFILL}},
13379         {&hf_amqp_header_basic_priority, {
13380             "Priority", "amqp.method.properties.priority",
13381             FT_UINT8, BASE_DEC, NULL, 0,
13382             NULL, HFILL}},
13383         {&hf_amqp_header_basic_correlation_id, {
13384             "Correlation-Id", "amqp.method.properties.correlation_id",
13385             FT_STRING, BASE_NONE, NULL, 0,
13386             NULL, HFILL}},
13387         {&hf_amqp_header_basic_reply_to, {
13388             "Reply-To", "amqp.method.properties.reply_to",
13389             FT_STRING, BASE_NONE, NULL, 0,
13390             NULL, HFILL}},
13391         {&hf_amqp_header_basic_expiration, {
13392             "Expiration", "amqp.method.properties.expiration",
13393             FT_STRING, BASE_NONE, NULL, 0,
13394             NULL, HFILL}},
13395         {&hf_amqp_header_basic_message_id, {
13396             "Message-Id", "amqp.method.properties.message_id",
13397             FT_STRING, BASE_NONE, NULL, 0,
13398             NULL, HFILL}},
13399         {&hf_amqp_header_basic_timestamp, {
13400             "Timestamp", "amqp.method.properties.timestamp",
13401             FT_UINT64, BASE_DEC, NULL, 0,
13402             NULL, HFILL}},
13403         {&hf_amqp_header_basic_type, {
13404             "Type", "amqp.method.properties.type",
13405             FT_STRING, BASE_NONE, NULL, 0,
13406             NULL, HFILL}},
13407         {&hf_amqp_header_basic_user_id, {
13408             "User-Id", "amqp.method.properties.user_id",
13409             FT_STRING, BASE_NONE, NULL, 0,
13410             NULL, HFILL}},
13411         {&hf_amqp_header_basic_app_id, {
13412             "App-Id", "amqp.method.properties.app_id",
13413             FT_STRING, BASE_NONE, NULL, 0,
13414             NULL, HFILL}},
13415         {&hf_amqp_header_basic_cluster_id, {
13416             "Cluster-Id", "amqp.method.properties.cluster_id",
13417             FT_STRING, BASE_NONE, NULL, 0,
13418             NULL, HFILL}},
13419         {&hf_amqp_header_file_content_type, {
13420             "Content-Type", "amqp.method.properties.content_type",
13421             FT_STRING, BASE_NONE, NULL, 0,
13422             NULL, HFILL}},
13423         {&hf_amqp_header_file_content_encoding, {
13424             "Content-Encoding", "amqp.method.properties.content_encoding",
13425             FT_STRING, BASE_NONE, NULL, 0,
13426             NULL, HFILL}},
13427         {&hf_amqp_header_file_headers, {
13428             "Headers", "amqp.method.properties.headers",
13429             FT_NONE, BASE_NONE, NULL, 0,
13430             NULL, HFILL}},
13431         {&hf_amqp_header_file_priority, {
13432             "Priority", "amqp.method.properties.priority",
13433             FT_UINT8, BASE_DEC, NULL, 0,
13434             NULL, HFILL}},
13435         {&hf_amqp_header_file_reply_to, {
13436             "Reply-To", "amqp.method.properties.reply_to",
13437             FT_STRING, BASE_NONE, NULL, 0,
13438             NULL, HFILL}},
13439         {&hf_amqp_header_file_message_id, {
13440             "Message-Id", "amqp.method.properties.message_id",
13441             FT_STRING, BASE_NONE, NULL, 0,
13442             NULL, HFILL}},
13443         {&hf_amqp_header_file_filename, {
13444             "Filename", "amqp.method.properties.filename",
13445             FT_STRING, BASE_NONE, NULL, 0,
13446             NULL, HFILL}},
13447         {&hf_amqp_header_file_timestamp, {
13448             "Timestamp", "amqp.method.properties.timestamp",
13449             FT_UINT64, BASE_DEC, NULL, 0,
13450             NULL, HFILL}},
13451         {&hf_amqp_header_file_cluster_id, {
13452             "Cluster-Id", "amqp.method.properties.cluster_id",
13453             FT_STRING, BASE_NONE, NULL, 0,
13454             NULL, HFILL}},
13455         {&hf_amqp_header_stream_content_type, {
13456             "Content-Type", "amqp.method.properties.content_type",
13457             FT_STRING, BASE_NONE, NULL, 0,
13458             NULL, HFILL}},
13459         {&hf_amqp_header_stream_content_encoding, {
13460             "Content-Encoding", "amqp.method.properties.content_encoding",
13461             FT_STRING, BASE_NONE, NULL, 0,
13462             NULL, HFILL}},
13463         {&hf_amqp_header_stream_headers, {
13464             "Headers", "amqp.method.properties.headers",
13465             FT_NONE, BASE_NONE, NULL, 0,
13466             NULL, HFILL}},
13467         {&hf_amqp_header_stream_priority, {
13468             "Priority", "amqp.method.properties.priority",
13469             FT_UINT8, BASE_DEC, NULL, 0,
13470             NULL, HFILL}},
13471         {&hf_amqp_header_stream_timestamp, {
13472             "Timestamp", "amqp.method.properties.timestamp",
13473             FT_UINT64, BASE_DEC, NULL, 0,
13474             NULL, HFILL}},
13475         {&hf_amqp_header_tunnel_headers, {
13476             "Headers", "amqp.method.properties.headers",
13477             FT_NONE, BASE_NONE, NULL, 0,
13478             NULL, HFILL}},
13479         {&hf_amqp_header_tunnel_proxy_name, {
13480             "Proxy-Name", "amqp.method.properties.proxy_name",
13481             FT_STRING, BASE_NONE, NULL, 0,
13482             NULL, HFILL}},
13483         {&hf_amqp_header_tunnel_data_name, {
13484             "Data-Name", "amqp.method.properties.data_name",
13485             FT_STRING, BASE_NONE, NULL, 0,
13486             NULL, HFILL}},
13487         {&hf_amqp_header_tunnel_durable, {
13488             "Durable", "amqp.method.properties.durable",
13489             FT_UINT8, BASE_DEC, NULL, 0,
13490             NULL, HFILL}},
13491         {&hf_amqp_header_tunnel_broadcast, {
13492             "Broadcast", "amqp.method.properties.broadcast",
13493             FT_UINT8, BASE_DEC, NULL, 0,
13494             NULL, HFILL}},
13495         {&hf_amqp_payload, {
13496             "Payload", "amqp.payload",
13497             FT_BYTES, BASE_NONE, NULL, 0,
13498             "Message payload", HFILL}},
13499         {&hf_amqp_init_protocol, {
13500             "Protocol", "amqp.init.protocol",
13501             FT_STRING, BASE_NONE, NULL, 0,
13502             "Protocol name", HFILL}},
13503         {&hf_amqp_init_id_major, {
13504             "Protocol ID Major", "amqp.init.id_major",
13505             FT_UINT8, BASE_DEC, NULL, 0,
13506             NULL, HFILL}},
13507         {&hf_amqp_init_id_minor, {
13508             "Protocol ID Minor", "amqp.init.id_minor",
13509             FT_UINT8, BASE_DEC, NULL, 0,
13510             NULL, HFILL}},
13511         {&hf_amqp_init_id, {
13512             "Protocol-ID", "amqp.init.id",
13513             FT_UINT8, BASE_DEC, NULL, 0,
13514             NULL, HFILL}},
13515         {&hf_amqp_init_version_major, {
13516             "Version Major", "amqp.init.version_major",
13517             FT_UINT8, BASE_DEC, NULL, 0,
13518             "Protocol version major", HFILL}},
13519         {&hf_amqp_init_version_minor, {
13520             "Version Minor", "amqp.init.version_minor",
13521             FT_UINT8, BASE_DEC, NULL, 0,
13522             "Protocol version minor", HFILL}},
13523         {&hf_amqp_init_version_revision, {
13524             "Version-Revision", "amqp.init.version_revision",
13525             FT_UINT8, BASE_DEC, NULL, 0,
13526             "Protocol version revision", HFILL}}
13527     };
13528
13529     /*  Setup of protocol subtree array  */
13530
13531     static gint *ett [] = {
13532          &ett_amqp,
13533          &ett_header,
13534          &ett_args,
13535          &ett_props,
13536          &ett_field_table,
13537          &ett_amqp_init,
13538          &ett_amqp_0_10_map,
13539          &ett_amqp_0_10_array,
13540          &ett_amqp_1_0_array,
13541          &ett_amqp_1_0_map,
13542          &ett_amqp_1_0_list
13543     };
13544
13545     static ei_register_info ei[] = {
13546         { &ei_amqp_bad_flag_value, { "amqp.bad_flag_value", PI_PROTOCOL, PI_WARN, "Bad flag value", EXPFILL }},
13547         { &ei_amqp_bad_length, { "amqp.bad_length", PI_MALFORMED, PI_ERROR, "Bad frame length", EXPFILL }},
13548         { &ei_amqp_field_short, { "amqp.field_short", PI_PROTOCOL, PI_ERROR, "Field is cut off by the end of the field table", EXPFILL }},
13549         { &ei_amqp_invalid_class_code, { "amqp.unknown.class_code", PI_PROTOCOL, PI_WARN, "Invalid class code", EXPFILL }},
13550         { &ei_amqp_unknown_command_class, { "amqp.unknown.command_class", PI_PROTOCOL, PI_ERROR, "Unknown command/control class", EXPFILL }},
13551         { &ei_amqp_unknown_frame_type, { "amqp.unknown.frame_type", PI_PROTOCOL, PI_ERROR, "Unknown frame type", EXPFILL }},
13552         { &ei_amqp_unknown_connection_method, { "amqp.unknown.method.connection", PI_PROTOCOL, PI_ERROR, "Unknown connection method", EXPFILL }},
13553         { &ei_amqp_unknown_channel_method, { "amqp.unknown.method.channel", PI_PROTOCOL, PI_ERROR, "Unknown channel method", EXPFILL }},
13554         { &ei_amqp_unknown_access_method, { "amqp.unknown.method.access", PI_PROTOCOL, PI_ERROR, "Unknown access method", EXPFILL }},
13555         { &ei_amqp_unknown_exchange_method, { "amqp.unknown.method.exchange", PI_PROTOCOL, PI_ERROR, "Unknown exchange method", EXPFILL }},
13556         { &ei_amqp_unknown_queue_method, { "amqp.unknown.method.queue", PI_PROTOCOL, PI_ERROR, "Unknown queue method", EXPFILL }},
13557         { &ei_amqp_unknown_basic_method, { "amqp.unknown.method.basic", PI_PROTOCOL, PI_ERROR, "Unknown basic method", EXPFILL }},
13558         { &ei_amqp_unknown_file_method, { "amqp.unknown.method.file", PI_PROTOCOL, PI_ERROR, "Unknown file method", EXPFILL }},
13559         { &ei_amqp_unknown_stream_method, { "amqp.unknown.method.stream", PI_PROTOCOL, PI_ERROR, "Unknown stream method", EXPFILL }},
13560         { &ei_amqp_unknown_tx_method, { "amqp.unknown.method.tx", PI_PROTOCOL, PI_ERROR, "Unknown tx method", EXPFILL }},
13561         { &ei_amqp_unknown_dtx_method, { "amqp.unknown.method.dtx", PI_PROTOCOL, PI_ERROR, "Unknown dtx method", EXPFILL }},
13562         { &ei_amqp_unknown_tunnel_method, { "amqp.unknown.method.tunnel", PI_PROTOCOL, PI_ERROR, "Unknown tunnel method", EXPFILL }},
13563         { &ei_amqp_unknown_method_class, { "amqp.unknown.method.class", PI_PROTOCOL, PI_ERROR, "Unknown method class", EXPFILL }},
13564         { &ei_amqp_unknown_header_class, { "amqp.unknown.header_class", PI_PROTOCOL, PI_ERROR, "Unknown header class", EXPFILL }},
13565         { &ei_amqp_unknown_sasl_command, { "amqp.unknown.sasl_command", PI_PROTOCOL, PI_ERROR, "Unknown SASL command", EXPFILL }},
13566         { &ei_amqp_unknown_amqp_command, { "amqp.unknown.amqp_command", PI_PROTOCOL, PI_ERROR, "Unknown AMQP command", EXPFILL }},
13567         { &ei_amqp_unknown_amqp_type,  { "amqp.unknown.amqp_type", PI_PROTOCOL, PI_ERROR, "Unknown AMQP type", EXPFILL }},
13568         { &ei_amqp_invalid_number_of_params, { "amqp.invalid.params_number", PI_PROTOCOL, PI_ERROR, "Invalid number of parameters", EXPFILL }},
13569     };
13570
13571     expert_module_t* expert_amqp;
13572
13573     proto_amqp = proto_register_protocol(
13574         "Advanced Message Queueing Protocol", "AMQP", "amqp");
13575     proto_register_field_array(proto_amqp, hf, array_length(hf));
13576     proto_register_subtree_array(ett, array_length(ett));
13577     expert_amqp = expert_register_protocol(proto_amqp);
13578     expert_register_field_array(expert_amqp, ei, array_length(ei));
13579 }
13580
13581 void
13582 proto_reg_handoff_amqp(void)
13583 {
13584     dissector_add_uint("tcp.port", amqp_port,
13585         create_dissector_handle(dissect_amqp, proto_amqp));
13586 }