Mercurial > cabal
annotate sources/headers/network.hpp @ 5:0faceb076254
code clean up
added PID to the default Core argument
bool => true|false
| author | Vlad Glagolev <enqlave@gmail.com> |
|---|---|
| date | Thu, 24 Jan 2008 21:00:52 +0300 |
| parents | a7051ac7118b |
| children | 9be05a31b7f9 |
| rev | line source |
|---|---|
| 2 | 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 | |
| 5 | 27 class Network |
| 28 { | |
| 2 | 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 | |
|
4
a7051ac7118b
added primary parser implementation
Vlad Glagolev <enqlave@gmail.com>
parents:
2
diff
changeset
|
46 bool closeSocket(); |
| 2 | 47 |
|
4
a7051ac7118b
added primary parser implementation
Vlad Glagolev <enqlave@gmail.com>
parents:
2
diff
changeset
|
48 bool openHost(); |
|
a7051ac7118b
added primary parser implementation
Vlad Glagolev <enqlave@gmail.com>
parents:
2
diff
changeset
|
49 bool resolveHost(pchar, address_type *, int inet = 0); |
|
a7051ac7118b
added primary parser implementation
Vlad Glagolev <enqlave@gmail.com>
parents:
2
diff
changeset
|
50 bool activateTCP(int, pchar host = 0); |
| 2 | 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_ |
