File: libevent.h

package info (click to toggle)
python-gevent 0.12.2-7
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 1,828 kB
  • ctags: 2,809
  • sloc: python: 9,151; makefile: 91; ansic: 42
file content (52 lines) | stat: -rw-r--r-- 1,208 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* Copyright (c) 2009-2010 Denis Bilenko. See LICENSE for details. */

#ifdef WIN32
#include "winsock2.h" // for timeval
#endif

#include "sys/queue.h"

#ifdef USE_LIBEVENT_2

#include "event2/event.h"
#include "event2/event_struct.h"
#include "event2/event_compat.h"
#include "event2/http.h"
#include "event2/http_compat.h"
#include "event2/http_struct.h"
#include "event2/buffer.h"
#include "event2/buffer_compat.h"
#include "event2/dns.h"
#include "event2/dns_compat.h"

#define EVBUFFER_DRAIN evbuffer_drain
#define EVHTTP_SET_CB  evhttp_set_cb

#elif USE_LIBEVENT_1

#include "event.h"
#include "evhttp.h"
#include "evdns.h"

/* compatibility */

#define evbuffer_get_length EVBUFFER_LENGTH
#define evbuffer_pullup(BUF, SIZE) EVBUFFER_DATA(BUF)

#define TAILQ_FIRST(head) ((head)->tqh_first)
#define	TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)

/* functions that return int in libeven2 but void in libevent1 */
#define EVBUFFER_DRAIN(A, B) (evbuffer_drain((A), (B)), 0)
#define EVHTTP_SET_CB(A, B, C, D) (evhttp_set_cb((A), (B), (C), (D)), 0)

#else

#error "Please define either USE_LIBEVENT_1 or USE_LIBEVENT_2"

#endif

#define TAILQ_GET_NEXT(X) TAILQ_NEXT((X), next)

extern void *current_base;