2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
15 \brief SocketProtocol and ConcreteSocketProtocol inline template implementation
18 //#include "SocketProtocol.ih"
21 #include "SocketHandle.hh"
23 #define prefix_ inline
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
26 //-/////////////////////////////////////////////////////////////////////////////////////////////////
27 // senf::ConcreteSocketProtocol<SocketPolicy,Self>
29 template <class SocketPolicy, class Self>
30 prefix_ senf::ConcreteSocketProtocol<SocketPolicy,Self>::~ConcreteSocketProtocol()
33 template <class SocketPolicy, class Self>
34 prefix_ typename senf::ConcreteSocketProtocol<SocketPolicy,Self>::Policy const &
35 senf::ConcreteSocketProtocol<SocketPolicy,Self>::policy()
41 template <class SocketPolicy, class Self>
42 prefix_ std::unique_ptr<senf::SocketBody>
43 senf::ConcreteSocketProtocol<SocketPolicy,Self>::clone(bool isServer)
46 return std::unique_ptr<SocketBody>(new ProtocolSocketBody<Self>(isServer));
49 template <class SocketPolicy, class Self>
50 prefix_ std::unique_ptr<senf::SocketBody>
51 senf::ConcreteSocketProtocol<SocketPolicy,Self>::clone(int fd, bool isServer)
54 return std::unique_ptr<SocketBody>(new ProtocolSocketBody<Self>(isServer, fd));
57 template <class SocketPolicy, class Self>
58 prefix_ senf::SocketBody & senf::ConcreteSocketProtocol<SocketPolicy,Self>::body()
61 return const_cast< ProtocolSocketBody<Self> &>(
62 static_cast< ProtocolSocketBody<Self> const & >(*this));
65 //-/////////////////////////////////////////////////////////////////////////////////////////////////
68 template <class SocketPolicy, class Self>
69 prefix_ senf::ClientSocketHandle<SocketPolicy>
70 senf::ConcreteSocketProtocol<SocketPolicy,Self>::clientHandle()
73 return static_socket_cast< ClientSocketHandle<Policy> >(fh());
76 template <class SocketPolicy, class Self>
77 prefix_ senf::ServerSocketHandle<SocketPolicy>
78 senf::ConcreteSocketProtocol<SocketPolicy,Self>::serverHandle()
81 return static_socket_cast< ServerSocketHandle<Policy> >(fh());
84 //-/////////////////////////////////////////////////////////////////////////////////////////////////
91 // c-file-style: "senf"
92 // indent-tabs-mode: nil
93 // ispell-local-dictionary: "american"
94 // compile-command: "scons -u test"