From 8b878d6c8088aba854c258b3c553b09effdc6fe7 Mon Sep 17 00:00:00 2001
From: "cellframe.docs" <cellframe.docs@gmail.com>
Date: Fri, 24 Sep 2021 15:26:50 +0300
Subject: [PATCH 1/4] Add comments

---
 dap-sdk/net/server/http_server/dap_http.c | 29 ++++++++++++++++++-----
 modules/net/dap_chain_node_cli_cmd.c      |  1 +
 2 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/dap-sdk/net/server/http_server/dap_http.c b/dap-sdk/net/server/http_server/dap_http.c
index b931d229d..7af054d9e 100644
--- a/dap-sdk/net/server/http_server/dap_http.c
+++ b/dap-sdk/net/server/http_server/dap_http.c
@@ -130,12 +130,29 @@ void dap_http_delete( dap_server_t *a_server, void * a_arg )
 
 
 /**
- * @brief dap_http_add_proc   Add custom procesor for the HTTP server
- * @param a_http              Server's instance
- * @param a_url_path          Part of URL to be processed
- * @param a_read_callback     Callback for read in DATA state
- * @param a_write_callback    Callback for write in DATA state
- * @param a_error_callback    Callback for error processing
+ * @brief dap_http_add_proc             Add custom procesor for the HTTP server
+ * 
+ * @param a_http                        Server's instance
+ * @param a_url_path                    Part of URL to be processed
+ * @param a_inheritor                   Internal data specific to the current URL processor
+ * @param a_new_callback                additional callback function
+ * 
+ * Called in s_queue_add_es_callback    
+ * if ( ! l_es_new->is_initalized ){
+        if (l_es_new->callbacks.new_callback)
+            l_es_new->callbacks.new_callback(l_es_new, NULL);
+        l_es_new->is_initalized = true;
+    }
+ * @param a_delete_callback             callback which is called, when HTTP server object is deleted
+ * @param a_headers_read_callback       Callback for read HTTP headers callback
+ * @param a_headers_write_callback      Callback for write HTTP headers callback
+ * @param a_data_read_callback          Callback for read in DATA state
+ * @param a_data_write_callback         Callback for write in DATA state
+ * @param a_error_callback              Callback for error processing
+ * @note 
+ * data_read_callback is called, when headers is finished in body request, and next part of 
+ * body request contains remaining part of buffer. If data contains only in header, a_data_read_callback is not called.
+ * @return dap_http_url_proc_t* 
  */
 dap_http_url_proc_t * dap_http_add_proc(dap_http_t *a_http, const char *a_url_path, void *a_inheritor
                       ,dap_http_client_callback_t a_new_callback
diff --git a/modules/net/dap_chain_node_cli_cmd.c b/modules/net/dap_chain_node_cli_cmd.c
index 9d38fa1f5..4dc8bd4c7 100644
--- a/modules/net/dap_chain_node_cli_cmd.c
+++ b/modules/net/dap_chain_node_cli_cmd.c
@@ -4036,6 +4036,7 @@ int com_print_log(int argc, char ** argv, void *arg_func, char **str_reply)
 
 /**
  * @brief cmd_gdb_export
+ * action for cellframe-node-cli.exe gdb_export command
  * @param argc
  * @param argv
  * @param arg_func
-- 
GitLab


From 137da6eef10143f33989f4a4c6d63cfc4264fcd2 Mon Sep 17 00:00:00 2001
From: "dmitriy.gerasimov" <naeper@demlabs.net>
Date: Fri, 24 Sep 2021 14:54:05 +0000
Subject: [PATCH 2/4] Update dap_chain_node_cli_cmd.c

---
 modules/net/dap_chain_node_cli_cmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/net/dap_chain_node_cli_cmd.c b/modules/net/dap_chain_node_cli_cmd.c
index 4dc8bd4c7..dbc1b41cd 100644
--- a/modules/net/dap_chain_node_cli_cmd.c
+++ b/modules/net/dap_chain_node_cli_cmd.c
@@ -3,7 +3,7 @@
  * Dmitriy A. Gerasimov <gerasimov.dmitriy@demlabs.net>
  * Alexander Lysikov <alexander.lysikov@demlabs.net>
  * DeM Labs Inc.   https://demlabs.net
- * Kelvin Project https://github.com/kelvinblockchain
+ * Cellframe Network  https://github.com/demlabs-cellframe
  * Copyright  (c) 2019
  * All rights reserved.
 
@@ -4036,7 +4036,7 @@ int com_print_log(int argc, char ** argv, void *arg_func, char **str_reply)
 
 /**
  * @brief cmd_gdb_export
- * action for cellframe-node-cli.exe gdb_export command
+ * action for cellframe-node-cli gdb_export command
  * @param argc
  * @param argv
  * @param arg_func
-- 
GitLab


From 5735f8c6a3a03a4c46aa35e16a58c332d667dd0d Mon Sep 17 00:00:00 2001
From: "cellframe.docs" <cellframe.docs@gmail.com>
Date: Mon, 4 Oct 2021 13:56:55 +0300
Subject: [PATCH 3/4] Update comments

---
 modules/net/dap_chain_node_cli.c        |  78 +++++++++-
 modules/net/dap_chain_node_cli_cmd.c    | 190 +++++++++++++++++++++---
 modules/net/dap_chain_node_cli_cmd_tx.c |  67 ++++++++-
 modules/net/dap_chain_node_client.c     |  74 ++++++++-
 4 files changed, 367 insertions(+), 42 deletions(-)

diff --git a/modules/net/dap_chain_node_cli.c b/modules/net/dap_chain_node_cli.c
index e065f8773..1b0932f2e 100644
--- a/modules/net/dap_chain_node_cli.c
+++ b/modules/net/dap_chain_node_cli.c
@@ -86,6 +86,7 @@ static dap_chain_node_cmd_item_t * s_commands = NULL;
 
 
 /**
+ * @brief int s_poll
  * Wait for data
  * timeout -  timeout in ms
  * [Specifying a negative value in timeout means an infinite timeout.]
@@ -93,6 +94,9 @@ static dap_chain_node_cmd_item_t * s_commands = NULL;
  * return zero if the time limit expired
  * return: >0 if data is present to read
  * return: -1 if error
+ * @param socket 
+ * @param timeout 
+ * @return int 
  */
 static int s_poll( int socket, int timeout )
 {
@@ -111,8 +115,13 @@ static int s_poll( int socket, int timeout )
     return res;
 }
 
+
 /**
+ * @brief is_valid_socket
  * Check socket for validity
+ * @param sock 
+ * @return true 
+ * @return false 
  */
 static bool is_valid_socket(SOCKET sock)
 {
@@ -145,10 +154,14 @@ static bool is_valid_socket(SOCKET sock)
 }
 
 /**
- * Read from socket
- *
+ * @brief s_recv
  * timeout in milliseconds
  * return the number of read bytes (-1 err or -2 timeout)
+ * @param sock 
+ * @param buf 
+ * @param bufsize 
+ * @param timeout 
+ * @return long 
  */
 long s_recv(SOCKET sock, unsigned char *buf, size_t bufsize, int timeout)
 {
@@ -172,13 +185,21 @@ long s_recv(SOCKET sock, unsigned char *buf, size_t bufsize, int timeout)
     return res;
 }
 
+
 /**
+ * @brief s_get_next_str
  * Reading from the socket till arrival the specified string
  *
  * stop_str - string to which reading will continue
  * del_stop_str - удалять ли строку для поиска в конце
  * timeout - in ms
  * return: string (if waited for final characters) or NULL, if the string requires deletion
+ * @param nSocket 
+ * @param dwLen 
+ * @param stop_str 
+ * @param del_stop_str 
+ * @param timeout 
+ * @return char* 
  */
 char* s_get_next_str( SOCKET nSocket, int *dwLen, const char *stop_str, bool del_stop_str, int timeout )
 {
@@ -379,6 +400,16 @@ static void* thread_one_client_func(void *args)
 
 #ifdef _WIN32
 
+/**
+ * @brief p_get_next_str
+ * 
+ * @param hPipe 
+ * @param dwLen 
+ * @param stop_str 
+ * @param del_stop_str 
+ * @param timeout 
+ * @return char* 
+ */
 char *p_get_next_str( HANDLE hPipe, int *dwLen, const char *stop_str, bool del_stop_str, int timeout )
 {
     bool bSuccess = false;
@@ -455,7 +486,14 @@ char *p_get_next_str( HANDLE hPipe, int *dwLen, const char *stop_str, bool del_s
 
 
 /**
+
+ */
+
+/**
+ * @brief thread_pipe_client_func
  * threading function for processing a request from a client
+ * @param args 
+ * @return void* 
  */
 static void *thread_pipe_client_func( void *args )
 {
@@ -603,7 +641,10 @@ static void *thread_pipe_client_func( void *args )
 
 
 /**
+ * @brief thread_pipe_func
  * main threading server function pipe win32
+ * @param args 
+ * @return void* 
  */
 static void* thread_pipe_func( void *args )
 {
@@ -650,8 +691,12 @@ static void* thread_pipe_func( void *args )
 }
 #endif
 
+
 /**
+ * @brief thread_main_func
  * main threading server function
+ * @param args 
+ * @return void* 
  */
 static void* thread_main_func(void *args)
 {
@@ -681,8 +726,13 @@ static void* thread_main_func(void *args)
     return NULL;
 }
 
+
 /**
+ * @brief dap_chain_node_cli_set_reply_text
  * Write text to reply string
+ * @param str_reply 
+ * @param str 
+ * @param ... 
  */
 void dap_chain_node_cli_set_reply_text(char **str_reply, const char *str, ...)
 {
@@ -725,10 +775,16 @@ int dap_chain_node_cli_check_option( char** argv, int arg_start, int arg_end, co
     return -1;
 }
 
+
 /**
- * find option value
- *
+ * @brief dap_chain_node_cli_find_option_val
  * return index of string in argv, or 0 if not found
+ * @param argv 
+ * @param arg_start 
+ * @param arg_end 
+ * @param opt_name 
+ * @param opt_value 
+ * @return int 
  */
 int dap_chain_node_cli_find_option_val( char** argv, int arg_start, int arg_end, const char *opt_name, const char **opt_value)
 {
@@ -784,6 +840,12 @@ void dap_chain_node_cli_cmd_item_create(const char * a_name, cmdfunc_t *a_func,
     log_it(L_DEBUG,"Added command %s",l_cmd_item->name);
 }
 
+/**
+ * @brief dap_chain_node_cli_cmd_item_apply_overrides
+ * 
+ * @param a_name 
+ * @param a_overrides 
+ */
 void dap_chain_node_cli_cmd_item_apply_overrides(const char * a_name, const dap_chain_node_cmd_item_func_overrides_t * a_overrides){
     dap_chain_node_cmd_item_t *l_cmd_item = dap_chain_node_cli_cmd_find(a_name);
     if(l_cmd_item)
@@ -813,10 +875,13 @@ dap_chain_node_cmd_item_t* dap_chain_node_cli_cmd_find(const char *a_name)
 
 
 /**
+ * @brief dap_chain_node_cli_init
  * Initialization of the server side of the interaction
  * with the console kelvin-node-cli
- *
+ * init commands description
  * return 0 if OK, -1 error
+ * @param g_config 
+ * @return int 
  */
 int dap_chain_node_cli_init(dap_config_t * g_config)
 {
@@ -1166,9 +1231,10 @@ int dap_chain_node_cli_init(dap_config_t * g_config)
     return 0;
 }
 
+
 /**
+ * @brief dap_chain_node_cli_delete
  * Deinitialization of the server side
- *
  */
 void dap_chain_node_cli_delete(void)
 {
diff --git a/modules/net/dap_chain_node_cli_cmd.c b/modules/net/dap_chain_node_cli_cmd.c
index dbc1b41cd..7303adeab 100644
--- a/modules/net/dap_chain_node_cli_cmd.c
+++ b/modules/net/dap_chain_node_cli_cmd.c
@@ -107,9 +107,13 @@
 
 
 /**
+ * @brief dap_chain_node_addr_t* dap_chain_node_addr_get_by_alias
  * Find in base addr by alias
  *
  * return addr, NULL if not found
+ * @param a_net 
+ * @param a_alias 
+ * @return dap_chain_node_addr_t* 
  */
 dap_chain_node_addr_t* dap_chain_node_addr_get_by_alias(dap_chain_net_t * a_net, const char *a_alias)
 {
@@ -128,10 +132,15 @@ dap_chain_node_addr_t* dap_chain_node_addr_get_by_alias(dap_chain_net_t * a_net,
     return l_addr;
 }
 
+
 /**
+ * @brief dap_list_t* get_aliases_by_name Get the aliases by name object
  * Find in base alias by addr
  *
  * return list of addr, NULL if not found
+ * @param l_net 
+ * @param a_addr 
+ * @return dap_list_t* 
  */
 static dap_list_t* get_aliases_by_name(dap_chain_net_t * l_net, dap_chain_node_addr_t *a_addr)
 {
@@ -157,6 +166,15 @@ static dap_list_t* get_aliases_by_name(dap_chain_net_t * l_net, dap_chain_node_a
     return list_aliases;
 }
 
+/**
+ * @brief dap_chain_node_addr_t* s_node_info_get_addr
+ * 
+ * @param a_net 
+ * @param a_node_info 
+ * @param a_addr 
+ * @param a_alias_str 
+ * @return dap_chain_node_addr_t* 
+ */
 static dap_chain_node_addr_t* s_node_info_get_addr(dap_chain_net_t * a_net, dap_chain_node_info_t *a_node_info,
         dap_chain_node_addr_t *a_addr, const char *a_alias_str)
 {
@@ -171,8 +189,14 @@ static dap_chain_node_addr_t* s_node_info_get_addr(dap_chain_net_t * a_net, dap_
     return l_address;
 }
 
+
 /**
+ * @brief node_info_read_and_reply
  * Read node from base
+ * @param a_net 
+ * @param a_address 
+ * @param a_str_reply 
+ * @return dap_chain_node_info_t* 
  */
 static dap_chain_node_info_t* node_info_read_and_reply(dap_chain_net_t * a_net, dap_chain_node_addr_t *a_address,
         char **a_str_reply)
@@ -213,8 +237,15 @@ static dap_chain_node_info_t* node_info_read_and_reply(dap_chain_net_t * a_net,
     return node_info;
 }
 
+
 /**
+ * @brief node_info_save_and_reply
  * Save node to base
+ * @param a_net 
+ * @param a_node_info 
+ * @param str_reply 
+ * @return true 
+ * @return false 
  */
 static bool node_info_save_and_reply(dap_chain_net_t * a_net, dap_chain_node_info_t *a_node_info, char **str_reply)
 {
@@ -245,11 +276,21 @@ static bool node_info_save_and_reply(dap_chain_net_t * a_net, dap_chain_node_inf
     return res;
 }
 
+
 /**
+ * @brief node_info_add_with_reply
  * Handler of command 'global_db node add'
  *
  * str_reply[out] for reply
  * return 0 Ok, -1 error
+ * @param a_net 
+ * @param a_node_info 
+ * @param a_alias_str 
+ * @param a_cell_str 
+ * @param a_ipv4_str 
+ * @param a_ipv6_str 
+ * @param a_str_reply 
+ * @return int 
  */
 static int node_info_add_with_reply(dap_chain_net_t * a_net, dap_chain_node_info_t *a_node_info,
         const char *a_alias_str,
@@ -296,10 +337,15 @@ static int node_info_add_with_reply(dap_chain_net_t * a_net, dap_chain_node_info
     return -1;
 }
 
+
 /**
+ * @brief node_info_del_with_reply
  * Handler of command 'global_db node add'
- *
- * str_reply[out] for reply
+ * @param a_net 
+ * @param a_node_info 
+ * @param alias_str 
+ * @param str_reply str_reply[out] for reply
+ * @return int 
  * return 0 Ok, -1 error
  */
 static int node_info_del_with_reply(dap_chain_net_t * a_net, dap_chain_node_info_t *a_node_info, const char *alias_str,
@@ -356,12 +402,20 @@ static int node_info_del_with_reply(dap_chain_net_t * a_net, dap_chain_node_info
     return -1;
 }
 
+
 /**
+ * @brief link_add_or_del_with_reply
  * Handler of command 'global_db node link'
- *
  * cmd 'add' or 'del'
  * str_reply[out] for reply
  * return 0 Ok, -1 error
+ * @param a_net 
+ * @param a_node_info 
+ * @param cmd 
+ * @param a_alias_str 
+ * @param link 
+ * @param a_str_reply 
+ * @return int 
  */
 static int link_add_or_del_with_reply(dap_chain_net_t * a_net, dap_chain_node_info_t *a_node_info, const char *cmd,
         const char *a_alias_str,
@@ -467,11 +521,18 @@ static int link_add_or_del_with_reply(dap_chain_net_t * a_net, dap_chain_node_in
     return -1;
 }
 
+
 /**
- * Handler of command 'node dump'
+ * @brief node_info_dump_with_reply Handler of command 'node dump'
  *
  * str_reply[out] for reply
  * return 0 Ok, -1 error
+ * @param a_net 
+ * @param a_addr 
+ * @param a_is_full 
+ * @param a_alias 
+ * @param a_str_reply 
+ * @return int 
  */
 static int node_info_dump_with_reply(dap_chain_net_t * a_net, dap_chain_node_addr_t * a_addr, bool a_is_full,
         const char *a_alias, char **a_str_reply)
@@ -669,11 +730,15 @@ static int node_info_dump_with_reply(dap_chain_net_t * a_net, dap_chain_node_add
 }
 
 /**
+ * @brief com_global_db
  * global_db command
- *
+ * @param a_argc 
+ * @param a_argv 
+ * @param arg_func 
+ * @param a_str_reply 
+ * @return int 
  * return 0 OK, -1 Err
  */
-
 int com_global_db(int a_argc, char ** a_argv, void *arg_func, char **a_str_reply)
 {
     enum {
@@ -1262,10 +1327,15 @@ int com_node(int a_argc, char ** a_argv, void *arg_func, char **a_str_reply)
     return 0;
 }
 
+
 /**
- * Traceroute command
- *
+ * @brief Traceroute command
  * return 0 OK, -1 Err
+ * @param argc 
+ * @param argv 
+ * @param arg_func 
+ * @param str_reply 
+ * @return int 
  */
 int com_traceroute(int argc, char** argv, void *arg_func, char **str_reply)
 {
@@ -1343,9 +1413,15 @@ int com_traceroute(int argc, char** argv, void *arg_func, char **str_reply)
 #endif
 }
 
+
 /**
+ * @brief com_tracepath
  * Tracepath command
- *
+ * @param argc 
+ * @param argv 
+ * @param arg_func 
+ * @param str_reply 
+ * @return int 
  * return 0 OK, -1 Err
  */
 int com_tracepath(int argc, char** argv, void *arg_func, char **str_reply)
@@ -1419,10 +1495,15 @@ int com_tracepath(int argc, char** argv, void *arg_func, char **str_reply)
 #endif
 }
 
+
 /**
- * Ping command
- *
+ * @brief Ping command
  * return 0 OK, -1 Err
+ * @param argc 
+ * @param argv 
+ * @param arg_func 
+ * @param str_reply 
+ * @return int 
  */
 int com_ping(int argc, char** argv, void *arg_func, char **str_reply)
 {
@@ -1509,7 +1590,13 @@ int com_version(int argc, char ** argv, void *arg_func, char **str_reply)
 
 
 /**
+ * @brief 
  * Help command
+ * @param argc 
+ * @param argv 
+ * @param arg_func 
+ * @param str_reply 
+ * @return int 
  */
 int com_help(int argc, char ** argv, void *arg_func, char **str_reply)
 {
@@ -1541,10 +1628,16 @@ int com_help(int argc, char ** argv, void *arg_func, char **str_reply)
     }
 }
 
+
 /**
- * com_tx_create command
- *
+ * @brief com_tx_wallet
  * Wallet info
+ * com_tx_create command
+ * @param argc 
+ * @param argv 
+ * @param arg_func 
+ * @param str_reply 
+ * @return int 
  */
 int com_tx_wallet(int argc, char ** argv, void *arg_func, char **str_reply)
 {
@@ -2049,6 +2142,14 @@ int com_token_decl_sign(int argc, char ** argv, void *arg_func, char ** a_str_re
     }
 }
 
+/**
+ * @brief s_com_mempool_list_print_for_chain
+ * 
+ * @param a_net 
+ * @param a_chain 
+ * @param a_str_tmp 
+ * @param a_hash_out_type 
+ */
 void s_com_mempool_list_print_for_chain(dap_chain_net_t * a_net, dap_chain_t * a_chain, dap_string_t * a_str_tmp, const char *a_hash_out_type){
     char * l_gdb_group_mempool = dap_chain_net_get_gdb_group_mempool(a_chain);
     if(!l_gdb_group_mempool){
@@ -3384,10 +3485,16 @@ int com_token_emit(int a_argc, char ** a_argv, void *a_arg_func, char ** a_str_r
     return 0;
 }
 
+
 /**
- * com_tx_cond_create command
- *
+ * @brief com_tx_cond_create
  * Create transaction
+ * com_tx_cond_create command
+ * @param a_argc 
+ * @param a_argv 
+ * @param a_arg_func 
+ * @param a_str_reply 
+ * @return int 
  */
 int com_tx_cond_create(int a_argc, char ** a_argv, void *a_arg_func, char **a_str_reply)
 {
@@ -3660,9 +3767,13 @@ int com_mempool_add_ca( int a_argc,  char ** a_argv, void *a_arg_func, char ** a
 
 
 /**
+ * @brief Create transaction
  * com_tx_create command
- *
- * Create transaction
+ * @param argc 
+ * @param argv 
+ * @param arg_func 
+ * @param str_reply 
+ * @return int 
  */
 int com_tx_create(int argc, char ** argv, void *arg_func, char **str_reply)
 {
@@ -3802,10 +3913,16 @@ int com_tx_create(int argc, char ** argv, void *arg_func, char **str_reply)
     return res;
 }
 
+
 /**
- * tx_verify command
- *
+ * @brief com_tx_verify
  * Verifing transaction
+ * tx_verify command
+ * @param argc 
+ * @param argv 
+ * @param arg_func 
+ * @param str_reply 
+ * @return int 
  */
 int com_tx_verify(int argc, char ** argv, void *arg_func, char **str_reply)
 {
@@ -3818,10 +3935,16 @@ int com_tx_verify(int argc, char ** argv, void *arg_func, char **str_reply)
     return -1;
 }
 
+
 /**
+ * @brief com_tx_history
  * tx_history command
- *
  * Transaction history for an address
+ * @param a_argc 
+ * @param a_argv 
+ * @param a_arg_func 
+ * @param a_str_reply 
+ * @return int 
  */
 int com_tx_history(int a_argc, char ** a_argv, void *a_arg_func, char **a_str_reply)
 {
@@ -3935,8 +4058,15 @@ int com_tx_history(int a_argc, char ** a_argv, void *a_arg_func, char **a_str_re
     return 0;
 }
 
+
 /**
- * stats command
+ * @brief stats command
+ * 
+ * @param argc 
+ * @param argv 
+ * @param arg_func 
+ * @param str_reply 
+ * @return int 
  */
 int com_stats(int argc, char ** argv, void *arg_func, char **str_reply)
 {
@@ -3987,6 +4117,15 @@ int com_stats(int argc, char ** argv, void *arg_func, char **str_reply)
     return 0;
 }
 
+/**
+ * @brief com_exit
+ * 
+ * @param argc 
+ * @param argv 
+ * @param arg_func 
+ * @param str_reply 
+ * @return int 
+ */
 int com_exit(int argc, char ** argv, void *arg_func, char **str_reply)
 {
     //dap_events_stop_all();
@@ -3996,10 +4135,13 @@ int com_exit(int argc, char ** argv, void *arg_func, char **str_reply)
 
 
 /**
- * print_log command
- *
- * Print log info
+ * @brief com_print_log Print log info
  * print_log [ts_after <timestamp >] [limit <line numbers>]
+ * @param argc 
+ * @param argv 
+ * @param arg_func 
+ * @param str_reply 
+ * @return int 
  */
 int com_print_log(int argc, char ** argv, void *arg_func, char **str_reply)
 {
diff --git a/modules/net/dap_chain_node_cli_cmd_tx.c b/modules/net/dap_chain_node_cli_cmd_tx.c
index c02c5c68c..8fc114dde 100644
--- a/modules/net/dap_chain_node_cli_cmd_tx.c
+++ b/modules/net/dap_chain_node_cli_cmd_tx.c
@@ -60,6 +60,13 @@ typedef struct dap_chain_tx_hash_processed_ht{
     dap_chain_hash_fast_t hash;
     UT_hash_handle hh;
 }dap_chain_tx_hash_processed_ht_t;
+
+
+/**
+ * @brief _dap_chain_tx_hash_processed_ht_free
+ * free l_current_hash->hash, l_current_hash, l_hash_processed
+ * @param l_hash_processed dap_chain_tx_hash_processed_ht_t
+ */
 void _dap_chain_tx_hash_processed_ht_free(dap_chain_tx_hash_processed_ht_t *l_hash_processed){
     dap_chain_tx_hash_processed_ht_t *l_tmp;
     dap_chain_tx_hash_processed_ht_t *l_current_hash;
@@ -70,6 +77,17 @@ void _dap_chain_tx_hash_processed_ht_free(dap_chain_tx_hash_processed_ht_t *l_ha
     DAP_FREE(l_hash_processed);
 }
 
+/**
+ * @brief _dap_chain_datum_tx_out_data
+ * 
+ * @param a_datum 
+ * @param a_ledger 
+ * @param a_str_out 
+ * @param a_hash_out_type 
+ * @param save_processed_tx 
+ * @param a_tx_hash_processed 
+ * @param l_tx_num 
+ */
 void _dap_chain_datum_tx_out_data(dap_chain_datum_tx_t *a_datum,
                                   dap_ledger_t *a_ledger,
                                   dap_string_t *a_str_out,
@@ -348,10 +366,16 @@ static dap_chain_datum_t* get_prev_tx(dap_tx_data_t *a_tx_data)
     return l_datum;
 }
 
+
 /**
+ * @brief dap_db_history_tx
  * Get data according the history log
  *
  * return history string
+ * @param a_tx_hash 
+ * @param a_chain 
+ * @param a_hash_out_type 
+ * @return char* 
  */
 char* dap_db_history_tx(dap_chain_hash_fast_t* a_tx_hash, dap_chain_t * a_chain, const char *a_hash_out_type)
 {
@@ -566,9 +590,14 @@ char* dap_db_history_tx(dap_chain_hash_fast_t* a_tx_hash, dap_chain_t * a_chain,
 }
 
 /**
+ * @brief dap_db_history_addr
  * Get data according the history log
  *
  * return history string
+ * @param a_addr 
+ * @param a_chain 
+ * @param a_hash_out_type 
+ * @return char* 
  */
 char* dap_db_history_addr(dap_chain_addr_t * a_addr, dap_chain_t * a_chain, const char *a_hash_out_type)
 {
@@ -952,6 +981,15 @@ char* dap_db_history_addr(dap_chain_addr_t * a_addr, dap_chain_t * a_chain, cons
     return l_ret_str;
 }
 
+/**
+ * @brief char* dap_db_history_token_list
+ * 
+ * @param a_chain 
+ * @param a_token_name 
+ * @param a_hash_out_type 
+ * @param a_token_num 
+ * @return char* 
+ */
 static char* dap_db_history_token_list(dap_chain_t * a_chain, const char *a_token_name, const char *a_hash_out_type, size_t *a_token_num)
 {
     dap_string_t *l_str_out = dap_string_new(NULL);
@@ -1053,10 +1091,22 @@ static char* dap_db_history_token_list(dap_chain_t * a_chain, const char *a_toke
     return l_ret_str;
 }
 
+
 /**
+ * @brief dap_db_history_filter
  * Get data according the history log
  *
  * return history string
+ * @param a_chain 
+ * @param a_ledger 
+ * @param a_filter_token_name 
+ * @param a_filtr_addr_base58 
+ * @param a_hash_out_type 
+ * @param a_datum_start 
+ * @param a_datum_end 
+ * @param a_total_datums 
+ * @param a_tx_hash_processed 
+ * @return char* 
  */
 static char* dap_db_history_filter(dap_chain_t * a_chain, dap_ledger_t *a_ledger, const char *a_filter_token_name, const char *a_filtr_addr_base58, const char *a_hash_out_type, long a_datum_start, long a_datum_end, long *a_total_datums, dap_chain_tx_hash_processed_ht_t *a_tx_hash_processed)
 {
@@ -1513,11 +1563,14 @@ static char* dap_db_history_filter(dap_chain_t * a_chain, dap_ledger_t *a_ledger
 }
 
 
-
-
 /**
+ * @brief com_ledger
  * ledger command
- *
+ * @param a_argc 
+ * @param a_argv 
+ * @param a_arg_func 
+ * @param a_str_reply 
+ * @return int 
  */
 int com_ledger(int a_argc, char ** a_argv, void *a_arg_func, char **a_str_reply)
 {
@@ -1740,9 +1793,15 @@ int com_ledger(int a_argc, char ** a_argv, void *a_arg_func, char **a_str_reply)
     return 0;
 }
 
+
 /**
+ * @brief com_token
  * token command
- *
+ * @param a_argc 
+ * @param a_argv 
+ * @param a_arg_func 
+ * @param a_str_reply 
+ * @return int 
  */
 int com_token(int a_argc, char ** a_argv, void *a_arg_func, char **a_str_reply)
 {
diff --git a/modules/net/dap_chain_node_client.c b/modules/net/dap_chain_node_client.c
index d7dba4dc7..92cea5bf3 100644
--- a/modules/net/dap_chain_node_client.c
+++ b/modules/net/dap_chain_node_client.c
@@ -178,6 +178,12 @@ static void s_stage_status_error_callback(dap_client_t *a_client, void *a_arg)
         l_node_client->callbacks.error(l_node_client, EINVAL,l_node_client->callbacks_arg );
 }
 
+/**
+ * @brief s_node_client_connected_synchro_start_callback
+ * 
+ * @param a_worker dap_worker_t
+ * @param a_arg void 
+ */
 static void s_node_client_connected_synchro_start_callback(dap_worker_t *a_worker, void *a_arg)
 {
     UNUSED(a_worker);
@@ -492,6 +498,13 @@ static void s_ch_chain_callback_notify_packet_out(dap_stream_ch_chain_t* a_ch_ch
     //}
 }
 
+/**
+ * @brief save_stat_to_database
+ * 
+ * @param a_request 
+ * @param a_node_client 
+ * @return int 
+ */
 static int save_stat_to_database(dap_stream_ch_chain_net_srv_pkt_test_t *a_request, dap_chain_node_client_t * a_node_client)
 {
     int l_ret = 0;
@@ -537,6 +550,7 @@ static int save_stat_to_database(dap_stream_ch_chain_net_srv_pkt_test_t *a_reque
     json_object_put(jobj);
     return l_ret;
 }
+
 /**
  * @brief s_ch_chain_callback_notify_packet_R - Callback for channel 'R'
  * @param a_ch_chain
@@ -570,12 +584,15 @@ static void s_ch_chain_callback_notify_packet_R(dap_stream_ch_chain_net_srv_t* a
     }
 }
 
+
 /**
+ * @brief dap_chain_node_client_connect_channels
  * Create connection to server
- *
- * return a connection handle, or NULL, if an error
+ * @param l_net 
+ * @param a_node_info 
+ * @param a_active_channels 
+ * @return dap_chain_node_client_t* return a connection handle, or NULL, if an error
  */
-
 dap_chain_node_client_t* dap_chain_node_client_connect_channels(dap_chain_net_t * l_net, dap_chain_node_info_t *a_node_info, const char *a_active_channels)
 {
     return dap_chain_net_client_create_n_connect_channels(l_net,a_node_info,a_active_channels);
@@ -630,7 +647,15 @@ dap_chain_node_client_t* dap_chain_node_client_create_n_connect(dap_chain_net_t
     return NULL;
 }
 
-// Create new dap_client, setup it, and send it in adventure trip
+
+/**
+ * @brief dap_chain_node_client_connect_internal
+ * Create new dap_client, setup it, and send it in adventure trip
+ * @param a_node_client dap_chain_node_client_t
+ * @param a_active_channels a_active_channels
+ * @return true 
+ * @return false 
+ */
 static bool dap_chain_node_client_connect_internal(dap_chain_node_client_t *a_node_client, const char *a_active_channels)
 {
     a_node_client->client = dap_client_new(a_node_client->events, s_stage_status_callback,
@@ -668,9 +693,11 @@ static bool dap_chain_node_client_connect_internal(dap_chain_node_client_t *a_no
 }
 
 /**
+ * @brief dap_chain_node_client_connect
  * Create connection to server
- *
- * return a connection handle, or NULL, if an error
+ * @param a_net 
+ * @param a_node_info 
+ * @return dap_chain_node_client_t* return a connection handle, or NULL, if an error
  */
 dap_chain_node_client_t* dap_chain_node_client_connect(dap_chain_net_t * a_net,dap_chain_node_info_t *a_node_info)
 {
@@ -678,7 +705,11 @@ dap_chain_node_client_t* dap_chain_node_client_connect(dap_chain_net_t * a_net,d
     return dap_chain_node_client_connect_channels(a_net,a_node_info, l_active_channels);
 }
 
-
+/**
+ * @brief dap_chain_node_client_reset
+ * 
+ * @param a_client dap_chain_node_client_t
+ */
 void dap_chain_node_client_reset(dap_chain_node_client_t *a_client)
 {
     if (a_client->state > NODE_CLIENT_STATE_ESTABLISHED) {
@@ -686,8 +717,11 @@ void dap_chain_node_client_reset(dap_chain_node_client_t *a_client)
     }
 }
 
+
 /**
+ * @brief dap_chain_node_client_close
  * Close connection to server, delete chain_node_client_t *client
+ * @param a_client dap_chain_node_client_t
  */
 void dap_chain_node_client_close(dap_chain_node_client_t *a_client)
 {
@@ -720,8 +754,16 @@ void dap_chain_node_client_close(dap_chain_node_client_t *a_client)
     }
 }
 
+
 /**
+ * @brief dap_chain_node_client_send_ch_pkt 
  * Send stream request to server
+ * @param a_client 
+ * @param a_ch_id 
+ * @param a_type 
+ * @param a_pkt_data 
+ * @param a_pkt_data_size 
+ * @return int 
  */
 int dap_chain_node_client_send_ch_pkt(dap_chain_node_client_t *a_client, uint8_t a_ch_id, uint8_t a_type,
         const void *a_pkt_data, size_t a_pkt_data_size)
@@ -734,12 +776,17 @@ int dap_chain_node_client_send_ch_pkt(dap_chain_node_client_t *a_client, uint8_t
     return 0;
 }
 
+
 /**
+ * @brief dap_chain_node_client_wait
  * wait for the complete of request
  *
  * timeout_ms timeout in milliseconds
  * waited_state state which we will wait, sample NODE_CLIENT_STATE_CONNECT or NODE_CLIENT_STATE_SENDED
- * return -2 false, -1 timeout, 0 end of connection or sending data
+ * @param a_client 
+ * @param a_waited_state 
+ * @param a_timeout_ms 
+ * @return int return -2 false, -1 timeout, 0 end of connection or sending data
  */
 int dap_chain_node_client_wait(dap_chain_node_client_t *a_client, int a_waited_state, int a_timeout_ms)
 {
@@ -815,6 +862,13 @@ int dap_chain_node_client_wait(dap_chain_node_client_t *a_client, int a_waited_s
     return ret;
 }
 
+/**
+ * @brief dap_chain_node_client_set_callbacks
+ * 
+ * @param a_client dap_client_t
+ * @param a_ch_id uint8_t
+ * @return int 
+ */
 int dap_chain_node_client_set_callbacks(dap_client_t *a_client, uint8_t a_ch_id)
 {
     int l_ret = -1;
@@ -866,8 +920,12 @@ static void nodelist_response_error_callback(dap_client_t *a_client, int a_err)
 {
 }*/
 
+
 /**
+ * @brief dap_chain_node_client_send_nodelist_req
  * Send nodelist request to server
+ * @param a_client 
+ * @return int 
  */
 int dap_chain_node_client_send_nodelist_req(dap_chain_node_client_t *a_client)
 {
-- 
GitLab


From bd342379abc54e91806429cbeaa4f179ba297d9a Mon Sep 17 00:00:00 2001
From: "cellframe.docs" <cellframe.docs@gmail.com>
Date: Mon, 4 Oct 2021 14:18:25 +0300
Subject: [PATCH 4/4] Update comments

---
 dap-sdk/core/src/dap_common.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/dap-sdk/core/src/dap_common.c b/dap-sdk/core/src/dap_common.c
index e685b3b8c..61f5159a1 100755
--- a/dap-sdk/core/src/dap_common.c
+++ b/dap-sdk/core/src/dap_common.c
@@ -217,11 +217,6 @@ void dap_set_log_tag_width(size_t a_width) {
     dap_snprintf(s_log_tag_fmt_str,sizeof (s_log_tag_fmt_str), "[%%%zds]\t",a_width);
 }
 
-/**
- * @brief dap_common_init initialise
- * @param[in] a_log_file
- * @return
- */
 
 /**
  * @brief dap_common_init call this function before using dap sdk modules
@@ -231,7 +226,6 @@ void dap_set_log_tag_width(size_t a_width) {
  * @param a_log_dirpath path to log directory. Saved in s_log_dir_path variable. For example. C:\\Users\\Public\\Documents/cellframe-node/var/log
  * @return int (0 if succcess, -1 if error)
  */
-
 int dap_common_init( const char *a_console_title, const char *a_log_file_path, const char *a_log_dirpath) {
 
     // init randomer
-- 
GitLab