MQTTProtocolClient.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*******************************************************************************
  2. * Copyright (c) 2009, 2017 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 API and implementation and/or initial documentation
  15. * Ian Craggs, Allan Stockdill-Mander - SSL updates
  16. * Ian Craggs - MQTT 3.1.1 updates
  17. * Rong Xiang, Ian Craggs - C++ compatibility
  18. * Ian Craggs - add debug definition of MQTTStrdup for when needed
  19. *******************************************************************************/
  20. #if !defined(MQTTPROTOCOLCLIENT_H)
  21. #define MQTTPROTOCOLCLIENT_H
  22. #include "LinkedList.h"
  23. #include "MQTTPacket.h"
  24. #include "Log.h"
  25. #include "MQTTProtocol.h"
  26. #include "Messages.h"
  27. #include "MQTTProperties.h"
  28. #define MAX_MSG_ID 65535
  29. #define MAX_CLIENTID_LEN 65535
  30. int MQTTProtocol_startPublish(Clients* pubclient, Publish* publish, int qos, int retained, Messages** m);
  31. Messages* MQTTProtocol_createMessage(Publish* publish, Messages** mm, int qos, int retained);
  32. Publications* MQTTProtocol_storePublication(Publish* publish, int* len);
  33. int messageIDCompare(void* a, void* b);
  34. int MQTTProtocol_assignMsgId(Clients* client);
  35. void MQTTProtocol_removePublication(Publications* p);
  36. void Protocol_processPublication(Publish* publish, Clients* client);
  37. int MQTTProtocol_handlePublishes(void* pack, int sock);
  38. int MQTTProtocol_handlePubacks(void* pack, int sock);
  39. int MQTTProtocol_handlePubrecs(void* pack, int sock);
  40. int MQTTProtocol_handlePubrels(void* pack, int sock);
  41. int MQTTProtocol_handlePubcomps(void* pack, int sock);
  42. void MQTTProtocol_closeSession(Clients* c, int sendwill);
  43. void MQTTProtocol_keepalive(time_t);
  44. void MQTTProtocol_retry(time_t, int, int);
  45. void MQTTProtocol_freeClient(Clients* client);
  46. void MQTTProtocol_emptyMessageList(List* msgList);
  47. void MQTTProtocol_freeMessageList(List* msgList);
  48. char* MQTTStrncpy(char *dest, const char* src, size_t num);
  49. char* MQTTStrdup(const char* src);
  50. //#define MQTTStrdup(src) MQTTStrncpy(malloc(strlen(src)+1), src, strlen(src)+1)
  51. #endif