11#include <promeki/config.h>
12#if PROMEKI_ENABLE_NETWORK
15PROMEKI_NAMESPACE_BEGIN
41class RawSocket :
public AbstractSocket {
42 PROMEKI_OBJECT(RawSocket, AbstractSocket)
48 RawSocket(ObjectBase *parent =
nullptr);
51 ~RawSocket()
override;
60 void setInterface(
const String &interfaceName) { _interface = interfaceName; }
63 const String &interface()
const {
return _interface; }
77 void setProtocol(uint16_t ethertype) { _protocol = ethertype; }
80 uint16_t protocol()
const {
return _protocol; }
92 Error open(OpenMode mode)
override;
98 Error close()
override;
101 bool isOpen()
const override {
return _fd >= 0; }
109 int64_t read(
void *data, int64_t maxSize)
override;
117 int64_t write(
const void *data, int64_t maxSize)
override;
124 Error setPromiscuous(
bool enable);
128 uint16_t _protocol = 0;