PacketSocketHandle.hh
Go to the documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00027 #ifndef HH_SENF_Socket_Protocols_Raw_PacketSocketHandle_
00028 #define HH_SENF_Socket_Protocols_Raw_PacketSocketHandle_ 1
00029
00030
00031 #include <senf/Socket/SocketPolicy.hh>
00032 #include <senf/Socket/SocketProtocol.hh>
00033 #include <senf/Socket/ProtocolClientSocketHandle.hh>
00034 #include <senf/Socket/FramingPolicy.hh>
00035 #include <senf/Socket/CommunicationPolicy.hh>
00036 #include <senf/Socket/ReadWritePolicy.hh>
00037 #include <senf/Socket/Protocols/BSDSocketProtocol.hh>
00038 #include <senf/Socket/Protocols/DatagramSocketProtocol.hh>
00039 #include "LLAddressing.hh"
00040
00041
00042
00043
00044
00045 namespace senf {
00046
00048
00049
00050 typedef MakeSocketPolicy<
00051 LLAddressingPolicy,
00052 DatagramFramingPolicy,
00053 UnconnectedCommunicationPolicy,
00054 ReadablePolicy,
00055 WriteablePolicy
00056 >::policy Packet_Policy;
00057
00077 class PacketSocketProtocol
00078 : public ConcreteSocketProtocol<Packet_Policy, PacketSocketProtocol>,
00079 public DatagramSocketProtocol,
00080 public BSDSocketProtocol
00081 {
00082 public:
00083 enum SocketType { RawSocket, DatagramSocket };
00085
00087
00088 void init_client(SocketType type = RawSocket, int protocol = -1) const;
00090
00108
00109
00111
00112
00113 void mcAdd(std::string const & interface, MACAddress const & address) const;
00115
00121 void mcDrop(std::string const & interface, MACAddress const & address) const;
00123
00125 void promisc(std::string const & interface, bool mode) const;
00127
00128
00129
00131
00132
00133 unsigned available() const;
00134 bool eof() const;
00135
00136
00137 };
00138
00139 typedef ProtocolClientSocketHandle<PacketSocketProtocol> PacketSocketHandle;
00141
00143
00144 }
00145
00146
00147
00148
00149
00150
00151 #endif
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162