Skip to content

Commit

Permalink
Rationalising the API
Browse files Browse the repository at this point in the history
  • Loading branch information
jholloc committed Jan 30, 2024
1 parent 9bd184d commit 165b6f8
Show file tree
Hide file tree
Showing 244 changed files with 1,594 additions and 2,260 deletions.
3 changes: 2 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ CheckOptions:
- { key: readability-identifier-naming.StructCase, value: CamelCase }
- { key: readability-identifier-naming.FunctionCase, value: lower_case }
- { key: readability-identifier-naming.VariableCase, value: lower_case }
- { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE }
- { key: readability-identifier-naming.GlobalConstantCase, value: CamelCase }
- { key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE }
WarningsAsErrors: '-*'
HeaderFilterRegex: '*.h'
FormatStyle: llvm
25 changes: 9 additions & 16 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,16 @@ configure_file(
)

set( HEADERS
include/accAPI.h
include/accessors.h
include/client.h
include/clientAPI.h
include/clientMDS.h
include/export.h
include/genStructs.h
include/legacy.h
include/struct.h
include/udaDefines.h
include/udaErrors.h
include/udaGetAPI.h
include/udaPlugin.h
include/udaPutAPI.h
include/udaTypes.h
include/uda/client.h
include/uda/export.h
include/uda/legacy.h
include/uda/plugins.h
include/uda/structured.h
include/uda/types.h
include/uda/uda_plugin_base.hpp
include/uda/portability.h
)
install( FILES uda.h ${CMAKE_BINARY_DIR}/source/version.h DESTINATION include/uda )
install( FILES include/uda.h ${CMAKE_BINARY_DIR}/source/version.h DESTINATION include/uda )
install( FILES ${HEADERS} DESTINATION include/uda )

set( ENV_PATH )
Expand Down
8 changes: 4 additions & 4 deletions source/authentication/udaClientSSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
# include <openssl/ssl.h>
# include <time.h>

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

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
6 changes: 2 additions & 4 deletions source/authentication/udaClientSSL.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
# define VERIFY_DEPTH 4
# define X509STRINGSIZE 256

# include <export.h>

# include <client/udaClientHostList.h>
# include <clientserver/socketStructs.h>
# include "client/udaClientHostList.h"
# include "clientserver/socketStructs.h"

bool getUdaClientSSLDisabled();
SSL* getUdaClientSSL();
Expand Down
6 changes: 3 additions & 3 deletions source/authentication/udaServerSSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
# include <openssl/ssl.h>
# include <openssl/x509.h>

# include <clientserver/errorLog.h>
# include <logging/logging.h>
# include <server/writer.h>
# include "clientserver/errorLog.h"
# include "logging/logging.h"
# include "server/writer.h"

# define VERIFY_DEPTH 4
# define X509STRINGSIZE 256
Expand Down
22 changes: 6 additions & 16 deletions source/authentication/udaServerSSL.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,12 @@
// Server host addressed beginng with SSL:// are assumed to be using SSL authentication. The SSL:// prefix is removed to
// make the connection.

# include <export.h>

# ifdef __cplusplus
extern "C" {
# endif

LIBRARY_API int startUdaServerSSL();
LIBRARY_API void closeUdaServerSSL();
LIBRARY_API int readUdaServerSSL(void* iohandle, char* buf, int count);
LIBRARY_API int writeUdaServerSSL(void* iohandle, const char* buf, int count);
LIBRARY_API void putUdaServerSSLSocket(int socket);
LIBRARY_API bool getUdaServerSSLDisabled();

# ifdef __cplusplus
}
# endif
int startUdaServerSSL();
void closeUdaServerSSL();
int readUdaServerSSL(void* iohandle, char* buf, int count);
int writeUdaServerSSL(void* iohandle, const char* buf, int count);
void putUdaServerSSLSocket(int socket);
bool getUdaServerSSLDisabled();

#endif // SSLAUTHENTICATION

Expand Down
2 changes: 1 addition & 1 deletion source/bin/uda_cli.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "udaTypes.h"
#include <uda/types.h>
#include <serialisation/capnp_serialisation.h>
#include <wrappers/c++/UDA.hpp>

Expand Down
17 changes: 5 additions & 12 deletions source/c_api/accAPI.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "accAPI.h"
#include <uda/client.h>
#include <uda/structured.h>

#include <cmath>
#include <vector>

#ifdef __GNUC__
# include <strings.h>
Expand All @@ -13,20 +13,17 @@
# define strlwr _strlwr
#endif

#include "accessors.h"
#include "clientserver/allocData.h"
#include "clientserver/memstream.h"
#include "clientserver/protocol.h"
#include "clientserver/stringUtils.h"
#include "clientserver/xdrlib.h"
#include "clientserver/initStructs.h"
#include "logging/logging.h"
#include "struct.h"
#include "version.h"

#include "client/generateErrors.h"
#include "client/getEnvironment.h"
#include "client/udaClient.h"
#include "version.h"

#ifdef __APPLE__
# include <cstdlib>
Expand Down Expand Up @@ -3545,12 +3542,8 @@ void getIdamClientSerialisedDataBlock(int handle, void** object, size_t* objectS

int setIdamDataTree(int handle)
{
if (getIdamDataOpaqueType(handle) != UDA_OPAQUE_TYPE_STRUCTURES) {
return 0; // Return FALSE
}
if (getIdamData(handle) == nullptr) {
return 0;
}
if (getIdamDataOpaqueType(handle) != UDA_OPAQUE_TYPE_STRUCTURES) return 0; // Return FALSE
if (getIdamData(handle) == nullptr) return 0;

udaSetFullNTree((NTREE*)getIdamData(handle));
void* opaque_block = getIdamDataOpaqueBlock(handle);
Expand Down
3 changes: 1 addition & 2 deletions source/c_api/clientAPI.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "clientAPI.h"
#include <uda/client.h>

#ifdef __GNUC__
# include <strings.h>
Expand All @@ -11,7 +11,6 @@
#include "clientserver/initStructs.h"
#include "logging/logging.h"

#include "client.h"
#include "client/makeClientRequestBlock.h"
#include "client/startup.h"

Expand Down
5 changes: 1 addition & 4 deletions source/c_api/clientMDS.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#include "clientMDS.h"
#include <uda/client.h>

#include "clientserver/protocol.h"
#include "clientserver/initStructs.h"
#include "logging/logging.h"

#include "client.h"
#include "client/startup.h"

/**
Expand Down
5 changes: 1 addition & 4 deletions source/c_api/udaGetAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
*--------------------------------------------------------------*/

#include "udaGetAPI.h"
#include <uda/client.h>

#ifndef _WIN32
# include <strings.h>
Expand All @@ -19,9 +19,6 @@
#include "clientserver/initStructs.h"
#include "logging/logging.h"

#include "accAPI.h"
#include "client.h"
#include "client/getEnvironment.h"
#include "client/makeClientRequestBlock.h"
#include "client/startup.h"

Expand Down
2 changes: 1 addition & 1 deletion source/c_api/udaPutAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Returns:
*--------------------------------------------------------------*/

#include "udaPutAPI.h"
#include <uda/client.h>

#include "clientserver/allocData.h"
#include "clientserver/errorLog.h"
Expand Down
4 changes: 2 additions & 2 deletions source/cache/cache.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "cache.h"

#include "clientserver/initStructs.h"
#include <clientserver/protocol.h>
#include <clientserver/xdrlib.h>
#include "clientserver/protocol.h"
#include "clientserver/xdrlib.h"

void writeCacheData(FILE* fp, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist,
const DATA_BLOCK* data_block, int protocolVersion, LOGSTRUCTLIST* log_struct_list,
Expand Down
15 changes: 3 additions & 12 deletions source/cache/cache.h
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
#ifndef UDA_CACHE_CACHE_H
#define UDA_CACHE_CACHE_H

#include "export.h"
#include "genStructs.h"
#include "structures/genStructs.h"
#include "clientserver/udaStructs.h"
#include <cstdio>

#ifdef __cplusplus
extern "C" {
#endif

LIBRARY_API void writeCacheData(FILE* fp, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist,
void writeCacheData(FILE* fp, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist,
const DATA_BLOCK* data_block, int protocolVersion, LOGSTRUCTLIST* log_struct_list,
unsigned int private_flags, int malloc_source);

LIBRARY_API DATA_BLOCK* readCacheData(FILE* fp, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist,
DATA_BLOCK* readCacheData(FILE* fp, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist,
int protocolVersion, LOGSTRUCTLIST* log_struct_list, unsigned int private_flags,
int malloc_source);

#ifdef __cplusplus
}
#endif

#endif // UDA_CACHE_CACHE_H
4 changes: 2 additions & 2 deletions source/cache/fileCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ int udaFileCacheWrite(const DATA_BLOCK* data_block, const REQUEST_BLOCK* request
# include <string>
# include <vector>

# include <clientserver/errorLog.h>
# include <clientserver/stringUtils.h>
# include "clientserver/errorLog.h"
# include "clientserver/stringUtils.h"
# include <sstream>

constexpr int CACHE_MAXCOUNT = 100; // Max Attempts at obtaining a database table lock
Expand Down
15 changes: 3 additions & 12 deletions source/cache/fileCache.h
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
#ifndef UDA_CACHE_FILECACHE_H
#define UDA_CACHE_FILECACHE_H

#include "export.h"
#include "genStructs.h"
#include "structures/genStructs.h"
#include "clientserver/udaStructs.h"

#ifdef __cplusplus
extern "C" {
#endif

LIBRARY_API DATA_BLOCK* udaFileCacheRead(const REQUEST_DATA* request, LOGMALLOCLIST* logmalloclist,
DATA_BLOCK* udaFileCacheRead(const REQUEST_DATA* request, LOGMALLOCLIST* logmalloclist,
USERDEFINEDTYPELIST* userdefinedtypelist, int protocolVersion,
LOGSTRUCTLIST* log_struct_list, unsigned int private_flags, int malloc_source);

LIBRARY_API int udaFileCacheWrite(const DATA_BLOCK* data_block, const REQUEST_BLOCK* request_block,
int udaFileCacheWrite(const DATA_BLOCK* data_block, const REQUEST_BLOCK* request_block,
LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist,
int protocolVersion, LOGSTRUCTLIST* log_struct_list, unsigned int private_flags,
int malloc_source);

#ifdef __cplusplus
}
#endif

#endif // UDA_CACHE_FILECACHE_H
10 changes: 5 additions & 5 deletions source/cache/memcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ DATA_BLOCK* uda::cache::cache_read(uda::cache::UdaCache* cache, const REQUEST_DA
// needed for GCC 12.0 - do not delete
# include <algorithm>

# include <clientserver/errorLog.h>
# include <clientserver/initStructs.h>
# include <clientserver/memstream.h>
# include <clientserver/xdrlib.h>
# include <logging/logging.h>
# include "clientserver/errorLog.h"
# include "clientserver/initStructs.h"
# include "clientserver/memstream.h"
# include "clientserver/xdrlib.h"
# include "logging/logging.h"

# define UDA_CACHE_HOST "localhost" // Override these with environment variables with the same name
# define UDA_CACHE_PORT 11211
Expand Down
4 changes: 2 additions & 2 deletions source/cache/memcache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#define UDA_CACHE_MEMCACHE_H

#include "clientserver/udaStructs.h"
#include "genStructs.h"
#include "export.h"
#include "structures/genStructs.h"
#include "include/uda/export.h"

namespace uda {
namespace cache {
Expand Down
4 changes: 2 additions & 2 deletions source/client/clientXDRStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include <cstdio>
#include <rpc/rpc.h>

#include "udaDefines.h"
#include <logging/logging.h>
#include "clientserver/udaDefines.h"
#include "logging/logging.h"

#include "connection.h"

Expand Down
2 changes: 0 additions & 2 deletions source/client/clientXDRStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#include <rpc/rpc.h>
#include <utility>

#include "export.h"

std::pair<XDR*, XDR*> clientCreateXDRStream();

#endif // UDA_CLIENT_CLIENTXDRSTREAM_H
9 changes: 4 additions & 5 deletions source/client/closedown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
*--------------------------------------------------------------*/
#include "closedown.h"

#include "client.h"
#include <client/udaClientHostList.h>
#include <logging/logging.h>
#include "client/udaClientHostList.h"
#include "logging/logging.h"

#ifdef FATCLIENT
# include <server/closeServerSockets.h>
# include <server/udaServer.h>
# include "server/closeServerSockets.h"
# include "server/udaServer.h"
#else
# include "connection.h"
# include "getEnvironment.h"
Expand Down
13 changes: 2 additions & 11 deletions source/client/closedown.h
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
#ifndef UDA_CLIENT_CLOSEDOWN_H
#define UDA_CLIENT_CLOSEDOWN_H

#include "export.h"
#include <clientserver/socketStructs.h>
#include "clientserver/socketStructs.h"

#ifdef FATCLIENT
# define closedown closedownFat
#endif

#ifdef __cplusplus
extern "C" {
#endif

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

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

#ifdef __cplusplus
}
#endif

#endif // UDA_CLIENT_CLOSEDOWN_H
Loading

0 comments on commit 165b6f8

Please sign in to comment.