CCF
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
client::HttpRpcTlsClient Class Reference

#include <rpc_tls_client.h>

Inherits client::TlsClient, and http::ResponseProcessor.

Classes

struct  PreparedRpc
 
struct  Response
 

Public Member Functions

 HttpRpcTlsClient (const std::string &host, const std::string &port, std::shared_ptr<::tls::CA > node_ca=nullptr, std::shared_ptr<::tls::Cert > cert=nullptr, const std::string &key_id_="Invalid")
 
 HttpRpcTlsClient (const HttpRpcTlsClient &c)
 
void create_key_pair (const ccf::crypto::Pem priv_key)
 
PreparedRpc gen_request (const std::string &method, const std::span< const uint8_t > params, const std::string &content_type, llhttp_method verb=HTTP_POST, const char *auth_token=nullptr)
 
Response call (const std::string &method, const nlohmann::json &params=nullptr, llhttp_method verb=HTTP_POST)
 
Response call (const std::string &method, const std::span< const uint8_t > params, llhttp_method verb=HTTP_POST)
 
Response post (const std::string &method, const nlohmann::json &params)
 
Response get (const std::string &method, const nlohmann::json &params=nullptr)
 
nlohmann::json unpack_body (const Response &resp)
 
std::string get_error (const Response &resp)
 
Response read_response ()
 
std::optional< Responseread_response_non_blocking ()
 
virtual void handle_response (ccf::http_status status, ccf::http::HeaderMap &&headers, std::vector< uint8_t > &&body) override
 
void set_prefix (const std::string &prefix_)
 
 TlsClient (const std::string &host, const std::string &port, std::shared_ptr<::tls::CA > node_ca=nullptr, std::shared_ptr<::tls::Cert > cert=nullptr)
 
 TlsClient (const TlsClient &c)
 
- Public Member Functions inherited from client::TlsClient
 TlsClient (const std::string &host, const std::string &port, std::shared_ptr<::tls::CA > node_ca=nullptr, std::shared_ptr<::tls::Cert > cert=nullptr)
 
 TlsClient (const TlsClient &c)
 
virtual ~TlsClient ()
 
auto get_ciphersuite_name ()
 
void write (std::span< const uint8_t > b)
 
std::vector< uint8_t > read (size_t read_size)
 
bool bytes_available ()
 
std::vector< uint8_t > read_all ()
 
void set_tcp_nodelay (bool on)
 

Protected Member Functions

std::vector< uint8_t > gen_http_request_internal (const std::string &method, const std::span< const uint8_t > params, const std::string &content_type, llhttp_method verb, const char *auth_token=nullptr)
 
std::vector< uint8_t > gen_request_internal (const std::string &method, const std::span< const uint8_t > params, const std::string &content_type, llhttp_method verb, const char *auth_token=nullptr)
 
Response call_raw (const std::vector< uint8_t > &raw)
 
Response call_raw (const PreparedRpc &prep)
 
- Protected Member Functions inherited from client::TlsClient
void init ()
 

Protected Attributes

::http::ResponseParser parser
 
std::optional< std::string > prefix
 
ccf::crypto::KeyPairPtr key_pair = nullptr
 
std::string key_id = "Invalid"
 
size_t next_send_id = 0
 
size_t next_recv_id = 0
 
std::optional< Responselast_response
 
- Protected Attributes inherited from client::TlsClient
std::string host
 
std::string port
 
std::shared_ptr<::tls::CAnode_ca
 
std::shared_ptr<::tls::Certcert
 
bool connected = false
 
Unique_SSL_CTX ctx
 
Unique_BIO bio
 

Constructor & Destructor Documentation

◆ HttpRpcTlsClient() [1/2]

client::HttpRpcTlsClient::HttpRpcTlsClient ( const std::string &  host,
const std::string &  port,
std::shared_ptr<::tls::CA node_ca = nullptr,
std::shared_ptr<::tls::Cert cert = nullptr,
const std::string &  key_id_ = "Invalid" 
)
inline

◆ HttpRpcTlsClient() [2/2]

client::HttpRpcTlsClient::HttpRpcTlsClient ( const HttpRpcTlsClient c)
inline

Member Function Documentation

◆ call() [1/2]

Response client::HttpRpcTlsClient::call ( const std::string &  method,
const nlohmann::json &  params = nullptr,
llhttp_method  verb = HTTP_POST 
)
inline

◆ call() [2/2]

Response client::HttpRpcTlsClient::call ( const std::string &  method,
const std::span< const uint8_t >  params,
llhttp_method  verb = HTTP_POST 
)
inline

◆ call_raw() [1/2]

Response client::HttpRpcTlsClient::call_raw ( const PreparedRpc prep)
inlineprotected

◆ call_raw() [2/2]

Response client::HttpRpcTlsClient::call_raw ( const std::vector< uint8_t > &  raw)
inlineprotected

◆ create_key_pair()

void client::HttpRpcTlsClient::create_key_pair ( const ccf::crypto::Pem  priv_key)
inline

◆ gen_http_request_internal()

std::vector< uint8_t > client::HttpRpcTlsClient::gen_http_request_internal ( const std::string &  method,
const std::span< const uint8_t >  params,
const std::string &  content_type,
llhttp_method  verb,
const char *  auth_token = nullptr 
)
inlineprotected

◆ gen_request()

PreparedRpc client::HttpRpcTlsClient::gen_request ( const std::string &  method,
const std::span< const uint8_t >  params,
const std::string &  content_type,
llhttp_method  verb = HTTP_POST,
const char *  auth_token = nullptr 
)
inline

◆ gen_request_internal()

std::vector< uint8_t > client::HttpRpcTlsClient::gen_request_internal ( const std::string &  method,
const std::span< const uint8_t >  params,
const std::string &  content_type,
llhttp_method  verb,
const char *  auth_token = nullptr 
)
inlineprotected

◆ get()

Response client::HttpRpcTlsClient::get ( const std::string &  method,
const nlohmann::json &  params = nullptr 
)
inline

◆ get_error()

std::string client::HttpRpcTlsClient::get_error ( const Response resp)
inline

◆ handle_response()

virtual void client::HttpRpcTlsClient::handle_response ( ccf::http_status  status,
ccf::http::HeaderMap &&  headers,
std::vector< uint8_t > &&  body 
)
inlineoverridevirtual

◆ post()

Response client::HttpRpcTlsClient::post ( const std::string &  method,
const nlohmann::json &  params 
)
inline

◆ read_response()

Response client::HttpRpcTlsClient::read_response ( )
inline

◆ read_response_non_blocking()

std::optional< Response > client::HttpRpcTlsClient::read_response_non_blocking ( )
inline

◆ set_prefix()

void client::HttpRpcTlsClient::set_prefix ( const std::string &  prefix_)
inline

◆ TlsClient() [1/2]

client::TlsClient::TlsClient ( const std::string &  host,
const std::string &  port,
std::shared_ptr<::tls::CA node_ca = nullptr,
std::shared_ptr<::tls::Cert cert = nullptr 
)
inline

◆ TlsClient() [2/2]

client::TlsClient::TlsClient ( const TlsClient c)
inline

◆ unpack_body()

nlohmann::json client::HttpRpcTlsClient::unpack_body ( const Response resp)
inline

Member Data Documentation

◆ key_id

std::string client::HttpRpcTlsClient::key_id = "Invalid"
protected

◆ key_pair

ccf::crypto::KeyPairPtr client::HttpRpcTlsClient::key_pair = nullptr
protected

◆ last_response

std::optional<Response> client::HttpRpcTlsClient::last_response
protected

◆ next_recv_id

size_t client::HttpRpcTlsClient::next_recv_id = 0
protected

◆ next_send_id

size_t client::HttpRpcTlsClient::next_send_id = 0
protected

◆ parser

::http::ResponseParser client::HttpRpcTlsClient::parser
protected

◆ prefix

std::optional<std::string> client::HttpRpcTlsClient::prefix
protected

The documentation for this class was generated from the following file: