38 #if defined(_WRS_KERNEL) 65 0, 0, 0, 0,
"\n", 100,
67 MQTTVERSION_DEFAULT, NULL,
"paho-c-sub", 0, 0, NULL, NULL,
"localhost",
"1883", NULL, 10,
69 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
79 printf(
"%d %s\t", message->
payloadlen, topicName);
116 fprintf(stderr,
"Subscribe failed, rc %s reason code %s\n",
126 fprintf(stderr,
"Subscribe failed, rc %s\n",
135 fprintf(stderr,
"Connect failed, rc %s reason code %s\n",
157 printf(
"Subscribing to topic %s with client %s at QoS %d\n", opts.
topic, opts.
clientid, opts.
qos);
165 fprintf(stderr,
"Failed to start subscribe, return code %s\n",
MQTTAsync_strerror(rc));
178 printf(
"Subscribing to topic %s with client %s at QoS %d\n", opts.
topic, opts.
clientid, opts.
qos);
186 fprintf(stderr,
"Failed to start subscribe, return code %s\n",
MQTTAsync_strerror(rc));
196 fprintf(stderr,
"Trace : %d, %s\n", level, message);
200 int main(
int argc,
char** argv)
210 const char* program_name =
"paho_c_sub";
219 if (
getopts(argc, argv, &opts) != 0)
222 if (strchr(opts.
topic,
'#') || strchr(opts.
topic,
'+'))
230 sprintf(url,
"%s:%s", opts.
host, opts.
port);
233 printf(
"URL is %s\n", url);
248 fprintf(stderr,
"Failed to create client, return code: %s\n",
MQTTAsync_strerror(rc));
256 fprintf(stderr,
"Failed to set callbacks, return code: %s\n",
MQTTAsync_strerror(rc));
264 memset(&sa, 0,
sizeof(
struct sigaction));
268 sigaction(SIGINT, &sa, NULL);
269 sigaction(SIGTERM, &sa, NULL);
275 conn_opts = conn_opts5;
299 conn_opts.
will = &will_opts;
312 conn_opts.
ssl = &ssl_opts;
335 fprintf(stderr,
"Failed to start disconnect, return code: %s\n",
MQTTAsync_strerror(rc));
MQTTAsync_onFailure * onFailure
MQTTProperties properties
int MQTTAsync_createWithOptions(MQTTAsync *handle, const char *serverURI, const char *clientId, int persistence_type, void *persistence_context, MQTTAsync_createOptions *options)
MQTTAsync_onFailure5 * onFailure5
void onSubscribeFailure(void *context, MQTTAsync_failureData *response)
#define MQTTAsync_responseOptions_initializer
void onDisconnect(void *context, MQTTAsync_successData *response)
int MQTTAsync_disconnect(MQTTAsync handle, const MQTTAsync_disconnectOptions *options)
int MQTTAsync_setCallbacks(MQTTAsync handle, void *context, MQTTAsync_connectionLost *cl, MQTTAsync_messageArrived *ma, MQTTAsync_deliveryComplete *dc)
const char * MQTTReasonCode_toString(enum MQTTReasonCodes value)
void usage(struct pubsub_opts *opts, pubsub_opts_nameValue *name_values, const char *program_name)
MQTTAsync_nameValue * MQTTAsync_getVersionInfo(void)
void onConnectFailure5(void *context, MQTTAsync_failureData5 *response)
void MQTTAsync_free(void *memory)
void MQTTAsync_freeMessage(MQTTAsync_message **message)
MQTTAsync_onSuccess5 * onSuccess5
void MQTTAsync_setTraceCallback(MQTTAsync_traceCallback *callback)
int MQTTAsync_connect(MQTTAsync handle, const MQTTAsync_connectOptions *options)
void trace_callback(enum MQTTASYNC_TRACE_LEVELS level, char *message)
MQTTAsync_connectOptions conn_opts
int MQTTAsync_subscribe(MQTTAsync handle, const char *topic, int qos, MQTTAsync_responseOptions *response)
#define MQTTAsync_willOptions_initializer
#define MQTTAsync_connectOptions_initializer5
This structure represents a persistent data store, used to store outbound and inbound messages...
void onConnectFailure(void *context, MQTTAsync_failureData *response)
#define MQTTAsync_disconnectOptions_initializer
MQTTAsync_onFailure * onFailure
void onConnect5(void *context, MQTTAsync_successData5 *response)
MQTTAsync_onFailure5 * onFailure5
void onSubscribe5(void *context, MQTTAsync_successData5 *response)
#define MQTTAsync_createOptions_initializer
MQTTAsync_SSLOptions * ssl
#define MQTTAsync_connectOptions_initializer
MQTTAsync_onSuccess * onSuccess
MQTTAsync_willOptions * will
const char * privateKeyPassword
const char * enabledCipherSuites
int main(int argc, char **argv)
void MQTTAsync_destroy(MQTTAsync *handle)
void onConnect(void *context, MQTTAsync_successData *response)
#define MQTTASYNC_SUCCESS
void MQTTAsync_setTraceLevel(enum MQTTASYNC_TRACE_LEVELS level)
void logProperties(MQTTProperties *props)
#define MQTTCLIENT_PERSISTENCE_NONE
enum MQTTReasonCodes reasonCode
const char * MQTTAsync_strerror(int code)
#define MQTTAsync_SSLOptions_initializer
void onSubscribeFailure5(void *context, MQTTAsync_failureData5 *response)
int messageArrived(void *context, char *topicName, int topicLen, MQTTAsync_message *message)
int getopts(int argc, char **argv, struct pubsub_opts *opts)
MQTTAsync_onSuccess * onSuccess
#define MQTTAsync_callOptions_initializer
#define MQTTVERSION_DEFAULT
MQTTAsync_onSuccess5 * onSuccess5
void onSubscribe(void *context, MQTTAsync_successData *response)
MQTTAsync_onSuccess * onSuccess