diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-09-20 18:26:40 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-09-20 18:26:40 +0000 |
commit | 250071830a701193c72aa8a65bd9afa5f74692fe (patch) | |
tree | b3bce2543d799019ace5bd2bb99ebb18c273e536 /evutil.h | |
parent | 626cc5f982f648e4d669178dc5e0bbb1f4ddb6d6 (diff) | |
download | libevent-250071830a701193c72aa8a65bd9afa5f74692fe.tar.gz |
r15216@catbus: nickm | 2007-09-20 13:58:23 -0400
Add a new evutil module to contain the usual cross-platform hacks: socketpair, closesocket, and make_socket_nonblocking()
svn:r441
Diffstat (limited to 'evutil.h')
-rw-r--r-- | evutil.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/evutil.h b/evutil.h new file mode 100644 index 00000000..10cb4171 --- /dev/null +++ b/evutil.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2007 Niels Provos <provos@citi.umich.edu> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _EVUTIL_H_ +#define _EVUTIL_H_ + +/** @file evutil.h + + Common convenience functions for cross-platform portability and + related socket manipulations. + + */ + +#ifdef __cplusplus +extern "C" { +#endif + +int evutil_socketpair(int d, int type, int protocol, int sv[2]); +int evutil_make_socket_nonblocking(int sock); +#ifdef WIN32 +#define EVUTIL_CLOSESOCKET(s) closesocket(s) +#else +#define EVUTIL_CLOSESOCKET(s) close(s) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _EVUTIL_H_ */ |