|
||||
File indexing completed on 2025-01-18 09:57:11
0001 /* 0002 * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu> 0003 * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 0004 * 0005 * Redistribution and use in source and binary forms, with or without 0006 * modification, are permitted provided that the following conditions 0007 * are met: 0008 * 1. Redistributions of source code must retain the above copyright 0009 * notice, this list of conditions and the following disclaimer. 0010 * 2. Redistributions in binary form must reproduce the above copyright 0011 * notice, this list of conditions and the following disclaimer in the 0012 * documentation and/or other materials provided with the distribution. 0013 * 3. The name of the author may not be used to endorse or promote products 0014 * derived from this software without specific prior written permission. 0015 * 0016 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 0017 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 0018 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 0019 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 0020 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 0021 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 0022 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 0023 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 0024 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 0025 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 0026 */ 0027 #ifndef EVENT2_BUFFEREVENT_STRUCT_H_INCLUDED_ 0028 #define EVENT2_BUFFEREVENT_STRUCT_H_INCLUDED_ 0029 0030 /** @file event2/bufferevent_struct.h 0031 0032 Data structures for bufferevents. Using these structures may hurt forward 0033 compatibility with later versions of Libevent: be careful! 0034 0035 @deprecated Use of bufferevent_struct.h is completely deprecated; these 0036 structures are only exposed for backward compatibility with programs 0037 written before Libevent 2.0 that used them. 0038 */ 0039 0040 #ifdef __cplusplus 0041 extern "C" { 0042 #endif 0043 0044 #include <event2/event-config.h> 0045 #ifdef EVENT__HAVE_SYS_TYPES_H 0046 #include <sys/types.h> 0047 #endif 0048 #ifdef EVENT__HAVE_SYS_TIME_H 0049 #include <sys/time.h> 0050 #endif 0051 0052 /* For int types. */ 0053 #include <event2/util.h> 0054 /* For struct event */ 0055 #include <event2/event_struct.h> 0056 0057 struct event_watermark { 0058 size_t low; 0059 size_t high; 0060 }; 0061 0062 /** 0063 Shared implementation of a bufferevent. 0064 0065 This type is exposed only because it was exposed in previous versions, 0066 and some people's code may rely on manipulating it. Otherwise, you 0067 should really not rely on the layout, size, or contents of this structure: 0068 it is fairly volatile, and WILL change in future versions of the code. 0069 **/ 0070 struct bufferevent { 0071 /** Event base for which this bufferevent was created. */ 0072 struct event_base *ev_base; 0073 /** Pointer to a table of function pointers to set up how this 0074 bufferevent behaves. */ 0075 const struct bufferevent_ops *be_ops; 0076 0077 /** A read event that triggers when a timeout has happened or a socket 0078 is ready to read data. Only used by some subtypes of 0079 bufferevent. */ 0080 struct event ev_read; 0081 /** A write event that triggers when a timeout has happened or a socket 0082 is ready to write data. Only used by some subtypes of 0083 bufferevent. */ 0084 struct event ev_write; 0085 0086 /** An input buffer. Only the bufferevent is allowed to add data to 0087 this buffer, though the user is allowed to drain it. */ 0088 struct evbuffer *input; 0089 0090 /** An input buffer. Only the bufferevent is allowed to drain data 0091 from this buffer, though the user is allowed to add it. */ 0092 struct evbuffer *output; 0093 0094 struct event_watermark wm_read; 0095 struct event_watermark wm_write; 0096 0097 bufferevent_data_cb readcb; 0098 bufferevent_data_cb writecb; 0099 /* This should be called 'eventcb', but renaming it would break 0100 * backward compatibility */ 0101 bufferevent_event_cb errorcb; 0102 void *cbarg; 0103 0104 struct timeval timeout_read; 0105 struct timeval timeout_write; 0106 0107 /** Events that are currently enabled: currently EV_READ and EV_WRITE 0108 are supported. */ 0109 short enabled; 0110 }; 0111 0112 #ifdef __cplusplus 0113 } 0114 #endif 0115 0116 #endif /* EVENT2_BUFFEREVENT_STRUCT_H_INCLUDED_ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |