util_mosq.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. Copyright (c) 2009-2020 Roger Light <roger@atchoo.org>
  3. All rights reserved. This program and the accompanying materials
  4. are made available under the terms of the Eclipse Public License 2.0
  5. and Eclipse Distribution License v1.0 which accompany this distribution.
  6. The Eclipse Public License is available at
  7. https://www.eclipse.org/legal/epl-2.0/
  8. and the Eclipse Distribution License is available at
  9. http://www.eclipse.org/org/documents/edl-v10.php.
  10. SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
  11. Contributors:
  12. Roger Light - initial implementation and documentation.
  13. */
  14. #ifndef UTIL_MOSQ_H
  15. #define UTIL_MOSQ_H
  16. #include <stdio.h>
  17. #include "tls_mosq.h"
  18. #include "mosquitto.h"
  19. #include "mosquitto_internal.h"
  20. #ifdef WITH_BROKER
  21. # include "mosquitto_broker_internal.h"
  22. #endif
  23. int mosquitto__check_keepalive(struct mosquitto *mosq);
  24. uint16_t mosquitto__mid_generate(struct mosquitto *mosq);
  25. int mosquitto__set_state(struct mosquitto *mosq, enum mosquitto_client_state state);
  26. enum mosquitto_client_state mosquitto__get_state(struct mosquitto *mosq);
  27. #ifdef WITH_TLS
  28. int mosquitto__hex2bin_sha1(const char *hex, unsigned char **bin);
  29. int mosquitto__hex2bin(const char *hex, unsigned char *bin, int bin_max_len);
  30. #endif
  31. int util__random_bytes(void *bytes, int count);
  32. void util__increment_receive_quota(struct mosquitto *mosq);
  33. void util__increment_send_quota(struct mosquitto *mosq);
  34. void util__decrement_receive_quota(struct mosquitto *mosq);
  35. void util__decrement_send_quota(struct mosquitto *mosq);
  36. #endif