Skip to content

Commit

Permalink
Changing client-server function names to snake case.
Browse files Browse the repository at this point in the history
  • Loading branch information
jholloc committed Feb 13, 2024
1 parent 9bacfe6 commit 8d236a1
Show file tree
Hide file tree
Showing 83 changed files with 1,104 additions and 1,104 deletions.
8 changes: 4 additions & 4 deletions source/authentication/udaServerSSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down Expand Up @@ -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?
Expand Down Expand Up @@ -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<uda::server::IoData*>(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
Expand Down Expand Up @@ -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;
}

Expand Down
16 changes: 8 additions & 8 deletions source/c_api/accAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand All @@ -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);
}
}
Expand Down
4 changes: 2 additions & 2 deletions source/c_api/clientAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions source/c_api/clientMDS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions source/c_api/udaGetAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions source/c_api/udaPutAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

//-------------------------------------------------------------------------
Expand All @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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);
}

//-------------------------------------------------------------------------
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion source/cache/cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
20 changes: 10 additions & 10 deletions source/client/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ 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

if (environment->server_reconnect) {
// 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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions source/client/makeClientRequestBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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());
}
}

Expand All @@ -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;
}
}
Expand All @@ -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);
Expand Down Expand Up @@ -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?
}
}
Expand Down
Loading

0 comments on commit 8d236a1

Please sign in to comment.