rabbitmq-c  0.5.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-2013
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 
53 /*
54  * \internal
55  * Important API decorators:
56  * AMQP_PUBLIC_FUNCTION - a public API function
57  * AMQP_PUBLIC_VARIABLE - a public API external variable
58  * AMQP_CALL - calling convension (used on Win32)
59  */
60 
61 #if defined(_WIN32) && defined(_MSC_VER)
62 # if defined(AMQP_BUILD) && !defined(AMQP_STATIC)
63 # define AMQP_PUBLIC_FUNCTION __declspec(dllexport)
64 # define AMQP_PUBLIC_VARIABLE __declspec(dllexport) extern
65 # else
66 # define AMQP_PUBLIC_FUNCTION
67 # if !defined(AMQP_STATIC)
68 # define AMQP_PUBLIC_VARIABLE __declspec(dllimport) extern
69 # else
70 # define AMQP_PUBLIC_VARIABLE extern
71 # endif
72 # endif
73 # define AMQP_CALL __cdecl
74 
75 #elif defined(_WIN32) && defined(__BORLANDC__)
76 # if defined(AMQP_BUILD) && !defined(AMQP_STATIC)
77 # define AMQP_PUBLIC_FUNCTION __declspec(dllexport)
78 # define AMQP_PUBLIC_VARIABLE __declspec(dllexport) extern
79 # else
80 # define AMQP_PUBLIC_FUNCTION
81 # if !defined(AMQP_STATIC)
82 # define AMQP_PUBLIC_VARIABLE __declspec(dllimport) extern
83 # else
84 # define AMQP_PUBLIC_VARIABLE extern
85 # endif
86 # endif
87 # define AMQP_CALL __cdecl
88 
89 #elif defined(_WIN32) && defined(__MINGW32__)
90 # if defined(AMQP_BUILD) && !defined(AMQP_STATIC)
91 # define AMQP_PUBLIC_FUNCTION __declspec(dllexport)
92 # define AMQP_PUBLIC_VARIABLE __declspec(dllexport) extern
93 # else
94 # define AMQP_PUBLIC_FUNCTION
95 # if !defined(AMQP_STATIC)
96 # define AMQP_PUBLIC_VARIABLE __declspec(dllimport) extern
97 # else
98 # define AMQP_PUBLIC_VARIABLE extern
99 # endif
100 # endif
101 # define AMQP_CALL __cdecl
102 
103 #elif defined(_WIN32) && defined(__CYGWIN__)
104 # if defined(AMQP_BUILD) && !defined(AMQP_STATIC)
105 # define AMQP_PUBLIC_FUNCTION __declspec(dllexport)
106 # define AMQP_PUBLIC_VARIABLE __declspec(dllexport)
107 # else
108 # define AMQP_PUBLIC_FUNCTION
109 # if !defined(AMQP_STATIC)
110 # define AMQP_PUBLIC_VARIABLE __declspec(dllimport) extern
111 # else
112 # define AMQP_PUBLIC_VARIABLE extern
113 # endif
114 # endif
115 # define AMQP_CALL __cdecl
116 
117 #elif defined(__GNUC__) && __GNUC__ >= 4
118 # include <sys/uio.h>
119 # define AMQP_PUBLIC_FUNCTION \
120  __attribute__ ((visibility ("default")))
121 # define AMQP_PUBLIC_VARIABLE \
122  __attribute__ ((visibility ("default"))) extern
123 # define AMQP_CALL
124 #else
125 # define AMQP_PUBLIC_FUNCTION
126 # define AMQP_PUBLIC_VARIABLE extern
127 # define AMQP_CALL
128 #endif
129 
130 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
131 # define AMQP_DEPRECATED(function) \
132  function __attribute__ ((__deprecated__))
133 #elif defined(_MSC_VER)
134 # define AMQP_DEPRECATED(function) \
135  __declspec(deprecated) function
136 #else
137 # define AMQP_DEPRECATED(function)
138 #endif
139 
140 /* Define ssize_t on Win32/64 platforms
141  See: http://lists.cs.uiuc.edu/pipermail/llvmdev/2010-April/030649.html for details
142  */
143 #if !defined(_W64)
144 #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
145 #define _W64 __w64
146 #else
147 #define _W64
148 #endif
149 #endif
150 
151 #ifdef _MSC_VER
152 #ifdef _WIN64
153 typedef __int64 ssize_t;
154 #else
155 typedef _W64 int ssize_t;
156 #endif
157 #endif
158 
161 #include <stddef.h>
162 #include <stdint.h>
163 
164 struct timeval;
165 
166 AMQP_BEGIN_DECLS
167 
219 /*
220  * Developer note: when changing these, be sure to update SOVERSION constants
221  * in CMakeLists.txt and configure.ac
222  */
223 
224 #define AMQP_VERSION_MAJOR 0
225 #define AMQP_VERSION_MINOR 5
226 #define AMQP_VERSION_PATCH 0
227 #define AMQP_VERSION_IS_RELEASE 1
228 
229 
248 #define AMQP_VERSION ((AMQP_VERSION_MAJOR << 24) | \
249  (AMQP_VERSION_MINOR << 16) | \
250  (AMQP_VERSION_PATCH << 8) | \
251  (AMQP_VERSION_IS_RELEASE))
252 
254 #define AMQ_STRINGIFY(s) AMQ_STRINGIFY_HELPER(s)
255 #define AMQ_STRINGIFY_HELPER(s) #s
256 
257 #define AMQ_VERSION_STRING AMQ_STRINGIFY(AMQP_VERSION_MAJOR) "." \
258  AMQ_STRINGIFY(AMQP_VERSION_MINOR) "." \
259  AMQ_STRINGIFY(AMQP_VERSION_PATCH)
260 
274 #if AMQP_VERSION_IS_RELEASE
275 # define AMQP_VERSION_STRING AMQ_VERSION_STRING
276 #else
277 # define AMQP_VERSION_STRING AMQ_VERSION_STRING "-pre"
278 #endif
279 
280 
292 AMQP_PUBLIC_FUNCTION
293 uint32_t
294 AMQP_CALL amqp_version_number(void);
295 
307 AMQP_PUBLIC_FUNCTION
308 char const *
309 AMQP_CALL amqp_version(void);
310 
320 #define AMQP_DEFAULT_FRAME_SIZE 131072
321 
331 #define AMQP_DEFAULT_MAX_CHANNELS 0
332 
342 #define AMQP_DEFAULT_HEARTBEAT 0
343 
349 typedef int amqp_boolean_t;
350 
356 typedef uint32_t amqp_method_number_t;
357 
363 typedef uint32_t amqp_flags_t;
364 
370 typedef uint16_t amqp_channel_t;
371 
377 typedef struct amqp_bytes_t_ {
378  size_t len;
379  void *bytes;
380 } amqp_bytes_t;
381 
387 typedef struct amqp_decimal_t_ {
388  uint8_t decimals;
389  uint32_t value;
391 
404 typedef struct amqp_table_t_ {
406  struct amqp_table_entry_t_ *entries;
407 } amqp_table_t;
408 
416 typedef struct amqp_array_t_ {
418  struct amqp_field_value_t_ *entries;
419 } amqp_array_t;
420 
421 /*
422  0-9 0-9-1 Qpid/Rabbit Type Remarks
423 ---------------------------------------------------------------------------
424  t t Boolean
425  b b Signed 8-bit
426  B Unsigned 8-bit
427  U s Signed 16-bit (A1)
428  u Unsigned 16-bit
429  I I I Signed 32-bit
430  i Unsigned 32-bit
431  L l Signed 64-bit (B)
432  l Unsigned 64-bit
433  f f 32-bit float
434  d d 64-bit float
435  D D D Decimal
436  s Short string (A2)
437  S S S Long string
438  A Nested Array
439  T T T Timestamp (u64)
440  F F F Nested Table
441  V V V Void
442  x Byte array
443 
444 Remarks:
445 
446  A1, A2: Notice how the types **CONFLICT** here. In Qpid and Rabbit,
447  's' means a signed 16-bit integer; in 0-9-1, it means a
448  short string.
449 
450  B: Notice how the signednesses **CONFLICT** here. In Qpid and Rabbit,
451  'l' means a signed 64-bit integer; in 0-9-1, it means an unsigned
452  64-bit integer.
453 
454 I'm going with the Qpid/Rabbit types, where there's a conflict, and
455 the 0-9-1 types otherwise. 0-8 is a subset of 0-9, which is a subset
456 of the other two, so this will work for both 0-8 and 0-9-1 branches of
457 the code.
458 */
459 
465 typedef struct amqp_field_value_t_ {
466  uint8_t kind;
467  union {
469  int8_t i8;
470  uint8_t u8;
471  int16_t i16;
472  uint16_t u16;
473  int32_t i32;
474  uint32_t u32;
475  int64_t i64;
476  uint64_t u64;
477  float f32;
478  double f64;
483  } value;
485 
493 typedef struct amqp_table_entry_t_ {
498 
504 typedef enum {
524 
530 typedef struct amqp_pool_blocklist_t_ {
532  void **blocklist;
534 
540 typedef struct amqp_pool_t_ {
541  size_t pagesize;
550  int next_page;
551  char *alloc_block;
552  size_t alloc_used;
553 } amqp_pool_t;
554 
560 typedef struct amqp_method_t_ {
562  void *decoded;
564 } amqp_method_t;
565 
571 typedef struct amqp_frame_t_ {
572  uint8_t frame_type;
578  union {
580  struct {
581  uint16_t class_id;
582  uint64_t body_size;
583  void *decoded;
585  } properties;
588  struct {
589  uint8_t transport_high;
590  uint8_t transport_low;
591  uint8_t protocol_version_major;
592  uint8_t protocol_version_minor;
593  } protocol_header;
595  } payload;
596 } amqp_frame_t;
597 
603 typedef enum amqp_response_type_enum_ {
609 
615 typedef struct amqp_rpc_reply_t_ {
629 
635 typedef enum amqp_sasl_method_enum_ {
638 
644 typedef struct amqp_connection_state_t_ *amqp_connection_state_t;
645 
651 typedef struct amqp_socket_t_ amqp_socket_t;
652 
658 typedef enum amqp_status_enum_
659 {
717 
724 typedef enum {
728 
729 AMQP_END_DECLS
730 
731 #include <amqp_framing.h>
732 
733 AMQP_BEGIN_DECLS
734 
740 AMQP_PUBLIC_VARIABLE const amqp_bytes_t amqp_empty_bytes;
741 
747 AMQP_PUBLIC_VARIABLE const amqp_table_t amqp_empty_table;
748 
754 AMQP_PUBLIC_VARIABLE const amqp_array_t amqp_empty_array;
755 
756 /* Compatibility macros for the above, to avoid the need to update
757  code written against earlier versions of librabbitmq. */
758 
768 #define AMQP_EMPTY_BYTES amqp_empty_bytes
769 
779 #define AMQP_EMPTY_TABLE amqp_empty_table
780 
790 #define AMQP_EMPTY_ARRAY amqp_empty_array
791 
813 AMQP_PUBLIC_FUNCTION
814 void
815 AMQP_CALL init_amqp_pool(amqp_pool_t *pool, size_t pagesize);
816 
837 AMQP_PUBLIC_FUNCTION
838 void
839 AMQP_CALL recycle_amqp_pool(amqp_pool_t *pool);
840 
850 AMQP_PUBLIC_FUNCTION
851 void
852 AMQP_CALL empty_amqp_pool(amqp_pool_t *pool);
853 
870 AMQP_PUBLIC_FUNCTION
871 void *
872 AMQP_CALL amqp_pool_alloc(amqp_pool_t *pool, size_t amount);
873 
893 AMQP_PUBLIC_FUNCTION
894 void
895 AMQP_CALL amqp_pool_alloc_bytes(amqp_pool_t *pool, size_t amount, amqp_bytes_t *output);
896 
915 AMQP_PUBLIC_FUNCTION
917 AMQP_CALL amqp_cstring_bytes(char const *cstr);
918 
935 AMQP_PUBLIC_FUNCTION
937 AMQP_CALL amqp_bytes_malloc_dup(amqp_bytes_t src);
938 
953 AMQP_PUBLIC_FUNCTION
955 AMQP_CALL amqp_bytes_malloc(size_t amount);
956 
971 AMQP_PUBLIC_FUNCTION
972 void
973 AMQP_CALL amqp_bytes_free(amqp_bytes_t bytes);
974 
987 AMQP_PUBLIC_FUNCTION
989 AMQP_CALL amqp_new_connection(void);
990 
1008 AMQP_PUBLIC_FUNCTION
1009 int
1010 AMQP_CALL amqp_get_sockfd(amqp_connection_state_t state);
1011 
1012 
1030 AMQP_DEPRECATED(
1031  AMQP_PUBLIC_FUNCTION
1032  void
1033  AMQP_CALL amqp_set_sockfd(amqp_connection_state_t state, int sockfd)
1034 );
1035 
1036 
1069 AMQP_PUBLIC_FUNCTION
1070 int
1072  int channel_max,
1073  int frame_max,
1074  int heartbeat);
1075 
1087 AMQP_PUBLIC_FUNCTION
1088 int
1090 
1108 AMQP_PUBLIC_FUNCTION
1109 int
1111 
1153 AMQP_PUBLIC_FUNCTION
1154 int
1156  amqp_bytes_t received_data,
1157  amqp_frame_t *decoded_frame);
1158 
1176 AMQP_PUBLIC_FUNCTION
1179 
1204 AMQP_PUBLIC_FUNCTION
1205 void
1207 
1225 AMQP_PUBLIC_FUNCTION
1226 void
1228 
1249 AMQP_PUBLIC_FUNCTION
1250 void
1252  amqp_channel_t channel);
1253 
1275 AMQP_PUBLIC_FUNCTION
1276 int
1277 AMQP_CALL amqp_send_frame(amqp_connection_state_t state, amqp_frame_t const *frame);
1278 
1290 AMQP_PUBLIC_FUNCTION
1291 int
1292 AMQP_CALL amqp_table_entry_cmp(void const *entry1, void const *entry2);
1293 
1321 AMQP_PUBLIC_FUNCTION
1322 int
1323 AMQP_CALL amqp_open_socket(char const *hostname, int portnumber);
1324 
1346 AMQP_PUBLIC_FUNCTION
1347 int
1348 AMQP_CALL amqp_send_header(amqp_connection_state_t state);
1349 
1366 AMQP_PUBLIC_FUNCTION
1369 
1421 AMQP_PUBLIC_FUNCTION
1422 int
1424  amqp_frame_t *decoded_frame);
1425 
1487 AMQP_PUBLIC_FUNCTION
1488 int
1490  amqp_frame_t *decoded_frame,
1491  struct timeval *tv);
1492 
1533 AMQP_PUBLIC_FUNCTION
1534 int
1536  amqp_channel_t expected_channel,
1537  amqp_method_number_t expected_method,
1538  amqp_method_t *output);
1539 
1566 AMQP_PUBLIC_FUNCTION
1567 int
1569  amqp_channel_t channel,
1571  void *decoded);
1572 
1605 AMQP_PUBLIC_FUNCTION
1608  amqp_channel_t channel,
1609  amqp_method_number_t request_id,
1610  amqp_method_number_t *expected_reply_ids,
1611  void *decoded_request_method);
1612 
1627 AMQP_PUBLIC_FUNCTION
1628 void *
1630  amqp_channel_t channel,
1631  amqp_method_number_t request_id,
1632  amqp_method_number_t reply_id,
1633  void *decoded_request_method);
1634 
1674 AMQP_PUBLIC_FUNCTION
1677 
1728 AMQP_PUBLIC_FUNCTION
1730 AMQP_CALL amqp_login(amqp_connection_state_t state, char const *vhost,
1731  int channel_max, int frame_max, int heartbeat,
1732  amqp_sasl_method_enum sasl_method, ...);
1733 
1786 AMQP_PUBLIC_FUNCTION
1788 AMQP_CALL amqp_login_with_properties(amqp_connection_state_t state, char const *vhost,
1789  int channel_max, int frame_max, int heartbeat,
1790  const amqp_table_t *properties, amqp_sasl_method_enum sasl_method, ...);
1791 
1792 struct amqp_basic_properties_t_;
1793 
1840 AMQP_PUBLIC_FUNCTION
1841 int
1843  amqp_bytes_t exchange, amqp_bytes_t routing_key,
1844  amqp_boolean_t mandatory, amqp_boolean_t immediate,
1845  struct amqp_basic_properties_t_ const *properties,
1846  amqp_bytes_t body);
1847 
1858 AMQP_PUBLIC_FUNCTION
1861  int code);
1862 
1876 AMQP_PUBLIC_FUNCTION
1878 AMQP_CALL amqp_connection_close(amqp_connection_state_t state, int code);
1879 
1895 AMQP_PUBLIC_FUNCTION
1896 int
1897 AMQP_CALL amqp_basic_ack(amqp_connection_state_t state, amqp_channel_t channel,
1898  uint64_t delivery_tag, amqp_boolean_t multiple);
1899 
1916 AMQP_PUBLIC_FUNCTION
1918 AMQP_CALL amqp_basic_get(amqp_connection_state_t state, amqp_channel_t channel,
1919  amqp_bytes_t queue, amqp_boolean_t no_ack);
1920 
1936 AMQP_PUBLIC_FUNCTION
1937 int
1939  uint64_t delivery_tag, amqp_boolean_t requeue);
1940 
1960 AMQP_PUBLIC_FUNCTION
1961 int
1962 AMQP_CALL amqp_basic_nack(amqp_connection_state_t state, amqp_channel_t channel,
1963  uint64_t delivery_tag, amqp_boolean_t multiple,
1964  amqp_boolean_t requeue);
1977 AMQP_PUBLIC_FUNCTION
1980 
1996 AMQP_DEPRECATED(
1997  AMQP_PUBLIC_FUNCTION
1998  char *
1999  AMQP_CALL amqp_error_string(int err)
2000 );
2001 
2002 
2014 AMQP_PUBLIC_FUNCTION
2015 const char *
2016 AMQP_CALL amqp_error_string2(int err);
2017 
2018 
2039 AMQP_PUBLIC_FUNCTION
2040 int
2041 AMQP_CALL amqp_decode_table(amqp_bytes_t encoded, amqp_pool_t *pool,
2042  amqp_table_t *output, size_t *offset);
2043 
2063 AMQP_PUBLIC_FUNCTION
2064 int
2065 AMQP_CALL amqp_encode_table(amqp_bytes_t encoded, amqp_table_t *input, size_t *offset);
2066 
2067 
2086 AMQP_PUBLIC_FUNCTION
2087 int
2088 AMQP_CALL amqp_table_clone(amqp_table_t *original, amqp_table_t *clone, amqp_pool_t *pool);
2089 
2095 typedef struct amqp_message_t_ {
2099 } amqp_message_t;
2100 
2119 AMQP_PUBLIC_FUNCTION
2122  amqp_channel_t channel,
2123  amqp_message_t *message, int flags);
2124 
2132 AMQP_PUBLIC_FUNCTION
2133 void
2134 AMQP_CALL amqp_destroy_message(amqp_message_t *message);
2135 
2141 typedef struct amqp_envelope_t_ {
2144  uint64_t delivery_tag;
2149 } amqp_envelope_t;
2150 
2181 AMQP_PUBLIC_FUNCTION
2184  amqp_envelope_t *envelope,
2185  struct timeval *timeout, int flags);
2186 
2194 AMQP_PUBLIC_FUNCTION
2195 void
2196 AMQP_CALL amqp_destroy_envelope(amqp_envelope_t *envelope);
2197 
2198 
2205  char *user;
2206  char *password;
2207  char *host;
2208  char *vhost;
2209  int port;
2210  amqp_boolean_t ssl;
2211 };
2212 
2227 AMQP_PUBLIC_FUNCTION
2228 void
2229 AMQP_CALL amqp_default_connection_info(struct amqp_connection_info *parsed);
2230 
2253 AMQP_PUBLIC_FUNCTION
2254 int
2255 AMQP_CALL amqp_parse_url(char *url, struct amqp_connection_info *parsed);
2256 
2257 /* socket API */
2258 
2275 AMQP_PUBLIC_FUNCTION
2276 int
2277 AMQP_CALL
2278 amqp_socket_open(amqp_socket_t *self, const char *host, int port);
2279 
2297 AMQP_PUBLIC_FUNCTION
2298 int
2299 AMQP_CALL
2300 amqp_socket_open_noblock(amqp_socket_t *self, const char *host, int port, struct timeval *timeout);
2301 
2317 AMQP_PUBLIC_FUNCTION
2318 int
2319 AMQP_CALL
2320 amqp_socket_get_sockfd(amqp_socket_t *self);
2321 
2330 AMQP_PUBLIC_FUNCTION
2331 amqp_socket_t *
2333 
2344 AMQP_PUBLIC_FUNCTION
2345 amqp_table_t *
2347 
2348 AMQP_END_DECLS
2349 
2350 
2351 #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:616
Unexpected protocol state.
Definition: amqp.h:698
the library got an EOF from the socket
Definition: amqp.h:604
int port
the port that the broker is listening on, default on most brokers is 5672
Definition: amqp.h:2209
uint16_t amqp_channel_t
Channel type.
Definition: amqp.h:370
uint64_t body_size
size of the body in bytes
Definition: amqp.h:582
unformatted byte string, datatype: amqp_bytes_t
Definition: amqp.h:522
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:579
uint32_t value
the value before the decimal point is applied
Definition: amqp.h:389
char * password
the password to authenticate with the broker, default on most brokers is 'guest'
Definition: amqp.h:2206
AMQP field table.
Definition: amqp.h:404
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:682
SSL handshake failed.
Definition: amqp.h:715
32-bit signed integer, datatype: int32_t
Definition: amqp.h:510
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:2146
The underlying system timer facility failed.
Definition: amqp.h:694
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:607
Timed out waiting for heartbeat.
Definition: amqp.h:696
uint64_t delivery_tag
the messages delivery tag
Definition: amqp.h:2144
uint16_t class_id
the class for the properties
Definition: amqp.h:581
amqp_status_enum
Status codes.
Definition: amqp.h:658
uint32_t amqp_flags_t
Bitmask for flags.
Definition: amqp.h:363
int8_t i8
int8_t type AMQP_FIELD_KIND_I8
Definition: amqp.h:469
struct amqp_field_value_t_ * entries
linked list of field values
Definition: amqp.h:418
char const * amqp_version(void)
Returns the rabbitmq-c version as a string.
field array (repeated values of another datatype.
Definition: amqp.h:518
amqp_bytes_t body
message body
Definition: amqp.h:2097
amqp_table_t * amqp_get_server_properties(amqp_connection_state_t state)
Get the broker properties table.
An AMQP frame.
Definition: amqp.h:571
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:2205
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:623
char * vhost
the virtual host on the broker to connect to, a good default is "/"
Definition: amqp.h:2208
amqp_bytes_t key
the table entry key.
Definition: amqp.h:494
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_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:670
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:709
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:378
int16_t i16
int16_t type AMQP_FIELD_KIND_I16
Definition: amqp.h:471
double f64
double type AMQP_FIELD_KIND_F64
Definition: amqp.h:478
8-bit signed integer, datatype: int8_t
Definition: amqp.h:506
amqp_delivery_mode_enum
AMQP delivery modes.
Definition: amqp.h:724
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:2145
amqp_field_value_kind_t
Field value types.
Definition: amqp.h:504
An amqp method.
Definition: amqp.h:560
64-bit unsigned integer, datatype: uint64_t
Definition: amqp.h:513
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:713
Incorrect or corrupt data was received from the broker.
Definition: amqp.h:663
Operation timed out.
Definition: amqp.h:693
A list of allocation blocks.
Definition: amqp.h:530
UTF-8 null-terminated character string, datatype: amqp_bytes_t.
Definition: amqp.h:517
int library_error
in case of AMQP_RESPONSE_LIBRARY_EXCEPTION this field will be set to an error code.
Definition: amqp.h:625
int32_t i32
int32_t type AMQP_FIELD_KIND_I32
Definition: amqp.h:473
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:379
amqp_pool_blocklist_t pages
blocks that are the size of pagesize
Definition: amqp.h:547
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:2143
size_t alloc_used
number of bytes in the current allocation block that has been used
Definition: amqp.h:552
An error occurred trying to initialize the socket library.
Definition: amqp.h:703
int amqp_open_socket(char const *hostname, int portnumber)
Open a socket to a remote host.
Unable to resolve the hostname.
Definition: amqp.h:673
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:2095
Envelope object.
Definition: amqp.h:2141
amqp_field_value_t value
the table entry values
Definition: amqp.h:496
uint32_t amqp_method_number_t
Method number.
Definition: amqp.h:356
const amqp_array_t amqp_empty_array
Empty table array structure.
Definition: amqp.h:754
amqp_response_type_enum
Response type.
Definition: amqp.h:603
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:511
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:2142
int amqp_boolean_t
boolean type 0 = false, true otherwise
Definition: amqp.h:349
The amqp_table_t object cannot be serialized because the output buffer is too small.
Definition: amqp.h:687
int amqp_table_clone(amqp_table_t *original, amqp_table_t *clone, amqp_pool_t *pool)
Create a deep-copy of an amqp_table_t object.
The wrong method was received.
Definition: amqp.h:691
amqp_decimal_t decimal
amqp_decimal_t AMQP_FIELD_KIND_DECIMAL
Definition: amqp.h:479
boolean type.
Definition: amqp.h:505
Persistent message.
Definition: amqp.h:726
empty entry
Definition: amqp.h:521
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:740
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.
Parameters used to connect to the RabbitMQ broker.
Definition: amqp.h:2204
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:678
amqp_table_t table
amqp_table_t type AMQP_FIELD_KIND_TABLE
Definition: amqp.h:481
library error, an error occurred in the library, examine the library_error
Definition: amqp.h:606
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:701
amqp_bytes_t body_fragment
a body fragment, use if frame_type == AMQP_FRAME_BODY
Definition: amqp.h:587
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:667
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:561
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:2148
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:66
Decimal data type.
Definition: amqp.h:387
int next_page
an index to the next unused page block
Definition: amqp.h:550
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:417
the PLAIN SASL method for authentication to the broker
Definition: amqp.h:636
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:577
uint8_t decimals
the location of the decimal point
Definition: amqp.h:388
Operation successful.
Definition: amqp.h:660
amqp_pool_t pool
pool used to allocate properties
Definition: amqp.h:2098
uint16_t u16
uint16_t type AMQP_FIELD_KIND_U16
Definition: amqp.h:472
An AMQP Field Array.
Definition: amqp.h:416
single-precision floating point value, datatype: float
Definition: amqp.h:514
amqp-decimal value, datatype: amqp_decimal_t
Definition: amqp.h:516
const amqp_table_t amqp_empty_table
Empty table structure.
Definition: amqp.h:747
The broker advertised an incompaible AMQP version.
Definition: amqp.h:675
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:508
uint32_t u32
uint32_t type AMQP_FIELD_KIND_U32
Definition: amqp.h:474
A generic SSL error occurred.
Definition: amqp.h:707
char * host
the hostname of the broker
Definition: amqp.h:2207
uint8_t u8
uint8_t type AMQP_FIELD_KIND_U8
Definition: amqp.h:470
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:466
8-bit unsigned integer, datatype: uint8_t
Definition: amqp.h:507
A field table value.
Definition: amqp.h:465
amqp_pool_blocklist_t large_blocks
allocations larger than the pagesize
Definition: amqp.h:548
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:661
An invalid parameter was passed into the function.
Definition: amqp.h:684
float f32
float type AMQP_FIELD_KIND_F32
Definition: amqp.h:477
field table.
Definition: amqp.h:520
Non-persistent message.
Definition: amqp.h:725
void init_amqp_pool(amqp_pool_t *pool, size_t pagesize)
Initializes an amqp_pool_t memory allocation pool for use.
int64_t i64
int64_t type AMQP_FIELD_KIND_I64
Definition: amqp.h:475
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:583
size_t pagesize
the size of the page in bytes.
Definition: amqp.h:541
An entry in a field-table.
Definition: amqp.h:493
char * alloc_block
pointer to the current allocation block
Definition: amqp.h:551
double-precision floating point value, datatype: double
Definition: amqp.h:515
Definition: amqp_framing.h:586
response normal, the RPC completed successfully
Definition: amqp.h:605
void ** blocklist
Array of memory blocks.
Definition: amqp.h:532
amqp_sasl_method_enum
SASL method type.
Definition: amqp.h:635
void * decoded
pointer to the decoded method, cast to the appropriate type to use
Definition: amqp.h:562
struct amqp_table_entry_t_ * entries
an array of table entries
Definition: amqp.h:406
amqp_bytes_t raw
amqp-encoded properties structure
Definition: amqp.h:584
Buffer descriptor.
Definition: amqp.h:377
int num_blocks
Number of blocks in the block list.
Definition: amqp.h:531
A memory pool.
Definition: amqp.h:540
amqp_connection_state_t amqp_new_connection(void)
Allocate and initialize a new amqp_connection_state_t object.
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:476
amqp_boolean_t boolean
boolean type AMQP_FIELD_KIND_BOOLEAN
Definition: amqp.h:468
uint8_t frame_type
frame type.
Definition: amqp.h:572
64-bit timestamp.
Definition: amqp.h:519
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:2096
void recycle_amqp_pool(amqp_pool_t *pool)
Recycles an amqp_pool_t memory allocation pool.
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:615
amqp_bytes_t bytes
amqp_bytes_t type AMQP_FIELD_KIND_UTF8, AMQP_FIELD_KIND_BYTES
Definition: amqp.h:480
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:509
amqp_array_t array
amqp_array_t type AMQP_FIELD_KIND_ARRAY
Definition: amqp.h:482
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:405
64-bit signed integer, datatype: int64_t
Definition: amqp.h:512
malformed AMQP URL
Definition: amqp.h:681
struct amqp_connection_state_t_ * amqp_connection_state_t
connection state object
Definition: amqp.h:644
amqp_bytes_t routing_key
the routing key this message was published with
Definition: amqp.h:2147