summaryrefslogtreecommitdiff
path: root/src/ivysocket.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ivysocket.h')
-rw-r--r--src/ivysocket.h31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/ivysocket.h b/src/ivysocket.h
index b491f0f..c656312 100644
--- a/src/ivysocket.h
+++ b/src/ivysocket.h
@@ -6,7 +6,7 @@
*
* Sockets
*
- * Authors: Francois-Regis Colin <fcolin@cena.fr>
+ * Authors: Francois-Regis Colin <fcolin@cena.dgac.fr>
*
* $Id$
*
@@ -32,11 +32,13 @@ extern "C" {
#ifdef __MINGW32__
#include <ws2tcpip.h>
#endif
+#define HANDLE SOCKET
#define socklen_t int
#ifndef IN_MULTICAST
#define IN_MULTICAST(i) (((long)(i) & 0xf0000000) == 0xe0000000)
#endif
#else
+#define HANDLE int
#include <netinet/in.h>
#endif
#ifdef __INTERIX
@@ -44,40 +46,43 @@ extern "C" {
#endif
/* General Init */
+extern void SocketInit();
+
/* Forward def */
typedef struct _client *Client;
-typedef char* (*SocketInterpretation) (Client client, void *data, char *ligne, unsigned int len);
-typedef void* (*SocketCreate) (Client client);
-typedef void (*SocketDelete) (Client client, void *data);
+typedef void (*SocketInterpretation) (Client client, void *data, char *ligne);
/* Server Part */
typedef struct _server *Server;
extern Server SocketServer(unsigned short port,
- SocketCreate create,
- SocketDelete handle_delete,
+ void*(*create)(Client client),
+ void(*handle_delete)(Client client, void *data),
SocketInterpretation interpretation);
extern unsigned short SocketServerGetPort( Server server );
extern void SocketServerClose( Server server );
/* Client Part */
-extern void SocketKeepAlive( Client client,int keepalive );
+
extern void SocketClose( Client client );
-extern void SocketSend( Client client, const char *buffer, int len );
-extern void SocketFlush (Client client);
+extern int SocketSend( Client client, char *fmt, ... );
+extern int 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 Client SocketConnect( char * host, unsigned short port,
void *data,
SocketInterpretation interpretation,
- SocketDelete handle_delete
- );
+ void (*handle_delete)(Client client, void *data)
+ );
extern Client SocketConnectAddr( struct in_addr * addr, unsigned short port,
void *data,
SocketInterpretation interpretation,
- SocketDelete handle_delete
+ 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 */
@@ -93,7 +98,7 @@ extern int SocketAddMember( Client client, unsigned long host );
extern struct in_addr * SocketGetRemoteAddr( Client client );
extern void SocketGetRemoteHost (Client client, char **host, unsigned short *port );
/* emmission d'un broadcast UDP */
-extern void SocketSendBroadcast( Client client, unsigned long host, unsigned short port, char *buffer, int len );
+extern void SocketSendBroadcast( Client client, unsigned long host, unsigned short port, char *fmt, ... );
#ifdef __cplusplus
}