score-back/include/server_api.h
Artur Mukhamadiev 33dd44f454
All checks were successful
Verification / Is-Buildable (push) Successful in 3m40s
[feat] add minimal client and address-based init
- add crpc_init_with_address for direct ip/port startup without yaml
- add minimal_client.cpp example using TCPConnector to send a ping
- set install_rpath '$ORIGIN' on shared libs so they find bundled deps
- ignore .worktrees/ for git worktree scratch directories
2026-06-02 16:18:31 +03:00

39 lines
997 B
C++

#ifndef CRPC_SERVER_API
#define CRPC_SERVER_API
#include <cstdint>
#include "export.h"
#ifdef __cplusplus
extern "C" {
#endif //cpp
/**
* @brief basically just std::string wrapper:
* struct rpc_string {
* std::string s;
* };
* has internal gc and would be automatically deallocated on deinit call,
* but it is better to call destroy manually, to prevent exceeding memory usage
*/
struct CRPC_EXPORT rpc_string;
CRPC_EXPORT const char* crpc_str_get_data(const rpc_string*);
CRPC_EXPORT uint64_t crpc_str_get_size(const rpc_string*);
CRPC_EXPORT rpc_string* crpc_str_create(const char* data, uint64_t size);
CRPC_EXPORT void crpc_str_destroy(rpc_string*);
typedef rpc_string*(*callback_t)(rpc_string*);
CRPC_EXPORT void crpc_init(const char* config_path);
CRPC_EXPORT void crpc_init_with_address(const char* ip, int port);
CRPC_EXPORT void crpc_deinit();
CRPC_EXPORT void crpc_add_method(callback_t cb, rpc_string* name);
#ifdef __cplusplus
}
#endif //cpp
#endif //CRPC_SERVER_API