--- cvsroot/EV/EV.xs 2007/10/26 17:24:18 1.3 +++ cvsroot/EV/EV.xs 2007/10/27 14:54:21 1.7 @@ -9,7 +9,16 @@ #include #include #include -/*include */ /* does not compile */ + +/* workaround for evhttp.h requiring obscure bsd headers */ +#ifndef TAILQ_ENTRY +#define TAILQ_ENTRY(type) \ +struct { \ + struct type *tqe_next; /* next element */ \ + struct type **tqe_prev; /* address of previous next element */ \ +} +#endif /* !TAILQ_ENTRY */ +#include #define EV_NONE 0 #define EV_UNDEF -1 @@ -109,7 +118,7 @@ { double now = e_now (); - if (now > to && ev->interval) + if (ev->interval) ev->timeout = (to += ceil ((now - to) / ev->interval) * ev->interval); to -= now; @@ -162,7 +171,7 @@ ENTER; SAVETMPS; - if (!(ev->ev.ev_events & EV_PERSIST)) + if (!(ev->ev.ev_events & EV_PERSIST) || (events & EV_TIMEOUT)) ev->active = 0; PUSHMARK (SP); @@ -473,7 +482,6 @@ IV iv; } *civ, const_iv[] = { # define const_iv(pfx, name) { # name, (IV) pfx ## name }, - const_iv (DNS_, ERR_NONE) const_iv (DNS_, ERR_FORMAT) const_iv (DNS_, ERR_SERVERFAILED) @@ -554,3 +562,49 @@ void evdns_search_ndots_set (int ndots) + +MODULE = EV PACKAGE = EV::HTTP PREFIX = evhttp_ + +BOOT: +{ + HV *stash = gv_stashpv ("EV::HTTP", 1); + + static const struct { + const char *name; + IV iv; + } *civ, const_iv[] = { +# define const_iv(pfx, name) { # name, (IV) pfx ## name }, + const_iv (HTTP_, OK) + const_iv (HTTP_, NOCONTENT) + const_iv (HTTP_, MOVEPERM) + const_iv (HTTP_, MOVETEMP) + const_iv (HTTP_, NOTMODIFIED) + const_iv (HTTP_, BADREQUEST) + const_iv (HTTP_, NOTFOUND) + const_iv (HTTP_, SERVUNAVAIL) + const_iv (EVHTTP_, REQ_OWN_CONNECTION) + const_iv (EVHTTP_, PROXY_REQUEST) + const_iv (EVHTTP_, REQ_GET) + const_iv (EVHTTP_, REQ_POST) + const_iv (EVHTTP_, REQ_HEAD) + const_iv (EVHTTP_, REQUEST) + const_iv (EVHTTP_, RESPONSE) + }; + + for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) + newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); +} + +MODULE = EV PACKAGE = EV::HTTP::Request PREFIX = evhttp_request_ + +#HttpRequest new (SV *klass, SV *cb) + +#void DESTROY (struct evhttp_request *req); + + + + + + + +