… | |
… | |
7 | |
7 | |
8 | #include <sys/time.h> |
8 | #include <sys/time.h> |
9 | #include <time.h> |
9 | #include <time.h> |
10 | #include <event.h> |
10 | #include <event.h> |
11 | #include <evdns.h> |
11 | #include <evdns.h> |
12 | /*include <evhttp.h>*/ /* does not compile */ |
12 | |
|
|
13 | /* workaround for evhttp.h requiring obscure bsd headers */ |
|
|
14 | #ifndef TAILQ_ENTRY |
|
|
15 | #define TAILQ_ENTRY(type) \ |
|
|
16 | struct { \ |
|
|
17 | struct type *tqe_next; /* next element */ \ |
|
|
18 | struct type **tqe_prev; /* address of previous next element */ \ |
|
|
19 | } |
|
|
20 | #endif /* !TAILQ_ENTRY */ |
|
|
21 | #include <evhttp.h> |
13 | |
22 | |
14 | #define EV_NONE 0 |
23 | #define EV_NONE 0 |
15 | #define EV_UNDEF -1 |
24 | #define EV_UNDEF -1 |
16 | |
25 | |
17 | #define TIMEOUT_NONE HUGE_VAL |
26 | #define TIMEOUT_NONE HUGE_VAL |
… | |
… | |
471 | static const struct { |
480 | static const struct { |
472 | const char *name; |
481 | const char *name; |
473 | IV iv; |
482 | IV iv; |
474 | } *civ, const_iv[] = { |
483 | } *civ, const_iv[] = { |
475 | # define const_iv(pfx, name) { # name, (IV) pfx ## name }, |
484 | # define const_iv(pfx, name) { # name, (IV) pfx ## name }, |
476 | |
|
|
477 | const_iv (DNS_, ERR_NONE) |
485 | const_iv (DNS_, ERR_NONE) |
478 | const_iv (DNS_, ERR_FORMAT) |
486 | const_iv (DNS_, ERR_FORMAT) |
479 | const_iv (DNS_, ERR_SERVERFAILED) |
487 | const_iv (DNS_, ERR_SERVERFAILED) |
480 | const_iv (DNS_, ERR_NOTEXIST) |
488 | const_iv (DNS_, ERR_NOTEXIST) |
481 | const_iv (DNS_, ERR_NOTIMPL) |
489 | const_iv (DNS_, ERR_NOTIMPL) |
… | |
… | |
552 | |
560 | |
553 | void evdns_search_add (char *domain) |
561 | void evdns_search_add (char *domain) |
554 | |
562 | |
555 | void evdns_search_ndots_set (int ndots) |
563 | void evdns_search_ndots_set (int ndots) |
556 | |
564 | |
|
|
565 | |
|
|
566 | MODULE = EV PACKAGE = EV::HTTP PREFIX = evhttp_ |
|
|
567 | |
|
|
568 | BOOT: |
|
|
569 | { |
|
|
570 | HV *stash = gv_stashpv ("EV::HTTP", 1); |
|
|
571 | |
|
|
572 | static const struct { |
|
|
573 | const char *name; |
|
|
574 | IV iv; |
|
|
575 | } *civ, const_iv[] = { |
|
|
576 | # define const_iv(pfx, name) { # name, (IV) pfx ## name }, |
|
|
577 | const_iv (HTTP_, OK) |
|
|
578 | const_iv (HTTP_, NOCONTENT) |
|
|
579 | const_iv (HTTP_, MOVEPERM) |
|
|
580 | const_iv (HTTP_, MOVETEMP) |
|
|
581 | const_iv (HTTP_, NOTMODIFIED) |
|
|
582 | const_iv (HTTP_, BADREQUEST) |
|
|
583 | const_iv (HTTP_, NOTFOUND) |
|
|
584 | const_iv (HTTP_, SERVUNAVAIL) |
|
|
585 | const_iv (EVHTTP_, REQ_OWN_CONNECTION) |
|
|
586 | const_iv (EVHTTP_, PROXY_REQUEST) |
|
|
587 | const_iv (EVHTTP_, REQ_GET) |
|
|
588 | const_iv (EVHTTP_, REQ_POST) |
|
|
589 | const_iv (EVHTTP_, REQ_HEAD) |
|
|
590 | const_iv (EVHTTP_, REQUEST) |
|
|
591 | const_iv (EVHTTP_, RESPONSE) |
|
|
592 | }; |
|
|
593 | |
|
|
594 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
|
|
595 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
|
|
596 | } |
|
|
597 | |
|
|
598 | MODULE = EV PACKAGE = EV::HTTP::Request PREFIX = evhttp_request_ |
|
|
599 | |
|
|
600 | #HttpRequest new (SV *klass, SV *cb) |
|
|
601 | |
|
|
602 | #void DESTROY (struct evhttp_request *req); |
|
|
603 | |
|
|
604 | |
|
|
605 | |
|
|
606 | |
|
|
607 | |
|
|
608 | |
|
|
609 | |
|
|
610 | |