Macros | Functions
MyQtt Conn: Related function to create and manage MyQtt Conns.

Macros

#define CONN_CTX(c)   myqtt_conn_get_ctx(c)
 Allows to get the context associated to the provided conn, logging a more verbose message if the context is null or the conn provided is null. More...
 

Functions

axl_bool myqtt_conn_close (MyQttConn *connection)
 Allows to cleanly close the connection by sending the DISCONNECT control packet. More...
 
void myqtt_conn_connect_timeout (MyQttCtx *ctx, long microseconds_to_wait)
 Allows to configure myqtt connect timeout. More...
 
void myqtt_conn_delete_key_data (MyQttConn *connection, const char *key)
 Allows to remove a key/value pair installed by myqtt_conn_set_data and myqtt_conn_set_data_full without calling destroy functions associated. More...
 
void myqtt_conn_free (MyQttConn *connection)
 Frees myqtt connection resources. More...
 
const char * myqtt_conn_get_client_id (MyQttConn *conn)
 Allows to get the client id used during CONNECT phase on the provided connection. More...
 
const char * myqtt_conn_get_code_to_err (MyQttConnAckTypes code)
 Allows to get textual error from error code provided. More...
 
long myqtt_conn_get_connect_timeout (MyQttCtx *ctx)
 Allows to get current timeout set for MyQttConn connect operation. More...
 
MyQttCtxmyqtt_conn_get_ctx (MyQttConn *connection)
 Allows to get the context under which the connection was created. More...
 
axlPointer myqtt_conn_get_data (MyQttConn *connection, const char *key)
 Gets stored value indexed by the given key inside the given connection. More...
 
MyQttHashmyqtt_conn_get_data_hash (MyQttConn *connection)
 Allows to get current data hash object used by the provided connection. More...
 
axlPointer myqtt_conn_get_hook (MyQttConn *connection)
 Allows to get the user land pointer configured by myqtt_conn_set_hook. More...
 
const char * myqtt_conn_get_host (MyQttConn *connection)
 Returns the actual host this connection is connected to. More...
 
const char * myqtt_conn_get_host_ip (MyQttConn *connection)
 Allows to get the actual host ip this connection is connected to. More...
 
int myqtt_conn_get_id (MyQttConn *connection)
 Returns the connection unique identifier. More...
 
MyQttConnAckTypes myqtt_conn_get_last_err (MyQttConn *conn)
 After a myqtt_conn_new you can call this function to get the last error reported. More...
 
MyQttConnmyqtt_conn_get_listener (MyQttConn *connection)
 The function returns the specific MQTT listener that accepted the provided connection. More...
 
const char * myqtt_conn_get_local_addr (MyQttConn *connection)
 Allows to get local address used by the connection. More...
 
const char * myqtt_conn_get_local_port (MyQttConn *connection)
 Allows to get the local port used by the connection. More...
 
int myqtt_conn_get_mss (MyQttConn *connection)
 Allows to get maximum segment size negotiated. More...
 
MyQttMsgmyqtt_conn_get_next (MyQttConn *conn, long timeout)
 Allows to implement a simple synchronous wait for the next message (PUBLISH) received on the provided connection limiting that wait to the provided timeout (in milliseconds). More...
 
const char * myqtt_conn_get_password (MyQttConn *conn)
 Allows to get the password used during CONNECT phase on the provided connection. More...
 
const char * myqtt_conn_get_port (MyQttConn *connection)
 Returns the actual port this connection is connected to. More...
 
MyQttPeerRole myqtt_conn_get_role (MyQttConn *connection)
 Allows to get current connection role. More...
 
const char * myqtt_conn_get_server_name (MyQttConn *conn)
 Allows to get the server name that was used on this connection by indicating the host to connect to. More...
 
MYQTT_SOCKET myqtt_conn_get_socket (MyQttConn *connection)
 Returns the socket used by this MyQttConn object. More...
 
long myqtt_conn_get_timeout (MyQttCtx *ctx)
 Allows to get current timeout set for MyQttConn synchronous operations. More...
 
const char * myqtt_conn_get_username (MyQttConn *conn)
 Allows to get the username used during CONNECT phase on the provided connection. More...
 
axl_bool myqtt_conn_half_opened (MyQttConn *conn)
 Allows to check if the provided connection is still in transit of being accepted. More...
 
axl_bool myqtt_conn_is_blocked (MyQttConn *conn)
 Allows to check if the connection provided is blocked. More...
 
axl_bool myqtt_conn_is_ok (MyQttConn *connection, axl_bool free_on_fail)
 Allows to get current connection status. More...
 
MyQttConnmyqtt_conn_new (MyQttCtx *ctx, const char *client_identifier, axl_bool clean_session, int keep_alive, const char *host, const char *port, MyQttConnOpts *opts, MyQttConnNew on_connected, axlPointer user_data)
 Allows to create a new MQTT connection to a MQTT broker/server. More...
 
MyQttConnmyqtt_conn_new6 (MyQttCtx *ctx, const char *client_identifier, axl_bool clean_session, int keep_alive, const char *host, const char *port, MyQttConnOpts *opts, MyQttConnNew on_connected, axlPointer user_data)
 Allows to create a new MQTT connection to a MQTT* broker/server, forcing IPv6 transport. More...
 
MyQttConnmyqtt_conn_new_empty (MyQttCtx *ctx, MYQTT_SOCKET socket, MyQttPeerRole role)
 Allows to create a new MyQttConn from a socket that is already connected. More...
 
axl_bool myqtt_conn_offline_pub (MyQttCtx *ctx, const char *client_identifier, const char *topic_name, const axlPointer app_message, int app_message_size, MyQttQos qos, axl_bool retain)
 Allows to queue PUBLISH messages on local storage, associated to the provided client identifier, that will be sent once the connection is created after this operation. More...
 
void myqtt_conn_opts_free (MyQttConnOpts *opts)
 Releases the connection object created by myqtt_conn_opts_new. More...
 
MyQttConnOptsmyqtt_conn_opts_new (void)
 Allows to create an empty connection options. More...
 
void myqtt_conn_opts_set_auth (MyQttConnOpts *opts, const char *username, const char *password)
 Allows to configure auth options to be used by the connection function. More...
 
void myqtt_conn_opts_set_init_session_setup_ptr (MyQttConnOpts *opts, MyQttInitSessionSetupPtr init_session_setup_ptr, axlPointer user_data, axlPointer user_data2, axlPointer user_data3)
 Allows to configure a session setup ptr init function used by the session setup handler to implement reconnect operations. More...
 
void myqtt_conn_opts_set_reconnect (MyQttConnOpts *opts, axl_bool enable_reconnect)
 Allows to set/unset reconnect flag on the provided connection options object. More...
 
void myqtt_conn_opts_set_reuse (MyQttConnOpts *opts, axl_bool reuse)
 Allows to configure the reuse option. More...
 
void myqtt_conn_opts_set_will (MyQttConnOpts *opts, MyQttQos will_qos, const char *will_topic, const char *will_message, axl_bool will_retain)
 Allows to configure Will options on the provided connection options. More...
 
axl_bool myqtt_conn_ping (MyQttConn *conn, int wait_pingresp)
 Allows to send a ping request (PINGREQ) to the server over the provided connection. More...
 
axl_bool myqtt_conn_pub (MyQttConn *conn, const char *topic_name, const axlPointer app_message, int app_message_size, MyQttQos qos, axl_bool retain, int wait_publish)
 Allows to publish a new application message with the provided topic name on the provided connection. More...
 
axl_bool myqtt_conn_reconnect (MyQttConn *connection, MyQttConnNew on_connected, axlPointer user_data)
 Allows to reconnect the given connection, using actual connection settings. More...
 
axl_bool myqtt_conn_ref (MyQttConn *connection, const char *who)
 Increase internal myqtt connection reference counting. More...
 
int myqtt_conn_ref_count (MyQttConn *connection)
 Allows to get current reference count for the provided connection. More...
 
axl_bool myqtt_conn_remove_on_close (MyQttConn *connection, MyQttConnOnClose on_close_handler, axlPointer data)
 Allows to uninstall a particular handler installed to get notifications about the connection close. More...
 
void myqtt_conn_sanity_socket_check (MyQttCtx *ctx, axl_bool enable)
 Allows to disable sanity socket check, by default enabled. More...
 
void myqtt_conn_send_connect_reply (MyQttConn *conn, MyQttConnAckTypes response)
 Allows to complete connect operation by sending a particular response. More...
 
axl_bool myqtt_conn_set_blocking_socket (MyQttConn *connection)
 Allows to change connection semantic to blocking. More...
 
void myqtt_conn_set_close_socket (MyQttConn *connection, axl_bool action)
 Allows to configure what to do with the underlying socket connection when the MyQttConn is closed. More...
 
void myqtt_conn_set_data (MyQttConn *connection, const char *key, axlPointer value)
 Sets user defined data associated with the given connection. More...
 
void myqtt_conn_set_data_full (MyQttConn *connection, char *key, axlPointer value, axlDestroyFunc key_destroy, axlDestroyFunc value_destroy)
 Allows to store user space data into the connection like myqtt_conn_set_data does but configuring functions to be called once required to de-allocate data stored. More...
 
void myqtt_conn_set_default_io_handler (MyQttConn *connection)
 Set default IO handlers to be used while sending and receiving data for the given connection. More...
 
void myqtt_conn_set_hook (MyQttConn *connection, axlPointer ptr)
 Allows to set a commonly used user land pointer associated to the provided connection. More...
 
axl_bool myqtt_conn_set_nonblocking_socket (MyQttConn *connection)
 Allows to change connection semantic to non-blocking. More...
 
void myqtt_conn_set_on_close (MyQttConn *connection, axl_bool insert_last, MyQttConnOnClose on_close_handler, axlPointer data)
 Allows to set a new on close handler to be executed only once the connection is being closed. More...
 
void myqtt_conn_set_on_close_full2 (MyQttConn *connection, MyQttConnOnClose on_close_handler, axl_bool insert_last, axlPointer data)
 Extended version for myqtt_conn_set_on_close handler which also support receiving a user data pointer. More...
 
void myqtt_conn_set_on_msg (MyQttConn *conn, MyQttOnMsgReceived on_msg, axlPointer on_msg_data)
 Allows to configure the on message handler for the provided connection. More...
 
void myqtt_conn_set_on_msg_sent (MyQttConn *conn, MyQttOnMsgSent on_msg_sent, axlPointer on_msg_sent_data)
 Allows to setup a handler that is called when a message is completely sent by the engine (myqtt sequencer). More...
 
void myqtt_conn_set_on_reconnect (MyQttConn *conn, MyQttOnReconnect on_reconnect, axlPointer on_reconnect_data)
 Allows to configure a handler that is called in the case a reconnect operation took place and finished without error. More...
 
MyQttReceive myqtt_conn_set_receive_handler (MyQttConn *connection, MyQttReceive receive_handler)
 Allows to configure receive handler use to actually receive data from remote peer. More...
 
MyQttSend myqtt_conn_set_send_handler (MyQttConn *connection, MyQttSend send_handler)
 Allows to configure the send handler used to actually perform sending operations over the underlying connection. More...
 
axl_bool myqtt_conn_set_sock_block (MYQTT_SOCKET socket, axl_bool enable)
 Allows to enable/disable non-blocking/blocking behaviour on the provided socket. More...
 
axl_bool myqtt_conn_set_sock_tcp_nodelay (MYQTT_SOCKET socket, axl_bool enable)
 Allows to configure tcp no delay flag (enable/disable Nagle algorithm). More...
 
axl_bool myqtt_conn_set_socket (MyQttConn *conn, MYQTT_SOCKET _socket, const char *real_host, const char *real_port)
 Allows to configure the socket to be used by the provided connection. More...
 
void myqtt_conn_shutdown (MyQttConn *connection)
 Allows to shutdown the connection without cleanly closing like using myqtt_conn_close. More...
 
void myqtt_conn_shutdown_socket (MyQttConn *connection)
 Function used to just shutdown socket associated to the connection. More...
 
MYQTT_SOCKET myqtt_conn_sock_connect (MyQttCtx *ctx, const char *host, const char *port, int *timeout, axlError **error)
 Allows to create a plain socket connection against the host and port provided. More...
 
MYQTT_SOCKET myqtt_conn_sock_connect_common (MyQttCtx *ctx, const char *host, const char *port, int *timeout, MyQttNetTransport transport, axlError **error)
 Allows to create a plain socket connection against the host and port provided allowing to configure the transport. More...
 
axl_bool myqtt_conn_sub (MyQttConn *conn, int wait_sub, const char *topic_filter, MyQttQos qos, int *subs_result)
 Allows to subscribe to one topic. More...
 
void myqtt_conn_timeout (MyQttCtx *ctx, long microseconds_to_wait)
 Allows to configure myqtt internal timeouts for synchronous operations. More...
 
axl_bool myqtt_conn_uncheck_ref (MyQttConn *connection)
 Allows to perform a ref count operation on the connection provided without checking if the connection is working (no call to myqtt_conn_is_ok). More...
 
void myqtt_conn_unref (MyQttConn *connection, char const *who)
 Decrease myqtt connection reference counting. More...
 
axl_bool myqtt_conn_unsub (MyQttConn *conn, const char *topic_filter, int wait_unsub)
 Allows to unsubscribe the given particular topic filter on the provided connection. More...
 

Detailed Description