]> icculus.org git repositories - btb/d2x.git/blob - main/ipclient.h
use simpler rcs tags
[btb/d2x.git] / main / ipclient.h
1 /*
2  * $Source: /cvs/cvsroot/d2x/main/ipclient.h,v $
3  * $Revision: 1.1 $
4  * $Author: bradleyb $
5  * $Date: 2002-02-06 09:22:42 $
6  *
7  * ipclient.h - udp/ip client code
8  * added 2000/02/07 Matt Mueller
9  *
10  * $Log: not supported by cvs2svn $
11  *
12  */
13
14 #ifndef __IPCLIENT_H_
15 #define __IPCLIENT_H_
16
17 #include <stdio.h>
18 #include <stdarg.h>
19 #ifdef __cplusplus
20 extern "C"{
21 #endif
22 #include "pstypes.h"
23 #include "ipx.h"
24 #include "ipx_drv.h"
25 void ip_sendtoall(char *buf,int len);
26 int ip_connect_manual(char *textaddr);//make it extern C so that it can be called from .c files.
27 //void ip_portshift(ubyte*qhbuf,const char *cs);
28
29 int arch_ip_get_my_addr(ushort myport);
30 int arch_ip_open_socket(int port);
31 void arch_ip_close_socket(void);
32 int arch_ip_recvfrom(char *outbuf,int outbufsize,struct ipx_recv_data *rd);
33 int arch_ip_PacketReady(void);
34 int arch_ip_queryhost(ip_addr *addr,char *buf,ushort baseport);
35
36 int ipx_ip_GetMyAddress(void);
37
38 extern int myport;
39
40 extern int baseport;
41
42
43 #ifdef __cplusplus
44 }
45 #endif
46
47
48 #define MSGHDR "IPX_ip: "
49
50 static inline void msg(const char *fmt,...)
51 {
52         va_list ap;
53         fputs(MSGHDR,stdout);
54         va_start(ap,fmt);
55         vprintf(fmt,ap);
56         va_end(ap);
57         putchar('\n');
58 }
59
60 #define FAIL(m...) do { msg(#m); return -1; } while (0)
61
62 static inline void chk(void *p){
63         if (p) return;
64         msg("FATAL: Virtual memory exhausted!");
65         exit(EXIT_FAILURE);
66 }
67
68
69 #endif