Last change
on this file since 608 was
49,
checked in by Sam Hocevar, 15 years ago
|
- Imported original public domain release, for future reference.
|
File size:
1.3 KB
|
Line | |
---|
1 | #ifndef __NET_HPP_ |
---|
2 | #define __NET_HPP_ |
---|
3 | |
---|
4 | #include "macs.hpp" |
---|
5 | #include "packet.hpp" |
---|
6 | |
---|
7 | enum { SOCK_BAD_HOST = -1, |
---|
8 | SOCK_CONNECT_FAIL = -2, |
---|
9 | SOCK_BIND_FAIL = -3, |
---|
10 | SOCK_LISTEN_FAIL = -4, |
---|
11 | SOCK_NAMELOOKUP_FAIL= -5, |
---|
12 | SOCK_ACCEPT_FAIL = -6, |
---|
13 | SOCK_WRITE_FAIL = -7, |
---|
14 | SOCK_CREATE_FAIL = -8, |
---|
15 | SOCK_SELECT_FAIL = -9 |
---|
16 | }; |
---|
17 | |
---|
18 | enum { NONET_PROTOCOL, IPX_PROTOCOL, TCPIP_PROTOCOL } ; |
---|
19 | |
---|
20 | extern char last_sock_err[200]; |
---|
21 | extern int current_sock_err; |
---|
22 | |
---|
23 | class out_socket |
---|
24 | { |
---|
25 | public : |
---|
26 | virtual int ready_to_read() = 0; |
---|
27 | virtual int ready_to_write() = 0; |
---|
28 | virtual int send(packet &pk) = 0; |
---|
29 | virtual int get(packet &pk) = 0; |
---|
30 | virtual ~out_socket(); |
---|
31 | } ; |
---|
32 | |
---|
33 | |
---|
34 | class in_socket |
---|
35 | { |
---|
36 | public : |
---|
37 | virtual out_socket *check_for_connect() = 0; |
---|
38 | virtual ~in_socket() { ; } |
---|
39 | } ; |
---|
40 | |
---|
41 | |
---|
42 | in_socket *create_in_socket(int port); |
---|
43 | out_socket *create_out_socket(char *name, int port); |
---|
44 | uchar *name_to_address(char *name, int protocol); // should be defined externally |
---|
45 | // returns 4 bytes for TCPIP |
---|
46 | // 4 (net number) 6 node number for IPX |
---|
47 | |
---|
48 | uchar *get_local_address(); // same format as above (be sure to jfree this) |
---|
49 | |
---|
50 | |
---|
51 | int net_init(int protocol); |
---|
52 | void net_uninit(); |
---|
53 | |
---|
54 | #endif |
---|
55 | |
---|
Note: See
TracBrowser
for help on using the repository browser.