Module: kamailio
Branch: master
Commit: 1b589c2070973ace082205dc0985363570c5b7f6
URL:
https://github.com/kamailio/kamailio/commit/1b589c2070973ace082205dc0985363…
Author: Sergey Safarov <s.safarov(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-12-12T12:50:18+01:00
rabbitmq: fixed rabbitmq-c deprecation warning
---
Modified: src/modules/rabbitmq/Makefile
Modified: src/modules/rabbitmq/rabbitmq.c
Modified: src/modules/rabbitmq/utils.c
---
Diff:
https://github.com/kamailio/kamailio/commit/1b589c2070973ace082205dc0985363…
Patch:
https://github.com/kamailio/kamailio/commit/1b589c2070973ace082205dc0985363…
---
diff --git a/src/modules/rabbitmq/Makefile b/src/modules/rabbitmq/Makefile
index 72633cc9c29..09023aaf827 100644
--- a/src/modules/rabbitmq/Makefile
+++ b/src/modules/rabbitmq/Makefile
@@ -10,6 +10,10 @@ RMQ_BUILDER=$(shell \
if pkg-config --exists librabbitmq && pkg-config --exists uuid; then \
echo 'pkg-config librabbitmq uuid'; \
fi)
+
+ ifeq ($(shell pkg-config --atleast-version=0.13.0 librabbitmq; echo $$?),0)
+ DEFS += -DRABBITMQ_DEPRECATION
+ endif
endif
ifneq ($(RMQ_BUILDER),)
diff --git a/src/modules/rabbitmq/rabbitmq.c b/src/modules/rabbitmq/rabbitmq.c
index b426ffb9d0b..8547bacac79 100644
--- a/src/modules/rabbitmq/rabbitmq.c
+++ b/src/modules/rabbitmq/rabbitmq.c
@@ -51,10 +51,18 @@
#include <uuid/uuid.h>
#include <stdint.h>
+
+#if RABBITMQ_DEPRECATION
+#include <rabbitmq-c/tcp_socket.h>
+#include <rabbitmq-c/amqp.h>
+#include <rabbitmq-c/framing.h>
+#include <rabbitmq-c/ssl_socket.h>
+#else
#include <amqp_tcp_socket.h>
#include <amqp_ssl_socket.h>
#include <amqp.h>
#include <amqp_framing.h>
+#endif
#include <assert.h>
diff --git a/src/modules/rabbitmq/utils.c b/src/modules/rabbitmq/utils.c
index 6edbc22ea1d..e40492a3cc8 100644
--- a/src/modules/rabbitmq/utils.c
+++ b/src/modules/rabbitmq/utils.c
@@ -44,8 +44,14 @@
#include <ctype.h>
#include <stdint.h>
+
+#if RABBITMQ_DEPRECATION
+#include <rabbitmq-c/amqp.h>
+#include <rabbitmq-c/framing.h>
+#else
#include <amqp.h>
#include <amqp_framing.h>
+#endif
#include "utils.h"