322 Commits

Author SHA1 Message Date
Nick Mathewson
a8267663de API to replace all calls to exit() with a user-supplied fatal-error handler.
Also, add unit tests for logging.

svn:r1462
2009-10-26 19:59:51 +00:00
Nick Mathewson
879420a711 Expose a narrow window to the IOCP code.
svn:r1459
2009-10-23 22:00:29 +00:00
Nick Mathewson
b73ad7bc45 Treat the bitwise OR of two enum values as an int.
This makes our interfaces usable from C++, which doesn't believe
you can say    "bufferevent_socket_nase(base, -1,
BEV_OPT_CLOSE_ON_FREE|BEV_OPT_DEFER_CALLBACKS)" but which instead
would demand "static_cast<bufferevent_options>(BEV_OPT_CLOSE_ON_FREE|
BEV_OPT_DEFER_CALLBACKS))" for the last	argument.

Diagnosis and patch from Chris Davis.

svn:r1456
2009-10-21 18:48:22 +00:00
Niels Provos
e1c9b84ae6 Fix compilation for listener.h for C++ - missing extern "C". Patch from Ferenc Szalai.
svn:r1448
2009-10-19 16:20:12 +00:00
Nick Mathewson
e3fd294a6d Spelling fixes in comments and strings.
svn:r1445
2009-10-16 13:19:57 +00:00
Nick Mathewson
e6b747c34a Declare struct timezone in util.h so that borken mingw versions do not complain
svn:r1441
2009-10-12 21:06:30 +00:00
Nick Mathewson
d5b640fc16 Apply Ka-Hing Cheung's event_base_got_[break|exit] patch, with locking and whitespace fixes.
svn:r1438
2009-10-01 15:29:08 +00:00
Nick Mathewson
c8b0fe4ad7 Define evhttp_del_accept_socket
[Patch from David Reiss]

svn:r1423
2009-08-16 19:22:10 +00:00
Nick Mathewson
6c53334c65 Define evhttp_{bind,accept}_socket_with_handle
[Patch from David Reiss]

svn:r1422
2009-08-16 19:22:04 +00:00
Nick Mathewson
4bcd5646d8 Make evhttp_bound_socket visible, and provide an accessor to its fd
Declare the previously private struct evhttp_bound_socket in
event2/http.h as an opaque struct.

Implement evhttp_bound_socket_get_fd, which returns the file descriptor
of an evhttp_bound_socket.

[Patch from David Reiss]

svn:r1421
2009-08-16 19:21:57 +00:00
Nick Mathewson
0755833e84 Minor documentation fixes
[Patch from David Reiss]

svn:r1420
2009-08-16 19:21:50 +00:00
Nick Mathewson
f22823982f New function to put an SSL bufferevent into a renegotiating state.
svn:r1418
2009-08-14 20:07:35 +00:00
Nick Mathewson
800f9aa607 When bufferevent_socket_connect is called with no address, assume that our existing fd is connecting and put the connection into "connecting" mode.
svn:r1411
2009-08-09 20:17:29 +00:00
Nick Mathewson
8a99083f01 Add an evbuffer_search_range() to search a bounded range of a buffer
This can be handy when you have	one search to find the end of a	header
section, and then you want to find a substring within the header
section without looking at the body.

svn:r1410
2009-08-07 17:16:52 +00:00
Nick Mathewson
d41347722a Refactor evbuffer_readln() into a search-for-eol function and an extract-line function.
svn:r1404
2009-07-31 17:35:42 +00:00
Nick Mathewson
7c688dd9a2 New function to expose bufferevent.enabled
svn:r1401
2009-07-31 14:41:45 +00:00
Nick Mathewson
621aafd27a Export sockaddr comparison functionality.
svn:r1400
2009-07-30 22:11:23 +00:00
Nick Mathewson
eecefc50e7 Add a function to extract the SSL object from a bufferevent_openssl.
svn:r1395
2009-07-30 20:41:00 +00:00
Nick Mathewson
7c20a6ae52 Export an ev_socklen_t.
svn:r1391
2009-07-30 17:01:21 +00:00
Nick Mathewson
75fe762e03 Accessor function to get a listener's associated fd
svn:r1390
2009-07-30 17:00:56 +00:00
Nick Mathewson
72ea534f8e Export evutil_str[n]casecmp as evutil_ascii_str[n]casecmp.
svn:r1387
2009-07-28 19:41:57 +00:00
Nick Mathewson
5b5b880be7 Various MSVC cleanups from Brodie Thiesfield.
svn:r1385
2009-07-28 19:41:39 +00:00
Nick Mathewson
709c21c48c Bufferevent support for openssl.
This code adds a new Bufferevent type that is only compiled when the
openssl library is present.  It supports using an SSL object and an
event alert mechanism, which can either be an fd or an underlying
bufferevent.

There is still more work to do: the unit tests are incomplete, and we
need to support flush and shutdown much better.  Sometimes events are
generated needlessly: this will hose performance.

There's a new encrypting proxy in sample/le-proxy.c.

This code has only been tested on OSX, and nowhere else.

svn:r1382
2009-07-28 04:03:57 +00:00
Nick Mathewson
670658ebd7 Correct the signatures for evdns_configure_windows_nameservers(), now that it is exposed.
svn:r1369
2009-07-21 18:32:57 +00:00
Nick Mathewson
e8400a43ca Rename encode_int(64) to avoid polluting the global namespace.
They're now called evtag_encode_int(64).  The old names are available
as macros in event2/tag_compat.h.

Also, add unit tests for encode/decode_int64.

svn:r1365
2009-07-20 14:55:35 +00:00
Nick Mathewson
1fb2e818a6 Use a uniform strategy when a function is not working: do not expose
it.

Rather than failing at runtime, it is better to fail at compile or
link time.

svn:r1363
2009-07-17 21:47:45 +00:00
Nick Mathewson
d3bef1a1e3 Finish implementing new convention that whenever an optional function is declared, a corresponding macro is defined.
svn:r1361
2009-07-17 20:32:25 +00:00
Nick Mathewson
a386fde321 Checking for MS_WINDOWS rather than WIN32 is a Tor-ism. Fix that!
svn:r1360
2009-07-17 20:28:03 +00:00
Nick Mathewson
ed038295cd Define a macro to indicate that we have defined one of the optional evthread_use macros
svn:r1355
2009-07-17 20:22:48 +00:00
Nick Mathewson
5d71b25b51 Remove all trailing whitespace from end-of-line.
svn:r1350
2009-07-17 18:38:38 +00:00
Nick Mathewson
eb97bb76e1 Make the headers compile happily with pedantic C compilers.
Original message from SF patch 2797966:

    While commas at the end of enumerator lists are valid in c99, they
    are not valid +in c89 nor in c++. When using gcc/g++ with the
    -pedantic flag, users will +receive a warning (gcc) or an
    error(g++) when including the event2/event.h and
    +event2/bufferevent.h. The errors look something like

    event2/event.h:159: error: comma at end of enumerator list

Patch from Akita Noek on Sourceforge.

svn:r1321
2009-05-28 15:58:28 +00:00
Nick Mathewson
0b4ab12251 Spell-check the the headers
svn:r1320
2009-05-28 15:47:15 +00:00
Nick Mathewson
3f0e49283b small doc fix.
svn:r1319
2009-05-27 23:48:59 +00:00
Nick Mathewson
5232cfa357 Consistently say "eventcb" instead of "errorcb"
svn:r1316
2009-05-25 23:11:20 +00:00
Nick Mathewson
0b22ca1929 Use ev_ssize_t in place of ssize_t *everywhere*.
svn:r1309
2009-05-22 19:11:48 +00:00
Nick Mathewson
8997f234f2 Use the native "struct iovec" as our "struct evbuffer_iovec" when available, so we do not need to copy more pointers than necessary.
svn:r1299
2009-05-21 20:59:00 +00:00
Nick Mathewson
23243b8a98 Replace reserve/commit with new iovec-based interface. Add a new evbuffer_peek.
svn:r1296
2009-05-19 21:39:35 +00:00
Nick Mathewson
ed1bbc7a9f Tweak the evconnlistener interface a little.
svn:r1295
2009-05-18 16:15:56 +00:00
Nick Mathewson
dc4c7b9570 Change the interface of evbuffer_add_reference: give the cleanup function more info.
svn:r1294
2009-05-15 22:44:18 +00:00
Nick Mathewson
bba69e03f8 New semantics for evbuffer_cb_set_flags().
Previously, set_flags() would replace all previous user-visible flags.
Now it just sets the flags, and there is a clear_flags() function to
clear other flags.

svn:r1293
2009-05-15 20:23:59 +00:00
Nick Mathewson
b4886ec80d Trim 22 bytes from struct event on 32 bit platforms, more on 64-bit platforms.
svn:r1292
2009-05-15 18:44:44 +00:00
Nick Mathewson
27fef1ef26 Note problems with some newer evbuffer interfaces.
svn:r1286
2009-05-14 18:06:41 +00:00
Nick Mathewson
3e759a0172 Actually, do not provide a compatibility name "EVBUFFER_CONNECTED": there is no old code that uses it.
svn:r1285
2009-05-14 18:06:29 +00:00
Nick Mathewson
31d89f274b Add a "ctrl" mechanism to bufferevents for property access.
OpenSSL uses something like this to implement get/set access for
properties on its BIOs, so that it doesn't need to add a pair of
get/set functions to the vtable struct for every new abstract property
it provides an accessor for.

Doing this lets us make bufferevent_setfd abstract, and implement an
abstract bufferevent_getfd.

svn:r1284
2009-05-13 20:37:21 +00:00
Nick Mathewson
83f46e51d7 Do not use the "evbuffer_" prefix to denote parts of bufferevents.
This is a bit of an interface doozy, but it's really needed in order
to be able to document this stuff without apologizing it.  This patch
does the following renamings:

   evbuffercb -> bufferevent_data_cb
   everrorcb -> bufferevent_event_cb
   EVBUFFER_(READ,WRITE,...) -> BEV_EVENT_(...)
   EVBUFFER_(INPUT,OUTPUT) -> bufferevent_get_(input,output)

All the old names are available in event2/bufferevent_compat.h

svn:r1283
2009-05-13 20:36:56 +00:00
Nick Mathewson
659d54d530 Add new code to make and accept connections.
This is stuff that it's easy to get wrong (as I noticed when writing
bench_http), and that takes up a fair amount of space (see http.c).
Also, it's something that we'll eventually want to abstract to use
IOCP, where available.

svn:r1272
2009-05-05 02:59:26 +00:00
Nick Mathewson
0fd70978c8 Add an event_get_base() function to remove one more reason to include event_struct.h
svn:r1271
2009-05-05 01:09:03 +00:00
Nick Mathewson
d5ca076379 Move event_set() and friends to event2/event_compat.h.
These functions are deprecated in favor of event_assign().

svn:r1267
2009-05-02 16:23:29 +00:00
Nick Mathewson
b2e8fd0e41 Apparently MSVC lacks a ssize_t. Define an ev_ssize_t for headers, and make ssize_t work elsewhere.
svn:r1261
2009-04-30 23:56:53 +00:00
Nick Mathewson
1959414120 Clarify semantics on event_pending()
svn:r1249
2009-04-29 20:48:21 +00:00