1#![allow(non_snake_case)]
4#![allow(non_camel_case_types)]
5#![allow(non_upper_case_globals)]
6#![allow(clippy::unreadable_literal)]
7
8pub const MOSQ_LOG_NONE: u32 = 0;
9pub const MOSQ_LOG_INFO: u32 = 1;
10pub const MOSQ_LOG_NOTICE: u32 = 2;
11pub const MOSQ_LOG_WARNING: u32 = 4;
12pub const MOSQ_LOG_ERR: u32 = 8;
13pub const MOSQ_LOG_DEBUG: u32 = 16;
14pub const MOSQ_LOG_SUBSCRIBE: u32 = 32;
15pub const MOSQ_LOG_UNSUBSCRIBE: u32 = 64;
16pub const MOSQ_LOG_WEBSOCKETS: u32 = 128;
17pub const MOSQ_LOG_INTERNAL: u32 = 2147483648;
18pub const MOSQ_LOG_ALL: u32 = 4294967295;
19pub const MOSQ_MQTT_ID_MAX_LENGTH: u32 = 23;
20#[repr(i32)]
21#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
22pub enum mosq_err_t {
23 MOSQ_ERR_AUTH_CONTINUE = -4,
24 MOSQ_ERR_NO_SUBSCRIBERS = -3,
25 MOSQ_ERR_SUB_EXISTS = -2,
26 MOSQ_ERR_CONN_PENDING = -1,
27 MOSQ_ERR_SUCCESS = 0,
28 MOSQ_ERR_NOMEM = 1,
29 MOSQ_ERR_PROTOCOL = 2,
30 MOSQ_ERR_INVAL = 3,
31 MOSQ_ERR_NO_CONN = 4,
32 MOSQ_ERR_CONN_REFUSED = 5,
33 MOSQ_ERR_NOT_FOUND = 6,
34 MOSQ_ERR_CONN_LOST = 7,
35 MOSQ_ERR_TLS = 8,
36 MOSQ_ERR_PAYLOAD_SIZE = 9,
37 MOSQ_ERR_NOT_SUPPORTED = 10,
38 MOSQ_ERR_AUTH = 11,
39 MOSQ_ERR_ACL_DENIED = 12,
40 MOSQ_ERR_UNKNOWN = 13,
41 MOSQ_ERR_ERRNO = 14,
42 MOSQ_ERR_EAI = 15,
43 MOSQ_ERR_PROXY = 16,
44 MOSQ_ERR_PLUGIN_DEFER = 17,
45 MOSQ_ERR_MALFORMED_UTF8 = 18,
46 MOSQ_ERR_KEEPALIVE = 19,
47 MOSQ_ERR_LOOKUP = 20,
48 MOSQ_ERR_MALFORMED_PACKET = 21,
49 MOSQ_ERR_DUPLICATE_PROPERTY = 22,
50 MOSQ_ERR_TLS_HANDSHAKE = 23,
51 MOSQ_ERR_QOS_NOT_SUPPORTED = 24,
52 MOSQ_ERR_OVERSIZE_PACKET = 25,
53 MOSQ_ERR_OCSP = 26,
54 MOSQ_ERR_TIMEOUT = 27,
55 MOSQ_ERR_RETAIN_NOT_SUPPORTED = 28,
56 MOSQ_ERR_TOPIC_ALIAS_INVALID = 29,
57 MOSQ_ERR_ADMINISTRATIVE_ACTION = 30,
58 MOSQ_ERR_ALREADY_EXISTS = 31,
59}
60#[repr(u32)]
61#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
62pub enum mosq_opt_t {
63 MOSQ_OPT_PROTOCOL_VERSION = 1,
64 MOSQ_OPT_SSL_CTX = 2,
65 MOSQ_OPT_SSL_CTX_WITH_DEFAULTS = 3,
66 MOSQ_OPT_RECEIVE_MAXIMUM = 4,
67 MOSQ_OPT_SEND_MAXIMUM = 5,
68 MOSQ_OPT_TLS_KEYFORM = 6,
69 MOSQ_OPT_TLS_ENGINE = 7,
70 MOSQ_OPT_TLS_ENGINE_KPASS_SHA1 = 8,
71 MOSQ_OPT_TLS_OCSP_REQUIRED = 9,
72 MOSQ_OPT_TLS_ALPN = 10,
73 MOSQ_OPT_TCP_NODELAY = 11,
74 MOSQ_OPT_BIND_ADDRESS = 12,
75 MOSQ_OPT_TLS_USE_OS_CERTS = 13,
76}
77#[repr(C)]
78#[derive(Debug, Copy, Clone)]
79pub struct mosquitto_message {
80 pub mid: ::std::os::raw::c_int,
81 pub topic: *mut ::std::os::raw::c_char,
82 pub payload: *mut ::std::os::raw::c_void,
83 pub payloadlen: ::std::os::raw::c_int,
84 pub qos: ::std::os::raw::c_int,
85 pub retain: bool,
86}
87#[repr(C)]
88#[derive(Debug, Copy, Clone)]
89pub struct mosquitto {
90 _unused: [u8; 0],
91}
92#[repr(C)]
93#[derive(Debug, Copy, Clone)]
94pub struct mqtt5__property {
95 _unused: [u8; 0],
96}
97pub type mosquitto_property = mqtt5__property;
98extern "C" {
99 pub fn mosquitto_lib_version(
100 major: *mut ::std::os::raw::c_int,
101 minor: *mut ::std::os::raw::c_int,
102 revision: *mut ::std::os::raw::c_int,
103 ) -> ::std::os::raw::c_int;
104}
105extern "C" {
106 pub fn mosquitto_lib_init() -> ::std::os::raw::c_int;
107}
108extern "C" {
109 pub fn mosquitto_lib_cleanup() -> ::std::os::raw::c_int;
110}
111extern "C" {
112 pub fn mosquitto_new(
113 id: *const ::std::os::raw::c_char,
114 clean_session: bool,
115 obj: *mut ::std::os::raw::c_void,
116 ) -> *mut mosquitto;
117}
118extern "C" {
119 pub fn mosquitto_destroy(mosq: *mut mosquitto);
120}
121extern "C" {
122 pub fn mosquitto_reinitialise(
123 mosq: *mut mosquitto,
124 id: *const ::std::os::raw::c_char,
125 clean_session: bool,
126 obj: *mut ::std::os::raw::c_void,
127 ) -> ::std::os::raw::c_int;
128}
129extern "C" {
130 pub fn mosquitto_will_set(
131 mosq: *mut mosquitto,
132 topic: *const ::std::os::raw::c_char,
133 payloadlen: ::std::os::raw::c_int,
134 payload: *const ::std::os::raw::c_void,
135 qos: ::std::os::raw::c_int,
136 retain: bool,
137 ) -> ::std::os::raw::c_int;
138}
139extern "C" {
140 pub fn mosquitto_will_set_v5(
141 mosq: *mut mosquitto,
142 topic: *const ::std::os::raw::c_char,
143 payloadlen: ::std::os::raw::c_int,
144 payload: *const ::std::os::raw::c_void,
145 qos: ::std::os::raw::c_int,
146 retain: bool,
147 properties: *mut mosquitto_property,
148 ) -> ::std::os::raw::c_int;
149}
150extern "C" {
151 pub fn mosquitto_will_clear(mosq: *mut mosquitto) -> ::std::os::raw::c_int;
152}
153extern "C" {
154 pub fn mosquitto_username_pw_set(
155 mosq: *mut mosquitto,
156 username: *const ::std::os::raw::c_char,
157 password: *const ::std::os::raw::c_char,
158 ) -> ::std::os::raw::c_int;
159}
160extern "C" {
161 pub fn mosquitto_connect(
162 mosq: *mut mosquitto,
163 host: *const ::std::os::raw::c_char,
164 port: ::std::os::raw::c_int,
165 keepalive: ::std::os::raw::c_int,
166 ) -> ::std::os::raw::c_int;
167}
168extern "C" {
169 pub fn mosquitto_connect_bind(
170 mosq: *mut mosquitto,
171 host: *const ::std::os::raw::c_char,
172 port: ::std::os::raw::c_int,
173 keepalive: ::std::os::raw::c_int,
174 bind_address: *const ::std::os::raw::c_char,
175 ) -> ::std::os::raw::c_int;
176}
177extern "C" {
178 pub fn mosquitto_connect_bind_v5(
179 mosq: *mut mosquitto,
180 host: *const ::std::os::raw::c_char,
181 port: ::std::os::raw::c_int,
182 keepalive: ::std::os::raw::c_int,
183 bind_address: *const ::std::os::raw::c_char,
184 properties: *const mosquitto_property,
185 ) -> ::std::os::raw::c_int;
186}
187extern "C" {
188 pub fn mosquitto_connect_async(
189 mosq: *mut mosquitto,
190 host: *const ::std::os::raw::c_char,
191 port: ::std::os::raw::c_int,
192 keepalive: ::std::os::raw::c_int,
193 ) -> ::std::os::raw::c_int;
194}
195extern "C" {
196 pub fn mosquitto_connect_bind_async(
197 mosq: *mut mosquitto,
198 host: *const ::std::os::raw::c_char,
199 port: ::std::os::raw::c_int,
200 keepalive: ::std::os::raw::c_int,
201 bind_address: *const ::std::os::raw::c_char,
202 ) -> ::std::os::raw::c_int;
203}
204extern "C" {
205 pub fn mosquitto_connect_srv(
206 mosq: *mut mosquitto,
207 host: *const ::std::os::raw::c_char,
208 keepalive: ::std::os::raw::c_int,
209 bind_address: *const ::std::os::raw::c_char,
210 ) -> ::std::os::raw::c_int;
211}
212extern "C" {
213 pub fn mosquitto_reconnect(mosq: *mut mosquitto) -> ::std::os::raw::c_int;
214}
215extern "C" {
216 pub fn mosquitto_reconnect_async(mosq: *mut mosquitto) -> ::std::os::raw::c_int;
217}
218extern "C" {
219 pub fn mosquitto_disconnect(mosq: *mut mosquitto) -> ::std::os::raw::c_int;
220}
221extern "C" {
222 pub fn mosquitto_disconnect_v5(
223 mosq: *mut mosquitto,
224 reason_code: ::std::os::raw::c_int,
225 properties: *const mosquitto_property,
226 ) -> ::std::os::raw::c_int;
227}
228extern "C" {
229 pub fn mosquitto_publish(
230 mosq: *mut mosquitto,
231 mid: *mut ::std::os::raw::c_int,
232 topic: *const ::std::os::raw::c_char,
233 payloadlen: ::std::os::raw::c_int,
234 payload: *const ::std::os::raw::c_void,
235 qos: ::std::os::raw::c_int,
236 retain: bool,
237 ) -> ::std::os::raw::c_int;
238}
239extern "C" {
240 pub fn mosquitto_publish_v5(
241 mosq: *mut mosquitto,
242 mid: *mut ::std::os::raw::c_int,
243 topic: *const ::std::os::raw::c_char,
244 payloadlen: ::std::os::raw::c_int,
245 payload: *const ::std::os::raw::c_void,
246 qos: ::std::os::raw::c_int,
247 retain: bool,
248 properties: *const mosquitto_property,
249 ) -> ::std::os::raw::c_int;
250}
251extern "C" {
252 pub fn mosquitto_subscribe(
253 mosq: *mut mosquitto,
254 mid: *mut ::std::os::raw::c_int,
255 sub: *const ::std::os::raw::c_char,
256 qos: ::std::os::raw::c_int,
257 ) -> ::std::os::raw::c_int;
258}
259extern "C" {
260 pub fn mosquitto_subscribe_v5(
261 mosq: *mut mosquitto,
262 mid: *mut ::std::os::raw::c_int,
263 sub: *const ::std::os::raw::c_char,
264 qos: ::std::os::raw::c_int,
265 options: ::std::os::raw::c_int,
266 properties: *const mosquitto_property,
267 ) -> ::std::os::raw::c_int;
268}
269extern "C" {
270 pub fn mosquitto_subscribe_multiple(
271 mosq: *mut mosquitto,
272 mid: *mut ::std::os::raw::c_int,
273 sub_count: ::std::os::raw::c_int,
274 sub: *const *mut ::std::os::raw::c_char,
275 qos: ::std::os::raw::c_int,
276 options: ::std::os::raw::c_int,
277 properties: *const mosquitto_property,
278 ) -> ::std::os::raw::c_int;
279}
280extern "C" {
281 pub fn mosquitto_unsubscribe(
282 mosq: *mut mosquitto,
283 mid: *mut ::std::os::raw::c_int,
284 sub: *const ::std::os::raw::c_char,
285 ) -> ::std::os::raw::c_int;
286}
287extern "C" {
288 pub fn mosquitto_unsubscribe_v5(
289 mosq: *mut mosquitto,
290 mid: *mut ::std::os::raw::c_int,
291 sub: *const ::std::os::raw::c_char,
292 properties: *const mosquitto_property,
293 ) -> ::std::os::raw::c_int;
294}
295extern "C" {
296 pub fn mosquitto_unsubscribe_multiple(
297 mosq: *mut mosquitto,
298 mid: *mut ::std::os::raw::c_int,
299 sub_count: ::std::os::raw::c_int,
300 sub: *const *mut ::std::os::raw::c_char,
301 properties: *const mosquitto_property,
302 ) -> ::std::os::raw::c_int;
303}
304extern "C" {
305 pub fn mosquitto_message_copy(
306 dst: *mut mosquitto_message,
307 src: *const mosquitto_message,
308 ) -> ::std::os::raw::c_int;
309}
310extern "C" {
311 pub fn mosquitto_message_free(message: *mut *mut mosquitto_message);
312}
313extern "C" {
314 pub fn mosquitto_message_free_contents(message: *mut mosquitto_message);
315}
316extern "C" {
317 pub fn mosquitto_loop_forever(
318 mosq: *mut mosquitto,
319 timeout: ::std::os::raw::c_int,
320 max_packets: ::std::os::raw::c_int,
321 ) -> ::std::os::raw::c_int;
322}
323extern "C" {
324 pub fn mosquitto_loop_start(mosq: *mut mosquitto) -> ::std::os::raw::c_int;
325}
326extern "C" {
327 pub fn mosquitto_loop_stop(mosq: *mut mosquitto, force: bool) -> ::std::os::raw::c_int;
328}
329extern "C" {
330 pub fn mosquitto_loop(
331 mosq: *mut mosquitto,
332 timeout: ::std::os::raw::c_int,
333 max_packets: ::std::os::raw::c_int,
334 ) -> ::std::os::raw::c_int;
335}
336extern "C" {
337 pub fn mosquitto_loop_read(
338 mosq: *mut mosquitto,
339 max_packets: ::std::os::raw::c_int,
340 ) -> ::std::os::raw::c_int;
341}
342extern "C" {
343 pub fn mosquitto_loop_write(
344 mosq: *mut mosquitto,
345 max_packets: ::std::os::raw::c_int,
346 ) -> ::std::os::raw::c_int;
347}
348extern "C" {
349 pub fn mosquitto_loop_misc(mosq: *mut mosquitto) -> ::std::os::raw::c_int;
350}
351extern "C" {
352 pub fn mosquitto_socket(mosq: *mut mosquitto) -> ::std::os::raw::c_int;
353}
354extern "C" {
355 pub fn mosquitto_want_write(mosq: *mut mosquitto) -> bool;
356}
357extern "C" {
358 pub fn mosquitto_threaded_set(mosq: *mut mosquitto, threaded: bool) -> ::std::os::raw::c_int;
359}
360extern "C" {
361 pub fn mosquitto_opts_set(
362 mosq: *mut mosquitto,
363 option: mosq_opt_t,
364 value: *mut ::std::os::raw::c_void,
365 ) -> ::std::os::raw::c_int;
366}
367extern "C" {
368 pub fn mosquitto_int_option(
369 mosq: *mut mosquitto,
370 option: mosq_opt_t,
371 value: ::std::os::raw::c_int,
372 ) -> ::std::os::raw::c_int;
373}
374extern "C" {
375 pub fn mosquitto_string_option(
376 mosq: *mut mosquitto,
377 option: mosq_opt_t,
378 value: *const ::std::os::raw::c_char,
379 ) -> ::std::os::raw::c_int;
380}
381extern "C" {
382 pub fn mosquitto_void_option(
383 mosq: *mut mosquitto,
384 option: mosq_opt_t,
385 value: *mut ::std::os::raw::c_void,
386 ) -> ::std::os::raw::c_int;
387}
388extern "C" {
389 pub fn mosquitto_reconnect_delay_set(
390 mosq: *mut mosquitto,
391 reconnect_delay: ::std::os::raw::c_uint,
392 reconnect_delay_max: ::std::os::raw::c_uint,
393 reconnect_exponential_backoff: bool,
394 ) -> ::std::os::raw::c_int;
395}
396extern "C" {
397 pub fn mosquitto_max_inflight_messages_set(
398 mosq: *mut mosquitto,
399 max_inflight_messages: ::std::os::raw::c_uint,
400 ) -> ::std::os::raw::c_int;
401}
402extern "C" {
403 pub fn mosquitto_message_retry_set(mosq: *mut mosquitto, message_retry: ::std::os::raw::c_uint);
404}
405extern "C" {
406 pub fn mosquitto_user_data_set(mosq: *mut mosquitto, obj: *mut ::std::os::raw::c_void);
407}
408extern "C" {
409 pub fn mosquitto_userdata(mosq: *mut mosquitto) -> *mut ::std::os::raw::c_void;
410}
411extern "C" {
412 pub fn mosquitto_tls_set(
413 mosq: *mut mosquitto,
414 cafile: *const ::std::os::raw::c_char,
415 capath: *const ::std::os::raw::c_char,
416 certfile: *const ::std::os::raw::c_char,
417 keyfile: *const ::std::os::raw::c_char,
418 pw_callback: ::std::option::Option<
419 unsafe extern "C" fn(
420 buf: *mut ::std::os::raw::c_char,
421 size: ::std::os::raw::c_int,
422 rwflag: ::std::os::raw::c_int,
423 userdata: *mut ::std::os::raw::c_void,
424 ) -> ::std::os::raw::c_int,
425 >,
426 ) -> ::std::os::raw::c_int;
427}
428extern "C" {
429 pub fn mosquitto_tls_insecure_set(mosq: *mut mosquitto, value: bool) -> ::std::os::raw::c_int;
430}
431extern "C" {
432 pub fn mosquitto_tls_opts_set(
433 mosq: *mut mosquitto,
434 cert_reqs: ::std::os::raw::c_int,
435 tls_version: *const ::std::os::raw::c_char,
436 ciphers: *const ::std::os::raw::c_char,
437 ) -> ::std::os::raw::c_int;
438}
439extern "C" {
440 pub fn mosquitto_tls_psk_set(
441 mosq: *mut mosquitto,
442 psk: *const ::std::os::raw::c_char,
443 identity: *const ::std::os::raw::c_char,
444 ciphers: *const ::std::os::raw::c_char,
445 ) -> ::std::os::raw::c_int;
446}
447extern "C" {
448 pub fn mosquitto_ssl_get(mosq: *mut mosquitto) -> *mut ::std::os::raw::c_void;
449}
450extern "C" {
451 pub fn mosquitto_connect_callback_set(
452 mosq: *mut mosquitto,
453 on_connect: ::std::option::Option<
454 unsafe extern "C" fn(
455 arg1: *mut mosquitto,
456 arg2: *mut ::std::os::raw::c_void,
457 arg3: ::std::os::raw::c_int,
458 ),
459 >,
460 );
461}
462extern "C" {
463 pub fn mosquitto_connect_with_flags_callback_set(
464 mosq: *mut mosquitto,
465 on_connect: ::std::option::Option<
466 unsafe extern "C" fn(
467 arg1: *mut mosquitto,
468 arg2: *mut ::std::os::raw::c_void,
469 arg3: ::std::os::raw::c_int,
470 arg4: ::std::os::raw::c_int,
471 ),
472 >,
473 );
474}
475extern "C" {
476 pub fn mosquitto_connect_v5_callback_set(
477 mosq: *mut mosquitto,
478 on_connect: ::std::option::Option<
479 unsafe extern "C" fn(
480 arg1: *mut mosquitto,
481 arg2: *mut ::std::os::raw::c_void,
482 arg3: ::std::os::raw::c_int,
483 arg4: ::std::os::raw::c_int,
484 props: *const mosquitto_property,
485 ),
486 >,
487 );
488}
489extern "C" {
490 pub fn mosquitto_disconnect_callback_set(
491 mosq: *mut mosquitto,
492 on_disconnect: ::std::option::Option<
493 unsafe extern "C" fn(
494 arg1: *mut mosquitto,
495 arg2: *mut ::std::os::raw::c_void,
496 arg3: ::std::os::raw::c_int,
497 ),
498 >,
499 );
500}
501extern "C" {
502 pub fn mosquitto_disconnect_v5_callback_set(
503 mosq: *mut mosquitto,
504 on_disconnect: ::std::option::Option<
505 unsafe extern "C" fn(
506 arg1: *mut mosquitto,
507 arg2: *mut ::std::os::raw::c_void,
508 arg3: ::std::os::raw::c_int,
509 props: *const mosquitto_property,
510 ),
511 >,
512 );
513}
514extern "C" {
515 pub fn mosquitto_publish_callback_set(
516 mosq: *mut mosquitto,
517 on_publish: ::std::option::Option<
518 unsafe extern "C" fn(
519 arg1: *mut mosquitto,
520 arg2: *mut ::std::os::raw::c_void,
521 arg3: ::std::os::raw::c_int,
522 ),
523 >,
524 );
525}
526extern "C" {
527 pub fn mosquitto_publish_v5_callback_set(
528 mosq: *mut mosquitto,
529 on_publish: ::std::option::Option<
530 unsafe extern "C" fn(
531 arg1: *mut mosquitto,
532 arg2: *mut ::std::os::raw::c_void,
533 arg3: ::std::os::raw::c_int,
534 arg4: ::std::os::raw::c_int,
535 props: *const mosquitto_property,
536 ),
537 >,
538 );
539}
540extern "C" {
541 pub fn mosquitto_message_callback_set(
542 mosq: *mut mosquitto,
543 on_message: ::std::option::Option<
544 unsafe extern "C" fn(
545 arg1: *mut mosquitto,
546 arg2: *mut ::std::os::raw::c_void,
547 arg3: *const mosquitto_message,
548 ),
549 >,
550 );
551}
552extern "C" {
553 pub fn mosquitto_message_v5_callback_set(
554 mosq: *mut mosquitto,
555 on_message: ::std::option::Option<
556 unsafe extern "C" fn(
557 arg1: *mut mosquitto,
558 arg2: *mut ::std::os::raw::c_void,
559 arg3: *const mosquitto_message,
560 props: *const mosquitto_property,
561 ),
562 >,
563 );
564}
565extern "C" {
566 pub fn mosquitto_subscribe_callback_set(
567 mosq: *mut mosquitto,
568 on_subscribe: ::std::option::Option<
569 unsafe extern "C" fn(
570 arg1: *mut mosquitto,
571 arg2: *mut ::std::os::raw::c_void,
572 arg3: ::std::os::raw::c_int,
573 arg4: ::std::os::raw::c_int,
574 arg5: *const ::std::os::raw::c_int,
575 ),
576 >,
577 );
578}
579extern "C" {
580 pub fn mosquitto_subscribe_v5_callback_set(
581 mosq: *mut mosquitto,
582 on_subscribe: ::std::option::Option<
583 unsafe extern "C" fn(
584 arg1: *mut mosquitto,
585 arg2: *mut ::std::os::raw::c_void,
586 arg3: ::std::os::raw::c_int,
587 arg4: ::std::os::raw::c_int,
588 arg5: *const ::std::os::raw::c_int,
589 props: *const mosquitto_property,
590 ),
591 >,
592 );
593}
594extern "C" {
595 pub fn mosquitto_unsubscribe_callback_set(
596 mosq: *mut mosquitto,
597 on_unsubscribe: ::std::option::Option<
598 unsafe extern "C" fn(
599 arg1: *mut mosquitto,
600 arg2: *mut ::std::os::raw::c_void,
601 arg3: ::std::os::raw::c_int,
602 ),
603 >,
604 );
605}
606extern "C" {
607 pub fn mosquitto_unsubscribe_v5_callback_set(
608 mosq: *mut mosquitto,
609 on_unsubscribe: ::std::option::Option<
610 unsafe extern "C" fn(
611 arg1: *mut mosquitto,
612 arg2: *mut ::std::os::raw::c_void,
613 arg3: ::std::os::raw::c_int,
614 props: *const mosquitto_property,
615 ),
616 >,
617 );
618}
619extern "C" {
620 pub fn mosquitto_log_callback_set(
621 mosq: *mut mosquitto,
622 on_log: ::std::option::Option<
623 unsafe extern "C" fn(
624 arg1: *mut mosquitto,
625 arg2: *mut ::std::os::raw::c_void,
626 arg3: ::std::os::raw::c_int,
627 arg4: *const ::std::os::raw::c_char,
628 ),
629 >,
630 );
631}
632extern "C" {
633 pub fn mosquitto_socks5_set(
634 mosq: *mut mosquitto,
635 host: *const ::std::os::raw::c_char,
636 port: ::std::os::raw::c_int,
637 username: *const ::std::os::raw::c_char,
638 password: *const ::std::os::raw::c_char,
639 ) -> ::std::os::raw::c_int;
640}
641extern "C" {
642 pub fn mosquitto_strerror(mosq_errno: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char;
643}
644extern "C" {
645 pub fn mosquitto_connack_string(
646 connack_code: ::std::os::raw::c_int,
647 ) -> *const ::std::os::raw::c_char;
648}
649extern "C" {
650 pub fn mosquitto_reason_string(
651 reason_code: ::std::os::raw::c_int,
652 ) -> *const ::std::os::raw::c_char;
653}
654extern "C" {
655 pub fn mosquitto_string_to_command(
656 str_: *const ::std::os::raw::c_char,
657 cmd: *mut ::std::os::raw::c_int,
658 ) -> ::std::os::raw::c_int;
659}
660extern "C" {
661 pub fn mosquitto_sub_topic_tokenise(
662 subtopic: *const ::std::os::raw::c_char,
663 topics: *mut *mut *mut ::std::os::raw::c_char,
664 count: *mut ::std::os::raw::c_int,
665 ) -> ::std::os::raw::c_int;
666}
667extern "C" {
668 pub fn mosquitto_sub_topic_tokens_free(
669 topics: *mut *mut *mut ::std::os::raw::c_char,
670 count: ::std::os::raw::c_int,
671 ) -> ::std::os::raw::c_int;
672}
673extern "C" {
674 pub fn mosquitto_topic_matches_sub(
675 sub: *const ::std::os::raw::c_char,
676 topic: *const ::std::os::raw::c_char,
677 result: *mut bool,
678 ) -> ::std::os::raw::c_int;
679}
680extern "C" {
681 pub fn mosquitto_topic_matches_sub2(
682 sub: *const ::std::os::raw::c_char,
683 sublen: usize,
684 topic: *const ::std::os::raw::c_char,
685 topiclen: usize,
686 result: *mut bool,
687 ) -> ::std::os::raw::c_int;
688}
689extern "C" {
690 pub fn mosquitto_pub_topic_check(topic: *const ::std::os::raw::c_char)
691 -> ::std::os::raw::c_int;
692}
693extern "C" {
694 pub fn mosquitto_pub_topic_check2(
695 topic: *const ::std::os::raw::c_char,
696 topiclen: usize,
697 ) -> ::std::os::raw::c_int;
698}
699extern "C" {
700 pub fn mosquitto_sub_topic_check(topic: *const ::std::os::raw::c_char)
701 -> ::std::os::raw::c_int;
702}
703extern "C" {
704 pub fn mosquitto_sub_topic_check2(
705 topic: *const ::std::os::raw::c_char,
706 topiclen: usize,
707 ) -> ::std::os::raw::c_int;
708}
709extern "C" {
710 pub fn mosquitto_validate_utf8(
711 str_: *const ::std::os::raw::c_char,
712 len: ::std::os::raw::c_int,
713 ) -> ::std::os::raw::c_int;
714}
715#[repr(C)]
716#[derive(Debug, Copy, Clone)]
717pub struct libmosquitto_will {
718 pub topic: *mut ::std::os::raw::c_char,
719 pub payload: *mut ::std::os::raw::c_void,
720 pub payloadlen: ::std::os::raw::c_int,
721 pub qos: ::std::os::raw::c_int,
722 pub retain: bool,
723}
724#[repr(C)]
725#[derive(Debug, Copy, Clone)]
726pub struct libmosquitto_tls {
727 pub cafile: *mut ::std::os::raw::c_char,
728 pub capath: *mut ::std::os::raw::c_char,
729 pub certfile: *mut ::std::os::raw::c_char,
730 pub keyfile: *mut ::std::os::raw::c_char,
731 pub ciphers: *mut ::std::os::raw::c_char,
732 pub tls_version: *mut ::std::os::raw::c_char,
733 pub pw_callback: ::std::option::Option<
734 unsafe extern "C" fn(
735 buf: *mut ::std::os::raw::c_char,
736 size: ::std::os::raw::c_int,
737 rwflag: ::std::os::raw::c_int,
738 userdata: *mut ::std::os::raw::c_void,
739 ) -> ::std::os::raw::c_int,
740 >,
741 pub cert_reqs: ::std::os::raw::c_int,
742}
743extern "C" {
744 pub fn mosquitto_subscribe_simple(
745 messages: *mut *mut mosquitto_message,
746 msg_count: ::std::os::raw::c_int,
747 want_retained: bool,
748 topic: *const ::std::os::raw::c_char,
749 qos: ::std::os::raw::c_int,
750 host: *const ::std::os::raw::c_char,
751 port: ::std::os::raw::c_int,
752 client_id: *const ::std::os::raw::c_char,
753 keepalive: ::std::os::raw::c_int,
754 clean_session: bool,
755 username: *const ::std::os::raw::c_char,
756 password: *const ::std::os::raw::c_char,
757 will: *const libmosquitto_will,
758 tls: *const libmosquitto_tls,
759 ) -> ::std::os::raw::c_int;
760}
761extern "C" {
762 pub fn mosquitto_subscribe_callback(
763 callback: ::std::option::Option<
764 unsafe extern "C" fn(
765 arg1: *mut mosquitto,
766 arg2: *mut ::std::os::raw::c_void,
767 arg3: *const mosquitto_message,
768 ) -> ::std::os::raw::c_int,
769 >,
770 userdata: *mut ::std::os::raw::c_void,
771 topic: *const ::std::os::raw::c_char,
772 qos: ::std::os::raw::c_int,
773 host: *const ::std::os::raw::c_char,
774 port: ::std::os::raw::c_int,
775 client_id: *const ::std::os::raw::c_char,
776 keepalive: ::std::os::raw::c_int,
777 clean_session: bool,
778 username: *const ::std::os::raw::c_char,
779 password: *const ::std::os::raw::c_char,
780 will: *const libmosquitto_will,
781 tls: *const libmosquitto_tls,
782 ) -> ::std::os::raw::c_int;
783}
784extern "C" {
785 pub fn mosquitto_property_add_byte(
786 proplist: *mut *mut mosquitto_property,
787 identifier: ::std::os::raw::c_int,
788 value: u8,
789 ) -> ::std::os::raw::c_int;
790}
791extern "C" {
792 pub fn mosquitto_property_add_int16(
793 proplist: *mut *mut mosquitto_property,
794 identifier: ::std::os::raw::c_int,
795 value: u16,
796 ) -> ::std::os::raw::c_int;
797}
798extern "C" {
799 pub fn mosquitto_property_add_int32(
800 proplist: *mut *mut mosquitto_property,
801 identifier: ::std::os::raw::c_int,
802 value: u32,
803 ) -> ::std::os::raw::c_int;
804}
805extern "C" {
806 pub fn mosquitto_property_add_varint(
807 proplist: *mut *mut mosquitto_property,
808 identifier: ::std::os::raw::c_int,
809 value: u32,
810 ) -> ::std::os::raw::c_int;
811}
812extern "C" {
813 pub fn mosquitto_property_add_binary(
814 proplist: *mut *mut mosquitto_property,
815 identifier: ::std::os::raw::c_int,
816 value: *const ::std::os::raw::c_void,
817 len: u16,
818 ) -> ::std::os::raw::c_int;
819}
820extern "C" {
821 pub fn mosquitto_property_add_string(
822 proplist: *mut *mut mosquitto_property,
823 identifier: ::std::os::raw::c_int,
824 value: *const ::std::os::raw::c_char,
825 ) -> ::std::os::raw::c_int;
826}
827extern "C" {
828 pub fn mosquitto_property_add_string_pair(
829 proplist: *mut *mut mosquitto_property,
830 identifier: ::std::os::raw::c_int,
831 name: *const ::std::os::raw::c_char,
832 value: *const ::std::os::raw::c_char,
833 ) -> ::std::os::raw::c_int;
834}
835extern "C" {
836 pub fn mosquitto_property_identifier(
837 property: *const mosquitto_property,
838 ) -> ::std::os::raw::c_int;
839}
840extern "C" {
841 pub fn mosquitto_property_next(
842 proplist: *const mosquitto_property,
843 ) -> *const mosquitto_property;
844}
845extern "C" {
846 pub fn mosquitto_property_read_byte(
847 proplist: *const mosquitto_property,
848 identifier: ::std::os::raw::c_int,
849 value: *mut u8,
850 skip_first: bool,
851 ) -> *const mosquitto_property;
852}
853extern "C" {
854 pub fn mosquitto_property_read_int16(
855 proplist: *const mosquitto_property,
856 identifier: ::std::os::raw::c_int,
857 value: *mut u16,
858 skip_first: bool,
859 ) -> *const mosquitto_property;
860}
861extern "C" {
862 pub fn mosquitto_property_read_int32(
863 proplist: *const mosquitto_property,
864 identifier: ::std::os::raw::c_int,
865 value: *mut u32,
866 skip_first: bool,
867 ) -> *const mosquitto_property;
868}
869extern "C" {
870 pub fn mosquitto_property_read_varint(
871 proplist: *const mosquitto_property,
872 identifier: ::std::os::raw::c_int,
873 value: *mut u32,
874 skip_first: bool,
875 ) -> *const mosquitto_property;
876}
877extern "C" {
878 pub fn mosquitto_property_read_binary(
879 proplist: *const mosquitto_property,
880 identifier: ::std::os::raw::c_int,
881 value: *mut *mut ::std::os::raw::c_void,
882 len: *mut u16,
883 skip_first: bool,
884 ) -> *const mosquitto_property;
885}
886extern "C" {
887 pub fn mosquitto_property_read_string(
888 proplist: *const mosquitto_property,
889 identifier: ::std::os::raw::c_int,
890 value: *mut *mut ::std::os::raw::c_char,
891 skip_first: bool,
892 ) -> *const mosquitto_property;
893}
894extern "C" {
895 pub fn mosquitto_property_read_string_pair(
896 proplist: *const mosquitto_property,
897 identifier: ::std::os::raw::c_int,
898 name: *mut *mut ::std::os::raw::c_char,
899 value: *mut *mut ::std::os::raw::c_char,
900 skip_first: bool,
901 ) -> *const mosquitto_property;
902}
903extern "C" {
904 pub fn mosquitto_property_free_all(properties: *mut *mut mosquitto_property);
905}
906extern "C" {
907 pub fn mosquitto_property_copy_all(
908 dest: *mut *mut mosquitto_property,
909 src: *const mosquitto_property,
910 ) -> ::std::os::raw::c_int;
911}
912extern "C" {
913 pub fn mosquitto_property_check_command(
914 command: ::std::os::raw::c_int,
915 identifier: ::std::os::raw::c_int,
916 ) -> ::std::os::raw::c_int;
917}
918extern "C" {
919 pub fn mosquitto_property_check_all(
920 command: ::std::os::raw::c_int,
921 properties: *const mosquitto_property,
922 ) -> ::std::os::raw::c_int;
923}
924extern "C" {
925 pub fn mosquitto_property_identifier_to_string(
926 identifier: ::std::os::raw::c_int,
927 ) -> *const ::std::os::raw::c_char;
928}
929extern "C" {
930 pub fn mosquitto_string_to_property_info(
931 propname: *const ::std::os::raw::c_char,
932 identifier: *mut ::std::os::raw::c_int,
933 type_: *mut ::std::os::raw::c_int,
934 ) -> ::std::os::raw::c_int;
935}
936#[repr(u32)]
937#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
938pub enum mqtt311_connack_codes {
939 CONNACK_ACCEPTED = 0,
940 CONNACK_REFUSED_PROTOCOL_VERSION = 1,
941 CONNACK_REFUSED_IDENTIFIER_REJECTED = 2,
942 CONNACK_REFUSED_SERVER_UNAVAILABLE = 3,
943 CONNACK_REFUSED_BAD_USERNAME_PASSWORD = 4,
944 CONNACK_REFUSED_NOT_AUTHORIZED = 5,
945}
946impl mqtt5_return_codes {
947 pub const MQTT_RC_NORMAL_DISCONNECTION: mqtt5_return_codes =
948 mqtt5_return_codes::MQTT_RC_SUCCESS;
949}
950impl mqtt5_return_codes {
951 pub const MQTT_RC_GRANTED_QOS0: mqtt5_return_codes = mqtt5_return_codes::MQTT_RC_SUCCESS;
952}
953#[repr(u32)]
954#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
955pub enum mqtt5_return_codes {
956 MQTT_RC_SUCCESS = 0,
957 MQTT_RC_GRANTED_QOS1 = 1,
958 MQTT_RC_GRANTED_QOS2 = 2,
959 MQTT_RC_DISCONNECT_WITH_WILL_MSG = 4,
960 MQTT_RC_NO_MATCHING_SUBSCRIBERS = 16,
961 MQTT_RC_NO_SUBSCRIPTION_EXISTED = 17,
962 MQTT_RC_CONTINUE_AUTHENTICATION = 24,
963 MQTT_RC_REAUTHENTICATE = 25,
964 MQTT_RC_UNSPECIFIED = 128,
965 MQTT_RC_MALFORMED_PACKET = 129,
966 MQTT_RC_PROTOCOL_ERROR = 130,
967 MQTT_RC_IMPLEMENTATION_SPECIFIC = 131,
968 MQTT_RC_UNSUPPORTED_PROTOCOL_VERSION = 132,
969 MQTT_RC_CLIENTID_NOT_VALID = 133,
970 MQTT_RC_BAD_USERNAME_OR_PASSWORD = 134,
971 MQTT_RC_NOT_AUTHORIZED = 135,
972 MQTT_RC_SERVER_UNAVAILABLE = 136,
973 MQTT_RC_SERVER_BUSY = 137,
974 MQTT_RC_BANNED = 138,
975 MQTT_RC_SERVER_SHUTTING_DOWN = 139,
976 MQTT_RC_BAD_AUTHENTICATION_METHOD = 140,
977 MQTT_RC_KEEP_ALIVE_TIMEOUT = 141,
978 MQTT_RC_SESSION_TAKEN_OVER = 142,
979 MQTT_RC_TOPIC_FILTER_INVALID = 143,
980 MQTT_RC_TOPIC_NAME_INVALID = 144,
981 MQTT_RC_PACKET_ID_IN_USE = 145,
982 MQTT_RC_PACKET_ID_NOT_FOUND = 146,
983 MQTT_RC_RECEIVE_MAXIMUM_EXCEEDED = 147,
984 MQTT_RC_TOPIC_ALIAS_INVALID = 148,
985 MQTT_RC_PACKET_TOO_LARGE = 149,
986 MQTT_RC_MESSAGE_RATE_TOO_HIGH = 150,
987 MQTT_RC_QUOTA_EXCEEDED = 151,
988 MQTT_RC_ADMINISTRATIVE_ACTION = 152,
989 MQTT_RC_PAYLOAD_FORMAT_INVALID = 153,
990 MQTT_RC_RETAIN_NOT_SUPPORTED = 154,
991 MQTT_RC_QOS_NOT_SUPPORTED = 155,
992 MQTT_RC_USE_ANOTHER_SERVER = 156,
993 MQTT_RC_SERVER_MOVED = 157,
994 MQTT_RC_SHARED_SUBS_NOT_SUPPORTED = 158,
995 MQTT_RC_CONNECTION_RATE_EXCEEDED = 159,
996 MQTT_RC_MAXIMUM_CONNECT_TIME = 160,
997 MQTT_RC_SUBSCRIPTION_IDS_NOT_SUPPORTED = 161,
998 MQTT_RC_WILDCARD_SUBS_NOT_SUPPORTED = 162,
999}
1000#[repr(u32)]
1001#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1002pub enum mqtt5_property {
1003 MQTT_PROP_PAYLOAD_FORMAT_INDICATOR = 1,
1004 MQTT_PROP_MESSAGE_EXPIRY_INTERVAL = 2,
1005 MQTT_PROP_CONTENT_TYPE = 3,
1006 MQTT_PROP_RESPONSE_TOPIC = 8,
1007 MQTT_PROP_CORRELATION_DATA = 9,
1008 MQTT_PROP_SUBSCRIPTION_IDENTIFIER = 11,
1009 MQTT_PROP_SESSION_EXPIRY_INTERVAL = 17,
1010 MQTT_PROP_ASSIGNED_CLIENT_IDENTIFIER = 18,
1011 MQTT_PROP_SERVER_KEEP_ALIVE = 19,
1012 MQTT_PROP_AUTHENTICATION_METHOD = 21,
1013 MQTT_PROP_AUTHENTICATION_DATA = 22,
1014 MQTT_PROP_REQUEST_PROBLEM_INFORMATION = 23,
1015 MQTT_PROP_WILL_DELAY_INTERVAL = 24,
1016 MQTT_PROP_REQUEST_RESPONSE_INFORMATION = 25,
1017 MQTT_PROP_RESPONSE_INFORMATION = 26,
1018 MQTT_PROP_SERVER_REFERENCE = 28,
1019 MQTT_PROP_REASON_STRING = 31,
1020 MQTT_PROP_RECEIVE_MAXIMUM = 33,
1021 MQTT_PROP_TOPIC_ALIAS_MAXIMUM = 34,
1022 MQTT_PROP_TOPIC_ALIAS = 35,
1023 MQTT_PROP_MAXIMUM_QOS = 36,
1024 MQTT_PROP_RETAIN_AVAILABLE = 37,
1025 MQTT_PROP_USER_PROPERTY = 38,
1026 MQTT_PROP_MAXIMUM_PACKET_SIZE = 39,
1027 MQTT_PROP_WILDCARD_SUB_AVAILABLE = 40,
1028 MQTT_PROP_SUBSCRIPTION_ID_AVAILABLE = 41,
1029 MQTT_PROP_SHARED_SUB_AVAILABLE = 42,
1030}
1031#[repr(u32)]
1032#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1033pub enum mqtt5_property_type {
1034 MQTT_PROP_TYPE_BYTE = 1,
1035 MQTT_PROP_TYPE_INT16 = 2,
1036 MQTT_PROP_TYPE_INT32 = 3,
1037 MQTT_PROP_TYPE_VARINT = 4,
1038 MQTT_PROP_TYPE_BINARY = 5,
1039 MQTT_PROP_TYPE_STRING = 6,
1040 MQTT_PROP_TYPE_STRING_PAIR = 7,
1041}
1042#[repr(u32)]
1043#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1044pub enum mqtt5_sub_options {
1045 MQTT_SUB_OPT_NO_LOCAL = 4,
1046 MQTT_SUB_OPT_RETAIN_AS_PUBLISHED = 8,
1047 MQTT_SUB_OPT_SEND_RETAIN_ALWAYS = 0,
1048 MQTT_SUB_OPT_SEND_RETAIN_NEW = 16,
1049 MQTT_SUB_OPT_SEND_RETAIN_NEVER = 32,
1050}