Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(950)

Side by Side Diff: third_party/libevent/event.h

Issue 412006: posix: upgrade libevent from 1.4.7 to 1.4.13 (Closed)
Patch Set: better readme Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu> 2 * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 #ifndef TAILQ_ENTRY 202 #ifndef TAILQ_ENTRY
203 #define _EVENT_DEFINED_TQENTRY 203 #define _EVENT_DEFINED_TQENTRY
204 #define TAILQ_ENTRY(type) \ 204 #define TAILQ_ENTRY(type) \
205 struct { \ 205 struct { \
206 struct type *tqe_next; /* next element */ \ 206 struct type *tqe_next; /* next element */ \
207 struct type **tqe_prev; /* address of previous next element */ \ 207 struct type **tqe_prev; /* address of previous next element */ \
208 } 208 }
209 #endif /* !TAILQ_ENTRY */ 209 #endif /* !TAILQ_ENTRY */
210 210
211 struct event_base; 211 struct event_base;
212 #ifndef EVENT_NO_STRUCT
212 struct event { 213 struct event {
213 TAILQ_ENTRY (event) ev_next; 214 TAILQ_ENTRY (event) ev_next;
214 TAILQ_ENTRY (event) ev_active_next; 215 TAILQ_ENTRY (event) ev_active_next;
215 TAILQ_ENTRY (event) ev_signal_next; 216 TAILQ_ENTRY (event) ev_signal_next;
216 unsigned int min_heap_idx; /* for managing timeouts */ 217 unsigned int min_heap_idx; /* for managing timeouts */
217 218
218 struct event_base *ev_base; 219 struct event_base *ev_base;
219 220
220 int ev_fd; 221 int ev_fd;
221 short ev_events; 222 short ev_events;
222 short ev_ncalls; 223 short ev_ncalls;
223 short *ev_pncalls; /* Allows deletes in callback */ 224 short *ev_pncalls; /* Allows deletes in callback */
224 225
225 struct timeval ev_timeout; 226 struct timeval ev_timeout;
226 227
227 int ev_pri; /* smaller numbers are higher priority */ 228 int ev_pri; /* smaller numbers are higher priority */
228 229
229 void (*ev_callback)(int, short, void *arg); 230 void (*ev_callback)(int, short, void *arg);
230 void *ev_arg; 231 void *ev_arg;
231 232
232 int ev_res; /* result passed to event callback */ 233 int ev_res; /* result passed to event callback */
233 int ev_flags; 234 int ev_flags;
234 }; 235 };
236 #else
237 struct event;
238 #endif
235 239
236 #define EVENT_SIGNAL(ev) (int)(ev)->ev_fd 240 #define EVENT_SIGNAL(ev) (int)(ev)->ev_fd
237 #define EVENT_FD(ev) (int)(ev)->ev_fd 241 #define EVENT_FD(ev) (int)(ev)->ev_fd
238 242
239 /* 243 /*
240 * Key-Value pairs. Can be used for HTTP headers but also for 244 * Key-Value pairs. Can be used for HTTP headers but also for
241 * query argument parsing. 245 * query argument parsing.
242 */ 246 */
243 struct evkeyval { 247 struct evkeyval {
244 TAILQ_ENTRY(evkeyval) next; 248 TAILQ_ENTRY(evkeyval) next;
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 744
741 struct bufferevent; 745 struct bufferevent;
742 typedef void (*evbuffercb)(struct bufferevent *, void *); 746 typedef void (*evbuffercb)(struct bufferevent *, void *);
743 typedef void (*everrorcb)(struct bufferevent *, short what, void *); 747 typedef void (*everrorcb)(struct bufferevent *, short what, void *);
744 748
745 struct event_watermark { 749 struct event_watermark {
746 size_t low; 750 size_t low;
747 size_t high; 751 size_t high;
748 }; 752 };
749 753
754 #ifndef EVENT_NO_STRUCT
750 struct bufferevent { 755 struct bufferevent {
751 struct event_base *ev_base; 756 struct event_base *ev_base;
752 757
753 struct event ev_read; 758 struct event ev_read;
754 struct event ev_write; 759 struct event ev_write;
755 760
756 struct evbuffer *input; 761 struct evbuffer *input;
757 struct evbuffer *output; 762 struct evbuffer *output;
758 763
759 struct event_watermark wm_read; 764 struct event_watermark wm_read;
760 struct event_watermark wm_write; 765 struct event_watermark wm_write;
761 766
762 evbuffercb readcb; 767 evbuffercb readcb;
763 evbuffercb writecb; 768 evbuffercb writecb;
764 everrorcb errorcb; 769 everrorcb errorcb;
765 void *cbarg; 770 void *cbarg;
766 771
767 int timeout_read; /* in seconds */ 772 int timeout_read; /* in seconds */
768 int timeout_write; /* in seconds */ 773 int timeout_write; /* in seconds */
769 774
770 short enabled; /* events that are currently enabled */ 775 short enabled; /* events that are currently enabled */
771 }; 776 };
772 777 #endif
773 778
774 /** 779 /**
775 Create a new bufferevent. 780 Create a new bufferevent.
776 781
777 libevent provides an abstraction on top of the regular event callbacks. 782 libevent provides an abstraction on top of the regular event callbacks.
778 This abstraction is called a buffered event. A buffered event provides 783 This abstraction is called a buffered event. A buffered event provides
779 input and output buffers that get filled and drained automatically. The 784 input and output buffers that get filled and drained automatically. The
780 user of a buffered event no longer deals directly with the I/O, but 785 user of a buffered event no longer deals directly with the I/O, but
781 instead is reading from input and writing to output buffers. 786 instead is reading from input and writing to output buffers.
782 787
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 @return The number of bytes added if successful, or -1 if an error occurred. 1067 @return The number of bytes added if successful, or -1 if an error occurred.
1063 */ 1068 */
1064 int evbuffer_add_vprintf(struct evbuffer *, const char *fmt, va_list ap); 1069 int evbuffer_add_vprintf(struct evbuffer *, const char *fmt, va_list ap);
1065 1070
1066 1071
1067 /** 1072 /**
1068 Remove a specified number of bytes data from the beginning of an evbuffer. 1073 Remove a specified number of bytes data from the beginning of an evbuffer.
1069 1074
1070 @param buf the evbuffer to be drained 1075 @param buf the evbuffer to be drained
1071 @param len the number of bytes to drain from the beginning of the buffer 1076 @param len the number of bytes to drain from the beginning of the buffer
1072 @return 0 if successful, or -1 if an error occurred
1073 */ 1077 */
1074 void evbuffer_drain(struct evbuffer *, size_t); 1078 void evbuffer_drain(struct evbuffer *, size_t);
1075 1079
1076 1080
1077 /** 1081 /**
1078 Write the contents of an evbuffer to a file descriptor. 1082 Write the contents of an evbuffer to a file descriptor.
1079 1083
1080 The evbuffer will be drained after the bytes have been successfully written. 1084 The evbuffer will be drained after the bytes have been successfully written.
1081 1085
1082 @param buffer the evbuffer to be written and drained 1086 @param buffer the evbuffer to be written and drained
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 char **pstring); 1171 char **pstring);
1168 1172
1169 int evtag_unmarshal_timeval(struct evbuffer *evbuf, ev_uint32_t need_tag, 1173 int evtag_unmarshal_timeval(struct evbuffer *evbuf, ev_uint32_t need_tag,
1170 struct timeval *ptv); 1174 struct timeval *ptv);
1171 1175
1172 #ifdef __cplusplus 1176 #ifdef __cplusplus
1173 } 1177 }
1174 #endif 1178 #endif
1175 1179
1176 #endif /* _EVENT_H_ */ 1180 #endif /* _EVENT_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698