From d3b04f0209ea826c67a2ee84ced889ee907f49a0 Mon Sep 17 00:00:00 2001 From: jacomi Date: Wed, 12 Aug 1998 10:23:25 +0000 Subject: version relookee en ivy --- src/ivysocket.h | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 src/ivysocket.h (limited to 'src/ivysocket.h') diff --git a/src/ivysocket.h b/src/ivysocket.h new file mode 100644 index 0000000..2258caf --- /dev/null +++ b/src/ivysocket.h @@ -0,0 +1,72 @@ +#ifndef _IVYSOCKET_H +#define _IVYSOCKET_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* general Handle */ + +#define ANYPORT 0 + +#ifdef WIN32 +#include +#define HANDLE SOCKET +#else +#define HANDLE int +#include +#endif + + +/* Server Part */ +typedef struct _client *Client; +typedef void (*SocketInterpretation)( Client client, void *data, char *ligne); + +extern void SocketInit(); + +extern void SocketClose( Client client ); +extern void SocketSend( Client client, char *fmt, ... ); +extern void SocketSendRaw( Client client, char *buffer, int len ); +extern char *SocketGetPeerHost( Client client ); +extern void SocketSetData( Client client, void *data ); +extern void *SocketGetData( Client client ); +extern void SocketBroadcast( char *fmt, ... ); + +extern int SocketServer(unsigned short port, + void*(*create)(Client client), + void(*handle_delete)(Client client, void *data), + SocketInterpretation interpretation); + +/* Client Part */ + +extern Client SocketConnect( char * host, unsigned short port, + void *data, + SocketInterpretation interpretation, + void (*handle_delete)(Client client, void *data) + ); +extern Client SocketConnectAddr( struct in_addr * addr, unsigned short port, + void *data, + SocketInterpretation interpretation, + void (*handle_delete)(Client client, void *data) + ); +extern int SocketWaitForReply( Client client, char *buffer, int size, int delai); + +/* Socket UDP */ +/* Creation d'une socket en mode non connecte */ +/* et ecoute des messages */ +extern Client SocketBroadcastCreate( + unsigned short port, + void *data, + SocketInterpretation interpretation + ); +/* recuperation de l'emetteur du message */ +extern struct in_addr * SocketGetRemoteAddr( Client client ); +extern void SocketGetRemote( Client client, char **host, unsigned short *port ); +/* emmission d'un broadcast UDP */ +extern void SocketSendBroadcast( Client client, unsigned long host, unsigned short port, char *fmt, ... ); + +#ifdef __cplusplus +} +#endif + +#endif -- cgit v1.1