2015-05-26 19:29:01 +03:00
|
|
|
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2015-06-15 15:44:03 +03:00
|
|
|
#ifndef mozilla_ipc_DaemonSocketConsumer_h
|
|
|
|
#define mozilla_ipc_DaemonSocketConsumer_h
|
2015-05-26 19:29:01 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace ipc {
|
|
|
|
|
2015-06-15 15:44:03 +03:00
|
|
|
class DaemonSocketPDU;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* |DaemonSocketIOConsumer| processes incoming PDUs from the
|
|
|
|
* HAL daemon. Please note that its method |Handle| runs on a
|
|
|
|
* different than the consumer thread.
|
|
|
|
*/
|
|
|
|
class DaemonSocketIOConsumer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~DaemonSocketIOConsumer();
|
|
|
|
|
|
|
|
virtual void Handle(DaemonSocketPDU& aPDU) = 0;
|
2015-09-15 12:47:30 +03:00
|
|
|
virtual void StoreUserData(const DaemonSocketPDU& aPDU) = 0;
|
2015-06-15 15:44:03 +03:00
|
|
|
|
|
|
|
protected:
|
|
|
|
DaemonSocketIOConsumer();
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2015-06-15 15:44:03 +03:00
|
|
|
* |DaemonSocketConsumer| handles socket events.
|
2015-05-26 19:29:01 +03:00
|
|
|
*/
|
2015-06-15 15:44:03 +03:00
|
|
|
class DaemonSocketConsumer
|
2015-05-26 19:29:01 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2015-06-02 11:01:58 +03:00
|
|
|
* Callback for socket success. Consumer-thread only.
|
2015-05-26 19:29:01 +03:00
|
|
|
*
|
|
|
|
* @param aIndex The index that has been given to the stream socket.
|
|
|
|
*/
|
|
|
|
virtual void OnConnectSuccess(int aIndex) = 0;
|
|
|
|
|
|
|
|
/**
|
2015-06-02 11:01:58 +03:00
|
|
|
* Callback for socket errors. Consumer-thread only.
|
2015-05-26 19:29:01 +03:00
|
|
|
*
|
|
|
|
* @param aIndex The index that has been given to the stream socket.
|
|
|
|
*/
|
|
|
|
virtual void OnConnectError(int aIndex) = 0;
|
|
|
|
|
|
|
|
/**
|
2015-06-02 11:01:58 +03:00
|
|
|
* Callback for socket disconnect. Consumer-thread only.
|
2015-05-26 19:29:01 +03:00
|
|
|
*
|
|
|
|
* @param aIndex The index that has been given to the stream socket.
|
|
|
|
*/
|
|
|
|
virtual void OnDisconnect(int aIndex) = 0;
|
|
|
|
|
|
|
|
protected:
|
2015-06-15 15:44:03 +03:00
|
|
|
DaemonSocketConsumer();
|
|
|
|
virtual ~DaemonSocketConsumer();
|
2015-05-26 19:29:01 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|