| oop.h | | oop.h | |
| | | | |
| skipping to change at line 22 | | skipping to change at line 22 | |
| #include <unistd.h> | | #include <unistd.h> | |
| | | | |
| /* ------------------------------------------------------------------------
- */ | | /* ------------------------------------------------------------------------
- */ | |
| | | | |
| typedef struct oop_source oop_source; | | typedef struct oop_source oop_source; | |
| | | | |
| /* File descriptor action types */ | | /* File descriptor action types */ | |
| typedef enum { | | typedef enum { | |
| OOP_READ, | | OOP_READ, | |
| OOP_WRITE, | | OOP_WRITE, | |
|
| | | OOP_EXCEPTION, | |
| | | | |
| OOP_NUM_EVENTS | | OOP_NUM_EVENTS | |
| } oop_event; | | } oop_event; | |
| | | | |
| /* Pass this to on_time to schedule an event immediately */ | | /* Pass this to on_time to schedule an event immediately */ | |
| static const struct timeval OOP_TIME_NOW = { 0, 0 }; | | static const struct timeval OOP_TIME_NOW = { 0, 0 }; | |
| | | | |
| /* Maximum signal number. (The OS may have a stricter limit!) */ | | /* Maximum signal number. (The OS may have a stricter limit!) */ | |
| #define OOP_NUM_SIGNALS 256 | | #define OOP_NUM_SIGNALS 256 | |
| | | | |
| /* Callbacks may return one of these */ | | /* Callbacks may return one of these */ | |
|
| #define OOP_CONTINUE NULL | | extern int _oop_continue; /* internal only */ | |
| #define OOP_HALT ((void *) 1) /* (or any non-NULL pointer of your choice) * | | #define OOP_CONTINUE ((void *) &_oop_continue) | |
| / | | #define OOP_HALT ((void *) NULL) /* (or any other value except OOP_CONTINUE | |
| | | ) */ | |
| | | | |
| /* Callback function prototypes */ | | /* Callback function prototypes */ | |
| typedef void *oop_call_fd(oop_source *,int fd,oop_event,void *); | | typedef void *oop_call_fd(oop_source *,int fd,oop_event,void *); | |
| typedef void *oop_call_time(oop_source *,struct timeval,void *); | | typedef void *oop_call_time(oop_source *,struct timeval,void *); | |
| typedef void *oop_call_signal(oop_source *,int sig,void *); | | typedef void *oop_call_signal(oop_source *,int sig,void *); | |
| | | | |
| struct oop_source { | | struct oop_source { | |
| void (*on_fd)(oop_source *,int fd,oop_event,oop_call_fd *,void *); | | void (*on_fd)(oop_source *,int fd,oop_event,oop_call_fd *,void *); | |
| void (*cancel_fd)(oop_source *,int fd,oop_event); | | void (*cancel_fd)(oop_source *,int fd,oop_event); | |
| | | | |
| | | | |
| skipping to change at line 57 | | skipping to change at line 59 | |
| | | | |
| void (*on_signal)(oop_source *,int sig,oop_call_signal *,void *); | | void (*on_signal)(oop_source *,int sig,oop_call_signal *,void *); | |
| void (*cancel_signal)(oop_source *,int sig,oop_call_signal *,void *)
; | | void (*cancel_signal)(oop_source *,int sig,oop_call_signal *,void *)
; | |
| }; | | }; | |
| | | | |
| /* ------------------------------------------------------------------------
- */ | | /* ------------------------------------------------------------------------
- */ | |
| | | | |
| /* For recommended use by oop components. */ | | /* For recommended use by oop components. */ | |
| | | | |
| extern void *(*oop_malloc)(size_t); | | extern void *(*oop_malloc)(size_t); | |
|
| | | extern void *(*oop_realloc)(void *,size_t); | |
| extern void (*oop_free)(void *); | | extern void (*oop_free)(void *); | |
| | | | |
| /* ------------------------------------------------------------------------
- */ | | /* ------------------------------------------------------------------------
- */ | |
| | | | |
| /* System event source. */ | | /* System event source. */ | |
| typedef struct oop_source_sys oop_source_sys; | | typedef struct oop_source_sys oop_source_sys; | |
| | | | |
| /* Create a system event source. Returns NULL on failure. */ | | /* Create a system event source. Returns NULL on failure. */ | |
| oop_source_sys *oop_sys_new(void); | | oop_source_sys *oop_sys_new(void); | |
| | | | |
| | | | |
| skipping to change at line 84 | | skipping to change at line 87 | |
| | | | |
| /* Get the event registration interface for a system event source. */ | | /* Get the event registration interface for a system event source. */ | |
| oop_source *oop_sys_source(oop_source_sys *); | | oop_source *oop_sys_source(oop_source_sys *); | |
| | | | |
| /* ------------------------------------------------------------------------
- */ | | /* ------------------------------------------------------------------------
- */ | |
| | | | |
| /* Helper for select-style asynchronous interfaces. */ | | /* Helper for select-style asynchronous interfaces. */ | |
| typedef struct oop_adapter_select oop_adapter_select; | | typedef struct oop_adapter_select oop_adapter_select; | |
| typedef void *oop_call_select( | | typedef void *oop_call_select( | |
| oop_adapter_select *, | | oop_adapter_select *, | |
|
| int num,fd_set *r,fd_set *w, | | int num,fd_set *r,fd_set *w,fd_set *x, | |
| struct timeval now,void *); | | struct timeval now,void *); | |
| | | | |
| oop_adapter_select *oop_select_new( | | oop_adapter_select *oop_select_new( | |
| oop_source *, | | oop_source *, | |
| oop_call_select *, | | oop_call_select *, | |
| void *); | | void *); | |
| | | | |
| void oop_select_set( | | void oop_select_set( | |
| oop_adapter_select *,int num_fd, | | oop_adapter_select *,int num_fd, | |
|
| fd_set *rfd,fd_set *wfd,struct timeval *timeout); | | fd_set *rfd,fd_set *wfd,fd_set *xfd,struct timeval *timeout); | |
| | | | |
| void oop_select_delete(oop_adapter_select *); | | void oop_select_delete(oop_adapter_select *); | |
| | | | |
| /* ------------------------------------------------------------------------
- */ | | /* ------------------------------------------------------------------------
- */ | |
| | | | |
| /* Helper for event sources without signal handling. */ | | /* Helper for event sources without signal handling. */ | |
| typedef struct oop_adapter_signal oop_adapter_signal; | | typedef struct oop_adapter_signal oop_adapter_signal; | |
| | | | |
| oop_adapter_signal *oop_signal_new(oop_source *); | | oop_adapter_signal *oop_signal_new(oop_source *); | |
| void oop_signal_delete(oop_adapter_signal *); | | void oop_signal_delete(oop_adapter_signal *); | |
| | | | |
End of changes. 5 change blocks. |
| 5 lines changed or deleted | | 8 lines changed or added | |
|