42 0, 0, 0, 0,
"\n", 100,
44 MQTTVERSION_DEFAULT, NULL,
"paho-cs-sub", 0, 0, NULL, NULL,
"localhost",
"1883", NULL, 10,
46 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
59 printf(
"Connecting\n");
64 conn_opts = conn_opts5;
78 conn_opts.
will = &will_opts;
94 conn_opts.
ssl = &ssl_opts;
115 fprintf(stderr,
"Connected\n");
125 signal(SIGINT, NULL);
132 fprintf(stderr,
"Trace : %d, %s\n", level, message);
136 int main(
int argc,
char** argv)
147 const char* program_name =
"paho_cs_sub";
153 if (
getopts(argc, argv, &opts) != 0)
156 if (strchr(opts.
topic,
'#') || strchr(opts.
topic,
'+'))
164 sprintf(url,
"%s:%s", opts.
host, opts.
port);
167 printf(
"URL is %s\n", url);
190 memset(&sa, 0,
sizeof(
struct sigaction));
194 sigaction(SIGINT, &sa, NULL);
195 sigaction(SIGTERM, &sa, NULL);
212 fprintf(stderr,
"Error %d subscribing to topic %s\n", rc, opts.
topic);
218 char* topicName = NULL;
228 printf(
"%s\t", topicName);
int MQTTClient_receive(MQTTClient handle, char **topicName, int *topicLen, MQTTClient_message **message, unsigned long timeout)
#define MQTTCLIENT_SUCCESS
int MQTTClient_connect(MQTTClient handle, MQTTClient_connectOptions *options)
int MQTTClient_disconnect(MQTTClient handle, int timeout)
const char * enabledCipherSuites
void usage(struct pubsub_opts *opts, pubsub_opts_nameValue *name_values, const char *program_name)
#define MQTTClient_connectOptions_initializer5
int MQTTClient_createWithOptions(MQTTClient *handle, const char *serverURI, const char *clientId, int persistence_type, void *persistence_context, MQTTClient_createOptions *options)
enum MQTTReasonCodes reasonCode
void MQTTResponse_free(MQTTResponse response)
MQTTAsync_connectOptions conn_opts
#define MQTTClient_willOptions_initializer
void MQTTClient_setTraceLevel(enum MQTTCLIENT_TRACE_LEVELS level)
MQTTClient_SSLOptions * ssl
void MQTTClient_setTraceCallback(MQTTClient_traceCallback *callback)
const char * MQTTClient_strerror(int code)
This structure represents a persistent data store, used to store outbound and inbound messages...
MQTTClient_nameValue * MQTTClient_getVersionInfo(void)
void MQTTClient_freeMessage(MQTTClient_message **message)
void MQTTClient_destroy(MQTTClient *handle)
MQTTResponse MQTTClient_connect5(MQTTClient handle, MQTTClient_connectOptions *options, MQTTProperties *connectProperties, MQTTProperties *willProperties)
MQTTProperties properties
int main(int argc, char **argv)
int MQTTClient_subscribe(MQTTClient handle, const char *topic, int qos)
void logProperties(MQTTProperties *props)
MQTTResponse MQTTClient_subscribe5(MQTTClient handle, const char *topic, int qos, MQTTSubscribe_options *opts, MQTTProperties *props)
void MQTTClient_free(void *memory)
#define MQTTCLIENT_PERSISTENCE_NONE
#define MQTTResponse_initializer
#define MQTTClient_connectOptions_initializer
void trace_callback(enum MQTTCLIENT_TRACE_LEVELS level, char *message)
#define MQTTClient_createOptions_initializer
#define MQTTClient_SSLOptions_initializer
const char * privateKeyPassword
int getopts(int argc, char **argv, struct pubsub_opts *opts)
int myconnect(MQTTClient *client)
#define MQTTVERSION_DEFAULT
MQTTClient_willOptions * will
#define MQTTProperties_initializer