From 8d236a109bbd0f69e3291653eb71d04e50968c85 Mon Sep 17 00:00:00 2001 From: Jonathan Hollocombe Date: Tue, 13 Feb 2024 17:02:04 +0000 Subject: [PATCH] Changing client-server function names to snake case. --- source/authentication/udaServerSSL.cpp | 8 +- source/c_api/accAPI.cpp | 16 +- source/c_api/clientAPI.cpp | 4 +- source/c_api/clientMDS.cpp | 4 +- source/c_api/udaGetAPI.cpp | 16 +- source/c_api/udaPutAPI.cpp | 12 +- source/cache/cache.cpp | 2 +- source/client/connection.cpp | 20 +-- source/client/makeClientRequestBlock.cpp | 16 +- source/client/udaClient.cpp | 46 +++--- source/client2/client.cpp | 58 +++---- source/client2/handle.cpp | 2 +- source/client2/make_request_block.cpp | 6 +- source/clientserver/allocData.cpp | 2 +- source/clientserver/errorLog.cpp | 4 +- source/clientserver/expand_path.cpp | 62 ++++---- source/clientserver/expand_path.h | 16 +- source/clientserver/initStructs.cpp | 36 ++--- source/clientserver/initStructs.h | 30 ++-- source/clientserver/makeRequestBlock.cpp | 126 +++++++-------- source/clientserver/makeRequestBlock.h | 4 +- source/clientserver/manageSockets.cpp | 18 +-- source/clientserver/manageSockets.h | 12 +- source/clientserver/nameValueSubstitution.cpp | 14 +- source/clientserver/parseOperation.cpp | 2 +- source/clientserver/parseOperation.h | 2 +- source/clientserver/parseXML.cpp | 46 +++--- source/clientserver/parseXML.h | 18 +-- source/clientserver/printStructs.cpp | 26 +-- source/clientserver/printStructs.h | 22 +-- source/clientserver/protocol.cpp | 30 ++-- source/clientserver/protocol.h | 4 +- source/clientserver/protocol2.cpp | 48 +++--- source/clientserver/protocolXML.cpp | 24 +-- source/clientserver/protocolXML.h | 2 +- source/clientserver/protocolXML2.cpp | 36 ++--- source/clientserver/protocolXML2.h | 6 +- source/clientserver/protocolXML2Put.cpp | 54 +++---- source/clientserver/protocolXML2Put.h | 8 +- source/clientserver/readXDRFile.cpp | 4 +- source/clientserver/readXDRFile.h | 4 +- source/clientserver/stringUtils.cpp | 48 +++--- source/clientserver/stringUtils.h | 44 ++--- source/clientserver/udaStructs.cpp | 6 +- source/clientserver/userid.cpp | 6 +- source/clientserver/userid.h | 2 +- source/clientserver/xdrlib.cpp | 150 +++++++++--------- source/clientserver/xdrlib.h | 8 +- source/include/uda/legacy.h | 4 +- source/logging/accessLog.cpp | 8 +- source/plugins/hdf5/readHDF58.cpp | 4 +- source/plugins/testplugin/testplugin.cpp | 2 +- source/plugins/uda/uda_plugin.cpp | 8 +- source/plugins/udaPlugin.cpp | 34 ++-- source/security/clientAuthentication.cpp | 2 +- source/security/serverAuthentication.cpp | 2 +- source/security/x509Utils.cpp | 4 +- source/server/applyXML.cpp | 14 +- source/server/closeServerSockets.cpp | 2 +- source/server/fatServer.cpp | 44 ++--- source/server/initPluginList.cpp | 36 ++--- source/server/makeServerRequestBlock.cpp | 2 +- source/server/serverGetData.cpp | 128 +++++++-------- source/server/serverLegacyPlugin.cpp | 62 ++++---- source/server/serverPlugin.cpp | 34 ++-- source/server/serverSubsetData.cpp | 54 +++---- source/server/udaLegacyServer.cpp | 54 +++---- source/server/udaServer.cpp | 62 ++++---- source/server/writer.cpp | 8 +- source/server2/apply_XML.cpp | 14 +- source/server2/get_data.cpp | 126 +++++++-------- source/server2/make_server_request_block.cpp | 2 +- source/server2/server.cpp | 54 +++---- source/server2/server_plugin.cpp | 32 ++-- source/server2/server_subset_data.cpp | 60 +++---- source/server2/xdr_protocol.cpp | 12 +- source/structures/parseIncludeFile.cpp | 74 ++++----- source/structures/struct.cpp | 28 ++-- source/structures/xdrUserDefinedData.cpp | 32 ++-- source/wrappers/c++/client.cpp | 8 +- source/wrappers/fortran/accAPI_F.c | 52 +++--- source/wrappers/idl/idam_dlm.c | 8 +- test/testSecurity.c | 4 +- 83 files changed, 1104 insertions(+), 1104 deletions(-) diff --git a/source/authentication/udaServerSSL.cpp b/source/authentication/udaServerSSL.cpp index 6fbed8fb..01b6e682 100644 --- a/source/authentication/udaServerSSL.cpp +++ b/source/authentication/udaServerSSL.cpp @@ -422,7 +422,7 @@ int uda::authentication::writeUdaServerSSL(void* iohandle, const char* buf, int // Block till it's possible to write to the socket or timeout - setSelectParms(g_sslSocket, &wfds, &tv, io_data->server_tot_block_time); + set_select_params(g_sslSocket, &wfds, &tv, io_data->server_tot_block_time); while ((rc = select(g_sslSocket + 1, nullptr, &wfds, nullptr, &tv)) <= 0) { @@ -453,7 +453,7 @@ int uda::authentication::writeUdaServerSSL(void* iohandle, const char* buf, int return -1; // Timeout } - updateSelectParms(g_sslSocket, &wfds, &tv, *io_data->server_tot_block_time); + update_select_params(g_sslSocket, &wfds, &tv, *io_data->server_tot_block_time); } // set SSL_MODE_AUTO_RETRY flag of the SSL_CTX_set_mode to disable automatic renegotiation? @@ -497,7 +497,7 @@ int uda::authentication::readUdaServerSSL(void* iohandle, char* buf, int count) // Set the blocking period before a timeout auto io_data = reinterpret_cast(iohandle); - setSelectParms(g_sslSocket, &rfds, &tv, io_data->server_tot_block_time); + set_select_params(g_sslSocket, &rfds, &tv, io_data->server_tot_block_time); tvc = tv; // TODO: Use pselect to include a signal mask to force a timeout @@ -531,7 +531,7 @@ int uda::authentication::readUdaServerSSL(void* iohandle, char* buf, int count) } # endif - updateSelectParms(g_sslSocket, &rfds, &tv, *io_data->server_tot_block_time); // Keep blocking and wait for data + update_select_params(g_sslSocket, &rfds, &tv, *io_data->server_tot_block_time); // Keep blocking and wait for data tvc = tv; } diff --git a/source/c_api/accAPI.cpp b/source/c_api/accAPI.cpp index 8f103b5f..8116cc4a 100644 --- a/source/c_api/accAPI.cpp +++ b/source/c_api/accAPI.cpp @@ -209,13 +209,13 @@ void udaSetProperty(const char* property) if (property[0] == 't') { strncpy(name, property, 55); name[55] = '\0'; - TrimString(name); - LeftTrimString(name); - MidTrimString(name); + trim_string(name); + left_trim_string(name); + mid_trim_string(name); strlwr(name); if ((value = strstr(name, "timeout=")) != nullptr) { value = name + 8; - if (IsNumber(value)) { + if (is_number(value)) { client_flags->user_timeout = atoi(value); } } @@ -232,13 +232,13 @@ void udaSetProperty(const char* property) if (!strncasecmp(property, "altRank", 7)) { strncpy(name, property, 55); name[55] = '\0'; - TrimString(name); - LeftTrimString(name); - MidTrimString(name); + trim_string(name); + left_trim_string(name); + mid_trim_string(name); strlwr(name); if ((value = strcasestr(name, "altRank=")) != nullptr) { value = name + 8; - if (IsNumber(value)) { + if (is_number(value)) { client_flags->alt_rank = atoi(value); } } diff --git a/source/c_api/clientAPI.cpp b/source/c_api/clientAPI.cpp index be3082e9..fc62e0ed 100644 --- a/source/c_api/clientAPI.cpp +++ b/source/c_api/clientAPI.cpp @@ -36,7 +36,7 @@ int udaClientAPI(const char* file, const char* signal, int pass, int exp_number) //------------------------------------------------------------------------- // Initialise the Client Data Request Structure - initRequestBlock(&request_block); + init_request_block(&request_block); //------------------------------------------------------------------------------ // Build the Request Data Block (Version and API dependent) @@ -110,7 +110,7 @@ int udaClientFileAPI(const char* file, const char* signal, const char* format) //------------------------------------------------------------------------- // Initialise the Client Data Request Structure - initRequestBlock(&request_block); + init_request_block(&request_block); //------------------------------------------------------------------------------ // Build the Request Data Block (Version and API dependent) diff --git a/source/c_api/clientMDS.cpp b/source/c_api/clientMDS.cpp index 1d6381be..5209fa24 100644 --- a/source/c_api/clientMDS.cpp +++ b/source/c_api/clientMDS.cpp @@ -33,12 +33,12 @@ int udaClientMDS(const char* server, const char* tree, const char* node, int tre // Passed Args REQUEST_BLOCK request_block; - initRequestBlock(&request_block); + init_request_block(&request_block); request_block.num_requests = 1; request_block.requests = (REQUEST_DATA*)malloc(sizeof(REQUEST_DATA)); auto request = &request_block.requests[0]; - initRequestData(request); + init_request_data(request); request->request = REQUEST_READ_MDS; request->exp_number = treenum; diff --git a/source/c_api/udaGetAPI.cpp b/source/c_api/udaGetAPI.cpp index cd19cd70..752c9682 100644 --- a/source/c_api/udaGetAPI.cpp +++ b/source/c_api/udaGetAPI.cpp @@ -126,8 +126,8 @@ void udaLockThread() idamState[i].socket = -1; idamState[i].lastHandle = -1; // initEnvironment(&(idamState[i].environment)); - initClientBlock(&(idamState[i].client_block), 0, ""); - initServerBlock(&(idamState[i].server_block), 0); + init_client_block(&(idamState[i].client_block), 0, ""); + init_server_block(&(idamState[i].server_block), 0); threadList[i] = 0; // and the thread identifiers } } @@ -206,8 +206,8 @@ void udaFreeThread() idamState[threadCount].socket = -1; idamState[threadCount].lastHandle = -1; // initEnvironment(&(idamState[threadCount].environment)); - initClientBlock(&(idamState[threadCount].client_block), 0, ""); - initServerBlock(&(idamState[threadCount].server_block), 0); + init_client_block(&(idamState[threadCount].client_block), 0, ""); + init_server_block(&(idamState[threadCount].server_block), 0); threadList[threadCount] = 0; } udaUnlockThread(); @@ -392,7 +392,7 @@ int udaGetAPIWithHost(const char* data_object, const char* data_source, const ch // Initialise the Client Data Request Structure REQUEST_BLOCK request_block; - initRequestBlock(&request_block); + init_request_block(&request_block); //------------------------------------------------------------------------------ // Build the Request Data Block (Version and API dependent) @@ -411,7 +411,7 @@ int udaGetAPIWithHost(const char* data_object, const char* data_source, const ch return -err; } - printRequestBlock(request_block); + print_request_block(request_block); //------------------------------------------------------------------------- // Fetch Data @@ -506,7 +506,7 @@ int udaGetBatchAPIWithHost(const char** signals, const char** sources, int count // Initialise the Client Data Request Structure REQUEST_BLOCK request_block; - initRequestBlock(&request_block); + init_request_block(&request_block); //------------------------------------------------------------------------------ // Build the Request Data Block (Version and API dependent) @@ -526,7 +526,7 @@ int udaGetBatchAPIWithHost(const char** signals, const char** sources, int count } UDA_LOG(UDA_LOG_DEBUG, "Routine: udaGetBatchAPI\n"); - printRequestBlock(request_block); + print_request_block(request_block); //------------------------------------------------------------------------- // Fetch Data diff --git a/source/c_api/udaPutAPI.cpp b/source/c_api/udaPutAPI.cpp index 389a703a..bf0eaf32 100644 --- a/source/c_api/udaPutAPI.cpp +++ b/source/c_api/udaPutAPI.cpp @@ -49,7 +49,7 @@ int udaPutListAPI(const char* putInstruction, PUTDATA_BLOCK_LIST* inPutDataBlock putDataBlockList = (PutDataBlockList*)inPutDataBlockList; } else { putDataBlockList = &emptyPutDataBlockList; - initPutDataBlockList(putDataBlockList); + init_put_data_block_list(putDataBlockList); } //------------------------------------------------------------------------- @@ -76,7 +76,7 @@ int udaPutListAPI(const char* putInstruction, PUTDATA_BLOCK_LIST* inPutDataBlock //------------------------------------------------------------------------- // Initialise the Client Data Request Structure - initRequestBlock(&request_block); + init_request_block(&request_block); //------------------------------------------------------------------------------ // Build the Request Data Block (Version and API dependent) @@ -91,7 +91,7 @@ int udaPutListAPI(const char* putInstruction, PUTDATA_BLOCK_LIST* inPutDataBlock return -err; } - printRequestBlock(request_block); + print_request_block(request_block); //------------------------------------------------------------------------- // Pass an empty structure rather than nullptr @@ -127,7 +127,7 @@ int udaPutAPI(const char* putInstruction, PUTDATA_BLOCK* inPutData) putData = (PutDataBlock*)inPutData; } else { putData = &emptyPutDataBlock; - initPutDataBlock(putData); + init_put_data_block(putData); } //------------------------------------------------------------------------- @@ -155,7 +155,7 @@ int udaPutAPI(const char* putInstruction, PUTDATA_BLOCK* inPutData) //------------------------------------------------------------------------- // Initialise the Client Data Request Structure - initRequestBlock(&request_block); + init_request_block(&request_block); //------------------------------------------------------------------------------ // Build the Request Data Block (Version and API dependent) @@ -170,7 +170,7 @@ int udaPutAPI(const char* putInstruction, PUTDATA_BLOCK* inPutData) return -err; } - printRequestBlock(request_block); + print_request_block(request_block); //------------------------------------------------------------------------- // Data to Put to the server diff --git a/source/cache/cache.cpp b/source/cache/cache.cpp index 6a7a081c..371b23ed 100644 --- a/source/cache/cache.cpp +++ b/source/cache/cache.cpp @@ -31,7 +31,7 @@ DATA_BLOCK* readCacheData(FILE* fp, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYP xdrstdio_create(&xdrs, fp, XDR_DECODE); DATA_BLOCK_LIST data_block_list; - initDataBlockList(&data_block_list); + init_data_block_list(&data_block_list); int token; protocol2(&xdrs, UDA_PROTOCOL_DATA_BLOCK_LIST, XDR_RECEIVE, &token, logmalloclist, userdefinedtypelist, diff --git a/source/client/connection.cpp b/source/client/connection.cpp index 927d683b..b9e3ceda 100644 --- a/source/client/connection.cpp +++ b/source/client/connection.cpp @@ -89,7 +89,7 @@ int uda::client::reconnect(ENVIRONMENT* environment, XDR** client_input, XDR** c // Identify the current Socket connection in the Socket List - int socketId = getSocketRecordId(&client_socketlist, client_socket); + int socketId = get_socket_record_id(&client_socketlist, client_socket); // Instance a new server if the Client has changed the host and/or port number @@ -97,7 +97,7 @@ int uda::client::reconnect(ENVIRONMENT* environment, XDR** client_input, XDR** c // RC int status; int fh; - if (getSocket(&client_socketlist, TYPE_UDA_SERVER, &status, environment->server_host, environment->server_port, + if (get_socket(&client_socketlist, TYPE_UDA_SERVER, &status, environment->server_host, environment->server_port, &fh) == 0) { environment->server_socket = fh; environment->server_change_socket = 1; @@ -112,7 +112,7 @@ int uda::client::reconnect(ENVIRONMENT* environment, XDR** client_input, XDR** c if (environment->server_change_socket) { int newsocketId; - if ((newsocketId = getSocketRecordId(&client_socketlist, environment->server_socket)) < 0) { + if ((newsocketId = get_socket_record_id(&client_socketlist, environment->server_socket)) < 0) { err = NO_SOCKET_CONNECTION; add_error(UDA_CODE_ERROR_TYPE, __func__, err, "The User Specified Socket Connection does not exist"); return err; @@ -554,12 +554,12 @@ int uda::client::createConnection(XDR* client_input, XDR* client_output, time_t* } // Add New Socket to the Socket's List - addSocket(&client_socketlist, TYPE_UDA_SERVER, 1, environment->server_host, environment->server_port, + add_socket(&client_socketlist, TYPE_UDA_SERVER, 1, environment->server_host, environment->server_port, client_socket); - client_socketlist.sockets[getSocketRecordId(&client_socketlist, client_socket)].Input = client_input; - client_socketlist.sockets[getSocketRecordId(&client_socketlist, client_socket)].Output = client_output; - client_socketlist.sockets[getSocketRecordId(&client_socketlist, client_socket)].user_timeout = user_timeout; - client_socketlist.sockets[getSocketRecordId(&client_socketlist, client_socket)].tv_server_start = *tv_server_start; + client_socketlist.sockets[get_socket_record_id(&client_socketlist, client_socket)].Input = client_input; + client_socketlist.sockets[get_socket_record_id(&client_socketlist, client_socket)].Output = client_output; + client_socketlist.sockets[get_socket_record_id(&client_socketlist, client_socket)].user_timeout = user_timeout; + client_socketlist.sockets[get_socket_record_id(&client_socketlist, client_socket)].tv_server_start = *tv_server_start; environment->server_reconnect = 0; environment->server_change_socket = 0; environment->server_socket = client_socket; @@ -581,9 +581,9 @@ void udaCloseAllConnections() void uda::client::closeConnection(ClosedownType type) { if (client_socket >= 0 && type != ClosedownType::CLOSE_ALL) { - closeClientSocket(&client_socketlist, client_socket); + close_client_socket(&client_socketlist, client_socket); } else { - closeClientSockets(&client_socketlist); + close_client_sockets(&client_socketlist); } client_socket = -1; diff --git a/source/client/makeClientRequestBlock.cpp b/source/client/makeClientRequestBlock.cpp index 72692840..72dfca5c 100644 --- a/source/client/makeClientRequestBlock.cpp +++ b/source/client/makeClientRequestBlock.cpp @@ -34,7 +34,7 @@ Interprets the API arguments and assembles a Request data structure. using namespace uda::client_server; using namespace uda::client; -int makeRequestData(const char* data_object, const char* data_source, REQUEST_DATA* request) +int make_request_data(const char* data_object, const char* data_source, REQUEST_DATA* request) { //------------------------------------------------------------------------------------------------------------------ //! Test Input Arguments comply with string length limits, then copy to the request structure without modification @@ -126,14 +126,14 @@ int makeRequestData(const char* data_object, const char* data_source, REQUEST_DA if (strchr(request->source, '(') == nullptr && strchr(request->source, ')') == nullptr) { // source is not a function call strcpy(request->path, request->source); - expandFilePath(request->path, getIdamClientEnvironment()); + expand_file_path(request->path, getIdamClientEnvironment()); } } else { if (strchr(test, '(') == nullptr && strchr(test, ')') == nullptr) { // Prefixed and not a function call int ldelim = (int)strlen(request->api_delim); strcpy(request->path, &test[ldelim]); - expandFilePath(request->path, getIdamClientEnvironment()); + expand_file_path(request->path, getIdamClientEnvironment()); } } @@ -149,8 +149,8 @@ int uda::client::makeClientRequestBlock(const char** signals, const char** sourc int err = 0; for (int i = 0; i < count; ++i) { REQUEST_DATA* request = &request_block->requests[i]; - initRequestData(request); - if ((err = makeRequestData(signals[i], sources[i], request))) { + init_request_data(request); + if ((err = make_request_data(signals[i], sources[i], request))) { return err; } } @@ -162,7 +162,7 @@ void uda::client::freeClientRequestBlock(REQUEST_BLOCK* request_block) { if (request_block != nullptr && request_block->requests != nullptr) { for (int i = 0; i < request_block->num_requests; i++) { - freeNameValueList(&request_block->requests[i].nameValueList); + free_name_value_list(&request_block->requests[i].nameValueList); freeClientPutDataBlockList(&request_block->requests[i].putDataBlockList); } free(request_block->requests); @@ -190,14 +190,14 @@ int shotRequestTest(const char* source) // pulse plasma shot number - an integer // pulse/pass include a pass or sequence number - this may be a text based component, e.g. LATEST - if (IsNumber((char*)source)) { + if (is_number((char*)source)) { return 1; // The source an integer number } strcpy(work, source); if ((token = strtok(work, "/")) != nullptr) { // Tokenise the remaining string - if (IsNumber(token)) { + if (is_number(token)) { return 1; // Is the First token an integer number? } } diff --git a/source/client/udaClient.cpp b/source/client/udaClient.cpp index e34d5a99..7f39eb39 100644 --- a/source/client/udaClient.cpp +++ b/source/client/udaClient.cpp @@ -118,7 +118,7 @@ int growDataBlocks() } data_blocks.push_back({}); - initDataBlock(&data_blocks.back()); + init_data_block(&data_blocks.back()); data_blocks.back().handle = data_blocks.size() - 1; udaPutThreadLastHandle(data_blocks.size() - 1); @@ -147,7 +147,7 @@ int getNewDataHandle() udaFree(newHandleIndex); } else { // Application has responsibility for freeing heap in the Data Block - initDataBlock(&data_blocks[newHandleIndex]); + init_data_block(&data_blocks[newHandleIndex]); } data_blocks[newHandleIndex].handle = newHandleIndex; return newHandleIndex; @@ -156,10 +156,10 @@ int getNewDataHandle() if ((newHandleIndex = findNewHandleIndex()) < 0) { // Search for an unused handle or issue a new one newHandleIndex = data_blocks.size(); data_blocks.push_back({}); - initDataBlock(&data_blocks[newHandleIndex]); + init_data_block(&data_blocks[newHandleIndex]); data_blocks[newHandleIndex].handle = newHandleIndex; } else { - initDataBlock(&data_blocks[newHandleIndex]); + init_data_block(&data_blocks[newHandleIndex]); data_blocks[newHandleIndex].handle = newHandleIndex; } @@ -186,7 +186,7 @@ int newDataHandle() udaFree(newHandleIndex); } else { // Application has responsibility for freeing heap in the Data Block - initDataBlock(&data_blocks[newHandleIndex]); + init_data_block(&data_blocks[newHandleIndex]); } data_blocks[newHandleIndex].handle = newHandleIndex; return newHandleIndex; @@ -195,10 +195,10 @@ int newDataHandle() if ((newHandleIndex = findNewHandleIndex()) < 0) { // Search for an unused handle or issue a new one newHandleIndex = data_blocks.size(); data_blocks.push_back({}); - initDataBlock(&data_blocks[newHandleIndex]); + init_data_block(&data_blocks[newHandleIndex]); data_blocks[newHandleIndex].handle = newHandleIndex; } else { - initDataBlock(&data_blocks[newHandleIndex]); + init_data_block(&data_blocks[newHandleIndex]); data_blocks[newHandleIndex].handle = newHandleIndex; } @@ -313,7 +313,7 @@ void copyDataBlock(DATA_BLOCK* str, DATA_BLOCK* in) memcpy(str->data_label, in->data_label, STRING_LENGTH); memcpy(str->data_desc, in->data_desc, STRING_LENGTH); memcpy(str->error_msg, in->error_msg, STRING_LENGTH); - initClientBlock(&str->client_block, 0, ""); + init_client_block(&str->client_block, 0, ""); } void copyClientBlock(CLIENT_BLOCK* str, const CLIENT_FLAGS* client_flags) @@ -418,7 +418,7 @@ static int fetchMeta(XDR* client_input, DATA_SYSTEM* data_system, SYSTEM_CONFIG* add_error(UDA_CODE_ERROR_TYPE, __func__, err, "Protocol 4 Error (Data System)"); return err; } - printDataSystem(*data_system); + print_data_system(*data_system); if ((err = protocol2(client_input, UDA_PROTOCOL_SYSTEM_CONFIG, XDR_RECEIVE, nullptr, g_log_malloc_list, g_user_defined_type_list, system_config, protocol_version, log_struct_list, private_flags, @@ -426,7 +426,7 @@ static int fetchMeta(XDR* client_input, DATA_SYSTEM* data_system, SYSTEM_CONFIG* add_error(UDA_CODE_ERROR_TYPE, __func__, err, "Protocol 5 Error (System Config)"); return err; } - printSystemConfig(*system_config); + print_system_config(*system_config); if ((err = protocol2(client_input, UDA_PROTOCOL_DATA_SOURCE, XDR_RECEIVE, nullptr, g_log_malloc_list, g_user_defined_type_list, data_source, protocol_version, log_struct_list, private_flags, @@ -434,7 +434,7 @@ static int fetchMeta(XDR* client_input, DATA_SYSTEM* data_system, SYSTEM_CONFIG* add_error(UDA_CODE_ERROR_TYPE, __func__, err, "Protocol 6 Error (Data Source)"); return err; } - printDataSource(*data_source); + print_data_source(*data_source); if ((err = protocol2(client_input, UDA_PROTOCOL_SIGNAL, XDR_RECEIVE, nullptr, g_log_malloc_list, g_user_defined_type_list, signal_rec, protocol_version, log_struct_list, private_flags, @@ -442,7 +442,7 @@ static int fetchMeta(XDR* client_input, DATA_SYSTEM* data_system, SYSTEM_CONFIG* add_error(UDA_CODE_ERROR_TYPE, __func__, err, "Protocol 7 Error (Signal)"); return err; } - printSignal(*signal_rec); + print_signal(*signal_rec); if ((err = protocol2(client_input, UDA_PROTOCOL_SIGNAL_DESC, XDR_RECEIVE, nullptr, g_log_malloc_list, g_user_defined_type_list, signal_desc, protocol_version, log_struct_list, private_flags, @@ -450,7 +450,7 @@ static int fetchMeta(XDR* client_input, DATA_SYSTEM* data_system, SYSTEM_CONFIG* add_error(UDA_CODE_ERROR_TYPE, __func__, err, "Protocol 8 Error (Signal Desc)"); return err; } - printSignalDesc(*signal_desc); + print_signal_desc(*signal_desc); #endif return err; @@ -527,7 +527,7 @@ int uda::client::idamClient(REQUEST_BLOCK* request_block, int* indices) free_error_stack(&server_block.idamerrorstack); // Free Previous Stack Heap } - initServerBlock(&server_block, 0); // Reset previous Error Messages from the Server & Free Heap + init_server_block(&server_block, 0); // Reset previous Error Messages from the Server & Free Heap init_error_stack(); //------------------------------------------------------------------------- @@ -684,8 +684,8 @@ int uda::client::idamClient(REQUEST_BLOCK* request_block, int* indices) // Initialise the Client/Server Structures if (initServer && system_startup) { - userid(client_username); - initClientBlock(&client_block, client_version, client_username); + user_id(client_username); + init_client_block(&client_block, client_version, client_username); system_startup = false; // Don't call again! } @@ -713,7 +713,7 @@ int uda::client::idamClient(REQUEST_BLOCK* request_block, int* indices) strcpy(client_block.DOI, env); } - printClientBlock(client_block); + print_client_block(client_block); //------------------------------------------------------------------------------ // User Authentication at startup @@ -849,7 +849,7 @@ int uda::client::idamClient(REQUEST_BLOCK* request_block, int* indices) UDA_LOG(UDA_LOG_DEBUG, "Server Block Received\n"); UDA_LOG(UDA_LOG_DEBUG, "xdrrec_eof rc = %d [1 => no more input]\n", rc); - printServerBlock(server_block); + print_server_block(server_block); // Protocol Version: Lower of the client and server version numbers // This defines the set of elements within data structures passed between client and server @@ -998,7 +998,7 @@ int uda::client::idamClient(REQUEST_BLOCK* request_block, int* indices) } UDA_LOG(UDA_LOG_DEBUG, "Server Block Received\n"); - printServerBlock(server_block); + print_server_block(server_block); serverside = 0; @@ -1050,7 +1050,7 @@ int uda::client::idamClient(REQUEST_BLOCK* request_block, int* indices) // Flush (mark as at EOF) the input socket buffer (All regular Data has been received) - printDataBlockList(recv_data_block_list); + print_data_block_list(recv_data_block_list); for (int i = 0; i < request_block->num_requests; ++i) { //------------------------------------------------------------------------------ @@ -1124,7 +1124,7 @@ int uda::client::idamClient(REQUEST_BLOCK* request_block, int* indices) // Fat Client Server DATA_BLOCK_LIST data_block_list0; - initDataBlockList(&data_block_list0); + init_data_block_list(&data_block_list0); err = uda::server::fat_server(client_block, &server_block, request_block, &data_block_list0); for (int i = 0; i < data_block_list0.count; ++i) { @@ -1150,7 +1150,7 @@ int uda::client::idamClient(REQUEST_BLOCK* request_block, int* indices) err = 0; // Need to Test for Error Condition! } - printDataBlock(*data_block); + print_data_block(*data_block); } #endif // <========================== End of FatClient Code Only @@ -1537,7 +1537,7 @@ void udaFree(int handle) // closeIdamError(&server_block.idamerrorstack); free_error_stack(&server_block.idamerrorstack); - initDataBlock(data_block); + init_data_block(data_block); data_block->handle = -1; // Flag this as ready for re-use } diff --git a/source/client2/client.cpp b/source/client2/client.cpp index 1b11fb9e..a5922948 100644 --- a/source/client2/client.cpp +++ b/source/client2/client.cpp @@ -33,7 +33,7 @@ void copy_data_block(DATA_BLOCK* str, DATA_BLOCK* in) memcpy(str->data_label, in->data_label, STRING_LENGTH); memcpy(str->data_desc, in->data_desc, STRING_LENGTH); memcpy(str->error_msg, in->error_msg, STRING_LENGTH); - initClientBlock(&str->client_block, 0, ""); + init_client_block(&str->client_block, 0, ""); } void copy_client_block(CLIENT_BLOCK* str, const uda::client::ClientFlags* client_flags) @@ -154,10 +154,10 @@ uda::client::Client::Client() : connection_{environment_}, protocol_version_{Cli cache_ = uda::cache::open_cache(); char username[STRING_LENGTH]; - userid(username); + user_id(username); client_username_ = username; - initClientBlock(&client_block_, ClientVersion, client_username_.c_str()); + init_client_block(&client_block_, ClientVersion, client_username_.c_str()); //---------------------------------------------------------------- // Check if Output Requested @@ -219,7 +219,7 @@ int uda::client::Client::fetch_meta() add_error(UDA_CODE_ERROR_TYPE, __func__, err, "Protocol 4 Error (Data System)"); return err; } - printDataSystem(*data_system); + print_data_system(*data_system); if ((err = protocol2(client_input_, UDA_PROTOCOL_SYSTEM_CONFIG, XDR_RECEIVE, nullptr, logmalloclist_, userdefinedtypelist_, system_config, protocol_version_, &log_struct_list_, private_flags_, @@ -227,7 +227,7 @@ int uda::client::Client::fetch_meta() add_error(UDA_CODE_ERROR_TYPE, __func__, err, "Protocol 5 Error (System Config)"); return err; } - printSystemConfig(*system_config); + print_system_config(*system_config); if ((err = protocol2(client_input_, UDA_PROTOCOL_DATA_SOURCE, XDR_RECEIVE, nullptr, logmalloclist_, userdefinedtypelist_, data_source, protocol_version_, &log_struct_list_, private_flags_, @@ -235,14 +235,14 @@ int uda::client::Client::fetch_meta() add_error(UDA_CODE_ERROR_TYPE, __func__, err, "Protocol 6 Error (Data Source)"); return err; } - printDataSource(*data_source); + print_data_source(*data_source); if ((err = protocol2(client_input_, UDA_PROTOCOL_SIGNAL, XDR_RECEIVE, nullptr, logmalloclist_, userdefinedtypelist_, signal_rec, protocol_version_, &log_struct_list_, private_flags_, malloc_source_)) != 0) { add_error(UDA_CODE_ERROR_TYPE, __func__, err, "Protocol 7 Error (Signal)"); return err; } - printSignal(*signal_rec); + print_signal(*signal_rec); if ((err = protocol2(client_input_, UDA_PROTOCOL_SIGNAL_DESC, XDR_RECEIVE, nullptr, logmalloclist_, userdefinedtypelist_, signal_desc, protocol_version_, &log_struct_list_, private_flags_, @@ -250,7 +250,7 @@ int uda::client::Client::fetch_meta() add_error(UDA_CODE_ERROR_TYPE, __func__, err, "Protocol 8 Error (Signal Desc)"); return err; } - printSignalDesc(*signal_desc); + print_signal_desc(*signal_desc); #endif return err; @@ -330,7 +330,7 @@ int get_data_status(DATA_BLOCK* data_block) int uda::client::Client::get_requests(RequestBlock& request_block, int* indices) { - initServerBlock(&server_block_, 0); + init_server_block(&server_block_, 0); init_error_stack(); time_t tv_server_start = 0; @@ -394,7 +394,7 @@ int uda::client::Client::get_requests(RequestBlock& request_block, int* indices) } update_client_block(client_block_, client_flags_, private_flags_); - printClientBlock(client_block_); + print_client_block(client_block_); //------------------------------------------------------------------------- // Client and Server States at Startup only (1 RTT) @@ -449,7 +449,7 @@ int uda::client::Client::get_requests(RequestBlock& request_block, int* indices) throw uda::exceptions::ClientError("Protocol 2 Error (Failure Receiving Data Block)"); } - printDataBlockList(recv_data_block_list); + print_data_block_list(recv_data_block_list); bool data_received = false; std::vector data_block_indices(request_block.num_requests); @@ -597,7 +597,7 @@ int uda::client::Client::send_putdata(const RequestBlock& request_block) int uda::client::Client::get(std::string_view data_signal, std::string_view data_source) { REQUEST_BLOCK request_block; - initRequestBlock(&request_block); + init_request_block(&request_block); auto signal_ptr = data_signal.data(); auto source_ptr = data_source.data(); @@ -610,7 +610,7 @@ int uda::client::Client::get(std::string_view data_signal, std::string_view data throw uda::exceptions::ClientError("Error identifying the Data Source [%1%]", data_source); } - printRequestBlock(request_block); + print_request_block(request_block); std::vector indices(request_block.num_requests); get_requests(request_block, indices.data()); @@ -621,7 +621,7 @@ int uda::client::Client::get(std::string_view data_signal, std::string_view data std::vector uda::client::Client::get(std::vector>& requests) { REQUEST_BLOCK request_block; - initRequestBlock(&request_block); + init_request_block(&request_block); std::vector signals; std::transform(requests.begin(), requests.end(), std::back_inserter(signals), @@ -639,7 +639,7 @@ std::vector uda::client::Client::get(std::vector indices(request_block.num_requests); get_requests(request_block, indices.data()); @@ -781,7 +781,7 @@ int uda::client::Client::perform_handshake() UDA_LOG(UDA_LOG_DEBUG, "Server Block Received\n"); UDA_LOG(UDA_LOG_DEBUG, "xdrrec_eof rc = %d [1 => no more input]\n", rc); - printServerBlock(server_block_); + print_server_block(server_block_); // Protocol Version: Lower of the client and server version numbers // This defines the set of elements within data structures passed between client and server @@ -840,7 +840,7 @@ int uda::client::Client::receive_server_block() } UDA_LOG(UDA_LOG_DEBUG, "Server Block Received\n"); - printServerBlock(server_block_); + print_server_block(server_block_); return 0; } @@ -922,13 +922,13 @@ void uda::client::Client::set_property(const char* property) if (property[0] == 't') { strncpy(name, property, 55); name[55] = '\0'; - TrimString(name); - LeftTrimString(name); - MidTrimString(name); + trim_string(name); + left_trim_string(name); + mid_trim_string(name); strlwr(name); if ((value = strstr(name, "timeout=")) != nullptr) { value = name + 8; - if (IsNumber(value)) { + if (is_number(value)) { client_flags_.user_timeout = atoi(value); } } @@ -945,13 +945,13 @@ void uda::client::Client::set_property(const char* property) if (!strncasecmp(property, "altRank", 7)) { strncpy(name, property, 55); name[55] = '\0'; - TrimString(name); - LeftTrimString(name); - MidTrimString(name); + trim_string(name); + left_trim_string(name); + mid_trim_string(name); strlwr(name); if ((value = strcasestr(name, "altRank=")) != nullptr) { value = name + 8; - if (IsNumber(value)) { + if (is_number(value)) { client_flags_.alt_rank = atoi(value); } } @@ -1204,7 +1204,7 @@ void uda::client::Client::set_full_ntree(NTREE* full_ntree) int uda::client::Client::put(std::string_view put_instruction, uda::client_server::PutDataBlock* putdata_block) { REQUEST_BLOCK request_block; - initRequestBlock(&request_block); + init_request_block(&request_block); auto signal_ptr = put_instruction.data(); auto source_ptr = ""; @@ -1217,7 +1217,7 @@ int uda::client::Client::put(std::string_view put_instruction, uda::client_serve throw uda::exceptions::ClientError("Error identifying the Data Source"); } - printRequestBlock(request_block); + print_request_block(request_block); request_block.requests[0].put = 1; // flags the direction of data (0 is default => get operation) add_put_data_block_list(putdata_block, &request_block.requests[0].putDataBlockList); @@ -1233,7 +1233,7 @@ int uda::client::Client::put(std::string_view put_instruction, uda::client_serve int uda::client::Client::put(std::string_view put_instruction, uda::client_server::PutDataBlockList* putdata_block_list) { REQUEST_BLOCK request_block; - initRequestBlock(&request_block); + init_request_block(&request_block); auto signal_ptr = put_instruction.data(); auto source_ptr = ""; @@ -1246,7 +1246,7 @@ int uda::client::Client::put(std::string_view put_instruction, uda::client_serve throw uda::exceptions::ClientError("Error identifying the Data Source"); } - printRequestBlock(request_block); + print_request_block(request_block); request_block.requests[0].put = 1; // flags the direction of data (0 is default => get operation) request_block.requests[0].putDataBlockList = *putdata_block_list; diff --git a/source/client2/handle.cpp b/source/client2/handle.cpp index 762de8b1..f8d66089 100644 --- a/source/client2/handle.cpp +++ b/source/client2/handle.cpp @@ -173,6 +173,6 @@ void uda::client::free_handle(int handle) // closeIdamError(&server_block.idamerrorstack); - initDataBlock(data_block); + init_data_block(data_block); data_block->handle = -1; // Flag this as ready for re-use } diff --git a/source/client2/make_request_block.cpp b/source/client2/make_request_block.cpp index 0ea50657..a32c2898 100644 --- a/source/client2/make_request_block.cpp +++ b/source/client2/make_request_block.cpp @@ -103,14 +103,14 @@ int make_request_data(const Environment* environment, const char* data_object, c if (strchr(request->source, '(') == nullptr && strchr(request->source, ')') == nullptr) { // source is not a function call strcpy(request->path, request->source); - expandFilePath(request->path, environment); + expand_file_path(request->path, environment); } } else { if (strchr(test, '(') == nullptr && strchr(test, ')') == nullptr) { // Prefixed and not a function call int ldelim = (int)strlen(request->api_delim); strcpy(request->path, &test[ldelim]); - expandFilePath(request->path, environment); + expand_file_path(request->path, environment); } } @@ -127,7 +127,7 @@ int uda::client::make_request_block(const Environment* environment, const char** int err = 0; for (int i = 0; i < count; ++i) { REQUEST_DATA* request = &request_block->requests[i]; - initRequestData(request); + init_request_data(request); if ((err = make_request_data(environment, signals[i], sources[i], request))) { return err; } diff --git a/source/clientserver/allocData.cpp b/source/clientserver/allocData.cpp index 0f6b39de..0d2a6c92 100644 --- a/source/clientserver/allocData.cpp +++ b/source/clientserver/allocData.cpp @@ -63,7 +63,7 @@ int uda::client_server::alloc_data(DATA_BLOCK* data_block) return ERROR_ALLOCATING_HEAP; } for (unsigned int i = 0; i < data_block->rank; i++) { - initDimBlock(&data_block->dims[i]); + init_dim_block(&data_block->dims[i]); } } diff --git a/source/clientserver/errorLog.cpp b/source/clientserver/errorLog.cpp index f6ed4986..bdb0d2a9 100644 --- a/source/clientserver/errorLog.cpp +++ b/source/clientserver/errorLog.cpp @@ -62,8 +62,8 @@ void uda::client_server::error_log(CLIENT_BLOCK client_block, REQUEST_BLOCK requ asctime_s(accessdate, UDA_DATE_LENGTH, broken); #endif - convertNonPrintable2(accessdate); - TrimString(accessdate); + convert_non_printable2(accessdate); + trim_string(accessdate); for (int i = 0; i < request_block.num_requests; ++i) { auto request = &request_block.requests[i]; diff --git a/source/clientserver/expand_path.cpp b/source/clientserver/expand_path.cpp index ffa2d1cf..b67ca952 100644 --- a/source/clientserver/expand_path.cpp +++ b/source/clientserver/expand_path.cpp @@ -67,7 +67,7 @@ using namespace uda::logging; * @param host The name of the client host workstation. The string is pre-allocated with length STRING_LENGTH * @return A pointer to the host string (Identical to the argument). */ -char* uda::client_server::hostid(char* host) +char* uda::client_server::host_id(char* host) { # ifdef _WIN32 @@ -82,7 +82,7 @@ char* uda::client_server::hostid(char* host) if ((gethostname(host, STRING_LENGTH - 1)) != 0) { char* env = getenv("HOSTNAME"); if (env != nullptr) { - copyString(env, host, STRING_LENGTH); + copy_string(env, host, STRING_LENGTH); } } # else @@ -99,13 +99,13 @@ char* uda::client_server::hostid(char* host) } else { char* env = getenv("HOSTNAME"); if (env != nullptr) { - copyString(env, host, STRING_LENGTH); + copy_string(env, host, STRING_LENGTH); } } # endif if (host[0] == '\0') { - add_error(UDA_CODE_ERROR_TYPE, "hostid", 999, "Unable to Identify the Host Name"); + add_error(UDA_CODE_ERROR_TYPE, "host_id", 999, "Unable to Identify the Host Name"); } return host; @@ -142,7 +142,7 @@ If there are more wildcards in the substitute string than in the target string, @param path The path to be tested for targeted name element replacement. @returns An integer Error Code: If non zero, a problem occurred. */ -int uda::client_server::pathReplacement(char* path, const ENVIRONMENT* environment) +int uda::client_server::path_replacement(char* path, const ENVIRONMENT* environment) { //---------------------------------------------------------------------------------------------- // Does the Path contain hierarchical components not seen by the server? If so make a substitution. @@ -174,7 +174,7 @@ int uda::client_server::pathReplacement(char* path, const ENVIRONMENT* environme std::string work; work.resize(strlen(path)); - UDA_LOG(UDA_LOG_DEBUG, "pathReplacement: Testing for File Path Replacement\n"); + UDA_LOG(UDA_LOG_DEBUG, "path_replacement: Testing for File Path Replacement\n"); UDA_LOG(UDA_LOG_DEBUG, "%s\n", path); // Parse targets @@ -280,7 +280,7 @@ int uda::client_server::pathReplacement(char* path, const ENVIRONMENT* environme } UDA_LOG(UDA_LOG_DEBUG, "%s\n", path); - UDA_LOG(UDA_LOG_DEBUG, "pathReplacement: End\n"); + UDA_LOG(UDA_LOG_DEBUG, "path_replacement: End\n"); return 0; } @@ -289,7 +289,7 @@ int uda::client_server::pathReplacement(char* path, const ENVIRONMENT* environme # ifndef SERVERBUILD -int uda::client_server::linkReplacement(char* path) +int uda::client_server::link_replacement(char* path) { //---------------------------------------------------------------------------------------------- @@ -315,10 +315,10 @@ int uda::client_server::linkReplacement(char* path) errno = 0; if ((ph = popen(cmd.c_str(), "r")) == nullptr) { if (errno != 0) { - add_error(UDA_SYSTEM_ERROR_TYPE, "linkReplacement", errno, ""); + add_error(UDA_SYSTEM_ERROR_TYPE, "link_replacement", errno, ""); } err = 1; - add_error(UDA_CODE_ERROR_TYPE, "linkReplacement", err, "Unable to Dereference Symbolic links"); + add_error(UDA_CODE_ERROR_TYPE, "link_replacement", err, "Unable to Dereference Symbolic links"); path[0] = '\0'; return err; } @@ -337,8 +337,8 @@ int uda::client_server::linkReplacement(char* path) if ((p = strstr(buffer, " -> ")) != nullptr) { if (p[4] == '/') { strcpy(path, p + 4); - convertNonPrintable2(path); - TrimString(path); + convert_non_printable2(path); + trim_string(path); // expandFilePath(path); } } @@ -349,7 +349,7 @@ int uda::client_server::linkReplacement(char* path) } # else -int uda::client_server::linkReplacement(char* path) +int uda::client_server::link_replacement(char* path) { // Links are resolved client side only return 0; @@ -379,7 +379,7 @@ int uda::client_server::linkReplacement(char* path) @returns An integer Error Code: If non zero, a problem occured. */ -int uda::client_server::expandFilePath(char* path, const ENVIRONMENT* environment) +int uda::client_server::expand_file_path(char* path, const ENVIRONMENT* environment) { # ifdef _WIN32 @@ -412,9 +412,9 @@ int uda::client_server::expandFilePath(char* path, const ENVIRONMENT* environmen //------------------------------------------------------------------------------------------------------------------ // Test for possible imbedded linux command - if (!IsLegalFilePath(path)) { + if (!is_legal_file_path(path)) { err = 999; - add_error(UDA_CODE_ERROR_TYPE, "expandFilePath", err, "The Source contains a Syntax Error!"); + add_error(UDA_CODE_ERROR_TYPE, "expand_file_path", err, "The Source contains a Syntax Error!"); return err; } @@ -520,7 +520,7 @@ int uda::client_server::expandFilePath(char* path, const ENVIRONMENT* environmen token = strtok(work, "/"); if (token != nullptr) { - if (IsNumber(token)) { + if (is_number(token)) { return 0; // Is the First token an integer number? } } @@ -555,10 +555,10 @@ int uda::client_server::expandFilePath(char* path, const ENVIRONMENT* environmen if ((fp = strrchr(path, '/')) == nullptr) { // Search backwards - extract filename strcpy(work1, path); snprintf(path, STRING_LENGTH, "%s/%s", cwd, work1); // prepend the CWD and return - if ((err = linkReplacement(path)) != 0) { + if ((err = link_replacement(path)) != 0) { return err; } - if ((err = pathReplacement(path, environment)) != 0) { + if ((err = path_replacement(path, environment)) != 0) { return err; } @@ -686,7 +686,7 @@ int uda::client_server::expandFilePath(char* path, const ENVIRONMENT* environmen /*! Symbolic Links might not be visible by the server: Pass the true location */ - if ((err = linkReplacement(path)) != 0) { + if ((err = link_replacement(path)) != 0) { return err; } @@ -709,7 +709,7 @@ int uda::client_server::expandFilePath(char* path, const ENVIRONMENT* environmen if ((env = getenv("HOSTNAME")) != nullptr) { // Check for a system Environment Variable strcpy(host, env); } else { - hostid(host); // Identify the Name of the Current Workstation or Host + host_id(host); // Identify the Name of the Current Workstation or Host } // TODO: refactor this function so that we do not have to guess the path size @@ -734,7 +734,7 @@ int uda::client_server::expandFilePath(char* path, const ENVIRONMENT* environmen /*! Does the Path to a user's Private Files contain network components not seen by the server? If so, target these and make a suitable substitution to resolve path problems. */ - err = pathReplacement(path, environment); + err = path_replacement(path, environment); return err; @@ -748,7 +748,7 @@ int uda::client_server::expandFilePath(char* path, const ENVIRONMENT* environmen @returns A pointer to the path argument. If a problem occurs, the path string is empty. */ -char* uda::client_server::pathid(char* path) +char* uda::client_server::path_id(char* path) { # ifdef _WIN32 @@ -763,8 +763,8 @@ char* uda::client_server::pathid(char* path) // the path string may contain malign embedded linux commands: is chdir secure? // basic check - if (!IsLegalFilePath(path)) { - add_error(UDA_CODE_ERROR_TYPE, "pathid", 999, "The directory path has incorrect syntax"); + if (!is_legal_file_path(path)) { + add_error(UDA_CODE_ERROR_TYPE, "path_id", 999, "The directory path has incorrect syntax"); path[0] = '\0'; return path; } @@ -778,17 +778,17 @@ char* uda::client_server::pathid(char* path) add_error(UDA_SYSTEM_ERROR_TYPE, __func__, errno, ""); add_error(UDA_CODE_ERROR_TYPE, __func__, 999, "The directory path is not available"); } - TrimString(path); - LeftTrimString(path); + trim_string(path); + left_trim_string(path); return path; } } else { if (errno == EACCES) { - add_error(UDA_SYSTEM_ERROR_TYPE, "pathid", errno, ""); - add_error(UDA_CODE_ERROR_TYPE, "pathid", 999, "The directory path is not available"); + add_error(UDA_SYSTEM_ERROR_TYPE, "path_id", errno, ""); + add_error(UDA_CODE_ERROR_TYPE, "path_id", 999, "The directory path is not available"); } else if (errno == ENOENT || errno == ENOTDIR) { - add_error(UDA_SYSTEM_ERROR_TYPE, "pathid", errno, ""); - add_error(UDA_CODE_ERROR_TYPE, "pathid", 999, "The directory path does not exist"); + add_error(UDA_SYSTEM_ERROR_TYPE, "path_id", errno, ""); + add_error(UDA_CODE_ERROR_TYPE, "path_id", 999, "The directory path does not exist"); } } } diff --git a/source/clientserver/expand_path.h b/source/clientserver/expand_path.h index c401fa10..e5c0d4a8 100644 --- a/source/clientserver/expand_path.h +++ b/source/clientserver/expand_path.h @@ -10,14 +10,14 @@ namespace uda::client_server @param host The name of the client host workstation. The string is pre-allocated with length STRING_LENGTH @returns A pointer to the host string (Identical to the argument). */ -char* hostid(char* host); +char* host_id(char* host); /*! Test a path is legitimate @param path The file path to be tested. @returns A pointer to the path argument. If a problem occurs, the path string is empty. */ -char* pathid(char* path); +char* path_id(char* path); /*! Fully expand file directory paths to remove relative path or environment variable components. @@ -39,7 +39,7 @@ char* pathid(char* path); @param path The file path to be resolved and expanded. @returns An integer Error Code: If non zero, a problem occured. */ -int expandFilePath(char* path, const ENVIRONMENT* environment); +int expand_file_path(char* path, const ENVIRONMENT* environment); #ifndef NO_EXPAND_PATH @@ -51,16 +51,16 @@ int expandFilePath(char* path, const ENVIRONMENT* environment); @param tokenList A Pointer to an array of token strings @param tokenCount The number of tokens in the list. */ -void freeTokenList(char*** tokenListArray, int* tokenCount); +void free_token_list(char*** tokenListArray, int* tokenCount); /*! Generate a lists of path elements tokens. @param delims An array of character delimiters used to separate path elements @param input The list of path elements to be parsed into individual token strings. -@param tokenList A pointer to an array of token strings. This must be freed using freeTokenList when no longer needed. +@param tokenList A pointer to an array of token strings. This must be freed using free_token_list when no longer needed. returns A count of the tokens parsed from input. */ -int tokenList(const char* delims, char* input, char*** tokenListArray); +int token_list(const char* delims, char* input, char*** tokenListArray); /*! Substitute/Replace file path name elements for server side name resolution. @@ -90,9 +90,9 @@ If there are more wildcards in the substitute string than in the target string, @param path The path to be tested for targeted name element replacement. @returns An integer Error Code: If non zero, a problem occured. */ -int pathReplacement(char* path, const ENVIRONMENT* environment); +int path_replacement(char* path, const ENVIRONMENT* environment); -int linkReplacement(char* path); +int link_replacement(char* path); #endif // NO_EXPAND_PATH diff --git a/source/clientserver/initStructs.cpp b/source/clientserver/initStructs.cpp index c34e9798..ba114b95 100644 --- a/source/clientserver/initStructs.cpp +++ b/source/clientserver/initStructs.cpp @@ -14,14 +14,14 @@ #include #include -void uda::client_server::initNameValueList(NAMEVALUELIST* nameValueList) +void uda::client_server::init_name_value_list(NAMEVALUELIST* nameValueList) { nameValueList->pairCount = 0; nameValueList->listSize = 0; nameValueList->nameValue = nullptr; } -void uda::client_server::initRequestData(REQUEST_DATA* str) +void uda::client_server::init_request_data(REQUEST_DATA* str) { str->request = 0; str->exp_number = 0; @@ -39,13 +39,13 @@ void uda::client_server::initRequestData(REQUEST_DATA* str) str->source[0] = '\0'; str->subset[0] = '\0'; str->datasubset.nbound = 0; - initNameValueList(&str->nameValueList); + init_name_value_list(&str->nameValueList); str->put = 0; - initPutDataBlockList(&str->putDataBlockList); + init_put_data_block_list(&str->putDataBlockList); } -void uda::client_server::initRequestBlock(REQUEST_BLOCK* str) +void uda::client_server::init_request_block(REQUEST_BLOCK* str) { str->num_requests = 0; str->requests = nullptr; @@ -55,7 +55,7 @@ void uda::client_server::initRequestBlock(REQUEST_BLOCK* str) # define getpid _getpid #endif -void uda::client_server::initClientBlock(CLIENT_BLOCK* str, int version, const char* clientname) +void uda::client_server::init_client_block(CLIENT_BLOCK* str, int version, const char* clientname) { str->version = version; str->timeout = TIMEOUT; @@ -89,7 +89,7 @@ void uda::client_server::initClientBlock(CLIENT_BLOCK* str, int version, const c #endif } -void uda::client_server::initServerBlock(SERVER_BLOCK* str, int version) +void uda::client_server::init_server_block(SERVER_BLOCK* str, int version) { str->version = version; str->error = 0; @@ -105,13 +105,13 @@ void uda::client_server::initServerBlock(SERVER_BLOCK* str, int version) #endif } -void uda::client_server::initDataBlockList(DATA_BLOCK_LIST* str) +void uda::client_server::init_data_block_list(DATA_BLOCK_LIST* str) { str->count = 0; str->data = nullptr; } -void uda::client_server::initDataBlock(DATA_BLOCK* str) +void uda::client_server::init_data_block(DATA_BLOCK* str) { str->handle = 0; str->errcode = 0; @@ -143,10 +143,10 @@ void uda::client_server::initDataBlock(DATA_BLOCK* str) memset(str->data_label, '\0', STRING_LENGTH); memset(str->data_desc, '\0', STRING_LENGTH); memset(str->error_msg, '\0', STRING_LENGTH); - initClientBlock(&(str->client_block), 0, ""); + init_client_block(&(str->client_block), 0, ""); } -void uda::client_server::initDimBlock(DIMS* str) +void uda::client_server::init_dim_block(DIMS* str) { str->dim = nullptr; str->synthetic = nullptr; @@ -173,7 +173,7 @@ void uda::client_server::initDimBlock(DIMS* str) str->dim_label[0] = '\0'; } -void uda::client_server::initDataSystem(DATA_SYSTEM* str) +void uda::client_server::init_data_system(DATA_SYSTEM* str) { str->system_id = 0; str->version = 0; @@ -187,7 +187,7 @@ void uda::client_server::initDataSystem(DATA_SYSTEM* str) str->xml_creation[0] = '\0'; } -void uda::client_server::initSystemConfig(SYSTEM_CONFIG* str) +void uda::client_server::init_system_config(SYSTEM_CONFIG* str) { str->config_id = 0; str->system_id = 0; @@ -199,7 +199,7 @@ void uda::client_server::initSystemConfig(SYSTEM_CONFIG* str) str->xml_creation[0] = '\0'; } -void uda::client_server::initDataSource(DATA_SOURCE* str) +void uda::client_server::init_data_source(DATA_SOURCE* str) { str->source_id = 0; str->config_id = 0; @@ -233,7 +233,7 @@ void uda::client_server::initDataSource(DATA_SOURCE* str) str->xml_creation[0] = '\0'; } -void uda::client_server::initSignal(SIGNAL* str) +void uda::client_server::init_signal(SIGNAL* str) { str->source_id = 0; str->signal_desc_id = 0; @@ -251,7 +251,7 @@ void uda::client_server::initSignal(SIGNAL* str) str->xml_creation[0] = '\0'; } -void uda::client_server::initSignalDesc(SIGNAL_DESC* str) +void uda::client_server::init_signal_desc(SIGNAL_DESC* str) { str->signal_desc_id = 0; str->meta_id = 0; @@ -274,7 +274,7 @@ void uda::client_server::initSignalDesc(SIGNAL_DESC* str) str->xml_creation[0] = '\0'; } -void uda::client_server::initPutDataBlock(PutDataBlock* str) +void uda::client_server::init_put_data_block(PutDataBlock* str) { str->data_type = UDA_TYPE_UNKNOWN; str->rank = 0; @@ -288,7 +288,7 @@ void uda::client_server::initPutDataBlock(PutDataBlock* str) str->blockName = nullptr; } -void uda::client_server::initPutDataBlockList(PutDataBlockList* putDataBlockList) +void uda::client_server::init_put_data_block_list(PutDataBlockList* putDataBlockList) { putDataBlockList->putDataBlock = nullptr; putDataBlockList->blockCount = 0; diff --git a/source/clientserver/initStructs.h b/source/clientserver/initStructs.h index 8a88f95a..8d4f0b5d 100644 --- a/source/clientserver/initStructs.h +++ b/source/clientserver/initStructs.h @@ -5,34 +5,34 @@ namespace uda::client_server { -void initNameValueList(NAMEVALUELIST* nameValueList); +void init_name_value_list(NAMEVALUELIST* nameValueList); -void initRequestData(REQUEST_DATA* str); +void init_request_data(REQUEST_DATA* str); -void initRequestBlock(REQUEST_BLOCK* str); +void init_request_block(REQUEST_BLOCK* str); -void initClientBlock(CLIENT_BLOCK* str, int version, const char* clientname); +void init_client_block(CLIENT_BLOCK* str, int version, const char* clientname); -void initServerBlock(SERVER_BLOCK* str, int version); +void init_server_block(SERVER_BLOCK* str, int version); -void initDataBlock(DATA_BLOCK* str); +void init_data_block(DATA_BLOCK* str); -void initDataBlockList(DATA_BLOCK_LIST* str); +void init_data_block_list(DATA_BLOCK_LIST* str); -void initDimBlock(DIMS* str); +void init_dim_block(DIMS* str); -void initDataSystem(DATA_SYSTEM* str); +void init_data_system(DATA_SYSTEM* str); -void initSystemConfig(SYSTEM_CONFIG* str); +void init_system_config(SYSTEM_CONFIG* str); -void initDataSource(DATA_SOURCE* str); +void init_data_source(DATA_SOURCE* str); -void initSignal(SIGNAL* str); +void init_signal(SIGNAL* str); -void initSignalDesc(SIGNAL_DESC* str); +void init_signal_desc(SIGNAL_DESC* str); -void initPutDataBlock(PutDataBlock* str); +void init_put_data_block(PutDataBlock* str); -void initPutDataBlockList(PutDataBlockList* putDataBlockList); +void init_put_data_block_list(PutDataBlockList* putDataBlockList); } // namespace uda::client_server diff --git a/source/clientserver/makeRequestBlock.cpp b/source/clientserver/makeRequestBlock.cpp index 95ffc6f2..620a597f 100644 --- a/source/clientserver/makeRequestBlock.cpp +++ b/source/clientserver/makeRequestBlock.cpp @@ -71,7 +71,7 @@ static int find_plugin_id_by_format(const char* format, const uda::plugins::Plug return -1; } -int uda::client_server::makeRequestData(REQUEST_DATA* request, const uda::plugins::PluginList* pluginList, +int uda::client_server::make_request_data(REQUEST_DATA* request, const uda::plugins::PluginList* pluginList, const ENVIRONMENT* environment) { int ldelim; @@ -101,10 +101,10 @@ int uda::client_server::makeRequestData(REQUEST_DATA* request, const uda::plugin snprintf(work, MAXMETA, "%s%s", environment->api_archive, environment->api_delim); // default archive snprintf(work2, MAXMETA, "%s%s", environment->api_device, environment->api_delim); // default device - LeftTrimString(request->signal); - TrimString(request->signal); - LeftTrimString(request->source); - TrimString(request->source); + left_trim_string(request->signal); + trim_string(request->signal); + left_trim_string(request->source); + trim_string(request->source); bool noSource = (request->source[0] == '\0' || // no source STR_IEQUALS(request->source, environment->api_device) || // default device name @@ -122,7 +122,7 @@ int uda::client_server::makeRequestData(REQUEST_DATA* request, const uda::plugin for (size_t i = 0; i < lstr; i++) { request->source[i] = ' '; } - LeftTrimString(request->source); + left_trim_string(request->source); } //------------------------------------------------------------------------------ @@ -191,7 +191,7 @@ int uda::client_server::makeRequestData(REQUEST_DATA* request, const uda::plugin if (test != nullptr) { strncpy(work2, request->source, test - request->source); work2[test - request->source] = '\0'; - TrimString(work2); + trim_string(work2); strcpy(work, test + ldelim); } else { work2[0] = '\0'; @@ -206,12 +206,12 @@ int uda::client_server::makeRequestData(REQUEST_DATA* request, const uda::plugin lstr = (p - work); strncpy(work2, work, lstr); // Ignore the default device name - force a pass to Scenario 2 work2[lstr] = '\0'; - TrimString(work2); + trim_string(work2); lstr = lstr + ldelim; for (size_t i = 0; i < lstr; i++) { work[i] = ' '; } - LeftTrimString(work); + left_trim_string(work); } bool reduceSignal; @@ -293,8 +293,8 @@ int uda::client_server::makeRequestData(REQUEST_DATA* request, const uda::plugin strcpy(work2, &p[1]); p = strchr(work2, ')'); p[0] = '\0'; - LeftTrimString(work2); - TrimString(work2); + left_trim_string(work2); + trim_string(work2); request->request = REQUEST_READ_SERVERSIDE; extract_function_name(work, request); @@ -400,7 +400,7 @@ int uda::client_server::makeRequestData(REQUEST_DATA* request, const uda::plugin UDA_THROW_ERROR(999, "Too many chained Device Name to Server Protocol Host subtitutions!"); } - err = makeRequestData(request, pluginList, environment); + err = make_request_data(request, pluginList, environment); depth--; return err; } @@ -457,8 +457,8 @@ int uda::client_server::makeRequestData(REQUEST_DATA* request, const uda::plugin strcpy(work, &p[1]); p = strrchr(work, ')'); p[0] = '\0'; - LeftTrimString(work); - TrimString(work); + left_trim_string(work); + trim_string(work); // Extract Name Value pairs @@ -521,7 +521,7 @@ int uda::client_server::makeRequestData(REQUEST_DATA* request, const uda::plugin if (p != nullptr) { p[0] = '\0'; // Remove subset operations from variable name } - TrimString(request->signal); + trim_string(request->signal); } else { request->subset[0] = '\0'; request->datasubset.nbound = 0; @@ -557,8 +557,8 @@ int uda::client_server::makeRequestData(REQUEST_DATA* request, const uda::plugin strcpy(work, &p[1]); if ((p = strrchr(work, ')')) != nullptr) { p[0] = '\0'; - LeftTrimString(work); - TrimString(work); + left_trim_string(work); + trim_string(work); isFunction = true; if (name_value_pairs(work, &request->nameValueList, strip) == -1) { UDA_THROW_ERROR(999, "Name Value pair syntax is incorrect!"); @@ -654,15 +654,15 @@ int uda::client_server::makeRequestData(REQUEST_DATA* request, const uda::plugin if (request->request == REQUEST_READ_MDS && !isProxy) { - reverseString(test + ldelim, work); // Drop the delimiters and Reverse the Source String + reverse_string(test + ldelim, work); // Drop the delimiters and Reverse the Source String char* token; if ((token = strtok(work, "/")) != nullptr) { // Tokenise - if (IsNumber(token)) { // This should be the tree Number otherwise only the server is passed - reverseString(token, work2); // Un-Reverse the token + if (is_number(token)) { // This should be the tree Number otherwise only the server is passed + reverse_string(token, work2); // Un-Reverse the token request->exp_number = (int)strtol(work2, nullptr, 10); // Extract the Data Tree Number if ((token = strtok(nullptr, "/")) != nullptr) { - reverseString(token, request->file); // This should be the Tree Name + reverse_string(token, request->file); // This should be the Tree Name work2[0] = '\0'; while ((token = strtok(nullptr, "/")) != nullptr) { // Everything Else is the Server Host and URL Path to the Tree @@ -672,11 +672,11 @@ int uda::client_server::makeRequestData(REQUEST_DATA* request, const uda::plugin if (work2[0] == '/') { strcpy(work2, &work2[1]); // Drop Trailing / } - reverseString(work2, request->server); + reverse_string(work2, request->server); token = test + ldelim; // Preserve Leading / if (token[0] != '/' && request->server[0] == '/') { request->server[0] = ' '; - LeftTrimString(request->server); + left_trim_string(request->server); } } else { err = 3; @@ -749,7 +749,7 @@ int uda::client_server::make_request_block(REQUEST_BLOCK* request_block, const u for (int i = 0; i < request_block->num_requests; ++i) { auto request = &request_block->requests[0]; - rc = makeRequestData(request, pluginList, environment); + rc = make_request_data(request, pluginList, environment); if (rc != 0) { break; } @@ -778,8 +778,8 @@ void extract_function_name(const char* str, REQUEST_DATA* request) for (int i = 0; i < lstr; i++) { work[i] = ' '; } - TrimString(work); - LeftTrimString(work); + trim_string(work); + left_trim_string(work); } while ((p = strstr(work, request->api_delim)) != nullptr); } strcpy(request->function, work); @@ -817,7 +817,7 @@ int source_file_format_test(const char* source, REQUEST_DATA* request, const uda // Does the path contain any Illegal (or problem) characters - if (!IsLegalFilePath((char*)source)) { + if (!is_legal_file_path((char*)source)) { return rc; // Not compliant with Portable Filename character set } @@ -856,9 +856,9 @@ int source_file_format_test(const char* source, REQUEST_DATA* request, const uda pclose(ph); test = blank; - convertNonPrintable2(buffer); - LeftTrimString(buffer); - TrimString(buffer); + convert_non_printable2(buffer); + left_trim_string(buffer); + trim_string(buffer); if (STR_EQUALS(buffer, "CDF")) { // Legacy netCDF file test = nc; @@ -884,9 +884,9 @@ int source_file_format_test(const char* source, REQUEST_DATA* request, const uda } } pclose(ph); - convertNonPrintable2(buffer); - LeftTrimString(buffer); - TrimString(buffer); + convert_non_printable2(buffer); + left_trim_string(buffer); + trim_string(buffer); if (STR_EQUALS(buffer, "netcdf")) { // netCDF file written to an HDF5 file test = nc; @@ -941,9 +941,9 @@ int source_file_format_test(const char* source, REQUEST_DATA* request, const uda } } pclose(ph); - convertNonPrintable2(buffer); - LeftTrimString(buffer); - TrimString(buffer); + convert_non_printable2(buffer); + left_trim_string(buffer); + trim_string(buffer); if (strncmp(buffer, "ida_open error", 14) != 0) { test = ida; // Legacy IDA file } @@ -977,7 +977,7 @@ int source_file_format_test(const char* source, REQUEST_DATA* request, const uda // Other regular types - if (strlen(&test[1]) == 2 && IsNumber(&test[1])) { // an integer number? + if (strlen(&test[1]) == 2 && is_number(&test[1])) { // an integer number? strcpy(request->format, "IDA3"); break; } @@ -1077,7 +1077,7 @@ int generic_request_test(const char* source, REQUEST_DATA* request) // pulse plasma shot number - an integer // pulse/pass include a pass or sequence number - this may be a text based component, e.g. LATEST - if (IsNumber((char*)source)) { // Is the source an integer number? + if (is_number((char*)source)) { // Is the source an integer number? rc = 1; request->request = REQUEST_READ_GENERIC; strcpy(request->path, ""); // Clean the path @@ -1086,13 +1086,13 @@ int generic_request_test(const char* source, REQUEST_DATA* request) } else { strcpy(work, source); if ((token = strtok(work, "/")) != nullptr) { // Tokenise the remaining string - if (IsNumber(token)) { // Is the First token an integer number? + if (is_number(token)) { // Is the First token an integer number? rc = 1; request->request = REQUEST_READ_GENERIC; strcpy(request->path, ""); // Clean the path request->exp_number = (int)strtol(token, nullptr, 10); if ((token = strtok(nullptr, "/")) != nullptr) { // Next Token - if (IsNumber(token)) { + if (is_number(token)) { request->pass = (int)strtol(token, nullptr, 10); // Must be the Pass number } else { strcpy(request->tpass, token); // capture anything else @@ -1124,7 +1124,7 @@ int extract_archive(REQUEST_DATA* request, int reduceSignal, const ENVIRONMENT* int ldelim = (int)strlen(request->api_delim); char *test, *token, *work; - TrimString(request->signal); + trim_string(request->signal); if (request->signal[0] != '\0' && environment->server_proxy[0] == '\0') { @@ -1138,7 +1138,7 @@ int extract_archive(REQUEST_DATA* request, int reduceSignal, const ENVIRONMENT* } strncpy(request->archive, request->signal, test - request->signal); request->archive[test - request->signal] = '\0'; - TrimString(request->archive); + trim_string(request->archive); // If a plugin is prefixed by the local archive name then discard the archive name if (reduceSignal && !strcasecmp(request->archive, environment->api_archive)) { @@ -1147,7 +1147,7 @@ int extract_archive(REQUEST_DATA* request, int reduceSignal, const ENVIRONMENT* return extract_archive(request, reduceSignal, environment); } - if (!IsLegalFilePath(request->archive)) { + if (!is_legal_file_path(request->archive)) { request->archive[0] = '\0'; return 0; } @@ -1159,14 +1159,14 @@ int extract_archive(REQUEST_DATA* request, int reduceSignal, const ENVIRONMENT* if ((token = strchr(request->archive, '[')) != nullptr || (token = strchr(request->archive, '{')) != nullptr) { - test1 = (strlen(&token[1]) == 0 || IsNumber(&token[1])); + test1 = (strlen(&token[1]) == 0 || is_number(&token[1])); } if ((token = strchr(test + ldelim, ']')) != nullptr || (token = strchr(test + ldelim, '}')) != nullptr) { work = (char*)malloc((strlen(test + ldelim) + 1) * sizeof(char)); strcpy(work, test + ldelim); work[token - (test + ldelim)] = '\0'; - test2 = (strlen(work) == 0 || IsNumber(work)); + test2 = (strlen(work) == 0 || is_number(work)); free(work); } @@ -1176,7 +1176,7 @@ int extract_archive(REQUEST_DATA* request, int reduceSignal, const ENVIRONMENT* strcpy(work, test + ldelim); strcpy(request->signal, work); // Valid Archive & signal free(work); - TrimString(request->signal); + trim_string(request->signal); } } else { request->archive[0] = '\0'; // Reset Archive @@ -1387,7 +1387,7 @@ int extract_subset(REQUEST_DATA* request) // -1 => Error request->subset[0] = '\0'; - initSubset(&request->datasubset); + init_subset(&request->datasubset); std::string signal = request->signal; @@ -1443,7 +1443,7 @@ int extract_subset(REQUEST_DATA* request) // // The returned value is the count of the name value pairs. If an error occurs, the returned value of the // pair count is -1. -void uda::client_server::freeNameValueList(NAMEVALUELIST* nameValueList) +void uda::client_server::free_name_value_list(NAMEVALUELIST* nameValueList) { if (nameValueList->nameValue != nullptr) { for (int i = 0; i < nameValueList->pairCount; i++) { @@ -1471,11 +1471,11 @@ void parse_name_value(const char* pair, NAMEVALUE* nameValue, unsigned short str lstr = (int)strlen(pair) + 1; copy = (char*)malloc(lstr * sizeof(char)); strcpy(copy, pair); - LeftTrimString(copy); - TrimString(copy); + left_trim_string(copy); + trim_string(copy); nameValue->pair = (char*)malloc(lstr * sizeof(char)); strcpy(nameValue->pair, copy); - LeftTrimString(nameValue->pair); + left_trim_string(nameValue->pair); UDA_LOG(UDA_LOG_DEBUG, "Pair: %s\n", pair); if ((p = strchr(copy, '=')) != nullptr) { *p = '\0'; @@ -1502,10 +1502,10 @@ void parse_name_value(const char* pair, NAMEVALUE* nameValue, unsigned short str UDA_LOG(UDA_LOG_DEBUG, "Placeholder value: %s\n", nameValue->name); } } - LeftTrimString(nameValue->name); - LeftTrimString(nameValue->value); - TrimString(nameValue->name); - TrimString(nameValue->value); + left_trim_string(nameValue->name); + left_trim_string(nameValue->value); + trim_string(nameValue->name); + trim_string(nameValue->value); UDA_LOG(UDA_LOG_DEBUG, "Name: %s Value: %s\n", nameValue->name, nameValue->value); // Regardless of whether or not the Value is not enclosed in quotes, strip out a possible closing parenthesis @@ -1523,16 +1523,16 @@ void parse_name_value(const char* pair, NAMEVALUE* nameValue, unsigned short str (nameValue->name[0] == '"' && nameValue->name[lstr - 1] == '"')) { nameValue->name[0] = ' '; nameValue->name[lstr - 1] = ' '; - LeftTrimString(nameValue->name); - TrimString(nameValue->name); + left_trim_string(nameValue->name); + trim_string(nameValue->name); } lstr = (int)strlen(nameValue->value); if ((nameValue->value[0] == '\'' && nameValue->value[lstr - 1] == '\'') || (nameValue->value[0] == '"' && nameValue->value[lstr - 1] == '"')) { nameValue->value[0] = ' '; nameValue->value[lstr - 1] = ' '; - LeftTrimString(nameValue->value); - TrimString(nameValue->value); + left_trim_string(nameValue->value); + trim_string(nameValue->value); } UDA_LOG(UDA_LOG_DEBUG, "Name: %s Value: %s\n", nameValue->name, nameValue->value); } @@ -1628,10 +1628,10 @@ int uda::client_server::name_value_pairs(const char* pairList, NAMEVALUELIST* na if ((p = strcasestr(copy, "delimiter")) != nullptr) { strcpy(buffer, &p[9]); - LeftTrimString(buffer); + left_trim_string(buffer); if (buffer[0] == '=' && buffer[1] != '\0') { buffer[0] = ' '; - LeftTrimString(buffer); // remove whitespace + left_trim_string(buffer); // remove whitespace if (strlen(buffer) >= 3 && ((buffer[0] == '\'' && buffer[2] == '\'') || (buffer[0] == '"' && buffer[2] == '"'))) { proposal = buffer[1]; // proposal delimiter @@ -1643,14 +1643,14 @@ int uda::client_server::name_value_pairs(const char* pairList, NAMEVALUELIST* na } else { strncpy(buffer, copy, lstr); // check 'delimiter' is not part of another name value pair buffer[lstr] = '\0'; - TrimString(buffer); + trim_string(buffer); lstr = (int)strlen(buffer); if (buffer[lstr - 1] == proposal) { // must be an immediately preceeding delimiter character delimiter = proposal; // new delimiter accepted p3 = strchr(&p[9], delimiter); // change delimiter temporarily to avert incorrect parse *p3 = '#'; } else { - TrimString(buffer); // Check for non alpha-numeric character + trim_string(buffer); // Check for non alpha-numeric character lstr = (int)strlen(buffer); if (!isalpha(buffer[lstr - 1]) && !isdigit(buffer[lstr - 1])) { // Probable syntax error! free(buffer); diff --git a/source/clientserver/makeRequestBlock.h b/source/clientserver/makeRequestBlock.h index 12596cd2..1d06f831 100644 --- a/source/clientserver/makeRequestBlock.h +++ b/source/clientserver/makeRequestBlock.h @@ -11,10 +11,10 @@ namespace uda::client_server int make_request_block(REQUEST_BLOCK* request_block, const uda::plugins::PluginList* pluginList, const ENVIRONMENT* environment); -int makeRequestData(REQUEST_DATA* request, const uda::plugins::PluginList* pluginList, const ENVIRONMENT* environment); +int make_request_data(REQUEST_DATA* request, const uda::plugins::PluginList* pluginList, const ENVIRONMENT* environment); int name_value_pairs(const char* pairList, NAMEVALUELIST* nameValueList, unsigned short strip); -void freeNameValueList(NAMEVALUELIST* nameValueList); +void free_name_value_list(NAMEVALUELIST* nameValueList); } // namespace uda::client_server \ No newline at end of file diff --git a/source/clientserver/manageSockets.cpp b/source/clientserver/manageSockets.cpp index bb56d999..3e8a8255 100644 --- a/source/clientserver/manageSockets.cpp +++ b/source/clientserver/manageSockets.cpp @@ -21,7 +21,7 @@ // Initialise -void uda::client_server::initSocketList(SOCKETLIST* socks) +void uda::client_server::init_socket_list(SOCKETLIST* socks) { socks->nsocks = 0; socks->sockets = nullptr; @@ -29,10 +29,10 @@ void uda::client_server::initSocketList(SOCKETLIST* socks) // Add a New Socket to the Socket List -int uda::client_server::addSocket(SOCKETLIST* socks, int type, int status, char* host, int port, int fh) +int uda::client_server::add_socket(SOCKETLIST* socks, int type, int status, char* host, int port, int fh) { int old_fh = -1; - if (!getSocket(socks, type, &status, host, port, &old_fh)) { // Is an Open Socket already listed? + if (!get_socket(socks, type, &status, host, port, &old_fh)) { // Is an Open Socket already listed? if (old_fh == fh) { return 0; } @@ -54,7 +54,7 @@ int uda::client_server::addSocket(SOCKETLIST* socks, int type, int status, char* // Search for an Open Socket in the Socket List -int uda::client_server::getSocket(SOCKETLIST* socks, int type, int* status, char* host, int port, int* fh) +int uda::client_server::get_socket(SOCKETLIST* socks, int type, int* status, char* host, int port, int* fh) { for (int i = 0; i < socks->nsocks; i++) { if (STR_IEQUALS(host, socks->sockets[i].host) && socks->sockets[i].type == type && @@ -72,7 +72,7 @@ int uda::client_server::getSocket(SOCKETLIST* socks, int type, int* status, char // Search for an Open Socket in the Socket List -int uda::client_server::getSocketRecordId(SOCKETLIST* socks, int fh) +int uda::client_server::get_socket_record_id(SOCKETLIST* socks, int fh) { for (int i = 0; i < socks->nsocks; i++) { if (socks->sockets[i].fh == fh) { @@ -82,7 +82,7 @@ int uda::client_server::getSocketRecordId(SOCKETLIST* socks, int fh) return -1; // Failed - No Socket } -void uda::client_server::closeClientSocket(SOCKETLIST* socks, int fh) +void uda::client_server::close_client_socket(SOCKETLIST* socks, int fh) { for (int i = 0; i < socks->nsocks; i++) { if (socks->sockets[i].fh == fh && socks->sockets[i].fh >= 0) { @@ -100,11 +100,11 @@ void uda::client_server::closeClientSocket(SOCKETLIST* socks, int fh) } } -void uda::client_server::closeClientSockets(SOCKETLIST* socks) +void uda::client_server::close_client_sockets(SOCKETLIST* socks) { for (int i = 0; i < socks->nsocks; i++) { - closeClientSocket(socks, socks->sockets[i].fh); + close_client_socket(socks, socks->sockets[i].fh); } free(socks->sockets); - initSocketList(socks); + init_socket_list(socks); } diff --git a/source/clientserver/manageSockets.h b/source/clientserver/manageSockets.h index d231e6db..4aeec73a 100644 --- a/source/clientserver/manageSockets.h +++ b/source/clientserver/manageSockets.h @@ -6,19 +6,19 @@ namespace uda::client_server { // Initialise -void initSocketList(SOCKETLIST* socks); +void init_socket_list(SOCKETLIST* socks); // Add a New Socket to the Socket List -int addSocket(SOCKETLIST* socks, int type, int status, char* host, int port, int fh); +int add_socket(SOCKETLIST* socks, int type, int status, char* host, int port, int fh); // Search for an Open Socket in the Socket List -int getSocket(SOCKETLIST* socks, int type, int* status, char* host, int port, int* fh); +int get_socket(SOCKETLIST* socks, int type, int* status, char* host, int port, int* fh); // Search for an Open Socket in the Socket List -int getSocketRecordId(SOCKETLIST* socks, int fh); +int get_socket_record_id(SOCKETLIST* socks, int fh); -void closeClientSockets(SOCKETLIST* socks); +void close_client_sockets(SOCKETLIST* socks); -void closeClientSocket(SOCKETLIST* socks, int fh); +void close_client_socket(SOCKETLIST* socks, int fh); } // namespace uda::client_server diff --git a/source/clientserver/nameValueSubstitution.cpp b/source/clientserver/nameValueSubstitution.cpp index ae2d234d..d8457ed0 100644 --- a/source/clientserver/nameValueSubstitution.cpp +++ b/source/clientserver/nameValueSubstitution.cpp @@ -43,7 +43,7 @@ int uda::client_server::name_value_substitution(NAMEVALUELIST* nameValueList, ch } NAMEVALUELIST newNameValueList; - initNameValueList(&newNameValueList); + init_name_value_list(&newNameValueList); unsigned short strip = 0; // Do Not Remove enclosing quotes from name value pairs if (name_value_pairs(tpass, &newNameValueList, strip) == -1) { @@ -54,7 +54,7 @@ int uda::client_server::name_value_substitution(NAMEVALUELIST* nameValueList, ch if (newNameValueList.pairCount == 0) { // No passed substitution values or additional name value pairs if (newNameValueList.nameValue != nullptr) { - freeNameValueList(&newNameValueList); + free_name_value_list(&newNameValueList); } return 0; } @@ -85,7 +85,7 @@ int uda::client_server::name_value_substitution(NAMEVALUELIST* nameValueList, ch tpassIndex[placeholderCount] = tpassPosition++; // Ordering: Default substitution value to use - list position if (nameValueList->nameValue[i].value[1] != '\0') { - if (IsNumber(&nameValueList->nameValue[i] + if (is_number(&nameValueList->nameValue[i] .value[1])) { // Is the placeholder numbered? - Use the specific substitution // value identified by list order tpassIndex[placeholderCount] = atoi(&nameValueList->nameValue[i].value[1]) - @@ -177,7 +177,7 @@ int uda::client_server::name_value_substitution(NAMEVALUELIST* nameValueList, ch free(tpassIndex); free(placeholderIndex); if (err != 0) { - freeNameValueList(&newNameValueList); + free_name_value_list(&newNameValueList); return err; } @@ -206,7 +206,7 @@ int uda::client_server::name_value_substitution(NAMEVALUELIST* nameValueList, ch } } - freeNameValueList(&newNameValueList); + free_name_value_list(&newNameValueList); // Scan all values for embedded placeholders and substitute @@ -244,7 +244,7 @@ void embedded_value_substitution(NAMEVALUELIST* nameValueList) continue; } - initNameValueList(&newNameValueList); + init_name_value_list(&newNameValueList); UDA_LOG(UDA_LOG_DEBUG, "Extracting Name Value Pairs from [%d]: %s\n", i, nameValueList->nameValue[i].value); @@ -324,5 +324,5 @@ void embedded_value_substitution(NAMEVALUELIST* nameValueList) } } } - freeNameValueList(&newNameValueList); + free_name_value_list(&newNameValueList); } diff --git a/source/clientserver/parseOperation.cpp b/source/clientserver/parseOperation.cpp index 5a0229ef..69064cf8 100644 --- a/source/clientserver/parseOperation.cpp +++ b/source/clientserver/parseOperation.cpp @@ -9,7 +9,7 @@ using namespace uda::client_server; -int uda::client_server::parseOperation(SUBSET* sub) +int uda::client_server::parse_operation(SUBSET* sub) { //------------------------------------------------------------------------------------------------------------- // Extract the Value Component from each separate Operation diff --git a/source/clientserver/parseOperation.h b/source/clientserver/parseOperation.h index f61bb28b..a40cb8d2 100644 --- a/source/clientserver/parseOperation.h +++ b/source/clientserver/parseOperation.h @@ -5,6 +5,6 @@ namespace uda::client_server { -int parseOperation(SUBSET* sub); +int parse_operation(SUBSET* sub); } diff --git a/source/clientserver/parseXML.cpp b/source/clientserver/parseXML.cpp index b3e41c7b..c50731db 100644 --- a/source/clientserver/parseXML.cpp +++ b/source/clientserver/parseXML.cpp @@ -69,7 +69,7 @@ float* parse_float_array(xmlDocPtr doc, xmlNodePtr cur, const char* target, int* while (cur != nullptr) { if ((!xmlStrcmp(cur->name, (const xmlChar*)target))) { key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); - convertNonPrintable((char*)key); + convert_non_printable((char*)key); if (strlen((char*)key) > 0) { int lkey = (int)strlen((char*)key); UDA_LOG(UDA_LOG_DEBUG, "parseFloatArray: [%d] %s %s \n", lkey, target, key); @@ -106,7 +106,7 @@ template void parse_fixed_length_array(xmlNodePtr cur, const char* int nco = 0; if ((att = xmlGetProp(cur, (xmlChar*)target)) != nullptr) { - convertNonPrintable((char*)att); + convert_non_printable((char*)att); if (strlen((char*)att) > 0) { int l = (int)strlen((char*)att); UDA_LOG(UDA_LOG_DEBUG, "parseFixedLengthArray: [%d] %s %s \n", l, target, att); @@ -138,7 +138,7 @@ void parse_fixed_length_array(xmlNodePtr cur, const char* target, void* array, i int nco = 0; if ((att = xmlGetProp(cur, (xmlChar*)target)) != nullptr) { - convertNonPrintable((char*)att); + convert_non_printable((char*)att); if (strlen((char*)att) > 0) { int l = (int)strlen((char*)att); UDA_LOG(UDA_LOG_DEBUG, "parseFixedLengthArray: [%d] %s %s \n", l, target, att); @@ -382,7 +382,7 @@ void parse_time_offset(xmlDocPtr doc, xmlNodePtr cur, ACTIONS* actions) n++; str = (ACTION*)realloc((void*)str, n * sizeof(ACTION)); - initAction(&str[n - 1]); + init_action(&str[n - 1]); str[n - 1].actionType = UDA_TIME_OFFSET_TYPE; init_time_offset(&str[n - 1].timeoffset); @@ -492,7 +492,7 @@ void parseCompositeSubset(xmlDocPtr doc, xmlNodePtr cur, COMPOSITE* comp) n++; str = (SUBSET*)realloc((void*)str, n * sizeof(SUBSET)); - initSubset(&str[n - 1]); + init_subset(&str[n - 1]); // Attributes @@ -545,7 +545,7 @@ void parseCompositeSubset(xmlDocPtr doc, xmlNodePtr cur, COMPOSITE* comp) parse_fixed_length_array(cur, "bound", (void*)str[n - 1].bound, UDA_TYPE_DOUBLE, &n0); parse_fixed_length_array(cur, "dimid", (void*)str[n - 1].dimid, UDA_TYPE_INT, &n1); - if (parseOperation(&str[n - 1]) != 0) { + if (parse_operation(&str[n - 1]) != 0) { return; } @@ -664,7 +664,7 @@ void parseComposite(xmlDocPtr doc, xmlNodePtr cur, ACTIONS* actions) n++; str = (ACTION*)realloc((void*)str, n * sizeof(ACTION)); - initAction(&str[n - 1]); + init_action(&str[n - 1]); str[n - 1].actionType = UDA_COMPOSITE_TYPE; init_composite(&str[n - 1].composite); @@ -854,7 +854,7 @@ void parse_error_model(xmlDocPtr doc, xmlNodePtr cur, ACTIONS* actions) n++; str = (ACTION*)realloc((void*)str, n * sizeof(ACTION)); - initAction(&str[n - 1]); + init_action(&str[n - 1]); str[n - 1].actionType = UDA_ERROR_MODEL_TYPE; init_error_model(&str[n - 1].errormodel); @@ -982,7 +982,7 @@ void parse_documentation(xmlDocPtr doc, xmlNodePtr cur, ACTIONS* actions) n++; str = (ACTION*)realloc((void*)str, n * sizeof(ACTION)); - initAction(&str[n - 1]); + init_action(&str[n - 1]); str[n - 1].actionType = UDA_DOCUMENTATION_TYPE; init_documentation(&str[n - 1].documentation); @@ -1108,7 +1108,7 @@ void parse_calibration(xmlDocPtr doc, xmlNodePtr cur, ACTIONS* actions) n++; str = (ACTION*)realloc((void*)str, n * sizeof(ACTION)); - initAction(&str[n - 1]); + init_action(&str[n - 1]); str[n - 1].actionType = UDA_CALIBRATION_TYPE; init_calibration(&str[n - 1].calibration); @@ -1204,10 +1204,10 @@ void parse_subset(xmlDocPtr doc, xmlNodePtr cur, ACTIONS* actions) n++; str = (ACTION*)realloc((void*)str, n * sizeof(ACTION)); - initAction(&str[n - 1]); + init_action(&str[n - 1]); str[n - 1].actionType = UDA_SUBSET_TYPE; sub = &str[n - 1].subset; - initSubset(sub); + init_subset(sub); // Attributes @@ -1272,7 +1272,7 @@ void parse_subset(xmlDocPtr doc, xmlNodePtr cur, ACTIONS* actions) parse_fixed_length_array(cur, "bound", (void*)sub->bound, UDA_TYPE_DOUBLE, &n0); parse_fixed_length_array(cur, "dimid", (void*)sub->dimid, UDA_TYPE_INT, &n1); - if (parseOperation(sub) != 0) { + if (parse_operation(sub) != 0) { return; } @@ -1292,7 +1292,7 @@ void parse_subset(xmlDocPtr doc, xmlNodePtr cur, ACTIONS* actions) actions->action = str; // Array of Actions bounded by a Ranges } -int uda::client_server::parseDoc(char* docname, ACTIONS* actions) +int uda::client_server::parse_doc(char* docname, ACTIONS* actions) { xmlDocPtr doc; xmlNodePtr cur; @@ -1399,7 +1399,7 @@ void print_dimensions(int ndim, DIMENSION* dims) } } -void uda::client_server::printAction(ACTION action) +void uda::client_server::print_action(ACTION action) { UDA_LOG(UDA_LOG_DEBUG, "Action XML Id : %d\n", action.actionId); UDA_LOG(UDA_LOG_DEBUG, "Action Type : %d\n", action.actionType); @@ -1490,12 +1490,12 @@ void uda::client_server::printAction(ACTION action) } } -void uda::client_server::printActions(ACTIONS actions) +void uda::client_server::print_actions(ACTIONS actions) { UDA_LOG(UDA_LOG_DEBUG, "No. Action Blocks: %d\n", actions.nactions); for (int i = 0; i < actions.nactions; i++) { UDA_LOG(UDA_LOG_DEBUG, "\n\n# %d\n", i); - printAction(actions.action[i]); + print_action(actions.action[i]); } UDA_LOG(UDA_LOG_DEBUG, "\n\n"); } @@ -1586,7 +1586,7 @@ void init_composite(COMPOSITE* act) act->maps = nullptr; } -void uda::client_server::initServerside(SERVERSIDE* act) +void uda::client_server::init_server_side(SERVERSIDE* act) { act->nsubsets = 0; act->nmaps = 0; @@ -1605,7 +1605,7 @@ void init_error_model(ERRORMODEL* act) act->dimensions = nullptr; } -void uda::client_server::initSubset(SUBSET* act) +void uda::client_server::init_subset(SUBSET* act) { for (int i = 0; i < UDA_MAX_DATA_RANK; i++) { act->bound[i] = 0.0; // Subsetting Float Bounds @@ -1626,7 +1626,7 @@ void uda::client_server::initSubset(SUBSET* act) // Initialise an Action Structure -void uda::client_server::initAction(ACTION* act) +void uda::client_server::init_action(ACTION* act) { act->actionType = 0; // Action Range Type act->inRange = 0; // Is this Action Record Applicable to the Current data Request? @@ -1639,13 +1639,13 @@ void uda::client_server::initAction(ACTION* act) // Initialise an Action Array Structure -void uda::client_server::initActions(ACTIONS* act) +void uda::client_server::init_actions(ACTIONS* act) { act->nactions = 0; // Number of Action blocks act->action = nullptr; // Array of Action blocks } -void uda::client_server::freeActions(ACTIONS* actions) +void uda::client_server::free_actions(ACTIONS* actions) { // Free Heap Memory From ACTION Structures void* cptr; @@ -1746,7 +1746,7 @@ void uda::client_server::freeActions(ACTIONS* actions) // Copy an Action Structure and Drop Pointers to ACTION & DIMENSION Structures (ensures a single Heap free later) -void uda::client_server::copyActions(ACTIONS* actions_out, ACTIONS* actions_in) +void uda::client_server::copy_actions(ACTIONS* actions_out, ACTIONS* actions_in) { *actions_out = *actions_in; actions_in->action = nullptr; diff --git a/source/clientserver/parseXML.h b/source/clientserver/parseXML.h index 99ea57ba..015e1f28 100644 --- a/source/clientserver/parseXML.h +++ b/source/clientserver/parseXML.h @@ -144,24 +144,24 @@ typedef struct Actions { #ifndef NOXMLPARSER -int parseDoc(char* docname, ACTIONS* actions); +int parse_doc(char* docname, ACTIONS* actions); #endif -void printAction(ACTION action); +void print_action(ACTION action); -void printActions(ACTIONS actions); +void print_actions(ACTIONS actions); -void initAction(ACTION* act); +void init_action(ACTION* act); -void initActions(ACTIONS* act); +void init_actions(ACTIONS* act); -void freeActions(ACTIONS* actions); +void free_actions(ACTIONS* actions); -void copyActions(ACTIONS* actions_out, ACTIONS* actions_in); +void copy_actions(ACTIONS* actions_out, ACTIONS* actions_in); -void initServerside(SERVERSIDE* act); +void init_server_side(SERVERSIDE* act); -void initSubset(SUBSET* act); +void init_subset(SUBSET* act); } // namespace uda::client_server diff --git a/source/clientserver/printStructs.cpp b/source/clientserver/printStructs.cpp index aea4a944..2a2df2c2 100644 --- a/source/clientserver/printStructs.cpp +++ b/source/clientserver/printStructs.cpp @@ -10,7 +10,7 @@ using namespace uda::client_server; using namespace uda::logging; -void uda::client_server::printRequestData(REQUEST_DATA str) +void uda::client_server::print_request_data(REQUEST_DATA str) { UDA_LOG(UDA_LOG_DEBUG, "request : %d\n", str.request); UDA_LOG(UDA_LOG_DEBUG, "exp_number : %d\n", str.exp_number); @@ -39,17 +39,17 @@ void uda::client_server::printRequestData(REQUEST_DATA str) } } -void uda::client_server::printRequestBlock(REQUEST_BLOCK str) +void uda::client_server::print_request_block(REQUEST_BLOCK str) { UDA_LOG(UDA_LOG_DEBUG, "Client Request Block\n"); UDA_LOG(UDA_LOG_DEBUG, "# requests : %d\n", str.num_requests); for (int i = 0; i < str.num_requests; ++i) { UDA_LOG(UDA_LOG_DEBUG, "number : %d\n", i); - printRequestData(str.requests[0]); + print_request_data(str.requests[0]); } } -void uda::client_server::printClientBlock(CLIENT_BLOCK str) +void uda::client_server::print_client_block(CLIENT_BLOCK str) { UDA_LOG(UDA_LOG_DEBUG, "Client State Block\n"); UDA_LOG(UDA_LOG_DEBUG, "version : %d\n", str.version); @@ -80,7 +80,7 @@ void uda::client_server::printClientBlock(CLIENT_BLOCK str) UDA_LOG(UDA_LOG_DEBUG, "Study DOI : %s\n", str.DOI); } -void uda::client_server::printServerBlock(SERVER_BLOCK str) +void uda::client_server::print_server_block(SERVER_BLOCK str) { UDA_LOG(UDA_LOG_DEBUG, "Server State Block\n"); UDA_LOG(UDA_LOG_DEBUG, "version : %d\n", str.version); @@ -92,17 +92,17 @@ void uda::client_server::printServerBlock(SERVER_BLOCK str) print_error_stack(); } -void uda::client_server::printDataBlockList(DATA_BLOCK_LIST str) +void uda::client_server::print_data_block_list(DATA_BLOCK_LIST str) { UDA_LOG(UDA_LOG_DEBUG, "Data Blocks\n"); UDA_LOG(UDA_LOG_DEBUG, "count : %d\n", str.count); for (int i = 0; i < str.count; ++i) { UDA_LOG(UDA_LOG_DEBUG, "block number : %d\n", i); - printDataBlock(str.data[i]); + print_data_block(str.data[i]); } } -void uda::client_server::printDataBlock(DATA_BLOCK str) +void uda::client_server::print_data_block(DATA_BLOCK str) { UDA_LOG(UDA_LOG_DEBUG, "Data Block Contents\n"); UDA_LOG(UDA_LOG_DEBUG, "handle : %d\n", str.handle); @@ -299,7 +299,7 @@ void uda::client_server::printDataBlock(DATA_BLOCK str) } } -void uda::client_server::printSystemConfig(SYSTEM_CONFIG str) +void uda::client_server::print_system_config(SYSTEM_CONFIG str) { UDA_LOG(UDA_LOG_DEBUG, "System Configuration Record\n"); UDA_LOG(UDA_LOG_DEBUG, "config_id : %d\n", str.config_id); @@ -312,7 +312,7 @@ void uda::client_server::printSystemConfig(SYSTEM_CONFIG str) UDA_LOG(UDA_LOG_DEBUG, "xml_creation: %s\n", str.xml_creation); } -void uda::client_server::printDataSystem(DATA_SYSTEM str) +void uda::client_server::print_data_system(DATA_SYSTEM str) { UDA_LOG(UDA_LOG_DEBUG, "Data System Record\n"); UDA_LOG(UDA_LOG_DEBUG, "system_id : %d\n", str.system_id); @@ -327,7 +327,7 @@ void uda::client_server::printDataSystem(DATA_SYSTEM str) UDA_LOG(UDA_LOG_DEBUG, "xml_creation: %s\n", str.xml_creation); } -void uda::client_server::printDataSource(DATA_SOURCE str) +void uda::client_server::print_data_source(DATA_SOURCE str) { UDA_LOG(UDA_LOG_DEBUG, "Data Source Record\n"); UDA_LOG(UDA_LOG_DEBUG, "source_id : %d\n", str.source_id); @@ -362,7 +362,7 @@ void uda::client_server::printDataSource(DATA_SOURCE str) UDA_LOG(UDA_LOG_DEBUG, "xml_creation : %s\n", str.xml_creation); } -void uda::client_server::printSignal(SIGNAL str) +void uda::client_server::print_signal(SIGNAL str) { UDA_LOG(UDA_LOG_DEBUG, "Signal Record\n"); UDA_LOG(UDA_LOG_DEBUG, "source_id : %d\n", str.source_id); @@ -381,7 +381,7 @@ void uda::client_server::printSignal(SIGNAL str) UDA_LOG(UDA_LOG_DEBUG, "xml_creation : %s\n", str.xml_creation); } -void uda::client_server::printSignalDesc(SIGNAL_DESC str) +void uda::client_server::print_signal_desc(SIGNAL_DESC str) { UDA_LOG(UDA_LOG_DEBUG, "Signal Description Record\n"); UDA_LOG(UDA_LOG_DEBUG, "signal_desc_id: %d\n", str.signal_desc_id); diff --git a/source/clientserver/printStructs.h b/source/clientserver/printStructs.h index 547e40b8..47ca5b01 100644 --- a/source/clientserver/printStructs.h +++ b/source/clientserver/printStructs.h @@ -5,26 +5,26 @@ namespace uda::client_server { -void printRequestData(REQUEST_DATA str); +void print_request_data(REQUEST_DATA str); -void printRequestBlock(REQUEST_BLOCK str); +void print_request_block(REQUEST_BLOCK str); -void printClientBlock(CLIENT_BLOCK str); +void print_client_block(CLIENT_BLOCK str); -void printServerBlock(SERVER_BLOCK str); +void print_server_block(SERVER_BLOCK str); -void printDataBlockList(DATA_BLOCK_LIST str); +void print_data_block_list(DATA_BLOCK_LIST str); -void printDataBlock(DATA_BLOCK str); +void print_data_block(DATA_BLOCK str); -void printSystemConfig(SYSTEM_CONFIG str); +void print_system_config(SYSTEM_CONFIG str); -void printDataSystem(DATA_SYSTEM str); +void print_data_system(DATA_SYSTEM str); -void printDataSource(DATA_SOURCE str); +void print_data_source(DATA_SOURCE str); -void printSignal(SIGNAL str); +void print_signal(SIGNAL str); -void printSignalDesc(SIGNAL_DESC str); +void print_signal_desc(SIGNAL_DESC str); } // namespace uda::client_server diff --git a/source/clientserver/protocol.cpp b/source/clientserver/protocol.cpp index 35988bbe..1aea2e39 100644 --- a/source/clientserver/protocol.cpp +++ b/source/clientserver/protocol.cpp @@ -41,7 +41,7 @@ using namespace uda::client_server; using namespace uda::logging; -void uda::client_server::setSelectParms(int fd, fd_set* rfds, struct timeval* tv, int* server_tot_block_time) +void uda::client_server::set_select_params(int fd, fd_set* rfds, struct timeval* tv, int* server_tot_block_time) { FD_ZERO(rfds); // Initialise the File Descriptor set FD_SET(fd, rfds); // Identify the Socket in the FD set @@ -50,7 +50,7 @@ void uda::client_server::setSelectParms(int fd, fd_set* rfds, struct timeval* tv *server_tot_block_time = 0; } -void uda::client_server::updateSelectParms(int fd, fd_set* rfds, struct timeval* tv, int server_tot_block_time) +void uda::client_server::update_select_params(int fd, fd_set* rfds, struct timeval* tv, int server_tot_block_time) { FD_ZERO(rfds); FD_SET(fd, rfds); @@ -145,8 +145,8 @@ int uda::client_server::protocol(XDR* xdrs, int protocol_id, int direction, int* // direction == XDR_RECEIVE && protocolVersion == 3 Means Client receiving data from a // Version >= 3 Server (Type has to be passed first) - if (protocolVersionTypeTest(protocolVersion, data_block->data_type) || - protocolVersionTypeTest(protocolVersion, data_block->error_type)) { + if (protocol_version_type_test(protocolVersion, data_block->data_type) || + protocol_version_type_test(protocolVersion, data_block->error_type)) { err = UDA_PROTOCOL_ERROR_9999; break; } @@ -179,7 +179,7 @@ int uda::client_server::protocol(XDR* xdrs, int protocol_id, int direction, int* if (data_block->rank > 0) { // Check if there are Dimensional Data to Receive for (unsigned int i = 0; i < data_block->rank; i++) { - initDimBlock(&data_block->dims[i]); + init_dim_block(&data_block->dims[i]); } if (!xdr_data_dim1(xdrs, data_block)) { @@ -190,8 +190,8 @@ int uda::client_server::protocol(XDR* xdrs, int protocol_id, int direction, int* if (protocolVersion < 3) { for (unsigned int i = 0; i < data_block->rank; i++) { auto dim = &data_block->dims[i]; - if (protocolVersionTypeTest(protocolVersion, dim->data_type) || - protocolVersionTypeTest(protocolVersion, dim->error_type)) { + if (protocol_version_type_test(protocolVersion, dim->data_type) || + protocol_version_type_test(protocolVersion, dim->error_type)) { err = UDA_PROTOCOL_ERROR_9999; break; } @@ -235,8 +235,8 @@ int uda::client_server::protocol(XDR* xdrs, int protocol_id, int direction, int* // direction == XDR_SEND && protocolVersion == 3 Means Server sending data to a Version 3 Client // (Type is known) - if (protocolVersionTypeTest(protocolVersion, data_block->data_type) || - protocolVersionTypeTest(protocolVersion, data_block->error_type)) { + if (protocol_version_type_test(protocolVersion, data_block->data_type) || + protocol_version_type_test(protocolVersion, data_block->error_type)) { err = UDA_PROTOCOL_ERROR_9999; break; } @@ -277,8 +277,8 @@ int uda::client_server::protocol(XDR* xdrs, int protocol_id, int direction, int* if (protocolVersion < 3) { for (unsigned int i = 0; i < data_block->rank; i++) { auto dim = &data_block->dims[i]; - if (protocolVersionTypeTest(protocolVersion, dim->data_type) || - protocolVersionTypeTest(protocolVersion, dim->error_type)) { + if (protocol_version_type_test(protocolVersion, dim->data_type) || + protocol_version_type_test(protocolVersion, dim->error_type)) { err = UDA_PROTOCOL_ERROR_9999; break; } @@ -353,7 +353,7 @@ int uda::client_server::protocol(XDR* xdrs, int protocol_id, int direction, int* for (unsigned int i = 0; i < blockCount; i++) { // Fetch multiple put blocks - initPutDataBlock(&put_data); + init_put_data_block(&put_data); if (!xdr_putdata_block1(xdrs, &put_data)) { err = UDA_PROTOCOL_ERROR_61; @@ -361,7 +361,7 @@ int uda::client_server::protocol(XDR* xdrs, int protocol_id, int direction, int* break; } - if (protocolVersionTypeTest(protocolVersion, put_data.data_type)) { + if (protocol_version_type_test(protocolVersion, put_data.data_type)) { err = UDA_PROTOCOL_ERROR_9999; break; } @@ -402,7 +402,7 @@ int uda::client_server::protocol(XDR* xdrs, int protocol_id, int direction, int* break; } - if (protocolVersionTypeTest(protocolVersion, put_data_block_list->putDataBlock[i].data_type)) { + if (protocol_version_type_test(protocolVersion, put_data_block_list->putDataBlock[i].data_type)) { err = UDA_PROTOCOL_ERROR_9999; break; } @@ -838,7 +838,7 @@ int uda::client_server::protocol(XDR* xdrs, int protocol_id, int direction, int* // Hierarchical or Meta Data Structures if (protocol_id > UDA_PROTOCOL_OPAQUE_START && protocol_id < UDA_PROTOCOL_OPAQUE_STOP) { - err = protocolXML(xdrs, protocol_id, direction, token, logmalloclist, userdefinedtypelist, str, + err = protocol_xml(xdrs, protocol_id, direction, token, logmalloclist, userdefinedtypelist, str, protocolVersion, log_struct_list, io_data, private_flags, malloc_source, nullptr); } diff --git a/source/clientserver/protocol.h b/source/clientserver/protocol.h index a6312561..ceaf054a 100644 --- a/source/clientserver/protocol.h +++ b/source/clientserver/protocol.h @@ -61,9 +61,9 @@ namespace uda::client_server struct IoData { }; -void setSelectParms(int fd, fd_set* rfds, struct timeval* tv, int* server_tot_block_time); +void set_select_params(int fd, fd_set* rfds, struct timeval* tv, int* server_tot_block_time); -void updateSelectParms(int fd, fd_set* rfds, struct timeval* tv, int server_tot_block_time); +void update_select_params(int fd, fd_set* rfds, struct timeval* tv, int server_tot_block_time); int protocol(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist, void* str, int protocolVersion, LOGSTRUCTLIST* log_struct_list, diff --git a/source/clientserver/protocol2.cpp b/source/clientserver/protocol2.cpp index 6ddcc8ff..a0e4abd4 100644 --- a/source/clientserver/protocol2.cpp +++ b/source/clientserver/protocol2.cpp @@ -118,7 +118,7 @@ int uda::client_server::protocol2(XDR* xdrs, int protocol_id, int direction, int break; default: if (protocol_id > UDA_PROTOCOL_OPAQUE_START && protocol_id < UDA_PROTOCOL_OPAQUE_STOP) { - err = protocolXML2(xdrs, protocol_id, direction, token, logmalloclist, userdefinedtypelist, str, + err = protocol_xml2(xdrs, protocol_id, direction, token, logmalloclist, userdefinedtypelist, str, protocolVersion, log_struct_list, private_flags, malloc_source); } } @@ -135,14 +135,14 @@ static int handle_security_block(XDR* xdrs, int direction, const void* str) switch (direction) { case XDR_RECEIVE: - if (!xdr_securityBlock1(xdrs, security_block)) { + if (!xdr_security_block1(xdrs, security_block)) { err = UDA_PROTOCOL_ERROR_23; break; } break; case XDR_SEND: - if (!xdr_securityBlock1(xdrs, security_block)) { + if (!xdr_security_block1(xdrs, security_block)) { err = UDA_PROTOCOL_ERROR_23; break; } @@ -180,14 +180,14 @@ static int handle_security_block(XDR* xdrs, int direction, const void* str) switch (direction) { case XDR_RECEIVE: - if (!xdr_securityBlock2(xdrs, security_block)) { + if (!xdr_security_block2(xdrs, security_block)) { err = UDA_PROTOCOL_ERROR_24; break; } break; case XDR_SEND: - if (!xdr_securityBlock2(xdrs, security_block)) { + if (!xdr_security_block2(xdrs, security_block)) { err = UDA_PROTOCOL_ERROR_24; break; } @@ -559,7 +559,7 @@ static int handle_putdata_block_list(XDR* xdrs, int direction, int* token, LOGMA // Fetch multiple put blocks PutDataBlock put_data; - initPutDataBlock(&put_data); + init_put_data_block(&put_data); if (!xdr_putdata_block1(xdrs, &put_data)) { err = UDA_PROTOCOL_ERROR_61; @@ -567,7 +567,7 @@ static int handle_putdata_block_list(XDR* xdrs, int direction, int* token, LOGMA break; } - if (protocolVersionTypeTest(protocolVersion, put_data.data_type)) { + if (protocol_version_type_test(protocolVersion, put_data.data_type)) { err = UDA_PROTOCOL_ERROR_9999; break; } @@ -597,13 +597,13 @@ static int handle_putdata_block_list(XDR* xdrs, int direction, int* token, LOGMA // *** Add to malloclog and test to ensure it is freed after use *** - initDataBlock(data_block); + init_data_block(data_block); data_block->opaque_type = UDA_OPAQUE_TYPE_STRUCTURES; data_block->data_n = (int)put_data.count; // This number (also rank and shape) data_block->opaque_block = put_data.opaque_block; // User Defined Type int protocol_id = UDA_PROTOCOL_STRUCTURES; - if ((err = protocolXML2Put(xdrs, protocol_id, direction, token, logmalloclist, userdefinedtypelist, + if ((err = protocol_xml2_put(xdrs, protocol_id, direction, token, logmalloclist, userdefinedtypelist, data_block, protocolVersion, log_struct_list, private_flags, malloc_source)) != 0) { // Fetch Structured data @@ -636,7 +636,7 @@ static int handle_putdata_block_list(XDR* xdrs, int direction, int* token, LOGMA break; } - if (protocolVersionTypeTest(protocolVersion, putDataBlockList->putDataBlock[i].data_type)) { + if (protocol_version_type_test(protocolVersion, putDataBlockList->putDataBlock[i].data_type)) { err = UDA_PROTOCOL_ERROR_9999; break; } @@ -659,7 +659,7 @@ static int handle_putdata_block_list(XDR* xdrs, int direction, int* token, LOGMA // *** putdata.opaque_count is not used or needed - count is sufficient DATA_BLOCK data_block; - initDataBlock(&data_block); + init_data_block(&data_block); data_block.opaque_type = UDA_OPAQUE_TYPE_STRUCTURES; data_block.data_n = (int)putDataBlockList->putDataBlock[i].count; // This number (also rank and shape) @@ -668,7 +668,7 @@ static int handle_putdata_block_list(XDR* xdrs, int direction, int* token, LOGMA (char*)putDataBlockList->putDataBlock[i].data; // Compact memory block with structures int protocol_id = UDA_PROTOCOL_STRUCTURES; - if ((err = protocolXML2Put(xdrs, protocol_id, direction, token, logmalloclist, userdefinedtypelist, + if ((err = protocol_xml2_put(xdrs, protocol_id, direction, token, logmalloclist, userdefinedtypelist, &data_block, protocolVersion, log_struct_list, private_flags, malloc_source)) != 0) { // Send Structured data @@ -704,8 +704,8 @@ static int handle_data_block(XDR* xdrs, int direction, const void* str, int prot // direction == XDR_RECEIVE && protocolVersion == 3 Means Client receiving data from a // Version >= 3 Server (Type has to be passed first) - if (protocolVersionTypeTest(protocolVersion, data_block->data_type) || - protocolVersionTypeTest(protocolVersion, data_block->error_type)) { + if (protocol_version_type_test(protocolVersion, data_block->data_type) || + protocol_version_type_test(protocolVersion, data_block->error_type)) { err = UDA_PROTOCOL_ERROR_9999; break; } @@ -739,7 +739,7 @@ static int handle_data_block(XDR* xdrs, int direction, const void* str, int prot if (data_block->rank > 0) { // Check if there are Dimensional Data to Receive for (unsigned int i = 0; i < data_block->rank; i++) { - initDimBlock(&data_block->dims[i]); + init_dim_block(&data_block->dims[i]); } if (!xdr_data_dim1(xdrs, data_block)) { @@ -750,8 +750,8 @@ static int handle_data_block(XDR* xdrs, int direction, const void* str, int prot if (protocolVersion < 3) { for (unsigned int i = 0; i < data_block->rank; i++) { DIMS* dim = &data_block->dims[i]; - if (protocolVersionTypeTest(protocolVersion, dim->data_type) || - protocolVersionTypeTest(protocolVersion, dim->error_type)) { + if (protocol_version_type_test(protocolVersion, dim->data_type) || + protocol_version_type_test(protocolVersion, dim->error_type)) { err = UDA_PROTOCOL_ERROR_9999; break; } @@ -796,10 +796,10 @@ static int handle_data_block(XDR* xdrs, int direction, const void* str, int prot // known) UDA_LOG(UDA_LOG_DEBUG, "#1 PROTOCOL: Send/Receive Data Block\n"); - printDataBlock(*data_block); + print_data_block(*data_block); - if (protocolVersionTypeTest(protocolVersion, data_block->data_type) || - protocolVersionTypeTest(protocolVersion, data_block->error_type)) { + if (protocol_version_type_test(protocolVersion, data_block->data_type) || + protocol_version_type_test(protocolVersion, data_block->error_type)) { err = UDA_PROTOCOL_ERROR_9999; UDA_LOG(UDA_LOG_DEBUG, "PROTOCOL: protocolVersionTypeTest Failed\n"); @@ -840,8 +840,8 @@ static int handle_data_block(XDR* xdrs, int direction, const void* str, int prot if (protocolVersion < 3) { for (unsigned int i = 0; i < data_block->rank; i++) { DIMS* dim = &data_block->dims[i]; - if (protocolVersionTypeTest(protocolVersion, dim->data_type) || - protocolVersionTypeTest(protocolVersion, dim->error_type)) { + if (protocol_version_type_test(protocolVersion, dim->data_type) || + protocol_version_type_test(protocolVersion, dim->error_type)) { err = UDA_PROTOCOL_ERROR_9999; break; } @@ -901,7 +901,7 @@ static int handle_data_block_list(XDR* xdrs, int direction, const void* str, int data_block_list->data = (DATA_BLOCK*)malloc(data_block_list->count * sizeof(DATA_BLOCK)); for (int i = 0; i < data_block_list->count; ++i) { DATA_BLOCK* data_block = &data_block_list->data[i]; - initDataBlock(data_block); + init_data_block(data_block); err = handle_data_block(xdrs, XDR_RECEIVE, data_block, protocolVersion); if (err != 0) { err = UDA_PROTOCOL_ERROR_2; @@ -955,7 +955,7 @@ static int handle_request_block(XDR* xdrs, int direction, const void* str, int p } request_block->requests = (REQUEST_DATA*)malloc(request_block->num_requests * sizeof(REQUEST_DATA)); for (int i = 0; i < request_block->num_requests; ++i) { - initRequestData(&request_block->requests[i]); + init_request_data(&request_block->requests[i]); if (!xdr_request_data(xdrs, &request_block->requests[i], protocolVersion)) { err = UDA_PROTOCOL_ERROR_2; break; diff --git a/source/clientserver/protocolXML.cpp b/source/clientserver/protocolXML.cpp index 2834c8f0..29be3325 100644 --- a/source/clientserver/protocolXML.cpp +++ b/source/clientserver/protocolXML.cpp @@ -74,7 +74,7 @@ using namespace uda::client_server; using namespace uda::logging; -int uda::client_server::protocolXML(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOCLIST* logmalloclist, +int uda::client_server::protocol_xml(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist, void* str, int protocolVersion, LOGSTRUCTLIST* log_struct_list, IoData* io_data, unsigned int private_flags, int malloc_source, CreateXDRStreams create_xdr_streams) @@ -220,12 +220,12 @@ int uda::client_server::protocolXML(XDR* xdrs, int protocol_id, int direction, i } #endif // send the full set of known named structures - rc = rc && xdr_userdefinedtypelist(xdrs, userdefinedtypelist, xdr_stdio_flag); + rc = rc && xdr_user_defined_type_list(xdrs, userdefinedtypelist, xdr_stdio_flag); UDA_LOG(UDA_LOG_DEBUG, "protocolXML: Structure Definitions sent: rc = %d\n", rc); // send the Data - rc = rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, u, (void**)data, + rc = rc && xdr_user_defined_type_data(xdrs, logmalloclist, userdefinedtypelist, u, (void**)data, protocolVersion, xdr_stdio_flag, log_struct_list, malloc_source); UDA_LOG(UDA_LOG_DEBUG, "protocolXML: Data sent: rc = %d\n", rc); @@ -258,7 +258,7 @@ int uda::client_server::protocolXML(XDR* xdrs, int protocol_id, int direction, i UDA_LOG(UDA_LOG_DEBUG, "protocolXML: sending temporary XDR file\n"); - err = sendXDRFile(xdrs, temp_file.c_str()); // Read and send + err = send_xdr_file(xdrs, temp_file.c_str()); // Read and send remove(temp_file.c_str()); if (err != 0) { @@ -347,7 +347,7 @@ int uda::client_server::protocolXML(XDR* xdrs, int protocol_id, int direction, i break; } - err = receiveXDRFile(xdrs, tempFile); // Receive and write the file + err = receive_xdr_file(xdrs, tempFile); // Receive and write the file char* fname = (char*)malloc(sizeof(char) * (strlen(tempFile) + 1)); strcpy(fname, tempFile); @@ -395,7 +395,7 @@ int uda::client_server::protocolXML(XDR* xdrs, int protocol_id, int direction, i break; } - err = receiveXDRFile(xdrs, tempFile); // Receive and write + err = receive_xdr_file(xdrs, tempFile); // Receive and write // Create input xdr file stream @@ -413,7 +413,7 @@ int uda::client_server::protocolXML(XDR* xdrs, int protocol_id, int direction, i } #endif // !FATCLIENT // receive the full set of known named structures - rc = rc && xdr_userdefinedtypelist(xdrs, userdefinedtypelist, xdr_stdio_flag); + rc = rc && xdr_user_defined_type_list(xdrs, userdefinedtypelist, xdr_stdio_flag); UDA_LOG(UDA_LOG_DEBUG, "protocolXML: xdr_userdefinedtypelist #B\n"); @@ -426,7 +426,7 @@ int uda::client_server::protocolXML(XDR* xdrs, int protocol_id, int direction, i UDA_LOG(UDA_LOG_DEBUG, "protocolXML: udaXDRUserDefinedTypeData #A\n"); initUserDefinedType(udt_received); - rc = rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received, &data, + rc = rc && xdr_user_defined_type_data(xdrs, logmalloclist, userdefinedtypelist, udt_received, &data, protocolVersion, xdr_stdio_flag, log_struct_list, malloc_source); // receive the Data @@ -509,7 +509,7 @@ int uda::client_server::protocolXML(XDR* xdrs, int protocol_id, int direction, i if (xdrs->x_op == XDR_ENCODE) { UDA_LOG(UDA_LOG_DEBUG, "protocolXML: Forwarding XDR File %s\n", (char*)data_block->opaque_block); - err = sendXDRFile(xdrs, (char*)data_block->opaque_block); // Forward the xdr file + err = send_xdr_file(xdrs, (char*)data_block->opaque_block); // Forward the xdr file } else { UDA_LOG(UDA_LOG_DEBUG, "protocolXML: Receiving forwarded XDR File\n"); @@ -531,7 +531,7 @@ int uda::client_server::protocolXML(XDR* xdrs, int protocol_id, int direction, i break; } - err = receiveXDRFile(xdrs, tempFile); // Receive and write the file + err = receive_xdr_file(xdrs, tempFile); // Receive and write the file if (private_flags & PRIVATEFLAG_XDRFILE) { // Forward the file (option 3) again @@ -573,7 +573,7 @@ int uda::client_server::protocolXML(XDR* xdrs, int protocol_id, int direction, i xdrs = &XDRInput; // receive the full set of known named structures - rc = xdr_userdefinedtypelist(xdrs, userdefinedtypelist, xdr_stdio_flag); + rc = xdr_user_defined_type_list(xdrs, userdefinedtypelist, xdr_stdio_flag); if (!rc) { err = 999; @@ -584,7 +584,7 @@ int uda::client_server::protocolXML(XDR* xdrs, int protocol_id, int direction, i initUserDefinedType(udt_received); - rc = rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received, + rc = rc && xdr_user_defined_type_data(xdrs, logmalloclist, userdefinedtypelist, udt_received, &data, protocolVersion, xdr_stdio_flag, log_struct_list, malloc_source); // receive the Data diff --git a/source/clientserver/protocolXML.h b/source/clientserver/protocolXML.h index f1e7a2ec..cdefcb55 100644 --- a/source/clientserver/protocolXML.h +++ b/source/clientserver/protocolXML.h @@ -17,7 +17,7 @@ struct IoData; using CreateXDRStreams = std::pair (*)(uda::client_server::IoData*); -int protocolXML(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOCLIST* logmalloclist, +int protocol_xml(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist, void* str, int protocolVersion, LOGSTRUCTLIST* log_struct_list, IoData* io_data, unsigned int private_flags, int malloc_source, CreateXDRStreams create_xdr_streams); diff --git a/source/clientserver/protocolXML2.cpp b/source/clientserver/protocolXML2.cpp index 3dc0e4f0..aa8dd665 100644 --- a/source/clientserver/protocolXML2.cpp +++ b/source/clientserver/protocolXML2.cpp @@ -96,7 +96,7 @@ int sha1File(char* name, FILE* fh, unsigned char* md); #define MAX_ELEMENT_SHA1 20 -int uda::client_server::protocolXML2(XDR* xdrs, int protocol_id, int direction, int* token, +int uda::client_server::protocol_xml2(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist, void* str, int protocolVersion, LOGSTRUCTLIST* log_struct_list, unsigned int private_flags, int malloc_source) @@ -312,7 +312,7 @@ int uda::client_server::protocolXML2(XDR* xdrs, int protocol_id, int direction, // Send the data // send the full set of known named structures - rc = rc && xdr_userdefinedtypelist(xdrs, userdefinedtypelist, xdr_stdio_flag); + rc = rc && xdr_user_defined_type_list(xdrs, userdefinedtypelist, xdr_stdio_flag); UDA_LOG(UDA_LOG_DEBUG, "Structure Definitions sent: rc = %d\n", rc); @@ -331,7 +331,7 @@ int uda::client_server::protocolXML2(XDR* xdrs, int protocol_id, int direction, break; } - rc = rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, u, (void**)data, + rc = rc && xdr_user_defined_type_data(xdrs, logmalloclist, userdefinedtypelist, u, (void**)data, protocolVersion, xdr_stdio_flag, log_struct_list, malloc_source); // send the Data @@ -372,7 +372,7 @@ int uda::client_server::protocolXML2(XDR* xdrs, int protocol_id, int direction, UDA_LOG(UDA_LOG_DEBUG, "sending temporary XDR file\n"); - err = sendXDRFile(xdrs, temp_file.c_str()); // Read and send + err = send_xdr_file(xdrs, temp_file.c_str()); // Read and send remove(temp_file.c_str()); @@ -549,7 +549,7 @@ int uda::client_server::protocolXML2(XDR* xdrs, int protocol_id, int direction, break; } - err = receiveXDRFile(xdrs, temp_file.c_str()); // Receive and write the file + err = receive_xdr_file(xdrs, temp_file.c_str()); // Receive and write the file if (err != 0) { break; @@ -641,7 +641,7 @@ int uda::client_server::protocolXML2(XDR* xdrs, int protocol_id, int direction, break; } - err = receiveXDRFile(xdrs, temp_file.c_str()); // Receive and write the file + err = receive_xdr_file(xdrs, temp_file.c_str()); // Receive and write the file // Create input xdr file stream @@ -692,7 +692,7 @@ int uda::client_server::protocolXML2(XDR* xdrs, int protocol_id, int direction, #endif // receive the full set of known named structures - rc = rc && xdr_userdefinedtypelist(xdrs, userdefinedtypelist, xdr_stdio_flag); + rc = rc && xdr_user_defined_type_list(xdrs, userdefinedtypelist, xdr_stdio_flag); UDA_LOG(UDA_LOG_DEBUG, "xdr_userdefinedtypelist #B\n"); @@ -714,7 +714,7 @@ int uda::client_server::protocolXML2(XDR* xdrs, int protocol_id, int direction, UDA_LOG(UDA_LOG_DEBUG, "udaXDRUserDefinedTypeData #A\n"); initUserDefinedType(udt_received); - rc = rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received, &data, + rc = rc && xdr_user_defined_type_data(xdrs, logmalloclist, userdefinedtypelist, udt_received, &data, protocolVersion, xdr_stdio_flag, log_struct_list, malloc_source); // receive the Data @@ -892,7 +892,7 @@ int uda::client_server::protocolXML2(XDR* xdrs, int protocol_id, int direction, xdrs = &XDRInput; // Switch from TCP stream to memory based object // receive the full set of known named structures - rc = xdr_userdefinedtypelist(xdrs, userdefinedtypelist, xdr_stdio_flag); + rc = xdr_user_defined_type_list(xdrs, userdefinedtypelist, xdr_stdio_flag); if (!rc) { err = 999; @@ -908,7 +908,7 @@ int uda::client_server::protocolXML2(XDR* xdrs, int protocol_id, int direction, initUserDefinedType(udt_received); - rc = rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received, + rc = rc && xdr_user_defined_type_data(xdrs, logmalloclist, userdefinedtypelist, udt_received, &data, protocolVersion, xdr_stdio_flag, log_struct_list, malloc_source); // receive the Data @@ -966,7 +966,7 @@ int uda::client_server::protocolXML2(XDR* xdrs, int protocol_id, int direction, } else if (data_block->opaque_type == UDA_OPAQUE_TYPE_XDRFILE) { if (xdrs->x_op == XDR_ENCODE) { UDA_LOG(UDA_LOG_DEBUG, "Forwarding XDR File %s\n", (char*)data_block->opaque_block); - err = sendXDRFile(xdrs, (char*)data_block->opaque_block); // Forward the xdr file + err = send_xdr_file(xdrs, (char*)data_block->opaque_block); // Forward the xdr file } else { UDA_LOG(UDA_LOG_DEBUG, "Receiving forwarded XDR File\n"); @@ -987,7 +987,7 @@ int uda::client_server::protocolXML2(XDR* xdrs, int protocol_id, int direction, break; } - err = receiveXDRFile(xdrs, temp_file.c_str()); // Receive and write the file + err = receive_xdr_file(xdrs, temp_file.c_str()); // Receive and write the file if (private_flags & PRIVATEFLAG_XDRFILE) { // Forward the file (option 3) again @@ -1025,7 +1025,7 @@ int uda::client_server::protocolXML2(XDR* xdrs, int protocol_id, int direction, xdrstdio_create(&XDRInput, xdrfile, XDR_DECODE); xdrs = &XDRInput; - rc = xdr_userdefinedtypelist(xdrs, userdefinedtypelist, xdr_stdio_flag); + rc = xdr_user_defined_type_list(xdrs, userdefinedtypelist, xdr_stdio_flag); // receive the full set of known named structures if (!rc) { @@ -1042,7 +1042,7 @@ int uda::client_server::protocolXML2(XDR* xdrs, int protocol_id, int direction, initUserDefinedType(udt_received); - rc = rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received, + rc = rc && xdr_user_defined_type_data(xdrs, logmalloclist, userdefinedtypelist, udt_received, &data, protocolVersion, xdr_stdio_flag, log_struct_list, malloc_source); // receive the Data @@ -1214,7 +1214,7 @@ int unpackXDRFile(LOGMALLOCLIST* logmalloclist, XDR* xdrs, unsigned char* filena // Unpack the associated set of named structures - rc = xdr_userdefinedtypelist(xdrs, userdefinedtypelist, xdr_stdio_flag); + rc = xdr_user_defined_type_list(xdrs, userdefinedtypelist, xdr_stdio_flag); if (!rc) { err = 999; @@ -1231,7 +1231,7 @@ int unpackXDRFile(LOGMALLOCLIST* logmalloclist, XDR* xdrs, unsigned char* filena initUserDefinedType(udt_received); - rc = rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received, &data, + rc = rc && xdr_user_defined_type_data(xdrs, logmalloclist, userdefinedtypelist, udt_received, &data, protocolVersion, xdr_stdio_flag, log_struct_list, malloc_source); if (!rc) { @@ -1324,7 +1324,7 @@ int unpackXDRObject(LOGMALLOCLIST* logmalloclist, XDR* xdrs, unsigned char* obje // Unpack the associated set of named structures - rc = xdr_userdefinedtypelist(xdrs, userdefinedtypelist, xdr_stdio_flag); + rc = xdr_user_defined_type_list(xdrs, userdefinedtypelist, xdr_stdio_flag); if (!rc) { err = 999; @@ -1341,7 +1341,7 @@ int unpackXDRObject(LOGMALLOCLIST* logmalloclist, XDR* xdrs, unsigned char* obje initUserDefinedType(udt_received); - rc = rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received, &data, + rc = rc && xdr_user_defined_type_data(xdrs, logmalloclist, userdefinedtypelist, udt_received, &data, protocolVersion, xdr_stdio_flag, log_struct_list, malloc_source); if (!rc) { diff --git a/source/clientserver/protocolXML2.h b/source/clientserver/protocolXML2.h index 93f883bb..8365037c 100644 --- a/source/clientserver/protocolXML2.h +++ b/source/clientserver/protocolXML2.h @@ -12,14 +12,14 @@ namespace uda::client_server { -int protocolXML2(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOCLIST* logmalloclist, +int protocol_xml2(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist, void* str, int protocolVersion, LOGSTRUCTLIST* log_struct_list, unsigned int private_flags, int malloc_source); -int xdrUserDefinedTypeData(XDR* xdrs, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist, +int xdr_user_defined_type_data(XDR* xdrs, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist, USERDEFINEDTYPE* userdefinedtype, void** data, int protocolVersion, bool xdr_stdio_flag, LOGSTRUCTLIST* log_struct_list, int malloc_source); -bool_t xdr_userdefinedtypelist(XDR* xdrs, USERDEFINEDTYPELIST* str, bool xdr_stdio_flag); +bool_t xdr_user_defined_type_list(XDR* xdrs, USERDEFINEDTYPELIST* str, bool xdr_stdio_flag); } // namespace uda::client_server diff --git a/source/clientserver/protocolXML2Put.cpp b/source/clientserver/protocolXML2Put.cpp index c5e7a7eb..b3d91d25 100644 --- a/source/clientserver/protocolXML2Put.cpp +++ b/source/clientserver/protocolXML2Put.cpp @@ -21,7 +21,7 @@ using namespace uda::logging; static int recursiveDepthPut = 0; // Keep count of recursive calls -int uda::client_server::xdrUserDefinedDataPut(XDR* xdrs, LOGMALLOCLIST* logmalloclist, LOGSTRUCTLIST* log_struct_list, +int uda::client_server::xdr_user_defined_data_put(XDR* xdrs, LOGMALLOCLIST* logmalloclist, LOGSTRUCTLIST* log_struct_list, USERDEFINEDTYPELIST* userdefinedtypelist, USERDEFINEDTYPE* userdefinedtype, void** data, int datacount, int structRank, int* structShape, int index, NTREE** NTree, @@ -899,7 +899,7 @@ int uda::client_server::xdrUserDefinedDataPut(XDR* xdrs, LOGMALLOCLIST* logmallo size = sizeof(char); type = userdefinedtype->compoundfield[j].type; } - convertNonPrintable2(d); // Remove obvious garbage (bug - non initialised...?) + convert_non_printable2(d); // Remove obvious garbage (bug - non initialised...?) } } } @@ -932,7 +932,7 @@ int uda::client_server::xdrUserDefinedDataPut(XDR* xdrs, LOGMALLOCLIST* logmallo d[count - 1] = '\0'; // Terminate } } - rc = rc && WrapXDRString(xdrs, d, count); + rc = rc && wrap_xdr_string(xdrs, d, count); isSOAP = 0; } else { rc = rc && xdr_vector(xdrs, d, count, sizeof(char), (xdrproc_t)xdr_char); @@ -1014,12 +1014,12 @@ int uda::client_server::xdrUserDefinedDataPut(XDR* xdrs, LOGMALLOCLIST* logmallo } if (count > 0) { - rc = rc && WrapXDRString(xdrs, d, count); + rc = rc && wrap_xdr_string(xdrs, d, count); } } else { if (userdefinedtype->compoundfield[j].rank == 1) { // Element is a Regular String - rc = rc && WrapXDRString(xdrs, (char*)p, userdefinedtype->compoundfield[j].count); + rc = rc && wrap_xdr_string(xdrs, (char*)p, userdefinedtype->compoundfield[j].count); } } break; @@ -1058,7 +1058,7 @@ int uda::client_server::xdrUserDefinedDataPut(XDR* xdrs, LOGMALLOCLIST* logmallo if (count > 0) { d = (char*)malloc(count * sizeof(char)); udaAddMalloc(logmalloclist, (void*)d, count, sizeof(char), "char"); - rc = rc && WrapXDRString(xdrs, d, count); + rc = rc && wrap_xdr_string(xdrs, d, count); str[istr] = d; } } @@ -1088,7 +1088,7 @@ int uda::client_server::xdrUserDefinedDataPut(XDR* xdrs, LOGMALLOCLIST* logmallo rc = rc && xdr_int(xdrs, &count); strarr[istr] = (char*)malloc(count * sizeof(char)); udaAddMalloc(logmalloclist, (void*)strarr[istr], count, sizeof(char), "STRING"); - rc = rc && WrapXDRString(xdrs, strarr[istr], count); + rc = rc && wrap_xdr_string(xdrs, strarr[istr], count); if (rank == 0 && nstr == 1) { *p = (VOIDTYPE)strarr[0]; } @@ -1108,7 +1108,7 @@ int uda::client_server::xdrUserDefinedDataPut(XDR* xdrs, LOGMALLOCLIST* logmallo rc = rc && xdr_int(xdrs, &count); if (count > 0) { d = str[istr]; - rc = rc && WrapXDRString(xdrs, d, count); + rc = rc && wrap_xdr_string(xdrs, d, count); } } } @@ -1151,14 +1151,14 @@ int uda::client_server::xdrUserDefinedDataPut(XDR* xdrs, LOGMALLOCLIST* logmallo if (rank == 0) { rc = rc && xdr_int(xdrs, &size); // This length of string - rc = rc && WrapXDRString(xdrs, d, size); + rc = rc && wrap_xdr_string(xdrs, d, size); } else { strarr = (char**)d; for (istr = 0; istr < nstr; istr++) { // Send individual String lengths, then the string itself count = (int)strlen(strarr[istr]) + 1; rc = rc && xdr_int(xdrs, &count); - rc = rc && WrapXDRString(xdrs, strarr[istr], count); + rc = rc && wrap_xdr_string(xdrs, strarr[istr], count); } } } @@ -1167,7 +1167,7 @@ int uda::client_server::xdrUserDefinedDataPut(XDR* xdrs, LOGMALLOCLIST* logmallo if (userdefinedtype->compoundfield[j].rank == 1 && strcmp(userdefinedtype->compoundfield[j].type, "STRING *") != 0) { // Element is a Single String - rc = rc && WrapXDRString(xdrs, (char*)p, userdefinedtype->compoundfield[j].count); + rc = rc && wrap_xdr_string(xdrs, (char*)p, userdefinedtype->compoundfield[j].count); } else { // Element is a String Array: Treat as Rank 1 array if (userdefinedtype->compoundfield[j].rank == 1 && STR_EQUALS(userdefinedtype->compoundfield[j].type, "STRING *")) { @@ -1179,7 +1179,7 @@ int uda::client_server::xdrUserDefinedDataPut(XDR* xdrs, LOGMALLOCLIST* logmallo if (count > 0) { d = (char*)malloc(count * sizeof(char)); udaAddMalloc(logmalloclist, (void*)d, count, sizeof(char), "STRING"); - rc = rc && WrapXDRString(xdrs, d, count); + rc = rc && wrap_xdr_string(xdrs, d, count); str[istr] = d; } // Save pointer: data will be written here } else { @@ -1187,7 +1187,7 @@ int uda::client_server::xdrUserDefinedDataPut(XDR* xdrs, LOGMALLOCLIST* logmallo rc = rc && xdr_int(xdrs, &count); if (count > 0) { d = (char*)str[istr]; - rc = rc && WrapXDRString(xdrs, d, count); + rc = rc && wrap_xdr_string(xdrs, d, count); } } } @@ -1200,7 +1200,7 @@ int uda::client_server::xdrUserDefinedDataPut(XDR* xdrs, LOGMALLOCLIST* logmallo .shape[istr]; // Number of strings to send/receive } for (istr = 0; istr < nstr; istr++) { // send/receive individual strings - rc = rc && WrapXDRString(xdrs, &str[istr * stride], + rc = rc && wrap_xdr_string(xdrs, &str[istr * stride], userdefinedtype->compoundfield[j].count); } } @@ -1238,7 +1238,7 @@ int uda::client_server::xdrUserDefinedDataPut(XDR* xdrs, LOGMALLOCLIST* logmallo break; } } - rc = rc && WrapXDRString(xdrs, d, count); + rc = rc && wrap_xdr_string(xdrs, d, count); } } break; @@ -1316,10 +1316,10 @@ int uda::client_server::xdrUserDefinedDataPut(XDR* xdrs, LOGMALLOCLIST* logmallo rc = rc && xdr_int(xdrs, &size); // Structure Size if (xdrs->x_op == XDR_DECODE) { - rc = rc && WrapXDRString(xdrs, (char*)rudtype, MAXELEMENTNAME - 1); + rc = rc && wrap_xdr_string(xdrs, (char*)rudtype, MAXELEMENTNAME - 1); type = rudtype; } else { - rc = rc && WrapXDRString(xdrs, (char*)type, MAXELEMENTNAME - 1); + rc = rc && wrap_xdr_string(xdrs, (char*)type, MAXELEMENTNAME - 1); } if (protocolVersion >= 7) { @@ -1485,11 +1485,11 @@ int udaXDRUserDefinedTypeDataPut(XDR* xdrs, LOGMALLOCLIST* logmalloclist, USERDE NTREE* dataNTree = nullptr; - rc = rc && xdr_userdefinedtype(xdrs, userdefinedtypelist, + rc = rc && xdr_user_defined_type(xdrs, userdefinedtypelist, userdefinedtype); // User Defined Type Definitions rc = rc && - xdrUserDefinedDataPut(xdrs, logmalloclist, log_struct_list, userdefinedtypelist, userdefinedtype, data, 1, + xdr_user_defined_data_put(xdrs, logmalloclist, log_struct_list, userdefinedtypelist, userdefinedtype, data, 1, 0, nullptr, 0, &dataNTree, protocolVersion, malloc_source); // Data within Structures udaSetFullNTree(dataNTree); // Copy to Global @@ -1501,11 +1501,11 @@ int udaXDRUserDefinedTypeDataPut(XDR* xdrs, LOGMALLOCLIST* logmalloclist, USERDE return 0; } - rc = xdr_userdefinedtype(xdrs, userdefinedtypelist, + rc = xdr_user_defined_type(xdrs, userdefinedtypelist, userdefinedtype); // User Defined Type Definitions rc = rc && - xdrUserDefinedDataPut(xdrs, logmalloclist, log_struct_list, userdefinedtypelist, userdefinedtype, data, 1, + xdr_user_defined_data_put(xdrs, logmalloclist, log_struct_list, userdefinedtypelist, userdefinedtype, data, 1, 0, nullptr, 0, nullptr, protocolVersion, malloc_source); // Data within Structures /* if(!XDRstdioFlag) rc = rc && xdrrec_endofrecord(xdrs, 1); @@ -1517,7 +1517,7 @@ int udaXDRUserDefinedTypeDataPut(XDR* xdrs, LOGMALLOCLIST* logmalloclist, USERDE return rc; } -bool_t uda::client_server::xdr_userdefinedtypelistPut(XDR* xdrs, USERDEFINEDTYPELIST* str) +bool_t uda::client_server::xdr_user_defined_type_list_put(XDR* xdrs, USERDEFINEDTYPELIST* str) { // Send/Receive the list of userdefined types @@ -1540,13 +1540,13 @@ bool_t uda::client_server::xdr_userdefinedtypelistPut(XDR* xdrs, USERDEFINEDTYPE } for (int i = 0; i < str->listCount; i++) { - rc = rc && xdr_userdefinedtype(xdrs, str, &str->userdefinedtype[i]); + rc = rc && xdr_user_defined_type(xdrs, str, &str->userdefinedtype[i]); } return rc; } -int uda::client_server::protocolXML2Put(XDR* xdrs, int protocol_id, int direction, int* token, +int uda::client_server::protocol_xml2_put(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist, void* str, int protocolVersion, LOGSTRUCTLIST* log_struct_list, unsigned int private_flags, int malloc_source) @@ -1612,7 +1612,7 @@ int uda::client_server::protocolXML2Put(XDR* xdrs, int protocol_id, int directio // error - unknown root cause rc = rc && - xdr_userdefinedtypelistPut(xdrs, + xdr_user_defined_type_list_put(xdrs, userdefinedtypelist); // send the full set of known named structures UDA_LOG(UDA_LOG_DEBUG, "Structure Definitions sent: rc = %d\n", rc); @@ -1667,7 +1667,7 @@ int uda::client_server::protocolXML2Put(XDR* xdrs, int protocol_id, int directio initUserDefinedTypeList(userdefinedtypelist); - rc = rc && xdr_userdefinedtypelistPut( + rc = rc && xdr_user_defined_type_list_put( xdrs, userdefinedtypelist); // receive the full set of known named structures @@ -1685,7 +1685,7 @@ int uda::client_server::protocolXML2Put(XDR* xdrs, int protocol_id, int directio rc = rc && udaXDRUserDefinedTypeDataPut(xdrs, logmalloclist, userdefinedtypelist, udt_received, &data, protocolVersion, log_struct_list, malloc_source); // receive the Data - // rc = rc && xdrUserDefinedTypeData(xdrs, udt_received, &data); // receive the Data + // rc = rc && xdr_user_defined_type_data(xdrs, udt_received, &data); // receive the Data UDA_LOG(UDA_LOG_DEBUG, "udaXDRUserDefinedTypeData received\n"); diff --git a/source/clientserver/protocolXML2Put.h b/source/clientserver/protocolXML2Put.h index a6e71d82..fa17f809 100644 --- a/source/clientserver/protocolXML2Put.h +++ b/source/clientserver/protocolXML2Put.h @@ -8,18 +8,18 @@ namespace uda::client_server { -int xdrUserDefinedDataPut(XDR* xdrs, LOGMALLOCLIST* logmalloclist, LOGSTRUCTLIST* log_struct_list, +int xdr_user_defined_data_put(XDR* xdrs, LOGMALLOCLIST* logmalloclist, LOGSTRUCTLIST* log_struct_list, USERDEFINEDTYPELIST* userdefinedtypelist, USERDEFINEDTYPE* userdefinedtype, void** data, int datacount, int structRank, int* structShape, int index, NTREE** NTree, int protocolVersion, int malloc_source); // Send/Receive Array of Structures -bool_t xdr_userdefinedtype(XDR* xdrs, USERDEFINEDTYPELIST* userdefinedtypelist, USERDEFINEDTYPE* str); +bool_t xdr_user_defined_type(XDR* xdrs, USERDEFINEDTYPELIST* userdefinedtypelist, USERDEFINEDTYPE* str); -bool_t xdr_userdefinedtypelistPut(XDR* xdrs, USERDEFINEDTYPELIST* str); +bool_t xdr_user_defined_type_list_put(XDR* xdrs, USERDEFINEDTYPELIST* str); -int protocolXML2Put(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOCLIST* logmalloclist, +int protocol_xml2_put(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist, void* str, int protocolVersion, LOGSTRUCTLIST* log_struct_list, unsigned int private_flags, int malloc_source); diff --git a/source/clientserver/readXDRFile.cpp b/source/clientserver/readXDRFile.cpp index 6a0bc5bf..cd503c4b 100644 --- a/source/clientserver/readXDRFile.cpp +++ b/source/clientserver/readXDRFile.cpp @@ -15,7 +15,7 @@ using namespace uda::client_server; using namespace uda::logging; -int uda::client_server::sendXDRFile(XDR* xdrs, const char* xdrfile) +int uda::client_server::send_xdr_file(XDR* xdrs, const char* xdrfile) { int err = 0, rc = 1, nchar, bufsize, count; @@ -103,7 +103,7 @@ int uda::client_server::sendXDRFile(XDR* xdrs, const char* xdrfile) return err; } -int uda::client_server::receiveXDRFile(XDR* xdrs, const char* xdrfile) +int uda::client_server::receive_xdr_file(XDR* xdrs, const char* xdrfile) { int err = 0, rc = 1, nchar, bufsize, count, doLoopLimit = 0; FILE* fh; diff --git a/source/clientserver/readXDRFile.h b/source/clientserver/readXDRFile.h index f89e7c28..6ead6f6f 100644 --- a/source/clientserver/readXDRFile.h +++ b/source/clientserver/readXDRFile.h @@ -8,8 +8,8 @@ namespace uda::client_server { -int sendXDRFile(XDR* xdrs, const char* xdrfile); +int send_xdr_file(XDR* xdrs, const char* xdrfile); -int receiveXDRFile(XDR* xdrs, const char* xdrfile); +int receive_xdr_file(XDR* xdrs, const char* xdrfile); } // namespace uda::client_server diff --git a/source/clientserver/stringUtils.cpp b/source/clientserver/stringUtils.cpp index 9c942535..78e07a99 100644 --- a/source/clientserver/stringUtils.cpp +++ b/source/clientserver/stringUtils.cpp @@ -38,7 +38,7 @@ char* strcasestr(const char* haystack, const char* needle) // Reverse a String -void uda::client_server::reverseString(const char* in, char* out) +void uda::client_server::reverse_string(const char* in, char* out) { int lstr = (int)strlen(in); out[lstr] = '\0'; @@ -49,7 +49,7 @@ void uda::client_server::reverseString(const char* in, char* out) // Copy a String subject to a Maximum length constraint -void uda::client_server::copyString(const char* in, char* out, int maxlength) +void uda::client_server::copy_string(const char* in, char* out, int maxlength) { int lstr = (int)strlen(in); if (lstr < maxlength) { @@ -60,7 +60,7 @@ void uda::client_server::copyString(const char* in, char* out, int maxlength) } } -char* uda::client_server::FormatString(const char* fmt, ...) +char* uda::client_server::format_string(const char* fmt, ...) { va_list vargs; va_start(vargs, fmt); @@ -80,7 +80,7 @@ char* uda::client_server::FormatString(const char* fmt, ...) // Trim Trailing Space Characters from a String -char* uda::client_server::TrimString(char* szSource) +char* uda::client_server::trim_string(char* szSource) { char* pszEOS; @@ -98,7 +98,7 @@ char* uda::client_server::TrimString(char* szSource) // Trim Leading Space Characters from a String -char* uda::client_server::LeftTrimString(char* str) +char* uda::client_server::left_trim_string(char* str) { int trim = 0, lstr; @@ -119,7 +119,7 @@ char* uda::client_server::LeftTrimString(char* str) return str; } -void uda::client_server::StringCopy(char* dest, const char* src, size_t len) +void uda::client_server::string_copy(char* dest, const char* src, size_t len) { strncpy(dest, src, len); dest[len - 1] = '\0'; @@ -163,7 +163,7 @@ char* uda::client_server::strlwr(char* a) // Trim Internal Space Characters from a String -char* uda::client_server::MidTrimString(char* str) +char* uda::client_server::mid_trim_string(char* str) { int j = 0, lstr; lstr = (int)strlen(str); @@ -178,7 +178,7 @@ char* uda::client_server::MidTrimString(char* str) // Is the String an Integer Number? (Simple but not exhaustive Check) -int uda::client_server::IsNumber(const char* a) +int uda::client_server::is_number(const char* a) { const char* wrk = a; while (*wrk != '\0') { @@ -192,7 +192,7 @@ int uda::client_server::IsNumber(const char* a) // Is the String a Simple Float Number? -int uda::client_server::IsFloat(char* a) +int uda::client_server::is_float(char* a) { char* wrk = a; while (*wrk != '\0') { @@ -206,7 +206,7 @@ int uda::client_server::IsFloat(char* a) // Is the String a Number List (#,#,#,#;#;#;#)? -int uda::client_server::IsNumberList(char* a) +int uda::client_server::is_number_list(char* a) { char* wrk = a; while (*wrk != '\0') { @@ -222,7 +222,7 @@ int uda::client_server::IsNumberList(char* a) return 1; } -char* uda::client_server::convertNonPrintable(char* str) +char* uda::client_server::convert_non_printable(char* str) { // Remove CR & LF Characters from a Number List @@ -236,7 +236,7 @@ char* uda::client_server::convertNonPrintable(char* str) return ret; } -char* uda::client_server::convertNonPrintable2(char* str) +char* uda::client_server::convert_non_printable2(char* str) { // Remove NonPrintable Characters from a String @@ -250,7 +250,7 @@ char* uda::client_server::convertNonPrintable2(char* str) return ret; } -int uda::client_server::IsLegalFilePath(const char* str) +int uda::client_server::is_legal_file_path(const char* str) { // Basic check that the filename complies with good naming practice - some protection against malign embedded code! // Test against the Portable Filename Character Set A-Z, a-z, 0-9, , and and @@ -317,7 +317,7 @@ int asprintf(char** strp, const char* fmt, ...) noexcept * Split a string using the given deliminator and return a list of the resultant tokens, with nullptr indicating the end * of the list. * - * The returned list should be freed after use with FreeSplitStringTokens(). + * The returned list should be freed after use with free_split_string_tokens(). * @param string * @param delims * @return @@ -327,7 +327,7 @@ int asprintf(char** strp, const char* fmt, ...) noexcept # define strdup _strdup #endif -char** uda::client_server::SplitString(const char* string, const char* delims) +char** uda::client_server::split_string(const char* string, const char* delims) { char** names = nullptr; char* tokptr = nullptr; @@ -350,7 +350,7 @@ char** uda::client_server::SplitString(const char* string, const char* delims) return names; } -char* uda::client_server::StringReplaceAll(const char* string, const char* find, const char* replace) +char* uda::client_server::string_replace_all(const char* string, const char* find, const char* replace) { char* prev_string = nullptr; char* new_string = strdup(string); @@ -358,14 +358,14 @@ char* uda::client_server::StringReplaceAll(const char* string, const char* find, do { free(prev_string); prev_string = new_string; - new_string = StringReplace(prev_string, find, replace); - } while (!StringEquals(prev_string, new_string)); + new_string = string_replace(prev_string, find, replace); + } while (!string_equals(prev_string, new_string)); free(prev_string); return new_string; } -char* uda::client_server::StringReplace(const char* string, const char* find, const char* replace) +char* uda::client_server::string_replace(const char* string, const char* find, const char* replace) { if (find == nullptr || find[0] == '\0') { return strdup(string); @@ -389,10 +389,10 @@ char* uda::client_server::StringReplace(const char* string, const char* find, co } /** - * Free the token list generated by SplitString(). + * Free the token list generated by split_string(). * @param tokens */ -void uda::client_server::FreeSplitStringTokens(char*** tokens) +void uda::client_server::free_split_string_tokens(char*** tokens) { size_t i = 0; while ((*tokens)[i] != nullptr) { @@ -403,7 +403,7 @@ void uda::client_server::FreeSplitStringTokens(char*** tokens) *tokens = nullptr; } -bool uda::client_server::StringEquals(const char* a, const char* b) +bool uda::client_server::string_equals(const char* a, const char* b) { if (a == nullptr || b == nullptr) { return false; @@ -420,7 +420,7 @@ bool uda::client_server::StringEquals(const char* a, const char* b) return *a == *b; } -bool uda::client_server::StringIEquals(const char* a, const char* b) +bool uda::client_server::string_iequals(const char* a, const char* b) { if (a == nullptr || b == nullptr) { return false; @@ -437,7 +437,7 @@ bool uda::client_server::StringIEquals(const char* a, const char* b) return *a == *b; } -bool uda::client_server::StringEndsWith(const char* str, const char* find) +bool uda::client_server::string_ends_with(const char* str, const char* find) { if (str == nullptr || find == nullptr) { return false; diff --git a/source/clientserver/stringUtils.h b/source/clientserver/stringUtils.h index 838769d7..66b8884c 100644 --- a/source/clientserver/stringUtils.h +++ b/source/clientserver/stringUtils.h @@ -14,10 +14,10 @@ namespace uda::client_server { // Reverse a String -void reverseString(const char* in, char* out); +void reverse_string(const char* in, char* out); // Copy a String subject to a Maximum length constraint -void copyString(const char* in, char* out, int maxlength); +void copy_string(const char* in, char* out, int maxlength); /** * Allocate and return a string built using the given format and arguments. @@ -25,15 +25,15 @@ void copyString(const char* in, char* out, int maxlength); * @param ... The arguments to use to generate the string * @return The allocated string, needs to be freed */ -char* FormatString(const char* fmt, ...); +char* format_string(const char* fmt, ...); // Trim Trailing Space Characters from a String -char* TrimString(char* szSource); +char* trim_string(char* szSource); // Trim Leading Space Characters from a String -char* LeftTrimString(char* str); +char* left_trim_string(char* str); -void StringCopy(char* dest, const char* src, size_t len); +void string_copy(char* dest, const char* src, size_t len); #ifdef __GNUC__ @@ -46,28 +46,28 @@ char* strlwr(char* a); #endif // Trim Internal Space Characters from a String -char* MidTrimString(char* str); +char* mid_trim_string(char* str); // Replace all instances of string `find` with string `replace` in the given string -char* StringReplaceAll(const char* string, const char* find, const char* replace); +char* string_replace_all(const char* string, const char* find, const char* replace); // Replace the first instance of string `find` with string `replace` in the given string -char* StringReplace(const char* string, const char* find, const char* replace); +char* string_replace(const char* string, const char* find, const char* replace); // Is the String an Integer Number? (Simple but not exhaustive Check) -int IsNumber(const char* a); +int is_number(const char* a); // Is the String a Simple Float Number? -int IsFloat(char* a); +int is_float(char* a); // Is the String a Number List (#,#,#,#;#;#;#)? -int IsNumberList(char* a); +int is_number_list(char* a); -char* convertNonPrintable(char* str); +char* convert_non_printable(char* str); -char* convertNonPrintable2(char* str); +char* convert_non_printable2(char* str); -int IsLegalFilePath(const char* str); +int is_legal_file_path(const char* str); #if !defined(asprintf) # if defined(__cplusplus) && !defined(__APPLE__) @@ -79,21 +79,21 @@ int asprintf(char** strp, const char* fmt, ...); # endif #endif -char** SplitString(const char* string, const char* delim); +char** split_string(const char* string, const char* delim); -void FreeSplitStringTokens(char*** tokens); +void free_split_string_tokens(char*** tokens); -bool StringEquals(const char* a, const char* b); +bool string_equals(const char* a, const char* b); -bool StringIEquals(const char* a, const char* b); +bool string_iequals(const char* a, const char* b); -bool StringEndsWith(const char* str, const char* find); +bool string_ends_with(const char* str, const char* find); #define STR_STARTSWITH(X, Y) !strncmp(X, Y, strlen(Y)) #define STR_ISTARTSWITH(X, Y) !strncasecmp(X, Y, strlen(Y)) -#define STR_EQUALS(X, Y) uda::client_server::StringEquals(X, Y) -#define STR_IEQUALS(X, Y) uda::client_server::StringIEquals(X, Y) +#define STR_EQUALS(X, Y) uda::client_server::string_equals(X, Y) +#define STR_IEQUALS(X, Y) uda::client_server::string_iequals(X, Y) // remove non printable characters static inline void convert_non_printable(std::string& str) diff --git a/source/clientserver/udaStructs.cpp b/source/clientserver/udaStructs.cpp index b2c4c053..4103fb93 100644 --- a/source/clientserver/udaStructs.cpp +++ b/source/clientserver/udaStructs.cpp @@ -11,12 +11,12 @@ void uda::client_server::freePutDataBlockList(PutDataBlockList* putDataBlockList if (putDataBlockList->putDataBlock != nullptr && putDataBlockList->blockListSize > 0) { free(putDataBlockList->putDataBlock); } - // initPutDataBlockList(putDataBlockList); + // init_put_data_block_list(putDataBlockList); } // void freeRequestData(REQUEST_DATA* request_data) //{ -// freeNameValueList(&request_data->nameValueList); +// free_name_value_list(&request_data->nameValueList); // freePutDataBlockList(&request_data->putDataBlockList); // } @@ -35,7 +35,7 @@ void uda::client_server::freeClientPutDataBlockList(PutDataBlockList* putDataBlo if (putDataBlockList->putDataBlock != nullptr && putDataBlockList->blockListSize > 0) { free(putDataBlockList->putDataBlock); } - // initPutDataBlockList(putDataBlockList); + // init_put_data_block_list(putDataBlockList); } void uda::client_server::freeDataBlock(DATA_BLOCK* data_block) diff --git a/source/clientserver/userid.cpp b/source/clientserver/userid.cpp index d95ab836..985bcf30 100644 --- a/source/clientserver/userid.cpp +++ b/source/clientserver/userid.cpp @@ -17,7 +17,7 @@ using namespace uda::client_server; * Request userid from OS * @param uid OUT */ -void uda::client_server::userid(char* uid) +void uda::client_server::user_id(char* uid) { #ifdef _WIN32 DWORD size = STRING_LENGTH - 1; @@ -28,13 +28,13 @@ void uda::client_server::userid(char* uid) uid[0] = '\0'; # if defined(cuserid) if ((user = cuserid(nullptr)) != nullptr) { - copyString(user, uid, STRING_LENGTH); + copy_string(user, uid, STRING_LENGTH); return; } else # endif if ((user = getlogin()) != nullptr || (user = getenv("USER")) != nullptr || (user = getenv("LOGNAME")) != nullptr) { - copyString(user, uid, STRING_LENGTH); + copy_string(user, uid, STRING_LENGTH); return; } #endif // _WIN32 diff --git a/source/clientserver/userid.h b/source/clientserver/userid.h index 5512afd5..6c1abc3e 100644 --- a/source/clientserver/userid.h +++ b/source/clientserver/userid.h @@ -3,6 +3,6 @@ namespace uda::client_server { -void userid(char* uid); +void user_id(char* uid); } diff --git a/source/clientserver/xdrlib.cpp b/source/clientserver/xdrlib.cpp index 23a20bc8..792694d1 100644 --- a/source/clientserver/xdrlib.cpp +++ b/source/clientserver/xdrlib.cpp @@ -26,7 +26,7 @@ using namespace uda::logging; //----------------------------------------------------------------------- // Test version's type passing capability -int uda::client_server::protocolVersionTypeTest(int protocol_version, int type) +int uda::client_server::protocol_version_type_test(int protocol_version, int type) { // If this client/server version cannot pass/receive a specific type, then return TRUE @@ -67,7 +67,7 @@ int uda::client_server::wrap_string(XDR* xdrs, char* sp) return xdr_string(xdrs, &sp, MAX_STRING_LENGTH); } -int uda::client_server::WrapXDRString(XDR* xdrs, const char* sp, int maxlen) +int uda::client_server::wrap_xdr_string(XDR* xdrs, const char* sp, int maxlen) { return xdr_string(xdrs, (char**)&sp, (unsigned int)maxlen); } @@ -77,14 +77,14 @@ int uda::client_server::WrapXDRString(XDR* xdrs, const char* sp, int maxlen) bool_t uda::client_server::xdr_meta(XDR* xdrs, DATA_BLOCK* str) { - int rc = WrapXDRString(xdrs, (char*)str->opaque_block, str->opaque_count + 1); + int rc = wrap_xdr_string(xdrs, (char*)str->opaque_block, str->opaque_count + 1); return rc; } //----------------------------------------------------------------------- // Security block -bool_t uda::client_server::xdr_securityBlock1(XDR* xdrs, SECURITY_BLOCK* str) +bool_t uda::client_server::xdr_security_block1(XDR* xdrs, SECURITY_BLOCK* str) { int rc = xdr_u_short(xdrs, &str->structVersion) && xdr_u_short(xdrs, &str->encryptionMethod) && xdr_u_short(xdrs, &str->authenticationStep) && xdr_u_short(xdrs, &str->client_ciphertextLength) && @@ -93,7 +93,7 @@ bool_t uda::client_server::xdr_securityBlock1(XDR* xdrs, SECURITY_BLOCK* str) return rc; } -bool_t uda::client_server::xdr_securityBlock2(XDR* xdrs, SECURITY_BLOCK* str) +bool_t uda::client_server::xdr_security_block2(XDR* xdrs, SECURITY_BLOCK* str) { int rc = 1; @@ -150,7 +150,7 @@ bool_t uda::client_server::xdr_securityBlock2(XDR* xdrs, SECURITY_BLOCK* str) bool_t uda::client_server::xdr_client(XDR* xdrs, CLIENT_BLOCK* str, int protocolVersion) { int rc = xdr_int(xdrs, &str->version) && xdr_int(xdrs, &str->pid) && xdr_int(xdrs, &str->timeout) && - WrapXDRString(xdrs, (char*)str->uid, STRING_LENGTH); + wrap_xdr_string(xdrs, (char*)str->uid, STRING_LENGTH); if (str->version < protocolVersion) { protocolVersion = str->version; @@ -190,16 +190,16 @@ bool_t uda::client_server::xdr_client(XDR* xdrs, CLIENT_BLOCK* str, int protocol } if (protocolVersion >= 7) { - rc = rc && WrapXDRString(xdrs, (char*)str->OSName, STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->DOI, STRING_LENGTH); + rc = rc && wrap_xdr_string(xdrs, (char*)str->OSName, STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->DOI, STRING_LENGTH); #ifdef SECURITYENABLED - rc = rc && WrapXDRString(xdrs, (char*)str->uid2, STRING_LENGTH); + rc = rc && wrap_xdr_string(xdrs, (char*)str->uid2, STRING_LENGTH); #endif } UDA_LOG(UDA_LOG_DEBUG, "protocolVersion %d\n", protocolVersion); - printClientBlock(*str); + print_client_block(*str); return rc; } @@ -233,7 +233,7 @@ bool_t uda::client_server::xdr_server1(XDR* xdrs, SERVER_BLOCK* str, int protoco rc = rc && xdr_u_int(xdrs, &str->idamerrorstack.nerrors); UDA_LOG(UDA_LOG_DEBUG, "Server #1 rc[3] = %d, error = %d\n", rc, str->idamerrorstack.nerrors); - rc = rc && WrapXDRString(xdrs, (char*)str->msg, STRING_LENGTH); + rc = rc && wrap_xdr_string(xdrs, (char*)str->msg, STRING_LENGTH); UDA_LOG(UDA_LOG_DEBUG, "Server #1 rc[4] = %d, strlen = %zd\n", rc, strlen(str->msg)); UDA_LOG(UDA_LOG_DEBUG, "str->msg = %p\n", str->msg); @@ -242,8 +242,8 @@ bool_t uda::client_server::xdr_server1(XDR* xdrs, SERVER_BLOCK* str, int protoco UDA_LOG(UDA_LOG_DEBUG, "Server #1 protocolVersion %d [rc = %d]\n", protocolVersion, rc); if ((xdrs->x_op == XDR_DECODE && protocolVersion >= 7) || (xdrs->x_op == XDR_ENCODE && protocolVersion >= 7)) { - rc = rc && WrapXDRString(xdrs, (char*)str->OSName, STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->DOI, STRING_LENGTH); + rc = rc && wrap_xdr_string(xdrs, (char*)str->OSName, STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->DOI, STRING_LENGTH); #ifdef SECURITYENABLED // rc = rc && xdr_securityBlock(xdrs, &str->securityBlock); #endif @@ -260,8 +260,8 @@ bool_t uda::client_server::xdr_server2(XDR* xdrs, SERVER_BLOCK* str) for (unsigned int i = 0; i < str->idamerrorstack.nerrors; i++) { rc = rc && xdr_int(xdrs, &str->idamerrorstack.idamerror[i].type) && xdr_int(xdrs, &str->idamerrorstack.idamerror[i].code) && - WrapXDRString(xdrs, (char*)str->idamerrorstack.idamerror[i].location, STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->idamerrorstack.idamerror[i].msg, STRING_LENGTH); + wrap_xdr_string(xdrs, (char*)str->idamerrorstack.idamerror[i].location, STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->idamerrorstack.idamerror[i].msg, STRING_LENGTH); UDA_LOG(UDA_LOG_DEBUG, "xdr_server2 [%d] %s\n", i, str->idamerrorstack.idamerror[i].msg); } @@ -274,7 +274,7 @@ bool_t uda::client_server::xdr_server2(XDR* xdrs, SERVER_BLOCK* str) bool_t uda::client_server::xdr_server(XDR* xdrs, SERVER_BLOCK* str) { return xdr_int(xdrs, &str->version) && xdr_int(xdrs, &str->error) && - WrapXDRString(xdrs, (char*)str->msg, STRING_LENGTH); + wrap_xdr_string(xdrs, (char*)str->msg, STRING_LENGTH); } //----------------------------------------------------------------------- @@ -287,19 +287,19 @@ bool_t uda::client_server::xdr_request_data(XDR* xdrs, REQUEST_DATA* str, int pr str->request = static_cast(request); rc = rc && xdr_int(xdrs, &str->exp_number); rc = rc && xdr_int(xdrs, &str->pass); - rc = rc && WrapXDRString(xdrs, (char*)str->tpass, STRING_LENGTH); - rc = rc && WrapXDRString(xdrs, (char*)str->archive, STRING_LENGTH); - rc = rc && WrapXDRString(xdrs, (char*)str->device_name, STRING_LENGTH); - rc = rc && WrapXDRString(xdrs, (char*)str->server, STRING_LENGTH); - rc = rc && WrapXDRString(xdrs, (char*)str->path, STRING_LENGTH); - rc = rc && WrapXDRString(xdrs, (char*)str->file, STRING_LENGTH); - rc = rc && WrapXDRString(xdrs, (char*)str->format, STRING_LENGTH); + rc = rc && wrap_xdr_string(xdrs, (char*)str->tpass, STRING_LENGTH); + rc = rc && wrap_xdr_string(xdrs, (char*)str->archive, STRING_LENGTH); + rc = rc && wrap_xdr_string(xdrs, (char*)str->device_name, STRING_LENGTH); + rc = rc && wrap_xdr_string(xdrs, (char*)str->server, STRING_LENGTH); + rc = rc && wrap_xdr_string(xdrs, (char*)str->path, STRING_LENGTH); + rc = rc && wrap_xdr_string(xdrs, (char*)str->file, STRING_LENGTH); + rc = rc && wrap_xdr_string(xdrs, (char*)str->format, STRING_LENGTH); - rc = rc && WrapXDRString(xdrs, (char*)str->signal, MAXMETA); + rc = rc && wrap_xdr_string(xdrs, (char*)str->signal, MAXMETA); if ((xdrs->x_op == XDR_DECODE && protocolVersion >= 6) || (xdrs->x_op == XDR_ENCODE && protocolVersion >= 6)) { - rc = rc && WrapXDRString(xdrs, (char*)str->source, STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->api_delim, MAXNAME); + rc = rc && wrap_xdr_string(xdrs, (char*)str->source, STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->api_delim, MAXNAME); } if (protocolVersion >= 7) { @@ -363,7 +363,7 @@ bool_t uda::client_server::xdr_putdata_block2(XDR* xdrs, PutDataBlock* str) } if (str->blockNameLength > 0) { - rc = rc && WrapXDRString(xdrs, (char*)str->blockName, str->blockNameLength + 1); + rc = rc && wrap_xdr_string(xdrs, (char*)str->blockName, str->blockNameLength + 1); } switch (str->data_type) { @@ -474,9 +474,9 @@ bool_t xdr_serialise_object(XDR* xdrs, LOGMALLOCLIST* logmalloclist, USERDEFINED // Send the data - rc = rc && xdr_userdefinedtypelist(xdrs, userdefinedtypelist, + rc = rc && xdr_user_defined_type_list(xdrs, userdefinedtypelist, xdr_stdio_flag); // send the full set of known named structures - rc = rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, u, (void**)data, protocolVersion, + rc = rc && xdr_user_defined_type_data(xdrs, logmalloclist, userdefinedtypelist, u, (void**)data, protocolVersion, xdr_stdio_flag, log_struct_list, malloc_source); // send the Data if (!rc) { @@ -506,7 +506,7 @@ bool_t xdr_serialise_object(XDR* xdrs, LOGMALLOCLIST* logmalloclist, USERDEFINED initUserDefinedTypeList(userdefinedtypelist); // receive the full set of known named structures - rc = rc && xdr_userdefinedtypelist(xdrs, userdefinedtypelist, xdr_stdio_flag); + rc = rc && xdr_user_defined_type_list(xdrs, userdefinedtypelist, xdr_stdio_flag); if (!rc) { err = 999; @@ -519,7 +519,7 @@ bool_t xdr_serialise_object(XDR* xdrs, LOGMALLOCLIST* logmalloclist, USERDEFINED auto udt_received = (USERDEFINEDTYPE*)malloc(sizeof(USERDEFINEDTYPE)); initUserDefinedType(udt_received); - rc = rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received, &data, + rc = rc && xdr_user_defined_type_data(xdrs, logmalloclist, userdefinedtypelist, udt_received, &data, protocolVersion, xdr_stdio_flag, log_struct_list, malloc_source); // receive the Data @@ -575,10 +575,10 @@ bool_t uda::client_server::xdr_data_block1(XDR* xdrs, DATA_BLOCK* str, int proto rc = rc && xdr_int(xdrs, &str->errcode); rc = rc && xdr_int(xdrs, &str->source_status); rc = rc && xdr_int(xdrs, &str->signal_status); - rc = rc && WrapXDRString(xdrs, (char*)str->data_units, STRING_LENGTH); - rc = rc && WrapXDRString(xdrs, (char*)str->data_label, STRING_LENGTH); - rc = rc && WrapXDRString(xdrs, (char*)str->data_desc, STRING_LENGTH); - rc = rc && WrapXDRString(xdrs, (char*)str->error_msg, STRING_LENGTH); + rc = rc && wrap_xdr_string(xdrs, (char*)str->data_units, STRING_LENGTH); + rc = rc && wrap_xdr_string(xdrs, (char*)str->data_label, STRING_LENGTH); + rc = rc && wrap_xdr_string(xdrs, (char*)str->data_desc, STRING_LENGTH); + rc = rc && wrap_xdr_string(xdrs, (char*)str->error_msg, STRING_LENGTH); // output (ENCODE) means written by the server // input (DECODE) means read by the client @@ -752,8 +752,8 @@ bool_t uda::client_server::xdr_data_dim1(XDR* xdrs, DATA_BLOCK* str) xdr_int(xdrs, &str->dims[i].compressed) && xdr_double(xdrs, &str->dims[i].dim0) && xdr_double(xdrs, &str->dims[i].diff) && xdr_int(xdrs, &str->dims[i].method) && xdr_u_int(xdrs, &str->dims[i].udoms) && - WrapXDRString(xdrs, (char*)str->dims[i].dim_units, STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->dims[i].dim_label, STRING_LENGTH); + wrap_xdr_string(xdrs, (char*)str->dims[i].dim_units, STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->dims[i].dim_label, STRING_LENGTH); } return rc; @@ -1382,11 +1382,11 @@ bool_t uda::client_server::xdr_data_dim4(XDR* xdrs, DATA_BLOCK* str) bool_t uda::client_server::xdr_data_system(XDR* xdrs, DATA_SYSTEM* str) { return xdr_int(xdrs, &str->system_id) && xdr_int(xdrs, &str->version) && xdr_int(xdrs, &str->meta_id) && - xdr_char(xdrs, &str->type) && WrapXDRString(xdrs, (char*)str->device_name, STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->system_name, STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->system_desc, MAX_STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->creation, DATE_LENGTH) && WrapXDRString(xdrs, (char*)str->xml, MAXMETA) && - WrapXDRString(xdrs, (char*)str->xml_creation, DATE_LENGTH); + xdr_char(xdrs, &str->type) && wrap_xdr_string(xdrs, (char*)str->device_name, STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->system_name, STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->system_desc, MAX_STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->creation, DATE_LENGTH) && wrap_xdr_string(xdrs, (char*)str->xml, MAXMETA) && + wrap_xdr_string(xdrs, (char*)str->xml_creation, DATE_LENGTH); } //----------------------------------------------------------------------- @@ -1395,10 +1395,10 @@ bool_t uda::client_server::xdr_data_system(XDR* xdrs, DATA_SYSTEM* str) bool_t uda::client_server::xdr_system_config(XDR* xdrs, SYSTEM_CONFIG* str) { return xdr_int(xdrs, &str->config_id) && xdr_int(xdrs, &str->system_id) && xdr_int(xdrs, &str->meta_id) && - WrapXDRString(xdrs, (char*)str->config_name, STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->config_desc, MAX_STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->creation, DATE_LENGTH) && WrapXDRString(xdrs, (char*)str->xml, MAXMETA) && - WrapXDRString(xdrs, (char*)str->xml_creation, DATE_LENGTH); + wrap_xdr_string(xdrs, (char*)str->config_name, STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->config_desc, MAX_STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->creation, DATE_LENGTH) && wrap_xdr_string(xdrs, (char*)str->xml, MAXMETA) && + wrap_xdr_string(xdrs, (char*)str->xml_creation, DATE_LENGTH); } //----------------------------------------------------------------------- @@ -1411,21 +1411,21 @@ bool_t uda::client_server::xdr_data_source(XDR* xdrs, DATA_SOURCE* str) xdr_int(xdrs, &str->exp_number) && xdr_int(xdrs, &str->pass) && xdr_int(xdrs, &str->status) && xdr_int(xdrs, &str->status_reason_code) && xdr_int(xdrs, &str->status_impact_code) && xdr_char(xdrs, &str->access) && xdr_char(xdrs, &str->reprocess) && xdr_char(xdrs, &str->type) && - WrapXDRString(xdrs, (char*)str->source_alias, STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->pass_date, DATE_LENGTH) && - WrapXDRString(xdrs, (char*)str->archive, STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->device_name, STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->format, STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->path, MAX_STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->filename, STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->server, STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->userid, STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->reason_desc, MAX_STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->status_desc, MAXMETA) && - WrapXDRString(xdrs, (char*)str->run_desc, MAXMETA) && - WrapXDRString(xdrs, (char*)str->creation, DATE_LENGTH) && - WrapXDRString(xdrs, (char*)str->modified, DATE_LENGTH) && WrapXDRString(xdrs, (char*)str->xml, MAXMETA) && - WrapXDRString(xdrs, (char*)str->xml_creation, DATE_LENGTH); + wrap_xdr_string(xdrs, (char*)str->source_alias, STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->pass_date, DATE_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->archive, STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->device_name, STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->format, STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->path, MAX_STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->filename, STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->server, STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->userid, STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->reason_desc, MAX_STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->status_desc, MAXMETA) && + wrap_xdr_string(xdrs, (char*)str->run_desc, MAXMETA) && + wrap_xdr_string(xdrs, (char*)str->creation, DATE_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->modified, DATE_LENGTH) && wrap_xdr_string(xdrs, (char*)str->xml, MAXMETA) && + wrap_xdr_string(xdrs, (char*)str->xml_creation, DATE_LENGTH); } //----------------------------------------------------------------------- @@ -1437,10 +1437,10 @@ bool_t uda::client_server::xdr_signal(XDR* xdrs, SIGNAL* str) xdr_int(xdrs, &str->status_desc_id) && xdr_int(xdrs, &str->status) && xdr_int(xdrs, &str->status_reason_code) && xdr_int(xdrs, &str->status_impact_code) && xdr_char(xdrs, &str->access) && xdr_char(xdrs, &str->reprocess) && - WrapXDRString(xdrs, (char*)str->status_desc, MAXMETA) && - WrapXDRString(xdrs, (char*)str->creation, DATE_LENGTH) && - WrapXDRString(xdrs, (char*)str->modified, DATE_LENGTH) && WrapXDRString(xdrs, (char*)str->xml, MAXMETA) && - WrapXDRString(xdrs, (char*)str->xml_creation, DATE_LENGTH); + wrap_xdr_string(xdrs, (char*)str->status_desc, MAXMETA) && + wrap_xdr_string(xdrs, (char*)str->creation, DATE_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->modified, DATE_LENGTH) && wrap_xdr_string(xdrs, (char*)str->xml, MAXMETA) && + wrap_xdr_string(xdrs, (char*)str->xml_creation, DATE_LENGTH); } //----------------------------------------------------------------------- @@ -1450,14 +1450,14 @@ bool_t uda::client_server::xdr_signal_desc(XDR* xdrs, SIGNAL_DESC* str) { return xdr_int(xdrs, &str->signal_desc_id) && xdr_int(xdrs, &str->meta_id) && xdr_int(xdrs, &str->rank) && xdr_int(xdrs, &str->range_start) && xdr_int(xdrs, &str->range_stop) && xdr_char(xdrs, &str->type) && - WrapXDRString(xdrs, (char*)str->source_alias, STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->signal_alias, STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->signal_name, STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->generic_name, STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->description, MAX_STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->signal_class, MAX_STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->signal_owner, MAX_STRING_LENGTH) && - WrapXDRString(xdrs, (char*)str->creation, DATE_LENGTH) && - WrapXDRString(xdrs, (char*)str->modified, DATE_LENGTH) && WrapXDRString(xdrs, (char*)str->xml, MAXMETA) && - WrapXDRString(xdrs, (char*)str->xml_creation, DATE_LENGTH); + wrap_xdr_string(xdrs, (char*)str->source_alias, STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->signal_alias, STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->signal_name, STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->generic_name, STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->description, MAX_STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->signal_class, MAX_STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->signal_owner, MAX_STRING_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->creation, DATE_LENGTH) && + wrap_xdr_string(xdrs, (char*)str->modified, DATE_LENGTH) && wrap_xdr_string(xdrs, (char*)str->xml, MAXMETA) && + wrap_xdr_string(xdrs, (char*)str->xml_creation, DATE_LENGTH); } diff --git a/source/clientserver/xdrlib.h b/source/clientserver/xdrlib.h index e8cc2882..b5499235 100644 --- a/source/clientserver/xdrlib.h +++ b/source/clientserver/xdrlib.h @@ -22,17 +22,17 @@ namespace uda::client_server //----------------------------------------------------------------------- // Test version's type passing capability -int protocolVersionTypeTest(int protocolVersion, int type); +int protocol_version_type_test(int protocolVersion, int type); int wrap_string(XDR* xdrs, char* sp); -int WrapXDRString(XDR* xdrs, const char* sp, int maxlen); +int wrap_xdr_string(XDR* xdrs, const char* sp, int maxlen); bool_t xdr_meta(XDR* xdrs, DATA_BLOCK* str); -bool_t xdr_securityBlock1(XDR* xdrs, SECURITY_BLOCK* str); +bool_t xdr_security_block1(XDR* xdrs, SECURITY_BLOCK* str); -bool_t xdr_securityBlock2(XDR* xdrs, SECURITY_BLOCK* str); +bool_t xdr_security_block2(XDR* xdrs, SECURITY_BLOCK* str); bool_t xdr_client(XDR* xdrs, CLIENT_BLOCK* str, int protocolVersion); diff --git a/source/include/uda/legacy.h b/source/include/uda/legacy.h index 9a9418cc..f1f7ddef 100644 --- a/source/include/uda/legacy.h +++ b/source/include/uda/legacy.h @@ -738,12 +738,12 @@ inline const char* getIdamFileFormat(int handle) inline void initIdamDataBlock(DATA_BLOCK* str) { - return initDataBlock(str); + return init_data_block(str); } inline void initIdamRequestBlock(REQUEST_BLOCK* str) { - return initRequestBlock(str); + return init_request_block(str); } /* diff --git a/source/logging/accessLog.cpp b/source/logging/accessLog.cpp index f8e773d4..ecffc2eb 100644 --- a/source/logging/accessLog.cpp +++ b/source/logging/accessLog.cpp @@ -149,8 +149,8 @@ void uda::logging::udaAccessLog(int init, CLIENT_BLOCK client_block, REQUEST_BLO host[HOSTNAMELENGTH - 1] = '\0'; } # endif - convertNonPrintable2(host); - TrimString(host); + convert_non_printable2(host); + trim_string(host); if (strlen(host) == 0) { strcpy(host, "-"); } @@ -175,8 +175,8 @@ void uda::logging::udaAccessLog(int init, CLIENT_BLOCK client_block, REQUEST_BLO asctime_s(accessdate, DATELENGTH, broken); # endif - convertNonPrintable2(accessdate); - TrimString(accessdate); + convert_non_printable2(accessdate); + trim_string(accessdate); // Client Request: From the request_block structure diff --git a/source/plugins/hdf5/readHDF58.cpp b/source/plugins/hdf5/readHDF58.cpp index d139a92a..52e67b6d 100644 --- a/source/plugins/hdf5/readHDF58.cpp +++ b/source/plugins/hdf5/readHDF58.cpp @@ -242,7 +242,7 @@ int readHDF5Att(hid_t file_id, char* object, hid_t att_id, char* attname, DATA_B } for (unsigned int i = 0; i < data_block->rank; i++) { - initDimBlock(&data_block->dims[i]); + init_dim_block(&data_block->dims[i]); data_block->dims[i].compressed = 1; data_block->dims[i].method = 0; data_block->dims[i].dim_n = (int)shape[data_block->rank - i - 1]; @@ -479,7 +479,7 @@ int readHDF5(DATA_SOURCE data_source, SIGNAL_DESC signal_desc, DATA_BLOCK* data_ { for (unsigned int i = 0; i < data_block->rank; i++) { - initDimBlock(&data_block->dims[i]); + init_dim_block(&data_block->dims[i]); } } diff --git a/source/plugins/testplugin/testplugin.cpp b/source/plugins/testplugin/testplugin.cpp index 766723d0..eef4db5d 100644 --- a/source/plugins/testplugin/testplugin.cpp +++ b/source/plugins/testplugin/testplugin.cpp @@ -2402,7 +2402,7 @@ int TestPlugin::testudt(UDA_PLUGIN_INTERFACE* plugin_interface) // Return IDAM status - initDataBlock(data_block); + init_data_block(data_block); data_block->rank = 0; data_block->data_n = 1; diff --git a/source/plugins/uda/uda_plugin.cpp b/source/plugins/uda/uda_plugin.cpp index c337d206..20837411 100644 --- a/source/plugins/uda/uda_plugin.cpp +++ b/source/plugins/uda/uda_plugin.cpp @@ -273,7 +273,7 @@ int uda::plugins::uda::Plugin::get(UDA_PLUGIN_INTERFACE* plugin_interface) old_host_ = data_source->server; udaPutServerHost(data_source->server); } - if (IsNumber(&p[1])) { + if (is_number(&p[1])) { newPort = atoi(&p[1]); if (newPort != old_port_) { udaPutServerPort(newPort); @@ -352,7 +352,7 @@ int uda::plugins::uda::Plugin::get(UDA_PLUGIN_INTERFACE* plugin_interface) old_host_ = request->server; udaPutServerHost(request->server); // different host name? } - if (IsNumber(&p[1])) { + if (is_number(&p[1])) { newPort = atoi(&p[1]); if (newPort != old_port_) { udaPutServerPort(newPort); @@ -450,7 +450,7 @@ int uda::plugins::uda::Plugin::get(UDA_PLUGIN_INTERFACE* plugin_interface) old_host_ = request->server; udaPutServerHost(request->server); // Change to a different host name } - if (IsNumber(&p[1])) { + if (is_number(&p[1])) { newPort = atoi(&p[1]); if (newPort != old_port_) { // Different Ports? @@ -519,7 +519,7 @@ int uda::plugins::uda::Plugin::get(UDA_PLUGIN_INTERFACE* plugin_interface) // Write the structure components element by element! (Ignore the CLIENT_BLOCK component) DATA_BLOCK db; - initDataBlock(&db); + init_data_block(&db); auto odb = (OLD_DATA_BLOCK*)getDataBlock(handle); diff --git a/source/plugins/udaPlugin.cpp b/source/plugins/udaPlugin.cpp index 65528601..3f846740 100644 --- a/source/plugins/udaPlugin.cpp +++ b/source/plugins/udaPlugin.cpp @@ -35,7 +35,7 @@ UDA_PLUGIN_INTERFACE* udaCreatePluginInterface(const char* request) initPluginList(plugin_list, environment); auto request_data = (REQUEST_DATA*)calloc(1, sizeof(REQUEST_DATA)); - makeRequestData(request_data, plugin_list, environment); + make_request_data(request_data, plugin_list, environment); auto user_defined_type_list = (USERDEFINEDTYPELIST*)calloc(1, sizeof(USERDEFINEDTYPELIST)); auto log_malloc_list = (LOGMALLOCLIST*)calloc(1, sizeof(LOGMALLOCLIST)); @@ -81,7 +81,7 @@ template int setReturnDataScalar(UDA_PLUGIN_INTERFACE* plugin_inter { auto interface = static_cast(plugin_interface); DATA_BLOCK* data_block = interface->data_block; - initDataBlock(data_block); + init_data_block(data_block); auto data = (T*)malloc(sizeof(T)); data[0] = value; @@ -105,7 +105,7 @@ int setReturnDataArray(UDA_PLUGIN_INTERFACE* plugin_interface, const T* values, { auto interface = static_cast(plugin_interface); DATA_BLOCK* data_block = interface->data_block; - initDataBlock(data_block); + init_data_block(data_block); if (description != nullptr) { strncpy(data_block->data_desc, description, STRING_LENGTH); @@ -118,7 +118,7 @@ int setReturnDataArray(UDA_PLUGIN_INTERFACE* plugin_interface, const T* values, size_t len = 1; for (size_t i = 0; i < rank; ++i) { - initDimBlock(&data_block->dims[i]); + init_dim_block(&data_block->dims[i]); data_block->dims[i].data_type = UDA_TYPE_UNSIGNED_INT; data_block->dims[i].dim_n = (int)shape[i]; @@ -169,7 +169,7 @@ int udaPluginReturnDataStringScalar(UDA_PLUGIN_INTERFACE* plugin_interface, cons { auto interface = static_cast(plugin_interface); DATA_BLOCK* data_block = interface->data_block; - initDataBlock(data_block); + init_data_block(data_block); data_block->data_type = UDA_TYPE_STRING; data_block->data = strdup(value); @@ -178,7 +178,7 @@ int udaPluginReturnDataStringScalar(UDA_PLUGIN_INTERFACE* plugin_interface, cons data_block->dims = (DIMS*)malloc(data_block->rank * sizeof(DIMS)); for (unsigned int i = 0; i < data_block->rank; i++) { - initDimBlock(&data_block->dims[i]); + init_dim_block(&data_block->dims[i]); } if (description != nullptr) { @@ -203,7 +203,7 @@ int udaPluginReturnData(UDA_PLUGIN_INTERFACE* plugin_interface, void* value, siz { auto interface = static_cast(plugin_interface); DATA_BLOCK* data_block = interface->data_block; - initDataBlock(data_block); + init_data_block(data_block); data_block->data_type = type; data_block->data = (char*)malloc(size); @@ -214,7 +214,7 @@ int udaPluginReturnData(UDA_PLUGIN_INTERFACE* plugin_interface, void* value, siz data_block->dims = (DIMS*)malloc(data_block->rank * sizeof(DIMS)); for (unsigned int i = 0; i < data_block->rank; i++) { - initDimBlock(&data_block->dims[i]); + init_dim_block(&data_block->dims[i]); } if (description != nullptr) { @@ -266,7 +266,7 @@ bool udaPluginFindStringArg(const UDA_PLUGIN_INTERFACE* plugin_interface, const auto interface = static_cast(plugin_interface); auto namevaluelist = &interface->request_data->nameValueList; - char** names = SplitString(name, "|"); + char** names = split_string(name, "|"); *value = nullptr; bool found = 0; @@ -281,7 +281,7 @@ bool udaPluginFindStringArg(const UDA_PLUGIN_INTERFACE* plugin_interface, const } } - FreeSplitStringTokens(&names); + free_split_string_tokens(&names); return found; } @@ -342,7 +342,7 @@ bool udaPluginFindArg(const UDA_PLUGIN_INTERFACE* plugin_interface, const char* { auto interface = static_cast(plugin_interface); auto namevaluelist = &interface->request_data->nameValueList; - char** names = SplitString(name, "|"); + char** names = split_string(name, "|"); bool found = false; for (int i = 0; i < namevaluelist->pairCount; i++) { @@ -356,7 +356,7 @@ bool udaPluginFindArg(const UDA_PLUGIN_INTERFACE* plugin_interface, const char* } } - FreeSplitStringTokens(&names); + free_split_string_tokens(&names); return found; } @@ -375,7 +375,7 @@ int udaCallPlugin2(UDA_PLUGIN_INTERFACE* plugin_interface, const char* request, strcpy(request_data.signal, request); strcpy(request_data.source, source); - makeRequestData(&request_data, interface->pluginList, interface->environment); + make_request_data(&request_data, interface->pluginList, interface->environment); request_data.request = findPluginRequestByFormat(request_data.format, interface->pluginList); if (request_data.request == REQUEST_READ_UNKNOWN) { @@ -394,7 +394,7 @@ int udaCallPlugin2(UDA_PLUGIN_INTERFACE* plugin_interface, const char* request, // Apply subsettinng if (request_data.datasubset.nbound > 0) { ACTION action = {}; - initAction(&action); + init_action(&action); action.actionType = UDA_SUBSET_TYPE; action.subset = request_data.datasubset; err = serverSubsetData(new_plugin_interface.data_block, action, new_plugin_interface.logmalloclist); @@ -408,7 +408,7 @@ int udaPluginReturnCompoundData(UDA_PLUGIN_INTERFACE* plugin_interface, char* da { auto interface = static_cast(plugin_interface); DATA_BLOCK* data_block = interface->data_block; - initDataBlock(data_block); + init_data_block(data_block); data_block->data_type = UDA_TYPE_COMPOUND; data_block->rank = 0; @@ -436,7 +436,7 @@ int udaPluginReturnCompoundArrayData(UDA_PLUGIN_INTERFACE* plugin_interface, cha { auto interface = static_cast(plugin_interface); DATA_BLOCK* data_block = interface->data_block; - initDataBlock(data_block); + init_data_block(data_block); int count = 1; for (int i = 0; i < rank; ++i) { @@ -450,7 +450,7 @@ int udaPluginReturnCompoundArrayData(UDA_PLUGIN_INTERFACE* plugin_interface, cha data_block->dims = (DIMS*)malloc(rank * sizeof(DIMS)); for (int i = 0; i < rank; ++i) { - initDimBlock(&data_block->dims[i]); + init_dim_block(&data_block->dims[i]); data_block->dims[i].data_type = UDA_TYPE_UNSIGNED_INT; data_block->dims[i].dim_n = (int)shape[i]; diff --git a/source/security/clientAuthentication.cpp b/source/security/clientAuthentication.cpp index 5a713700..e87b1905 100644 --- a/source/security/clientAuthentication.cpp +++ b/source/security/clientAuthentication.cpp @@ -330,7 +330,7 @@ static int decryptServerToken(SERVER_BLOCK* server_block, CLIENT_BLOCK* client_b #endif UDA_LOG(UDA_LOG_DEBUG, "Server Block Received\n"); - printServerBlock(*server_block); + print_server_block(*server_block); // Protocol Version: Lower of the client and server version numbers // This defines the set of elements within data structures passed between client and server diff --git a/source/security/serverAuthentication.cpp b/source/security/serverAuthentication.cpp index be65b542..ba52de79 100644 --- a/source/security/serverAuthentication.cpp +++ b/source/security/serverAuthentication.cpp @@ -188,7 +188,7 @@ static SECURITY_BLOCK* receiveSecurityBlock(CLIENT_BLOCK* client_block, LOGMALLO if (err == 0) { UDA_LOG(UDA_LOG_DEBUG, "Initial Client Block received\n"); - printClientBlock(*client_block); + print_client_block(*client_block); } } diff --git a/source/security/x509Utils.cpp b/source/security/x509Utils.cpp index 295aef94..a687e546 100644 --- a/source/security/x509Utils.cpp +++ b/source/security/x509Utils.cpp @@ -664,8 +664,8 @@ int testX509Dates(ksba_cert_t certificate) asctime_s(datetime, DATELENGTH, broken); #endif - convertNonPrintable2(datetime); - TrimString(datetime); + convert_non_printable2(datetime); + trim_string(datetime); // Year diff --git a/source/server/applyXML.cpp b/source/server/applyXML.cpp index 04c0d9cb..dce63eec 100644 --- a/source/server/applyXML.cpp +++ b/source/server/applyXML.cpp @@ -45,30 +45,30 @@ int uda::server::serverParseSignalXML(uda::client_server::DATA_SOURCE data_sourc //---------------------------------------------------------------------- // Initialise - initActions(actions_desc); // Array of actions from the Signal_Desc record - initActions(actions_sig); // Array of actions from the Signal Record + init_actions(actions_desc); // Array of actions from the Signal_Desc record + init_actions(actions_sig); // Array of actions from the Signal Record //---------------------------------------------------------------------- // Parse Signal XML if (strlen(signal.xml) > 0) { // If this Signal level XML exists then populated components takes priority. - if ((rc = parseDoc(signal.xml, actions_sig)) != 0) { + if ((rc = parse_doc(signal.xml, actions_sig)) != 0) { return 1; } UDA_LOG(UDA_LOG_DEBUG, "XML from the Signal Record parsed\n"); - printActions(*actions_sig); + print_actions(*actions_sig); } //---------------------------------------------------------------------- // Parse Signal_Desc XML if (strlen(signal_desc.xml) > 0) { - if ((rc = parseDoc(signal_desc.xml, actions_desc)) != 0) { + if ((rc = parse_doc(signal_desc.xml, actions_desc)) != 0) { return 1; } UDA_LOG(UDA_LOG_DEBUG, "XML from the Signal_Desc Record parsed\n"); - printActions(*actions_desc); + print_actions(*actions_desc); } //---------------------------------------------------------------------------------------------- @@ -119,7 +119,7 @@ int uda::server::serverParseSignalXML(uda::client_server::DATA_SOURCE data_sourc } } - printActions(*actions_desc); + print_actions(*actions_desc); if (actions_sig->nactions == 0 && ndesc == 0) { // No qualifying XML from either source UDA_LOG(UDA_LOG_DEBUG, "No Applicable Actionable XML Found\n"); diff --git a/source/server/closeServerSockets.cpp b/source/server/closeServerSockets.cpp index 04fc212d..eefcfe09 100644 --- a/source/server/closeServerSockets.cpp +++ b/source/server/closeServerSockets.cpp @@ -50,5 +50,5 @@ void uda::server::closeServerSockets(SOCKETLIST* socks) if (socks->sockets != nullptr) { free(socks->sockets); } - initSocketList(socks); + init_socket_list(socks); } diff --git a/source/server/fatServer.cpp b/source/server/fatServer.cpp index e081563e..952de54b 100644 --- a/source/server/fatServer.cpp +++ b/source/server/fatServer.cpp @@ -119,10 +119,10 @@ int uda::server::fat_server(CLIENT_BLOCK client_block, SERVER_BLOCK* server_bloc // Initialise the Error Stack & the Server Status Structure // Reinitialised after each logging action - initServerBlock(server_block, server_version); - initDataBlockList(&data_blocks); - initActions(&actions_desc); // There may be a Sequence of Actions to Apply - initActions(&actions_sig); + init_server_block(server_block, server_version); + init_data_block_list(&data_blocks); + init_actions(&actions_desc); // There may be a Sequence of Actions to Apply + init_actions(&actions_sig); USERDEFINEDTYPELIST parseduserdefinedtypelist; @@ -212,7 +212,7 @@ static int process_hierarchical_data(DATA_BLOCK* data_block, LOGSTRUCTLIST* log_ // Write data to the temporary file int protocol_id = UDA_PROTOCOL_STRUCTURES; - protocolXML(&xdr_server_output, protocol_id, XDR_SEND, nullptr, log_malloc_list, user_defined_type_list, data_block, + protocol_xml(&xdr_server_output, protocol_id, XDR_SEND, nullptr, log_malloc_list, user_defined_type_list, data_block, protocol_version, log_struct_list, io_data, private_flags, malloc_source, serverCreateXDRStream); // Close the stream and file @@ -237,7 +237,7 @@ static int process_hierarchical_data(DATA_BLOCK* data_block, LOGSTRUCTLIST* log_ // Read data from the temporary file protocol_id = UDA_PROTOCOL_STRUCTURES; - err = protocolXML(&xdr_server_input, protocol_id, XDR_RECEIVE, nullptr, log_malloc_list, user_defined_type_list, + err = protocol_xml(&xdr_server_input, protocol_id, XDR_RECEIVE, nullptr, log_malloc_list, user_defined_type_list, data_block, protocol_version, log_struct_list, io_data, private_flags, malloc_source, serverCreateXDRStream); @@ -293,16 +293,16 @@ int handle_request_fat(REQUEST_BLOCK* request_block, REQUEST_BLOCK* request_bloc int err = 0; - printClientBlock(*client_block); - printServerBlock(*server_block); - printRequestBlock(*request_block); + print_client_block(*client_block); + print_server_block(*server_block); + print_request_block(*request_block); //---------------------------------------------------------------------- // Initialise Data Structures - initDataSource(&metadata_block->data_source); - initSignalDesc(&metadata_block->signal_desc); - initSignal(&metadata_block->signal_rec); + init_data_source(&metadata_block->data_source); + init_signal_desc(&metadata_block->signal_desc); + init_signal(&metadata_block->signal_rec); //---------------------------------------------------------------------------------------------- // Decode the API Arguments: determine appropriate data plug-in to use @@ -336,7 +336,7 @@ int handle_request_fat(REQUEST_BLOCK* request_block, REQUEST_BLOCK* request_bloc assert(i == data_blocks->count); data_blocks->data = (DATA_BLOCK*)realloc(data_blocks->data, (data_blocks->count + 1) * sizeof(DATA_BLOCK)); auto data_block = &data_blocks->data[i]; - initDataBlock(data_block); + init_data_block(data_block); err = udaGetData(&depth, request, *client_block, data_block, &metadata_block->data_source, &metadata_block->signal_rec, &metadata_block->signal_desc, actions_desc, actions_sig, &pluginList, log_malloc_list, user_defined_type_list, &socket_list, protocol_version); @@ -359,11 +359,11 @@ int handle_request_fat(REQUEST_BLOCK* request_block, REQUEST_BLOCK* request_bloc UDA_LOG(UDA_LOG_DEBUG, "Pulse Number : %d \n", data_source->exp_number); UDA_LOG(UDA_LOG_DEBUG, "Pass Number : %d \n", data_source->pass); UDA_LOG(UDA_LOG_DEBUG, "Recursive # : %d \n", depth); - printRequestBlock(*request_block); - printDataSource(*data_source); - printSignal(metadata_block->signal_rec); - printSignalDesc(*signal_desc); - printDataBlockList(*data_blocks); + print_request_block(*request_block); + print_data_source(*data_source); + print_signal(metadata_block->signal_rec); + print_signal_desc(*signal_desc); + print_data_block_list(*data_blocks); print_error_stack(); UDA_LOG(UDA_LOG_DEBUG, "======================== ******************** ==========================================\n"); @@ -399,8 +399,8 @@ int do_fat_server_closedown(SERVER_BLOCK* server_block, DATA_BLOCK_LIST* data_bl //---------------------------------------------------------------------------- // Free Actions Heap - freeActions(actions_desc); - freeActions(actions_sig); + free_actions(actions_desc); + free_actions(actions_sig); //---------------------------------------------------------------------------- @@ -409,7 +409,7 @@ int do_fat_server_closedown(SERVER_BLOCK* server_block, DATA_BLOCK_LIST* data_bl *data_blocks0 = *data_blocks; - printDataBlockList(*data_blocks0); + print_data_block_list(*data_blocks0); return 0; } @@ -424,7 +424,7 @@ int startup_fat_server(SERVER_BLOCK* server_block, USERDEFINEDTYPELIST& parsedus // Open and Initialise the Socket List (Once Only) if (!socket_list_initialised) { - initSocketList(&socket_list); + init_socket_list(&socket_list); socket_list_initialised = 1; } diff --git a/source/server/initPluginList.cpp b/source/server/initPluginList.cpp index 9465d786..e78218f8 100644 --- a/source/server/initPluginList.cpp +++ b/source/server/initPluginList.cpp @@ -137,8 +137,8 @@ void uda::server::initPluginList(uda::plugins::PluginList* plugin_list, ENVIRONM */ while (fgets(buffer, STRING_LENGTH - 1, conf) != nullptr) { - convertNonPrintable2(buffer); - LeftTrimString(TrimString(buffer)); + convert_non_printable2(buffer); + left_trim_string(trim_string(buffer)); do { if (buffer[0] == '#') { break; @@ -153,25 +153,25 @@ void uda::server::initPluginList(uda::plugins::PluginList* plugin_list, ENVIRONM if (csv != nullptr && i <= 8) { csv[0] = '\0'; // Extract the sub-string ignoring the example - has a comma within text } - LeftTrimString(TrimString(next)); + left_trim_string(trim_string(next)); switch (i) { case 0: // File Format or Server Protocol or Library name or Device name etc. - strcpy(plugin_list->plugin[plugin_list->count].format, LeftTrimString(next)); + strcpy(plugin_list->plugin[plugin_list->count].format, left_trim_string(next)); // If the Format or Protocol is Not unique, the plugin that is selected will be the first // one registered: others will be ignored. break; case 1: // Plugin class: File, Server, Function or Device plugin_list->plugin[plugin_list->count].plugin_class = UDA_PLUGIN_CLASS_FILE; - if (STR_IEQUALS(LeftTrimString(next), "server")) { + if (STR_IEQUALS(left_trim_string(next), "server")) { plugin_list->plugin[plugin_list->count].plugin_class = UDA_PLUGIN_CLASS_SERVER; - } else if (STR_IEQUALS(LeftTrimString(next), "function")) { + } else if (STR_IEQUALS(left_trim_string(next), "function")) { plugin_list->plugin[plugin_list->count].plugin_class = UDA_PLUGIN_CLASS_FUNCTION; - } else if (STR_IEQUALS(LeftTrimString(next), "file")) { + } else if (STR_IEQUALS(left_trim_string(next), "file")) { plugin_list->plugin[plugin_list->count].plugin_class = UDA_PLUGIN_CLASS_FILE; - } else if (STR_IEQUALS(LeftTrimString(next), "device")) { + } else if (STR_IEQUALS(left_trim_string(next), "device")) { plugin_list->plugin[plugin_list->count].plugin_class = UDA_PLUGIN_CLASS_DEVICE; } break; @@ -180,7 +180,7 @@ void uda::server::initPluginList(uda::plugins::PluginList* plugin_list, ENVIRONM // Allow the same symbol (name of data access reader function or plugin entrypoint symbol) // but from different libraries! if (plugin_list->plugin[plugin_list->count].plugin_class != UDA_PLUGIN_CLASS_DEVICE) { - strcpy(plugin_list->plugin[plugin_list->count].symbol, LeftTrimString(next)); + strcpy(plugin_list->plugin[plugin_list->count].symbol, left_trim_string(next)); plugin_list->plugin[plugin_list->count].external = UDA_PLUGIN_EXTERNAL; // External (not linked) shared library @@ -196,16 +196,16 @@ void uda::server::initPluginList(uda::plugins::PluginList* plugin_list, ENVIRONM } else { // Device name Substitution protocol - strcpy(plugin_list->plugin[plugin_list->count].deviceProtocol, LeftTrimString(next)); + strcpy(plugin_list->plugin[plugin_list->count].deviceProtocol, left_trim_string(next)); } break; case 3: // Server Host or Name of the shared library - can contain multiple plugin symbols so // may not be unique if (plugin_list->plugin[plugin_list->count].plugin_class != UDA_PLUGIN_CLASS_DEVICE) { - strcpy(plugin_list->plugin[plugin_list->count].library, LeftTrimString(next)); + strcpy(plugin_list->plugin[plugin_list->count].library, left_trim_string(next)); } else { - strcpy(plugin_list->plugin[plugin_list->count].deviceHost, LeftTrimString(next)); + strcpy(plugin_list->plugin[plugin_list->count].deviceHost, left_trim_string(next)); } break; @@ -219,7 +219,7 @@ void uda::server::initPluginList(uda::plugins::PluginList* plugin_list, ENVIRONM strcpy(plugin_list->plugin[plugin_list->count].method, next); } } else { - strcpy(plugin_list->plugin[plugin_list->count].devicePort, LeftTrimString(next)); + strcpy(plugin_list->plugin[plugin_list->count].devicePort, left_trim_string(next)); } break; @@ -231,7 +231,7 @@ void uda::server::initPluginList(uda::plugins::PluginList* plugin_list, ENVIRONM case 6: // Permission to Cache returned values - strcpy(plugin_list->plugin[plugin_list->count].desc, LeftTrimString(next)); + strcpy(plugin_list->plugin[plugin_list->count].desc, left_trim_string(next)); if (plugin_list->plugin[plugin_list->count].desc[0] != '\0' && (plugin_list->plugin[plugin_list->count].desc[0] == 'Y' || plugin_list->plugin[plugin_list->count].desc[0] == 'y' || @@ -250,7 +250,7 @@ void uda::server::initPluginList(uda::plugins::PluginList* plugin_list, ENVIRONM case 7: // Private or Public plugin - i.e. available to external users - strcpy(plugin_list->plugin[plugin_list->count].desc, LeftTrimString(next)); + strcpy(plugin_list->plugin[plugin_list->count].desc, left_trim_string(next)); if (plugin_list->plugin[plugin_list->count].desc[0] != '\0' && (plugin_list->plugin[plugin_list->count].desc[0] == 'Y' || plugin_list->plugin[plugin_list->count].desc[0] == 'y' || @@ -265,18 +265,18 @@ void uda::server::initPluginList(uda::plugins::PluginList* plugin_list, ENVIRONM case 8: // Description - strcpy(plugin_list->plugin[plugin_list->count].desc, LeftTrimString(next)); + strcpy(plugin_list->plugin[plugin_list->count].desc, left_trim_string(next)); break; case 9: { // Example - LeftTrimString(next); + left_trim_string(next); char* p = strchr(next, '\n'); if (p != nullptr) { p[0] = '\0'; } - strcpy(plugin_list->plugin[plugin_list->count].example, LeftTrimString(next)); + strcpy(plugin_list->plugin[plugin_list->count].example, left_trim_string(next)); break; } diff --git a/source/server/makeServerRequestBlock.cpp b/source/server/makeServerRequestBlock.cpp index a2026020..9be32458 100644 --- a/source/server/makeServerRequestBlock.cpp +++ b/source/server/makeServerRequestBlock.cpp @@ -16,7 +16,7 @@ int uda::server::makeServerRequestBlock(REQUEST_BLOCK* request_block, uda::plugi int uda::server::makeServerRequestData(REQUEST_DATA* request, uda::plugins::PluginList pluginList) { - return makeRequestData(request, &pluginList, getServerEnvironment()); + return make_request_data(request, &pluginList, getServerEnvironment()); } #endif diff --git a/source/server/serverGetData.cpp b/source/server/serverGetData.cpp index ad8b77cc..8164165f 100644 --- a/source/server/serverGetData.cpp +++ b/source/server/serverGetData.cpp @@ -90,13 +90,13 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK if (STR_IEQUALS(request_data->archive, "SS") || STR_IEQUALS(request_data->archive, "SERVERSIDE")) { if (!strncasecmp(request_data->signal, "SUBSET(", 7)) { serverside = 1; - initActions(&actions_serverside); + init_actions(&actions_serverside); int rc; if ((rc = serverParseServerSide(request_data, &actions_serverside, pluginlist)) != 0) { return rc; } // Erase original SUBSET request - copyString(TrimString(request_data->signal), signal_desc->signal_name, MAXNAME); + copy_string(trim_string(request_data->signal), signal_desc->signal_name, MAXNAME); } } } else if (STR_IEQUALS(request_data->function, "subset")) { @@ -104,13 +104,13 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK if ((id = findPluginIdByFormat(request_data->archive, pluginlist)) >= 0) { if (STR_IEQUALS(pluginlist->plugin[id].symbol, "serverside")) { serverside = 1; - initActions(&actions_serverside); + init_actions(&actions_serverside); int rc; if ((rc = serverParseServerSide(request_data, &actions_serverside, pluginlist)) != 0) { return rc; } // Erase original SUBSET request - copyString(TrimString(request_data->signal), signal_desc->signal_name, MAXNAME); + copy_string(trim_string(request_data->signal), signal_desc->signal_name, MAXNAME); } } } @@ -134,7 +134,7 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK if (request_data->datasubset.nbound > 0) { UDA_LOG(UDA_LOG_DEBUG, "Calling serverSubsetData (SUBSET) %d\n", *depth); ACTION action = {}; - initAction(&action); + init_action(&action); action.actionType = UDA_SUBSET_TYPE; action.subset = request_data->datasubset; if ((rc = serverSubsetData(data_block, action, logmalloclist)) != 0) { @@ -170,8 +170,8 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK // Allways Parse Signal XML to Identify the True Data Source for this Pulse Number - not subject to client // request: get_asis (First Valid Action Record found only - others ignored) - initActions(&actions_comp_desc); - initActions(&actions_comp_sig); + init_actions(&actions_comp_desc); + init_actions(&actions_comp_sig); UDA_LOG(UDA_LOG_DEBUG, "parsing XML for a COMPOSITE Signal\n"); @@ -180,8 +180,8 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK UDA_LOG(UDA_LOG_DEBUG, "parsing XML RC? %d\n", rc); if (rc > 0) { - freeActions(&actions_comp_desc); - freeActions(&actions_comp_sig); + free_actions(&actions_comp_desc); + free_actions(&actions_comp_sig); (*depth)--; UDA_THROW_ERROR(8881, "Unable to Parse XML"); } @@ -251,8 +251,8 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK if ((strlen(actions_comp_desc.action[compId].composite.file) == 0 || strlen(actions_comp_desc.action[compId].composite.format) == 0) && request_block2.exp_number <= 0) { - freeActions(&actions_comp_desc); - freeActions(&actions_comp_sig); + free_actions(&actions_comp_desc); + free_actions(&actions_comp_sig); (*depth)--; UDA_THROW_ERROR(8888, "User Specified Composite Data Signal Not Fully Defined: Format?, File?"); @@ -267,8 +267,8 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK request_block2.exp_number > 0) { request_block2.request = REQUEST_READ_GENERIC; } else { - freeActions(&actions_comp_desc); - freeActions(&actions_comp_sig); + free_actions(&actions_comp_desc); + free_actions(&actions_comp_sig); (*depth)--; UDA_THROW_ERROR(8889, "User Specified Composite Data Signal's File Format NOT Recognised"); @@ -276,8 +276,8 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK } if (request_block2.request == REQUEST_READ_HDF5) { - strcpy(data_source->path, TrimString(request_block2.path)); // HDF5 File Location - strcpy(signal_desc->signal_name, TrimString(request_block2.signal)); // HDF5 Variable Name + strcpy(data_source->path, trim_string(request_block2.path)); // HDF5 File Location + strcpy(signal_desc->signal_name, trim_string(request_block2.signal)); // HDF5 Variable Name } } @@ -305,12 +305,12 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK signal_desc, actions_desc, actions_sig, pluginlist, logmalloclist, userdefinedtypelist, socket_list, protocolVersion); - freeActions(actions_desc); // Added 06Nov2008 - freeActions(actions_sig); + free_actions(actions_desc); // Added 06Nov2008 + free_actions(actions_sig); if (rc != 0) { // Error - freeActions(&actions_comp_desc); - freeActions(&actions_comp_sig); + free_actions(&actions_comp_desc); + free_actions(&actions_comp_sig); (*depth)--; return rc; } @@ -322,8 +322,8 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK } } else { if (rc == -1 || rc == 1) { - freeActions(&actions_comp_desc); - freeActions(&actions_comp_sig); + free_actions(&actions_comp_desc); + free_actions(&actions_comp_sig); (*depth)--; UDA_THROW_ERROR(7770, "Composite Data Signal Not Available - No XML Document to define it!"); } @@ -340,8 +340,8 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK if (isDerived) { // All Actions are applicable to the Derived/Composite Data Structure - copyActions(actions_desc, &actions_comp_desc); - copyActions(actions_sig, &actions_comp_sig); + copy_actions(actions_desc, &actions_comp_desc); + copy_actions(actions_sig, &actions_comp_sig); } else { UDA_LOG(UDA_LOG_DEBUG, "parsing XML for a Regular Signal\n"); @@ -385,12 +385,12 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK // Recursive Call for Error Data - initActions(&actions_comp_desc2); - initActions(&actions_comp_sig2); - initDataBlock(&data_block2); - initDataSource(&data_source2); - initSignal(&signal_rec2); - initSignalDesc(&signal_desc2); + init_actions(&actions_comp_desc2); + init_actions(&actions_comp_sig2); + init_data_block(&data_block2); + init_data_source(&data_source2); + init_signal(&signal_rec2); + init_signal_desc(&signal_desc2); // Check if the source file was originally defined in the client API? @@ -404,8 +404,8 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK &signal_desc2, &actions_comp_desc2, &actions_comp_sig2, pluginlist, logmalloclist, userdefinedtypelist, socket_list, protocolVersion); - freeActions(&actions_comp_desc2); - freeActions(&actions_comp_sig2); + free_actions(&actions_comp_desc2); + free_actions(&actions_comp_sig2); if (rc != 0) { freeDataBlock(&data_block2); @@ -434,9 +434,9 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK // Recursive Call for Error Data - initActions(&actions_comp_desc2); - initActions(&actions_comp_sig2); - initDataBlock(&data_block2); + init_actions(&actions_comp_desc2); + init_actions(&actions_comp_sig2); + init_data_block(&data_block2); // Check if the source file was originally defined in the client API? @@ -450,8 +450,8 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK &signal_desc2, &actions_comp_desc2, &actions_comp_sig2, pluginlist, logmalloclist, userdefinedtypelist, socket_list, protocolVersion); - freeActions(&actions_comp_desc2); - freeActions(&actions_comp_sig2); + free_actions(&actions_comp_desc2); + free_actions(&actions_comp_sig2); if (rc != 0) { freeDataBlock(&data_block2); @@ -518,22 +518,22 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK // Recursive Call for Data - initActions(&actions_comp_desc2); - initActions(&actions_comp_sig2); - initDataBlock(&data_block2); - initSignalDesc(&signal_desc2); // Added 06Nov2008 + init_actions(&actions_comp_desc2); + init_actions(&actions_comp_sig2); + init_data_block(&data_block2); + init_signal_desc(&signal_desc2); // Added 06Nov2008 // Check if the source file was originally defined in the client API? strcpy(data_source2.format, request_block2.format); strcpy(data_source2.path, request_block2.path); - strcpy(signal_desc2.signal_name, TrimString(request_block2.signal)); + strcpy(signal_desc2.signal_name, trim_string(request_block2.signal)); request_block2.request = findPluginRequestByFormat(request_block2.format, pluginlist); if (request_block2.request == REQUEST_READ_UNKNOWN) { - freeActions(&actions_comp_desc2); - freeActions(&actions_comp_sig2); + free_actions(&actions_comp_desc2); + free_actions(&actions_comp_sig2); (*depth)--; UDA_THROW_ERROR(9999, "User Specified Composite Dimension Data Signal's File Format NOT Recognised"); @@ -554,8 +554,8 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK &signal_desc2, &actions_comp_desc2, &actions_comp_sig2, pluginlist, logmalloclist, userdefinedtypelist, socket_list, protocolVersion); - freeActions(&actions_comp_desc2); - freeActions(&actions_comp_sig2); + free_actions(&actions_comp_desc2); + free_actions(&actions_comp_sig2); if (rc != 0) { freeDataBlock(&data_block2); @@ -586,9 +586,9 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK // Recursive Call for Data - initActions(&actions_comp_desc2); - initActions(&actions_comp_sig2); - initDataBlock(&data_block2); + init_actions(&actions_comp_desc2); + init_actions(&actions_comp_sig2); + init_data_block(&data_block2); // Check if the source file was originally defined in the client API? @@ -602,8 +602,8 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK &signal_desc2, &actions_comp_desc2, &actions_comp_sig2, pluginlist, logmalloclist, userdefinedtypelist, socket_list, protocolVersion); - freeActions(&actions_comp_desc2); - freeActions(&actions_comp_sig2); + free_actions(&actions_comp_desc2); + free_actions(&actions_comp_sig2); if (rc != 0) { freeDataBlock(&data_block2); @@ -634,9 +634,9 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK // Recursive Call for Data - initActions(&actions_comp_desc2); - initActions(&actions_comp_sig2); - initDataBlock(&data_block2); + init_actions(&actions_comp_desc2); + init_actions(&actions_comp_sig2); + init_data_block(&data_block2); // Check if the source file was originally defined in the client API? @@ -650,8 +650,8 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK &signal_desc2, &actions_comp_desc2, &actions_comp_sig2, pluginlist, logmalloclist, userdefinedtypelist, socket_list, protocolVersion); - freeActions(&actions_comp_desc2); - freeActions(&actions_comp_sig2); + free_actions(&actions_comp_desc2); + free_actions(&actions_comp_sig2); if (rc != 0) { freeDataBlock(&data_block2); @@ -679,7 +679,7 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK // substituting) UDA_LOG(UDA_LOG_DEBUG, "#Timing Before XML\n"); - printDataBlock(*data_block); + print_data_block(*data_block); if (!client_block.get_asis) { @@ -692,14 +692,14 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK } UDA_LOG(UDA_LOG_DEBUG, "#Timing After XML\n"); - printDataBlock(*data_block); + print_data_block(*data_block); //-------------------------------------------------------------------------------------------------------------------------- // Subset Data or Map Data when all other actions have been applied if (isDerived && compId > -1) { UDA_LOG(UDA_LOG_DEBUG, "Calling serverSubsetData (Derived) %d\n", *depth); - printDataBlock(*data_block); + print_data_block(*data_block); if ((rc = serverSubsetData(data_block, actions_desc->action[compId], logmalloclist)) != 0) { (*depth)--; @@ -714,7 +714,7 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK for (int i = 0; i < actions_desc->nactions; i++) { if (actions_desc->action[i].actionType == UDA_SUBSET_TYPE) { UDA_LOG(UDA_LOG_DEBUG, "Calling serverSubsetData (SUBSET) %d\n", *depth); - printDataBlock(*data_block); + print_data_block(*data_block); if ((rc = serverSubsetData(data_block, actions_desc->action[i], logmalloclist)) != 0) { (*depth)--; @@ -732,7 +732,7 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK if (actions_serverside.action[i].actionType == UDA_SERVER_SIDE_TYPE) { for (int j = 0; j < actions_serverside.action[i].serverside.nsubsets; j++) { UDA_LOG(UDA_LOG_DEBUG, "Calling serverSubsetData (Serverside) %d\n", *depth); - printDataBlock(*data_block); + print_data_block(*data_block); if ((rc = serverSubsetData(data_block, actions_serverside.action[i], logmalloclist)) != 0) { (*depth)--; @@ -741,7 +741,7 @@ int uda::server::udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK } } } - freeActions(&actions_serverside); + free_actions(&actions_serverside); } //-------------------------------------------------------------------------------------------------------------------------- @@ -965,7 +965,7 @@ int read_data(REQUEST_DATA* request, CLIENT_BLOCK client_block, DATA_BLOCK* data char mapping[MAXMETA] = ""; - printRequestData(*request); + print_request_data(*request); //------------------------------------------------------------------------------ // Test for Subsetting or Mapping XML: These require parsing First to identify the data signals needed. @@ -1123,7 +1123,7 @@ int read_data(REQUEST_DATA* request, CLIENT_BLOCK client_block, DATA_BLOCK* data // Initialise the Data Block - initDataBlock(data_block); + init_data_block(data_block); plugin_interface.interfaceVersion = 1; plugin_interface.pluginVersion = 0; @@ -1279,7 +1279,7 @@ int read_data(REQUEST_DATA* request, CLIENT_BLOCK client_block, DATA_BLOCK* data //---------------------------------------------------------------------------- // Initialise the Data Block Structure - initDataBlock(data_block); + init_data_block(data_block); //---------------------------------------------------------------------------- // Status values diff --git a/source/server/serverLegacyPlugin.cpp b/source/server/serverLegacyPlugin.cpp index b712e8bc..daae74e6 100644 --- a/source/server/serverLegacyPlugin.cpp +++ b/source/server/serverLegacyPlugin.cpp @@ -129,11 +129,11 @@ int uda::server::udaServerLegacyPlugin(REQUEST_DATA* request, DATA_SOURCE* data_ switch (request->request) { case REQUEST_READ_IDA: - strcpy(data_source->source_alias, TrimString(request->file)); - strcpy(data_source->filename, TrimString(request->file)); - strcpy(data_source->path, TrimString(request->path)); + strcpy(data_source->source_alias, trim_string(request->file)); + strcpy(data_source->filename, trim_string(request->file)); + strcpy(data_source->path, trim_string(request->path)); - copyString(TrimString(request->signal), signal_desc->signal_name, MAXNAME); + copy_string(trim_string(request->signal), signal_desc->signal_name, MAXNAME); data_source->exp_number = request->exp_number; data_source->pass = request->pass; @@ -148,11 +148,11 @@ int uda::server::udaServerLegacyPlugin(REQUEST_DATA* request, DATA_SOURCE* data_ break; case REQUEST_READ_NEW_PLUGIN: - strcpy(data_source->source_alias, TrimString(request->file)); - strcpy(data_source->filename, TrimString(request->file)); - strcpy(data_source->path, TrimString(request->path)); + strcpy(data_source->source_alias, trim_string(request->file)); + strcpy(data_source->filename, trim_string(request->file)); + strcpy(data_source->path, trim_string(request->path)); - copyString(TrimString(request->signal), signal_desc->signal_name, MAXNAME); + copy_string(trim_string(request->signal), signal_desc->signal_name, MAXNAME); data_source->exp_number = request->exp_number; data_source->pass = request->pass; @@ -167,13 +167,13 @@ int uda::server::udaServerLegacyPlugin(REQUEST_DATA* request, DATA_SOURCE* data_ break; case REQUEST_READ_MDS: - strcpy(data_source->filename, TrimString(request->file)); // MDS+ Tree - strcpy(data_source->server, TrimString(request->server)); // MDS+ Server Name + strcpy(data_source->filename, trim_string(request->file)); // MDS+ Tree + strcpy(data_source->server, trim_string(request->server)); // MDS+ Server Name - copyString(TrimString(request->signal), signal_desc->signal_name, MAXNAME); + copy_string(trim_string(request->signal), signal_desc->signal_name, MAXNAME); if (strlen(signal_desc->signal_name) == MAXNAME - 1) { - copyString(TrimString(request->signal), signal_desc->xml, MAXMETA); // Pass via XML member + copy_string(trim_string(request->signal), signal_desc->xml, MAXMETA); // Pass via XML member signal_desc->signal_name[0] = '\0'; } @@ -194,8 +194,8 @@ int uda::server::udaServerLegacyPlugin(REQUEST_DATA* request, DATA_SOURCE* data_ break; case REQUEST_READ_CDF: - strcpy(data_source->path, TrimString(request->path)); // netCDF File Location - copyString(TrimString(request->signal), signal_desc->signal_name, MAXNAME); + strcpy(data_source->path, trim_string(request->path)); // netCDF File Location + copy_string(trim_string(request->signal), signal_desc->signal_name, MAXNAME); UDA_LOG(UDA_LOG_DEBUG, "Request: readnetCDF \n"); UDA_LOG(UDA_LOG_DEBUG, "netCDF File : %s \n", request->path); @@ -203,8 +203,8 @@ int uda::server::udaServerLegacyPlugin(REQUEST_DATA* request, DATA_SOURCE* data_ break; case REQUEST_READ_HDF5: - strcpy(data_source->path, TrimString(request->path)); // HDF5 File Location - copyString(TrimString(request->signal), signal_desc->signal_name, MAXNAME); + strcpy(data_source->path, trim_string(request->path)); // HDF5 File Location + copy_string(trim_string(request->signal), signal_desc->signal_name, MAXNAME); UDA_LOG(UDA_LOG_DEBUG, "Request: ReadHDF5 \n"); UDA_LOG(UDA_LOG_DEBUG, "HDF5 File : %s \n", request->path); @@ -221,32 +221,32 @@ int uda::server::udaServerLegacyPlugin(REQUEST_DATA* request, DATA_SOURCE* data_ break; case REQUEST_READ_UFILE: - strcpy(data_source->path, TrimString(request->path)); // UFile File Location + strcpy(data_source->path, trim_string(request->path)); // UFile File Location UDA_LOG(UDA_LOG_DEBUG, "Request: ReadUFile \n"); UDA_LOG(UDA_LOG_DEBUG, "UFile File : %s \n", request->path); break; case REQUEST_READ_FILE: - strcpy(data_source->path, TrimString(request->path)); // File Location + strcpy(data_source->path, trim_string(request->path)); // File Location UDA_LOG(UDA_LOG_DEBUG, "Request: ReadBytes \n"); UDA_LOG(UDA_LOG_DEBUG, "File : %s \n", request->path); break; case REQUEST_READ_HDATA: - strcpy(data_source->path, TrimString(request->path)); // File Location + strcpy(data_source->path, trim_string(request->path)); // File Location UDA_LOG(UDA_LOG_DEBUG, "Request: ReadHData \n"); UDA_LOG(UDA_LOG_DEBUG, "File : %s \n", request->path); break; case REQUEST_READ_SQL: - strcpy(data_source->path, TrimString(request->path)); // SQL database etc. - strcpy(data_source->server, TrimString(request->server)); // SQL server host - strcpy(data_source->format, TrimString(request->format)); - strcpy(data_source->archive, TrimString(request->archive)); - strcpy(data_source->device_name, TrimString(request->device_name)); + strcpy(data_source->path, trim_string(request->path)); // SQL database etc. + strcpy(data_source->server, trim_string(request->server)); // SQL server host + strcpy(data_source->format, trim_string(request->format)); + strcpy(data_source->archive, trim_string(request->archive)); + strcpy(data_source->device_name, trim_string(request->device_name)); UDA_LOG(UDA_LOG_DEBUG, "Request: ReadSQL \n"); UDA_LOG(UDA_LOG_DEBUG, "SQL : %s \n", request->signal); @@ -259,10 +259,10 @@ int uda::server::udaServerLegacyPlugin(REQUEST_DATA* request, DATA_SOURCE* data_ if (data_source->exp_number == 0 && data_source->pass == -1) { // May be passed in Path String strcpy(work, request->path); if (work[0] == '/' && (token = strtok(work, "/")) != nullptr) { // Tokenise the remaining string - if (IsNumber(token)) { // Is the First token an integer number? + if (is_number(token)) { // Is the First token an integer number? request->exp_number = atoi(token); if ((token = strtok(nullptr, "/")) != nullptr) { // Next Token - if (IsNumber(token)) { + if (is_number(token)) { request->pass = atoi(token); // Must be the Pass number } else { strcpy(request->tpass, token); // anything else @@ -278,10 +278,10 @@ int uda::server::udaServerLegacyPlugin(REQUEST_DATA* request, DATA_SOURCE* data_ break; case REQUEST_READ_PPF: - strcpy(data_source->source_alias, TrimString(request->file)); - strcpy(data_source->filename, TrimString(request->file)); - strcpy(data_source->path, TrimString(request->path)); - copyString(TrimString(request->signal), signal_desc->signal_name, MAXNAME); + strcpy(data_source->source_alias, trim_string(request->file)); + strcpy(data_source->filename, trim_string(request->file)); + strcpy(data_source->path, trim_string(request->path)); + copy_string(trim_string(request->signal), signal_desc->signal_name, MAXNAME); data_source->exp_number = request->exp_number; data_source->pass = request->pass; data_source->type = ' '; @@ -295,7 +295,7 @@ int uda::server::udaServerLegacyPlugin(REQUEST_DATA* request, DATA_SOURCE* data_ break; case REQUEST_READ_JPF: - copyString(TrimString(request->signal), signal_desc->signal_name, MAXNAME); + copy_string(trim_string(request->signal), signal_desc->signal_name, MAXNAME); data_source->exp_number = request->exp_number; UDA_LOG(UDA_LOG_DEBUG, "Request: Read JPF \n"); diff --git a/source/server/serverPlugin.cpp b/source/server/serverPlugin.cpp index 9a1ddf33..223793c7 100644 --- a/source/server/serverPlugin.cpp +++ b/source/server/serverPlugin.cpp @@ -129,7 +129,7 @@ void resetPlugins(const uda::plugins::PluginList* plugin_list) { REQUEST_DATA request_block; uda::plugins::UdaPluginInterface plugin_interface; - initRequestData(&request_block); + init_request_data(&request_block); strcpy(request_block.function, "reset"); plugin_interface.interfaceVersion = 1; @@ -348,12 +348,12 @@ int uda::server::udaServerPlugin(REQUEST_DATA* request, DATA_SOURCE* data_source //---------------------------------------------------------------------------------------------- // Decode the API Arguments: determine appropriate data reader plug-in - if ((err = makeRequestData(request, plugin_list, environment)) != 0) { + if ((err = make_request_data(request, plugin_list, environment)) != 0) { return err; } UDA_LOG(UDA_LOG_DEBUG, "request_block\n"); - printRequestData(*request); + print_request_data(*request); //---------------------------------------------------------------------------------------------- // Does the Path to Private Files contain hierarchical components not seen by the server? @@ -361,7 +361,7 @@ int uda::server::udaServerPlugin(REQUEST_DATA* request, DATA_SOURCE* data_source if (strlen(request->server) == 0 && request->request != REQUEST_READ_SERVERSIDE) { // Must be a File plugin - if ((err = pathReplacement(request->path, environment)) != 0) { + if ((err = path_replacement(request->path, environment)) != 0) { return err; } } @@ -369,17 +369,17 @@ int uda::server::udaServerPlugin(REQUEST_DATA* request, DATA_SOURCE* data_source //---------------------------------------------------------------------- // Copy request details into the data_source structure mimicking a SQL query - strcpy(data_source->source_alias, TrimString(request->file)); - strcpy(data_source->filename, TrimString(request->file)); - strcpy(data_source->path, TrimString(request->path)); + strcpy(data_source->source_alias, trim_string(request->file)); + strcpy(data_source->filename, trim_string(request->file)); + strcpy(data_source->path, trim_string(request->path)); - copyString(TrimString(request->signal), signal_desc->signal_name, MAXNAME); + copy_string(trim_string(request->signal), signal_desc->signal_name, MAXNAME); - strcpy(data_source->server, TrimString(request->server)); + strcpy(data_source->server, trim_string(request->server)); - strcpy(data_source->format, TrimString(request->format)); - strcpy(data_source->archive, TrimString(request->archive)); - strcpy(data_source->device_name, TrimString(request->device_name)); + strcpy(data_source->format, trim_string(request->format)); + strcpy(data_source->archive, trim_string(request->archive)); + strcpy(data_source->device_name, trim_string(request->device_name)); data_source->exp_number = request->exp_number; data_source->pass = request->pass; @@ -465,7 +465,7 @@ int uda::server::udaProvenancePlugin(CLIENT_BLOCK* client_block, REQUEST_DATA* o } REQUEST_DATA request; - initRequestData(&request); + init_request_data(&request); strcpy(request.api_delim, "::"); strcpy(request.source, ""); @@ -491,7 +491,7 @@ int uda::server::udaProvenancePlugin(CLIENT_BLOCK* client_block, REQUEST_DATA* o UDA_LOG(UDA_LOG_DEBUG, "Provenance Plugin signal: %s\n", request.signal); - makeRequestData(&request, plugin_list, environment); + make_request_data(&request, plugin_list, environment); int err, rc, reset; DATA_BLOCK data_block; @@ -499,7 +499,7 @@ int uda::server::udaProvenancePlugin(CLIENT_BLOCK* client_block, REQUEST_DATA* o // Initialise the Data Block - initDataBlock(&data_block); + init_data_block(&data_block); UDA_LOG(UDA_LOG_DEBUG, "Creating plugin interface\n"); @@ -550,7 +550,7 @@ int uda::server::udaProvenancePlugin(CLIENT_BLOCK* client_block, REQUEST_DATA* o UDA_LOG(UDA_LOG_DEBUG, "housekeeping\n"); - freeNameValueList(&request.nameValueList); + free_name_value_list(&request.nameValueList); UDA_LOG(UDA_LOG_DEBUG, "testing for bug!!!\n"); if (data_block.opaque_type != UDA_OPAQUE_TYPE_UNKNOWN || data_block.opaque_count != 0 || @@ -658,7 +658,7 @@ int uda::server::udaServerMetaDataPlugin(const uda::plugins::PluginList* plugin_ } DATA_BLOCK data_block; - initDataBlock(&data_block); + init_data_block(&data_block); data_block.signal_rec = signal_rec; USERDEFINEDTYPELIST userdefinedtypelist; diff --git a/source/server/serverSubsetData.cpp b/source/server/serverSubsetData.cpp index 4fddee17..083fa248 100644 --- a/source/server/serverSubsetData.cpp +++ b/source/server/serverSubsetData.cpp @@ -102,7 +102,7 @@ int process_subset_operation(int ii, SUBSET subset, DATA_BLOCK* data_block, LOGM if (dim_id < 0 || dim_id >= (int)data_block->rank) { UDA_LOG(UDA_LOG_ERROR, "DIM id = %d, Rank = %d, Test = %d \n", dim_id, data_block->rank, dim_id >= (int)data_block->rank); - printDataBlock(*data_block); + print_data_block(*data_block); UDA_THROW_ERROR( 9999, "Data Subsetting is Impossible as the subset Dimension is not Compatible with the Rank of the Signal"); @@ -309,7 +309,7 @@ int process_subset_operation(int ii, SUBSET subset, DATA_BLOCK* data_block, LOGM data_block->dims = (DIMS*)realloc((void*)data_block->dims, rank * sizeof(DIMS)); for (int k = k0; k < rank; k++) { - initDimBlock(&data_block->dims[k]); + init_dim_block(&data_block->dims[k]); if (shape == nullptr) { data_block->dims[k].dim_n = data_n; } else { @@ -331,7 +331,7 @@ int process_subset_operation(int ii, SUBSET subset, DATA_BLOCK* data_block, LOGM data_block->dims = (DIMS*)realloc((void*)data_block->dims, data_block->rank * sizeof(DIMS)); for (unsigned int k = k0; k < data_block->rank; k++) { - initDimBlock(&data_block->dims[k]); + init_dim_block(&data_block->dims[k]); data_block->dims[k].dim_n = udt->compoundfield[i].shape[k - k0]; data_block->dims[k].data_type = UDA_TYPE_UNSIGNED_INT; data_block->dims[k].compressed = 1; @@ -379,7 +379,7 @@ int process_subset_operation(int ii, SUBSET subset, DATA_BLOCK* data_block, LOGM // Decompress the dimensional data if necessary & free Heap Associated with Compression DIMS new_dim; - initDimBlock(&new_dim); // Holder for the Sub-setted Dimension (part copy of the original) + init_dim_block(&new_dim); // Holder for the Sub-setted Dimension (part copy of the original) auto dim = &(data_block->dims[dim_id]); // the original dimension to be subset @@ -527,7 +527,7 @@ int process_subset_operation(int ii, SUBSET subset, DATA_BLOCK* data_block, LOGM //---------------------------------------------------------------------------------------------------------------------------- // Build the New Sub-setted Dimension - printDataBlock(*data_block); + print_data_block(*data_block); UDA_LOG(UDA_LOG_DEBUG, "\n\n\n*** dim->data_type: %d\n\n\n", dim->data_type); UDA_LOG(UDA_LOG_DEBUG, "\n\n\n*** dim->errhi != nullptr: %d\n\n\n", dim->errhi != nullptr); UDA_LOG(UDA_LOG_DEBUG, "\n\n\n*** dim->errlo != nullptr: %d\n\n\n", dim->errlo != nullptr); @@ -557,7 +557,7 @@ int process_subset_operation(int ii, SUBSET subset, DATA_BLOCK* data_block, LOGM //----------------------------------------------------------------------------------------------------------------------- // Reshape and Save the Subsetted Data - printDataBlock(*data_block); + print_data_block(*data_block); int n_data; char* new_data; @@ -677,7 +677,7 @@ int apply_minimum(SUBSET subset, DATA_BLOCK* data_block) p2[0] = ' '; p3 = strchr(p2, ')'); p3[0] = '\0'; - if (IsNumber(p2)) { + if (is_number(p2)) { dim_id = atoi(p2); } else { // ERROR @@ -867,7 +867,7 @@ int apply_maximum(SUBSET subset, DATA_BLOCK* data_block) p2[0] = ' '; p3 = strchr(p2, ')'); p3[0] = '\0'; - if (IsNumber(p2)) { + if (is_number(p2)) { dim_id = atoi(p2); } else { // ERROR @@ -1053,7 +1053,7 @@ int apply_count(SUBSET subset, DATA_BLOCK* data_block) if (p1 == nullptr) { count[0] = (unsigned int)data_block->data_n; freeDataBlock(data_block); - initDataBlock(data_block); + init_data_block(data_block); data_block->data_n = 1; data_block->data = (char*)count; data_block->data_type = UDA_TYPE_UNSIGNED_INT; @@ -1064,7 +1064,7 @@ int apply_count(SUBSET subset, DATA_BLOCK* data_block) p2[0] = ' '; p3 = strchr(p2, ')'); p3[0] = '\0'; - if (IsNumber(p2)) { + if (is_number(p2)) { dim_id = atoi(p2); } else { // ERROR @@ -1173,10 +1173,10 @@ int apply_const(SUBSET subset, DATA_BLOCK* data_block) p2[0] = ' '; p3 = strchr(p2, ')'); p3[0] = '\0'; - TrimString(p2); - LeftTrimString(p2); + trim_string(p2); + left_trim_string(p2); UDA_LOG(UDA_LOG_DEBUG, "p2 = [%s]\n", p2); - if (IsFloat(p2)) { + if (is_float(p2)) { value = atof(p2); } else { UDA_LOG(UDA_LOG_DEBUG, "IsFloat FALSE!\n"); @@ -1229,10 +1229,10 @@ int apply_order(SUBSET subset, DATA_BLOCK* data_block) p2[0] = ' '; p3 = strchr(p2, ')'); p3[0] = '\0'; - TrimString(p2); - LeftTrimString(p2); + trim_string(p2); + left_trim_string(p2); UDA_LOG(UDA_LOG_DEBUG, "p2 = [%s]\n", p2); - if (IsNumber(p2)) { + if (is_number(p2)) { data_block->order = (int)atof(p2); } else { // ERROR @@ -1375,8 +1375,8 @@ int apply_functions(SUBSET subset, DATA_BLOCK* data_block) int uda::server::serverSubsetData(DATA_BLOCK* data_block, const ACTION& action, LOGMALLOCLIST* logmalloclist) { - printAction(action); - printDataBlock(*data_block); + print_action(action); + print_data_block(*data_block); //----------------------------------------------------------------------------------------------------------------------- // How many sets of sub-setting operations? @@ -1531,7 +1531,7 @@ int uda::server::serverParseServerSide(REQUEST_DATA* request_block, ACTIONS* act std::string func = signal.substr(0, l_pos); std::string args = signal.substr(l_pos + 1, r_pos - l_pos - 1); strcpy(request_block->function, func.c_str()); - freeNameValueList(&request_block->nameValueList); + free_name_value_list(&request_block->nameValueList); name_value_pairs(args.c_str(), &request_block->nameValueList, true); } @@ -1545,13 +1545,13 @@ int uda::server::serverParseServerSide(REQUEST_DATA* request_block, ACTIONS* act UDA_THROW_ERROR(9999, "Unable to Allocate Heap memory"); } - initAction(&action[nactions - 1]); + init_action(&action[nactions - 1]); action[nactions - 1].actionType = UDA_SERVER_SIDE_TYPE; action[nactions - 1].inRange = 1; action[nactions - 1].actionId = nactions; - initServerside(&action[nactions - 1].serverside); + init_server_side(&action[nactions - 1].serverside); int nsubsets = 1; if ((subsets = (SUBSET*)malloc(sizeof(SUBSET))) == nullptr) { @@ -1559,7 +1559,7 @@ int uda::server::serverParseServerSide(REQUEST_DATA* request_block, ACTIONS* act } for (int i = 0; i < nsubsets; i++) { - initSubset(&subsets[i]); + init_subset(&subsets[i]); } action[nactions - 1].serverside.nsubsets = 1; @@ -1576,10 +1576,10 @@ int uda::server::serverParseServerSide(REQUEST_DATA* request_block, ACTIONS* act // Extract a Structure member size_t member_pos = options.find("member="); strcpy(subsets[nsubsets - 1].member, &options[member_pos + 7]); - LeftTrimString(subsets[nsubsets - 1].member); + left_trim_string(subsets[nsubsets - 1].member); if (subsets[nsubsets - 1].member[0] == '"') { subsets[nsubsets - 1].member[0] = ' '; - LeftTrimString(subsets[nsubsets - 1].member); + left_trim_string(subsets[nsubsets - 1].member); } char* p = nullptr; if ((p = strchr(subsets[nsubsets - 1].member, '"')) != nullptr) { @@ -1596,10 +1596,10 @@ int uda::server::serverParseServerSide(REQUEST_DATA* request_block, ACTIONS* act // Identify a function size_t function_pos = options.find("function="); strcpy(subsets[nsubsets - 1].function, &options[function_pos + 9]); - LeftTrimString(subsets[nsubsets - 1].function); + left_trim_string(subsets[nsubsets - 1].function); if (subsets[nsubsets - 1].function[0] == '"') { subsets[nsubsets - 1].function[0] = ' '; - LeftTrimString(subsets[nsubsets - 1].function); + left_trim_string(subsets[nsubsets - 1].function); } char* p = nullptr; if ((p = strchr(subsets[nsubsets - 1].function, '"')) != nullptr) { @@ -1647,7 +1647,7 @@ int uda::server::serverParseServerSide(REQUEST_DATA* request_block, ACTIONS* act // for (int i = 0; i < nbound; i++) { - int rc = parseOperation(&subsets[nsubsets - 1]); + int rc = parse_operation(&subsets[nsubsets - 1]); if (rc != 0) { return rc; } diff --git a/source/server/udaLegacyServer.cpp b/source/server/udaLegacyServer.cpp index 9a0a260a..eabe6273 100644 --- a/source/server/udaLegacyServer.cpp +++ b/source/server/udaLegacyServer.cpp @@ -81,10 +81,10 @@ int uda::server::legacyServer(CLIENT_BLOCK client_block, const uda::plugins::Plu init_error_stack(); - initServerBlock(&server_block, server_version); - initDataBlock(&data_block); - initActions(&actions_desc); // There may be a Sequence of Actions to Apply - initActions(&actions_sig); + init_server_block(&server_block, server_version); + init_data_block(&data_block); + init_actions(&actions_desc); // There may be a Sequence of Actions to Apply + init_actions(&actions_sig); USERDEFINEDTYPELIST parseduserdefinedtypelist; @@ -104,13 +104,13 @@ int uda::server::legacyServer(CLIENT_BLOCK client_block, const uda::plugins::Plu // Initialise the Client Structure - only if this is not the first time in the wait loop if (normalLegacyWait) { - initClientBlock(&client_block, 0, ""); + init_client_block(&client_block, 0, ""); } //---------------------------------------------------------------------------- // Initialise the Request Structure - initRequestBlock(&request_block); + init_request_block(&request_block); //---------------------------------------------------------------------------- // Client and Server States @@ -220,9 +220,9 @@ int uda::server::legacyServer(CLIENT_BLOCK client_block, const uda::plugins::Plu UDA_LOG(UDA_LOG_DEBUG, "Request Block Received\n"); UDA_LOG(UDA_LOG_DEBUG, "XDR #C xdrrec_eof ? %d\n", rc); - printClientBlock(client_block); - printServerBlock(server_block); - printRequestBlock(request_block); + print_client_block(client_block); + print_server_block(server_block); + print_request_block(request_block); //------------------------------------------------------------------------------------------------------------------ // Prepend Proxy Host to Source to redirect client request @@ -317,16 +317,16 @@ int uda::server::legacyServer(CLIENT_BLOCK client_block, const uda::plugins::Plu //---------------------------------------------------------------------- // Initialise Data Structures - initDataSource(&data_source); - initSignalDesc(&signal_desc); - initSignal(&signal_rec); + init_data_source(&data_source); + init_signal_desc(&signal_desc); + init_signal(&signal_rec); //---------------------------------------------------------------------------------------------- // If this is a PUT request then receive the putData structure REQUEST_DATA* request_data = &request_block.requests[0]; - initPutDataBlockList(&(request_data->putDataBlockList)); + init_put_data_block_list(&(request_data->putDataBlockList)); if (request_data->put) { @@ -389,11 +389,11 @@ int uda::server::legacyServer(CLIENT_BLOCK client_block, const uda::plugins::Plu UDA_LOG(UDA_LOG_DEBUG, "Pulse Number : %d \n", data_source.exp_number); UDA_LOG(UDA_LOG_DEBUG, "Pass Number : %d \n", data_source.pass); UDA_LOG(UDA_LOG_DEBUG, "Recursive # : %d \n", depth); - printRequestBlock(request_block); - printDataSource(data_source); - printSignal(signal_rec); - printSignalDesc(signal_desc); - printDataBlock(data_block); + print_request_block(request_block); + print_data_source(data_source); + print_signal(signal_rec); + print_signal_desc(signal_desc); + print_data_block(data_block); print_error_stack(); UDA_LOG(UDA_LOG_DEBUG, "======================== ******************** ==========================================\n"); @@ -421,8 +421,8 @@ int uda::server::legacyServer(CLIENT_BLOCK client_block, const uda::plugins::Plu data_block.data_type = UDA_TYPE_CHAR; } - if (data_block.data_n > 0 && (protocolVersionTypeTest(protocolVersion, data_block.data_type) || - protocolVersionTypeTest(protocolVersion, data_block.error_type))) { + if (data_block.data_n > 0 && (protocol_version_type_test(protocolVersion, data_block.data_type) || + protocol_version_type_test(protocolVersion, data_block.error_type))) { err = 999; add_error(UDA_CODE_ERROR_TYPE, __func__, err, "The Data has a type that cannot be passed to the Client: A newer client library version " @@ -434,8 +434,8 @@ int uda::server::legacyServer(CLIENT_BLOCK client_block, const uda::plugins::Plu DIMS dim; for (unsigned int i = 0; i < data_block.rank; i++) { dim = data_block.dims[i]; - if (protocolVersionTypeTest(protocolVersion, dim.data_type) || - protocolVersionTypeTest(protocolVersion, dim.error_type)) { + if (protocol_version_type_test(protocolVersion, dim.data_type) || + protocol_version_type_test(protocolVersion, dim.error_type)) { err = 999; add_error(UDA_CODE_ERROR_TYPE, __func__, err, "A Coordinate Data has a numerical type that cannot be passed to the Client: A " @@ -464,7 +464,7 @@ int uda::server::legacyServer(CLIENT_BLOCK client_block, const uda::plugins::Plu concat_error(&server_block.idamerrorstack); // Update Server State with Error Stack close_error(); - printServerBlock(server_block); + print_server_block(server_block); if (server_block.idamerrorstack.nerrors > 0) { server_block.error = server_block.idamerrorstack.idamerror[0].code; @@ -614,7 +614,7 @@ int uda::server::legacyServer(CLIENT_BLOCK client_block, const uda::plugins::Plu break; } - printDataBlock(data_block); + print_data_block(data_block); UDA_LOG(UDA_LOG_DEBUG, "Sending Data Block Structure to Client\n"); protocol_id = UDA_PROTOCOL_DATA_BLOCK_LIST; @@ -732,10 +732,10 @@ int uda::server::legacyServer(CLIENT_BLOCK client_block, const uda::plugins::Plu freeDataBlock(&data_block); UDA_LOG(UDA_LOG_DEBUG, "freeActions\n"); - freeActions(&actions_desc); + free_actions(&actions_desc); UDA_LOG(UDA_LOG_DEBUG, "freeActions\n"); - freeActions(&actions_sig); + free_actions(&actions_sig); UDA_LOG(UDA_LOG_DEBUG, "freeRequestBlock\n"); freeRequestBlock(&request_block); @@ -756,7 +756,7 @@ int uda::server::legacyServer(CLIENT_BLOCK client_block, const uda::plugins::Plu close_error(); UDA_LOG(UDA_LOG_DEBUG, "initServerBlock\n"); - initServerBlock(&server_block, server_version); + init_server_block(&server_block, server_version); UDA_LOG(UDA_LOG_DEBUG, "At End of Error Trap\n"); diff --git a/source/server/udaServer.cpp b/source/server/udaServer.cpp index 9559da0c..4cc29d68 100644 --- a/source/server/udaServer.cpp +++ b/source/server/udaServer.cpp @@ -150,10 +150,10 @@ int uda::server::uda_server(uda::client_server::CLIENT_BLOCK client_block) // Reinitialised after each logging action init_error_stack(); - initServerBlock(&server_block, server_version); - initActions(&actions_desc); // There may be a Sequence of Actions to Apply - initActions(&actions_sig); - initRequestBlock(&request_block); + init_server_block(&server_block, server_version); + init_actions(&actions_desc); // There may be a Sequence of Actions to Apply + init_actions(&actions_sig); + init_request_block(&request_block); uda::cache::UdaCache* cache = uda::cache::open_cache(); @@ -210,7 +210,7 @@ int report_to_client(SERVER_BLOCK* server_block, DATA_BLOCK_LIST* data_block_lis *total_datablock_size = countDataBlockListSize(data_block_list, client_block); - printServerBlock(*server_block); + print_server_block(*server_block); //------------------------------------------------------------------------------------------------ // Send the server block and all data in a single (minimal number) tcp packet @@ -317,7 +317,7 @@ int report_to_client(SERVER_BLOCK* server_block, DATA_BLOCK_LIST* data_block_lis //---------------------------------------------------------------------------- // Send the Data - printDataBlockList(*data_block_list); + print_data_block_list(*data_block_list); UDA_LOG(UDA_LOG_DEBUG, "Sending Data Block Structure to Client\n"); if (protocol_version < 9) { @@ -401,7 +401,7 @@ int handle_request(REQUEST_BLOCK* request_block, CLIENT_BLOCK* client_block, SER int err = 0; - initClientBlock(client_block, 0, ""); + init_client_block(client_block, 0, ""); UDA_LOG(UDA_LOG_DEBUG, "Waiting to receive Client Block\n"); @@ -500,9 +500,9 @@ int handle_request(REQUEST_BLOCK* request_block, CLIENT_BLOCK* client_block, SER UDA_LOG(UDA_LOG_DEBUG, "Request Block Received\n"); - printClientBlock(*client_block); - printServerBlock(*server_block); - printRequestBlock(*request_block); + print_client_block(*client_block); + print_server_block(*server_block); + print_request_block(*request_block); data_block_list->count = request_block->num_requests; data_block_list->data = (DATA_BLOCK*)calloc(data_block_list->count, sizeof(DATA_BLOCK)); @@ -693,9 +693,9 @@ int handle_request(REQUEST_BLOCK* request_block, CLIENT_BLOCK* client_block, SER //---------------------------------------------------------------------- // Initialise Data Structures - initDataSource(&metadata_block->data_source); - initSignalDesc(&metadata_block->signal_desc); - initSignal(&metadata_block->signal_rec); + init_data_source(&metadata_block->data_source); + init_signal_desc(&metadata_block->signal_desc); + init_signal(&metadata_block->signal_rec); //---------------------------------------------------------------------------------------------- // If this is a PUT request then receive the putData structure @@ -703,7 +703,7 @@ int handle_request(REQUEST_BLOCK* request_block, CLIENT_BLOCK* client_block, SER for (int i = 0; i < request_block->num_requests; ++i) { REQUEST_DATA* request = &request_block->requests[0]; - initPutDataBlockList(&request->putDataBlockList); + init_put_data_block_list(&request->putDataBlockList); if (request->put) { if ((err = protocol2(server_input, UDA_PROTOCOL_PUTDATA_BLOCK_LIST, XDR_RECEIVE, nullptr, log_malloc_list, @@ -783,11 +783,11 @@ int handle_request(REQUEST_BLOCK* request_block, CLIENT_BLOCK* client_block, SER UDA_LOG(UDA_LOG_DEBUG, "Pulse Number : %d \n", data_source->exp_number); UDA_LOG(UDA_LOG_DEBUG, "Pass Number : %d \n", data_source->pass); // UDA_LOG(UDA_LOG_DEBUG, "Recursive # : %d \n", depth); - printRequestBlock(*request_block); - printDataSource(*data_source); - printSignal(metadata_block->signal_rec); - printSignalDesc(*signal_desc); - printDataBlockList(*data_block_list); + print_request_block(*request_block); + print_data_source(*data_source); + print_signal(metadata_block->signal_rec); + print_signal_desc(*signal_desc); + print_data_block_list(*data_block_list); print_error_stack(); UDA_LOG(UDA_LOG_DEBUG, "======================== ******************** ==========================================\n"); @@ -819,8 +819,8 @@ int handle_request(REQUEST_BLOCK* request_block, CLIENT_BLOCK* client_block, SER data_block->data_type = UDA_TYPE_CHAR; } - if (data_block->data_n > 0 && (protocolVersionTypeTest(protocol_version, data_block->data_type) || - protocolVersionTypeTest(protocol_version, data_block->error_type))) { + if (data_block->data_n > 0 && (protocol_version_type_test(protocol_version, data_block->data_type) || + protocol_version_type_test(protocol_version, data_block->error_type))) { UDA_THROW_ERROR( 999, "The Data has a type that cannot be passed to the Client: A newer client library version is required."); @@ -830,8 +830,8 @@ int handle_request(REQUEST_BLOCK* request_block, CLIENT_BLOCK* client_block, SER DIMS dim; for (unsigned int j = 0; j < data_block->rank; j++) { dim = data_block->dims[j]; - if (protocolVersionTypeTest(protocol_version, dim.data_type) || - protocolVersionTypeTest(protocol_version, dim.error_type)) { + if (protocol_version_type_test(protocol_version, dim.data_type) || + protocol_version_type_test(protocol_version, dim.error_type)) { UDA_THROW_ERROR(999, "A Coordinate Data has a numerical type that cannot be passed to the Client: " "A newer client library version is required."); } @@ -907,10 +907,10 @@ int do_server_loop(REQUEST_BLOCK* request_block, DATA_BLOCK_LIST* data_block_lis freeDataBlockList(data_block_list); UDA_LOG(UDA_LOG_DEBUG, "freeActions\n"); - freeActions(actions_desc); + free_actions(actions_desc); UDA_LOG(UDA_LOG_DEBUG, "freeActions\n"); - freeActions(actions_sig); + free_actions(actions_sig); freeRequestBlock(request_block); @@ -930,7 +930,7 @@ int do_server_loop(REQUEST_BLOCK* request_block, DATA_BLOCK_LIST* data_block_lis close_error(); UDA_LOG(UDA_LOG_DEBUG, "initServerBlock\n"); - initServerBlock(server_block, server_version); + init_server_block(server_block, server_version); //---------------------------------------------------------------------------- // Server Wait Loop @@ -1006,7 +1006,7 @@ int authenticateClient(CLIENT_BLOCK* client_block, SERVER_BLOCK* server_block) { static int authenticationNeeded = 1; // No data access until this is set TRUE - initClientBlock(client_block, 0, ""); + init_client_block(client_block, 0, ""); if (authenticationNeeded && protocolVersion >= UDA_SECURITY_VERSION) { // User or intermediate server Must Authenticate @@ -1056,7 +1056,7 @@ int handshake_client(CLIENT_BLOCK* client_block, SERVER_BLOCK* server_block, int { // Exchange version details - once only - initClientBlock(client_block, 0, ""); + init_client_block(client_block, 0, ""); // Receive the client block, respecting earlier protocol versions @@ -1080,7 +1080,7 @@ int handshake_client(CLIENT_BLOCK* client_block, SERVER_BLOCK* server_block, int if (err == 0) { UDA_LOG(UDA_LOG_DEBUG, "Initial Client Block received\n"); - printClientBlock(*client_block); + print_client_block(*client_block); } // Test for an immediate CLOSEDOWN instruction @@ -1109,7 +1109,7 @@ int handshake_client(CLIENT_BLOCK* client_block, SERVER_BLOCK* server_block, int // Send the server block UDA_LOG(UDA_LOG_DEBUG, "Sending Initial Server Block \n"); - printServerBlock(*server_block); + print_server_block(*server_block); int protocol_id = UDA_PROTOCOL_SERVER_BLOCK; // Receive Server Block: Server Aknowledgement @@ -1181,7 +1181,7 @@ int startup_server(SERVER_BLOCK* server_block, XDR*& server_input, XDR*& server_ // Open and Initialise the Socket List (Once Only) if (!socket_list_initialised) { - initSocketList(&socket_list); + init_socket_list(&socket_list); socket_list_initialised = 1; } diff --git a/source/server/writer.cpp b/source/server/writer.cpp index 161902f2..5ceb2906 100644 --- a/source/server/writer.cpp +++ b/source/server/writer.cpp @@ -53,7 +53,7 @@ int uda::server::server_read(void* iohandle, char* buf, int count) // Wait until there are data to be read from the socket - setSelectParms(serverSocket, &rfds, &tv, io_data->server_tot_block_time); + set_select_params(serverSocket, &rfds, &tv, io_data->server_tot_block_time); tvc = tv; while (select(serverSocket + 1, &rfds, nullptr, nullptr, &tvc) <= 0) { @@ -64,7 +64,7 @@ int uda::server::server_read(void* iohandle, char* buf, int count) return -1; } - updateSelectParms(serverSocket, &rfds, &tv, *io_data->server_tot_block_time); // Keep trying ... + update_select_params(serverSocket, &rfds, &tv, *io_data->server_tot_block_time); // Keep trying ... tvc = tv; } @@ -97,7 +97,7 @@ int uda::server::server_write(void* iohandle, char* buf, int count) // Block IO until the Socket is ready to write to Client - setSelectParms(serverSocket, &wfds, &tv, io_data->server_tot_block_time); + set_select_params(serverSocket, &wfds, &tv, io_data->server_tot_block_time); while (select(serverSocket + 1, nullptr, &wfds, nullptr, &tv) <= 0) { *io_data->server_tot_block_time += tv.tv_usec / 1000; @@ -105,7 +105,7 @@ int uda::server::server_write(void* iohandle, char* buf, int count) UDA_LOG(UDA_LOG_DEBUG, "Total Blocking Time: %d (ms)\n", *io_data->server_tot_block_time); return -1; } - updateSelectParms(serverSocket, &wfds, &tv, *io_data->server_tot_block_time); + update_select_params(serverSocket, &wfds, &tv, *io_data->server_tot_block_time); } // Write to socket, checking for EINTR, as happens if called from IDL diff --git a/source/server2/apply_XML.cpp b/source/server2/apply_XML.cpp index 4ab5df2f..6d6d456d 100644 --- a/source/server2/apply_XML.cpp +++ b/source/server2/apply_XML.cpp @@ -44,30 +44,30 @@ int uda::server_parse_signal_XML(uda::client_server::DATA_SOURCE data_source, ud //---------------------------------------------------------------------- // Initialise - initActions(actions_desc); // Array of actions from the Signal_Desc record - initActions(actions_sig); // Array of actions from the Signal Record + init_actions(actions_desc); // Array of actions from the Signal_Desc record + init_actions(actions_sig); // Array of actions from the Signal Record //---------------------------------------------------------------------- // Parse Signal XML if (strlen(signal.xml) > 0) { // If this Signal level XML exists then populated components takes priority. - if ((rc = parseDoc(signal.xml, actions_sig)) != 0) { + if ((rc = parse_doc(signal.xml, actions_sig)) != 0) { return 1; } UDA_LOG(UDA_LOG_DEBUG, "XML from the Signal Record parsed\n"); - printActions(*actions_sig); + print_actions(*actions_sig); } //---------------------------------------------------------------------- // Parse Signal_Desc XML if (strlen(signal_desc.xml) > 0) { - if ((rc = parseDoc(signal_desc.xml, actions_desc)) != 0) { + if ((rc = parse_doc(signal_desc.xml, actions_desc)) != 0) { return 1; } UDA_LOG(UDA_LOG_DEBUG, "XML from the Signal_Desc Record parsed\n"); - printActions(*actions_desc); + print_actions(*actions_desc); } //---------------------------------------------------------------------------------------------- @@ -118,7 +118,7 @@ int uda::server_parse_signal_XML(uda::client_server::DATA_SOURCE data_source, ud } } - printActions(*actions_desc); + print_actions(*actions_desc); if (actions_sig->nactions == 0 && ndesc == 0) { // No qualifying XML from either source UDA_LOG(UDA_LOG_DEBUG, "No Applicable Actionable XML Found\n"); diff --git a/source/server2/get_data.cpp b/source/server2/get_data.cpp index e6722198..d44b2ffa 100644 --- a/source/server2/get_data.cpp +++ b/source/server2/get_data.cpp @@ -283,13 +283,13 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data if (STR_IEQUALS(request_data->archive, "SS") || STR_IEQUALS(request_data->archive, "SERVERSIDE")) { if (!strncasecmp(request_data->signal, "SUBSET(", 7)) { serverside = 1; - initActions(&actions_serverside); + init_actions(&actions_serverside); int rc; if ((rc = serverParseServerSide(request_data, &actions_serverside, nullptr)) != 0) { return rc; } // Erase original SUBSET request - copyString(TrimString(request_data->signal), metadata_block_.signal_desc.signal_name, MAXNAME); + copy_string(trim_string(request_data->signal), metadata_block_.signal_desc.signal_name, MAXNAME); } } } else if (STR_IEQUALS(request_data->function, "subset")) { @@ -297,13 +297,13 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data if (maybe_plugin) { if (STR_IEQUALS(maybe_plugin.get().symbol, "serverside")) { serverside = 1; - initActions(&actions_serverside); + init_actions(&actions_serverside); int rc; if ((rc = serverParseServerSide(request_data, &actions_serverside, nullptr)) != 0) { return rc; } // Erase original SUBSET request - copyString(TrimString(request_data->signal), metadata_block_.signal_desc.signal_name, MAXNAME); + copy_string(trim_string(request_data->signal), metadata_block_.signal_desc.signal_name, MAXNAME); } } } @@ -352,8 +352,8 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data // Allways Parse Signal XML to Identify the True Data Source for this Pulse Number - not subject to client // request: get_asis (First Valid Action Record found only - others ignored) - initActions(&actions_comp_desc); - initActions(&actions_comp_sig); + init_actions(&actions_comp_desc); + init_actions(&actions_comp_sig); UDA_LOG(UDA_LOG_DEBUG, "parsing XML for a COMPOSITE Signal\n"); @@ -362,8 +362,8 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data UDA_LOG(UDA_LOG_DEBUG, "parsing XML RC? %d\n", rc); if (rc > 0) { - freeActions(&actions_comp_desc); - freeActions(&actions_comp_sig); + free_actions(&actions_comp_desc); + free_actions(&actions_comp_sig); (*depth)--; UDA_THROW_ERROR(8881, "Unable to Parse XML"); } @@ -435,8 +435,8 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data if ((strlen(actions_comp_desc.action[compId].composite.file) == 0 || strlen(actions_comp_desc.action[compId].composite.format) == 0) && request_block2.exp_number <= 0) { - freeActions(&actions_comp_desc); - freeActions(&actions_comp_sig); + free_actions(&actions_comp_desc); + free_actions(&actions_comp_sig); (*depth)--; UDA_THROW_ERROR(8888, "User Specified Composite Data Signal Not Fully Defined: Format?, File?"); @@ -455,8 +455,8 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data request_block2.exp_number > 0) { request_block2.request = REQUEST_READ_GENERIC; } else { - freeActions(&actions_comp_desc); - freeActions(&actions_comp_sig); + free_actions(&actions_comp_desc); + free_actions(&actions_comp_sig); (*depth)--; UDA_THROW_ERROR(8889, "User Specified Composite Data Signal's File Format NOT Recognised"); @@ -465,9 +465,9 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data if (request_block2.request == REQUEST_READ_HDF5) { strcpy(metadata_block_.data_source.path, - TrimString(request_block2.path)); // HDF5 File Location + trim_string(request_block2.path)); // HDF5 File Location strcpy(metadata_block_.signal_desc.signal_name, - TrimString(request_block2.signal)); // HDF5 Variable Name + trim_string(request_block2.signal)); // HDF5 Variable Name } } @@ -493,12 +493,12 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data rc = get_data(depth, &request_block2, data_block, 0); - freeActions(&actions_desc_); // Added 06Nov2008 - freeActions(&actions_sig_); + free_actions(&actions_desc_); // Added 06Nov2008 + free_actions(&actions_sig_); if (rc != 0) { // Error - freeActions(&actions_comp_desc); - freeActions(&actions_comp_sig); + free_actions(&actions_comp_desc); + free_actions(&actions_comp_sig); (*depth)--; return rc; } @@ -510,8 +510,8 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data } } else { if (rc == -1 || rc == 1) { - freeActions(&actions_comp_desc); - freeActions(&actions_comp_sig); + free_actions(&actions_comp_desc); + free_actions(&actions_comp_sig); (*depth)--; UDA_THROW_ERROR(7770, "Composite Data Signal Not Available - No XML Document to define it!"); } @@ -528,8 +528,8 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data if (isDerived) { // All Actions are applicable to the Derived/Composite Data Structure - copyActions(&actions_desc_, &actions_comp_desc); - copyActions(&actions_sig_, &actions_comp_sig); + copy_actions(&actions_desc_, &actions_comp_desc); + copy_actions(&actions_sig_, &actions_comp_sig); } else { UDA_LOG(UDA_LOG_DEBUG, "parsing XML for a Regular Signal\n"); @@ -573,12 +573,12 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data // Recursive Call for Error Data - initActions(&actions_comp_desc2); - initActions(&actions_comp_sig2); - initDataBlock(&data_block2); - initDataSource(&data_source2); - initSignal(&signal_rec2); - initSignalDesc(&signal_desc2); + init_actions(&actions_comp_desc2); + init_actions(&actions_comp_sig2); + init_data_block(&data_block2); + init_data_source(&data_source2); + init_signal(&signal_rec2); + init_signal_desc(&signal_desc2); // Check if the source file was originally defined in the client API? @@ -590,8 +590,8 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data rc = get_data(depth, request_data, data_block, 0); - freeActions(&actions_comp_desc2); - freeActions(&actions_comp_sig2); + free_actions(&actions_comp_desc2); + free_actions(&actions_comp_sig2); if (rc != 0) { freeDataBlock(&data_block2); @@ -620,9 +620,9 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data // Recursive Call for Error Data - initActions(&actions_comp_desc2); - initActions(&actions_comp_sig2); - initDataBlock(&data_block2); + init_actions(&actions_comp_desc2); + init_actions(&actions_comp_sig2); + init_data_block(&data_block2); // Check if the source file was originally defined in the client API? @@ -634,8 +634,8 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data rc = get_data(depth, &request_block2, data_block, 0); - freeActions(&actions_comp_desc2); - freeActions(&actions_comp_sig2); + free_actions(&actions_comp_desc2); + free_actions(&actions_comp_sig2); if (rc != 0) { freeDataBlock(&data_block2); @@ -702,16 +702,16 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data // Recursive Call for Data - initActions(&actions_comp_desc2); - initActions(&actions_comp_sig2); - initDataBlock(&data_block2); - initSignalDesc(&signal_desc2); // Added 06Nov2008 + init_actions(&actions_comp_desc2); + init_actions(&actions_comp_sig2); + init_data_block(&data_block2); + init_signal_desc(&signal_desc2); // Added 06Nov2008 // Check if the source file was originally defined in the client API? strcpy(data_source2.format, request_block2.format); strcpy(data_source2.path, request_block2.path); - strcpy(signal_desc2.signal_name, TrimString(request_block2.signal)); + strcpy(signal_desc2.signal_name, trim_string(request_block2.signal)); auto maybe_plugin = plugins_.find_by_format(request_block2.format); if (maybe_plugin) { @@ -721,8 +721,8 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data } if (request_block2.request == REQUEST_READ_UNKNOWN) { - freeActions(&actions_comp_desc2); - freeActions(&actions_comp_sig2); + free_actions(&actions_comp_desc2); + free_actions(&actions_comp_sig2); (*depth)--; UDA_THROW_ERROR(9999, "User Specified Composite Dimension Data Signal's File Format NOT Recognised"); @@ -741,8 +741,8 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data rc = get_data(depth, &request_block2, data_block, 0); - freeActions(&actions_comp_desc2); - freeActions(&actions_comp_sig2); + free_actions(&actions_comp_desc2); + free_actions(&actions_comp_sig2); if (rc != 0) { freeDataBlock(&data_block2); @@ -773,9 +773,9 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data // Recursive Call for Data - initActions(&actions_comp_desc2); - initActions(&actions_comp_sig2); - initDataBlock(&data_block2); + init_actions(&actions_comp_desc2); + init_actions(&actions_comp_sig2); + init_data_block(&data_block2); // Check if the source file was originally defined in the client API? @@ -787,8 +787,8 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data rc = get_data(depth, &request_block2, data_block, 0); - freeActions(&actions_comp_desc2); - freeActions(&actions_comp_sig2); + free_actions(&actions_comp_desc2); + free_actions(&actions_comp_sig2); if (rc != 0) { freeDataBlock(&data_block2); @@ -819,9 +819,9 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data // Recursive Call for Data - initActions(&actions_comp_desc2); - initActions(&actions_comp_sig2); - initDataBlock(&data_block2); + init_actions(&actions_comp_desc2); + init_actions(&actions_comp_sig2); + init_data_block(&data_block2); // Check if the source file was originally defined in the client API? @@ -833,8 +833,8 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data rc = get_data(depth, &request_block2, data_block, 0); - freeActions(&actions_comp_desc2); - freeActions(&actions_comp_sig2); + free_actions(&actions_comp_desc2); + free_actions(&actions_comp_sig2); if (rc != 0) { freeDataBlock(&data_block2); @@ -862,7 +862,7 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data // substituting) UDA_LOG(UDA_LOG_DEBUG, "#Timing Before XML\n"); - printDataBlock(*data_block); + print_data_block(*data_block); if (!client_block_.get_asis) { @@ -875,14 +875,14 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data } UDA_LOG(UDA_LOG_DEBUG, "#Timing After XML\n"); - printDataBlock(*data_block); + print_data_block(*data_block); //-------------------------------------------------------------------------------------------------------------------------- // Subset Data or Map Data when all other actions have been applied if (isDerived && compId > -1) { UDA_LOG(UDA_LOG_DEBUG, "Calling serverSubsetData (Derived) %d\n", *depth); - printDataBlock(*data_block); + print_data_block(*data_block); if ((rc = serverSubsetData(data_block, actions_desc_.action[compId], log_malloc_list_)) != 0) { (*depth)--; @@ -897,7 +897,7 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data for (int i = 0; i < actions_desc_.nactions; i++) { if (actions_desc_.action[i].actionType == UDA_SUBSET_TYPE) { UDA_LOG(UDA_LOG_DEBUG, "Calling serverSubsetData (SUBSET) %d\n", *depth); - printDataBlock(*data_block); + print_data_block(*data_block); if ((rc = serverSubsetData(data_block, actions_desc_.action[i], log_malloc_list_)) != 0) { (*depth)--; @@ -915,7 +915,7 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data if (actions_serverside.action[i].actionType == UDA_SERVER_SIDE_TYPE) { for (int j = 0; j < actions_serverside.action[i].serverside.nsubsets; j++) { UDA_LOG(UDA_LOG_DEBUG, "Calling serverSubsetData (Serverside) %d\n", *depth); - printDataBlock(*data_block); + print_data_block(*data_block); if ((rc = serverSubsetData(data_block, actions_serverside.action[i], log_malloc_list_)) != 0) { (*depth)--; @@ -924,7 +924,7 @@ int uda::Server::get_data(int* depth, RequestData* request_data, DataBlock* data } } } - freeActions(&actions_serverside); + free_actions(&actions_serverside); } //-------------------------------------------------------------------------------------------------------------------------- @@ -941,7 +941,7 @@ int uda::Server::read_data(RequestData* request, DATA_BLOCK* data_block) char mapping[MAXMETA] = ""; - printRequestData(*request); + print_request_data(*request); //------------------------------------------------------------------------------ // Test for Subsetting or Mapping XML: These require parsing First to identify the data signals needed. @@ -1095,7 +1095,7 @@ int uda::Server::read_data(RequestData* request, DATA_BLOCK* data_block) // Initialise the Data Block - initDataBlock(data_block); + init_data_block(data_block); auto plugin_list = plugins_.as_plugin_list(); plugin_interface.interfaceVersion = 1; @@ -1250,7 +1250,7 @@ int uda::Server::read_data(RequestData* request, DATA_BLOCK* data_block) //---------------------------------------------------------------------------- // Initialise the Data Block Structure - initDataBlock(data_block); + init_data_block(data_block); //---------------------------------------------------------------------------- // Status values diff --git a/source/server2/make_server_request_block.cpp b/source/server2/make_server_request_block.cpp index b698fecf..3aaf2b18 100644 --- a/source/server2/make_server_request_block.cpp +++ b/source/server2/make_server_request_block.cpp @@ -21,7 +21,7 @@ int uda::makeServerRequestData(RequestData* request, const uda::Plugins& plugins const server::Environment& environment) { auto plugin_list = plugins.as_plugin_list(); - return makeRequestData(request, &plugin_list, environment.p_env()); + return make_request_data(request, &plugin_list, environment.p_env()); } #endif diff --git a/source/server2/server.cpp b/source/server2/server.cpp index 9730c307..fe0d56c0 100644 --- a/source/server2/server.cpp +++ b/source/server2/server.cpp @@ -50,17 +50,17 @@ void print_data_block_list(const std::vector& data_blocks) int i = 0; for (auto& data_block : data_blocks) { UDA_LOG(UDA_LOG_DEBUG, "block number : %d\n", i); - printDataBlock(data_block); + print_data_block(data_block); ++i; } } uda::Server::Server() : error_stack_{}, environment_{}, sockets_{} { - initServerBlock(&server_block_, ServerVersion); - initActions(&actions_desc_); // There may be a Sequence of Actions to Apply - initActions(&actions_sig_); - initRequestBlock(&request_block_); + init_server_block(&server_block_, ServerVersion); + init_actions(&actions_desc_); // There may be a Sequence of Actions to Apply + init_actions(&actions_sig_); + init_request_block(&request_block_); cache_ = cache::open_cache(); } @@ -274,10 +274,10 @@ void uda::Server::loop() free_data_blocks(data_blocks_); UDA_LOG(UDA_LOG_DEBUG, "freeActions\n"); - freeActions(&actions_desc_); + free_actions(&actions_desc_); UDA_LOG(UDA_LOG_DEBUG, "freeActions\n"); - freeActions(&actions_sig_); + free_actions(&actions_sig_); freeRequestBlock(&request_block_); @@ -297,7 +297,7 @@ void uda::Server::loop() close_error(); UDA_LOG(UDA_LOG_DEBUG, "initServerBlock\n"); - initServerBlock(&server_block_, ServerVersion); + init_server_block(&server_block_, ServerVersion); //---------------------------------------------------------------------------- // Server Wait Loop @@ -317,7 +317,7 @@ int uda::Server::handle_request() int err = 0; - initClientBlock(&client_block_, 0, ""); + init_client_block(&client_block_, 0, ""); err = protocol_.recv_client_block(server_block_, &client_block_, &fatal_error_, server_tot_block_time_, &server_timeout_, log_malloc_list_, user_defined_type_list_); @@ -392,9 +392,9 @@ int uda::Server::handle_request() return err; } - printClientBlock(client_block_); - printServerBlock(server_block_); - printRequestBlock(request_block_); + print_client_block(client_block_); + print_server_block(server_block_); + print_request_block(request_block_); //------------------------------------------------------------------------------------------------------------------ // Prepend Proxy Host to Source to redirect client request @@ -584,9 +584,9 @@ int uda::Server::handle_request() //---------------------------------------------------------------------- // Initialise Data Structures - initDataSource(&metadata_block_.data_source); - initSignalDesc(&metadata_block_.signal_desc); - initSignal(&metadata_block_.signal_rec); + init_data_source(&metadata_block_.data_source); + init_signal_desc(&metadata_block_.signal_desc); + init_signal(&metadata_block_.signal_rec); //---------------------------------------------------------------------------------------------- // If this is a PUT request then receive the putData structure @@ -594,7 +594,7 @@ int uda::Server::handle_request() for (int i = 0; i < request_block_.num_requests; ++i) { REQUEST_DATA* request = &request_block_.requests[0]; - initPutDataBlockList(&request->putDataBlockList); + init_put_data_block_list(&request->putDataBlockList); if (request->put) { err = protocol_.recv_putdata_block_list(&request->putDataBlockList, log_malloc_list_, @@ -664,10 +664,10 @@ int uda::Server::handle_request() UDA_LOG(UDA_LOG_DEBUG, "Pulse Number : %d \n", data_source->exp_number); UDA_LOG(UDA_LOG_DEBUG, "Pass Number : %d \n", data_source->pass); UDA_LOG(UDA_LOG_DEBUG, "Recursive # : %d \n", depth); - printRequestBlock(request_block_); - printDataSource(*data_source); - printSignal(metadata_block_.signal_rec); - printSignalDesc(*signal_desc); + print_request_block(request_block_); + print_data_source(*data_source); + print_signal(metadata_block_.signal_rec); + print_signal_desc(*signal_desc); print_data_block_list(data_blocks_); print_error_stack(); UDA_LOG(UDA_LOG_DEBUG, @@ -698,8 +698,8 @@ int uda::Server::handle_request() data_block.data_type = UDA_TYPE_CHAR; } - if (data_block.data_n > 0 && (protocolVersionTypeTest(protocol_version, data_block.data_type) || - protocolVersionTypeTest(protocol_version, data_block.error_type))) { + if (data_block.data_n > 0 && (protocol_version_type_test(protocol_version, data_block.data_type) || + protocol_version_type_test(protocol_version, data_block.error_type))) { UDA_THROW_ERROR( 999, "The Data has a type that cannot be passed to the Client: A newer client library version is required."); @@ -709,8 +709,8 @@ int uda::Server::handle_request() DIMS dim; for (unsigned int j = 0; j < data_block.rank; j++) { dim = data_block.dims[j]; - if (protocolVersionTypeTest(protocol_version, dim.data_type) || - protocolVersionTypeTest(protocol_version, dim.error_type)) { + if (protocol_version_type_test(protocol_version, dim.data_type) || + protocol_version_type_test(protocol_version, dim.error_type)) { UDA_THROW_ERROR(999, "A Coordinate Data has a numerical type that cannot be passed to the Client: " "A newer client library version is required."); } @@ -742,7 +742,7 @@ void print_data_blocks(const std::vector& data_blocks) int i = 0; for (const auto& data_block : data_blocks) { UDA_LOG(UDA_LOG_DEBUG, "block number : %d\n", i); - printDataBlock(data_block); + print_data_block(data_block); ++i; } } @@ -768,7 +768,7 @@ int uda::Server::report_to_client() total_datablock_size_ = count_data_block_list_size(data_blocks_, &client_block_); - printServerBlock(server_block_); + print_server_block(server_block_); //------------------------------------------------------------------------------------------------ // Send the server block and all data in a single (minimal number) tcp packet @@ -832,7 +832,7 @@ void uda::Server::handshake_client() { // Exchange version details - once only - initClientBlock(&client_block_, 0, ""); + init_client_block(&client_block_, 0, ""); // Receive the client block, respecting earlier protocol versions diff --git a/source/server2/server_plugin.cpp b/source/server2/server_plugin.cpp index bd393475..0b15cd84 100644 --- a/source/server2/server_plugin.cpp +++ b/source/server2/server_plugin.cpp @@ -183,12 +183,12 @@ int uda::serverPlugin(REQUEST_DATA* request, DATA_SOURCE* data_source, SIGNAL_DE // Decode the API Arguments: determine appropriate data reader plug-in auto plugin_list = plugins.as_plugin_list(); - if ((err = makeRequestData(request, &plugin_list, environment)) != 0) { + if ((err = make_request_data(request, &plugin_list, environment)) != 0) { return err; } UDA_LOG(UDA_LOG_DEBUG, "request_block\n"); - printRequestData(*request); + print_request_data(*request); //---------------------------------------------------------------------------------------------- // Does the Path to Private Files contain hierarchical components not seen by the server? @@ -196,7 +196,7 @@ int uda::serverPlugin(REQUEST_DATA* request, DATA_SOURCE* data_source, SIGNAL_DE if (strlen(request->server) == 0 && request->request != REQUEST_READ_SERVERSIDE) { // Must be a File plugin - if ((err = pathReplacement(request->path, environment)) != 0) { + if ((err = path_replacement(request->path, environment)) != 0) { return err; } } @@ -204,17 +204,17 @@ int uda::serverPlugin(REQUEST_DATA* request, DATA_SOURCE* data_source, SIGNAL_DE //---------------------------------------------------------------------- // Copy request details into the data_source structure mimicking a SQL query - strcpy(data_source->source_alias, TrimString(request->file)); - strcpy(data_source->filename, TrimString(request->file)); - strcpy(data_source->path, TrimString(request->path)); + strcpy(data_source->source_alias, trim_string(request->file)); + strcpy(data_source->filename, trim_string(request->file)); + strcpy(data_source->path, trim_string(request->path)); - copyString(TrimString(request->signal), signal_desc->signal_name, MAXNAME); + copy_string(trim_string(request->signal), signal_desc->signal_name, MAXNAME); - strcpy(data_source->server, TrimString(request->server)); + strcpy(data_source->server, trim_string(request->server)); - strcpy(data_source->format, TrimString(request->format)); - strcpy(data_source->archive, TrimString(request->archive)); - strcpy(data_source->device_name, TrimString(request->device_name)); + strcpy(data_source->format, trim_string(request->format)); + strcpy(data_source->archive, trim_string(request->archive)); + strcpy(data_source->device_name, trim_string(request->device_name)); data_source->exp_number = request->exp_number; data_source->pass = request->pass; @@ -297,7 +297,7 @@ int uda::provenancePlugin(ClientBlock* client_block, RequestData* original_reque } RequestData request = {}; - initRequestData(&request); + init_request_data(&request); strcpy(request.api_delim, "::"); strcpy(request.source, ""); @@ -324,7 +324,7 @@ int uda::provenancePlugin(ClientBlock* client_block, RequestData* original_reque UDA_LOG(UDA_LOG_DEBUG, "Provenance Plugin signal: %s\n", request.signal); auto plugin_list = plugins.as_plugin_list(); - makeRequestData(&request, &plugin_list, environment.p_env()); + make_request_data(&request, &plugin_list, environment.p_env()); int err, rc, reset; DataBlock data_block = {}; @@ -332,7 +332,7 @@ int uda::provenancePlugin(ClientBlock* client_block, RequestData* original_reque // Initialise the Data Block - initDataBlock(&data_block); + init_data_block(&data_block); UDA_LOG(UDA_LOG_DEBUG, "Creating plugin interface\n"); @@ -383,7 +383,7 @@ int uda::provenancePlugin(ClientBlock* client_block, RequestData* original_reque UDA_LOG(UDA_LOG_DEBUG, "housekeeping\n"); - freeNameValueList(&request.nameValueList); + free_name_value_list(&request.nameValueList); UDA_LOG(UDA_LOG_DEBUG, "testing for bug!!!\n"); if (data_block.opaque_type != UDA_OPAQUE_TYPE_UNKNOWN || data_block.opaque_count != 0 || @@ -488,7 +488,7 @@ int uda::call_metadata_plugin(const uda::plugins::PluginData& plugin, RequestDat } DataBlock data_block = {}; - initDataBlock(&data_block); + init_data_block(&data_block); data_block.signal_rec = &metadata.signal_rec; UserDefinedTypeList userdefinedtypelist = {}; diff --git a/source/server2/server_subset_data.cpp b/source/server2/server_subset_data.cpp index 12a94510..6b9df6d5 100644 --- a/source/server2/server_subset_data.cpp +++ b/source/server2/server_subset_data.cpp @@ -67,8 +67,8 @@ int uda::serverSubsetData(uda::client_server::DATA_BLOCK* data_block, uda::clien char *newdata, *newerrhi, *newerrlo; int nsubsets, nbound, dimid, start, end, start1, end1, dim_n, ndata, n, reshape, reverse, notoperation, ierr = 0; - printAction(action); - printDataBlock(*data_block); + print_action(action); + print_data_block(*data_block); //----------------------------------------------------------------------------------------------------------------------- // How many sets of subsetting operations? @@ -132,7 +132,7 @@ int uda::serverSubsetData(uda::client_server::DATA_BLOCK* data_block, uda::clien if (dimid < 0 || dimid >= (int)data_block->rank) { UDA_LOG(UDA_LOG_ERROR, "DIM id = %d, Rank = %d, Test = %d \n", dimid, data_block->rank, dimid >= (int)data_block->rank); - printDataBlock(*data_block); + print_data_block(*data_block); UDA_THROW_ERROR(9999, "Data Subsetting is Impossible as the subset Dimension is not Compatible with " "the Rank of the Signal"); return ierr; @@ -348,7 +348,7 @@ int uda::serverSubsetData(uda::client_server::DATA_BLOCK* data_block, uda::clien data_block->dims = (DIMS*)realloc((void*)data_block->dims, rank * sizeof(DIMS)); for (int k = k0; k < rank; k++) { - initDimBlock(&data_block->dims[k]); + init_dim_block(&data_block->dims[k]); if (shape == nullptr) { data_block->dims[k].dim_n = data_n; } else { @@ -371,7 +371,7 @@ int uda::serverSubsetData(uda::client_server::DATA_BLOCK* data_block, uda::clien (DIMS*)realloc((void*)data_block->dims, data_block->rank * sizeof(DIMS)); for (unsigned int k = k0; k < data_block->rank; k++) { - initDimBlock(&data_block->dims[k]); + init_dim_block(&data_block->dims[k]); data_block->dims[k].dim_n = udt->compoundfield[i].shape[k - k0]; data_block->dims[k].data_type = UDA_TYPE_UNSIGNED_INT; data_block->dims[k].compressed = 1; @@ -418,7 +418,7 @@ int uda::serverSubsetData(uda::client_server::DATA_BLOCK* data_block, uda::clien //---------------------------------------------------------------------------------------------------------------------------- // Decompress the dimensional data if necessary & free Heap Associated with Compression - initDimBlock(&newdim); // Holder for the Subsetted Dimension (part copy of the original) + init_dim_block(&newdim); // Holder for the Subsetted Dimension (part copy of the original) dim = &(data_block->dims[dimid]); // the original dimension to be subset @@ -563,7 +563,7 @@ int uda::serverSubsetData(uda::client_server::DATA_BLOCK* data_block, uda::clien //---------------------------------------------------------------------------------------------------------------------------- // Build the New Subsetted Dimension - printDataBlock(*data_block); + print_data_block(*data_block); UDA_LOG(UDA_LOG_DEBUG, "\n\n\n*** dim->data_type: %d\n\n\n", dim->data_type); UDA_LOG(UDA_LOG_DEBUG, "\n\n\n*** dim->errhi != nullptr: %d\n\n\n", dim->errhi != nullptr); UDA_LOG(UDA_LOG_DEBUG, "\n\n\n*** dim->errlo != nullptr: %d\n\n\n", dim->errlo != nullptr); @@ -590,7 +590,7 @@ int uda::serverSubsetData(uda::client_server::DATA_BLOCK* data_block, uda::clien //----------------------------------------------------------------------------------------------------------------------- // Reshape and Save the Subsetted Data - printDataBlock(*data_block); + print_data_block(*data_block); if ((ierr = serverNewDataArray2(data_block->dims, data_block->rank, dimid, data_block->data, data_block->data_n, data_block->data_type, notoperation, reverse, start, @@ -705,7 +705,7 @@ int uda::serverSubsetData(uda::client_server::DATA_BLOCK* data_block, uda::clien p2[0] = ' '; p3 = strchr(p2, ')'); p3[0] = '\0'; - if (IsNumber(p2)) { + if (is_number(p2)) { dimid = atoi(p2); } else { // ERROR @@ -895,7 +895,7 @@ int uda::serverSubsetData(uda::client_server::DATA_BLOCK* data_block, uda::clien if (p1 == nullptr) { count[0] = (unsigned int)data_block->data_n; freeDataBlock(data_block); - initDataBlock(data_block); + init_data_block(data_block); data_block->data_n = 1; data_block->data = (char*)count; data_block->data_type = UDA_TYPE_UNSIGNED_INT; @@ -906,7 +906,7 @@ int uda::serverSubsetData(uda::client_server::DATA_BLOCK* data_block, uda::clien p2[0] = ' '; p3 = strchr(p2, ')'); p3[0] = '\0'; - if (IsNumber(p2)) { + if (is_number(p2)) { dimid = atoi(p2); } else { // ERROR @@ -1004,10 +1004,10 @@ int uda::serverSubsetData(uda::client_server::DATA_BLOCK* data_block, uda::clien p2[0] = ' '; p3 = strchr(p2, ')'); p3[0] = '\0'; - TrimString(p2); - LeftTrimString(p2); + trim_string(p2); + left_trim_string(p2); UDA_LOG(UDA_LOG_DEBUG, "p2 = [%s]\n", p2); - if (IsFloat(p2)) { + if (is_float(p2)) { value = atof(p2); } else { UDA_LOG(UDA_LOG_DEBUG, "IsFloat FALSE!\n"); @@ -1058,10 +1058,10 @@ int uda::serverSubsetData(uda::client_server::DATA_BLOCK* data_block, uda::clien p2[0] = ' '; p3 = strchr(p2, ')'); p3[0] = '\0'; - TrimString(p2); - LeftTrimString(p2); + trim_string(p2); + left_trim_string(p2); UDA_LOG(UDA_LOG_DEBUG, "p2 = [%s]\n", p2); - if (IsNumber(p2)) { + if (is_number(p2)) { data_block->order = (int)atof(p2); } else { // ERROR @@ -1285,13 +1285,13 @@ int uda::serverParseServerSide(REQUEST_DATA* request_block, ACTIONS* actions_ser UDA_THROW_ERROR(9999, "Unable to Allocate Heap memory"); } - initAction(&action[nactions - 1]); + init_action(&action[nactions - 1]); action[nactions - 1].actionType = UDA_SERVER_SIDE_TYPE; action[nactions - 1].inRange = 1; action[nactions - 1].actionId = nactions; - initServerside(&action[nactions - 1].serverside); + init_server_side(&action[nactions - 1].serverside); nsubsets = 1; if ((subsets = (SUBSET*)malloc(sizeof(SUBSET))) == nullptr) { @@ -1299,7 +1299,7 @@ int uda::serverParseServerSide(REQUEST_DATA* request_block, ACTIONS* actions_ser } for (int i = 0; i < nsubsets; i++) { - initSubset(&subsets[i]); + init_subset(&subsets[i]); } action[nactions - 1].serverside.nsubsets = 1; @@ -1313,10 +1313,10 @@ int uda::serverParseServerSide(REQUEST_DATA* request_block, ACTIONS* actions_ser if ((p = strstr(options, "member=")) != nullptr) { // Extract a Structure member strcpy(subsets[nsubsets - 1].member, &p[7]); - LeftTrimString(subsets[nsubsets - 1].member); + left_trim_string(subsets[nsubsets - 1].member); if (subsets[nsubsets - 1].member[0] == '"') { subsets[nsubsets - 1].member[0] = ' '; - LeftTrimString(subsets[nsubsets - 1].member); + left_trim_string(subsets[nsubsets - 1].member); } if ((p = strchr(subsets[nsubsets - 1].member, '"')) != nullptr) { p[0] = '\0'; @@ -1330,10 +1330,10 @@ int uda::serverParseServerSide(REQUEST_DATA* request_block, ACTIONS* actions_ser if ((p = strstr(options, "function=")) != nullptr) { // Identify a function strcpy(subsets[nsubsets - 1].function, &p[9]); - LeftTrimString(subsets[nsubsets - 1].function); + left_trim_string(subsets[nsubsets - 1].function); if (subsets[nsubsets - 1].function[0] == '"') { subsets[nsubsets - 1].function[0] = ' '; - LeftTrimString(subsets[nsubsets - 1].function); + left_trim_string(subsets[nsubsets - 1].function); } if ((p = strchr(subsets[nsubsets - 1].function, '"')) != nullptr) { p[0] = '\0'; @@ -1346,7 +1346,7 @@ int uda::serverParseServerSide(REQUEST_DATA* request_block, ACTIONS* actions_ser //------------------------------------------------------------------------------------------------------------- // Parse the Operation String for Value and Operation - LeftTrimString(TrimString(operation)); // Remove Leading white space + left_trim_string(trim_string(operation)); // Remove Leading white space strcpy(opcopy, operation); nbound = 0; @@ -1355,7 +1355,7 @@ int uda::serverParseServerSide(REQUEST_DATA* request_block, ACTIONS* actions_ser nbound++; if (strlen(p) < UDA_SXML_MAX_STRING) { strcpy(subsets[nsubsets - 1].operation[nbound - 1], p); - MidTrimString(subsets[nsubsets - 1].operation[nbound - 1]); // Remove internal white space + mid_trim_string(subsets[nsubsets - 1].operation[nbound - 1]); // Remove internal white space } else { free(subsets); UDA_THROW_ERROR(9999, "Syntax Error: The Signal Operation String is too long"); @@ -1370,7 +1370,7 @@ int uda::serverParseServerSide(REQUEST_DATA* request_block, ACTIONS* actions_ser } if (strlen(p) < UDA_SXML_MAX_STRING) { strcpy(subsets[nsubsets - 1].operation[nbound - 1], p); - MidTrimString(subsets[nsubsets - 1].operation[nbound - 1]); // Remove white space + mid_trim_string(subsets[nsubsets - 1].operation[nbound - 1]); // Remove white space } else { free(subsets); UDA_THROW_ERROR(9999, "Syntax Error: The Signal Operation String is too long"); @@ -1408,7 +1408,7 @@ int uda::serverParseServerSide(REQUEST_DATA* request_block, ACTIONS* actions_ser } // Reverse the data as # => Final array value if (strlen(t1) > 0 && t1[0] != '*' && t1[0] != '#') { - if (IsNumber(t1)) { + if (is_number(t1)) { // the Lower Index Value of the Bound subsets[nsubsets - 1].lbindex[i] = {.init = true, .value = strtol(t1, &endp, 0)}; if (*endp != '\0' || errno == EINVAL || errno == ERANGE) { @@ -1421,7 +1421,7 @@ int uda::serverParseServerSide(REQUEST_DATA* request_block, ACTIONS* actions_ser } } if (strlen(t2) > 0 && t2[0] != '*' && t2[0] != '#') { - if (IsNumber(t2)) { + if (is_number(t2)) { // the Upper Index Value of the Bound subsets[nsubsets - 1].ubindex[i] = {.init = true, .value = strtol(t2, &endp, 0)}; if (*endp != '\0' || errno == EINVAL || errno == ERANGE) { @@ -1453,7 +1453,7 @@ int uda::serverParseServerSide(REQUEST_DATA* request_block, ACTIONS* actions_ser continue; } - if (IsNumber(opcopy)) { // Single Index value + if (is_number(opcopy)) { // Single Index value subsets[nsubsets - 1].isindex[i] = true; // the Index Value of the Bound subsets[nsubsets - 1].ubindex[i] = {.init = true, .value = strtol(opcopy, &endp, 0)}; diff --git a/source/server2/xdr_protocol.cpp b/source/server2/xdr_protocol.cpp index 75d5315b..3e574e51 100644 --- a/source/server2/xdr_protocol.cpp +++ b/source/server2/xdr_protocol.cpp @@ -47,7 +47,7 @@ int server_read(void* iohandle, char* buf, int count) // Wait until there are data to be read from the socket - setSelectParms(serverSocket, &rfds, &tv, io_data->server_tot_block_time); + set_select_params(serverSocket, &rfds, &tv, io_data->server_tot_block_time); tvc = tv; while (select(serverSocket + 1, &rfds, nullptr, nullptr, &tvc) <= 0) { @@ -58,7 +58,7 @@ int server_read(void* iohandle, char* buf, int count) return -1; } - updateSelectParms(serverSocket, &rfds, &tv, *io_data->server_tot_block_time); // Keep trying ... + update_select_params(serverSocket, &rfds, &tv, *io_data->server_tot_block_time); // Keep trying ... tvc = tv; } @@ -91,7 +91,7 @@ int server_write(void* iohandle, char* buf, int count) // Block IO until the Socket is ready to write to Client - setSelectParms(serverSocket, &wfds, &tv, io_data->server_tot_block_time); + set_select_params(serverSocket, &wfds, &tv, io_data->server_tot_block_time); while (select(serverSocket + 1, nullptr, &wfds, nullptr, &tv) <= 0) { *io_data->server_tot_block_time += tv.tv_usec / 1000; @@ -99,7 +99,7 @@ int server_write(void* iohandle, char* buf, int count) UDA_LOG(UDA_LOG_DEBUG, "Total Blocking Time: %d (ms)\n", *io_data->server_tot_block_time); return -1; } - updateSelectParms(serverSocket, &wfds, &tv, *io_data->server_tot_block_time); + update_select_params(serverSocket, &wfds, &tv, *io_data->server_tot_block_time); } // Write to socket, checking for EINTR, as happens if called from IDL @@ -219,7 +219,7 @@ int uda::XdrProtocol::read_client_block(ClientBlock* client_block, LogMallocList if (err == 0) { UDA_LOG(UDA_LOG_DEBUG, "Client Block received\n"); - printClientBlock(*client_block); + print_client_block(*client_block); } // Test for an immediate CLOSEDOWN instruction @@ -232,7 +232,7 @@ int uda::XdrProtocol::send_server_block(SERVER_BLOCK server_block, LogMallocList UserDefinedTypeList* user_defined_type_list) { UDA_LOG(UDA_LOG_DEBUG, "Sending Server Block\n"); - printServerBlock(server_block); + print_server_block(server_block); int protocol_id = UDA_PROTOCOL_SERVER_BLOCK; // Receive Server Block: Server Aknowledgement diff --git a/source/structures/parseIncludeFile.cpp b/source/structures/parseIncludeFile.cpp index b3cead7e..bb2cd960 100644 --- a/source/structures/parseIncludeFile.cpp +++ b/source/structures/parseIncludeFile.cpp @@ -154,7 +154,7 @@ int parseIncludeFile(USERDEFINEDTYPELIST* userdefinedtypelist, const char* heade // while (fgets(buffer, STRING_LENGTH, fh) != nullptr) { - LeftTrimString(TrimString(buffer)); + left_trim_string(trim_string(buffer)); do { @@ -182,14 +182,14 @@ int parseIncludeFile(USERDEFINEDTYPELIST* userdefinedtypelist, const char* heade if ((p = strstr(defnames[defCount], "//")) != nullptr) { p[0] = '\0'; // drop Comments } - convertNonPrintable2(defnames[defCount]); - LeftTrimString(defnames[defCount]); - TrimString(defnames[defCount]); + convert_non_printable2(defnames[defCount]); + left_trim_string(defnames[defCount]); + trim_string(defnames[defCount]); if ((p = strchr(defnames[defCount], ' ')) != nullptr) { strcpy(buffer, &p[1]); - LeftTrimString(buffer); - TrimString(buffer); - if (IsNumber(buffer)) { + left_trim_string(buffer); + trim_string(buffer); + if (is_number(buffer)) { defvalues[defCount] = atoi(buffer); p[0] = '\0'; defCount++; @@ -214,8 +214,8 @@ int parseIncludeFile(USERDEFINEDTYPELIST* userdefinedtypelist, const char* heade if ((p = strchr(name1, ';')) != nullptr) { p[0] = '\0'; } - LeftTrimString(name1); - TrimString(name1); + left_trim_string(name1); + trim_string(name1); strcpy(typeEnum[typeEnumCount++], name1); // type name name1[0] = '\0'; } else { @@ -226,8 +226,8 @@ int parseIncludeFile(USERDEFINEDTYPELIST* userdefinedtypelist, const char* heade if (!isEnum && STR_STARTSWITH(buffer, "typedef") && (strncmp(buffer, "typedef struct", 14) != 0)) { // Regular Type Definition strcpy(name1, &buffer[7]); - LeftTrimString(name1); - TrimString(name1); + left_trim_string(name1); + trim_string(name1); if ((p = strchr(name1, ' ')) != nullptr) { p[0] = '\0'; strcpy(name2, &p[1]); @@ -240,8 +240,8 @@ int parseIncludeFile(USERDEFINEDTYPELIST* userdefinedtypelist, const char* heade } else { typeDefPtr[typeDefCount] = 0; } - LeftTrimString(name2); - TrimString(name2); + left_trim_string(name2); + trim_string(name2); strcpy(typeDefName[typeDefCount], name2); // type synonym strcpy(typeDef[typeDefCount++], name1); // actual type name1[0] = '\0'; @@ -257,8 +257,8 @@ int parseIncludeFile(USERDEFINEDTYPELIST* userdefinedtypelist, const char* heade if (!isEnum && STR_STARTSWITH(buffer, "typedef struct") && (p = strchr(buffer, '{')) == nullptr) { // Type Definition strcpy(name1, &buffer[14]); - LeftTrimString(name1); - TrimString(name1); + left_trim_string(name1); + trim_string(name1); if ((p = strchr(name1, ' ')) != nullptr) { p[0] = '\0'; strcpy(name2, &p[1]); @@ -271,8 +271,8 @@ int parseIncludeFile(USERDEFINEDTYPELIST* userdefinedtypelist, const char* heade } else { typeStrPtr[typeDefCount] = 0; } - LeftTrimString(name2); - TrimString(name2); + left_trim_string(name2); + trim_string(name2); strcpy(typeStrName[typeStrCount], name2); // type synonym strcpy(typeStruct[typeStrCount++], name1); // actual type name1[0] = '\0'; @@ -317,9 +317,9 @@ int parseIncludeFile(USERDEFINEDTYPELIST* userdefinedtypelist, const char* heade if ((p = strchr(name, '{')) != nullptr) { p[0] = '\0'; } - convertNonPrintable2(name); - LeftTrimString(name); - TrimString(name); + convert_non_printable2(name); + left_trim_string(name); + trim_string(name); } else { name[0] = '\0'; } @@ -350,8 +350,8 @@ int parseIncludeFile(USERDEFINEDTYPELIST* userdefinedtypelist, const char* heade strcpy(name1, name2); strcpy(name3, &p[1]); strcpy(name2, name3); - MidTrimString(name1); - MidTrimString(name2); + mid_trim_string(name1); + mid_trim_string(name2); if ((p = strchr(name2, ';')) != nullptr) { p[0] = '\0'; } @@ -363,7 +363,7 @@ int parseIncludeFile(USERDEFINEDTYPELIST* userdefinedtypelist, const char* heade } else { if ((p = strchr(buffer, ' ')) != nullptr) { strcpy(name, &p[1]); - MidTrimString(name); + mid_trim_string(name); if ((p = strchr(name, ';')) != nullptr) { p[0] = '\0'; } @@ -457,8 +457,8 @@ int parseIncludeFile(USERDEFINEDTYPELIST* userdefinedtypelist, const char* heade udaExpandImage(buffer, defnames, defvalues, defCount, work); udaAddImage(&image, &imagecount, work); - convertNonPrintable2(buffer); - LeftTrimString(buffer); + convert_non_printable2(buffer); + left_trim_string(buffer); isStruct = 0; isConst = 0; @@ -522,19 +522,19 @@ int parseIncludeFile(USERDEFINEDTYPELIST* userdefinedtypelist, const char* heade // Compact strings and remove unprintable characters and terminating ; - LeftTrimString(desc[itemCount]); - TrimString(desc[itemCount]); + left_trim_string(desc[itemCount]); + trim_string(desc[itemCount]); - LeftTrimString(type[itemCount]); + left_trim_string(type[itemCount]); if (!isConst && !isUnsigned && !isLong64) { - MidTrimString(type[itemCount]); + mid_trim_string(type[itemCount]); } - TrimString(type[itemCount]); + trim_string(type[itemCount]); - convertNonPrintable2(item[itemCount]); - LeftTrimString(item[itemCount]); - MidTrimString(item[itemCount]); - TrimString(item[itemCount]); + convert_non_printable2(item[itemCount]); + left_trim_string(item[itemCount]); + mid_trim_string(item[itemCount]); + trim_string(item[itemCount]); if ((p = strstr(item[itemCount], ";")) != nullptr) { p[0] = '\0'; } @@ -545,12 +545,12 @@ int parseIncludeFile(USERDEFINEDTYPELIST* userdefinedtypelist, const char* heade if (item[itemCount][0] == '*') { pointer[itemCount] = 1; item[itemCount][0] = ' '; - LeftTrimString(item[itemCount]); + left_trim_string(item[itemCount]); } else { if (type[itemCount][strlen(type[itemCount]) - 1] == '*') { pointer[itemCount] = 1; type[itemCount][strlen(type[itemCount]) - 1] = ' '; - TrimString(type[itemCount]); + trim_string(type[itemCount]); } } @@ -635,7 +635,7 @@ int parseIncludeFile(USERDEFINEDTYPELIST* userdefinedtypelist, const char* heade buffer[lstr] = '\0'; shape[itemCount][rnk] = 0; - if (IsNumber(buffer)) { // hard coded size + if (is_number(buffer)) { // hard coded size shape[itemCount][rnk] = atoi(buffer); count[itemCount] = count[itemCount] + shape[itemCount][rnk++]; } else { diff --git a/source/structures/struct.cpp b/source/structures/struct.cpp index 0392c887..ff5aa976 100644 --- a/source/structures/struct.cpp +++ b/source/structures/struct.cpp @@ -16,7 +16,7 @@ // // Send the Data // -// rc = xdrUserDefinedTypeData(xdrs, udtype, (void *)&mystruct); +// rc = xdr_user_defined_type_data(xdrs, udtype, (void *)&mystruct); // // Arrays of User Defined Structures are ported using a special structure names SARRAY .... // @@ -32,7 +32,7 @@ // // Receive the Data and its structure definition // -// rc = xdrUserDefinedTypeData(xdrs, &udtype, (void *)&mystruct); +// rc = xdr_user_defined_type_data(xdrs, &udtype, (void *)&mystruct); // // //============================================================================================================== @@ -238,7 +238,7 @@ void udaExpandImage(char* buffer, char defnames[MAXELEMENTS][MAXELEMENTNAME], in lstr = (int)(p2 - p1 - 1); strncpy(work, &p1[1], lstr); work[lstr] = '\0'; - if (IsNumber(work)) { // hard coded size + if (is_number(work)) { // hard coded size strncat(expand, &p1[1], p2 - &p1[1] + 1); len = len + (int)(p2 - &p1[1] + 1); expand[len] = '\0'; @@ -2091,7 +2091,7 @@ int xdrAtomicData(LOGMALLOCLIST* logmalloclist, XDR* xdrs, const char* type, int // Send/Receive Array of Structures -int uda::client_server::xdrUserDefinedTypeData(XDR* xdrs, LOGMALLOCLIST* logmalloclist, +int uda::client_server::xdr_user_defined_type_data(XDR* xdrs, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist, USERDEFINEDTYPE* userdefinedtype, void** data, int protocolVersion, bool xdr_stdio_flag, LOGSTRUCTLIST* log_struct_list, int malloc_source) @@ -2110,7 +2110,7 @@ int uda::client_server::xdrUserDefinedTypeData(XDR* xdrs, LOGMALLOCLIST* logmall rc = 1; } - rc = rc && xdr_userdefinedtype(xdrs, userdefinedtypelist, userdefinedtype); // User Defined Type Definitions + rc = rc && xdr_user_defined_type(xdrs, userdefinedtypelist, userdefinedtype); // User Defined Type Definitions rc = rc && xdrUserDefinedData(xdrs, logmalloclist, log_struct_list, userdefinedtypelist, userdefinedtype, data, 1, 0, nullptr, 0, &dataNTree, protocolVersion, malloc_source); // Data within Structures @@ -2124,7 +2124,7 @@ int uda::client_server::xdrUserDefinedTypeData(XDR* xdrs, LOGMALLOCLIST* logmall return 0; } - rc = xdr_userdefinedtype(xdrs, userdefinedtypelist, userdefinedtype); // User Defined Type Definitions + rc = xdr_user_defined_type(xdrs, userdefinedtypelist, userdefinedtype); // User Defined Type Definitions rc = rc && xdrUserDefinedData(xdrs, logmalloclist, log_struct_list, userdefinedtypelist, userdefinedtype, data, 1, 0, nullptr, 0, nullptr, protocolVersion, malloc_source); // Data within Structures @@ -2250,9 +2250,9 @@ bool_t xdr_compoundfield(XDR* xdrs, COMPOUNDFIELD* str) rc = rc && xdr_int(xdrs, &str->pointer); rc = rc && xdr_int(xdrs, &str->rank); rc = rc && xdr_int(xdrs, &str->count); - rc = rc && WrapXDRString(xdrs, (char*)str->type, MAXELEMENTNAME - 1); - rc = rc && WrapXDRString(xdrs, (char*)str->name, MAXELEMENTNAME - 1); - rc = rc && WrapXDRString(xdrs, (char*)str->desc, MAXELEMENTNAME - 1); + rc = rc && wrap_xdr_string(xdrs, (char*)str->type, MAXELEMENTNAME - 1); + rc = rc && wrap_xdr_string(xdrs, (char*)str->name, MAXELEMENTNAME - 1); + rc = rc && wrap_xdr_string(xdrs, (char*)str->desc, MAXELEMENTNAME - 1); if (!rc) { return 0; } @@ -2272,7 +2272,7 @@ bool_t xdr_compoundfield(XDR* xdrs, COMPOUNDFIELD* str) return rc; } -bool_t uda::client_server::xdr_userdefinedtype(XDR* xdrs, USERDEFINEDTYPELIST* userdefinedtypelist, +bool_t uda::client_server::xdr_user_defined_type(XDR* xdrs, USERDEFINEDTYPELIST* userdefinedtypelist, USERDEFINEDTYPE* str) { // Send/Receive a single user defined type @@ -2280,8 +2280,8 @@ bool_t uda::client_server::xdr_userdefinedtype(XDR* xdrs, USERDEFINEDTYPELIST* u int rc, adjust = 0; rc = xdr_int(xdrs, &str->idamclass); - rc = rc && WrapXDRString(xdrs, (char*)str->name, MAXELEMENTNAME - 1); - rc = rc && WrapXDRString(xdrs, (char*)str->source, MAXELEMENTNAME - 1); + rc = rc && wrap_xdr_string(xdrs, (char*)str->name, MAXELEMENTNAME - 1); + rc = rc && wrap_xdr_string(xdrs, (char*)str->source, MAXELEMENTNAME - 1); rc = rc && xdr_int(xdrs, &str->ref_id); rc = rc && xdr_int(xdrs, &str->size); // Size determined on the server side: client must recalculate rc = rc && xdr_int(xdrs, &str->imagecount); @@ -2391,7 +2391,7 @@ bool_t uda::client_server::xdr_userdefinedtype(XDR* xdrs, USERDEFINEDTYPELIST* u return rc; } -bool_t uda::client_server::xdr_userdefinedtypelist(XDR* xdrs, USERDEFINEDTYPELIST* str, bool xdr_stdio_flag) +bool_t uda::client_server::xdr_user_defined_type_list(XDR* xdrs, USERDEFINEDTYPELIST* str, bool xdr_stdio_flag) { // Send/Receive the list of userdefined types @@ -2421,7 +2421,7 @@ bool_t uda::client_server::xdr_userdefinedtypelist(XDR* xdrs, USERDEFINEDTYPELIS } for (int i = 0; i < str->listCount; i++) { - rc = rc && xdr_userdefinedtype(xdrs, str, &str->userdefinedtype[i]); + rc = rc && xdr_user_defined_type(xdrs, str, &str->userdefinedtype[i]); } if (!xdr_stdio_flag) { diff --git a/source/structures/xdrUserDefinedData.cpp b/source/structures/xdrUserDefinedData.cpp index 7c66bdfd..c4e78a30 100644 --- a/source/structures/xdrUserDefinedData.cpp +++ b/source/structures/xdrUserDefinedData.cpp @@ -960,7 +960,7 @@ int xdrUserDefinedData(XDR* xdrs, LOGMALLOCLIST* logmalloclist, LOGSTRUCTLIST* l size = sizeof(char); type = userdefinedtype->compoundfield[j].type; } - convertNonPrintable2(d); // Remove obvious garbage (bug - non initialised...?) + convert_non_printable2(d); // Remove obvious garbage (bug - non initialised...?) } } } @@ -993,7 +993,7 @@ int xdrUserDefinedData(XDR* xdrs, LOGMALLOCLIST* logmalloclist, LOGSTRUCTLIST* l d[count - 1] = '\0'; // Terminate } } - rc = rc && WrapXDRString(xdrs, d, count); + rc = rc && wrap_xdr_string(xdrs, d, count); isSOAP = 0; } else { rc = rc && xdr_vector(xdrs, d, count, sizeof(char), (xdrproc_t)xdr_char); @@ -1076,11 +1076,11 @@ int xdrUserDefinedData(XDR* xdrs, LOGMALLOCLIST* logmalloclist, LOGSTRUCTLIST* l } if (count > 0) { - rc = rc && WrapXDRString(xdrs, d, count); + rc = rc && wrap_xdr_string(xdrs, d, count); } } else { if (userdefinedtype->compoundfield[j].rank == 1) { // Element is a Regular String - rc = rc && WrapXDRString(xdrs, (char*)p, userdefinedtype->compoundfield[j].count); + rc = rc && wrap_xdr_string(xdrs, (char*)p, userdefinedtype->compoundfield[j].count); } else { // Element is an Array of Strings of fixed max size } @@ -1120,7 +1120,7 @@ int xdrUserDefinedData(XDR* xdrs, LOGMALLOCLIST* logmalloclist, LOGSTRUCTLIST* l if (count > 0) { d = (char*)malloc(count * sizeof(char)); udaAddMalloc(logmalloclist, (void*)d, count, sizeof(char), "char"); - rc = rc && WrapXDRString(xdrs, d, count); + rc = rc && wrap_xdr_string(xdrs, d, count); str[istr] = d; } } @@ -1150,7 +1150,7 @@ int xdrUserDefinedData(XDR* xdrs, LOGMALLOCLIST* logmalloclist, LOGSTRUCTLIST* l rc = rc && xdr_int(xdrs, &count); strarr[istr] = (char*)malloc(count * sizeof(char)); udaAddMalloc(logmalloclist, (void*)strarr[istr], count, sizeof(char), "STRING"); - rc = rc && WrapXDRString(xdrs, strarr[istr], count); + rc = rc && wrap_xdr_string(xdrs, strarr[istr], count); if (rank == 0 && nstr == 1) { *p = (VOIDTYPE)strarr[0]; } @@ -1170,7 +1170,7 @@ int xdrUserDefinedData(XDR* xdrs, LOGMALLOCLIST* logmalloclist, LOGSTRUCTLIST* l rc = rc && xdr_int(xdrs, &count); if (count > 0) { d = (char*)str[istr]; - rc = rc && WrapXDRString(xdrs, d, count); + rc = rc && wrap_xdr_string(xdrs, d, count); } } } @@ -1212,14 +1212,14 @@ int xdrUserDefinedData(XDR* xdrs, LOGMALLOCLIST* logmalloclist, LOGSTRUCTLIST* l } if (rank == 0) { rc = rc && xdr_int(xdrs, &size); // This length of string - rc = rc && WrapXDRString(xdrs, (char*)d, size); + rc = rc && wrap_xdr_string(xdrs, (char*)d, size); } else { strarr = (char**)d; for (istr = 0; istr < nstr; istr++) { // Send individual String lengths, then the string itself count = (int)strlen(strarr[istr]) + 1; rc = rc && xdr_int(xdrs, &count); - rc = rc && WrapXDRString(xdrs, strarr[istr], count); + rc = rc && wrap_xdr_string(xdrs, strarr[istr], count); } } } @@ -1229,7 +1229,7 @@ int xdrUserDefinedData(XDR* xdrs, LOGMALLOCLIST* logmalloclist, LOGSTRUCTLIST* l if (userdefinedtype->compoundfield[j].rank == 1 && strcmp(userdefinedtype->compoundfield[j].type, "STRING *") != 0) { // Element is a Single String - rc = rc && WrapXDRString(xdrs, (char*)p, userdefinedtype->compoundfield[j].count); + rc = rc && wrap_xdr_string(xdrs, (char*)p, userdefinedtype->compoundfield[j].count); } else { // Element is a String Array: Treat as Rank 1 array if (userdefinedtype->compoundfield[j].rank == 1 && STR_EQUALS(userdefinedtype->compoundfield[j].type, "STRING *")) { @@ -1241,7 +1241,7 @@ int xdrUserDefinedData(XDR* xdrs, LOGMALLOCLIST* logmalloclist, LOGSTRUCTLIST* l if (count > 0) { d = (char*)malloc(count * sizeof(char)); udaAddMalloc(logmalloclist, (void*)d, count, sizeof(char), "STRING"); - rc = rc && WrapXDRString(xdrs, d, count); + rc = rc && wrap_xdr_string(xdrs, d, count); str[istr] = d; } // Save pointer: data will be written here } else { @@ -1249,7 +1249,7 @@ int xdrUserDefinedData(XDR* xdrs, LOGMALLOCLIST* logmalloclist, LOGSTRUCTLIST* l rc = rc && xdr_int(xdrs, &count); if (count > 0) { d = (char*)str[istr]; - rc = rc && WrapXDRString(xdrs, d, count); + rc = rc && wrap_xdr_string(xdrs, d, count); } } } @@ -1262,7 +1262,7 @@ int xdrUserDefinedData(XDR* xdrs, LOGMALLOCLIST* logmalloclist, LOGSTRUCTLIST* l .shape[istr]; // Number of strings to send/receive } for (istr = 0; istr < nstr; istr++) { // send/receive individual strings - rc = rc && WrapXDRString(xdrs, &str[istr * stride], + rc = rc && wrap_xdr_string(xdrs, &str[istr * stride], userdefinedtype->compoundfield[j].count); } } @@ -1300,7 +1300,7 @@ int xdrUserDefinedData(XDR* xdrs, LOGMALLOCLIST* logmalloclist, LOGSTRUCTLIST* l break; } } - rc = rc && WrapXDRString(xdrs, d, count); + rc = rc && wrap_xdr_string(xdrs, d, count); } } break; @@ -1380,10 +1380,10 @@ int xdrUserDefinedData(XDR* xdrs, LOGMALLOCLIST* logmalloclist, LOGSTRUCTLIST* l rc = rc && xdr_int(xdrs, &size); // Structure Size if (xdrs->x_op == XDR_DECODE) { - rc = rc && WrapXDRString(xdrs, (char*)rudtype, MAXELEMENTNAME - 1); + rc = rc && wrap_xdr_string(xdrs, (char*)rudtype, MAXELEMENTNAME - 1); type = rudtype; } else { - rc = rc && WrapXDRString(xdrs, type, MAXELEMENTNAME - 1); + rc = rc && wrap_xdr_string(xdrs, type, MAXELEMENTNAME - 1); } if (protocolVersion >= 7) { diff --git a/source/wrappers/c++/client.cpp b/source/wrappers/c++/client.cpp index f8e89173..e4471c8b 100644 --- a/source/wrappers/c++/client.cpp +++ b/source/wrappers/c++/client.cpp @@ -374,7 +374,7 @@ void uda::Client::put(const uda::Signal& signal) udaPutAPI(request.c_str(), nullptr); uda::client_server::PutDataBlock pdblock{}; - initPutDataBlock(&pdblock); + init_put_data_block(&pdblock); const uda::Array& array = signal.array(); @@ -393,7 +393,7 @@ void uda::Client::put(const uda::Signal& signal) template void put_scalar(const std::string& instruction, T data) { uda::client_server::PutDataBlock putdata_block{}; - initPutDataBlock(&putdata_block); + init_put_data_block(&putdata_block); putdata_block.data_type = typeIDToUDAType(typeid(T)); putdata_block.rank = 0; @@ -458,7 +458,7 @@ void uda::Client::put(const std::string& instruction, double data) template void put_vector(const std::string& instruction, const std::vector& data) { uda::client_server::PutDataBlock putdata_block{}; - initPutDataBlock(&putdata_block); + init_put_data_block(&putdata_block); putdata_block.data_type = typeIDToUDAType(typeid(T)); putdata_block.rank = 1; @@ -537,7 +537,7 @@ void uda::Client::put(const std::string& instruction, const uda::Array& data) }; uda::client_server::PutDataBlock putdata_block{}; - initPutDataBlock(&putdata_block); + init_put_data_block(&putdata_block); putdata_block.data_type = typeIDToUDAType(data.type()); putdata_block.rank = static_cast(data.dims().size()); diff --git a/source/wrappers/fortran/accAPI_F.c b/source/wrappers/fortran/accAPI_F.c index aa108888..32882535 100755 --- a/source/wrappers/fortran/accAPI_F.c +++ b/source/wrappers/fortran/accAPI_F.c @@ -51,10 +51,10 @@ extern void idamgetapi_(char* data_object, char* data_source, int* handle, int l } strncpy(object, data_object, ldata_object); object[ldata_object] = '\0'; - TrimString(object); + trim_string(object); strncpy(source, data_source, ldata_source); source[ldata_source] = '\0'; - TrimString(source); + trim_string(source); *handle = udaGetAPI(object, source); free( object); free( source); @@ -76,7 +76,7 @@ extern void idamapi_(char* signal, int* pulno, int* handle, int lsignal) strncpy(sig, signal, lsignal); sig[lsignal] = '\0'; - sig = TrimString(sig); + sig = trim_string(sig); if (idamGetLogLevel() == UDA_LOG_DEBUG) { errno = 0; @@ -118,7 +118,7 @@ extern void idampassapi_(char* signal, int* pulno, int* pass, int* handle, int l strncpy(sig, signal, lsignal); sig[lsignal] = '\0'; - sig = TrimString(sig); + sig = trim_string(sig); if (idamGetLogLevel() == UDA_LOG_DEBUG) { errno = 0; @@ -161,7 +161,7 @@ extern void idamgenapi_(char* archive, char* device, char* signal, int* pulno, i strncpy(sig, signal, lsignal); sig[lsignal] = '\0'; - sig = TrimString(sig); + sig = trim_string(sig); if (idamGetLogLevel() == UDA_LOG_DEBUG) { errno = 0; @@ -203,9 +203,9 @@ extern void idamfileapi_(char* file, char* signal, char* format, int* handle, s[lsignal] = '\0'; f[lformat] = '\0'; - p = TrimString(p); - s = TrimString(s); - f = TrimString(f); + p = trim_string(p); + s = trim_string(s); + f = trim_string(f); *handle = udaClientFileAPI(p, s, f); @@ -235,8 +235,8 @@ extern void idamida_(char* file, char* signal, int* pulno, int* pass, int* handl f[lfile] = '\0'; s[lsignal] = '\0'; - f = TrimString(f); - s = TrimString(s); + f = trim_string(f); + s = trim_string(s); if (idamGetLogLevel() == UDA_LOG_DEBUG) { errno = 0; @@ -289,9 +289,9 @@ extern void idammds_(char* server, char* tree, char* node, int* treenum, int* ha t[ltree] = '\0'; n[lnode] = '\0'; - s = TrimString(s); - t = TrimString(t); - n = TrimString(n); + s = trim_string(s); + t = trim_string(t); + n = trim_string(n); if (idamGetLogLevel() == UDA_LOG_DEBUG) { errno = 0; @@ -357,11 +357,11 @@ extern void idamlocalapi_(char* archive, char* owner, char* file, char* format, f[lformat] = '\0'; o[lowner] = '\0'; - a = TrimString(a); - p = TrimString(p); - s = TrimString(s); - f = TrimString(f); - o = TrimString(o); + a = trim_string(a); + p = trim_string(p); + s = trim_string(s); + f = trim_string(f); + o = trim_string(o); if ((l = (int) strlen(a)) > 0) { sprintf(api_signal, "%s::%s", a, s); @@ -408,7 +408,7 @@ extern void setidamproperty_(char* property, int lproperty) char* s = (char*) malloc((size_t) (lproperty + 1)); strncpy(s, property, lproperty); s[lproperty] = '\0'; - s = TrimString(s); + s = trim_string(s); udaSetProperty(s); free( s); } @@ -418,7 +418,7 @@ extern void getidamproperty_(const char* property, int* value, int lproperty) char* s = (char*) malloc((size_t) (lproperty + 1)); strncpy(s, property, lproperty); s[lproperty] = '\0'; - s = TrimString(s); + s = trim_string(s); *value = udaGetProperty(s); } @@ -427,7 +427,7 @@ extern void resetidamproperty_(char* property, int lproperty) char* s = (char*) malloc((size_t) (lproperty + 1)); strncpy(s, property, lproperty); s[lproperty] = '\0'; - s = TrimString(s); + s = trim_string(s); udaResetProperty(s); free( s); } @@ -457,7 +457,7 @@ extern void putidamserver_(char* h, int* port, int lh) char* host = (char*) malloc((size_t) (lh + 1)); strncpy(host, h, lh); host[lh] = '\0'; - TrimString(host); + trim_string(host); udaPutServer(host, *port); free( host); } @@ -467,7 +467,7 @@ extern void putidamserverhost_(char* h, int lh) char* host = (char*) malloc((size_t) (lh + 1)); strncpy(host, h, lh); host[lh] = '\0'; - TrimString(host); + trim_string(host); udaPutServerHost(host); free( host); } @@ -656,7 +656,7 @@ extern void getidamdatatypeid_(char* t, int* id, int lt) char* type = (char*) malloc((size_t) (lt + 1)); strncpy(type, t, lt); type[lt] = '\0'; - TrimString(type); + trim_string(type); *id = udaGetDataTypeId(type); free( type); } @@ -676,7 +676,7 @@ extern void getidamerrormodelid_(char* m, int* id, int lm) char* model = (char*) malloc((size_t) (lm + 1)); strncpy(model, m, lm); model[lm] = '\0'; - TrimString(model); + trim_string(model); *id = udaGetErrorModelId(model); free( model); } @@ -1189,7 +1189,7 @@ extern void getidamenv_(char* str, int* rc, char* env, int lstr, int lenv) strncpy(s, str, lstr); s[lstr] = '\0'; - s = TrimString(s); + s = trim_string(s); e = getenv(s); *rc = 0; diff --git a/source/wrappers/idl/idam_dlm.c b/source/wrappers/idl/idam_dlm.c index 52122bb5..3c8acf26 100755 --- a/source/wrappers/idl/idam_dlm.c +++ b/source/wrappers/idl/idam_dlm.c @@ -743,10 +743,10 @@ IDL_VPTR IDL_CDECL idamputapi(int argc, IDL_VPTR argv[], char* argk) // Array?, data[] PUTDATA_BLOCK putData; - initPutDataBlock(&putData); + init_put_data_block(&putData); PUTDATA_BLOCK_LIST putDataBlockList; - initPutDataBlockList(&putDataBlockList); + init_put_data_block_list(&putDataBlockList); int rank = 0, count = 0; int type = IDL_TYP_UNDEF; @@ -7629,7 +7629,7 @@ getdomains(int argc, IDL_VPTR argv[], char* argk) if (kw.debug) { fprintf(stdout, "Handle: %d\n", handle); fprintf(stdout, "Dim id: %d\n", dimid); - printDataBlock(*udaGetDataBlock(handle)); + print_data_block(*udaGetDataBlock(handle)); } IDL_KW_FREE; @@ -7637,7 +7637,7 @@ getdomains(int argc, IDL_VPTR argv[], char* argk) } if (kw.debug) { - printDataBlock(*udaGetDataBlock(handle)); + print_data_block(*udaGetDataBlock(handle)); } //-------------------------------------------------------------------------- diff --git a/test/testSecurity.c b/test/testSecurity.c index a8389da1..69552658 100755 --- a/test/testSecurity.c +++ b/test/testSecurity.c @@ -98,8 +98,8 @@ int main() idamSetLogFile(UDA_LOG_ERROR, stderr); idamSetLogLevel(UDA_LOG_DEBUG); - initClientBlock(&client_block, clientVersion, clientUsername); - initServerBlock(&server_block, 0); + init_client_block(&client_block, clientVersion, clientUsername); + init_server_block(&server_block, 0); initSecurityBlock(&client_block.securityBlock); initSecurityBlock(&server_block.securityBlock);