#ifndef _CONNECTION_H_ #define _CONNECTION_H_ typedef struct Connection Connection; typedef union ConnectionEvent ConnectionEvent; typedef enum { CONNECTION_READ, CONNECTION_CLOSE, CONNECTION_ERROR } ConnectionEventType; union ConnectionEvent { ConnectionEventType type; struct { ConnectionEventType type; } read; struct { ConnectionEventType type; } close; struct { ConnectionEventType type; } error; }; typedef void (* ConnectionFunc) (Connection *connection, ConnectionEvent *event); Connection *connection_new (int fd, MainContext *context, ConnectionFunc func, gpointer data); #endif