X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FSocketPolicy.hh;h=859686e92be9c8310115fda39908aa67f01de3d9;hb=1ad3873b372da6187b1fbc645bf276287d2efb54;hp=e3907fe9c5640da558b41cc0b5e4de780bd7fffd;hpb=145f6a7d0f3a6aaa77b3625351c952d24cb0b8a1;p=senf.git diff --git a/Socket/SocketPolicy.hh b/Socket/SocketPolicy.hh index e3907fe..859686e 100644 --- a/Socket/SocketPolicy.hh +++ b/Socket/SocketPolicy.hh @@ -38,8 +38,19 @@ /** \defgroup policy_group The Policy Framework - \image html SocketPolicy.png - + \htmlonly + + SocketPolicy + BufferingPolicyBase + WritePolicyBase + ReadPolicyBase + CommunicationPolicyBase + FramingPolicyBase + AddressingPolicyBase + + Socket Policy + \endhtmlonly + \section policy_group_introduction Introduction to the Policy Framework The policy framework conceptually implements a list of parallel inheritance hierarchies each @@ -243,8 +254,6 @@ // Custom includes -#include "GenericSockAddr.hh" - //#include "SocketPolicy.mpp" ///////////////////////////////hh.p//////////////////////////////////////// @@ -298,7 +307,7 @@ namespace senf { { virtual ~AddressingPolicyBase() {} - typedef GenericSockAddr Address; + class Address { Address(); }; }; /** \brief Policy defining the framing format @@ -323,13 +332,12 @@ namespace senf { +
method void listen(FileHandle, unsigned backlog) Switch socket into listening state
method int accept(FileHandle, Address &) Accept a new connection
method int accept(FileHandle) Accept a new connection
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 @@ -352,7 +360,7 @@ namespace senf { 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 @@ -375,7 +383,7 @@ namespace senf { 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 @@ -497,10 +505,15 @@ namespace senf { { /** \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