// $Id:SocketPolicy.hh 218 2007-03-20 14:39:32Z tho $
//
// Copyright (C) 2006
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
-// Stefan Bund <stefan.bund@fokus.fraunhofer.de>
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+// Stefan Bund <g0dil@berlios.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
/** \defgroup policy_group The Policy Framework
- \image html SocketPolicy.png
-
+ \htmlonly
+ <map name="socketPolicy">
+ <area shape="rect" alt="SocketPolicy" href="structsenf_1_1SocketPolicy.html" title="SocketPolicy" coords="276,90,558,213" />
+ <area shape="rect" alt="BufferingPolicyBase" href="structsenf_1_1BufferingPolicyBase.html" title="BufferingPolicyBase" coords="25,282,190,306" />
+ <area shape="rect" alt="WritePolicyBase" href="structsenf_1_1WritePolicyBase.html" title="WritePolicyBase" coords="39,243,174,268" />
+ <area shape="rect" alt="ReadPolicyBase" href="structsenf_1_1ReadPolicyBase.html" title="ReadPolicyBase" coords="42,204,174,231" />
+ <area shape="rect" alt="CommunicationPolicyBase" href="structsenf_1_1CommunicationPolicyBase.html" title="CommunicationPolicyBase" coords="0,166,215,193" />
+ <area shape="rect" alt="FramingPolicyBase" href="structsenf_1_1FramingPolicyBase.html" title="FramingPolicyBase" coords="30,129,185,155" />
+ <area shape="rect" alt="AddressingPolicyBase" href="structsenf_1_1AddressingPolicyBase.html" title="AddressingPolicyBase" coords="17,90,200,116" />
+ </map>
+ <img src="SocketPolicy.png" border="0" alt="Socket Policy" usemap="#socketPolicy">
+ \endhtmlonly
+
\section policy_group_introduction Introduction to the Policy Framework
The policy framework conceptually implements a list of parallel inheritance hierarchies each
// Custom includes
-#include "GenericSockAddr.hh"
-
//#include "SocketPolicy.mpp"
///////////////////////////////hh.p////////////////////////////////////////
{
virtual ~AddressingPolicyBase() {}
- typedef GenericSockAddr Address;
+ class Address { Address(); };
};
/** \brief Policy defining the framing format
<table class="senf">
<tr><td>method</td> <td><tt>void listen(FileHandle, unsigned backlog)</tt></td> <td>Switch socket into listening state</td></tr>
<tr><td>method</td> <td><tt>int accept(FileHandle, Address &)</tt></td> <td>Accept a new connection</td></tr>
+ <tr><td>method</td> <td><tt>int accept(FileHandle)</tt></td> <td>Accept a new connection</td></tr>
</table>
The \c listen member is straight forward. The \c accept() member must return a new file
descriptor (which will be used to create a new SocketHandle of the correct
- type). Additionally, accept() should only be defined, if the Addressing policy is not \c
- NoAddressingPolicy (which together with ConnectedCommunicationPolicy would identify a
- point-to-point link with fixed communication partners).
+ type).
\note This Policy only has two meaningful states: ConnectedCommunicationPolicy and
UnconnectedCommunicationPolicy. It is probably not sensible to define a new
</table>
The second member should only be enabled if the communication policy is
- UnconnectedCommunication (otherwise it does not make sense since the communication partner
+ UnconnectedCommunicationPolicy (otherwise it does not make sense since the communication partner
is fixed) (see AddressingPolicyBase on how to do this).
\note This Policy only has two meaningful states: ReadablePolicy and NotReadablePolicy. It
</table>
The second member should only be enabled if the communication policy is
- UnconnectedCommunication (otherwise it does not make sense since the communication partner
+ UnconnectedCommunicationPolicy (otherwise it does not make sense since the communication partner
is fixed) (see AddressingPolicyBase on how to do this).
\note This Policy only has two meaningful states: WritablePolicy and NotWritablePolicy. It
{
/** \brief Check dynamic policy compatibility
- This method will check the socket policy \a other against this policy. It will check,
- whether \a other is a base policy (or the same) of this policy. This check is done
- against the \e dynamic type of \a other using RTTI. It will throw \c std::bad_cast, if
- the policy is not compatible.
+ This check will validate, that a socket with \a other as it's policy is convertible to a
+ socket with the current SocketPolicy as it's policy. This is true, if for each policy
+ axis, the policy class of that axis as defined in the \a other policy is convertible to
+ the policy class of that same axis in the current SocketPolicy instance (as is defined
+ by the template arguments). This again is true, if the \a other policy class is derived
+ from (or is the same as) the policy class taken from the current SocketPolicy instance.
+
+ In other words, this call checks, that the current SocketPolicy (as defined via the
+ template arguments) is more generic than the \a other socket policy.
\param[in] other SocketPolicy to check
\throws std::bad_cast if \a other is not a compatible policy
// c-file-style: "senf"
// indent-tabs-mode: nil
// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// comment-column: 40
// End: