summaryrefslogtreecommitdiff
path: root/src/components/connection_handler/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/connection_handler/include')
-rw-r--r--src/components/connection_handler/include/connection_handler/connection.h3
-rw-r--r--src/components/connection_handler/include/connection_handler/connection_handler.h13
-rw-r--r--src/components/connection_handler/include/connection_handler/connection_handler_impl.h15
-rw-r--r--src/components/connection_handler/include/connection_handler/connection_handler_observer.h7
-rw-r--r--src/components/connection_handler/include/connection_handler/heartbeat_monitor.h2
5 files changed, 32 insertions, 8 deletions
diff --git a/src/components/connection_handler/include/connection_handler/connection.h b/src/components/connection_handler/include/connection_handler/connection.h
index 6bcbc3fdcd..a94786eaa7 100644
--- a/src/components/connection_handler/include/connection_handler/connection.h
+++ b/src/components/connection_handler/include/connection_handler/connection.h
@@ -37,6 +37,7 @@
#include <vector>
#include "utils/lock.h"
+#include "utils/threads/thread.h"
#include "connection_handler/device.h"
#include "connection_handler/heartbeat_monitor.h"
#include "protocol/service_type.h"
@@ -288,7 +289,7 @@ class Connection {
/**
* \brief monitor that closes connection if there is no traffic over it
*/
- HeartBeatMonitor *heartbeat_monitor_;
+ HeartBeatMonitor* heartbeat_monitor_;
threads::Thread *heart_beat_monitor_thread_;
DISALLOW_COPY_AND_ASSIGN(Connection);
diff --git a/src/components/connection_handler/include/connection_handler/connection_handler.h b/src/components/connection_handler/include/connection_handler/connection_handler.h
index 08bef97155..8fa52631ff 100644
--- a/src/components/connection_handler/include/connection_handler/connection_handler.h
+++ b/src/components/connection_handler/include/connection_handler/connection_handler.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) 2014, Ford Motor Company
* All rights reserved.
*
@@ -45,6 +45,12 @@
* \brief SmartDeviceLink connection_handler namespace.
*/
namespace connection_handler {
+
+ enum CloseSessionReason {
+ kCommon = 0,
+ kFlood
+ };
+
/**
* \class ConnectionHandler
* \brief SmartDeviceLink ConnectionHandler interface class
@@ -100,13 +106,14 @@ class ConnectionHandler {
/**
* Close session associated with the key
*/
- virtual void CloseSession(uint32_t key) = 0;
+ virtual void CloseSession(uint32_t key, CloseSessionReason close_reason) = 0;
/**
* Close session
*/
virtual void CloseSession(ConnectionHandle connection_handle,
- uint8_t session_id) = 0;
+ uint8_t session_id,
+ CloseSessionReason close_reason) = 0;
/**
* \brief Start heartbeat for specified session
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 00ebdf0ab5..b33d956e54 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
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) 2014, Ford Motor Company
* All rights reserved.
*
@@ -189,6 +189,13 @@ class ConnectionHandlerImpl : public ConnectionHandler,
const protocol_handler::ServiceType &service_type);
/**
+ * \brief Callback function used by ProtocolHandler
+ * when Mobile Application start message flood
+ * \param connection_key used by other components as application identifier
+ */
+ void OnApplicationFloodCallBack(const uint32_t &connection_key) OVERRIDE;
+
+ /**
* \brief Creates unique identifier of session (can be used as hash)
* from given connection identifier
* within which session exists and session number.
@@ -298,7 +305,7 @@ class ConnectionHandlerImpl : public ConnectionHandler,
* \brief Close session associated with the key
* \param key Unique key used by other components as session identifier
*/
- virtual void CloseSession(uint32_t key);
+ virtual void CloseSession(uint32_t key, CloseSessionReason close_reason);
/**
* \brief Function used by HearbeatMonitior to close session on HB timeout
@@ -306,7 +313,8 @@ class ConnectionHandlerImpl : public ConnectionHandler,
* \param session_id Identifier of the session to be ended
*/
virtual void CloseSession(ConnectionHandle connection_handle,
- uint8_t session_id);
+ uint8_t session_id,
+ CloseSessionReason close_reason);
/**
* \brief Return count of session for specified connection
@@ -401,6 +409,7 @@ class ConnectionHandlerImpl : public ConnectionHandler,
* \brief Lock for applications list
*/
mutable sync_primitives::Lock connection_list_lock_;
+ mutable sync_primitives::Lock connection_handler_observer_lock_;
/**
* \brief Cleans connection list on destruction
diff --git a/src/components/connection_handler/include/connection_handler/connection_handler_observer.h b/src/components/connection_handler/include/connection_handler/connection_handler_observer.h
index cd419c124a..e8a4735c0f 100644
--- a/src/components/connection_handler/include/connection_handler/connection_handler_observer.h
+++ b/src/components/connection_handler/include/connection_handler/connection_handler_observer.h
@@ -96,6 +96,13 @@ class ConnectionHandlerObserver {
const int32_t &session_key,
const protocol_handler::ServiceType &type) = 0;
+ /**
+ * \brief Callback function used by ConnectionHandler
+ * 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;
+
protected:
/**
* \brief Destructor
diff --git a/src/components/connection_handler/include/connection_handler/heartbeat_monitor.h b/src/components/connection_handler/include/connection_handler/heartbeat_monitor.h
index 9b641ce01c..31c798bf75 100644
--- a/src/components/connection_handler/include/connection_handler/heartbeat_monitor.h
+++ b/src/components/connection_handler/include/connection_handler/heartbeat_monitor.h
@@ -72,7 +72,7 @@ class HeartBeatMonitor: public threads::ThreadDelegate {
/**
* \brief Thread exit procedure.
*/
- virtual bool exitThreadMain();
+ virtual void exitThreadMain();
void set_heartbeat_timeout_seconds(int32_t timeout);