common.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright 2007 - 2021, Alan Antonuk and the rabbitmq-c contributors.
  2. // SPDX-License-Identifier: mit
  3. #include <stdint.h>
  4. #include <popt.h>
  5. #include <rabbitmq-c/amqp.h>
  6. #include <rabbitmq-c/framing.h>
  7. extern const char *amqp_server_exception_string(amqp_rpc_reply_t r);
  8. extern const char *amqp_rpc_reply_string(amqp_rpc_reply_t r);
  9. extern void die(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
  10. extern void die_errno(int err, const char *fmt, ...)
  11. __attribute__((format(printf, 2, 3)));
  12. extern void die_amqp_error(int err, const char *fmt, ...)
  13. __attribute__((format(printf, 2, 3)));
  14. extern void die_rpc(amqp_rpc_reply_t r, const char *fmt, ...)
  15. __attribute__((format(printf, 2, 3)));
  16. extern const char *connect_options_title;
  17. extern struct poptOption connect_options[];
  18. extern amqp_connection_state_t make_connection(void);
  19. extern void close_connection(amqp_connection_state_t conn);
  20. extern amqp_bytes_t read_all(int fd);
  21. extern void write_all(int fd, amqp_bytes_t data);
  22. extern void copy_body(amqp_connection_state_t conn, int fd);
  23. #define INCLUDE_OPTIONS(options) \
  24. { NULL, 0, POPT_ARG_INCLUDE_TABLE, options, 0, options##_title, NULL }
  25. extern poptContext process_options(int argc, const char **argv,
  26. struct poptOption *options,
  27. const char *help);
  28. extern void process_all_options(int argc, const char **argv,
  29. struct poptOption *options);
  30. extern amqp_bytes_t cstring_bytes(const char *str);