messageQueue.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #if !defined(OBOO_RUNTIME_MQTT_H_INCLUDED)
  2. #define OBOO_RUNTIME_MQTT_H_INCLUDED
  3. #include "config.h"
  4. #define CLIENT_ID_LEN 10
  5. #define MAX_PAYLOAD_SIZE 8192
  6. // types
  7. typedef enum {
  8. MQ_LOCAL_CLIENT = 0,
  9. MQ_REMOTE_CLIENT = 1,
  10. MQ_NUM_CLIENTS = 2
  11. } mq_client_type;
  12. // function definitions
  13. // TODO: move these two functions to a utils file
  14. char* generateRandomString (int length);
  15. char* generateRandomNumber (int length);
  16. int generateRandomInteger (int n);
  17. void initMessageQueue ();
  18. void destroyMessageQueue ();
  19. int connectMessageQueue (int clientType, char* host, int port, char* clientId, char* willTopic, char* willPayload);
  20. int connectMessageQueueSecure (int clientType, char* host, int port, char* clientId, char* willTopic, char* willPayload);
  21. int sendMessage (int clientType, char* topic, char* payload);
  22. int messageQueueSubscribe (int clientType, char* topic, int *id);
  23. #endif /* OBOO_RUNTIME_MQTT_H_INCLUDED */
  24. /*
  25. connection bridge-to-aws
  26. address axkzq7gf6ury0.iot.us-east-1.amazonaws.com:8883
  27. bridge_cafile /etc/awsiot/RootCA.pem
  28. cleansession true
  29. try_private false
  30. bridge_attempt_unsubscribe false
  31. bridge_insecure false
  32. notifications false
  33. bridge_certfile /etc/awsiot/Omega-7CCB-certificate.pem.crt
  34. bridge_keyfile /etc/awsiot/Omega-7CCB-private.pem.key
  35. remote_clientid Omega-7CCB
  36. */