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

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

Fuck the history, I'm renaming all .hpp files to .h for my own sanity.

  • Property svn:keywords set to Id
File size: 1.6 KB
Line 
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
10/* FIXME: this file is unused */
11
12#ifndef __NET_HPP_
13#define __NET_HPP_
14
15#include "macs.h"
16#include "packet.h"
17
18enum { SOCK_BAD_HOST       = -1,
19       SOCK_CONNECT_FAIL   = -2,
20       SOCK_BIND_FAIL      = -3,
21       SOCK_LISTEN_FAIL    = -4,
22       SOCK_NAMELOOKUP_FAIL= -5,
23       SOCK_ACCEPT_FAIL    = -6,
24       SOCK_WRITE_FAIL     = -7,
25       SOCK_CREATE_FAIL    = -8,
26       SOCK_SELECT_FAIL    = -9
27     };
28
29enum { NONET_PROTOCOL, IPX_PROTOCOL, TCPIP_PROTOCOL } ;
30
31extern char last_sock_err[200];
32extern int current_sock_err;
33
34class out_socket
35{
36  public :
37  virtual int ready_to_read()  = 0;
38  virtual int ready_to_write() = 0;
39  virtual int send(packet &pk) = 0;
40  virtual int get(packet &pk)  = 0;
41  virtual ~out_socket();
42} ;
43
44
45class in_socket
46{
47  public :
48  virtual out_socket *check_for_connect()    = 0;
49  virtual ~in_socket() { ; }
50} ;
51
52
53in_socket *create_in_socket(int port);
54out_socket *create_out_socket(char *name, int port);
55uchar *name_to_address(char *name, int protocol);       // should be defined externally
56                                                        // returns 4 bytes for TCPIP
57                                                        // 4 (net number) 6 node number for IPX
58
59uchar *get_local_address();                             // same format as above (be sure to free this)
60
61
62int net_init(int protocol);
63void net_uninit();
64
65#endif
66
Note: See TracBrowser for help on using the repository browser.