Added socket Poll flags
[fmail.git] / include / libfmail / socket.h
blob830cd4b32126f1e7fe895f59c98398e40dd54cd6
1 /*
2 libfmail: Socket abstraction
4 Copyright (C) 2007 Carlos Daniel Ruvalcaba Valenzuela <clsdaniel@gmail.com>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program 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
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #define SOCKET_INET 1
22 #define SOCKET_UNIX 2
23 #define SOCKET_POLL_READ 1
24 #define SOCKET_POLL_WRITE 2
25 #define SOCKET_POLL_ERROR 4
27 class Socket{
28 public:
29 static Socket *CreateSocket(int socktype, int options);
31 virtual void setPort(int port) = 0;
32 virtual int getPort() = 0;
33 virtual void setAddress(char *addr) = 0;
34 virtual char *getAddress() = 0;
36 virtual int Connect() = 0;
37 virtual int Close() = 0;
38 virtual int Bind() = 0;
39 virtual int Listen(int queue) = 0;
40 virtual Socket *Accept() = 0;
42 virtual int Write(const char *buffer, int len) = 0;
43 virtual int Read(char *buffer, int len) = 0;
44 virtual int Poll(int ms, int mode) = 0;