Move include files in debian packge into 'senf' subdirectory
[senf.git] / Socket / Protocols / BSDSocketProtocol.hh
1 // $Id$
2 //
3 // Copyright (C) 2006
4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 //     Stefan Bund <stefan.bund@fokus.fraunhofer.de>
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
23 /** \file
24     \brief BSDSocketProtocol public header */
25
26 #ifndef HH_BSDSocketProtocol_
27 #define HH_BSDSocketProtocol_ 1
28
29 // Custom includes
30 #include <sys/time.h>
31 #include "../../Socket/SocketProtocol.hh"
32
33 //#include "BSDSocketProtocol.mpp"
34 ///////////////////////////////hh.p////////////////////////////////////////
35
36 namespace senf {
37
38     /// \addtogroup protocol_facets_group
39     /// @{
40
41     /** \brief Protocol facet providing basic BSD socket functionality
42
43         BSDSocketProtocol provides the basic BSD socket API as shared by all BSD sockets.
44      */
45     class BSDSocketProtocol
46         : public virtual SocketProtocol
47     {
48     public:
49         std::pair<bool,unsigned> linger() const; ///< Return current linger status
50                                         /**< The value is returned in an std:pair. the first element
51                                              is \c true, if linger is active. The second value is
52                                              the linger timeout in seconds.
53                                              \returns linger state (enable disabled) and linger
54                                              timeout */
55         void linger(bool enable, unsigned timeout=0) const; ///< Change linger status
56                                         /**< If linger is enabled, the timeout value specifies, how
57                                              long to wait before returning while data is unsent in
58                                              seconds. If this value is 0, a close() might wait
59                                              forever.
60                                              \param[in] enable \c true to activate linger
61                                              \param[in] timeout linger timeout in seconds */
62
63         struct timeval timestamp() const; ///< Return packet timestamp of last packet
64                                         /**< The returned timestamp represents the time, at which
65                                              the last network packet passed to the user has been
66                                              received from the network. This allows precise network
67                                              timing.
68                                              \returns timestamp when packet was received 
69                                              \todo Move this to DatagramSocketProtocol class */
70     };
71
72     /** \brief Protocol facet providing basic connection oriented BSD socket functions
73
74         AddressableBSDSocketProtocol provides the BSD socket API as it generically applies to
75         addressable (connection oriented) sockets.
76      */
77     class AddressableBSDSocketProtocol
78         : public virtual SocketProtocol
79     {
80     public:
81         bool reuseaddr() const;         ///< Return current reuseaddr state
82                                         /**< \returns \c true if \c SO_REUSEADDR is currently
83                                              enabled, \c false otherwise*/
84         void reuseaddr(bool value) const; ///< Set reuseraddr state
85                                         /**< A \c true value enables \c SO_REUSEADDR, \c false will
86                                              disable it.
87                                              \param[in] value new \c SO_REUSEADDR state */
88     };
89
90     /// @}
91
92 }
93
94
95 ///////////////////////////////hh.e////////////////////////////////////////
96 //#include "BSDSocketProtocol.cci"
97 //#include "BSDSocketProtocol.ct"
98 //#include "BSDSocketProtocol.cti"
99 //#include "BSDSocketProtocol.mpp"
100 #endif
101
102 \f
103 // Local Variables:
104 // mode: c++
105 // fill-column: 100
106 // c-file-style: "senf"
107 // indent-tabs-mode: nil
108 // ispell-local-dictionary: "american"
109 // compile-command: "scons -u test"
110 // comment-column: 40
111 // End: