45 1, 0, 0, 0,
"\n", 100,
47 MQTTVERSION_DEFAULT, NULL,
"paho-cs-pub", 0, 0, NULL, NULL,
"localhost",
"1883", NULL, 10,
49 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
62 printf(
"Connecting\n");
67 conn_opts = conn_opts5;
81 conn_opts.
will = &will_opts;
97 conn_opts.
ssl = &ssl_opts;
117 printf(
"Connected\n");
134 fprintf(stderr,
"Trace : %d, %s\n", level, message);
138 int main(
int argc,
char** argv)
150 const char* program_name =
"paho_cs_pub";
156 if (
getopts(argc, argv, &opts) != 0)
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);
246 buffer[data_len++] =
c;
247 if (data_len > delim_len)
249 if (strncmp(opts.
delimiter, &buffer[data_len - delim_len], delim_len) == 0)
257 data_len = (int)strlen(opts.
message);
261 buffer =
readfile(&data_len, &opts);
266 fprintf(stderr,
"Publishing data of length %d\n", data_len);
int MQTTClient_disconnect5(MQTTClient handle, int timeout, enum MQTTReasonCodes reason, MQTTProperties *props)
void trace_callback(enum MQTTCLIENT_TRACE_LEVELS level, char *message)
MQTTResponse MQTTClient_publish5(MQTTClient handle, const char *topicName, int payloadlen, const void *payload, int qos, int retained, MQTTProperties *properties, MQTTClient_deliveryToken *deliveryToken)
#define MQTTCLIENT_SUCCESS
int MQTTClient_connect(MQTTClient handle, MQTTClient_connectOptions *options)
int MQTTClient_publish(MQTTClient handle, const char *topicName, int payloadlen, const void *payload, int qos, int retained, MQTTClient_deliveryToken *deliveryToken)
int MQTTClient_disconnect(MQTTClient handle, int timeout)
char * readfile(int *data_len, struct pubsub_opts *opts)
const char * enabledCipherSuites
void usage(struct pubsub_opts *opts, pubsub_opts_nameValue *name_values, const char *program_name)
int messageArrived(void *context, char *topicName, int topicLen, MQTTClient_message *m)
int MQTTProperties_add(MQTTProperties *props, const MQTTProperty *prop)
#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
MQTTAsync_connectOptions conn_opts
#define MQTTClient_willOptions_initializer
void MQTTClient_setTraceLevel(enum MQTTCLIENT_TRACE_LEVELS level)
int MQTTClient_setCallbacks(MQTTClient handle, void *context, MQTTClient_connectionLost *cl, MQTTClient_messageArrived *ma, MQTTClient_deliveryComplete *dc)
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)
enum MQTTPropertyCodes identifier
int main(int argc, char **argv)
void MQTTClient_yield(void)
void MQTTClient_destroy(MQTTClient *handle)
MQTTResponse MQTTClient_connect5(MQTTClient handle, MQTTClient_connectOptions *options, MQTTProperties *connectProperties, MQTTProperties *willProperties)
#define MQTTCLIENT_PERSISTENCE_NONE
#define MQTTResponse_initializer
#define MQTTClient_connectOptions_initializer
#define MQTTClient_createOptions_initializer
#define MQTTClient_SSLOptions_initializer
const char * privateKeyPassword
int getopts(int argc, char **argv, struct pubsub_opts *opts)
#define MQTTVERSION_DEFAULT
MQTTClient_willOptions * will
int myconnect(MQTTClient *client)
struct pubsub_opts::@69 user_property
#define MQTTProperties_initializer