1 module mosquitto.api.ctlink; 2 3 import mosquitto.api.types; 4 5 version (ctlink): 6 extern (C): 7 8 int mosquitto_lib_version(int* major, int* minor, int* revision); 9 int mosquitto_lib_init(); 10 int mosquitto_lib_cleanup(); 11 mosquitto_t mosquitto_new(const(char)* id, bool clean_session, void* obj); 12 void mosquitto_destroy(mosquitto_t mosq); 13 int mosquitto_reinitialise(mosquitto_t mosq, const(char)* id, bool clean_session, void* obj); 14 int mosquitto_will_set(mosquitto_t mosq, const(char)* topic, int payloadlen, const(void)* payload, int qos, bool retain); 15 int mosquitto_will_clear(mosquitto_t mosq); 16 int mosquitto_username_pw_set(mosquitto_t mosq, const(char)* username, const(char)* password); 17 int mosquitto_connect(mosquitto_t mosq, const(char)* host, int port, int keepalive); 18 int mosquitto_connect_bind(mosquitto_t mosq, const(char)* host, int port, int keepalive, const(char)* bind_address); 19 int mosquitto_connect_async(mosquitto_t mosq, const(char)* host, int port, int keepalive); 20 int mosquitto_connect_bind_async(mosquitto_t mosq, const(char)* host, int port, int keepalive, const(char)* bind_address); 21 int mosquitto_connect_srv(mosquitto_t mosq, const(char)* host, int keepalive, const(char)* bind_address); 22 int mosquitto_reconnect(mosquitto_t mosq); 23 int mosquitto_reconnect_async(mosquitto_t mosq); 24 int mosquitto_disconnect(mosquitto_t mosq); 25 int mosquitto_publish(mosquitto_t mosq, int* mid, const(char)* topic, int payloadlen, const(void)* payload, int qos, bool retain); 26 int mosquitto_subscribe(mosquitto_t mosq, int* mid, const(char)* sub, int qos); 27 int mosquitto_unsubscribe(mosquitto_t mosq, int* mid, const(char)* sub); 28 int mosquitto_message_copy(mosquitto_message* dst, const mosquitto_message* src); 29 void mosquitto_message_free(mosquitto_message** message); 30 int mosquitto_loop(mosquitto_t mosq, int timeout, int max_packets); 31 int mosquitto_loop_forever(mosquitto_t mosq, int timeout, int max_packets); 32 int mosquitto_loop_start(mosquitto_t mosq); 33 int mosquitto_loop_stop(mosquitto_t mosq, bool force); 34 int mosquitto_socket(mosquitto_t mosq); 35 int mosquitto_loop_read(mosquitto_t mosq, int max_packets); 36 int mosquitto_loop_write(mosquitto_t mosq, int max_packets); 37 int mosquitto_loop_misc(mosquitto_t mosq); 38 bool mosquitto_want_write(mosquitto_t mosq); 39 int mosquitto_threaded_set(mosquitto_t mosq, bool threaded); 40 int mosquitto_opts_set(mosquitto_t mosq, MOSQ_OPT option, void* value); 41 int mosquitto_tls_set(mosquitto_t mosq, 42 const(char)* cafile, const(char)* capath, 43 const(char)* certfile, const(char)* keyfile, 44 int function(char* buf, int size, int rwflag, void* userdata) pw_callback); 45 int mosquitto_tls_insecure_set(mosquitto_t mosq, bool value); 46 int mosquitto_tls_opts_set(mosquitto_t mosq, int cert_reqs, const(char)* tls_version, const(char)* ciphers); 47 int mosquitto_tls_psk_set(mosquitto_t mosq, const(char)* psk, const(char)* identity, const(char)* ciphers); 48 49 alias mosq_base_callback = void function(mosquitto_t, void*, int); 50 51 void mosquitto_connect_callback_set(mosquitto_t mosq, mosq_base_callback on_connect); 52 void mosquitto_disconnect_callback_set(mosquitto_t mosq, mosq_base_callback on_disconnect); 53 void mosquitto_publish_callback_set(mosquitto_t mosq, mosq_base_callback on_publish); 54 void mosquitto_message_callback_set(mosquitto_t mosq, void function(mosquitto_t, void*, const mosquitto_message*) on_message); 55 void mosquitto_subscribe_callback_set(mosquitto_t mosq, void function(mosquitto_t, void*, int, int, const int*)on_subscribe); 56 void mosquitto_unsubscribe_callback_set(mosquitto_t mosq, mosq_base_callback on_unsubscribe); 57 void mosquitto_log_callback_set(mosquitto_t mosq, void function(mosquitto_t, void*, int, const(char)*) on_log); 58 int mosquitto_reconnect_delay_set(mosquitto_t mosq, uint reconnect_delay, uint reconnect_delay_max, 59 bool reconnect_exponential_backoff); 60 int mosquitto_max_inflight_messages_set(mosquitto_t mosq, uint max_inflight_messages); 61 void mosquitto_message_retry_set(mosquitto_t mosq, uint message_retry); 62 void mosquitto_user_data_set(mosquitto_t mosq, void* obj); 63 64 int mosquitto_socks5_set(mosquitto_t mosq, const(char)* host, int port, const(char)* username, const(char)* password); 65 66 const(char)* mosquitto_strerror(int mosq_errno); 67 const(char)* mosquitto_connack_string(int connack_code); 68 int mosquitto_sub_topic_tokenise(const(char)* subtopic, char*** topics, int* count); 69 int mosquitto_sub_topic_tokens_free(char*** topics, int count); 70 int mosquitto_topic_matches_sub(const(char)* sub, const(char)* topic, bool* result); 71 int mosquitto_pub_topic_check(const(char)* topic); 72 int mosquitto_sub_topic_check(const(char)* topic);