X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FProtocols%2FRaw%2FLLAddressing.hh;h=78a1c326a421e9208c47a65db0bfebc4137fab7d;hb=5443435c4c2b6e4386c5334b5b8358273f2bae93;hp=bd82689c7b4faeba02f98cdcf63bb16357042732;hpb=1d9b6ad3acfb5059ecb461286de0dc11a9da9851;p=senf.git diff --git a/Socket/Protocols/Raw/LLAddressing.hh b/Socket/Protocols/Raw/LLAddressing.hh index bd82689..78a1c32 100644 --- a/Socket/Protocols/Raw/LLAddressing.hh +++ b/Socket/Protocols/Raw/LLAddressing.hh @@ -24,15 +24,16 @@ \brief LLSocketAddress and LLAddressingPolicy public header */ -#ifndef HH_LLAddressing_ -#define HH_LLAddressing_ 1 +#ifndef HH_SENF_Socket_Protocols_Raw_LLAddressing_ +#define HH_SENF_Socket_Protocols_Raw_LLAddressing_ 1 // Custom includes #include #include -#include "../../../Socket/SocketPolicy.hh" -#include "../../../Socket/FileHandle.hh" -#include "../../../Socket/Protocols/GenericAddressingPolicy.hh" +#include "../../SocketPolicy.hh" +#include "../../FileHandle.hh" +#include "../BSDAddressingPolicy.hh" +#include "../BSDSocketAddress.hh" #include "MACAddress.hh" //#include "LLAddressing.mpp" @@ -54,8 +55,11 @@ namespace senf { \nosubgrouping */ class LLSocketAddress + : public BSDSocketAddress { public: + static short const addressFamily = AF_PACKET; + /** \brief Valid pkttype() values These are the possible values returned by pkttype() @@ -95,16 +99,18 @@ namespace senf { \param addr Address to send data to \param iface Interface to send packet from */ + LLSocketAddress(const LLSocketAddress& other); + LLSocketAddress& operator=(const LLSocketAddress& other); + ///@} /////////////////////////////////////////////////////////////////////////// - void clear(); ///< Clear the address - - unsigned protocol() const; ///< Return address protocol (ethertype) + MACAddress address() const; ///< Return address std::string interface() const; ///< Return interface name + unsigned protocol() const; ///< Return address protocol (ethertype) + unsigned arptype() const; ///< Return the hatype field (ARP hardware type) PktType pkttype() const; ///< Return type of packet - MACAddress address() const; ///< Return address // The mutating interface is purposely restricted to allow only // changing those members, which are sensible to be changed. @@ -113,14 +119,8 @@ namespace senf { void interface(std::string const & iface); ///< Change interface void protocol(unsigned prot); ///< Change protocol - ///\name Generic SocketAddress interface - ///@{ - - struct sockaddr * sockaddr_p(); - struct sockaddr const * sockaddr_p() const; - unsigned sockaddr_len() const; - - ///@} + using BSDSocketAddress::sockaddr_p; + using BSDSocketAddress::socklen_p; private: struct ::sockaddr_ll addr_; @@ -146,12 +146,12 @@ namespace senf { */ struct LLAddressingPolicy : public AddressingPolicyBase, - private GenericAddressingPolicy + private BSDAddressingPolicyMixin { typedef LLSocketAddress Address; - using GenericAddressingPolicy::local; - using GenericAddressingPolicy::bind; + using BSDAddressingPolicyMixin::local; + using BSDAddressingPolicyMixin::bind; }; /// @}