diff options
author | AKalinich-Luxoft <AKalinich@luxoft.com> | 2017-12-22 14:49:06 +0200 |
---|---|---|
committer | AKalinich-Luxoft <AKalinich@luxoft.com> | 2018-01-29 08:26:20 +0200 |
commit | 62b2705f1526f0c5e15aecf0c82d149de095acd7 (patch) | |
tree | c5d4283b4914d28db803da606eac77ce20b8c13f | |
parent | bfb42a23d3c4b1bfdb177a985ac9a8b090800612 (diff) | |
download | sdl_core-62b2705f1526f0c5e15aecf0c82d149de095acd7.tar.gz |
ServiceStartedContext were moved to session observer
ServiceStartedContext were moved to session observer and
renamed to StartingSessionContext.
Also new fields were added:
- is_new_service - to check later is this a new service for this session
- is_ptu_required - to check later is session from this context requires
triggering of PTU in case there is no certificate data in local PT
3 files changed, 58 insertions, 49 deletions
diff --git a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h index c2bac31c1b..7355838b63 100644 --- a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h +++ b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h @@ -530,54 +530,6 @@ class ConnectionHandlerImpl private: /** - * \brief Struct to keep variables between OnSessionStartedCallback() and - * NotifyServiceStartedResult() - **/ - struct ServiceStartedContext { - transport_manager::ConnectionUID connection_handle_; - uint8_t session_id_; - uint32_t new_session_id_; - protocol_handler::ServiceType service_type_; - uint32_t hash_id_; - bool is_protected_; - - /** - * \brief Constructor - */ - ServiceStartedContext() - : connection_handle_(0) - , session_id_(0) - , new_session_id_(0) - , service_type_(protocol_handler::kInvalidServiceType) - , hash_id_(0) - , is_protected_(0) {} - - /** - * \brief Constructor - * \param connection_handle Connection identifier within which session is - * started. - * \param session_id Session ID specified to OnSessionStartedCallback() - * \param new_session_id Session ID generated - * \param service_type Type of service - * \param hash_id Hash ID generated from connection_handle and - * new_session_id - * \param is_protected Whether service will be protected - **/ - ServiceStartedContext(transport_manager::ConnectionUID connection_handle, - uint8_t session_id, - uint32_t new_session_id, - protocol_handler::ServiceType service_type, - uint32_t hash_id, - bool is_protected) - : connection_handle_(connection_handle) - , session_id_(session_id) - , new_session_id_(new_session_id) - , service_type_(service_type) - , hash_id_(hash_id) - , is_protected_(is_protected) {} - }; - - /** * \brief Disconnect application. * * \param device_handle DeviceHandle of disconnected device. @@ -635,7 +587,8 @@ class ConnectionHandlerImpl utils::StlMapDeleter<ConnectionList> connection_list_deleter_; sync_primitives::Lock start_service_context_map_lock_; - std::map<uint32_t, ServiceStartedContext> start_service_context_map_; + std::map<uint32_t, protocol_handler::StartingSessionContext> + start_service_context_map_; #ifdef BUILD_TESTS // Methods for test usage diff --git a/src/components/include/protocol_handler/protocol_handler.h b/src/components/include/protocol_handler/protocol_handler.h index 34135617bd..84121c59be 100644 --- a/src/components/include/protocol_handler/protocol_handler.h +++ b/src/components/include/protocol_handler/protocol_handler.h @@ -43,6 +43,8 @@ namespace protocol_handler { class ProtocolObserver; class SessionObserver; +struct StartingSessionContext; + /** * \class ProtocolHandler * \brief Interface for component parsing protocol header diff --git a/src/components/include/protocol_handler/session_observer.h b/src/components/include/protocol_handler/session_observer.h index 4648e678c2..36780da639 100644 --- a/src/components/include/protocol_handler/session_observer.h +++ b/src/components/include/protocol_handler/session_observer.h @@ -56,6 +56,60 @@ namespace protocol_handler { enum { HASH_ID_NOT_SUPPORTED = 0, HASH_ID_WRONG = 0xFFFF0000 }; /** + * @brief Struct with data containing attributes of starting session + **/ +struct StartingSessionContext { + transport_manager::ConnectionUID connection_id_; + uint8_t initial_session_id_; + uint8_t new_session_id_; + protocol_handler::ServiceType service_type_; + uint32_t hash_id_; + bool is_protected_; + bool is_new_service_; + bool is_ptu_required_; + + /** + * @brief Constructor + */ + StartingSessionContext() + : connection_id_(0) + , initial_session_id_(0) + , new_session_id_(0) + , service_type_(protocol_handler::kInvalidServiceType) + , hash_id_(0) + , is_protected_(false) + , is_new_service_(false) + , is_ptu_required_(false) {} + + /** + * @brief Constructor + * @param connection_id_ Connection identifier within which session is + * started. + * @param session_id Session ID specified to OnSessionStartedCallback() + * @param new_session_id Session ID generated + * @param service_type Type of service + * @param hash_id Hash ID generated from connection_handle and + * new_session_id + * @param is_protected Whether service will be protected + * @param is_new_service Whether service was already established + **/ + StartingSessionContext(transport_manager::ConnectionUID connection_id, + uint8_t session_id, + uint8_t new_session_id, + protocol_handler::ServiceType service_type, + uint32_t hash_id, + const bool is_protected) + : connection_id_(connection_id) + , initial_session_id_(session_id) + , new_session_id_(new_session_id) + , service_type_(service_type) + , hash_id_(hash_id) + , is_protected_(is_protected) + , is_new_service_(false) + , is_ptu_required_(false) {} +}; + +/** * \class SessionObserver * \brief Interface for making a bridge between ProtocolHandler and * ConnectionHandler components. |