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 BSDAddressingPolicyMixin inline template implementation
18 //#include "BSDAddressingPolicy.ih"
22 #define prefix_ inline
23 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 //-/////////////////////////////////////////////////////////////////////////////////////////////////
26 // senf::BSDAddressingPolicyMixin<Address>
29 template <class Address>
30 template <class SPolicy>
31 prefix_ void senf::BSDAddressingPolicyMixin<Address>::
32 peer(SocketHandle<SPolicy> const & handle, Address & addr,
33 typename IfCommunicationPolicyIs<SPolicy,ConnectedCommunicationPolicy>::type *)
36 do_peer(handle,addr.sockaddr_p(),addr.socklen_p());
37 } catch (Exception & e) {
38 e << "; could not get peer for address \"" << addr << "\"";
43 template <class Address>
44 template <class SPolicy>
45 prefix_ void senf::BSDAddressingPolicyMixin<Address>::
46 peer(SocketHandle<SPolicy> const & handle, Address & addr)
51 template <class Address>
52 template <class SPolicy>
53 prefix_ void senf::BSDAddressingPolicyMixin<Address>::
54 connect(SocketHandle<SPolicy> const & handle, Address const & addr,
55 typename IfCommunicationPolicyIs<SPolicy,ConnectedCommunicationPolicy>::type *)
58 do_connect(handle,addr.sockaddr_p(),addr.socklen());
59 } catch (Exception & e) {
60 e << "; could not connect to address \"" << addr << "\"";
65 template <class Address>
66 template <class SPolicy>
67 prefix_ void senf::BSDAddressingPolicyMixin<Address>::
68 connect(SocketHandle<SPolicy> const & handle, Address const & addr)
72 template <class Address>
73 prefix_ void senf::BSDAddressingPolicyMixin<Address>::local(FileHandle const & handle,
77 do_local(handle,addr.sockaddr_p(),addr.socklen_p());
78 } catch (Exception & e) {
79 // TODO: identify socket by some meaningful attribute
80 e << "; could not get name for address \"" << addr << "\"";
85 template <class Address>
86 prefix_ void senf::BSDAddressingPolicyMixin<Address>::bind(FileHandle const & handle,
90 do_bind(handle,addr.sockaddr_p(),addr.socklen());
91 } catch (Exception & e) {
92 e << "; could not bind to address \"" << addr << "\"";
97 //-/////////////////////////////////////////////////////////////////////////////////////////////////
104 // c-file-style: "senf"
105 // indent-tabs-mode: nil
106 // ispell-local-dictionary: "american"
107 // compile-command: "scons -u ../test"
108 // comment-column: 40