MQTTSubscribeOpts.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*******************************************************************************
  2. * Copyright (c) 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 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. *******************************************************************************/
  16. #if !defined(SUBOPTS_H)
  17. #define SUBOPTS_H
  18. /** The MQTT V5 subscribe options, apart from QoS which existed before V5. */
  19. typedef struct MQTTSubscribe_options
  20. {
  21. /** The eyecatcher for this structure. Must be MQSO. */
  22. char struct_id[4];
  23. /** The version number of this structure. Must be 0.
  24. */
  25. int struct_version;
  26. /** To not receive our own publications, set to 1.
  27. * 0 is the original MQTT behaviour - all messages matching the subscription are received.
  28. */
  29. unsigned char noLocal;
  30. /** To keep the retain flag as on the original publish message, set to 1.
  31. * If 0, defaults to the original MQTT behaviour where the retain flag is only set on
  32. * publications sent by a broker if in response to a subscribe request.
  33. */
  34. unsigned char retainAsPublished;
  35. /** 0 - send retained messages at the time of the subscribe (original MQTT behaviour)
  36. * 1 - send retained messages on subscribe only if the subscription is new
  37. * 2 - do not send retained messages at all
  38. */
  39. unsigned char retainHandling;
  40. } MQTTSubscribe_options;
  41. #define MQTTSubscribe_options_initializer { {'M', 'Q', 'S', 'O'}, 0, 0, 0, 0 }
  42. #endif