1 /*
2 * StreamSocketServer.hpp
3 *
4 * Copyright (C) 2012 Evidence Srl - www.evidence.eu.com
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21
22 #ifndef STREAMSOCKETSERVER_HPP_
23 #define STREAMSOCKETSERVER_HPP_
24
25 #include <fcntl.h>
26 #include <stdlib.h>
27 #include <sys/types.h>
28 #include <sys/stat.h>
29 #include <sys/un.h>
30 #include <sys/socket.h>
31 #include <netinet/in.h>
32 #include <netinet/ip.h>
33 #include <string>
34
35 namespace onposix {
36
37 ///Default maximum number of pending connections
38 #define STREAM_MAX_PENDING_CONNECTIONS 100
39
40 /**
41 * \brief Socket server for connection-oriented communications.
42 *
43 * This class corresponds to a socket created with socket(), that must be
44 * given to the constructor of StreamSocketServerDescriptor to accept incoming
45 * connections.
46 */
48
51
52 /**
53 * \brief Number of the file descriptor.
54 *
55 * This is the return value of socket().
56 */
58
59 public:
60
65
66
67 /**
68 * \brief Destructor.
69 *
70 * It just calls close() to close the descriptor.
71 */
74 }
75
76 /**
77 * \brief Close the descriptor
78 */
81 }
82
83 /**
84 * \brief Method to get descriptor number.
85 *
86 * @return Descriptor number.
87 */
90 }
91 };
92
93 } /* onposix */
94
95 #endif /* STREAMSOCKETSERVER_HPP_ */