libsocket
unixserverstream.hpp
Go to the documentation of this file.
1 #ifndef LIBSOCKET_UNIXSERVERSTREAM_H_DBD900942A364273A5E9C89F0096D9AF
2 #define LIBSOCKET_UNIXSERVERSTREAM_H_DBD900942A364273A5E9C89F0096D9AF
3 
4 #include <memory>
5 #include <string>
6 
7 #include "unixbase.hpp"
8 #include "unixclientstream.hpp"
9 
15 /*
16  The committers of the libsocket project, all rights reserved
17  (c) 2012, dermesser <lbo@spheniscida.de>
18 
19  Redistribution and use in source and binary forms, with or without
20  modification, are permitted provided that the following conditions are met:
21 
22  1. Redistributions of source code must retain the above copyright notice,
23  this list of conditions and the following disclaimer.
24  2. Redistributions in binary form must reproduce the above copyright notice,
25  this list of conditions and the following disclaimer in the documentation
26  and/or other materials provided with the distribution.
27 
28  THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS “AS IS” AND ANY
29  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
30  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31  DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
32  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
33  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
34  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
35  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 
39 */
40 
41 namespace libsocket {
42 using std::string;
43 using std::unique_ptr;
44 
52  public:
53  unix_stream_server(void);
54  unix_stream_server(const char* path, int flags = 0);
55  unix_stream_server(const string& path, int flags = 0);
56 
57  void setup(const char* path, int flags = 0);
58  void setup(const string& path, int flags = 0);
59 
60  unix_stream_client* accept(int flags = 0);
61  unique_ptr<unix_stream_client> accept2(int flags = 0);
62 };
66 } // namespace libsocket
67 #endif
Contains libsocket elements.
Definition: dgramclient.hpp:41
Base class for all UNIX socket classes.
Definition: unixbase.hpp:53
Provides an interface for working with UNIX STREAM sockets.
unix_stream_client * accept(int flags=0)
Accepts incoming connections on a UNIX domain stream server socket.
unique_ptr< unix_stream_client > accept2(int flags=0)
Accepts an incoming connection on a UNIX domain stream server socket and returns an owned pointer.
Socket class for UNIX-domain STREAM socket server.
unix_stream_server(void)
Void constructor.
void setup(const char *path, int flags=0)
Sets a server socket up.