Debian Codegraph @

src/common/fdwbackend.h

raw symbols SCIP
1 /*
2 * Abstraction API/layer for the various ways PvPGN can inspect sockets state
3 * 2003 (C)
4 *
5 * Code is based on the ideas found in thttpd project.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */
21
22 #ifndef __PVPGN_FDWBACKEND_INCLUDED__
23 #define __PVPGN_FDWBACKEND_INCLUDED__
24
25 #include <stdexcept>
26 #include <string>
27
28 namespace pvpgn
29 {
30
31 class FDWBackend
32 {
33 public:
34 class InitError :public std::runtime_error
35 {
36 public:
37 explicit InitError(const std::string& str)
38 :std::runtime_error(str) {}
39 ~InitError() throw() {}
40 };
41
42 explicit FDWBackend(int nfds_);
43 virtual ~FDWBackend() throw();
44
45 virtual int add(int idx, unsigned rw) = 0;
46 virtual int del(int idx) = 0;
47 virtual int watch(long timeout_msecs) = 0;
48 virtual void handle() = 0;
49
50 protected:
51 int nfds;
52 };
53
54 }
55
56 #endif /* __PVPGN_FDWBACKEND_INCLUDED__ */