summaryrefslogtreecommitdiff
path: root/src/ivysocket.h
diff options
context:
space:
mode:
authorbustico2008-03-21 09:03:34 +0000
committerbustico2008-03-21 09:03:34 +0000
commit6ca781b8a38474ab428d5fcb3b489dfe3e974334 (patch)
tree8c8725c88c3fd031d632a9f2b1f7376d1cb3c75b /src/ivysocket.h
parent50236114f04a0050625bedee7c4c02b36b1213ae (diff)
downloadivy-c-6ca781b8a38474ab428d5fcb3b489dfe3e974334.zip
ivy-c-6ca781b8a38474ab428d5fcb3b489dfe3e974334.tar.gz
ivy-c-6ca781b8a38474ab428d5fcb3b489dfe3e974334.tar.bz2
ivy-c-6ca781b8a38474ab428d5fcb3b489dfe3e974334.tar.xz
- numerous fixes
- socket in non blocking mode (resolve some deadlock, and agent are immune to another agent beeing blocked)
Diffstat (limited to 'src/ivysocket.h')
-rw-r--r--src/ivysocket.h25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/ivysocket.h b/src/ivysocket.h
index 604e65f..551ec52 100644
--- a/src/ivysocket.h
+++ b/src/ivysocket.h
@@ -45,10 +45,13 @@ extern "C" {
#define socklen_t int
#endif
+typedef enum {SendOk, SendStillCongestion, SendStateChangeToCongestion,
+ SendStateChangeToDecongestion, SendStateFifoFull, SendError,
+ SendParamError} SendState;
+
/* General Init */
extern void SocketInit();
-
/* Forward def */
typedef struct _client *Client;
typedef void (*SocketInterpretation) (Client client, void *data, char *ligne);
@@ -58,16 +61,17 @@ typedef struct _server *Server;
extern Server SocketServer(unsigned short port,
void*(*create)(Client client),
void(*handle_delete)(Client client, void *data),
- SocketInterpretation interpretation);
+ void(*handle_decongestion)(Client client, void *data),
+ SocketInterpretation interpretation);
extern unsigned short SocketServerGetPort( Server server );
extern void SocketServerClose( Server server );
/* Client Part */
extern void SocketClose( Client client );
-extern int SocketSend( Client client, char *fmt, ... );
-extern int SocketSendRaw( const Client client, const char *buffer, const int len );
-extern int SocketSendRawWithId( const Client client, const char *id, const char *buffer, const int len );
+extern SendState SocketSend( Client client, char *fmt, ... );
+extern SendState SocketSendRaw( const Client client, const char *buffer, const int len );
+extern SendState SocketSendRawWithId( const Client client, const char *id, const char *buffer, const int len );
extern char *SocketGetPeerHost( Client client );
extern void SocketSetData( Client client, void *data );
extern void *SocketGetData( Client client );
@@ -75,13 +79,17 @@ extern void SocketBroadcast( char *fmt, ... );
extern Client SocketConnect( char * host, unsigned short port,
void *data,
SocketInterpretation interpretation,
- void (*handle_delete)(Client client, void *data)
+ void (*handle_delete)(Client client, void *data),
+ void(*handle_decongestion)(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)
+ void (*handle_delete)(Client client, void *data),
+ void(*handle_decongestion)(Client client, void *data)
);
+
extern int SocketWaitForReply( Client client, char *buffer, int size, int delai);
/* Socket UDP */
@@ -97,6 +105,9 @@ extern int SocketAddMember( Client client, unsigned long host );
/* recuperation de l'emetteur du message */
extern struct in_addr * SocketGetRemoteAddr( Client client );
+extern void SocketSetUuid (Client client, const char *uuid);
+extern const char* SocketGetUuid (const Client client);
+extern int SocketCmpUuid (const Client c1, const Client c2);
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 *fmt, ... );