comparison sources/headers/network.hpp @ 2:19227b0b7cc1

.h => .hpp for the headers added year 2008 to copyright notes renamed some functions for better meaning prepared parser module for rewriting added showHelp() function some code clean up
author Vlad Glagolev <enqlave@gmail.com>
date Mon, 21 Jan 2008 01:14:10 +0300
parents
children a7051ac7118b
comparison
equal deleted inserted replaced
1:08d8cdf4fe7f 2:19227b0b7cc1
1 /**
2 * network.hpp (2007-04-02)
3 *
4 * -- CABAL -- network header
5 *
6 * Copyright (c) 2007-2008 Vlad Glagolev <enqlave@gmail.com>
7 * All rights reserved.
8 *
9 * Permission to use, copy, modify, and distribute this software for any
10 * purpose with or without fee is hereby granted, provided that the above
11 * copyright notice and this permission notice appear in all copies.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 */
21
22 #ifndef _NETWORK_HPP_
23 #define _NETWORK_HPP_
24
25 #include "core.hpp"
26
27 class Network {
28
29 public:
30 Network();
31 ~Network();
32
33 void sendMsg(string);
34 string receiveMsg();
35
36 int cs;
37
38 struct address_type {
39 int inet;
40 struct sockaddr_in sa;
41 #ifdef ENABLE_IPV6
42 struct sockaddr_in6 sa6;
43 #endif
44 } address;
45
46 bool socketClose();
47
48 bool hostResolve(pchar, address_type *, int inet = 0);
49 bool tcpActivate(int, pchar host = 0);
50 bool hostOpen();
51
52 int canRead(int);
53 int canWrite(int);
54
55 fd_set rs, ws;
56 timeval timeout;
57
58 bool connecting, connected;
59 };
60
61 #endif // _NETWORK_HPP_