ssb: Pass around reasons for failing to connect. This will help get that information to the ui when I finish hooking it up.
This commit is contained in:
16
src/ssb.h
16
src/ssb.h
@ -348,6 +348,14 @@ const char** tf_ssb_get_connection_ids(tf_ssb_t* ssb);
|
||||
*/
|
||||
int tf_ssb_get_connections(tf_ssb_t* ssb, tf_ssb_connection_t** out_connections, int out_connections_count);
|
||||
|
||||
/**
|
||||
** Callback for completing establishing a connection.
|
||||
** @param connection The established connection if successful or null.
|
||||
** @param reason The reason for failure if the connection failed.
|
||||
** @param user_data User data.
|
||||
*/
|
||||
typedef void(tf_ssb_connect_callback_t)(tf_ssb_connection_t* connection, const char* reason, void* user_data);
|
||||
|
||||
/**
|
||||
** Establish an SHS connection with a host.
|
||||
** @param ssb The SSB instance.
|
||||
@ -355,16 +363,20 @@ int tf_ssb_get_connections(tf_ssb_t* ssb, tf_ssb_connection_t** out_connections,
|
||||
** @param port The host's SHS port.
|
||||
** @param key The host's SSB identity.
|
||||
** @param connect_flags Flags affecting the connection.
|
||||
** @param callback Completion callback.
|
||||
** @param user_data User data to be passed to the callback.
|
||||
*/
|
||||
void tf_ssb_connect(tf_ssb_t* ssb, const char* host, int port, const uint8_t* key, int connect_flags);
|
||||
void tf_ssb_connect(tf_ssb_t* ssb, const char* host, int port, const uint8_t* key, int connect_flags, tf_ssb_connect_callback_t* callback, void* user_data);
|
||||
|
||||
/**
|
||||
** Establish an SHS connection with a host by string address.
|
||||
** @param ssb The SSB instance.
|
||||
** @param address The address.
|
||||
** @param connect_flags Flags affecting the connection.
|
||||
** @param callback Completion callback.
|
||||
** @param user_data User data to be passed to the callback.
|
||||
*/
|
||||
void tf_ssb_connect_str(tf_ssb_t* ssb, const char* address, int connect_flags);
|
||||
void tf_ssb_connect_str(tf_ssb_t* ssb, const char* address, int connect_flags, tf_ssb_connect_callback_t* callback, void* user_data);
|
||||
|
||||
/**
|
||||
** Begin listening for SHS connections on the given port.
|
||||
|
Reference in New Issue
Block a user