From da1ed7964441327f7ac95af7327d379c01b5aaf2 Mon Sep 17 00:00:00 2001 From: Oskari Timperi Date: Sat, 18 Feb 2017 15:49:04 +0200 Subject: Add first interop test The tests can be run against the Eclipse Paho interop test broker. https://wiki.eclipse.org/Interop_Testing_Plan https://github.com/eclipse/paho.mqtt.testing --- test/interop/testclient.h | 63 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 test/interop/testclient.h (limited to 'test/interop/testclient.h') diff --git a/test/interop/testclient.h b/test/interop/testclient.h new file mode 100644 index 0000000..6f9bdb9 --- /dev/null +++ b/test/interop/testclient.h @@ -0,0 +1,63 @@ +#ifndef TESTCLIENT_H +#define TESTCLIENT_H + +#include "mqtt.h" +#include "queue.h" + +typedef struct Message Message; + +struct Message +{ + SIMPLEQ_ENTRY(Message) chain; + char *topic; + void *data; + size_t size; + int qos; + int retain; +}; + +typedef struct TestClient TestClient; + +struct TestClient +{ + MqttClient *client; + + /* OnConnect */ + MqttConnectionStatus connectionStatus; + int sessionPresent; + + /* OnSubscribe */ + int subId; + MqttSubscriptionStatus subStatus; + + /* OnPublish */ + int pubId; + + /* OnMessage */ + SIMPLEQ_HEAD(messages, Message) messages; +}; + +Message *MessageNew(const char *topic, const void *data, size_t size, + int qos, int retain); + +void MessageFree(Message *msg); + +TestClient *TestClientNew(const char *clientId); + +void TestClientFree(TestClient *client); + +int TestClientConnect(TestClient *client, const char *host, int port, + int keepAlive, int cleanSession); + +void TestClientDisconnect(TestClient *client); + +int TestClientSubscribe(TestClient *client, const char *topicFilter, int qos); + +int TestClientPublish(TestClient *client, int qos, int retain, + const char *topic, const char *message); + +int TestClientMessageCount(TestClient *client); + +int TestClientWait(TestClient *client, int timeout); + +#endif -- cgit v1.2.3