net.h
Go to the documentation of this file.00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _COMMON_NET_H
00026 #define _COMMON_NET_H
00027
00028 struct net_stream;
00029 struct datagram_socket;
00030 struct sockaddr;
00031 typedef void stream_callback_func(struct net_stream *s);
00032 typedef void datagram_callback_func(struct datagram_socket *s, const char *buf, int len, struct sockaddr *from);
00033
00034 qboolean SV_Start(const char *node, const char *service, stream_callback_func *func);
00035 void SV_Stop(void);
00036
00037 struct datagram_socket *NET_DatagramSocketNew(const char *node, const char *service, datagram_callback_func *datagram_func);
00038 void NET_DatagramSend(struct datagram_socket *s, const char *buf, int len, struct sockaddr *to);
00039 void NET_DatagramBroadcast(struct datagram_socket *s, const char *buf, int len, int port);
00040 void NET_DatagramSocketClose(struct datagram_socket *s);
00041 void NET_SockaddrToStrings(struct datagram_socket *s, struct sockaddr *addr, char *node, size_t nodelen, char *service, size_t servicelen);
00042
00043 void NET_Init(void);
00044 void NET_Shutdown(void);
00045 void NET_Wait(int timeout);
00046 struct net_stream *NET_Connect(const char *node, const char *service);
00047 struct net_stream *NET_ConnectToLoopBack(void);
00048 void NET_StreamEnqueue(struct net_stream *s, const char *data, int len);
00049 qboolean NET_StreamIsClosed(struct net_stream *s);
00050 int NET_StreamGetLength(struct net_stream *s);
00051 int NET_StreamPeek(struct net_stream *s, char *data, int len);
00052 int NET_StreamDequeue(struct net_stream *s, char *data, int len);
00053 void *NET_StreamGetData(struct net_stream *s);
00054 void NET_StreamSetData(struct net_stream *s, void *data);
00055 const char *NET_StreamPeerToName(struct net_stream *s, char *dst, int len, qboolean appendPort);
00056 qboolean NET_StreamIsLoopback(struct net_stream *s);
00057 void NET_StreamFree(struct net_stream *s);
00058 void NET_StreamFinished(struct net_stream *s);
00059 void NET_StreamSetCallback(struct net_stream *s, stream_callback_func *func);
00060
00061 #endif