rabbitmq-c  0.8.0
C AMQP Client library for RabbitMQ
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
amqp.h
Go to the documentation of this file.
1 /* vim:set ft=c ts=2 sw=2 sts=2 et cindent: */
3 /*
4  * ***** BEGIN LICENSE BLOCK *****
5  * Version: MIT
6  *
7  * Portions created by Alan Antonuk are Copyright (c) 2012-2014
8  * Alan Antonuk. All Rights Reserved.
9  *
10  * Portions created by VMware are Copyright (c) 2007-2012 VMware, Inc.
11  * All Rights Reserved.
12  *
13  * Portions created by Tony Garnock-Jones are Copyright (c) 2009-2010
14  * VMware, Inc. and Tony Garnock-Jones. All Rights Reserved.
15  *
16  * Permission is hereby granted, free of charge, to any person
17  * obtaining a copy of this software and associated documentation
18  * files (the "Software"), to deal in the Software without
19  * restriction, including without limitation the rights to use, copy,
20  * modify, merge, publish, distribute, sublicense, and/or sell copies
21  * of the Software, and to permit persons to whom the Software is
22  * furnished to do so, subject to the following conditions:
23  *
24  * The above copyright notice and this permission notice shall be
25  * included in all copies or substantial portions of the Software.
26  *
27  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
31  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
32  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
33  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34  * SOFTWARE.
35  * ***** END LICENSE BLOCK *****
36  */
37 
38 #ifndef AMQP_H
39 #define AMQP_H
40 
43 #ifdef __cplusplus
44 #define AMQP_BEGIN_DECLS extern "C" {
45 #define AMQP_END_DECLS }
46 #else
47 #define AMQP_BEGIN_DECLS
48 #define AMQP_END_DECLS
49 #endif
50 
51 /*
52  * \internal
53  * Important API decorators:
54  * AMQP_PUBLIC_FUNCTION - a public API function
55  * AMQP_PUBLIC_VARIABLE - a public API external variable
56  * AMQP_CALL - calling convension (used on Win32)
57  */
58 
59 #if defined(_WIN32) && defined(_MSC_VER)
60 # if defined(AMQP_BUILD) && !defined(AMQP_STATIC)
61 # define AMQP_PUBLIC_FUNCTION __declspec(dllexport)
62 # define AMQP_PUBLIC_VARIABLE __declspec(dllexport) extern
63 # else
64 # define AMQP_PUBLIC_FUNCTION
65 # if !defined(AMQP_STATIC)
66 # define AMQP_PUBLIC_VARIABLE __declspec(dllimport) extern
67 # else
68 # define AMQP_PUBLIC_VARIABLE extern
69 # endif
70 # endif
71 # define AMQP_CALL __cdecl
72 
73 #elif defined(_WIN32) && defined(__BORLANDC__)
74 # if defined(AMQP_BUILD) && !defined(AMQP_STATIC)
75 # define AMQP_PUBLIC_FUNCTION __declspec(dllexport)
76 # define AMQP_PUBLIC_VARIABLE __declspec(dllexport) extern
77 # else
78 # define AMQP_PUBLIC_FUNCTION
79 # if !defined(AMQP_STATIC)
80 # define AMQP_PUBLIC_VARIABLE __declspec(dllimport) extern
81 # else
82 # define AMQP_PUBLIC_VARIABLE extern
83 # endif
84 # endif
85 # define AMQP_CALL __cdecl
86 
87 #elif defined(_WIN32) && defined(__MINGW32__)
88 # if defined(AMQP_BUILD) && !defined(AMQP_STATIC)
89 # define AMQP_PUBLIC_FUNCTION __declspec(dllexport)
90 # define AMQP_PUBLIC_VARIABLE __declspec(dllexport) extern
91 # else
92 # define AMQP_PUBLIC_FUNCTION
93 # if !defined(AMQP_STATIC)
94 # define AMQP_PUBLIC_VARIABLE __declspec(dllimport) extern
95 # else
96 # define AMQP_PUBLIC_VARIABLE extern
97 # endif
98 # endif
99 # define AMQP_CALL __cdecl
100 
101 #elif defined(_WIN32) && defined(__CYGWIN__)
102 # if defined(AMQP_BUILD) && !defined(AMQP_STATIC)
103 # define AMQP_PUBLIC_FUNCTION __declspec(dllexport)
104 # define AMQP_PUBLIC_VARIABLE __declspec(dllexport)
105 # else
106 # define AMQP_PUBLIC_FUNCTION
107 # if !defined(AMQP_STATIC)
108 # define AMQP_PUBLIC_VARIABLE __declspec(dllimport) extern
109 # else
110 # define AMQP_PUBLIC_VARIABLE extern
111 # endif
112 # endif
113 # define AMQP_CALL __cdecl
114 
115 #elif defined(__GNUC__) && __GNUC__ >= 4
116 # define AMQP_PUBLIC_FUNCTION \
117  __attribute__ ((visibility ("default")))
118 # define AMQP_PUBLIC_VARIABLE \
119  __attribute__ ((visibility ("default"))) extern
120 # define AMQP_CALL
121 #else
122 # define AMQP_PUBLIC_FUNCTION
123 # define AMQP_PUBLIC_VARIABLE extern
124 # define AMQP_CALL
125 #endif
126 
127 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
128 # define AMQP_DEPRECATED(function) \
129  function __attribute__ ((__deprecated__))
130 #elif defined(_MSC_VER)
131 # define AMQP_DEPRECATED(function) \
132  __declspec(deprecated) function
133 #else
134 # define AMQP_DEPRECATED(function)
135 #endif
136 
137 /* Define ssize_t on Win32/64 platforms
138  See: http://lists.cs.uiuc.edu/pipermail/llvmdev/2010-April/030649.html for details
139  */
140 #if !defined(_W64)
141 #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
142 #define _W64 __w64
143 #else
144 #define _W64
145 #endif
146 #endif
147 
148 #ifdef _MSC_VER
149 #ifdef _WIN64
150 typedef __int64 ssize_t;
151 #else
152 typedef _W64 int ssize_t;
153 #endif
154 #endif
155 
156 #if defined(_WIN32) && defined(__MINGW32__)
157 #include <sys/types.h>
158 #endif
159 
162 #include <stddef.h>
163 #include <stdint.h>
164 
165 struct timeval;
166 
167 AMQP_BEGIN_DECLS
168 
220 /*
221  * Developer note: when changing these, be sure to update SOVERSION constants
222  * in CMakeLists.txt and configure.ac
223  */
224 
225 #define AMQP_VERSION_MAJOR 0
226 #define AMQP_VERSION_MINOR 8
227 #define AMQP_VERSION_PATCH 0
228 #define AMQP_VERSION_IS_RELEASE 1
229 
230 
242 #define AMQP_VERSION_CODE(major, minor, patch, release) \
243  ((major << 24) | \
244  (minor << 16) | \
245  (patch << 8) | \
246  (release))
247 
248 
267 #define AMQP_VERSION AMQP_VERSION_CODE(AMQP_VERSION_MAJOR, \
268  AMQP_VERSION_MINOR, \
269  AMQP_VERSION_PATCH, \
270  AMQP_VERSION_IS_RELEASE)
271 
273 #define AMQ_STRINGIFY(s) AMQ_STRINGIFY_HELPER(s)
274 #define AMQ_STRINGIFY_HELPER(s) #s
275 
276 #define AMQ_VERSION_STRING AMQ_STRINGIFY(AMQP_VERSION_MAJOR) "." \
277  AMQ_STRINGIFY(AMQP_VERSION_MINOR) "." \
278  AMQ_STRINGIFY(AMQP_VERSION_PATCH)
279 
293 #if AMQP_VERSION_IS_RELEASE
294 # define AMQP_VERSION_STRING AMQ_VERSION_STRING
295 #else
296 # define AMQP_VERSION_STRING AMQ_VERSION_STRING "-pre"
297 #endif
298 
299 
311 AMQP_PUBLIC_FUNCTION
312 uint32_t
313 AMQP_CALL amqp_version_number(void);
314 
326 AMQP_PUBLIC_FUNCTION
327 char const *
328 AMQP_CALL amqp_version(void);
329 
339 #define AMQP_DEFAULT_FRAME_SIZE 131072
340 
350 #define AMQP_DEFAULT_MAX_CHANNELS 0
351 
361 #define AMQP_DEFAULT_HEARTBEAT 0
362 
368 typedef int amqp_boolean_t;
369 
375 typedef uint32_t amqp_method_number_t;
376 
382 typedef uint32_t amqp_flags_t;
383 
389 typedef uint16_t amqp_channel_t;
390 
396 typedef struct amqp_bytes_t_ {
397  size_t len;
398  void *bytes;
399 } amqp_bytes_t;
400 
406 typedef struct amqp_decimal_t_ {
407  uint8_t decimals;
408  uint32_t value;
410 
423 typedef struct amqp_table_t_ {
425  struct amqp_table_entry_t_ *entries;
426 } amqp_table_t;
427 
435 typedef struct amqp_array_t_ {
437  struct amqp_field_value_t_ *entries;
438 } amqp_array_t;
439 
440 /*
441  0-9 0-9-1 Qpid/Rabbit Type Remarks
442 ---------------------------------------------------------------------------
443  t t Boolean
444  b b Signed 8-bit
445  B Unsigned 8-bit
446  U s Signed 16-bit (A1)
447  u Unsigned 16-bit
448  I I I Signed 32-bit
449  i Unsigned 32-bit
450  L l Signed 64-bit (B)
451  l Unsigned 64-bit
452  f f 32-bit float
453  d d 64-bit float
454  D D D Decimal
455  s Short string (A2)
456  S S S Long string
457  A Nested Array
458  T T T Timestamp (u64)
459  F F F Nested Table
460  V V V Void
461  x Byte array
462 
463 Remarks:
464 
465  A1, A2: Notice how the types **CONFLICT** here. In Qpid and Rabbit,
466  's' means a signed 16-bit integer; in 0-9-1, it means a
467  short string.
468 
469  B: Notice how the signednesses **CONFLICT** here. In Qpid and Rabbit,
470  'l' means a signed 64-bit integer; in 0-9-1, it means an unsigned
471  64-bit integer.
472 
473 I'm going with the Qpid/Rabbit types, where there's a conflict, and
474 the 0-9-1 types otherwise. 0-8 is a subset of 0-9, which is a subset
475 of the other two, so this will work for both 0-8 and 0-9-1 branches of
476 the code.
477 */
478 
484 typedef struct amqp_field_value_t_ {
485  uint8_t kind;
486  union {
488  int8_t i8;
489  uint8_t u8;
490  int16_t i16;
491  uint16_t u16;
492  int32_t i32;
493  uint32_t u32;
494  int64_t i64;
495  uint64_t u64;
496  float f32;
497  double f64;
502  } value;
504 
512 typedef struct amqp_table_entry_t_ {
517 
523 typedef enum {
543 
549 typedef struct amqp_pool_blocklist_t_ {
551  void **blocklist;
553 
559 typedef struct amqp_pool_t_ {
560  size_t pagesize;
569  int next_page;
570  char *alloc_block;
571  size_t alloc_used;
572 } amqp_pool_t;
573 
579 typedef struct amqp_method_t_ {
581  void *decoded;
583 } amqp_method_t;
584 
590 typedef struct amqp_frame_t_ {
591  uint8_t frame_type;
597  union {
599  struct {
600  uint16_t class_id;
601  uint64_t body_size;
602  void *decoded;
604  } properties;
607  struct {
608  uint8_t transport_high;
609  uint8_t transport_low;
610  uint8_t protocol_version_major;
611  uint8_t protocol_version_minor;
612  } protocol_header;
614  } payload;
615 } amqp_frame_t;
616 
622 typedef enum amqp_response_type_enum_ {
628 
634 typedef struct amqp_rpc_reply_t_ {
648 
654 typedef enum amqp_sasl_method_enum_ {
659 
665 typedef struct amqp_connection_state_t_ *amqp_connection_state_t;
666 
672 typedef struct amqp_socket_t_ amqp_socket_t;
673 
679 /* NOTE: When updating this enum, update the strings in librabbitmq/amqp_api.c */
680 typedef enum amqp_status_enum_
681 {
751 
758 typedef enum {
762 
763 AMQP_END_DECLS
764 
765 #include <amqp_framing.h>
766 
767 AMQP_BEGIN_DECLS
768 
774 AMQP_PUBLIC_VARIABLE const amqp_bytes_t amqp_empty_bytes;
775 
781 AMQP_PUBLIC_VARIABLE const amqp_table_t amqp_empty_table;
782 
788 AMQP_PUBLIC_VARIABLE const amqp_array_t amqp_empty_array;
789 
790 /* Compatibility macros for the above, to avoid the need to update
791  code written against earlier versions of librabbitmq. */
792 
802 #define AMQP_EMPTY_BYTES amqp_empty_bytes
803 
813 #define AMQP_EMPTY_TABLE amqp_empty_table
814 
824 #define AMQP_EMPTY_ARRAY amqp_empty_array
825 
847 AMQP_PUBLIC_FUNCTION
848 void
849 AMQP_CALL init_amqp_pool(amqp_pool_t *pool, size_t pagesize);
850 
871 AMQP_PUBLIC_FUNCTION
872 void
873 AMQP_CALL recycle_amqp_pool(amqp_pool_t *pool);
874 
884 AMQP_PUBLIC_FUNCTION
885 void
886 AMQP_CALL empty_amqp_pool(amqp_pool_t *pool);
887 
904 AMQP_PUBLIC_FUNCTION
905 void *
906 AMQP_CALL amqp_pool_alloc(amqp_pool_t *pool, size_t amount);
907 
927 AMQP_PUBLIC_FUNCTION
928 void
929 AMQP_CALL amqp_pool_alloc_bytes(amqp_pool_t *pool, size_t amount, amqp_bytes_t *output);
930 
949 AMQP_PUBLIC_FUNCTION
951 AMQP_CALL amqp_cstring_bytes(char const *cstr);
952 
969 AMQP_PUBLIC_FUNCTION
971 AMQP_CALL amqp_bytes_malloc_dup(amqp_bytes_t src);
972 
987 AMQP_PUBLIC_FUNCTION
989 AMQP_CALL amqp_bytes_malloc(size_t amount);
990 
1005 AMQP_PUBLIC_FUNCTION
1006 void
1007 AMQP_CALL amqp_bytes_free(amqp_bytes_t bytes);
1008 
1021 AMQP_PUBLIC_FUNCTION
1023 AMQP_CALL amqp_new_connection(void);
1024 
1042 AMQP_PUBLIC_FUNCTION
1043 int
1044 AMQP_CALL amqp_get_sockfd(amqp_connection_state_t state);
1045 
1046 
1064 AMQP_DEPRECATED(
1065  AMQP_PUBLIC_FUNCTION
1066  void
1067  AMQP_CALL amqp_set_sockfd(amqp_connection_state_t state, int sockfd)
1068 );
1069 
1070 
1103 AMQP_PUBLIC_FUNCTION
1104 int
1106  int channel_max,
1107  int frame_max,
1108  int heartbeat);
1109 
1121 AMQP_PUBLIC_FUNCTION
1122 int
1124 
1136 AMQP_PUBLIC_FUNCTION
1137 int
1139 
1151 AMQP_PUBLIC_FUNCTION
1152 int
1154 
1172 AMQP_PUBLIC_FUNCTION
1173 int
1175 
1217 AMQP_PUBLIC_FUNCTION
1218 int
1220  amqp_bytes_t received_data,
1221  amqp_frame_t *decoded_frame);
1222 
1240 AMQP_PUBLIC_FUNCTION
1243 
1268 AMQP_PUBLIC_FUNCTION
1269 void
1271 
1289 AMQP_PUBLIC_FUNCTION
1290 void
1292 
1313 AMQP_PUBLIC_FUNCTION
1314 void
1316  amqp_channel_t channel);
1317 
1339 AMQP_PUBLIC_FUNCTION
1340 int
1341 AMQP_CALL amqp_send_frame(amqp_connection_state_t state, amqp_frame_t const *frame);
1342 
1354 AMQP_PUBLIC_FUNCTION
1355 int
1356 AMQP_CALL amqp_table_entry_cmp(void const *entry1, void const *entry2);
1357 
1385 AMQP_PUBLIC_FUNCTION
1386 int
1387 AMQP_CALL amqp_open_socket(char const *hostname, int portnumber);
1388 
1410 AMQP_PUBLIC_FUNCTION
1411 int
1412 AMQP_CALL amqp_send_header(amqp_connection_state_t state);
1413 
1430 AMQP_PUBLIC_FUNCTION
1433 
1485 AMQP_PUBLIC_FUNCTION
1486 int
1488  amqp_frame_t *decoded_frame);
1489 
1551 AMQP_PUBLIC_FUNCTION
1552 int
1554  amqp_frame_t *decoded_frame,
1555  struct timeval *tv);
1556 
1597 AMQP_PUBLIC_FUNCTION
1598 int
1600  amqp_channel_t expected_channel,
1601  amqp_method_number_t expected_method,
1602  amqp_method_t *output);
1603 
1630 AMQP_PUBLIC_FUNCTION
1631 int
1633  amqp_channel_t channel,
1635  void *decoded);
1636 
1669 AMQP_PUBLIC_FUNCTION
1672  amqp_channel_t channel,
1673  amqp_method_number_t request_id,
1674  amqp_method_number_t *expected_reply_ids,
1675  void *decoded_request_method);
1676 
1691 AMQP_PUBLIC_FUNCTION
1692 void *
1694  amqp_channel_t channel,
1695  amqp_method_number_t request_id,
1696  amqp_method_number_t reply_id,
1697  void *decoded_request_method);
1698 
1738 AMQP_PUBLIC_FUNCTION
1741 
1794 AMQP_PUBLIC_FUNCTION
1796 AMQP_CALL amqp_login(amqp_connection_state_t state, char const *vhost,
1797  int channel_max, int frame_max, int heartbeat,
1798  amqp_sasl_method_enum sasl_method, ...);
1799 
1854 AMQP_PUBLIC_FUNCTION
1856 AMQP_CALL amqp_login_with_properties(amqp_connection_state_t state, char const *vhost,
1857  int channel_max, int frame_max, int heartbeat,
1858  const amqp_table_t *properties, amqp_sasl_method_enum sasl_method, ...);
1859 
1860 struct amqp_basic_properties_t_;
1861 
1907 AMQP_PUBLIC_FUNCTION
1908 int
1910  amqp_bytes_t exchange, amqp_bytes_t routing_key,
1911  amqp_boolean_t mandatory, amqp_boolean_t immediate,
1912  struct amqp_basic_properties_t_ const *properties,
1913  amqp_bytes_t body);
1914 
1925 AMQP_PUBLIC_FUNCTION
1928  int code);
1929 
1943 AMQP_PUBLIC_FUNCTION
1945 AMQP_CALL amqp_connection_close(amqp_connection_state_t state, int code);
1946 
1962 AMQP_PUBLIC_FUNCTION
1963 int
1964 AMQP_CALL amqp_basic_ack(amqp_connection_state_t state, amqp_channel_t channel,
1965  uint64_t delivery_tag, amqp_boolean_t multiple);
1966 
1983 AMQP_PUBLIC_FUNCTION
1985 AMQP_CALL amqp_basic_get(amqp_connection_state_t state, amqp_channel_t channel,
1986  amqp_bytes_t queue, amqp_boolean_t no_ack);
1987 
2003 AMQP_PUBLIC_FUNCTION
2004 int
2006  uint64_t delivery_tag, amqp_boolean_t requeue);
2007 
2027 AMQP_PUBLIC_FUNCTION
2028 int
2029 AMQP_CALL amqp_basic_nack(amqp_connection_state_t state, amqp_channel_t channel,
2030  uint64_t delivery_tag, amqp_boolean_t multiple,
2031  amqp_boolean_t requeue);
2044 AMQP_PUBLIC_FUNCTION
2047 
2063 AMQP_DEPRECATED(
2064  AMQP_PUBLIC_FUNCTION
2065  char *
2066  AMQP_CALL amqp_error_string(int err)
2067 );
2068 
2069 
2081 AMQP_PUBLIC_FUNCTION
2082 const char *
2083 AMQP_CALL amqp_error_string2(int err);
2084 
2085 
2106 AMQP_PUBLIC_FUNCTION
2107 int
2108 AMQP_CALL amqp_decode_table(amqp_bytes_t encoded, amqp_pool_t *pool,
2109  amqp_table_t *output, size_t *offset);
2110 
2130 AMQP_PUBLIC_FUNCTION
2131 int
2132 AMQP_CALL amqp_encode_table(amqp_bytes_t encoded, amqp_table_t *input, size_t *offset);
2133 
2134 
2153 AMQP_PUBLIC_FUNCTION
2154 int
2155 AMQP_CALL amqp_table_clone(const amqp_table_t *original, amqp_table_t *clone, amqp_pool_t *pool);
2156 
2162 typedef struct amqp_message_t_ {
2166 } amqp_message_t;
2167 
2186 AMQP_PUBLIC_FUNCTION
2189  amqp_channel_t channel,
2190  amqp_message_t *message, int flags);
2191 
2199 AMQP_PUBLIC_FUNCTION
2200 void
2201 AMQP_CALL amqp_destroy_message(amqp_message_t *message);
2202 
2208 typedef struct amqp_envelope_t_ {
2211  uint64_t delivery_tag;
2216 } amqp_envelope_t;
2217 
2248 AMQP_PUBLIC_FUNCTION
2251  amqp_envelope_t *envelope,
2252  struct timeval *timeout, int flags);
2253 
2261 AMQP_PUBLIC_FUNCTION
2262 void
2263 AMQP_CALL amqp_destroy_envelope(amqp_envelope_t *envelope);
2264 
2265 
2272  char *user;
2273  char *password;
2274  char *host;
2275  char *vhost;
2276  int port;
2277  amqp_boolean_t ssl;
2278 };
2279 
2294 AMQP_PUBLIC_FUNCTION
2295 void
2296 AMQP_CALL amqp_default_connection_info(struct amqp_connection_info *parsed);
2297 
2324 AMQP_PUBLIC_FUNCTION
2325 int
2326 AMQP_CALL amqp_parse_url(char *url, struct amqp_connection_info *parsed);
2327 
2328 /* socket API */
2329 
2346 AMQP_PUBLIC_FUNCTION
2347 int
2348 AMQP_CALL
2349 amqp_socket_open(amqp_socket_t *self, const char *host, int port);
2350 
2368 AMQP_PUBLIC_FUNCTION
2369 int
2370 AMQP_CALL
2371 amqp_socket_open_noblock(amqp_socket_t *self, const char *host, int port, struct timeval *timeout);
2372 
2388 AMQP_PUBLIC_FUNCTION
2389 int
2390 AMQP_CALL
2391 amqp_socket_get_sockfd(amqp_socket_t *self);
2392 
2401 AMQP_PUBLIC_FUNCTION
2402 amqp_socket_t *
2404 
2415 AMQP_PUBLIC_FUNCTION
2416 amqp_table_t *
2418 
2431 AMQP_PUBLIC_FUNCTION
2432 amqp_table_t *
2434 
2435 AMQP_END_DECLS
2436 
2437 
2438 #endif /* AMQP_H */
amqp_rpc_reply_t amqp_login(amqp_connection_state_t state, char const *vhost, int channel_max, int frame_max, int heartbeat, amqp_sasl_method_enum sasl_method,...)
Login to the broker.
amqp_bytes_t amqp_bytes_malloc_dup(amqp_bytes_t src)
Duplicates an amqp_bytes_t buffer.
amqp_response_type_enum reply_type
the reply type:
Definition: amqp.h:635
Unexpected protocol state.
Definition: amqp.h:720
the library got an EOF from the socket
Definition: amqp.h:623
int port
the port that the broker is listening on, default on most brokers is 5672
Definition: amqp.h:2276
uint16_t amqp_channel_t
Channel type.
Definition: amqp.h:389
uint64_t body_size
size of the body in bytes
Definition: amqp.h:601
unformatted byte string, datatype: amqp_bytes_t
Definition: amqp.h:541
void empty_amqp_pool(amqp_pool_t *pool)
Empties an amqp memory pool.
void amqp_pool_alloc_bytes(amqp_pool_t *pool, size_t amount, amqp_bytes_t *output)
Allocates a block of memory from an amqp_pool_t to an amqp_bytes_t.
amqp_method_t method
a method, use if frame_type == AMQP_FRAME_METHOD
Definition: amqp.h:598
Underlying socket is already open.
Definition: amqp.h:724
uint32_t value
the value before the decimal point is applied
Definition: amqp.h:408
int amqp_table_clone(const amqp_table_t *original, amqp_table_t *clone, amqp_pool_t *pool)
Create a deep-copy of an amqp_table_t object.
char * password
the password to authenticate with the broker, default on most brokers is 'guest'
Definition: amqp.h:2273
AMQP field table.
Definition: amqp.h:423
void * amqp_simple_rpc_decoded(amqp_connection_state_t state, amqp_channel_t channel, amqp_method_number_t request_id, amqp_method_number_t reply_id, void *decoded_request_method)
Sends a method to the broker and waits for a method response.
A socket error occurred.
Definition: amqp.h:704
SSL handshake failed.
Definition: amqp.h:748
32-bit signed integer, datatype: int32_t
Definition: amqp.h:529
amqp_boolean_t amqp_frames_enqueued(amqp_connection_state_t state)
Checks to see if there are any incoming frames ready to be read.
amqp_boolean_t amqp_release_buffers_ok(amqp_connection_state_t state)
Check to see if connection memory can be released.
amqp_bytes_t exchange
exchange this message was published to
Definition: amqp.h:2213
The underlying system timer facility failed.
Definition: amqp.h:716
amqp_rpc_reply_t amqp_consume_message(amqp_connection_state_t state, amqp_envelope_t *envelope, struct timeval *timeout, int flags)
Wait for and consume a message.
int amqp_send_method(amqp_connection_state_t state, amqp_channel_t channel, amqp_method_number_t id, void *decoded)
Sends a method to the broker.
server exception, the broker returned an error, check replay
Definition: amqp.h:626
Timed out waiting for heartbeat.
Definition: amqp.h:718
uint64_t delivery_tag
the messages delivery tag
Definition: amqp.h:2211
uint16_t class_id
the class for the properties
Definition: amqp.h:600
Broker does not support the requested SASL mechanism.
Definition: amqp.h:726
amqp_status_enum
Status codes.
Definition: amqp.h:680
uint32_t amqp_flags_t
Bitmask for flags.
Definition: amqp.h:382
int8_t i8
int8_t type AMQP_FIELD_KIND_I8
Definition: amqp.h:488
struct amqp_field_value_t_ * entries
linked list of field values
Definition: amqp.h:437
char const * amqp_version(void)
Returns the rabbitmq-c version as a string.
field array (repeated values of another datatype.
Definition: amqp.h:537
amqp_bytes_t body
message body
Definition: amqp.h:2164
amqp_table_t * amqp_get_server_properties(amqp_connection_state_t state)
Get the broker properties table.
An AMQP frame.
Definition: amqp.h:590
amqp_rpc_reply_t amqp_login_with_properties(amqp_connection_state_t state, char const *vhost, int channel_max, int frame_max, int heartbeat, const amqp_table_t *properties, amqp_sasl_method_enum sasl_method,...)
Login to the broker passing a properties table.
int amqp_basic_ack(amqp_connection_state_t state, amqp_channel_t channel, uint64_t delivery_tag, amqp_boolean_t multiple)
Acknowledges a message.
int amqp_get_channel_max(amqp_connection_state_t state)
Get the maximum number of channels the connection can handle.
char * user
the username to authenticate with the broker, default on most broker is 'guest'
Definition: amqp.h:2272
amqp_method_t reply
in case of AMQP_RESPONSE_SERVER_EXCEPTION this field will be set to the method returned from the brok...
Definition: amqp.h:642
char * vhost
the virtual host on the broker to connect to, a good default is "/"
Definition: amqp.h:2275
amqp_bytes_t key
the table entry key.
Definition: amqp.h:513
int amqp_tune_connection(amqp_connection_state_t state, int channel_max, int frame_max, int heartbeat)
Tune client side parameters.
int amqp_send_header(amqp_connection_state_t state)
Send initial AMQP header to the broker.
void amqp_release_buffers(amqp_connection_state_t state)
Release amqp_connection_state_t owned memory.
int amqp_get_frame_max(amqp_connection_state_t state)
Get the maximum size of an frame the connection can handle.
int amqp_socket_open(amqp_socket_t *self, const char *host, int port)
Open a socket connection.
amqp_socket_t * amqp_get_socket(amqp_connection_state_t state)
Get the socket object associated with a amqp_connection_state_t.
An unknown AMQP method was received.
Definition: amqp.h:692
amqp_bytes_t amqp_cstring_bytes(char const *cstr)
Wraps a c string in an amqp_bytes_t.
SSL validation of hostname against peer certificate failed.
Definition: amqp.h:742
int amqp_handle_input(amqp_connection_state_t state, amqp_bytes_t received_data, amqp_frame_t *decoded_frame)
Process incoming data.
size_t len
length of the buffer in bytes
Definition: amqp.h:397
int16_t i16
int16_t type AMQP_FIELD_KIND_I16
Definition: amqp.h:490
double f64
double type AMQP_FIELD_KIND_F64
Definition: amqp.h:497
8-bit signed integer, datatype: int8_t
Definition: amqp.h:525
amqp_delivery_mode_enum
AMQP delivery modes.
Definition: amqp.h:758
amqp_boolean_t amqp_data_in_buffer(amqp_connection_state_t state)
Check to see if there is data left in the receive buffer.
amqp_boolean_t redelivered
flag indicating whether this message is being redelivered
Definition: amqp.h:2212
amqp_field_value_kind_t
Field value types.
Definition: amqp.h:523
An amqp method.
Definition: amqp.h:579
64-bit unsigned integer, datatype: uint64_t
Definition: amqp.h:532
amqp_rpc_reply_t amqp_read_message(amqp_connection_state_t state, amqp_channel_t channel, amqp_message_t *message, int flags)
Reads the next message on a channel.
SSL validation of peer certificate failed.
Definition: amqp.h:746
Incorrect or corrupt data was received from the broker.
Definition: amqp.h:685
Operation timed out.
Definition: amqp.h:715
A list of allocation blocks.
Definition: amqp.h:549
UTF-8 null-terminated character string, datatype: amqp_bytes_t.
Definition: amqp.h:536
int library_error
in case of AMQP_RESPONSE_LIBRARY_EXCEPTION this field will be set to an error code.
Definition: amqp.h:644
int32_t i32
int32_t type AMQP_FIELD_KIND_I32
Definition: amqp.h:492
int amqp_simple_wait_method(amqp_connection_state_t state, amqp_channel_t expected_channel, amqp_method_number_t expected_method, amqp_method_t *output)
Waits for a specific method from the broker.
void * bytes
pointer to the beginning of the buffer
Definition: amqp.h:398
amqp_pool_blocklist_t pages
blocks that are the size of pagesize
Definition: amqp.h:566
int amqp_send_frame(amqp_connection_state_t state, amqp_frame_t const *frame)
Send a frame to the broker.
amqp_bytes_t consumer_tag
the consumer tag the message was delivered to
Definition: amqp.h:2210
size_t alloc_used
number of bytes in the current allocation block that has been used
Definition: amqp.h:571
An error occurred trying to initialize the socket library.
Definition: amqp.h:735
int amqp_open_socket(char const *hostname, int portnumber)
Open a socket to a remote host.
Unable to resolve the hostname.
Definition: amqp.h:695
void amqp_destroy_envelope(amqp_envelope_t *envelope)
Frees memory associated with a amqp_envelope_t allocated in amqp_consume_message() ...
A message object.
Definition: amqp.h:2162
Envelope object.
Definition: amqp.h:2208
amqp_field_value_t value
the table entry values
Definition: amqp.h:515
uint32_t amqp_method_number_t
Method number.
Definition: amqp.h:375
const amqp_array_t amqp_empty_array
Empty table array structure.
Definition: amqp.h:788
Invalid SASL method.
Definition: amqp.h:655
amqp_response_type_enum
Response type.
Definition: amqp.h:622
int amqp_table_entry_cmp(void const *entry1, void const *entry2)
Compare two table entries.
32-bit unsigned integer, datatype: uint32_t
Definition: amqp.h:530
int amqp_get_heartbeat(amqp_connection_state_t state)
Get the number of seconds between heartbeats of the connection.
int amqp_socket_get_sockfd(amqp_socket_t *self)
Get the socket descriptor in use by a socket object.
amqp_channel_t channel
channel message was delivered on
Definition: amqp.h:2209
int amqp_boolean_t
boolean type 0 = false, true otherwise
Definition: amqp.h:368
The amqp_table_t object cannot be serialized because the output buffer is too small.
Definition: amqp.h:709
The wrong method was received.
Definition: amqp.h:713
amqp_decimal_t decimal
amqp_decimal_t AMQP_FIELD_KIND_DECIMAL
Definition: amqp.h:498
boolean type.
Definition: amqp.h:524
Persistent message.
Definition: amqp.h:760
empty entry
Definition: amqp.h:540
void amqp_set_sockfd(amqp_connection_state_t state, int sockfd)
Deprecated, use amqp_tcp_socket_new() or amqp_ssl_socket_new()
void amqp_default_connection_info(struct amqp_connection_info *parsed)
Initialze an amqp_connection_info to default values.
const amqp_bytes_t amqp_empty_bytes
Empty bytes structure.
Definition: amqp.h:774
int amqp_basic_reject(amqp_connection_state_t state, amqp_channel_t channel, uint64_t delivery_tag, amqp_boolean_t requeue)
Do a basic.reject.
Internal value.
Definition: amqp.h:731
Parameters used to connect to the RabbitMQ broker.
Definition: amqp.h:2271
amqp_rpc_reply_t amqp_channel_close(amqp_connection_state_t state, amqp_channel_t channel, int code)
Closes an channel.
The connection to the broker has been closed.
Definition: amqp.h:700
amqp_table_t table
amqp_table_t type AMQP_FIELD_KIND_TABLE
Definition: amqp.h:500
library error, an error occurred in the library, examine the library_error
Definition: amqp.h:625
int amqp_simple_wait_frame_noblock(amqp_connection_state_t state, amqp_frame_t *decoded_frame, struct timeval *tv)
Read a single amqp_frame_t with a timeout.
A generic TCP error occurred.
Definition: amqp.h:733
amqp_bytes_t body_fragment
a body fragment, use if frame_type == AMQP_FRAME_BODY
Definition: amqp.h:606
amqp_rpc_reply_t amqp_simple_rpc(amqp_connection_state_t state, amqp_channel_t channel, amqp_method_number_t request_id, amqp_method_number_t *expected_reply_ids, void *decoded_request_method)
Sends a method to the broker and waits for a method response.
An unknown AMQP class was received.
Definition: amqp.h:689
amqp_rpc_reply_t amqp_basic_get(amqp_connection_state_t state, amqp_channel_t channel, amqp_bytes_t queue, amqp_boolean_t no_ack)
Do a basic.get.
amqp_method_number_t id
the method id number
Definition: amqp.h:580
int amqp_socket_open_noblock(amqp_socket_t *self, const char *host, int port, struct timeval *timeout)
Open a socket connection.
int amqp_simple_wait_frame(amqp_connection_state_t state, amqp_frame_t *decoded_frame)
Read a single amqp_frame_t.
amqp_bytes_t amqp_bytes_malloc(size_t amount)
Allocates a amqp_bytes_t buffer.
amqp_message_t message
the message
Definition: amqp.h:2215
Internal value.
Definition: amqp.h:738
amqp_rpc_reply_t amqp_get_rpc_reply(amqp_connection_state_t state)
Get the last global amqp_rpc_reply.
Abstract base class for amqp_socket_t.
Definition: amqp_socket.h:78
Decimal data type.
Definition: amqp.h:406
int next_page
an index to the next unused page block
Definition: amqp.h:569
int amqp_encode_table(amqp_bytes_t encoded, amqp_table_t *input, size_t *offset)
Serializes an amqp_table_t to the AMQP wireformat.
int num_entries
Number of entries in the table.
Definition: amqp.h:436
the PLAIN SASL method for authentication to the broker
Definition: amqp.h:656
uint32_t amqp_version_number(void)
Returns the rabbitmq-c version as a packed integer.
amqp_channel_t channel
the channel the frame was received on
Definition: amqp.h:596
uint8_t decimals
the location of the decimal point
Definition: amqp.h:407
Operation successful.
Definition: amqp.h:682
amqp_pool_t pool
pool used to allocate properties
Definition: amqp.h:2165
uint16_t u16
uint16_t type AMQP_FIELD_KIND_U16
Definition: amqp.h:491
An AMQP Field Array.
Definition: amqp.h:435
single-precision floating point value, datatype: float
Definition: amqp.h:533
amqp-decimal value, datatype: amqp_decimal_t
Definition: amqp.h:535
const amqp_table_t amqp_empty_table
Empty table structure.
Definition: amqp.h:781
The broker advertised an incompaible AMQP version.
Definition: amqp.h:697
int amqp_destroy_connection(amqp_connection_state_t state)
Destroys an amqp_connection_state_t object.
16-bit signed integer, datatype: int16_t
Definition: amqp.h:527
uint32_t u32
uint32_t type AMQP_FIELD_KIND_U32
Definition: amqp.h:493
A generic SSL error occurred.
Definition: amqp.h:740
char * host
the hostname of the broker
Definition: amqp.h:2274
uint8_t u8
uint8_t type AMQP_FIELD_KIND_U8
Definition: amqp.h:489
int amqp_parse_url(char *url, struct amqp_connection_info *parsed)
Parse a connection URL.
uint8_t kind
the type of the entry /sa amqp_field_value_kind_t
Definition: amqp.h:485
8-bit unsigned integer, datatype: uint8_t
Definition: amqp.h:526
A field table value.
Definition: amqp.h:484
amqp_pool_blocklist_t large_blocks
allocations larger than the pagesize
Definition: amqp.h:567
int amqp_basic_publish(amqp_connection_state_t state, amqp_channel_t channel, amqp_bytes_t exchange, amqp_bytes_t routing_key, amqp_boolean_t mandatory, amqp_boolean_t immediate, struct amqp_basic_properties_t_ const *properties, amqp_bytes_t body)
Publish a message to the broker.
Memory allocation failed.
Definition: amqp.h:683
An invalid parameter was passed into the function.
Definition: amqp.h:706
float f32
float type AMQP_FIELD_KIND_F32
Definition: amqp.h:496
field table.
Definition: amqp.h:539
Non-persistent message.
Definition: amqp.h:759
void init_amqp_pool(amqp_pool_t *pool, size_t pagesize)
Initializes an amqp_pool_t memory allocation pool for use.
Internal value.
Definition: amqp.h:749
int64_t i64
int64_t type AMQP_FIELD_KIND_I64
Definition: amqp.h:494
int amqp_decode_table(amqp_bytes_t encoded, amqp_pool_t *pool, amqp_table_t *output, size_t *offset)
Deserialize an amqp_table_t from AMQP wireformat.
void * decoded
the decoded properties
Definition: amqp.h:602
size_t pagesize
the size of the page in bytes.
Definition: amqp.h:560
An entry in a field-table.
Definition: amqp.h:512
char * alloc_block
pointer to the current allocation block
Definition: amqp.h:570
double-precision floating point value, datatype: double
Definition: amqp.h:534
basic class properties
Definition: amqp_framing.h:727
response normal, the RPC completed successfully
Definition: amqp.h:624
void ** blocklist
Array of memory blocks.
Definition: amqp.h:551
amqp_sasl_method_enum
SASL method type.
Definition: amqp.h:654
void * decoded
pointer to the decoded method, cast to the appropriate type to use
Definition: amqp.h:581
struct amqp_table_entry_t_ * entries
an array of table entries
Definition: amqp.h:425
amqp_bytes_t raw
amqp-encoded properties structure
Definition: amqp.h:603
Buffer descriptor.
Definition: amqp.h:396
int num_blocks
Number of blocks in the block list.
Definition: amqp.h:550
A memory pool.
Definition: amqp.h:559
amqp_connection_state_t amqp_new_connection(void)
Allocate and initialize a new amqp_connection_state_t object.
Parameter is unsupported in this version.
Definition: amqp.h:729
int amqp_basic_nack(amqp_connection_state_t state, amqp_channel_t channel, uint64_t delivery_tag, amqp_boolean_t multiple, amqp_boolean_t requeue)
Do a basic.nack.
void amqp_bytes_free(amqp_bytes_t bytes)
Frees an amqp_bytes_t buffer.
void amqp_destroy_message(amqp_message_t *message)
Frees memory associated with a amqp_message_t allocated in amqp_read_message.
uint64_t u64
uint64_t type AMQP_FIELD_KIND_U64, AMQP_FIELD_KIND_TIMESTAMP
Definition: amqp.h:495
amqp_boolean_t boolean
boolean type AMQP_FIELD_KIND_BOOLEAN
Definition: amqp.h:487
uint8_t frame_type
frame type.
Definition: amqp.h:591
64-bit timestamp.
Definition: amqp.h:538
char * amqp_error_string(int err)
Get the error string for the given error code.
amqp_basic_properties_t properties
message properties
Definition: amqp.h:2163
void recycle_amqp_pool(amqp_pool_t *pool)
Recycles an amqp_pool_t memory allocation pool.
Underlying socket is closed.
Definition: amqp.h:722
the EXTERNAL SASL method for authentication to the broker
Definition: amqp.h:657
amqp_rpc_reply_t amqp_connection_close(amqp_connection_state_t state, int code)
Closes the entire connection.
Reply from a RPC method on the broker.
Definition: amqp.h:634
amqp_bytes_t bytes
amqp_bytes_t type AMQP_FIELD_KIND_UTF8, AMQP_FIELD_KIND_BYTES
Definition: amqp.h:499
void amqp_maybe_release_buffers_on_channel(amqp_connection_state_t state, amqp_channel_t channel)
Release amqp_connection_state_t owned memory related to a channel.
16-bit unsigned integer, datatype: uint16_t
Definition: amqp.h:528
amqp_table_t * amqp_get_client_properties(amqp_connection_state_t state)
Get the client properties table.
amqp_array_t array
amqp_array_t type AMQP_FIELD_KIND_ARRAY
Definition: amqp.h:501
void amqp_maybe_release_buffers(amqp_connection_state_t state)
Release amqp_connection_state_t owned memory.
const char * amqp_error_string2(int err)
Get the error string for the given error code.
int amqp_get_sockfd(amqp_connection_state_t state)
Get the underlying socket descriptor for the connection.
void * amqp_pool_alloc(amqp_pool_t *pool, size_t amount)
Allocates a block of memory from an amqp_pool_t memory pool.
int num_entries
length of entries array
Definition: amqp.h:424
64-bit signed integer, datatype: int64_t
Definition: amqp.h:531
malformed AMQP URL
Definition: amqp.h:703
struct amqp_connection_state_t_ * amqp_connection_state_t
connection state object
Definition: amqp.h:665
amqp_bytes_t routing_key
the routing key this message was published with
Definition: amqp.h:2214