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.
23 #define SOCKET_POLL_READ 1
24 #define SOCKET_POLL_WRITE 2
25 #define SOCKET_POLL_ERROR 4
26 #define SOCKET_NONBLOCK 1
30 static Socket
*CreateSocket(int socktype
, int options
);
32 virtual void setPort(int port
) = 0;
33 virtual int getPort() = 0;
34 virtual void setAddress(char *addr
) = 0;
35 virtual char *getAddress() = 0;
37 virtual int Connect() = 0;
38 virtual int Close() = 0;
39 virtual int Bind() = 0;
40 virtual int Listen(int queue
) = 0;
41 virtual Socket
*Accept() = 0;
43 virtual int Write(const char *buffer
, int len
) = 0;
44 virtual int Read(char *buffer
, int len
) = 0;
45 virtual int Poll(int ms
, int mode
) = 0;