summaryrefslogtreecommitdiff
path: root/librabbitmq/amqp.h
diff options
context:
space:
mode:
authorTony Garnock-Jones <tonyg@kcbbs.gen.nz>2009-04-26 23:21:23 +0100
committerTony Garnock-Jones <tonyg@kcbbs.gen.nz>2009-04-26 23:21:23 +0100
commite1dec49d13caa05af05984af12f3e8354387f33f (patch)
tree8e83237174c0db0c7fd4e1b42ce7c8b3afb8b3ee /librabbitmq/amqp.h
parentaf9315c575b8788b28bb3c5d959a9462b12b9a15 (diff)
downloadrabbitmq-c-github-ask-e1dec49d13caa05af05984af12f3e8354387f33f.tar.gz
Publication works!
Diffstat (limited to 'librabbitmq/amqp.h')
-rw-r--r--librabbitmq/amqp.h80
1 files changed, 65 insertions, 15 deletions
diff --git a/librabbitmq/amqp.h b/librabbitmq/amqp.h
index 314e2c9..18a7c76 100644
--- a/librabbitmq/amqp.h
+++ b/librabbitmq/amqp.h
@@ -5,8 +5,6 @@
extern "C" {
#endif
-typedef int (*amqp_writer_fun_t)(int context, void const *buf, size_t len);
-
typedef int amqp_boolean_t;
typedef uint32_t amqp_method_number_t;
typedef uint32_t amqp_flags_t;
@@ -55,28 +53,41 @@ typedef struct amqp_pool_t_ {
size_t alloc_used;
} amqp_pool_t;
+typedef struct amqp_method_t_ {
+ amqp_method_number_t id;
+ void *decoded;
+} amqp_method_t;
+
typedef struct amqp_frame_t_ {
uint8_t frame_type; /* 0 means no event */
amqp_channel_t channel;
union {
- struct {
- amqp_method_number_t id;
- void *decoded;
- } method;
+ amqp_method_t method;
struct {
uint16_t class_id;
+ uint64_t body_size;
void *decoded;
} properties;
amqp_bytes_t body_fragment;
} payload;
} amqp_frame_t;
-#define AMQP_EXCEPTION_CATEGORY_UNKNOWN 0
-#define AMQP_EXCEPTION_CATEGORY_CONNECTION 1
-#define AMQP_EXCEPTION_CATEGORY_CHANNEL 2
+typedef enum amqp_response_type_enum_ {
+ AMQP_RESPONSE_NONE = 0,
+ AMQP_RESPONSE_NORMAL,
+ AMQP_RESPONSE_LIBRARY_EXCEPTION,
+ AMQP_RESPONSE_SERVER_EXCEPTION
+} amqp_response_type_enum;
+
+typedef struct amqp_rpc_reply_t_ {
+ amqp_response_type_enum reply_type;
+ amqp_method_t reply;
+ int library_errno; /* if AMQP_RESPONSE_LIBRARY_EXCEPTION, then 0 here means socket EOF */
+} amqp_rpc_reply_t;
-#define AMQP_FRAME_COMPLETE 0
-#define AMQP_FRAME_INCOMPLETE 1
+typedef enum amqp_sasl_method_enum_ {
+ AMQP_SASL_METHOD_PLAIN = 0
+} amqp_sasl_method_enum;
/* Opaque struct. */
typedef struct amqp_connection_state_t_ *amqp_connection_state_t;
@@ -88,8 +99,13 @@ extern void recycle_amqp_pool(amqp_pool_t *pool);
extern void empty_amqp_pool(amqp_pool_t *pool);
extern void *amqp_pool_alloc(amqp_pool_t *pool, size_t amount);
+extern void amqp_pool_alloc_bytes(amqp_pool_t *pool, size_t amount, amqp_bytes_t *output);
+
+extern amqp_bytes_t amqp_cstring_bytes(char const *cstr);
extern amqp_connection_state_t amqp_new_connection(void);
+extern void amqp_set_sockfd(amqp_connection_state_t state,
+ int sockfd);
extern void amqp_tune_connection(amqp_connection_state_t state,
int frame_max);
extern void amqp_destroy_connection(amqp_connection_state_t state);
@@ -98,21 +114,55 @@ extern int amqp_handle_input(amqp_connection_state_t state,
amqp_bytes_t received_data,
amqp_frame_t *decoded_frame);
+extern amqp_boolean_t amqp_release_buffers_ok(amqp_connection_state_t state);
+
+extern void amqp_release_buffers(amqp_connection_state_t state);
+
+extern void amqp_maybe_release_buffers(amqp_connection_state_t state);
+
extern int amqp_send_frame(amqp_connection_state_t state,
- amqp_writer_fun_t writer,
- int context,
amqp_frame_t const *frame);
extern int amqp_table_entry_cmp(void const *entry1, void const *entry2);
extern int amqp_open_socket(char const *hostname, int portnumber);
-extern int amqp_send_header(amqp_writer_fun_t writer, int context);
+extern int amqp_send_header(amqp_connection_state_t state);
+
+extern amqp_boolean_t amqp_frames_enqueued(amqp_connection_state_t state);
extern int amqp_simple_wait_frame(amqp_connection_state_t state,
- int sockfd,
amqp_frame_t *decoded_frame);
+extern int amqp_simple_wait_method(amqp_connection_state_t state,
+ amqp_method_number_t expected_or_zero,
+ amqp_method_t *output);
+
+extern int amqp_send_method(amqp_connection_state_t state,
+ amqp_channel_t channel,
+ amqp_method_number_t id,
+ void *decoded);
+
+extern 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_id,
+ void *decoded_request_method);
+
+extern amqp_rpc_reply_t amqp_login(amqp_connection_state_t state,
+ char const *vhost,
+ int frame_max,
+ amqp_sasl_method_enum sasl_method, ...);
+
+struct amqp_basic_properties_t_;
+extern int amqp_basic_publish(amqp_connection_state_t state,
+ 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);
+
#ifdef __cplusplus
}
#endif