diff options
Diffstat (limited to 'src/buschannel.h')
-rw-r--r-- | src/buschannel.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/buschannel.h b/src/buschannel.h new file mode 100644 index 0000000..2d05ff4 --- /dev/null +++ b/src/buschannel.h @@ -0,0 +1,43 @@ +#ifndef _BUSCHANNEL_H +#define _BUSCHANNEL_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* general Handle */ + +#ifdef WIN32 +#include <windows.h> +#define HANDLE SOCKET +#else +#define HANDLE int +#endif + +typedef struct _channel *Channel; +/* callback declenche par la gestion de boucle sur evenement exception sur le canal */ +typedef void (*ChannelHandleDelete)( void *data ); +/* callback declenche par la gestion de boucle sur donnees pretes sur le canal */ +typedef void (*ChannelHandleRead)( Channel channel, HANDLE fd, void *data); + +/* fonction appele par le bus pour initialisation */ +typedef void (*ChannelInit)(void); + +/* fonction appele par le bus pour mise en place des callback sur le canal */ +typedef Channel (*ChannelSetUp)( + HANDLE fd, + void *data, + ChannelHandleDelete handle_delete, + ChannelHandleRead handle_read + ); +/* fonction appele par le bus pour fermeture du canal */ +typedef void (*ChannelClose)( Channel channel ); + +/* mise en place des fonction de gestion des canaux */ +void BusSetChannelManagement( ChannelInit init_chan, ChannelSetUp setup_chan, ChannelClose close_chan ); + +#ifdef __cplusplus +} +#endif + +#endif |