]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/socket.h
Added start of socket classes used by modular linking
[user/henk/code/inspircd.git] / include / socket.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
6  *                       E-mail:
7  *                <brain@chatspike.net>
8  *                <Craig@chatspike.net>
9  *     
10  * Written by Craig Edwards, Craig McLure, and others.
11  * This program is free but copyrighted software; see
12  *            the file COPYING for details.
13  *
14  * ---------------------------------------------------
15  */
16
17 #include <sstream>
18 #include <string>
19
20 enum InspSocketState { I_DISCONNECTED, I_CONNECTING, I_CONNECTED, I_LISTENING };
21
22 class InspSocket
23 {
24 private:
25         int fd;
26         std::string host;
27         int port;
28         InspSocketState state;
29 public:
30         InspSocket();
31         InspSocket(std::string host, int port, bool listening);
32         void Poll();
33         virtual int OnConnected();
34         virtual int OnError();
35         virtual int OnDisconnect();
36         virtual int OnIncomingConnection();
37         ~InspSocket();
38 };