source: abuse/trunk/src/sdlport/jnet.h @ 494

Last change on this file since 494 was 494, checked in by Sam Hocevar, 12 years ago

style: remove trailing spaces, fix copyright statements.

  • Property svn:keywords set to Id
File size: 1.7 KB
Line 
1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
5 *
6 *  This software was released into the Public Domain. As with most public
7 *  domain software, no warranty is made or implied by Crack dot Com or
8 *  Jonathan Clark.
9 */
10
11/* FIXME: this file is unused */
12
13#ifndef __NET_HPP_
14#define __NET_HPP_
15
16#include "macs.h"
17#include "packet.h"
18
19enum { SOCK_BAD_HOST       = -1,
20       SOCK_CONNECT_FAIL   = -2,
21       SOCK_BIND_FAIL      = -3,
22       SOCK_LISTEN_FAIL    = -4,
23       SOCK_NAMELOOKUP_FAIL= -5,
24       SOCK_ACCEPT_FAIL    = -6,
25       SOCK_WRITE_FAIL     = -7,
26       SOCK_CREATE_FAIL    = -8,
27       SOCK_SELECT_FAIL    = -9
28     };
29
30enum { NONET_PROTOCOL, IPX_PROTOCOL, TCPIP_PROTOCOL } ;
31
32extern char last_sock_err[200];
33extern int current_sock_err;
34
35class out_socket
36{
37  public :
38  virtual int ready_to_read()  = 0;
39  virtual int ready_to_write() = 0;
40  virtual int send(packet &pk) = 0;
41  virtual int get(packet &pk)  = 0;
42  virtual ~out_socket();
43} ;
44
45
46class in_socket
47{
48  public :
49  virtual out_socket *check_for_connect()    = 0;
50  virtual ~in_socket() { ; }
51} ;
52
53
54in_socket *create_in_socket(int port);
55out_socket *create_out_socket(char *name, int port);
56uchar *name_to_address(char *name, int protocol);       // should be defined externally
57                                                        // returns 4 bytes for TCPIP
58                                                        // 4 (net number) 6 node number for IPX
59
60uchar *get_local_address();                             // same format as above (be sure to free this)
61
62
63int net_init(int protocol);
64void net_uninit();
65
66#endif
67
Note: See TracBrowser for help on using the repository browser.