pubsub_opts.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*******************************************************************************
  2. * Copyright (c) 2012, 2018 IBM Corp.
  3. *
  4. * All rights reserved. This program and the accompanying materials
  5. * are made available under the terms of the Eclipse Public License v1.0
  6. * and Eclipse Distribution License v1.0 which accompany this distribution.
  7. *
  8. * The Eclipse Public License is available at
  9. * http://www.eclipse.org/legal/epl-v10.html
  10. * and the Eclipse Distribution License is available at
  11. * http://www.eclipse.org/org/documents/edl-v10.php.
  12. *
  13. * Contributors:
  14. * Ian Craggs - initial contribution
  15. * Guilherme Maciel Ferreira - add keep alive option
  16. *******************************************************************************/
  17. #if !defined(PUBSUB_OPTS_H)
  18. #define PUBSUB_OPTS_H
  19. #include "MQTTAsync.h"
  20. #include "MQTTClientPersistence.h"
  21. struct pubsub_opts
  22. {
  23. /* debug app options */
  24. int publisher; /* publisher app? */
  25. int quiet;
  26. int verbose;
  27. int tracelevel;
  28. char* delimiter;
  29. int maxdatalen;
  30. /* message options */
  31. char* message;
  32. char* filename;
  33. int stdin_lines;
  34. int stdlin_complete;
  35. int null_message;
  36. /* MQTT options */
  37. int MQTTVersion;
  38. char* topic;
  39. char* clientid;
  40. int qos;
  41. int retained;
  42. char* username;
  43. char* password;
  44. char* host;
  45. char* port;
  46. char* connection;
  47. int keepalive;
  48. /* will options */
  49. char* will_topic;
  50. char* will_payload;
  51. int will_qos;
  52. int will_retain;
  53. /* TLS options */
  54. int insecure;
  55. char* capath;
  56. char* cert;
  57. char* cafile;
  58. char* key;
  59. char* keypass;
  60. char* ciphers;
  61. char* psk_identity;
  62. char* psk;
  63. /* MQTT V5 options */
  64. int message_expiry;
  65. struct {
  66. char *name;
  67. char *value;
  68. } user_property;
  69. };
  70. typedef struct
  71. {
  72. const char* name;
  73. const char* value;
  74. } pubsub_opts_nameValue;
  75. //void usage(struct pubsub_opts* opts, const char* version, const char* program_name);
  76. void usage(struct pubsub_opts* opts, pubsub_opts_nameValue* name_values, const char* program_name);
  77. int getopts(int argc, char** argv, struct pubsub_opts* opts);
  78. char* readfile(int* data_len, struct pubsub_opts* opts);
  79. void logProperties(MQTTProperties *props);
  80. #endif