diff --git a/src/socket.js.h b/src/socket.js.h index f4a372ab7..1416d9066 100644 --- a/src/socket.js.h +++ b/src/socket.js.h @@ -8,8 +8,23 @@ #include "quickjs.h" +/** +** Register the socket script interface. +** @param context The JS context. +** @return The Socket constructor. +*/ JSValue tf_socket_register(JSContext* context); + +/** +** Get the number of active socket objects. +** @return The count. +*/ int tf_socket_get_count(); + +/** +** Get the number of connected socket objects. +** @return the count. +*/ int tf_socket_get_open_count(); /** @} */ diff --git a/src/ssb.connections.h b/src/ssb.connections.h index 8bb8ae04c..6be839bdd 100644 --- a/src/ssb.connections.h +++ b/src/ssb.connections.h @@ -7,14 +7,50 @@ ** @{ */ +/** An SSB instance. */ typedef struct _tf_ssb_t tf_ssb_t; + +/** An SSB connections tracker instance. */ typedef struct _tf_ssb_connections_t tf_ssb_connections_t; +/** +** Create a connection tracker. +** @param ssb The SSB instance. +** @return The connection tracker instance. +*/ tf_ssb_connections_t* tf_ssb_connections_create(tf_ssb_t* ssb); + +/** +** Destroy a connection tracker. +** @param connections The connection tracker to destroy. +*/ void tf_ssb_connections_destroy(tf_ssb_connections_t* connections); +/** +** 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. +*/ void tf_ssb_connections_store(tf_ssb_connections_t* connections, const char* host, int port, const char* key); + +/** +** 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. +*/ void tf_ssb_connections_set_attempted(tf_ssb_connections_t* connections, const char* host, int port, const char* key); + +/** +** 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. +*/ void tf_ssb_connections_set_succeeded(tf_ssb_connections_t* connections, const char* host, int port, const char* key); /** @} */ diff --git a/src/ssb.export.h b/src/ssb.export.h index 9b7bc9561..96106057a 100644 --- a/src/ssb.export.h +++ b/src/ssb.export.h @@ -8,8 +8,14 @@ ** @{ */ +/** An SSB instance. */ typedef struct _tf_ssb_t tf_ssb_t; +/** +** Export an app to disk. +** @param ssb The SSB instance. +** @param key The app path in the form "/~user/appname". +*/ void tf_ssb_export(tf_ssb_t* ssb, const char* key); /** @} */