Files

78 lines
1.9 KiB
C++

/**
* @file include/ActivMiddleware/ActivFramework/KernelBypass/EthernetReceiver.h
*
* @brief Header file for EthernetReceiver class.
*/
#if (!defined ACTIV_FRAMEWORK_KERNEL_BYPASS_ETHERNET_RECEIVER_H)
#define ACTIV_FRAMEWORK_KERNEL_BYPASS_ETHERNET_RECEIVER_H
#include "ActivMiddleware/ActivFramework/External.h"
#if (!defined ACTIV_ENABLE_EFVI)
#error ef_vi is not supported on this processor/platform/compiler.
#endif
#include "ActivMiddleware/ActivFramework/KernelBypass/Mode.h"
#include "ActivMiddleware/ActivFramework/KernelBypass/Statistics.h"
#include <functional>
#include <vector>
//! Activ namespace.
namespace Activ
{
class MacAddress;
class ManagedEndPoint;
//! KernelBypass namespace.
namespace KernelBypass
{
class EfviDistributor;
///! EthernetReceiver class.
class EthernetReceiver
{
public:
//! PacketInfo struct.
struct PacketInfo
{
bool m_hasTimestamp; ///< Indicates, if packet has m_timestamp filled.
size_t m_length; ///< The length.
timespec m_timestamp; ///< The UTC timestamp associated with a received packet.
};
//! Callback function type specification.
typedef std::function<void (const void * const, const PacketInfo &)> CallbackFunction;
/**
* @brief Constructor.
*
* @param managedEndPoint the managed end point to attach to.
* @param mode
* @param callbackFunction
* @param interfaceId id of the interface to open a virtual interface on.
* @param macAddressList
*
* @throw std::exception
*/
ACTIV_FRAMEWORK_API EthernetReceiver(ManagedEndPoint &managedEndPoint, const Mode mode, const CallbackFunction &callbackFunction,
const size_t interfaceId, const std::vector<MacAddress> &macAddressList);
ACTIV_FRAMEWORK_API ~EthernetReceiver();
//! Is time stamping enabled?
ACTIV_FRAMEWORK_API bool IsTimestampingEnabled() const;
private:
EfviDistributor * m_pDistributor;
};
} // namespace KernelBypass
} // namespace Activ
#endif // (!defined ACTIV_FRAMEWORK_KERNEL_BYPASS_ETHERNET_RECEIVER_H)