2021-01-02 13:10:00 -05:00
|
|
|
#pragma once
|
|
|
|
|
2024-02-20 21:41:37 -05:00
|
|
|
/**
|
|
|
|
** \defgroup ssb_connections SSB Connections
|
|
|
|
** Primitive tracking for SSB connections, as in we tried to connect to host X
|
|
|
|
** Y seconds ago, and it failed. This needs to be replaced with something better.
|
|
|
|
** @{
|
|
|
|
*/
|
|
|
|
|
2024-03-06 12:31:17 -05:00
|
|
|
/** An SSB instance. */
|
2021-01-02 13:10:00 -05:00
|
|
|
typedef struct _tf_ssb_t tf_ssb_t;
|
2024-03-06 12:31:17 -05:00
|
|
|
|
|
|
|
/** An SSB connections tracker instance. */
|
2021-01-02 13:10:00 -05:00
|
|
|
typedef struct _tf_ssb_connections_t tf_ssb_connections_t;
|
|
|
|
|
2024-03-06 12:31:17 -05:00
|
|
|
/**
|
|
|
|
** Create a connection tracker.
|
|
|
|
** @param ssb The SSB instance.
|
|
|
|
** @return The connection tracker instance.
|
|
|
|
*/
|
2021-01-02 13:10:00 -05:00
|
|
|
tf_ssb_connections_t* tf_ssb_connections_create(tf_ssb_t* ssb);
|
2024-03-06 12:31:17 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
** Destroy a connection tracker.
|
|
|
|
** @param connections The connection tracker to destroy.
|
|
|
|
*/
|
2021-01-02 13:10:00 -05:00
|
|
|
void tf_ssb_connections_destroy(tf_ssb_connections_t* connections);
|
|
|
|
|
2024-03-06 12:31:17 -05:00
|
|
|
/**
|
|
|
|
** Store a connection in the connection tracker.
|
|
|
|
** @param connections The connection tracker.
|
|
|
|
** @param host The host name or address.
|
|
|
|
** @param port The network port number.
|
|
|
|
** @param key The identity on the other end of the connection.
|
|
|
|
*/
|
2021-01-02 13:10:00 -05:00
|
|
|
void tf_ssb_connections_store(tf_ssb_connections_t* connections, const char* host, int port, const char* key);
|
2024-03-06 12:31:17 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
** Record that a connection was recently attempted.
|
|
|
|
** @param connections The connection tracker.
|
|
|
|
** @param host The host name or address.
|
|
|
|
** @param port The network port number.
|
|
|
|
** @param key The identity on the other end of the connection.
|
|
|
|
*/
|
2021-01-02 13:10:00 -05:00
|
|
|
void tf_ssb_connections_set_attempted(tf_ssb_connections_t* connections, const char* host, int port, const char* key);
|
2024-03-06 12:31:17 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
** Record that a connection recently succeeded.
|
|
|
|
** @param connections The connection tracker.
|
|
|
|
** @param host The host name or address.
|
|
|
|
** @param port The network port number.
|
|
|
|
** @param key The identity on the other end of the connection.
|
|
|
|
*/
|
2021-01-02 13:10:00 -05:00
|
|
|
void tf_ssb_connections_set_succeeded(tf_ssb_connections_t* connections, const char* host, int port, const char* key);
|
2024-02-20 21:41:37 -05:00
|
|
|
|
2024-10-06 11:14:37 -04:00
|
|
|
/**
|
|
|
|
** Initiate an immediate sync.
|
|
|
|
** @param connections The connections tracker.
|
|
|
|
*/
|
|
|
|
void tf_ssb_connections_sync_start(tf_ssb_connections_t* connections);
|
|
|
|
|
2024-02-20 21:41:37 -05:00
|
|
|
/** @} */
|