BSDAddressingPolicy.hh
Go to the documentation of this file.
1 //
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
6 //
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
11 //
12 
13 
21 #ifndef HH_SENF_Socket_Protocols_BSDAddressingPolicy_
22 #define HH_SENF_Socket_Protocols_BSDAddressingPolicy_ 1
23 
24 // Custom includes
28 #include "BSDSocketAddress.hh"
29 
30 //#include "BSDAddressingPolicy.mpp"
31 //-/////////////////////////////////////////////////////////////////////////////////////////////////
32 
33 namespace senf {
34 
36  //\{
37 
43  {
44  static void do_local(FileHandle const & handle, struct sockaddr * addr, socklen_t * len);
45  static void do_peer(FileHandle const & handle, struct sockaddr * addr, socklen_t * len);
46  static void do_bind(FileHandle const & handle, struct sockaddr const * addr, socklen_t len);
47  static void do_connect(FileHandle const & handle, struct sockaddr const * addr, socklen_t len);
48  };
49 
74  template <class Address>
77  {
78 # ifndef DOXYGEN
79  template <class SPolicy>
80  static void peer(SocketHandle<SPolicy> const & handle, Address & addr,
81  typename IfCommunicationPolicyIs<SPolicy,ConnectedCommunicationPolicy>::type * = 0);
82 # else
83  template <class SPolicy>
84  static void peer(SocketHandle<SPolicy> const & handle, Address & addr);
86 
91 # endif
92  static void local(FileHandle const & handle, Address & addr);
94 
97 # ifndef DOXYGEN
98  template <class SPolicy>
99  static void connect(SocketHandle<SPolicy> const & handle, Address const & addr,
100  typename IfCommunicationPolicyIs<SPolicy,ConnectedCommunicationPolicy>::type * = 0);
101 # else
102  template <class SPolicy>
103  static void connect(SocketHandle<SPolicy> const & handle, Address const & addr);
105 
111 # endif
112  static void bind(FileHandle const & handle, Address const & addr);
114 
116  };
117 
118  //\}
119 
121  : public AddressingPolicyBase,
122  private BSDAddressingPolicyMixin<GenericBSDSocketAddress>
123  {
125 
130  };
131 
132 }
133 
134 //-/////////////////////////////////////////////////////////////////////////////////////////////////
135 //#include "BSDAddressingPolicy.cci"
136 //#include "BSDAddressingPolicy.ct"
137 #include "BSDAddressingPolicy.cti"
138 //#include "BSDAddressingPolicy.mpp"
139 #endif
140 
141 
142 // Local Variables:
143 // mode: c++
144 // fill-column: 100
145 // c-file-style: "senf"
146 // indent-tabs-mode: nil
147 // ispell-local-dictionary: "american"
148 // compile-command: "scons -u ../test"
149 // comment-column: 40
150 // End:
CommunicationPolicy public header.
static void do_local(FileHandle const &handle, struct sockaddr *addr, socklen_t *len)
BSDSocketAddress public header.
static void do_peer(FileHandle const &handle, struct sockaddr *addr, socklen_t *len)
static void do_connect(FileHandle const &handle, struct sockaddr const *addr, socklen_t len)
Policy defining socket addressing.
Basic file handle wrapper.
Definition: FileHandle.hh:102
GenericBSDSocketAddress Address
void connect(connector::FastActiveOutput< PacketType > &source, connector::FastPassiveInput< PacketType > &target)
basic SocketHandle supporting protocol and policy abstraction
Definition: SocketHandle.hh:60
FileHandle public header.
static void do_bind(FileHandle const &handle, struct sockaddr const *addr, socklen_t len)
Non-template implementation class of BSDAddressingPolicyMixin template.
SocketHandle public header.
Template for generic AddressingPolicy implementation based on the BSD socket API. ...
Generic BSD sockaddr storage.