summaryrefslogtreecommitdiff
path: root/src/components/application_manager/include/application_manager/rpc_service_impl.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/include/application_manager/rpc_service_impl.h')
-rw-r--r--src/components/application_manager/include/application_manager/rpc_service_impl.h53
1 files changed, 41 insertions, 12 deletions
diff --git a/src/components/application_manager/include/application_manager/rpc_service_impl.h b/src/components/application_manager/include/application_manager/rpc_service_impl.h
index 98aad1a90e..3e3d83a519 100644
--- a/src/components/application_manager/include/application_manager/rpc_service_impl.h
+++ b/src/components/application_manager/include/application_manager/rpc_service_impl.h
@@ -34,24 +34,25 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RPC_SERVICE_IMPL_H
#include "application_manager/application_manager.h"
-#include "application_manager/rpc_service.h"
-#include "application_manager/request_controller.h"
+#include "application_manager/command_holder_impl.h"
#include "application_manager/message_helper.h"
-#include "application_manager/usage_statistics.h"
#include "application_manager/mobile_message_handler.h"
-#include "application_manager/command_holder_impl.h"
+#include "application_manager/request_controller.h"
+#include "application_manager/rpc_protection_manager.h"
+#include "application_manager/rpc_service.h"
+#include "application_manager/usage_statistics.h"
-#include "formatters/formatter_json_rpc.h"
-#include "formatters/CFormatterJsonSDLRPCv2.h"
#include "formatters/CFormatterJsonSDLRPCv1.h"
+#include "formatters/CFormatterJsonSDLRPCv2.h"
+#include "formatters/formatter_json_rpc.h"
#include "interfaces/HMI_API_schema.h"
#include "interfaces/MOBILE_API_schema.h"
#include "interfaces/v4_protocol_v1_2_no_extra.h"
#include "interfaces/v4_protocol_v1_2_no_extra_schema.h"
-#include "utils/threads/message_loop_thread.h"
#include "utils/logger.h"
+#include "utils/threads/message_loop_thread.h"
namespace application_manager {
namespace rpc_service {
@@ -85,7 +86,15 @@ typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageToMobile> >
ToMobileQueue;
typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageToHmi> >
ToHmiQueue;
-}
+} // namespace impl
+
+typedef std::shared_ptr<RPCProtectionManager> RPCProtectionManagerSPtr;
+
+enum class EncryptionFlagCheckResult {
+ kSuccess_Protected,
+ kSuccess_NotProtected,
+ kError_EncryptionNeeded
+};
class RPCServiceImpl : public RPCService,
public impl::ToMobileQueue::Handler,
@@ -103,9 +112,14 @@ class RPCServiceImpl : public RPCService,
request_controller::RequestController& request_ctrl,
protocol_handler::ProtocolHandler* protocol_handler,
hmi_message_handler::HMIMessageHandler* hmi_handler,
- CommandHolder& commands_holder);
+ CommandHolder& commands_holder,
+ RPCProtectionManagerSPtr rpc_protection_manager,
+ hmi_apis::HMI_API& hmi_so_factory_,
+ mobile_apis::MOBILE_API& mobile_so_factory_);
~RPCServiceImpl();
+ void Stop() OVERRIDE;
+
bool ManageMobileCommand(const commands::MessageSharedPtr message,
commands::Command::CommandSource source) OVERRIDE;
bool ManageHMICommand(const commands::MessageSharedPtr message,
@@ -122,17 +136,31 @@ class RPCServiceImpl : public RPCService,
void SendMessageToHMI(const commands::MessageSharedPtr message) OVERRIDE;
bool IsAppServiceRPC(int32_t function_id,
- commands::Command::CommandSource source);
+ commands::Command::CommandSource source) OVERRIDE;
void set_protocol_handler(
protocol_handler::ProtocolHandler* handler) OVERRIDE;
void set_hmi_message_handler(
hmi_message_handler::HMIMessageHandler* handler) OVERRIDE;
+ void UpdateMobileRPCParams(
+ const mobile_apis::FunctionID::eType& function_id,
+ const mobile_apis::messageType::eType& message_type,
+ const std::map<std::string, SMember>& members) OVERRIDE;
+ void UpdateHMIRPCParams(
+ const hmi_apis::FunctionID::eType& function_id,
+ const hmi_apis::messageType::eType& message_type,
+ const std::map<std::string, SMember>& members) OVERRIDE;
+
private:
bool ConvertSOtoMessage(const smart_objects::SmartObject& message,
Message& output,
const bool allow_unknown_parameters = false);
+
+ EncryptionFlagCheckResult IsEncryptionRequired(
+ const smart_objects::SmartObject& message,
+ ApplicationSharedPtr app,
+ const bool is_rpc_service_secure) const;
hmi_apis::HMI_API& hmi_so_factory();
mobile_apis::MOBILE_API& mobile_so_factory();
void CheckSourceForUnsupportedRequest(
@@ -143,14 +171,15 @@ class RPCServiceImpl : public RPCService,
request_controller::RequestController& request_ctrl_;
protocol_handler::ProtocolHandler* protocol_handler_;
hmi_message_handler::HMIMessageHandler* hmi_handler_;
+ RPCProtectionManagerSPtr rpc_protection_manager_;
CommandHolder& commands_holder_;
// Thread that pumps messages being passed to mobile side.
impl::ToMobileQueue messages_to_mobile_;
// Thread that pumps messages being passed to HMI.
impl::ToHmiQueue messages_to_hmi_;
- hmi_apis::HMI_API hmi_so_factory_;
- mobile_apis::MOBILE_API mobile_so_factory_;
+ hmi_apis::HMI_API& hmi_so_factory_;
+ mobile_apis::MOBILE_API& mobile_so_factory_;
};
} // namespace rpc_service
} // namespace application_manager