=================== ToolForExperiment =================== ToolForExperiment is a native mobile app that acts as a web server tool and performs actions based on commands received from clients via websocket protocol. The app has an interface from which you can start or stop the server, and when the server is started it continues to work even when the app is in the background and, if the system is restarted, the server restarts automatically. Once the permissions are given to ToolForExperiment, a websocket client can access device's system resources such as filesystem or DNS without any limitation. For security reasons, requests from clients must come from the same device on which the server service is running. Each command must return the result before timeout, otherwise a "command thread timeout" error is returned. Timeout default is 10000 ms. If a request command ID is unknown or some arguments are missing or for some other reasons the request can't be processed a response error message is sent back to client. Request package structure: ========================== Request packages have json format and nodes can change according to 'command_id', the latter node and 'args_size' one are common to each package. Example - The following request sends 'command_id' 200 that means "get name of all files in folder", has one argument that represents the path folder hence 'arg_size' is 1 and 'arg0' contains the string of the absolute folder's path: { command_id: 200, args_size: 1, arg0: "/storage/emulated/0/Personal_Files" } Response package structure: =========================== Response packages have json format and nodes can change according to 'command_id', the latter node and 'args_size' one are common to each package. Example - The following is the response to a request with 'command_id' equal to 200, 4 files have been found in folder and the 'arg_size' is 4 and each argument contains the name of one file: { command_id: 200, args_size: 4, arg0: "file1.ext", arg1: "file2.ext", arg2: "file3.ext", arg3: "file4.ext" } Commands in details: ==================== 100 - 199 General commands -------------------------- 100 ECHO_SERVER request: { command_id: 100, args_size: 1, arg0: } response: { command_id: 100, args_size: 1, arg0: } 200 - 299 Filesystem commands ----------------------------- 200 GET_NAME_OF_ALL_FILES_IN_FOLDER request: { command_id: 200, args_size: 1, arg0: } response: { command_id: 200, args_size: , arg0: , arg1: , ... arg: } 300 - 399 Network commands -------------------------- 300 RESOLVE_DNS_NAME request: { command_id: 300, args_size: 1, arg0: arg1: } response: { command_id: 300, args_size: 1, arg0: } 301 GET_DNS_RESOURCE_RECORDS request: { command_id: 301, args_size: <5 to 7>, arg0: , arg1: , arg2: , arg3: , arg4: , arg5: , arg6: } response: { command_id: 301, args_size: , arg0: , arg1: , ... arg: } 302 SET_DNS_RESOURCE_RECORD request: { command_id: 302, args_size: <7 to 8>, arg0 : , arg1 : , arg2 : , arg3 : , arg4 : , arg5 : , arg6 : , arg7 : } response: { command_id: 302, args_size: 0 } 303 DELETE_DNS_RESOURCE_RECORD request: { command_id: 303, args_size: <7 to 8>, arg0 : , arg1 : , arg2 : , arg3 : , arg4 : , arg5 : , arg6 : , arg7 : } response: { command_id: 303, args_size: 0 } Response error message package structure: ========================================= Response error messages have json format and are always made of three nodes as shown in the following example: { error_id: 90000, error_desc: "command_id unknown", exception } The 'exception' node could be empty if error hasn't been generated by exception List of error messages: ======================= 90000 - 90999 General errors -------------------------- 90000 COMMAND_ID_UNKNOWN - "command_id unknown" 90001 MISSING_JSON_NODE - "missing json node" 90002 GENERIC_PARSE_REQUEST_EXCEPTION - "generic parse request exception" 90003 ERRO_WHILE_READING_JSON_STRING - "error while reading json string" 90004 GENERIC_CREATE_JSON_RESPONSE_EXCEPTION - "generic create json response exception" 90005 REQUEST_INCONSISTENT_ARGUMENTS - "request inconsistent arguments" 90006 RESPONSE_INCONSISTENT_ARGUMENTS - "response inconsistent arguments" 90007 ERROR_WHILE_WRITING_JSON_STRING - "error while writing json string" 90008 COMMAND_THREAD_TIMEOUT - "command thread timeout" // Error for missing mandatory arguments 90009 REQUEST_MUST_HAVE_1_MANDATORY_ARGUMENT - "request must have 1 mandatory argument" }, 90010 REQUEST_MUST_HAVE_2_MANDATORY_ARGUMENTS - "request must have 2 mandatory arguments" }, 90011 REQUEST_MUST_HAVE_3_MANDATORY_ARGUMENTS - "request must have 3 mandatory arguments" }, 90012 REQUEST_MUST_HAVE_4_MANDATORY_ARGUMENTS - "request must have 4 mandatory arguments" }, 90013 REQUEST_MUST_HAVE_5_MANDATORY_ARGUMENTS - "request must have 5 mandatory arguments" }, 90014 REQUEST_MUST_HAVE_6_MANDATORY_ARGUMENTS - "request must have 6 mandatory arguments" }, 90015 REQUEST_MUST_HAVE_7_MANDATORY_ARGUMENTS - "request must have 7 mandatory arguments" }, 90016 REQUEST_MUST_HAVE_8_MANDATORY_ARGUMENTS - "request must have 8 mandatory arguments" }, 90017 REQUEST_MUST_HAVE_9_MANDATORY_ARGUMENTS - "request must have 9 mandatory arguments" }, 90018 REQUEST_MUST_HAVE_10_MANDATORY_ARGUMENTS - "request must have 10 mandatory arguments" }, 90019 REQUEST_MUST_HAVE_11_MANDATORY_ARGUMENTS - "request must have 11 mandatory arguments" }, 90020 REQUEST_MUST_HAVE_12_MANDATORY_ARGUMENTS - "request must have 12 mandatory arguments" }, 90021 REQUEST_MUST_HAVE_13_MANDATORY_ARGUMENTS - "request must have 13 mandatory arguments" }, 90022 REQUEST_MUST_HAVE_14_MANDATORY_ARGUMENTS - "request must have 14 mandatory arguments" }, 90023 REQUEST_MUST_HAVE_15_MANDATORY_ARGUMENTS - "request must have 15 mandatory arguments" }, 90024 REQUEST_MUST_HAVE_16_MANDATORY_ARGUMENTS - "request must have 16 mandatory arguments" }, 90025 REQUEST_MUST_HAVE_17_MANDATORY_ARGUMENTS - "request must have 17 mandatory arguments" }, 90026 REQUEST_MUST_HAVE_18_MANDATORY_ARGUMENTS - "request must have 18 mandatory arguments" }, 90027 REQUEST_MUST_HAVE_19_MANDATORY_ARGUMENTS - "request must have 19 mandatory arguments" }, 90028 REQUEST_MUST_HAVE_20_MANDATORY_ARGUMENTS - "request must have 20 mandatory arguments" }, 91000 - 91999 General commands errors ----------------------------------- 91000 GENERIC_GENERAL_COMMAND_ERROR "generic general command error" 92000 - 92999 Filesystem commands errors -------------------------------------- 92000 GENERIC_FILESYSTEM_COMMAND_ERROR - "generic filesystem command error" 92001 MISSING_PATH_ARGUMENT - "missing path argument" 93000 - 93999 Network commands erros ---------------------------------- 93000 GENERIC_NETWORK_COMMAND_ERROR - "generic network command error" 93001 TCP_ENDPOINTS_RESOLVER_ERROR - "TCP endpoints resolver error" 93002 MISSING_HOST_ARGUMENT - "missing host argument" 93003 DNS_TYPE_OF_RR_QUERY_NOT_IMPLEMENTED - "DNS query for this resourse record type not implemented" 93004 OPEN_SOCKET_EXCEPTION - "exception while opening socket" 93005 SET_RCV_SOCKET_TIMEOUT_EXCEPTION - "exception while setting receiver timeout" 93006 SOCKET_SEND_EXCEPTION - "exception while socket sending" 93007 SOCKET_RECEIVE_EXCEPTION - "exception while socket receiving" 93008 BOOST_SENDING_ERROR - "sending error: " 93009 BOOST_RECEIVING_ERROR - "receiving error: " 93010 BOOST_RECEIVE_EOF - "receiving error: end of file" 93011 QUERY_ID_NOT_MATCHING - "query id does not mach respose id" 93012 DNS_QUERY_RESPONSE_CODE_1 - "format error - The name server was unable to interpret the query" 93013 DNS_QUERY_RESPONSE_CODE_2 - "server failure - The name server was unable to process this query due to a problem with the name server" 93014 DNS_QUERY_RESPONSE_CODE_3 - "name Error - domain name referenced in the query does not exist" 93015 DNS_QUERY_RESPONSE_CODE_4 - "not Implemented - The name server does not support the requested kind of query" 93016 DNS_QUERY_RESPONSE_CODE_5 - "refused - The name server refuses to perform the specified operation for policy reasons" 93017 DNS_QUERY_RESPONSE_CODE_UNKNOWN - "unknown DNS query response code" 93018 DNS_UPDATE_RESPONSE_CODE_FORMERR - "the name server was unable to interpret the request due to a format error." 93019 DNS_UPDATE_RESPONSE_CODE_SERVFAIL - "the name server encountered an internal failure while processing this request, for example an operating system error or a forwarding timeout." 93020 DNS_UPDATE_RESPONSE_CODE_NXDOMAIN - "some name that ought to exist, does not exist." 93021 DNS_UPDATE_RESPONSE_CODE_NOTIMP - "the name server does not support the specified Opcode." 93022 DNS_UPDATE_RESPONSE_CODE_REFUSED - "the name server refuses to perform the specified operation for policy or security reasons." 93023 DNS_UPDATE_RESPONSE_CODE_YXDOMAIN - "some name that ought not to exist, does exist." 93024 DNS_UPDATE_RESPONSE_CODE_YXRRSET - "some RRset that ought not to exist, does exist." 93025 DNS_UPDATE_RESPONSE_CODE_NXRRSET - "some RRset that ought to exist, does not exist." 93026 DNS_UPDATE_RESPONSE_CODE_NOTAUTH - "the server is not authoritative for the zone named in the Zone Section." 93027 DNS_UPDATE_RESPONSE_CODE_NOTZONE - "a name used in the Prerequisite or Update Section is not within the zone denoted by the Zone Section." 93028 DNS_UPDATE_RESPONSE_CODE_UNKNOWN - "unknown DNS update response code" 93029 DNS_TYPE_OF_RR_UPDATE_NOT_IMPLEMENTED - "DNS update for this resourse record type not implemented" 93030 WRONG_DNS_RR_DATA_FORMAT - "DNS resourse record data has wrong format"