summaryrefslogtreecommitdiff
path: root/src/components/include/protocol_handler/session_observer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/include/protocol_handler/session_observer.h')
-rw-r--r--src/components/include/protocol_handler/session_observer.h105
1 files changed, 55 insertions, 50 deletions
diff --git a/src/components/include/protocol_handler/session_observer.h b/src/components/include/protocol_handler/session_observer.h
index 355c62e646..5e630c6c74 100644
--- a/src/components/include/protocol_handler/session_observer.h
+++ b/src/components/include/protocol_handler/session_observer.h
@@ -39,26 +39,25 @@
#ifdef ENABLE_SECURITY
#include "security_manager/ssl_context.h"
#endif // ENABLE_SECURITY
-/**
- *\namespace protocol_handlerHandler
- *\brief Namespace for SmartDeviceLink ProtocolHandler related functionality.
- */
+ /**
+ *\namespace protocol_handlerHandler
+ *\brief Namespace for SmartDeviceLink ProtocolHandler related functionality.
+ */
namespace protocol_handler {
/**
* \brief HASH_ID constants.
* Hint: Shall not intersect with connection identifiers for correct handling
* these constants (Session identifier shall be greater than zero)
*/
-enum {
- HASH_ID_NOT_SUPPORTED = 0,
- HASH_ID_WRONG = 0xFFFF0000
-};
+enum { HASH_ID_NOT_SUPPORTED = 0, HASH_ID_WRONG = 0xFFFF0000 };
+
/**
* \class SessionObserver
* \brief Interface for making a bridge between ProtocolHandler and
* ConnectionHandler components.
*/
-// TODO(EZamakhov): Reconsider rename callbacks and SessionObserver to SessionManager
+// TODO(EZamakhov): Reconsider rename callbacks and SessionObserver to
+// SessionManager
// TODO(EZamakhov): Reconsider rename KeyFromPair and PairFromKey
class SessionObserver {
public:
@@ -75,39 +74,42 @@ class SessionObserver {
* \return uint32_t Id (number) of new session if successful, otherwise 0.
*/
virtual uint32_t OnSessionStartedCallback(
- const transport_manager::ConnectionUID &connection_handle,
- const uint8_t sessionId,
- const protocol_handler::ServiceType &service_type,
- const bool is_protected, uint32_t* hash_id) = 0;
+ const transport_manager::ConnectionUID connection_handle,
+ const uint8_t sessionId,
+ const protocol_handler::ServiceType& service_type,
+ const bool is_protected,
+ uint32_t* hash_id) = 0;
+
/**
* \brief Callback function used by ProtocolHandler
* when Mobile Application initiates session ending.
* \param connection_handle Connection identifier within which session exists
* \param sessionId Identifier of the session to be ended
- * \param hashCode Hash used only in second version of SmartDeviceLink protocol.
+ * \param hashCode Hash used only in second version of SmartDeviceLink
+ * protocol.
* If not equal to hash assigned to session on start then operation fails.
* \param service_type Type of service
* \return uint32_t 0 if operation fails, session key otherwise
*/
virtual uint32_t OnSessionEndedCallback(
- const transport_manager::ConnectionUID &connection_handle,
+ const transport_manager::ConnectionUID connection_handle,
const uint8_t sessionId,
- const uint32_t &hashCode,
- const protocol_handler::ServiceType &service_type) = 0;
+ const uint32_t& hashCode,
+ const protocol_handler::ServiceType& service_type) = 0;
/**
* \brief Callback function used by ProtocolHandler
* when Mobile Application start message flood
* \param connection_key used by other components as application identifier
*/
- virtual void OnApplicationFloodCallBack(const uint32_t &connection_key) = 0;
+ virtual void OnApplicationFloodCallBack(const uint32_t& connection_key) = 0;
/**
* \brief Callback function used by ProtocolHandler
* when Mobile Application sends malformed message
* \param connection_key used by other components as application identifier
*/
- virtual void OnMalformedMessageCallback(const uint32_t &connection_key) = 0;
+ virtual void OnMalformedMessageCallback(const uint32_t& connection_key) = 0;
/**
* \brief Creates unique identifier of session (can be used as hash)
@@ -118,8 +120,8 @@ class SessionObserver {
* \return uint32_t Unique key for session
*/
virtual uint32_t KeyFromPair(
- transport_manager::ConnectionUID connection_handle,
- uint8_t session_id) = 0;
+ transport_manager::ConnectionUID connection_handle,
+ uint8_t session_id) const = 0;
/**
* \brief Returns connection identifier and session number from given
@@ -128,10 +130,9 @@ class SessionObserver {
* \param connection_handle Connection identifier within which session exists
* \param sessionId Returned: Number of session
*/
- virtual void PairFromKey(
- uint32_t key,
- transport_manager::ConnectionUID *connection_handle,
- uint8_t *sessionId) = 0;
+ virtual void PairFromKey(uint32_t key,
+ transport_manager::ConnectionUID* connection_handle,
+ uint8_t* sessionId) const = 0;
/**
* \brief information about given Connection Key.
@@ -142,9 +143,9 @@ class SessionObserver {
* \return int32_t -1 in case of error or 0 in case of success
*/
virtual int32_t GetDataOnSessionKey(uint32_t key,
- uint32_t *app_id,
- std::list<int32_t> *sessions_list,
- uint32_t *device_id) = 0;
+ uint32_t* app_id,
+ std::list<int32_t>* sessions_list,
+ uint32_t* device_id) const = 0;
/**
* \brief information about device
@@ -155,21 +156,24 @@ class SessionObserver {
* \param connection_type Returned: type of connection (USB, BT, etc.)
* \return int32_t -1 in case of error or 0 in case of success
*/
- virtual int32_t GetDataOnDeviceID(uint32_t device_handle,
- std::string *device_name,
- std::list<uint32_t> *applications_list,
- std::string *mac_address,
- std::string *connection_type) = 0;
+ virtual int32_t GetDataOnDeviceID(
+ transport_manager::DeviceHandle device_handle,
+ std::string* device_name = NULL,
+ std::list<uint32_t>* applications_list = NULL,
+ std::string* mac_address = NULL,
+ std::string* connection_type = NULL) const = 0;
/**
- * \brief returns TRUE if session supports sending HEARTBEAT ACK to mobile side
+ * \brief returns TRUE if session supports sending HEARTBEAT ACK to mobile
+ * side
* \param connection_handle Connection identifier whithin which session exists
* \param session_id Identifier of the session
- * \return TRUE if session has protocol version which supports heartbeat otherwise returns FALSE
+ * \return TRUE if session has protocol version which supports heartbeat
+ * otherwise returns FALSE
*/
- virtual bool IsHeartBeatSupported(
- transport_manager::ConnectionUID connection_handle,
- uint8_t session_id) = 0;
+ virtual bool IsHeartBeatSupported(
+ transport_manager::ConnectionUID connection_handle,
+ uint8_t session_id) const = 0;
/**
* @brief returns protocol version which application supports
@@ -179,8 +183,8 @@ class SessionObserver {
* @return TRUE if session and connection exist otherwise returns FALSE
*/
virtual bool ProtocolVersionUsed(uint32_t connection_id,
- uint8_t session_id, uint8_t& protocol_version) = 0;
-
+ uint8_t session_id,
+ uint8_t& protocol_version) const = 0;
#ifdef ENABLE_SECURITY
/**
@@ -189,9 +193,8 @@ class SessionObserver {
* \param context SSLContext to be set
* \return \c SecurityQuery::ProtectSessionResult value
*/
- virtual int SetSSLContext(
- const uint32_t &key,
- security_manager::SSLContext *context) = 0;
+ virtual int SetSSLContext(const uint32_t& key,
+ security_manager::SSLContext* context) = 0;
/**
* \brief Gets crypto context of connection, use service_type to get NULL
* SSLContext for not protected services or ControlService (0x0)
@@ -200,9 +203,9 @@ class SessionObserver {
* \param service_type Type of service
* \return \ref SSLContext of connection
*/
- virtual security_manager::SSLContext *GetSSLContext(
- const uint32_t &key,
- const protocol_handler::ServiceType &service_type) = 0;
+ virtual security_manager::SSLContext* GetSSLContext(
+ const uint32_t& key,
+ const protocol_handler::ServiceType& service_type) = 0;
/**
* \brief Set protection flag to service in session by key
* to get current SSLContext of connection
@@ -210,16 +213,18 @@ class SessionObserver {
* \param service_type Type of service
*/
virtual void SetProtectionFlag(
- const uint32_t &key,
- const protocol_handler::ServiceType &service_type) = 0;
+ const uint32_t& key,
+ const protocol_handler::ServiceType& service_type) = 0;
+
+ virtual security_manager::SSLContext::HandshakeContext GetHandshakeContext(
+ uint32_t key) const = 0;
#endif // ENABLE_SECURITY
protected:
/**
* \brief Destructor
*/
- virtual ~SessionObserver() {
- }
+ virtual ~SessionObserver() {}
};
} // namespace protocol_handler
#endif // SRC_COMPONENTS_INCLUDE_PROTOCOL_HANDLER_SESSION_OBSERVER_H_