@@ -80,91 +80,91 @@ typedef struct mjrpc_handle
8080/* --- For client --- */
8181
8282/**
83- * @brief build a jsonrpc string request
84- * @param method name of method
85- * @param params parameters for the method
86- * @param id request id, can be NULL for notification
87- * @return string pointer
83+ * @brief Build a jsonrpc string request
84+ * @param method Name of method
85+ * @param params Parameters for the method, will be released (free)
86+ * @param id Request id, can be NULL for notification, will be released (free)
87+ * @return String pointer (free this after use), if return NULL, id and params will also be released (free)
8888 */
8989char * mjrpc_request_str (const char * method , cJSON * params , cJSON * id );
9090
9191/**
92- * @brief build a jsonrpc cjson request
93- * @param method name of method
94- * @param params parameters for the method
95- * @param id request id, can be NULL for notification
96- * @return cjson pointer
92+ * @brief Build a jsonrpc cjson request
93+ * @param method Name of method
94+ * @param params Parameters for the method, will be owned by the request
95+ * @param id Request id, can be NULL for notification, will be owned by the request
96+ * @return cJSON pointer (delete this after use), if return NULL, id and params will be released (free)
9797 */
9898cJSON * mjrpc_request_cjson (const char * method , cJSON * params , cJSON * id );
9999
100100
101101/* --- For server --- */
102102
103103/**
104- * @brief build a jsonrpc response with result
105- * @param result call result
106- * @param id client request id
107- * @return cjson pointer
104+ * @brief Build a jsonrpc response with result
105+ * @param result Result of the method
106+ * @param id Client request id
107+ * @return cJSON pointer
108108 */
109109cJSON * mjrpc_response_ok (cJSON * result , cJSON * id );
110110
111111/**
112- * @brief build a jsonrpc response with error
113- * @param code error code
114- * @param message error message
115- * @param id client request id
116- * @return cjson pointer
112+ * @brief Build a jsonrpc response with error
113+ * @param code Error code
114+ * @param message Error message
115+ * @param id Client request id
116+ * @return cJSON pointer
117117 */
118118cJSON * mjrpc_response_error (int code , char * message , cJSON * id );
119119
120120/**
121- * @brief allocate a mjsonrpc handle
122- * @param initial_capacity initial capacity of builtin hash table, 0 means use default capacity
123- * @return pointer of mjrpc handle (destroy the handle after use)
121+ * @brief Allocate a mjsonrpc handle
122+ * @param initial_capacity Initial capacity of builtin hash table, 0 means use default capacity
123+ * @return Pointer of mjrpc handle (destroy the handle after use)
124124 */
125125mjrpc_handle_t * mjrpc_create_handle (size_t initial_capacity );
126126
127127/**
128- * @brief destroy (free) a handle
129- * @param handle handle to be free
128+ * @brief Destroy (free) a handle
129+ * @param handle Handle to be free
130130 * @return enum mjrpc_error_return
131131 */
132132int mjrpc_destroy_handle (mjrpc_handle_t * handle );
133133
134134/**
135- * @brief add a method to jsonrpc handle
135+ * @brief Add a method to jsonrpc handle
136136 * @param handle mjrpc handle
137- * @param function_pointer callback function
138- * @param method_name method name
139- * @param arg2func argument to callback function
137+ * @param function_pointer Callback function
138+ * @param method_name Method name
139+ * @param arg2func Argument to callback function
140140 * @return enum mjrpc_error_return
141141 */
142142int mjrpc_add_method (mjrpc_handle_t * handle , mjrpc_func function_pointer , const char * method_name ,
143143 void * arg2func );
144144
145145/**
146- * @brief delete a method from jsonrpc handle
146+ * @brief Delete a method from jsonrpc handle
147147 * @param handle mjrpc handle
148- * @param method_name method name if NULL, delete all methods
148+ * @param method_name Method name to be deleted
149149 * @return enum mjrpc_error_return
150150 */
151151int mjrpc_del_method (mjrpc_handle_t * handle , const char * method_name );
152152
153153/**
154- * @brief process a string typed jsonrpc request
154+ * @brief Process a string typed jsonrpc request
155155 * @param handle mjrpc handle
156- * @param reqeust_str request string
157- * @param ret_code return code
158- * @return response string (need to be free)
156+ * @param reqeust_str Request string
157+ * @param ret_code Return code
158+ * @return Response string (need to be free)
159159 */
160160char * mjrpc_process_str (mjrpc_handle_t * handle , const char * reqeust_str , int * ret_code );
161161
162162/**
163- * @brief process a cjson typed jsonrpc request
163+ * @brief Process a cjson typed jsonrpc request
164164 * @param handle mjrpc handle
165- * @param request_cjson request cjson
166- * @param ret_code return code
167- * @return response cjson pointer (need to be free)
165+ * @param request_cjson Request cjson
166+ * @param ret_code Return code
167+ * @return Response cjson pointer (need to be free)
168168 */
169169cJSON * mjrpc_process_cjson (mjrpc_handle_t * handle , const cJSON * request_cjson , int * ret_code );
170170
0 commit comments