What is the function of svc_name in the C function in rpc related projects, which is generally just a registration function. Is hash structure used here to facilitate searching?

  c++, question

clipboard.png

clipboard.png

searpc_server_register_function ("seafserv-threaded-rpcserver",
 seafile_check_passwd,
 "seafile_check_passwd",
 searpc_signature_int__string_string());
 searpc_server_register_function ("seafserv-threaded-rpcserver",
 seafile_set_passwd,
 "seafile_set_passwd",
 searpc_signature_int__string_string_string());
 searpc_server_register_function ("seafserv-threaded-rpcserver",
 seafile_unset_passwd,
 "seafile_unset_passwd",
 searpc_signature_int__string_string());
 searpc_server_register_function ("seafserv-rpcserver",
 seafile_is_passwd_set,
 "seafile_is_passwd_set",
 searpc_signature_int__string_string());
 searpc_server_register_function ("seafserv-rpcserver",
 seafile_get_decrypt_key,
 "seafile_get_decrypt_key",
 searpc_signature_object__string_string());
gboolean
 searpc_server_register_function (const char *svc_name,
 void *func, const gchar *fname, gchar *signature)
 {
 SearpcService *service;
 FuncItem *item;
 MarshalItem *mitem;
 
 g_assert (svc_name !  = NULL && func !  = NULL && fname !  = NULL && signature !  = NULL);
 
 service = g_hash_table_lookup (service_table, svc_name);
 if (!  service)
 return FALSE;
 
 mitem = g_hash_table_lookup (marshal_table, signature);
 if (!  mitem) {
 g_free (signature);
 return FALSE;
 }
 
 item = g_new0 (FuncItem, 1);
 item->marshal = mitem;
 item->fname = g_strdup(fname);
 item->func = func;
 
 g_hash_table_insert (service->func_table, (gpointer)item->fname, item);
 
 g_free (signature);
 return TRUE;
 }

C programs do not provide function pointers based on function names, while RPC structures need to find functions based on function names very much, so naturally a mapping is needed to combine function names with specific functions and related information, and Hash is just in line with the structure that stores these mappings.