rabbitmq-c
0.5.3
C AMQP Client library for RabbitMQ
|
00001 /* vim:set ft=c ts=2 sw=2 sts=2 et cindent: */ 00003 /* 00004 * ***** BEGIN LICENSE BLOCK ***** 00005 * Version: MIT 00006 * 00007 * Portions created by Alan Antonuk are Copyright (c) 2012-2014 00008 * Alan Antonuk. All Rights Reserved. 00009 * 00010 * Portions created by VMware are Copyright (c) 2007-2012 VMware, Inc. 00011 * All Rights Reserved. 00012 * 00013 * Portions created by Tony Garnock-Jones are Copyright (c) 2009-2010 00014 * VMware, Inc. and Tony Garnock-Jones. All Rights Reserved. 00015 * 00016 * Permission is hereby granted, free of charge, to any person 00017 * obtaining a copy of this software and associated documentation 00018 * files (the "Software"), to deal in the Software without 00019 * restriction, including without limitation the rights to use, copy, 00020 * modify, merge, publish, distribute, sublicense, and/or sell copies 00021 * of the Software, and to permit persons to whom the Software is 00022 * furnished to do so, subject to the following conditions: 00023 * 00024 * The above copyright notice and this permission notice shall be 00025 * included in all copies or substantial portions of the Software. 00026 * 00027 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00028 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00029 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00030 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 00031 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 00032 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00033 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00034 * SOFTWARE. 00035 * ***** END LICENSE BLOCK ***** 00036 */ 00037 00038 #ifndef AMQP_H 00039 #define AMQP_H 00040 00043 #ifdef __cplusplus 00044 #define AMQP_BEGIN_DECLS extern "C" { 00045 #define AMQP_END_DECLS } 00046 #else 00047 #define AMQP_BEGIN_DECLS 00048 #define AMQP_END_DECLS 00049 #endif 00050 00051 /* 00052 * \internal 00053 * Important API decorators: 00054 * AMQP_PUBLIC_FUNCTION - a public API function 00055 * AMQP_PUBLIC_VARIABLE - a public API external variable 00056 * AMQP_CALL - calling convension (used on Win32) 00057 */ 00058 00059 #if defined(_WIN32) && defined(_MSC_VER) 00060 # if defined(AMQP_BUILD) && !defined(AMQP_STATIC) 00061 # define AMQP_PUBLIC_FUNCTION __declspec(dllexport) 00062 # define AMQP_PUBLIC_VARIABLE __declspec(dllexport) extern 00063 # else 00064 # define AMQP_PUBLIC_FUNCTION 00065 # if !defined(AMQP_STATIC) 00066 # define AMQP_PUBLIC_VARIABLE __declspec(dllimport) extern 00067 # else 00068 # define AMQP_PUBLIC_VARIABLE extern 00069 # endif 00070 # endif 00071 # define AMQP_CALL __cdecl 00072 00073 #elif defined(_WIN32) && defined(__BORLANDC__) 00074 # if defined(AMQP_BUILD) && !defined(AMQP_STATIC) 00075 # define AMQP_PUBLIC_FUNCTION __declspec(dllexport) 00076 # define AMQP_PUBLIC_VARIABLE __declspec(dllexport) extern 00077 # else 00078 # define AMQP_PUBLIC_FUNCTION 00079 # if !defined(AMQP_STATIC) 00080 # define AMQP_PUBLIC_VARIABLE __declspec(dllimport) extern 00081 # else 00082 # define AMQP_PUBLIC_VARIABLE extern 00083 # endif 00084 # endif 00085 # define AMQP_CALL __cdecl 00086 00087 #elif defined(_WIN32) && defined(__MINGW32__) 00088 # if defined(AMQP_BUILD) && !defined(AMQP_STATIC) 00089 # define AMQP_PUBLIC_FUNCTION __declspec(dllexport) 00090 # define AMQP_PUBLIC_VARIABLE __declspec(dllexport) extern 00091 # else 00092 # define AMQP_PUBLIC_FUNCTION 00093 # if !defined(AMQP_STATIC) 00094 # define AMQP_PUBLIC_VARIABLE __declspec(dllimport) extern 00095 # else 00096 # define AMQP_PUBLIC_VARIABLE extern 00097 # endif 00098 # endif 00099 # define AMQP_CALL __cdecl 00100 00101 #elif defined(_WIN32) && defined(__CYGWIN__) 00102 # if defined(AMQP_BUILD) && !defined(AMQP_STATIC) 00103 # define AMQP_PUBLIC_FUNCTION __declspec(dllexport) 00104 # define AMQP_PUBLIC_VARIABLE __declspec(dllexport) 00105 # else 00106 # define AMQP_PUBLIC_FUNCTION 00107 # if !defined(AMQP_STATIC) 00108 # define AMQP_PUBLIC_VARIABLE __declspec(dllimport) extern 00109 # else 00110 # define AMQP_PUBLIC_VARIABLE extern 00111 # endif 00112 # endif 00113 # define AMQP_CALL __cdecl 00114 00115 #elif defined(__GNUC__) && __GNUC__ >= 4 00116 # define AMQP_PUBLIC_FUNCTION \ 00117 __attribute__ ((visibility ("default"))) 00118 # define AMQP_PUBLIC_VARIABLE \ 00119 __attribute__ ((visibility ("default"))) extern 00120 # define AMQP_CALL 00121 #else 00122 # define AMQP_PUBLIC_FUNCTION 00123 # define AMQP_PUBLIC_VARIABLE extern 00124 # define AMQP_CALL 00125 #endif 00126 00127 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) 00128 # define AMQP_DEPRECATED(function) \ 00129 function __attribute__ ((__deprecated__)) 00130 #elif defined(_MSC_VER) 00131 # define AMQP_DEPRECATED(function) \ 00132 __declspec(deprecated) function 00133 #else 00134 # define AMQP_DEPRECATED(function) 00135 #endif 00136 00137 /* Define ssize_t on Win32/64 platforms 00138 See: http://lists.cs.uiuc.edu/pipermail/llvmdev/2010-April/030649.html for details 00139 */ 00140 #if !defined(_W64) 00141 #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 00142 #define _W64 __w64 00143 #else 00144 #define _W64 00145 #endif 00146 #endif 00147 00148 #ifdef _MSC_VER 00149 #ifdef _WIN64 00150 typedef __int64 ssize_t; 00151 #else 00152 typedef _W64 int ssize_t; 00153 #endif 00154 #endif 00155 00156 #if defined(_WIN32) && defined(__MINGW32__) 00157 #include <sys/types.h> 00158 #endif 00159 00162 #include <stddef.h> 00163 #include <stdint.h> 00164 00165 struct timeval; 00166 00167 AMQP_BEGIN_DECLS 00168 00220 /* 00221 * Developer note: when changing these, be sure to update SOVERSION constants 00222 * in CMakeLists.txt and configure.ac 00223 */ 00224 00225 #define AMQP_VERSION_MAJOR 0 00226 #define AMQP_VERSION_MINOR 5 00227 #define AMQP_VERSION_PATCH 3 00228 #define AMQP_VERSION_IS_RELEASE 0 00229 00230 00249 #define AMQP_VERSION ((AMQP_VERSION_MAJOR << 24) | \ 00250 (AMQP_VERSION_MINOR << 16) | \ 00251 (AMQP_VERSION_PATCH << 8) | \ 00252 (AMQP_VERSION_IS_RELEASE)) 00253 00255 #define AMQ_STRINGIFY(s) AMQ_STRINGIFY_HELPER(s) 00256 #define AMQ_STRINGIFY_HELPER(s) #s 00257 00258 #define AMQ_VERSION_STRING AMQ_STRINGIFY(AMQP_VERSION_MAJOR) "." \ 00259 AMQ_STRINGIFY(AMQP_VERSION_MINOR) "." \ 00260 AMQ_STRINGIFY(AMQP_VERSION_PATCH) 00261 00275 #if AMQP_VERSION_IS_RELEASE 00276 # define AMQP_VERSION_STRING AMQ_VERSION_STRING 00277 #else 00278 # define AMQP_VERSION_STRING AMQ_VERSION_STRING "-pre" 00279 #endif 00280 00281 00293 AMQP_PUBLIC_FUNCTION 00294 uint32_t 00295 AMQP_CALL amqp_version_number(void); 00296 00308 AMQP_PUBLIC_FUNCTION 00309 char const * 00310 AMQP_CALL amqp_version(void); 00311 00321 #define AMQP_DEFAULT_FRAME_SIZE 131072 00322 00332 #define AMQP_DEFAULT_MAX_CHANNELS 0 00333 00343 #define AMQP_DEFAULT_HEARTBEAT 0 00344 00350 typedef int amqp_boolean_t; 00351 00357 typedef uint32_t amqp_method_number_t; 00358 00364 typedef uint32_t amqp_flags_t; 00365 00371 typedef uint16_t amqp_channel_t; 00372 00378 typedef struct amqp_bytes_t_ { 00379 size_t len; 00380 void *bytes; 00381 } amqp_bytes_t; 00382 00388 typedef struct amqp_decimal_t_ { 00389 uint8_t decimals; 00390 uint32_t value; 00391 } amqp_decimal_t; 00392 00405 typedef struct amqp_table_t_ { 00406 int num_entries; 00407 struct amqp_table_entry_t_ *entries; 00408 } amqp_table_t; 00409 00417 typedef struct amqp_array_t_ { 00418 int num_entries; 00419 struct amqp_field_value_t_ *entries; 00420 } amqp_array_t; 00421 00422 /* 00423 0-9 0-9-1 Qpid/Rabbit Type Remarks 00424 --------------------------------------------------------------------------- 00425 t t Boolean 00426 b b Signed 8-bit 00427 B Unsigned 8-bit 00428 U s Signed 16-bit (A1) 00429 u Unsigned 16-bit 00430 I I I Signed 32-bit 00431 i Unsigned 32-bit 00432 L l Signed 64-bit (B) 00433 l Unsigned 64-bit 00434 f f 32-bit float 00435 d d 64-bit float 00436 D D D Decimal 00437 s Short string (A2) 00438 S S S Long string 00439 A Nested Array 00440 T T T Timestamp (u64) 00441 F F F Nested Table 00442 V V V Void 00443 x Byte array 00444 00445 Remarks: 00446 00447 A1, A2: Notice how the types **CONFLICT** here. In Qpid and Rabbit, 00448 's' means a signed 16-bit integer; in 0-9-1, it means a 00449 short string. 00450 00451 B: Notice how the signednesses **CONFLICT** here. In Qpid and Rabbit, 00452 'l' means a signed 64-bit integer; in 0-9-1, it means an unsigned 00453 64-bit integer. 00454 00455 I'm going with the Qpid/Rabbit types, where there's a conflict, and 00456 the 0-9-1 types otherwise. 0-8 is a subset of 0-9, which is a subset 00457 of the other two, so this will work for both 0-8 and 0-9-1 branches of 00458 the code. 00459 */ 00460 00466 typedef struct amqp_field_value_t_ { 00467 uint8_t kind; 00468 union { 00469 amqp_boolean_t boolean; 00470 int8_t i8; 00471 uint8_t u8; 00472 int16_t i16; 00473 uint16_t u16; 00474 int32_t i32; 00475 uint32_t u32; 00476 int64_t i64; 00477 uint64_t u64; 00478 float f32; 00479 double f64; 00480 amqp_decimal_t decimal; 00481 amqp_bytes_t bytes; 00482 amqp_table_t table; 00483 amqp_array_t array; 00484 } value; 00485 } amqp_field_value_t; 00486 00494 typedef struct amqp_table_entry_t_ { 00495 amqp_bytes_t key; 00497 amqp_field_value_t value; 00498 } amqp_table_entry_t; 00499 00505 typedef enum { 00506 AMQP_FIELD_KIND_BOOLEAN = 't', 00507 AMQP_FIELD_KIND_I8 = 'b', 00508 AMQP_FIELD_KIND_U8 = 'B', 00509 AMQP_FIELD_KIND_I16 = 's', 00510 AMQP_FIELD_KIND_U16 = 'u', 00511 AMQP_FIELD_KIND_I32 = 'I', 00512 AMQP_FIELD_KIND_U32 = 'i', 00513 AMQP_FIELD_KIND_I64 = 'l', 00514 AMQP_FIELD_KIND_U64 = 'L', 00515 AMQP_FIELD_KIND_F32 = 'f', 00516 AMQP_FIELD_KIND_F64 = 'd', 00517 AMQP_FIELD_KIND_DECIMAL = 'D', 00518 AMQP_FIELD_KIND_UTF8 = 'S', 00519 AMQP_FIELD_KIND_ARRAY = 'A', 00520 AMQP_FIELD_KIND_TIMESTAMP = 'T', 00521 AMQP_FIELD_KIND_TABLE = 'F', 00522 AMQP_FIELD_KIND_VOID = 'V', 00523 AMQP_FIELD_KIND_BYTES = 'x' 00524 } amqp_field_value_kind_t; 00525 00531 typedef struct amqp_pool_blocklist_t_ { 00532 int num_blocks; 00533 void **blocklist; 00534 } amqp_pool_blocklist_t; 00535 00541 typedef struct amqp_pool_t_ { 00542 size_t pagesize; 00548 amqp_pool_blocklist_t pages; 00549 amqp_pool_blocklist_t large_blocks; 00551 int next_page; 00552 char *alloc_block; 00553 size_t alloc_used; 00554 } amqp_pool_t; 00555 00561 typedef struct amqp_method_t_ { 00562 amqp_method_number_t id; 00563 void *decoded; 00565 } amqp_method_t; 00566 00572 typedef struct amqp_frame_t_ { 00573 uint8_t frame_type; 00578 amqp_channel_t channel; 00579 union { 00580 amqp_method_t method; 00581 struct { 00582 uint16_t class_id; 00583 uint64_t body_size; 00584 void *decoded; 00585 amqp_bytes_t raw; 00586 } properties; 00588 amqp_bytes_t body_fragment; 00589 struct { 00590 uint8_t transport_high; 00591 uint8_t transport_low; 00592 uint8_t protocol_version_major; 00593 uint8_t protocol_version_minor; 00594 } protocol_header; 00596 } payload; 00597 } amqp_frame_t; 00598 00604 typedef enum amqp_response_type_enum_ { 00605 AMQP_RESPONSE_NONE = 0, 00606 AMQP_RESPONSE_NORMAL, 00607 AMQP_RESPONSE_LIBRARY_EXCEPTION, 00608 AMQP_RESPONSE_SERVER_EXCEPTION 00609 } amqp_response_type_enum; 00610 00616 typedef struct amqp_rpc_reply_t_ { 00617 amqp_response_type_enum reply_type; 00624 amqp_method_t reply; 00626 int library_error; 00629 } amqp_rpc_reply_t; 00630 00636 typedef enum amqp_sasl_method_enum_ { 00637 AMQP_SASL_METHOD_PLAIN = 0 00638 } amqp_sasl_method_enum; 00639 00645 typedef struct amqp_connection_state_t_ *amqp_connection_state_t; 00646 00652 typedef struct amqp_socket_t_ amqp_socket_t; 00653 00659 typedef enum amqp_status_enum_ 00660 { 00661 AMQP_STATUS_OK = 0x0, 00662 AMQP_STATUS_NO_MEMORY = -0x0001, 00664 AMQP_STATUS_BAD_AMQP_DATA = -0x0002, 00668 AMQP_STATUS_UNKNOWN_CLASS = -0x0003, 00671 AMQP_STATUS_UNKNOWN_METHOD = -0x0004, 00674 AMQP_STATUS_HOSTNAME_RESOLUTION_FAILED= -0x0005, 00676 AMQP_STATUS_INCOMPATIBLE_AMQP_VERSION = -0x0006, 00679 AMQP_STATUS_CONNECTION_CLOSED = -0x0007, 00682 AMQP_STATUS_BAD_URL = -0x0008, 00683 AMQP_STATUS_SOCKET_ERROR = -0x0009, 00685 AMQP_STATUS_INVALID_PARAMETER = -0x000A, 00688 AMQP_STATUS_TABLE_TOO_BIG = -0x000B, 00692 AMQP_STATUS_WRONG_METHOD = -0x000C, 00694 AMQP_STATUS_TIMEOUT = -0x000D, 00695 AMQP_STATUS_TIMER_FAILURE = -0x000E, 00697 AMQP_STATUS_HEARTBEAT_TIMEOUT = -0x000F, 00699 AMQP_STATUS_UNEXPECTED_STATE = -0x0010, 00702 AMQP_STATUS_TCP_ERROR = -0x0100, 00704 AMQP_STATUS_TCP_SOCKETLIB_INIT_ERROR = -0x0101, 00708 AMQP_STATUS_SSL_ERROR = -0x0200, 00710 AMQP_STATUS_SSL_HOSTNAME_VERIFY_FAILED= -0x0201, 00714 AMQP_STATUS_SSL_PEER_VERIFY_FAILED = -0x0202, 00716 AMQP_STATUS_SSL_CONNECTION_FAILED = -0x0203 00717 } amqp_status_enum; 00718 00725 typedef enum { 00726 AMQP_DELIVERY_NONPERSISTENT = 1, 00727 AMQP_DELIVERY_PERSISTENT = 2 00728 } amqp_delivery_mode_enum; 00729 00730 AMQP_END_DECLS 00731 00732 #include <amqp_framing.h> 00733 00734 AMQP_BEGIN_DECLS 00735 00741 AMQP_PUBLIC_VARIABLE const amqp_bytes_t amqp_empty_bytes; 00742 00748 AMQP_PUBLIC_VARIABLE const amqp_table_t amqp_empty_table; 00749 00755 AMQP_PUBLIC_VARIABLE const amqp_array_t amqp_empty_array; 00756 00757 /* Compatibility macros for the above, to avoid the need to update 00758 code written against earlier versions of librabbitmq. */ 00759 00769 #define AMQP_EMPTY_BYTES amqp_empty_bytes 00770 00780 #define AMQP_EMPTY_TABLE amqp_empty_table 00781 00791 #define AMQP_EMPTY_ARRAY amqp_empty_array 00792 00814 AMQP_PUBLIC_FUNCTION 00815 void 00816 AMQP_CALL init_amqp_pool(amqp_pool_t *pool, size_t pagesize); 00817 00838 AMQP_PUBLIC_FUNCTION 00839 void 00840 AMQP_CALL recycle_amqp_pool(amqp_pool_t *pool); 00841 00851 AMQP_PUBLIC_FUNCTION 00852 void 00853 AMQP_CALL empty_amqp_pool(amqp_pool_t *pool); 00854 00871 AMQP_PUBLIC_FUNCTION 00872 void * 00873 AMQP_CALL amqp_pool_alloc(amqp_pool_t *pool, size_t amount); 00874 00894 AMQP_PUBLIC_FUNCTION 00895 void 00896 AMQP_CALL amqp_pool_alloc_bytes(amqp_pool_t *pool, size_t amount, amqp_bytes_t *output); 00897 00916 AMQP_PUBLIC_FUNCTION 00917 amqp_bytes_t 00918 AMQP_CALL amqp_cstring_bytes(char const *cstr); 00919 00936 AMQP_PUBLIC_FUNCTION 00937 amqp_bytes_t 00938 AMQP_CALL amqp_bytes_malloc_dup(amqp_bytes_t src); 00939 00954 AMQP_PUBLIC_FUNCTION 00955 amqp_bytes_t 00956 AMQP_CALL amqp_bytes_malloc(size_t amount); 00957 00972 AMQP_PUBLIC_FUNCTION 00973 void 00974 AMQP_CALL amqp_bytes_free(amqp_bytes_t bytes); 00975 00988 AMQP_PUBLIC_FUNCTION 00989 amqp_connection_state_t 00990 AMQP_CALL amqp_new_connection(void); 00991 01009 AMQP_PUBLIC_FUNCTION 01010 int 01011 AMQP_CALL amqp_get_sockfd(amqp_connection_state_t state); 01012 01013 01031 AMQP_DEPRECATED( 01032 AMQP_PUBLIC_FUNCTION 01033 void 01034 AMQP_CALL amqp_set_sockfd(amqp_connection_state_t state, int sockfd) 01035 ); 01036 01037 01070 AMQP_PUBLIC_FUNCTION 01071 int 01072 AMQP_CALL amqp_tune_connection(amqp_connection_state_t state, 01073 int channel_max, 01074 int frame_max, 01075 int heartbeat); 01076 01088 AMQP_PUBLIC_FUNCTION 01089 int 01090 AMQP_CALL amqp_get_channel_max(amqp_connection_state_t state); 01091 01109 AMQP_PUBLIC_FUNCTION 01110 int 01111 AMQP_CALL amqp_destroy_connection(amqp_connection_state_t state); 01112 01154 AMQP_PUBLIC_FUNCTION 01155 int 01156 AMQP_CALL amqp_handle_input(amqp_connection_state_t state, 01157 amqp_bytes_t received_data, 01158 amqp_frame_t *decoded_frame); 01159 01177 AMQP_PUBLIC_FUNCTION 01178 amqp_boolean_t 01179 AMQP_CALL amqp_release_buffers_ok(amqp_connection_state_t state); 01180 01205 AMQP_PUBLIC_FUNCTION 01206 void 01207 AMQP_CALL amqp_release_buffers(amqp_connection_state_t state); 01208 01226 AMQP_PUBLIC_FUNCTION 01227 void 01228 AMQP_CALL amqp_maybe_release_buffers(amqp_connection_state_t state); 01229 01250 AMQP_PUBLIC_FUNCTION 01251 void 01252 AMQP_CALL amqp_maybe_release_buffers_on_channel(amqp_connection_state_t state, 01253 amqp_channel_t channel); 01254 01276 AMQP_PUBLIC_FUNCTION 01277 int 01278 AMQP_CALL amqp_send_frame(amqp_connection_state_t state, amqp_frame_t const *frame); 01279 01291 AMQP_PUBLIC_FUNCTION 01292 int 01293 AMQP_CALL amqp_table_entry_cmp(void const *entry1, void const *entry2); 01294 01322 AMQP_PUBLIC_FUNCTION 01323 int 01324 AMQP_CALL amqp_open_socket(char const *hostname, int portnumber); 01325 01347 AMQP_PUBLIC_FUNCTION 01348 int 01349 AMQP_CALL amqp_send_header(amqp_connection_state_t state); 01350 01367 AMQP_PUBLIC_FUNCTION 01368 amqp_boolean_t 01369 AMQP_CALL amqp_frames_enqueued(amqp_connection_state_t state); 01370 01422 AMQP_PUBLIC_FUNCTION 01423 int 01424 AMQP_CALL amqp_simple_wait_frame(amqp_connection_state_t state, 01425 amqp_frame_t *decoded_frame); 01426 01488 AMQP_PUBLIC_FUNCTION 01489 int 01490 AMQP_CALL amqp_simple_wait_frame_noblock(amqp_connection_state_t state, 01491 amqp_frame_t *decoded_frame, 01492 struct timeval *tv); 01493 01534 AMQP_PUBLIC_FUNCTION 01535 int 01536 AMQP_CALL amqp_simple_wait_method(amqp_connection_state_t state, 01537 amqp_channel_t expected_channel, 01538 amqp_method_number_t expected_method, 01539 amqp_method_t *output); 01540 01567 AMQP_PUBLIC_FUNCTION 01568 int 01569 AMQP_CALL amqp_send_method(amqp_connection_state_t state, 01570 amqp_channel_t channel, 01571 amqp_method_number_t id, 01572 void *decoded); 01573 01606 AMQP_PUBLIC_FUNCTION 01607 amqp_rpc_reply_t 01608 AMQP_CALL amqp_simple_rpc(amqp_connection_state_t state, 01609 amqp_channel_t channel, 01610 amqp_method_number_t request_id, 01611 amqp_method_number_t *expected_reply_ids, 01612 void *decoded_request_method); 01613 01628 AMQP_PUBLIC_FUNCTION 01629 void * 01630 AMQP_CALL amqp_simple_rpc_decoded(amqp_connection_state_t state, 01631 amqp_channel_t channel, 01632 amqp_method_number_t request_id, 01633 amqp_method_number_t reply_id, 01634 void *decoded_request_method); 01635 01675 AMQP_PUBLIC_FUNCTION 01676 amqp_rpc_reply_t 01677 AMQP_CALL amqp_get_rpc_reply(amqp_connection_state_t state); 01678 01729 AMQP_PUBLIC_FUNCTION 01730 amqp_rpc_reply_t 01731 AMQP_CALL amqp_login(amqp_connection_state_t state, char const *vhost, 01732 int channel_max, int frame_max, int heartbeat, 01733 amqp_sasl_method_enum sasl_method, ...); 01734 01787 AMQP_PUBLIC_FUNCTION 01788 amqp_rpc_reply_t 01789 AMQP_CALL amqp_login_with_properties(amqp_connection_state_t state, char const *vhost, 01790 int channel_max, int frame_max, int heartbeat, 01791 const amqp_table_t *properties, amqp_sasl_method_enum sasl_method, ...); 01792 01793 struct amqp_basic_properties_t_; 01794 01841 AMQP_PUBLIC_FUNCTION 01842 int 01843 AMQP_CALL amqp_basic_publish(amqp_connection_state_t state, amqp_channel_t channel, 01844 amqp_bytes_t exchange, amqp_bytes_t routing_key, 01845 amqp_boolean_t mandatory, amqp_boolean_t immediate, 01846 struct amqp_basic_properties_t_ const *properties, 01847 amqp_bytes_t body); 01848 01859 AMQP_PUBLIC_FUNCTION 01860 amqp_rpc_reply_t 01861 AMQP_CALL amqp_channel_close(amqp_connection_state_t state, amqp_channel_t channel, 01862 int code); 01863 01877 AMQP_PUBLIC_FUNCTION 01878 amqp_rpc_reply_t 01879 AMQP_CALL amqp_connection_close(amqp_connection_state_t state, int code); 01880 01896 AMQP_PUBLIC_FUNCTION 01897 int 01898 AMQP_CALL amqp_basic_ack(amqp_connection_state_t state, amqp_channel_t channel, 01899 uint64_t delivery_tag, amqp_boolean_t multiple); 01900 01917 AMQP_PUBLIC_FUNCTION 01918 amqp_rpc_reply_t 01919 AMQP_CALL amqp_basic_get(amqp_connection_state_t state, amqp_channel_t channel, 01920 amqp_bytes_t queue, amqp_boolean_t no_ack); 01921 01937 AMQP_PUBLIC_FUNCTION 01938 int 01939 AMQP_CALL amqp_basic_reject(amqp_connection_state_t state, amqp_channel_t channel, 01940 uint64_t delivery_tag, amqp_boolean_t requeue); 01941 01961 AMQP_PUBLIC_FUNCTION 01962 int 01963 AMQP_CALL amqp_basic_nack(amqp_connection_state_t state, amqp_channel_t channel, 01964 uint64_t delivery_tag, amqp_boolean_t multiple, 01965 amqp_boolean_t requeue); 01978 AMQP_PUBLIC_FUNCTION 01979 amqp_boolean_t 01980 AMQP_CALL amqp_data_in_buffer(amqp_connection_state_t state); 01981 01997 AMQP_DEPRECATED( 01998 AMQP_PUBLIC_FUNCTION 01999 char * 02000 AMQP_CALL amqp_error_string(int err) 02001 ); 02002 02003 02015 AMQP_PUBLIC_FUNCTION 02016 const char * 02017 AMQP_CALL amqp_error_string2(int err); 02018 02019 02040 AMQP_PUBLIC_FUNCTION 02041 int 02042 AMQP_CALL amqp_decode_table(amqp_bytes_t encoded, amqp_pool_t *pool, 02043 amqp_table_t *output, size_t *offset); 02044 02064 AMQP_PUBLIC_FUNCTION 02065 int 02066 AMQP_CALL amqp_encode_table(amqp_bytes_t encoded, amqp_table_t *input, size_t *offset); 02067 02068 02087 AMQP_PUBLIC_FUNCTION 02088 int 02089 AMQP_CALL amqp_table_clone(amqp_table_t *original, amqp_table_t *clone, amqp_pool_t *pool); 02090 02096 typedef struct amqp_message_t_ { 02097 amqp_basic_properties_t properties; 02098 amqp_bytes_t body; 02099 amqp_pool_t pool; 02100 } amqp_message_t; 02101 02120 AMQP_PUBLIC_FUNCTION 02121 amqp_rpc_reply_t 02122 AMQP_CALL amqp_read_message(amqp_connection_state_t state, 02123 amqp_channel_t channel, 02124 amqp_message_t *message, int flags); 02125 02133 AMQP_PUBLIC_FUNCTION 02134 void 02135 AMQP_CALL amqp_destroy_message(amqp_message_t *message); 02136 02142 typedef struct amqp_envelope_t_ { 02143 amqp_channel_t channel; 02144 amqp_bytes_t consumer_tag; 02145 uint64_t delivery_tag; 02146 amqp_boolean_t redelivered; 02147 amqp_bytes_t exchange; 02148 amqp_bytes_t routing_key; 02149 amqp_message_t message; 02150 } amqp_envelope_t; 02151 02182 AMQP_PUBLIC_FUNCTION 02183 amqp_rpc_reply_t 02184 AMQP_CALL amqp_consume_message(amqp_connection_state_t state, 02185 amqp_envelope_t *envelope, 02186 struct timeval *timeout, int flags); 02187 02195 AMQP_PUBLIC_FUNCTION 02196 void 02197 AMQP_CALL amqp_destroy_envelope(amqp_envelope_t *envelope); 02198 02199 02205 struct amqp_connection_info { 02206 char *user; 02207 char *password; 02208 char *host; 02209 char *vhost; 02210 int port; 02211 amqp_boolean_t ssl; 02212 }; 02213 02228 AMQP_PUBLIC_FUNCTION 02229 void 02230 AMQP_CALL amqp_default_connection_info(struct amqp_connection_info *parsed); 02231 02254 AMQP_PUBLIC_FUNCTION 02255 int 02256 AMQP_CALL amqp_parse_url(char *url, struct amqp_connection_info *parsed); 02257 02258 /* socket API */ 02259 02276 AMQP_PUBLIC_FUNCTION 02277 int 02278 AMQP_CALL 02279 amqp_socket_open(amqp_socket_t *self, const char *host, int port); 02280 02281 02299 AMQP_PUBLIC_FUNCTION 02300 int 02301 AMQP_CALL 02302 amqp_socket_open_noblock(amqp_socket_t *self, const char *host, int port, struct timeval *timeout); 02303 02319 AMQP_PUBLIC_FUNCTION 02320 int 02321 AMQP_CALL 02322 amqp_socket_get_sockfd(amqp_socket_t *self); 02323 02332 AMQP_PUBLIC_FUNCTION 02333 amqp_socket_t * 02334 amqp_get_socket(amqp_connection_state_t state); 02335 02346 AMQP_PUBLIC_FUNCTION 02347 amqp_table_t * 02348 amqp_get_server_properties(amqp_connection_state_t state); 02349 02350 AMQP_END_DECLS 02351 02352 02353 #endif /* AMQP_H */