line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
/* Generated code. Do not edit. Edit and re-run codegen.py instead. |
2
|
|
|
|
|
|
|
* |
3
|
|
|
|
|
|
|
* ***** BEGIN LICENSE BLOCK ***** |
4
|
|
|
|
|
|
|
* Version: MIT |
5
|
|
|
|
|
|
|
* |
6
|
|
|
|
|
|
|
* Portions created by Alan Antonuk are Copyright (c) 2012-2013 |
7
|
|
|
|
|
|
|
* Alan Antonuk. All Rights Reserved. |
8
|
|
|
|
|
|
|
* |
9
|
|
|
|
|
|
|
* Portions created by VMware are Copyright (c) 2007-2012 VMware, Inc. |
10
|
|
|
|
|
|
|
* All Rights Reserved. |
11
|
|
|
|
|
|
|
* |
12
|
|
|
|
|
|
|
* Portions created by Tony Garnock-Jones are Copyright (c) 2009-2010 |
13
|
|
|
|
|
|
|
* VMware, Inc. and Tony Garnock-Jones. All Rights Reserved. |
14
|
|
|
|
|
|
|
* |
15
|
|
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person |
16
|
|
|
|
|
|
|
* obtaining a copy of this software and associated documentation |
17
|
|
|
|
|
|
|
* files (the "Software"), to deal in the Software without |
18
|
|
|
|
|
|
|
* restriction, including without limitation the rights to use, copy, |
19
|
|
|
|
|
|
|
* modify, merge, publish, distribute, sublicense, and/or sell copies |
20
|
|
|
|
|
|
|
* of the Software, and to permit persons to whom the Software is |
21
|
|
|
|
|
|
|
* furnished to do so, subject to the following conditions: |
22
|
|
|
|
|
|
|
* |
23
|
|
|
|
|
|
|
* The above copyright notice and this permission notice shall be |
24
|
|
|
|
|
|
|
* included in all copies or substantial portions of the Software. |
25
|
|
|
|
|
|
|
* |
26
|
|
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
27
|
|
|
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
28
|
|
|
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
29
|
|
|
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
30
|
|
|
|
|
|
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
31
|
|
|
|
|
|
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
32
|
|
|
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
33
|
|
|
|
|
|
|
* SOFTWARE. |
34
|
|
|
|
|
|
|
* ***** END LICENSE BLOCK ***** |
35
|
|
|
|
|
|
|
*/ |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H |
38
|
|
|
|
|
|
|
#include "config.h" |
39
|
|
|
|
|
|
|
#endif |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
#include "amqp_private.h" |
42
|
|
|
|
|
|
|
#include |
43
|
|
|
|
|
|
|
#include |
44
|
|
|
|
|
|
|
#include |
45
|
|
|
|
|
|
|
#include |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
char const *amqp_constant_name(int constantNumber) { |
48
|
0
|
|
|
|
|
|
switch (constantNumber) { |
49
|
|
|
|
|
|
|
case AMQP_FRAME_METHOD: |
50
|
0
|
|
|
|
|
|
return "AMQP_FRAME_METHOD"; |
51
|
|
|
|
|
|
|
case AMQP_FRAME_HEADER: |
52
|
0
|
|
|
|
|
|
return "AMQP_FRAME_HEADER"; |
53
|
|
|
|
|
|
|
case AMQP_FRAME_BODY: |
54
|
0
|
|
|
|
|
|
return "AMQP_FRAME_BODY"; |
55
|
|
|
|
|
|
|
case AMQP_FRAME_HEARTBEAT: |
56
|
0
|
|
|
|
|
|
return "AMQP_FRAME_HEARTBEAT"; |
57
|
|
|
|
|
|
|
case AMQP_FRAME_MIN_SIZE: |
58
|
0
|
|
|
|
|
|
return "AMQP_FRAME_MIN_SIZE"; |
59
|
|
|
|
|
|
|
case AMQP_FRAME_END: |
60
|
0
|
|
|
|
|
|
return "AMQP_FRAME_END"; |
61
|
|
|
|
|
|
|
case AMQP_REPLY_SUCCESS: |
62
|
0
|
|
|
|
|
|
return "AMQP_REPLY_SUCCESS"; |
63
|
|
|
|
|
|
|
case AMQP_CONTENT_TOO_LARGE: |
64
|
0
|
|
|
|
|
|
return "AMQP_CONTENT_TOO_LARGE"; |
65
|
|
|
|
|
|
|
case AMQP_NO_ROUTE: |
66
|
0
|
|
|
|
|
|
return "AMQP_NO_ROUTE"; |
67
|
|
|
|
|
|
|
case AMQP_NO_CONSUMERS: |
68
|
0
|
|
|
|
|
|
return "AMQP_NO_CONSUMERS"; |
69
|
|
|
|
|
|
|
case AMQP_ACCESS_REFUSED: |
70
|
0
|
|
|
|
|
|
return "AMQP_ACCESS_REFUSED"; |
71
|
|
|
|
|
|
|
case AMQP_NOT_FOUND: |
72
|
0
|
|
|
|
|
|
return "AMQP_NOT_FOUND"; |
73
|
|
|
|
|
|
|
case AMQP_RESOURCE_LOCKED: |
74
|
0
|
|
|
|
|
|
return "AMQP_RESOURCE_LOCKED"; |
75
|
|
|
|
|
|
|
case AMQP_PRECONDITION_FAILED: |
76
|
0
|
|
|
|
|
|
return "AMQP_PRECONDITION_FAILED"; |
77
|
|
|
|
|
|
|
case AMQP_CONNECTION_FORCED: |
78
|
0
|
|
|
|
|
|
return "AMQP_CONNECTION_FORCED"; |
79
|
|
|
|
|
|
|
case AMQP_INVALID_PATH: |
80
|
0
|
|
|
|
|
|
return "AMQP_INVALID_PATH"; |
81
|
|
|
|
|
|
|
case AMQP_FRAME_ERROR: |
82
|
0
|
|
|
|
|
|
return "AMQP_FRAME_ERROR"; |
83
|
|
|
|
|
|
|
case AMQP_SYNTAX_ERROR: |
84
|
0
|
|
|
|
|
|
return "AMQP_SYNTAX_ERROR"; |
85
|
|
|
|
|
|
|
case AMQP_COMMAND_INVALID: |
86
|
0
|
|
|
|
|
|
return "AMQP_COMMAND_INVALID"; |
87
|
|
|
|
|
|
|
case AMQP_CHANNEL_ERROR: |
88
|
0
|
|
|
|
|
|
return "AMQP_CHANNEL_ERROR"; |
89
|
|
|
|
|
|
|
case AMQP_UNEXPECTED_FRAME: |
90
|
0
|
|
|
|
|
|
return "AMQP_UNEXPECTED_FRAME"; |
91
|
|
|
|
|
|
|
case AMQP_RESOURCE_ERROR: |
92
|
0
|
|
|
|
|
|
return "AMQP_RESOURCE_ERROR"; |
93
|
|
|
|
|
|
|
case AMQP_NOT_ALLOWED: |
94
|
0
|
|
|
|
|
|
return "AMQP_NOT_ALLOWED"; |
95
|
|
|
|
|
|
|
case AMQP_NOT_IMPLEMENTED: |
96
|
0
|
|
|
|
|
|
return "AMQP_NOT_IMPLEMENTED"; |
97
|
|
|
|
|
|
|
case AMQP_INTERNAL_ERROR: |
98
|
0
|
|
|
|
|
|
return "AMQP_INTERNAL_ERROR"; |
99
|
|
|
|
|
|
|
default: |
100
|
0
|
|
|
|
|
|
return "(unknown)"; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
amqp_boolean_t amqp_constant_is_hard_error(int constantNumber) { |
105
|
0
|
|
|
|
|
|
switch (constantNumber) { |
106
|
|
|
|
|
|
|
case AMQP_CONNECTION_FORCED: |
107
|
0
|
|
|
|
|
|
return 1; |
108
|
|
|
|
|
|
|
case AMQP_INVALID_PATH: |
109
|
0
|
|
|
|
|
|
return 1; |
110
|
|
|
|
|
|
|
case AMQP_FRAME_ERROR: |
111
|
0
|
|
|
|
|
|
return 1; |
112
|
|
|
|
|
|
|
case AMQP_SYNTAX_ERROR: |
113
|
0
|
|
|
|
|
|
return 1; |
114
|
|
|
|
|
|
|
case AMQP_COMMAND_INVALID: |
115
|
0
|
|
|
|
|
|
return 1; |
116
|
|
|
|
|
|
|
case AMQP_CHANNEL_ERROR: |
117
|
0
|
|
|
|
|
|
return 1; |
118
|
|
|
|
|
|
|
case AMQP_UNEXPECTED_FRAME: |
119
|
0
|
|
|
|
|
|
return 1; |
120
|
|
|
|
|
|
|
case AMQP_RESOURCE_ERROR: |
121
|
0
|
|
|
|
|
|
return 1; |
122
|
|
|
|
|
|
|
case AMQP_NOT_ALLOWED: |
123
|
0
|
|
|
|
|
|
return 1; |
124
|
|
|
|
|
|
|
case AMQP_NOT_IMPLEMENTED: |
125
|
0
|
|
|
|
|
|
return 1; |
126
|
|
|
|
|
|
|
case AMQP_INTERNAL_ERROR: |
127
|
0
|
|
|
|
|
|
return 1; |
128
|
|
|
|
|
|
|
default: |
129
|
0
|
|
|
|
|
|
return 0; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
0
|
|
|
|
|
|
char const *amqp_method_name(amqp_method_number_t methodNumber) { |
134
|
0
|
|
|
|
|
|
switch (methodNumber) { |
135
|
|
|
|
|
|
|
case AMQP_CONNECTION_START_METHOD: |
136
|
0
|
|
|
|
|
|
return "AMQP_CONNECTION_START_METHOD"; |
137
|
|
|
|
|
|
|
case AMQP_CONNECTION_START_OK_METHOD: |
138
|
0
|
|
|
|
|
|
return "AMQP_CONNECTION_START_OK_METHOD"; |
139
|
|
|
|
|
|
|
case AMQP_CONNECTION_SECURE_METHOD: |
140
|
0
|
|
|
|
|
|
return "AMQP_CONNECTION_SECURE_METHOD"; |
141
|
|
|
|
|
|
|
case AMQP_CONNECTION_SECURE_OK_METHOD: |
142
|
0
|
|
|
|
|
|
return "AMQP_CONNECTION_SECURE_OK_METHOD"; |
143
|
|
|
|
|
|
|
case AMQP_CONNECTION_TUNE_METHOD: |
144
|
0
|
|
|
|
|
|
return "AMQP_CONNECTION_TUNE_METHOD"; |
145
|
|
|
|
|
|
|
case AMQP_CONNECTION_TUNE_OK_METHOD: |
146
|
0
|
|
|
|
|
|
return "AMQP_CONNECTION_TUNE_OK_METHOD"; |
147
|
|
|
|
|
|
|
case AMQP_CONNECTION_OPEN_METHOD: |
148
|
0
|
|
|
|
|
|
return "AMQP_CONNECTION_OPEN_METHOD"; |
149
|
|
|
|
|
|
|
case AMQP_CONNECTION_OPEN_OK_METHOD: |
150
|
0
|
|
|
|
|
|
return "AMQP_CONNECTION_OPEN_OK_METHOD"; |
151
|
|
|
|
|
|
|
case AMQP_CONNECTION_CLOSE_METHOD: |
152
|
0
|
|
|
|
|
|
return "AMQP_CONNECTION_CLOSE_METHOD"; |
153
|
|
|
|
|
|
|
case AMQP_CONNECTION_CLOSE_OK_METHOD: |
154
|
0
|
|
|
|
|
|
return "AMQP_CONNECTION_CLOSE_OK_METHOD"; |
155
|
|
|
|
|
|
|
case AMQP_CONNECTION_BLOCKED_METHOD: |
156
|
0
|
|
|
|
|
|
return "AMQP_CONNECTION_BLOCKED_METHOD"; |
157
|
|
|
|
|
|
|
case AMQP_CONNECTION_UNBLOCKED_METHOD: |
158
|
0
|
|
|
|
|
|
return "AMQP_CONNECTION_UNBLOCKED_METHOD"; |
159
|
|
|
|
|
|
|
case AMQP_CHANNEL_OPEN_METHOD: |
160
|
0
|
|
|
|
|
|
return "AMQP_CHANNEL_OPEN_METHOD"; |
161
|
|
|
|
|
|
|
case AMQP_CHANNEL_OPEN_OK_METHOD: |
162
|
0
|
|
|
|
|
|
return "AMQP_CHANNEL_OPEN_OK_METHOD"; |
163
|
|
|
|
|
|
|
case AMQP_CHANNEL_FLOW_METHOD: |
164
|
0
|
|
|
|
|
|
return "AMQP_CHANNEL_FLOW_METHOD"; |
165
|
|
|
|
|
|
|
case AMQP_CHANNEL_FLOW_OK_METHOD: |
166
|
0
|
|
|
|
|
|
return "AMQP_CHANNEL_FLOW_OK_METHOD"; |
167
|
|
|
|
|
|
|
case AMQP_CHANNEL_CLOSE_METHOD: |
168
|
0
|
|
|
|
|
|
return "AMQP_CHANNEL_CLOSE_METHOD"; |
169
|
|
|
|
|
|
|
case AMQP_CHANNEL_CLOSE_OK_METHOD: |
170
|
0
|
|
|
|
|
|
return "AMQP_CHANNEL_CLOSE_OK_METHOD"; |
171
|
|
|
|
|
|
|
case AMQP_ACCESS_REQUEST_METHOD: |
172
|
0
|
|
|
|
|
|
return "AMQP_ACCESS_REQUEST_METHOD"; |
173
|
|
|
|
|
|
|
case AMQP_ACCESS_REQUEST_OK_METHOD: |
174
|
0
|
|
|
|
|
|
return "AMQP_ACCESS_REQUEST_OK_METHOD"; |
175
|
|
|
|
|
|
|
case AMQP_EXCHANGE_DECLARE_METHOD: |
176
|
0
|
|
|
|
|
|
return "AMQP_EXCHANGE_DECLARE_METHOD"; |
177
|
|
|
|
|
|
|
case AMQP_EXCHANGE_DECLARE_OK_METHOD: |
178
|
0
|
|
|
|
|
|
return "AMQP_EXCHANGE_DECLARE_OK_METHOD"; |
179
|
|
|
|
|
|
|
case AMQP_EXCHANGE_DELETE_METHOD: |
180
|
0
|
|
|
|
|
|
return "AMQP_EXCHANGE_DELETE_METHOD"; |
181
|
|
|
|
|
|
|
case AMQP_EXCHANGE_DELETE_OK_METHOD: |
182
|
0
|
|
|
|
|
|
return "AMQP_EXCHANGE_DELETE_OK_METHOD"; |
183
|
|
|
|
|
|
|
case AMQP_EXCHANGE_BIND_METHOD: |
184
|
0
|
|
|
|
|
|
return "AMQP_EXCHANGE_BIND_METHOD"; |
185
|
|
|
|
|
|
|
case AMQP_EXCHANGE_BIND_OK_METHOD: |
186
|
0
|
|
|
|
|
|
return "AMQP_EXCHANGE_BIND_OK_METHOD"; |
187
|
|
|
|
|
|
|
case AMQP_EXCHANGE_UNBIND_METHOD: |
188
|
0
|
|
|
|
|
|
return "AMQP_EXCHANGE_UNBIND_METHOD"; |
189
|
|
|
|
|
|
|
case AMQP_EXCHANGE_UNBIND_OK_METHOD: |
190
|
0
|
|
|
|
|
|
return "AMQP_EXCHANGE_UNBIND_OK_METHOD"; |
191
|
|
|
|
|
|
|
case AMQP_QUEUE_DECLARE_METHOD: |
192
|
0
|
|
|
|
|
|
return "AMQP_QUEUE_DECLARE_METHOD"; |
193
|
|
|
|
|
|
|
case AMQP_QUEUE_DECLARE_OK_METHOD: |
194
|
0
|
|
|
|
|
|
return "AMQP_QUEUE_DECLARE_OK_METHOD"; |
195
|
|
|
|
|
|
|
case AMQP_QUEUE_BIND_METHOD: |
196
|
0
|
|
|
|
|
|
return "AMQP_QUEUE_BIND_METHOD"; |
197
|
|
|
|
|
|
|
case AMQP_QUEUE_BIND_OK_METHOD: |
198
|
0
|
|
|
|
|
|
return "AMQP_QUEUE_BIND_OK_METHOD"; |
199
|
|
|
|
|
|
|
case AMQP_QUEUE_PURGE_METHOD: |
200
|
0
|
|
|
|
|
|
return "AMQP_QUEUE_PURGE_METHOD"; |
201
|
|
|
|
|
|
|
case AMQP_QUEUE_PURGE_OK_METHOD: |
202
|
0
|
|
|
|
|
|
return "AMQP_QUEUE_PURGE_OK_METHOD"; |
203
|
|
|
|
|
|
|
case AMQP_QUEUE_DELETE_METHOD: |
204
|
0
|
|
|
|
|
|
return "AMQP_QUEUE_DELETE_METHOD"; |
205
|
|
|
|
|
|
|
case AMQP_QUEUE_DELETE_OK_METHOD: |
206
|
0
|
|
|
|
|
|
return "AMQP_QUEUE_DELETE_OK_METHOD"; |
207
|
|
|
|
|
|
|
case AMQP_QUEUE_UNBIND_METHOD: |
208
|
0
|
|
|
|
|
|
return "AMQP_QUEUE_UNBIND_METHOD"; |
209
|
|
|
|
|
|
|
case AMQP_QUEUE_UNBIND_OK_METHOD: |
210
|
0
|
|
|
|
|
|
return "AMQP_QUEUE_UNBIND_OK_METHOD"; |
211
|
|
|
|
|
|
|
case AMQP_BASIC_QOS_METHOD: |
212
|
0
|
|
|
|
|
|
return "AMQP_BASIC_QOS_METHOD"; |
213
|
|
|
|
|
|
|
case AMQP_BASIC_QOS_OK_METHOD: |
214
|
0
|
|
|
|
|
|
return "AMQP_BASIC_QOS_OK_METHOD"; |
215
|
|
|
|
|
|
|
case AMQP_BASIC_CONSUME_METHOD: |
216
|
0
|
|
|
|
|
|
return "AMQP_BASIC_CONSUME_METHOD"; |
217
|
|
|
|
|
|
|
case AMQP_BASIC_CONSUME_OK_METHOD: |
218
|
0
|
|
|
|
|
|
return "AMQP_BASIC_CONSUME_OK_METHOD"; |
219
|
|
|
|
|
|
|
case AMQP_BASIC_CANCEL_METHOD: |
220
|
0
|
|
|
|
|
|
return "AMQP_BASIC_CANCEL_METHOD"; |
221
|
|
|
|
|
|
|
case AMQP_BASIC_CANCEL_OK_METHOD: |
222
|
0
|
|
|
|
|
|
return "AMQP_BASIC_CANCEL_OK_METHOD"; |
223
|
|
|
|
|
|
|
case AMQP_BASIC_PUBLISH_METHOD: |
224
|
0
|
|
|
|
|
|
return "AMQP_BASIC_PUBLISH_METHOD"; |
225
|
|
|
|
|
|
|
case AMQP_BASIC_RETURN_METHOD: |
226
|
0
|
|
|
|
|
|
return "AMQP_BASIC_RETURN_METHOD"; |
227
|
|
|
|
|
|
|
case AMQP_BASIC_DELIVER_METHOD: |
228
|
0
|
|
|
|
|
|
return "AMQP_BASIC_DELIVER_METHOD"; |
229
|
|
|
|
|
|
|
case AMQP_BASIC_GET_METHOD: |
230
|
0
|
|
|
|
|
|
return "AMQP_BASIC_GET_METHOD"; |
231
|
|
|
|
|
|
|
case AMQP_BASIC_GET_OK_METHOD: |
232
|
0
|
|
|
|
|
|
return "AMQP_BASIC_GET_OK_METHOD"; |
233
|
|
|
|
|
|
|
case AMQP_BASIC_GET_EMPTY_METHOD: |
234
|
0
|
|
|
|
|
|
return "AMQP_BASIC_GET_EMPTY_METHOD"; |
235
|
|
|
|
|
|
|
case AMQP_BASIC_ACK_METHOD: |
236
|
0
|
|
|
|
|
|
return "AMQP_BASIC_ACK_METHOD"; |
237
|
|
|
|
|
|
|
case AMQP_BASIC_REJECT_METHOD: |
238
|
0
|
|
|
|
|
|
return "AMQP_BASIC_REJECT_METHOD"; |
239
|
|
|
|
|
|
|
case AMQP_BASIC_RECOVER_ASYNC_METHOD: |
240
|
0
|
|
|
|
|
|
return "AMQP_BASIC_RECOVER_ASYNC_METHOD"; |
241
|
|
|
|
|
|
|
case AMQP_BASIC_RECOVER_METHOD: |
242
|
0
|
|
|
|
|
|
return "AMQP_BASIC_RECOVER_METHOD"; |
243
|
|
|
|
|
|
|
case AMQP_BASIC_RECOVER_OK_METHOD: |
244
|
0
|
|
|
|
|
|
return "AMQP_BASIC_RECOVER_OK_METHOD"; |
245
|
|
|
|
|
|
|
case AMQP_BASIC_NACK_METHOD: |
246
|
0
|
|
|
|
|
|
return "AMQP_BASIC_NACK_METHOD"; |
247
|
|
|
|
|
|
|
case AMQP_TX_SELECT_METHOD: |
248
|
0
|
|
|
|
|
|
return "AMQP_TX_SELECT_METHOD"; |
249
|
|
|
|
|
|
|
case AMQP_TX_SELECT_OK_METHOD: |
250
|
0
|
|
|
|
|
|
return "AMQP_TX_SELECT_OK_METHOD"; |
251
|
|
|
|
|
|
|
case AMQP_TX_COMMIT_METHOD: |
252
|
0
|
|
|
|
|
|
return "AMQP_TX_COMMIT_METHOD"; |
253
|
|
|
|
|
|
|
case AMQP_TX_COMMIT_OK_METHOD: |
254
|
0
|
|
|
|
|
|
return "AMQP_TX_COMMIT_OK_METHOD"; |
255
|
|
|
|
|
|
|
case AMQP_TX_ROLLBACK_METHOD: |
256
|
0
|
|
|
|
|
|
return "AMQP_TX_ROLLBACK_METHOD"; |
257
|
|
|
|
|
|
|
case AMQP_TX_ROLLBACK_OK_METHOD: |
258
|
0
|
|
|
|
|
|
return "AMQP_TX_ROLLBACK_OK_METHOD"; |
259
|
|
|
|
|
|
|
case AMQP_CONFIRM_SELECT_METHOD: |
260
|
0
|
|
|
|
|
|
return "AMQP_CONFIRM_SELECT_METHOD"; |
261
|
|
|
|
|
|
|
case AMQP_CONFIRM_SELECT_OK_METHOD: |
262
|
0
|
|
|
|
|
|
return "AMQP_CONFIRM_SELECT_OK_METHOD"; |
263
|
|
|
|
|
|
|
default: |
264
|
0
|
|
|
|
|
|
return NULL; |
265
|
|
|
|
|
|
|
} |
266
|
|
|
|
|
|
|
} |
267
|
|
|
|
|
|
|
|
268
|
0
|
|
|
|
|
|
amqp_boolean_t amqp_method_has_content(amqp_method_number_t methodNumber) { |
269
|
0
|
|
|
|
|
|
switch (methodNumber) { |
270
|
|
|
|
|
|
|
case AMQP_BASIC_PUBLISH_METHOD: |
271
|
0
|
|
|
|
|
|
return 1; |
272
|
|
|
|
|
|
|
case AMQP_BASIC_RETURN_METHOD: |
273
|
0
|
|
|
|
|
|
return 1; |
274
|
|
|
|
|
|
|
case AMQP_BASIC_DELIVER_METHOD: |
275
|
0
|
|
|
|
|
|
return 1; |
276
|
|
|
|
|
|
|
case AMQP_BASIC_GET_OK_METHOD: |
277
|
0
|
|
|
|
|
|
return 1; |
278
|
|
|
|
|
|
|
default: |
279
|
0
|
|
|
|
|
|
return 0; |
280
|
|
|
|
|
|
|
} |
281
|
|
|
|
|
|
|
} |
282
|
|
|
|
|
|
|
|
283
|
400
|
|
|
|
|
|
int amqp_decode_method(amqp_method_number_t methodNumber, amqp_pool_t *pool, |
284
|
|
|
|
|
|
|
amqp_bytes_t encoded, void **decoded) { |
285
|
400
|
|
|
|
|
|
size_t offset = 0; |
286
|
|
|
|
|
|
|
uint8_t bit_buffer; |
287
|
|
|
|
|
|
|
|
288
|
400
|
|
|
|
|
|
switch (methodNumber) { |
289
|
|
|
|
|
|
|
case AMQP_CONNECTION_START_METHOD: { |
290
|
38
|
|
|
|
|
|
amqp_connection_start_t *m = (amqp_connection_start_t *)amqp_pool_alloc( |
291
|
|
|
|
|
|
|
pool, sizeof(amqp_connection_start_t)); |
292
|
38
|
50
|
|
|
|
|
if (m == NULL) { |
293
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
294
|
|
|
|
|
|
|
} |
295
|
38
|
50
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &m->version_major)) |
296
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
297
|
38
|
50
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &m->version_minor)) |
298
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
299
|
|
|
|
|
|
|
{ |
300
|
38
|
|
|
|
|
|
int res = |
301
|
38
|
|
|
|
|
|
amqp_decode_table(encoded, pool, &(m->server_properties), &offset); |
302
|
38
|
50
|
|
|
|
|
if (res < 0) return res; |
303
|
|
|
|
|
|
|
} |
304
|
|
|
|
|
|
|
{ |
305
|
|
|
|
|
|
|
uint32_t len; |
306
|
76
|
|
|
|
|
|
if (!amqp_decode_32(encoded, &offset, &len) || |
307
|
38
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->mechanisms, len)) |
308
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
309
|
|
|
|
|
|
|
} |
310
|
|
|
|
|
|
|
{ |
311
|
|
|
|
|
|
|
uint32_t len; |
312
|
76
|
|
|
|
|
|
if (!amqp_decode_32(encoded, &offset, &len) || |
313
|
38
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->locales, len)) |
314
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
315
|
|
|
|
|
|
|
} |
316
|
38
|
|
|
|
|
|
*decoded = m; |
317
|
38
|
|
|
|
|
|
return 0; |
318
|
|
|
|
|
|
|
} |
319
|
|
|
|
|
|
|
case AMQP_CONNECTION_START_OK_METHOD: { |
320
|
0
|
|
|
|
|
|
amqp_connection_start_ok_t *m = |
321
|
|
|
|
|
|
|
(amqp_connection_start_ok_t *)amqp_pool_alloc( |
322
|
|
|
|
|
|
|
pool, sizeof(amqp_connection_start_ok_t)); |
323
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
324
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
325
|
|
|
|
|
|
|
} |
326
|
|
|
|
|
|
|
{ |
327
|
0
|
|
|
|
|
|
int res = |
328
|
0
|
|
|
|
|
|
amqp_decode_table(encoded, pool, &(m->client_properties), &offset); |
329
|
0
|
0
|
|
|
|
|
if (res < 0) return res; |
330
|
|
|
|
|
|
|
} |
331
|
|
|
|
|
|
|
{ |
332
|
|
|
|
|
|
|
uint8_t len; |
333
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
334
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->mechanism, len)) |
335
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
336
|
|
|
|
|
|
|
} |
337
|
|
|
|
|
|
|
{ |
338
|
|
|
|
|
|
|
uint32_t len; |
339
|
0
|
|
|
|
|
|
if (!amqp_decode_32(encoded, &offset, &len) || |
340
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->response, len)) |
341
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
342
|
|
|
|
|
|
|
} |
343
|
|
|
|
|
|
|
{ |
344
|
|
|
|
|
|
|
uint8_t len; |
345
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
346
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->locale, len)) |
347
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
348
|
|
|
|
|
|
|
} |
349
|
0
|
|
|
|
|
|
*decoded = m; |
350
|
0
|
|
|
|
|
|
return 0; |
351
|
|
|
|
|
|
|
} |
352
|
|
|
|
|
|
|
case AMQP_CONNECTION_SECURE_METHOD: { |
353
|
0
|
|
|
|
|
|
amqp_connection_secure_t *m = (amqp_connection_secure_t *)amqp_pool_alloc( |
354
|
|
|
|
|
|
|
pool, sizeof(amqp_connection_secure_t)); |
355
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
356
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
357
|
|
|
|
|
|
|
} |
358
|
|
|
|
|
|
|
{ |
359
|
|
|
|
|
|
|
uint32_t len; |
360
|
0
|
|
|
|
|
|
if (!amqp_decode_32(encoded, &offset, &len) || |
361
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->challenge, len)) |
362
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
363
|
|
|
|
|
|
|
} |
364
|
0
|
|
|
|
|
|
*decoded = m; |
365
|
0
|
|
|
|
|
|
return 0; |
366
|
|
|
|
|
|
|
} |
367
|
|
|
|
|
|
|
case AMQP_CONNECTION_SECURE_OK_METHOD: { |
368
|
0
|
|
|
|
|
|
amqp_connection_secure_ok_t *m = |
369
|
|
|
|
|
|
|
(amqp_connection_secure_ok_t *)amqp_pool_alloc( |
370
|
|
|
|
|
|
|
pool, sizeof(amqp_connection_secure_ok_t)); |
371
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
372
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
373
|
|
|
|
|
|
|
} |
374
|
|
|
|
|
|
|
{ |
375
|
|
|
|
|
|
|
uint32_t len; |
376
|
0
|
|
|
|
|
|
if (!amqp_decode_32(encoded, &offset, &len) || |
377
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->response, len)) |
378
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
379
|
|
|
|
|
|
|
} |
380
|
0
|
|
|
|
|
|
*decoded = m; |
381
|
0
|
|
|
|
|
|
return 0; |
382
|
|
|
|
|
|
|
} |
383
|
|
|
|
|
|
|
case AMQP_CONNECTION_TUNE_METHOD: { |
384
|
38
|
|
|
|
|
|
amqp_connection_tune_t *m = (amqp_connection_tune_t *)amqp_pool_alloc( |
385
|
|
|
|
|
|
|
pool, sizeof(amqp_connection_tune_t)); |
386
|
38
|
50
|
|
|
|
|
if (m == NULL) { |
387
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
388
|
|
|
|
|
|
|
} |
389
|
38
|
50
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->channel_max)) |
390
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
391
|
38
|
50
|
|
|
|
|
if (!amqp_decode_32(encoded, &offset, &m->frame_max)) |
392
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
393
|
38
|
50
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->heartbeat)) |
394
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
395
|
38
|
|
|
|
|
|
*decoded = m; |
396
|
38
|
|
|
|
|
|
return 0; |
397
|
|
|
|
|
|
|
} |
398
|
|
|
|
|
|
|
case AMQP_CONNECTION_TUNE_OK_METHOD: { |
399
|
0
|
|
|
|
|
|
amqp_connection_tune_ok_t *m = |
400
|
|
|
|
|
|
|
(amqp_connection_tune_ok_t *)amqp_pool_alloc( |
401
|
|
|
|
|
|
|
pool, sizeof(amqp_connection_tune_ok_t)); |
402
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
403
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
404
|
|
|
|
|
|
|
} |
405
|
0
|
0
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->channel_max)) |
406
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
407
|
0
|
0
|
|
|
|
|
if (!amqp_decode_32(encoded, &offset, &m->frame_max)) |
408
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
409
|
0
|
0
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->heartbeat)) |
410
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
411
|
0
|
|
|
|
|
|
*decoded = m; |
412
|
0
|
|
|
|
|
|
return 0; |
413
|
|
|
|
|
|
|
} |
414
|
|
|
|
|
|
|
case AMQP_CONNECTION_OPEN_METHOD: { |
415
|
0
|
|
|
|
|
|
amqp_connection_open_t *m = (amqp_connection_open_t *)amqp_pool_alloc( |
416
|
|
|
|
|
|
|
pool, sizeof(amqp_connection_open_t)); |
417
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
418
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
419
|
|
|
|
|
|
|
} |
420
|
|
|
|
|
|
|
{ |
421
|
|
|
|
|
|
|
uint8_t len; |
422
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
423
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->virtual_host, len)) |
424
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
425
|
|
|
|
|
|
|
} |
426
|
|
|
|
|
|
|
{ |
427
|
|
|
|
|
|
|
uint8_t len; |
428
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
429
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->capabilities, len)) |
430
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
431
|
|
|
|
|
|
|
} |
432
|
0
|
0
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
433
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
434
|
0
|
|
|
|
|
|
m->insist = (bit_buffer & (1 << 0)) ? 1 : 0; |
435
|
0
|
|
|
|
|
|
*decoded = m; |
436
|
0
|
|
|
|
|
|
return 0; |
437
|
|
|
|
|
|
|
} |
438
|
|
|
|
|
|
|
case AMQP_CONNECTION_OPEN_OK_METHOD: { |
439
|
38
|
|
|
|
|
|
amqp_connection_open_ok_t *m = |
440
|
|
|
|
|
|
|
(amqp_connection_open_ok_t *)amqp_pool_alloc( |
441
|
|
|
|
|
|
|
pool, sizeof(amqp_connection_open_ok_t)); |
442
|
38
|
50
|
|
|
|
|
if (m == NULL) { |
443
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
444
|
|
|
|
|
|
|
} |
445
|
|
|
|
|
|
|
{ |
446
|
|
|
|
|
|
|
uint8_t len; |
447
|
76
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
448
|
38
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->known_hosts, len)) |
449
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
450
|
|
|
|
|
|
|
} |
451
|
38
|
|
|
|
|
|
*decoded = m; |
452
|
38
|
|
|
|
|
|
return 0; |
453
|
|
|
|
|
|
|
} |
454
|
|
|
|
|
|
|
case AMQP_CONNECTION_CLOSE_METHOD: { |
455
|
0
|
|
|
|
|
|
amqp_connection_close_t *m = (amqp_connection_close_t *)amqp_pool_alloc( |
456
|
|
|
|
|
|
|
pool, sizeof(amqp_connection_close_t)); |
457
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
458
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
459
|
|
|
|
|
|
|
} |
460
|
0
|
0
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->reply_code)) |
461
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
462
|
|
|
|
|
|
|
{ |
463
|
|
|
|
|
|
|
uint8_t len; |
464
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
465
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->reply_text, len)) |
466
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
467
|
|
|
|
|
|
|
} |
468
|
0
|
0
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->class_id)) |
469
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
470
|
0
|
0
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->method_id)) |
471
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
472
|
0
|
|
|
|
|
|
*decoded = m; |
473
|
0
|
|
|
|
|
|
return 0; |
474
|
|
|
|
|
|
|
} |
475
|
|
|
|
|
|
|
case AMQP_CONNECTION_CLOSE_OK_METHOD: { |
476
|
30
|
|
|
|
|
|
amqp_connection_close_ok_t *m = |
477
|
|
|
|
|
|
|
(amqp_connection_close_ok_t *)amqp_pool_alloc( |
478
|
|
|
|
|
|
|
pool, sizeof(amqp_connection_close_ok_t)); |
479
|
30
|
50
|
|
|
|
|
if (m == NULL) { |
480
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
481
|
|
|
|
|
|
|
} |
482
|
30
|
|
|
|
|
|
*decoded = m; |
483
|
30
|
|
|
|
|
|
return 0; |
484
|
|
|
|
|
|
|
} |
485
|
|
|
|
|
|
|
case AMQP_CONNECTION_BLOCKED_METHOD: { |
486
|
0
|
|
|
|
|
|
amqp_connection_blocked_t *m = |
487
|
|
|
|
|
|
|
(amqp_connection_blocked_t *)amqp_pool_alloc( |
488
|
|
|
|
|
|
|
pool, sizeof(amqp_connection_blocked_t)); |
489
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
490
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
491
|
|
|
|
|
|
|
} |
492
|
|
|
|
|
|
|
{ |
493
|
|
|
|
|
|
|
uint8_t len; |
494
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
495
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->reason, len)) |
496
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
497
|
|
|
|
|
|
|
} |
498
|
0
|
|
|
|
|
|
*decoded = m; |
499
|
0
|
|
|
|
|
|
return 0; |
500
|
|
|
|
|
|
|
} |
501
|
|
|
|
|
|
|
case AMQP_CONNECTION_UNBLOCKED_METHOD: { |
502
|
0
|
|
|
|
|
|
amqp_connection_unblocked_t *m = |
503
|
|
|
|
|
|
|
(amqp_connection_unblocked_t *)amqp_pool_alloc( |
504
|
|
|
|
|
|
|
pool, sizeof(amqp_connection_unblocked_t)); |
505
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
506
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
507
|
|
|
|
|
|
|
} |
508
|
0
|
|
|
|
|
|
*decoded = m; |
509
|
0
|
|
|
|
|
|
return 0; |
510
|
|
|
|
|
|
|
} |
511
|
|
|
|
|
|
|
case AMQP_CHANNEL_OPEN_METHOD: { |
512
|
0
|
|
|
|
|
|
amqp_channel_open_t *m = (amqp_channel_open_t *)amqp_pool_alloc( |
513
|
|
|
|
|
|
|
pool, sizeof(amqp_channel_open_t)); |
514
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
515
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
516
|
|
|
|
|
|
|
} |
517
|
|
|
|
|
|
|
{ |
518
|
|
|
|
|
|
|
uint8_t len; |
519
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
520
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->out_of_band, len)) |
521
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
522
|
|
|
|
|
|
|
} |
523
|
0
|
|
|
|
|
|
*decoded = m; |
524
|
0
|
|
|
|
|
|
return 0; |
525
|
|
|
|
|
|
|
} |
526
|
|
|
|
|
|
|
case AMQP_CHANNEL_OPEN_OK_METHOD: { |
527
|
36
|
|
|
|
|
|
amqp_channel_open_ok_t *m = (amqp_channel_open_ok_t *)amqp_pool_alloc( |
528
|
|
|
|
|
|
|
pool, sizeof(amqp_channel_open_ok_t)); |
529
|
36
|
50
|
|
|
|
|
if (m == NULL) { |
530
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
531
|
|
|
|
|
|
|
} |
532
|
|
|
|
|
|
|
{ |
533
|
|
|
|
|
|
|
uint32_t len; |
534
|
72
|
|
|
|
|
|
if (!amqp_decode_32(encoded, &offset, &len) || |
535
|
36
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->channel_id, len)) |
536
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
537
|
|
|
|
|
|
|
} |
538
|
36
|
|
|
|
|
|
*decoded = m; |
539
|
36
|
|
|
|
|
|
return 0; |
540
|
|
|
|
|
|
|
} |
541
|
|
|
|
|
|
|
case AMQP_CHANNEL_FLOW_METHOD: { |
542
|
0
|
|
|
|
|
|
amqp_channel_flow_t *m = (amqp_channel_flow_t *)amqp_pool_alloc( |
543
|
|
|
|
|
|
|
pool, sizeof(amqp_channel_flow_t)); |
544
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
545
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
546
|
|
|
|
|
|
|
} |
547
|
0
|
0
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
548
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
549
|
0
|
|
|
|
|
|
m->active = (bit_buffer & (1 << 0)) ? 1 : 0; |
550
|
0
|
|
|
|
|
|
*decoded = m; |
551
|
0
|
|
|
|
|
|
return 0; |
552
|
|
|
|
|
|
|
} |
553
|
|
|
|
|
|
|
case AMQP_CHANNEL_FLOW_OK_METHOD: { |
554
|
0
|
|
|
|
|
|
amqp_channel_flow_ok_t *m = (amqp_channel_flow_ok_t *)amqp_pool_alloc( |
555
|
|
|
|
|
|
|
pool, sizeof(amqp_channel_flow_ok_t)); |
556
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
557
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
558
|
|
|
|
|
|
|
} |
559
|
0
|
0
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
560
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
561
|
0
|
|
|
|
|
|
m->active = (bit_buffer & (1 << 0)) ? 1 : 0; |
562
|
0
|
|
|
|
|
|
*decoded = m; |
563
|
0
|
|
|
|
|
|
return 0; |
564
|
|
|
|
|
|
|
} |
565
|
|
|
|
|
|
|
case AMQP_CHANNEL_CLOSE_METHOD: { |
566
|
5
|
|
|
|
|
|
amqp_channel_close_t *m = (amqp_channel_close_t *)amqp_pool_alloc( |
567
|
|
|
|
|
|
|
pool, sizeof(amqp_channel_close_t)); |
568
|
5
|
50
|
|
|
|
|
if (m == NULL) { |
569
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
570
|
|
|
|
|
|
|
} |
571
|
5
|
50
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->reply_code)) |
572
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
573
|
|
|
|
|
|
|
{ |
574
|
|
|
|
|
|
|
uint8_t len; |
575
|
10
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
576
|
5
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->reply_text, len)) |
577
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
578
|
|
|
|
|
|
|
} |
579
|
5
|
50
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->class_id)) |
580
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
581
|
5
|
50
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->method_id)) |
582
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
583
|
5
|
|
|
|
|
|
*decoded = m; |
584
|
5
|
|
|
|
|
|
return 0; |
585
|
|
|
|
|
|
|
} |
586
|
|
|
|
|
|
|
case AMQP_CHANNEL_CLOSE_OK_METHOD: { |
587
|
1
|
|
|
|
|
|
amqp_channel_close_ok_t *m = (amqp_channel_close_ok_t *)amqp_pool_alloc( |
588
|
|
|
|
|
|
|
pool, sizeof(amqp_channel_close_ok_t)); |
589
|
1
|
50
|
|
|
|
|
if (m == NULL) { |
590
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
591
|
|
|
|
|
|
|
} |
592
|
1
|
|
|
|
|
|
*decoded = m; |
593
|
1
|
|
|
|
|
|
return 0; |
594
|
|
|
|
|
|
|
} |
595
|
|
|
|
|
|
|
case AMQP_ACCESS_REQUEST_METHOD: { |
596
|
0
|
|
|
|
|
|
amqp_access_request_t *m = (amqp_access_request_t *)amqp_pool_alloc( |
597
|
|
|
|
|
|
|
pool, sizeof(amqp_access_request_t)); |
598
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
599
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
600
|
|
|
|
|
|
|
} |
601
|
|
|
|
|
|
|
{ |
602
|
|
|
|
|
|
|
uint8_t len; |
603
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
604
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->realm, len)) |
605
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
606
|
|
|
|
|
|
|
} |
607
|
0
|
0
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
608
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
609
|
0
|
|
|
|
|
|
m->exclusive = (bit_buffer & (1 << 0)) ? 1 : 0; |
610
|
0
|
|
|
|
|
|
m->passive = (bit_buffer & (1 << 1)) ? 1 : 0; |
611
|
0
|
|
|
|
|
|
m->active = (bit_buffer & (1 << 2)) ? 1 : 0; |
612
|
0
|
|
|
|
|
|
m->write = (bit_buffer & (1 << 3)) ? 1 : 0; |
613
|
0
|
|
|
|
|
|
m->read = (bit_buffer & (1 << 4)) ? 1 : 0; |
614
|
0
|
|
|
|
|
|
*decoded = m; |
615
|
0
|
|
|
|
|
|
return 0; |
616
|
|
|
|
|
|
|
} |
617
|
|
|
|
|
|
|
case AMQP_ACCESS_REQUEST_OK_METHOD: { |
618
|
0
|
|
|
|
|
|
amqp_access_request_ok_t *m = (amqp_access_request_ok_t *)amqp_pool_alloc( |
619
|
|
|
|
|
|
|
pool, sizeof(amqp_access_request_ok_t)); |
620
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
621
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
622
|
|
|
|
|
|
|
} |
623
|
0
|
0
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->ticket)) |
624
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
625
|
0
|
|
|
|
|
|
*decoded = m; |
626
|
0
|
|
|
|
|
|
return 0; |
627
|
|
|
|
|
|
|
} |
628
|
|
|
|
|
|
|
case AMQP_EXCHANGE_DECLARE_METHOD: { |
629
|
0
|
|
|
|
|
|
amqp_exchange_declare_t *m = (amqp_exchange_declare_t *)amqp_pool_alloc( |
630
|
|
|
|
|
|
|
pool, sizeof(amqp_exchange_declare_t)); |
631
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
632
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
633
|
|
|
|
|
|
|
} |
634
|
0
|
0
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->ticket)) |
635
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
636
|
|
|
|
|
|
|
{ |
637
|
|
|
|
|
|
|
uint8_t len; |
638
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
639
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->exchange, len)) |
640
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
641
|
|
|
|
|
|
|
} |
642
|
|
|
|
|
|
|
{ |
643
|
|
|
|
|
|
|
uint8_t len; |
644
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
645
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->type, len)) |
646
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
647
|
|
|
|
|
|
|
} |
648
|
0
|
0
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
649
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
650
|
0
|
|
|
|
|
|
m->passive = (bit_buffer & (1 << 0)) ? 1 : 0; |
651
|
0
|
|
|
|
|
|
m->durable = (bit_buffer & (1 << 1)) ? 1 : 0; |
652
|
0
|
|
|
|
|
|
m->auto_delete = (bit_buffer & (1 << 2)) ? 1 : 0; |
653
|
0
|
|
|
|
|
|
m->internal = (bit_buffer & (1 << 3)) ? 1 : 0; |
654
|
0
|
|
|
|
|
|
m->nowait = (bit_buffer & (1 << 4)) ? 1 : 0; |
655
|
|
|
|
|
|
|
{ |
656
|
0
|
|
|
|
|
|
int res = amqp_decode_table(encoded, pool, &(m->arguments), &offset); |
657
|
0
|
0
|
|
|
|
|
if (res < 0) return res; |
658
|
|
|
|
|
|
|
} |
659
|
0
|
|
|
|
|
|
*decoded = m; |
660
|
0
|
|
|
|
|
|
return 0; |
661
|
|
|
|
|
|
|
} |
662
|
|
|
|
|
|
|
case AMQP_EXCHANGE_DECLARE_OK_METHOD: { |
663
|
26
|
|
|
|
|
|
amqp_exchange_declare_ok_t *m = |
664
|
|
|
|
|
|
|
(amqp_exchange_declare_ok_t *)amqp_pool_alloc( |
665
|
|
|
|
|
|
|
pool, sizeof(amqp_exchange_declare_ok_t)); |
666
|
26
|
50
|
|
|
|
|
if (m == NULL) { |
667
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
668
|
|
|
|
|
|
|
} |
669
|
26
|
|
|
|
|
|
*decoded = m; |
670
|
26
|
|
|
|
|
|
return 0; |
671
|
|
|
|
|
|
|
} |
672
|
|
|
|
|
|
|
case AMQP_EXCHANGE_DELETE_METHOD: { |
673
|
0
|
|
|
|
|
|
amqp_exchange_delete_t *m = (amqp_exchange_delete_t *)amqp_pool_alloc( |
674
|
|
|
|
|
|
|
pool, sizeof(amqp_exchange_delete_t)); |
675
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
676
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
677
|
|
|
|
|
|
|
} |
678
|
0
|
0
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->ticket)) |
679
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
680
|
|
|
|
|
|
|
{ |
681
|
|
|
|
|
|
|
uint8_t len; |
682
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
683
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->exchange, len)) |
684
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
685
|
|
|
|
|
|
|
} |
686
|
0
|
0
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
687
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
688
|
0
|
|
|
|
|
|
m->if_unused = (bit_buffer & (1 << 0)) ? 1 : 0; |
689
|
0
|
|
|
|
|
|
m->nowait = (bit_buffer & (1 << 1)) ? 1 : 0; |
690
|
0
|
|
|
|
|
|
*decoded = m; |
691
|
0
|
|
|
|
|
|
return 0; |
692
|
|
|
|
|
|
|
} |
693
|
|
|
|
|
|
|
case AMQP_EXCHANGE_DELETE_OK_METHOD: { |
694
|
27
|
|
|
|
|
|
amqp_exchange_delete_ok_t *m = |
695
|
|
|
|
|
|
|
(amqp_exchange_delete_ok_t *)amqp_pool_alloc( |
696
|
|
|
|
|
|
|
pool, sizeof(amqp_exchange_delete_ok_t)); |
697
|
27
|
50
|
|
|
|
|
if (m == NULL) { |
698
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
699
|
|
|
|
|
|
|
} |
700
|
27
|
|
|
|
|
|
*decoded = m; |
701
|
27
|
|
|
|
|
|
return 0; |
702
|
|
|
|
|
|
|
} |
703
|
|
|
|
|
|
|
case AMQP_EXCHANGE_BIND_METHOD: { |
704
|
0
|
|
|
|
|
|
amqp_exchange_bind_t *m = (amqp_exchange_bind_t *)amqp_pool_alloc( |
705
|
|
|
|
|
|
|
pool, sizeof(amqp_exchange_bind_t)); |
706
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
707
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
708
|
|
|
|
|
|
|
} |
709
|
0
|
0
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->ticket)) |
710
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
711
|
|
|
|
|
|
|
{ |
712
|
|
|
|
|
|
|
uint8_t len; |
713
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
714
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->destination, len)) |
715
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
716
|
|
|
|
|
|
|
} |
717
|
|
|
|
|
|
|
{ |
718
|
|
|
|
|
|
|
uint8_t len; |
719
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
720
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->source, len)) |
721
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
722
|
|
|
|
|
|
|
} |
723
|
|
|
|
|
|
|
{ |
724
|
|
|
|
|
|
|
uint8_t len; |
725
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
726
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->routing_key, len)) |
727
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
728
|
|
|
|
|
|
|
} |
729
|
0
|
0
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
730
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
731
|
0
|
|
|
|
|
|
m->nowait = (bit_buffer & (1 << 0)) ? 1 : 0; |
732
|
|
|
|
|
|
|
{ |
733
|
0
|
|
|
|
|
|
int res = amqp_decode_table(encoded, pool, &(m->arguments), &offset); |
734
|
0
|
0
|
|
|
|
|
if (res < 0) return res; |
735
|
|
|
|
|
|
|
} |
736
|
0
|
|
|
|
|
|
*decoded = m; |
737
|
0
|
|
|
|
|
|
return 0; |
738
|
|
|
|
|
|
|
} |
739
|
|
|
|
|
|
|
case AMQP_EXCHANGE_BIND_OK_METHOD: { |
740
|
1
|
|
|
|
|
|
amqp_exchange_bind_ok_t *m = (amqp_exchange_bind_ok_t *)amqp_pool_alloc( |
741
|
|
|
|
|
|
|
pool, sizeof(amqp_exchange_bind_ok_t)); |
742
|
1
|
50
|
|
|
|
|
if (m == NULL) { |
743
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
744
|
|
|
|
|
|
|
} |
745
|
1
|
|
|
|
|
|
*decoded = m; |
746
|
1
|
|
|
|
|
|
return 0; |
747
|
|
|
|
|
|
|
} |
748
|
|
|
|
|
|
|
case AMQP_EXCHANGE_UNBIND_METHOD: { |
749
|
0
|
|
|
|
|
|
amqp_exchange_unbind_t *m = (amqp_exchange_unbind_t *)amqp_pool_alloc( |
750
|
|
|
|
|
|
|
pool, sizeof(amqp_exchange_unbind_t)); |
751
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
752
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
753
|
|
|
|
|
|
|
} |
754
|
0
|
0
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->ticket)) |
755
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
756
|
|
|
|
|
|
|
{ |
757
|
|
|
|
|
|
|
uint8_t len; |
758
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
759
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->destination, len)) |
760
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
761
|
|
|
|
|
|
|
} |
762
|
|
|
|
|
|
|
{ |
763
|
|
|
|
|
|
|
uint8_t len; |
764
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
765
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->source, len)) |
766
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
767
|
|
|
|
|
|
|
} |
768
|
|
|
|
|
|
|
{ |
769
|
|
|
|
|
|
|
uint8_t len; |
770
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
771
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->routing_key, len)) |
772
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
773
|
|
|
|
|
|
|
} |
774
|
0
|
0
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
775
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
776
|
0
|
|
|
|
|
|
m->nowait = (bit_buffer & (1 << 0)) ? 1 : 0; |
777
|
|
|
|
|
|
|
{ |
778
|
0
|
|
|
|
|
|
int res = amqp_decode_table(encoded, pool, &(m->arguments), &offset); |
779
|
0
|
0
|
|
|
|
|
if (res < 0) return res; |
780
|
|
|
|
|
|
|
} |
781
|
0
|
|
|
|
|
|
*decoded = m; |
782
|
0
|
|
|
|
|
|
return 0; |
783
|
|
|
|
|
|
|
} |
784
|
|
|
|
|
|
|
case AMQP_EXCHANGE_UNBIND_OK_METHOD: { |
785
|
1
|
|
|
|
|
|
amqp_exchange_unbind_ok_t *m = |
786
|
|
|
|
|
|
|
(amqp_exchange_unbind_ok_t *)amqp_pool_alloc( |
787
|
|
|
|
|
|
|
pool, sizeof(amqp_exchange_unbind_ok_t)); |
788
|
1
|
50
|
|
|
|
|
if (m == NULL) { |
789
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
790
|
|
|
|
|
|
|
} |
791
|
1
|
|
|
|
|
|
*decoded = m; |
792
|
1
|
|
|
|
|
|
return 0; |
793
|
|
|
|
|
|
|
} |
794
|
|
|
|
|
|
|
case AMQP_QUEUE_DECLARE_METHOD: { |
795
|
0
|
|
|
|
|
|
amqp_queue_declare_t *m = (amqp_queue_declare_t *)amqp_pool_alloc( |
796
|
|
|
|
|
|
|
pool, sizeof(amqp_queue_declare_t)); |
797
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
798
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
799
|
|
|
|
|
|
|
} |
800
|
0
|
0
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->ticket)) |
801
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
802
|
|
|
|
|
|
|
{ |
803
|
|
|
|
|
|
|
uint8_t len; |
804
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
805
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->queue, len)) |
806
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
807
|
|
|
|
|
|
|
} |
808
|
0
|
0
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
809
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
810
|
0
|
|
|
|
|
|
m->passive = (bit_buffer & (1 << 0)) ? 1 : 0; |
811
|
0
|
|
|
|
|
|
m->durable = (bit_buffer & (1 << 1)) ? 1 : 0; |
812
|
0
|
|
|
|
|
|
m->exclusive = (bit_buffer & (1 << 2)) ? 1 : 0; |
813
|
0
|
|
|
|
|
|
m->auto_delete = (bit_buffer & (1 << 3)) ? 1 : 0; |
814
|
0
|
|
|
|
|
|
m->nowait = (bit_buffer & (1 << 4)) ? 1 : 0; |
815
|
|
|
|
|
|
|
{ |
816
|
0
|
|
|
|
|
|
int res = amqp_decode_table(encoded, pool, &(m->arguments), &offset); |
817
|
0
|
0
|
|
|
|
|
if (res < 0) return res; |
818
|
|
|
|
|
|
|
} |
819
|
0
|
|
|
|
|
|
*decoded = m; |
820
|
0
|
|
|
|
|
|
return 0; |
821
|
|
|
|
|
|
|
} |
822
|
|
|
|
|
|
|
case AMQP_QUEUE_DECLARE_OK_METHOD: { |
823
|
19
|
|
|
|
|
|
amqp_queue_declare_ok_t *m = (amqp_queue_declare_ok_t *)amqp_pool_alloc( |
824
|
|
|
|
|
|
|
pool, sizeof(amqp_queue_declare_ok_t)); |
825
|
19
|
50
|
|
|
|
|
if (m == NULL) { |
826
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
827
|
|
|
|
|
|
|
} |
828
|
|
|
|
|
|
|
{ |
829
|
|
|
|
|
|
|
uint8_t len; |
830
|
38
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
831
|
19
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->queue, len)) |
832
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
833
|
|
|
|
|
|
|
} |
834
|
19
|
50
|
|
|
|
|
if (!amqp_decode_32(encoded, &offset, &m->message_count)) |
835
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
836
|
19
|
50
|
|
|
|
|
if (!amqp_decode_32(encoded, &offset, &m->consumer_count)) |
837
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
838
|
19
|
|
|
|
|
|
*decoded = m; |
839
|
19
|
|
|
|
|
|
return 0; |
840
|
|
|
|
|
|
|
} |
841
|
|
|
|
|
|
|
case AMQP_QUEUE_BIND_METHOD: { |
842
|
0
|
|
|
|
|
|
amqp_queue_bind_t *m = |
843
|
|
|
|
|
|
|
(amqp_queue_bind_t *)amqp_pool_alloc(pool, sizeof(amqp_queue_bind_t)); |
844
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
845
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
846
|
|
|
|
|
|
|
} |
847
|
0
|
0
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->ticket)) |
848
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
849
|
|
|
|
|
|
|
{ |
850
|
|
|
|
|
|
|
uint8_t len; |
851
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
852
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->queue, len)) |
853
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
854
|
|
|
|
|
|
|
} |
855
|
|
|
|
|
|
|
{ |
856
|
|
|
|
|
|
|
uint8_t len; |
857
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
858
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->exchange, len)) |
859
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
860
|
|
|
|
|
|
|
} |
861
|
|
|
|
|
|
|
{ |
862
|
|
|
|
|
|
|
uint8_t len; |
863
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
864
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->routing_key, len)) |
865
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
866
|
|
|
|
|
|
|
} |
867
|
0
|
0
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
868
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
869
|
0
|
|
|
|
|
|
m->nowait = (bit_buffer & (1 << 0)) ? 1 : 0; |
870
|
|
|
|
|
|
|
{ |
871
|
0
|
|
|
|
|
|
int res = amqp_decode_table(encoded, pool, &(m->arguments), &offset); |
872
|
0
|
0
|
|
|
|
|
if (res < 0) return res; |
873
|
|
|
|
|
|
|
} |
874
|
0
|
|
|
|
|
|
*decoded = m; |
875
|
0
|
|
|
|
|
|
return 0; |
876
|
|
|
|
|
|
|
} |
877
|
|
|
|
|
|
|
case AMQP_QUEUE_BIND_OK_METHOD: { |
878
|
17
|
|
|
|
|
|
amqp_queue_bind_ok_t *m = (amqp_queue_bind_ok_t *)amqp_pool_alloc( |
879
|
|
|
|
|
|
|
pool, sizeof(amqp_queue_bind_ok_t)); |
880
|
17
|
50
|
|
|
|
|
if (m == NULL) { |
881
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
882
|
|
|
|
|
|
|
} |
883
|
17
|
|
|
|
|
|
*decoded = m; |
884
|
17
|
|
|
|
|
|
return 0; |
885
|
|
|
|
|
|
|
} |
886
|
|
|
|
|
|
|
case AMQP_QUEUE_PURGE_METHOD: { |
887
|
0
|
|
|
|
|
|
amqp_queue_purge_t *m = (amqp_queue_purge_t *)amqp_pool_alloc( |
888
|
|
|
|
|
|
|
pool, sizeof(amqp_queue_purge_t)); |
889
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
890
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
891
|
|
|
|
|
|
|
} |
892
|
0
|
0
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->ticket)) |
893
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
894
|
|
|
|
|
|
|
{ |
895
|
|
|
|
|
|
|
uint8_t len; |
896
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
897
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->queue, len)) |
898
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
899
|
|
|
|
|
|
|
} |
900
|
0
|
0
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
901
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
902
|
0
|
|
|
|
|
|
m->nowait = (bit_buffer & (1 << 0)) ? 1 : 0; |
903
|
0
|
|
|
|
|
|
*decoded = m; |
904
|
0
|
|
|
|
|
|
return 0; |
905
|
|
|
|
|
|
|
} |
906
|
|
|
|
|
|
|
case AMQP_QUEUE_PURGE_OK_METHOD: { |
907
|
18
|
|
|
|
|
|
amqp_queue_purge_ok_t *m = (amqp_queue_purge_ok_t *)amqp_pool_alloc( |
908
|
|
|
|
|
|
|
pool, sizeof(amqp_queue_purge_ok_t)); |
909
|
18
|
50
|
|
|
|
|
if (m == NULL) { |
910
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
911
|
|
|
|
|
|
|
} |
912
|
18
|
50
|
|
|
|
|
if (!amqp_decode_32(encoded, &offset, &m->message_count)) |
913
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
914
|
18
|
|
|
|
|
|
*decoded = m; |
915
|
18
|
|
|
|
|
|
return 0; |
916
|
|
|
|
|
|
|
} |
917
|
|
|
|
|
|
|
case AMQP_QUEUE_DELETE_METHOD: { |
918
|
0
|
|
|
|
|
|
amqp_queue_delete_t *m = (amqp_queue_delete_t *)amqp_pool_alloc( |
919
|
|
|
|
|
|
|
pool, sizeof(amqp_queue_delete_t)); |
920
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
921
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
922
|
|
|
|
|
|
|
} |
923
|
0
|
0
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->ticket)) |
924
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
925
|
|
|
|
|
|
|
{ |
926
|
|
|
|
|
|
|
uint8_t len; |
927
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
928
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->queue, len)) |
929
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
930
|
|
|
|
|
|
|
} |
931
|
0
|
0
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
932
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
933
|
0
|
|
|
|
|
|
m->if_unused = (bit_buffer & (1 << 0)) ? 1 : 0; |
934
|
0
|
|
|
|
|
|
m->if_empty = (bit_buffer & (1 << 1)) ? 1 : 0; |
935
|
0
|
|
|
|
|
|
m->nowait = (bit_buffer & (1 << 2)) ? 1 : 0; |
936
|
0
|
|
|
|
|
|
*decoded = m; |
937
|
0
|
|
|
|
|
|
return 0; |
938
|
|
|
|
|
|
|
} |
939
|
|
|
|
|
|
|
case AMQP_QUEUE_DELETE_OK_METHOD: { |
940
|
20
|
|
|
|
|
|
amqp_queue_delete_ok_t *m = (amqp_queue_delete_ok_t *)amqp_pool_alloc( |
941
|
|
|
|
|
|
|
pool, sizeof(amqp_queue_delete_ok_t)); |
942
|
20
|
50
|
|
|
|
|
if (m == NULL) { |
943
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
944
|
|
|
|
|
|
|
} |
945
|
20
|
50
|
|
|
|
|
if (!amqp_decode_32(encoded, &offset, &m->message_count)) |
946
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
947
|
20
|
|
|
|
|
|
*decoded = m; |
948
|
20
|
|
|
|
|
|
return 0; |
949
|
|
|
|
|
|
|
} |
950
|
|
|
|
|
|
|
case AMQP_QUEUE_UNBIND_METHOD: { |
951
|
0
|
|
|
|
|
|
amqp_queue_unbind_t *m = (amqp_queue_unbind_t *)amqp_pool_alloc( |
952
|
|
|
|
|
|
|
pool, sizeof(amqp_queue_unbind_t)); |
953
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
954
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
955
|
|
|
|
|
|
|
} |
956
|
0
|
0
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->ticket)) |
957
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
958
|
|
|
|
|
|
|
{ |
959
|
|
|
|
|
|
|
uint8_t len; |
960
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
961
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->queue, len)) |
962
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
963
|
|
|
|
|
|
|
} |
964
|
|
|
|
|
|
|
{ |
965
|
|
|
|
|
|
|
uint8_t len; |
966
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
967
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->exchange, len)) |
968
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
969
|
|
|
|
|
|
|
} |
970
|
|
|
|
|
|
|
{ |
971
|
|
|
|
|
|
|
uint8_t len; |
972
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
973
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->routing_key, len)) |
974
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
975
|
|
|
|
|
|
|
} |
976
|
|
|
|
|
|
|
{ |
977
|
0
|
|
|
|
|
|
int res = amqp_decode_table(encoded, pool, &(m->arguments), &offset); |
978
|
0
|
0
|
|
|
|
|
if (res < 0) return res; |
979
|
|
|
|
|
|
|
} |
980
|
0
|
|
|
|
|
|
*decoded = m; |
981
|
0
|
|
|
|
|
|
return 0; |
982
|
|
|
|
|
|
|
} |
983
|
|
|
|
|
|
|
case AMQP_QUEUE_UNBIND_OK_METHOD: { |
984
|
21
|
|
|
|
|
|
amqp_queue_unbind_ok_t *m = (amqp_queue_unbind_ok_t *)amqp_pool_alloc( |
985
|
|
|
|
|
|
|
pool, sizeof(amqp_queue_unbind_ok_t)); |
986
|
21
|
50
|
|
|
|
|
if (m == NULL) { |
987
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
988
|
|
|
|
|
|
|
} |
989
|
21
|
|
|
|
|
|
*decoded = m; |
990
|
21
|
|
|
|
|
|
return 0; |
991
|
|
|
|
|
|
|
} |
992
|
|
|
|
|
|
|
case AMQP_BASIC_QOS_METHOD: { |
993
|
0
|
|
|
|
|
|
amqp_basic_qos_t *m = |
994
|
|
|
|
|
|
|
(amqp_basic_qos_t *)amqp_pool_alloc(pool, sizeof(amqp_basic_qos_t)); |
995
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
996
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
997
|
|
|
|
|
|
|
} |
998
|
0
|
0
|
|
|
|
|
if (!amqp_decode_32(encoded, &offset, &m->prefetch_size)) |
999
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1000
|
0
|
0
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->prefetch_count)) |
1001
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1002
|
0
|
0
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
1003
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1004
|
0
|
|
|
|
|
|
m->global = (bit_buffer & (1 << 0)) ? 1 : 0; |
1005
|
0
|
|
|
|
|
|
*decoded = m; |
1006
|
0
|
|
|
|
|
|
return 0; |
1007
|
|
|
|
|
|
|
} |
1008
|
|
|
|
|
|
|
case AMQP_BASIC_QOS_OK_METHOD: { |
1009
|
1
|
|
|
|
|
|
amqp_basic_qos_ok_t *m = (amqp_basic_qos_ok_t *)amqp_pool_alloc( |
1010
|
|
|
|
|
|
|
pool, sizeof(amqp_basic_qos_ok_t)); |
1011
|
1
|
50
|
|
|
|
|
if (m == NULL) { |
1012
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1013
|
|
|
|
|
|
|
} |
1014
|
1
|
|
|
|
|
|
*decoded = m; |
1015
|
1
|
|
|
|
|
|
return 0; |
1016
|
|
|
|
|
|
|
} |
1017
|
|
|
|
|
|
|
case AMQP_BASIC_CONSUME_METHOD: { |
1018
|
0
|
|
|
|
|
|
amqp_basic_consume_t *m = (amqp_basic_consume_t *)amqp_pool_alloc( |
1019
|
|
|
|
|
|
|
pool, sizeof(amqp_basic_consume_t)); |
1020
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
1021
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1022
|
|
|
|
|
|
|
} |
1023
|
0
|
0
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->ticket)) |
1024
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1025
|
|
|
|
|
|
|
{ |
1026
|
|
|
|
|
|
|
uint8_t len; |
1027
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1028
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->queue, len)) |
1029
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1030
|
|
|
|
|
|
|
} |
1031
|
|
|
|
|
|
|
{ |
1032
|
|
|
|
|
|
|
uint8_t len; |
1033
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1034
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->consumer_tag, len)) |
1035
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1036
|
|
|
|
|
|
|
} |
1037
|
0
|
0
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
1038
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1039
|
0
|
|
|
|
|
|
m->no_local = (bit_buffer & (1 << 0)) ? 1 : 0; |
1040
|
0
|
|
|
|
|
|
m->no_ack = (bit_buffer & (1 << 1)) ? 1 : 0; |
1041
|
0
|
|
|
|
|
|
m->exclusive = (bit_buffer & (1 << 2)) ? 1 : 0; |
1042
|
0
|
|
|
|
|
|
m->nowait = (bit_buffer & (1 << 3)) ? 1 : 0; |
1043
|
|
|
|
|
|
|
{ |
1044
|
0
|
|
|
|
|
|
int res = amqp_decode_table(encoded, pool, &(m->arguments), &offset); |
1045
|
0
|
0
|
|
|
|
|
if (res < 0) return res; |
1046
|
|
|
|
|
|
|
} |
1047
|
0
|
|
|
|
|
|
*decoded = m; |
1048
|
0
|
|
|
|
|
|
return 0; |
1049
|
|
|
|
|
|
|
} |
1050
|
|
|
|
|
|
|
case AMQP_BASIC_CONSUME_OK_METHOD: { |
1051
|
16
|
|
|
|
|
|
amqp_basic_consume_ok_t *m = (amqp_basic_consume_ok_t *)amqp_pool_alloc( |
1052
|
|
|
|
|
|
|
pool, sizeof(amqp_basic_consume_ok_t)); |
1053
|
16
|
50
|
|
|
|
|
if (m == NULL) { |
1054
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1055
|
|
|
|
|
|
|
} |
1056
|
|
|
|
|
|
|
{ |
1057
|
|
|
|
|
|
|
uint8_t len; |
1058
|
32
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1059
|
16
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->consumer_tag, len)) |
1060
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1061
|
|
|
|
|
|
|
} |
1062
|
16
|
|
|
|
|
|
*decoded = m; |
1063
|
16
|
|
|
|
|
|
return 0; |
1064
|
|
|
|
|
|
|
} |
1065
|
|
|
|
|
|
|
case AMQP_BASIC_CANCEL_METHOD: { |
1066
|
0
|
|
|
|
|
|
amqp_basic_cancel_t *m = (amqp_basic_cancel_t *)amqp_pool_alloc( |
1067
|
|
|
|
|
|
|
pool, sizeof(amqp_basic_cancel_t)); |
1068
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
1069
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1070
|
|
|
|
|
|
|
} |
1071
|
|
|
|
|
|
|
{ |
1072
|
|
|
|
|
|
|
uint8_t len; |
1073
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1074
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->consumer_tag, len)) |
1075
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1076
|
|
|
|
|
|
|
} |
1077
|
0
|
0
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
1078
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1079
|
0
|
|
|
|
|
|
m->nowait = (bit_buffer & (1 << 0)) ? 1 : 0; |
1080
|
0
|
|
|
|
|
|
*decoded = m; |
1081
|
0
|
|
|
|
|
|
return 0; |
1082
|
|
|
|
|
|
|
} |
1083
|
|
|
|
|
|
|
case AMQP_BASIC_CANCEL_OK_METHOD: { |
1084
|
1
|
|
|
|
|
|
amqp_basic_cancel_ok_t *m = (amqp_basic_cancel_ok_t *)amqp_pool_alloc( |
1085
|
|
|
|
|
|
|
pool, sizeof(amqp_basic_cancel_ok_t)); |
1086
|
1
|
50
|
|
|
|
|
if (m == NULL) { |
1087
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1088
|
|
|
|
|
|
|
} |
1089
|
|
|
|
|
|
|
{ |
1090
|
|
|
|
|
|
|
uint8_t len; |
1091
|
2
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1092
|
1
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->consumer_tag, len)) |
1093
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1094
|
|
|
|
|
|
|
} |
1095
|
1
|
|
|
|
|
|
*decoded = m; |
1096
|
1
|
|
|
|
|
|
return 0; |
1097
|
|
|
|
|
|
|
} |
1098
|
|
|
|
|
|
|
case AMQP_BASIC_PUBLISH_METHOD: { |
1099
|
0
|
|
|
|
|
|
amqp_basic_publish_t *m = (amqp_basic_publish_t *)amqp_pool_alloc( |
1100
|
|
|
|
|
|
|
pool, sizeof(amqp_basic_publish_t)); |
1101
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
1102
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1103
|
|
|
|
|
|
|
} |
1104
|
0
|
0
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->ticket)) |
1105
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1106
|
|
|
|
|
|
|
{ |
1107
|
|
|
|
|
|
|
uint8_t len; |
1108
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1109
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->exchange, len)) |
1110
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1111
|
|
|
|
|
|
|
} |
1112
|
|
|
|
|
|
|
{ |
1113
|
|
|
|
|
|
|
uint8_t len; |
1114
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1115
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->routing_key, len)) |
1116
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1117
|
|
|
|
|
|
|
} |
1118
|
0
|
0
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
1119
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1120
|
0
|
|
|
|
|
|
m->mandatory = (bit_buffer & (1 << 0)) ? 1 : 0; |
1121
|
0
|
|
|
|
|
|
m->immediate = (bit_buffer & (1 << 1)) ? 1 : 0; |
1122
|
0
|
|
|
|
|
|
*decoded = m; |
1123
|
0
|
|
|
|
|
|
return 0; |
1124
|
|
|
|
|
|
|
} |
1125
|
|
|
|
|
|
|
case AMQP_BASIC_RETURN_METHOD: { |
1126
|
0
|
|
|
|
|
|
amqp_basic_return_t *m = (amqp_basic_return_t *)amqp_pool_alloc( |
1127
|
|
|
|
|
|
|
pool, sizeof(amqp_basic_return_t)); |
1128
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
1129
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1130
|
|
|
|
|
|
|
} |
1131
|
0
|
0
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->reply_code)) |
1132
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1133
|
|
|
|
|
|
|
{ |
1134
|
|
|
|
|
|
|
uint8_t len; |
1135
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1136
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->reply_text, len)) |
1137
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1138
|
|
|
|
|
|
|
} |
1139
|
|
|
|
|
|
|
{ |
1140
|
|
|
|
|
|
|
uint8_t len; |
1141
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1142
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->exchange, len)) |
1143
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1144
|
|
|
|
|
|
|
} |
1145
|
|
|
|
|
|
|
{ |
1146
|
|
|
|
|
|
|
uint8_t len; |
1147
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1148
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->routing_key, len)) |
1149
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1150
|
|
|
|
|
|
|
} |
1151
|
0
|
|
|
|
|
|
*decoded = m; |
1152
|
0
|
|
|
|
|
|
return 0; |
1153
|
|
|
|
|
|
|
} |
1154
|
|
|
|
|
|
|
case AMQP_BASIC_DELIVER_METHOD: { |
1155
|
21
|
|
|
|
|
|
amqp_basic_deliver_t *m = (amqp_basic_deliver_t *)amqp_pool_alloc( |
1156
|
|
|
|
|
|
|
pool, sizeof(amqp_basic_deliver_t)); |
1157
|
21
|
50
|
|
|
|
|
if (m == NULL) { |
1158
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1159
|
|
|
|
|
|
|
} |
1160
|
|
|
|
|
|
|
{ |
1161
|
|
|
|
|
|
|
uint8_t len; |
1162
|
42
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1163
|
21
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->consumer_tag, len)) |
1164
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1165
|
|
|
|
|
|
|
} |
1166
|
21
|
50
|
|
|
|
|
if (!amqp_decode_64(encoded, &offset, &m->delivery_tag)) |
1167
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1168
|
21
|
50
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
1169
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1170
|
21
|
|
|
|
|
|
m->redelivered = (bit_buffer & (1 << 0)) ? 1 : 0; |
1171
|
|
|
|
|
|
|
{ |
1172
|
|
|
|
|
|
|
uint8_t len; |
1173
|
42
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1174
|
21
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->exchange, len)) |
1175
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1176
|
|
|
|
|
|
|
} |
1177
|
|
|
|
|
|
|
{ |
1178
|
|
|
|
|
|
|
uint8_t len; |
1179
|
42
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1180
|
21
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->routing_key, len)) |
1181
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1182
|
|
|
|
|
|
|
} |
1183
|
21
|
|
|
|
|
|
*decoded = m; |
1184
|
21
|
|
|
|
|
|
return 0; |
1185
|
|
|
|
|
|
|
} |
1186
|
|
|
|
|
|
|
case AMQP_BASIC_GET_METHOD: { |
1187
|
0
|
|
|
|
|
|
amqp_basic_get_t *m = |
1188
|
|
|
|
|
|
|
(amqp_basic_get_t *)amqp_pool_alloc(pool, sizeof(amqp_basic_get_t)); |
1189
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
1190
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1191
|
|
|
|
|
|
|
} |
1192
|
0
|
0
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &m->ticket)) |
1193
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1194
|
|
|
|
|
|
|
{ |
1195
|
|
|
|
|
|
|
uint8_t len; |
1196
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1197
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->queue, len)) |
1198
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1199
|
|
|
|
|
|
|
} |
1200
|
0
|
0
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
1201
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1202
|
0
|
|
|
|
|
|
m->no_ack = (bit_buffer & (1 << 0)) ? 1 : 0; |
1203
|
0
|
|
|
|
|
|
*decoded = m; |
1204
|
0
|
|
|
|
|
|
return 0; |
1205
|
|
|
|
|
|
|
} |
1206
|
|
|
|
|
|
|
case AMQP_BASIC_GET_OK_METHOD: { |
1207
|
4
|
|
|
|
|
|
amqp_basic_get_ok_t *m = (amqp_basic_get_ok_t *)amqp_pool_alloc( |
1208
|
|
|
|
|
|
|
pool, sizeof(amqp_basic_get_ok_t)); |
1209
|
4
|
50
|
|
|
|
|
if (m == NULL) { |
1210
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1211
|
|
|
|
|
|
|
} |
1212
|
4
|
50
|
|
|
|
|
if (!amqp_decode_64(encoded, &offset, &m->delivery_tag)) |
1213
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1214
|
4
|
50
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
1215
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1216
|
4
|
|
|
|
|
|
m->redelivered = (bit_buffer & (1 << 0)) ? 1 : 0; |
1217
|
|
|
|
|
|
|
{ |
1218
|
|
|
|
|
|
|
uint8_t len; |
1219
|
8
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1220
|
4
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->exchange, len)) |
1221
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1222
|
|
|
|
|
|
|
} |
1223
|
|
|
|
|
|
|
{ |
1224
|
|
|
|
|
|
|
uint8_t len; |
1225
|
8
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1226
|
4
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->routing_key, len)) |
1227
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1228
|
|
|
|
|
|
|
} |
1229
|
4
|
50
|
|
|
|
|
if (!amqp_decode_32(encoded, &offset, &m->message_count)) |
1230
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1231
|
4
|
|
|
|
|
|
*decoded = m; |
1232
|
4
|
|
|
|
|
|
return 0; |
1233
|
|
|
|
|
|
|
} |
1234
|
|
|
|
|
|
|
case AMQP_BASIC_GET_EMPTY_METHOD: { |
1235
|
18
|
|
|
|
|
|
amqp_basic_get_empty_t *m = (amqp_basic_get_empty_t *)amqp_pool_alloc( |
1236
|
|
|
|
|
|
|
pool, sizeof(amqp_basic_get_empty_t)); |
1237
|
18
|
50
|
|
|
|
|
if (m == NULL) { |
1238
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1239
|
|
|
|
|
|
|
} |
1240
|
|
|
|
|
|
|
{ |
1241
|
|
|
|
|
|
|
uint8_t len; |
1242
|
36
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1243
|
18
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &m->cluster_id, len)) |
1244
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1245
|
|
|
|
|
|
|
} |
1246
|
18
|
|
|
|
|
|
*decoded = m; |
1247
|
18
|
|
|
|
|
|
return 0; |
1248
|
|
|
|
|
|
|
} |
1249
|
|
|
|
|
|
|
case AMQP_BASIC_ACK_METHOD: { |
1250
|
0
|
|
|
|
|
|
amqp_basic_ack_t *m = |
1251
|
|
|
|
|
|
|
(amqp_basic_ack_t *)amqp_pool_alloc(pool, sizeof(amqp_basic_ack_t)); |
1252
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
1253
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1254
|
|
|
|
|
|
|
} |
1255
|
0
|
0
|
|
|
|
|
if (!amqp_decode_64(encoded, &offset, &m->delivery_tag)) |
1256
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1257
|
0
|
0
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
1258
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1259
|
0
|
|
|
|
|
|
m->multiple = (bit_buffer & (1 << 0)) ? 1 : 0; |
1260
|
0
|
|
|
|
|
|
*decoded = m; |
1261
|
0
|
|
|
|
|
|
return 0; |
1262
|
|
|
|
|
|
|
} |
1263
|
|
|
|
|
|
|
case AMQP_BASIC_REJECT_METHOD: { |
1264
|
0
|
|
|
|
|
|
amqp_basic_reject_t *m = (amqp_basic_reject_t *)amqp_pool_alloc( |
1265
|
|
|
|
|
|
|
pool, sizeof(amqp_basic_reject_t)); |
1266
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
1267
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1268
|
|
|
|
|
|
|
} |
1269
|
0
|
0
|
|
|
|
|
if (!amqp_decode_64(encoded, &offset, &m->delivery_tag)) |
1270
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1271
|
0
|
0
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
1272
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1273
|
0
|
|
|
|
|
|
m->requeue = (bit_buffer & (1 << 0)) ? 1 : 0; |
1274
|
0
|
|
|
|
|
|
*decoded = m; |
1275
|
0
|
|
|
|
|
|
return 0; |
1276
|
|
|
|
|
|
|
} |
1277
|
|
|
|
|
|
|
case AMQP_BASIC_RECOVER_ASYNC_METHOD: { |
1278
|
0
|
|
|
|
|
|
amqp_basic_recover_async_t *m = |
1279
|
|
|
|
|
|
|
(amqp_basic_recover_async_t *)amqp_pool_alloc( |
1280
|
|
|
|
|
|
|
pool, sizeof(amqp_basic_recover_async_t)); |
1281
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
1282
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1283
|
|
|
|
|
|
|
} |
1284
|
0
|
0
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
1285
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1286
|
0
|
|
|
|
|
|
m->requeue = (bit_buffer & (1 << 0)) ? 1 : 0; |
1287
|
0
|
|
|
|
|
|
*decoded = m; |
1288
|
0
|
|
|
|
|
|
return 0; |
1289
|
|
|
|
|
|
|
} |
1290
|
|
|
|
|
|
|
case AMQP_BASIC_RECOVER_METHOD: { |
1291
|
0
|
|
|
|
|
|
amqp_basic_recover_t *m = (amqp_basic_recover_t *)amqp_pool_alloc( |
1292
|
|
|
|
|
|
|
pool, sizeof(amqp_basic_recover_t)); |
1293
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
1294
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1295
|
|
|
|
|
|
|
} |
1296
|
0
|
0
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
1297
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1298
|
0
|
|
|
|
|
|
m->requeue = (bit_buffer & (1 << 0)) ? 1 : 0; |
1299
|
0
|
|
|
|
|
|
*decoded = m; |
1300
|
0
|
|
|
|
|
|
return 0; |
1301
|
|
|
|
|
|
|
} |
1302
|
|
|
|
|
|
|
case AMQP_BASIC_RECOVER_OK_METHOD: { |
1303
|
0
|
|
|
|
|
|
amqp_basic_recover_ok_t *m = (amqp_basic_recover_ok_t *)amqp_pool_alloc( |
1304
|
|
|
|
|
|
|
pool, sizeof(amqp_basic_recover_ok_t)); |
1305
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
1306
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1307
|
|
|
|
|
|
|
} |
1308
|
0
|
|
|
|
|
|
*decoded = m; |
1309
|
0
|
|
|
|
|
|
return 0; |
1310
|
|
|
|
|
|
|
} |
1311
|
|
|
|
|
|
|
case AMQP_BASIC_NACK_METHOD: { |
1312
|
0
|
|
|
|
|
|
amqp_basic_nack_t *m = |
1313
|
|
|
|
|
|
|
(amqp_basic_nack_t *)amqp_pool_alloc(pool, sizeof(amqp_basic_nack_t)); |
1314
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
1315
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1316
|
|
|
|
|
|
|
} |
1317
|
0
|
0
|
|
|
|
|
if (!amqp_decode_64(encoded, &offset, &m->delivery_tag)) |
1318
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1319
|
0
|
0
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
1320
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1321
|
0
|
|
|
|
|
|
m->multiple = (bit_buffer & (1 << 0)) ? 1 : 0; |
1322
|
0
|
|
|
|
|
|
m->requeue = (bit_buffer & (1 << 1)) ? 1 : 0; |
1323
|
0
|
|
|
|
|
|
*decoded = m; |
1324
|
0
|
|
|
|
|
|
return 0; |
1325
|
|
|
|
|
|
|
} |
1326
|
|
|
|
|
|
|
case AMQP_TX_SELECT_METHOD: { |
1327
|
0
|
|
|
|
|
|
amqp_tx_select_t *m = |
1328
|
|
|
|
|
|
|
(amqp_tx_select_t *)amqp_pool_alloc(pool, sizeof(amqp_tx_select_t)); |
1329
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
1330
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1331
|
|
|
|
|
|
|
} |
1332
|
0
|
|
|
|
|
|
*decoded = m; |
1333
|
0
|
|
|
|
|
|
return 0; |
1334
|
|
|
|
|
|
|
} |
1335
|
|
|
|
|
|
|
case AMQP_TX_SELECT_OK_METHOD: { |
1336
|
1
|
|
|
|
|
|
amqp_tx_select_ok_t *m = (amqp_tx_select_ok_t *)amqp_pool_alloc( |
1337
|
|
|
|
|
|
|
pool, sizeof(amqp_tx_select_ok_t)); |
1338
|
1
|
50
|
|
|
|
|
if (m == NULL) { |
1339
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1340
|
|
|
|
|
|
|
} |
1341
|
1
|
|
|
|
|
|
*decoded = m; |
1342
|
1
|
|
|
|
|
|
return 0; |
1343
|
|
|
|
|
|
|
} |
1344
|
|
|
|
|
|
|
case AMQP_TX_COMMIT_METHOD: { |
1345
|
0
|
|
|
|
|
|
amqp_tx_commit_t *m = |
1346
|
|
|
|
|
|
|
(amqp_tx_commit_t *)amqp_pool_alloc(pool, sizeof(amqp_tx_commit_t)); |
1347
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
1348
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1349
|
|
|
|
|
|
|
} |
1350
|
0
|
|
|
|
|
|
*decoded = m; |
1351
|
0
|
|
|
|
|
|
return 0; |
1352
|
|
|
|
|
|
|
} |
1353
|
|
|
|
|
|
|
case AMQP_TX_COMMIT_OK_METHOD: { |
1354
|
1
|
|
|
|
|
|
amqp_tx_commit_ok_t *m = (amqp_tx_commit_ok_t *)amqp_pool_alloc( |
1355
|
|
|
|
|
|
|
pool, sizeof(amqp_tx_commit_ok_t)); |
1356
|
1
|
50
|
|
|
|
|
if (m == NULL) { |
1357
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1358
|
|
|
|
|
|
|
} |
1359
|
1
|
|
|
|
|
|
*decoded = m; |
1360
|
1
|
|
|
|
|
|
return 0; |
1361
|
|
|
|
|
|
|
} |
1362
|
|
|
|
|
|
|
case AMQP_TX_ROLLBACK_METHOD: { |
1363
|
0
|
|
|
|
|
|
amqp_tx_rollback_t *m = (amqp_tx_rollback_t *)amqp_pool_alloc( |
1364
|
|
|
|
|
|
|
pool, sizeof(amqp_tx_rollback_t)); |
1365
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
1366
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1367
|
|
|
|
|
|
|
} |
1368
|
0
|
|
|
|
|
|
*decoded = m; |
1369
|
0
|
|
|
|
|
|
return 0; |
1370
|
|
|
|
|
|
|
} |
1371
|
|
|
|
|
|
|
case AMQP_TX_ROLLBACK_OK_METHOD: { |
1372
|
1
|
|
|
|
|
|
amqp_tx_rollback_ok_t *m = (amqp_tx_rollback_ok_t *)amqp_pool_alloc( |
1373
|
|
|
|
|
|
|
pool, sizeof(amqp_tx_rollback_ok_t)); |
1374
|
1
|
50
|
|
|
|
|
if (m == NULL) { |
1375
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1376
|
|
|
|
|
|
|
} |
1377
|
1
|
|
|
|
|
|
*decoded = m; |
1378
|
1
|
|
|
|
|
|
return 0; |
1379
|
|
|
|
|
|
|
} |
1380
|
|
|
|
|
|
|
case AMQP_CONFIRM_SELECT_METHOD: { |
1381
|
0
|
|
|
|
|
|
amqp_confirm_select_t *m = (amqp_confirm_select_t *)amqp_pool_alloc( |
1382
|
|
|
|
|
|
|
pool, sizeof(amqp_confirm_select_t)); |
1383
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
1384
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1385
|
|
|
|
|
|
|
} |
1386
|
0
|
0
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &bit_buffer)) |
1387
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1388
|
0
|
|
|
|
|
|
m->nowait = (bit_buffer & (1 << 0)) ? 1 : 0; |
1389
|
0
|
|
|
|
|
|
*decoded = m; |
1390
|
0
|
|
|
|
|
|
return 0; |
1391
|
|
|
|
|
|
|
} |
1392
|
|
|
|
|
|
|
case AMQP_CONFIRM_SELECT_OK_METHOD: { |
1393
|
0
|
|
|
|
|
|
amqp_confirm_select_ok_t *m = (amqp_confirm_select_ok_t *)amqp_pool_alloc( |
1394
|
|
|
|
|
|
|
pool, sizeof(amqp_confirm_select_ok_t)); |
1395
|
0
|
0
|
|
|
|
|
if (m == NULL) { |
1396
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1397
|
|
|
|
|
|
|
} |
1398
|
0
|
|
|
|
|
|
*decoded = m; |
1399
|
0
|
|
|
|
|
|
return 0; |
1400
|
|
|
|
|
|
|
} |
1401
|
|
|
|
|
|
|
default: |
1402
|
400
|
|
|
|
|
|
return AMQP_STATUS_UNKNOWN_METHOD; |
1403
|
|
|
|
|
|
|
} |
1404
|
|
|
|
|
|
|
} |
1405
|
|
|
|
|
|
|
|
1406
|
25
|
|
|
|
|
|
int amqp_decode_properties(uint16_t class_id, amqp_pool_t *pool, |
1407
|
|
|
|
|
|
|
amqp_bytes_t encoded, void **decoded) { |
1408
|
25
|
|
|
|
|
|
size_t offset = 0; |
1409
|
|
|
|
|
|
|
|
1410
|
25
|
|
|
|
|
|
amqp_flags_t flags = 0; |
1411
|
25
|
|
|
|
|
|
int flagword_index = 0; |
1412
|
|
|
|
|
|
|
uint16_t partial_flags; |
1413
|
|
|
|
|
|
|
|
1414
|
|
|
|
|
|
|
do { |
1415
|
25
|
50
|
|
|
|
|
if (!amqp_decode_16(encoded, &offset, &partial_flags)) |
1416
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1417
|
25
|
|
|
|
|
|
flags |= (partial_flags << (flagword_index * 16)); |
1418
|
25
|
|
|
|
|
|
flagword_index++; |
1419
|
25
|
50
|
|
|
|
|
} while (partial_flags & 1); |
1420
|
|
|
|
|
|
|
|
1421
|
25
|
|
|
|
|
|
switch (class_id) { |
1422
|
|
|
|
|
|
|
case 10: { |
1423
|
0
|
|
|
|
|
|
amqp_connection_properties_t *p = |
1424
|
|
|
|
|
|
|
(amqp_connection_properties_t *)amqp_pool_alloc( |
1425
|
|
|
|
|
|
|
pool, sizeof(amqp_connection_properties_t)); |
1426
|
0
|
0
|
|
|
|
|
if (p == NULL) { |
1427
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1428
|
|
|
|
|
|
|
} |
1429
|
0
|
|
|
|
|
|
p->_flags = flags; |
1430
|
0
|
|
|
|
|
|
*decoded = p; |
1431
|
0
|
|
|
|
|
|
return 0; |
1432
|
|
|
|
|
|
|
} |
1433
|
|
|
|
|
|
|
case 20: { |
1434
|
0
|
|
|
|
|
|
amqp_channel_properties_t *p = |
1435
|
|
|
|
|
|
|
(amqp_channel_properties_t *)amqp_pool_alloc( |
1436
|
|
|
|
|
|
|
pool, sizeof(amqp_channel_properties_t)); |
1437
|
0
|
0
|
|
|
|
|
if (p == NULL) { |
1438
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1439
|
|
|
|
|
|
|
} |
1440
|
0
|
|
|
|
|
|
p->_flags = flags; |
1441
|
0
|
|
|
|
|
|
*decoded = p; |
1442
|
0
|
|
|
|
|
|
return 0; |
1443
|
|
|
|
|
|
|
} |
1444
|
|
|
|
|
|
|
case 30: { |
1445
|
0
|
|
|
|
|
|
amqp_access_properties_t *p = (amqp_access_properties_t *)amqp_pool_alloc( |
1446
|
|
|
|
|
|
|
pool, sizeof(amqp_access_properties_t)); |
1447
|
0
|
0
|
|
|
|
|
if (p == NULL) { |
1448
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1449
|
|
|
|
|
|
|
} |
1450
|
0
|
|
|
|
|
|
p->_flags = flags; |
1451
|
0
|
|
|
|
|
|
*decoded = p; |
1452
|
0
|
|
|
|
|
|
return 0; |
1453
|
|
|
|
|
|
|
} |
1454
|
|
|
|
|
|
|
case 40: { |
1455
|
0
|
|
|
|
|
|
amqp_exchange_properties_t *p = |
1456
|
|
|
|
|
|
|
(amqp_exchange_properties_t *)amqp_pool_alloc( |
1457
|
|
|
|
|
|
|
pool, sizeof(amqp_exchange_properties_t)); |
1458
|
0
|
0
|
|
|
|
|
if (p == NULL) { |
1459
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1460
|
|
|
|
|
|
|
} |
1461
|
0
|
|
|
|
|
|
p->_flags = flags; |
1462
|
0
|
|
|
|
|
|
*decoded = p; |
1463
|
0
|
|
|
|
|
|
return 0; |
1464
|
|
|
|
|
|
|
} |
1465
|
|
|
|
|
|
|
case 50: { |
1466
|
0
|
|
|
|
|
|
amqp_queue_properties_t *p = (amqp_queue_properties_t *)amqp_pool_alloc( |
1467
|
|
|
|
|
|
|
pool, sizeof(amqp_queue_properties_t)); |
1468
|
0
|
0
|
|
|
|
|
if (p == NULL) { |
1469
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1470
|
|
|
|
|
|
|
} |
1471
|
0
|
|
|
|
|
|
p->_flags = flags; |
1472
|
0
|
|
|
|
|
|
*decoded = p; |
1473
|
0
|
|
|
|
|
|
return 0; |
1474
|
|
|
|
|
|
|
} |
1475
|
|
|
|
|
|
|
case 60: { |
1476
|
25
|
|
|
|
|
|
amqp_basic_properties_t *p = (amqp_basic_properties_t *)amqp_pool_alloc( |
1477
|
|
|
|
|
|
|
pool, sizeof(amqp_basic_properties_t)); |
1478
|
25
|
50
|
|
|
|
|
if (p == NULL) { |
1479
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1480
|
|
|
|
|
|
|
} |
1481
|
25
|
|
|
|
|
|
p->_flags = flags; |
1482
|
25
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_CONTENT_TYPE_FLAG) { |
1483
|
|
|
|
|
|
|
{ |
1484
|
|
|
|
|
|
|
uint8_t len; |
1485
|
8
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1486
|
4
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &p->content_type, len)) |
1487
|
4
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1488
|
|
|
|
|
|
|
} |
1489
|
|
|
|
|
|
|
} |
1490
|
25
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_CONTENT_ENCODING_FLAG) { |
1491
|
|
|
|
|
|
|
{ |
1492
|
|
|
|
|
|
|
uint8_t len; |
1493
|
14
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1494
|
7
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &p->content_encoding, len)) |
1495
|
7
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1496
|
|
|
|
|
|
|
} |
1497
|
|
|
|
|
|
|
} |
1498
|
25
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_HEADERS_FLAG) { |
1499
|
|
|
|
|
|
|
{ |
1500
|
9
|
|
|
|
|
|
int res = amqp_decode_table(encoded, pool, &(p->headers), &offset); |
1501
|
9
|
50
|
|
|
|
|
if (res < 0) return res; |
1502
|
|
|
|
|
|
|
} |
1503
|
|
|
|
|
|
|
} |
1504
|
25
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_DELIVERY_MODE_FLAG) { |
1505
|
4
|
50
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &p->delivery_mode)) |
1506
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1507
|
|
|
|
|
|
|
} |
1508
|
25
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_PRIORITY_FLAG) { |
1509
|
4
|
50
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &p->priority)) |
1510
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1511
|
|
|
|
|
|
|
} |
1512
|
25
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_CORRELATION_ID_FLAG) { |
1513
|
|
|
|
|
|
|
{ |
1514
|
|
|
|
|
|
|
uint8_t len; |
1515
|
8
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1516
|
4
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &p->correlation_id, len)) |
1517
|
4
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1518
|
|
|
|
|
|
|
} |
1519
|
|
|
|
|
|
|
} |
1520
|
25
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_REPLY_TO_FLAG) { |
1521
|
|
|
|
|
|
|
{ |
1522
|
|
|
|
|
|
|
uint8_t len; |
1523
|
8
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1524
|
4
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &p->reply_to, len)) |
1525
|
4
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1526
|
|
|
|
|
|
|
} |
1527
|
|
|
|
|
|
|
} |
1528
|
25
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_EXPIRATION_FLAG) { |
1529
|
|
|
|
|
|
|
{ |
1530
|
|
|
|
|
|
|
uint8_t len; |
1531
|
8
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1532
|
4
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &p->expiration, len)) |
1533
|
4
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1534
|
|
|
|
|
|
|
} |
1535
|
|
|
|
|
|
|
} |
1536
|
25
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_MESSAGE_ID_FLAG) { |
1537
|
|
|
|
|
|
|
{ |
1538
|
|
|
|
|
|
|
uint8_t len; |
1539
|
8
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1540
|
4
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &p->message_id, len)) |
1541
|
4
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1542
|
|
|
|
|
|
|
} |
1543
|
|
|
|
|
|
|
} |
1544
|
25
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_TIMESTAMP_FLAG) { |
1545
|
4
|
50
|
|
|
|
|
if (!amqp_decode_64(encoded, &offset, &p->timestamp)) |
1546
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1547
|
|
|
|
|
|
|
} |
1548
|
25
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_TYPE_FLAG) { |
1549
|
|
|
|
|
|
|
{ |
1550
|
|
|
|
|
|
|
uint8_t len; |
1551
|
8
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1552
|
4
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &p->type, len)) |
1553
|
4
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1554
|
|
|
|
|
|
|
} |
1555
|
|
|
|
|
|
|
} |
1556
|
25
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_USER_ID_FLAG) { |
1557
|
|
|
|
|
|
|
{ |
1558
|
|
|
|
|
|
|
uint8_t len; |
1559
|
8
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1560
|
4
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &p->user_id, len)) |
1561
|
4
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1562
|
|
|
|
|
|
|
} |
1563
|
|
|
|
|
|
|
} |
1564
|
25
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_APP_ID_FLAG) { |
1565
|
|
|
|
|
|
|
{ |
1566
|
|
|
|
|
|
|
uint8_t len; |
1567
|
8
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1568
|
4
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &p->app_id, len)) |
1569
|
4
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1570
|
|
|
|
|
|
|
} |
1571
|
|
|
|
|
|
|
} |
1572
|
25
|
50
|
|
|
|
|
if (flags & AMQP_BASIC_CLUSTER_ID_FLAG) { |
1573
|
|
|
|
|
|
|
{ |
1574
|
|
|
|
|
|
|
uint8_t len; |
1575
|
0
|
|
|
|
|
|
if (!amqp_decode_8(encoded, &offset, &len) || |
1576
|
0
|
|
|
|
|
|
!amqp_decode_bytes(encoded, &offset, &p->cluster_id, len)) |
1577
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1578
|
|
|
|
|
|
|
} |
1579
|
|
|
|
|
|
|
} |
1580
|
25
|
|
|
|
|
|
*decoded = p; |
1581
|
25
|
|
|
|
|
|
return 0; |
1582
|
|
|
|
|
|
|
} |
1583
|
|
|
|
|
|
|
case 90: { |
1584
|
0
|
|
|
|
|
|
amqp_tx_properties_t *p = (amqp_tx_properties_t *)amqp_pool_alloc( |
1585
|
|
|
|
|
|
|
pool, sizeof(amqp_tx_properties_t)); |
1586
|
0
|
0
|
|
|
|
|
if (p == NULL) { |
1587
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1588
|
|
|
|
|
|
|
} |
1589
|
0
|
|
|
|
|
|
p->_flags = flags; |
1590
|
0
|
|
|
|
|
|
*decoded = p; |
1591
|
0
|
|
|
|
|
|
return 0; |
1592
|
|
|
|
|
|
|
} |
1593
|
|
|
|
|
|
|
case 85: { |
1594
|
0
|
|
|
|
|
|
amqp_confirm_properties_t *p = |
1595
|
|
|
|
|
|
|
(amqp_confirm_properties_t *)amqp_pool_alloc( |
1596
|
|
|
|
|
|
|
pool, sizeof(amqp_confirm_properties_t)); |
1597
|
0
|
0
|
|
|
|
|
if (p == NULL) { |
1598
|
0
|
|
|
|
|
|
return AMQP_STATUS_NO_MEMORY; |
1599
|
|
|
|
|
|
|
} |
1600
|
0
|
|
|
|
|
|
p->_flags = flags; |
1601
|
0
|
|
|
|
|
|
*decoded = p; |
1602
|
0
|
|
|
|
|
|
return 0; |
1603
|
|
|
|
|
|
|
} |
1604
|
|
|
|
|
|
|
default: |
1605
|
25
|
|
|
|
|
|
return AMQP_STATUS_UNKNOWN_CLASS; |
1606
|
|
|
|
|
|
|
} |
1607
|
|
|
|
|
|
|
} |
1608
|
|
|
|
|
|
|
|
1609
|
414
|
|
|
|
|
|
int amqp_encode_method(amqp_method_number_t methodNumber, void *decoded, |
1610
|
|
|
|
|
|
|
amqp_bytes_t encoded) { |
1611
|
414
|
|
|
|
|
|
size_t offset = 0; |
1612
|
|
|
|
|
|
|
uint8_t bit_buffer; |
1613
|
|
|
|
|
|
|
|
1614
|
414
|
|
|
|
|
|
switch (methodNumber) { |
1615
|
|
|
|
|
|
|
case AMQP_CONNECTION_START_METHOD: { |
1616
|
0
|
|
|
|
|
|
amqp_connection_start_t *m = (amqp_connection_start_t *)decoded; |
1617
|
0
|
0
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, m->version_major)) |
1618
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1619
|
0
|
0
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, m->version_minor)) |
1620
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1621
|
|
|
|
|
|
|
{ |
1622
|
0
|
|
|
|
|
|
int res = amqp_encode_table(encoded, &(m->server_properties), &offset); |
1623
|
0
|
0
|
|
|
|
|
if (res < 0) return res; |
1624
|
|
|
|
|
|
|
} |
1625
|
0
|
|
|
|
|
|
if (UINT32_MAX < m->mechanisms.len || |
1626
|
0
|
0
|
|
|
|
|
!amqp_encode_32(encoded, &offset, (uint32_t)m->mechanisms.len) || |
1627
|
0
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->mechanisms)) |
1628
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1629
|
0
|
|
|
|
|
|
if (UINT32_MAX < m->locales.len || |
1630
|
0
|
0
|
|
|
|
|
!amqp_encode_32(encoded, &offset, (uint32_t)m->locales.len) || |
1631
|
0
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->locales)) |
1632
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1633
|
0
|
|
|
|
|
|
return (int)offset; |
1634
|
|
|
|
|
|
|
} |
1635
|
|
|
|
|
|
|
case AMQP_CONNECTION_START_OK_METHOD: { |
1636
|
38
|
|
|
|
|
|
amqp_connection_start_ok_t *m = (amqp_connection_start_ok_t *)decoded; |
1637
|
|
|
|
|
|
|
{ |
1638
|
38
|
|
|
|
|
|
int res = amqp_encode_table(encoded, &(m->client_properties), &offset); |
1639
|
38
|
50
|
|
|
|
|
if (res < 0) return res; |
1640
|
|
|
|
|
|
|
} |
1641
|
76
|
|
|
|
|
|
if (UINT8_MAX < m->mechanism.len || |
1642
|
76
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->mechanism.len) || |
1643
|
38
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->mechanism)) |
1644
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1645
|
76
|
|
|
|
|
|
if (UINT32_MAX < m->response.len || |
1646
|
76
|
50
|
|
|
|
|
!amqp_encode_32(encoded, &offset, (uint32_t)m->response.len) || |
1647
|
38
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->response)) |
1648
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1649
|
76
|
|
|
|
|
|
if (UINT8_MAX < m->locale.len || |
1650
|
76
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->locale.len) || |
1651
|
38
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->locale)) |
1652
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1653
|
38
|
|
|
|
|
|
return (int)offset; |
1654
|
|
|
|
|
|
|
} |
1655
|
|
|
|
|
|
|
case AMQP_CONNECTION_SECURE_METHOD: { |
1656
|
0
|
|
|
|
|
|
amqp_connection_secure_t *m = (amqp_connection_secure_t *)decoded; |
1657
|
0
|
|
|
|
|
|
if (UINT32_MAX < m->challenge.len || |
1658
|
0
|
0
|
|
|
|
|
!amqp_encode_32(encoded, &offset, (uint32_t)m->challenge.len) || |
1659
|
0
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->challenge)) |
1660
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1661
|
0
|
|
|
|
|
|
return (int)offset; |
1662
|
|
|
|
|
|
|
} |
1663
|
|
|
|
|
|
|
case AMQP_CONNECTION_SECURE_OK_METHOD: { |
1664
|
0
|
|
|
|
|
|
amqp_connection_secure_ok_t *m = (amqp_connection_secure_ok_t *)decoded; |
1665
|
0
|
|
|
|
|
|
if (UINT32_MAX < m->response.len || |
1666
|
0
|
0
|
|
|
|
|
!amqp_encode_32(encoded, &offset, (uint32_t)m->response.len) || |
1667
|
0
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->response)) |
1668
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1669
|
0
|
|
|
|
|
|
return (int)offset; |
1670
|
|
|
|
|
|
|
} |
1671
|
|
|
|
|
|
|
case AMQP_CONNECTION_TUNE_METHOD: { |
1672
|
0
|
|
|
|
|
|
amqp_connection_tune_t *m = (amqp_connection_tune_t *)decoded; |
1673
|
0
|
0
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->channel_max)) |
1674
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1675
|
0
|
0
|
|
|
|
|
if (!amqp_encode_32(encoded, &offset, m->frame_max)) |
1676
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1677
|
0
|
0
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->heartbeat)) |
1678
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1679
|
0
|
|
|
|
|
|
return (int)offset; |
1680
|
|
|
|
|
|
|
} |
1681
|
|
|
|
|
|
|
case AMQP_CONNECTION_TUNE_OK_METHOD: { |
1682
|
38
|
|
|
|
|
|
amqp_connection_tune_ok_t *m = (amqp_connection_tune_ok_t *)decoded; |
1683
|
38
|
50
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->channel_max)) |
1684
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1685
|
38
|
50
|
|
|
|
|
if (!amqp_encode_32(encoded, &offset, m->frame_max)) |
1686
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1687
|
38
|
50
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->heartbeat)) |
1688
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1689
|
38
|
|
|
|
|
|
return (int)offset; |
1690
|
|
|
|
|
|
|
} |
1691
|
|
|
|
|
|
|
case AMQP_CONNECTION_OPEN_METHOD: { |
1692
|
38
|
|
|
|
|
|
amqp_connection_open_t *m = (amqp_connection_open_t *)decoded; |
1693
|
76
|
|
|
|
|
|
if (UINT8_MAX < m->virtual_host.len || |
1694
|
76
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->virtual_host.len) || |
1695
|
38
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->virtual_host)) |
1696
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1697
|
76
|
|
|
|
|
|
if (UINT8_MAX < m->capabilities.len || |
1698
|
76
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->capabilities.len) || |
1699
|
38
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->capabilities)) |
1700
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1701
|
38
|
|
|
|
|
|
bit_buffer = 0; |
1702
|
38
|
50
|
|
|
|
|
if (m->insist) bit_buffer |= (1 << 0); |
1703
|
38
|
50
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
1704
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1705
|
38
|
|
|
|
|
|
return (int)offset; |
1706
|
|
|
|
|
|
|
} |
1707
|
|
|
|
|
|
|
case AMQP_CONNECTION_OPEN_OK_METHOD: { |
1708
|
0
|
|
|
|
|
|
amqp_connection_open_ok_t *m = (amqp_connection_open_ok_t *)decoded; |
1709
|
0
|
|
|
|
|
|
if (UINT8_MAX < m->known_hosts.len || |
1710
|
0
|
0
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->known_hosts.len) || |
1711
|
0
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->known_hosts)) |
1712
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1713
|
0
|
|
|
|
|
|
return (int)offset; |
1714
|
|
|
|
|
|
|
} |
1715
|
|
|
|
|
|
|
case AMQP_CONNECTION_CLOSE_METHOD: { |
1716
|
33
|
|
|
|
|
|
amqp_connection_close_t *m = (amqp_connection_close_t *)decoded; |
1717
|
33
|
50
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->reply_code)) |
1718
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1719
|
66
|
|
|
|
|
|
if (UINT8_MAX < m->reply_text.len || |
1720
|
66
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->reply_text.len) || |
1721
|
33
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->reply_text)) |
1722
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1723
|
33
|
50
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->class_id)) |
1724
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1725
|
33
|
50
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->method_id)) |
1726
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1727
|
33
|
|
|
|
|
|
return (int)offset; |
1728
|
|
|
|
|
|
|
} |
1729
|
|
|
|
|
|
|
case AMQP_CONNECTION_CLOSE_OK_METHOD: { |
1730
|
0
|
|
|
|
|
|
return (int)offset; |
1731
|
|
|
|
|
|
|
} |
1732
|
|
|
|
|
|
|
case AMQP_CONNECTION_BLOCKED_METHOD: { |
1733
|
0
|
|
|
|
|
|
amqp_connection_blocked_t *m = (amqp_connection_blocked_t *)decoded; |
1734
|
0
|
|
|
|
|
|
if (UINT8_MAX < m->reason.len || |
1735
|
0
|
0
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->reason.len) || |
1736
|
0
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->reason)) |
1737
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1738
|
0
|
|
|
|
|
|
return (int)offset; |
1739
|
|
|
|
|
|
|
} |
1740
|
|
|
|
|
|
|
case AMQP_CONNECTION_UNBLOCKED_METHOD: { |
1741
|
0
|
|
|
|
|
|
return (int)offset; |
1742
|
|
|
|
|
|
|
} |
1743
|
|
|
|
|
|
|
case AMQP_CHANNEL_OPEN_METHOD: { |
1744
|
36
|
|
|
|
|
|
amqp_channel_open_t *m = (amqp_channel_open_t *)decoded; |
1745
|
72
|
|
|
|
|
|
if (UINT8_MAX < m->out_of_band.len || |
1746
|
72
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->out_of_band.len) || |
1747
|
36
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->out_of_band)) |
1748
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1749
|
36
|
|
|
|
|
|
return (int)offset; |
1750
|
|
|
|
|
|
|
} |
1751
|
|
|
|
|
|
|
case AMQP_CHANNEL_OPEN_OK_METHOD: { |
1752
|
0
|
|
|
|
|
|
amqp_channel_open_ok_t *m = (amqp_channel_open_ok_t *)decoded; |
1753
|
0
|
|
|
|
|
|
if (UINT32_MAX < m->channel_id.len || |
1754
|
0
|
0
|
|
|
|
|
!amqp_encode_32(encoded, &offset, (uint32_t)m->channel_id.len) || |
1755
|
0
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->channel_id)) |
1756
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1757
|
0
|
|
|
|
|
|
return (int)offset; |
1758
|
|
|
|
|
|
|
} |
1759
|
|
|
|
|
|
|
case AMQP_CHANNEL_FLOW_METHOD: { |
1760
|
0
|
|
|
|
|
|
amqp_channel_flow_t *m = (amqp_channel_flow_t *)decoded; |
1761
|
0
|
|
|
|
|
|
bit_buffer = 0; |
1762
|
0
|
0
|
|
|
|
|
if (m->active) bit_buffer |= (1 << 0); |
1763
|
0
|
0
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
1764
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1765
|
0
|
|
|
|
|
|
return (int)offset; |
1766
|
|
|
|
|
|
|
} |
1767
|
|
|
|
|
|
|
case AMQP_CHANNEL_FLOW_OK_METHOD: { |
1768
|
0
|
|
|
|
|
|
amqp_channel_flow_ok_t *m = (amqp_channel_flow_ok_t *)decoded; |
1769
|
0
|
|
|
|
|
|
bit_buffer = 0; |
1770
|
0
|
0
|
|
|
|
|
if (m->active) bit_buffer |= (1 << 0); |
1771
|
0
|
0
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
1772
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1773
|
0
|
|
|
|
|
|
return (int)offset; |
1774
|
|
|
|
|
|
|
} |
1775
|
|
|
|
|
|
|
case AMQP_CHANNEL_CLOSE_METHOD: { |
1776
|
1
|
|
|
|
|
|
amqp_channel_close_t *m = (amqp_channel_close_t *)decoded; |
1777
|
1
|
50
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->reply_code)) |
1778
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1779
|
2
|
|
|
|
|
|
if (UINT8_MAX < m->reply_text.len || |
1780
|
2
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->reply_text.len) || |
1781
|
1
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->reply_text)) |
1782
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1783
|
1
|
50
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->class_id)) |
1784
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1785
|
1
|
50
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->method_id)) |
1786
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1787
|
1
|
|
|
|
|
|
return (int)offset; |
1788
|
|
|
|
|
|
|
} |
1789
|
|
|
|
|
|
|
case AMQP_CHANNEL_CLOSE_OK_METHOD: { |
1790
|
0
|
|
|
|
|
|
return (int)offset; |
1791
|
|
|
|
|
|
|
} |
1792
|
|
|
|
|
|
|
case AMQP_ACCESS_REQUEST_METHOD: { |
1793
|
0
|
|
|
|
|
|
amqp_access_request_t *m = (amqp_access_request_t *)decoded; |
1794
|
0
|
|
|
|
|
|
if (UINT8_MAX < m->realm.len || |
1795
|
0
|
0
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->realm.len) || |
1796
|
0
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->realm)) |
1797
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1798
|
0
|
|
|
|
|
|
bit_buffer = 0; |
1799
|
0
|
0
|
|
|
|
|
if (m->exclusive) bit_buffer |= (1 << 0); |
1800
|
0
|
0
|
|
|
|
|
if (m->passive) bit_buffer |= (1 << 1); |
1801
|
0
|
0
|
|
|
|
|
if (m->active) bit_buffer |= (1 << 2); |
1802
|
0
|
0
|
|
|
|
|
if (m->write) bit_buffer |= (1 << 3); |
1803
|
0
|
0
|
|
|
|
|
if (m->read) bit_buffer |= (1 << 4); |
1804
|
0
|
0
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
1805
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1806
|
0
|
|
|
|
|
|
return (int)offset; |
1807
|
|
|
|
|
|
|
} |
1808
|
|
|
|
|
|
|
case AMQP_ACCESS_REQUEST_OK_METHOD: { |
1809
|
0
|
|
|
|
|
|
amqp_access_request_ok_t *m = (amqp_access_request_ok_t *)decoded; |
1810
|
0
|
0
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->ticket)) |
1811
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1812
|
0
|
|
|
|
|
|
return (int)offset; |
1813
|
|
|
|
|
|
|
} |
1814
|
|
|
|
|
|
|
case AMQP_EXCHANGE_DECLARE_METHOD: { |
1815
|
26
|
|
|
|
|
|
amqp_exchange_declare_t *m = (amqp_exchange_declare_t *)decoded; |
1816
|
26
|
50
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->ticket)) |
1817
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1818
|
52
|
|
|
|
|
|
if (UINT8_MAX < m->exchange.len || |
1819
|
52
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->exchange.len) || |
1820
|
26
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->exchange)) |
1821
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1822
|
52
|
|
|
|
|
|
if (UINT8_MAX < m->type.len || |
1823
|
52
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->type.len) || |
1824
|
26
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->type)) |
1825
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1826
|
26
|
|
|
|
|
|
bit_buffer = 0; |
1827
|
26
|
50
|
|
|
|
|
if (m->passive) bit_buffer |= (1 << 0); |
1828
|
26
|
100
|
|
|
|
|
if (m->durable) bit_buffer |= (1 << 1); |
1829
|
26
|
100
|
|
|
|
|
if (m->auto_delete) bit_buffer |= (1 << 2); |
1830
|
26
|
100
|
|
|
|
|
if (m->internal) bit_buffer |= (1 << 3); |
1831
|
26
|
50
|
|
|
|
|
if (m->nowait) bit_buffer |= (1 << 4); |
1832
|
26
|
50
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
1833
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1834
|
|
|
|
|
|
|
{ |
1835
|
26
|
|
|
|
|
|
int res = amqp_encode_table(encoded, &(m->arguments), &offset); |
1836
|
26
|
50
|
|
|
|
|
if (res < 0) return res; |
1837
|
|
|
|
|
|
|
} |
1838
|
26
|
|
|
|
|
|
return (int)offset; |
1839
|
|
|
|
|
|
|
} |
1840
|
|
|
|
|
|
|
case AMQP_EXCHANGE_DECLARE_OK_METHOD: { |
1841
|
0
|
|
|
|
|
|
return (int)offset; |
1842
|
|
|
|
|
|
|
} |
1843
|
|
|
|
|
|
|
case AMQP_EXCHANGE_DELETE_METHOD: { |
1844
|
27
|
|
|
|
|
|
amqp_exchange_delete_t *m = (amqp_exchange_delete_t *)decoded; |
1845
|
27
|
50
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->ticket)) |
1846
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1847
|
54
|
|
|
|
|
|
if (UINT8_MAX < m->exchange.len || |
1848
|
54
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->exchange.len) || |
1849
|
27
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->exchange)) |
1850
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1851
|
27
|
|
|
|
|
|
bit_buffer = 0; |
1852
|
27
|
50
|
|
|
|
|
if (m->if_unused) bit_buffer |= (1 << 0); |
1853
|
27
|
50
|
|
|
|
|
if (m->nowait) bit_buffer |= (1 << 1); |
1854
|
27
|
50
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
1855
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1856
|
27
|
|
|
|
|
|
return (int)offset; |
1857
|
|
|
|
|
|
|
} |
1858
|
|
|
|
|
|
|
case AMQP_EXCHANGE_DELETE_OK_METHOD: { |
1859
|
0
|
|
|
|
|
|
return (int)offset; |
1860
|
|
|
|
|
|
|
} |
1861
|
|
|
|
|
|
|
case AMQP_EXCHANGE_BIND_METHOD: { |
1862
|
1
|
|
|
|
|
|
amqp_exchange_bind_t *m = (amqp_exchange_bind_t *)decoded; |
1863
|
1
|
50
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->ticket)) |
1864
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1865
|
2
|
|
|
|
|
|
if (UINT8_MAX < m->destination.len || |
1866
|
2
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->destination.len) || |
1867
|
1
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->destination)) |
1868
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1869
|
2
|
|
|
|
|
|
if (UINT8_MAX < m->source.len || |
1870
|
2
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->source.len) || |
1871
|
1
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->source)) |
1872
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1873
|
2
|
|
|
|
|
|
if (UINT8_MAX < m->routing_key.len || |
1874
|
2
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->routing_key.len) || |
1875
|
1
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->routing_key)) |
1876
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1877
|
1
|
|
|
|
|
|
bit_buffer = 0; |
1878
|
1
|
50
|
|
|
|
|
if (m->nowait) bit_buffer |= (1 << 0); |
1879
|
1
|
50
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
1880
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1881
|
|
|
|
|
|
|
{ |
1882
|
1
|
|
|
|
|
|
int res = amqp_encode_table(encoded, &(m->arguments), &offset); |
1883
|
1
|
50
|
|
|
|
|
if (res < 0) return res; |
1884
|
|
|
|
|
|
|
} |
1885
|
1
|
|
|
|
|
|
return (int)offset; |
1886
|
|
|
|
|
|
|
} |
1887
|
|
|
|
|
|
|
case AMQP_EXCHANGE_BIND_OK_METHOD: { |
1888
|
0
|
|
|
|
|
|
return (int)offset; |
1889
|
|
|
|
|
|
|
} |
1890
|
|
|
|
|
|
|
case AMQP_EXCHANGE_UNBIND_METHOD: { |
1891
|
1
|
|
|
|
|
|
amqp_exchange_unbind_t *m = (amqp_exchange_unbind_t *)decoded; |
1892
|
1
|
50
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->ticket)) |
1893
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1894
|
2
|
|
|
|
|
|
if (UINT8_MAX < m->destination.len || |
1895
|
2
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->destination.len) || |
1896
|
1
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->destination)) |
1897
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1898
|
2
|
|
|
|
|
|
if (UINT8_MAX < m->source.len || |
1899
|
2
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->source.len) || |
1900
|
1
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->source)) |
1901
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1902
|
2
|
|
|
|
|
|
if (UINT8_MAX < m->routing_key.len || |
1903
|
2
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->routing_key.len) || |
1904
|
1
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->routing_key)) |
1905
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1906
|
1
|
|
|
|
|
|
bit_buffer = 0; |
1907
|
1
|
50
|
|
|
|
|
if (m->nowait) bit_buffer |= (1 << 0); |
1908
|
1
|
50
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
1909
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1910
|
|
|
|
|
|
|
{ |
1911
|
1
|
|
|
|
|
|
int res = amqp_encode_table(encoded, &(m->arguments), &offset); |
1912
|
1
|
50
|
|
|
|
|
if (res < 0) return res; |
1913
|
|
|
|
|
|
|
} |
1914
|
1
|
|
|
|
|
|
return (int)offset; |
1915
|
|
|
|
|
|
|
} |
1916
|
|
|
|
|
|
|
case AMQP_EXCHANGE_UNBIND_OK_METHOD: { |
1917
|
0
|
|
|
|
|
|
return (int)offset; |
1918
|
|
|
|
|
|
|
} |
1919
|
|
|
|
|
|
|
case AMQP_QUEUE_DECLARE_METHOD: { |
1920
|
20
|
|
|
|
|
|
amqp_queue_declare_t *m = (amqp_queue_declare_t *)decoded; |
1921
|
20
|
50
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->ticket)) |
1922
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1923
|
40
|
|
|
|
|
|
if (UINT8_MAX < m->queue.len || |
1924
|
40
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->queue.len) || |
1925
|
20
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->queue)) |
1926
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1927
|
20
|
|
|
|
|
|
bit_buffer = 0; |
1928
|
20
|
50
|
|
|
|
|
if (m->passive) bit_buffer |= (1 << 0); |
1929
|
20
|
100
|
|
|
|
|
if (m->durable) bit_buffer |= (1 << 1); |
1930
|
20
|
50
|
|
|
|
|
if (m->exclusive) bit_buffer |= (1 << 2); |
1931
|
20
|
100
|
|
|
|
|
if (m->auto_delete) bit_buffer |= (1 << 3); |
1932
|
20
|
50
|
|
|
|
|
if (m->nowait) bit_buffer |= (1 << 4); |
1933
|
20
|
50
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
1934
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1935
|
|
|
|
|
|
|
{ |
1936
|
20
|
|
|
|
|
|
int res = amqp_encode_table(encoded, &(m->arguments), &offset); |
1937
|
20
|
50
|
|
|
|
|
if (res < 0) return res; |
1938
|
|
|
|
|
|
|
} |
1939
|
20
|
|
|
|
|
|
return (int)offset; |
1940
|
|
|
|
|
|
|
} |
1941
|
|
|
|
|
|
|
case AMQP_QUEUE_DECLARE_OK_METHOD: { |
1942
|
0
|
|
|
|
|
|
amqp_queue_declare_ok_t *m = (amqp_queue_declare_ok_t *)decoded; |
1943
|
0
|
|
|
|
|
|
if (UINT8_MAX < m->queue.len || |
1944
|
0
|
0
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->queue.len) || |
1945
|
0
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->queue)) |
1946
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1947
|
0
|
0
|
|
|
|
|
if (!amqp_encode_32(encoded, &offset, m->message_count)) |
1948
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1949
|
0
|
0
|
|
|
|
|
if (!amqp_encode_32(encoded, &offset, m->consumer_count)) |
1950
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1951
|
0
|
|
|
|
|
|
return (int)offset; |
1952
|
|
|
|
|
|
|
} |
1953
|
|
|
|
|
|
|
case AMQP_QUEUE_BIND_METHOD: { |
1954
|
18
|
|
|
|
|
|
amqp_queue_bind_t *m = (amqp_queue_bind_t *)decoded; |
1955
|
18
|
50
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->ticket)) |
1956
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1957
|
36
|
|
|
|
|
|
if (UINT8_MAX < m->queue.len || |
1958
|
36
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->queue.len) || |
1959
|
18
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->queue)) |
1960
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1961
|
36
|
|
|
|
|
|
if (UINT8_MAX < m->exchange.len || |
1962
|
36
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->exchange.len) || |
1963
|
18
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->exchange)) |
1964
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1965
|
36
|
|
|
|
|
|
if (UINT8_MAX < m->routing_key.len || |
1966
|
36
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->routing_key.len) || |
1967
|
18
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->routing_key)) |
1968
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1969
|
18
|
|
|
|
|
|
bit_buffer = 0; |
1970
|
18
|
50
|
|
|
|
|
if (m->nowait) bit_buffer |= (1 << 0); |
1971
|
18
|
50
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
1972
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1973
|
|
|
|
|
|
|
{ |
1974
|
18
|
|
|
|
|
|
int res = amqp_encode_table(encoded, &(m->arguments), &offset); |
1975
|
18
|
50
|
|
|
|
|
if (res < 0) return res; |
1976
|
|
|
|
|
|
|
} |
1977
|
18
|
|
|
|
|
|
return (int)offset; |
1978
|
|
|
|
|
|
|
} |
1979
|
|
|
|
|
|
|
case AMQP_QUEUE_BIND_OK_METHOD: { |
1980
|
0
|
|
|
|
|
|
return (int)offset; |
1981
|
|
|
|
|
|
|
} |
1982
|
|
|
|
|
|
|
case AMQP_QUEUE_PURGE_METHOD: { |
1983
|
19
|
|
|
|
|
|
amqp_queue_purge_t *m = (amqp_queue_purge_t *)decoded; |
1984
|
19
|
50
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->ticket)) |
1985
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1986
|
38
|
|
|
|
|
|
if (UINT8_MAX < m->queue.len || |
1987
|
38
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->queue.len) || |
1988
|
19
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->queue)) |
1989
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1990
|
19
|
|
|
|
|
|
bit_buffer = 0; |
1991
|
19
|
50
|
|
|
|
|
if (m->nowait) bit_buffer |= (1 << 0); |
1992
|
19
|
50
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
1993
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
1994
|
19
|
|
|
|
|
|
return (int)offset; |
1995
|
|
|
|
|
|
|
} |
1996
|
|
|
|
|
|
|
case AMQP_QUEUE_PURGE_OK_METHOD: { |
1997
|
0
|
|
|
|
|
|
amqp_queue_purge_ok_t *m = (amqp_queue_purge_ok_t *)decoded; |
1998
|
0
|
0
|
|
|
|
|
if (!amqp_encode_32(encoded, &offset, m->message_count)) |
1999
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2000
|
0
|
|
|
|
|
|
return (int)offset; |
2001
|
|
|
|
|
|
|
} |
2002
|
|
|
|
|
|
|
case AMQP_QUEUE_DELETE_METHOD: { |
2003
|
20
|
|
|
|
|
|
amqp_queue_delete_t *m = (amqp_queue_delete_t *)decoded; |
2004
|
20
|
50
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->ticket)) |
2005
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2006
|
40
|
|
|
|
|
|
if (UINT8_MAX < m->queue.len || |
2007
|
40
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->queue.len) || |
2008
|
20
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->queue)) |
2009
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2010
|
20
|
|
|
|
|
|
bit_buffer = 0; |
2011
|
20
|
50
|
|
|
|
|
if (m->if_unused) bit_buffer |= (1 << 0); |
2012
|
20
|
50
|
|
|
|
|
if (m->if_empty) bit_buffer |= (1 << 1); |
2013
|
20
|
50
|
|
|
|
|
if (m->nowait) bit_buffer |= (1 << 2); |
2014
|
20
|
50
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
2015
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2016
|
20
|
|
|
|
|
|
return (int)offset; |
2017
|
|
|
|
|
|
|
} |
2018
|
|
|
|
|
|
|
case AMQP_QUEUE_DELETE_OK_METHOD: { |
2019
|
0
|
|
|
|
|
|
amqp_queue_delete_ok_t *m = (amqp_queue_delete_ok_t *)decoded; |
2020
|
0
|
0
|
|
|
|
|
if (!amqp_encode_32(encoded, &offset, m->message_count)) |
2021
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2022
|
0
|
|
|
|
|
|
return (int)offset; |
2023
|
|
|
|
|
|
|
} |
2024
|
|
|
|
|
|
|
case AMQP_QUEUE_UNBIND_METHOD: { |
2025
|
21
|
|
|
|
|
|
amqp_queue_unbind_t *m = (amqp_queue_unbind_t *)decoded; |
2026
|
21
|
50
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->ticket)) |
2027
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2028
|
42
|
|
|
|
|
|
if (UINT8_MAX < m->queue.len || |
2029
|
42
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->queue.len) || |
2030
|
21
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->queue)) |
2031
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2032
|
42
|
|
|
|
|
|
if (UINT8_MAX < m->exchange.len || |
2033
|
42
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->exchange.len) || |
2034
|
21
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->exchange)) |
2035
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2036
|
42
|
|
|
|
|
|
if (UINT8_MAX < m->routing_key.len || |
2037
|
42
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->routing_key.len) || |
2038
|
21
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->routing_key)) |
2039
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2040
|
|
|
|
|
|
|
{ |
2041
|
21
|
|
|
|
|
|
int res = amqp_encode_table(encoded, &(m->arguments), &offset); |
2042
|
21
|
50
|
|
|
|
|
if (res < 0) return res; |
2043
|
|
|
|
|
|
|
} |
2044
|
21
|
|
|
|
|
|
return (int)offset; |
2045
|
|
|
|
|
|
|
} |
2046
|
|
|
|
|
|
|
case AMQP_QUEUE_UNBIND_OK_METHOD: { |
2047
|
0
|
|
|
|
|
|
return (int)offset; |
2048
|
|
|
|
|
|
|
} |
2049
|
|
|
|
|
|
|
case AMQP_BASIC_QOS_METHOD: { |
2050
|
1
|
|
|
|
|
|
amqp_basic_qos_t *m = (amqp_basic_qos_t *)decoded; |
2051
|
1
|
50
|
|
|
|
|
if (!amqp_encode_32(encoded, &offset, m->prefetch_size)) |
2052
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2053
|
1
|
50
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->prefetch_count)) |
2054
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2055
|
1
|
|
|
|
|
|
bit_buffer = 0; |
2056
|
1
|
50
|
|
|
|
|
if (m->global) bit_buffer |= (1 << 0); |
2057
|
1
|
50
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
2058
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2059
|
1
|
|
|
|
|
|
return (int)offset; |
2060
|
|
|
|
|
|
|
} |
2061
|
|
|
|
|
|
|
case AMQP_BASIC_QOS_OK_METHOD: { |
2062
|
0
|
|
|
|
|
|
return (int)offset; |
2063
|
|
|
|
|
|
|
} |
2064
|
|
|
|
|
|
|
case AMQP_BASIC_CONSUME_METHOD: { |
2065
|
16
|
|
|
|
|
|
amqp_basic_consume_t *m = (amqp_basic_consume_t *)decoded; |
2066
|
16
|
50
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->ticket)) |
2067
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2068
|
32
|
|
|
|
|
|
if (UINT8_MAX < m->queue.len || |
2069
|
32
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->queue.len) || |
2070
|
16
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->queue)) |
2071
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2072
|
32
|
|
|
|
|
|
if (UINT8_MAX < m->consumer_tag.len || |
2073
|
32
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->consumer_tag.len) || |
2074
|
16
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->consumer_tag)) |
2075
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2076
|
16
|
|
|
|
|
|
bit_buffer = 0; |
2077
|
16
|
50
|
|
|
|
|
if (m->no_local) bit_buffer |= (1 << 0); |
2078
|
16
|
100
|
|
|
|
|
if (m->no_ack) bit_buffer |= (1 << 1); |
2079
|
16
|
50
|
|
|
|
|
if (m->exclusive) bit_buffer |= (1 << 2); |
2080
|
16
|
50
|
|
|
|
|
if (m->nowait) bit_buffer |= (1 << 3); |
2081
|
16
|
50
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
2082
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2083
|
|
|
|
|
|
|
{ |
2084
|
16
|
|
|
|
|
|
int res = amqp_encode_table(encoded, &(m->arguments), &offset); |
2085
|
16
|
50
|
|
|
|
|
if (res < 0) return res; |
2086
|
|
|
|
|
|
|
} |
2087
|
16
|
|
|
|
|
|
return (int)offset; |
2088
|
|
|
|
|
|
|
} |
2089
|
|
|
|
|
|
|
case AMQP_BASIC_CONSUME_OK_METHOD: { |
2090
|
0
|
|
|
|
|
|
amqp_basic_consume_ok_t *m = (amqp_basic_consume_ok_t *)decoded; |
2091
|
0
|
|
|
|
|
|
if (UINT8_MAX < m->consumer_tag.len || |
2092
|
0
|
0
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->consumer_tag.len) || |
2093
|
0
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->consumer_tag)) |
2094
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2095
|
0
|
|
|
|
|
|
return (int)offset; |
2096
|
|
|
|
|
|
|
} |
2097
|
|
|
|
|
|
|
case AMQP_BASIC_CANCEL_METHOD: { |
2098
|
2
|
|
|
|
|
|
amqp_basic_cancel_t *m = (amqp_basic_cancel_t *)decoded; |
2099
|
4
|
|
|
|
|
|
if (UINT8_MAX < m->consumer_tag.len || |
2100
|
4
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->consumer_tag.len) || |
2101
|
2
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->consumer_tag)) |
2102
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2103
|
2
|
|
|
|
|
|
bit_buffer = 0; |
2104
|
2
|
50
|
|
|
|
|
if (m->nowait) bit_buffer |= (1 << 0); |
2105
|
2
|
50
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
2106
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2107
|
2
|
|
|
|
|
|
return (int)offset; |
2108
|
|
|
|
|
|
|
} |
2109
|
|
|
|
|
|
|
case AMQP_BASIC_CANCEL_OK_METHOD: { |
2110
|
0
|
|
|
|
|
|
amqp_basic_cancel_ok_t *m = (amqp_basic_cancel_ok_t *)decoded; |
2111
|
0
|
|
|
|
|
|
if (UINT8_MAX < m->consumer_tag.len || |
2112
|
0
|
0
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->consumer_tag.len) || |
2113
|
0
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->consumer_tag)) |
2114
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2115
|
0
|
|
|
|
|
|
return (int)offset; |
2116
|
|
|
|
|
|
|
} |
2117
|
|
|
|
|
|
|
case AMQP_BASIC_PUBLISH_METHOD: { |
2118
|
29
|
|
|
|
|
|
amqp_basic_publish_t *m = (amqp_basic_publish_t *)decoded; |
2119
|
29
|
50
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->ticket)) |
2120
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2121
|
58
|
|
|
|
|
|
if (UINT8_MAX < m->exchange.len || |
2122
|
58
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->exchange.len) || |
2123
|
29
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->exchange)) |
2124
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2125
|
58
|
|
|
|
|
|
if (UINT8_MAX < m->routing_key.len || |
2126
|
58
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->routing_key.len) || |
2127
|
29
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->routing_key)) |
2128
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2129
|
29
|
|
|
|
|
|
bit_buffer = 0; |
2130
|
29
|
50
|
|
|
|
|
if (m->mandatory) bit_buffer |= (1 << 0); |
2131
|
29
|
50
|
|
|
|
|
if (m->immediate) bit_buffer |= (1 << 1); |
2132
|
29
|
50
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
2133
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2134
|
29
|
|
|
|
|
|
return (int)offset; |
2135
|
|
|
|
|
|
|
} |
2136
|
|
|
|
|
|
|
case AMQP_BASIC_RETURN_METHOD: { |
2137
|
0
|
|
|
|
|
|
amqp_basic_return_t *m = (amqp_basic_return_t *)decoded; |
2138
|
0
|
0
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->reply_code)) |
2139
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2140
|
0
|
|
|
|
|
|
if (UINT8_MAX < m->reply_text.len || |
2141
|
0
|
0
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->reply_text.len) || |
2142
|
0
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->reply_text)) |
2143
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2144
|
0
|
|
|
|
|
|
if (UINT8_MAX < m->exchange.len || |
2145
|
0
|
0
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->exchange.len) || |
2146
|
0
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->exchange)) |
2147
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2148
|
0
|
|
|
|
|
|
if (UINT8_MAX < m->routing_key.len || |
2149
|
0
|
0
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->routing_key.len) || |
2150
|
0
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->routing_key)) |
2151
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2152
|
0
|
|
|
|
|
|
return (int)offset; |
2153
|
|
|
|
|
|
|
} |
2154
|
|
|
|
|
|
|
case AMQP_BASIC_DELIVER_METHOD: { |
2155
|
0
|
|
|
|
|
|
amqp_basic_deliver_t *m = (amqp_basic_deliver_t *)decoded; |
2156
|
0
|
|
|
|
|
|
if (UINT8_MAX < m->consumer_tag.len || |
2157
|
0
|
0
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->consumer_tag.len) || |
2158
|
0
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->consumer_tag)) |
2159
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2160
|
0
|
0
|
|
|
|
|
if (!amqp_encode_64(encoded, &offset, m->delivery_tag)) |
2161
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2162
|
0
|
|
|
|
|
|
bit_buffer = 0; |
2163
|
0
|
0
|
|
|
|
|
if (m->redelivered) bit_buffer |= (1 << 0); |
2164
|
0
|
0
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
2165
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2166
|
0
|
|
|
|
|
|
if (UINT8_MAX < m->exchange.len || |
2167
|
0
|
0
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->exchange.len) || |
2168
|
0
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->exchange)) |
2169
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2170
|
0
|
|
|
|
|
|
if (UINT8_MAX < m->routing_key.len || |
2171
|
0
|
0
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->routing_key.len) || |
2172
|
0
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->routing_key)) |
2173
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2174
|
0
|
|
|
|
|
|
return (int)offset; |
2175
|
|
|
|
|
|
|
} |
2176
|
|
|
|
|
|
|
case AMQP_BASIC_GET_METHOD: { |
2177
|
22
|
|
|
|
|
|
amqp_basic_get_t *m = (amqp_basic_get_t *)decoded; |
2178
|
22
|
50
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, m->ticket)) |
2179
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2180
|
44
|
|
|
|
|
|
if (UINT8_MAX < m->queue.len || |
2181
|
44
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->queue.len) || |
2182
|
22
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->queue)) |
2183
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2184
|
22
|
|
|
|
|
|
bit_buffer = 0; |
2185
|
22
|
100
|
|
|
|
|
if (m->no_ack) bit_buffer |= (1 << 0); |
2186
|
22
|
50
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
2187
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2188
|
22
|
|
|
|
|
|
return (int)offset; |
2189
|
|
|
|
|
|
|
} |
2190
|
|
|
|
|
|
|
case AMQP_BASIC_GET_OK_METHOD: { |
2191
|
0
|
|
|
|
|
|
amqp_basic_get_ok_t *m = (amqp_basic_get_ok_t *)decoded; |
2192
|
0
|
0
|
|
|
|
|
if (!amqp_encode_64(encoded, &offset, m->delivery_tag)) |
2193
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2194
|
0
|
|
|
|
|
|
bit_buffer = 0; |
2195
|
0
|
0
|
|
|
|
|
if (m->redelivered) bit_buffer |= (1 << 0); |
2196
|
0
|
0
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
2197
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2198
|
0
|
|
|
|
|
|
if (UINT8_MAX < m->exchange.len || |
2199
|
0
|
0
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->exchange.len) || |
2200
|
0
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->exchange)) |
2201
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2202
|
0
|
|
|
|
|
|
if (UINT8_MAX < m->routing_key.len || |
2203
|
0
|
0
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->routing_key.len) || |
2204
|
0
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->routing_key)) |
2205
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2206
|
0
|
0
|
|
|
|
|
if (!amqp_encode_32(encoded, &offset, m->message_count)) |
2207
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2208
|
0
|
|
|
|
|
|
return (int)offset; |
2209
|
|
|
|
|
|
|
} |
2210
|
|
|
|
|
|
|
case AMQP_BASIC_GET_EMPTY_METHOD: { |
2211
|
0
|
|
|
|
|
|
amqp_basic_get_empty_t *m = (amqp_basic_get_empty_t *)decoded; |
2212
|
0
|
|
|
|
|
|
if (UINT8_MAX < m->cluster_id.len || |
2213
|
0
|
0
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)m->cluster_id.len) || |
2214
|
0
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, m->cluster_id)) |
2215
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2216
|
0
|
|
|
|
|
|
return (int)offset; |
2217
|
|
|
|
|
|
|
} |
2218
|
|
|
|
|
|
|
case AMQP_BASIC_ACK_METHOD: { |
2219
|
2
|
|
|
|
|
|
amqp_basic_ack_t *m = (amqp_basic_ack_t *)decoded; |
2220
|
2
|
50
|
|
|
|
|
if (!amqp_encode_64(encoded, &offset, m->delivery_tag)) |
2221
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2222
|
2
|
|
|
|
|
|
bit_buffer = 0; |
2223
|
2
|
50
|
|
|
|
|
if (m->multiple) bit_buffer |= (1 << 0); |
2224
|
2
|
50
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
2225
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2226
|
2
|
|
|
|
|
|
return (int)offset; |
2227
|
|
|
|
|
|
|
} |
2228
|
|
|
|
|
|
|
case AMQP_BASIC_REJECT_METHOD: { |
2229
|
1
|
|
|
|
|
|
amqp_basic_reject_t *m = (amqp_basic_reject_t *)decoded; |
2230
|
1
|
50
|
|
|
|
|
if (!amqp_encode_64(encoded, &offset, m->delivery_tag)) |
2231
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2232
|
1
|
|
|
|
|
|
bit_buffer = 0; |
2233
|
1
|
50
|
|
|
|
|
if (m->requeue) bit_buffer |= (1 << 0); |
2234
|
1
|
50
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
2235
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2236
|
1
|
|
|
|
|
|
return (int)offset; |
2237
|
|
|
|
|
|
|
} |
2238
|
|
|
|
|
|
|
case AMQP_BASIC_RECOVER_ASYNC_METHOD: { |
2239
|
0
|
|
|
|
|
|
amqp_basic_recover_async_t *m = (amqp_basic_recover_async_t *)decoded; |
2240
|
0
|
|
|
|
|
|
bit_buffer = 0; |
2241
|
0
|
0
|
|
|
|
|
if (m->requeue) bit_buffer |= (1 << 0); |
2242
|
0
|
0
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
2243
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2244
|
0
|
|
|
|
|
|
return (int)offset; |
2245
|
|
|
|
|
|
|
} |
2246
|
|
|
|
|
|
|
case AMQP_BASIC_RECOVER_METHOD: { |
2247
|
0
|
|
|
|
|
|
amqp_basic_recover_t *m = (amqp_basic_recover_t *)decoded; |
2248
|
0
|
|
|
|
|
|
bit_buffer = 0; |
2249
|
0
|
0
|
|
|
|
|
if (m->requeue) bit_buffer |= (1 << 0); |
2250
|
0
|
0
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
2251
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2252
|
0
|
|
|
|
|
|
return (int)offset; |
2253
|
|
|
|
|
|
|
} |
2254
|
|
|
|
|
|
|
case AMQP_BASIC_RECOVER_OK_METHOD: { |
2255
|
0
|
|
|
|
|
|
return (int)offset; |
2256
|
|
|
|
|
|
|
} |
2257
|
|
|
|
|
|
|
case AMQP_BASIC_NACK_METHOD: { |
2258
|
1
|
|
|
|
|
|
amqp_basic_nack_t *m = (amqp_basic_nack_t *)decoded; |
2259
|
1
|
50
|
|
|
|
|
if (!amqp_encode_64(encoded, &offset, m->delivery_tag)) |
2260
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2261
|
1
|
|
|
|
|
|
bit_buffer = 0; |
2262
|
1
|
50
|
|
|
|
|
if (m->multiple) bit_buffer |= (1 << 0); |
2263
|
1
|
50
|
|
|
|
|
if (m->requeue) bit_buffer |= (1 << 1); |
2264
|
1
|
50
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
2265
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2266
|
1
|
|
|
|
|
|
return (int)offset; |
2267
|
|
|
|
|
|
|
} |
2268
|
|
|
|
|
|
|
case AMQP_TX_SELECT_METHOD: { |
2269
|
1
|
|
|
|
|
|
return (int)offset; |
2270
|
|
|
|
|
|
|
} |
2271
|
|
|
|
|
|
|
case AMQP_TX_SELECT_OK_METHOD: { |
2272
|
0
|
|
|
|
|
|
return (int)offset; |
2273
|
|
|
|
|
|
|
} |
2274
|
|
|
|
|
|
|
case AMQP_TX_COMMIT_METHOD: { |
2275
|
1
|
|
|
|
|
|
return (int)offset; |
2276
|
|
|
|
|
|
|
} |
2277
|
|
|
|
|
|
|
case AMQP_TX_COMMIT_OK_METHOD: { |
2278
|
0
|
|
|
|
|
|
return (int)offset; |
2279
|
|
|
|
|
|
|
} |
2280
|
|
|
|
|
|
|
case AMQP_TX_ROLLBACK_METHOD: { |
2281
|
1
|
|
|
|
|
|
return (int)offset; |
2282
|
|
|
|
|
|
|
} |
2283
|
|
|
|
|
|
|
case AMQP_TX_ROLLBACK_OK_METHOD: { |
2284
|
0
|
|
|
|
|
|
return (int)offset; |
2285
|
|
|
|
|
|
|
} |
2286
|
|
|
|
|
|
|
case AMQP_CONFIRM_SELECT_METHOD: { |
2287
|
0
|
|
|
|
|
|
amqp_confirm_select_t *m = (amqp_confirm_select_t *)decoded; |
2288
|
0
|
|
|
|
|
|
bit_buffer = 0; |
2289
|
0
|
0
|
|
|
|
|
if (m->nowait) bit_buffer |= (1 << 0); |
2290
|
0
|
0
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, bit_buffer)) |
2291
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2292
|
0
|
|
|
|
|
|
return (int)offset; |
2293
|
|
|
|
|
|
|
} |
2294
|
|
|
|
|
|
|
case AMQP_CONFIRM_SELECT_OK_METHOD: { |
2295
|
0
|
|
|
|
|
|
return (int)offset; |
2296
|
|
|
|
|
|
|
} |
2297
|
|
|
|
|
|
|
default: |
2298
|
414
|
|
|
|
|
|
return AMQP_STATUS_UNKNOWN_METHOD; |
2299
|
|
|
|
|
|
|
} |
2300
|
|
|
|
|
|
|
} |
2301
|
|
|
|
|
|
|
|
2302
|
28
|
|
|
|
|
|
int amqp_encode_properties(uint16_t class_id, void *decoded, |
2303
|
|
|
|
|
|
|
amqp_bytes_t encoded) { |
2304
|
28
|
|
|
|
|
|
size_t offset = 0; |
2305
|
|
|
|
|
|
|
|
2306
|
|
|
|
|
|
|
/* Cheat, and get the flags out generically, relying on the |
2307
|
|
|
|
|
|
|
similarity of structure between classes */ |
2308
|
28
|
|
|
|
|
|
amqp_flags_t flags = *(amqp_flags_t *)decoded; /* cheating! */ |
2309
|
|
|
|
|
|
|
|
2310
|
|
|
|
|
|
|
{ |
2311
|
|
|
|
|
|
|
/* We take a copy of flags to avoid destroying it, as it is used |
2312
|
|
|
|
|
|
|
in the autogenerated code below. */ |
2313
|
28
|
|
|
|
|
|
amqp_flags_t remaining_flags = flags; |
2314
|
|
|
|
|
|
|
do { |
2315
|
28
|
|
|
|
|
|
amqp_flags_t remainder = remaining_flags >> 16; |
2316
|
28
|
|
|
|
|
|
uint16_t partial_flags = remaining_flags & 0xFFFE; |
2317
|
28
|
50
|
|
|
|
|
if (remainder != 0) { |
2318
|
0
|
|
|
|
|
|
partial_flags |= 1; |
2319
|
|
|
|
|
|
|
} |
2320
|
28
|
50
|
|
|
|
|
if (!amqp_encode_16(encoded, &offset, partial_flags)) |
2321
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2322
|
28
|
|
|
|
|
|
remaining_flags = remainder; |
2323
|
28
|
50
|
|
|
|
|
} while (remaining_flags != 0); |
2324
|
|
|
|
|
|
|
} |
2325
|
|
|
|
|
|
|
|
2326
|
28
|
|
|
|
|
|
switch (class_id) { |
2327
|
|
|
|
|
|
|
case 10: { |
2328
|
0
|
|
|
|
|
|
return (int)offset; |
2329
|
|
|
|
|
|
|
} |
2330
|
|
|
|
|
|
|
case 20: { |
2331
|
0
|
|
|
|
|
|
return (int)offset; |
2332
|
|
|
|
|
|
|
} |
2333
|
|
|
|
|
|
|
case 30: { |
2334
|
0
|
|
|
|
|
|
return (int)offset; |
2335
|
|
|
|
|
|
|
} |
2336
|
|
|
|
|
|
|
case 40: { |
2337
|
0
|
|
|
|
|
|
return (int)offset; |
2338
|
|
|
|
|
|
|
} |
2339
|
|
|
|
|
|
|
case 50: { |
2340
|
0
|
|
|
|
|
|
return (int)offset; |
2341
|
|
|
|
|
|
|
} |
2342
|
|
|
|
|
|
|
case 60: { |
2343
|
28
|
|
|
|
|
|
amqp_basic_properties_t *p = (amqp_basic_properties_t *)decoded; |
2344
|
28
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_CONTENT_TYPE_FLAG) { |
2345
|
10
|
|
|
|
|
|
if (UINT8_MAX < p->content_type.len || |
2346
|
10
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)p->content_type.len) || |
2347
|
5
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, p->content_type)) |
2348
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2349
|
|
|
|
|
|
|
} |
2350
|
28
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_CONTENT_ENCODING_FLAG) { |
2351
|
16
|
|
|
|
|
|
if (UINT8_MAX < p->content_encoding.len || |
2352
|
8
|
|
|
|
|
|
!amqp_encode_8(encoded, &offset, |
2353
|
8
|
50
|
|
|
|
|
(uint8_t)p->content_encoding.len) || |
2354
|
8
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, p->content_encoding)) |
2355
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2356
|
|
|
|
|
|
|
} |
2357
|
28
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_HEADERS_FLAG) { |
2358
|
|
|
|
|
|
|
{ |
2359
|
9
|
|
|
|
|
|
int res = amqp_encode_table(encoded, &(p->headers), &offset); |
2360
|
9
|
50
|
|
|
|
|
if (res < 0) return res; |
2361
|
|
|
|
|
|
|
} |
2362
|
|
|
|
|
|
|
} |
2363
|
28
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_DELIVERY_MODE_FLAG) { |
2364
|
5
|
50
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, p->delivery_mode)) |
2365
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2366
|
|
|
|
|
|
|
} |
2367
|
28
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_PRIORITY_FLAG) { |
2368
|
5
|
50
|
|
|
|
|
if (!amqp_encode_8(encoded, &offset, p->priority)) |
2369
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2370
|
|
|
|
|
|
|
} |
2371
|
28
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_CORRELATION_ID_FLAG) { |
2372
|
10
|
|
|
|
|
|
if (UINT8_MAX < p->correlation_id.len || |
2373
|
10
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)p->correlation_id.len) || |
2374
|
5
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, p->correlation_id)) |
2375
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2376
|
|
|
|
|
|
|
} |
2377
|
28
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_REPLY_TO_FLAG) { |
2378
|
10
|
|
|
|
|
|
if (UINT8_MAX < p->reply_to.len || |
2379
|
10
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)p->reply_to.len) || |
2380
|
5
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, p->reply_to)) |
2381
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2382
|
|
|
|
|
|
|
} |
2383
|
28
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_EXPIRATION_FLAG) { |
2384
|
10
|
|
|
|
|
|
if (UINT8_MAX < p->expiration.len || |
2385
|
10
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)p->expiration.len) || |
2386
|
5
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, p->expiration)) |
2387
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2388
|
|
|
|
|
|
|
} |
2389
|
28
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_MESSAGE_ID_FLAG) { |
2390
|
10
|
|
|
|
|
|
if (UINT8_MAX < p->message_id.len || |
2391
|
10
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)p->message_id.len) || |
2392
|
5
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, p->message_id)) |
2393
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2394
|
|
|
|
|
|
|
} |
2395
|
28
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_TIMESTAMP_FLAG) { |
2396
|
5
|
50
|
|
|
|
|
if (!amqp_encode_64(encoded, &offset, p->timestamp)) |
2397
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2398
|
|
|
|
|
|
|
} |
2399
|
28
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_TYPE_FLAG) { |
2400
|
10
|
|
|
|
|
|
if (UINT8_MAX < p->type.len || |
2401
|
10
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)p->type.len) || |
2402
|
5
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, p->type)) |
2403
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2404
|
|
|
|
|
|
|
} |
2405
|
28
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_USER_ID_FLAG) { |
2406
|
10
|
|
|
|
|
|
if (UINT8_MAX < p->user_id.len || |
2407
|
10
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)p->user_id.len) || |
2408
|
5
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, p->user_id)) |
2409
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2410
|
|
|
|
|
|
|
} |
2411
|
28
|
100
|
|
|
|
|
if (flags & AMQP_BASIC_APP_ID_FLAG) { |
2412
|
10
|
|
|
|
|
|
if (UINT8_MAX < p->app_id.len || |
2413
|
10
|
50
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)p->app_id.len) || |
2414
|
5
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, p->app_id)) |
2415
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2416
|
|
|
|
|
|
|
} |
2417
|
28
|
50
|
|
|
|
|
if (flags & AMQP_BASIC_CLUSTER_ID_FLAG) { |
2418
|
0
|
|
|
|
|
|
if (UINT8_MAX < p->cluster_id.len || |
2419
|
0
|
0
|
|
|
|
|
!amqp_encode_8(encoded, &offset, (uint8_t)p->cluster_id.len) || |
2420
|
0
|
|
|
|
|
|
!amqp_encode_bytes(encoded, &offset, p->cluster_id)) |
2421
|
0
|
|
|
|
|
|
return AMQP_STATUS_BAD_AMQP_DATA; |
2422
|
|
|
|
|
|
|
} |
2423
|
28
|
|
|
|
|
|
return (int)offset; |
2424
|
|
|
|
|
|
|
} |
2425
|
|
|
|
|
|
|
case 90: { |
2426
|
0
|
|
|
|
|
|
return (int)offset; |
2427
|
|
|
|
|
|
|
} |
2428
|
|
|
|
|
|
|
case 85: { |
2429
|
0
|
|
|
|
|
|
return (int)offset; |
2430
|
|
|
|
|
|
|
} |
2431
|
|
|
|
|
|
|
default: |
2432
|
28
|
|
|
|
|
|
return AMQP_STATUS_UNKNOWN_CLASS; |
2433
|
|
|
|
|
|
|
} |
2434
|
|
|
|
|
|
|
} |
2435
|
|
|
|
|
|
|
|
2436
|
|
|
|
|
|
|
/** |
2437
|
|
|
|
|
|
|
* amqp_channel_open |
2438
|
|
|
|
|
|
|
* |
2439
|
|
|
|
|
|
|
* @param [in] state connection state |
2440
|
|
|
|
|
|
|
* @param [in] channel the channel to do the RPC on |
2441
|
|
|
|
|
|
|
* @returns amqp_channel_open_ok_t |
2442
|
|
|
|
|
|
|
*/ |
2443
|
|
|
|
|
|
|
AMQP_PUBLIC_FUNCTION |
2444
|
|
|
|
|
|
|
amqp_channel_open_ok_t *AMQP_CALL |
2445
|
36
|
|
|
|
|
|
amqp_channel_open(amqp_connection_state_t state, amqp_channel_t channel) { |
2446
|
|
|
|
|
|
|
amqp_channel_open_t req; |
2447
|
36
|
|
|
|
|
|
req.out_of_band = amqp_empty_bytes; |
2448
|
|
|
|
|
|
|
|
2449
|
36
|
|
|
|
|
|
return amqp_simple_rpc_decoded(state, channel, AMQP_CHANNEL_OPEN_METHOD, |
2450
|
|
|
|
|
|
|
AMQP_CHANNEL_OPEN_OK_METHOD, &req); |
2451
|
|
|
|
|
|
|
} |
2452
|
|
|
|
|
|
|
|
2453
|
|
|
|
|
|
|
/** |
2454
|
|
|
|
|
|
|
* amqp_channel_flow |
2455
|
|
|
|
|
|
|
* |
2456
|
|
|
|
|
|
|
* @param [in] state connection state |
2457
|
|
|
|
|
|
|
* @param [in] channel the channel to do the RPC on |
2458
|
|
|
|
|
|
|
* @param [in] active active |
2459
|
|
|
|
|
|
|
* @returns amqp_channel_flow_ok_t |
2460
|
|
|
|
|
|
|
*/ |
2461
|
|
|
|
|
|
|
AMQP_PUBLIC_FUNCTION |
2462
|
|
|
|
|
|
|
amqp_channel_flow_ok_t *AMQP_CALL |
2463
|
0
|
|
|
|
|
|
amqp_channel_flow(amqp_connection_state_t state, amqp_channel_t channel, |
2464
|
|
|
|
|
|
|
amqp_boolean_t active) { |
2465
|
|
|
|
|
|
|
amqp_channel_flow_t req; |
2466
|
0
|
|
|
|
|
|
req.active = active; |
2467
|
|
|
|
|
|
|
|
2468
|
0
|
|
|
|
|
|
return amqp_simple_rpc_decoded(state, channel, AMQP_CHANNEL_FLOW_METHOD, |
2469
|
|
|
|
|
|
|
AMQP_CHANNEL_FLOW_OK_METHOD, &req); |
2470
|
|
|
|
|
|
|
} |
2471
|
|
|
|
|
|
|
|
2472
|
|
|
|
|
|
|
/** |
2473
|
|
|
|
|
|
|
* amqp_exchange_declare |
2474
|
|
|
|
|
|
|
* |
2475
|
|
|
|
|
|
|
* @param [in] state connection state |
2476
|
|
|
|
|
|
|
* @param [in] channel the channel to do the RPC on |
2477
|
|
|
|
|
|
|
* @param [in] exchange exchange |
2478
|
|
|
|
|
|
|
* @param [in] type type |
2479
|
|
|
|
|
|
|
* @param [in] passive passive |
2480
|
|
|
|
|
|
|
* @param [in] durable durable |
2481
|
|
|
|
|
|
|
* @param [in] auto_delete auto_delete |
2482
|
|
|
|
|
|
|
* @param [in] internal internal |
2483
|
|
|
|
|
|
|
* @param [in] arguments arguments |
2484
|
|
|
|
|
|
|
* @returns amqp_exchange_declare_ok_t |
2485
|
|
|
|
|
|
|
*/ |
2486
|
|
|
|
|
|
|
AMQP_PUBLIC_FUNCTION |
2487
|
26
|
|
|
|
|
|
amqp_exchange_declare_ok_t *AMQP_CALL amqp_exchange_declare( |
2488
|
|
|
|
|
|
|
amqp_connection_state_t state, amqp_channel_t channel, |
2489
|
|
|
|
|
|
|
amqp_bytes_t exchange, amqp_bytes_t type, amqp_boolean_t passive, |
2490
|
|
|
|
|
|
|
amqp_boolean_t durable, amqp_boolean_t auto_delete, amqp_boolean_t internal, |
2491
|
|
|
|
|
|
|
amqp_table_t arguments) { |
2492
|
|
|
|
|
|
|
amqp_exchange_declare_t req; |
2493
|
26
|
|
|
|
|
|
req.ticket = 0; |
2494
|
26
|
|
|
|
|
|
req.exchange = exchange; |
2495
|
26
|
|
|
|
|
|
req.type = type; |
2496
|
26
|
|
|
|
|
|
req.passive = passive; |
2497
|
26
|
|
|
|
|
|
req.durable = durable; |
2498
|
26
|
|
|
|
|
|
req.auto_delete = auto_delete; |
2499
|
26
|
|
|
|
|
|
req.internal = internal; |
2500
|
26
|
|
|
|
|
|
req.nowait = 0; |
2501
|
26
|
|
|
|
|
|
req.arguments = arguments; |
2502
|
|
|
|
|
|
|
|
2503
|
26
|
|
|
|
|
|
return amqp_simple_rpc_decoded(state, channel, AMQP_EXCHANGE_DECLARE_METHOD, |
2504
|
|
|
|
|
|
|
AMQP_EXCHANGE_DECLARE_OK_METHOD, &req); |
2505
|
|
|
|
|
|
|
} |
2506
|
|
|
|
|
|
|
|
2507
|
|
|
|
|
|
|
/** |
2508
|
|
|
|
|
|
|
* amqp_exchange_delete |
2509
|
|
|
|
|
|
|
* |
2510
|
|
|
|
|
|
|
* @param [in] state connection state |
2511
|
|
|
|
|
|
|
* @param [in] channel the channel to do the RPC on |
2512
|
|
|
|
|
|
|
* @param [in] exchange exchange |
2513
|
|
|
|
|
|
|
* @param [in] if_unused if_unused |
2514
|
|
|
|
|
|
|
* @returns amqp_exchange_delete_ok_t |
2515
|
|
|
|
|
|
|
*/ |
2516
|
|
|
|
|
|
|
AMQP_PUBLIC_FUNCTION |
2517
|
|
|
|
|
|
|
amqp_exchange_delete_ok_t *AMQP_CALL |
2518
|
27
|
|
|
|
|
|
amqp_exchange_delete(amqp_connection_state_t state, amqp_channel_t channel, |
2519
|
|
|
|
|
|
|
amqp_bytes_t exchange, amqp_boolean_t if_unused) { |
2520
|
|
|
|
|
|
|
amqp_exchange_delete_t req; |
2521
|
27
|
|
|
|
|
|
req.ticket = 0; |
2522
|
27
|
|
|
|
|
|
req.exchange = exchange; |
2523
|
27
|
|
|
|
|
|
req.if_unused = if_unused; |
2524
|
27
|
|
|
|
|
|
req.nowait = 0; |
2525
|
|
|
|
|
|
|
|
2526
|
27
|
|
|
|
|
|
return amqp_simple_rpc_decoded(state, channel, AMQP_EXCHANGE_DELETE_METHOD, |
2527
|
|
|
|
|
|
|
AMQP_EXCHANGE_DELETE_OK_METHOD, &req); |
2528
|
|
|
|
|
|
|
} |
2529
|
|
|
|
|
|
|
|
2530
|
|
|
|
|
|
|
/** |
2531
|
|
|
|
|
|
|
* amqp_exchange_bind |
2532
|
|
|
|
|
|
|
* |
2533
|
|
|
|
|
|
|
* @param [in] state connection state |
2534
|
|
|
|
|
|
|
* @param [in] channel the channel to do the RPC on |
2535
|
|
|
|
|
|
|
* @param [in] destination destination |
2536
|
|
|
|
|
|
|
* @param [in] source source |
2537
|
|
|
|
|
|
|
* @param [in] routing_key routing_key |
2538
|
|
|
|
|
|
|
* @param [in] arguments arguments |
2539
|
|
|
|
|
|
|
* @returns amqp_exchange_bind_ok_t |
2540
|
|
|
|
|
|
|
*/ |
2541
|
|
|
|
|
|
|
AMQP_PUBLIC_FUNCTION |
2542
|
|
|
|
|
|
|
amqp_exchange_bind_ok_t *AMQP_CALL |
2543
|
1
|
|
|
|
|
|
amqp_exchange_bind(amqp_connection_state_t state, amqp_channel_t channel, |
2544
|
|
|
|
|
|
|
amqp_bytes_t destination, amqp_bytes_t source, |
2545
|
|
|
|
|
|
|
amqp_bytes_t routing_key, amqp_table_t arguments) { |
2546
|
|
|
|
|
|
|
amqp_exchange_bind_t req; |
2547
|
1
|
|
|
|
|
|
req.ticket = 0; |
2548
|
1
|
|
|
|
|
|
req.destination = destination; |
2549
|
1
|
|
|
|
|
|
req.source = source; |
2550
|
1
|
|
|
|
|
|
req.routing_key = routing_key; |
2551
|
1
|
|
|
|
|
|
req.nowait = 0; |
2552
|
1
|
|
|
|
|
|
req.arguments = arguments; |
2553
|
|
|
|
|
|
|
|
2554
|
1
|
|
|
|
|
|
return amqp_simple_rpc_decoded(state, channel, AMQP_EXCHANGE_BIND_METHOD, |
2555
|
|
|
|
|
|
|
AMQP_EXCHANGE_BIND_OK_METHOD, &req); |
2556
|
|
|
|
|
|
|
} |
2557
|
|
|
|
|
|
|
|
2558
|
|
|
|
|
|
|
/** |
2559
|
|
|
|
|
|
|
* amqp_exchange_unbind |
2560
|
|
|
|
|
|
|
* |
2561
|
|
|
|
|
|
|
* @param [in] state connection state |
2562
|
|
|
|
|
|
|
* @param [in] channel the channel to do the RPC on |
2563
|
|
|
|
|
|
|
* @param [in] destination destination |
2564
|
|
|
|
|
|
|
* @param [in] source source |
2565
|
|
|
|
|
|
|
* @param [in] routing_key routing_key |
2566
|
|
|
|
|
|
|
* @param [in] arguments arguments |
2567
|
|
|
|
|
|
|
* @returns amqp_exchange_unbind_ok_t |
2568
|
|
|
|
|
|
|
*/ |
2569
|
|
|
|
|
|
|
AMQP_PUBLIC_FUNCTION |
2570
|
|
|
|
|
|
|
amqp_exchange_unbind_ok_t *AMQP_CALL |
2571
|
1
|
|
|
|
|
|
amqp_exchange_unbind(amqp_connection_state_t state, amqp_channel_t channel, |
2572
|
|
|
|
|
|
|
amqp_bytes_t destination, amqp_bytes_t source, |
2573
|
|
|
|
|
|
|
amqp_bytes_t routing_key, amqp_table_t arguments) { |
2574
|
|
|
|
|
|
|
amqp_exchange_unbind_t req; |
2575
|
1
|
|
|
|
|
|
req.ticket = 0; |
2576
|
1
|
|
|
|
|
|
req.destination = destination; |
2577
|
1
|
|
|
|
|
|
req.source = source; |
2578
|
1
|
|
|
|
|
|
req.routing_key = routing_key; |
2579
|
1
|
|
|
|
|
|
req.nowait = 0; |
2580
|
1
|
|
|
|
|
|
req.arguments = arguments; |
2581
|
|
|
|
|
|
|
|
2582
|
1
|
|
|
|
|
|
return amqp_simple_rpc_decoded(state, channel, AMQP_EXCHANGE_UNBIND_METHOD, |
2583
|
|
|
|
|
|
|
AMQP_EXCHANGE_UNBIND_OK_METHOD, &req); |
2584
|
|
|
|
|
|
|
} |
2585
|
|
|
|
|
|
|
|
2586
|
|
|
|
|
|
|
/** |
2587
|
|
|
|
|
|
|
* amqp_queue_declare |
2588
|
|
|
|
|
|
|
* |
2589
|
|
|
|
|
|
|
* @param [in] state connection state |
2590
|
|
|
|
|
|
|
* @param [in] channel the channel to do the RPC on |
2591
|
|
|
|
|
|
|
* @param [in] queue queue |
2592
|
|
|
|
|
|
|
* @param [in] passive passive |
2593
|
|
|
|
|
|
|
* @param [in] durable durable |
2594
|
|
|
|
|
|
|
* @param [in] exclusive exclusive |
2595
|
|
|
|
|
|
|
* @param [in] auto_delete auto_delete |
2596
|
|
|
|
|
|
|
* @param [in] arguments arguments |
2597
|
|
|
|
|
|
|
* @returns amqp_queue_declare_ok_t |
2598
|
|
|
|
|
|
|
*/ |
2599
|
|
|
|
|
|
|
AMQP_PUBLIC_FUNCTION |
2600
|
20
|
|
|
|
|
|
amqp_queue_declare_ok_t *AMQP_CALL amqp_queue_declare( |
2601
|
|
|
|
|
|
|
amqp_connection_state_t state, amqp_channel_t channel, amqp_bytes_t queue, |
2602
|
|
|
|
|
|
|
amqp_boolean_t passive, amqp_boolean_t durable, amqp_boolean_t exclusive, |
2603
|
|
|
|
|
|
|
amqp_boolean_t auto_delete, amqp_table_t arguments) { |
2604
|
|
|
|
|
|
|
amqp_queue_declare_t req; |
2605
|
20
|
|
|
|
|
|
req.ticket = 0; |
2606
|
20
|
|
|
|
|
|
req.queue = queue; |
2607
|
20
|
|
|
|
|
|
req.passive = passive; |
2608
|
20
|
|
|
|
|
|
req.durable = durable; |
2609
|
20
|
|
|
|
|
|
req.exclusive = exclusive; |
2610
|
20
|
|
|
|
|
|
req.auto_delete = auto_delete; |
2611
|
20
|
|
|
|
|
|
req.nowait = 0; |
2612
|
20
|
|
|
|
|
|
req.arguments = arguments; |
2613
|
|
|
|
|
|
|
|
2614
|
20
|
|
|
|
|
|
return amqp_simple_rpc_decoded(state, channel, AMQP_QUEUE_DECLARE_METHOD, |
2615
|
|
|
|
|
|
|
AMQP_QUEUE_DECLARE_OK_METHOD, &req); |
2616
|
|
|
|
|
|
|
} |
2617
|
|
|
|
|
|
|
|
2618
|
|
|
|
|
|
|
/** |
2619
|
|
|
|
|
|
|
* amqp_queue_bind |
2620
|
|
|
|
|
|
|
* |
2621
|
|
|
|
|
|
|
* @param [in] state connection state |
2622
|
|
|
|
|
|
|
* @param [in] channel the channel to do the RPC on |
2623
|
|
|
|
|
|
|
* @param [in] queue queue |
2624
|
|
|
|
|
|
|
* @param [in] exchange exchange |
2625
|
|
|
|
|
|
|
* @param [in] routing_key routing_key |
2626
|
|
|
|
|
|
|
* @param [in] arguments arguments |
2627
|
|
|
|
|
|
|
* @returns amqp_queue_bind_ok_t |
2628
|
|
|
|
|
|
|
*/ |
2629
|
|
|
|
|
|
|
AMQP_PUBLIC_FUNCTION |
2630
|
18
|
|
|
|
|
|
amqp_queue_bind_ok_t *AMQP_CALL amqp_queue_bind( |
2631
|
|
|
|
|
|
|
amqp_connection_state_t state, amqp_channel_t channel, amqp_bytes_t queue, |
2632
|
|
|
|
|
|
|
amqp_bytes_t exchange, amqp_bytes_t routing_key, amqp_table_t arguments) { |
2633
|
|
|
|
|
|
|
amqp_queue_bind_t req; |
2634
|
18
|
|
|
|
|
|
req.ticket = 0; |
2635
|
18
|
|
|
|
|
|
req.queue = queue; |
2636
|
18
|
|
|
|
|
|
req.exchange = exchange; |
2637
|
18
|
|
|
|
|
|
req.routing_key = routing_key; |
2638
|
18
|
|
|
|
|
|
req.nowait = 0; |
2639
|
18
|
|
|
|
|
|
req.arguments = arguments; |
2640
|
|
|
|
|
|
|
|
2641
|
18
|
|
|
|
|
|
return amqp_simple_rpc_decoded(state, channel, AMQP_QUEUE_BIND_METHOD, |
2642
|
|
|
|
|
|
|
AMQP_QUEUE_BIND_OK_METHOD, &req); |
2643
|
|
|
|
|
|
|
} |
2644
|
|
|
|
|
|
|
|
2645
|
|
|
|
|
|
|
/** |
2646
|
|
|
|
|
|
|
* amqp_queue_purge |
2647
|
|
|
|
|
|
|
* |
2648
|
|
|
|
|
|
|
* @param [in] state connection state |
2649
|
|
|
|
|
|
|
* @param [in] channel the channel to do the RPC on |
2650
|
|
|
|
|
|
|
* @param [in] queue queue |
2651
|
|
|
|
|
|
|
* @returns amqp_queue_purge_ok_t |
2652
|
|
|
|
|
|
|
*/ |
2653
|
|
|
|
|
|
|
AMQP_PUBLIC_FUNCTION |
2654
|
19
|
|
|
|
|
|
amqp_queue_purge_ok_t *AMQP_CALL amqp_queue_purge(amqp_connection_state_t state, |
2655
|
|
|
|
|
|
|
amqp_channel_t channel, |
2656
|
|
|
|
|
|
|
amqp_bytes_t queue) { |
2657
|
|
|
|
|
|
|
amqp_queue_purge_t req; |
2658
|
19
|
|
|
|
|
|
req.ticket = 0; |
2659
|
19
|
|
|
|
|
|
req.queue = queue; |
2660
|
19
|
|
|
|
|
|
req.nowait = 0; |
2661
|
|
|
|
|
|
|
|
2662
|
19
|
|
|
|
|
|
return amqp_simple_rpc_decoded(state, channel, AMQP_QUEUE_PURGE_METHOD, |
2663
|
|
|
|
|
|
|
AMQP_QUEUE_PURGE_OK_METHOD, &req); |
2664
|
|
|
|
|
|
|
} |
2665
|
|
|
|
|
|
|
|
2666
|
|
|
|
|
|
|
/** |
2667
|
|
|
|
|
|
|
* amqp_queue_delete |
2668
|
|
|
|
|
|
|
* |
2669
|
|
|
|
|
|
|
* @param [in] state connection state |
2670
|
|
|
|
|
|
|
* @param [in] channel the channel to do the RPC on |
2671
|
|
|
|
|
|
|
* @param [in] queue queue |
2672
|
|
|
|
|
|
|
* @param [in] if_unused if_unused |
2673
|
|
|
|
|
|
|
* @param [in] if_empty if_empty |
2674
|
|
|
|
|
|
|
* @returns amqp_queue_delete_ok_t |
2675
|
|
|
|
|
|
|
*/ |
2676
|
|
|
|
|
|
|
AMQP_PUBLIC_FUNCTION |
2677
|
20
|
|
|
|
|
|
amqp_queue_delete_ok_t *AMQP_CALL amqp_queue_delete( |
2678
|
|
|
|
|
|
|
amqp_connection_state_t state, amqp_channel_t channel, amqp_bytes_t queue, |
2679
|
|
|
|
|
|
|
amqp_boolean_t if_unused, amqp_boolean_t if_empty) { |
2680
|
|
|
|
|
|
|
amqp_queue_delete_t req; |
2681
|
20
|
|
|
|
|
|
req.ticket = 0; |
2682
|
20
|
|
|
|
|
|
req.queue = queue; |
2683
|
20
|
|
|
|
|
|
req.if_unused = if_unused; |
2684
|
20
|
|
|
|
|
|
req.if_empty = if_empty; |
2685
|
20
|
|
|
|
|
|
req.nowait = 0; |
2686
|
|
|
|
|
|
|
|
2687
|
20
|
|
|
|
|
|
return amqp_simple_rpc_decoded(state, channel, AMQP_QUEUE_DELETE_METHOD, |
2688
|
|
|
|
|
|
|
AMQP_QUEUE_DELETE_OK_METHOD, &req); |
2689
|
|
|
|
|
|
|
} |
2690
|
|
|
|
|
|
|
|
2691
|
|
|
|
|
|
|
/** |
2692
|
|
|
|
|
|
|
* amqp_queue_unbind |
2693
|
|
|
|
|
|
|
* |
2694
|
|
|
|
|
|
|
* @param [in] state connection state |
2695
|
|
|
|
|
|
|
* @param [in] channel the channel to do the RPC on |
2696
|
|
|
|
|
|
|
* @param [in] queue queue |
2697
|
|
|
|
|
|
|
* @param [in] exchange exchange |
2698
|
|
|
|
|
|
|
* @param [in] routing_key routing_key |
2699
|
|
|
|
|
|
|
* @param [in] arguments arguments |
2700
|
|
|
|
|
|
|
* @returns amqp_queue_unbind_ok_t |
2701
|
|
|
|
|
|
|
*/ |
2702
|
|
|
|
|
|
|
AMQP_PUBLIC_FUNCTION |
2703
|
21
|
|
|
|
|
|
amqp_queue_unbind_ok_t *AMQP_CALL amqp_queue_unbind( |
2704
|
|
|
|
|
|
|
amqp_connection_state_t state, amqp_channel_t channel, amqp_bytes_t queue, |
2705
|
|
|
|
|
|
|
amqp_bytes_t exchange, amqp_bytes_t routing_key, amqp_table_t arguments) { |
2706
|
|
|
|
|
|
|
amqp_queue_unbind_t req; |
2707
|
21
|
|
|
|
|
|
req.ticket = 0; |
2708
|
21
|
|
|
|
|
|
req.queue = queue; |
2709
|
21
|
|
|
|
|
|
req.exchange = exchange; |
2710
|
21
|
|
|
|
|
|
req.routing_key = routing_key; |
2711
|
21
|
|
|
|
|
|
req.arguments = arguments; |
2712
|
|
|
|
|
|
|
|
2713
|
21
|
|
|
|
|
|
return amqp_simple_rpc_decoded(state, channel, AMQP_QUEUE_UNBIND_METHOD, |
2714
|
|
|
|
|
|
|
AMQP_QUEUE_UNBIND_OK_METHOD, &req); |
2715
|
|
|
|
|
|
|
} |
2716
|
|
|
|
|
|
|
|
2717
|
|
|
|
|
|
|
/** |
2718
|
|
|
|
|
|
|
* amqp_basic_qos |
2719
|
|
|
|
|
|
|
* |
2720
|
|
|
|
|
|
|
* @param [in] state connection state |
2721
|
|
|
|
|
|
|
* @param [in] channel the channel to do the RPC on |
2722
|
|
|
|
|
|
|
* @param [in] prefetch_size prefetch_size |
2723
|
|
|
|
|
|
|
* @param [in] prefetch_count prefetch_count |
2724
|
|
|
|
|
|
|
* @param [in] global global |
2725
|
|
|
|
|
|
|
* @returns amqp_basic_qos_ok_t |
2726
|
|
|
|
|
|
|
*/ |
2727
|
|
|
|
|
|
|
AMQP_PUBLIC_FUNCTION |
2728
|
1
|
|
|
|
|
|
amqp_basic_qos_ok_t *AMQP_CALL amqp_basic_qos(amqp_connection_state_t state, |
2729
|
|
|
|
|
|
|
amqp_channel_t channel, |
2730
|
|
|
|
|
|
|
uint32_t prefetch_size, |
2731
|
|
|
|
|
|
|
uint16_t prefetch_count, |
2732
|
|
|
|
|
|
|
amqp_boolean_t global) { |
2733
|
|
|
|
|
|
|
amqp_basic_qos_t req; |
2734
|
1
|
|
|
|
|
|
req.prefetch_size = prefetch_size; |
2735
|
1
|
|
|
|
|
|
req.prefetch_count = prefetch_count; |
2736
|
1
|
|
|
|
|
|
req.global = global; |
2737
|
|
|
|
|
|
|
|
2738
|
1
|
|
|
|
|
|
return amqp_simple_rpc_decoded(state, channel, AMQP_BASIC_QOS_METHOD, |
2739
|
|
|
|
|
|
|
AMQP_BASIC_QOS_OK_METHOD, &req); |
2740
|
|
|
|
|
|
|
} |
2741
|
|
|
|
|
|
|
|
2742
|
|
|
|
|
|
|
/** |
2743
|
|
|
|
|
|
|
* amqp_basic_consume |
2744
|
|
|
|
|
|
|
* |
2745
|
|
|
|
|
|
|
* @param [in] state connection state |
2746
|
|
|
|
|
|
|
* @param [in] channel the channel to do the RPC on |
2747
|
|
|
|
|
|
|
* @param [in] queue queue |
2748
|
|
|
|
|
|
|
* @param [in] consumer_tag consumer_tag |
2749
|
|
|
|
|
|
|
* @param [in] no_local no_local |
2750
|
|
|
|
|
|
|
* @param [in] no_ack no_ack |
2751
|
|
|
|
|
|
|
* @param [in] exclusive exclusive |
2752
|
|
|
|
|
|
|
* @param [in] arguments arguments |
2753
|
|
|
|
|
|
|
* @returns amqp_basic_consume_ok_t |
2754
|
|
|
|
|
|
|
*/ |
2755
|
|
|
|
|
|
|
AMQP_PUBLIC_FUNCTION |
2756
|
16
|
|
|
|
|
|
amqp_basic_consume_ok_t *AMQP_CALL amqp_basic_consume( |
2757
|
|
|
|
|
|
|
amqp_connection_state_t state, amqp_channel_t channel, amqp_bytes_t queue, |
2758
|
|
|
|
|
|
|
amqp_bytes_t consumer_tag, amqp_boolean_t no_local, amqp_boolean_t no_ack, |
2759
|
|
|
|
|
|
|
amqp_boolean_t exclusive, amqp_table_t arguments) { |
2760
|
|
|
|
|
|
|
amqp_basic_consume_t req; |
2761
|
16
|
|
|
|
|
|
req.ticket = 0; |
2762
|
16
|
|
|
|
|
|
req.queue = queue; |
2763
|
16
|
|
|
|
|
|
req.consumer_tag = consumer_tag; |
2764
|
16
|
|
|
|
|
|
req.no_local = no_local; |
2765
|
16
|
|
|
|
|
|
req.no_ack = no_ack; |
2766
|
16
|
|
|
|
|
|
req.exclusive = exclusive; |
2767
|
16
|
|
|
|
|
|
req.nowait = 0; |
2768
|
16
|
|
|
|
|
|
req.arguments = arguments; |
2769
|
|
|
|
|
|
|
|
2770
|
16
|
|
|
|
|
|
return amqp_simple_rpc_decoded(state, channel, AMQP_BASIC_CONSUME_METHOD, |
2771
|
|
|
|
|
|
|
AMQP_BASIC_CONSUME_OK_METHOD, &req); |
2772
|
|
|
|
|
|
|
} |
2773
|
|
|
|
|
|
|
|
2774
|
|
|
|
|
|
|
/** |
2775
|
|
|
|
|
|
|
* amqp_basic_cancel |
2776
|
|
|
|
|
|
|
* |
2777
|
|
|
|
|
|
|
* @param [in] state connection state |
2778
|
|
|
|
|
|
|
* @param [in] channel the channel to do the RPC on |
2779
|
|
|
|
|
|
|
* @param [in] consumer_tag consumer_tag |
2780
|
|
|
|
|
|
|
* @returns amqp_basic_cancel_ok_t |
2781
|
|
|
|
|
|
|
*/ |
2782
|
|
|
|
|
|
|
AMQP_PUBLIC_FUNCTION |
2783
|
|
|
|
|
|
|
amqp_basic_cancel_ok_t *AMQP_CALL |
2784
|
2
|
|
|
|
|
|
amqp_basic_cancel(amqp_connection_state_t state, amqp_channel_t channel, |
2785
|
|
|
|
|
|
|
amqp_bytes_t consumer_tag) { |
2786
|
|
|
|
|
|
|
amqp_basic_cancel_t req; |
2787
|
2
|
|
|
|
|
|
req.consumer_tag = consumer_tag; |
2788
|
2
|
|
|
|
|
|
req.nowait = 0; |
2789
|
|
|
|
|
|
|
|
2790
|
2
|
|
|
|
|
|
return amqp_simple_rpc_decoded(state, channel, AMQP_BASIC_CANCEL_METHOD, |
2791
|
|
|
|
|
|
|
AMQP_BASIC_CANCEL_OK_METHOD, &req); |
2792
|
|
|
|
|
|
|
} |
2793
|
|
|
|
|
|
|
|
2794
|
|
|
|
|
|
|
/** |
2795
|
|
|
|
|
|
|
* amqp_basic_recover |
2796
|
|
|
|
|
|
|
* |
2797
|
|
|
|
|
|
|
* @param [in] state connection state |
2798
|
|
|
|
|
|
|
* @param [in] channel the channel to do the RPC on |
2799
|
|
|
|
|
|
|
* @param [in] requeue requeue |
2800
|
|
|
|
|
|
|
* @returns amqp_basic_recover_ok_t |
2801
|
|
|
|
|
|
|
*/ |
2802
|
|
|
|
|
|
|
AMQP_PUBLIC_FUNCTION |
2803
|
|
|
|
|
|
|
amqp_basic_recover_ok_t *AMQP_CALL |
2804
|
0
|
|
|
|
|
|
amqp_basic_recover(amqp_connection_state_t state, amqp_channel_t channel, |
2805
|
|
|
|
|
|
|
amqp_boolean_t requeue) { |
2806
|
|
|
|
|
|
|
amqp_basic_recover_t req; |
2807
|
0
|
|
|
|
|
|
req.requeue = requeue; |
2808
|
|
|
|
|
|
|
|
2809
|
0
|
|
|
|
|
|
return amqp_simple_rpc_decoded(state, channel, AMQP_BASIC_RECOVER_METHOD, |
2810
|
|
|
|
|
|
|
AMQP_BASIC_RECOVER_OK_METHOD, &req); |
2811
|
|
|
|
|
|
|
} |
2812
|
|
|
|
|
|
|
|
2813
|
|
|
|
|
|
|
/** |
2814
|
|
|
|
|
|
|
* amqp_tx_select |
2815
|
|
|
|
|
|
|
* |
2816
|
|
|
|
|
|
|
* @param [in] state connection state |
2817
|
|
|
|
|
|
|
* @param [in] channel the channel to do the RPC on |
2818
|
|
|
|
|
|
|
* @returns amqp_tx_select_ok_t |
2819
|
|
|
|
|
|
|
*/ |
2820
|
|
|
|
|
|
|
AMQP_PUBLIC_FUNCTION |
2821
|
1
|
|
|
|
|
|
amqp_tx_select_ok_t *AMQP_CALL amqp_tx_select(amqp_connection_state_t state, |
2822
|
|
|
|
|
|
|
amqp_channel_t channel) { |
2823
|
|
|
|
|
|
|
amqp_tx_select_t req; |
2824
|
|
|
|
|
|
|
|
2825
|
1
|
|
|
|
|
|
return amqp_simple_rpc_decoded(state, channel, AMQP_TX_SELECT_METHOD, |
2826
|
|
|
|
|
|
|
AMQP_TX_SELECT_OK_METHOD, &req); |
2827
|
|
|
|
|
|
|
} |
2828
|
|
|
|
|
|
|
|
2829
|
|
|
|
|
|
|
/** |
2830
|
|
|
|
|
|
|
* amqp_tx_commit |
2831
|
|
|
|
|
|
|
* |
2832
|
|
|
|
|
|
|
* @param [in] state connection state |
2833
|
|
|
|
|
|
|
* @param [in] channel the channel to do the RPC on |
2834
|
|
|
|
|
|
|
* @returns amqp_tx_commit_ok_t |
2835
|
|
|
|
|
|
|
*/ |
2836
|
|
|
|
|
|
|
AMQP_PUBLIC_FUNCTION |
2837
|
1
|
|
|
|
|
|
amqp_tx_commit_ok_t *AMQP_CALL amqp_tx_commit(amqp_connection_state_t state, |
2838
|
|
|
|
|
|
|
amqp_channel_t channel) { |
2839
|
|
|
|
|
|
|
amqp_tx_commit_t req; |
2840
|
|
|
|
|
|
|
|
2841
|
1
|
|
|
|
|
|
return amqp_simple_rpc_decoded(state, channel, AMQP_TX_COMMIT_METHOD, |
2842
|
|
|
|
|
|
|
AMQP_TX_COMMIT_OK_METHOD, &req); |
2843
|
|
|
|
|
|
|
} |
2844
|
|
|
|
|
|
|
|
2845
|
|
|
|
|
|
|
/** |
2846
|
|
|
|
|
|
|
* amqp_tx_rollback |
2847
|
|
|
|
|
|
|
* |
2848
|
|
|
|
|
|
|
* @param [in] state connection state |
2849
|
|
|
|
|
|
|
* @param [in] channel the channel to do the RPC on |
2850
|
|
|
|
|
|
|
* @returns amqp_tx_rollback_ok_t |
2851
|
|
|
|
|
|
|
*/ |
2852
|
|
|
|
|
|
|
AMQP_PUBLIC_FUNCTION |
2853
|
1
|
|
|
|
|
|
amqp_tx_rollback_ok_t *AMQP_CALL amqp_tx_rollback(amqp_connection_state_t state, |
2854
|
|
|
|
|
|
|
amqp_channel_t channel) { |
2855
|
|
|
|
|
|
|
amqp_tx_rollback_t req; |
2856
|
|
|
|
|
|
|
|
2857
|
1
|
|
|
|
|
|
return amqp_simple_rpc_decoded(state, channel, AMQP_TX_ROLLBACK_METHOD, |
2858
|
|
|
|
|
|
|
AMQP_TX_ROLLBACK_OK_METHOD, &req); |
2859
|
|
|
|
|
|
|
} |
2860
|
|
|
|
|
|
|
|
2861
|
|
|
|
|
|
|
/** |
2862
|
|
|
|
|
|
|
* amqp_confirm_select |
2863
|
|
|
|
|
|
|
* |
2864
|
|
|
|
|
|
|
* @param [in] state connection state |
2865
|
|
|
|
|
|
|
* @param [in] channel the channel to do the RPC on |
2866
|
|
|
|
|
|
|
* @returns amqp_confirm_select_ok_t |
2867
|
|
|
|
|
|
|
*/ |
2868
|
|
|
|
|
|
|
AMQP_PUBLIC_FUNCTION |
2869
|
|
|
|
|
|
|
amqp_confirm_select_ok_t *AMQP_CALL |
2870
|
0
|
|
|
|
|
|
amqp_confirm_select(amqp_connection_state_t state, amqp_channel_t channel) { |
2871
|
|
|
|
|
|
|
amqp_confirm_select_t req; |
2872
|
0
|
|
|
|
|
|
req.nowait = 0; |
2873
|
|
|
|
|
|
|
|
2874
|
0
|
|
|
|
|
|
return amqp_simple_rpc_decoded(state, channel, AMQP_CONFIRM_SELECT_METHOD, |
2875
|
|
|
|
|
|
|
AMQP_CONFIRM_SELECT_OK_METHOD, &req); |
2876
|
|
|
|
|
|
|
} |