From e3c7c862122b1af52fe3793359364becb7490084 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Wed, 6 Mar 2024 12:31:17 -0500 Subject: [PATCH] All but the two biggest .h files have docs. --- src/socket.js.h | 15 +++++++++++++++ src/ssb.connections.h | 36 ++++++++++++++++++++++++++++++++++++ src/ssb.export.h | 6 ++++++ 3 files changed, 57 insertions(+) diff --git a/src/socket.js.h b/src/socket.js.h index f4a372ab..1416d906 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 8bb8ae04..6be839bd 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 9b7bc956..96106057 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); /** @} */