Skip to content

Commit

Permalink
Adding namespaces to all client headers.
Browse files Browse the repository at this point in the history
  • Loading branch information
jholloc committed Feb 13, 2024
1 parent 8d31c20 commit 07559b2
Show file tree
Hide file tree
Showing 34 changed files with 179 additions and 171 deletions.
4 changes: 2 additions & 2 deletions source/authentication/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ endif()

# Sources

add_library( authentication-client-objects OBJECT udaClientSSL.cpp udaClientSSL.h udaServerSSL.h )
add_library( authentication-client-objects OBJECT udaClientSSL.cpp updateSelectParms.cpp )
target_link_libraries( authentication-client-objects ${LIBS} )

target_include_directories( authentication-client-objects PRIVATE
Expand All @@ -24,7 +24,7 @@ target_include_directories( authentication-client-objects PRIVATE
)

if( NOT CLIENT_ONLY )
add_library( authentication-server-objects OBJECT udaServerSSL.cpp udaClientSSL.h )
add_library( authentication-server-objects OBJECT udaServerSSL.cpp updateSelectParms.cpp )
target_compile_definitions( authentication-server-objects PRIVATE -DSERVERBUILD )
target_link_libraries( authentication-server-objects ${LIBS} )
target_include_directories( authentication-server-objects PRIVATE
Expand Down
4 changes: 3 additions & 1 deletion source/authentication/udaClientSSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
# include <time.h>

# include "client/udaClientHostList.h"
# include "client/updateSelectParms.h"
# include "updateSelectParms.h"
# include "clientserver/errorLog.h"
# include "logging/logging.h"

using namespace uda::client_server;
using namespace uda::client;
using namespace uda::authentication;

static bool g_sslDisabled = true; // Default state is not SSL authentication
static int g_sslProtocol = 0; // The default server host name has the SSL protocol name prefix or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "updateSelectParms.h"

void udaUpdateSelectParms(int fd, fd_set* rfds, struct timeval* tv)
void uda::authentication::udaUpdateSelectParms(int fd, fd_set* rfds, struct timeval* tv)
{
FD_ZERO(rfds);
FD_SET(fd, rfds);
Expand Down
15 changes: 15 additions & 0 deletions source/authentication/updateSelectParms.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once

#include <ctime>

#ifndef _WIN32
# include <sys/select.h>
#else
# include <winsock.h>
#endif

namespace uda::authentication {

void udaUpdateSelectParms(int fd, fd_set *rfds, struct timeval *tv);

}
1 change: 1 addition & 0 deletions source/c_api/accAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#endif

using namespace uda::client_server;
using namespace uda::client;

USERDEFINEDTYPE* udaGetUserDefinedType(int handle);
USERDEFINEDTYPELIST* udaGetUserDefinedTypeList(int handle);
Expand Down
1 change: 1 addition & 0 deletions source/c_api/clientAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "client/startup.h"

using namespace uda::client_server;
using namespace uda::client;

int udaClientAPI(const char* file, const char* signal, int pass, int exp_number)
{
Expand Down
1 change: 1 addition & 0 deletions source/c_api/clientMDS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "logging/logging.h"

using namespace uda::client_server;
using namespace uda::client;

/**
* Reads the Requested Data
Expand Down
1 change: 1 addition & 0 deletions source/c_api/udaGetAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
# endif

using namespace uda::client_server;
using namespace uda::client;

typedef struct {
int id; // Thread identifier assigned by the application
Expand Down
1 change: 1 addition & 0 deletions source/c_api/udaPutAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
/* #endif */

using namespace uda::client_server;
using namespace uda::client;

int udaPutListAPI(const char* putInstruction, PUTDATA_BLOCK_LIST* inPutDataBlockList)
{
Expand Down
2 changes: 1 addition & 1 deletion source/client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ set( SRC_FILES
closedown.cpp
connection.cpp
clientXDRStream.cpp
updateSelectParms.cpp
getEnvironment.cpp
generateErrors.cpp
makeClientRequestBlock.cpp
Expand Down Expand Up @@ -89,6 +88,7 @@ set( FATCLIENT_OBJS
$<TARGET_OBJECTS:structures-server-objects>
$<TARGET_OBJECTS:cache-objects>
$<TARGET_OBJECTS:logging-server-objects>
$<TARGET_OBJECTS:authentication-client-objects>
)

add_library( client-static STATIC ${CLIENT_OBJS} )
Expand Down
26 changes: 13 additions & 13 deletions source/client/clientXDRStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# include <authentication/udaClientSSL.h>
#endif

std::pair<XDR*, XDR*> clientCreateXDRStream()
std::pair<XDR*, XDR*> uda::client::clientCreateXDRStream()
{
static XDR client_input = {};
static XDR client_output = {};
Expand All @@ -27,12 +27,12 @@ std::pair<XDR*, XDR*> clientCreateXDRStream()

# if defined(__APPLE__) || defined(__TIRPC__)
xdrrec_create(&client_output, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, nullptr,
reinterpret_cast<int (*)(void*, void*, int)>(clientReadin),
reinterpret_cast<int (*)(void*, void*, int)>(clientWriteout));
reinterpret_cast<int (*)(void*, void*, int)>(uda::client::clientReadin),
reinterpret_cast<int (*)(void*, void*, int)>(uda::client::clientWriteout));

xdrrec_create(&client_input, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, nullptr,
reinterpret_cast<int (*)(void*, void*, int)>(clientReadin),
reinterpret_cast<int (*)(void*, void*, int)>(clientWriteout));
reinterpret_cast<int (*)(void*, void*, int)>(uda::client::clientReadin),
reinterpret_cast<int (*)(void*, void*, int)>(uda::client::clientWriteout));
# else
xdrrec_create(&client_output, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, nullptr,
reinterpret_cast<int (*)(char*, char*, int)>(clientReadin),
Expand Down Expand Up @@ -65,20 +65,20 @@ std::pair<XDR*, XDR*> clientCreateXDRStream()

# if defined(__APPLE__) || defined(__TIRPC__)
xdrrec_create(&client_output, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, nullptr,
reinterpret_cast<int (*)(void*, void*, int)>(clientReadin),
reinterpret_cast<int (*)(void*, void*, int)>(clientWriteout));
reinterpret_cast<int (*)(void*, void*, int)>(uda::client::clientReadin),
reinterpret_cast<int (*)(void*, void*, int)>(uda::client::clientWriteout));

xdrrec_create(&client_input, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, nullptr,
reinterpret_cast<int (*)(void*, void*, int)>(clientReadin),
reinterpret_cast<int (*)(void*, void*, int)>(clientWriteout));
reinterpret_cast<int (*)(void*, void*, int)>(uda::client::clientReadin),
reinterpret_cast<int (*)(void*, void*, int)>(uda::client::clientWriteout));
# else
xdrrec_create(&client_output, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, nullptr,
reinterpret_cast<int (*)(char*, char*, int)>(clientReadin),
reinterpret_cast<int (*)(char*, char*, int)>(clientWriteout));
reinterpret_cast<int (*)(char*, char*, int)>(uda::client::clientReadin),
reinterpret_cast<int (*)(char*, char*, int)>(uda::client::clientWriteout));

xdrrec_create(&client_input, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, nullptr,
reinterpret_cast<int (*)(char*, char*, int)>(clientReadin),
reinterpret_cast<int (*)(char*, char*, int)>(clientWriteout));
reinterpret_cast<int (*)(char*, char*, int)>(uda::client::clientReadin),
reinterpret_cast<int (*)(char*, char*, int)>(uda::client::clientWriteout));
# endif

#endif // SSLAUTHENTICATION
Expand Down
9 changes: 5 additions & 4 deletions source/client/clientXDRStream.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#ifndef UDA_CLIENT_CLIENTXDRSTREAM_H
#define UDA_CLIENT_CLIENTXDRSTREAM_H
#pragma once

#include <rpc/rpc.h>
#include <utility>

std::pair<XDR*, XDR*> clientCreateXDRStream();
namespace uda::client {

#endif // UDA_CLIENT_CLIENTXDRSTREAM_H
std::pair<XDR *, XDR *> clientCreateXDRStream();

}
4 changes: 3 additions & 1 deletion source/client/closedown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
# include <authentication/udaClientSSL.h>
#endif

int closedown(ClosedownType type, uda::client_server::SOCKETLIST* socket_list, XDR* client_input, XDR* client_output,
using namespace uda::client;

int uda::client::closedown(ClosedownType type, uda::client_server::SOCKETLIST* socket_list, XDR* client_input, XDR* client_output,
bool* reopen_logs)
{
int rc = 0;
Expand Down
11 changes: 6 additions & 5 deletions source/client/closedown.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
#ifndef UDA_CLIENT_CLOSEDOWN_H
#define UDA_CLIENT_CLOSEDOWN_H
#pragma once

#include "clientserver/socketStructs.h"

#ifdef FATCLIENT
# define closedown closedownFat
#endif

namespace uda::client {

enum class ClosedownType {
CLOSE_SOCKETS = 0,
CLOSE_ALL = 1,
};

int closedown(ClosedownType type, uda::client_server::SOCKETLIST* socket_list, XDR* client_input, XDR* client_output,
bool* reopen_logs);
int closedown(ClosedownType type, uda::client_server::SOCKETLIST *socket_list, XDR *client_input, XDR *client_output,
bool *reopen_logs);

#endif // UDA_CLIENT_CLOSEDOWN_H
}
16 changes: 9 additions & 7 deletions source/client/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

#include "getEnvironment.h"
#include "uda/client.h"
#include "updateSelectParms.h"
#include "authentication/updateSelectParms.h"

#if defined(SSLAUTHENTICATION) && !defined(FATCLIENT)
# include <authentication/udaClientSSL.h>
Expand All @@ -62,16 +62,18 @@
#define PORT_STRING 64

using namespace uda::client_server;
using namespace uda::client;
using namespace uda::authentication;

static int client_socket = -1;
static SOCKETLIST client_socketlist; // List of open sockets

int connectionOpen()
int uda::client::connectionOpen()
{
return client_socket != -1;
}

int reconnect(ENVIRONMENT* environment, XDR** client_input, XDR** client_output, time_t* tv_server_start,
int uda::client::reconnect(ENVIRONMENT* environment, XDR** client_input, XDR** client_output, time_t* tv_server_start,
int* user_timeout)
{
int err = 0;
Expand Down Expand Up @@ -207,7 +209,7 @@ void setHints(struct addrinfo* hints, const char* hostname)
}
}

int createConnection(XDR* client_input, XDR* client_output, time_t* tv_server_start, int user_timeout)
int uda::client::createConnection(XDR* client_input, XDR* client_output, time_t* tv_server_start, int user_timeout)
{
int window_size = DB_READ_BLOCK_SIZE; // 128K
int rc;
Expand Down Expand Up @@ -575,7 +577,7 @@ void udaCloseAllConnections()
closeConnection(ClosedownType::CLOSE_ALL);
}

void closeConnection(ClosedownType type)
void uda::client::closeConnection(ClosedownType type)
{
if (client_socket >= 0 && type != ClosedownType::CLOSE_ALL) {
closeClientSocket(&client_socketlist, client_socket);
Expand All @@ -586,7 +588,7 @@ void closeConnection(ClosedownType type)
client_socket = -1;
}

int clientWriteout(void* iohandle ALLOW_UNUSED_TYPE, char* buf, int count)
int uda::client::clientWriteout(void* iohandle ALLOW_UNUSED_TYPE, char* buf, int count)
{
#ifndef _WIN32
void (*OldSIGPIPEHandler)(int);
Expand Down Expand Up @@ -664,7 +666,7 @@ int clientWriteout(void* iohandle ALLOW_UNUSED_TYPE, char* buf, int count)
return rc;
}

int clientReadin(void* iohandle ALLOW_UNUSED_TYPE, char* buf, int count)
int uda::client::clientReadin(void* iohandle ALLOW_UNUSED_TYPE, char* buf, int count)
{
int rc;
fd_set rfds;
Expand Down
25 changes: 14 additions & 11 deletions source/client/connection.h
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
#pragma once

#ifndef UDA_CLIENT_CONNECTION_H
# define UDA_CLIENT_CONNECTION_H
#include "clientserver/socketStructs.h"
#include "clientserver/udaStructs.h"

# include "clientserver/socketStructs.h"
# include "clientserver/udaStructs.h"
#include "closedown.h"

# include "closedown.h"
namespace uda::client {

int connectionOpen();
int reconnect(uda::client_server::ENVIRONMENT* environment, XDR** client_input, XDR** client_output,
time_t* tv_server_start, int* user_timeout);
int createConnection(XDR* client_input, XDR* client_output, time_t* tv_server_start, int user_timeout);

int reconnect(uda::client_server::ENVIRONMENT *environment, XDR **client_input, XDR **client_output,
time_t *tv_server_start, int *user_timeout);

int createConnection(XDR *client_input, XDR *client_output, time_t *tv_server_start, int user_timeout);

void closeConnection(ClosedownType type);

int clientWriteout(void* iohandle, char* buf, int count);
int clientReadin(void* iohandle, char* buf, int count);
int clientWriteout(void *iohandle, char *buf, int count);

int clientReadin(void *iohandle, char *buf, int count);

#endif // UDA_CLIENT_CONNECTION_H
}
17 changes: 9 additions & 8 deletions source/client/generateErrors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
#endif

using namespace uda::client_server;
using namespace uda::client;

//--------------------------------------------------------------------------------------------------------------
// Generate Error Data

int idamErrorModel(int model, int param_n, float* params, int data_n, float* data, int* asymmetry, float* errhi,
int uda::client::idamErrorModel(int model, int param_n, float* params, int data_n, float* data, int* asymmetry, float* errhi,
float* errlo)
{
*asymmetry = 0; // No Error Asymmetry for most models
Expand Down Expand Up @@ -73,7 +74,7 @@ int idamErrorModel(int model, int param_n, float* params, int data_n, float* dat
// GSL_RNG_SEED 12345 for the seed value
// GSL_RNG_TYPE mrg for the name of the random number generator

int idamSyntheticModel(int model, int param_n, float* params, int data_n, float* data)
int uda::client::idamSyntheticModel(int model, int param_n, float* params, int data_n, float* data)
{

#ifdef NO_GSL_LIB
Expand Down Expand Up @@ -143,7 +144,7 @@ int idamSyntheticModel(int model, int param_n, float* params, int data_n, float*
#endif
}

int generateIdamSyntheticData(int handle)
int uda::client::generateIdamSyntheticData(int handle)
{
int err = 0;

Expand Down Expand Up @@ -279,7 +280,7 @@ int generateIdamSyntheticData(int handle)
//--------------------------------------------------------------------------------------------------------------
// Generate Synthetic Data

err = idamSyntheticModel(model, param_n, params, udaGetDataNum(handle), data);
err = uda::client::idamSyntheticModel(model, param_n, params, udaGetDataNum(handle), data);

if (err != 0) {
add_error(UDA_CODE_ERROR_TYPE, "generateIdamSyntheticData", err, "Unable to Generate Synthetic Data");
Expand Down Expand Up @@ -394,7 +395,7 @@ int generateIdamSyntheticData(int handle)
return 0;
}

int generateIdamSyntheticDimData(int handle, int ndim)
int uda::client::generateIdamSyntheticDimData(int handle, int ndim)
{
int err = 0;

Expand Down Expand Up @@ -535,7 +536,7 @@ int generateIdamSyntheticDimData(int handle, int ndim)
//--------------------------------------------------------------------------------------------------------------
// Generate Model Data

err = idamSyntheticModel(model, param_n, params, udaGetDimNum(handle, ndim), data);
err = uda::client::idamSyntheticModel(model, param_n, params, udaGetDimNum(handle, ndim), data);

if (err != 0) {
add_error(UDA_CODE_ERROR_TYPE, "generateIdamSyntheticDimData", err,
Expand Down Expand Up @@ -652,7 +653,7 @@ int generateIdamSyntheticDimData(int handle, int ndim)
return 0;
}

int generateIdamDataError(int handle)
int uda::client::generateIdamDataError(int handle)
{
int err = 0, asymmetry = 0;

Expand Down Expand Up @@ -965,7 +966,7 @@ int generateIdamDataError(int handle)
return 0;
}

int generateIdamDimDataError(int handle, int ndim)
int uda::client::generateIdamDimDataError(int handle, int ndim)
{

int err = 0, asymmetry = 0;
Expand Down
Loading

0 comments on commit 07559b2

Please sign in to comment.