subs_stubs.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. #include <time.h>
  2. #define WITH_BROKER
  3. #include <logging_mosq.h>
  4. #include <memory_mosq.h>
  5. #include <mosquitto_broker_internal.h>
  6. #include <net_mosq.h>
  7. #include <send_mosq.h>
  8. #include <time_mosq.h>
  9. #if 0
  10. extern uint64_t last_retained;
  11. extern char *last_sub;
  12. extern int last_qos;
  13. struct mosquitto *context__init(mosq_sock_t sock)
  14. {
  15. return mosquitto__calloc(1, sizeof(struct mosquitto));
  16. }
  17. int db__message_insert(struct mosquitto *context, uint16_t mid, enum mosquitto_msg_direction dir, uint8_t qos, bool retain, struct mosquitto_msg_store *stored, mosquitto_property *properties)
  18. {
  19. return MOSQ_ERR_SUCCESS;
  20. }
  21. void db__msg_store_ref_dec(struct mosquitto_msg_store **store)
  22. {
  23. }
  24. void db__msg_store_ref_inc(struct mosquitto_msg_store *store)
  25. {
  26. store->ref_count++;
  27. }
  28. #endif
  29. int log__printf(struct mosquitto *mosq, unsigned int priority, const char *fmt, ...)
  30. {
  31. UNUSED(mosq);
  32. UNUSED(priority);
  33. UNUSED(fmt);
  34. return 0;
  35. }
  36. time_t mosquitto_time(void)
  37. {
  38. return 123;
  39. }
  40. #if 0
  41. int net__socket_close(struct mosquitto *mosq)
  42. {
  43. return MOSQ_ERR_SUCCESS;
  44. }
  45. int send__pingreq(struct mosquitto *mosq)
  46. {
  47. return MOSQ_ERR_SUCCESS;
  48. }
  49. int mosquitto_acl_check(struct mosquitto *context, const char *topic, uint32_tn payloadlen, void* payload, uint8_t qos, bool retain, int access)
  50. {
  51. return MOSQ_ERR_SUCCESS;
  52. }
  53. int acl__find_acls(struct mosquitto *context)
  54. {
  55. return MOSQ_ERR_SUCCESS;
  56. }
  57. #endif
  58. int send__publish(struct mosquitto *mosq, uint16_t mid, const char *topic, uint32_t payloadlen, const void *payload, uint8_t qos, bool retain, bool dup, const mosquitto_property *cmsg_props, const mosquitto_property *store_props, uint32_t expiry_interval)
  59. {
  60. UNUSED(mosq);
  61. UNUSED(mid);
  62. UNUSED(topic);
  63. UNUSED(payloadlen);
  64. UNUSED(payload);
  65. UNUSED(qos);
  66. UNUSED(retain);
  67. UNUSED(dup);
  68. UNUSED(cmsg_props);
  69. UNUSED(store_props);
  70. UNUSED(expiry_interval);
  71. return MOSQ_ERR_SUCCESS;
  72. }
  73. int send__pubcomp(struct mosquitto *mosq, uint16_t mid, const mosquitto_property *properties)
  74. {
  75. UNUSED(mosq);
  76. UNUSED(mid);
  77. UNUSED(properties);
  78. return MOSQ_ERR_SUCCESS;
  79. }
  80. int send__pubrec(struct mosquitto *mosq, uint16_t mid, uint8_t reason_code, const mosquitto_property *properties)
  81. {
  82. UNUSED(mosq);
  83. UNUSED(mid);
  84. UNUSED(reason_code);
  85. UNUSED(properties);
  86. return MOSQ_ERR_SUCCESS;
  87. }
  88. int send__pubrel(struct mosquitto *mosq, uint16_t mid, const mosquitto_property *properties)
  89. {
  90. UNUSED(mosq);
  91. UNUSED(mid);
  92. UNUSED(properties);
  93. return MOSQ_ERR_SUCCESS;
  94. }
  95. int mosquitto_acl_check(struct mosquitto *context, const char *topic, uint32_t payloadlen, void* payload, uint8_t qos, bool retain, int access)
  96. {
  97. UNUSED(context);
  98. UNUSED(topic);
  99. UNUSED(payloadlen);
  100. UNUSED(payload);
  101. UNUSED(qos);
  102. UNUSED(retain);
  103. UNUSED(access);
  104. return MOSQ_ERR_SUCCESS;
  105. }
  106. uint16_t mosquitto__mid_generate(struct mosquitto *mosq)
  107. {
  108. static uint16_t mid = 1;
  109. UNUSED(mosq);
  110. return ++mid;
  111. }
  112. int mosquitto_property_add_varint(mosquitto_property **proplist, int identifier, uint32_t value)
  113. {
  114. UNUSED(proplist);
  115. UNUSED(identifier);
  116. UNUSED(value);
  117. return MOSQ_ERR_SUCCESS;
  118. }
  119. int persist__backup(bool shutdown)
  120. {
  121. UNUSED(shutdown);
  122. return MOSQ_ERR_SUCCESS;
  123. }
  124. int persist__restore(void)
  125. {
  126. return MOSQ_ERR_SUCCESS;
  127. }
  128. void mosquitto_property_free_all(mosquitto_property **properties)
  129. {
  130. UNUSED(properties);
  131. }
  132. int retain__init(void)
  133. {
  134. return MOSQ_ERR_SUCCESS;
  135. }
  136. void retain__clean(struct mosquitto__retainhier **retainhier)
  137. {
  138. UNUSED(retainhier);
  139. }
  140. int retain__queue(struct mosquitto *context, const char *sub, uint8_t sub_qos, uint32_t subscription_identifier)
  141. {
  142. UNUSED(context);
  143. UNUSED(sub);
  144. UNUSED(sub_qos);
  145. UNUSED(subscription_identifier);
  146. return MOSQ_ERR_SUCCESS;
  147. }
  148. int retain__store(const char *topic, struct mosquitto_msg_store *stored, char **split_topics)
  149. {
  150. UNUSED(topic);
  151. UNUSED(stored);
  152. UNUSED(split_topics);
  153. return MOSQ_ERR_SUCCESS;
  154. }
  155. void util__decrement_receive_quota(struct mosquitto *mosq)
  156. {
  157. if(mosq->msgs_in.inflight_quota > 0){
  158. mosq->msgs_in.inflight_quota--;
  159. }
  160. }
  161. void util__decrement_send_quota(struct mosquitto *mosq)
  162. {
  163. if(mosq->msgs_out.inflight_quota > 0){
  164. mosq->msgs_out.inflight_quota--;
  165. }
  166. }
  167. void util__increment_receive_quota(struct mosquitto *mosq)
  168. {
  169. mosq->msgs_in.inflight_quota++;
  170. }
  171. void util__increment_send_quota(struct mosquitto *mosq)
  172. {
  173. mosq->msgs_out.inflight_quota++;
  174. }