namespace {
class MySocketHandle
- : public senf::ClientSocketHandle<senf::test::SomeProtocol::Policy>
+ : public senf::ClientSocketHandle<senf::test::SomeSocketProtocol::Policy>
{
public:
MySocketHandle()
- : senf::ClientSocketHandle<senf::test::SomeProtocol::Policy>(
+ : senf::ClientSocketHandle<senf::test::SomeSocketProtocol::Policy>(
std::auto_ptr<senf::SocketBody>(
- new senf::ProtocolSocketBody<senf::test::SomeProtocol>(false)))
+ new senf::ProtocolSocketBody<senf::test::SomeSocketProtocol>(false)))
{}
};
OtherSocketHandle osh (myh);
BOOST_CHECKPOINT("Assigning socket handle");
osh = myh;
- typedef senf::ClientSocketHandle<senf::test::SomeProtocol::Policy> SomeSocketHandle;
+ typedef senf::ClientSocketHandle<senf::test::SomeSocketProtocol::Policy> SomeSocketHandle;
BOOST_CHECKPOINT("static_casting socket handle");
SomeSocketHandle ssh =
senf::static_socket_cast<SomeSocketHandle>(osh);
ProtocolClientSocketHandle or ProtocolServerSocketHandle. You will probably not use these
templates as is but use proper typedefs (for example TCPv4ClientSocketHandle or
PacketSocketHandle). The documentation for these socket handles are found in the protocol class
- (for example TCPv4SocketProtocol or PacketProtocol).
+ (for example TCPv4SocketProtocol or PacketSocketProtocol).
\section usage_reusable Writing Reusable Components
After the protocol class has been defined, you will probably want to provide typedefs for the
new protocol sockets. If the new protocol is connection oriented, this will be like
\code
- typedef ProtocolClientSocketHandle<MyProtocolClass> MyProtocolClientSocketHandle;
- typedef ProtocolServerSocketHandle<MyProtocolClass> MyProtocolServerSocketHandle;
+ typedef ProtocolClientSocketHandle<MySocketProtocolClass> MySocketProtocolClientSocketHandle;
+ typedef ProtocolServerSocketHandle<MySocketProtocolClass> MySocketProtocolServerSocketHandle;
\endcode
\section extend_policy Extending the policy framework
///////////////////////////////cc.p////////////////////////////////////////
namespace {
- struct MyProtocol : public senf::test::SomeProtocol
+ struct MySocketProtocol : public senf::test::SomeSocketProtocol
{
- using senf::test::SomeProtocol::init_client;
+ using senf::test::SomeSocketProtocol::init_client;
void init_client(char const *,unsigned) const {}
};
}
BOOST_AUTO_UNIT_TEST(protocolClientSocketHandle)
{
- typedef senf::ProtocolClientSocketHandle<MyProtocol> MySocketHandle;
+ typedef senf::ProtocolClientSocketHandle<MySocketProtocol> MySocketHandle;
{
typedef senf::MakeSocketPolicy<
namespace {
- struct MyProtocol : public senf::test::SomeProtocol
+ struct MySocketProtocol : public senf::test::SomeSocketProtocol
{
- using senf::test::SomeProtocol::init_server;
+ using senf::test::SomeSocketProtocol::init_server;
void init_server(char const *,unsigned) const {}
};
}
BOOST_AUTO_UNIT_TEST(protocolServerSocketHandle)
{
- typedef senf::ProtocolServerSocketHandle<MyProtocol> MySocketHandle;
+ typedef senf::ProtocolServerSocketHandle<MySocketProtocol> MySocketHandle;
{
typedef senf::MakeSocketPolicy<
BOOST_CHECK_EQUAL( h.dumpState(),
"file.handle: -1\n"
"file.refcount: 2\n"
- "handle: senf::ProtocolServerSocketHandle<(anonymous namespace)::MyProtocol>\n"
- "socket.protocol: (anonymous namespace)::MyProtocol\n"
+ "handle: senf::ProtocolServerSocketHandle<(anonymous namespace)::MySocketProtocol>\n"
+ "socket.protocol: (anonymous namespace)::MySocketProtocol\n"
"socket.protocol.policy: senf::SocketPolicy<senf::test::SomeAddressingPolicy, senf::test::SomeFramingPolicy, senf::test::SomeCommunicationPolicy, senf::test::SomeReadPolicy, senf::test::SomeWritePolicy>\n"
"socket.server: true\n" );
///////////////////////////////////////////////////////////////////////////
// senf::DVBDemuxHandles
-prefix_ void senf::DVBDemuxSectionProtocol::init_client(unsigned short adapter, unsigned short device)
+prefix_ void senf::DVBDemuxSectionSocketProtocol::init_client(unsigned short adapter, unsigned short device)
const
{
std::string devDemux = str( boost::format(
fd(f);
}
-prefix_ unsigned senf::DVBDemuxSectionProtocol::available()
+prefix_ unsigned senf::DVBDemuxSectionSocketProtocol::available()
const
{
return 4096;
}
-prefix_ void senf::DVBDemuxSectionProtocol::setSectionFilter(struct dmx_sct_filter_params *filter)
+prefix_ void senf::DVBDemuxSectionSocketProtocol::setSectionFilter(struct dmx_sct_filter_params *filter)
const
{
if (::ioctl(fd(), DMX_SET_FILTER, filter) < 0)
// ----------------------------------------------------------------
-prefix_ void senf::DVBDemuxPESProtocol::init_client(unsigned short adapter, unsigned short device)
+prefix_ void senf::DVBDemuxPESSocketProtocol::init_client(unsigned short adapter, unsigned short device)
const
{
std::string devDemux = str( boost::format(
fd(f);
}
-prefix_ unsigned senf::DVBDemuxPESProtocol::available()
+prefix_ unsigned senf::DVBDemuxPESSocketProtocol::available()
const
{
return 4096; //???
}
-prefix_ void senf::DVBDemuxPESProtocol::setPESFilter(struct dmx_pes_filter_params *filter)
+prefix_ void senf::DVBDemuxPESSocketProtocol::setPESFilter(struct dmx_pes_filter_params *filter)
const
{
if (::ioctl(fd(), DMX_SET_PES_FILTER, filter) < 0)
// ----------------------------------------------------------------
-prefix_ void senf::DVBDvrProtocol::init_client(unsigned short adapter, unsigned short device)
+prefix_ void senf::DVBDvrSocketProtocol::init_client(unsigned short adapter, unsigned short device)
const
{
std::string devDvr = str( boost::format(
fd(f);
}
-prefix_ unsigned senf::DVBDvrProtocol::available()
+prefix_ unsigned senf::DVBDvrSocketProtocol::available()
const
{
return 188;
#include "../../../Socket/CommunicationPolicy.hh"
#include "../../../Socket/ReadWritePolicy.hh"
#include "../../../Socket/ProtocolClientSocketHandle.hh"
-#include "DVBDemuxProtocol.hh"
+#include "DVBDemuxSocketProtocol.hh"
//#include "DVBDemuxHandles.mpp"
///////////////////////////////hh.p////////////////////////////////////////
/** \brief xxx
*/
- class DVBDemuxSectionProtocol
- : public ConcreteSocketProtocol<DVBDemux_Policy, DVBDemuxSectionProtocol>,
- public DVBDemuxProtocol
+ class DVBDemuxSectionSocketProtocol
+ : public ConcreteSocketProtocol<DVBDemux_Policy, DVBDemuxSectionSocketProtocol>,
+ public DVBDemuxSocketProtocol
{
public:
///////////////////////////////////////////////////////////////////////////
void setSectionFilter(struct dmx_sct_filter_params *filter) const;
};
- typedef ProtocolClientSocketHandle<DVBDemuxSectionProtocol> DVBDemuxSectionHandle;
+ typedef ProtocolClientSocketHandle<DVBDemuxSectionSocketProtocol> DVBDemuxSectionHandle;
// ----------------------------------------------------------------
/** \brief xxx
*/
- class DVBDemuxPESProtocol
- : public ConcreteSocketProtocol<DVBDemux_Policy,DVBDemuxPESProtocol>,
- public DVBDemuxProtocol
+ class DVBDemuxPESSocketProtocol
+ : public ConcreteSocketProtocol<DVBDemux_Policy,DVBDemuxPESSocketProtocol>,
+ public DVBDemuxSocketProtocol
{
public:
///////////////////////////////////////////////////////////////////////////
void setPESFilter(struct dmx_pes_filter_params *filter) const;
};
- typedef ProtocolClientSocketHandle<DVBDemuxPESProtocol> DVBDemuxPESHandle;
+ typedef ProtocolClientSocketHandle<DVBDemuxPESSocketProtocol> DVBDemuxPESHandle;
// ----------------------------------------------------------------
/** \brief xxx
*/
- class DVBDvrProtocol
- : public ConcreteSocketProtocol<DVBDemux_Policy, DVBDvrProtocol>,
- public DVBDemuxProtocol
+ class DVBDvrSocketProtocol
+ : public ConcreteSocketProtocol<DVBDemux_Policy, DVBDvrSocketProtocol>,
+ public DVBDemuxSocketProtocol
{
public:
///////////////////////////////////////////////////////////////////////////
///@}
};
- typedef ProtocolClientSocketHandle<DVBDvrProtocol> DVBDvrHandle;
+ typedef ProtocolClientSocketHandle<DVBDvrSocketProtocol> DVBDvrHandle;
///@}
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief DVBDemuxProtocol non-inline non-template implementation */
+ \brief DVBDemuxSocketProtocol non-inline non-template implementation */
-#include "DVBDemuxProtocol.hh"
-//#include "DVBDemuxProtocol.ih"
+#include "DVBDemuxSocketProtocol.hh"
+//#include "DVBDemuxSocketProtocol.ih"
// Custom includes
#include <sys/socket.h>
#include <linux/sockios.h>
#include "../../../Socket/SocketHandle.hh"
-//#include "DVBDemuxProtocol.mpp"
+//#include "DVBDemuxSocketProtocol.mpp"
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
-prefix_ void senf::DVBDemuxProtocol::setBufferSize(unsigned long size)
+prefix_ void senf::DVBDemuxSocketProtocol::setBufferSize(unsigned long size)
const
{
if (::ioctl(fd(), DMX_SET_BUFFER_SIZE, size) < 0)
throw SystemException();
}
-prefix_ void senf::DVBDemuxProtocol::startFiltering()
+prefix_ void senf::DVBDemuxSocketProtocol::startFiltering()
const
{
if (::ioctl(fd(), DMX_START) < 0)
throw SystemException();
}
-prefix_ void senf::DVBDemuxProtocol::stopFiltering()
+prefix_ void senf::DVBDemuxSocketProtocol::stopFiltering()
const
{
if (::ioctl(fd(), DMX_STOP) < 0)
throw SystemException();
}
-prefix_ bool senf::DVBDemuxProtocol::eof()
+prefix_ bool senf::DVBDemuxSocketProtocol::eof()
const
{
return false;
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
-//#include "DVBDemuxProtocol.mpp"
+//#include "DVBDemuxSocketProtocol.mpp"
\f
// Local Variables:
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief DVBDemuxProtocol public header */
+ \brief DVBDemuxSocketProtocol public header */
-#ifndef HH_DVBDemuxProtocol_
-#define HH_DVBDemuxProtocol_ 1
+#ifndef HH_DVBDemuxSocketProtocol_
+#define HH_DVBDemuxSocketProtocol_ 1
#include <linux/dvb/dmx.h>
// Custom includes
#include "../../../Socket/SocketProtocol.hh"
-//#include "DVBProtocol.mpp"
+//#include "DVBSocketProtocol.mpp"
///////////////////////////////hh.p////////////////////////////////////////
namespace senf {
/** xxx
*/
- class DVBDemuxProtocol
+ class DVBDemuxSocketProtocol
: public virtual SocketProtocol
{
public:
}
///////////////////////////////hh.e////////////////////////////////////////
-//#include "DVBDemuxProtocol.cci"
-//#include "DVBDemuxProtocol.ct"
-//#include "DVBDemuxProtocol.cti"
+//#include "DVBDemuxSocketProtocol.cci"
+//#include "DVBDemuxSocketProtocol.ct"
+//#include "DVBDemuxSocketProtocol.cti"
#endif
\f
///////////////////////////////////////////////////////////////////////////
// senf::DVBFrontendHandle
-prefix_ void senf::DVBFrontendProtocol::init_client(uint8_t adapter, boost::uint8_t device)
+prefix_ void senf::DVBFrontendSocketProtocol::init_client(uint8_t adapter, boost::uint8_t device)
const
{
std::string devFrontend = str( boost::format(
fd(f);
}
-prefix_ unsigned senf::DVBFrontendProtocol::available()
+prefix_ unsigned senf::DVBFrontendSocketProtocol::available()
const
{
return 0;
}
-prefix_ bool senf::DVBFrontendProtocol::eof()
+prefix_ bool senf::DVBFrontendSocketProtocol::eof()
const
{
return false;
}
-prefix_ void senf::DVBFrontendProtocol::signalStrength(int16_t *strength)
+prefix_ void senf::DVBFrontendSocketProtocol::signalStrength(int16_t *strength)
const
{
if (::ioctl(fd(), FE_READ_SIGNAL_STRENGTH, strength) < 0)
/** \brief xxx
*/
- class DVBFrontendProtocol
- : public ConcreteSocketProtocol<DVBFrontend_Policy, DVBFrontendProtocol>
+ class DVBFrontendSocketProtocol
+ : public ConcreteSocketProtocol<DVBFrontend_Policy, DVBFrontendSocketProtocol>
{
public:
///////////////////////////////////////////////////////////////////////////
void signalStrength(int16_t *strength) const;
};
- typedef ProtocolClientSocketHandle<DVBFrontendProtocol> DVBFrontendHandle;
+ typedef ProtocolClientSocketHandle<DVBFrontendSocketProtocol> DVBFrontendHandle;
///@}
}
#define CONNECTEDRAWINETSOCKETHANDLE_HH_
// Custom includes
-#include "INetProtocol.hh"
-#include "RawINetProtocol.hh"
+#include "INetSocketProtocol.hh"
+#include "RawINetSocketProtocol.hh"
#include "../../../Socket/Protocols/BSDSocketProtocol.hh"
#include "../../../Socket/FramingPolicy.hh"
#include "../../../Socket/CommunicationPolicy.hh"
*/
class ConnectedRawV4SocketProtocol
: public ConcreteSocketProtocol<ConnectedRawV4Socket_Policy, ConnectedRawV4SocketProtocol>,
- public RawINetProtocol,
+ public RawINetSocketProtocol,
public BSDSocketProtocol,
public AddressableBSDSocketProtocol
{
*/
class ConnectedRawV6SocketProtocol
: public ConcreteSocketProtocol<ConnectedRawV6Socket_Policy, ConnectedRawV6SocketProtocol>,
- public RawINetProtocol,
+ public RawINetSocketProtocol,
public BSDSocketProtocol,
public AddressableBSDSocketProtocol
{
#define HH_ConnectedUDPSocketHandle_ 1
// Custom includes
-#include "INetProtocol.hh"
-#include "UDPProtocol.hh"
+#include "INetSocketProtocol.hh"
+#include "UDPSocketProtocol.hh"
#include "../../../Socket/Protocols/BSDSocketProtocol.hh"
#include "../../../Socket/FramingPolicy.hh"
#include "../../../Socket/CommunicationPolicy.hh"
*/
class ConnectedUDPv4SocketProtocol
: public ConcreteSocketProtocol<ConnectedUDPv4Socket_Policy, ConnectedUDPv4SocketProtocol>,
- public UDPProtocol,
+ public UDPSocketProtocol,
public BSDSocketProtocol,
public AddressableBSDSocketProtocol
{
*/
class ConnectedUDPv6SocketProtocol
: public ConcreteSocketProtocol<ConnectedUDPv6Socket_Policy, ConnectedUDPv6SocketProtocol>,
- public UDPProtocol,
+ public UDPSocketProtocol,
public BSDSocketProtocol,
public AddressableBSDSocketProtocol
{
/** \file
\brief INet[46]Protocol non-inline non-template implementation */
-#include "INetProtocol.hh"
-//#include "INetProtocol.ih"
+#include "INetSocketProtocol.hh"
+//#include "INetSocketProtocol.ih"
// Custom includes
#include <sys/socket.h>
#include <net/if.h>
#include "../../../Utils/Exception.hh"
-//#include "INetProtocol.mpp"
+//#include "INetSocketProtocol.mpp"
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
-// senf::INetProtocol
+// senf::INetSocketProtocol
-prefix_ void senf::INetProtocol::bindInterface(std::string const & iface)
+prefix_ void senf::INetSocketProtocol::bindInterface(std::string const & iface)
const
{
if (::setsockopt(fd(), SOL_SOCKET, SO_BINDTODEVICE, iface.c_str(), iface.size()) < 0)
throw SystemException("::setsockopt(SO_BINDTODEVICE)");
}
-prefix_ std::string senf::INetProtocol::bindInterface()
+prefix_ std::string senf::INetSocketProtocol::bindInterface()
{
char iface[IFNAMSIZ];
socklen_t size (sizeof(iface));
}
///////////////////////////////////////////////////////////////////////////
-// senf::IPv4Protocol
+// senf::IPv4SocketProtocol
///////////////////////////////////////////////////////////////////////////
-// senf::IPv6Protocol
+// senf::IPv6SocketProtocol
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
-//#include "INetProtocol.mpp"
+//#include "INetSocketProtocol.mpp"
\f
// Local Variables:
for SOCK_DGRAM (UDP) and not SOCK_STREAM (TCP) sockets
*/
-#ifndef HH_INetProtocol_
-#define HH_INetProtocol_ 1
+#ifndef HH_INetSocketProtocol_
+#define HH_INetSocketProtocol_ 1
// Custom includes
#include "../../../Socket/SocketProtocol.hh"
#include "../../../Socket/ClientSocketHandle.hh"
#include "../../../Socket/CommunicationPolicy.hh"
-//#include "INetProtocol.mpp"
+//#include "INetSocketProtocol.mpp"
///////////////////////////////hh.p////////////////////////////////////////
namespace senf {
/// \addtogroup protocol_facets_group
/// @{
- class INetProtocol
+ class INetSocketProtocol
: public virtual SocketProtocol
{
public:
}
///////////////////////////////hh.e////////////////////////////////////////
-//#include "INetProtocol.cci"
-//#include "INetProtocol.ct"
-//#include "INetProtocol.cti"
+//#include "INetSocketProtocol.cci"
+//#include "INetSocketProtocol.ct"
+//#include "INetSocketProtocol.cti"
#endif
\f
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief MulticastProtocol non-inline non-template implementation */
+ \brief MulticastSocketProtocol non-inline non-template implementation */
-#include "MulticastProtocol.hh"
-//#include "MulticastProtocol.ih"
+#include "MulticastSocketProtocol.hh"
+//#include "MulticastSocketProtocol.ih"
// Custom includes
#include <sys/socket.h>
#include <netinet/in.h>
#include <net/if.h> // for if_nametoindex
-//#include "MulticastProtocol.mpp"
+//#include "MulticastSocketProtocol.mpp"
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
-// senf::MulticastProtocol
+// senf::MulticastSocketProtocol
-prefix_ void senf::MulticastProtocol::broadcastEnabled(bool v)
+prefix_ void senf::MulticastSocketProtocol::broadcastEnabled(bool v)
{
int ivalue (v);
if (::setsockopt(fd(), SOL_SOCKET, SO_BROADCAST, &ivalue, sizeof(ivalue)) < 0)
throw SystemException("::setsockopt(SO_BROADCAST)");
}
-prefix_ bool senf::MulticastProtocol::broadcastEnabled()
+prefix_ bool senf::MulticastSocketProtocol::broadcastEnabled()
{
int value (0);
::socklen_t len (sizeof(value));
return value;
}
-prefix_ bool senf::MulticastProtocol::mcLoop()
+prefix_ bool senf::MulticastSocketProtocol::mcLoop()
const
{
int value;
return value;
}
-prefix_ void senf::MulticastProtocol::mcLoop(bool value)
+prefix_ void senf::MulticastSocketProtocol::mcLoop(bool value)
const
{
int ivalue (value);
throw SystemException();
}
-prefix_ void senf::MulticastProtocol::mcIface(std::string const & iface)
+prefix_ void senf::MulticastSocketProtocol::mcIface(std::string const & iface)
const
{
struct ip_mreqn mreqn;
throw SystemException();
}
-prefix_ unsigned senf::MulticastProtocol::mcTTL()
+prefix_ unsigned senf::MulticastSocketProtocol::mcTTL()
const
{
int value;
return value;
}
-prefix_ void senf::MulticastProtocol::mcTTL(unsigned value)
+prefix_ void senf::MulticastSocketProtocol::mcTTL(unsigned value)
const
{
if (::setsockopt(fd(),SOL_IP,IP_MULTICAST_TTL,&value,sizeof(value)) < 0)
}
///////////////////////////////////////////////////////////////////////////
-// senf::INet4MulticastProtocol
+// senf::INet4MulticastSocketProtocol
-prefix_ void senf::INet4MulticastProtocol::mcAddMembership(INet4Address const & mcAddr)
+prefix_ void senf::INet4MulticastSocketProtocol::mcAddMembership(INet4Address const & mcAddr)
const
{
struct ip_mreqn mreqn;
throw SystemException("::setsockopt(IP_ADD_MEMBERSHIP");
}
-prefix_ void senf::INet4MulticastProtocol::mcAddMembership(INet4Address const & mcAddr,
+prefix_ void senf::INet4MulticastSocketProtocol::mcAddMembership(INet4Address const & mcAddr,
INet4Address const & localAddr)
const
{
throw SystemException("::setsockopt(IP_ADD_MEMBERSHIP");
}
-prefix_ void senf::INet4MulticastProtocol::mcAddMembership(INet4Address const & mcAddr,
+prefix_ void senf::INet4MulticastSocketProtocol::mcAddMembership(INet4Address const & mcAddr,
std::string const & iface)
const
{
throw SystemException("::setsockopt(IP_ADD_MEMBERSHIP");
}
-prefix_ void senf::INet4MulticastProtocol::mcDropMembership(INet4Address const & mcAddr)
+prefix_ void senf::INet4MulticastSocketProtocol::mcDropMembership(INet4Address const & mcAddr)
const
{
struct ip_mreqn mreqn;
throw SystemException();
}
-prefix_ void senf::INet4MulticastProtocol::mcDropMembership(INet4Address const & mcAddr,
+prefix_ void senf::INet4MulticastSocketProtocol::mcDropMembership(INet4Address const & mcAddr,
INet4Address const & localAddr)
const
{
throw SystemException();
}
-prefix_ void senf::INet4MulticastProtocol::mcDropMembership(INet4Address const & mcAddr,
+prefix_ void senf::INet4MulticastSocketProtocol::mcDropMembership(INet4Address const & mcAddr,
std::string const & iface)
const
{
}
///////////////////////////////////////////////////////////////////////////
-// senf::INet6MulticastProtocol
+// senf::INet6MulticastSocketProtocol
-prefix_ void senf::INet6MulticastProtocol::mcAddMembership(INet6Address const & mcAddr)
+prefix_ void senf::INet6MulticastSocketProtocol::mcAddMembership(INet6Address const & mcAddr)
const
{
struct ipv6_mreq mreqn;
throw SystemException("::setsockopt(IPV6_ADD_MEMBERSHIP");
}
-prefix_ void senf::INet6MulticastProtocol::mcAddMembership(INet6Address const & mcAddr,
+prefix_ void senf::INet6MulticastSocketProtocol::mcAddMembership(INet6Address const & mcAddr,
std::string const & iface)
{
struct ipv6_mreq mreqn;
throw SystemException("::setsockopt(IPV6_ADD_MEMBERSHIP");
}
-prefix_ void senf::INet6MulticastProtocol::mcDropMembership(INet6Address const & mcAddr)
+prefix_ void senf::INet6MulticastSocketProtocol::mcDropMembership(INet6Address const & mcAddr)
const
{
struct ipv6_mreq mreqn;
}
prefix_ void
-senf::INet6MulticastProtocol::mcDropMembership(INet6Address const & mcAddr,
+senf::INet6MulticastSocketProtocol::mcDropMembership(INet6Address const & mcAddr,
std::string const & iface)
const
{
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
-//#include "MulticastProtocol.mpp"
+//#include "MulticastSocketProtocol.mpp"
\f
// Local Variables:
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief MulticastProtocol public header */
+ \brief MulticastSocketProtocol public header */
-#ifndef HH_MulticastProtocol_
-#define HH_MulticastProtocol_ 1
+#ifndef HH_MulticastSocketProtocol_
+#define HH_MulticastSocketProtocol_ 1
// Custom includes
#include "../../../Socket/SocketProtocol.hh"
#include "INet4Address.hh"
#include "INet6Address.hh"
-//#include "MulticastProtocol.mpp"
+//#include "MulticastSocketProtocol.mpp"
///////////////////////////////hh.p////////////////////////////////////////
namespace senf {
///\addtogroup protocol_facets_group
///\{
- class MulticastProtocol
+ class MulticastSocketProtocol
: public virtual SocketProtocol
{
public:
data from */
};
- class INet4MulticastProtocol
+ class INet4MulticastSocketProtocol
: public virtual SocketProtocol
{
public:
\param[in] iface interface name */
};
- class INet6MulticastProtocol
+ class INet6MulticastSocketProtocol
: public virtual SocketProtocol
{
public:
}
///////////////////////////////hh.e////////////////////////////////////////
-//#include "MulticastProtocol.cci"
-//#include "MulticastProtocol.ct"
-//#include "MulticastProtocol.cti"
+//#include "MulticastSocketProtocol.cci"
+//#include "MulticastSocketProtocol.ct"
+//#include "MulticastSocketProtocol.cti"
#endif
\f
// Custom includes
-#include "INetProtocol.hh"
-#include "RawINetProtocol.hh"
-#include "MulticastProtocol.hh"
+#include "INetSocketProtocol.hh"
+#include "RawINetSocketProtocol.hh"
+#include "MulticastSocketProtocol.hh"
#include "../../../Socket/Protocols/BSDSocketProtocol.hh"
#include "../../../Socket/FramingPolicy.hh"
#include "../../../Socket/CommunicationPolicy.hh"
*/
class RawV4SocketProtocol
: public ConcreteSocketProtocol<RawV4Socket_Policy, RawV4SocketProtocol>,
- public RawINetProtocol,
+ public RawINetSocketProtocol,
public BSDSocketProtocol,
public AddressableBSDSocketProtocol,
- public MulticastProtocol,
- public INet4MulticastProtocol
+ public MulticastSocketProtocol,
+ public INet4MulticastSocketProtocol
{
public:
///////////////////////////////////////////////////////////////////////////
*/
class RawV6SocketProtocol
: public ConcreteSocketProtocol<RawV6Socket_Policy,RawV6SocketProtocol>,
- public RawINetProtocol,
+ public RawINetSocketProtocol,
public BSDSocketProtocol,
public AddressableBSDSocketProtocol,
- public MulticastProtocol,
- public INet4MulticastProtocol
+ public MulticastSocketProtocol,
+ public INet4MulticastSocketProtocol
{
public:
///////////////////////////////////////////////////////////////////////////
-// $Id: RawINetProtocol.cc 597 2008-01-15 09:16:20Z g0dil $
+// $Id: RawINetSocketProtocol.cc 597 2008-01-15 09:16:20Z g0dil $
//
// Copyright (C) 2007
// Fraunhofer Institute for Open Communication Systems (FOKUS)
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#include "RawINetProtocol.hh"
+#include "RawINetSocketProtocol.hh"
// Custom includes
#include <sys/socket.h>
#include <net/if.h> // for if_nametoindex
#include "../../../Socket/SocketHandle.hh"
-//#include "UDPProtocol.mpp"
+//#include "UDPSocketProtocol.mpp"
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
-prefix_ unsigned senf::RawINetProtocol::available()
+prefix_ unsigned senf::RawINetSocketProtocol::available()
const
{
int n;
return n;
}
-prefix_ bool senf::RawINetProtocol::eof()
+prefix_ bool senf::RawINetSocketProtocol::eof()
const
{
return false;
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
-//#include "UDPProtocol.mpp"
+//#include "UDPSocketProtocol.mpp"
\f
// Local Variables:
-// $Id: RawINetProtocol.hh 597 2008-01-15 09:16:20Z g0dil $
+// $Id: RawINetSocketProtocol.hh 597 2008-01-15 09:16:20Z g0dil $
//
// Copyright (C) 2007
// Fraunhofer Institute for Open Communication Systems (FOKUS)
// Custom includes
#include "INetAddressing.hh"
-#include "INetProtocol.hh"
+#include "INetSocketProtocol.hh"
#include "../../../Socket/Protocols/BSDSocketProtocol.hh"
#include "../../../Socket/FramingPolicy.hh"
#include "../../../Socket/CommunicationPolicy.hh"
which are available on a PF_INET[6]/RAW socket.
*/
- class RawINetProtocol
+ class RawINetSocketProtocol
: public virtual SocketProtocol
{
public:
#define HH_TCPSocketHandle_ 1
// Custom includes
-#include "INetProtocol.hh"
-#include "TCPProtocol.hh"
+#include "INetSocketProtocol.hh"
+#include "TCPSocketProtocol.hh"
#include "../../../Socket/Protocols/BSDSocketProtocol.hh"
#include "../../../Socket/FramingPolicy.hh"
#include "../../../Socket/CommunicationPolicy.hh"
*/
class TCPv4SocketProtocol
: public ConcreteSocketProtocol<TCPv4Socket_Policy,TCPv4SocketProtocol>,
- public TCPProtocol,
+ public TCPSocketProtocol,
public BSDSocketProtocol,
public AddressableBSDSocketProtocol
{
*/
class TCPv6SocketProtocol
: public ConcreteSocketProtocol<TCPv6Socket_Policy,TCPv6SocketProtocol>,
- public TCPProtocol,
+ public TCPSocketProtocol,
public BSDSocketProtocol,
public AddressableBSDSocketProtocol
{
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief TCPProtocol non-inline non-template implementation
+ \brief TCPSocketProtocol non-inline non-template implementation
*/
-#include "TCPProtocol.hh"
-//#include "TCPProtocol.ih"
+#include "TCPSocketProtocol.hh"
+//#include "TCPSocketProtocol.ih"
// Custom includes
#include <sys/socket.h>
#include <linux/sockios.h> // for SIOCINQ / SIOCOUTQ
#include "../../../Socket/SocketHandle.hh"
-//#include "TCPProtocol.mpp"
+//#include "TCPSocketProtocol.mpp"
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
-prefix_ bool senf::TCPProtocol::nodelay()
+prefix_ bool senf::TCPSocketProtocol::nodelay()
const
{
int value;
return value;
}
-prefix_ void senf::TCPProtocol::nodelay(bool value)
+prefix_ void senf::TCPSocketProtocol::nodelay(bool value)
const
{
int ivalue (value);
throw SystemException();
}
-prefix_ unsigned senf::TCPProtocol::siocinq()
+prefix_ unsigned senf::TCPSocketProtocol::siocinq()
const
{
int n;
return n;
}
-prefix_ unsigned senf::TCPProtocol::siocoutq()
+prefix_ unsigned senf::TCPSocketProtocol::siocoutq()
const
{
int n;
return n;
}
-prefix_ unsigned senf::TCPProtocol::available()
+prefix_ unsigned senf::TCPSocketProtocol::available()
const
{
return siocinq();
}
-prefix_ bool senf::TCPProtocol::eof()
+prefix_ bool senf::TCPSocketProtocol::eof()
const
{
return fh().readable() && available()==0;
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
-//#include "TCPProtocol.mpp"
+//#include "TCPSocketProtocol.mpp"
\f
// Local Variables:
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief TCPProtocol public header
+ \brief TCPSocketProtocol public header
*/
-#ifndef HH_TCPProtocol_
-#define HH_TCPProtocol_ 1
+#ifndef HH_TCPSocketProtocol_
+#define HH_TCPSocketProtocol_ 1
// Custom includes
#include "../../../Socket/SocketProtocol.hh"
-//#include "TCPProtocol.mpp"
+//#include "TCPSocketProtocol.mpp"
///////////////////////////////hh.p////////////////////////////////////////
namespace senf {
This protocol facet provides all those protocol functions,
which are available on any TCP socket.
*/
- class TCPProtocol
+ class TCPSocketProtocol
: public virtual SocketProtocol
{
public:
}
///////////////////////////////hh.e////////////////////////////////////////
-//#include "TCPProtocol.cci"
-//#include "TCPProtocol.ct"
-//#include "TCPProtocol.cti"
+//#include "TCPSocketProtocol.cci"
+//#include "TCPSocketProtocol.ct"
+//#include "TCPSocketProtocol.cti"
#endif
\f
#define HH_UDPSocketHandle_ 1
// Custom includes
-#include "INetProtocol.hh"
-#include "UDPProtocol.hh"
-#include "MulticastProtocol.hh"
+#include "INetSocketProtocol.hh"
+#include "UDPSocketProtocol.hh"
+#include "MulticastSocketProtocol.hh"
#include "../../../Socket/Protocols/BSDSocketProtocol.hh"
#include "../../../Socket/Protocols/DatagramSocketProtocol.hh"
#include "../../../Socket/FramingPolicy.hh"
*/
class UDPv4SocketProtocol
: public ConcreteSocketProtocol<UDPv4Socket_Policy, UDPv4SocketProtocol>,
- public UDPProtocol,
- public MulticastProtocol,
- public INet4MulticastProtocol,
+ public UDPSocketProtocol,
+ public MulticastSocketProtocol,
+ public INet4MulticastSocketProtocol,
public BSDSocketProtocol,
public DatagramSocketProtocol,
public AddressableBSDSocketProtocol
*/
class UDPv6SocketProtocol
: public ConcreteSocketProtocol<UDPv6Socket_Policy, UDPv6SocketProtocol>,
- public UDPProtocol,
- public MulticastProtocol,
- public INet6MulticastProtocol,
+ public UDPSocketProtocol,
+ public MulticastSocketProtocol,
+ public INet6MulticastSocketProtocol,
public BSDSocketProtocol,
public DatagramSocketProtocol,
public AddressableBSDSocketProtocol
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief TCPProtocol non-inline non-template implementation
+ \brief TCPSocketProtocol non-inline non-template implementation
*/
-#include "UDPProtocol.hh"
-//#include "UDPProtocol.ih"
+#include "UDPSocketProtocol.hh"
+//#include "UDPSocketProtocol.ih"
// Custom includes
#include <sys/socket.h>
#include <net/if.h> // for if_nametoindex
#include "../../../Socket/SocketHandle.hh"
-//#include "UDPProtocol.mpp"
+//#include "UDPSocketProtocol.mpp"
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
-prefix_ unsigned senf::UDPProtocol::available()
+prefix_ unsigned senf::UDPSocketProtocol::available()
const
{
int n;
return n;
}
-prefix_ bool senf::UDPProtocol::eof()
+prefix_ bool senf::UDPSocketProtocol::eof()
const
{
return false;
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
-//#include "UDPProtocol.mpp"
+//#include "UDPSocketProtocol.mpp"
\f
// Local Variables:
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief UDPProtocol public header
+ \brief UDPSocketProtocol public header
*/
-#ifndef HH_UDPProtocol_
-#define HH_UDPProtocol_ 1
+#ifndef HH_UDPSocketProtocol_
+#define HH_UDPSocketProtocol_ 1
// Custom includes
#include "../../../Socket/SocketProtocol.hh"
#include "INetAddressing.hh"
-//#include "UDPProtocol.mpp"
+//#include "UDPSocketProtocol.mpp"
///////////////////////////////hh.p////////////////////////////////////////
namespace senf {
This protocol facet provides all those protocol functions,
which are available on any UDP socket.
*/
- class UDPProtocol
+ class UDPSocketProtocol
: public virtual SocketProtocol
{
public:
}
///////////////////////////////hh.e////////////////////////////////////////
-//#include "UDPProtocol.cci"
-//#include "UDPProtocol.ct"
-//#include "UDPProtocol.cti"
+//#include "UDPSocketProtocol.cci"
+//#include "UDPSocketProtocol.ct"
+//#include "UDPSocketProtocol.cti"
#endif
\f
/**< The string representation must exactly match the form
<tt>dd:dd:dd:dd:dd:dd</tt> where <tt>d</tt> is any
hexadecimal digit. In place of ':', '-' is also
- accepted as a delimiter. */
+ accepted as a delimiter.
+ \throws AddressSyntaxException */
template <class InputIterator>
static MACAddress from_data(InputIterator i);
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief PacketProtocol and PacketSocketHandle non-inline non-template implementation
+ \brief PacketSocketProtocol and PacketSocketHandle non-inline non-template implementation
*/
#include "PacketSocketHandle.hh"
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
-prefix_ void senf::PacketProtocol::init_client(SocketType type, int protocol)
+prefix_ void senf::PacketSocketProtocol::init_client(SocketType type, int protocol)
const
{
int socktype = SOCK_RAW;
fd(sock);
}
-prefix_ unsigned senf::PacketProtocol::available()
+prefix_ unsigned senf::PacketSocketProtocol::available()
const
{
if (! fh().readable())
return l;
}
-prefix_ bool senf::PacketProtocol::eof()
+prefix_ bool senf::PacketSocketProtocol::eof()
const
{
return false;
}
-prefix_ void senf::PacketProtocol::mcAdd(std::string const & interface,
+prefix_ void senf::PacketSocketProtocol::mcAdd(std::string const & interface,
MACAddress const & address)
const
{
do_mc(fd(),interface,address,true);
}
-prefix_ void senf::PacketProtocol::mcDrop(std::string const & interface,
+prefix_ void senf::PacketSocketProtocol::mcDrop(std::string const & interface,
MACAddress const & address)
const
{
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief PacketProtocol and PacketSocketHandle public header
+ \brief PacketSocketProtocol and PacketSocketHandle public header
*/
#ifndef HH_PacketSocketHandle_
UnconnectedCommunicationPolicy,
ReadablePolicy,
WriteablePolicy
- >::policy Packet_Policy; ///< Policy of PacketProtocol
+ >::policy Packet_Policy; ///< Policy of PacketSocketProtocol
/** \brief Raw Packet-Socket access (Linux)
\par Address Type:
LLSocketAddress
- The PacketProtocol provides access to the linux packet socket API. This API gives access to
+ The PacketSocketProtocol provides access to the linux packet socket API. This API gives access to
the low level network packets. The packet socket allows read() and write() operations. The
- PacketProtocol has no concept of a server socket.
+ PacketSocketProtocol has no concept of a server socket.
This class is utilized as the protocol class of the ProtocolClientSocketHandle via the
Socket Handle typedefs above.
*/
- class PacketProtocol
- : public ConcreteSocketProtocol<Packet_Policy, PacketProtocol>,
+ class PacketSocketProtocol
+ : public ConcreteSocketProtocol<Packet_Policy, PacketSocketProtocol>,
public BSDSocketProtocol
{
public:
///@}
};
- typedef ProtocolClientSocketHandle<PacketProtocol> PacketSocketHandle;
- ///< SocketHandle of the PacketProtocol
+ typedef ProtocolClientSocketHandle<PacketSocketProtocol> PacketSocketHandle;
+ ///< SocketHandle of the PacketSocketProtocol
/**< \related PacketPrototol */
/// @}
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
-prefix_ void senf::TapProtocol::init_client()
+prefix_ void senf::TapSocketProtocol::init_client()
const
{
init_client(std::string());
}
-prefix_ void senf::TapProtocol::init_client(std::string const & interface_name, bool const NO_PI)
+prefix_ void senf::TapSocketProtocol::init_client(std::string const & interface_name, bool const NO_PI)
const
{
int f;
fd(f);
}
-prefix_ unsigned senf::TapProtocol::available()
+prefix_ unsigned senf::TapSocketProtocol::available()
const
{
if (! fh().readable())
/*
#include <linux/sockios.h> // for SIOCINQ / SIOCOUTQ
-prefix_ unsigned senf::TapProtocol::available()
+prefix_ unsigned senf::TapSocketProtocol::available()
const
{
if (! body().readable())
}
*/
-prefix_ bool senf::TapProtocol::eof()
+prefix_ bool senf::TapSocketProtocol::eof()
const
{
return false;
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief PacketProtocol and PacketSocketHandle public header
+ \brief PacketSocketProtocol and PacketSocketHandle public header
*/
#ifndef HH_TunTapSocketHandle_
This class is utilized as the protocol class of the ProtocolClientSocketHandle via the
Socket Handle typedefs above.
*/
- class TapProtocol
- : public ConcreteSocketProtocol<Tap_Policy,TapProtocol>,
+ class TapSocketProtocol
+ : public ConcreteSocketProtocol<Tap_Policy,TapSocketProtocol>,
public BSDSocketProtocol
{
public:
///@}
};
- typedef ProtocolClientSocketHandle<TapProtocol> TapSocketHandle;
- ///< SocketHandle of TapProtocol
+ typedef ProtocolClientSocketHandle<TapSocketProtocol> TapSocketHandle;
+ ///< SocketHandle of TapSocketProtocol
/**< \related TapPrototol */
/// @}
// Custom includes
#include "UNAddressing.hh"
-#include "UNProtocol.hh"
+#include "UNSocketProtocol.hh"
#include "../../../Socket/Protocols/BSDSocketProtocol.hh"
#include "../../../Socket/FramingPolicy.hh"
#include "../../../Socket/CommunicationPolicy.hh"
class ConnectedUNDatagramSocketProtocol
: public ConcreteSocketProtocol<ConnectedUNDatagramSocket_Policy,
ConnectedUNDatagramSocketProtocol>,
- public UNProtocol,
+ public UNSocketProtocol,
public BSDSocketProtocol,
public AddressableBSDSocketProtocol
{
// Custom includes
#include "UNAddressing.hh"
-#include "UNProtocol.hh"
+#include "UNSocketProtocol.hh"
#include "../../../Socket/Protocols/BSDSocketProtocol.hh"
#include "../../../Socket/FramingPolicy.hh"
#include "../../../Socket/CommunicationPolicy.hh"
class UNDatagramSocketProtocol
: public ConcreteSocketProtocol<UNDatagramSocket_Policy,
UNDatagramSocketProtocol>,
- public UNProtocol,
+ public UNSocketProtocol,
public BSDSocketProtocol,
public AddressableBSDSocketProtocol
{
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief UNProtocol non-inline non-template implementation */
+ \brief UNSocketProtocol non-inline non-template implementation */
-#include "UNProtocol.hh"
-//#include "UNProtocol.ih"
+#include "UNSocketProtocol.hh"
+//#include "UNSocketProtocol.ih"
// Custom includes
#include <fstream>
#include <linux/sockios.h> // for SIOCINQ / SIOCOUTQ
#include "../../../Utils/Exception.hh"
-//#include "UNProtocol.mpp"
+//#include "UNSocketProtocol.mpp"
#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
-prefix_ unsigned senf::UNProtocol::available()
+prefix_ unsigned senf::UNSocketProtocol::available()
const
{
int n;
return n;
}
-prefix_ bool senf::UNProtocol::eof()
+prefix_ bool senf::UNSocketProtocol::eof()
const
{
return false;
}
-prefix_ void senf::UNProtocol::close()
+prefix_ void senf::UNSocketProtocol::close()
const
{
check_and_unlink();
SocketProtocol::close();
}
-prefix_ void senf::UNProtocol::terminate()
+prefix_ void senf::UNSocketProtocol::terminate()
const
{
check_and_unlink();
SocketProtocol::terminate();
}
-prefix_ void senf::UNProtocol::check_and_unlink()
+prefix_ void senf::UNSocketProtocol::check_and_unlink()
const
{
typedef ClientSocketHandle<MakeSocketPolicy<UNAddressingPolicy>::policy> UNSocketHandle;
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
-//#include "UNProtocol.mpp"
+//#include "UNSocketProtocol.mpp"
\f
// Local Variables:
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief UNProtocol public header */
+ \brief UNSocketProtocol public header */
-#ifndef HH_UNProtocol_
-#define HH_UNProtocol_ 1
+#ifndef HH_UNSocketProtocol_
+#define HH_UNSocketProtocol_ 1
// Custom includes
#include "../../../Socket/SocketProtocol.hh"
#include "../../../Socket/ClientSocketHandle.hh"
#include "../../../Socket/CommunicationPolicy.hh"
-//#include "UNProtocol.mpp"
+//#include "UNSocketProtocol.mpp"
///////////////////////////////hh.p////////////////////////////////////////
namespace senf {
This protocol facet introduces all the socket api protocol members which are related to Unix
Domain addressing.
*/
- class UNProtocol
+ class UNSocketProtocol
: public virtual SocketProtocol
{
public:
}
///////////////////////////////hh.e////////////////////////////////////////
-//#include "UNProtocol.cci"
-//#include "UNProtocol.ct"
-//#include "UNProtocol.cti"
+//#include "UNSocketProtocol.cci"
+//#include "UNSocketProtocol.ct"
+//#include "UNSocketProtocol.cti"
#endif
\f
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief UNProtocol.test unit tests */
+ \brief UNSocketProtocol.test unit tests */
-//#include "UNProtocol.test.hh"
-//#include "UNProtocol.test.ih"
+//#include "UNSocketProtocol.test.hh"
+//#include "UNSocketProtocol.test.ih"
// Custom includes
-#include "UNProtocol.hh"
+#include "UNSocketProtocol.hh"
#include "../../../Utils/auto_unit_test.hh"
#include <boost/test/test_tools.hpp>
namespace {
class MySocketHandle
- : public senf::ServerSocketHandle<senf::test::SomeProtocol::Policy>
+ : public senf::ServerSocketHandle<senf::test::SomeSocketProtocol::Policy>
{
public:
MySocketHandle()
- : senf::ServerSocketHandle<senf::test::SomeProtocol::Policy>(
+ : senf::ServerSocketHandle<senf::test::SomeSocketProtocol::Policy>(
std::auto_ptr<senf::SocketBody>(
- new senf::ProtocolSocketBody<senf::test::SomeProtocol>(true)))
+ new senf::ProtocolSocketBody<senf::test::SomeSocketProtocol>(true)))
{}
};
OtherSocketHandle osh (myh);
osh = myh;
- typedef senf::ServerSocketHandle<senf::test::SomeProtocol::Policy> SomeSocketHandle;
+ typedef senf::ServerSocketHandle<senf::test::SomeSocketProtocol::Policy> SomeSocketHandle;
SomeSocketHandle ssh = senf::static_socket_cast<SomeSocketHandle>(osh);
typedef senf::ServerSocketHandle<senf::MakeSocketPolicy<
namespace {
class MySocketHandle
- : public senf::SocketHandle<senf::test::SomeProtocol::Policy>
+ : public senf::SocketHandle<senf::test::SomeSocketProtocol::Policy>
{
public:
MySocketHandle()
- : senf::SocketHandle<senf::test::SomeProtocol::Policy>(
+ : senf::SocketHandle<senf::test::SomeSocketProtocol::Policy>(
std::auto_ptr<senf::SocketBody>(
- new senf::ProtocolSocketBody<senf::test::SomeProtocol>(false, 0)))
+ new senf::ProtocolSocketBody<senf::test::SomeSocketProtocol>(false, 0)))
{}
};
OtherSocketHandle osh (myh);
osh = myh;
- typedef senf::SocketHandle<senf::test::SomeProtocol::Policy> SomeSocketHandle;
+ typedef senf::SocketHandle<senf::test::SomeSocketProtocol::Policy> SomeSocketHandle;
SomeSocketHandle ssh = senf::static_socket_cast<SomeSocketHandle>(osh);
BOOST_CHECK_NO_THROW( senf::dynamic_socket_cast<SomeSocketHandle>(osh) );
"file.handle: 0\n"
"file.refcount: 3\n"
"handle: senf::SocketHandle<senf::SocketPolicy<senf::test::SomeAddressingPolicy, senf::test::SomeFramingPolicy, senf::test::SomeCommunicationPolicy, senf::test::SomeReadPolicy, senf::test::SomeWritePolicy> >\n"
- "socket.protocol: senf::test::SomeProtocol\n"
+ "socket.protocol: senf::test::SomeSocketProtocol\n"
"socket.protocol.policy: senf::SocketPolicy<senf::test::SomeAddressingPolicy, senf::test::SomeFramingPolicy, senf::test::SomeCommunicationPolicy, senf::test::SomeReadPolicy, senf::test::SomeWritePolicy>\n"
"socket.server: false\n" );
}
// Ensure, the destructor is called and calls the correct close() implementation
- BOOST_CHECK_EQUAL( senf::test::SomeProtocol::closeCount(), 1u );
+ BOOST_CHECK_EQUAL( senf::test::SomeSocketProtocol::closeCount(), 1u );
}
///////////////////////////////cc.e////////////////////////////////////////
<area shape="rect" alt="SocketProtocol" href="classsenf_1_1SocketProtocol.html" title="SocketProtocol" coords="1,2,120,26" />
<area shape="rect" alt="BSDSocketProtocol" href="classsenf_1_1BSDSocketProtocol.html" title="BSDSocketProtocol" coords="124,118,276,143" />
<area shape="rect" alt="AddressableBSDSocketProtocol" href="classsenf_1_1AddressableBSDSocketProtocol.html" title="AddressableBSDSocketProtocol" coords="82,200,314,224" />
- <area shape="rect" alt="IPv4Protocol" href="classsenf_1_1IPv4Protocol.html" title="IPv4Protocol" coords="149,272,252,296" />
- <area shape="rect" alt="IPv6Protocol" href="classsenf_1_1IPv6Protocol.html" title="IPv6Protocol" coords="149,335,251,359" />
- <area shape="rect" alt="TCPProtocol" href="classsenf_1_1TCPProtocol.html" title="TCPProtocol" coords="151,398,248,420" />
+ <area shape="rect" alt="IPv4SocketProtocol" href="classsenf_1_1IPv4SocketProtocol.html" title="IPv4SocketProtocol" coords="149,272,252,296" />
+ <area shape="rect" alt="IPv6SocketProtocol" href="classsenf_1_1IPv6SocketProtocol.html" title="IPv6SocketProtocol" coords="149,335,251,359" />
+ <area shape="rect" alt="TCPSocketProtocol" href="classsenf_1_1TCPSocketProtocol.html" title="TCPSocketProtocol" coords="151,398,248,420" />
<area shape="rect" alt="TCPv4SocketProtocol" href="classsenf_1_1TCPv4SocketProtocol.html" title="TCPv4SocketProtocol" coords="288,471,405,494" />
<area shape="rect" alt="TCPv6SocketProtocol" href="classsenf_1_1TCPv6SocketProtocol.html" title="TCPv6SocketProtocol" coords="424,470,540,494" />
- <area shape="rect" alt="PacketProtocol" href="classsenf_1_1PacketProtocol.html" title="PacketProtocol" coords="560,469,680,495" />
+ <area shape="rect" alt="PacketSocketProtocol" href="classsenf_1_1PacketSocketProtocol.html" title="PacketSocketProtocol" coords="560,469,680,495" />
</map>
<img src="Protocols.png" border="0" alt="Protocols" usemap="#protocols">
\endhtmlonly
A protocol implementation may define the protocol interface directly. It can also
(additionally) make use of multiple inheritance to combine a set of protocol facets into a
specific protocol implementation (i.e. TCPv4SocketProtocol inherits from
- ConcreteSocketProtocol and from the protocol facets IPv4Protocol, TCPProtocol,
+ ConcreteSocketProtocol and from the protocol facets IPv4SocketProtocol, TCPSocketProtocol,
BSDSocketProtocol and AddressableBSDSocketProtocol). The protocol facets are not concrete
protocols themselves, they are combined to build concrete protocols. This structure will
remove a lot of code duplication. It is important to ensure, that the protocol facets do not
BOOST_AUTO_UNIT_TEST(socketProtocol)
{
- senf::test::SomeProtocol protocol;
+ senf::test::SomeSocketProtocol protocol;
// This would fail an assertion ...
// BOOST_CHECK( protocol.body() == 0 );
namespace senf {
namespace test {
- class SomeProtocol
- : public ConcreteSocketProtocol<SomeSocketPolicy,SomeProtocol>
+ class SomeSocketProtocol
+ : public ConcreteSocketProtocol<SomeSocketPolicy,SomeSocketProtocol>
{
public:
- ~SomeProtocol() {}
+ ~SomeSocketProtocol() {}
void init_client() const { fd(0); }
void init_server() const { fd(0); }
return message_.c_str();
}
+///////////////////////////////////////////////////////////////////////////
+// senf::SystemException
+
+prefix_ void senf::SystemException::init(std::string const & where, int code)
+{
+ code_ = code;
+ if (! where.empty())
+ (*this) << where << ": ";
+ (*this) << "(" << code << ") " << description();
+}
+
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
throw()
{}
-prefix_ void senf::SystemException::init(std::string const & where, int code)
-{
- code_ = code;
- if (! where.empty())
- (*this) << where << ": ";
- (*this) << "(" << code << ") " << description();
-}
-
///////////////////////////////cci.e///////////////////////////////////////
#undef prefix_