MQTTProtocolOut.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*******************************************************************************
  2. * Copyright (c) 2009, 2022 IBM Corp., Ian Craggs, and others
  3. *
  4. * All rights reserved. This program and the accompanying materials
  5. * are made available under the terms of the Eclipse Public License v2.0
  6. * and Eclipse Distribution License v1.0 which accompany this distribution.
  7. *
  8. * The Eclipse Public License is available at
  9. * https://www.eclipse.org/legal/epl-2.0/
  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 API and implementation and/or initial documentation
  15. * Ian Craggs, Allan Stockdill-Mander - SSL updates
  16. * Ian Craggs - MQTT 3.1.1 support
  17. * Ian Craggs - SNI support
  18. * Ian Craggs - MQTT 5.0 support
  19. * Sven Gambel - add generic proxy support
  20. *******************************************************************************/
  21. #if !defined(MQTTPROTOCOLOUT_H)
  22. #define MQTTPROTOCOLOUT_H
  23. #include "LinkedList.h"
  24. #include "MQTTPacket.h"
  25. #include "Clients.h"
  26. #include "Log.h"
  27. #include "Messages.h"
  28. #include "MQTTProtocol.h"
  29. #include "MQTTProtocolClient.h"
  30. #define MQTT_DEFAULT_PORT 1883
  31. #define SECURE_MQTT_DEFAULT_PORT 8883
  32. #define WS_DEFAULT_PORT 80
  33. #define WSS_DEFAULT_PORT 443
  34. #define PROXY_DEFAULT_PORT 8080
  35. size_t MQTTProtocol_addressPort(const char* uri, int* port, const char **topic, int default_port);
  36. void MQTTProtocol_reconnect(const char* ip_address, Clients* client);
  37. #if defined(OPENSSL)
  38. #if defined(__GNUC__) && defined(__linux__)
  39. int MQTTProtocol_connect(const char* ip_address, Clients* acClients, int ssl, int websocket, int MQTTVersion,
  40. MQTTProperties* connectProperties, MQTTProperties* willProperties, long timeout);
  41. #else
  42. int MQTTProtocol_connect(const char* ip_address, Clients* acClients, int ssl, int websocket, int MQTTVersion,
  43. MQTTProperties* connectProperties, MQTTProperties* willProperties);
  44. #endif
  45. #else
  46. #if defined(__GNUC__) && defined(__linux__)
  47. int MQTTProtocol_connect(const char* ip_address, Clients* acClients, int websocket, int MQTTVersion,
  48. MQTTProperties* connectProperties, MQTTProperties* willProperties, long timeout);
  49. #else
  50. int MQTTProtocol_connect(const char* ip_address, Clients* acClients, int websocket, int MQTTVersion,
  51. MQTTProperties* connectProperties, MQTTProperties* willProperties);
  52. #endif
  53. #endif
  54. int MQTTProtocol_handlePingresps(void* pack, SOCKET sock);
  55. int MQTTProtocol_subscribe(Clients* client, List* topics, List* qoss, int msgID,
  56. MQTTSubscribe_options* opts, MQTTProperties* props);
  57. int MQTTProtocol_handleSubacks(void* pack, SOCKET sock);
  58. int MQTTProtocol_unsubscribe(Clients* client, List* topics, int msgID, MQTTProperties* props);
  59. int MQTTProtocol_handleUnsubacks(void* pack, SOCKET sock);
  60. int MQTTProtocol_handleDisconnects(void* pack, SOCKET sock);
  61. #endif