diff options
| author | Oskari Timperi <oskari.timperi@iki.fi> | 2017-02-18 15:49:04 +0200 |
|---|---|---|
| committer | Oskari Timperi <oskari.timperi@iki.fi> | 2017-02-18 15:49:04 +0200 |
| commit | da1ed7964441327f7ac95af7327d379c01b5aaf2 (patch) | |
| tree | 41105624a8e5f59e36c8e7f2fe383fbba0e5de12 /test/interop/testclient.h | |
| parent | 64c0b42a8178b1573ceebfda93e3f4526fa2d8d0 (diff) | |
| download | mqtt-da1ed7964441327f7ac95af7327d379c01b5aaf2.tar.gz mqtt-da1ed7964441327f7ac95af7327d379c01b5aaf2.zip | |
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
Diffstat (limited to 'test/interop/testclient.h')
| -rw-r--r-- | test/interop/testclient.h | 63 |
1 files changed, 63 insertions, 0 deletions
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 |
