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

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

core: Get rid of mostly useless headers, move endianness handling to
common.h (and rewrite functions so that they do not need the SDL headers)
and move a few functions out of sdlport's video.cpp. These functions
were in the original video.cpp (which reappears) and shouldn't be part
of the SDL port.

  • 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 *  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 "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.