BSDSocketProtocol.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 
17 #ifndef HH_SENF_Socket_Protocols_BSDSocketProtocol_
18 #define HH_SENF_Socket_Protocols_BSDSocketProtocol_ 1
19 
20 // Custom includes
22 #include <boost/cstdint.hpp>
23 
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 
26 struct sock_filter;
27 
28 namespace senf {
29 
31  //\{
32 
38  : public virtual SocketProtocol
39  {
40  public:
41  std::pair<bool,unsigned> linger() const;
42 
47  void linger(bool enable, unsigned timeout=0) const;
48 
54  boost::uint8_t priority() const;
55 
60  void priority(boost::uint8_t value) const;
61 
66  int error() const;
67 
71  unsigned rcvbuf() const;
72 
77  void rcvbuf(unsigned size) const;
78 
80  unsigned sndbuf() const;
81 
86  void sndbuf(unsigned size) const;
87 
89  template <unsigned short N>
90  void attachSocketFilter(::sock_filter (&filter)[N]);
91  void detachSocketFilter();
92 
93  void mtuDiscovery(int mode) const;
94 
95  void rcvLowat(unsigned lowWat) const;
96  void sndLowat(unsigned lowWat) const;
97 
98  private:
99  void do_attachSocketFilter(::sock_filter * filter, unsigned short len);
100  };
101 
108  : public virtual SocketProtocol
109  {
110  public:
111  bool reuseaddr() const;
112 
114  void reuseaddr(bool value) const;
115 
118  };
119 
120  //\}
121 }
122 
123 //-/////////////////////////////////////////////////////////////////////////////////////////////////
124 //#include "BSDSocketProtocol.cci"
125 #include "BSDSocketProtocol.ct"
126 //#include "BSDSocketProtocol.cti"
127 #endif
128 
129 
130 // Local Variables:
131 // mode: c++
132 // fill-column: 100
133 // c-file-style: "senf"
134 // indent-tabs-mode: nil
135 // ispell-local-dictionary: "american"
136 // compile-command: "scons -u test"
137 // comment-column: 40
138 // End:
void mtuDiscovery(int mode) const
unsigned rcvbuf() const
Check receive buffer size.
Socket Protocol base class.
void sndLowat(unsigned lowWat) const
unsigned sndbuf() const
Check send buffer size.
boost::uint8_t priority() const
Get packet priority assigned to outgoing packets.
void attachSocketFilter(::sock_filter(&filter)[N])
Protocol facet providing basic BSD socket functionality.
std::pair< bool, unsigned > linger() const
Return current linger status.
int error() const
Get and clear pending socket error.
Protocol facet providing basic connection oriented BSD socket functions.
void rcvLowat(unsigned lowWat) const
SocketProtocol and ConcreteSocketProtocol public header.