Showing
79 changed files
with
4680 additions
and
0 deletions
Too many changes to show.
To preserve performance only 79 of 79+ files are displayed.
.doxygen
0 → 100644
1 | +# Doxyfile 1.7.3 | |
2 | + | |
3 | +#--------------------------------------------------------------------------- | |
4 | +# Project related configuration options | |
5 | +#--------------------------------------------------------------------------- | |
6 | +DOXYFILE_ENCODING = UTF-8 | |
7 | +PROJECT_NAME = Server | |
8 | +PROJECT_NUMBER = 0.0.1 | |
9 | +PROJECT_BRIEF = "HTTP/REST server implementation" | |
10 | +PROJECT_LOGO = | |
11 | +OUTPUT_DIRECTORY = docs | |
12 | +CREATE_SUBDIRS = NO | |
13 | +OUTPUT_LANGUAGE = English | |
14 | +BRIEF_MEMBER_DESC = YES | |
15 | +REPEAT_BRIEF = YES | |
16 | +ABBREVIATE_BRIEF = | |
17 | +ALWAYS_DETAILED_SEC = NO | |
18 | +INLINE_INHERITED_MEMB = NO | |
19 | +FULL_PATH_NAMES = YES | |
20 | +STRIP_FROM_PATH = | |
21 | +STRIP_FROM_INC_PATH = | |
22 | +SHORT_NAMES = NO | |
23 | +JAVADOC_AUTOBRIEF = NO | |
24 | +QT_AUTOBRIEF = NO | |
25 | +MULTILINE_CPP_IS_BRIEF = NO | |
26 | +INHERIT_DOCS = YES | |
27 | +SEPARATE_MEMBER_PAGES = NO | |
28 | +TAB_SIZE = 8 | |
29 | +ALIASES = | |
30 | +OPTIMIZE_OUTPUT_FOR_C = YES | |
31 | +OPTIMIZE_OUTPUT_JAVA = NO | |
32 | +OPTIMIZE_FOR_FORTRAN = NO | |
33 | +OPTIMIZE_OUTPUT_VHDL = NO | |
34 | +EXTENSION_MAPPING = | |
35 | +BUILTIN_STL_SUPPORT = NO | |
36 | +CPP_CLI_SUPPORT = YES | |
37 | +SIP_SUPPORT = NO | |
38 | +IDL_PROPERTY_SUPPORT = YES | |
39 | +DISTRIBUTE_GROUP_DOC = NO | |
40 | +SUBGROUPING = YES | |
41 | +TYPEDEF_HIDES_STRUCT = NO | |
42 | +SYMBOL_CACHE_SIZE = 0 | |
43 | +#--------------------------------------------------------------------------- | |
44 | +# Build related configuration options | |
45 | +#--------------------------------------------------------------------------- | |
46 | +EXTRACT_ALL = YES | |
47 | +EXTRACT_PRIVATE = NO | |
48 | +EXTRACT_STATIC = NO | |
49 | +EXTRACT_LOCAL_CLASSES = YES | |
50 | +EXTRACT_LOCAL_METHODS = YES | |
51 | +EXTRACT_ANON_NSPACES = YES | |
52 | +HIDE_UNDOC_MEMBERS = NO | |
53 | +HIDE_UNDOC_CLASSES = NO | |
54 | +HIDE_FRIEND_COMPOUNDS = NO | |
55 | +HIDE_IN_BODY_DOCS = NO | |
56 | +INTERNAL_DOCS = YES | |
57 | +CASE_SENSE_NAMES = YES | |
58 | +HIDE_SCOPE_NAMES = NO | |
59 | +SHOW_INCLUDE_FILES = YES | |
60 | +FORCE_LOCAL_INCLUDES = NO | |
61 | +INLINE_INFO = YES | |
62 | +SORT_MEMBER_DOCS = YES | |
63 | +SORT_BRIEF_DOCS = NO | |
64 | +SORT_MEMBERS_CTORS_1ST = NO | |
65 | +SORT_GROUP_NAMES = NO | |
66 | +SORT_BY_SCOPE_NAME = NO | |
67 | +STRICT_PROTO_MATCHING = NO | |
68 | +GENERATE_TODOLIST = YES | |
69 | +GENERATE_TESTLIST = YES | |
70 | +GENERATE_BUGLIST = YES | |
71 | +GENERATE_DEPRECATEDLIST= YES | |
72 | +ENABLED_SECTIONS = | |
73 | +MAX_INITIALIZER_LINES = 30 | |
74 | +SHOW_USED_FILES = YES | |
75 | +SHOW_DIRECTORIES = NO | |
76 | +SHOW_FILES = YES | |
77 | +SHOW_NAMESPACES = YES | |
78 | +FILE_VERSION_FILTER = | |
79 | +LAYOUT_FILE = | |
80 | +#--------------------------------------------------------------------------- | |
81 | +# configuration options related to warning and progress messages | |
82 | +#--------------------------------------------------------------------------- | |
83 | +QUIET = NO | |
84 | +WARNINGS = YES | |
85 | +WARN_IF_UNDOCUMENTED = YES | |
86 | +WARN_IF_DOC_ERROR = YES | |
87 | +WARN_NO_PARAMDOC = NO | |
88 | +WARN_FORMAT = "$file:$line: $text" | |
89 | +WARN_LOGFILE = | |
90 | +#--------------------------------------------------------------------------- | |
91 | +# configuration options related to the input files | |
92 | +#--------------------------------------------------------------------------- | |
93 | +INPUT = | |
94 | +INPUT_ENCODING = UTF-8 | |
95 | +FILE_PATTERNS = | |
96 | +RECURSIVE = YES | |
97 | +EXCLUDE = | |
98 | +EXCLUDE_SYMLINKS = NO | |
99 | +EXCLUDE_PATTERNS = */tests/* */doc/* */docs/* */.git/* | |
100 | +EXCLUDE_SYMBOLS = | |
101 | +EXAMPLE_PATH = | |
102 | +EXAMPLE_PATTERNS = | |
103 | +EXAMPLE_RECURSIVE = NO | |
104 | +IMAGE_PATH = | |
105 | +INPUT_FILTER = | |
106 | +FILTER_PATTERNS = | |
107 | +FILTER_SOURCE_FILES = NO | |
108 | +FILTER_SOURCE_PATTERNS = | |
109 | +#--------------------------------------------------------------------------- | |
110 | +# configuration options related to source browsing | |
111 | +#--------------------------------------------------------------------------- | |
112 | +SOURCE_BROWSER = YES | |
113 | +INLINE_SOURCES = YES | |
114 | +STRIP_CODE_COMMENTS = YES | |
115 | +REFERENCED_BY_RELATION = NO | |
116 | +REFERENCES_RELATION = NO | |
117 | +REFERENCES_LINK_SOURCE = YES | |
118 | +USE_HTAGS = NO | |
119 | +VERBATIM_HEADERS = YES | |
120 | +#--------------------------------------------------------------------------- | |
121 | +# configuration options related to the alphabetical class index | |
122 | +#--------------------------------------------------------------------------- | |
123 | +ALPHABETICAL_INDEX = YES | |
124 | +COLS_IN_ALPHA_INDEX = 5 | |
125 | +IGNORE_PREFIX = | |
126 | +#--------------------------------------------------------------------------- | |
127 | +# configuration options related to the HTML output | |
128 | +#--------------------------------------------------------------------------- | |
129 | +GENERATE_HTML = YES | |
130 | +HTML_OUTPUT = html | |
131 | +HTML_FILE_EXTENSION = .html | |
132 | +HTML_HEADER = | |
133 | +HTML_FOOTER = | |
134 | +HTML_STYLESHEET = | |
135 | +HTML_COLORSTYLE_HUE = 220 | |
136 | +HTML_COLORSTYLE_SAT = 100 | |
137 | +HTML_COLORSTYLE_GAMMA = 80 | |
138 | +HTML_TIMESTAMP = YES | |
139 | +HTML_ALIGN_MEMBERS = YES | |
140 | +HTML_DYNAMIC_SECTIONS = NO | |
141 | +GENERATE_DOCSET = NO | |
142 | +DOCSET_FEEDNAME = "Doxygen generated docs" | |
143 | +DOCSET_BUNDLE_ID = org.doxygen.Project | |
144 | +DOCSET_PUBLISHER_ID = org.doxygen.Publisher | |
145 | +DOCSET_PUBLISHER_NAME = Publisher | |
146 | +GENERATE_HTMLHELP = NO | |
147 | +CHM_FILE = | |
148 | +HHC_LOCATION = | |
149 | +GENERATE_CHI = NO | |
150 | +CHM_INDEX_ENCODING = | |
151 | +BINARY_TOC = NO | |
152 | +TOC_EXPAND = NO | |
153 | +GENERATE_QHP = NO | |
154 | +QCH_FILE = | |
155 | +QHP_NAMESPACE = org.doxygen.Project | |
156 | +QHP_VIRTUAL_FOLDER = doc | |
157 | +QHP_CUST_FILTER_NAME = | |
158 | +QHP_CUST_FILTER_ATTRS = | |
159 | +QHP_SECT_FILTER_ATTRS = | |
160 | +QHG_LOCATION = | |
161 | +GENERATE_ECLIPSEHELP = NO | |
162 | +ECLIPSE_DOC_ID = org.doxygen.Project | |
163 | +DISABLE_INDEX = NO | |
164 | +ENUM_VALUES_PER_LINE = 4 | |
165 | +GENERATE_TREEVIEW = YES | |
166 | +USE_INLINE_TREES = YES | |
167 | +TREEVIEW_WIDTH = 250 | |
168 | +EXT_LINKS_IN_WINDOW = NO | |
169 | +FORMULA_FONTSIZE = 10 | |
170 | +FORMULA_TRANSPARENT = YES | |
171 | +USE_MATHJAX = NO | |
172 | +MATHJAX_RELPATH = http://www.mathjax.org/mathjax | |
173 | +SEARCHENGINE = YES | |
174 | +SERVER_BASED_SEARCH = NO | |
175 | +#--------------------------------------------------------------------------- | |
176 | +# configuration options related to the LaTeX output | |
177 | +#--------------------------------------------------------------------------- | |
178 | +GENERATE_LATEX = YES | |
179 | +LATEX_OUTPUT = latex | |
180 | +LATEX_CMD_NAME = latex | |
181 | +MAKEINDEX_CMD_NAME = makeindex | |
182 | +COMPACT_LATEX = NO | |
183 | +PAPER_TYPE = a4 | |
184 | +EXTRA_PACKAGES = | |
185 | +LATEX_HEADER = | |
186 | +PDF_HYPERLINKS = YES | |
187 | +USE_PDFLATEX = YES | |
188 | +LATEX_BATCHMODE = NO | |
189 | +LATEX_HIDE_INDICES = NO | |
190 | +LATEX_SOURCE_CODE = NO | |
191 | +#--------------------------------------------------------------------------- | |
192 | +# configuration options related to the RTF output | |
193 | +#--------------------------------------------------------------------------- | |
194 | +GENERATE_RTF = NO | |
195 | +RTF_OUTPUT = rtf | |
196 | +COMPACT_RTF = NO | |
197 | +RTF_HYPERLINKS = NO | |
198 | +RTF_STYLESHEET_FILE = | |
199 | +RTF_EXTENSIONS_FILE = | |
200 | +#--------------------------------------------------------------------------- | |
201 | +# configuration options related to the man page output | |
202 | +#--------------------------------------------------------------------------- | |
203 | +GENERATE_MAN = NO | |
204 | +MAN_OUTPUT = man | |
205 | +MAN_EXTENSION = .3 | |
206 | +MAN_LINKS = NO | |
207 | +#--------------------------------------------------------------------------- | |
208 | +# configuration options related to the XML output | |
209 | +#--------------------------------------------------------------------------- | |
210 | +GENERATE_XML = NO | |
211 | +XML_OUTPUT = xml | |
212 | +XML_SCHEMA = | |
213 | +XML_DTD = | |
214 | +XML_PROGRAMLISTING = YES | |
215 | +#--------------------------------------------------------------------------- | |
216 | +# configuration options for the AutoGen Definitions output | |
217 | +#--------------------------------------------------------------------------- | |
218 | +GENERATE_AUTOGEN_DEF = NO | |
219 | +#--------------------------------------------------------------------------- | |
220 | +# configuration options related to the Perl module output | |
221 | +#--------------------------------------------------------------------------- | |
222 | +GENERATE_PERLMOD = NO | |
223 | +PERLMOD_LATEX = NO | |
224 | +PERLMOD_PRETTY = YES | |
225 | +PERLMOD_MAKEVAR_PREFIX = | |
226 | +#--------------------------------------------------------------------------- | |
227 | +# Configuration options related to the preprocessor | |
228 | +#--------------------------------------------------------------------------- | |
229 | +ENABLE_PREPROCESSING = YES | |
230 | +MACRO_EXPANSION = NO | |
231 | +EXPAND_ONLY_PREDEF = NO | |
232 | +SEARCH_INCLUDES = YES | |
233 | +INCLUDE_PATH = | |
234 | +INCLUDE_FILE_PATTERNS = | |
235 | +PREDEFINED = | |
236 | +EXPAND_AS_DEFINED = | |
237 | +SKIP_FUNCTION_MACROS = NO | |
238 | +#--------------------------------------------------------------------------- | |
239 | +# Configuration::additions related to external references | |
240 | +#--------------------------------------------------------------------------- | |
241 | +TAGFILES = | |
242 | +GENERATE_TAGFILE = | |
243 | +ALLEXTERNALS = NO | |
244 | +EXTERNAL_GROUPS = YES | |
245 | +PERL_PATH = /usr/bin/perl | |
246 | +#--------------------------------------------------------------------------- | |
247 | +# Configuration options related to the dot tool | |
248 | +#--------------------------------------------------------------------------- | |
249 | +CLASS_DIAGRAMS = YES | |
250 | +MSCGEN_PATH = | |
251 | +HIDE_UNDOC_RELATIONS = YES | |
252 | +HAVE_DOT = YES | |
253 | +DOT_NUM_THREADS = 0 | |
254 | +DOT_FONTNAME = Helvetica | |
255 | +DOT_FONTSIZE = 10 | |
256 | +DOT_FONTPATH = | |
257 | +CLASS_GRAPH = YES | |
258 | +COLLABORATION_GRAPH = YES | |
259 | +GROUP_GRAPHS = YES | |
260 | +UML_LOOK = YES | |
261 | +TEMPLATE_RELATIONS = NO | |
262 | +INCLUDE_GRAPH = YES | |
263 | +INCLUDED_BY_GRAPH = YES | |
264 | +CALL_GRAPH = YES | |
265 | +CALLER_GRAPH = YES | |
266 | +GRAPHICAL_HIERARCHY = YES | |
267 | +DIRECTORY_GRAPH = YES | |
268 | +DOT_IMAGE_FORMAT = png | |
269 | +DOT_PATH = | |
270 | +DOTFILE_DIRS = | |
271 | +MSCFILE_DIRS = | |
272 | +DOT_GRAPH_MAX_NODES = 50 | |
273 | +MAX_DOT_GRAPH_DEPTH = 0 | |
274 | +DOT_TRANSPARENT = YES | |
275 | +DOT_MULTI_TARGETS = NO | |
276 | +GENERATE_LEGEND = YES | |
277 | +DOT_CLEANUP = YES | ... | ... |
.gitignore
0 → 100644
COPYING
0 → 100644
1 | + GNU GENERAL PUBLIC LICENSE | |
2 | + Version 3, 29 June 2007 | |
3 | + | |
4 | + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> | |
5 | + Everyone is permitted to copy and distribute verbatim copies | |
6 | + of this license document, but changing it is not allowed. | |
7 | + | |
8 | + Preamble | |
9 | + | |
10 | + The GNU General Public License is a free, copyleft license for | |
11 | +software and other kinds of works. | |
12 | + | |
13 | + The licenses for most software and other practical works are designed | |
14 | +to take away your freedom to share and change the works. By contrast, | |
15 | +the GNU General Public License is intended to guarantee your freedom to | |
16 | +share and change all versions of a program--to make sure it remains free | |
17 | +software for all its users. We, the Free Software Foundation, use the | |
18 | +GNU General Public License for most of our software; it applies also to | |
19 | +any other work released this way by its authors. You can apply it to | |
20 | +your programs, too. | |
21 | + | |
22 | + When we speak of free software, we are referring to freedom, not | |
23 | +price. Our General Public Licenses are designed to make sure that you | |
24 | +have the freedom to distribute copies of free software (and charge for | |
25 | +them if you wish), that you receive source code or can get it if you | |
26 | +want it, that you can change the software or use pieces of it in new | |
27 | +free programs, and that you know you can do these things. | |
28 | + | |
29 | + To protect your rights, we need to prevent others from denying you | |
30 | +these rights or asking you to surrender the rights. Therefore, you have | |
31 | +certain responsibilities if you distribute copies of the software, or if | |
32 | +you modify it: responsibilities to respect the freedom of others. | |
33 | + | |
34 | + For example, if you distribute copies of such a program, whether | |
35 | +gratis or for a fee, you must pass on to the recipients the same | |
36 | +freedoms that you received. You must make sure that they, too, receive | |
37 | +or can get the source code. And you must show them these terms so they | |
38 | +know their rights. | |
39 | + | |
40 | + Developers that use the GNU GPL protect your rights with two steps: | |
41 | +(1) assert copyright on the software, and (2) offer you this License | |
42 | +giving you legal permission to copy, distribute and/or modify it. | |
43 | + | |
44 | + For the developers' and authors' protection, the GPL clearly explains | |
45 | +that there is no warranty for this free software. For both users' and | |
46 | +authors' sake, the GPL requires that modified versions be marked as | |
47 | +changed, so that their problems will not be attributed erroneously to | |
48 | +authors of previous versions. | |
49 | + | |
50 | + Some devices are designed to deny users access to install or run | |
51 | +modified versions of the software inside them, although the manufacturer | |
52 | +can do so. This is fundamentally incompatible with the aim of | |
53 | +protecting users' freedom to change the software. The systematic | |
54 | +pattern of such abuse occurs in the area of products for individuals to | |
55 | +use, which is precisely where it is most unacceptable. Therefore, we | |
56 | +have designed this version of the GPL to prohibit the practice for those | |
57 | +products. If such problems arise substantially in other domains, we | |
58 | +stand ready to extend this provision to those domains in future versions | |
59 | +of the GPL, as needed to protect the freedom of users. | |
60 | + | |
61 | + Finally, every program is threatened constantly by software patents. | |
62 | +States should not allow patents to restrict development and use of | |
63 | +software on general-purpose computers, but in those that do, we wish to | |
64 | +avoid the special danger that patents applied to a free program could | |
65 | +make it effectively proprietary. To prevent this, the GPL assures that | |
66 | +patents cannot be used to render the program non-free. | |
67 | + | |
68 | + The precise terms and conditions for copying, distribution and | |
69 | +modification follow. | |
70 | + | |
71 | + TERMS AND CONDITIONS | |
72 | + | |
73 | + 0. Definitions. | |
74 | + | |
75 | + "This License" refers to version 3 of the GNU General Public License. | |
76 | + | |
77 | + "Copyright" also means copyright-like laws that apply to other kinds of | |
78 | +works, such as semiconductor masks. | |
79 | + | |
80 | + "The Program" refers to any copyrightable work licensed under this | |
81 | +License. Each licensee is addressed as "you". "Licensees" and | |
82 | +"recipients" may be individuals or organizations. | |
83 | + | |
84 | + To "modify" a work means to copy from or adapt all or part of the work | |
85 | +in a fashion requiring copyright permission, other than the making of an | |
86 | +exact copy. The resulting work is called a "modified version" of the | |
87 | +earlier work or a work "based on" the earlier work. | |
88 | + | |
89 | + A "covered work" means either the unmodified Program or a work based | |
90 | +on the Program. | |
91 | + | |
92 | + To "propagate" a work means to do anything with it that, without | |
93 | +permission, would make you directly or secondarily liable for | |
94 | +infringement under applicable copyright law, except executing it on a | |
95 | +computer or modifying a private copy. Propagation includes copying, | |
96 | +distribution (with or without modification), making available to the | |
97 | +public, and in some countries other activities as well. | |
98 | + | |
99 | + To "convey" a work means any kind of propagation that enables other | |
100 | +parties to make or receive copies. Mere interaction with a user through | |
101 | +a computer network, with no transfer of a copy, is not conveying. | |
102 | + | |
103 | + An interactive user interface displays "Appropriate Legal Notices" | |
104 | +to the extent that it includes a convenient and prominently visible | |
105 | +feature that (1) displays an appropriate copyright notice, and (2) | |
106 | +tells the user that there is no warranty for the work (except to the | |
107 | +extent that warranties are provided), that licensees may convey the | |
108 | +work under this License, and how to view a copy of this License. If | |
109 | +the interface presents a list of user commands or options, such as a | |
110 | +menu, a prominent item in the list meets this criterion. | |
111 | + | |
112 | + 1. Source Code. | |
113 | + | |
114 | + The "source code" for a work means the preferred form of the work | |
115 | +for making modifications to it. "Object code" means any non-source | |
116 | +form of a work. | |
117 | + | |
118 | + A "Standard Interface" means an interface that either is an official | |
119 | +standard defined by a recognized standards body, or, in the case of | |
120 | +interfaces specified for a particular programming language, one that | |
121 | +is widely used among developers working in that language. | |
122 | + | |
123 | + The "System Libraries" of an executable work include anything, other | |
124 | +than the work as a whole, that (a) is included in the normal form of | |
125 | +packaging a Major Component, but which is not part of that Major | |
126 | +Component, and (b) serves only to enable use of the work with that | |
127 | +Major Component, or to implement a Standard Interface for which an | |
128 | +implementation is available to the public in source code form. A | |
129 | +"Major Component", in this context, means a major essential component | |
130 | +(kernel, window system, and so on) of the specific operating system | |
131 | +(if any) on which the executable work runs, or a compiler used to | |
132 | +produce the work, or an object code interpreter used to run it. | |
133 | + | |
134 | + The "Corresponding Source" for a work in object code form means all | |
135 | +the source code needed to generate, install, and (for an executable | |
136 | +work) run the object code and to modify the work, including scripts to | |
137 | +control those activities. However, it does not include the work's | |
138 | +System Libraries, or general-purpose tools or generally available free | |
139 | +programs which are used unmodified in performing those activities but | |
140 | +which are not part of the work. For example, Corresponding Source | |
141 | +includes interface definition files associated with source files for | |
142 | +the work, and the source code for shared libraries and dynamically | |
143 | +linked subprograms that the work is specifically designed to require, | |
144 | +such as by intimate data communication or control flow between those | |
145 | +subprograms and other parts of the work. | |
146 | + | |
147 | + The Corresponding Source need not include anything that users | |
148 | +can regenerate automatically from other parts of the Corresponding | |
149 | +Source. | |
150 | + | |
151 | + The Corresponding Source for a work in source code form is that | |
152 | +same work. | |
153 | + | |
154 | + 2. Basic Permissions. | |
155 | + | |
156 | + All rights granted under this License are granted for the term of | |
157 | +copyright on the Program, and are irrevocable provided the stated | |
158 | +conditions are met. This License explicitly affirms your unlimited | |
159 | +permission to run the unmodified Program. The output from running a | |
160 | +covered work is covered by this License only if the output, given its | |
161 | +content, constitutes a covered work. This License acknowledges your | |
162 | +rights of fair use or other equivalent, as provided by copyright law. | |
163 | + | |
164 | + You may make, run and propagate covered works that you do not | |
165 | +convey, without conditions so long as your license otherwise remains | |
166 | +in force. You may convey covered works to others for the sole purpose | |
167 | +of having them make modifications exclusively for you, or provide you | |
168 | +with facilities for running those works, provided that you comply with | |
169 | +the terms of this License in conveying all material for which you do | |
170 | +not control copyright. Those thus making or running the covered works | |
171 | +for you must do so exclusively on your behalf, under your direction | |
172 | +and control, on terms that prohibit them from making any copies of | |
173 | +your copyrighted material outside their relationship with you. | |
174 | + | |
175 | + Conveying under any other circumstances is permitted solely under | |
176 | +the conditions stated below. Sublicensing is not allowed; section 10 | |
177 | +makes it unnecessary. | |
178 | + | |
179 | + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. | |
180 | + | |
181 | + No covered work shall be deemed part of an effective technological | |
182 | +measure under any applicable law fulfilling obligations under article | |
183 | +11 of the WIPO copyright treaty adopted on 20 December 1996, or | |
184 | +similar laws prohibiting or restricting circumvention of such | |
185 | +measures. | |
186 | + | |
187 | + When you convey a covered work, you waive any legal power to forbid | |
188 | +circumvention of technological measures to the extent such circumvention | |
189 | +is effected by exercising rights under this License with respect to | |
190 | +the covered work, and you disclaim any intention to limit operation or | |
191 | +modification of the work as a means of enforcing, against the work's | |
192 | +users, your or third parties' legal rights to forbid circumvention of | |
193 | +technological measures. | |
194 | + | |
195 | + 4. Conveying Verbatim Copies. | |
196 | + | |
197 | + You may convey verbatim copies of the Program's source code as you | |
198 | +receive it, in any medium, provided that you conspicuously and | |
199 | +appropriately publish on each copy an appropriate copyright notice; | |
200 | +keep intact all notices stating that this License and any | |
201 | +non-permissive terms added in accord with section 7 apply to the code; | |
202 | +keep intact all notices of the absence of any warranty; and give all | |
203 | +recipients a copy of this License along with the Program. | |
204 | + | |
205 | + You may charge any price or no price for each copy that you convey, | |
206 | +and you may offer support or warranty protection for a fee. | |
207 | + | |
208 | + 5. Conveying Modified Source Versions. | |
209 | + | |
210 | + You may convey a work based on the Program, or the modifications to | |
211 | +produce it from the Program, in the form of source code under the | |
212 | +terms of section 4, provided that you also meet all of these conditions: | |
213 | + | |
214 | + a) The work must carry prominent notices stating that you modified | |
215 | + it, and giving a relevant date. | |
216 | + | |
217 | + b) The work must carry prominent notices stating that it is | |
218 | + released under this License and any conditions added under section | |
219 | + 7. This requirement modifies the requirement in section 4 to | |
220 | + "keep intact all notices". | |
221 | + | |
222 | + c) You must license the entire work, as a whole, under this | |
223 | + License to anyone who comes into possession of a copy. This | |
224 | + License will therefore apply, along with any applicable section 7 | |
225 | + additional terms, to the whole of the work, and all its parts, | |
226 | + regardless of how they are packaged. This License gives no | |
227 | + permission to license the work in any other way, but it does not | |
228 | + invalidate such permission if you have separately received it. | |
229 | + | |
230 | + d) If the work has interactive user interfaces, each must display | |
231 | + Appropriate Legal Notices; however, if the Program has interactive | |
232 | + interfaces that do not display Appropriate Legal Notices, your | |
233 | + work need not make them do so. | |
234 | + | |
235 | + A compilation of a covered work with other separate and independent | |
236 | +works, which are not by their nature extensions of the covered work, | |
237 | +and which are not combined with it such as to form a larger program, | |
238 | +in or on a volume of a storage or distribution medium, is called an | |
239 | +"aggregate" if the compilation and its resulting copyright are not | |
240 | +used to limit the access or legal rights of the compilation's users | |
241 | +beyond what the individual works permit. Inclusion of a covered work | |
242 | +in an aggregate does not cause this License to apply to the other | |
243 | +parts of the aggregate. | |
244 | + | |
245 | + 6. Conveying Non-Source Forms. | |
246 | + | |
247 | + You may convey a covered work in object code form under the terms | |
248 | +of sections 4 and 5, provided that you also convey the | |
249 | +machine-readable Corresponding Source under the terms of this License, | |
250 | +in one of these ways: | |
251 | + | |
252 | + a) Convey the object code in, or embodied in, a physical product | |
253 | + (including a physical distribution medium), accompanied by the | |
254 | + Corresponding Source fixed on a durable physical medium | |
255 | + customarily used for software interchange. | |
256 | + | |
257 | + b) Convey the object code in, or embodied in, a physical product | |
258 | + (including a physical distribution medium), accompanied by a | |
259 | + written offer, valid for at least three years and valid for as | |
260 | + long as you offer spare parts or customer support for that product | |
261 | + model, to give anyone who possesses the object code either (1) a | |
262 | + copy of the Corresponding Source for all the software in the | |
263 | + product that is covered by this License, on a durable physical | |
264 | + medium customarily used for software interchange, for a price no | |
265 | + more than your reasonable cost of physically performing this | |
266 | + conveying of source, or (2) access to copy the | |
267 | + Corresponding Source from a network server at no charge. | |
268 | + | |
269 | + c) Convey individual copies of the object code with a copy of the | |
270 | + written offer to provide the Corresponding Source. This | |
271 | + alternative is allowed only occasionally and noncommercially, and | |
272 | + only if you received the object code with such an offer, in accord | |
273 | + with subsection 6b. | |
274 | + | |
275 | + d) Convey the object code by offering access from a designated | |
276 | + place (gratis or for a charge), and offer equivalent access to the | |
277 | + Corresponding Source in the same way through the same place at no | |
278 | + further charge. You need not require recipients to copy the | |
279 | + Corresponding Source along with the object code. If the place to | |
280 | + copy the object code is a network server, the Corresponding Source | |
281 | + may be on a different server (operated by you or a third party) | |
282 | + that supports equivalent copying facilities, provided you maintain | |
283 | + clear directions next to the object code saying where to find the | |
284 | + Corresponding Source. Regardless of what server hosts the | |
285 | + Corresponding Source, you remain obligated to ensure that it is | |
286 | + available for as long as needed to satisfy these requirements. | |
287 | + | |
288 | + e) Convey the object code using peer-to-peer transmission, provided | |
289 | + you inform other peers where the object code and Corresponding | |
290 | + Source of the work are being offered to the general public at no | |
291 | + charge under subsection 6d. | |
292 | + | |
293 | + A separable portion of the object code, whose source code is excluded | |
294 | +from the Corresponding Source as a System Library, need not be | |
295 | +included in conveying the object code work. | |
296 | + | |
297 | + A "User Product" is either (1) a "consumer product", which means any | |
298 | +tangible personal property which is normally used for personal, family, | |
299 | +or household purposes, or (2) anything designed or sold for incorporation | |
300 | +into a dwelling. In determining whether a product is a consumer product, | |
301 | +doubtful cases shall be resolved in favor of coverage. For a particular | |
302 | +product received by a particular user, "normally used" refers to a | |
303 | +typical or common use of that class of product, regardless of the status | |
304 | +of the particular user or of the way in which the particular user | |
305 | +actually uses, or expects or is expected to use, the product. A product | |
306 | +is a consumer product regardless of whether the product has substantial | |
307 | +commercial, industrial or non-consumer uses, unless such uses represent | |
308 | +the only significant mode of use of the product. | |
309 | + | |
310 | + "Installation Information" for a User Product means any methods, | |
311 | +procedures, authorization keys, or other information required to install | |
312 | +and execute modified versions of a covered work in that User Product from | |
313 | +a modified version of its Corresponding Source. The information must | |
314 | +suffice to ensure that the continued functioning of the modified object | |
315 | +code is in no case prevented or interfered with solely because | |
316 | +modification has been made. | |
317 | + | |
318 | + If you convey an object code work under this section in, or with, or | |
319 | +specifically for use in, a User Product, and the conveying occurs as | |
320 | +part of a transaction in which the right of possession and use of the | |
321 | +User Product is transferred to the recipient in perpetuity or for a | |
322 | +fixed term (regardless of how the transaction is characterized), the | |
323 | +Corresponding Source conveyed under this section must be accompanied | |
324 | +by the Installation Information. But this requirement does not apply | |
325 | +if neither you nor any third party retains the ability to install | |
326 | +modified object code on the User Product (for example, the work has | |
327 | +been installed in ROM). | |
328 | + | |
329 | + The requirement to provide Installation Information does not include a | |
330 | +requirement to continue to provide support service, warranty, or updates | |
331 | +for a work that has been modified or installed by the recipient, or for | |
332 | +the User Product in which it has been modified or installed. Access to a | |
333 | +network may be denied when the modification itself materially and | |
334 | +adversely affects the operation of the network or violates the rules and | |
335 | +protocols for communication across the network. | |
336 | + | |
337 | + Corresponding Source conveyed, and Installation Information provided, | |
338 | +in accord with this section must be in a format that is publicly | |
339 | +documented (and with an implementation available to the public in | |
340 | +source code form), and must require no special password or key for | |
341 | +unpacking, reading or copying. | |
342 | + | |
343 | + 7. Additional Terms. | |
344 | + | |
345 | + "Additional permissions" are terms that supplement the terms of this | |
346 | +License by making exceptions from one or more of its conditions. | |
347 | +Additional permissions that are applicable to the entire Program shall | |
348 | +be treated as though they were included in this License, to the extent | |
349 | +that they are valid under applicable law. If additional permissions | |
350 | +apply only to part of the Program, that part may be used separately | |
351 | +under those permissions, but the entire Program remains governed by | |
352 | +this License without regard to the additional permissions. | |
353 | + | |
354 | + When you convey a copy of a covered work, you may at your option | |
355 | +remove any additional permissions from that copy, or from any part of | |
356 | +it. (Additional permissions may be written to require their own | |
357 | +removal in certain cases when you modify the work.) You may place | |
358 | +additional permissions on material, added by you to a covered work, | |
359 | +for which you have or can give appropriate copyright permission. | |
360 | + | |
361 | + Notwithstanding any other provision of this License, for material you | |
362 | +add to a covered work, you may (if authorized by the copyright holders of | |
363 | +that material) supplement the terms of this License with terms: | |
364 | + | |
365 | + a) Disclaiming warranty or limiting liability differently from the | |
366 | + terms of sections 15 and 16 of this License; or | |
367 | + | |
368 | + b) Requiring preservation of specified reasonable legal notices or | |
369 | + author attributions in that material or in the Appropriate Legal | |
370 | + Notices displayed by works containing it; or | |
371 | + | |
372 | + c) Prohibiting misrepresentation of the origin of that material, or | |
373 | + requiring that modified versions of such material be marked in | |
374 | + reasonable ways as different from the original version; or | |
375 | + | |
376 | + d) Limiting the use for publicity purposes of names of licensors or | |
377 | + authors of the material; or | |
378 | + | |
379 | + e) Declining to grant rights under trademark law for use of some | |
380 | + trade names, trademarks, or service marks; or | |
381 | + | |
382 | + f) Requiring indemnification of licensors and authors of that | |
383 | + material by anyone who conveys the material (or modified versions of | |
384 | + it) with contractual assumptions of liability to the recipient, for | |
385 | + any liability that these contractual assumptions directly impose on | |
386 | + those licensors and authors. | |
387 | + | |
388 | + All other non-permissive additional terms are considered "further | |
389 | +restrictions" within the meaning of section 10. If the Program as you | |
390 | +received it, or any part of it, contains a notice stating that it is | |
391 | +governed by this License along with a term that is a further | |
392 | +restriction, you may remove that term. If a license document contains | |
393 | +a further restriction but permits relicensing or conveying under this | |
394 | +License, you may add to a covered work material governed by the terms | |
395 | +of that license document, provided that the further restriction does | |
396 | +not survive such relicensing or conveying. | |
397 | + | |
398 | + If you add terms to a covered work in accord with this section, you | |
399 | +must place, in the relevant source files, a statement of the | |
400 | +additional terms that apply to those files, or a notice indicating | |
401 | +where to find the applicable terms. | |
402 | + | |
403 | + Additional terms, permissive or non-permissive, may be stated in the | |
404 | +form of a separately written license, or stated as exceptions; | |
405 | +the above requirements apply either way. | |
406 | + | |
407 | + 8. Termination. | |
408 | + | |
409 | + You may not propagate or modify a covered work except as expressly | |
410 | +provided under this License. Any attempt otherwise to propagate or | |
411 | +modify it is void, and will automatically terminate your rights under | |
412 | +this License (including any patent licenses granted under the third | |
413 | +paragraph of section 11). | |
414 | + | |
415 | + However, if you cease all violation of this License, then your | |
416 | +license from a particular copyright holder is reinstated (a) | |
417 | +provisionally, unless and until the copyright holder explicitly and | |
418 | +finally terminates your license, and (b) permanently, if the copyright | |
419 | +holder fails to notify you of the violation by some reasonable means | |
420 | +prior to 60 days after the cessation. | |
421 | + | |
422 | + Moreover, your license from a particular copyright holder is | |
423 | +reinstated permanently if the copyright holder notifies you of the | |
424 | +violation by some reasonable means, this is the first time you have | |
425 | +received notice of violation of this License (for any work) from that | |
426 | +copyright holder, and you cure the violation prior to 30 days after | |
427 | +your receipt of the notice. | |
428 | + | |
429 | + Termination of your rights under this section does not terminate the | |
430 | +licenses of parties who have received copies or rights from you under | |
431 | +this License. If your rights have been terminated and not permanently | |
432 | +reinstated, you do not qualify to receive new licenses for the same | |
433 | +material under section 10. | |
434 | + | |
435 | + 9. Acceptance Not Required for Having Copies. | |
436 | + | |
437 | + You are not required to accept this License in order to receive or | |
438 | +run a copy of the Program. Ancillary propagation of a covered work | |
439 | +occurring solely as a consequence of using peer-to-peer transmission | |
440 | +to receive a copy likewise does not require acceptance. However, | |
441 | +nothing other than this License grants you permission to propagate or | |
442 | +modify any covered work. These actions infringe copyright if you do | |
443 | +not accept this License. Therefore, by modifying or propagating a | |
444 | +covered work, you indicate your acceptance of this License to do so. | |
445 | + | |
446 | + 10. Automatic Licensing of Downstream Recipients. | |
447 | + | |
448 | + Each time you convey a covered work, the recipient automatically | |
449 | +receives a license from the original licensors, to run, modify and | |
450 | +propagate that work, subject to this License. You are not responsible | |
451 | +for enforcing compliance by third parties with this License. | |
452 | + | |
453 | + An "entity transaction" is a transaction transferring control of an | |
454 | +organization, or substantially all assets of one, or subdividing an | |
455 | +organization, or merging organizations. If propagation of a covered | |
456 | +work results from an entity transaction, each party to that | |
457 | +transaction who receives a copy of the work also receives whatever | |
458 | +licenses to the work the party's predecessor in interest had or could | |
459 | +give under the previous paragraph, plus a right to possession of the | |
460 | +Corresponding Source of the work from the predecessor in interest, if | |
461 | +the predecessor has it or can get it with reasonable efforts. | |
462 | + | |
463 | + You may not impose any further restrictions on the exercise of the | |
464 | +rights granted or affirmed under this License. For example, you may | |
465 | +not impose a license fee, royalty, or other charge for exercise of | |
466 | +rights granted under this License, and you may not initiate litigation | |
467 | +(including a cross-claim or counterclaim in a lawsuit) alleging that | |
468 | +any patent claim is infringed by making, using, selling, offering for | |
469 | +sale, or importing the Program or any portion of it. | |
470 | + | |
471 | + 11. Patents. | |
472 | + | |
473 | + A "contributor" is a copyright holder who authorizes use under this | |
474 | +License of the Program or a work on which the Program is based. The | |
475 | +work thus licensed is called the contributor's "contributor version". | |
476 | + | |
477 | + A contributor's "essential patent claims" are all patent claims | |
478 | +owned or controlled by the contributor, whether already acquired or | |
479 | +hereafter acquired, that would be infringed by some manner, permitted | |
480 | +by this License, of making, using, or selling its contributor version, | |
481 | +but do not include claims that would be infringed only as a | |
482 | +consequence of further modification of the contributor version. For | |
483 | +purposes of this definition, "control" includes the right to grant | |
484 | +patent sublicenses in a manner consistent with the requirements of | |
485 | +this License. | |
486 | + | |
487 | + Each contributor grants you a non-exclusive, worldwide, royalty-free | |
488 | +patent license under the contributor's essential patent claims, to | |
489 | +make, use, sell, offer for sale, import and otherwise run, modify and | |
490 | +propagate the contents of its contributor version. | |
491 | + | |
492 | + In the following three paragraphs, a "patent license" is any express | |
493 | +agreement or commitment, however denominated, not to enforce a patent | |
494 | +(such as an express permission to practice a patent or covenant not to | |
495 | +sue for patent infringement). To "grant" such a patent license to a | |
496 | +party means to make such an agreement or commitment not to enforce a | |
497 | +patent against the party. | |
498 | + | |
499 | + If you convey a covered work, knowingly relying on a patent license, | |
500 | +and the Corresponding Source of the work is not available for anyone | |
501 | +to copy, free of charge and under the terms of this License, through a | |
502 | +publicly available network server or other readily accessible means, | |
503 | +then you must either (1) cause the Corresponding Source to be so | |
504 | +available, or (2) arrange to deprive yourself of the benefit of the | |
505 | +patent license for this particular work, or (3) arrange, in a manner | |
506 | +consistent with the requirements of this License, to extend the patent | |
507 | +license to downstream recipients. "Knowingly relying" means you have | |
508 | +actual knowledge that, but for the patent license, your conveying the | |
509 | +covered work in a country, or your recipient's use of the covered work | |
510 | +in a country, would infringe one or more identifiable patents in that | |
511 | +country that you have reason to believe are valid. | |
512 | + | |
513 | + If, pursuant to or in connection with a single transaction or | |
514 | +arrangement, you convey, or propagate by procuring conveyance of, a | |
515 | +covered work, and grant a patent license to some of the parties | |
516 | +receiving the covered work authorizing them to use, propagate, modify | |
517 | +or convey a specific copy of the covered work, then the patent license | |
518 | +you grant is automatically extended to all recipients of the covered | |
519 | +work and works based on it. | |
520 | + | |
521 | + A patent license is "discriminatory" if it does not include within | |
522 | +the scope of its coverage, prohibits the exercise of, or is | |
523 | +conditioned on the non-exercise of one or more of the rights that are | |
524 | +specifically granted under this License. You may not convey a covered | |
525 | +work if you are a party to an arrangement with a third party that is | |
526 | +in the business of distributing software, under which you make payment | |
527 | +to the third party based on the extent of your activity of conveying | |
528 | +the work, and under which the third party grants, to any of the | |
529 | +parties who would receive the covered work from you, a discriminatory | |
530 | +patent license (a) in connection with copies of the covered work | |
531 | +conveyed by you (or copies made from those copies), or (b) primarily | |
532 | +for and in connection with specific products or compilations that | |
533 | +contain the covered work, unless you entered into that arrangement, | |
534 | +or that patent license was granted, prior to 28 March 2007. | |
535 | + | |
536 | + Nothing in this License shall be construed as excluding or limiting | |
537 | +any implied license or other defenses to infringement that may | |
538 | +otherwise be available to you under applicable patent law. | |
539 | + | |
540 | + 12. No Surrender of Others' Freedom. | |
541 | + | |
542 | + If conditions are imposed on you (whether by court order, agreement or | |
543 | +otherwise) that contradict the conditions of this License, they do not | |
544 | +excuse you from the conditions of this License. If you cannot convey a | |
545 | +covered work so as to satisfy simultaneously your obligations under this | |
546 | +License and any other pertinent obligations, then as a consequence you may | |
547 | +not convey it at all. For example, if you agree to terms that obligate you | |
548 | +to collect a royalty for further conveying from those to whom you convey | |
549 | +the Program, the only way you could satisfy both those terms and this | |
550 | +License would be to refrain entirely from conveying the Program. | |
551 | + | |
552 | + 13. Use with the GNU Affero General Public License. | |
553 | + | |
554 | + Notwithstanding any other provision of this License, you have | |
555 | +permission to link or combine any covered work with a work licensed | |
556 | +under version 3 of the GNU Affero General Public License into a single | |
557 | +combined work, and to convey the resulting work. The terms of this | |
558 | +License will continue to apply to the part which is the covered work, | |
559 | +but the special requirements of the GNU Affero General Public License, | |
560 | +section 13, concerning interaction through a network will apply to the | |
561 | +combination as such. | |
562 | + | |
563 | + 14. Revised Versions of this License. | |
564 | + | |
565 | + The Free Software Foundation may publish revised and/or new versions of | |
566 | +the GNU General Public License from time to time. Such new versions will | |
567 | +be similar in spirit to the present version, but may differ in detail to | |
568 | +address new problems or concerns. | |
569 | + | |
570 | + Each version is given a distinguishing version number. If the | |
571 | +Program specifies that a certain numbered version of the GNU General | |
572 | +Public License "or any later version" applies to it, you have the | |
573 | +option of following the terms and conditions either of that numbered | |
574 | +version or of any later version published by the Free Software | |
575 | +Foundation. If the Program does not specify a version number of the | |
576 | +GNU General Public License, you may choose any version ever published | |
577 | +by the Free Software Foundation. | |
578 | + | |
579 | + If the Program specifies that a proxy can decide which future | |
580 | +versions of the GNU General Public License can be used, that proxy's | |
581 | +public statement of acceptance of a version permanently authorizes you | |
582 | +to choose that version for the Program. | |
583 | + | |
584 | + Later license versions may give you additional or different | |
585 | +permissions. However, no additional obligations are imposed on any | |
586 | +author or copyright holder as a result of your choosing to follow a | |
587 | +later version. | |
588 | + | |
589 | + 15. Disclaimer of Warranty. | |
590 | + | |
591 | + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY | |
592 | +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT | |
593 | +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY | |
594 | +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, | |
595 | +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
596 | +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM | |
597 | +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF | |
598 | +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. | |
599 | + | |
600 | + 16. Limitation of Liability. | |
601 | + | |
602 | + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | |
603 | +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS | |
604 | +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY | |
605 | +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE | |
606 | +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF | |
607 | +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD | |
608 | +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), | |
609 | +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF | |
610 | +SUCH DAMAGES. | |
611 | + | |
612 | + 17. Interpretation of Sections 15 and 16. | |
613 | + | |
614 | + If the disclaimer of warranty and limitation of liability provided | |
615 | +above cannot be given local legal effect according to their terms, | |
616 | +reviewing courts shall apply local law that most closely approximates | |
617 | +an absolute waiver of all civil liability in connection with the | |
618 | +Program, unless a warranty or assumption of liability accompanies a | |
619 | +copy of the Program in return for a fee. | |
620 | + | |
621 | + END OF TERMS AND CONDITIONS | |
622 | + | |
623 | + How to Apply These Terms to Your New Programs | |
624 | + | |
625 | + If you develop a new program, and you want it to be of the greatest | |
626 | +possible use to the public, the best way to achieve this is to make it | |
627 | +free software which everyone can redistribute and change under these terms. | |
628 | + | |
629 | + To do so, attach the following notices to the program. It is safest | |
630 | +to attach them to the start of each source file to most effectively | |
631 | +state the exclusion of warranty; and each file should have at least | |
632 | +the "copyright" line and a pointer to where the full notice is found. | |
633 | + | |
634 | + <one line to give the program's name and a brief idea of what it does.> | |
635 | + Copyright (C) <year> <name of author> | |
636 | + | |
637 | + This program is free software: you can redistribute it and/or modify | |
638 | + it under the terms of the GNU General Public License as published by | |
639 | + the Free Software Foundation, either version 3 of the License, or | |
640 | + (at your option) any later version. | |
641 | + | |
642 | + This program is distributed in the hope that it will be useful, | |
643 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
644 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
645 | + GNU General Public License for more details. | |
646 | + | |
647 | + You should have received a copy of the GNU General Public License | |
648 | + along with this program. If not, see <http://www.gnu.org/licenses/>. | |
649 | + | |
650 | +Also add information on how to contact you by electronic and paper mail. | |
651 | + | |
652 | + If the program does terminal interaction, make it output a short | |
653 | +notice like this when it starts in an interactive mode: | |
654 | + | |
655 | + <program> Copyright (C) <year> <name of author> | |
656 | + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. | |
657 | + This is free software, and you are welcome to redistribute it | |
658 | + under certain conditions; type `show c' for details. | |
659 | + | |
660 | +The hypothetical commands `show w' and `show c' should show the appropriate | |
661 | +parts of the General Public License. Of course, your program's commands | |
662 | +might be different; for a GUI interface, you would use an "about box". | |
663 | + | |
664 | + You should also get your employer (if you work as a programmer) or school, | |
665 | +if any, to sign a "copyright disclaimer" for the program, if necessary. | |
666 | +For more information on this, and how to apply and follow the GNU GPL, see | |
667 | +<http://www.gnu.org/licenses/>. | |
668 | + | |
669 | + The GNU General Public License does not permit incorporating your program | |
670 | +into proprietary programs. If your program is a subroutine library, you | |
671 | +may consider it more useful to permit linking proprietary applications with | |
672 | +the library. If this is what you want to do, use the GNU Lesser General | |
673 | +Public License instead of this License. But first, please read | |
674 | +<http://www.gnu.org/philosophy/why-not-lgpl.html>. | ... | ... |
ChangeLog
0 → 100644
1 | +2012-02-23 17:40:00 +0100 Georg Hopp | |
2 | + | |
3 | + * add cookie header again (HEAD, origin/master, origin/HEAD, master) | |
4 | + | |
5 | +2012-02-23 16:41:36 +0100 Georg Hopp | |
6 | + | |
7 | + * optmize header search | |
8 | + | |
9 | +2012-02-23 13:02:23 +0100 Georg Hopp | |
10 | + | |
11 | + * changed all string operation within header handling with fixed length mem operations, preventing multiple iterations over these strings. In theory this should improve performance in reality it seems that it is worse...CHECK WHY | |
12 | + | |
13 | +2012-02-23 00:05:25 +0100 Georg Hopp | |
14 | + | |
15 | + * fix initialization of search value | |
16 | + | |
17 | +2012-02-22 21:50:21 +0100 Georg Hopp | |
18 | + | |
19 | + * ed | |
20 | + | |
21 | +2012-02-22 21:49:52 +0100 Georg Hopp | |
22 | + | |
23 | + * structural changes for worker/process. @TODO actually i have no idea why this happens. | |
24 | + | |
25 | +2012-02-22 12:19:40 +0100 Georg Hopp | |
26 | + | |
27 | + * fix memory problems occured with latest changes | |
28 | + | |
29 | +2012-02-22 09:03:40 +0100 Georg Hopp | |
30 | + | |
31 | + * fixed bug in keep-alive check arised by implementation if #10 | |
32 | + | |
33 | +2012-02-22 08:51:05 +0100 Georg Hopp | |
34 | + | |
35 | + * add forgotten jquery assets | |
36 | + | |
37 | +2012-02-22 08:48:43 +0100 Georg Hopp | |
38 | + | |
39 | + * closes #10: values for header ids are now stored in a char ** making multiple values for one id possible. Additionally added a jquery action that delivers the jquery java script and use it on the me action | |
40 | + | |
41 | +2012-02-21 13:01:38 +0100 Georg Hopp | |
42 | + | |
43 | + * now when a constructor returns -1 the new call will in turn call the destructor effectively freeing all resources. ATTENTION: now the destructor has to be aware that it might be called with a not completely initialized object. To make this more ease there is the FREE makro with the corresponding ffree that does NULL pointer checking and the destructor checks for NULL pointer too. Additionally the handle_accept now handles _SC_OPEN_MAX - 10 connections. The 10 are reserved for internal usage. | |
44 | + | |
45 | +2012-02-21 09:45:01 +0100 Georg Hopp | |
46 | + | |
47 | + * now a child is spawned and writes random values in a shared memory segment. These values will be shown in the me action | |
48 | + | |
49 | +2012-02-20 21:36:55 +0100 Georg Hopp | |
50 | + | |
51 | + * some code cleanups...no changes in the logic | |
52 | + | |
53 | +2012-02-20 18:08:23 +0100 Georg Hopp | |
54 | + | |
55 | + * move sdbm implementation in one file. | |
56 | + | |
57 | +2012-02-20 17:16:44 +0100 Georg Hopp | |
58 | + | |
59 | + * changed /**/ single line comments to // | |
60 | + | |
61 | +2012-02-20 14:55:46 +0100 Georg Hopp | |
62 | + | |
63 | + * start documenting this whole stuff...well at least add a copyright information in each file | |
64 | + | |
65 | +2012-02-20 10:10:29 +0100 Georg Hopp | |
66 | + | |
67 | + * first very crude, not complete, experimental 304 test implementation | |
68 | + | |
69 | +2012-02-20 07:55:06 +0100 Georg Hopp | |
70 | + | |
71 | + * disconnect on invalid request line | |
72 | + | |
73 | +2012-02-19 20:12:40 +0100 Georg Hopp | |
74 | + | |
75 | + * now incomplete requests should no longer block the complete server. Tested with \'echo -en "GET / HTTP\r\nConn" | nc -w 600 localhost 11212\' and then doing requests from my browser. @TODO: cleanup those stuff, check if a not correctly response reading would block the server. | |
76 | + | |
77 | +2012-02-19 18:28:30 +0100 Georg Hopp | |
78 | + | |
79 | + * increase writebuffer size a lot. | |
80 | + | |
81 | +2012-02-19 18:15:55 +0100 Georg Hopp | |
82 | + | |
83 | + * fixed the non keep-alive performance issue as well as i lower memory usage by using a single read and write circular buffer for every connection. @TODO: i noticed a server hang while getting large data (my image) with non keep-alive connections. Additionally an incomplete keep-alive request might stop the server now as the lock on the read buffer will not be released. | |
84 | + | |
85 | +2012-02-19 15:41:48 +0100 Georg Hopp | |
86 | + | |
87 | + * another try with the shmen trick...this time use MAP_ANONYMOUS ... as GNU extension. | |
88 | + | |
89 | +2012-02-19 14:33:42 +0100 Georg Hopp | |
90 | + | |
91 | + * Merge remote branch 'origin/master' | |
92 | + | |
93 | +2012-02-19 12:13:52 +0100 Georg Hopp | |
94 | + | |
95 | + * added missing header file to repo | |
96 | + | |
97 | +2012-02-19 11:35:15 +0100 Georg Hopp | |
98 | + | |
99 | + * another try with a shared memory based ringbuffer...this performs well for keep-alive sessions but is much slower without. actually i am not sure why but most likely the shared memory setup is quite expensive. @TODO: make a profiling. | |
100 | + | |
101 | +2012-02-18 21:08:32 +0100 Georg Hopp | |
102 | + | |
103 | + * fix inf loop. @TODO: This whole handling has to be cleaned. | |
104 | + | |
105 | +2012-02-18 20:50:01 +0100 Georg Hopp | |
106 | + | |
107 | + * this change hopefully makes the shm trick work on amd64 | |
108 | + | |
109 | +2012-02-18 20:12:27 +0100 Georg Hopp | |
110 | + | |
111 | + * lots of changes but primarily change the request parser to use a ringbuffer. The ringbuffer is implemented using the shared memory trick. | |
112 | + | |
113 | +2012-02-15 12:30:33 +0100 Georg Hopp | |
114 | + | |
115 | + * some more cleanups in the server code. Removing not needed header includes | |
116 | + | |
117 | +2012-02-15 12:17:39 +0100 Georg Hopp | |
118 | + | |
119 | + * Merge branch 'master' of 192.168.100.2:/var/lib/git/server | |
120 | + | |
121 | +2012-02-15 12:17:00 +0100 Georg Hopp | |
122 | + | |
123 | + * now the separated http worker works. Changed some size_t to ssize_t as i use -1 and -2 es error indicator in my server and fixed caculation of remainig buffer size in reader | |
124 | + | |
125 | +2012-02-15 09:38:32 +0100 Georg Hopp | |
126 | + | |
127 | + * separated the server completely from the http processing | |
128 | + | |
129 | +2012-02-15 06:19:52 +0100 Georg Hopp | |
130 | + | |
131 | + * add subject/observer interface | |
132 | + | |
133 | +2012-02-15 06:19:52 +0100 Georg Hopp | |
134 | + | |
135 | + * add subject/observer interface | |
136 | + | |
137 | +2012-02-15 04:55:46 +0100 Georg Hopp | |
138 | + | |
139 | + * fix infinite busy loop in run | |
140 | + | |
141 | +2012-02-15 04:44:38 +0100 Georg Hopp | |
142 | + | |
143 | + * dynamically get and free buffer for response write pipe now | |
144 | + | |
145 | +2012-02-14 21:32:38 +0100 Georg Hopp | |
146 | + | |
147 | + * increase write buffer | |
148 | + | |
149 | +2012-02-13 21:27:47 +0100 Georg Hopp | |
150 | + | |
151 | + * use one dynamic buffer less and save at least one write on small responses | |
152 | + | |
153 | +2012-02-13 18:25:36 +0100 Georg Hopp | |
154 | + | |
155 | + * removed generated docs | |
156 | + | |
157 | +2012-02-13 17:55:52 +0100 Georg Hopp | |
158 | + | |
159 | + * fixed bug in new response handling | |
160 | + | |
161 | +2012-02-13 17:29:35 +0100 Georg Hopp | |
162 | + | |
163 | + * better response handling but still buggy with stream piping | |
164 | + | |
165 | +2012-02-13 09:46:39 +0100 Georg Hopp | |
166 | + | |
167 | + * now load image from actual server | |
168 | + | |
169 | +2012-02-13 09:39:21 +0100 Georg Hopp | |
170 | + | |
171 | + * first working version of content delivery from file....very crude... @TODO: rewrite complete response handline. | |
172 | + | |
173 | +2012-02-12 20:39:12 +0100 Georg Hopp | |
174 | + | |
175 | + * more generalizing of response writing (implemented a response writer...now it should be possible to implement a stream writer for images | |
176 | + | |
177 | +2012-02-12 12:43:56 +0100 Georg Hopp | |
178 | + | |
179 | + * make http request and response childs of a common parent http message | |
180 | + | |
181 | +2012-02-12 04:13:54 +0100 Georg Hopp | |
182 | + | |
183 | + * remove now obsoleted header_sort | |
184 | + | |
185 | +2012-02-12 04:05:38 +0100 Georg Hopp | |
186 | + | |
187 | + * change response to tree based header storage and make everything work. | |
188 | + | |
189 | +2012-02-12 00:05:13 +0100 Georg Hopp | |
190 | + | |
191 | + * changed header hashing to use btree (GNU only). @TODO: make this conditional for other systems. Removed the qsort calls on server->fds making O(2nlogn) to O(n) | |
192 | + | |
193 | +2012-02-11 13:52:32 +0100 Georg Hopp | |
194 | + | |
195 | + * daemonize testserver now | |
196 | + | |
197 | +2012-02-11 12:47:01 +0100 Georg Hopp | |
198 | + | |
199 | + * fix seaks and hangs after adding response object (mostly not related with the response object but how i integated it into serverRun | |
200 | + | |
201 | +2012-02-10 19:57:57 +0100 Georg Hopp | |
202 | + | |
203 | + * started a response handler and changed serverRun to use it for its response | |
204 | + | |
205 | +2012-02-10 12:42:04 +0100 Georg Hopp | |
206 | + | |
207 | + * fixed bug at server destructor | |
208 | + | |
209 | +2012-02-10 09:59:41 +0100 Georg Hopp | |
210 | + | |
211 | + * reset keep_live flag on connection close | |
212 | + | |
213 | +2012-02-10 09:52:27 +0100 Georg Hopp | |
214 | + | |
215 | + * made a first cruel handling for keep-alive and non keep-alive requests. @TODO: this MUST BE cleaned | |
216 | + | |
217 | +2012-02-10 08:14:31 +0100 Georg Hopp | |
218 | + | |
219 | + * now only use keep-alive.... | |
220 | + | |
221 | +2012-02-10 06:36:43 +0100 Georg Hopp | |
222 | + | |
223 | + * moved request_parser.h and request_queue.h in separeate request subfolder | |
224 | + | |
225 | +2012-02-10 06:22:39 +0100 Georg Hopp | |
226 | + | |
227 | + * fix rather nasty reentrance bug | |
228 | + | |
229 | +2012-02-10 05:52:50 +0100 Georg Hopp | |
230 | + | |
231 | + * fix bug that arose in rewrite of header get and results in an ugly memory leak, as well as no headers would be found any more | |
232 | + | |
233 | +2012-02-10 00:27:51 +0100 Georg Hopp | |
234 | + | |
235 | + * fix memory leak created while changing things | |
236 | + | |
237 | +2012-02-09 22:39:08 +0100 Georg Hopp | |
238 | + | |
239 | + * updated docs | |
240 | + | |
241 | +2012-02-09 22:34:32 +0100 Georg Hopp | |
242 | + | |
243 | + * start split of request parser | |
244 | + | |
245 | +2012-02-09 11:44:17 +0100 Georg Hopp | |
246 | + | |
247 | + * no more request body debig output | |
248 | + | |
249 | +2012-02-09 11:32:28 +0100 Georg Hopp | |
250 | + | |
251 | + * add missing header_get to repo and build header hash only from lowercase letters now as it seems header identifier should be case insensitive | |
252 | + | |
253 | +2012-02-09 09:34:21 +0100 Georg Hopp | |
254 | + | |
255 | + * access to headers via hash, read body (actually only with content-length header should also look for content-encoding) | |
256 | + | |
257 | +2012-02-08 16:51:49 +0100 Georg Hopp | |
258 | + | |
259 | + * fix handling of remote close - i should have another eye on this...there still seems to be something wrong. | |
260 | + | |
261 | +2012-02-08 15:04:52 +0100 Georg Hopp | |
262 | + | |
263 | + * fixed some warnings | |
264 | + | |
265 | +2012-02-08 13:12:59 +0100 Georg Hopp | |
266 | + | |
267 | + * changed documentation | |
268 | + | |
269 | +2012-02-08 13:05:23 +0100 Georg Hopp | |
270 | + | |
271 | + * added first generated documentation | |
272 | + | |
273 | +2012-02-08 12:14:44 +0100 Georg Hopp | |
274 | + | |
275 | + * oops commit...forgot to add request_queue.c | |
276 | + | |
277 | +2012-02-08 11:52:30 +0100 Georg Hopp | |
278 | + | |
279 | + * found the file handle lost...made a first workaround and added an todo. | |
280 | + | |
281 | +2012-02-08 10:21:04 +0100 Georg Hopp | |
282 | + | |
283 | + * changed request handling. @TODO: I still seem to have the problem that the file handles are not closed and freed correctly as the service refuses connections after about a 1000. | |
284 | + | |
285 | +2012-02-07 14:20:00 +0100 Georg Hopp | |
286 | + | |
287 | + * now stuff seems to work correct even if read does not provide a complete request (tested with telnet) | |
288 | + | |
289 | +2012-02-07 13:41:49 +0100 Georg Hopp | |
290 | + | |
291 | + * now each HttpRequestParser initializes its own request queue and enqueus completed requests there. The server now gets the queue and prints completed requests. | |
292 | + | |
293 | +2012-02-07 11:12:30 +0100 Georg Hopp | |
294 | + | |
295 | + * started filling out a request object with the parser | |
296 | + | |
297 | +2012-02-07 09:29:59 +0100 Georg Hopp | |
298 | + | |
299 | + * porformance improvement in parsing process (no longer do alloc and free on each line) | |
300 | + | |
301 | +2012-02-07 08:52:18 +0100 Georg Hopp | |
302 | + | |
303 | + * basic request parsing (line by line) implemented | |
304 | + | |
305 | +2012-02-06 16:08:13 +0100 Georg Hopp | |
306 | + | |
307 | + * split server implementation for readability | |
308 | + | |
309 | +2012-02-06 11:35:40 +0100 Georg Hopp | |
310 | + | |
311 | + * free reader (HttpRequestParser) when connection is closed | |
312 | + | |
313 | +2012-02-06 11:20:00 +0100 Georg Hopp | |
314 | + | |
315 | + * add StreamReader interface, modify HttpRequestParser and Server to use it | |
316 | + | |
317 | +2012-02-06 11:15:00 +0100 Georg Hopp | |
318 | + | |
319 | + * add missing include to stdarg.h | |
320 | + | |
321 | +2012-02-06 10:45:33 +0100 Georg Hopp | |
322 | + | |
323 | + * implement clone selector | |
324 | + | |
325 | +2012-02-06 10:43:59 +0100 Georg Hopp | |
326 | + | |
327 | + * add ability to call interface methods with return value | |
328 | + | |
329 | +2012-02-06 02:37:55 +0100 Georg Hopp | |
330 | + | |
331 | + * make build system work again | |
332 | + | |
333 | +2012-02-06 02:37:24 +0100 Georg Hopp | |
334 | + | |
335 | + * remove inline stuff for now ... add carefully again later perhaps | |
336 | + | |
337 | +2012-02-06 00:57:26 +0100 Georg Hopp | |
338 | + | |
339 | + * and also mod conigure.ac | |
340 | + | |
341 | +2012-02-06 00:55:44 +0100 Georg Hopp | |
342 | + | |
343 | + * makefile modification for new class stuff | |
344 | + | |
345 | +2012-02-05 22:55:16 +0100 Georg Hopp | |
346 | + | |
347 | + * changed class tool. Now multiple interface per class are supported as well as simple inheritence. | |
348 | + | |
349 | +2012-02-05 22:47:10 +0100 Georg Hopp | |
350 | + | |
351 | + * some latest work | |
352 | + | |
353 | +2012-02-05 22:44:59 +0100 Georg Hopp | |
354 | + | |
355 | + * added some documentation | |
356 | + | |
357 | +2012-02-05 22:42:37 +0100 Georg Hopp | |
358 | + | |
359 | + * changes related to server code | |
360 | + | |
361 | +2012-01-19 16:41:41 +0100 Georg Hopp | |
362 | + | |
363 | + * added some valueable thought about cclass and how this structure might evolve to a real class | |
364 | + | |
365 | +2012-01-18 07:52:07 +0100 Georg Hopp | |
366 | + | |
367 | + * add testserver and did some fixes not shown by my incomplete tests | |
368 | + | |
369 | +2012-01-17 15:40:07 +0100 Georg Hopp | |
370 | + | |
371 | + * more notes | |
372 | + | |
373 | +2012-01-17 15:04:33 +0100 Georg Hopp | |
374 | + | |
375 | + * add some thought | |
376 | + | |
377 | +2012-01-17 14:49:49 +0100 Georg Hopp | |
378 | + | |
379 | + * changed from select(UNIX) to poll(POSIX) | |
380 | + | |
381 | +2012-01-16 18:39:01 +0100 Georg Hopp | |
382 | + | |
383 | + * work on server_run | |
384 | + | |
385 | +2012-01-16 17:05:57 +0100 Georg Hopp | |
386 | + | |
387 | + * move test under docs dir | |
388 | + | |
389 | +2012-01-16 17:05:08 +0100 Georg Hopp | |
390 | + | |
391 | + * simply copy signal handling code from gameserver project | |
392 | + | |
393 | +2012-01-16 16:04:11 +0100 Georg Hopp | |
394 | + | |
395 | + * more work on socket handling stuff... @TODO think about renaming it to connection as it only handles TCP sockets | |
396 | + | |
397 | +2012-01-16 13:48:05 +0100 Georg Hopp | |
398 | + | |
399 | + * add info text about file handle passing and ported more stuff from my old server structure | |
400 | + | |
401 | +2012-01-16 08:05:15 +0100 Georg Hopp | |
402 | + | |
403 | + * reflect changes in configure.ac | |
404 | + | |
405 | +2012-01-13 22:46:45 +0100 Georg Hopp | |
406 | + | |
407 | + * add daemonize code from other project. (Might be integrated in a future class but i am not sure right now | |
408 | + | |
409 | +2012-01-13 22:16:17 +0100 Georg Hopp | |
410 | + | |
411 | + * logger now works and has some basic testing | |
412 | + | |
413 | +2012-01-13 22:15:03 +0100 Georg Hopp | |
414 | + | |
415 | + * change cclass so that the internal structure is no longer visible by the rest of the code | |
416 | + | |
417 | +2012-01-13 16:06:02 +0100 Georg Hopp | |
418 | + | |
419 | + * some fixes on first logger tests | |
420 | + | |
421 | +2012-01-13 15:54:22 +0100 Georg Hopp | |
422 | + | |
423 | + * initial checkin | |
424 | + | ... | ... |
Makefile.am
0 → 100644
NEWS
0 → 100644
README
0 → 100644
1 | +Actually this is some kind of server toolkit, also containing | |
2 | +a class and interface toolkit for C. | |
3 | +I use a gcc preprocessor extension to use empty variadoc | |
4 | +argument lists so actually this is gcc only code. | |
5 | + | |
6 | +This should become a server that has a dynamic time-sliced part | |
7 | +that updates an internal state all the time. | |
8 | +Clients might connect as they want and get some information | |
9 | +from the server. | |
10 | +The server should scale in two manners. | |
11 | +New instances should be able to handle connection and get | |
12 | +updates about the computed state. | |
13 | +Additionally new instances might hold their own state which | |
14 | +all other instances might update. | |
15 | + | |
16 | +In a first run the state might be something simple as a | |
17 | +matrix where every field hold a unique value. e.g. | |
18 | + | |
19 | + ------------- | |
20 | + |1|4|a|j|k|9| | |
21 | + ------------- | |
22 | + |1|4|a|j|k|9| | |
23 | + ------------- | |
24 | + |1|4|a|j|k|9| | |
25 | + ------------- | |
26 | + |1|4|a|j|k|9| | |
27 | + ------------- | |
28 | + | |
29 | +suggestion for timing: sigsuspend | ... | ... |
TODO
0 → 100644
assets/jquery-1.7.1.js
0 → 100644
This diff could not be displayed because it is too large.
assets/jquery-1.7.1.min.js
0 → 100644
1 | +/*! jQuery v1.7.1 jquery.com | jquery.org/license */ | |
2 | +(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function cb(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function ca(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bE.test(a)?d(a,e):ca(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)ca(a+"["+e+"]",b[e],c,d);else d(a,b)}function b_(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function b$(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bT,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=b$(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=b$(a,c,d,e,"*",g));return l}function bZ(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bP),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bC(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bx:by,g=0,h=e.length;if(d>0){if(c!=="border")for(;g<h;g++)c||(d-=parseFloat(f.css(a,"padding"+e[g]))||0),c==="margin"?d+=parseFloat(f.css(a,c+e[g]))||0:d-=parseFloat(f.css(a,"border"+e[g]+"Width"))||0;return d+"px"}d=bz(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0;if(c)for(;g<h;g++)d+=parseFloat(f.css(a,"padding"+e[g]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+e[g]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+e[g]))||0);return d+"px"}function bp(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c+(i[c][d].namespace?".":"")+i[c][d].namespace,i[c][d],i[c][d].data)}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?m(g):h==="function"&&(!a.unique||!o.has(g))&&c.push(g)},n=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,l=j||0,j=0,k=c.length;for(;c&&l<k;l++)if(c[l].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}i=!1,c&&(a.once?e===!0?o.disable():c=[]:d&&d.length&&(e=d.shift(),o.fireWith(e[0],e[1])))},o={add:function(){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){i&&f<=k&&(k--,f<=l&&l--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&o.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(i?a.once||d.push([b,c]):(!a.once||!e)&&n(b,c));return this},fire:function(){o.fireWith(this,arguments);return this},fired:function(){return!!e}};return o};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p,q=c.createElement("div"),r=c.documentElement;q.setAttribute("className","t"),q.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="<div "+n+"><div></div></div>"+"<table "+n+" cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="<div style='width:4px;'></div>",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h=null;if(typeof a=="undefined"){if(this.length){h=f.data(this[0]);if(this[0].nodeType===1&&!f._data(this[0],"parsedAttrs")){e=this[0].attributes;for(var i=0,j=e.length;i<j;i++)g=e[i].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),l(this[0],g,h[g]));f._data(this[0],"parsedAttrs",!0)}}return h}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split("."),d[1]=d[1]?"."+d[1]:"";if(c===b){h=this.triggerHandler("getData"+d[1]+"!",[d[0]]),h===b&&this.length&&(h=f.data(this[0],a),h=l(this[0],a,h));return h===b&&d[1]?this.data(d[0]):h}return this.each(function(){var b=f(this),e=[d[0],c];b.triggerHandler("setData"+d[1]+"!",e),f.data(this,a,c),b.triggerHandler("changeData"+d[1]+"!",e)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise()}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h<g;h++)e=d[h],e&&(c=f.propFix[e]||e,f.attr(a,e,""),a.removeAttribute(v?e:c),u.test(e)&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")}; | |
3 | +f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=[],j,k,l,m,n,o,p,q,r,s,t;g[0]=c,c.delegateTarget=this;if(e&&!c.target.disabled&&(!c.button||c.type!=="click")){m=f(this),m.context=this.ownerDocument||this;for(l=c.target;l!=this;l=l.parentNode||this){o={},q=[],m[0]=l;for(j=0;j<e;j++)r=d[j],s=r.selector,o[s]===b&&(o[s]=r.quick?H(l,r.quick):m.is(s)),o[s]&&q.push(r);q.length&&i.push({elem:l,matches:q})}}d.length>e&&i.push({elem:this,matches:d.slice(e)});for(j=0;j<i.length&&!c.isPropagationStopped();j++){p=i[j],c.currentTarget=p.elem;for(k=0;k<p.matches.length&&!c.isImmediatePropagationStopped();k++){r=p.matches[k];if(h||!c.namespace&&!r.namespace||c.namespace_re&&c.namespace_re.test(r.namespace))c.data=r.data,c.handleObj=r,n=((f.event.special[r.origType]||{}).handle||r.handler).apply(p.elem,g),n!==b&&(c.result=n,n===!1&&(c.preventDefault(),c.stopPropagation()))}}return c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){this.parentNode&&!a.isTrigger&&f.event.simulate("submit",this.parentNode,a,!0)}),d._submit_attached=!0)})},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate("change",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on.call(this,a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.type+"."+e.namespace:e.type,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.POS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),"not",a)},filter:function(a){return this.pushStack(T(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?Q.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|style)/i,bb=/<(?:script|object|embed|option|style)/i,bc=new RegExp("<(?:"+V+")","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function() | |
4 | +{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bp)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1></$2>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bn(k[i]);else bn(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||be.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bq=/alpha\([^)]*\)/i,br=/opacity=([^)]*)/,bs=/([A-Z]|^ms)/g,bt=/^-?\d+(?:px)?$/i,bu=/^-?\d/,bv=/^([\-+])=([\-+.\de]+)/,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Left","Right"],by=["Top","Bottom"],bz,bA,bB;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bz(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bv.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bz)return bz(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return bC(a,b,d);f.swap(a,bw,function(){e=bC(a,b,d)});return e}},set:function(a,b){if(!bt.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cv(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cu("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cu("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cv(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new f.fx(this,b,i),h=a[i],cn.test(h)?(o=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),o?(f._data(this,"toggle"+i,o==="show"?"hide":"show"),j[o]()):j[h]()):(k=co.exec(h),l=j.cur(),k?(m=parseFloat(k[2]),n=k[3]||(f.cssNumber[i]?"":"px"),n!=="px"&&(f.style(this,i,(m||1)+n),l=(m||1)/j.cur()*l,f.style(this,i,l+n)),k[1]&&(m=(k[1]==="-="?-1:1)*m+l),j.custom(l,m,n)):j.custom(l,h,""));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b]&&g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:cu("show",1),slideUp:cu("hide",1),slideToggle:cu("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=cr||cs(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){e.options.hide&&f._data(e.elem,"fxshow"+e.prop)===b&&f._data(e.elem,"fxshow"+e.prop,e.start)},h()&&f.timers.push(h)&&!cp&&(cp=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f._data(this.elem,"fxshow"+this.prop)||f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=cr||cs(),g=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cp),cp=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),f.each(["width","height"],function(a,b){f.fx.step[b]=function(a){f.style(a.elem,b,Math.max(0,a.now)+a.unit)}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cy(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.support.fixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.support.doesNotAddBorder&&(!f.support.doesAddBorderForTableAndCells||!cw.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.support.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.support.fixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); | |
\ No newline at end of file | ... | ... |
assets/waldschrat.jpg
0 → 100644
77.8 KB
bootstrap
0 → 100755
certs/server.crt
0 → 100644
1 | +-----BEGIN CERTIFICATE----- | |
2 | +MIICrzCCAhgCCQDgHe3rh23alDANBgkqhkiG9w0BAQUFADCBmzELMAkGA1UEBhMC | |
3 | +REUxEDAOBgNVBAgMB0hhbWJ1cmcxEDAOBgNVBAcMB0hhbWJ1cmcxGjAYBgNVBAoM | |
4 | +EVdlaXJkIFdlYiBXb3JrZXJzMRQwEgYDVQQLDAtkZXZlbG9wbWVudDETMBEGA1UE | |
5 | +AwwKR2VvcmcgSG9wcDEhMB8GCSqGSIb3DQEJARYSZ2VvcmdAc3RlZmZlcnMub3Jn | |
6 | +MB4XDTEyMDMwOTExMjUxOVoXDTEzMDMwOTExMjUxOVowgZsxCzAJBgNVBAYTAkRF | |
7 | +MRAwDgYDVQQIDAdIYW1idXJnMRAwDgYDVQQHDAdIYW1idXJnMRowGAYDVQQKDBFX | |
8 | +ZWlyZCBXZWIgV29ya2VyczEUMBIGA1UECwwLZGV2ZWxvcG1lbnQxEzARBgNVBAMM | |
9 | +Ckdlb3JnIEhvcHAxITAfBgkqhkiG9w0BCQEWEmdlb3JnQHN0ZWZmZXJzLm9yZzCB | |
10 | +nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAt5ntW8UUwImTL0s3l7Jm2AkMqBvk | |
11 | ++XCDjkO3g89dxfYyRaYjluANnUqeg/ilF2ZcxI/8GVlCBTDbsJeQXFtlRFr94S2d | |
12 | +i1358dZkjGIQAutmtwf8L1nbYi6mtvS6wBWJhtE9baPfj6HDRePnAC/YtKunKfz9 | |
13 | +5TbOj+/2vjj//I8CAwEAATANBgkqhkiG9w0BAQUFAAOBgQCWVZuqshFdOC3Vmf/7 | |
14 | +CKrtA8/da2tgOIFB60LwGwcWicM3m/VIS6RPf3Ui/sUDFMempkmtkUYflr58T901 | |
15 | +SAV5YubjNV3oaOySqDozsvfLsAxb7EUXk4VqY/g5VkK+pUxVAfE1biqf6LhPHzRd | |
16 | +KJrq5muIGeVx3YX1G9A1gdI0YQ== | |
17 | +-----END CERTIFICATE----- | ... | ... |
certs/server.key
0 → 100644
1 | +-----BEGIN RSA PRIVATE KEY----- | |
2 | +MIICXgIBAAKBgQC3me1bxRTAiZMvSzeXsmbYCQyoG+T5cIOOQ7eDz13F9jJFpiOW | |
3 | +4A2dSp6D+KUXZlzEj/wZWUIFMNuwl5BcW2VEWv3hLZ2LXfnx1mSMYhAC62a3B/wv | |
4 | +WdtiLqa29LrAFYmG0T1to9+PocNF4+cAL9i0q6cp/P3lNs6P7/a+OP/8jwIDAQAB | |
5 | +AoGAMbOEkpwmQvy7EElvUixkNMU2XOe4M2Im6sMgEZl4DBfaggo4hiY+6T6C7LzJ | |
6 | +jC0Unc1QdFg6TAdu4T4WQToojkODjEXWd/QRltxJjkCz2vrDp68JldzfTovE2HDn | |
7 | +k5MQvUZCrH1jFnvzwC1Ak+X4ON5hlsu67u2EYNTfdEeTI6ECQQDwm6DNNjsGynGy | |
8 | +W+zCCGTPjuwYHG7zjaGQw9Ng7g+SyYHkg0zSsxcVpwKwI3m3Iuju1O85pgcl/Bj9 | |
9 | +UDuPdtLxAkEAw1i3ZyGxW/CHmk8mG4w31eC7loyjFgN51lSJE7DrZ3VtKnzRwUrk | |
10 | +EEUgQMh1RxWKTc5F8QvmMpkWJha2+FTHfwJBALDtwBEnD8CunWzKrA8CnR8DuhkA | |
11 | +z5XJUEVjusxMQqduBlZDNvq5NwB1D0T20UoaIa9+ZWu+6wLDnpynoySb/AECQQDB | |
12 | +EDY63EbQqfkrHdx4z20DmZdsZFRuVkMc+/F6H5mYZ6rbmf8ofR7HoboNrNCTz4sf | |
13 | ++KSRZgQ9r6T/QeXVqtx7AkEApiC8VAYhH0Dz+Y6QSRqwjOww0kDBCnFlrdn+oyG4 | |
14 | +kAC34PCOFHzvSsJ3tjcAwNJgcaN/qw49DRnHBlwti6gyBg== | |
15 | +-----END RSA PRIVATE KEY----- | ... | ... |
configure.ac
0 → 100644
1 | +# -*- Autoconf -*- | |
2 | +# Process this file with autoconf to produce a configure script. | |
3 | + | |
4 | +AC_PREREQ([2.68]) | |
5 | +AC_INIT([taskrambler], [0.0.1], [Georg Hopp <georg@steffers.org>]) | |
6 | +AM_INIT_AUTOMAKE | |
7 | +AC_COPYRIGHT([Copyright (C) 2012 Georg Hopp]) | |
8 | +AC_REVISION([$Revision: 0.01 $]) | |
9 | +AC_CONFIG_SRCDIR([src/taskrambler.c]) | |
10 | +AC_CONFIG_HEADERS([config.h]) | |
11 | +AC_CONFIG_MACRO_DIR([m4]) | |
12 | + | |
13 | +# Checks for programs. | |
14 | +AC_PROG_CXX | |
15 | +AC_PROG_CC | |
16 | +AC_PROG_CC_C99 | |
17 | +AC_PROG_LIBTOOL | |
18 | +AM_PROG_CC_C_O | |
19 | + | |
20 | +# # Checks for libraries. | |
21 | +# AC_CHECK_LIB([json], [json_object_new_object], [], | |
22 | +# [AC_MSG_ERROR([json-c library not found], [1])]) | |
23 | +AC_CHECK_LIB([ssl], [SSL_library_init], [], | |
24 | + [AC_MSG_ERROR([openssl not found], [1])]) | |
25 | + | |
26 | +# Checks for header files. | |
27 | +AC_CHECK_HEADERS([stdarg.h string.h stdlib.h stdio.h unistd.h syslog.h sys/types.h json/json.h]) | |
28 | + | |
29 | +# Checks for typedefs, structures, and compiler characteristics. | |
30 | +AC_HEADER_STDBOOL | |
31 | +AC_C_INLINE | |
32 | +AC_TYPE_PID_T | |
33 | +AC_TYPE_SIZE_T | |
34 | + | |
35 | +# Checks for library functions. | |
36 | +#AC_FUNC_FORK | |
37 | +#AC_FUNC_MALLOC | |
38 | +AC_CHECK_FUNCS([memset]) | |
39 | + | |
40 | +AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile]) | |
41 | +AC_OUTPUT | ... | ... |
include/cbuf.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * My implementation of a ringbuffer. | |
4 | + * It maps a shared memory object twice directly following | |
5 | + * thus make it possible to read and write from any | |
6 | + * position within the buffer without the nasty wrap | |
7 | + * calculations. | |
8 | + * This is achived because the same memory region is mapped | |
9 | + * at the two addresses. | |
10 | + * | |
11 | + * \author Georg Hopp | |
12 | + * | |
13 | + * \copyright | |
14 | + * Copyright (C) 2012 Georg Hopp | |
15 | + * | |
16 | + * This program is free software: you can redistribute it and/or modify | |
17 | + * it under the terms of the GNU General Public License as published by | |
18 | + * the Free Software Foundation, either version 3 of the License, or | |
19 | + * (at your option) any later version. | |
20 | + * | |
21 | + * This program is distributed in the hope that it will be useful, | |
22 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
23 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
24 | + * GNU General Public License for more details. | |
25 | + * | |
26 | + * You should have received a copy of the GNU General Public License | |
27 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
28 | + */ | |
29 | + | |
30 | +#ifndef __CBUF_H__ | |
31 | +#define __CBUF_H__ | |
32 | + | |
33 | +#include <ctype.h> | |
34 | +#include <string.h> | |
35 | +#include <sys/types.h> | |
36 | + | |
37 | +#include "class.h" | |
38 | +#include "stream.h" | |
39 | + | |
40 | +#include "commons.h" | |
41 | + | |
42 | +#define ECBUFOVFL 100 | |
43 | + | |
44 | + | |
45 | +CLASS(Cbuf) { | |
46 | + char * shm_name; // shared memory identifier | |
47 | + | |
48 | + char * data; | |
49 | + Bool lock; | |
50 | + | |
51 | + size_t bsize; | |
52 | + size_t bused; | |
53 | + | |
54 | + size_t write; | |
55 | + size_t read; | |
56 | +}; | |
57 | + | |
58 | +ssize_t cbufRead(Cbuf, Stream); | |
59 | +ssize_t cbufWrite(Cbuf, Stream); | |
60 | + | |
61 | +char * cbufGetLine(Cbuf, char **); | |
62 | +char * cbufGetData(Cbuf, size_t); | |
63 | +char * cbufSetData(Cbuf, const void *, size_t); | |
64 | +void cbufEmpty(Cbuf); | |
65 | + | |
66 | +char * cbufGetRead(Cbuf this); | |
67 | +char * cbufGetWrite(Cbuf this); | |
68 | +char * cbufMemchr(Cbuf this, int c); | |
69 | +size_t cbufAddrIndex(Cbuf this, const void * c); | |
70 | +void cbufIncRead(Cbuf this, size_t n); | |
71 | +void cbufIncWrite(Cbuf this, size_t n); | |
72 | +size_t cbufGetFree(Cbuf this); | |
73 | +char cbufIsEmpty(Cbuf this); | |
74 | +void cbufSkipNonAlpha(Cbuf this); | |
75 | +Bool cbufIsLocked(Cbuf this); | |
76 | +void cbufLock(Cbuf this); | |
77 | +void cbufRelease(Cbuf this); | |
78 | + | |
79 | +#endif // __CBUF_H__ | |
80 | + | |
81 | +// vim: set ts=4 sw=4: | ... | ... |
include/class.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * My own class implementation for C. It combines a data structure | |
4 | + * with a set of dynamically linked methods defined by an interface. A | |
5 | + * dynamically linked method will be called via a selector method which in | |
6 | + * turn gets the implementation stored in the class. | |
7 | + * | |
8 | + * \author Georg Hopp | |
9 | + * | |
10 | + * \copyright | |
11 | + * Copyright (C) 2012 Georg Hopp | |
12 | + * | |
13 | + * This program is free software: you can redistribute it and/or modify | |
14 | + * it under the terms of the GNU General Public License as published by | |
15 | + * the Free Software Foundation, either version 3 of the License, or | |
16 | + * (at your option) any later version. | |
17 | + * | |
18 | + * This program is distributed in the hope that it will be useful, | |
19 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | + * GNU General Public License for more details. | |
22 | + * | |
23 | + * You should have received a copy of the GNU General Public License | |
24 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
25 | + */ | |
26 | + | |
27 | +#ifndef __CLASS_H__ | |
28 | +#define __CLASS_H__ | |
29 | + | |
30 | +#include <stdarg.h> | |
31 | +#include <sys/types.h> | |
32 | +#include <string.h> | |
33 | +#include <assert.h> | |
34 | + | |
35 | +#include "interface.h" | |
36 | + | |
37 | +#ifndef _ISOC99_SOURCE | |
38 | +#define _ISOC99_SOURCE | |
39 | +#endif | |
40 | + | |
41 | +#define CLASS_MAGIC 0xFEFE | |
42 | + | |
43 | +#define CLASS(name) \ | |
44 | + struct c_##name; \ | |
45 | + typedef struct c_##name * name; \ | |
46 | + extern struct class * const _##name; \ | |
47 | + struct c_##name | |
48 | + | |
49 | +#define EXTENDS(parent) \ | |
50 | + const char _[sizeof(struct c_##parent)] | |
51 | + | |
52 | +#define _NULL NULL | |
53 | +#define CREATE_CLASS(name,_parent,...) \ | |
54 | + static struct class c_##name; \ | |
55 | + static void _classInit_(void) { \ | |
56 | + c_##name.parent = _##_parent; \ | |
57 | + c_##name.init = NULL; \ | |
58 | + } \ | |
59 | + static struct class c_##name = { \ | |
60 | + CLASS_MAGIC, \ | |
61 | + NULL, \ | |
62 | + sizeof(struct c_##name), \ | |
63 | + _classInit_, \ | |
64 | + INIT_IMPL(__VA_ARGS__) \ | |
65 | + }; struct class * const _##name = &c_##name | |
66 | + | |
67 | +#define GET_CLASS(object) (*(class_ptr *)((object) - sizeof(void*))) | |
68 | +#define IFACE_GET(class,iface) (interfaceGet(&((class)->impl),(iface))) | |
69 | +#define IFACE_EXISTS(class,iface) (NULL != IFACE_GET((class),(iface))) | |
70 | + | |
71 | +/** | |
72 | + * \todo actually i use gcc feature ## for variadoc... think about | |
73 | + * a way to make this standard. | |
74 | + */ | |
75 | +#define _CALL(object,_iface,method,...) \ | |
76 | + do { \ | |
77 | + class_ptr class = GET_CLASS((object)); \ | |
78 | + if (class->init) class->init(); \ | |
79 | + iface = (struct i_##_iface *)IFACE_GET(class, &i_##_iface); \ | |
80 | + while ((NULL == iface || NULL == iface->method) && HAS_PARENT(class)) { \ | |
81 | + class = class->parent; \ | |
82 | + if (class->init) class->init(); \ | |
83 | + iface = (struct i_##_iface *)IFACE_GET(class, &i_##_iface); \ | |
84 | + }; \ | |
85 | + assert(NULL != iface->method); \ | |
86 | + } while(0) | |
87 | + | |
88 | +#define CALL(object,_iface,method,...) \ | |
89 | + do { \ | |
90 | + struct i_##_iface * iface; \ | |
91 | + _CALL(object, _iface, method, ##__VA_ARGS__); \ | |
92 | + iface->method(object, ##__VA_ARGS__); \ | |
93 | + } while(0) | |
94 | + | |
95 | +#define RETCALL(object,_iface,method,ret,...) \ | |
96 | + do { \ | |
97 | + struct i_##_iface * iface; \ | |
98 | + _CALL(object, _iface, method, ##__VA_ARGS__); \ | |
99 | + ret = iface->method(object, ##__VA_ARGS__); \ | |
100 | + } while(0) | |
101 | + | |
102 | +#define PARENTCALL(object,_iface,method,...) \ | |
103 | + do { \ | |
104 | + struct i_##_iface * iface; \ | |
105 | + class_ptr class = GET_CLASS((object)); \ | |
106 | + if (class->init) class->init(); \ | |
107 | + assert(HAS_PARENT(class)); \ | |
108 | + class = class->parent; \ | |
109 | + if (class->init) class->init(); \ | |
110 | + iface = (struct i_##_iface *)IFACE_GET(class, &i_##_iface); \ | |
111 | + assert(NULL != iface->method); \ | |
112 | + iface->method(object, ##__VA_ARGS__); \ | |
113 | + } while(0) | |
114 | + | |
115 | + | |
116 | +#define HAS_PARENT(class) (NULL != ((class)->parent)) | |
117 | + | |
118 | +typedef void (* fptr_classInit)(void); | |
119 | + | |
120 | +struct class; | |
121 | +typedef struct class * class_ptr; | |
122 | +struct class { | |
123 | + const int magic; | |
124 | + class_ptr parent; | |
125 | + size_t object_size; | |
126 | + fptr_classInit init; | |
127 | + struct iface_impl impl; | |
128 | +}; | |
129 | + | |
130 | +#endif // __CLASS_H__ | |
131 | + | |
132 | +// vim: set ts=4 sw=4: | ... | ... |
include/commons.h
0 → 100644
include/http/header.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * HTTP header class. One Instance represents one header line of | |
4 | + * an HTTP message. | |
5 | + * | |
6 | + * \author Georg Hopp | |
7 | + * | |
8 | + * \copyright | |
9 | + * Copyright (C) 2012 Georg Hopp | |
10 | + * | |
11 | + * This program is free software: you can redistribute it and/or modify | |
12 | + * it under the terms of the GNU General Public License as published by | |
13 | + * the Free Software Foundation, either version 3 of the License, or | |
14 | + * (at your option) any later version. | |
15 | + * | |
16 | + * This program is distributed in the hope that it will be useful, | |
17 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | + * GNU General Public License for more details. | |
20 | + * | |
21 | + * You should have received a copy of the GNU General Public License | |
22 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
23 | + */ | |
24 | + | |
25 | +#ifndef __HTTP_HEADER_H__ | |
26 | +#define __HTTP_HEADER_H__ | |
27 | + | |
28 | +#include <sys/types.h> | |
29 | + | |
30 | +#include "class.h" | |
31 | + | |
32 | +#define N_VALUES 128 | |
33 | + | |
34 | +CLASS(HttpHeader) { | |
35 | + unsigned long hash; | |
36 | + char * name; | |
37 | + char * value[N_VALUES]; | |
38 | + size_t nname; //!< len of name without \0 | |
39 | + size_t nvalue[N_VALUES]; //!< len of value without \0 | |
40 | + size_t cvalue; //!< count of values up to N_VALUE | |
41 | + size_t size; //!< full size of this header | |
42 | +}; | |
43 | + | |
44 | +HttpHeader httpHeaderAdd(const HttpHeader *, HttpHeader); | |
45 | +HttpHeader httpHeaderGet(const HttpHeader *, const char *, size_t); | |
46 | +size_t httpHeaderToString(HttpHeader, char *); | |
47 | + | |
48 | +#endif // __HTTP_HEADER_H__ | |
49 | + | |
50 | +// vim: set ts=4 sw=4: | ... | ... |
include/http/message.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * Generic HTTP message. Parent for request and response. | |
4 | + * | |
5 | + * \author Georg Hopp | |
6 | + * | |
7 | + * \copyright | |
8 | + * Copyright (C) 2012 Georg Hopp | |
9 | + * | |
10 | + * This program is free software: you can redistribute it and/or modify | |
11 | + * it under the terms of the GNU General Public License as published by | |
12 | + * the Free Software Foundation, either version 3 of the License, or | |
13 | + * (at your option) any later version. | |
14 | + * | |
15 | + * This program is distributed in the hope that it will be useful, | |
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | + * GNU General Public License for more details. | |
19 | + * | |
20 | + * You should have received a copy of the GNU General Public License | |
21 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
22 | + */ | |
23 | + | |
24 | +#ifndef __HTTP_MESSAGE__ | |
25 | +#define __HTTP_MESSAGE__ | |
26 | + | |
27 | +#include "class.h" | |
28 | +#include "http/header.h" | |
29 | +#include "stream.h" | |
30 | + | |
31 | +typedef enum e_HttpMessageType { | |
32 | + HTTP_MESSAGE_BUFFERED=0, | |
33 | + HTTP_MESSAGE_PIPED | |
34 | +} HttpMessageType; | |
35 | + | |
36 | + | |
37 | +CLASS(HttpMessage) { | |
38 | + char * version; | |
39 | + | |
40 | + HttpHeader header; | |
41 | + | |
42 | + HttpMessageType type; | |
43 | + Stream handle; | |
44 | + char * body; | |
45 | + int nbody; | |
46 | + int dbody; | |
47 | +}; | |
48 | + | |
49 | +char httpMessageHasKeepAlive(HttpMessage); | |
50 | +size_t httpMessageHeaderSizeGet(HttpMessage); | |
51 | +char * httpMessageHeaderToString(HttpMessage, char *); | |
52 | + | |
53 | +int httpMessageGetVersion(HttpMessage, int *, int *); | |
54 | +int httpMessageHasValidVersion(HttpMessage); | |
55 | + | |
56 | +#endif // __HTTP_MESSAGE__ | |
57 | + | |
58 | +// vim: set ts=4 sw=4: | ... | ... |
include/http/message/queue.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * Holds requests ready for processing. | |
4 | + * | |
5 | + * \todo change this to a real queue. | |
6 | + * | |
7 | + * \author Georg Hopp | |
8 | + * | |
9 | + * \copyright | |
10 | + * Copyright (C) 2012 Georg Hopp | |
11 | + * | |
12 | + * This program is free software: you can redistribute it and/or modify | |
13 | + * it under the terms of the GNU General Public License as published by | |
14 | + * the Free Software Foundation, either version 3 of the License, or | |
15 | + * (at your option) any later version. | |
16 | + * | |
17 | + * This program is distributed in the hope that it will be useful, | |
18 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | + * GNU General Public License for more details. | |
21 | + * | |
22 | + * You should have received a copy of the GNU General Public License | |
23 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
24 | + */ | |
25 | + | |
26 | +#ifndef __HTTP_MESSAGE_QUEUE_H__ | |
27 | +#define __HTTP_MESSAGE_QUEUE_H__ | |
28 | + | |
29 | +#include "class.h" | |
30 | +#include "http/message.h" | |
31 | + | |
32 | +#define HTTP_MESSAGE_QUEUE_MAX 1024 | |
33 | + | |
34 | + | |
35 | +CLASS(HttpMessageQueue) { | |
36 | + HttpMessage msgs[HTTP_MESSAGE_QUEUE_MAX]; | |
37 | + size_t nmsgs; | |
38 | +}; | |
39 | + | |
40 | +#endif // __HTTP_MESSAGE_QUEUE_H__ | |
41 | + | |
42 | +// vim: set ts=4 sw=4: | ... | ... |
include/http/parser.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * Parse requests from an input stream. | |
4 | + * | |
5 | + * \author Georg Hopp | |
6 | + * | |
7 | + * \copyright | |
8 | + * Copyright (C) 2012 Georg Hopp | |
9 | + * | |
10 | + * This program is free software: you can redistribute it and/or modify | |
11 | + * it under the terms of the GNU General Public License as published by | |
12 | + * the Free Software Foundation, either version 3 of the License, or | |
13 | + * (at your option) any later version. | |
14 | + * | |
15 | + * This program is distributed in the hope that it will be useful, | |
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | + * GNU General Public License for more details. | |
19 | + * | |
20 | + * You should have received a copy of the GNU General Public License | |
21 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
22 | + */ | |
23 | + | |
24 | +#ifndef __HTTP_PARSER_H__ | |
25 | +#define __HTTP_PARSER_H__ | |
26 | + | |
27 | +#include "class.h" | |
28 | +#include "http/message.h" | |
29 | +#include "http/message/queue.h" | |
30 | +#include "cbuf.h" | |
31 | +#include "stream.h" | |
32 | + | |
33 | +#include "commons.h" | |
34 | + | |
35 | +#define PARSER_MAX_BUF 131072 | |
36 | + | |
37 | + | |
38 | +typedef enum e_HttpMessageState { | |
39 | + HTTP_MESSAGE_GARBAGE=0, | |
40 | + HTTP_MESSAGE_START, | |
41 | + HTTP_MESSAGE_INTRO_DONE, | |
42 | + HTTP_MESSAGE_HEADERS_DONE, | |
43 | + HTTP_MESSAGE_DONE | |
44 | +} HttpMessageState; | |
45 | + | |
46 | + | |
47 | +CLASS(HttpParser) { | |
48 | + Cbuf buffer; | |
49 | + Bool ourLock; | |
50 | + | |
51 | + char * incomplete; | |
52 | + size_t isize; | |
53 | + | |
54 | + HttpMessageQueue queue; | |
55 | + HttpMessage current; | |
56 | + | |
57 | + HttpMessageState state; | |
58 | +}; | |
59 | + | |
60 | +ssize_t httpParserParse(void *, Stream); | |
61 | +void httpParserHeader(HttpParser, const char *, const char *); | |
62 | +void httpParserNewMessage(HttpParser, const char *, const char * lend); | |
63 | +size_t httpParserBody(HttpParser, const char *, size_t); | |
64 | + | |
65 | +#endif // __HTTP_PARSER_H__ | |
66 | + | |
67 | +// vim: set ts=4 sw=4: | ... | ... |
include/http/request.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * Represents one HTTP request. | |
4 | + * | |
5 | + * \author Georg Hopp | |
6 | + * | |
7 | + * \copyright | |
8 | + * Copyright (C) 2012 Georg Hopp | |
9 | + * | |
10 | + * This program is free software: you can redistribute it and/or modify | |
11 | + * it under the terms of the GNU General Public License as published by | |
12 | + * the Free Software Foundation, either version 3 of the License, or | |
13 | + * (at your option) any later version. | |
14 | + * | |
15 | + * This program is distributed in the hope that it will be useful, | |
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | + * GNU General Public License for more details. | |
19 | + * | |
20 | + * You should have received a copy of the GNU General Public License | |
21 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
22 | + */ | |
23 | + | |
24 | +#ifndef __HTTP_REQUEST_H__ | |
25 | +#define __HTTP_REQUEST_H__ | |
26 | + | |
27 | +#include "class.h" | |
28 | +#include "http/message.h" | |
29 | + | |
30 | +#define N_HTTP_METHOD 8 | |
31 | + | |
32 | +char * http_method[N_HTTP_METHOD]; | |
33 | + | |
34 | +CLASS(HttpRequest) { | |
35 | + EXTENDS(HttpMessage); | |
36 | + | |
37 | + char * method; | |
38 | + char * uri; | |
39 | +}; | |
40 | + | |
41 | +int httpRequestHasValidMethod(HttpRequest); | |
42 | + | |
43 | +#endif // __HTTP_REQUEST_H__ | |
44 | + | |
45 | +// vim: set ts=4 sw=4: | ... | ... |
include/http/response.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * Represents one HTTP response. | |
4 | + * | |
5 | + * \author Georg Hopp | |
6 | + * | |
7 | + * \copyright | |
8 | + * Copyright (C) 2012 Georg Hopp | |
9 | + * | |
10 | + * This program is free software: you can redistribute it and/or modify | |
11 | + * it under the terms of the GNU General Public License as published by | |
12 | + * the Free Software Foundation, either version 3 of the License, or | |
13 | + * (at your option) any later version. | |
14 | + * | |
15 | + * This program is distributed in the hope that it will be useful, | |
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | + * GNU General Public License for more details. | |
19 | + * | |
20 | + * You should have received a copy of the GNU General Public License | |
21 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
22 | + */ | |
23 | + | |
24 | +#ifndef __HTTP_RESPONSE_H__ | |
25 | +#define __HTTP_RESPONSE_H__ | |
26 | + | |
27 | +#include <time.h> | |
28 | +#include <sys/types.h> | |
29 | + | |
30 | +#include "class.h" | |
31 | +#include "http/message.h" | |
32 | + | |
33 | + | |
34 | +CLASS(HttpResponse) { | |
35 | + EXTENDS(HttpMessage); | |
36 | + | |
37 | + unsigned int status; | |
38 | + char * reason; | |
39 | +}; | |
40 | + | |
41 | +HttpResponse httpResponse304( | |
42 | + const char *, size_t, | |
43 | + const char *, size_t, | |
44 | + const char *, size_t); | |
45 | +HttpResponse httpResponse404(); | |
46 | +HttpResponse httpResponse403(); | |
47 | +HttpResponse httpResponseMe(); | |
48 | +HttpResponse httpResponseLoginForm(); | |
49 | +HttpResponse httpResponseRandval(time_t, int); | |
50 | +HttpResponse httpResponseAsset( | |
51 | + const char *, | |
52 | + const char *, size_t, | |
53 | + const char *, size_t); | |
54 | + | |
55 | +#endif // __HTTP_RESPONSE_H__ | |
56 | + | |
57 | +// vim: set ts=4 sw=4: | ... | ... |
include/http/worker.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * Worker for processing HTTP request, response cycles. | |
4 | + * | |
5 | + * \author Georg Hopp | |
6 | + * | |
7 | + * \copyright | |
8 | + * Copyright (C) 2012 Georg Hopp | |
9 | + * | |
10 | + * This program is free software: you can redistribute it and/or modify | |
11 | + * it under the terms of the GNU General Public License as published by | |
12 | + * the Free Software Foundation, either version 3 of the License, or | |
13 | + * (at your option) any later version. | |
14 | + * | |
15 | + * This program is distributed in the hope that it will be useful, | |
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | + * GNU General Public License for more details. | |
19 | + * | |
20 | + * You should have received a copy of the GNU General Public License | |
21 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
22 | + */ | |
23 | + | |
24 | +#ifndef __HTTP_WORKER_H__ | |
25 | +#define __HTTP_WORKER_H__ | |
26 | + | |
27 | +#include <sys/types.h> | |
28 | +#include <time.h> | |
29 | + | |
30 | +#include "class.h" | |
31 | +#include "http/parser.h" | |
32 | +#include "http/writer.h" | |
33 | +#include "cbuf.h" | |
34 | +#include "session.h" | |
35 | + | |
36 | +#include "commons.h" | |
37 | + | |
38 | +struct randval { | |
39 | + time_t timestamp; | |
40 | + int value; | |
41 | +}; | |
42 | + | |
43 | + | |
44 | +CLASS(HttpWorker) { | |
45 | + char * id; | |
46 | + struct randval * val; | |
47 | + | |
48 | + Cbuf pbuf; | |
49 | + Cbuf wbuf; | |
50 | + | |
51 | + HttpParser parser; | |
52 | + HttpWriter writer; | |
53 | + Session session; | |
54 | + Session * sroot; | |
55 | +}; | |
56 | + | |
57 | +#endif // __HTTP_WORKER_H__ | |
58 | + | |
59 | +// vim: set ts=4 sw=4: | ... | ... |
include/http/writer.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * Write ready responses to an output stream. | |
4 | + * | |
5 | + * \author Georg Hopp | |
6 | + * | |
7 | + * \copyright | |
8 | + * - Copyright (C) 2012 Georg Hopp | |
9 | + * - | |
10 | + * - This program is free software: you can redistribute it and/or modify | |
11 | + * - it under the terms of the GNU General Public License as published by | |
12 | + * - the Free Software Foundation, either version 3 of the License, or | |
13 | + * - (at your option) any later version. | |
14 | + * - | |
15 | + * - This program is distributed in the hope that it will be useful, | |
16 | + * - but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | + * - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | + * - GNU General Public License for more details. | |
19 | + * - | |
20 | + * - You should have received a copy of the GNU General Public License | |
21 | + * - along with this program. If not, see <http://www.gnu.org/licenses/>. | |
22 | + */ | |
23 | + | |
24 | +#ifndef __HTTP_WRITER_H__ | |
25 | +#define __HTTP_WRITER_H__ | |
26 | + | |
27 | +#include <sys/types.h> | |
28 | + | |
29 | +#include "class.h" | |
30 | +#include "http/message.h" | |
31 | +#include "http/message/queue.h" | |
32 | +#include "cbuf.h" | |
33 | +#include "stream.h" | |
34 | + | |
35 | +#include "commons.h" | |
36 | + | |
37 | + | |
38 | +#define WRITER_MAX_BUF 131072 | |
39 | + | |
40 | + | |
41 | +typedef enum e_HttpWriterState { | |
42 | + HTTP_WRITER_GET=0, | |
43 | + HTTP_WRITER_WRITE, | |
44 | + HTTP_WRITER_DONE | |
45 | +} HttpWriterState; | |
46 | + | |
47 | +CLASS(HttpWriter) { | |
48 | + Cbuf buffer; | |
49 | + Bool ourLock; | |
50 | + | |
51 | + HttpMessageQueue queue; | |
52 | + HttpMessage current; | |
53 | + | |
54 | + size_t nheader; | |
55 | + size_t nbody; | |
56 | + size_t written; | |
57 | + | |
58 | + HttpWriterState state; | |
59 | +}; | |
60 | + | |
61 | +ssize_t httpWriterWrite(void *, Stream); | |
62 | + | |
63 | +#endif // __HTTP_WRITER_H__ | |
64 | + | |
65 | +// vim: set ts=4 sw=4: | ... | ... |
include/interface.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * Interface definition code. Each interface is a set of selector functions | |
4 | + * as well as a data structure where the concrete implementation will be stored. | |
5 | + * This structure is the intergrated in the class that implements the | |
6 | + * interface. | |
7 | + * | |
8 | + * \author Georg Hopp | |
9 | + * | |
10 | + * \copyright | |
11 | + * Copyright (C) 2012 Georg Hopp | |
12 | + * | |
13 | + * This program is free software: you can redistribute it and/or modify | |
14 | + * it under the terms of the GNU General Public License as published by | |
15 | + * the Free Software Foundation, either version 3 of the License, or | |
16 | + * (at your option) any later version. | |
17 | + * | |
18 | + * This program is distributed in the hope that it will be useful, | |
19 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | + * GNU General Public License for more details. | |
22 | + * | |
23 | + * You should have received a copy of the GNU General Public License | |
24 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
25 | + */ | |
26 | + | |
27 | +#ifndef __INTERFACE_H__ | |
28 | +#define __INTERFACE_H__ | |
29 | + | |
30 | +#include <sys/types.h> | |
31 | + | |
32 | +#define MAX_IFACE 32 // ATTENTION: every iface_impl will use MAX_IFACE * sizeof(void*) | |
33 | + | |
34 | +#define IFACE(name) ((const struct i_##name const*)&i_##name##_impl) | |
35 | +#define INIT_IFACE(name,...) \ | |
36 | + static const struct i_##name i_##name##_impl = {&i_##name,__VA_ARGS__} | |
37 | + | |
38 | +#define NUMARGS(...) (sizeof((const void*[]){__VA_ARGS__})/sizeof(void*)) | |
39 | +#define INIT_IMPL(...) {NUMARGS(__VA_ARGS__), 0, {__VA_ARGS__}} | |
40 | + | |
41 | + | |
42 | +struct interface { | |
43 | + const char * name; | |
44 | + const size_t nmethods; | |
45 | +}; | |
46 | +typedef const struct interface * iface_ptr; | |
47 | + | |
48 | +struct iface_impl { | |
49 | + const size_t nimpl; // number of interface implementations | |
50 | + char simpl; // implementations sorted?? | |
51 | + const void * impl[MAX_IFACE]; // implementations | |
52 | +}; | |
53 | +typedef struct iface_impl * iface_impl_ptr; | |
54 | + | |
55 | +extern struct interface * interfaceGet(iface_impl_ptr, const iface_ptr); | |
56 | + | |
57 | +#endif // __INTERFACE_H__ | |
58 | + | |
59 | +// vim: set ts=4 sw=4: | ... | ... |
include/interface/class.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * Interface for class handling. Defines new, delete and clone selectors | |
4 | + * which in turn use the ctor, dtor and clone implementation from the | |
5 | + * class implementation. | |
6 | + * | |
7 | + * \author Georg Hopp | |
8 | + * | |
9 | + * \copyright | |
10 | + * Copyright (C) 2012 Georg Hopp | |
11 | + * | |
12 | + * This program is free software: you can redistribute it and/or modify | |
13 | + * it under the terms of the GNU General Public License as published by | |
14 | + * the Free Software Foundation, either version 3 of the License, or | |
15 | + * (at your option) any later version. | |
16 | + * | |
17 | + * This program is distributed in the hope that it will be useful, | |
18 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | + * GNU General Public License for more details. | |
21 | + * | |
22 | + * You should have received a copy of the GNU General Public License | |
23 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
24 | + */ | |
25 | + | |
26 | +#ifndef __INTERFACE_CLASS_H__ | |
27 | +#define __INTERFACE_CLASS_H__ | |
28 | + | |
29 | +#include <stdarg.h> | |
30 | + | |
31 | +#include "class.h" | |
32 | +#include "interface.h" | |
33 | + | |
34 | +typedef int (* fptr_ctor)(void *, va_list *); | |
35 | +typedef void (* fptr_dtor)(void *); | |
36 | +typedef void (* fptr_clone)(void *, void * const); | |
37 | + | |
38 | +extern const struct interface i_Class; | |
39 | + | |
40 | +struct i_Class { | |
41 | + const struct interface * const _; | |
42 | + fptr_ctor ctor; | |
43 | + fptr_dtor dtor; | |
44 | + fptr_clone clone; | |
45 | +}; | |
46 | + | |
47 | +extern void * classNew(class_ptr, ...); | |
48 | +extern void classDelete(void **); | |
49 | +extern void * classClone(void *); | |
50 | + | |
51 | +#define new(class,...) classNew(_##class, ##__VA_ARGS__) | |
52 | +#define delete(object) classDelete((void **)&(object)) | |
53 | +#define clone(object) classClone((void *)(object)) | |
54 | + | |
55 | +#endif // __INTERFACE_CLASS_H__ | |
56 | + | |
57 | +// vim: set ts=4 sw=4: | ... | ... |
include/interface/http_intro.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * Virtual (dynamically bound) methods to get the size of the http intro | |
4 | + * line. As i have two kinds of http messages (response, request) which | |
5 | + * need a slitly different handling when turning the data into a string. | |
6 | + * | |
7 | + * \author Georg Hopp | |
8 | + * | |
9 | + * \copyright | |
10 | + * Copyright (C) 2012 Georg Hopp | |
11 | + * | |
12 | + * This program is free software: you can redistribute it and/or modify | |
13 | + * it under the terms of the GNU General Public License as published by | |
14 | + * the Free Software Foundation, either version 3 of the License, or | |
15 | + * (at your option) any later version. | |
16 | + * | |
17 | + * This program is distributed in the hope that it will be useful, | |
18 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | + * GNU General Public License for more details. | |
21 | + * | |
22 | + * You should have received a copy of the GNU General Public License | |
23 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
24 | + */ | |
25 | + | |
26 | +#ifndef __HTTP_INTRO_H__ | |
27 | +#define __HTTP_INTRO_H__ | |
28 | + | |
29 | +#include <sys/types.h> | |
30 | + | |
31 | +typedef size_t (* fptr_httpIntroSizeGet)(void *); | |
32 | +typedef char * (* fptr_httpIntroToString)(void *, char *); | |
33 | + | |
34 | +extern const struct interface i_HttpIntro; | |
35 | + | |
36 | +struct i_HttpIntro { | |
37 | + const struct interface * const _; | |
38 | + fptr_httpIntroSizeGet sizeGet; | |
39 | + fptr_httpIntroToString toString; | |
40 | +}; | |
41 | + | |
42 | +extern size_t httpIntroSizeGet(void *); | |
43 | +extern char * httpIntroToString(void *, char *); | |
44 | + | |
45 | +#endif // __HTTP_INTRO_H__ | |
46 | + | |
47 | +// vim: set ts=4 sw=4: | ... | ... |
include/interface/logger.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * The logger interface. | |
4 | + * | |
5 | + * \author Georg Hopp | |
6 | + * | |
7 | + * \copyright | |
8 | + * Copyright (C) 2012 Georg Hopp | |
9 | + * | |
10 | + * This program is free software: you can redistribute it and/or modify | |
11 | + * it under the terms of the GNU General Public License as published by | |
12 | + * the Free Software Foundation, either version 3 of the License, or | |
13 | + * (at your option) any later version. | |
14 | + * | |
15 | + * This program is distributed in the hope that it will be useful, | |
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | + * GNU General Public License for more details. | |
19 | + * | |
20 | + * You should have received a copy of the GNU General Public License | |
21 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
22 | + */ | |
23 | + | |
24 | +#ifndef __INTERFACE_LOGGER_H__ | |
25 | +#define __INTERFACE_LOGGER_H__ | |
26 | + | |
27 | +#include <stdarg.h> | |
28 | + | |
29 | +#include "interface.h" | |
30 | +#include "logger.h" | |
31 | + | |
32 | +typedef void (* fptr_log)(void *, logger_level, const char * const); | |
33 | + | |
34 | +extern const struct interface i_Logger; | |
35 | + | |
36 | +struct i_Logger { | |
37 | + const struct interface * const _; | |
38 | + fptr_log log; | |
39 | +}; | |
40 | + | |
41 | +extern void loggerLog(void *, logger_level, const char * const, ...); | |
42 | + | |
43 | +#endif // __INTERFACE_LOGGER_H__ | |
44 | + | |
45 | +// vim: set ts=4 sw=4: | ... | ... |
include/interface/observer.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * Definition of the observer pattern implementation. | |
4 | + * | |
5 | + * \author Georg Hopp | |
6 | + * | |
7 | + * \copyright | |
8 | + * Copyright (C) 2012 Georg Hopp | |
9 | + * | |
10 | + * This program is free software: you can redistribute it and/or modify | |
11 | + * it under the terms of the GNU General Public License as published by | |
12 | + * the Free Software Foundation, either version 3 of the License, or | |
13 | + * (at your option) any later version. | |
14 | + * | |
15 | + * This program is distributed in the hope that it will be useful, | |
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | + * GNU General Public License for more details. | |
19 | + * | |
20 | + * You should have received a copy of the GNU General Public License | |
21 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
22 | + */ | |
23 | + | |
24 | +#ifndef __OBSERVER_H__ | |
25 | +#define __OBSERVER_H__ | |
26 | + | |
27 | +typedef void (* fptr_observerNotify)(void *, void*); | |
28 | + | |
29 | +extern const struct interface i_Observer; | |
30 | + | |
31 | +struct i_Observer { | |
32 | + const struct interface * const _; | |
33 | + fptr_observerNotify notify; | |
34 | +}; | |
35 | + | |
36 | +extern void observerNotify(void *, void *); | |
37 | + | |
38 | +#endif // __OBSERVER_H__ | |
39 | + | |
40 | +// vim: set ts=4 sw=4: | ... | ... |
include/interface/stream_reader.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * Interface whose implementations can read from a stream given as | |
4 | + * a handle. | |
5 | + * | |
6 | + * \author Georg Hopp | |
7 | + * | |
8 | + * \copyright | |
9 | + * Copyright (C) 2012 Georg Hopp | |
10 | + * | |
11 | + * This program is free software: you can redistribute it and/or modify | |
12 | + * it under the terms of the GNU General Public License as published by | |
13 | + * the Free Software Foundation, either version 3 of the License, or | |
14 | + * (at your option) any later version. | |
15 | + * | |
16 | + * This program is distributed in the hope that it will be useful, | |
17 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | + * GNU General Public License for more details. | |
20 | + * | |
21 | + * You should have received a copy of the GNU General Public License | |
22 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
23 | + */ | |
24 | + | |
25 | +#ifndef __STREAM_READER_H__ | |
26 | +#define __STREAM_READER_H__ | |
27 | + | |
28 | +#include <sys/types.h> | |
29 | + | |
30 | +#include "stream.h" | |
31 | + | |
32 | +typedef ssize_t (* fptr_streamReaderRead)(void *, Stream); | |
33 | + | |
34 | +extern const struct interface i_StreamReader; | |
35 | + | |
36 | +struct i_StreamReader { | |
37 | + const struct interface * const _; | |
38 | + fptr_streamReaderRead read; | |
39 | +}; | |
40 | + | |
41 | +extern ssize_t streamReaderRead(void *, Stream); | |
42 | + | |
43 | +#endif // __STREAM_READER_H__ | |
44 | + | |
45 | +// vim: set ts=4 sw=4: | ... | ... |
include/interface/stream_writer.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * Interface whose implementations can write from a stream given as | |
4 | + * a handle. | |
5 | + * | |
6 | + * \author Georg Hopp | |
7 | + * | |
8 | + * \copyright | |
9 | + * Copyright (C) 2012 Georg Hopp | |
10 | + * | |
11 | + * This program is free software: you can redistribute it and/or modify | |
12 | + * it under the terms of the GNU General Public License as published by | |
13 | + * the Free Software Foundation, either version 3 of the License, or | |
14 | + * (at your option) any later version. | |
15 | + * | |
16 | + * This program is distributed in the hope that it will be useful, | |
17 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | + * GNU General Public License for more details. | |
20 | + * | |
21 | + * You should have received a copy of the GNU General Public License | |
22 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
23 | + */ | |
24 | + | |
25 | +#ifndef __STREAM_WRITER_H__ | |
26 | +#define __STREAM_WRITER_H__ | |
27 | + | |
28 | +#include <sys/types.h> | |
29 | + | |
30 | +#include "stream.h" | |
31 | + | |
32 | +typedef ssize_t (* fptr_streamWriterWrite)(void *, Stream); | |
33 | + | |
34 | +extern const struct interface i_StreamWriter; | |
35 | + | |
36 | +struct i_StreamWriter { | |
37 | + const struct interface * const _; | |
38 | + fptr_streamWriterWrite write; | |
39 | +}; | |
40 | + | |
41 | +extern ssize_t streamWriterWrite(void *, Stream); | |
42 | + | |
43 | +#endif // __STREAM_WRITER_H__ | |
44 | + | |
45 | +// vim: set ts=4 sw=4: | ... | ... |
include/interface/subject.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * Definition of the subject pattern implementation. | |
4 | + * | |
5 | + * \author Georg Hopp | |
6 | + * | |
7 | + * \copyright | |
8 | + * Copyright (C) 2012 Georg Hopp | |
9 | + * | |
10 | + * This program is free software: you can redistribute it and/or modify | |
11 | + * it under the terms of the GNU General Public License as published by | |
12 | + * the Free Software Foundation, either version 3 of the License, or | |
13 | + * (at your option) any later version. | |
14 | + * | |
15 | + * This program is distributed in the hope that it will be useful, | |
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | + * GNU General Public License for more details. | |
19 | + * | |
20 | + * You should have received a copy of the GNU General Public License | |
21 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
22 | + */ | |
23 | + | |
24 | +#ifndef __SUBJECT_H__ | |
25 | +#define __SUBJECT_H__ | |
26 | + | |
27 | +typedef void (* fptr_subjectAttach)(void *, void *); | |
28 | +typedef void (* fptr_subjectDetach)(void *, void *); | |
29 | +typedef void (* fptr_subjectNotify)(void *); | |
30 | + | |
31 | +extern const struct interface i_Subject; | |
32 | + | |
33 | +struct i_Subject { | |
34 | + const struct interface * const _; | |
35 | + fptr_subjectAttach attach; | |
36 | + fptr_subjectDetach detach; | |
37 | + fptr_subjectNotify notify; | |
38 | +}; | |
39 | + | |
40 | +extern void subjectAttach(void *, void *); | |
41 | +extern void subjectDetach(void *, void *); | |
42 | +extern void subjectNotify(void *); | |
43 | + | |
44 | +#endif // __SUBJECT_H__ | |
45 | + | |
46 | +// vim: set ts=4 sw=4: | ... | ... |
include/logger.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * A generic logger class and two extended classes, One that logs to | |
4 | + * stderr and one that logs to the system syslog. | |
5 | + * | |
6 | + * \author Georg Hopp | |
7 | + * | |
8 | + * \copyright | |
9 | + * Copyright (C) 2012 Georg Hopp | |
10 | + * | |
11 | + * This program is free software: you can redistribute it and/or modify | |
12 | + * it under the terms of the GNU General Public License as published by | |
13 | + * the Free Software Foundation, either version 3 of the License, or | |
14 | + * (at your option) any later version. | |
15 | + * | |
16 | + * This program is distributed in the hope that it will be useful, | |
17 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | + * GNU General Public License for more details. | |
20 | + * | |
21 | + * You should have received a copy of the GNU General Public License | |
22 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
23 | + */ | |
24 | + | |
25 | +#ifndef __LOGGER_H__ | |
26 | +#define __LOGGER_H__ | |
27 | + | |
28 | +#include "class.h" | |
29 | + | |
30 | +typedef enum logger_level { | |
31 | + LOGGER_DEBUG=0, | |
32 | + LOGGER_INFO, | |
33 | + LOGGER_NOTICE, | |
34 | + LOGGER_WARNING, | |
35 | + LOGGER_ERR, | |
36 | + LOGGER_CRIT, | |
37 | + LOGGER_ALERT, | |
38 | + LOGGER_EMERG | |
39 | +} logger_level; | |
40 | + | |
41 | +extern const char * const logger_level_str[]; | |
42 | + | |
43 | +CLASS(Logger) { | |
44 | + logger_level min_level; | |
45 | +}; | |
46 | + | |
47 | +CLASS(LoggerStderr) { | |
48 | + EXTENDS(Logger); | |
49 | +}; | |
50 | + | |
51 | +CLASS(LoggerSyslog) { | |
52 | + EXTENDS(Logger); | |
53 | +}; | |
54 | + | |
55 | +#endif // __LOGGER_H__ | |
56 | + | |
57 | +// vim: set ts=4 sw=4: | ... | ... |
include/server.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * Server class. Handles acceptance and closing of connection and uses | |
4 | + * a class that has to implement the stream reader and writer interface | |
5 | + * to handle incoming reads and outgoing writes. | |
6 | + * | |
7 | + * \author Georg Hopp | |
8 | + * | |
9 | + * \copyright | |
10 | + * Copyright (C) 2012 Georg Hopp | |
11 | + * | |
12 | + * This program is free software: you can redistribute it and/or modify | |
13 | + * it under the terms of the GNU General Public License as published by | |
14 | + * the Free Software Foundation, either version 3 of the License, or | |
15 | + * (at your option) any later version. | |
16 | + * | |
17 | + * This program is distributed in the hope that it will be useful, | |
18 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | + * GNU General Public License for more details. | |
21 | + * | |
22 | + * You should have received a copy of the GNU General Public License | |
23 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
24 | + */ | |
25 | + | |
26 | +#ifndef __SERVER_H__ | |
27 | +#define __SERVER_H__ | |
28 | + | |
29 | +#include <stdio.h> // for printf() and fprintf() | |
30 | +#include <poll.h> // for poll system call and related | |
31 | + | |
32 | +#include <openssl/ssl.h> | |
33 | + | |
34 | +#include "class.h" | |
35 | +#include "socket.h" | |
36 | +#include "logger.h" | |
37 | +#include "stream.h" | |
38 | + | |
39 | +struct conns { | |
40 | + Sock sock; | |
41 | + Stream stream; | |
42 | + void * worker; | |
43 | +}; | |
44 | + | |
45 | +CLASS(Server) { | |
46 | + Logger logger; | |
47 | + Sock sock; | |
48 | + Sock sockSSL; | |
49 | + SSL_CTX * ctx; | |
50 | + void * worker; | |
51 | + | |
52 | + nfds_t nfds; | |
53 | + struct pollfd * fds; | |
54 | + long max_fds; | |
55 | + | |
56 | + struct conns * conns; | |
57 | +}; | |
58 | + | |
59 | +void serverRun(Server this); | |
60 | + | |
61 | +#endif // __SERVER_H__ | |
62 | + | |
63 | +// vim: set ts=4 sw=4: | ... | ... |
include/session.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#ifndef __SESSION_H__ | |
24 | +#define __SESSION_H__ | |
25 | + | |
26 | +#include <time.h> | |
27 | +#include <sys/types.h> | |
28 | + | |
29 | +#include "class.h" | |
30 | + | |
31 | +#define SESSION_LIVETIME 30 | |
32 | + | |
33 | + | |
34 | +CLASS(Session) { | |
35 | + unsigned long id; | |
36 | + time_t livetime; | |
37 | + | |
38 | + char * username; | |
39 | +}; | |
40 | + | |
41 | +Session sessionAdd(const Session *, Session); | |
42 | +Session sessionGet(const Session *, const unsigned long id); | |
43 | +void sessionDelete(const Session *, const unsigned long id); | |
44 | + | |
45 | +#endif // __SESSION_H__ | |
46 | + | |
47 | +// vim: set ts=4 sw=4: | ... | ... |
include/socket.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * Abstraction layer above BSD sockets. Capsules and simplifies connect | |
4 | + * accept and listen. | |
5 | + * | |
6 | + * \author Georg Hopp | |
7 | + * | |
8 | + * \copyright | |
9 | + * Copyright (C) 2012 Georg Hopp | |
10 | + * | |
11 | + * This program is free software: you can redistribute it and/or modify | |
12 | + * it under the terms of the GNU General Public License as published by | |
13 | + * the Free Software Foundation, either version 3 of the License, or | |
14 | + * (at your option) any later version. | |
15 | + * | |
16 | + * This program is distributed in the hope that it will be useful, | |
17 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | + * GNU General Public License for more details. | |
20 | + * | |
21 | + * You should have received a copy of the GNU General Public License | |
22 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
23 | + */ | |
24 | + | |
25 | +#ifndef __SOCKET_H__ | |
26 | +#define __SOCKET_H__ | |
27 | + | |
28 | +#include <arpa/inet.h> // for in_port_t | |
29 | + | |
30 | +#include "class.h" | |
31 | +#include "logger.h" | |
32 | + | |
33 | +CLASS(Sock) { | |
34 | + Logger log; | |
35 | + in_port_t port; | |
36 | + struct sockaddr_in addr; | |
37 | + int handle; | |
38 | +}; | |
39 | + | |
40 | +void socketConnect(Sock this, const char * addr, char (*)[16]); | |
41 | +void socketListen(Sock this, int backlog); | |
42 | +Sock socketAccept(Sock this, char (*remoteAddr)[16]); | |
43 | + | |
44 | +#endif // __SOCKET_H__ | |
45 | + | |
46 | +// vim: set ts=4 sw=4: | |
47 | + | ... | ... |
include/stream.h
0 → 100644
1 | +#ifndef __STREAM_H__ | |
2 | +#define __STREAM_H__ | |
3 | + | |
4 | +#include <sys/types.h> | |
5 | +#include <openssl/ssl.h> | |
6 | + | |
7 | +#include "class.h" | |
8 | + | |
9 | +typedef enum e_StreamHandleType { | |
10 | + STREAM_FD = 0, | |
11 | + STREAM_SSL | |
12 | +} StreamHandleType; | |
13 | + | |
14 | +CLASS(Stream) { | |
15 | + StreamHandleType type; | |
16 | + union { | |
17 | + int fd; | |
18 | + SSL * ssl; | |
19 | + } handle; | |
20 | +}; | |
21 | + | |
22 | +ssize_t streamRead(Stream, void *, size_t); | |
23 | +ssize_t streamWrite(Stream, void *, size_t); | |
24 | + | |
25 | +#endif // __STREAM_H__ | |
26 | + | |
27 | +// vim: set ts=4 sw=4: | ... | ... |
include/utils/hash.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * Functions to handle varios signals send to the application. | |
4 | + * | |
5 | + * \author Georg Hopp | |
6 | + * | |
7 | + * \copyright | |
8 | + * Copyright (C) 2012 Georg Hopp | |
9 | + * | |
10 | + * This program is free software: you can redistribute it and/or modify | |
11 | + * it under the terms of the GNU General Public License as published by | |
12 | + * the Free Software Foundation, either version 3 of the License, or | |
13 | + * (at your option) any later version. | |
14 | + * | |
15 | + * This program is distributed in the hope that it will be useful, | |
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | + * GNU General Public License for more details. | |
19 | + * | |
20 | + * You should have received a copy of the GNU General Public License | |
21 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
22 | + */ | |
23 | + | |
24 | +#ifndef __UTILS_HASH_H__ | |
25 | +#define __UTILS_HASH_H__ | |
26 | + | |
27 | +#include <sys/types.h> | |
28 | + | |
29 | +unsigned long sdbm(const unsigned char *, size_t); | |
30 | + | |
31 | +#endif // __UTILS_HASH_H__ | |
32 | + | |
33 | +// vim: set ts=4 sw=4: | ... | ... |
include/utils/http.h
0 → 100644
1 | +#ifndef __UTILS_HTTP_H__ | |
2 | +#define __UTILS_HTTP_H__ | |
3 | + | |
4 | +#include <sys/types.h> | |
5 | + | |
6 | +#include "http/message.h" | |
7 | + | |
8 | +char isHttpVersion(const char *, size_t); | |
9 | +HttpMessage httpGetMessage( | |
10 | + const char *, size_t, | |
11 | + const char *, size_t, | |
12 | + const char *, size_t); | |
13 | + | |
14 | +#endif // __UTILS_HTTP_H__ | |
15 | + | |
16 | +// vim: set ts=4 sw=4: | ... | ... |
include/utils/memory.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#ifndef __UTILS_MEMORY_H__ | |
24 | +#define __UTILS_MEMORY_H__ | |
25 | + | |
26 | +#define CSTRA(val) val, sizeof(val)-1 //!< Const STRing Argument | |
27 | + | |
28 | +#define FREE(val) (ffree((void**)&(val))) | |
29 | + | |
30 | +void ffree(void **); | |
31 | + | |
32 | +#endif // __UTILS_MEMORY_H__ | |
33 | + | |
34 | +// vim: set ts=4 sw=4: | ... | ... |
include/utils/signalHandling.h
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * Functions to handle varios signals send to the application. | |
4 | + * | |
5 | + * \author Georg Hopp | |
6 | + * | |
7 | + * \copyright | |
8 | + * Copyright (C) 2012 Georg Hopp | |
9 | + * | |
10 | + * This program is free software: you can redistribute it and/or modify | |
11 | + * it under the terms of the GNU General Public License as published by | |
12 | + * the Free Software Foundation, either version 3 of the License, or | |
13 | + * (at your option) any later version. | |
14 | + * | |
15 | + * This program is distributed in the hope that it will be useful, | |
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | + * GNU General Public License for more details. | |
19 | + * | |
20 | + * You should have received a copy of the GNU General Public License | |
21 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
22 | + */ | |
23 | + | |
24 | +#ifndef __UTILS_SIGNAL_HANDLING_H__ | |
25 | +#define __UTILS_SIGNAL_HANDLING_H__ | |
26 | + | |
27 | +extern volatile int doShutdown; | |
28 | + | |
29 | +void terminate(int signum); | |
30 | +void init_signals(void); | |
31 | + | |
32 | +#endif // __UTILS_SIGNAL_HANDLING_H__ | |
33 | + | ... | ... |
src/Makefile.am
0 → 100644
1 | +ACLOCAL_AMFLAGS = -I m4 | |
2 | +AUTOMAKE_OPTIONS = subdir-objects | |
3 | + | |
4 | +IFACE = interface/class.c interface/stream_reader.c interface/logger.c \ | |
5 | + interface/stream_writer.c interface/http_intro.c \ | |
6 | + interface/subject.c interface/observer.c interface.c | |
7 | +SOCKET = socket.c socket/accept.c socket/connect.c socket/listen.c | |
8 | +STREAM = stream.c stream/read.c stream/write.c | |
9 | +SERVER = server.c server/run.c server/close_conn.c server/poll.c \ | |
10 | + server/handle_accept.c server/read.c server/write.c | |
11 | +LOGGER = logger.c logger/stderr.c logger/syslog.c | |
12 | +CB = cbuf.c cbuf/read.c cbuf/write.c \ | |
13 | + cbuf/get_line.c cbuf/set_data.c cbuf/get_data.c \ | |
14 | + cbuf/addr_index.c cbuf/get_free.c cbuf/get_read.c cbuf/get_write.c \ | |
15 | + cbuf/inc_read.c cbuf/inc_write.c cbuf/is_empty.c cbuf/memchr.c \ | |
16 | + cbuf/skip_non_alpha.c cbuf/is_locked.c cbuf/lock.c cbuf/release.c \ | |
17 | + cbuf/empty.c | |
18 | +MSG = http/message.c \ | |
19 | + http/message/has_keep_alive.c \ | |
20 | + http/message/header_size_get.c \ | |
21 | + http/message/header_to_string.c \ | |
22 | + http/message/get_version.c \ | |
23 | + http/message/has_valid_version.c | |
24 | +MSGQ = http/message/queue.c | |
25 | +REQ = http/request.c \ | |
26 | + http/request/has_valid_method.c | |
27 | +RESP = http/response.c \ | |
28 | + http/response/304.c \ | |
29 | + http/response/404.c \ | |
30 | + http/response/403.c \ | |
31 | + http/response/login_form.c \ | |
32 | + http/response/asset.c \ | |
33 | + http/response/me.c \ | |
34 | + http/response/randval.c | |
35 | +PARSER = http/parser.c \ | |
36 | + http/parser/parse.c \ | |
37 | + http/parser/new_message.c \ | |
38 | + http/parser/header.c \ | |
39 | + http/parser/body.c | |
40 | +WRITER = http/writer.c \ | |
41 | + http/writer/write.c | |
42 | +WORKER = http/worker.c \ | |
43 | + http/worker/process.c \ | |
44 | + http/worker/write.c \ | |
45 | + http/worker/get_asset.c \ | |
46 | + http/worker/add_common_header.c | |
47 | +HEADER = http/header.c http/header/get.c http/header/add.c \ | |
48 | + http/header/to_string.c | |
49 | +SESSION = session.c session/add.c session/get.c session/delete.c | |
50 | +UTILS = utils/hash.c \ | |
51 | + utils/memory.c \ | |
52 | + utils/http.c \ | |
53 | + utils/daemonize.c \ | |
54 | + utils/signalHandling.c | |
55 | + | |
56 | + | |
57 | +AM_CFLAGS = -Wall -I ../include/ | |
58 | + | |
59 | +bin_PROGRAMS = taskrambler | |
60 | + | |
61 | +taskrambler_SOURCES = webgameserver.c \ | |
62 | + $(IFACE) $(SOCKET) $(SERVER) $(LOGGER) $(MSG) $(REQ) \ | |
63 | + $(WRITER) $(RESP) $(HEADER) $(PARSER) $(WORKER) $(CB) \ | |
64 | + $(UTILS) $(MSGQ) $(SESSION) $(STREAM) | |
65 | +taskrambler_CFLAGS = -Wall -I ../include/ | |
66 | +taskrambler_LDFLAGS = -lrt -lssl | ... | ... |
src/cbuf.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#define _POSIX_SOURCE | |
24 | +#define _POSIX_C_SOURCE 200112L | |
25 | +#define _GNU_SOURCE | |
26 | + | |
27 | +#include <sys/types.h> | |
28 | +#include <sys/stat.h> | |
29 | +#include <sys/mman.h> | |
30 | +#include <stdarg.h> | |
31 | +#include <stdlib.h> | |
32 | +#include <stdio.h> | |
33 | +#include <unistd.h> | |
34 | +#include <fcntl.h> | |
35 | + | |
36 | +#include "class.h" | |
37 | +#include "interface/class.h" | |
38 | +#include "utils/memory.h" | |
39 | + | |
40 | +#include "cbuf.h" | |
41 | + | |
42 | + | |
43 | +static void cbufDtor(void*); | |
44 | + | |
45 | +static | |
46 | +int | |
47 | +cbufCtor(void * _this, va_list * params) | |
48 | +{ | |
49 | + Cbuf this = _this; | |
50 | + char state = -1; | |
51 | + char * shm_name = va_arg(*params, char*); | |
52 | + long psize = sysconf(_SC_PAGESIZE); | |
53 | + size_t size; | |
54 | + int shm; | |
55 | + char * data; | |
56 | + | |
57 | + this->shm_name = malloc(strlen(shm_name) + 7 + 2); | |
58 | + sprintf(this->shm_name, "/%06d_%s", getpid(), shm_name); | |
59 | + | |
60 | + /** | |
61 | + * align size at page boundary. | |
62 | + * increase as neccessary | |
63 | + */ | |
64 | + size = va_arg(*params, size_t); | |
65 | + size = (0 >= size)? 1 : (0 != size%psize)? (size/psize)+1 : size/psize; | |
66 | + this->bsize = psize * size; | |
67 | + | |
68 | + while (-1 == state) { | |
69 | + shm = shm_open(this->shm_name, O_RDWR|O_CREAT|O_EXCL, S_IRWXU); | |
70 | + if (-1 == shm) { | |
71 | + break; | |
72 | + } | |
73 | + | |
74 | + if (-1 == ftruncate(shm, this->bsize)) { | |
75 | + break; | |
76 | + } | |
77 | + | |
78 | + this->data = mmap (0, this->bsize << 1, | |
79 | + PROT_NONE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0); | |
80 | + if (this->data == MAP_FAILED) { | |
81 | + this->data = NULL; | |
82 | + break; | |
83 | + } | |
84 | + | |
85 | + data = mmap (this->data, this->bsize, | |
86 | + PROT_READ|PROT_WRITE, MAP_FIXED|MAP_SHARED, shm, 0); | |
87 | + if (data != this->data) { | |
88 | + break; | |
89 | + } | |
90 | + | |
91 | + data = mmap (this->data + this->bsize, this->bsize, | |
92 | + PROT_READ|PROT_WRITE, MAP_FIXED|MAP_SHARED, shm, 0); | |
93 | + if (data != this->data + this->bsize) { | |
94 | + break; | |
95 | + } | |
96 | + | |
97 | + state = 0; | |
98 | + } | |
99 | + | |
100 | + if (-1 != shm) { | |
101 | + shm_unlink(this->shm_name); | |
102 | + close(shm); | |
103 | + } | |
104 | + | |
105 | + return state; | |
106 | +} | |
107 | + | |
108 | +static | |
109 | +void | |
110 | +cbufDtor(void * _this) | |
111 | +{ | |
112 | + Cbuf this = _this; | |
113 | + | |
114 | + FREE(this->shm_name); | |
115 | + | |
116 | + if (NULL != this->data && MAP_FAILED != this->data) { | |
117 | + munmap(this->data, this->bsize << 1); | |
118 | + } | |
119 | + | |
120 | + this->data = NULL; | |
121 | +} | |
122 | + | |
123 | +INIT_IFACE(Class, cbufCtor, cbufDtor, NULL); | |
124 | +CREATE_CLASS(Cbuf, NULL, IFACE(Class)); | |
125 | + | |
126 | +// vim: set ts=4 sw=4: | ... | ... |
src/cbuf/addr_index.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include <sys/types.h> | |
24 | + | |
25 | +#include "cbuf.h" | |
26 | + | |
27 | +size_t | |
28 | +cbufAddrIndex(Cbuf this, const void * c) | |
29 | +{ | |
30 | + return c - (const void *)cbufGetRead(this); | |
31 | +} | |
32 | + | |
33 | +// vim: set ts=4 sw=4: | ... | ... |
src/cbuf/empty.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include "cbuf.h" | |
24 | + | |
25 | +void | |
26 | +cbufEmpty(Cbuf this) | |
27 | +{ | |
28 | + this->bused = 0; | |
29 | + this->read = this->write; | |
30 | +} | |
31 | + | |
32 | +// vim: set ts=4 sw=4: | ... | ... |
src/cbuf/get_data.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include <sys/types.h> | |
24 | +#include <string.h> | |
25 | + | |
26 | +#include "cbuf.h" | |
27 | + | |
28 | +char * | |
29 | +cbufGetData(Cbuf this, size_t n) | |
30 | +{ | |
31 | + char * ret = cbufGetRead(this); | |
32 | + | |
33 | + if (n > this->bused) { | |
34 | + return (char *)-1; | |
35 | + } | |
36 | + | |
37 | + cbufIncRead(this, n); | |
38 | + return ret; | |
39 | +} | |
40 | + | |
41 | +// vim: set ts=4 sw=4: | ... | ... |
src/cbuf/get_free.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include <sys/types.h> | |
24 | + | |
25 | +#include "cbuf.h" | |
26 | + | |
27 | +size_t | |
28 | +cbufGetFree(Cbuf this) | |
29 | +{ | |
30 | + return this->bsize - this->bused; | |
31 | +} | |
32 | + | |
33 | +// vim: set ts=4 sw=4: | ... | ... |
src/cbuf/get_line.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include <sys/types.h> | |
24 | + | |
25 | +#include <string.h> | |
26 | + | |
27 | +#include "cbuf.h" | |
28 | + | |
29 | +char * | |
30 | +cbufGetLine(Cbuf this, char ** line_end) | |
31 | +{ | |
32 | + char * nl = cbufMemchr(this, '\n'); | |
33 | + char * ret = NULL; | |
34 | + | |
35 | + if (NULL != nl) { | |
36 | + size_t len = cbufAddrIndex(this, nl) + 1; | |
37 | + | |
38 | + *line_end = nl - 1; | |
39 | + *nl = 0; | |
40 | + *(nl-1) = ('\r' == *(nl-1))? 0 : *(nl-1); | |
41 | + | |
42 | + ret = cbufGetRead(this); | |
43 | + cbufIncRead(this, len); | |
44 | + } | |
45 | + | |
46 | + return ret; | |
47 | +} | |
48 | + | |
49 | +// vim: set ts=4 sw=4: | ... | ... |
src/cbuf/get_read.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include "cbuf.h" | |
24 | + | |
25 | +char * | |
26 | +cbufGetRead(Cbuf this) | |
27 | +{ | |
28 | + return this->data + this->read; | |
29 | +} | |
30 | + | |
31 | +// vim: set ts=4 sw=4: | ... | ... |
src/cbuf/get_write.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include "cbuf.h" | |
24 | + | |
25 | +char * | |
26 | +cbufGetWrite(Cbuf this) | |
27 | +{ | |
28 | + return this->data + this->write; | |
29 | +} | |
30 | + | |
31 | +// vim: set ts=4 sw=4: | ... | ... |
src/cbuf/inc_read.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include <sys/types.h> | |
24 | + | |
25 | +#include "cbuf.h" | |
26 | + | |
27 | +void | |
28 | +cbufIncRead(Cbuf this, size_t n) | |
29 | +{ | |
30 | + this->read += n; | |
31 | + this->read = (this->read >= this->bsize)? | |
32 | + this->read - this->bsize : this->read; | |
33 | + this->bused -= n; | |
34 | +} | |
35 | + | |
36 | +// vim: set ts=4 sw=4: | ... | ... |
src/cbuf/inc_write.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include <sys/types.h> | |
24 | + | |
25 | +#include "cbuf.h" | |
26 | + | |
27 | +void | |
28 | +cbufIncWrite(Cbuf this, size_t n) | |
29 | +{ | |
30 | + this->write += n; | |
31 | + this->write = (this->write >= this->bsize)? | |
32 | + this->write - this->bsize : this->write; | |
33 | + this->bused += n; | |
34 | +} | |
35 | + | |
36 | +// vim: set ts=4 sw=4: | ... | ... |
src/cbuf/is_empty.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include "cbuf.h" | |
24 | + | |
25 | +char | |
26 | +cbufIsEmpty(Cbuf this) | |
27 | +{ | |
28 | + return (0 == this->bused); | |
29 | +} | |
30 | + | |
31 | +// vim: set ts=4 sw=4: | ... | ... |
src/cbuf/is_locked.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include "cbuf.h" | |
24 | + | |
25 | +#include "commons.h" | |
26 | + | |
27 | +Bool | |
28 | +cbufIsLocked(Cbuf this) | |
29 | +{ | |
30 | + return this->lock; | |
31 | +} | |
32 | + | |
33 | +// vim: set ts=4 sw=4: | ... | ... |
src/cbuf/lock.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include "cbuf.h" | |
24 | + | |
25 | +void | |
26 | +cbufLock(Cbuf this) | |
27 | +{ | |
28 | + this->lock = TRUE; | |
29 | +} | |
30 | + | |
31 | +// vim: set ts=4 sw=4: | ... | ... |
src/cbuf/memchr.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include <string.h> | |
24 | + | |
25 | +#include "cbuf.h" | |
26 | + | |
27 | +char * | |
28 | +cbufMemchr(Cbuf this, int c) | |
29 | +{ | |
30 | + return memchr(cbufGetRead(this), c, this->bused); | |
31 | +} | |
32 | + | |
33 | +// vim: set ts=4 sw=4: | ... | ... |
src/cbuf/read.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include <sys/types.h> | |
24 | +#include <unistd.h> | |
25 | +#include <errno.h> | |
26 | + | |
27 | +#include "cbuf.h" | |
28 | +#include "stream.h" | |
29 | + | |
30 | + | |
31 | +ssize_t | |
32 | +cbufRead(Cbuf this, Stream st) | |
33 | +{ | |
34 | + ssize_t rrsize = 0; | |
35 | + size_t rsize = cbufGetFree(this); | |
36 | + | |
37 | + if (0 == rsize) { | |
38 | + errno = ECBUFOVFL; | |
39 | + return -1; | |
40 | + } | |
41 | + | |
42 | + rrsize = streamRead(st, cbufGetWrite(this), rsize); | |
43 | + | |
44 | + switch (rrsize) { | |
45 | + case 0: | |
46 | + rrsize = -2; | |
47 | + // DROP THROUGH | |
48 | + | |
49 | + case -1: | |
50 | + break; | |
51 | + | |
52 | + default: | |
53 | + cbufIncWrite(this, rrsize); | |
54 | + break; | |
55 | + } | |
56 | + | |
57 | + return rrsize; | |
58 | +} | |
59 | + | |
60 | +// vim: set ts=4 sw=4: | ... | ... |
src/cbuf/release.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include "cbuf.h" | |
24 | + | |
25 | +void | |
26 | +cbufRelease(Cbuf this) | |
27 | +{ | |
28 | + this->lock = FALSE; | |
29 | +} | |
30 | + | |
31 | +// vim: set ts=4 sw=4: | ... | ... |
src/cbuf/set_data.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include <sys/types.h> | |
24 | +#include <string.h> | |
25 | +#include <errno.h> | |
26 | + | |
27 | +#include "cbuf.h" | |
28 | + | |
29 | +char * | |
30 | +cbufSetData(Cbuf this, const void * src, size_t n) | |
31 | +{ | |
32 | + char * addr; | |
33 | + | |
34 | + if (n > cbufGetFree(this)) { | |
35 | + errno = ECBUFOVFL; | |
36 | + return (char *)-1; | |
37 | + } | |
38 | + | |
39 | + addr = memcpy(cbufGetWrite(this), src, n); | |
40 | + cbufIncWrite(this, n); | |
41 | + | |
42 | + return addr; | |
43 | +} | |
44 | + | |
45 | +// vim: set ts=4 sw=4: | ... | ... |
src/cbuf/skip_non_alpha.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include <ctype.h> | |
24 | + | |
25 | +#include "cbuf.h" | |
26 | + | |
27 | +void | |
28 | +cbufSkipNonAlpha(Cbuf this) | |
29 | +{ | |
30 | + while(0 > this->bused && isalpha(*cbufGetRead(this))) | |
31 | + cbufIncRead(this, 1); | |
32 | +} | |
33 | + | |
34 | +// vim: set ts=4 sw=4: | ... | ... |
src/cbuf/write.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include <sys/types.h> | |
24 | +#include <unistd.h> | |
25 | + | |
26 | +#include "cbuf.h" | |
27 | +#include "stream.h" | |
28 | + | |
29 | + | |
30 | +ssize_t | |
31 | +cbufWrite(Cbuf this, Stream st) | |
32 | +{ | |
33 | + ssize_t wwsize = 0; | |
34 | + size_t wsize = this->bused; | |
35 | + | |
36 | + if (0 == wsize) return 0; | |
37 | + | |
38 | + wwsize = streamWrite(st, cbufGetRead(this), wsize); | |
39 | + | |
40 | + switch (wwsize) { | |
41 | + case -1: | |
42 | + break; | |
43 | + | |
44 | + default: | |
45 | + cbufIncRead(this, wwsize); | |
46 | + break; | |
47 | + } | |
48 | + | |
49 | + return wwsize; | |
50 | +} | |
51 | + | |
52 | +// vim: set ts=4 sw=4: | ... | ... |
src/http/header.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * Interface implementation for HTTP header class. | |
4 | + * | |
5 | + * \author Georg Hopp | |
6 | + * | |
7 | + * \copyright | |
8 | + * Copyright (C) 2012 Georg Hopp | |
9 | + * | |
10 | + * This program is free software: you can redistribute it and/or modify | |
11 | + * it under the terms of the GNU General Public License as published by | |
12 | + * the Free Software Foundation, either version 3 of the License, or | |
13 | + * (at your option) any later version. | |
14 | + * | |
15 | + * This program is distributed in the hope that it will be useful, | |
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | + * GNU General Public License for more details. | |
19 | + * | |
20 | + * You should have received a copy of the GNU General Public License | |
21 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
22 | + */ | |
23 | + | |
24 | +#include <stdlib.h> | |
25 | +#include <string.h> | |
26 | + | |
27 | +#include "class.h" | |
28 | +#include "interface/class.h" | |
29 | +#include "http/header.h" | |
30 | + | |
31 | +#include "utils/hash.h" | |
32 | +#include "utils/memory.h" | |
33 | + | |
34 | +static | |
35 | +int | |
36 | +httpHeaderCtor(void * _this, va_list * params) { | |
37 | + HttpHeader this = _this; | |
38 | + char * name; | |
39 | + char * value; | |
40 | + | |
41 | + name = va_arg(* params, char *); | |
42 | + this->nname = va_arg(* params, size_t); | |
43 | + value = va_arg(* params, char *); | |
44 | + this->nvalue[0] = va_arg(* params, size_t); | |
45 | + | |
46 | + this->name = malloc(this->nname + 1); | |
47 | + this->name[this->nname] = 0; | |
48 | + memcpy(this->name, name, this->nname); | |
49 | + | |
50 | + this->hash = sdbm((unsigned char *)name, this->nname); | |
51 | + | |
52 | + (this->value)[0] = malloc((this->nvalue)[0] + 1); | |
53 | + (this->value)[0][(this->nvalue)[0]] = 0; | |
54 | + memcpy((this->value)[0], value, (this->nvalue)[0]); | |
55 | + this->cvalue = 1; | |
56 | + this->size = this->nname + 2 + (this->nvalue)[0] + 2; | |
57 | + | |
58 | + return 0; | |
59 | +} | |
60 | + | |
61 | +static | |
62 | +void | |
63 | +httpHeaderDtor(void * _this) | |
64 | +{ | |
65 | + HttpHeader this = _this; | |
66 | + size_t i; | |
67 | + | |
68 | + FREE(this->name); | |
69 | + | |
70 | + for (i=0; i<this->cvalue; i++) { | |
71 | + FREE(this->value[i]); | |
72 | + } | |
73 | +} | |
74 | + | |
75 | +INIT_IFACE(Class, httpHeaderCtor, httpHeaderDtor, NULL); | |
76 | +CREATE_CLASS(HttpHeader, NULL, IFACE(Class)); | |
77 | + | |
78 | +// vim: set ts=4 sw=4: | ... | ... |
src/http/header/add.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include <search.h> | |
24 | +#include <stdio.h> | |
25 | +#include <stdlib.h> | |
26 | +#include <string.h> | |
27 | + | |
28 | +#include "class.h" | |
29 | +#include "interface/class.h" | |
30 | +#include "http/header.h" | |
31 | +#include "utils/hash.h" | |
32 | + | |
33 | +static | |
34 | +inline | |
35 | +int | |
36 | +comp(const void * _a, const void * _b) | |
37 | +{ | |
38 | + HttpHeader a = (HttpHeader)_a; | |
39 | + HttpHeader b = (HttpHeader)_b; | |
40 | + return (a->hash < b->hash)? -1 : (a->hash > b->hash)? 1 : 0; | |
41 | +} | |
42 | + | |
43 | +HttpHeader | |
44 | +httpHeaderAdd(const HttpHeader * root, HttpHeader header) | |
45 | +{ | |
46 | + HttpHeader * _found = tsearch(header, (void **)root, comp); | |
47 | + HttpHeader found; | |
48 | + | |
49 | + if (NULL == _found) { | |
50 | + return NULL; | |
51 | + } | |
52 | + | |
53 | + found = *_found; | |
54 | + | |
55 | + if (found != header) { | |
56 | + if (found->cvalue >= N_VALUES) { | |
57 | + return NULL; | |
58 | + } | |
59 | + (found->nvalue)[found->cvalue] = (header->nvalue)[0]; | |
60 | + (found->value)[(found->cvalue)++] = (header->value)[0]; | |
61 | + found->size += header->size; | |
62 | + (header->value)[0] = NULL; | |
63 | + delete(header); | |
64 | + } | |
65 | + | |
66 | + return found; | |
67 | +} | |
68 | + | |
69 | +// vim: set ts=4 sw=4: | ... | ... |
src/http/header/get.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * Get a header from a tree containing headers by its name. | |
4 | + * The key for the tree is the hased lowercase header identifier. | |
5 | + * | |
6 | + * \author Georg Hopp | |
7 | + * | |
8 | + * \copyright | |
9 | + * Copyright (C) 2012 Georg Hopp | |
10 | + * | |
11 | + * This program is free software: you can redistribute it and/or modify | |
12 | + * it under the terms of the GNU General Public License as published by | |
13 | + * the Free Software Foundation, either version 3 of the License, or | |
14 | + * (at your option) any later version. | |
15 | + * | |
16 | + * This program is distributed in the hope that it will be useful, | |
17 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | + * GNU General Public License for more details. | |
20 | + * | |
21 | + * You should have received a copy of the GNU General Public License | |
22 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
23 | + */ | |
24 | + | |
25 | +#include <search.h> | |
26 | +#include <stdlib.h> | |
27 | + | |
28 | +#include "http/header.h" | |
29 | +#include "utils/hash.h" | |
30 | + | |
31 | +static | |
32 | +inline | |
33 | +int | |
34 | +comp(const void * _a, const void * _b) | |
35 | +{ | |
36 | + const unsigned long * a = _a; | |
37 | + HttpHeader b = (HttpHeader)_b; | |
38 | + return (*a < b->hash)? -1 : (*a > b->hash)? 1 : 0; | |
39 | +} | |
40 | + | |
41 | +HttpHeader | |
42 | +httpHeaderGet(const HttpHeader * root, const char * name, size_t nname) | |
43 | +{ | |
44 | + unsigned long hash = sdbm((const unsigned char*)name, nname); | |
45 | + | |
46 | + HttpHeader * found = tfind(&hash, (void**)root, comp); | |
47 | + | |
48 | + return (NULL != found)? *found : NULL; | |
49 | +} | |
50 | + | |
51 | +// vim: set ts=4 sw=4: | ... | ... |
src/http/header/to_string.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * Convert the given Header to string. | |
4 | + * | |
5 | + * \author Georg Hopp | |
6 | + * | |
7 | + * \copyright | |
8 | + * Copyright (C) 2012 Georg Hopp | |
9 | + * | |
10 | + * This program is free software: you can redistribute it and/or modify | |
11 | + * it under the terms of the GNU General Public License as published by | |
12 | + * the Free Software Foundation, either version 3 of the License, or | |
13 | + * (at your option) any later version. | |
14 | + * | |
15 | + * This program is distributed in the hope that it will be useful, | |
16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | + * GNU General Public License for more details. | |
19 | + * | |
20 | + * You should have received a copy of the GNU General Public License | |
21 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
22 | + */ | |
23 | + | |
24 | +#include <string.h> | |
25 | + | |
26 | +#include "http/header.h" | |
27 | + | |
28 | +size_t | |
29 | +httpHeaderToString(HttpHeader header, char * string) | |
30 | +{ | |
31 | + size_t size = header->size; | |
32 | + int i; | |
33 | + | |
34 | + for (i=0; i<header->cvalue; i++) { | |
35 | + memcpy(string, header->name, header->nname); | |
36 | + string += header->nname; | |
37 | + | |
38 | + *string++ = ':'; | |
39 | + *string++ = ' '; | |
40 | + | |
41 | + memcpy(string, header->value[i], header->nvalue[i]); | |
42 | + string += header->nvalue[i]; | |
43 | + | |
44 | + *string++ = '\r'; | |
45 | + *string++ = '\n'; | |
46 | + } | |
47 | + | |
48 | + return size; | |
49 | +} | |
50 | + | |
51 | +// vim: set ts=4 sw=4: | ... | ... |
src/http/message.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#ifndef _GNU_SOURCE | |
24 | +#define _GNU_SOURCE | |
25 | +#endif | |
26 | + | |
27 | +#include <search.h> | |
28 | +#include <stdlib.h> | |
29 | +#include <string.h> | |
30 | +#include <stdarg.h> | |
31 | +#include <unistd.h> | |
32 | + | |
33 | +#include "class.h" | |
34 | +#include "interface/class.h" | |
35 | + | |
36 | +#include "http/message.h" | |
37 | +#include "utils/memory.h" | |
38 | + | |
39 | + | |
40 | +static | |
41 | +inline | |
42 | +void | |
43 | +tDelete(void * node) | |
44 | +{ | |
45 | + delete(node); | |
46 | +} | |
47 | + | |
48 | +static | |
49 | +int | |
50 | +httpMessageCtor(void * _this, va_list * params) | |
51 | +{ | |
52 | + HttpMessage this = _this; | |
53 | + char * version = va_arg(* params, char *); | |
54 | + | |
55 | + this->version = calloc(1, strlen(version)+1); | |
56 | + strcpy(this->version, version); | |
57 | + | |
58 | + return 0; | |
59 | +} | |
60 | + | |
61 | +static | |
62 | +void | |
63 | +httpMessageDtor(void * _this) | |
64 | +{ | |
65 | + HttpMessage this = _this; | |
66 | + | |
67 | + FREE(this->version); | |
68 | + | |
69 | + /** | |
70 | + * this is a GNU extension...anyway on most non | |
71 | + * GNUish systems i would not use tsearch anyway | |
72 | + * as the trees will be unbalanced. | |
73 | + */ | |
74 | + tdestroy(this->header, tDelete); | |
75 | + | |
76 | + switch (this->type) { | |
77 | + case HTTP_MESSAGE_BUFFERED: | |
78 | + FREE(this->body); | |
79 | + break; | |
80 | + | |
81 | + case HTTP_MESSAGE_PIPED: | |
82 | + if (2 < (this->handle->handle).fd) { | |
83 | + close((this->handle->handle).fd); | |
84 | + } | |
85 | + delete(this->handle); | |
86 | + break; | |
87 | + | |
88 | + default: | |
89 | + break; | |
90 | + } | |
91 | +} | |
92 | + | |
93 | +INIT_IFACE(Class, httpMessageCtor, httpMessageDtor, NULL); | |
94 | +CREATE_CLASS(HttpMessage, NULL, IFACE(Class)); | |
95 | + | |
96 | +// vim: set ts=4 sw=4: | ... | ... |
src/http/message/get_version.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include <string.h> | |
24 | +#include <stdlib.h> | |
25 | + | |
26 | +#include "http/message.h" | |
27 | + | |
28 | +int | |
29 | +httpMessageGetVersion(HttpMessage this, int * major, int * minor) | |
30 | +{ | |
31 | + char * major_ptr = this->version + 5; | |
32 | + char * minor_ptr = strchr(major_ptr, '.') + 1; | |
33 | + char version[] = "\0\0\0"; | |
34 | + | |
35 | + if (NULL == minor_ptr || | |
36 | + ((minor_ptr - major_ptr - 1) > 2) || | |
37 | + strlen(minor_ptr) > 2) | |
38 | + return -1; | |
39 | + | |
40 | + memcpy(version, major_ptr, minor_ptr - major_ptr - 1); | |
41 | + *major = atoi(version); | |
42 | + | |
43 | + memset(version, 0, 3); | |
44 | + strcpy(version, minor_ptr); | |
45 | + *minor = atoi(version); | |
46 | + | |
47 | + return ((*major)<<7)|(*minor); | |
48 | +} | |
49 | + | |
50 | +// vim: set ts=4 sw=4: | ... | ... |
src/http/message/has_keep_alive.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include <string.h> | |
24 | +#include <sys/types.h> | |
25 | +#include <ctype.h> | |
26 | + | |
27 | +#include "http/message.h" | |
28 | +#include "http/request.h" | |
29 | +#include "http/header.h" | |
30 | + | |
31 | +#include "utils/memory.h" | |
32 | + | |
33 | +#include "commons.h" | |
34 | + | |
35 | +char | |
36 | +httpMessageHasKeepAlive(HttpMessage message) | |
37 | +{ | |
38 | + HttpHeader header; | |
39 | + size_t size; | |
40 | + char * value; | |
41 | + | |
42 | + header = httpHeaderGet(&(message->header), CSTRA("connection")); | |
43 | + | |
44 | + if (NULL == header) { | |
45 | + return 0; | |
46 | + } | |
47 | + | |
48 | + size = (header->nvalue)[0]; | |
49 | + value = (header->value)[0]; | |
50 | + | |
51 | + return (0 == strncasecmp("keep-alive", value, size))? 1 : 0; | |
52 | +} | |
53 | + | |
54 | +// vim: set ts=4 sw=4: | ... | ... |
src/http/message/has_valid_version.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include <string.h> | |
24 | + | |
25 | +#include "http/message.h" | |
26 | +#include "utils/http.h" | |
27 | + | |
28 | +int | |
29 | +httpMessageHasValidVersion(HttpMessage this) | |
30 | +{ | |
31 | + int major; | |
32 | + int minor; | |
33 | + | |
34 | + if (! isHttpVersion(this->version, strlen(this->version))) | |
35 | + return 0; | |
36 | + | |
37 | + if (0 > httpMessageGetVersion(this, &major, &minor)) | |
38 | + return 0; | |
39 | + | |
40 | + if (1 != major) | |
41 | + return 0; | |
42 | + | |
43 | + if (0 > minor || 1 < minor) | |
44 | + return 0; | |
45 | + | |
46 | + return 1; | |
47 | +} | |
48 | + | |
49 | +// vim: set ts=4 sw=4: | ... | ... |
src/http/message/header_size_get.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include <search.h> | |
24 | +#include <string.h> | |
25 | +#include <sys/types.h> | |
26 | + | |
27 | +#include "http/message.h" | |
28 | +#include "http/response.h" | |
29 | +#include "http/header.h" | |
30 | +#include "interface/http_intro.h" | |
31 | + | |
32 | +static size_t size; | |
33 | + | |
34 | +static | |
35 | +inline | |
36 | +void | |
37 | +addHeaderSize(const void * node, const VISIT which, const int depth) | |
38 | +{ | |
39 | + if (endorder == which || leaf == which) { | |
40 | + size += (*(HttpHeader *)node)->size; | |
41 | + } | |
42 | +} | |
43 | + | |
44 | +size_t | |
45 | +httpMessageHeaderSizeGet(HttpMessage message) | |
46 | +{ | |
47 | + size = httpIntroSizeGet(message); | |
48 | + | |
49 | + twalk(message->header, addHeaderSize); | |
50 | + size += 2; | |
51 | + | |
52 | + return size; | |
53 | +} | |
54 | + | |
55 | +// vim: set ts=4 sw=4: | ... | ... |
src/http/message/header_to_string.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include <search.h> | |
24 | +#include <string.h> | |
25 | +#include <stdio.h> | |
26 | + | |
27 | +#include "http/response.h" | |
28 | +#include "http/header.h" | |
29 | +#include "interface/http_intro.h" | |
30 | + | |
31 | +static char * string; | |
32 | + | |
33 | +void | |
34 | +addHeaderString(const void * node, const VISIT which, const int depth) | |
35 | +{ | |
36 | + if (endorder == which || leaf == which) { | |
37 | + string += httpHeaderToString(*(HttpHeader *)node, string); | |
38 | + } | |
39 | +} | |
40 | + | |
41 | +char * | |
42 | +httpMessageHeaderToString(HttpMessage response, char * _string) | |
43 | +{ | |
44 | + HttpMessage message = (HttpMessage)response; | |
45 | + | |
46 | + string = httpIntroToString(response, _string); | |
47 | + | |
48 | + twalk(message->header, addHeaderString); | |
49 | + | |
50 | + *string++ = '\r'; | |
51 | + *string++ = '\n'; | |
52 | + | |
53 | + return string; | |
54 | +} | |
55 | + | |
56 | +// vim: set ts=4 sw=4: | ... | ... |
src/http/message/queue.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include <stdarg.h> | |
24 | + | |
25 | +#include "class.h" | |
26 | +#include "interface/class.h" | |
27 | + | |
28 | +#include "http/message/queue.h" | |
29 | + | |
30 | +static | |
31 | +int | |
32 | +messageQueueCtor(void * _this, va_list * params) | |
33 | +{ | |
34 | + return 0; | |
35 | +} | |
36 | + | |
37 | +static | |
38 | +void | |
39 | +messageQueueDtor(void * _this) | |
40 | +{ | |
41 | + HttpMessageQueue this = _this; | |
42 | + int i; | |
43 | + | |
44 | + for (i=0; i<this->nmsgs; i++) { | |
45 | + delete((this->msgs)[i]); | |
46 | + } | |
47 | +} | |
48 | + | |
49 | +INIT_IFACE(Class, messageQueueCtor, messageQueueDtor, NULL); | |
50 | +CREATE_CLASS(HttpMessageQueue, NULL, IFACE(Class)); | |
51 | + | |
52 | +// vim: set ts=4 sw=4: | ... | ... |
src/http/parser.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include <stdlib.h> | |
24 | +#include <sys/types.h> | |
25 | +#include <stdarg.h> | |
26 | + | |
27 | +#include "class.h" | |
28 | +#include "interface/class.h" | |
29 | +#include "interface/stream_reader.h" | |
30 | + | |
31 | +#include "http/parser.h" | |
32 | +#include "http/message/queue.h" | |
33 | +#include "http/request.h" | |
34 | +#include "http/response.h" | |
35 | +#include "cbuf.h" | |
36 | + | |
37 | +#include "utils/memory.h" | |
38 | + | |
39 | + | |
40 | +static | |
41 | +int | |
42 | +httpParserCtor(void * _this, va_list * params) | |
43 | +{ | |
44 | + HttpParser this = _this; | |
45 | + | |
46 | + this->buffer = va_arg(* params, Cbuf); | |
47 | + | |
48 | + if (NULL == this->buffer) { | |
49 | + return -1; | |
50 | + } | |
51 | + | |
52 | + this->queue = new(HttpMessageQueue); | |
53 | + | |
54 | + return 0; | |
55 | +} | |
56 | + | |
57 | +static | |
58 | +void | |
59 | +httpParserDtor(void * _this) | |
60 | +{ | |
61 | + HttpParser this = _this; | |
62 | + | |
63 | + delete(this->queue); | |
64 | + | |
65 | + if (TRUE == this->ourLock) | |
66 | + cbufRelease(this->buffer); | |
67 | + | |
68 | + FREE(this->incomplete); | |
69 | + delete(this->current); | |
70 | +} | |
71 | + | |
72 | +INIT_IFACE(Class, httpParserCtor, httpParserDtor, NULL); | |
73 | +INIT_IFACE(StreamReader, httpParserParse); | |
74 | +CREATE_CLASS(HttpParser, NULL, IFACE(Class), IFACE(StreamReader)); | |
75 | + | |
76 | +// vim: set ts=4 sw=4: | ... | ... |
src/http/parser/body.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include <stdlib.h> | |
24 | +#include <sys/types.h> | |
25 | + | |
26 | +#include "http/header.h" | |
27 | +#include "http/message.h" | |
28 | +#include "http/parser.h" | |
29 | +#include "cbuf.h" | |
30 | + | |
31 | +#define MAX(a,b) (((a) > (b))? (a) : (b)) | |
32 | + | |
33 | +size_t | |
34 | +httpParserBody(HttpParser this, const char * buf, size_t nbuf) | |
35 | +{ | |
36 | + size_t len = 0; | |
37 | + HttpMessage current = this->current; | |
38 | + | |
39 | + if (current->dbody < current->nbody) { | |
40 | + len = MAX(current->nbody - current->dbody, nbuf); | |
41 | + | |
42 | + memcpy(current->body, buf, len); | |
43 | + | |
44 | + current->dbody += len; | |
45 | + } | |
46 | + | |
47 | + return len; | |
48 | +} | |
49 | + | |
50 | +// vim: set ts=4 sw=4: | ... | ... |
src/http/parser/header.c
0 → 100644
1 | +/** | |
2 | + * \file | |
3 | + * | |
4 | + * \author Georg Hopp | |
5 | + * | |
6 | + * \copyright | |
7 | + * Copyright (C) 2012 Georg Hopp | |
8 | + * | |
9 | + * This program is free software: you can redistribute it and/or modify | |
10 | + * it under the terms of the GNU General Public License as published by | |
11 | + * the Free Software Foundation, either version 3 of the License, or | |
12 | + * (at your option) any later version. | |
13 | + * | |
14 | + * This program is distributed in the hope that it will be useful, | |
15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | + * GNU General Public License for more details. | |
18 | + * | |
19 | + * You should have received a copy of the GNU General Public License | |
20 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | + */ | |
22 | + | |
23 | +#include <stdlib.h> | |
24 | +#include <string.h> | |
25 | +#include <sys/types.h> | |
26 | + | |
27 | +#include "class.h" | |
28 | +#include "interface/class.h" | |
29 | +#include "http/header.h" | |
30 | +#include "http/parser.h" | |
31 | +#include "http/message.h" | |
32 | + | |
33 | +void | |
34 | +httpParserHeader( | |
35 | + HttpParser this, | |
36 | + const char * line, | |
37 | + const char * lend) | |
38 | +{ | |
39 | + const char * name = line; | |
40 | + char * value = memchr(line, ':', lend - line); | |
41 | + size_t nname = (value++) - name; | |
42 | + HttpMessage current = this->current; | |
43 | + | |
44 | + if (NULL == value) { | |
45 | + return; | |
46 | + } | |
47 | + | |
48 | + for (; *value == ' ' && value < lend; value++); | |
49 | + | |
50 | + if (value == lend) { | |
51 | + return; | |
52 | + } | |
53 | + | |
54 | + if (0 == strncasecmp("content-length", name, nname-1)) { | |
55 | + current->nbody = strtoul(value, NULL, 10); | |
56 | + if (0 < this->current->nbody) { | |
57 | + current->body = malloc(current->nbody); | |
58 | + } | |
59 | + current->dbody = 0; | |
60 | + } | |
61 | + | |
62 | + httpHeaderAdd( | |
63 | + &(current->header), | |
64 | + new(HttpHeader, name, nname, value, lend - value)); | |
65 | +} | |
66 | + | |
67 | +// vim: set ts=4 sw=4: | ... | ... |
src/http/parser/new_message.c
0 → 100644
1 | +#include "http/parser.h" | |
2 | + | |
3 | +#include "utils/http.h" | |
4 | + | |
5 | +void | |
6 | +httpParserNewMessage( | |
7 | + HttpParser this, | |
8 | + const char * line, | |
9 | + const char * lend) | |
10 | +{ | |
11 | + const char * part1, * part2, * part3; | |
12 | + size_t len1, len2, len3; | |
13 | + | |
14 | + part1 = line; | |
15 | + part2 = memchr(line, ' ', lend - line); | |
16 | + | |
17 | + if (NULL == part2) return; | |
18 | + | |
19 | + len1 = part2 - part1; | |
20 | + for (; *part2 == ' ' && *part2 != 0; part2++); | |
21 | + | |
22 | + part3 = memchr(part2, ' ', lend - part2); | |
23 | + | |
24 | + if (NULL == part3) return; | |
25 | + | |
26 | + len2 = part3 - part2; | |
27 | + for (; *part3 == ' ' && *part3 != 0; part3++); | |
28 | + | |
29 | + len3 = lend - part3; | |
30 | + | |
31 | + this->current = httpGetMessage(part1, len1, part2, len2, part3, len3); | |
32 | +} | |
33 | + | |
34 | +// vim: set ts=4 sw=4: | ... | ... |
Please
register
or
login
to post a comment