diff --git a/CMakeLists.txt b/CMakeLists.txt index 98cb62ef5a8d..ebd4cf84f51f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -224,6 +224,7 @@ set(CCF_ENDPOINTS_SOURCES ${CCF_DIR}/src/endpoints/endpoint_registry.cpp ${CCF_DIR}/src/endpoints/base_endpoint_registry.cpp ${CCF_DIR}/src/endpoints/common_endpoint_registry.cpp + ${CCF_DIR}/src/endpoints/user_endpoint_registry.cpp ${CCF_DIR}/src/endpoints/json_handler.cpp ${CCF_DIR}/src/endpoints/authentication/cose_auth.cpp ${CCF_DIR}/src/endpoints/authentication/cert_auth.cpp diff --git a/include/ccf/app_interface.h b/include/ccf/app_interface.h index 03498766c1ce..6b5c45293862 100644 --- a/include/ccf/app_interface.h +++ b/include/ccf/app_interface.h @@ -2,7 +2,6 @@ // Licensed under the Apache 2.0 License. #pragma once -#include "ccf/actors.h" #include "ccf/ccf_deprecated.h" #include "ccf/common_endpoint_registry.h" #include "ccf/js_plugin.h" @@ -27,24 +26,18 @@ namespace ccf class UserEndpointRegistry : public CommonEndpointRegistry { public: - UserEndpointRegistry(ccf::AbstractNodeContext& context) : - CommonEndpointRegistry(get_actor_prefix(ActorsType::users), context) - {} + UserEndpointRegistry(ccf::AbstractNodeContext& context); // Default behaviour is to do nothing - do NOT log summary of every request // as it completes. Apps may override this if they wish. void handle_event_request_completed( - const ccf::endpoints::RequestCompletedEvent& event) override - {} + const ccf::endpoints::RequestCompletedEvent& event) override; + // Default behavour is to log dispatch failures, as a coarse metric of + // some user errors, but do not log the raw path, which may contain + // confidential fields misformatted into the wrong url void handle_event_dispatch_failed( - const ccf::endpoints::DispatchFailedEvent& event) override - { - // Log dispatch failures, as a coarse metric of some user errors, but do - // not log the raw path, which may contain confidential fields - // misformatted into the wrong url - CCF_APP_INFO("DispatchFailedEvent: {} {}", event.method, event.status); - } + const ccf::endpoints::DispatchFailedEvent& event) override; }; } diff --git a/src/apps/js_generic/js_generic_base.cpp b/src/apps/js_generic/js_generic_base.cpp index ea1f5e789ffc..32a5c2a5fee9 100644 --- a/src/apps/js_generic/js_generic_base.cpp +++ b/src/apps/js_generic/js_generic_base.cpp @@ -19,6 +19,7 @@ #include "ccf/node/host_processes_interface.h" #include "ccf/service/tables/jsengine.h" #include "ccf/version.h" +#include "ds/actors.h" #include "enclave/enclave_time.h" #include "js/global_class_ids.h" #include "js/modules/chained_module_loader.h" diff --git a/include/ccf/actors.h b/src/ds/actors.h similarity index 100% rename from include/ccf/actors.h rename to src/ds/actors.h diff --git a/src/enclave/rpc_map.h b/src/enclave/rpc_map.h index e6ab22628c88..bbecdc5b591c 100644 --- a/src/enclave/rpc_map.h +++ b/src/enclave/rpc_map.h @@ -2,7 +2,7 @@ // Licensed under the Apache 2.0 License. #pragma once -#include "ccf/actors.h" +#include "ds/actors.h" #include "rpc_handler.h" namespace ccf diff --git a/src/endpoints/user_endpoint_registry.cpp b/src/endpoints/user_endpoint_registry.cpp new file mode 100644 index 000000000000..da69a7adc26a --- /dev/null +++ b/src/endpoints/user_endpoint_registry.cpp @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the Apache 2.0 License. + +#include "ccf/app_interface.h" +#include "ds/actors.h" + +namespace ccf +{ + UserEndpointRegistry::UserEndpointRegistry( + ccf::AbstractNodeContext& context) : + CommonEndpointRegistry(get_actor_prefix(ActorsType::users), context) + {} + + void UserEndpointRegistry::handle_event_request_completed( + const ccf::endpoints::RequestCompletedEvent& event) + {} + + void UserEndpointRegistry::handle_event_dispatch_failed( + const ccf::endpoints::DispatchFailedEvent& event) + { + CCF_APP_INFO("DispatchFailedEvent: {} {}", event.method, event.status); + } +} \ No newline at end of file diff --git a/src/http/http_rpc_context.h b/src/http/http_rpc_context.h index 93bf8cc4a52a..af808a96c9e7 100644 --- a/src/http/http_rpc_context.h +++ b/src/http/http_rpc_context.h @@ -2,10 +2,10 @@ // Licensed under the Apache 2.0 License. #pragma once -#include "ccf/actors.h" #include "ccf/http_responder.h" #include "ccf/odata_error.h" #include "ccf/rpc_context.h" +#include "ds/actors.h" #include "http_parser.h" #include "node/rpc_context_impl.h" diff --git a/src/js/registry.cpp b/src/js/registry.cpp index 60bd636cae23..2078b8cd8f77 100644 --- a/src/js/registry.cpp +++ b/src/js/registry.cpp @@ -33,6 +33,7 @@ #include "ccf/js/extensions/ccf/request.h" #include "ccf/js/extensions/ccf/rpc.h" #include "ccf/js/interpreter_cache_interface.h" +#include "ds/actors.h" #include "js/modules/chained_module_loader.h" #include "js/modules/kv_bytecode_module_loader.h" #include "js/modules/kv_module_loader.h" diff --git a/src/node/acme_challenge_frontend.h b/src/node/acme_challenge_frontend.h index f82e5792bbfa..7a415db729c2 100644 --- a/src/node/acme_challenge_frontend.h +++ b/src/node/acme_challenge_frontend.h @@ -2,10 +2,10 @@ // Licensed under the Apache 2.0 License. #pragma once -#include "ccf/actors.h" #include "ccf/common_auth_policies.h" #include "ccf/common_endpoint_registry.h" #include "ccf/endpoint_registry.h" +#include "ds/actors.h" #include "node/network_state.h" #include "node/rpc/frontend.h"