Simple coroutine library integrated with IO event loop (libevent) / objects in plain C Snapshot
Classes | Typedefs | Enumerations | Functions
evthread.h File Reference
#include <corothread/cthread.h>
#include <corothread/stacks.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <cutils/dlist.h>
#include <nutils/addrutil.h>
#include <event.h>

Go to the source code of this file.

Classes

struct  tagEVLOOP
struct  tagEVTHREAD
struct  tagEVTHREAD_OBJECT
 base class of sockets and timers. API of this class is not not called directly by the user of this library. More...
struct  tagEVTIMER
struct  tagEVSOCKET
struct  tagTCPACCEPTOR

Typedefs

typedef struct tagEVLOOP EVLOOP
typedef void(* EVTHREAD_PROC )(struct tagEVTHREAD *thread, struct tagEVSOCKET *socket, void *user_ctx)
typedef struct tagEVTHREAD EVTHREAD
typedef struct tagEVTHREAD_OBJECT EVTHREAD_OBJECT
 base class of sockets and timers. API of this class is not not called directly by the user of this library.
typedef struct tagEVTIMER EVTIMER
typedef struct tagEVSOCKET EVSOCKET
typedef int(* EVTHREAD_FACTORY )(int fd, EVTHREAD_PROC *proc, void **ctx, void *factory_ctx)
typedef struct tagTCPACCEPTOR EVTCPACCEPTOR

Enumerations

enum  EVTHREAD_OBJECT_TYPE { EVTHREAD_OBJECT_SOCKET, EVTHREAD_OBJECT_TIMER }
enum  EVTIMERSTATE { EVTIMER_STATE_INIT, EVTIMER_STATE_SCHEDULED }
enum  EVSOCKET_STATE {
  EVSOCKET_STATE_INIT, EVSOCKET_STATE_CONNECTING, EVSOCKET_STATE_CONNECTED, EVSOCKET_STATE_READING,
  EVSOCKET_STATE_WRITING, EVSOCKET_STATE_CLOSED, EVSOCKET_STATE_ERROR
}

Functions

EVLOOPEVLOOP_init (STACKS *stacks)
int EVLOOP_run (EVLOOP *loop)
int EVLOOP_break (EVLOOP *loop)
EVTHREADEVTHREAD_init (EVLOOP *loop, EVTHREAD_PROC thread_proc, void *user_ctx)
int EVTHREAD_start (EVTHREAD *thread, struct tagEVSOCKET *socket)
int EVTHREAD_delay (EVTHREAD *thread, struct timeval delay)
EVTIMEREVTIMER_init (EVTHREAD *thread, int timer_id, struct timeval tm)
int EVTIMER_start (EVTIMER *ret)
int EVTIMER_cancel (EVTIMER *timer)
int EVTIMER_free (EVTIMER *timer)
EVSOCKETEVSOCKET_init (EVTHREAD *thread, int fd, int is_connected)
int EVSOCKET_close (EVSOCKET *socket)
int EVSOCKET_connect (EVSOCKET *socket, struct sockaddr *address, socklen_t socklen, struct timeval timeout)
void EVSOCKET_set_idle_timeout (EVSOCKET *socket, struct timeval timeout)
int EVSOCKET_recv (EVSOCKET *socket, void *buf, size_t buf_size, int flags, struct timeval timeout)
int EVSOCKET_recv_all (EVSOCKET *socket, void *buf, size_t buf_size, int flags, struct timeval timeout)
int EVSOCKET_send (EVSOCKET *socket, void *buf, size_t buf_size, int flags, struct timeval timeout)
EVTCPACCEPTOREVTCPACCEPTOR_init_ex (EVLOOP *loop, SOCKADDR *addr, int listener_backlog, EVTHREAD_FACTORY factory, int read_buffer_size, int write_buffer_size, void *ctx)
EVTCPACCEPTOREVTCPACCEPTOR_init (EVLOOP *loop, int listener_fd, EVTHREAD_FACTORY factory, int read_buffer_size, int write_buffer_size, void *ctx)
void EVTCPACCEPTOR_close (EVTCPACCEPTOR *)

Typedef Documentation

base class of sockets and timers. API of this class is not not called directly by the user of this library.


Enumeration Type Documentation

Enumerator:
EVTHREAD_OBJECT_SOCKET 
EVTHREAD_OBJECT_TIMER 

Definition at line 115 of file evthread.h.