From 90da65f8a15ba739970f33c8cd97b19be4d314ab Mon Sep 17 00:00:00 2001 From: rakshasa Date: Sun, 4 Apr 2010 04:44:45 +0000 Subject: [PATCH] * Cleanup of old command code. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1156 e378c898-3ddf-0310-93e7-cc216c733640 --- src/command_dynamic.cc | 6 +- src/command_helpers.h | 36 +-- src/main.cc | 398 +++++++++++++++++----------------- src/rpc/Makefile.am | 1 + src/rpc/command.h | 66 ++---- src/rpc/command_function.cc | 7 - src/rpc/command_function.h | 1 - src/rpc/command_map.cc | 96 ++++---- src/rpc/command_map.h | 23 +- src/rpc/command_variable.cc | 16 +- src/rpc/command_variable.h | 32 ++- src/rpc/xmlrpc.cc | 2 +- test/Makefile.am | 2 + test/rpc/command_map_test.cc | 6 +- test/rpc/command_slot_test.cc | 28 +-- 15 files changed, 334 insertions(+), 386 deletions(-) diff --git a/src/command_dynamic.cc b/src/command_dynamic.cc index 6b9ae012..20c960f1 100644 --- a/src/command_dynamic.cc +++ b/src/command_dynamic.cc @@ -119,8 +119,8 @@ system_method_insert(const torrent::Object::list_type& args) { options.find("string") != std::string::npos || options.find("list") != std::string::npos) { rpc::CommandVariable *command; - rpc::Command::cleaned_slot getSlot; - rpc::Command::cleaned_slot setSlot; + rpc::Command::any_slot getSlot; + rpc::Command::any_slot setSlot; if (options.find("value") != std::string::npos) { command = new rpc::CommandVariable(int64_t()); @@ -152,7 +152,7 @@ system_method_insert(const torrent::Object::list_type& args) { rpc::commands.insert_type(create_new_key<5>(rawKey, ".set"), command, setSlot, flags | rpc::CommandMap::flag_dont_delete, NULL, NULL); if (++itrArgs != args.end()) - (*setSlot)(command, NULL, *itrArgs); + (*setSlot)(command, rpc::make_target(), *itrArgs); } else { // THROW. diff --git a/src/command_helpers.h b/src/command_helpers.h index f7af8cdb..c0fd3a87 100644 --- a/src/command_helpers.h +++ b/src/command_helpers.h @@ -78,24 +78,24 @@ void initialize_commands(); #define CMD2_ANY_V(key, slot) CMD2_A_FUNCTION(key, command_base_call_list, object_convert_void(slot), "i:", "") #define CMD2_ANY_L(key, slot) CMD2_A_FUNCTION(key, command_base_call_list, slot, "A:", "") -#define CMD2_ANY_VALUE(key, slot) CMD2_A_FUNCTION(key, command_base_call_value, slot, "i:i", "") -#define CMD2_ANY_VALUE_V(key, slot) CMD2_A_FUNCTION(key, command_base_call_value, object_convert_void(slot), "i:i", "") +#define CMD2_ANY_VALUE(key, slot) CMD2_A_FUNCTION(key, command_base_call_value, slot, "i:i", "") +#define CMD2_ANY_VALUE_V(key, slot) CMD2_A_FUNCTION(key, command_base_call_value, object_convert_void(slot), "i:i", "") #define CMD2_ANY_STRING(key, slot) CMD2_A_FUNCTION(key, command_base_call_string, slot, "i:s", "") #define CMD2_ANY_STRING_V(key, slot) CMD2_A_FUNCTION(key, command_base_call_string, object_convert_void(slot), "i:s", "") -#define CMD2_ANY_LIST(key, slot) CMD2_A_FUNCTION(key, command_base_call_list, slot, "i:", "") +#define CMD2_ANY_LIST(key, slot) CMD2_A_FUNCTION(key, command_base_call_list, slot, "i:", "") -#define CMD2_DL(key, slot) CMD2_A_FUNCTION(key, command_base_call, slot, "i:", "") -#define CMD2_DL_V(key, slot) CMD2_A_FUNCTION(key, command_base_call, object_convert_void(slot), "i:", "") -#define CMD2_DL_VALUE(key, slot) CMD2_A_FUNCTION(key, command_base_call_value, slot, "i:", "") -#define CMD2_DL_VALUE_V(key, slot) CMD2_A_FUNCTION(key, command_base_call_value, object_convert_void(slot), "i:", "") -#define CMD2_DL_STRING(key, slot) CMD2_A_FUNCTION(key, command_base_call_string, slot, "i:", "") -#define CMD2_DL_STRING_V(key, slot) CMD2_A_FUNCTION(key, command_base_call_string, object_convert_void(slot), "i:", "") -#define CMD2_DL_LIST(key, slot) CMD2_A_FUNCTION(key, command_base_call_list, slot, "i:", "") +#define CMD2_DL(key, slot) CMD2_A_FUNCTION(key, command_base_call, slot, "i:", "") +#define CMD2_DL_V(key, slot) CMD2_A_FUNCTION(key, command_base_call, object_convert_void(slot), "i:", "") +#define CMD2_DL_VALUE(key, slot) CMD2_A_FUNCTION(key, command_base_call_value, slot, "i:", "") +#define CMD2_DL_VALUE_V(key, slot) CMD2_A_FUNCTION(key, command_base_call_value, object_convert_void(slot), "i:", "") +#define CMD2_DL_STRING(key, slot) CMD2_A_FUNCTION(key, command_base_call_string, slot, "i:", "") +#define CMD2_DL_STRING_V(key, slot) CMD2_A_FUNCTION(key, command_base_call_string, object_convert_void(slot), "i:", "") +#define CMD2_DL_LIST(key, slot) CMD2_A_FUNCTION(key, command_base_call_list, slot, "i:", "") -#define CMD2_DL_VALUE_P(key, slot) CMD2_A_FUNCTION_PRIVATE(key, command_base_call_value, slot, "i:", "") -#define CMD2_DL_STRING_P(key, slot) CMD2_A_FUNCTION_PRIVATE(key, command_base_call_string, slot, "i:", "") +#define CMD2_DL_VALUE_P(key, slot) CMD2_A_FUNCTION_PRIVATE(key, command_base_call_value, slot, "i:", "") +#define CMD2_DL_STRING_P(key, slot) CMD2_A_FUNCTION_PRIVATE(key, command_base_call_string, slot, "i:", "") #define CMD2_FILE(key, slot) CMD2_A_FUNCTION(key, command_base_call, slot, "i:", "") #define CMD2_FILE_V(key, slot) CMD2_A_FUNCTION(key, command_base_call, object_convert_void(slot), "i:", "") @@ -103,9 +103,9 @@ void initialize_commands(); #define CMD2_FILEITR(key, slot) CMD2_A_FUNCTION(key, command_base_call, slot, "i:", "") -#define CMD2_PEER(key, slot) CMD2_A_FUNCTION(key, command_base_call, slot, "i:", "") -#define CMD2_PEER_V(key, slot) CMD2_A_FUNCTION(key, command_base_call, object_convert_void(slot), "i:", "") -#define CMD2_PEER_VALUE_V(key, slot) CMD2_A_FUNCTION(key, command_base_call_value, object_convert_void(slot), "i:i", "") +#define CMD2_PEER(key, slot) CMD2_A_FUNCTION(key, command_base_call, slot, "i:", "") +#define CMD2_PEER_V(key, slot) CMD2_A_FUNCTION(key, command_base_call, object_convert_void(slot), "i:", "") +#define CMD2_PEER_VALUE_V(key, slot) CMD2_A_FUNCTION(key, command_base_call_value, object_convert_void(slot), "i:i", "") #define CMD2_TRACKER(key, slot) CMD2_A_FUNCTION(key, command_base_call, slot, "i:", "") #define CMD2_TRACKER_V(key, slot) CMD2_A_FUNCTION(key, command_base_call, object_convert_void(slot), "i:", "") @@ -124,6 +124,12 @@ void initialize_commands(); CMD2_ANY(key, std::tr1::bind(&rpc::command_function_call, torrent::raw_string::from_c_str(cmds), \ std::tr1::placeholders::_1, std::tr1::placeholders::_2)); +#define CMD2_REDIRECT(from_key, to_key) \ + rpc::commands.create_redirect(from_key, to_key, rpc::CommandMap::flag_public_xmlrpc); + +#define CMD2_REDIRECT_GENERIC(from_key, to_key) \ + rpc::commands.create_redirect(from_key, to_key, rpc::CommandMap::flag_public_xmlrpc | rpc::CommandMap::flag_no_target); + // // Conversion of return types: // diff --git a/src/main.cc b/src/main.cc index 57be7b67..fca56446 100644 --- a/src/main.cc +++ b/src/main.cc @@ -321,252 +321,258 @@ main(int argc, char** argv) { // * command_tracker.cc // * command_ui.cc - rpc::commands.create_redirect("system.method.insert", "method.insert", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("system.method.set", "method.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("system.method.set_key", "method.set_key", rpc::CommandMap::flag_public_xmlrpc); +#define CMD2_REDIRECT(from_key, to_key) \ + rpc::commands.create_redirect(from_key, to_key, rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("get_handshake_log", "log.handshake", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("set_handshake_log", "log.handshake.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("get_log.tracker", "log.tracker", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("set_log.tracker", "log.tracker.set", rpc::CommandMap::flag_public_xmlrpc); +#define CMD2_REDIRECT_GENERIC(from_key, to_key) \ + rpc::commands.create_redirect(from_key, to_key, rpc::CommandMap::flag_public_xmlrpc | rpc::CommandMap::flag_no_target); - rpc::commands.create_redirect("get_name", "system.session_name", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("set_name", "system.session_name.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("system.file_allocate", "system.file.allocate", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("system.file_allocate.set", "system.file.allocate.set", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("system.method.insert", "method.insert"); + CMD2_REDIRECT ("system.method.set", "method.set"); + CMD2_REDIRECT ("system.method.set_key", "method.set_key"); - rpc::commands.create_redirect("get_preload_type", "pieces.preload.type", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("get_preload_min_size", "pieces.preload.min_size", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("get_preload_required_rate", "pieces.preload.min_rate", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("set_preload_type", "pieces.preload.type.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("set_preload_min_size", "pieces.preload.min_size.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("set_preload_required_rate", "pieces.preload.min_rate.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("get_stats_preloaded", "pieces.stats_preloaded", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("get_stats_not_preloaded", "pieces.stats_not_preloaded", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("get_handshake_log", "log.handshake"); + CMD2_REDIRECT ("set_handshake_log", "log.handshake.set"); + CMD2_REDIRECT ("get_log.tracker", "log.tracker"); + CMD2_REDIRECT ("set_log.tracker", "log.tracker.set"); - rpc::commands.create_redirect("get_memory_usage", "pieces.memory.current", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("get_max_memory_usage", "pieces.memory.max", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("set_max_memory_usage", "pieces.memory.max.set", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("get_name", "system.session_name"); + CMD2_REDIRECT ("set_name", "system.session_name.set"); + CMD2_REDIRECT ("system.file_allocate", "system.file.allocate"); + CMD2_REDIRECT ("system.file_allocate.set", "system.file.allocate.set"); - rpc::commands.create_redirect("get_send_buffer_size", "network.send_buffer.size", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("set_send_buffer_size", "network.send_buffer.size.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("get_receive_buffer_size", "network.receive_buffer.size", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("set_receive_buffer_size", "network.receive_buffer.size.set", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("get_preload_type", "pieces.preload.type"); + CMD2_REDIRECT ("get_preload_min_size", "pieces.preload.min_size"); + CMD2_REDIRECT ("get_preload_required_rate", "pieces.preload.min_rate"); + CMD2_REDIRECT ("set_preload_type", "pieces.preload.type.set"); + CMD2_REDIRECT ("set_preload_min_size", "pieces.preload.min_size.set"); + CMD2_REDIRECT ("set_preload_required_rate", "pieces.preload.min_rate.set"); + CMD2_REDIRECT ("get_stats_preloaded", "pieces.stats_preloaded"); + CMD2_REDIRECT ("get_stats_not_preloaded", "pieces.stats_not_preloaded"); - rpc::commands.create_redirect("get_up_rate", "throttle.global_up.rate", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("get_up_total", "throttle.global_up.total", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("get_upload_rate", "throttle.global_up.max_rate", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("set_upload_rate", "throttle.global_up.max_rate.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("get_down_rate", "throttle.global_down.rate", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("get_down_total", "throttle.global_down.total", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("get_download_rate", "throttle.global_down.max_rate", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("set_download_rate", "throttle.global_down.max_rate.set", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("get_memory_usage", "pieces.memory.current"); + CMD2_REDIRECT ("get_max_memory_usage", "pieces.memory.max"); + CMD2_REDIRECT ("set_max_memory_usage", "pieces.memory.max.set"); - rpc::commands.create_redirect("bind", "network.bind_address.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("set_bind", "network.bind_address.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("get_bind", "network.bind_address", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("get_send_buffer_size", "network.send_buffer.size"); + CMD2_REDIRECT ("set_send_buffer_size", "network.send_buffer.size.set"); + CMD2_REDIRECT ("get_receive_buffer_size", "network.receive_buffer.size"); + CMD2_REDIRECT ("set_receive_buffer_size", "network.receive_buffer.size.set"); - rpc::commands.create_redirect("ip", "network.local_address.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("set_ip", "network.local_address.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("get_ip", "network.local_address", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("get_up_rate", "throttle.global_up.rate"); + CMD2_REDIRECT ("get_up_total", "throttle.global_up.total"); + CMD2_REDIRECT ("get_upload_rate", "throttle.global_up.max_rate"); + CMD2_REDIRECT ("set_upload_rate", "throttle.global_up.max_rate.set"); + CMD2_REDIRECT ("get_down_rate", "throttle.global_down.rate"); + CMD2_REDIRECT ("get_down_total", "throttle.global_down.total"); + CMD2_REDIRECT ("get_download_rate", "throttle.global_down.max_rate"); + CMD2_REDIRECT ("set_download_rate", "throttle.global_down.max_rate.set"); - rpc::commands.create_redirect("proxy_address", "network.proxy_address.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("set_proxy_address", "network.proxy_address.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("get_proxy_address", "network.proxy_address", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("bind", "network.bind_address.set"); + CMD2_REDIRECT ("set_bind", "network.bind_address.set"); + CMD2_REDIRECT ("get_bind", "network.bind_address"); - rpc::commands.create_redirect("scgi_port", "network.scgi.open_port", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("scgi_local", "network.scgi.open_local", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("ip", "network.local_address.set"); + CMD2_REDIRECT ("set_ip", "network.local_address.set"); + CMD2_REDIRECT ("get_ip", "network.local_address"); - rpc::commands.create_redirect("scgi_dont_route", "network.scgi.dont_route.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("set_scgi_dont_route", "network.scgi.dont_route.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("get_scgi_dont_route", "network.scgi.dont_route", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("proxy_address", "network.proxy_address.set"); + CMD2_REDIRECT ("set_proxy_address", "network.proxy_address.set"); + CMD2_REDIRECT ("get_proxy_address", "network.proxy_address"); - rpc::commands.create_redirect("xmlrpc_dialect", "network.xmlrpc.size_limit.set", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("scgi_port", "network.scgi.open_port"); + CMD2_REDIRECT ("scgi_local", "network.scgi.open_local"); - rpc::commands.create_redirect("get_connection_leech", "connection_leech", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("set_connection_leech", "connection_leech.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("get_connection_seed", "connection_seed", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("set_connection_seed", "connection_seed.set", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("scgi_dont_route", "network.scgi.dont_route.set"); + CMD2_REDIRECT ("set_scgi_dont_route", "network.scgi.dont_route.set"); + CMD2_REDIRECT ("get_scgi_dont_route", "network.scgi.dont_route"); - rpc::commands.create_redirect("dht", "dht.mode.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("dht_add_node", "dht.add_node", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("dht_statistics", "dht.statistics", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("get_dht_port", "dht.port", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("set_dht_port", "dht.port", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("get_dht_throttle", "dht.throttle.name", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("set_dht_throttle", "dht.throttle.name.set", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("xmlrpc_dialect", "network.xmlrpc.size_limit.set"); - rpc::commands.create_redirect("directory", "directory.default.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("get_directory", "directory.default", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("set_directory", "directory.default.set", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("get_connection_leech", "connection_leech"); + CMD2_REDIRECT ("set_connection_leech", "connection_leech.set"); + CMD2_REDIRECT ("get_connection_seed", "connection_seed"); + CMD2_REDIRECT ("set_connection_seed", "connection_seed.set"); + + CMD2_REDIRECT ("dht", "dht.mode.set"); + CMD2_REDIRECT ("dht_add_node", "dht.add_node"); + CMD2_REDIRECT ("dht_statistics", "dht.statistics"); + CMD2_REDIRECT ("get_dht_port", "dht.port"); + CMD2_REDIRECT ("set_dht_port", "dht.port"); + CMD2_REDIRECT ("get_dht_throttle", "dht.throttle.name"); + CMD2_REDIRECT ("set_dht_throttle", "dht.throttle.name.set"); + + CMD2_REDIRECT ("directory", "directory.default.set"); + CMD2_REDIRECT ("get_directory", "directory.default"); + CMD2_REDIRECT ("set_directory", "directory.default.set"); // // Download: // - rpc::commands.create_redirect("d.get_hash", "d.hash", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_local_id", "d.local_id", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_local_id_html", "d.local_id_html", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_bitfield", "d.bitfield", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_base_path", "d.base_path", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("d.get_hash", "d.hash"); + CMD2_REDIRECT ("d.get_local_id", "d.local_id"); + CMD2_REDIRECT ("d.get_local_id_html", "d.local_id_html"); + CMD2_REDIRECT ("d.get_bitfield", "d.bitfield"); + CMD2_REDIRECT ("d.get_base_path", "d.base_path"); - rpc::commands.create_redirect("d.get_name", "d.name", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_creation_date", "d.creation_date", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("d.get_name", "d.name"); + CMD2_REDIRECT ("d.get_creation_date", "d.creation_date"); - rpc::commands.create_redirect("d.get_peer_exchange", "d.peer_exchange", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("d.get_peer_exchange", "d.peer_exchange"); - rpc::commands.create_redirect("d.get_up_rate", "d.up.rate", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_up_total", "d.up.total", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_down_rate", "d.down.rate", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_down_total", "d.down.total", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_skip_rate", "d.skip.rate", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_skip_total", "d.skip.total", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("d.get_up_rate", "d.up.rate"); + CMD2_REDIRECT ("d.get_up_total", "d.up.total"); + CMD2_REDIRECT ("d.get_down_rate", "d.down.rate"); + CMD2_REDIRECT ("d.get_down_total", "d.down.total"); + CMD2_REDIRECT ("d.get_skip_rate", "d.skip.rate"); + CMD2_REDIRECT ("d.get_skip_total", "d.skip.total"); // - rpc::commands.create_redirect("d.get_bytes_done", "d.bytes_done", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_chunk_size", "d.chunk_size", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_chunks_hashed", "d.chunks_hashed", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_complete", "d.complete", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_completed_bytes", "d.completed_bytes", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_completed_chunks", "d.completed_chunks", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_connection_current", "d.connection_current", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_connection_leech", "d.connection_leech", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_connection_seed", "d.connection_seed", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_custom", "d.custom", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_custom1", "d.custom1", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_custom2", "d.custom2", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_custom3", "d.custom3", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_custom4", "d.custom4", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_custom5", "d.custom5", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_custom_throw", "d.custom_throw", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_directory", "d.directory", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_directory_base", "d.directory_base", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_free_diskspace", "d.free_diskspace", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_hashing", "d.hashing", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_hashing_failed", "d.hashing_failed", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_ignore_commands", "d.ignore_commands", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_left_bytes", "d.left_bytes", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_loaded_file", "d.loaded_file", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_max_file_size", "d.max_file_size", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_max_size_pex", "d.max_size_pex", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_message", "d.message", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_mode", "d.mode", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_peers_accounted", "d.peers_accounted", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_peers_complete", "d.peers_complete", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_peers_connected", "d.peers_connected", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_peers_max", "d.peers_max", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_peers_min", "d.peers_min", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_peers_not_connected", "d.peers_not_connected", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_priority", "d.priority", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_priority_str", "d.priority_str", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_ratio", "d.ratio", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_size_bytes", "d.size_bytes", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_size_chunks", "d.size_chunks", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_size_files", "d.size_files", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_size_pex", "d.size_pex", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_state", "d.state", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_state_changed", "d.state_changed", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_state_counter", "d.state_counter", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_throttle_name", "d.throttle_name", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_tied_to_file", "d.tied_to_file", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_tracker_focus", "d.tracker_focus", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_tracker_numwant", "d.tracker_numwant", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_tracker_size", "d.tracker_size", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.get_uploads_max", "d.uploads_max", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("d.get_bytes_done", "d.bytes_done"); + CMD2_REDIRECT ("d.get_chunk_size", "d.chunk_size"); + CMD2_REDIRECT ("d.get_chunks_hashed", "d.chunks_hashed"); + CMD2_REDIRECT ("d.get_complete", "d.complete"); + CMD2_REDIRECT ("d.get_completed_bytes", "d.completed_bytes"); + CMD2_REDIRECT ("d.get_completed_chunks", "d.completed_chunks"); + CMD2_REDIRECT ("d.get_connection_current", "d.connection_current"); + CMD2_REDIRECT ("d.get_connection_leech", "d.connection_leech"); + CMD2_REDIRECT ("d.get_connection_seed", "d.connection_seed"); + CMD2_REDIRECT ("d.get_custom", "d.custom"); + CMD2_REDIRECT ("d.get_custom1", "d.custom1"); + CMD2_REDIRECT ("d.get_custom2", "d.custom2"); + CMD2_REDIRECT ("d.get_custom3", "d.custom3"); + CMD2_REDIRECT ("d.get_custom4", "d.custom4"); + CMD2_REDIRECT ("d.get_custom5", "d.custom5"); + CMD2_REDIRECT ("d.get_custom_throw", "d.custom_throw"); + CMD2_REDIRECT ("d.get_directory", "d.directory"); + CMD2_REDIRECT ("d.get_directory_base", "d.directory_base"); + CMD2_REDIRECT ("d.get_free_diskspace", "d.free_diskspace"); + CMD2_REDIRECT ("d.get_hashing", "d.hashing"); + CMD2_REDIRECT ("d.get_hashing_failed", "d.hashing_failed"); + CMD2_REDIRECT ("d.get_ignore_commands", "d.ignore_commands"); + CMD2_REDIRECT ("d.get_left_bytes", "d.left_bytes"); + CMD2_REDIRECT ("d.get_loaded_file", "d.loaded_file"); + CMD2_REDIRECT ("d.get_max_file_size", "d.max_file_size"); + CMD2_REDIRECT ("d.get_max_size_pex", "d.max_size_pex"); + CMD2_REDIRECT ("d.get_message", "d.message"); + CMD2_REDIRECT ("d.get_mode", "d.mode"); + CMD2_REDIRECT ("d.get_peers_accounted", "d.peers_accounted"); + CMD2_REDIRECT ("d.get_peers_complete", "d.peers_complete"); + CMD2_REDIRECT ("d.get_peers_connected", "d.peers_connected"); + CMD2_REDIRECT ("d.get_peers_max", "d.peers_max"); + CMD2_REDIRECT ("d.get_peers_min", "d.peers_min"); + CMD2_REDIRECT ("d.get_peers_not_connected", "d.peers_not_connected"); + CMD2_REDIRECT ("d.get_priority", "d.priority"); + CMD2_REDIRECT ("d.get_priority_str", "d.priority_str"); + CMD2_REDIRECT ("d.get_ratio", "d.ratio"); + CMD2_REDIRECT ("d.get_size_bytes", "d.size_bytes"); + CMD2_REDIRECT ("d.get_size_chunks", "d.size_chunks"); + CMD2_REDIRECT ("d.get_size_files", "d.size_files"); + CMD2_REDIRECT ("d.get_size_pex", "d.size_pex"); + CMD2_REDIRECT ("d.get_state", "d.state"); + CMD2_REDIRECT ("d.get_state_changed", "d.state_changed"); + CMD2_REDIRECT ("d.get_state_counter", "d.state_counter"); + CMD2_REDIRECT ("d.get_throttle_name", "d.throttle_name"); + CMD2_REDIRECT ("d.get_tied_to_file", "d.tied_to_file"); + CMD2_REDIRECT ("d.get_tracker_focus", "d.tracker_focus"); + CMD2_REDIRECT ("d.get_tracker_numwant", "d.tracker_numwant"); + CMD2_REDIRECT ("d.get_tracker_size", "d.tracker_size"); + CMD2_REDIRECT ("d.get_uploads_max", "d.uploads_max"); - rpc::commands.create_redirect("d.set_connection_current", "d.connection_current.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.set_custom", "d.custom.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.set_custom1", "d.custom1.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.set_custom2", "d.custom2.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.set_custom3", "d.custom3.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.set_custom4", "d.custom4.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.set_custom5", "d.custom5.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.set_directory", "d.directory.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.set_directory_base", "d.directory_base.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.set_hashing_failed", "d.hashing_failed.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.set_ignore_commands", "d.ignore_commands.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.set_max_file_size", "d.max_file_size.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.set_message", "d.message.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.set_peers_max", "d.peers_max.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.set_peers_min", "d.peers_min.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.set_priority", "d.priority.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.set_throttle_name", "d.throttle_name.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.set_tied_to_file", "d.tied_to_file.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.set_tracker_numwant", "d.tracker_numwant.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("d.set_uploads_max", "d.uploads_max.set", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("d.set_connection_current", "d.connection_current.set"); + CMD2_REDIRECT ("d.set_custom", "d.custom.set"); + CMD2_REDIRECT ("d.set_custom1", "d.custom1.set"); + CMD2_REDIRECT ("d.set_custom2", "d.custom2.set"); + CMD2_REDIRECT ("d.set_custom3", "d.custom3.set"); + CMD2_REDIRECT ("d.set_custom4", "d.custom4.set"); + CMD2_REDIRECT ("d.set_custom5", "d.custom5.set"); + CMD2_REDIRECT ("d.set_directory", "d.directory.set"); + CMD2_REDIRECT ("d.set_directory_base", "d.directory_base.set"); + CMD2_REDIRECT ("d.set_hashing_failed", "d.hashing_failed.set"); + CMD2_REDIRECT ("d.set_ignore_commands", "d.ignore_commands.set"); + CMD2_REDIRECT ("d.set_max_file_size", "d.max_file_size.set"); + CMD2_REDIRECT ("d.set_message", "d.message.set"); + CMD2_REDIRECT ("d.set_peers_max", "d.peers_max.set"); + CMD2_REDIRECT ("d.set_peers_min", "d.peers_min.set"); + CMD2_REDIRECT ("d.set_priority", "d.priority.set"); + CMD2_REDIRECT ("d.set_throttle_name", "d.throttle_name.set"); + CMD2_REDIRECT ("d.set_tied_to_file", "d.tied_to_file.set"); + CMD2_REDIRECT ("d.set_tracker_numwant", "d.tracker_numwant.set"); + CMD2_REDIRECT ("d.set_uploads_max", "d.uploads_max.set"); // // Tracker: // - rpc::commands.create_redirect("t.get_group", "t.group", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("t.get_id", "t.id", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("t.get_min_interval", "t.min_interval", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("t.get_normal_interval", "t.normal_interval", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("t.get_scrape_complete", "t.scrape_complete", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("t.get_scrape_downloaded", "t.scrape_downloaded", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("t.get_scrape_incomplete", "t.scrape_incomplete", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("t.get_scrape_time_last", "t.scrape_time_last", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("t.get_type", "t.type", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("t.get_url", "t.url", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("t.get_group", "t.group"); + CMD2_REDIRECT ("t.get_id", "t.id"); + CMD2_REDIRECT ("t.get_min_interval", "t.min_interval"); + CMD2_REDIRECT ("t.get_normal_interval", "t.normal_interval"); + CMD2_REDIRECT ("t.get_scrape_complete", "t.scrape_complete"); + CMD2_REDIRECT ("t.get_scrape_downloaded", "t.scrape_downloaded"); + CMD2_REDIRECT ("t.get_scrape_incomplete", "t.scrape_incomplete"); + CMD2_REDIRECT ("t.get_scrape_time_last", "t.scrape_time_last"); + CMD2_REDIRECT ("t.get_type", "t.type"); + CMD2_REDIRECT ("t.get_url", "t.url"); // // Tracker: // - rpc::commands.create_redirect("f.get_completed_chunks", "f.completed_chunks", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("f.get_frozen_path", "f.frozen_path", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("f.get_last_touched", "f.last_touched", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("f.get_match_depth_next", "f.match_depth_next", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("f.get_match_depth_prev", "f.match_depth_prev", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("f.get_offset", "f.offset", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("f.get_path", "f.path", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("f.get_path_components", "f.path_components", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("f.get_path_depth", "f.path_depth", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("f.get_priority", "f.priority", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("f.get_range_first", "f.range_first", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("f.get_range_second", "f.range_second", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("f.get_size_bytes", "f.size_bytes", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("f.get_size_chunks", "f.size_chunks", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("f.set_priority", "f.priority.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("fi.get_filename_last", "fi.filename_last", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("f.get_completed_chunks", "f.completed_chunks"); + CMD2_REDIRECT ("f.get_frozen_path", "f.frozen_path"); + CMD2_REDIRECT ("f.get_last_touched", "f.last_touched"); + CMD2_REDIRECT ("f.get_match_depth_next", "f.match_depth_next"); + CMD2_REDIRECT ("f.get_match_depth_prev", "f.match_depth_prev"); + CMD2_REDIRECT ("f.get_offset", "f.offset"); + CMD2_REDIRECT ("f.get_path", "f.path"); + CMD2_REDIRECT ("f.get_path_components", "f.path_components"); + CMD2_REDIRECT ("f.get_path_depth", "f.path_depth"); + CMD2_REDIRECT ("f.get_priority", "f.priority"); + CMD2_REDIRECT ("f.get_range_first", "f.range_first"); + CMD2_REDIRECT ("f.get_range_second", "f.range_second"); + CMD2_REDIRECT ("f.get_size_bytes", "f.size_bytes"); + CMD2_REDIRECT ("f.get_size_chunks", "f.size_chunks"); + CMD2_REDIRECT ("f.set_priority", "f.priority.set"); + CMD2_REDIRECT ("fi.get_filename_last", "fi.filename_last"); // // Peer: // - rpc::commands.create_redirect("p.get_address", "p.address", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("p.get_client_version", "p.client_version", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("p.get_completed_percent", "p.completed_percent", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("p.get_down_rate", "p.down_rate", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("p.get_down_total", "p.down_total", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("p.get_id", "p.id", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("p.get_id_html", "p.id_html", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("p.get_options_str", "p.options_str", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("p.get_peer_rate", "p.peer_rate", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("p.get_peer_total", "p.peer_total", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("p.get_port", "p.port", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("p.get_up_rate", "p.up_rate", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("p.get_up_total", "p.up_total", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("p.get_address", "p.address"); + CMD2_REDIRECT ("p.get_client_version", "p.client_version"); + CMD2_REDIRECT ("p.get_completed_percent", "p.completed_percent"); + CMD2_REDIRECT ("p.get_down_rate", "p.down_rate"); + CMD2_REDIRECT ("p.get_down_total", "p.down_total"); + CMD2_REDIRECT ("p.get_id", "p.id"); + CMD2_REDIRECT ("p.get_id_html", "p.id_html"); + CMD2_REDIRECT ("p.get_options_str", "p.options_str"); + CMD2_REDIRECT ("p.get_peer_rate", "p.peer_rate"); + CMD2_REDIRECT ("p.get_peer_total", "p.peer_total"); + CMD2_REDIRECT ("p.get_port", "p.port"); + CMD2_REDIRECT ("p.get_up_rate", "p.up_rate"); + CMD2_REDIRECT ("p.get_up_total", "p.up_total"); // // View: // - rpc::commands.create_redirect("view_add", "view.add", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("view_filter", "view.filter", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("view_filter_on", "view.filter_on", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("view_list", "view.list", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("view_set", "view.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("view_sort", "view.sort", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("view_sort_current", "view.sort_current", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("view_sort_new", "view.sort_new", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("view_add", "view.add"); + CMD2_REDIRECT ("view_filter", "view.filter"); + CMD2_REDIRECT ("view_filter_on", "view.filter_on"); + CMD2_REDIRECT ("view_list", "view.list"); + CMD2_REDIRECT ("view_set", "view.set"); + CMD2_REDIRECT ("view_sort", "view.sort"); + CMD2_REDIRECT ("view_sort_current", "view.sort_current"); + CMD2_REDIRECT ("view_sort_new", "view.sort_new"); // Functions that might not get depracted as they are nice for // configuration files, and thus might do with just some // cleanup. - rpc::commands.create_redirect("upload_rate", "throttle.global_up.max_rate.set", rpc::CommandMap::flag_public_xmlrpc); - rpc::commands.create_redirect("download_rate", "throttle.global_down.max_rate.set", rpc::CommandMap::flag_public_xmlrpc); + CMD2_REDIRECT ("upload_rate", "throttle.global_up.max_rate.set"); + CMD2_REDIRECT ("download_rate", "throttle.global_down.max_rate.set"); } if (OptionParser::has_flag('n', argc, argv)) diff --git a/src/rpc/Makefile.am b/src/rpc/Makefile.am index dad377cb..d3818796 100644 --- a/src/rpc/Makefile.am +++ b/src/rpc/Makefile.am @@ -2,6 +2,7 @@ noinst_LIBRARIES = libsub_rpc.a libsub_rpc_a_SOURCES = \ command.h \ + command_impl.h \ command_function.cc \ command_function.h \ command_map.cc \ diff --git a/src/rpc/command.h b/src/rpc/command.h index 0740e7ed..8798c5af 100644 --- a/src/rpc/command.h +++ b/src/rpc/command.h @@ -34,8 +34,8 @@ // Skomakerveien 33 // 3185 Skoppum, NORWAY -#ifndef RTORRENT_RPC_VARIABLE_H -#define RTORRENT_RPC_VARIABLE_H +#ifndef RTORRENT_RPC_COMMAND_H +#define RTORRENT_RPC_COMMAND_H #include #include @@ -128,14 +128,30 @@ public: static const int target_download_pair = 7; + static const unsigned int max_arguments = 10; + + struct stack_type { + torrent::Object* begin() { return reinterpret_cast(buffer); } + torrent::Object* end() { return reinterpret_cast(buffer) + max_arguments; } + + static stack_type* from_data(char* data) { return reinterpret_cast(data); } + + char buffer[sizeof(torrent::Object) * max_arguments]; + }; + Command() {} virtual ~Command() {} - static torrent::Object* argument(unsigned int index) { return m_arguments + index; } - static torrent::Object& argument_ref(unsigned int index) { return *(m_arguments + index); } + static torrent::Object* argument(unsigned int index) { return m_arguments.begin() + index; } + static torrent::Object& argument_ref(unsigned int index) { return *(m_arguments.begin() + index); } - static const unsigned int max_arguments = 10; - static torrent::Object m_arguments[max_arguments]; + static stack_type m_arguments; + + static torrent::Object* stack_begin() { return m_arguments.begin(); } + static torrent::Object* stack_end() { return m_arguments.end(); } + + static torrent::Object* push_stack(const torrent::Object::list_type& args, torrent::Object* tmp_stack); + static void pop_stack(torrent::Object* first_stack, torrent::Object* last_stack); protected: Command(const Command&); @@ -151,54 +167,20 @@ struct target_type_id { // Nothing here, so we cause an error. }; -//template <> struct target_type_id { static const int value = Command::target_generic; }; -template <> struct target_type_id { static const int value = Command::target_generic; }; -template <> struct target_type_id { static const int value = Command::target_any; }; -template <> struct target_type_id { static const int value = Command::target_download; }; -template <> struct target_type_id { static const int value = Command::target_peer; }; -template <> struct target_type_id { static const int value = Command::target_tracker; }; -template <> struct target_type_id { static const int value = Command::target_file; }; -template <> struct target_type_id { static const int value = Command::target_file_itr; }; - -template <> struct target_type_id { static const int value = Command::target_download_pair; }; - -template <> struct target_type_id<> { static const int value = Command::target_generic; }; -template <> struct target_type_id { static const int value = Command::target_any; static const int proper_type = 1; }; -template <> struct target_type_id { static const int value = Command::target_download; static const int proper_type = 1; }; -template <> struct target_type_id { static const int value = Command::target_peer; static const int proper_type = 1; }; -template <> struct target_type_id { static const int value = Command::target_tracker; static const int proper_type = 1; }; -template <> struct target_type_id { static const int value = Command::target_file; static const int proper_type = 1; }; -template <> struct target_type_id { static const int value = Command::target_file_itr; static const int proper_type = 1; }; - -template <> struct target_type_id { static const int value = Command::target_download_pair; }; - template inline bool is_target_compatible(const target_type& target) { return target.first == target_type_id::value; } -template <> inline bool -is_target_compatible(const target_type& target) { return true; } -template <> inline bool -is_target_compatible(const target_type& target) { return target.first == Command::target_file || Command::target_file_itr; } - // Splitting pairs into separate targets. inline bool is_target_pair(const target_type& target) { return target.first >= Command::target_download_pair; } template inline T get_target_cast(target_type target, int type = target_type_id::value) { return (T)target.second; } -template <> inline target_type -get_target_cast(target_type target, int type) { return target; } - -template <> inline torrent::File* -get_target_cast(target_type target, int type) { - if (target.first == Command::target_file_itr) - return static_cast(target.second)->file(); - else - return static_cast(target.second); -} inline target_type get_target_left(const target_type& target) { return target_type(target.first - 5, target.second); } inline target_type get_target_right(const target_type& target) { return target_type(target.first - 5, target.third); } } +#include "command_impl.h" + #endif diff --git a/src/rpc/command_function.cc b/src/rpc/command_function.cc index cadb5670..743ee9d2 100644 --- a/src/rpc/command_function.cc +++ b/src/rpc/command_function.cc @@ -129,13 +129,6 @@ CommandFunction::call(Command* rawCommand, target_type target, const torrent::Ob } } -const torrent::Object -CommandFunction::call_redirect(Command* rawCommand, target_type target, const torrent::Object& args) { - CommandFunction* command = reinterpret_cast(rawCommand); - - return commands.call_command(command->m_command.c_str(), args, target); -} - const torrent::Object CommandFunctionList::call(Command* rawCommand, target_type target, const torrent::Object& args) { char* buffer[sizeof(torrent::Object) * Command::max_arguments]; diff --git a/src/rpc/command_function.h b/src/rpc/command_function.h index 878769df..117a0378 100644 --- a/src/rpc/command_function.h +++ b/src/rpc/command_function.h @@ -55,7 +55,6 @@ public: void set_command(const std::string& cmd) { m_command = cmd; } static const torrent::Object call(Command* rawCommand, target_type target, const torrent::Object& args); - static const torrent::Object call_redirect(Command* rawCommand, target_type target, const torrent::Object& args); private: // TODO: Replace with a delete-me flag and const char*. diff --git a/src/rpc/command_map.cc b/src/rpc/command_map.cc index bca72230..00a4c4a6 100644 --- a/src/rpc/command_map.cc +++ b/src/rpc/command_map.cc @@ -55,7 +55,7 @@ namespace rpc { -torrent::Object Command::m_arguments[Command::max_arguments]; +Command::stack_type Command::m_arguments; CommandMap::~CommandMap() { std::vector keys; @@ -95,8 +95,7 @@ CommandMap::insert(key_type key, const command_map_data_type src) { itr = base_type::insert(itr, value_type(key, command_map_data_type(src.m_variable, src.m_flags | flag_dont_delete, src.m_parm, src.m_doc))); // We can assume all the slots are the same size. - itr->second.m_target = src.m_target; - itr->second.m_genericSlot = src.m_genericSlot; + itr->second.m_anySlot = src.m_anySlot; } void @@ -144,8 +143,7 @@ CommandMap::create_redirect(key_type key_new, key_type key_dest, int flags) { dest_itr->second.m_doc))); // We can assume all the slots are the same size. - itr->second.m_target = dest_itr->second.m_target; - itr->second.m_genericSlot = dest_itr->second.m_genericSlot; + itr->second.m_anySlot = dest_itr->second.m_anySlot; } const CommandMap::mapped_type @@ -165,72 +163,54 @@ CommandMap::call_command(key_type key, const mapped_type& arg, target_type targe if (itr == base_type::end()) throw torrent::input_error("Command \"" + std::string(key) + "\" does not exist."); - if (target.first != Command::target_generic && target.second == NULL) { - // We received a target that is NULL, so throw an exception unless - // we can convert it to a void target. - if (itr->second.m_target > Command::target_any) - throw torrent::input_error("Command type mis-match."); +// if (target.first != Command::target_generic && target.second == NULL) { +// // We received a target that is NULL, so throw an exception unless +// // we can convert it to a void target. +// if (itr->second.m_target > Command::target_any) +// throw torrent::input_error("Command type mis-match."); - target.first = Command::target_generic; - } +// target.first = Command::target_generic; +// } - if (itr->second.m_target != target.first && itr->second.m_target > Command::target_any) { - // Mismatch between the target and command type. If it is not - // possible to convert, then throw an input error. - if (target.first == Command::target_file_itr && itr->second.m_target == Command::target_file) - target = target_type((int)Command::target_file, static_cast(target.second)->file()); - else - throw torrent::input_error("Command type mis-match."); - } +// if (itr->second.m_target != target.first && itr->second.m_target > Command::target_any) { +// // Mismatch between the target and command type. If it is not +// // possible to convert, then throw an input error. +// if (target.first == Command::target_file_itr && itr->second.m_target == Command::target_file) +// target = target_type((int)Command::target_file, static_cast(target.second)->file()); +// else +// throw torrent::input_error("Command type mis-match."); +// } // This _should_ be optimized int just two calls. - switch (itr->second.m_target) { - case Command::target_any: return itr->second.m_anySlot(itr->second.m_variable, target, arg); +// switch (itr->second.m_target) { +// case Command::target_any: return itr->second.m_anySlot(itr->second.m_variable, target, arg); +// default: throw torrent::internal_error("CommandMap::call_command(...) Invalid target."); +// } - case Command::target_generic: - case Command::target_download: - case Command::target_peer: - case Command::target_tracker: - case Command::target_file: - case Command::target_file_itr: return itr->second.m_genericSlot(itr->second.m_variable, (target_wrapper::cleaned_type)target.second, arg); - - // This should only allow target_type to be passed or something, in - // order to optimize this away. - case Command::target_download_pair: return itr->second.m_downloadPairSlot(itr->second.m_variable, (core::Download*)target.second, (core::Download*)target.third, arg); - - default: throw torrent::internal_error("CommandMap::call_command(...) Invalid target."); - } + return itr->second.m_anySlot(itr->second.m_variable, target, arg); } const CommandMap::mapped_type CommandMap::call_command(const_iterator itr, const mapped_type& arg, target_type target) { - if (target.first != Command::target_generic && target.second == NULL) { - // We received a target that is NULL, so throw an exception unless - // we can convert it to a void target. - if (itr->second.m_target > Command::target_any) - throw torrent::input_error("Command type mis-match."); +// if (target.first != Command::target_generic && target.second == NULL) { +// // We received a target that is NULL, so throw an exception unless +// // we can convert it to a void target. +// if (itr->second.m_target > Command::target_any) +// throw torrent::input_error("Command type mis-match."); - target.first = Command::target_generic; - } +// target.first = Command::target_generic; +// } - if (itr->second.m_target != target.first && itr->second.m_target > Command::target_any) - throw torrent::input_error("Command type mis-match."); +// if (itr->second.m_target != target.first && itr->second.m_target > Command::target_any) +// throw torrent::input_error("Command type mis-match."); - // This _should_ be optimized int just two calls. - switch (itr->second.m_target) { - case Command::target_any: return itr->second.m_anySlot(itr->second.m_variable, target, arg); +// // This _should_ be optimized int just two calls. +// switch (itr->second.m_target) { +// case Command::target_any: return itr->second.m_anySlot(itr->second.m_variable, target, arg); +// default: throw torrent::internal_error("CommandMap::call_command(...) Invalid target."); +// } - case Command::target_generic: - case Command::target_download: - case Command::target_peer: - case Command::target_tracker: - case Command::target_file: - case Command::target_file_itr: return itr->second.m_genericSlot(itr->second.m_variable, (target_wrapper::cleaned_type)target.second, arg); - - case Command::target_download_pair: return itr->second.m_downloadPairSlot(itr->second.m_variable, (core::Download*)target.second, (core::Download*)target.third, arg); - - default: throw torrent::internal_error("CommandMap::call_command(...) Invalid target."); - } + return itr->second.m_anySlot(itr->second.m_variable, target, arg); } } diff --git a/src/rpc/command_map.h b/src/rpc/command_map.h index aa4ff38a..7678d9fe 100644 --- a/src/rpc/command_map.h +++ b/src/rpc/command_map.h @@ -60,24 +60,10 @@ struct command_map_data_type { command_map_data_type(Command* variable, int flags, const char* parm, const char* doc) : m_variable(variable), m_flags(flags), m_parm(parm), m_doc(doc) {} - int target() const { return m_target; } - Command* m_variable; - - union { - Command::cleaned_slot m_genericSlot; - Command::any_slot m_anySlot; - Command::download_slot m_downloadSlot; - Command::file_slot m_fileSlot; - Command::file_itr_slot m_fileItrSlot; - Command::peer_slot m_peerSlot; - Command::tracker_slot m_trackerSlot; - - Command::download_pair_slot m_downloadPairSlot; - }; + Command::any_slot m_anySlot; int m_flags; - int m_target; const char* m_parm; const char* m_doc; @@ -118,12 +104,9 @@ public: iterator insert(key_type key, Command* variable, int flags, const char* parm, const char* doc); // Make this a wrapper call to insert without extra fluff. - template - void insert_type(key_type key, Command* variable, T targetSlot, int flags, const char* parm, const char* doc) { + void insert_type(key_type key, Command* variable, Command::any_slot targetSlot, int flags, const char* parm, const char* doc) { iterator itr = insert(key, variable, flags, parm, doc); - - itr->second.m_target = target_type_id::value; - itr->second.m_genericSlot = (Command::cleaned_slot)targetSlot; + itr->second.m_anySlot = targetSlot; } void insert(key_type key, const command_map_data_type src); diff --git a/src/rpc/command_variable.cc b/src/rpc/command_variable.cc index fb2e6647..24e73bd1 100644 --- a/src/rpc/command_variable.cc +++ b/src/rpc/command_variable.cc @@ -42,7 +42,7 @@ namespace rpc { const torrent::Object -CommandVariable::set_bool(Command* rawCommand, cleaned_type target, const torrent::Object& rawArgs) { +CommandVariable::set_bool(Command* rawCommand, target_type target, const torrent::Object& rawArgs) { CommandVariable* variable = static_cast(rawCommand); const torrent::Object& arg = convert_to_single_argument(rawArgs); @@ -73,14 +73,14 @@ CommandVariable::set_bool(Command* rawCommand, cleaned_type target, const torren } const torrent::Object -CommandVariable::get_bool(Command* rawCommand, cleaned_type target, const torrent::Object& args) { +CommandVariable::get_bool(Command* rawCommand, target_type target, const torrent::Object& args) { CommandVariable* variable = static_cast(rawCommand); return variable->m_variable; } const torrent::Object -CommandVariable::set_value(Command* rawCommand, cleaned_type target, const torrent::Object& rawArgs) { +CommandVariable::set_value(Command* rawCommand, target_type target, const torrent::Object& rawArgs) { CommandVariable* variable = static_cast(rawCommand); const torrent::Object& arg = convert_to_single_argument(rawArgs); @@ -109,14 +109,14 @@ CommandVariable::set_value(Command* rawCommand, cleaned_type target, const torre } const torrent::Object -CommandVariable::get_value(Command* rawCommand, cleaned_type target, const torrent::Object& args) { +CommandVariable::get_value(Command* rawCommand, target_type target, const torrent::Object& args) { CommandVariable* variable = static_cast(rawCommand); return variable->m_variable; } const torrent::Object -CommandVariable::set_string(Command* rawCommand, cleaned_type target, const torrent::Object& rawArgs) { +CommandVariable::set_string(Command* rawCommand, target_type target, const torrent::Object& rawArgs) { CommandVariable* variable = static_cast(rawCommand); const torrent::Object& arg = convert_to_single_argument(rawArgs); @@ -142,7 +142,7 @@ CommandVariable::set_string(Command* rawCommand, cleaned_type target, const torr } const torrent::Object -CommandVariable::get_string(Command* rawCommand, cleaned_type target, const torrent::Object& args) { +CommandVariable::get_string(Command* rawCommand, target_type target, const torrent::Object& args) { CommandVariable* variable = static_cast(rawCommand); return variable->m_variable; @@ -153,14 +153,14 @@ CommandVariable::get_string(Command* rawCommand, cleaned_type target, const torr // const torrent::Object -CommandObjectPtr::set_generic(Command* rawCommand, cleaned_type target, const torrent::Object& rawArgs) { +CommandObjectPtr::set_generic(Command* rawCommand, target_type target, const torrent::Object& rawArgs) { CommandObjectPtr* command = static_cast(rawCommand); return (*command->m_object = rawArgs); } const torrent::Object -CommandObjectPtr::get_generic(Command* rawCommand, cleaned_type target, const torrent::Object& args) { +CommandObjectPtr::get_generic(Command* rawCommand, target_type target, const torrent::Object& args) { CommandObjectPtr* command = static_cast(rawCommand); return *command->m_object; diff --git a/src/rpc/command_variable.h b/src/rpc/command_variable.h index 06f64b5f..1cc89908 100644 --- a/src/rpc/command_variable.h +++ b/src/rpc/command_variable.h @@ -48,21 +48,19 @@ namespace rpc { class CommandVariable : public Command { public: - typedef target_wrapper::cleaned_type cleaned_type; - CommandVariable(const torrent::Object& v = torrent::Object()) : m_variable(v) {} const torrent::Object variable() const { return m_variable; } void set_variable(const torrent::Object& var) { m_variable = var; } - static const torrent::Object set_bool(Command* rawCommand, cleaned_type target, const torrent::Object& args); - static const torrent::Object get_bool(Command* rawCommand, cleaned_type target, const torrent::Object& args); + static const torrent::Object set_bool(Command* rawCommand, target_type target, const torrent::Object& args); + static const torrent::Object get_bool(Command* rawCommand, target_type target, const torrent::Object& args); - static const torrent::Object set_value(Command* rawCommand, cleaned_type target, const torrent::Object& args); - static const torrent::Object get_value(Command* rawCommand, cleaned_type target, const torrent::Object& args); + static const torrent::Object set_value(Command* rawCommand, target_type target, const torrent::Object& args); + static const torrent::Object get_value(Command* rawCommand, target_type target, const torrent::Object& args); - static const torrent::Object set_string(Command* rawCommand, cleaned_type target, const torrent::Object& args); - static const torrent::Object get_string(Command* rawCommand, cleaned_type target, const torrent::Object& args); + static const torrent::Object set_string(Command* rawCommand, target_type target, const torrent::Object& args); + static const torrent::Object get_string(Command* rawCommand, target_type target, const torrent::Object& args); private: torrent::Object m_variable; @@ -70,24 +68,22 @@ private: class CommandObjectPtr : public Command { public: - typedef target_wrapper::cleaned_type cleaned_type; - CommandObjectPtr(torrent::Object* obj = NULL) : m_object(obj) {} const torrent::Object* object() const { return m_object; } void set_object(torrent::Object* obj) { m_object = obj; } - static const torrent::Object set_generic(Command* rawCommand, cleaned_type target, const torrent::Object& args); - static const torrent::Object get_generic(Command* rawCommand, cleaned_type target, const torrent::Object& args); + static const torrent::Object set_generic(Command* rawCommand, target_type target, const torrent::Object& args); + static const torrent::Object get_generic(Command* rawCommand, target_type target, const torrent::Object& args); -// static const torrent::Object set_bool(Command* rawCommand, cleaned_type target, const torrent::Object& args); -// static const torrent::Object get_bool(Command* rawCommand, cleaned_type target, const torrent::Object& args); +// static const torrent::Object set_bool(Command* rawCommand, target_type target, const torrent::Object& args); +// static const torrent::Object get_bool(Command* rawCommand, target_type target, const torrent::Object& args); -// static const torrent::Object set_value(Command* rawCommand, cleaned_type target, const torrent::Object& args); -// static const torrent::Object get_value(Command* rawCommand, cleaned_type target, const torrent::Object& args); +// static const torrent::Object set_value(Command* rawCommand, target_type target, const torrent::Object& args); +// static const torrent::Object get_value(Command* rawCommand, target_type target, const torrent::Object& args); -// static const torrent::Object set_string(Command* rawCommand, cleaned_type target, const torrent::Object& args); -// static const torrent::Object get_string(Command* rawCommand, cleaned_type target, const torrent::Object& args); +// static const torrent::Object set_string(Command* rawCommand, target_type target, const torrent::Object& args); +// static const torrent::Object get_string(Command* rawCommand, target_type target, const torrent::Object& args); private: torrent::Object* m_object; diff --git a/src/rpc/xmlrpc.cc b/src/rpc/xmlrpc.cc index 00adf9c2..824f1dcb 100644 --- a/src/rpc/xmlrpc.cc +++ b/src/rpc/xmlrpc.cc @@ -446,7 +446,7 @@ xmlrpc_call_command(xmlrpc_env* env, xmlrpc_value* args, void* voidServerInfo) { if (itr->second.m_flags & CommandMap::flag_no_target) xmlrpc_to_object(env, args, XmlRpc::call_generic, &target).swap(object); else - xmlrpc_to_object(env, args, itr->second.target(), &target).swap(object); + xmlrpc_to_object(env, args, XmlRpc::call_any, &target).swap(object); if (env->fault_occurred) return NULL; diff --git a/test/Makefile.am b/test/Makefile.am index e050d619..90da7231 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -10,6 +10,8 @@ rtorrentTest_LDADD = \ ../src/libsub_root.a rtorrentTest_SOURCES = \ + rpc/command_test.cc \ + rpc/command_test.h \ rpc/command_map_test.cc \ rpc/command_map_test.h \ rpc/command_slot_test.cc \ diff --git a/test/rpc/command_map_test.cc b/test/rpc/command_map_test.cc index 400b53fd..8ce2741e 100644 --- a/test/rpc/command_map_test.cc +++ b/test/rpc/command_map_test.cc @@ -9,9 +9,9 @@ CPPUNIT_TEST_SUITE_REGISTRATION(CommandMapTest); #undef CMD2_A_FUNCTION -#define CMD2_A_FUNCTION(key, function, func_type, slot, parm, doc) \ - commandNewSlotItr->set_function(slot); \ - m_map.insert_type(key, commandNewSlotItr++, &rpc::function, \ +#define CMD2_A_FUNCTION(key, function, slot, parm, doc) \ + m_commandItr->set_function::type>(slot); \ + m_map.insert_type(key, m_commandItr++, &rpc::function, \ rpc::CommandMap::flag_dont_delete | rpc::CommandMap::flag_public_xmlrpc, NULL, NULL); torrent::Object cmd_test_map_a(rpc::target_type t, const torrent::Object& obj) { return obj; } diff --git a/test/rpc/command_slot_test.cc b/test/rpc/command_slot_test.cc index a360ee4a..cb88df44 100644 --- a/test/rpc/command_slot_test.cc +++ b/test/rpc/command_slot_test.cc @@ -21,32 +21,32 @@ const std::string& cmd_test_convert_const_string(rpc::target_type t, const torre void CommandSlotTest::test_basics() { - rpc::command_base test_any; - test_any.set_function(&cmd_test_a); - CPPUNIT_ASSERT(rpc::command_base_call_any(&test_any, rpc::make_target(), (int64_t)1).as_value() == 1); +// rpc::command_base test_any; +// test_any.set_function(&cmd_test_a); +// CPPUNIT_ASSERT(rpc::command_base_call_any(&test_any, rpc::make_target(), (int64_t)1).as_value() == 1); - test_any.set_function(std::tr1::bind(&cmd_test_b, std::tr1::placeholders::_1, std::tr1::placeholders::_2, (uint64_t)2)); - CPPUNIT_ASSERT(rpc::command_base_call_any(&test_any, rpc::make_target(), (int64_t)1).as_value() == 2); +// test_any.set_function(std::tr1::bind(&cmd_test_b, std::tr1::placeholders::_1, std::tr1::placeholders::_2, (uint64_t)2)); +// CPPUNIT_ASSERT(rpc::command_base_call_any(&test_any, rpc::make_target(), (int64_t)1).as_value() == 2); - test_any.set_function(&cmd_test_list); - CPPUNIT_ASSERT(rpc::command_base_call_any_list(&test_any, rpc::make_target(), (int64_t)3).as_value() == 3); +// test_any.set_function(&cmd_test_list); +// CPPUNIT_ASSERT(rpc::command_base_call_any_list(&test_any, rpc::make_target(), (int64_t)3).as_value() == 3); } void CommandSlotTest::test_type_validity() { - CPPUNIT_ASSERT((rpc::command_base_is_type::value)); - CPPUNIT_ASSERT((rpc::command_base_is_type::value)); +// CPPUNIT_ASSERT((rpc::command_base_is_type::value)); +// CPPUNIT_ASSERT((rpc::command_base_is_type::value)); } void CommandSlotTest::test_convert_return() { - rpc::command_base test_any; +// rpc::command_base test_any; - test_any.set_function(&cmd_test_convert_string); - CPPUNIT_ASSERT(rpc::command_base_call_any(&test_any, rpc::make_target(), (int64_t)1).as_string() == "test_1"); +// test_any.set_function(&cmd_test_convert_string); +// CPPUNIT_ASSERT(rpc::command_base_call_any(&test_any, rpc::make_target(), (int64_t)1).as_string() == "test_1"); - test_any.set_function(&cmd_test_convert_const_string); - CPPUNIT_ASSERT(rpc::command_base_call_any(&test_any, rpc::make_target(), (int64_t)1).as_string() == "test_2"); +// test_any.set_function(&cmd_test_convert_const_string); +// CPPUNIT_ASSERT(rpc::command_base_call_any(&test_any, rpc::make_target(), (int64_t)1).as_string() == "test_2"); // test_any.set_function(object_convert_void(&cmd_test_convert_void)); // CPPUNIT_ASSERT(rpc::command_base_call_any(&test_any, rpc::make_target(), (int64_t)1).is_empty());