Last change
on this file since 57 was
57,
checked in by Sam Hocevar, 15 years ago
|
- Move each header to the same directory as its corresponding source, to
get a better idea of which files are likely to export symbols.
|
File size:
1.6 KB
|
Rev | Line | |
---|
[56] | 1 | /* |
---|
| 2 | * Abuse - dark 2D side-scrolling platform game |
---|
| 3 | * Copyright (c) 1995 Crack dot Com |
---|
| 4 | * |
---|
| 5 | * This software was released into the Public Domain. As with most public |
---|
| 6 | * domain software, no warranty is made or implied by Crack dot Com or |
---|
| 7 | * Jonathan Clark. |
---|
| 8 | */ |
---|
| 9 | |
---|
[2] | 10 | #ifndef __NET_HPP_ |
---|
| 11 | #define __NET_HPP_ |
---|
| 12 | |
---|
| 13 | #include "macs.hpp" |
---|
| 14 | #include "packet.hpp" |
---|
| 15 | |
---|
| 16 | enum { SOCK_BAD_HOST = -1, |
---|
| 17 | SOCK_CONNECT_FAIL = -2, |
---|
| 18 | SOCK_BIND_FAIL = -3, |
---|
| 19 | SOCK_LISTEN_FAIL = -4, |
---|
| 20 | SOCK_NAMELOOKUP_FAIL= -5, |
---|
| 21 | SOCK_ACCEPT_FAIL = -6, |
---|
| 22 | SOCK_WRITE_FAIL = -7, |
---|
| 23 | SOCK_CREATE_FAIL = -8, |
---|
| 24 | SOCK_SELECT_FAIL = -9 |
---|
| 25 | }; |
---|
| 26 | |
---|
| 27 | enum { NONET_PROTOCOL, IPX_PROTOCOL, TCPIP_PROTOCOL } ; |
---|
| 28 | |
---|
| 29 | extern char last_sock_err[200]; |
---|
| 30 | extern int current_sock_err; |
---|
| 31 | |
---|
| 32 | class out_socket |
---|
| 33 | { |
---|
| 34 | public : |
---|
| 35 | virtual int ready_to_read() = 0; |
---|
| 36 | virtual int ready_to_write() = 0; |
---|
| 37 | virtual int send(packet &pk) = 0; |
---|
| 38 | virtual int get(packet &pk) = 0; |
---|
| 39 | virtual ~out_socket(); |
---|
| 40 | } ; |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | class in_socket |
---|
| 44 | { |
---|
| 45 | public : |
---|
| 46 | virtual out_socket *check_for_connect() = 0; |
---|
| 47 | virtual ~in_socket() { ; } |
---|
| 48 | } ; |
---|
| 49 | |
---|
| 50 | |
---|
| 51 | in_socket *create_in_socket(int port); |
---|
| 52 | out_socket *create_out_socket(char *name, int port); |
---|
| 53 | uchar *name_to_address(char *name, int protocol); // should be defined externally |
---|
| 54 | // returns 4 bytes for TCPIP |
---|
| 55 | // 4 (net number) 6 node number for IPX |
---|
| 56 | |
---|
| 57 | uchar *get_local_address(); // same format as above (be sure to jfree this) |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | int net_init(int protocol); |
---|
| 61 | void net_uninit(); |
---|
| 62 | |
---|
| 63 | #endif |
---|
| 64 | |
---|
Note: See
TracBrowser
for help on using the repository browser.