1#ifndef SSGX_HTTP_U_CALLBACK_MANAGER_H
2#define SSGX_HTTP_U_CALLBACK_MANAGER_H
8#include <unordered_map>
20 const char* req_method,
const char* req_path,
21 const char* req_params_json,
const char* req_headers_json,
22 const uint8_t* req_body,
size_t req_body_size,
23 char** resp_status_headers_json, uint8_t** resp_body,
24 size_t* resp_body_size);
51 std::lock_guard<std::mutex> lock(mutex_);
52 http_callback_map_[eid] = http_cb;
53 sgx_status_t status = register_cb(eid, eid);
54 return status == SGX_SUCCESS;
63 std::lock_guard<std::mutex> lock(mutex_);
64 return http_callback_map_.count(eid) > 0;
73 std::lock_guard<std::mutex> lock(mutex_);
74 auto it = http_callback_map_.find(eid);
75 if (it != http_callback_map_.end()) {
92 mutable std::mutex mutex_;
93 std::unordered_map<sgx_enclave_id_t, HttpOnMessageCallback> http_callback_map_;
Http module callback function registration and management.
Definition ssgx_http_u.h:33
bool RegisterCallbacks(sgx_enclave_id_t eid, RegisterEidCallback register_cb, HttpOnMessageCallback http_cb)
Http module callback function registration.
Definition ssgx_http_u.h:50
static HttpCallbackManager & GetInstance()
Singleton Pattern.
Definition ssgx_http_u.h:39
HttpCallbackManager(const HttpCallbackManager &)=delete
HttpCallbackManager & operator=(HttpCallbackManager &&)=delete
bool HasHttpCallback(sgx_enclave_id_t eid) const
Check if the enclave has registered a callback function.
Definition ssgx_http_u.h:62
HttpOnMessageCallback GetHttpCallback(sgx_enclave_id_t eid) const
Get the http message callback function of the corresponding enclave.
Definition ssgx_http_u.h:72
HttpCallbackManager(HttpCallbackManager &&)=delete
HttpCallbackManager & operator=(const HttpCallbackManager &)=delete
sgx_status_t(*)(sgx_enclave_id_t eid, sgx_enclave_id_t enclave_eid) RegisterEidCallback
Typedef for Enclave ID registration callback.
Definition ssgx_http_u.h:27
sgx_status_t(*)(sgx_enclave_id_t eid, int *retval, const char *server_id, const char *req_method, const char *req_path, const char *req_params_json, const char *req_headers_json, const uint8_t *req_body, size_t req_body_size, char **resp_status_headers_json, uint8_t **resp_body, size_t *resp_body_size) HttpOnMessageCallback
Typedef for HTTP message callback.
Definition ssgx_http_u.h:19
Definition ssgx_attestation_t.h:6