11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 streamingnology Inc
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Http Server
2 |
3 | Http Server for Android is an open source software under MIT licese.
4 |
5 | Thanks to [libevent](http://libevent.org/), [RapidJSON](https://github.com/Tencent/rapidjson), [android-folder-picker-library](https://github.com/kashifo/android-folder-picker-library) and [android-cmake](https://github.com/taka-no-me/android-cmake).
6 |
7 | ### For developer
8 |
9 | **NDK** is used to develop this software, and for convenience I choose **C++ 11** standard to program. So you should choose **NDK** support **C++ 11**.
10 |
11 | ### Download and Install
12 |
13 | From [Google Play Store](https://play.google.com/store/apps/details?id=com.streamingnology.httpserver) or download [Android APK](https://github.com/streamingnology/HTTP-Server/releases)
14 |
15 | ### Support or Contact
16 |
17 | If you encounter an bug, You can fire an issue at GitHub. I will fix it as soon as possible.
18 |
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-modernist
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # For more information about using CMake with Android Studio, read the
2 | # documentation: https://d.android.com/studio/projects/add-native-code.html
3 |
4 | # Sets the minimum version of CMake required to build the native library.
5 |
6 | cmake_minimum_required(VERSION 3.4.1)
7 |
8 | set(NOCOMPANY_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../)
9 | set(STATIC_LIBS_DIR ${NOCOMPANY_SOURCE_DIR}/app/libs)
10 |
11 | # Creates and names a library, sets it as either STATIC
12 | # or SHARED, and provides the relative paths to its source code.
13 | # You can define multiple libraries, and CMake builds them for you.
14 | # Gradle automatically packages shared libraries with your APK.
15 |
16 | add_library( # Sets the name of the library.
17 | httpserver-jni
18 |
19 | # Sets the library as a shared library.
20 | SHARED
21 |
22 | # Provides a relative path to your source file(s).
23 | src/main/cpp/HttpServer.cpp
24 | src/main/cpp/Log.cpp
25 | src/main/cpp/MageResults.cpp
26 | src/main/cpp/IHttpServer.cpp
27 | src/main/cpp/HttpServerJNI.cpp
28 | )
29 |
30 | include_directories(
31 | include/${ANDROID_ABI}
32 | ../third-party/rapidjson/include
33 | )
34 |
35 | # Searches for a specified prebuilt library and stores the path as a
36 | # variable. Because CMake includes system libraries in the search path by
37 | # default, you only need to specify the name of the public NDK library
38 | # you want to add. CMake verifies that the library exists before
39 | # completing its build.
40 |
41 | find_library( # Sets the name of the path variable.
42 | log-lib
43 |
44 | # Specifies the name of the NDK library that
45 | # you want CMake to locate.
46 | log )
47 |
48 | add_library(event SHARED IMPORTED GLOBAL)
49 | set_property(TARGET event PROPERTY IMPORTED_LOCATION ${STATIC_LIBS_DIR}/${ANDROID_ABI}/libevent.so)
50 |
51 | # Specifies libraries CMake should link to your target library. You
52 | # can link multiple libraries, such as libraries you define in this
53 | # build script, prebuilt third-party libraries, or system libraries.
54 |
55 | target_link_libraries( # Specifies the target library.
56 | httpserver-jni
57 | event
58 | ${log-lib} )
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 27
5 | defaultConfig {
6 | applicationId "com.streamingnology.httpserver"
7 | minSdkVersion 14
8 | targetSdkVersion 27
9 | versionCode 1
10 | versionName "1.0"
11 | externalNativeBuild {
12 | cmake {
13 | cppFlags "-std=c++11"
14 | }
15 | }
16 | }
17 | externalNativeBuild {
18 | cmake {
19 | path "CMakeLists.txt"
20 | }
21 | }
22 | sourceSets.main {
23 | jniLibs.srcDir 'libs'
24 | }
25 | buildTypes {
26 | release {
27 | minifyEnabled false
28 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
29 | }
30 | }
31 | }
32 |
33 | dependencies {
34 | implementation fileTree(dir: 'libs', include: ['*.jar'])
35 | implementation 'com.android.support:appcompat-v7:27.1.0'
36 | implementation 'com.android.support:design:27.1.0'
37 | implementation 'com.android.support.constraint:constraint-layout:1.0.2'
38 | implementation 'com.google.firebase:firebase-ads:11.8.0'
39 | implementation 'lib.kashif:folderpicker:2.2'
40 | }
41 |
--------------------------------------------------------------------------------
/app/include/arm64-v8a/event2/buffer_compat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions
6 | * are met:
7 | * 1. Redistributions of source code must retain the above copyright
8 | * notice, this list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright
10 | * notice, this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. The name of the author may not be used to endorse or promote products
13 | * derived from this software without specific prior written permission.
14 | *
15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 | */
26 |
27 | #ifndef EVENT2_BUFFER_COMPAT_H_INCLUDED_
28 | #define EVENT2_BUFFER_COMPAT_H_INCLUDED_
29 |
30 | #include
31 |
32 | /** @file event2/buffer_compat.h
33 |
34 | Obsolete and deprecated versions of the functions in buffer.h: provided
35 | only for backward compatibility.
36 | */
37 |
38 |
39 | /**
40 | Obsolete alias for evbuffer_readln(buffer, NULL, EVBUFFER_EOL_ANY).
41 |
42 | @deprecated This function is deprecated because its behavior is not correct
43 | for almost any protocol, and also because it's wholly subsumed by
44 | evbuffer_readln().
45 |
46 | @param buffer the evbuffer to read from
47 | @return pointer to a single line, or NULL if an error occurred
48 |
49 | */
50 | EVENT2_EXPORT_SYMBOL
51 | char *evbuffer_readline(struct evbuffer *buffer);
52 |
53 | /** Type definition for a callback that is invoked whenever data is added or
54 | removed from an evbuffer.
55 |
56 | An evbuffer may have one or more callbacks set at a time. The order
57 | in which they are executed is undefined.
58 |
59 | A callback function may add more callbacks, or remove itself from the
60 | list of callbacks, or add or remove data from the buffer. It may not
61 | remove another callback from the list.
62 |
63 | If a callback adds or removes data from the buffer or from another
64 | buffer, this can cause a recursive invocation of your callback or
65 | other callbacks. If you ask for an infinite loop, you might just get
66 | one: watch out!
67 |
68 | @param buffer the buffer whose size has changed
69 | @param old_len the previous length of the buffer
70 | @param new_len the current length of the buffer
71 | @param arg a pointer to user data
72 | */
73 | typedef void (*evbuffer_cb)(struct evbuffer *buffer, size_t old_len, size_t new_len, void *arg);
74 |
75 | /**
76 | Replace all callbacks on an evbuffer with a single new callback, or
77 | remove them.
78 |
79 | Subsequent calls to evbuffer_setcb() replace callbacks set by previous
80 | calls. Setting the callback to NULL removes any previously set callback.
81 |
82 | @deprecated This function is deprecated because it clears all previous
83 | callbacks set on the evbuffer, which can cause confusing behavior if
84 | multiple parts of the code all want to add their own callbacks on a
85 | buffer. Instead, use evbuffer_add(), evbuffer_del(), and
86 | evbuffer_setflags() to manage your own evbuffer callbacks without
87 | interfering with callbacks set by others.
88 |
89 | @param buffer the evbuffer to be monitored
90 | @param cb the callback function to invoke when the evbuffer is modified,
91 | or NULL to remove all callbacks.
92 | @param cbarg an argument to be provided to the callback function
93 | */
94 | EVENT2_EXPORT_SYMBOL
95 | void evbuffer_setcb(struct evbuffer *buffer, evbuffer_cb cb, void *cbarg);
96 |
97 |
98 | /**
99 | Find a string within an evbuffer.
100 |
101 | @param buffer the evbuffer to be searched
102 | @param what the string to be searched for
103 | @param len the length of the search string
104 | @return a pointer to the beginning of the search string, or NULL if the search failed.
105 | */
106 | EVENT2_EXPORT_SYMBOL
107 | unsigned char *evbuffer_find(struct evbuffer *buffer, const unsigned char *what, size_t len);
108 |
109 | /** deprecated in favor of calling the functions directly */
110 | #define EVBUFFER_LENGTH(x) evbuffer_get_length(x)
111 | /** deprecated in favor of calling the functions directly */
112 | #define EVBUFFER_DATA(x) evbuffer_pullup((x), -1)
113 |
114 | #endif
115 |
116 |
--------------------------------------------------------------------------------
/app/include/arm64-v8a/event2/bufferevent_compat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2007-2012 Niels Provos, Nick Mathewson
3 | * Copyright (c) 2000-2007 Niels Provos
4 | * All rights reserved.
5 | *
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions
8 | * are met:
9 | * 1. Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | * 2. Redistributions in binary form must reproduce the above copyright
12 | * notice, this list of conditions and the following disclaimer in the
13 | * documentation and/or other materials provided with the distribution.
14 | * 3. The name of the author may not be used to endorse or promote products
15 | * derived from this software without specific prior written permission.
16 | *
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 | */
28 | #ifndef EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_
29 | #define EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_
30 |
31 | #define evbuffercb bufferevent_data_cb
32 | #define everrorcb bufferevent_event_cb
33 |
34 | /**
35 | Create a new bufferevent for an fd.
36 |
37 | This function is deprecated. Use bufferevent_socket_new and
38 | bufferevent_set_callbacks instead.
39 |
40 | Libevent provides an abstraction on top of the regular event callbacks.
41 | This abstraction is called a buffered event. A buffered event provides
42 | input and output buffers that get filled and drained automatically. The
43 | user of a buffered event no longer deals directly with the I/O, but
44 | instead is reading from input and writing to output buffers.
45 |
46 | Once initialized, the bufferevent structure can be used repeatedly with
47 | bufferevent_enable() and bufferevent_disable().
48 |
49 | When read enabled the bufferevent will try to read from the file descriptor
50 | and call the read callback. The write callback is executed whenever the
51 | output buffer is drained below the write low watermark, which is 0 by
52 | default.
53 |
54 | If multiple bases are in use, bufferevent_base_set() must be called before
55 | enabling the bufferevent for the first time.
56 |
57 | @deprecated This function is deprecated because it uses the current
58 | event base, and as such can be error prone for multithreaded programs.
59 | Use bufferevent_socket_new() instead.
60 |
61 | @param fd the file descriptor from which data is read and written to.
62 | This file descriptor is not allowed to be a pipe(2).
63 | @param readcb callback to invoke when there is data to be read, or NULL if
64 | no callback is desired
65 | @param writecb callback to invoke when the file descriptor is ready for
66 | writing, or NULL if no callback is desired
67 | @param errorcb callback to invoke when there is an error on the file
68 | descriptor
69 | @param cbarg an argument that will be supplied to each of the callbacks
70 | (readcb, writecb, and errorcb)
71 | @return a pointer to a newly allocated bufferevent struct, or NULL if an
72 | error occurred
73 | @see bufferevent_base_set(), bufferevent_free()
74 | */
75 | struct bufferevent *bufferevent_new(evutil_socket_t fd,
76 | evbuffercb readcb, evbuffercb writecb, everrorcb errorcb, void *cbarg);
77 |
78 |
79 | /**
80 | Set the read and write timeout for a buffered event.
81 |
82 | @param bufev the bufferevent to be modified
83 | @param timeout_read the read timeout
84 | @param timeout_write the write timeout
85 | */
86 | void bufferevent_settimeout(struct bufferevent *bufev,
87 | int timeout_read, int timeout_write);
88 |
89 | #define EVBUFFER_READ BEV_EVENT_READING
90 | #define EVBUFFER_WRITE BEV_EVENT_WRITING
91 | #define EVBUFFER_EOF BEV_EVENT_EOF
92 | #define EVBUFFER_ERROR BEV_EVENT_ERROR
93 | #define EVBUFFER_TIMEOUT BEV_EVENT_TIMEOUT
94 |
95 | /** macro for getting access to the input buffer of a bufferevent */
96 | #define EVBUFFER_INPUT(x) bufferevent_get_input(x)
97 | /** macro for getting access to the output buffer of a bufferevent */
98 | #define EVBUFFER_OUTPUT(x) bufferevent_get_output(x)
99 |
100 | #endif
101 |
--------------------------------------------------------------------------------
/app/include/arm64-v8a/event2/bufferevent_struct.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2000-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_BUFFEREVENT_STRUCT_H_INCLUDED_
28 | #define EVENT2_BUFFEREVENT_STRUCT_H_INCLUDED_
29 |
30 | /** @file event2/bufferevent_struct.h
31 |
32 | Data structures for bufferevents. Using these structures may hurt forward
33 | compatibility with later versions of Libevent: be careful!
34 |
35 | @deprecated Use of bufferevent_struct.h is completely deprecated; these
36 | structures are only exposed for backward compatibility with programs
37 | written before Libevent 2.0 that used them.
38 | */
39 |
40 | #ifdef __cplusplus
41 | extern "C" {
42 | #endif
43 |
44 | #include
45 | #ifdef EVENT__HAVE_SYS_TYPES_H
46 | #include
47 | #endif
48 | #ifdef EVENT__HAVE_SYS_TIME_H
49 | #include
50 | #endif
51 |
52 | /* For int types. */
53 | #include
54 | /* For struct event */
55 | #include
56 |
57 | struct event_watermark {
58 | size_t low;
59 | size_t high;
60 | };
61 |
62 | /**
63 | Shared implementation of a bufferevent.
64 |
65 | This type is exposed only because it was exposed in previous versions,
66 | and some people's code may rely on manipulating it. Otherwise, you
67 | should really not rely on the layout, size, or contents of this structure:
68 | it is fairly volatile, and WILL change in future versions of the code.
69 | **/
70 | struct bufferevent {
71 | /** Event base for which this bufferevent was created. */
72 | struct event_base *ev_base;
73 | /** Pointer to a table of function pointers to set up how this
74 | bufferevent behaves. */
75 | const struct bufferevent_ops *be_ops;
76 |
77 | /** A read event that triggers when a timeout has happened or a socket
78 | is ready to read data. Only used by some subtypes of
79 | bufferevent. */
80 | struct event ev_read;
81 | /** A write event that triggers when a timeout has happened or a socket
82 | is ready to write data. Only used by some subtypes of
83 | bufferevent. */
84 | struct event ev_write;
85 |
86 | /** An input buffer. Only the bufferevent is allowed to add data to
87 | this buffer, though the user is allowed to drain it. */
88 | struct evbuffer *input;
89 |
90 | /** An input buffer. Only the bufferevent is allowed to drain data
91 | from this buffer, though the user is allowed to add it. */
92 | struct evbuffer *output;
93 |
94 | struct event_watermark wm_read;
95 | struct event_watermark wm_write;
96 |
97 | bufferevent_data_cb readcb;
98 | bufferevent_data_cb writecb;
99 | /* This should be called 'eventcb', but renaming it would break
100 | * backward compatibility */
101 | bufferevent_event_cb errorcb;
102 | void *cbarg;
103 |
104 | struct timeval timeout_read;
105 | struct timeval timeout_write;
106 |
107 | /** Events that are currently enabled: currently EV_READ and EV_WRITE
108 | are supported. */
109 | short enabled;
110 | };
111 |
112 | #ifdef __cplusplus
113 | }
114 | #endif
115 |
116 | #endif /* EVENT2_BUFFEREVENT_STRUCT_H_INCLUDED_ */
117 |
--------------------------------------------------------------------------------
/app/include/arm64-v8a/event2/dns_struct.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2000-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_DNS_STRUCT_H_INCLUDED_
28 | #define EVENT2_DNS_STRUCT_H_INCLUDED_
29 |
30 | /** @file event2/dns_struct.h
31 |
32 | Data structures for dns. Using these structures may hurt forward
33 | compatibility with later versions of Libevent: be careful!
34 |
35 | */
36 |
37 | #ifdef __cplusplus
38 | extern "C" {
39 | #endif
40 |
41 | #include
42 | #ifdef EVENT__HAVE_SYS_TYPES_H
43 | #include
44 | #endif
45 | #ifdef EVENT__HAVE_SYS_TIME_H
46 | #include
47 | #endif
48 |
49 | /* For int types. */
50 | #include
51 |
52 | /*
53 | * Structures used to implement a DNS server.
54 | */
55 |
56 | struct evdns_server_request {
57 | int flags;
58 | int nquestions;
59 | struct evdns_server_question **questions;
60 | };
61 | struct evdns_server_question {
62 | int type;
63 | #ifdef __cplusplus
64 | int dns_question_class;
65 | #else
66 | /* You should refer to this field as "dns_question_class". The
67 | * name "class" works in C for backward compatibility, and will be
68 | * removed in a future version. (1.5 or later). */
69 | int class;
70 | #define dns_question_class class
71 | #endif
72 | char name[1];
73 | };
74 |
75 | #ifdef __cplusplus
76 | }
77 | #endif
78 |
79 | #endif /* EVENT2_DNS_STRUCT_H_INCLUDED_ */
80 |
81 |
--------------------------------------------------------------------------------
/app/include/arm64-v8a/event2/http_compat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2000-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_HTTP_COMPAT_H_INCLUDED_
28 | #define EVENT2_HTTP_COMPAT_H_INCLUDED_
29 |
30 | /** @file event2/http_compat.h
31 |
32 | Potentially non-threadsafe versions of the functions in http.h: provided
33 | only for backwards compatibility.
34 |
35 | */
36 |
37 | #ifdef __cplusplus
38 | extern "C" {
39 | #endif
40 |
41 | #include
42 | #ifdef EVENT__HAVE_SYS_TYPES_H
43 | #include
44 | #endif
45 | #ifdef EVENT__HAVE_SYS_TIME_H
46 | #include
47 | #endif
48 |
49 | /* For int types. */
50 | #include
51 |
52 | /**
53 | * Start an HTTP server on the specified address and port
54 | *
55 | * @deprecated It does not allow an event base to be specified
56 | *
57 | * @param address the address to which the HTTP server should be bound
58 | * @param port the port number on which the HTTP server should listen
59 | * @return an struct evhttp object
60 | */
61 | struct evhttp *evhttp_start(const char *address, ev_uint16_t port);
62 |
63 | /**
64 | * A connection object that can be used to for making HTTP requests. The
65 | * connection object tries to establish the connection when it is given an
66 | * http request object.
67 | *
68 | * @deprecated It does not allow an event base to be specified
69 | */
70 | struct evhttp_connection *evhttp_connection_new(
71 | const char *address, ev_uint16_t port);
72 |
73 | /**
74 | * Associates an event base with the connection - can only be called
75 | * on a freshly created connection object that has not been used yet.
76 | *
77 | * @deprecated XXXX Why?
78 | */
79 | void evhttp_connection_set_base(struct evhttp_connection *evcon,
80 | struct event_base *base);
81 |
82 |
83 | /** Returns the request URI */
84 | #define evhttp_request_uri evhttp_request_get_uri
85 |
86 | #ifdef __cplusplus
87 | }
88 | #endif
89 |
90 | #endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */
91 |
--------------------------------------------------------------------------------
/app/include/arm64-v8a/event2/keyvalq_struct.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2000-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_KEYVALQ_STRUCT_H_INCLUDED_
28 | #define EVENT2_KEYVALQ_STRUCT_H_INCLUDED_
29 |
30 | #ifdef __cplusplus
31 | extern "C" {
32 | #endif
33 |
34 | /* Fix so that people don't have to run with */
35 | /* XXXX This code is duplicated with event_struct.h */
36 | #ifndef TAILQ_ENTRY
37 | #define EVENT_DEFINED_TQENTRY_
38 | #define TAILQ_ENTRY(type) \
39 | struct { \
40 | struct type *tqe_next; /* next element */ \
41 | struct type **tqe_prev; /* address of previous next element */ \
42 | }
43 | #endif /* !TAILQ_ENTRY */
44 |
45 | #ifndef TAILQ_HEAD
46 | #define EVENT_DEFINED_TQHEAD_
47 | #define TAILQ_HEAD(name, type) \
48 | struct name { \
49 | struct type *tqh_first; \
50 | struct type **tqh_last; \
51 | }
52 | #endif
53 |
54 | /*
55 | * Key-Value pairs. Can be used for HTTP headers but also for
56 | * query argument parsing.
57 | */
58 | struct evkeyval {
59 | TAILQ_ENTRY(evkeyval) next;
60 |
61 | char *key;
62 | char *value;
63 | };
64 |
65 | TAILQ_HEAD (evkeyvalq, evkeyval);
66 |
67 | /* XXXX This code is duplicated with event_struct.h */
68 | #ifdef EVENT_DEFINED_TQENTRY_
69 | #undef TAILQ_ENTRY
70 | #endif
71 |
72 | #ifdef EVENT_DEFINED_TQHEAD_
73 | #undef TAILQ_HEAD
74 | #endif
75 |
76 | #ifdef __cplusplus
77 | }
78 | #endif
79 |
80 | #endif
81 |
--------------------------------------------------------------------------------
/app/include/arm64-v8a/event2/rpc_compat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_RPC_COMPAT_H_INCLUDED_
28 | #define EVENT2_RPC_COMPAT_H_INCLUDED_
29 |
30 | /** @file event2/rpc_compat.h
31 |
32 | Deprecated versions of the functions in rpc.h: provided only for
33 | backwards compatibility.
34 |
35 | */
36 |
37 | #ifdef __cplusplus
38 | extern "C" {
39 | #endif
40 |
41 | /** backwards compatible accessors that work only with gcc */
42 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
43 |
44 | #undef EVTAG_ASSIGN
45 | #undef EVTAG_GET
46 | #undef EVTAG_ADD
47 |
48 | #define EVTAG_ASSIGN(msg, member, args...) \
49 | (*(msg)->base->member##_assign)(msg, ## args)
50 | #define EVTAG_GET(msg, member, args...) \
51 | (*(msg)->base->member##_get)(msg, ## args)
52 | #define EVTAG_ADD(msg, member, args...) \
53 | (*(msg)->base->member##_add)(msg, ## args)
54 | #endif
55 | #define EVTAG_LEN(msg, member) ((msg)->member##_length)
56 |
57 | #ifdef __cplusplus
58 | }
59 | #endif
60 |
61 | #endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */
62 |
--------------------------------------------------------------------------------
/app/include/arm64-v8a/event2/rpc_struct.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_RPC_STRUCT_H_INCLUDED_
28 | #define EVENT2_RPC_STRUCT_H_INCLUDED_
29 |
30 | #ifdef __cplusplus
31 | extern "C" {
32 | #endif
33 |
34 | /** @file event2/rpc_struct.h
35 |
36 | Structures used by rpc.h. Using these structures directly may harm
37 | forward compatibility: be careful!
38 |
39 | */
40 |
41 | /**
42 | * provides information about the completed RPC request.
43 | */
44 | struct evrpc_status {
45 | #define EVRPC_STATUS_ERR_NONE 0
46 | #define EVRPC_STATUS_ERR_TIMEOUT 1
47 | #define EVRPC_STATUS_ERR_BADPAYLOAD 2
48 | #define EVRPC_STATUS_ERR_UNSTARTED 3
49 | #define EVRPC_STATUS_ERR_HOOKABORTED 4
50 | int error;
51 |
52 | /* for looking at headers or other information */
53 | struct evhttp_request *http_req;
54 | };
55 |
56 | /* the structure below needs to be synchronized with evrpc_req_generic */
57 |
58 | /* Encapsulates a request */
59 | struct evrpc {
60 | TAILQ_ENTRY(evrpc) next;
61 |
62 | /* the URI at which the request handler lives */
63 | const char* uri;
64 |
65 | /* creates a new request structure */
66 | void *(*request_new)(void *);
67 | void *request_new_arg;
68 |
69 | /* frees the request structure */
70 | void (*request_free)(void *);
71 |
72 | /* unmarshals the buffer into the proper request structure */
73 | int (*request_unmarshal)(void *, struct evbuffer *);
74 |
75 | /* creates a new reply structure */
76 | void *(*reply_new)(void *);
77 | void *reply_new_arg;
78 |
79 | /* frees the reply structure */
80 | void (*reply_free)(void *);
81 |
82 | /* verifies that the reply is valid */
83 | int (*reply_complete)(void *);
84 |
85 | /* marshals the reply into a buffer */
86 | void (*reply_marshal)(struct evbuffer*, void *);
87 |
88 | /* the callback invoked for each received rpc */
89 | void (*cb)(struct evrpc_req_generic *, void *);
90 | void *cb_arg;
91 |
92 | /* reference for further configuration */
93 | struct evrpc_base *base;
94 | };
95 |
96 | #ifdef __cplusplus
97 | }
98 | #endif
99 |
100 | #endif /* EVENT2_RPC_STRUCT_H_INCLUDED_ */
101 |
--------------------------------------------------------------------------------
/app/include/arm64-v8a/event2/tag_compat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2000-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_TAG_COMPAT_H_INCLUDED_
28 | #define EVENT2_TAG_COMPAT_H_INCLUDED_
29 |
30 | /** @file event2/tag_compat.h
31 |
32 | Obsolete/deprecated functions from tag.h; provided only for backwards
33 | compatibility.
34 | */
35 |
36 | /**
37 | @name Misnamed functions
38 |
39 | @deprecated These macros are deprecated because their names don't follow
40 | Libevent's naming conventions. Use evtag_encode_int and
41 | evtag_encode_int64 instead.
42 |
43 | @{
44 | */
45 | #define encode_int(evbuf, number) evtag_encode_int((evbuf), (number))
46 | #define encode_int64(evbuf, number) evtag_encode_int64((evbuf), (number))
47 | /**@}*/
48 |
49 | #endif /* EVENT2_TAG_H_INCLUDED_ */
50 |
--------------------------------------------------------------------------------
/app/include/arm64-v8a/event2/visibility.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 | /*
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_VISIBILITY_H_INCLUDED_
28 | #define EVENT2_VISIBILITY_H_INCLUDED_
29 |
30 | #include
31 |
32 | #if defined(event_EXPORTS) || defined(event_extra_EXPORTS) || defined(event_core_EXPORTS)
33 | # if defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550)
34 | # define EVENT2_EXPORT_SYMBOL __global
35 | # elif defined __GNUC__
36 | # define EVENT2_EXPORT_SYMBOL __attribute__ ((visibility("default")))
37 | # elif defined(_MSC_VER)
38 | # define EVENT2_EXPORT_SYMBOL extern __declspec(dllexport)
39 | # else
40 | # define EVENT2_EXPORT_SYMBOL /* unknown compiler */
41 | # endif
42 | #else
43 | # if defined(EVENT__NEED_DLLIMPORT) && defined(_MSC_VER) && !defined(EVENT_BUILDING_REGRESS_TEST)
44 | # define EVENT2_EXPORT_SYMBOL extern __declspec(dllimport)
45 | # else
46 | # define EVENT2_EXPORT_SYMBOL
47 | # endif
48 | #endif
49 |
50 | #endif /* EVENT2_VISIBILITY_H_INCLUDED_ */
51 |
--------------------------------------------------------------------------------
/app/include/armeabi-v7a/event2/buffer_compat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions
6 | * are met:
7 | * 1. Redistributions of source code must retain the above copyright
8 | * notice, this list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright
10 | * notice, this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. The name of the author may not be used to endorse or promote products
13 | * derived from this software without specific prior written permission.
14 | *
15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 | */
26 |
27 | #ifndef EVENT2_BUFFER_COMPAT_H_INCLUDED_
28 | #define EVENT2_BUFFER_COMPAT_H_INCLUDED_
29 |
30 | #include
31 |
32 | /** @file event2/buffer_compat.h
33 |
34 | Obsolete and deprecated versions of the functions in buffer.h: provided
35 | only for backward compatibility.
36 | */
37 |
38 |
39 | /**
40 | Obsolete alias for evbuffer_readln(buffer, NULL, EVBUFFER_EOL_ANY).
41 |
42 | @deprecated This function is deprecated because its behavior is not correct
43 | for almost any protocol, and also because it's wholly subsumed by
44 | evbuffer_readln().
45 |
46 | @param buffer the evbuffer to read from
47 | @return pointer to a single line, or NULL if an error occurred
48 |
49 | */
50 | EVENT2_EXPORT_SYMBOL
51 | char *evbuffer_readline(struct evbuffer *buffer);
52 |
53 | /** Type definition for a callback that is invoked whenever data is added or
54 | removed from an evbuffer.
55 |
56 | An evbuffer may have one or more callbacks set at a time. The order
57 | in which they are executed is undefined.
58 |
59 | A callback function may add more callbacks, or remove itself from the
60 | list of callbacks, or add or remove data from the buffer. It may not
61 | remove another callback from the list.
62 |
63 | If a callback adds or removes data from the buffer or from another
64 | buffer, this can cause a recursive invocation of your callback or
65 | other callbacks. If you ask for an infinite loop, you might just get
66 | one: watch out!
67 |
68 | @param buffer the buffer whose size has changed
69 | @param old_len the previous length of the buffer
70 | @param new_len the current length of the buffer
71 | @param arg a pointer to user data
72 | */
73 | typedef void (*evbuffer_cb)(struct evbuffer *buffer, size_t old_len, size_t new_len, void *arg);
74 |
75 | /**
76 | Replace all callbacks on an evbuffer with a single new callback, or
77 | remove them.
78 |
79 | Subsequent calls to evbuffer_setcb() replace callbacks set by previous
80 | calls. Setting the callback to NULL removes any previously set callback.
81 |
82 | @deprecated This function is deprecated because it clears all previous
83 | callbacks set on the evbuffer, which can cause confusing behavior if
84 | multiple parts of the code all want to add their own callbacks on a
85 | buffer. Instead, use evbuffer_add(), evbuffer_del(), and
86 | evbuffer_setflags() to manage your own evbuffer callbacks without
87 | interfering with callbacks set by others.
88 |
89 | @param buffer the evbuffer to be monitored
90 | @param cb the callback function to invoke when the evbuffer is modified,
91 | or NULL to remove all callbacks.
92 | @param cbarg an argument to be provided to the callback function
93 | */
94 | EVENT2_EXPORT_SYMBOL
95 | void evbuffer_setcb(struct evbuffer *buffer, evbuffer_cb cb, void *cbarg);
96 |
97 |
98 | /**
99 | Find a string within an evbuffer.
100 |
101 | @param buffer the evbuffer to be searched
102 | @param what the string to be searched for
103 | @param len the length of the search string
104 | @return a pointer to the beginning of the search string, or NULL if the search failed.
105 | */
106 | EVENT2_EXPORT_SYMBOL
107 | unsigned char *evbuffer_find(struct evbuffer *buffer, const unsigned char *what, size_t len);
108 |
109 | /** deprecated in favor of calling the functions directly */
110 | #define EVBUFFER_LENGTH(x) evbuffer_get_length(x)
111 | /** deprecated in favor of calling the functions directly */
112 | #define EVBUFFER_DATA(x) evbuffer_pullup((x), -1)
113 |
114 | #endif
115 |
116 |
--------------------------------------------------------------------------------
/app/include/armeabi-v7a/event2/bufferevent_compat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2007-2012 Niels Provos, Nick Mathewson
3 | * Copyright (c) 2000-2007 Niels Provos
4 | * All rights reserved.
5 | *
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions
8 | * are met:
9 | * 1. Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | * 2. Redistributions in binary form must reproduce the above copyright
12 | * notice, this list of conditions and the following disclaimer in the
13 | * documentation and/or other materials provided with the distribution.
14 | * 3. The name of the author may not be used to endorse or promote products
15 | * derived from this software without specific prior written permission.
16 | *
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 | */
28 | #ifndef EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_
29 | #define EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_
30 |
31 | #define evbuffercb bufferevent_data_cb
32 | #define everrorcb bufferevent_event_cb
33 |
34 | /**
35 | Create a new bufferevent for an fd.
36 |
37 | This function is deprecated. Use bufferevent_socket_new and
38 | bufferevent_set_callbacks instead.
39 |
40 | Libevent provides an abstraction on top of the regular event callbacks.
41 | This abstraction is called a buffered event. A buffered event provides
42 | input and output buffers that get filled and drained automatically. The
43 | user of a buffered event no longer deals directly with the I/O, but
44 | instead is reading from input and writing to output buffers.
45 |
46 | Once initialized, the bufferevent structure can be used repeatedly with
47 | bufferevent_enable() and bufferevent_disable().
48 |
49 | When read enabled the bufferevent will try to read from the file descriptor
50 | and call the read callback. The write callback is executed whenever the
51 | output buffer is drained below the write low watermark, which is 0 by
52 | default.
53 |
54 | If multiple bases are in use, bufferevent_base_set() must be called before
55 | enabling the bufferevent for the first time.
56 |
57 | @deprecated This function is deprecated because it uses the current
58 | event base, and as such can be error prone for multithreaded programs.
59 | Use bufferevent_socket_new() instead.
60 |
61 | @param fd the file descriptor from which data is read and written to.
62 | This file descriptor is not allowed to be a pipe(2).
63 | @param readcb callback to invoke when there is data to be read, or NULL if
64 | no callback is desired
65 | @param writecb callback to invoke when the file descriptor is ready for
66 | writing, or NULL if no callback is desired
67 | @param errorcb callback to invoke when there is an error on the file
68 | descriptor
69 | @param cbarg an argument that will be supplied to each of the callbacks
70 | (readcb, writecb, and errorcb)
71 | @return a pointer to a newly allocated bufferevent struct, or NULL if an
72 | error occurred
73 | @see bufferevent_base_set(), bufferevent_free()
74 | */
75 | struct bufferevent *bufferevent_new(evutil_socket_t fd,
76 | evbuffercb readcb, evbuffercb writecb, everrorcb errorcb, void *cbarg);
77 |
78 |
79 | /**
80 | Set the read and write timeout for a buffered event.
81 |
82 | @param bufev the bufferevent to be modified
83 | @param timeout_read the read timeout
84 | @param timeout_write the write timeout
85 | */
86 | void bufferevent_settimeout(struct bufferevent *bufev,
87 | int timeout_read, int timeout_write);
88 |
89 | #define EVBUFFER_READ BEV_EVENT_READING
90 | #define EVBUFFER_WRITE BEV_EVENT_WRITING
91 | #define EVBUFFER_EOF BEV_EVENT_EOF
92 | #define EVBUFFER_ERROR BEV_EVENT_ERROR
93 | #define EVBUFFER_TIMEOUT BEV_EVENT_TIMEOUT
94 |
95 | /** macro for getting access to the input buffer of a bufferevent */
96 | #define EVBUFFER_INPUT(x) bufferevent_get_input(x)
97 | /** macro for getting access to the output buffer of a bufferevent */
98 | #define EVBUFFER_OUTPUT(x) bufferevent_get_output(x)
99 |
100 | #endif
101 |
--------------------------------------------------------------------------------
/app/include/armeabi-v7a/event2/bufferevent_struct.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2000-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_BUFFEREVENT_STRUCT_H_INCLUDED_
28 | #define EVENT2_BUFFEREVENT_STRUCT_H_INCLUDED_
29 |
30 | /** @file event2/bufferevent_struct.h
31 |
32 | Data structures for bufferevents. Using these structures may hurt forward
33 | compatibility with later versions of Libevent: be careful!
34 |
35 | @deprecated Use of bufferevent_struct.h is completely deprecated; these
36 | structures are only exposed for backward compatibility with programs
37 | written before Libevent 2.0 that used them.
38 | */
39 |
40 | #ifdef __cplusplus
41 | extern "C" {
42 | #endif
43 |
44 | #include
45 | #ifdef EVENT__HAVE_SYS_TYPES_H
46 | #include
47 | #endif
48 | #ifdef EVENT__HAVE_SYS_TIME_H
49 | #include
50 | #endif
51 |
52 | /* For int types. */
53 | #include
54 | /* For struct event */
55 | #include
56 |
57 | struct event_watermark {
58 | size_t low;
59 | size_t high;
60 | };
61 |
62 | /**
63 | Shared implementation of a bufferevent.
64 |
65 | This type is exposed only because it was exposed in previous versions,
66 | and some people's code may rely on manipulating it. Otherwise, you
67 | should really not rely on the layout, size, or contents of this structure:
68 | it is fairly volatile, and WILL change in future versions of the code.
69 | **/
70 | struct bufferevent {
71 | /** Event base for which this bufferevent was created. */
72 | struct event_base *ev_base;
73 | /** Pointer to a table of function pointers to set up how this
74 | bufferevent behaves. */
75 | const struct bufferevent_ops *be_ops;
76 |
77 | /** A read event that triggers when a timeout has happened or a socket
78 | is ready to read data. Only used by some subtypes of
79 | bufferevent. */
80 | struct event ev_read;
81 | /** A write event that triggers when a timeout has happened or a socket
82 | is ready to write data. Only used by some subtypes of
83 | bufferevent. */
84 | struct event ev_write;
85 |
86 | /** An input buffer. Only the bufferevent is allowed to add data to
87 | this buffer, though the user is allowed to drain it. */
88 | struct evbuffer *input;
89 |
90 | /** An input buffer. Only the bufferevent is allowed to drain data
91 | from this buffer, though the user is allowed to add it. */
92 | struct evbuffer *output;
93 |
94 | struct event_watermark wm_read;
95 | struct event_watermark wm_write;
96 |
97 | bufferevent_data_cb readcb;
98 | bufferevent_data_cb writecb;
99 | /* This should be called 'eventcb', but renaming it would break
100 | * backward compatibility */
101 | bufferevent_event_cb errorcb;
102 | void *cbarg;
103 |
104 | struct timeval timeout_read;
105 | struct timeval timeout_write;
106 |
107 | /** Events that are currently enabled: currently EV_READ and EV_WRITE
108 | are supported. */
109 | short enabled;
110 | };
111 |
112 | #ifdef __cplusplus
113 | }
114 | #endif
115 |
116 | #endif /* EVENT2_BUFFEREVENT_STRUCT_H_INCLUDED_ */
117 |
--------------------------------------------------------------------------------
/app/include/armeabi-v7a/event2/dns_struct.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2000-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_DNS_STRUCT_H_INCLUDED_
28 | #define EVENT2_DNS_STRUCT_H_INCLUDED_
29 |
30 | /** @file event2/dns_struct.h
31 |
32 | Data structures for dns. Using these structures may hurt forward
33 | compatibility with later versions of Libevent: be careful!
34 |
35 | */
36 |
37 | #ifdef __cplusplus
38 | extern "C" {
39 | #endif
40 |
41 | #include
42 | #ifdef EVENT__HAVE_SYS_TYPES_H
43 | #include
44 | #endif
45 | #ifdef EVENT__HAVE_SYS_TIME_H
46 | #include
47 | #endif
48 |
49 | /* For int types. */
50 | #include
51 |
52 | /*
53 | * Structures used to implement a DNS server.
54 | */
55 |
56 | struct evdns_server_request {
57 | int flags;
58 | int nquestions;
59 | struct evdns_server_question **questions;
60 | };
61 | struct evdns_server_question {
62 | int type;
63 | #ifdef __cplusplus
64 | int dns_question_class;
65 | #else
66 | /* You should refer to this field as "dns_question_class". The
67 | * name "class" works in C for backward compatibility, and will be
68 | * removed in a future version. (1.5 or later). */
69 | int class;
70 | #define dns_question_class class
71 | #endif
72 | char name[1];
73 | };
74 |
75 | #ifdef __cplusplus
76 | }
77 | #endif
78 |
79 | #endif /* EVENT2_DNS_STRUCT_H_INCLUDED_ */
80 |
81 |
--------------------------------------------------------------------------------
/app/include/armeabi-v7a/event2/http_compat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2000-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_HTTP_COMPAT_H_INCLUDED_
28 | #define EVENT2_HTTP_COMPAT_H_INCLUDED_
29 |
30 | /** @file event2/http_compat.h
31 |
32 | Potentially non-threadsafe versions of the functions in http.h: provided
33 | only for backwards compatibility.
34 |
35 | */
36 |
37 | #ifdef __cplusplus
38 | extern "C" {
39 | #endif
40 |
41 | #include
42 | #ifdef EVENT__HAVE_SYS_TYPES_H
43 | #include
44 | #endif
45 | #ifdef EVENT__HAVE_SYS_TIME_H
46 | #include
47 | #endif
48 |
49 | /* For int types. */
50 | #include
51 |
52 | /**
53 | * Start an HTTP server on the specified address and port
54 | *
55 | * @deprecated It does not allow an event base to be specified
56 | *
57 | * @param address the address to which the HTTP server should be bound
58 | * @param port the port number on which the HTTP server should listen
59 | * @return an struct evhttp object
60 | */
61 | struct evhttp *evhttp_start(const char *address, ev_uint16_t port);
62 |
63 | /**
64 | * A connection object that can be used to for making HTTP requests. The
65 | * connection object tries to establish the connection when it is given an
66 | * http request object.
67 | *
68 | * @deprecated It does not allow an event base to be specified
69 | */
70 | struct evhttp_connection *evhttp_connection_new(
71 | const char *address, ev_uint16_t port);
72 |
73 | /**
74 | * Associates an event base with the connection - can only be called
75 | * on a freshly created connection object that has not been used yet.
76 | *
77 | * @deprecated XXXX Why?
78 | */
79 | void evhttp_connection_set_base(struct evhttp_connection *evcon,
80 | struct event_base *base);
81 |
82 |
83 | /** Returns the request URI */
84 | #define evhttp_request_uri evhttp_request_get_uri
85 |
86 | #ifdef __cplusplus
87 | }
88 | #endif
89 |
90 | #endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */
91 |
--------------------------------------------------------------------------------
/app/include/armeabi-v7a/event2/keyvalq_struct.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2000-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_KEYVALQ_STRUCT_H_INCLUDED_
28 | #define EVENT2_KEYVALQ_STRUCT_H_INCLUDED_
29 |
30 | #ifdef __cplusplus
31 | extern "C" {
32 | #endif
33 |
34 | /* Fix so that people don't have to run with */
35 | /* XXXX This code is duplicated with event_struct.h */
36 | #ifndef TAILQ_ENTRY
37 | #define EVENT_DEFINED_TQENTRY_
38 | #define TAILQ_ENTRY(type) \
39 | struct { \
40 | struct type *tqe_next; /* next element */ \
41 | struct type **tqe_prev; /* address of previous next element */ \
42 | }
43 | #endif /* !TAILQ_ENTRY */
44 |
45 | #ifndef TAILQ_HEAD
46 | #define EVENT_DEFINED_TQHEAD_
47 | #define TAILQ_HEAD(name, type) \
48 | struct name { \
49 | struct type *tqh_first; \
50 | struct type **tqh_last; \
51 | }
52 | #endif
53 |
54 | /*
55 | * Key-Value pairs. Can be used for HTTP headers but also for
56 | * query argument parsing.
57 | */
58 | struct evkeyval {
59 | TAILQ_ENTRY(evkeyval) next;
60 |
61 | char *key;
62 | char *value;
63 | };
64 |
65 | TAILQ_HEAD (evkeyvalq, evkeyval);
66 |
67 | /* XXXX This code is duplicated with event_struct.h */
68 | #ifdef EVENT_DEFINED_TQENTRY_
69 | #undef TAILQ_ENTRY
70 | #endif
71 |
72 | #ifdef EVENT_DEFINED_TQHEAD_
73 | #undef TAILQ_HEAD
74 | #endif
75 |
76 | #ifdef __cplusplus
77 | }
78 | #endif
79 |
80 | #endif
81 |
--------------------------------------------------------------------------------
/app/include/armeabi-v7a/event2/rpc_compat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_RPC_COMPAT_H_INCLUDED_
28 | #define EVENT2_RPC_COMPAT_H_INCLUDED_
29 |
30 | /** @file event2/rpc_compat.h
31 |
32 | Deprecated versions of the functions in rpc.h: provided only for
33 | backwards compatibility.
34 |
35 | */
36 |
37 | #ifdef __cplusplus
38 | extern "C" {
39 | #endif
40 |
41 | /** backwards compatible accessors that work only with gcc */
42 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
43 |
44 | #undef EVTAG_ASSIGN
45 | #undef EVTAG_GET
46 | #undef EVTAG_ADD
47 |
48 | #define EVTAG_ASSIGN(msg, member, args...) \
49 | (*(msg)->base->member##_assign)(msg, ## args)
50 | #define EVTAG_GET(msg, member, args...) \
51 | (*(msg)->base->member##_get)(msg, ## args)
52 | #define EVTAG_ADD(msg, member, args...) \
53 | (*(msg)->base->member##_add)(msg, ## args)
54 | #endif
55 | #define EVTAG_LEN(msg, member) ((msg)->member##_length)
56 |
57 | #ifdef __cplusplus
58 | }
59 | #endif
60 |
61 | #endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */
62 |
--------------------------------------------------------------------------------
/app/include/armeabi-v7a/event2/rpc_struct.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_RPC_STRUCT_H_INCLUDED_
28 | #define EVENT2_RPC_STRUCT_H_INCLUDED_
29 |
30 | #ifdef __cplusplus
31 | extern "C" {
32 | #endif
33 |
34 | /** @file event2/rpc_struct.h
35 |
36 | Structures used by rpc.h. Using these structures directly may harm
37 | forward compatibility: be careful!
38 |
39 | */
40 |
41 | /**
42 | * provides information about the completed RPC request.
43 | */
44 | struct evrpc_status {
45 | #define EVRPC_STATUS_ERR_NONE 0
46 | #define EVRPC_STATUS_ERR_TIMEOUT 1
47 | #define EVRPC_STATUS_ERR_BADPAYLOAD 2
48 | #define EVRPC_STATUS_ERR_UNSTARTED 3
49 | #define EVRPC_STATUS_ERR_HOOKABORTED 4
50 | int error;
51 |
52 | /* for looking at headers or other information */
53 | struct evhttp_request *http_req;
54 | };
55 |
56 | /* the structure below needs to be synchronized with evrpc_req_generic */
57 |
58 | /* Encapsulates a request */
59 | struct evrpc {
60 | TAILQ_ENTRY(evrpc) next;
61 |
62 | /* the URI at which the request handler lives */
63 | const char* uri;
64 |
65 | /* creates a new request structure */
66 | void *(*request_new)(void *);
67 | void *request_new_arg;
68 |
69 | /* frees the request structure */
70 | void (*request_free)(void *);
71 |
72 | /* unmarshals the buffer into the proper request structure */
73 | int (*request_unmarshal)(void *, struct evbuffer *);
74 |
75 | /* creates a new reply structure */
76 | void *(*reply_new)(void *);
77 | void *reply_new_arg;
78 |
79 | /* frees the reply structure */
80 | void (*reply_free)(void *);
81 |
82 | /* verifies that the reply is valid */
83 | int (*reply_complete)(void *);
84 |
85 | /* marshals the reply into a buffer */
86 | void (*reply_marshal)(struct evbuffer*, void *);
87 |
88 | /* the callback invoked for each received rpc */
89 | void (*cb)(struct evrpc_req_generic *, void *);
90 | void *cb_arg;
91 |
92 | /* reference for further configuration */
93 | struct evrpc_base *base;
94 | };
95 |
96 | #ifdef __cplusplus
97 | }
98 | #endif
99 |
100 | #endif /* EVENT2_RPC_STRUCT_H_INCLUDED_ */
101 |
--------------------------------------------------------------------------------
/app/include/armeabi-v7a/event2/tag_compat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2000-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_TAG_COMPAT_H_INCLUDED_
28 | #define EVENT2_TAG_COMPAT_H_INCLUDED_
29 |
30 | /** @file event2/tag_compat.h
31 |
32 | Obsolete/deprecated functions from tag.h; provided only for backwards
33 | compatibility.
34 | */
35 |
36 | /**
37 | @name Misnamed functions
38 |
39 | @deprecated These macros are deprecated because their names don't follow
40 | Libevent's naming conventions. Use evtag_encode_int and
41 | evtag_encode_int64 instead.
42 |
43 | @{
44 | */
45 | #define encode_int(evbuf, number) evtag_encode_int((evbuf), (number))
46 | #define encode_int64(evbuf, number) evtag_encode_int64((evbuf), (number))
47 | /**@}*/
48 |
49 | #endif /* EVENT2_TAG_H_INCLUDED_ */
50 |
--------------------------------------------------------------------------------
/app/include/armeabi-v7a/event2/visibility.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 | /*
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_VISIBILITY_H_INCLUDED_
28 | #define EVENT2_VISIBILITY_H_INCLUDED_
29 |
30 | #include
31 |
32 | #if defined(event_EXPORTS) || defined(event_extra_EXPORTS) || defined(event_core_EXPORTS)
33 | # if defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550)
34 | # define EVENT2_EXPORT_SYMBOL __global
35 | # elif defined __GNUC__
36 | # define EVENT2_EXPORT_SYMBOL __attribute__ ((visibility("default")))
37 | # elif defined(_MSC_VER)
38 | # define EVENT2_EXPORT_SYMBOL extern __declspec(dllexport)
39 | # else
40 | # define EVENT2_EXPORT_SYMBOL /* unknown compiler */
41 | # endif
42 | #else
43 | # if defined(EVENT__NEED_DLLIMPORT) && defined(_MSC_VER) && !defined(EVENT_BUILDING_REGRESS_TEST)
44 | # define EVENT2_EXPORT_SYMBOL extern __declspec(dllimport)
45 | # else
46 | # define EVENT2_EXPORT_SYMBOL
47 | # endif
48 | #endif
49 |
50 | #endif /* EVENT2_VISIBILITY_H_INCLUDED_ */
51 |
--------------------------------------------------------------------------------
/app/include/x86/event2/buffer_compat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions
6 | * are met:
7 | * 1. Redistributions of source code must retain the above copyright
8 | * notice, this list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright
10 | * notice, this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. The name of the author may not be used to endorse or promote products
13 | * derived from this software without specific prior written permission.
14 | *
15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 | */
26 |
27 | #ifndef EVENT2_BUFFER_COMPAT_H_INCLUDED_
28 | #define EVENT2_BUFFER_COMPAT_H_INCLUDED_
29 |
30 | #include
31 |
32 | /** @file event2/buffer_compat.h
33 |
34 | Obsolete and deprecated versions of the functions in buffer.h: provided
35 | only for backward compatibility.
36 | */
37 |
38 |
39 | /**
40 | Obsolete alias for evbuffer_readln(buffer, NULL, EVBUFFER_EOL_ANY).
41 |
42 | @deprecated This function is deprecated because its behavior is not correct
43 | for almost any protocol, and also because it's wholly subsumed by
44 | evbuffer_readln().
45 |
46 | @param buffer the evbuffer to read from
47 | @return pointer to a single line, or NULL if an error occurred
48 |
49 | */
50 | EVENT2_EXPORT_SYMBOL
51 | char *evbuffer_readline(struct evbuffer *buffer);
52 |
53 | /** Type definition for a callback that is invoked whenever data is added or
54 | removed from an evbuffer.
55 |
56 | An evbuffer may have one or more callbacks set at a time. The order
57 | in which they are executed is undefined.
58 |
59 | A callback function may add more callbacks, or remove itself from the
60 | list of callbacks, or add or remove data from the buffer. It may not
61 | remove another callback from the list.
62 |
63 | If a callback adds or removes data from the buffer or from another
64 | buffer, this can cause a recursive invocation of your callback or
65 | other callbacks. If you ask for an infinite loop, you might just get
66 | one: watch out!
67 |
68 | @param buffer the buffer whose size has changed
69 | @param old_len the previous length of the buffer
70 | @param new_len the current length of the buffer
71 | @param arg a pointer to user data
72 | */
73 | typedef void (*evbuffer_cb)(struct evbuffer *buffer, size_t old_len, size_t new_len, void *arg);
74 |
75 | /**
76 | Replace all callbacks on an evbuffer with a single new callback, or
77 | remove them.
78 |
79 | Subsequent calls to evbuffer_setcb() replace callbacks set by previous
80 | calls. Setting the callback to NULL removes any previously set callback.
81 |
82 | @deprecated This function is deprecated because it clears all previous
83 | callbacks set on the evbuffer, which can cause confusing behavior if
84 | multiple parts of the code all want to add their own callbacks on a
85 | buffer. Instead, use evbuffer_add(), evbuffer_del(), and
86 | evbuffer_setflags() to manage your own evbuffer callbacks without
87 | interfering with callbacks set by others.
88 |
89 | @param buffer the evbuffer to be monitored
90 | @param cb the callback function to invoke when the evbuffer is modified,
91 | or NULL to remove all callbacks.
92 | @param cbarg an argument to be provided to the callback function
93 | */
94 | EVENT2_EXPORT_SYMBOL
95 | void evbuffer_setcb(struct evbuffer *buffer, evbuffer_cb cb, void *cbarg);
96 |
97 |
98 | /**
99 | Find a string within an evbuffer.
100 |
101 | @param buffer the evbuffer to be searched
102 | @param what the string to be searched for
103 | @param len the length of the search string
104 | @return a pointer to the beginning of the search string, or NULL if the search failed.
105 | */
106 | EVENT2_EXPORT_SYMBOL
107 | unsigned char *evbuffer_find(struct evbuffer *buffer, const unsigned char *what, size_t len);
108 |
109 | /** deprecated in favor of calling the functions directly */
110 | #define EVBUFFER_LENGTH(x) evbuffer_get_length(x)
111 | /** deprecated in favor of calling the functions directly */
112 | #define EVBUFFER_DATA(x) evbuffer_pullup((x), -1)
113 |
114 | #endif
115 |
116 |
--------------------------------------------------------------------------------
/app/include/x86/event2/bufferevent_compat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2007-2012 Niels Provos, Nick Mathewson
3 | * Copyright (c) 2000-2007 Niels Provos
4 | * All rights reserved.
5 | *
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions
8 | * are met:
9 | * 1. Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | * 2. Redistributions in binary form must reproduce the above copyright
12 | * notice, this list of conditions and the following disclaimer in the
13 | * documentation and/or other materials provided with the distribution.
14 | * 3. The name of the author may not be used to endorse or promote products
15 | * derived from this software without specific prior written permission.
16 | *
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 | */
28 | #ifndef EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_
29 | #define EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_
30 |
31 | #define evbuffercb bufferevent_data_cb
32 | #define everrorcb bufferevent_event_cb
33 |
34 | /**
35 | Create a new bufferevent for an fd.
36 |
37 | This function is deprecated. Use bufferevent_socket_new and
38 | bufferevent_set_callbacks instead.
39 |
40 | Libevent provides an abstraction on top of the regular event callbacks.
41 | This abstraction is called a buffered event. A buffered event provides
42 | input and output buffers that get filled and drained automatically. The
43 | user of a buffered event no longer deals directly with the I/O, but
44 | instead is reading from input and writing to output buffers.
45 |
46 | Once initialized, the bufferevent structure can be used repeatedly with
47 | bufferevent_enable() and bufferevent_disable().
48 |
49 | When read enabled the bufferevent will try to read from the file descriptor
50 | and call the read callback. The write callback is executed whenever the
51 | output buffer is drained below the write low watermark, which is 0 by
52 | default.
53 |
54 | If multiple bases are in use, bufferevent_base_set() must be called before
55 | enabling the bufferevent for the first time.
56 |
57 | @deprecated This function is deprecated because it uses the current
58 | event base, and as such can be error prone for multithreaded programs.
59 | Use bufferevent_socket_new() instead.
60 |
61 | @param fd the file descriptor from which data is read and written to.
62 | This file descriptor is not allowed to be a pipe(2).
63 | @param readcb callback to invoke when there is data to be read, or NULL if
64 | no callback is desired
65 | @param writecb callback to invoke when the file descriptor is ready for
66 | writing, or NULL if no callback is desired
67 | @param errorcb callback to invoke when there is an error on the file
68 | descriptor
69 | @param cbarg an argument that will be supplied to each of the callbacks
70 | (readcb, writecb, and errorcb)
71 | @return a pointer to a newly allocated bufferevent struct, or NULL if an
72 | error occurred
73 | @see bufferevent_base_set(), bufferevent_free()
74 | */
75 | struct bufferevent *bufferevent_new(evutil_socket_t fd,
76 | evbuffercb readcb, evbuffercb writecb, everrorcb errorcb, void *cbarg);
77 |
78 |
79 | /**
80 | Set the read and write timeout for a buffered event.
81 |
82 | @param bufev the bufferevent to be modified
83 | @param timeout_read the read timeout
84 | @param timeout_write the write timeout
85 | */
86 | void bufferevent_settimeout(struct bufferevent *bufev,
87 | int timeout_read, int timeout_write);
88 |
89 | #define EVBUFFER_READ BEV_EVENT_READING
90 | #define EVBUFFER_WRITE BEV_EVENT_WRITING
91 | #define EVBUFFER_EOF BEV_EVENT_EOF
92 | #define EVBUFFER_ERROR BEV_EVENT_ERROR
93 | #define EVBUFFER_TIMEOUT BEV_EVENT_TIMEOUT
94 |
95 | /** macro for getting access to the input buffer of a bufferevent */
96 | #define EVBUFFER_INPUT(x) bufferevent_get_input(x)
97 | /** macro for getting access to the output buffer of a bufferevent */
98 | #define EVBUFFER_OUTPUT(x) bufferevent_get_output(x)
99 |
100 | #endif
101 |
--------------------------------------------------------------------------------
/app/include/x86/event2/bufferevent_struct.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2000-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_BUFFEREVENT_STRUCT_H_INCLUDED_
28 | #define EVENT2_BUFFEREVENT_STRUCT_H_INCLUDED_
29 |
30 | /** @file event2/bufferevent_struct.h
31 |
32 | Data structures for bufferevents. Using these structures may hurt forward
33 | compatibility with later versions of Libevent: be careful!
34 |
35 | @deprecated Use of bufferevent_struct.h is completely deprecated; these
36 | structures are only exposed for backward compatibility with programs
37 | written before Libevent 2.0 that used them.
38 | */
39 |
40 | #ifdef __cplusplus
41 | extern "C" {
42 | #endif
43 |
44 | #include
45 | #ifdef EVENT__HAVE_SYS_TYPES_H
46 | #include
47 | #endif
48 | #ifdef EVENT__HAVE_SYS_TIME_H
49 | #include
50 | #endif
51 |
52 | /* For int types. */
53 | #include
54 | /* For struct event */
55 | #include
56 |
57 | struct event_watermark {
58 | size_t low;
59 | size_t high;
60 | };
61 |
62 | /**
63 | Shared implementation of a bufferevent.
64 |
65 | This type is exposed only because it was exposed in previous versions,
66 | and some people's code may rely on manipulating it. Otherwise, you
67 | should really not rely on the layout, size, or contents of this structure:
68 | it is fairly volatile, and WILL change in future versions of the code.
69 | **/
70 | struct bufferevent {
71 | /** Event base for which this bufferevent was created. */
72 | struct event_base *ev_base;
73 | /** Pointer to a table of function pointers to set up how this
74 | bufferevent behaves. */
75 | const struct bufferevent_ops *be_ops;
76 |
77 | /** A read event that triggers when a timeout has happened or a socket
78 | is ready to read data. Only used by some subtypes of
79 | bufferevent. */
80 | struct event ev_read;
81 | /** A write event that triggers when a timeout has happened or a socket
82 | is ready to write data. Only used by some subtypes of
83 | bufferevent. */
84 | struct event ev_write;
85 |
86 | /** An input buffer. Only the bufferevent is allowed to add data to
87 | this buffer, though the user is allowed to drain it. */
88 | struct evbuffer *input;
89 |
90 | /** An input buffer. Only the bufferevent is allowed to drain data
91 | from this buffer, though the user is allowed to add it. */
92 | struct evbuffer *output;
93 |
94 | struct event_watermark wm_read;
95 | struct event_watermark wm_write;
96 |
97 | bufferevent_data_cb readcb;
98 | bufferevent_data_cb writecb;
99 | /* This should be called 'eventcb', but renaming it would break
100 | * backward compatibility */
101 | bufferevent_event_cb errorcb;
102 | void *cbarg;
103 |
104 | struct timeval timeout_read;
105 | struct timeval timeout_write;
106 |
107 | /** Events that are currently enabled: currently EV_READ and EV_WRITE
108 | are supported. */
109 | short enabled;
110 | };
111 |
112 | #ifdef __cplusplus
113 | }
114 | #endif
115 |
116 | #endif /* EVENT2_BUFFEREVENT_STRUCT_H_INCLUDED_ */
117 |
--------------------------------------------------------------------------------
/app/include/x86/event2/dns_struct.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2000-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_DNS_STRUCT_H_INCLUDED_
28 | #define EVENT2_DNS_STRUCT_H_INCLUDED_
29 |
30 | /** @file event2/dns_struct.h
31 |
32 | Data structures for dns. Using these structures may hurt forward
33 | compatibility with later versions of Libevent: be careful!
34 |
35 | */
36 |
37 | #ifdef __cplusplus
38 | extern "C" {
39 | #endif
40 |
41 | #include
42 | #ifdef EVENT__HAVE_SYS_TYPES_H
43 | #include
44 | #endif
45 | #ifdef EVENT__HAVE_SYS_TIME_H
46 | #include
47 | #endif
48 |
49 | /* For int types. */
50 | #include
51 |
52 | /*
53 | * Structures used to implement a DNS server.
54 | */
55 |
56 | struct evdns_server_request {
57 | int flags;
58 | int nquestions;
59 | struct evdns_server_question **questions;
60 | };
61 | struct evdns_server_question {
62 | int type;
63 | #ifdef __cplusplus
64 | int dns_question_class;
65 | #else
66 | /* You should refer to this field as "dns_question_class". The
67 | * name "class" works in C for backward compatibility, and will be
68 | * removed in a future version. (1.5 or later). */
69 | int class;
70 | #define dns_question_class class
71 | #endif
72 | char name[1];
73 | };
74 |
75 | #ifdef __cplusplus
76 | }
77 | #endif
78 |
79 | #endif /* EVENT2_DNS_STRUCT_H_INCLUDED_ */
80 |
81 |
--------------------------------------------------------------------------------
/app/include/x86/event2/http_compat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2000-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_HTTP_COMPAT_H_INCLUDED_
28 | #define EVENT2_HTTP_COMPAT_H_INCLUDED_
29 |
30 | /** @file event2/http_compat.h
31 |
32 | Potentially non-threadsafe versions of the functions in http.h: provided
33 | only for backwards compatibility.
34 |
35 | */
36 |
37 | #ifdef __cplusplus
38 | extern "C" {
39 | #endif
40 |
41 | #include
42 | #ifdef EVENT__HAVE_SYS_TYPES_H
43 | #include
44 | #endif
45 | #ifdef EVENT__HAVE_SYS_TIME_H
46 | #include
47 | #endif
48 |
49 | /* For int types. */
50 | #include
51 |
52 | /**
53 | * Start an HTTP server on the specified address and port
54 | *
55 | * @deprecated It does not allow an event base to be specified
56 | *
57 | * @param address the address to which the HTTP server should be bound
58 | * @param port the port number on which the HTTP server should listen
59 | * @return an struct evhttp object
60 | */
61 | struct evhttp *evhttp_start(const char *address, ev_uint16_t port);
62 |
63 | /**
64 | * A connection object that can be used to for making HTTP requests. The
65 | * connection object tries to establish the connection when it is given an
66 | * http request object.
67 | *
68 | * @deprecated It does not allow an event base to be specified
69 | */
70 | struct evhttp_connection *evhttp_connection_new(
71 | const char *address, ev_uint16_t port);
72 |
73 | /**
74 | * Associates an event base with the connection - can only be called
75 | * on a freshly created connection object that has not been used yet.
76 | *
77 | * @deprecated XXXX Why?
78 | */
79 | void evhttp_connection_set_base(struct evhttp_connection *evcon,
80 | struct event_base *base);
81 |
82 |
83 | /** Returns the request URI */
84 | #define evhttp_request_uri evhttp_request_get_uri
85 |
86 | #ifdef __cplusplus
87 | }
88 | #endif
89 |
90 | #endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */
91 |
--------------------------------------------------------------------------------
/app/include/x86/event2/http_struct.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2000-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_HTTP_STRUCT_H_INCLUDED_
28 | #define EVENT2_HTTP_STRUCT_H_INCLUDED_
29 |
30 | /** @file event2/http_struct.h
31 |
32 | Data structures for http. Using these structures may hurt forward
33 | compatibility with later versions of Libevent: be careful!
34 |
35 | */
36 |
37 | #ifdef __cplusplus
38 | extern "C" {
39 | #endif
40 |
41 | #include
42 | #ifdef EVENT__HAVE_SYS_TYPES_H
43 | #include
44 | #endif
45 | #ifdef EVENT__HAVE_SYS_TIME_H
46 | #include
47 | #endif
48 |
49 | /* For int types. */
50 | #include
51 |
52 | /**
53 | * the request structure that a server receives.
54 | * WARNING: expect this structure to change. I will try to provide
55 | * reasonable accessors.
56 | */
57 | struct evhttp_request {
58 | #if defined(TAILQ_ENTRY)
59 | TAILQ_ENTRY(evhttp_request) next;
60 | #else
61 | struct {
62 | struct evhttp_request *tqe_next;
63 | struct evhttp_request **tqe_prev;
64 | } next;
65 | #endif
66 |
67 | /* the connection object that this request belongs to */
68 | struct evhttp_connection *evcon;
69 | int flags;
70 | /** The request obj owns the evhttp connection and needs to free it */
71 | #define EVHTTP_REQ_OWN_CONNECTION 0x0001
72 | /** Request was made via a proxy */
73 | #define EVHTTP_PROXY_REQUEST 0x0002
74 | /** The request object is owned by the user; the user must free it */
75 | #define EVHTTP_USER_OWNED 0x0004
76 | /** The request will be used again upstack; freeing must be deferred */
77 | #define EVHTTP_REQ_DEFER_FREE 0x0008
78 | /** The request should be freed upstack */
79 | #define EVHTTP_REQ_NEEDS_FREE 0x0010
80 |
81 | struct evkeyvalq *input_headers;
82 | struct evkeyvalq *output_headers;
83 |
84 | /* address of the remote host and the port connection came from */
85 | char *remote_host;
86 | ev_uint16_t remote_port;
87 |
88 | /* cache of the hostname for evhttp_request_get_host */
89 | char *host_cache;
90 |
91 | enum evhttp_request_kind kind;
92 | enum evhttp_cmd_type type;
93 |
94 | size_t headers_size;
95 | size_t body_size;
96 |
97 | char *uri; /* uri after HTTP request was parsed */
98 | struct evhttp_uri *uri_elems; /* uri elements */
99 |
100 | char major; /* HTTP Major number */
101 | char minor; /* HTTP Minor number */
102 |
103 | int response_code; /* HTTP Response code */
104 | char *response_code_line; /* Readable response */
105 |
106 | struct evbuffer *input_buffer; /* read data */
107 | ev_int64_t ntoread;
108 | unsigned chunked:1, /* a chunked request */
109 | userdone:1; /* the user has sent all data */
110 |
111 | struct evbuffer *output_buffer; /* outgoing post or data */
112 |
113 | /* Callback */
114 | void (*cb)(struct evhttp_request *, void *);
115 | void *cb_arg;
116 |
117 | /*
118 | * Chunked data callback - call for each completed chunk if
119 | * specified. If not specified, all the data is delivered via
120 | * the regular callback.
121 | */
122 | void (*chunk_cb)(struct evhttp_request *, void *);
123 |
124 | /*
125 | * Callback added for forked-daapd so they can collect ICY
126 | * (shoutcast) metadata from the http header. If return
127 | * int is negative the connection will be closed.
128 | */
129 | int (*header_cb)(struct evhttp_request *, void *);
130 |
131 | /*
132 | * Error callback - called when error is occured.
133 | * @see evhttp_request_error for error types.
134 | *
135 | * @see evhttp_request_set_error_cb()
136 | */
137 | void (*error_cb)(enum evhttp_request_error, void *);
138 |
139 | /*
140 | * Send complete callback - called when the request is actually
141 | * sent and completed.
142 | */
143 | void (*on_complete_cb)(struct evhttp_request *, void *);
144 | void *on_complete_cb_arg;
145 | };
146 |
147 | #ifdef __cplusplus
148 | }
149 | #endif
150 |
151 | #endif /* EVENT2_HTTP_STRUCT_H_INCLUDED_ */
152 |
153 |
--------------------------------------------------------------------------------
/app/include/x86/event2/keyvalq_struct.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2000-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_KEYVALQ_STRUCT_H_INCLUDED_
28 | #define EVENT2_KEYVALQ_STRUCT_H_INCLUDED_
29 |
30 | #ifdef __cplusplus
31 | extern "C" {
32 | #endif
33 |
34 | /* Fix so that people don't have to run with */
35 | /* XXXX This code is duplicated with event_struct.h */
36 | #ifndef TAILQ_ENTRY
37 | #define EVENT_DEFINED_TQENTRY_
38 | #define TAILQ_ENTRY(type) \
39 | struct { \
40 | struct type *tqe_next; /* next element */ \
41 | struct type **tqe_prev; /* address of previous next element */ \
42 | }
43 | #endif /* !TAILQ_ENTRY */
44 |
45 | #ifndef TAILQ_HEAD
46 | #define EVENT_DEFINED_TQHEAD_
47 | #define TAILQ_HEAD(name, type) \
48 | struct name { \
49 | struct type *tqh_first; \
50 | struct type **tqh_last; \
51 | }
52 | #endif
53 |
54 | /*
55 | * Key-Value pairs. Can be used for HTTP headers but also for
56 | * query argument parsing.
57 | */
58 | struct evkeyval {
59 | TAILQ_ENTRY(evkeyval) next;
60 |
61 | char *key;
62 | char *value;
63 | };
64 |
65 | TAILQ_HEAD (evkeyvalq, evkeyval);
66 |
67 | /* XXXX This code is duplicated with event_struct.h */
68 | #ifdef EVENT_DEFINED_TQENTRY_
69 | #undef TAILQ_ENTRY
70 | #endif
71 |
72 | #ifdef EVENT_DEFINED_TQHEAD_
73 | #undef TAILQ_HEAD
74 | #endif
75 |
76 | #ifdef __cplusplus
77 | }
78 | #endif
79 |
80 | #endif
81 |
--------------------------------------------------------------------------------
/app/include/x86/event2/rpc_compat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_RPC_COMPAT_H_INCLUDED_
28 | #define EVENT2_RPC_COMPAT_H_INCLUDED_
29 |
30 | /** @file event2/rpc_compat.h
31 |
32 | Deprecated versions of the functions in rpc.h: provided only for
33 | backwards compatibility.
34 |
35 | */
36 |
37 | #ifdef __cplusplus
38 | extern "C" {
39 | #endif
40 |
41 | /** backwards compatible accessors that work only with gcc */
42 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
43 |
44 | #undef EVTAG_ASSIGN
45 | #undef EVTAG_GET
46 | #undef EVTAG_ADD
47 |
48 | #define EVTAG_ASSIGN(msg, member, args...) \
49 | (*(msg)->base->member##_assign)(msg, ## args)
50 | #define EVTAG_GET(msg, member, args...) \
51 | (*(msg)->base->member##_get)(msg, ## args)
52 | #define EVTAG_ADD(msg, member, args...) \
53 | (*(msg)->base->member##_add)(msg, ## args)
54 | #endif
55 | #define EVTAG_LEN(msg, member) ((msg)->member##_length)
56 |
57 | #ifdef __cplusplus
58 | }
59 | #endif
60 |
61 | #endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */
62 |
--------------------------------------------------------------------------------
/app/include/x86/event2/rpc_struct.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_RPC_STRUCT_H_INCLUDED_
28 | #define EVENT2_RPC_STRUCT_H_INCLUDED_
29 |
30 | #ifdef __cplusplus
31 | extern "C" {
32 | #endif
33 |
34 | /** @file event2/rpc_struct.h
35 |
36 | Structures used by rpc.h. Using these structures directly may harm
37 | forward compatibility: be careful!
38 |
39 | */
40 |
41 | /**
42 | * provides information about the completed RPC request.
43 | */
44 | struct evrpc_status {
45 | #define EVRPC_STATUS_ERR_NONE 0
46 | #define EVRPC_STATUS_ERR_TIMEOUT 1
47 | #define EVRPC_STATUS_ERR_BADPAYLOAD 2
48 | #define EVRPC_STATUS_ERR_UNSTARTED 3
49 | #define EVRPC_STATUS_ERR_HOOKABORTED 4
50 | int error;
51 |
52 | /* for looking at headers or other information */
53 | struct evhttp_request *http_req;
54 | };
55 |
56 | /* the structure below needs to be synchronized with evrpc_req_generic */
57 |
58 | /* Encapsulates a request */
59 | struct evrpc {
60 | TAILQ_ENTRY(evrpc) next;
61 |
62 | /* the URI at which the request handler lives */
63 | const char* uri;
64 |
65 | /* creates a new request structure */
66 | void *(*request_new)(void *);
67 | void *request_new_arg;
68 |
69 | /* frees the request structure */
70 | void (*request_free)(void *);
71 |
72 | /* unmarshals the buffer into the proper request structure */
73 | int (*request_unmarshal)(void *, struct evbuffer *);
74 |
75 | /* creates a new reply structure */
76 | void *(*reply_new)(void *);
77 | void *reply_new_arg;
78 |
79 | /* frees the reply structure */
80 | void (*reply_free)(void *);
81 |
82 | /* verifies that the reply is valid */
83 | int (*reply_complete)(void *);
84 |
85 | /* marshals the reply into a buffer */
86 | void (*reply_marshal)(struct evbuffer*, void *);
87 |
88 | /* the callback invoked for each received rpc */
89 | void (*cb)(struct evrpc_req_generic *, void *);
90 | void *cb_arg;
91 |
92 | /* reference for further configuration */
93 | struct evrpc_base *base;
94 | };
95 |
96 | #ifdef __cplusplus
97 | }
98 | #endif
99 |
100 | #endif /* EVENT2_RPC_STRUCT_H_INCLUDED_ */
101 |
--------------------------------------------------------------------------------
/app/include/x86/event2/tag_compat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2000-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_TAG_COMPAT_H_INCLUDED_
28 | #define EVENT2_TAG_COMPAT_H_INCLUDED_
29 |
30 | /** @file event2/tag_compat.h
31 |
32 | Obsolete/deprecated functions from tag.h; provided only for backwards
33 | compatibility.
34 | */
35 |
36 | /**
37 | @name Misnamed functions
38 |
39 | @deprecated These macros are deprecated because their names don't follow
40 | Libevent's naming conventions. Use evtag_encode_int and
41 | evtag_encode_int64 instead.
42 |
43 | @{
44 | */
45 | #define encode_int(evbuf, number) evtag_encode_int((evbuf), (number))
46 | #define encode_int64(evbuf, number) evtag_encode_int64((evbuf), (number))
47 | /**@}*/
48 |
49 | #endif /* EVENT2_TAG_H_INCLUDED_ */
50 |
--------------------------------------------------------------------------------
/app/include/x86/event2/visibility.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 | /*
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_VISIBILITY_H_INCLUDED_
28 | #define EVENT2_VISIBILITY_H_INCLUDED_
29 |
30 | #include
31 |
32 | #if defined(event_EXPORTS) || defined(event_extra_EXPORTS) || defined(event_core_EXPORTS)
33 | # if defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550)
34 | # define EVENT2_EXPORT_SYMBOL __global
35 | # elif defined __GNUC__
36 | # define EVENT2_EXPORT_SYMBOL __attribute__ ((visibility("default")))
37 | # elif defined(_MSC_VER)
38 | # define EVENT2_EXPORT_SYMBOL extern __declspec(dllexport)
39 | # else
40 | # define EVENT2_EXPORT_SYMBOL /* unknown compiler */
41 | # endif
42 | #else
43 | # if defined(EVENT__NEED_DLLIMPORT) && defined(_MSC_VER) && !defined(EVENT_BUILDING_REGRESS_TEST)
44 | # define EVENT2_EXPORT_SYMBOL extern __declspec(dllimport)
45 | # else
46 | # define EVENT2_EXPORT_SYMBOL
47 | # endif
48 | #endif
49 |
50 | #endif /* EVENT2_VISIBILITY_H_INCLUDED_ */
51 |
--------------------------------------------------------------------------------
/app/include/x86_64/event2/buffer_compat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions
6 | * are met:
7 | * 1. Redistributions of source code must retain the above copyright
8 | * notice, this list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright
10 | * notice, this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. The name of the author may not be used to endorse or promote products
13 | * derived from this software without specific prior written permission.
14 | *
15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 | */
26 |
27 | #ifndef EVENT2_BUFFER_COMPAT_H_INCLUDED_
28 | #define EVENT2_BUFFER_COMPAT_H_INCLUDED_
29 |
30 | #include
31 |
32 | /** @file event2/buffer_compat.h
33 |
34 | Obsolete and deprecated versions of the functions in buffer.h: provided
35 | only for backward compatibility.
36 | */
37 |
38 |
39 | /**
40 | Obsolete alias for evbuffer_readln(buffer, NULL, EVBUFFER_EOL_ANY).
41 |
42 | @deprecated This function is deprecated because its behavior is not correct
43 | for almost any protocol, and also because it's wholly subsumed by
44 | evbuffer_readln().
45 |
46 | @param buffer the evbuffer to read from
47 | @return pointer to a single line, or NULL if an error occurred
48 |
49 | */
50 | EVENT2_EXPORT_SYMBOL
51 | char *evbuffer_readline(struct evbuffer *buffer);
52 |
53 | /** Type definition for a callback that is invoked whenever data is added or
54 | removed from an evbuffer.
55 |
56 | An evbuffer may have one or more callbacks set at a time. The order
57 | in which they are executed is undefined.
58 |
59 | A callback function may add more callbacks, or remove itself from the
60 | list of callbacks, or add or remove data from the buffer. It may not
61 | remove another callback from the list.
62 |
63 | If a callback adds or removes data from the buffer or from another
64 | buffer, this can cause a recursive invocation of your callback or
65 | other callbacks. If you ask for an infinite loop, you might just get
66 | one: watch out!
67 |
68 | @param buffer the buffer whose size has changed
69 | @param old_len the previous length of the buffer
70 | @param new_len the current length of the buffer
71 | @param arg a pointer to user data
72 | */
73 | typedef void (*evbuffer_cb)(struct evbuffer *buffer, size_t old_len, size_t new_len, void *arg);
74 |
75 | /**
76 | Replace all callbacks on an evbuffer with a single new callback, or
77 | remove them.
78 |
79 | Subsequent calls to evbuffer_setcb() replace callbacks set by previous
80 | calls. Setting the callback to NULL removes any previously set callback.
81 |
82 | @deprecated This function is deprecated because it clears all previous
83 | callbacks set on the evbuffer, which can cause confusing behavior if
84 | multiple parts of the code all want to add their own callbacks on a
85 | buffer. Instead, use evbuffer_add(), evbuffer_del(), and
86 | evbuffer_setflags() to manage your own evbuffer callbacks without
87 | interfering with callbacks set by others.
88 |
89 | @param buffer the evbuffer to be monitored
90 | @param cb the callback function to invoke when the evbuffer is modified,
91 | or NULL to remove all callbacks.
92 | @param cbarg an argument to be provided to the callback function
93 | */
94 | EVENT2_EXPORT_SYMBOL
95 | void evbuffer_setcb(struct evbuffer *buffer, evbuffer_cb cb, void *cbarg);
96 |
97 |
98 | /**
99 | Find a string within an evbuffer.
100 |
101 | @param buffer the evbuffer to be searched
102 | @param what the string to be searched for
103 | @param len the length of the search string
104 | @return a pointer to the beginning of the search string, or NULL if the search failed.
105 | */
106 | EVENT2_EXPORT_SYMBOL
107 | unsigned char *evbuffer_find(struct evbuffer *buffer, const unsigned char *what, size_t len);
108 |
109 | /** deprecated in favor of calling the functions directly */
110 | #define EVBUFFER_LENGTH(x) evbuffer_get_length(x)
111 | /** deprecated in favor of calling the functions directly */
112 | #define EVBUFFER_DATA(x) evbuffer_pullup((x), -1)
113 |
114 | #endif
115 |
116 |
--------------------------------------------------------------------------------
/app/include/x86_64/event2/bufferevent_compat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2007-2012 Niels Provos, Nick Mathewson
3 | * Copyright (c) 2000-2007 Niels Provos
4 | * All rights reserved.
5 | *
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions
8 | * are met:
9 | * 1. Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | * 2. Redistributions in binary form must reproduce the above copyright
12 | * notice, this list of conditions and the following disclaimer in the
13 | * documentation and/or other materials provided with the distribution.
14 | * 3. The name of the author may not be used to endorse or promote products
15 | * derived from this software without specific prior written permission.
16 | *
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 | */
28 | #ifndef EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_
29 | #define EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_
30 |
31 | #define evbuffercb bufferevent_data_cb
32 | #define everrorcb bufferevent_event_cb
33 |
34 | /**
35 | Create a new bufferevent for an fd.
36 |
37 | This function is deprecated. Use bufferevent_socket_new and
38 | bufferevent_set_callbacks instead.
39 |
40 | Libevent provides an abstraction on top of the regular event callbacks.
41 | This abstraction is called a buffered event. A buffered event provides
42 | input and output buffers that get filled and drained automatically. The
43 | user of a buffered event no longer deals directly with the I/O, but
44 | instead is reading from input and writing to output buffers.
45 |
46 | Once initialized, the bufferevent structure can be used repeatedly with
47 | bufferevent_enable() and bufferevent_disable().
48 |
49 | When read enabled the bufferevent will try to read from the file descriptor
50 | and call the read callback. The write callback is executed whenever the
51 | output buffer is drained below the write low watermark, which is 0 by
52 | default.
53 |
54 | If multiple bases are in use, bufferevent_base_set() must be called before
55 | enabling the bufferevent for the first time.
56 |
57 | @deprecated This function is deprecated because it uses the current
58 | event base, and as such can be error prone for multithreaded programs.
59 | Use bufferevent_socket_new() instead.
60 |
61 | @param fd the file descriptor from which data is read and written to.
62 | This file descriptor is not allowed to be a pipe(2).
63 | @param readcb callback to invoke when there is data to be read, or NULL if
64 | no callback is desired
65 | @param writecb callback to invoke when the file descriptor is ready for
66 | writing, or NULL if no callback is desired
67 | @param errorcb callback to invoke when there is an error on the file
68 | descriptor
69 | @param cbarg an argument that will be supplied to each of the callbacks
70 | (readcb, writecb, and errorcb)
71 | @return a pointer to a newly allocated bufferevent struct, or NULL if an
72 | error occurred
73 | @see bufferevent_base_set(), bufferevent_free()
74 | */
75 | struct bufferevent *bufferevent_new(evutil_socket_t fd,
76 | evbuffercb readcb, evbuffercb writecb, everrorcb errorcb, void *cbarg);
77 |
78 |
79 | /**
80 | Set the read and write timeout for a buffered event.
81 |
82 | @param bufev the bufferevent to be modified
83 | @param timeout_read the read timeout
84 | @param timeout_write the write timeout
85 | */
86 | void bufferevent_settimeout(struct bufferevent *bufev,
87 | int timeout_read, int timeout_write);
88 |
89 | #define EVBUFFER_READ BEV_EVENT_READING
90 | #define EVBUFFER_WRITE BEV_EVENT_WRITING
91 | #define EVBUFFER_EOF BEV_EVENT_EOF
92 | #define EVBUFFER_ERROR BEV_EVENT_ERROR
93 | #define EVBUFFER_TIMEOUT BEV_EVENT_TIMEOUT
94 |
95 | /** macro for getting access to the input buffer of a bufferevent */
96 | #define EVBUFFER_INPUT(x) bufferevent_get_input(x)
97 | /** macro for getting access to the output buffer of a bufferevent */
98 | #define EVBUFFER_OUTPUT(x) bufferevent_get_output(x)
99 |
100 | #endif
101 |
--------------------------------------------------------------------------------
/app/include/x86_64/event2/bufferevent_struct.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2000-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_BUFFEREVENT_STRUCT_H_INCLUDED_
28 | #define EVENT2_BUFFEREVENT_STRUCT_H_INCLUDED_
29 |
30 | /** @file event2/bufferevent_struct.h
31 |
32 | Data structures for bufferevents. Using these structures may hurt forward
33 | compatibility with later versions of Libevent: be careful!
34 |
35 | @deprecated Use of bufferevent_struct.h is completely deprecated; these
36 | structures are only exposed for backward compatibility with programs
37 | written before Libevent 2.0 that used them.
38 | */
39 |
40 | #ifdef __cplusplus
41 | extern "C" {
42 | #endif
43 |
44 | #include
45 | #ifdef EVENT__HAVE_SYS_TYPES_H
46 | #include
47 | #endif
48 | #ifdef EVENT__HAVE_SYS_TIME_H
49 | #include
50 | #endif
51 |
52 | /* For int types. */
53 | #include
54 | /* For struct event */
55 | #include
56 |
57 | struct event_watermark {
58 | size_t low;
59 | size_t high;
60 | };
61 |
62 | /**
63 | Shared implementation of a bufferevent.
64 |
65 | This type is exposed only because it was exposed in previous versions,
66 | and some people's code may rely on manipulating it. Otherwise, you
67 | should really not rely on the layout, size, or contents of this structure:
68 | it is fairly volatile, and WILL change in future versions of the code.
69 | **/
70 | struct bufferevent {
71 | /** Event base for which this bufferevent was created. */
72 | struct event_base *ev_base;
73 | /** Pointer to a table of function pointers to set up how this
74 | bufferevent behaves. */
75 | const struct bufferevent_ops *be_ops;
76 |
77 | /** A read event that triggers when a timeout has happened or a socket
78 | is ready to read data. Only used by some subtypes of
79 | bufferevent. */
80 | struct event ev_read;
81 | /** A write event that triggers when a timeout has happened or a socket
82 | is ready to write data. Only used by some subtypes of
83 | bufferevent. */
84 | struct event ev_write;
85 |
86 | /** An input buffer. Only the bufferevent is allowed to add data to
87 | this buffer, though the user is allowed to drain it. */
88 | struct evbuffer *input;
89 |
90 | /** An input buffer. Only the bufferevent is allowed to drain data
91 | from this buffer, though the user is allowed to add it. */
92 | struct evbuffer *output;
93 |
94 | struct event_watermark wm_read;
95 | struct event_watermark wm_write;
96 |
97 | bufferevent_data_cb readcb;
98 | bufferevent_data_cb writecb;
99 | /* This should be called 'eventcb', but renaming it would break
100 | * backward compatibility */
101 | bufferevent_event_cb errorcb;
102 | void *cbarg;
103 |
104 | struct timeval timeout_read;
105 | struct timeval timeout_write;
106 |
107 | /** Events that are currently enabled: currently EV_READ and EV_WRITE
108 | are supported. */
109 | short enabled;
110 | };
111 |
112 | #ifdef __cplusplus
113 | }
114 | #endif
115 |
116 | #endif /* EVENT2_BUFFEREVENT_STRUCT_H_INCLUDED_ */
117 |
--------------------------------------------------------------------------------
/app/include/x86_64/event2/dns_struct.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2000-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_DNS_STRUCT_H_INCLUDED_
28 | #define EVENT2_DNS_STRUCT_H_INCLUDED_
29 |
30 | /** @file event2/dns_struct.h
31 |
32 | Data structures for dns. Using these structures may hurt forward
33 | compatibility with later versions of Libevent: be careful!
34 |
35 | */
36 |
37 | #ifdef __cplusplus
38 | extern "C" {
39 | #endif
40 |
41 | #include
42 | #ifdef EVENT__HAVE_SYS_TYPES_H
43 | #include
44 | #endif
45 | #ifdef EVENT__HAVE_SYS_TIME_H
46 | #include
47 | #endif
48 |
49 | /* For int types. */
50 | #include
51 |
52 | /*
53 | * Structures used to implement a DNS server.
54 | */
55 |
56 | struct evdns_server_request {
57 | int flags;
58 | int nquestions;
59 | struct evdns_server_question **questions;
60 | };
61 | struct evdns_server_question {
62 | int type;
63 | #ifdef __cplusplus
64 | int dns_question_class;
65 | #else
66 | /* You should refer to this field as "dns_question_class". The
67 | * name "class" works in C for backward compatibility, and will be
68 | * removed in a future version. (1.5 or later). */
69 | int class;
70 | #define dns_question_class class
71 | #endif
72 | char name[1];
73 | };
74 |
75 | #ifdef __cplusplus
76 | }
77 | #endif
78 |
79 | #endif /* EVENT2_DNS_STRUCT_H_INCLUDED_ */
80 |
81 |
--------------------------------------------------------------------------------
/app/include/x86_64/event2/http_compat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2000-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_HTTP_COMPAT_H_INCLUDED_
28 | #define EVENT2_HTTP_COMPAT_H_INCLUDED_
29 |
30 | /** @file event2/http_compat.h
31 |
32 | Potentially non-threadsafe versions of the functions in http.h: provided
33 | only for backwards compatibility.
34 |
35 | */
36 |
37 | #ifdef __cplusplus
38 | extern "C" {
39 | #endif
40 |
41 | #include
42 | #ifdef EVENT__HAVE_SYS_TYPES_H
43 | #include
44 | #endif
45 | #ifdef EVENT__HAVE_SYS_TIME_H
46 | #include
47 | #endif
48 |
49 | /* For int types. */
50 | #include
51 |
52 | /**
53 | * Start an HTTP server on the specified address and port
54 | *
55 | * @deprecated It does not allow an event base to be specified
56 | *
57 | * @param address the address to which the HTTP server should be bound
58 | * @param port the port number on which the HTTP server should listen
59 | * @return an struct evhttp object
60 | */
61 | struct evhttp *evhttp_start(const char *address, ev_uint16_t port);
62 |
63 | /**
64 | * A connection object that can be used to for making HTTP requests. The
65 | * connection object tries to establish the connection when it is given an
66 | * http request object.
67 | *
68 | * @deprecated It does not allow an event base to be specified
69 | */
70 | struct evhttp_connection *evhttp_connection_new(
71 | const char *address, ev_uint16_t port);
72 |
73 | /**
74 | * Associates an event base with the connection - can only be called
75 | * on a freshly created connection object that has not been used yet.
76 | *
77 | * @deprecated XXXX Why?
78 | */
79 | void evhttp_connection_set_base(struct evhttp_connection *evcon,
80 | struct event_base *base);
81 |
82 |
83 | /** Returns the request URI */
84 | #define evhttp_request_uri evhttp_request_get_uri
85 |
86 | #ifdef __cplusplus
87 | }
88 | #endif
89 |
90 | #endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */
91 |
--------------------------------------------------------------------------------
/app/include/x86_64/event2/keyvalq_struct.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2000-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_KEYVALQ_STRUCT_H_INCLUDED_
28 | #define EVENT2_KEYVALQ_STRUCT_H_INCLUDED_
29 |
30 | #ifdef __cplusplus
31 | extern "C" {
32 | #endif
33 |
34 | /* Fix so that people don't have to run with */
35 | /* XXXX This code is duplicated with event_struct.h */
36 | #ifndef TAILQ_ENTRY
37 | #define EVENT_DEFINED_TQENTRY_
38 | #define TAILQ_ENTRY(type) \
39 | struct { \
40 | struct type *tqe_next; /* next element */ \
41 | struct type **tqe_prev; /* address of previous next element */ \
42 | }
43 | #endif /* !TAILQ_ENTRY */
44 |
45 | #ifndef TAILQ_HEAD
46 | #define EVENT_DEFINED_TQHEAD_
47 | #define TAILQ_HEAD(name, type) \
48 | struct name { \
49 | struct type *tqh_first; \
50 | struct type **tqh_last; \
51 | }
52 | #endif
53 |
54 | /*
55 | * Key-Value pairs. Can be used for HTTP headers but also for
56 | * query argument parsing.
57 | */
58 | struct evkeyval {
59 | TAILQ_ENTRY(evkeyval) next;
60 |
61 | char *key;
62 | char *value;
63 | };
64 |
65 | TAILQ_HEAD (evkeyvalq, evkeyval);
66 |
67 | /* XXXX This code is duplicated with event_struct.h */
68 | #ifdef EVENT_DEFINED_TQENTRY_
69 | #undef TAILQ_ENTRY
70 | #endif
71 |
72 | #ifdef EVENT_DEFINED_TQHEAD_
73 | #undef TAILQ_HEAD
74 | #endif
75 |
76 | #ifdef __cplusplus
77 | }
78 | #endif
79 |
80 | #endif
81 |
--------------------------------------------------------------------------------
/app/include/x86_64/event2/rpc_compat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_RPC_COMPAT_H_INCLUDED_
28 | #define EVENT2_RPC_COMPAT_H_INCLUDED_
29 |
30 | /** @file event2/rpc_compat.h
31 |
32 | Deprecated versions of the functions in rpc.h: provided only for
33 | backwards compatibility.
34 |
35 | */
36 |
37 | #ifdef __cplusplus
38 | extern "C" {
39 | #endif
40 |
41 | /** backwards compatible accessors that work only with gcc */
42 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
43 |
44 | #undef EVTAG_ASSIGN
45 | #undef EVTAG_GET
46 | #undef EVTAG_ADD
47 |
48 | #define EVTAG_ASSIGN(msg, member, args...) \
49 | (*(msg)->base->member##_assign)(msg, ## args)
50 | #define EVTAG_GET(msg, member, args...) \
51 | (*(msg)->base->member##_get)(msg, ## args)
52 | #define EVTAG_ADD(msg, member, args...) \
53 | (*(msg)->base->member##_add)(msg, ## args)
54 | #endif
55 | #define EVTAG_LEN(msg, member) ((msg)->member##_length)
56 |
57 | #ifdef __cplusplus
58 | }
59 | #endif
60 |
61 | #endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */
62 |
--------------------------------------------------------------------------------
/app/include/x86_64/event2/rpc_struct.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_RPC_STRUCT_H_INCLUDED_
28 | #define EVENT2_RPC_STRUCT_H_INCLUDED_
29 |
30 | #ifdef __cplusplus
31 | extern "C" {
32 | #endif
33 |
34 | /** @file event2/rpc_struct.h
35 |
36 | Structures used by rpc.h. Using these structures directly may harm
37 | forward compatibility: be careful!
38 |
39 | */
40 |
41 | /**
42 | * provides information about the completed RPC request.
43 | */
44 | struct evrpc_status {
45 | #define EVRPC_STATUS_ERR_NONE 0
46 | #define EVRPC_STATUS_ERR_TIMEOUT 1
47 | #define EVRPC_STATUS_ERR_BADPAYLOAD 2
48 | #define EVRPC_STATUS_ERR_UNSTARTED 3
49 | #define EVRPC_STATUS_ERR_HOOKABORTED 4
50 | int error;
51 |
52 | /* for looking at headers or other information */
53 | struct evhttp_request *http_req;
54 | };
55 |
56 | /* the structure below needs to be synchronized with evrpc_req_generic */
57 |
58 | /* Encapsulates a request */
59 | struct evrpc {
60 | TAILQ_ENTRY(evrpc) next;
61 |
62 | /* the URI at which the request handler lives */
63 | const char* uri;
64 |
65 | /* creates a new request structure */
66 | void *(*request_new)(void *);
67 | void *request_new_arg;
68 |
69 | /* frees the request structure */
70 | void (*request_free)(void *);
71 |
72 | /* unmarshals the buffer into the proper request structure */
73 | int (*request_unmarshal)(void *, struct evbuffer *);
74 |
75 | /* creates a new reply structure */
76 | void *(*reply_new)(void *);
77 | void *reply_new_arg;
78 |
79 | /* frees the reply structure */
80 | void (*reply_free)(void *);
81 |
82 | /* verifies that the reply is valid */
83 | int (*reply_complete)(void *);
84 |
85 | /* marshals the reply into a buffer */
86 | void (*reply_marshal)(struct evbuffer*, void *);
87 |
88 | /* the callback invoked for each received rpc */
89 | void (*cb)(struct evrpc_req_generic *, void *);
90 | void *cb_arg;
91 |
92 | /* reference for further configuration */
93 | struct evrpc_base *base;
94 | };
95 |
96 | #ifdef __cplusplus
97 | }
98 | #endif
99 |
100 | #endif /* EVENT2_RPC_STRUCT_H_INCLUDED_ */
101 |
--------------------------------------------------------------------------------
/app/include/x86_64/event2/tag_compat.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2000-2007 Niels Provos
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_TAG_COMPAT_H_INCLUDED_
28 | #define EVENT2_TAG_COMPAT_H_INCLUDED_
29 |
30 | /** @file event2/tag_compat.h
31 |
32 | Obsolete/deprecated functions from tag.h; provided only for backwards
33 | compatibility.
34 | */
35 |
36 | /**
37 | @name Misnamed functions
38 |
39 | @deprecated These macros are deprecated because their names don't follow
40 | Libevent's naming conventions. Use evtag_encode_int and
41 | evtag_encode_int64 instead.
42 |
43 | @{
44 | */
45 | #define encode_int(evbuf, number) evtag_encode_int((evbuf), (number))
46 | #define encode_int64(evbuf, number) evtag_encode_int64((evbuf), (number))
47 | /**@}*/
48 |
49 | #endif /* EVENT2_TAG_H_INCLUDED_ */
50 |
--------------------------------------------------------------------------------
/app/include/x86_64/event2/visibility.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 | /*
3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | * 2. Redistributions in binary form must reproduce the above copyright
11 | * notice, this list of conditions and the following disclaimer in the
12 | * documentation and/or other materials provided with the distribution.
13 | * 3. The name of the author may not be used to endorse or promote products
14 | * derived from this software without specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 | #ifndef EVENT2_VISIBILITY_H_INCLUDED_
28 | #define EVENT2_VISIBILITY_H_INCLUDED_
29 |
30 | #include
31 |
32 | #if defined(event_EXPORTS) || defined(event_extra_EXPORTS) || defined(event_core_EXPORTS)
33 | # if defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550)
34 | # define EVENT2_EXPORT_SYMBOL __global
35 | # elif defined __GNUC__
36 | # define EVENT2_EXPORT_SYMBOL __attribute__ ((visibility("default")))
37 | # elif defined(_MSC_VER)
38 | # define EVENT2_EXPORT_SYMBOL extern __declspec(dllexport)
39 | # else
40 | # define EVENT2_EXPORT_SYMBOL /* unknown compiler */
41 | # endif
42 | #else
43 | # if defined(EVENT__NEED_DLLIMPORT) && defined(_MSC_VER) && !defined(EVENT_BUILDING_REGRESS_TEST)
44 | # define EVENT2_EXPORT_SYMBOL extern __declspec(dllimport)
45 | # else
46 | # define EVENT2_EXPORT_SYMBOL
47 | # endif
48 | #endif
49 |
50 | #endif /* EVENT2_VISIBILITY_H_INCLUDED_ */
51 |
--------------------------------------------------------------------------------
/app/libs/arm64-v8a/libevent.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/streamingnology/HTTP-Server/e122291fcf5fdacfc9860b15595ec51649b292ae/app/libs/arm64-v8a/libevent.so
--------------------------------------------------------------------------------
/app/libs/armeabi-v7a/libevent.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/streamingnology/HTTP-Server/e122291fcf5fdacfc9860b15595ec51649b292ae/app/libs/armeabi-v7a/libevent.so
--------------------------------------------------------------------------------
/app/libs/x86/libevent.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/streamingnology/HTTP-Server/e122291fcf5fdacfc9860b15595ec51649b292ae/app/libs/x86/libevent.so
--------------------------------------------------------------------------------
/app/libs/x86_64/libevent.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/streamingnology/HTTP-Server/e122291fcf5fdacfc9860b15595ec51649b292ae/app/libs/x86_64/libevent.so
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
16 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/cpp/C.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | |
3 | | Copyright (c) 2018 streamingnology Inc (https://github.com/streamingnology)
4 | |
5 | | This file is part of HTTP Server
6 | |
7 | | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | | of this software and associated documentation files (the "Software"), to deal
9 | | in the Software without restriction, including without limitation the rights
10 | | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | | copies of the Software, and to permit persons to whom the Software is
12 | | furnished to do so, subject to the following conditions:
13 | |
14 | | The above copyright notice and this permission notice shall be included in all
15 | | opies or substantial portions of the Software.
16 | |
17 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | | MPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | | OFTWARE.
24 | ******************************************************************************/
25 |
26 | #ifndef HTTP_SERVER_C_H
27 | #define HTTP_SERVER_C_H
28 |
29 | #include
30 | using namespace std;
31 |
32 | static string ERRORID = "ERRORID";
33 | static string ERRORHOW = "ERRORHOW";
34 | static string ERRORHOWTO = "ERRORHOWTO";
35 |
36 | #endif //HTTP_SERVER_C_H
37 |
--------------------------------------------------------------------------------
/app/src/main/cpp/HttpServer.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | |
3 | | Copyright (c) 2018 streamingnology Inc (https://github.com/streamingnology)
4 | |
5 | | This file is part of HTTP Server
6 | |
7 | | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | | of this software and associated documentation files (the "Software"), to deal
9 | | in the Software without restriction, including without limitation the rights
10 | | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | | copies of the Software, and to permit persons to whom the Software is
12 | | furnished to do so, subject to the following conditions:
13 | |
14 | | The above copyright notice and this permission notice shall be included in all
15 | | opies or substantial portions of the Software.
16 | |
17 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | | MPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | | OFTWARE.
24 | ******************************************************************************/
25 |
26 | #ifndef MAGE_COMMON_HTTPSERVER_H
27 | #define MAGE_COMMON_HTTPSERVER_H
28 |
29 | #include
30 | #include
31 | #include "MageTypes.h"
32 | #include "MageResults.h"
33 | #include "IHttpServer.h"
34 |
35 | extern "C" {
36 | #include
37 | #include
38 | #include
39 | #include
40 | }
41 |
42 | //static struct event_base *base = NULL;
43 |
44 | using namespace std;
45 | class HttpServer: public IHttpServer
46 | {
47 | public:
48 | HttpServer();
49 | ~HttpServer();
50 |
51 | public:
52 | void SetListenPort(Mage_UI16 port);
53 | Mage_UI16 GetListenPort();
54 | void SetWebRoot(string webroot);
55 | string GetWebRoot();
56 | Mage_Result Start();
57 | void Stop();
58 | void* GetEventBase();
59 | string ToString();
60 | string GetErrorMessage();
61 | public:
62 | static void onHttpRequest(struct evhttp_request *req, void *arg);
63 |
64 | private:
65 | void makeErrorMessage(int errid, string how, string howto);
66 | private:
67 | Mage_UI16 listenPort;
68 | string webroot;
69 | struct event_base *base;
70 | struct evhttp *http;
71 | struct evhttp_bound_socket *handle;
72 | thread *httpServerThread;
73 | static const char *TAG;
74 | string err;
75 | };
76 |
77 | #endif //!MAGE_COMMON_HTTPSERVER_H
78 |
--------------------------------------------------------------------------------
/app/src/main/cpp/HttpServerJNI.cpp:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | |
3 | | Copyright (c) 2018 streamingnology Inc (https://github.com/streamingnology)
4 | |
5 | | This file is part of HTTP Server
6 | |
7 | | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | | of this software and associated documentation files (the "Software"), to deal
9 | | in the Software without restriction, including without limitation the rights
10 | | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | | copies of the Software, and to permit persons to whom the Software is
12 | | furnished to do so, subject to the following conditions:
13 | |
14 | | The above copyright notice and this permission notice shall be included in all
15 | | opies or substantial portions of the Software.
16 | |
17 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | | MPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | | OFTWARE.
24 | ******************************************************************************/
25 |
26 | #include "HttpServerJNI.h"
27 | #include "IHttpServer.h"
28 |
29 | JNIEXPORT jlong JNICALL Java_com_streamingnology_httpserver_HTTPServer_nativeCreate
30 | (JNIEnv *, jobject) {
31 | IHttpServer* httpServer = IHttpServer::CreateInstance();
32 | return (long)httpServer;
33 | }
34 |
35 | JNIEXPORT void JNICALL Java_com_streamingnology_httpserver_HTTPServer_nativeOpen
36 | (JNIEnv *env, jobject, jlong httpServer, jstring webroot, jint port) {
37 | const char *root = env->GetStringUTFChars(webroot, NULL);
38 | IHttpServer* pHttpServer = (IHttpServer*) httpServer;
39 | if (pHttpServer != NULL) {
40 | pHttpServer->SetWebRoot(root);
41 | pHttpServer->SetListenPort(port);
42 | }
43 | }
44 |
45 | JNIEXPORT jint JNICALL Java_com_streamingnology_httpserver_HTTPServer_nativeStart
46 | (JNIEnv *, jobject, jlong httpServer) {
47 | IHttpServer* pHttpServer = (IHttpServer*) httpServer;
48 | if (pHttpServer != NULL) {
49 | return pHttpServer->Start();
50 | }
51 | return 0;
52 | }
53 |
54 | JNIEXPORT void JNICALL Java_com_streamingnology_httpserver_HTTPServer_nativeStop
55 | (JNIEnv *, jobject, jlong httpServer) {
56 | IHttpServer* pHttpServer = (IHttpServer*) httpServer;
57 | if (pHttpServer != NULL) {
58 | pHttpServer->Stop();
59 | }
60 | }
61 |
62 | JNIEXPORT jstring JNICALL Java_com_streamingnology_httpserver_HTTPServer_nativeGetErrorMessage
63 | (JNIEnv *env, jobject, jlong httpServer) {
64 | IHttpServer* pHttpServer = (IHttpServer*) httpServer;
65 | if (pHttpServer != NULL) {
66 | string message = pHttpServer->GetErrorMessage();
67 | return env->NewStringUTF(message.c_str());
68 | }
69 | return env->NewStringUTF("");
70 | }
71 |
72 |
--------------------------------------------------------------------------------
/app/src/main/cpp/HttpServerJNI.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | |
3 | | Copyright (c) 2018 streamingnology Inc (https://github.com/streamingnology)
4 | |
5 | | This file is part of HTTP Server
6 | |
7 | | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | | of this software and associated documentation files (the "Software"), to deal
9 | | in the Software without restriction, including without limitation the rights
10 | | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | | copies of the Software, and to permit persons to whom the Software is
12 | | furnished to do so, subject to the following conditions:
13 | |
14 | | The above copyright notice and this permission notice shall be included in all
15 | | opies or substantial portions of the Software.
16 | |
17 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | | MPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | | OFTWARE.
24 | ******************************************************************************/
25 |
26 | /* DO NOT EDIT THIS FILE - it is machine generated */
27 | #include
28 | /* Header for class com_streamingnology_httpserver_HTTPServer */
29 |
30 | #ifndef _Included_com_streamingnology_httpserver_HTTPServer
31 | #define _Included_com_streamingnology_httpserver_HTTPServer
32 | #ifdef __cplusplus
33 | extern "C" {
34 | #endif
35 | /*
36 | * Class: com_streamingnology_httpserver_HTTPServer
37 | * Method: nativeCreate
38 | * Signature: ()J
39 | */
40 | JNIEXPORT jlong JNICALL Java_com_streamingnology_httpserver_HTTPServer_nativeCreate
41 | (JNIEnv *, jobject);
42 |
43 | /*
44 | * Class: com_streamingnology_httpserver_HTTPServer
45 | * Method: nativeOpen
46 | * Signature: (JLjava/lang/String;I)V
47 | */
48 | JNIEXPORT void JNICALL Java_com_streamingnology_httpserver_HTTPServer_nativeOpen
49 | (JNIEnv *, jobject, jlong, jstring, jint);
50 |
51 | /*
52 | * Class: com_streamingnology_httpserver_HTTPServer
53 | * Method: nativeStart
54 | * Signature: (J)I
55 | */
56 | JNIEXPORT jint JNICALL Java_com_streamingnology_httpserver_HTTPServer_nativeStart
57 | (JNIEnv *, jobject, jlong);
58 |
59 | /*
60 | * Class: com_streamingnology_httpserver_HTTPServer
61 | * Method: nativeStop
62 | * Signature: (J)V
63 | */
64 | JNIEXPORT void JNICALL Java_com_streamingnology_httpserver_HTTPServer_nativeStop
65 | (JNIEnv *, jobject, jlong);
66 |
67 | /*
68 | * Class: com_streamingnology_httpserver_HTTPServer
69 | * Method: nativeGetErrorMessage
70 | * Signature: (J)Ljava/lang/String;
71 | */
72 | JNIEXPORT jstring JNICALL Java_com_streamingnology_httpserver_HTTPServer_nativeGetErrorMessage
73 | (JNIEnv *, jobject, jlong);
74 |
75 | #ifdef __cplusplus
76 | }
77 | #endif
78 | #endif
79 |
--------------------------------------------------------------------------------
/app/src/main/cpp/IHttpServer.cpp:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | |
3 | | Copyright (c) 2018 streamingnology Inc (https://github.com/streamingnology)
4 | |
5 | | This file is part of HTTP Server
6 | |
7 | | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | | of this software and associated documentation files (the "Software"), to deal
9 | | in the Software without restriction, including without limitation the rights
10 | | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | | copies of the Software, and to permit persons to whom the Software is
12 | | furnished to do so, subject to the following conditions:
13 | |
14 | | The above copyright notice and this permission notice shall be included in all
15 | | opies or substantial portions of the Software.
16 | |
17 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | | MPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | | OFTWARE.
24 | ******************************************************************************/
25 |
26 | #include "IHttpServer.h"
27 | #include "HttpServer.h"
28 |
29 | IHttpServer *IHttpServer::CreateInstance() {
30 | return new HttpServer();
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/cpp/IHttpServer.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | |
3 | | Copyright (c) 2018 streamingnology Inc (https://github.com/streamingnology)
4 | |
5 | | This file is part of HTTP Server
6 | |
7 | | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | | of this software and associated documentation files (the "Software"), to deal
9 | | in the Software without restriction, including without limitation the rights
10 | | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | | copies of the Software, and to permit persons to whom the Software is
12 | | furnished to do so, subject to the following conditions:
13 | |
14 | | The above copyright notice and this permission notice shall be included in all
15 | | opies or substantial portions of the Software.
16 | |
17 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | | MPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | | OFTWARE.
24 | ******************************************************************************/
25 |
26 | #ifndef MAGE_COMMON_IHTTPSERVER_H
27 | #define MAGE_COMMON_IHTTPSERVER_H
28 |
29 | #include
30 | #include
31 | #include "MageTypes.h"
32 | #include "MageResults.h"
33 |
34 | using namespace std;
35 |
36 | class IHttpServer {
37 | public:
38 | static IHttpServer * CreateInstance();
39 | public:
40 | virtual void SetListenPort(Mage_UI16 port) = 0;
41 | virtual Mage_UI16 GetListenPort() = 0;
42 | virtual void SetWebRoot(string webroot) = 0;
43 | virtual string GetWebRoot() = 0;
44 | virtual Mage_Result Start() = 0;
45 | virtual void Stop() = 0;
46 | virtual void* GetEventBase() = 0;
47 | virtual string ToString() = 0;
48 | virtual string GetErrorMessage() = 0;
49 | };
50 |
51 | #endif //!MAGE_COMMON_IHTTPSERVER_H
52 |
--------------------------------------------------------------------------------
/app/src/main/cpp/Log.cpp:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | |
3 | | Copyright (c) 2018 streamingnology Inc (https://github.com/streamingnology)
4 | |
5 | | This file is part of HTTP Server
6 | |
7 | | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | | of this software and associated documentation files (the "Software"), to deal
9 | | in the Software without restriction, including without limitation the rights
10 | | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | | copies of the Software, and to permit persons to whom the Software is
12 | | furnished to do so, subject to the following conditions:
13 | |
14 | | The above copyright notice and this permission notice shall be included in all
15 | | opies or substantial portions of the Software.
16 | |
17 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | | MPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | | OFTWARE.
24 | ******************************************************************************/
25 |
26 | #include "log.h"
27 |
28 | void log_print_verbose(const char *TAG, const char *fmt, ...) {
29 | if (LEVEL <= VERBOSE) {
30 |
31 | char printf_buf[1024];
32 | va_list args;
33 |
34 | va_start(args, fmt);
35 | vsprintf(printf_buf, fmt, args);
36 | va_end(args);
37 |
38 | // 判断是否有换行符
39 | bool flag = false;
40 | if (fmt[strlen(fmt)-1] == '\n')
41 | flag = true;
42 |
43 | if (flag) {
44 | printf("V/%s: %s", TAG, printf_buf);
45 | } else {
46 | printf("V/%s: %s\n", TAG, printf_buf);
47 | }
48 | }
49 | }
50 |
51 | void log_print_debug(const char *TAG, const char *fmt, ...) {
52 | if (LEVEL <= DEBUG) {
53 |
54 | char printf_buf[1024];
55 | va_list args;
56 |
57 | va_start(args, fmt);
58 | vsprintf(printf_buf, fmt, args);
59 | va_end(args);
60 |
61 | // 判断是否有换行符
62 | bool flag = false;
63 | if (fmt[strlen(fmt)-1] == '\n')
64 | flag = true;
65 |
66 | if (flag) {
67 | printf("D/%s: %s", TAG, printf_buf);
68 | } else {
69 | printf("D/%s: %s\n", TAG, printf_buf);
70 | }
71 | }
72 | }
73 |
74 | void log_print_info(const char *TAG, const char *fmt, ...) {
75 | if (LEVEL <= INFO) {
76 |
77 | char printf_buf[1024];
78 | va_list args;
79 |
80 | va_start(args, fmt);
81 | vsprintf(printf_buf, fmt, args);
82 | va_end(args);
83 |
84 | // 判断是否有换行符
85 | bool flag = false;
86 | if (fmt[strlen(fmt)-1] == '\n')
87 | flag = true;
88 |
89 | if (flag) {
90 | printf("I/%s: %s", TAG, printf_buf);
91 | } else {
92 | printf("I/%s: %s\n", TAG, printf_buf);
93 | }
94 | }
95 | }
96 |
97 | void log_print_warn(const char *TAG, const char *fmt, ...) {
98 | if (LEVEL <= WARN) {
99 |
100 | char printf_buf[1024];
101 | va_list args;
102 |
103 | va_start(args, fmt);
104 | vsprintf(printf_buf, fmt, args);
105 | va_end(args);
106 |
107 | // 判断是否有换行符
108 | bool flag = false;
109 | if (fmt[strlen(fmt)-1] == '\n')
110 | flag = true;
111 |
112 | if (flag) {
113 | printf("W/%s: %s", TAG, printf_buf);
114 | } else {
115 | printf("W/%s: %s\n", TAG, printf_buf);
116 | }
117 | }
118 | }
119 |
120 | void log_print_error(const char *TAG, const char *fmt, ...) {
121 | if (LEVEL <= ERROR) {
122 |
123 | char printf_buf[1024];
124 | va_list args;
125 |
126 | va_start(args, fmt);
127 | vsprintf(printf_buf, fmt, args);
128 | va_end(args);
129 |
130 | // 判断是否有换行符
131 | bool flag = false;
132 | if (fmt[strlen(fmt)-1] == '\n')
133 | flag = true;
134 |
135 | if (flag) {
136 | printf("E/%s: %s", TAG, printf_buf);
137 | } else {
138 | printf("E/%s: %s\n", TAG, printf_buf);
139 | }
140 | }
141 | }
--------------------------------------------------------------------------------
/app/src/main/cpp/Log.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | |
3 | | Copyright (c) 2018 streamingnology Inc (https://github.com/streamingnology)
4 | |
5 | | This file is part of HTTP Server
6 | |
7 | | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | | of this software and associated documentation files (the "Software"), to deal
9 | | in the Software without restriction, including without limitation the rights
10 | | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | | copies of the Software, and to permit persons to whom the Software is
12 | | furnished to do so, subject to the following conditions:
13 | |
14 | | The above copyright notice and this permission notice shall be included in all
15 | | opies or substantial portions of the Software.
16 | |
17 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | | MPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | | OFTWARE.
24 | ******************************************************************************/
25 |
26 | #ifndef MAGE_COMMON_LOG_H
27 | #define MAGE_COMMON_LOG_H
28 |
29 | #include
30 | #include
31 | #include
32 |
33 | #define ANDROID_NDK true
34 |
35 | #if ANDROID_NDK
36 | #include
37 | #include
38 | #endif
39 |
40 | // ----------------------------------------------------------
41 |
42 | const int VERBOSE = 1;
43 | const int DEBUG = 2;
44 | const int INFO = 3;
45 | const int WARN = 4;
46 | const int ERROR = 5;
47 |
48 | const int LEVEL = VERBOSE;
49 |
50 | // ----------------------------------------------------------
51 |
52 | void log_print_verbose(const char *TAG, const char *fmt, ...);
53 | void log_print_debug(const char *TAG, const char *fmt, ...);
54 | void log_print_info(const char *TAG, const char *fmt, ...);
55 | void log_print_warn(const char *TAG, const char *fmt, ...);
56 | void log_print_error(const char *TAG, const char *fmt, ...);
57 |
58 | #if ANDROID_NDK
59 | #define LOGV(TAG, ...) __android_log_print(ANDROID_LOG_VERBOSE, TAG, __VA_ARGS__)
60 | #define LOGD(TAG, ...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__)
61 | #define LOGI(TAG, ...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__)
62 | #define LOGW(TAG, ...) __android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__)
63 | #define LOGE(TAG, ...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__)
64 | #else
65 | #define LOGV(TAG, fmt, ...) log_print_verbose(TAG, fmt, ##__VA_ARGS__)
66 | #define LOGD(TAG, fmt, ...) log_print_debug(TAG, fmt, ##__VA_ARGS__)
67 | #define LOGI(TAG, fmt, ...) log_print_info(TAG, fmt, ##__VA_ARGS__)
68 | #define LOGW(TAG, fmt, ...) log_print_warn(TAG, fmt, ##__VA_ARGS__)
69 | #define LOGE(TAG, fmt, ...) log_print_error(TAG, fmt, ##__VA_ARGS__)
70 | #endif
71 |
72 | #endif // !MAGE_COMMON_LOG_H
--------------------------------------------------------------------------------
/app/src/main/cpp/MageResults.cpp:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | |
3 | | Copyright (c) 2018 streamingnology Inc (https://github.com/streamingnology)
4 | |
5 | | This file is part of HTTP Server
6 | |
7 | | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | | of this software and associated documentation files (the "Software"), to deal
9 | | in the Software without restriction, including without limitation the rights
10 | | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | | copies of the Software, and to permit persons to whom the Software is
12 | | furnished to do so, subject to the following conditions:
13 | |
14 | | The above copyright notice and this permission notice shall be included in all
15 | | opies or substantial portions of the Software.
16 | |
17 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | | MPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | | OFTWARE.
24 | ******************************************************************************/
25 |
26 | #include "MageResults.h"
27 |
28 | const char* Mage_ResultText(int result) {
29 | switch (result) {
30 | case Mage_SUCCESS: return "Mage_SUCCESS";
31 | case Mage_FAILURE: return "Mage_FAILURE";
32 | case Mage_ERROR_OUT_OF_MEMORY: return "Mage_ERROR_OUT_OF_MEMORY";
33 | case Mage_ERROR_INVALID_PARAMETERS: return "Mage_ERROR_INVALID_PARAMETERS";
34 | case Mage_ERROR_NO_SUCH_FILE: return "Mage_ERROR_NO_SUCH_FILE";
35 | case Mage_ERROR_PERMISSION_DENIED: return "Mage_ERROR_PERMISSION_DENIED";
36 | case Mage_ERROR_CANNOT_OPEN_FILE: return "Mage_ERROR_CANNOT_OPEN_FILE";
37 | case Mage_ERROR_EOS: return "Mage_ERROR_EOS";
38 | case Mage_ERROR_WRITE_FAILED: return "Mage_ERROR_WRITE_FAILED";
39 | case Mage_ERROR_READ_FAILED: return "Mage_ERROR_READ_FAILED";
40 | case Mage_ERROR_INVALID_FORMAT: return "Mage_ERROR_INVALID_FORMAT";
41 | case Mage_ERROR_NO_SUCH_ITEM: return "Mage_ERROR_NO_SUCH_ITEM";
42 | case Mage_ERROR_OUT_OF_RANGE: return "Mage_ERROR_OUT_OF_RANGE";
43 | case Mage_ERROR_INTERNAL: return "Mage_ERROR_INTERNAL";
44 | case Mage_ERROR_INVALID_STATE: return "Mage_ERROR_INVALID_STATE";
45 | case Mage_ERROR_LIST_EMPTY: return "Mage_ERROR_LIST_EMPTY";
46 | case Mage_ERROR_LIST_OPERATION_ABORTED: return "Mage_ERROR_LIST_OPERATION_ABORTED";
47 | case Mage_ERROR_INVALID_RTP_CONSTRUCTOR_TYPE: return "Mage_ERROR_INVALID_RTP_CONSTRUCTOR_TYPE";
48 | case Mage_ERROR_NOT_SUPPORTED: return "Mage_ERROR_NOT_SUPPORTED";
49 | case Mage_ERROR_INVALID_TRACK_TYPE: return "Mage_ERROR_INVALID_TRACK_TYPE";
50 | case Mage_ERROR_INVALID_RTP_PACKET_EXTRA_DATA: return "Mage_ERROR_INVALID_RTP_PACKET_EXTRA_DATA";
51 | case Mage_ERROR_BUFFER_TOO_SMALL: return "Mage_ERROR_BUFFER_TOO_SMALL";
52 | case Mage_ERROR_NOT_ENOUGH_DATA: return "Mage_ERROR_NOT_ENOUGH_DATA";
53 | default: return "UNKNOWN";
54 | }
55 | }
56 |
57 |
--------------------------------------------------------------------------------
/app/src/main/cpp/MageResults.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | |
3 | | Copyright (c) 2018 streamingnology Inc (https://github.com/streamingnology)
4 | |
5 | | This file is part of HTTP Server
6 | |
7 | | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | | of this software and associated documentation files (the "Software"), to deal
9 | | in the Software without restriction, including without limitation the rights
10 | | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | | copies of the Software, and to permit persons to whom the Software is
12 | | furnished to do so, subject to the following conditions:
13 | |
14 | | The above copyright notice and this permission notice shall be included in all
15 | | opies or substantial portions of the Software.
16 | |
17 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | | MPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | | OFTWARE.
24 | ******************************************************************************/
25 |
26 | #ifndef MAGE_COMMON_RESULTS_H_
27 | #define MAGE_COMMON_RESULTS_H_
28 |
29 | const int Mage_SUCCESS = 0;
30 | const int Mage_FAILURE = -1;
31 | const int Mage_ERROR_OUT_OF_MEMORY = -2;
32 | const int Mage_ERROR_INVALID_PARAMETERS = -3;
33 | const int Mage_ERROR_NO_SUCH_FILE = -4;
34 | const int Mage_ERROR_PERMISSION_DENIED = -5;
35 | const int Mage_ERROR_CANNOT_OPEN_FILE = -6;
36 | const int Mage_ERROR_EOS = -7;
37 | const int Mage_ERROR_WRITE_FAILED = -8;
38 | const int Mage_ERROR_READ_FAILED = -9;
39 | const int Mage_ERROR_INVALID_FORMAT = -10;
40 | const int Mage_ERROR_NO_SUCH_ITEM = -11;
41 | const int Mage_ERROR_OUT_OF_RANGE = -12;
42 | const int Mage_ERROR_INTERNAL = -13;
43 | const int Mage_ERROR_INVALID_STATE = -14;
44 | const int Mage_ERROR_LIST_EMPTY = -15;
45 | const int Mage_ERROR_LIST_OPERATION_ABORTED = -16;
46 | const int Mage_ERROR_INVALID_RTP_CONSTRUCTOR_TYPE = -17;
47 | const int Mage_ERROR_NOT_SUPPORTED = -18;
48 | const int Mage_ERROR_INVALID_TRACK_TYPE = -19;
49 | const int Mage_ERROR_INVALID_RTP_PACKET_EXTRA_DATA = -20;
50 | const int Mage_ERROR_BUFFER_TOO_SMALL = -21;
51 | const int Mage_ERROR_NOT_ENOUGH_DATA = -22;
52 | const int Mage_ERROR_NOT_ENOUGH_SPACE = -23;
53 |
54 | const char* Mage_ResultText(int result);
55 |
56 | #define Mage_FAILED(result) ((result) != Mage_SUCCESS)
57 | #define Mage_SUCCEEDED(result) ((result) == Mage_SUCCESS)
58 |
59 | #define Mage_CHECK(_x) do { \
60 | Mage_Result _result = (_x); \
61 | if (Mage_FAILED(_result)) return _result; \
62 | } while(0)
63 |
64 | #endif //!MAGE_COMMON_RESULTS_H_
65 |
--------------------------------------------------------------------------------
/app/src/main/cpp/MageTypes.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | |
3 | | Copyright (c) 2018 streamingnology Inc (https://github.com/streamingnology)
4 | |
5 | | This file is part of HTTP Server
6 | |
7 | | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | | of this software and associated documentation files (the "Software"), to deal
9 | | in the Software without restriction, including without limitation the rights
10 | | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | | copies of the Software, and to permit persons to whom the Software is
12 | | furnished to do so, subject to the following conditions:
13 | |
14 | | The above copyright notice and this permission notice shall be included in all
15 | | opies or substantial portions of the Software.
16 | |
17 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | | MPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | | OFTWARE.
24 | ******************************************************************************/
25 |
26 | #ifndef MAGE_COMMON_MAGE_TYPES_H_
27 | #define MAGE_COMMON_MAGE_TYPES_H_
28 |
29 | #include
30 | #include
31 |
32 | typedef int Mage_Result;
33 | typedef unsigned int Mage_Flags;
34 | typedef unsigned int Mage_Mask;
35 | typedef unsigned int Mage_Cardinal;
36 | typedef unsigned int Mage_Ordinal;
37 | typedef unsigned int Mage_UI32;
38 | typedef signed int Mage_SI32;
39 | typedef unsigned short Mage_UI16;
40 | typedef signed short Mage_SI16;
41 | typedef unsigned char Mage_UI08;
42 | typedef Mage_UI08 Mage_Byte;
43 | typedef Mage_UI32 Mage_Size;
44 | typedef __int64_t Mage_SI64;
45 | typedef __uint64_t Mage_UI64;
46 |
47 | #endif //!MAGE_COMMON_MAGE_TYPES_H_
--------------------------------------------------------------------------------
/app/src/main/java/com/streamingnology/httpserver/GetIPAddressUtil.java:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | |
3 | | Copyright (c) 2018 streamingnology Inc (https://github.com/streamingnology)
4 | |
5 | | This file is part of HTTP Server
6 | |
7 | | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | | of this software and associated documentation files (the "Software"), to deal
9 | | in the Software without restriction, including without limitation the rights
10 | | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | | copies of the Software, and to permit persons to whom the Software is
12 | | furnished to do so, subject to the following conditions:
13 | |
14 | | The above copyright notice and this permission notice shall be included in all
15 | | opies or substantial portions of the Software.
16 | |
17 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | | MPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | | OFTWARE.
24 | ******************************************************************************/
25 |
26 | package com.streamingnology.httpserver;
27 |
28 | import android.content.Context;
29 | import android.net.wifi.WifiInfo;
30 | import android.net.wifi.WifiManager;
31 |
32 | public class GetIPAddressUtil {
33 |
34 | public static String getWifiIP(Context context) {
35 | String ip = null;
36 | WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
37 | if (wifiManager != null && wifiManager.isWifiEnabled()) {
38 | WifiInfo wifiInfo = wifiManager.getConnectionInfo();
39 | int i = wifiInfo.getIpAddress();
40 | ip = (i & 0xFF) + "." + ((i >> 8) & 0xFF) + "." + ((i >> 16) & 0xFF)
41 | + "." + (i >> 24 & 0xFF);
42 | }
43 | return ip;
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/java/com/streamingnology/httpserver/HTTPServer.java:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | |
3 | | Copyright (c) 2018 streamingnology Inc (https://github.com/streamingnology)
4 | |
5 | | This file is part of HTTP Server
6 | |
7 | | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | | of this software and associated documentation files (the "Software"), to deal
9 | | in the Software without restriction, including without limitation the rights
10 | | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | | copies of the Software, and to permit persons to whom the Software is
12 | | furnished to do so, subject to the following conditions:
13 | |
14 | | The above copyright notice and this permission notice shall be included in all
15 | | opies or substantial portions of the Software.
16 | |
17 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | | MPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | | OFTWARE.
24 | ******************************************************************************/
25 |
26 | package com.streamingnology.httpserver;
27 |
28 | public class HTTPServer {
29 | private String TAG = "HTTPServer";
30 | private String webroot = "";
31 | private int port = 8080;
32 | private long nativeHTTPServer = 0;
33 |
34 | static {
35 | System.loadLibrary("httpserver-jni");
36 | }
37 |
38 | public void setParameter(String webroot, int port) {
39 | this.webroot = webroot;
40 | this.port = port;
41 | }
42 |
43 | public void open () {
44 | nativeHTTPServer = nativeCreate();
45 | nativeOpen(nativeHTTPServer, webroot, port);
46 | }
47 |
48 | public int start() {
49 | if (nativeHTTPServer != 0) {
50 | return nativeStart(nativeHTTPServer);
51 | }
52 | return 0;
53 | }
54 |
55 | public void stop() {
56 | if (nativeHTTPServer != 0) {
57 | nativeStop(nativeHTTPServer);
58 | }
59 | }
60 |
61 | public String getErrorMessage() {
62 | if (nativeHTTPServer != 0) {
63 | return nativeGetErrorMessage(nativeHTTPServer);
64 | }
65 | return "";
66 | }
67 |
68 | private native long nativeCreate();
69 | private native void nativeOpen(long HTTPServer, String webroot, int port);
70 | private native int nativeStart(long HTTPServer);
71 | private native void nativeStop(long HTTPServer);
72 | private native String nativeGetErrorMessage(long HTTPServer);
73 | }
74 |
--------------------------------------------------------------------------------
/app/src/main/java/com/streamingnology/httpserver/WifiReceiver.java:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | |
3 | | Copyright (c) 2018 streamingnology Inc (https://github.com/streamingnology)
4 | |
5 | | This file is part of HTTP Server
6 | |
7 | | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | | of this software and associated documentation files (the "Software"), to deal
9 | | in the Software without restriction, including without limitation the rights
10 | | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | | copies of the Software, and to permit persons to whom the Software is
12 | | furnished to do so, subject to the following conditions:
13 | |
14 | | The above copyright notice and this permission notice shall be included in all
15 | | opies or substantial portions of the Software.
16 | |
17 | | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | | MPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | | OFTWARE.
24 | ******************************************************************************/
25 |
26 | package com.streamingnology.httpserver;
27 |
28 | import android.content.BroadcastReceiver;
29 | import android.content.Context;
30 | import android.content.Intent;
31 | import android.net.ConnectivityManager;
32 | import android.net.NetworkInfo;
33 | import android.net.wifi.WifiInfo;
34 | import android.net.wifi.WifiManager;
35 | import android.util.Log;
36 |
37 | public class WifiReceiver extends BroadcastReceiver {
38 |
39 | String TAG = getClass().getSimpleName();
40 | @Override
41 | public void onReceive(Context context, Intent intent) {
42 | if (intent.getAction().equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
43 |
44 | ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
45 | NetworkInfo networkInfo = cm.getActiveNetworkInfo();
46 |
47 | if (networkInfo != null && networkInfo.getType() == ConnectivityManager.TYPE_WIFI &&
48 | networkInfo.isConnected()) {
49 | // Wifi is connected
50 | WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
51 | WifiInfo wifiInfo = wifiManager.getConnectionInfo();
52 | String ssid = wifiInfo.getSSID();
53 |
54 | Log.e(TAG, " -- Wifi connected --- " + " SSID " + ssid );
55 |
56 | }
57 | }
58 | else if (intent.getAction().equalsIgnoreCase(WifiManager.WIFI_STATE_CHANGED_ACTION))
59 | {
60 | int wifiState = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE, WifiManager.WIFI_STATE_UNKNOWN);
61 | if (wifiState == WifiManager.WIFI_STATE_DISABLED)
62 | {
63 | Log.e(TAG, " ----- Wifi Disconnected ----- ");
64 | }
65 |
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
18 |
19 |
23 |
24 |
29 |
30 |
35 |
36 |
41 |
42 |
43 |
44 |
45 |
50 |
51 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_mainpage.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
21 |
22 |
32 |
33 |
39 |
40 |
51 |
52 |
63 |
64 |
77 |
78 |
88 |
89 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
23 |
24 |
38 |
39 |
49 |
50 |
61 |
62 |
77 |
78 |
88 |
89 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/streamingnology/HTTP-Server/e122291fcf5fdacfc9860b15595ec51649b292ae/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/streamingnology/HTTP-Server/e122291fcf5fdacfc9860b15595ec51649b292ae/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/streamingnology/HTTP-Server/e122291fcf5fdacfc9860b15595ec51649b292ae/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/streamingnology/HTTP-Server/e122291fcf5fdacfc9860b15595ec51649b292ae/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/streamingnology/HTTP-Server/e122291fcf5fdacfc9860b15595ec51649b292ae/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/streamingnology/HTTP-Server/e122291fcf5fdacfc9860b15595ec51649b292ae/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/streamingnology/HTTP-Server/e122291fcf5fdacfc9860b15595ec51649b292ae/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/streamingnology/HTTP-Server/e122291fcf5fdacfc9860b15595ec51649b292ae/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/streamingnology/HTTP-Server/e122291fcf5fdacfc9860b15595ec51649b292ae/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/streamingnology/HTTP-Server/e122291fcf5fdacfc9860b15595ec51649b292ae/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 16dp
6 | 8dp
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Http Server
3 | Http Server
4 | Settings
5 | About
6 | Settings
7 | Hello World from section: %1$d
8 | MainPage
9 | ca-app-pub-0143974411186089/7643209317
10 | running
11 | stopped
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.1.0'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/streamingnology/HTTP-Server/e122291fcf5fdacfc9860b15595ec51649b292ae/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Apr 04 16:44:48 CST 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------