ms-runner/transport/transport.h

27 lines
856 B
C

#define _GNU_SOURCE
#include "gen/runner/v1/runner.pb-c.h"
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <rabbitmq-c/amqp.h>
#include <rabbitmq-c/tcp_socket.h>
struct connection_data {
char const *hostname;
int port;
char const *exchange;
char const *bindingkey;
amqp_socket_t *socket;
amqp_connection_state_t conn;
amqp_bytes_t queuename;
};
extern char* amqp_error(amqp_rpc_reply_t x);
#define error_log(err) fprintf(stderr,"error in %s line %d:%s",__FILE__,__LINE__,err);
#define amqp_assert(msg) {char* err=amqp_error(msg);if(err!=NULL) {fprintf(stderr,"amqp error in %s line %d:%s",__FILE__,__LINE__,err);free(err);}}
#define amqp_code_assert(msg) {int32_t code=msg;if(code<0) {fprintf(stderr,"amqp error in %s line %d:%s",__FILE__,__LINE__,amqp_error_string2(code));}}