Merge lp:~eday/scalestack/style-updates into lp:~registry/scalestack/old-trunk
- style-updates
- Merge into old-trunk
Proposed by
Eric Day
Status: | Merged |
---|---|
Merged at revision: | 57 |
Proposed branch: | lp:~eday/scalestack/style-updates |
Merge into: | lp:~registry/scalestack/old-trunk |
Diff against target: |
17851 lines (+5120/-4760) 174 files modified
.bzrignore (+5/-5) Makefile.am (+27/-27) README (+22/-25) bin/scalestack.cc (+7/-7) config/pandora-plugin.ini (+2/-2) configure.ac (+4/-4) docs/doxyfile (+1/-1) scalestack/common/delete_pointer.h (+12/-9) scalestack/common/exception.cc (+11/-9) scalestack/common/exception.h (+9/-7) scalestack/common/macros.h.in (+2/-0) scalestack/common/notification.cc (+37/-18) scalestack/common/notification.h (+19/-10) scalestack/common/test.h (+7/-7) scalestack/database_proxy/client.cc (+43/-41) scalestack/database_proxy/client.h (+25/-23) scalestack/database_proxy/client_service.cc (+38/-36) scalestack/database_proxy/client_service.h (+36/-34) scalestack/database_proxy/connection.cc (+33/-31) scalestack/database_proxy/connection.h (+23/-21) scalestack/database_proxy/database_proxy.cc (+15/-15) scalestack/database_proxy/plugin.ini (+3/-3) scalestack/database_proxy/service.cc (+38/-36) scalestack/database_proxy/service.h (+35/-33) scalestack/echo/flood/datagram.cc (+38/-35) scalestack/echo/flood/datagram.h (+32/-28) scalestack/echo/flood/flood.cc (+10/-10) scalestack/echo/flood/flood.h (+9/-6) scalestack/echo/flood/local_stream/local_stream.cc (+20/-20) scalestack/echo/flood/local_stream/plugin.ini (+5/-5) scalestack/echo/flood/local_stream/service.cc (+21/-17) scalestack/echo/flood/local_stream/service.h (+36/-32) scalestack/echo/flood/plugin.ini (+3/-3) scalestack/echo/flood/stream.cc (+37/-34) scalestack/echo/flood/stream.h (+32/-28) scalestack/echo/flood/tcp/plugin.ini (+3/-3) scalestack/echo/flood/tcp/service.cc (+27/-23) scalestack/echo/flood/tcp/service.h (+31/-27) scalestack/echo/flood/tcp/tcp.cc (+21/-21) scalestack/echo/flood/udp/plugin.ini (+3/-3) scalestack/echo/flood/udp/service.cc (+27/-23) scalestack/echo/flood/udp/service.h (+31/-27) scalestack/echo/flood/udp/udp.cc (+19/-19) scalestack/echo/server/datagram.cc (+16/-13) scalestack/echo/server/datagram.h (+22/-19) scalestack/echo/server/local_stream/local_stream.cc (+12/-12) scalestack/echo/server/local_stream/plugin.ini (+6/-6) scalestack/echo/server/local_stream/service.cc (+22/-18) scalestack/echo/server/local_stream/service.h (+38/-34) scalestack/echo/server/local_stream/test/run.cc (+18/-17) scalestack/echo/server/plugin.ini (+3/-3) scalestack/echo/server/server.cc (+1/-1) scalestack/echo/server/stream.cc (+16/-13) scalestack/echo/server/stream.h (+22/-19) scalestack/echo/server/tcp/plugin.ini (+4/-4) scalestack/echo/server/tcp/service.cc (+21/-17) scalestack/echo/server/tcp/service.h (+33/-29) scalestack/echo/server/tcp/tcp.cc (+14/-14) scalestack/echo/server/tcp/test/run.cc (+16/-16) scalestack/echo/server/udp/plugin.ini (+4/-4) scalestack/echo/server/udp/service.cc (+20/-16) scalestack/echo/server/udp/service.h (+31/-27) scalestack/echo/server/udp/test/run.cc (+15/-15) scalestack/echo/server/udp/udp.cc (+14/-14) scalestack/event/event.cc (+1/-1) scalestack/event/handler.h (+160/-158) scalestack/event/libevent/handler_provider.cc (+59/-56) scalestack/event/libevent/handler_provider.h (+72/-68) scalestack/event/libevent/libevent.cc (+12/-12) scalestack/event/libevent/plugin.ini (+3/-3) scalestack/event/libevent/service_provider.cc (+38/-35) scalestack/event/libevent/service_provider.h (+30/-27) scalestack/event/libevent/thread.cc (+90/-87) scalestack/event/libevent/thread.h (+56/-52) scalestack/event/plugin.ini (+2/-2) scalestack/event/service.cc (+27/-24) scalestack/event/service.h (+30/-28) scalestack/event/service_provider.h (+48/-46) scalestack/event/test/handler.cc (+41/-38) scalestack/event/test/handler.h (+23/-20) scalestack/event/test/handler_provider.cc (+45/-42) scalestack/event/test/handler_provider.h (+34/-31) scalestack/event/test/plugin.ini (+4/-4) scalestack/event/test/run.cc (+4/-4) scalestack/event/test/service.cc (+16/-13) scalestack/event/test/service.h (+20/-17) scalestack/event/test/service_provider.cc (+39/-36) scalestack/event/test/service_provider.h (+29/-26) scalestack/event/test/test.cc (+33/-33) scalestack/kernel/core.cc (+204/-190) scalestack/kernel/core.h (+70/-64) scalestack/kernel/log.h (+30/-26) scalestack/kernel/log_console.cc (+13/-9) scalestack/kernel/log_console.h (+19/-17) scalestack/kernel/log_message.h (+60/-57) scalestack/kernel/module.cc (+163/-158) scalestack/kernel/module.h (+105/-102) scalestack/kernel/option.cc (+30/-28) scalestack/kernel/option.h (+36/-34) scalestack/kernel/service.h (+27/-25) scalestack/kernel/test/core.cc (+174/-174) scalestack/kernel/test/module.cc (+170/-170) scalestack/kernel/test/module_child/module_child.cc (+24/-24) scalestack/kernel/test/module_child/plugin.ini (+6/-6) scalestack/kernel/test/module_grand_parent/module_grand_parent.cc (+38/-38) scalestack/kernel/test/module_grand_parent/plugin.ini (+5/-5) scalestack/kernel/test/module_loop/module_loop.cc (+2/-2) scalestack/kernel/test/module_loop/plugin.ini (+6/-6) scalestack/kernel/test/module_open_error/module_open_error.cc (+2/-2) scalestack/kernel/test/module_open_error/plugin.ini (+6/-6) scalestack/kernel/test/module_parent/module_parent.cc (+19/-19) scalestack/kernel/test/module_parent/plugin.ini (+6/-6) scalestack/kernel/test/module_sym_error/module_sym_error.cc (+1/-1) scalestack/kernel/test/module_sym_error/plugin.ini (+5/-5) scalestack/kernel/test/option.cc (+58/-58) scalestack/kernel/test/option_bad/option_bad.cc (+9/-9) scalestack/kernel/test/option_bad/plugin.ini (+5/-5) scalestack/kernel/test/option_basic/option_basic.cc (+32/-32) scalestack/kernel/test/option_basic/plugin.ini (+5/-5) scalestack/network/datagram.cc (+71/-66) scalestack/network/datagram.h (+130/-127) scalestack/network/datagram_service.h (+35/-33) scalestack/network/ip/common.cc (+26/-23) scalestack/network/ip/common.h (+34/-29) scalestack/network/ip/ip.cc (+1/-1) scalestack/network/ip/plugin.ini (+3/-3) scalestack/network/ip/tcp/connection.cc (+25/-21) scalestack/network/ip/tcp/connection.h (+34/-29) scalestack/network/ip/tcp/connection_service.cc (+58/-57) scalestack/network/ip/tcp/connection_service.h (+35/-31) scalestack/network/ip/tcp/listener.cc (+32/-28) scalestack/network/ip/tcp/listener.h (+25/-21) scalestack/network/ip/tcp/listener_service.cc (+42/-38) scalestack/network/ip/tcp/listener_service.h (+34/-30) scalestack/network/ip/tcp/plugin.ini (+4/-4) scalestack/network/ip/tcp/tcp.cc (+1/-1) scalestack/network/ip/udp/plugin.ini (+3/-3) scalestack/network/ip/udp/socket.cc (+25/-21) scalestack/network/ip/udp/socket.h (+27/-23) scalestack/network/ip/udp/socket_service.cc (+92/-87) scalestack/network/ip/udp/socket_service.h (+40/-36) scalestack/network/ip/udp/udp.cc (+1/-1) scalestack/network/listener.cc (+35/-32) scalestack/network/listener.h (+21/-19) scalestack/network/local/common.cc (+21/-18) scalestack/network/local/common.h (+22/-19) scalestack/network/local/local.cc (+2/-2) scalestack/network/local/plugin.ini (+5/-5) scalestack/network/local/stream/connection.cc (+31/-27) scalestack/network/local/stream/connection.h (+38/-33) scalestack/network/local/stream/connection_service.cc (+52/-48) scalestack/network/local/stream/connection_service.h (+36/-32) scalestack/network/local/stream/listener.cc (+35/-31) scalestack/network/local/stream/listener.h (+35/-31) scalestack/network/local/stream/listener_service.cc (+39/-35) scalestack/network/local/stream/listener_service.h (+35/-31) scalestack/network/local/stream/plugin.ini (+5/-5) scalestack/network/local/stream/stream.cc (+2/-2) scalestack/network/network.cc (+1/-1) scalestack/network/plugin.ini (+4/-4) scalestack/network/stream.cc (+56/-54) scalestack/network/stream.h (+148/-145) scalestack/network/stream_service.h (+36/-34) scalestack/proxy/client.cc (+34/-32) scalestack/proxy/client.h (+24/-22) scalestack/proxy/client_service.cc (+22/-20) scalestack/proxy/client_service.h (+33/-31) scalestack/proxy/connection.cc (+28/-26) scalestack/proxy/connection.h (+25/-23) scalestack/proxy/plugin.ini (+3/-3) scalestack/proxy/proxy.cc (+13/-13) scalestack/proxy/service.cc (+14/-12) scalestack/proxy/service.h (+32/-30) test_run.sh (+2/-2) |
To merge this branch: | bzr merge lp:~eday/scalestack/style-updates |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Registry Administrators | Pending | ||
Review via email: mp+26664@code.launchpad.net |
Commit message
Description of the change
No functionality changes, just renaming. Not perfect yet, but wanted to get the bulk done in one pass then we can go back and touch up each module in smaller patches while doing another review. Need to develop some practices on variable naming so types != variable names, not really happy with the conventions used so far.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2010-04-29 07:39:49 +0000 |
3 | +++ .bzrignore 2010-06-03 05:01:22 +0000 |
4 | @@ -35,8 +35,8 @@ |
5 | m4/ltversion.m4 |
6 | m4/lt~obsolete.m4 |
7 | bin/scalestack |
8 | -ScaleStack/Common/Macros.h |
9 | -ScaleStack/Kernel/Test/Core |
10 | -ScaleStack/Kernel/Test/Module |
11 | -ScaleStack/Kernel/Test/Option |
12 | -ScaleStack/**/Test/Run |
13 | +scalestack/common/macros.h |
14 | +scalestack/kernel/test/core |
15 | +scalestack/kernel/test/module |
16 | +scalestack/kernel/test/option |
17 | +scalestack/**/test/run |
18 | |
19 | === modified file 'Makefile.am' |
20 | --- Makefile.am 2010-04-30 03:54:30 +0000 |
21 | +++ Makefile.am 2010-06-03 05:01:22 +0000 |
22 | @@ -22,7 +22,7 @@ |
23 | pkgplugin_LTLIBRARIES = |
24 | CLEANFILES = |
25 | EXTRA_DIST = \ |
26 | - docs/Doxyfile \ |
27 | + docs/doxyfile \ |
28 | docs/header.html.in \ |
29 | test_run.sh |
30 | |
31 | @@ -33,30 +33,30 @@ |
32 | lib_LTLIBRARIES += libscalestack.la |
33 | |
34 | libscalestack_la_SOURCES = \ |
35 | - ScaleStack/Common/Exception.cc \ |
36 | - ScaleStack/Common/Notification.cc \ |
37 | - ScaleStack/Kernel/Core.cc \ |
38 | - ScaleStack/Kernel/LogConsole.cc \ |
39 | - ScaleStack/Kernel/Module.cc \ |
40 | - ScaleStack/Kernel/Option.cc |
41 | + scalestack/common/exception.cc \ |
42 | + scalestack/common/notification.cc \ |
43 | + scalestack/kernel/core.cc \ |
44 | + scalestack/kernel/log_console.cc \ |
45 | + scalestack/kernel/module.cc \ |
46 | + scalestack/kernel/option.cc |
47 | |
48 | nobase_include_HEADERS += \ |
49 | - ScaleStack/Common/DeletePointer.h \ |
50 | - ScaleStack/Common/Exception.h \ |
51 | - ScaleStack/Common/Notification.h \ |
52 | - ScaleStack/Kernel/Core.h \ |
53 | - ScaleStack/Kernel/Log.h \ |
54 | - ScaleStack/Kernel/LogConsole.h \ |
55 | - ScaleStack/Kernel/LogMessage.h \ |
56 | - ScaleStack/Kernel/Module.h \ |
57 | - ScaleStack/Kernel/Option.h \ |
58 | - ScaleStack/Kernel/Service.h |
59 | + scalestack/common/delete_pointer.h \ |
60 | + scalestack/common/exception.h \ |
61 | + scalestack/common/notification.h \ |
62 | + scalestack/kernel/core.h \ |
63 | + scalestack/kernel/log.h \ |
64 | + scalestack/kernel/log_console.h \ |
65 | + scalestack/kernel/log_message.h \ |
66 | + scalestack/kernel/module.h \ |
67 | + scalestack/kernel/option.h \ |
68 | + scalestack/kernel/service.h |
69 | |
70 | noinst_HEADERS += \ |
71 | - ScaleStack/Common/Test.h |
72 | + scalestack/common/test.h |
73 | |
74 | -nobase_nodist_include_HEADERS = ScaleStack/Common/Macros.h |
75 | -EXTRA_DIST += ScaleStack/Common/Macros.h.in |
76 | +nobase_nodist_include_HEADERS = scalestack/common/macros.h |
77 | +EXTRA_DIST += scalestack/common/macros.h.in |
78 | |
79 | libscalestack_la_CXXFLAGS = \ |
80 | $(AM_CXXFLAGS) \ |
81 | @@ -68,9 +68,9 @@ |
82 | libscalestack_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBSCALESTACK_VERSION) |
83 | |
84 | check_PROGRAMS += \ |
85 | - ScaleStack/Kernel/Test/Core \ |
86 | - ScaleStack/Kernel/Test/Module \ |
87 | - ScaleStack/Kernel/Test/Option |
88 | + scalestack/kernel/test/core \ |
89 | + scalestack/kernel/test/module \ |
90 | + scalestack/kernel/test/option |
91 | |
92 | # |
93 | # Simple scalestack application |
94 | @@ -116,7 +116,7 @@ |
95 | @cat ${top_srcdir}/README >> docs/mainpage.h |
96 | @echo "</pre>" >> docs/mainpage.h |
97 | @echo "*/" >> docs/mainpage.h |
98 | - ${DOXYGEN} ${top_srcdir}/docs/Doxyfile |
99 | + ${DOXYGEN} ${top_srcdir}/docs/doxyfile |
100 | @rm docs/mainpage.h |
101 | |
102 | lcov: lcov-clean check |
103 | @@ -125,9 +125,9 @@ |
104 | @echo "Make sure ./configure was run with '--enable-coverage'" |
105 | @echo "------------------------------------------------------" |
106 | @echo |
107 | - cd ScaleStack && lcov --directory . --base-directory .. --capture --output-file lcov.out |
108 | - cd ScaleStack && lcov --directory . --base-directory .. --extract lcov.out `pwd`/\* --output-file lcov_extract.out |
109 | - genhtml -o lcov -t ScaleStack ScaleStack/lcov_extract.out |
110 | + cd scalestack && lcov --directory . --base-directory .. --capture --output-file lcov.out |
111 | + cd scalestack && lcov --directory . --base-directory .. --extract lcov.out `pwd`/\* --output-file lcov_extract.out |
112 | + genhtml -o lcov -t scalestack scalestack/lcov_extract.out |
113 | |
114 | lcov-clean: clean |
115 | find . -name '*.gcno' -exec rm {} \; |
116 | |
117 | === modified file 'README' |
118 | --- README 2010-04-30 03:54:30 +0000 |
119 | +++ README 2010-06-03 05:01:22 +0000 |
120 | @@ -75,7 +75,7 @@ |
121 | any new files). Once you think you have something ready to share, push |
122 | your branch back up to Launchpad (which requires a Launchpad account). |
123 | |
124 | -bzr add NewModule |
125 | +bzr add new_module |
126 | bzr commit -m "Comment describing my changes" |
127 | bzr push lp:~johndoe/scalestack/my-changes |
128 | |
129 | @@ -85,12 +85,12 @@ |
130 | |
131 | https://code.launchpad.net/scalestack |
132 | |
133 | -If you would like to add new modules, please do so in the ScaleStack |
134 | +If you would like to add new modules, please do so in the scalestack |
135 | directory. The C++ namespace is directly translated to path names |
136 | there, so you'll find all code in that directory. Look around at the |
137 | other modules for examples on how to do so, but the minimum needed |
138 | -is a plugin.ini and ModuleName.cc file. Reading the documentation in |
139 | -ScaleStack/Kernel/Module.h may be helpful as well. |
140 | +is a plugin.ini and <module name>.cc file. Reading the documentation |
141 | +in scalestack/kernel/module.h may be helpful as well. |
142 | |
143 | |
144 | Coding Style Guidelines |
145 | @@ -107,35 +107,32 @@ |
146 | * Comments should follow Doxygen style formatting. See existing code |
147 | for examples. |
148 | |
149 | -* Opening curly braces should appear on their own line. The one |
150 | - exception to this is when defining namespaces, then it must appear |
151 | - on the same line. |
152 | +* Opening curly braces should appear on their own line. |
153 | |
154 | * C++ exceptions are allowed if they derive from std::exception. Most |
155 | - exception throwing is hidden behind logFatal messages, which throw |
156 | - ScaleStack::Common::Exception and contains custom messages. Use of |
157 | - this through module.logFatal() in modules is preferred. |
158 | - |
159 | -* Public method names should be camelCase starting with lower. |
160 | - |
161 | -* Private method names should be _camelCase starting with underscore |
162 | - and lower. |
163 | - |
164 | -* Data members should always be private, start with an underscore, |
165 | - and are all lowercase with underscores, such as _log_level. The |
166 | - leading underscores help to easily differentiate the class members |
167 | - from local method variables. Some data members may under the |
168 | - protected section so derived classes can also access them. |
169 | - |
170 | -* Header files should be ordered by system and then ScaleStack headers, |
171 | - with a empty line in between. Each set should be ordered |
172 | + exception throwing is hidden behind log_fatal messages, which throw |
173 | + scalestack::common::exception and contains custom messages. Use of |
174 | + this through module.log_fatal() in modules is preferred. |
175 | + |
176 | +* All namespaces, classes, methods, and data members must be all |
177 | + lowercase and use '_' to separate words (like the C++ STL). |
178 | + |
179 | +* Private method names should start with an underscore. |
180 | + |
181 | +* Data members should always be private and start with an underscore. |
182 | + The leading underscores help to easily differentiate the class |
183 | + members from local method variables. Some data members may be under |
184 | + the protected section so derived classes can also access them. |
185 | + |
186 | +* Header files should be ordered by system and then Scale Stack |
187 | + headers, with a empty line in between. Each set should be ordered |
188 | alphabetically as well. The "config.h" include must be the first |
189 | include for every non-header file, and should NEVER appear in any |
190 | header files. |
191 | |
192 | * You should only use 'using namespace ...;' in source files, never in |
193 | header files. In source files, only specify 'using namespace std;' |
194 | - and 'using namespace ScaleStack;'. Beyond that, please write out |
195 | + and 'using namespace scalestack;'. Beyond that, please write out |
196 | the full namespace for objects. |
197 | |
198 | * In general, do the most consistent thing given the existing code |
199 | |
200 | === modified file 'bin/scalestack.cc' |
201 | --- bin/scalestack.cc 2010-04-30 03:54:30 +0000 |
202 | +++ bin/scalestack.cc 2010-06-03 05:01:22 +0000 |
203 | @@ -10,27 +10,27 @@ |
204 | |
205 | /** |
206 | * @file |
207 | - * @brief Basic application to run generic Scale Stack instance. |
208 | + * @brief Basic application to run a generic Scale Stack instance. |
209 | */ |
210 | |
211 | #include <exception> |
212 | #include <iostream> |
213 | |
214 | -#include <ScaleStack/Kernel/Core.h> |
215 | +#include <scalestack/kernel/core.h> |
216 | |
217 | int main(int argc, const char* argv[]) |
218 | { |
219 | - ScaleStack::Kernel::Core core; |
220 | + scalestack::kernel::core core; |
221 | |
222 | try |
223 | { |
224 | - /* We use libevent as the default Event service. */ |
225 | - core.addModuleOptionValue("Event::Service", "", "Event::Libevent"); |
226 | + /* We use libevent as the default event service. */ |
227 | + core.add_module_option_value("event::service", "", "event::libevent"); |
228 | |
229 | /* The first argv entry is the execution filename, so skip it. */ |
230 | - core.parseArguments(argc - 1, argv + 1); |
231 | + core.parse_arguments(argc - 1, argv + 1); |
232 | |
233 | - core.setSignalHandlers(); |
234 | + core.set_signal_handlers(); |
235 | core.run(); |
236 | } |
237 | catch (std::exception& e) |
238 | |
239 | === modified file 'config/pandora-plugin.ini' |
240 | --- config/pandora-plugin.ini 2010-05-01 01:14:47 +0000 |
241 | +++ config/pandora-plugin.ini 2010-06-03 05:01:22 +0000 |
242 | @@ -1,6 +1,6 @@ |
243 | [pandora-plugin] |
244 | -root_plugin_dir=ScaleStack |
245 | -pkgplugindir=$(libdir)/ScaleStack |
246 | +root_plugin_dir=scalestack |
247 | +pkgplugindir=$(libdir)/scalestack |
248 | plugin_suffix=_module |
249 | extra_cxxflags=-DBUILDING_SCALESTACK |
250 | default_load_by_default=True |
251 | |
252 | === modified file 'configure.ac' |
253 | --- configure.ac 2010-04-27 00:25:30 +0000 |
254 | +++ configure.ac 2010-06-03 05:01:22 +0000 |
255 | @@ -8,9 +8,9 @@ |
256 | # the COPYING file in this directory for full text. |
257 | # |
258 | |
259 | -AC_INIT([ScaleStack],[0.1],[https://bugs.launchpad.net/scalestack], |
260 | - [ScaleStack], [http://scalestack.org/]) |
261 | -AC_CONFIG_SRCDIR([ScaleStack/Kernel/Core.h]) |
262 | +AC_INIT([scalestack],[0.1],[https://bugs.launchpad.net/scalestack], |
263 | + [scalestack], [http://scalestack.org/]) |
264 | +AC_CONFIG_SRCDIR([scalestack/kernel/core.h]) |
265 | AC_CONFIG_AUX_DIR(config) |
266 | AC_CONFIG_MACRO_DIR([m4]) |
267 | |
268 | @@ -54,7 +54,7 @@ |
269 | AC_DEFINE_UNQUOTED([SCALESTACK_MODULE_EXT], ["$acl_cv_shlibext"], |
270 | [Extension to use for modules.]) |
271 | |
272 | -AC_CONFIG_FILES(Makefile ScaleStack/Common/Macros.h docs/header.html) |
273 | +AC_CONFIG_FILES(Makefile scalestack/common/macros.h docs/header.html) |
274 | |
275 | AC_OUTPUT |
276 | |
277 | |
278 | === renamed file 'docs/Doxyfile' => 'docs/doxyfile' |
279 | --- docs/Doxyfile 2010-03-13 07:57:16 +0000 |
280 | +++ docs/doxyfile 2010-06-03 05:01:22 +0000 |
281 | @@ -568,7 +568,7 @@ |
282 | # directories like "/usr/src/myproject". Separate the files or directories |
283 | # with spaces. |
284 | |
285 | -INPUT = docs ScaleStack |
286 | +INPUT = docs scalestack |
287 | |
288 | # This tag can be used to specify the character encoding of the source files |
289 | # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is |
290 | |
291 | === renamed directory 'ScaleStack' => 'scalestack' |
292 | === renamed directory 'ScaleStack/Common' => 'scalestack/common' |
293 | === renamed file 'ScaleStack/Common/DeletePointer.h' => 'scalestack/common/delete_pointer.h' |
294 | --- ScaleStack/Common/DeletePointer.h 2010-04-30 03:54:30 +0000 |
295 | +++ scalestack/common/delete_pointer.h 2010-06-03 05:01:22 +0000 |
296 | @@ -10,22 +10,25 @@ |
297 | |
298 | /** |
299 | * @file |
300 | - * @brief DeletePointer Function Object Declaration |
301 | + * @brief Delete Pointer Function Object Declaration |
302 | */ |
303 | |
304 | -#ifndef SCALESTACK_COMMON_DELETEPOINTER_H |
305 | -#define SCALESTACK_COMMON_DELETEPOINTER_H |
306 | +#ifndef SCALESTACK_COMMON_DELETE_POINTER_H |
307 | +#define SCALESTACK_COMMON_DELETE_POINTER_H |
308 | |
309 | -namespace ScaleStack { |
310 | -namespace Common { |
311 | +namespace scalestack |
312 | +{ |
313 | +namespace common |
314 | +{ |
315 | |
316 | /** |
317 | * Function object to use with containers of pointers when the objects should |
318 | * be deleted. |
319 | */ |
320 | -class DeletePointer |
321 | +class delete_pointer |
322 | { |
323 | public: |
324 | + |
325 | template<typename T> |
326 | void operator()(const T* pointer) const |
327 | { |
328 | @@ -33,7 +36,7 @@ |
329 | } |
330 | }; |
331 | |
332 | -} /* namespace Common */ |
333 | -} /* namespace ScaleStack */ |
334 | +} /* namespace common */ |
335 | +} /* namespace scalestack */ |
336 | |
337 | -#endif /* SCALESTACK_COMMON_DELETEPOINTER_H */ |
338 | +#endif /* SCALESTACK_COMMON_DELETE_POINTER_H */ |
339 | |
340 | === renamed file 'ScaleStack/Common/Exception.cc' => 'scalestack/common/exception.cc' |
341 | --- ScaleStack/Common/Exception.cc 2010-04-30 03:54:30 +0000 |
342 | +++ scalestack/common/exception.cc 2010-06-03 05:01:22 +0000 |
343 | @@ -17,20 +17,22 @@ |
344 | |
345 | #include <cstdio> |
346 | |
347 | -#include <ScaleStack/Common/Exception.h> |
348 | - |
349 | -namespace ScaleStack { |
350 | -namespace Common { |
351 | - |
352 | -Exception::Exception(const char* context, const char* message) throw() |
353 | +#include <scalestack/common/exception.h> |
354 | + |
355 | +namespace scalestack |
356 | +{ |
357 | +namespace common |
358 | +{ |
359 | + |
360 | +exception::exception(const char* context, const char* message) throw() |
361 | { |
362 | snprintf(_message, SCALESTACK_MAX_MESSAGE_SIZE, "[%s] %s", context, message); |
363 | } |
364 | |
365 | -const char* Exception::what() const throw() |
366 | +const char* exception::what() const throw() |
367 | { |
368 | return _message; |
369 | } |
370 | |
371 | -} /* namespace Common */ |
372 | -} /* namespace ScaleStack */ |
373 | +} /* namespace common */ |
374 | +} /* namespace scalestack */ |
375 | |
376 | === renamed file 'ScaleStack/Common/Exception.h' => 'scalestack/common/exception.h' |
377 | --- ScaleStack/Common/Exception.h 2010-04-30 03:54:30 +0000 |
378 | +++ scalestack/common/exception.h 2010-06-03 05:01:22 +0000 |
379 | @@ -18,15 +18,17 @@ |
380 | |
381 | #include <exception> |
382 | |
383 | -#include <ScaleStack/Common/Macros.h> |
384 | +#include <scalestack/common/macros.h> |
385 | |
386 | -namespace ScaleStack { |
387 | -namespace Common { |
388 | +namespace scalestack |
389 | +{ |
390 | +namespace common |
391 | +{ |
392 | |
393 | /** |
394 | * This class allows exceptions to be thrown with custom error mesages. |
395 | */ |
396 | -class SCALESTACK_API Exception: public std::exception |
397 | +class SCALESTACK_API exception: public std::exception |
398 | { |
399 | public: |
400 | |
401 | @@ -36,7 +38,7 @@ |
402 | * @param[in] context Context where the exception occurred. |
403 | * @param[in] message Message describing the exception. |
404 | */ |
405 | - Exception(const char* context, const char* message) throw(); |
406 | + exception(const char* context, const char* message) throw(); |
407 | |
408 | /** |
409 | * Return the formatted buffer. |
410 | @@ -49,7 +51,7 @@ |
411 | char _message[SCALESTACK_MAX_MESSAGE_SIZE]; |
412 | }; |
413 | |
414 | -} /* namespace Common */ |
415 | -} /* namespace ScaleStack */ |
416 | +} /* namespace common */ |
417 | +} /* namespace scalestack */ |
418 | |
419 | #endif /* SCALESTACK_COMMON_EXCEPTION_H */ |
420 | |
421 | === renamed file 'ScaleStack/Common/Macros.h.in' => 'scalestack/common/macros.h.in' |
422 | --- ScaleStack/Common/Macros.h.in 2010-03-29 07:57:59 +0000 |
423 | +++ scalestack/common/macros.h.in 2010-06-03 05:01:22 +0000 |
424 | @@ -70,4 +70,6 @@ |
425 | */ |
426 | #define SCALESTACK_MAX_MESSAGE_SIZE 1024 |
427 | |
428 | +#define _(string) string |
429 | + |
430 | #endif /* SCALESTACK_COMMON_MACROS_H */ |
431 | |
432 | === renamed file 'ScaleStack/Common/Notification.cc' => 'scalestack/common/notification.cc' |
433 | --- ScaleStack/Common/Notification.cc 2010-04-30 03:54:30 +0000 |
434 | +++ scalestack/common/notification.cc 2010-06-03 05:01:22 +0000 |
435 | @@ -16,40 +16,59 @@ |
436 | #include "config.h" |
437 | |
438 | #include <cerrno> |
439 | - |
440 | +#include <cstdio> |
441 | +#include <cstring> |
442 | #include <unistd.h> |
443 | |
444 | -#include <ScaleStack/Common/Exception.h> |
445 | -#include <ScaleStack/Common/Notification.h> |
446 | - |
447 | -namespace ScaleStack { |
448 | -namespace Common { |
449 | - |
450 | -Notification::Notification(void) |
451 | +#include <scalestack/common/exception.h> |
452 | +#include <scalestack/common/notification.h> |
453 | + |
454 | +namespace scalestack |
455 | +{ |
456 | +namespace common |
457 | +{ |
458 | + |
459 | +/* |
460 | + * Public methods. |
461 | + */ |
462 | + |
463 | +notification::notification(void) |
464 | { |
465 | if (pipe(_pipe) == -1) |
466 | - throw Exception("Notification", "Could not create pipe"); |
467 | + _throw_exception(_("Could not create notification pipe")); |
468 | } |
469 | |
470 | -Notification::~Notification() |
471 | +notification::~notification() |
472 | { |
473 | close(_pipe[0]); |
474 | close(_pipe[1]); |
475 | } |
476 | |
477 | -void Notification::send(void) |
478 | +void notification::send(void) |
479 | { |
480 | if (write(_pipe[1], "\0", 1) == -1 && errno != EINTR) |
481 | - throw Exception("Notification", "Could not write to pipe"); |
482 | + _throw_exception(_("Could not write to notification pipe")); |
483 | } |
484 | |
485 | -void Notification::wait(void) |
486 | +void notification::wait(void) |
487 | { |
488 | char buffer[1024]; |
489 | |
490 | if (read(_pipe[0], buffer, sizeof(buffer)) == -1 && errno != EINTR) |
491 | - throw Exception("Notification", "Could not read from pipe"); |
492 | -} |
493 | - |
494 | -} /* namespace Common */ |
495 | -} /* namespace ScaleStack */ |
496 | + _throw_exception(_("Could not read from notification pipe")); |
497 | +} |
498 | + |
499 | +/* |
500 | + * Private methods. |
501 | + */ |
502 | + |
503 | +void notification::_throw_exception(const char* prefix) |
504 | +{ |
505 | + char message[SCALESTACK_MAX_MESSAGE_SIZE]; |
506 | + snprintf(message, SCALESTACK_MAX_MESSAGE_SIZE, |
507 | + "%s: %s", prefix, strerror(errno)); |
508 | + throw exception("notification", message); |
509 | +} |
510 | + |
511 | +} /* namespace common */ |
512 | +} /* namespace scalestack */ |
513 | |
514 | === renamed file 'ScaleStack/Common/Notification.h' => 'scalestack/common/notification.h' |
515 | --- ScaleStack/Common/Notification.h 2010-04-30 03:54:30 +0000 |
516 | +++ scalestack/common/notification.h 2010-06-03 05:01:22 +0000 |
517 | @@ -16,21 +16,23 @@ |
518 | #ifndef SCALESTACK_COMMON_NOTIFICATION_H |
519 | #define SCALESTACK_COMMON_NOTIFICATION_H |
520 | |
521 | -#include <ScaleStack/Common/Macros.h> |
522 | +#include <scalestack/common/macros.h> |
523 | |
524 | -namespace ScaleStack { |
525 | -namespace Common { |
526 | +namespace scalestack |
527 | +{ |
528 | +namespace common |
529 | +{ |
530 | |
531 | /** |
532 | * This class provides a way for different threads to notify each other. |
533 | */ |
534 | -class SCALESTACK_API Notification |
535 | +class SCALESTACK_API notification |
536 | { |
537 | public: |
538 | |
539 | - Notification(void); |
540 | + notification(void); |
541 | |
542 | - ~Notification(); |
543 | + ~notification(); |
544 | |
545 | /** |
546 | * Send a notification. |
547 | @@ -47,17 +49,24 @@ |
548 | /** |
549 | * Don't allow copying of objects. |
550 | */ |
551 | - Notification(const Notification&); |
552 | + notification(const notification&); |
553 | |
554 | /** |
555 | * Don't allow assignment of objects. |
556 | */ |
557 | - Notification& operator=(const Notification&); |
558 | + notification& operator=(const notification&); |
559 | + |
560 | + /** |
561 | + * Format an error message from errno and throw an exception. |
562 | + * |
563 | + * @param[in] prefix The prefix for the error message. |
564 | + */ |
565 | + void _throw_exception(const char* prefix); |
566 | |
567 | int _pipe[2]; |
568 | }; |
569 | |
570 | -} /* namespace Common */ |
571 | -} /* namespace ScaleStack */ |
572 | +} /* namespace common */ |
573 | +} /* namespace scalestack */ |
574 | |
575 | #endif /* SCALESTACK_COMMON_NOTIFICATION_H */ |
576 | |
577 | === renamed file 'ScaleStack/Common/Test.h' => 'scalestack/common/test.h' |
578 | --- ScaleStack/Common/Test.h 2010-04-30 03:54:30 +0000 |
579 | +++ scalestack/common/test.h 2010-06-03 05:01:22 +0000 |
580 | @@ -23,10 +23,12 @@ |
581 | #include <iostream> |
582 | #include <string> |
583 | |
584 | -#include <ScaleStack/Kernel/Core.h> |
585 | +#include <scalestack/kernel/core.h> |
586 | |
587 | using namespace std; |
588 | -using namespace ScaleStack; |
589 | +using namespace scalestack; |
590 | + |
591 | +#define TEST_EVENT_SERVICE "event::libevent" |
592 | |
593 | #define TEST_SUITE_BEGIN \ |
594 | int main(int _test_argc, char* _test_argv[]) \ |
595 | @@ -48,9 +50,9 @@ |
596 | |
597 | #define TEST_BEGIN(name) \ |
598 | TEST_BEGIN_NO_CORE(name) \ |
599 | - Kernel::Core core; \ |
600 | - core.setLogThreshold(TEST_LOG_THRESHOLD); \ |
601 | - core.addModuleOptionValue("path", "", "ScaleStack/.libs"); |
602 | + kernel::core core; \ |
603 | + core.set_log_threshold(TEST_LOG_THRESHOLD); \ |
604 | + core.add_module_option_value("path", "", "scalestack/.libs"); |
605 | |
606 | |
607 | #define TEST_END \ |
608 | @@ -80,6 +82,4 @@ |
609 | TEST_EXCEPTION_END \ |
610 | while (false) |
611 | |
612 | -#define TEST_EVENT_SERVICE "Event::Libevent" |
613 | - |
614 | #endif /* SCALESTACK_COMMON_TEST_H */ |
615 | |
616 | === renamed directory 'ScaleStack/DatabaseProxy' => 'scalestack/database_proxy' |
617 | === renamed file 'ScaleStack/DatabaseProxy/Client.cc' => 'scalestack/database_proxy/client.cc' |
618 | --- ScaleStack/DatabaseProxy/Client.cc 2010-04-30 03:54:30 +0000 |
619 | +++ scalestack/database_proxy/client.cc 2010-06-03 05:01:22 +0000 |
620 | @@ -15,20 +15,22 @@ |
621 | |
622 | #include "config.h" |
623 | |
624 | -#include <ScaleStack/DatabaseProxy/Client.h> |
625 | -#include <ScaleStack/DatabaseProxy/ClientService.h> |
626 | -#include <ScaleStack/DatabaseProxy/Connection.h> |
627 | -#include <ScaleStack/Kernel/Module.h> |
628 | +#include <scalestack/database_proxy/client.h> |
629 | +#include <scalestack/database_proxy/client_service.h> |
630 | +#include <scalestack/database_proxy/connection.h> |
631 | +#include <scalestack/kernel/module.h> |
632 | |
633 | -namespace ScaleStack { |
634 | -namespace DatabaseProxy { |
635 | +namespace scalestack |
636 | +{ |
637 | +namespace database_proxy |
638 | +{ |
639 | |
640 | /* |
641 | * Public methods. |
642 | */ |
643 | |
644 | -Client::Client(ClientService& client_service): |
645 | - Network::Stream(client_service), |
646 | +client::client(client_service& creator): |
647 | + network::stream(creator), |
648 | _state(), |
649 | _next_state(), |
650 | _need_yield(false), |
651 | @@ -40,12 +42,12 @@ |
652 | { |
653 | } |
654 | |
655 | -void Client::setConnection(DatabaseProxy::Connection* connection, |
656 | - bool need_handshake) |
657 | +void client::set_connection(database_proxy::connection* bound_connection, |
658 | + bool need_handshake) |
659 | { |
660 | - _connection = connection; |
661 | + _connection = bound_connection; |
662 | |
663 | - if (connection == NULL) |
664 | + if (_connection == NULL) |
665 | return; |
666 | |
667 | if (need_handshake && _state != SERVER_HANDSHAKE_PACKET && |
668 | @@ -55,60 +57,60 @@ |
669 | reconnect(); |
670 | } |
671 | else |
672 | - runNow(); |
673 | + run_now(); |
674 | } |
675 | |
676 | -void Client::yield(void) |
677 | +void client::yield(void) |
678 | { |
679 | _need_yield = true; |
680 | } |
681 | |
682 | -void Client::connected(void) |
683 | +void client::connected(void) |
684 | { |
685 | if (_connection == NULL) |
686 | return; |
687 | |
688 | - _connection->continueWrite(); |
689 | + _connection->continue_write(); |
690 | } |
691 | |
692 | -size_t Client::read(uint8_t* buffer, size_t size) |
693 | +size_t client::read(uint8_t* buffer, size_t size) |
694 | { |
695 | _size = size; |
696 | _buffer = buffer; |
697 | - return _connectionWrite(); |
698 | -} |
699 | - |
700 | -void Client::continueWrite(void) |
701 | -{ |
702 | - consume(_connectionWrite()); |
703 | -} |
704 | - |
705 | -void Client::flushWrite(void) |
706 | -{ |
707 | - _connection->continueWrite(); |
708 | -} |
709 | - |
710 | -void Client::error(void) |
711 | + return _connection_write(); |
712 | +} |
713 | + |
714 | +void client::continue_write(void) |
715 | +{ |
716 | + consume(_connection_write()); |
717 | +} |
718 | + |
719 | +void client::flush_write(void) |
720 | +{ |
721 | + _connection->continue_write(); |
722 | +} |
723 | + |
724 | +void client::error(void) |
725 | { |
726 | _connection->error(); |
727 | } |
728 | |
729 | -void Client::run(void) |
730 | +void client::run(void) |
731 | { |
732 | if (_shutdown) |
733 | { |
734 | - _connection->runNow(); |
735 | + _connection->run_now(); |
736 | remove(); |
737 | } |
738 | else |
739 | - _connection->continueWrite(); |
740 | + _connection->continue_write(); |
741 | } |
742 | |
743 | /* |
744 | * Private methods. |
745 | */ |
746 | |
747 | -size_t Client::_connectionWrite(void) |
748 | +size_t client::_connection_write(void) |
749 | { |
750 | if (_connection == NULL) |
751 | return 0; |
752 | @@ -124,7 +126,7 @@ |
753 | |
754 | _packet_size = 4 + (_buffer[0] | (static_cast<size_t>(_buffer[1]) << 8) | (static_cast<size_t>(_buffer[2]) << 16)); |
755 | _state = SERVER_HANDSHAKE_FLUSH; |
756 | - _module.logDebug("S-HAND packet: %u", _packet_size); |
757 | + _module.log_debug("S-HAND packet: %u", _packet_size); |
758 | |
759 | case SERVER_HANDSHAKE_FLUSH: |
760 | total_written = _connection->write(_buffer, _packet_size, true); |
761 | @@ -143,7 +145,7 @@ |
762 | |
763 | _packet_size = 4 + (_buffer[0] | (static_cast<size_t>(_buffer[1]) << 8) | (static_cast<size_t>(_buffer[2]) << 16)); |
764 | _state = RESULT_FLUSH; |
765 | - _module.logDebug("RESULT packet: %u", _packet_size); |
766 | + _module.log_debug("RESULT packet: %u", _packet_size); |
767 | |
768 | if (_buffer[4] == 0 || _buffer[4] >= 254) |
769 | _next_state = RESULT_PACKET; |
770 | @@ -171,7 +173,7 @@ |
771 | |
772 | _packet_size = 4 + (_buffer[0] | (static_cast<size_t>(_buffer[1]) << 8) | (static_cast<size_t>(_buffer[2]) << 16)); |
773 | _state = COLUMN_FLUSH; |
774 | - _module.logDebug("COLUMN packet: %u", _packet_size); |
775 | + _module.log_debug("COLUMN packet: %u", _packet_size); |
776 | |
777 | if (_packet_size == 9 && _buffer[4] == 254) |
778 | _next_state = ROW_PACKET; |
779 | @@ -200,7 +202,7 @@ |
780 | |
781 | _packet_size = 4 + (_buffer[0] | (static_cast<size_t>(_buffer[1]) << 8) | (static_cast<size_t>(_buffer[2]) << 16)); |
782 | _state = ROW_FLUSH; |
783 | - _module.logDebug("ROW packet: %u", _packet_size); |
784 | + _module.log_debug("ROW packet: %u", _packet_size); |
785 | |
786 | if (_packet_size == 9 && _buffer[4] == 254) |
787 | _next_state = RESULT_PACKET; |
788 | @@ -232,5 +234,5 @@ |
789 | return total_written; |
790 | } |
791 | |
792 | -} /* namespace DatabaseProxy */ |
793 | -} /* namespace ScaleStack */ |
794 | +} /* namespace database_proxy */ |
795 | +} /* namespace scalestack */ |
796 | |
797 | === renamed file 'ScaleStack/DatabaseProxy/Client.h' => 'scalestack/database_proxy/client.h' |
798 | --- ScaleStack/DatabaseProxy/Client.h 2010-04-30 03:54:30 +0000 |
799 | +++ scalestack/database_proxy/client.h 2010-06-03 05:01:22 +0000 |
800 | @@ -16,25 +16,27 @@ |
801 | #ifndef SCALESTACK_DATABASEPROXY_CLIENT_H |
802 | #define SCALESTACK_DATABASEPROXY_CLIENT_H |
803 | |
804 | -#include <ScaleStack/Network/Stream.h> |
805 | - |
806 | -namespace ScaleStack { |
807 | -namespace DatabaseProxy { |
808 | - |
809 | -class ClientService; |
810 | -class Connection; |
811 | - |
812 | -class Client: public Network::Stream |
813 | +#include <scalestack/network/stream.h> |
814 | + |
815 | +namespace scalestack |
816 | +{ |
817 | +namespace database_proxy |
818 | +{ |
819 | + |
820 | +class client_service; |
821 | +class connection; |
822 | + |
823 | +class client: public network::stream |
824 | { |
825 | public: |
826 | |
827 | - Client(ClientService& client_service); |
828 | + client(client_service& creator); |
829 | |
830 | /** |
831 | * Set the connection that uses this client. |
832 | */ |
833 | - void setConnection(DatabaseProxy::Connection* connection, |
834 | - bool need_handshake); |
835 | + void set_connection(database_proxy::connection* bound_connection, |
836 | + bool need_handshake); |
837 | |
838 | /** |
839 | * Notify client it should be yielded once current request is complete. |
840 | @@ -47,19 +49,19 @@ |
841 | void connected(void); |
842 | |
843 | /** |
844 | - * See SocketTCP::Connection::read(). |
845 | + * See Socket_tCP::connection::read(). |
846 | */ |
847 | size_t read(uint8_t* buffer, size_t size); |
848 | |
849 | /** |
850 | * Continue writing to the connection from the read buffer. |
851 | */ |
852 | - void continueWrite(void); |
853 | + void continue_write(void); |
854 | |
855 | /** |
856 | - * See SocketTCP::Connection::flushWrite(). |
857 | + * See Socket_tCP::connection::flush_write(). |
858 | */ |
859 | - void flushWrite(void); |
860 | + void flush_write(void); |
861 | |
862 | /** |
863 | * On error, notify attached connection to shutdown. |
864 | @@ -76,18 +78,18 @@ |
865 | /** |
866 | * Don't allow copying of objects. |
867 | */ |
868 | - Client(const Client&); |
869 | + client(const client&); |
870 | |
871 | /** |
872 | * Don't allow assignment of objects. |
873 | */ |
874 | - Client& operator=(const Client&); |
875 | + client& operator=(const client&); |
876 | |
877 | /** |
878 | * Write data to the connection. This is used by both the read() and |
879 | - * continueWrite() methods. |
880 | + * continue_write() methods. |
881 | */ |
882 | - size_t _connectionWrite(void); |
883 | + size_t _connection_write(void); |
884 | |
885 | enum |
886 | { |
887 | @@ -105,10 +107,10 @@ |
888 | size_t _size; |
889 | size_t _packet_size; |
890 | uint8_t* _buffer; |
891 | - DatabaseProxy::Connection* _connection; |
892 | + database_proxy::connection* _connection; |
893 | }; |
894 | |
895 | -} /* namespace DatabaseProxy */ |
896 | -} /* namespace ScaleStack */ |
897 | +} /* namespace database_proxy */ |
898 | +} /* namespace scalestack */ |
899 | |
900 | #endif /* SCALESTACK_DATABASEPROXY_CLIENT_H */ |
901 | |
902 | === renamed file 'ScaleStack/DatabaseProxy/ClientService.cc' => 'scalestack/database_proxy/client_service.cc' |
903 | --- ScaleStack/DatabaseProxy/ClientService.cc 2010-04-30 03:54:30 +0000 |
904 | +++ scalestack/database_proxy/client_service.cc 2010-06-03 05:01:22 +0000 |
905 | @@ -17,24 +17,26 @@ |
906 | |
907 | #include <algorithm> |
908 | |
909 | -#include <ScaleStack/DatabaseProxy/Client.h> |
910 | -#include <ScaleStack/DatabaseProxy/ClientService.h> |
911 | -#include <ScaleStack/DatabaseProxy/Connection.h> |
912 | -#include <ScaleStack/Kernel/Module.h> |
913 | -#include <ScaleStack/Kernel/Option.h> |
914 | +#include <scalestack/database_proxy/client.h> |
915 | +#include <scalestack/database_proxy/client_service.h> |
916 | +#include <scalestack/database_proxy/connection.h> |
917 | +#include <scalestack/kernel/module.h> |
918 | +#include <scalestack/kernel/option.h> |
919 | |
920 | using namespace std; |
921 | |
922 | -namespace ScaleStack { |
923 | -namespace DatabaseProxy { |
924 | +namespace scalestack |
925 | +{ |
926 | +namespace database_proxy |
927 | +{ |
928 | |
929 | /* |
930 | * Public functions. |
931 | */ |
932 | |
933 | -ClientService::ClientService(Kernel::Module& module): |
934 | - Network::IP::TCP::ConnectionService(module), |
935 | - _max_clients(_module.getOption("max_clients").getSizeValue()), |
936 | +client_service::client_service(kernel::module& creator): |
937 | + network::ip::tcp::connection_service(creator), |
938 | + _max_clients(_module.get_option("max_clients").get_size_value()), |
939 | _current_clients(), |
940 | _queue_mutex(), |
941 | _waiting_connections(), |
942 | @@ -42,39 +44,39 @@ |
943 | { |
944 | int return_code = pthread_mutex_init(&_queue_mutex, NULL); |
945 | if (return_code != 0) |
946 | - _module.logFatal("Failed pthread_mutex_init: %d", return_code); |
947 | + _module.log_fatal("Failed pthread_mutex_init: %d", return_code); |
948 | } |
949 | |
950 | -ClientService::~ClientService() |
951 | +client_service::~client_service() |
952 | { |
953 | shutdown(); |
954 | int return_code = pthread_mutex_destroy(&_queue_mutex); |
955 | if (return_code != 0) |
956 | - _module.logError("Failed pthread_mutex_destroy: %d", return_code); |
957 | + _module.log_error("Failed pthread_mutex_destroy: %d", return_code); |
958 | } |
959 | |
960 | -Network::Stream* ClientService::addStream(void) |
961 | +network::stream* client_service::add_stream(void) |
962 | { |
963 | - return new Client(*this); |
964 | + return new client(*this); |
965 | } |
966 | |
967 | -void ClientService::removeStream(Network::Stream* stream) |
968 | +void client_service::remove_stream(network::stream* old_stream) |
969 | { |
970 | pthread_mutex_lock(&_queue_mutex); |
971 | --_current_clients; |
972 | pthread_mutex_unlock(&_queue_mutex); |
973 | - delete stream; |
974 | + delete old_stream; |
975 | } |
976 | |
977 | -Client* ClientService::getClient(Connection* connection, bool need_handshake) |
978 | +client* client_service::get_client(connection* bound_connection, bool need_handshake) |
979 | { |
980 | pthread_mutex_lock(&_queue_mutex); |
981 | |
982 | - Client* client; |
983 | - vector<Connection*>::reverse_iterator found_connection; |
984 | + client* new_client; |
985 | + vector<connection*>::reverse_iterator found_connection; |
986 | found_connection = find(_waiting_connections.rbegin(), |
987 | _waiting_connections.rend(), |
988 | - connection); |
989 | + bound_connection); |
990 | |
991 | if (_free_clients.empty() || |
992 | (_current_clients != _max_clients && need_handshake)) |
993 | @@ -82,19 +84,19 @@ |
994 | if (_current_clients == _max_clients) |
995 | { |
996 | if (found_connection == _waiting_connections.rend()) |
997 | - _waiting_connections.insert(_waiting_connections.begin(), connection); |
998 | + _waiting_connections.insert(_waiting_connections.begin(), bound_connection); |
999 | pthread_mutex_unlock(&_queue_mutex); |
1000 | return NULL; |
1001 | } |
1002 | |
1003 | - const string& host = _module.getOption("client_host").getValue(); |
1004 | - const string& port = _module.getOption("client_port").getValue(); |
1005 | - client = static_cast<Client*>(addConnect(host, port)); |
1006 | + const string& host = _module.get_option("client_host").get_value(); |
1007 | + const string& port = _module.get_option("client_port").get_value(); |
1008 | + new_client = static_cast<client*>(add_connect(host, port)); |
1009 | ++_current_clients; |
1010 | } |
1011 | else |
1012 | { |
1013 | - client = _free_clients.back(); |
1014 | + new_client = _free_clients.back(); |
1015 | _free_clients.pop_back(); |
1016 | } |
1017 | |
1018 | @@ -103,34 +105,34 @@ |
1019 | |
1020 | pthread_mutex_unlock(&_queue_mutex); |
1021 | |
1022 | - client->setConnection(connection, need_handshake); |
1023 | - return client; |
1024 | + new_client->set_connection(bound_connection, need_handshake); |
1025 | + return new_client; |
1026 | } |
1027 | |
1028 | -void ClientService::yieldClient(Client* client) |
1029 | +void client_service::yield_client(client* bound_client) |
1030 | { |
1031 | pthread_mutex_lock(&_queue_mutex); |
1032 | |
1033 | - _free_clients.push_back(client); |
1034 | + _free_clients.push_back(bound_client); |
1035 | if (!_waiting_connections.empty()) |
1036 | - _waiting_connections.back()->runNow(); |
1037 | + _waiting_connections.back()->run_now(); |
1038 | |
1039 | pthread_mutex_unlock(&_queue_mutex); |
1040 | } |
1041 | |
1042 | -void ClientService::removeFromQueue(Connection* connection) |
1043 | +void client_service::remove_from_queue(connection* bound_connection) |
1044 | { |
1045 | pthread_mutex_lock(&_queue_mutex); |
1046 | |
1047 | - vector<Connection*>::iterator found_connection; |
1048 | + vector<connection*>::iterator found_connection; |
1049 | found_connection = find(_waiting_connections.begin(), |
1050 | _waiting_connections.end(), |
1051 | - connection); |
1052 | + bound_connection); |
1053 | if (found_connection != _waiting_connections.end()) |
1054 | _waiting_connections.erase(found_connection); |
1055 | |
1056 | pthread_mutex_unlock(&_queue_mutex); |
1057 | } |
1058 | |
1059 | -} /* namespace DatabaseProxy */ |
1060 | -} /* namespace ScaleStack */ |
1061 | +} /* namespace database_proxy */ |
1062 | +} /* namespace scalestack */ |
1063 | |
1064 | === renamed file 'ScaleStack/DatabaseProxy/ClientService.h' => 'scalestack/database_proxy/client_service.h' |
1065 | --- ScaleStack/DatabaseProxy/ClientService.h 2010-04-30 03:54:30 +0000 |
1066 | +++ scalestack/database_proxy/client_service.h 2010-06-03 05:01:22 +0000 |
1067 | @@ -13,72 +13,74 @@ |
1068 | * @brief Database Proxy Client Service Declarations |
1069 | */ |
1070 | |
1071 | -#ifndef SCALESTACK_DATABASEPROXY_CLIENTSERVICE_H |
1072 | -#define SCALESTACK_DATABASEPROXY_CLIENTSERVICE_H |
1073 | +#ifndef SCALESTACK_DATABASEPROXY_CLIENT_SERVICE_H |
1074 | +#define SCALESTACK_DATABASEPROXY_CLIENT_SERVICE_H |
1075 | |
1076 | #include <vector> |
1077 | |
1078 | -#include <ScaleStack/Network/IP/TCP/ConnectionService.h> |
1079 | - |
1080 | -namespace ScaleStack { |
1081 | -namespace DatabaseProxy { |
1082 | - |
1083 | -class Client; |
1084 | -class Connection; |
1085 | - |
1086 | -class ClientService: public Network::IP::TCP::ConnectionService |
1087 | +#include <scalestack/network/ip/tcp/connection_service.h> |
1088 | + |
1089 | +namespace scalestack |
1090 | +{ |
1091 | +namespace database_proxy |
1092 | +{ |
1093 | + |
1094 | +class client; |
1095 | +class connection; |
1096 | + |
1097 | +class client_service: public network::ip::tcp::connection_service |
1098 | { |
1099 | public: |
1100 | |
1101 | - ClientService(Kernel::Module& module); |
1102 | - |
1103 | - ~ClientService(); |
1104 | - |
1105 | - /** |
1106 | - * See SocketTCP::ConnectionService::addConnection(). |
1107 | - */ |
1108 | - Network::Stream* addStream(void); |
1109 | - |
1110 | - /** |
1111 | - * See SocketTCP::ConnectionService::removeConnection(). |
1112 | - */ |
1113 | - void removeStream(Network::Stream* stream); |
1114 | + client_service(kernel::module& creator); |
1115 | + |
1116 | + ~client_service(); |
1117 | + |
1118 | + /** |
1119 | + * See network::stream_service::add_stream(). |
1120 | + */ |
1121 | + network::stream* add_stream(void); |
1122 | + |
1123 | + /** |
1124 | + * See network::stream_service::remove_stream(). |
1125 | + */ |
1126 | + void remove_stream(network::stream* old_stream); |
1127 | |
1128 | /** |
1129 | * Get a client connection to proxy to. |
1130 | */ |
1131 | - Client* getClient(Connection* connection, bool need_handshake); |
1132 | + client* get_client(connection* bound_connection, bool need_handshake); |
1133 | |
1134 | /** |
1135 | * Yield a client to other pending transactions. |
1136 | */ |
1137 | - void yieldClient(Client* client); |
1138 | + void yield_client(client* bound_client); |
1139 | |
1140 | /** |
1141 | * Erase a connection from the queue. |
1142 | */ |
1143 | - void removeFromQueue(Connection* connection); |
1144 | + void remove_from_queue(connection* bound_connection); |
1145 | |
1146 | private: |
1147 | |
1148 | /** |
1149 | * Don't allow copying of objects. |
1150 | */ |
1151 | - ClientService(const ClientService&); |
1152 | + client_service(const client_service&); |
1153 | |
1154 | /** |
1155 | * Don't allow assignment of objects. |
1156 | */ |
1157 | - ClientService& operator=(const ClientService&); |
1158 | + client_service& operator=(const client_service&); |
1159 | |
1160 | size_t _max_clients; |
1161 | size_t _current_clients; |
1162 | pthread_mutex_t _queue_mutex; |
1163 | - std::vector<Connection*> _waiting_connections; |
1164 | - std::vector<Client*> _free_clients; |
1165 | + std::vector<connection*> _waiting_connections; |
1166 | + std::vector<client*> _free_clients; |
1167 | }; |
1168 | |
1169 | -} /* namespace DatabaseProxy */ |
1170 | -} /* namespace ScaleStack */ |
1171 | +} /* namespace database_proxy */ |
1172 | +} /* namespace scalestack */ |
1173 | |
1174 | -#endif /* SCALESTACK_DATABASEPROXY_CLIENTSERVICE_H */ |
1175 | +#endif /* SCALESTACK_DATABASEPROXY_CLIENT_SERVICE_H */ |
1176 | |
1177 | === renamed file 'ScaleStack/DatabaseProxy/Connection.cc' => 'scalestack/database_proxy/connection.cc' |
1178 | --- ScaleStack/DatabaseProxy/Connection.cc 2010-04-30 03:54:30 +0000 |
1179 | +++ scalestack/database_proxy/connection.cc 2010-06-03 05:01:22 +0000 |
1180 | @@ -17,20 +17,22 @@ |
1181 | |
1182 | #include <cstring> |
1183 | |
1184 | -#include <ScaleStack/DatabaseProxy/Client.h> |
1185 | -#include <ScaleStack/DatabaseProxy/Connection.h> |
1186 | -#include <ScaleStack/DatabaseProxy/Service.h> |
1187 | -#include <ScaleStack/Kernel/Module.h> |
1188 | +#include <scalestack/database_proxy/client.h> |
1189 | +#include <scalestack/database_proxy/connection.h> |
1190 | +#include <scalestack/database_proxy/service.h> |
1191 | +#include <scalestack/kernel/module.h> |
1192 | |
1193 | -namespace ScaleStack { |
1194 | -namespace DatabaseProxy { |
1195 | +namespace scalestack |
1196 | +{ |
1197 | +namespace database_proxy |
1198 | +{ |
1199 | |
1200 | /* |
1201 | * Public methods. |
1202 | */ |
1203 | |
1204 | -Connection::Connection(Service& service): |
1205 | - Network::Stream(service), |
1206 | +connection::connection(service& creator): |
1207 | + network::stream(creator), |
1208 | _state(), |
1209 | _need_handshake(true), |
1210 | _need_yield(false), |
1211 | @@ -41,70 +43,70 @@ |
1212 | _buffer(), |
1213 | _client() |
1214 | { |
1215 | - _client = service.getClient(this, _need_handshake); |
1216 | + _client = creator.get_client(this, _need_handshake); |
1217 | } |
1218 | |
1219 | -size_t Connection::read(uint8_t* buffer, size_t size) |
1220 | +size_t connection::read(uint8_t* buffer, size_t size) |
1221 | { |
1222 | _size = size; |
1223 | _buffer = buffer; |
1224 | - return _clientWrite(); |
1225 | + return _client_write(); |
1226 | } |
1227 | |
1228 | -void Connection::continueWrite(void) |
1229 | +void connection::continue_write(void) |
1230 | { |
1231 | - consume(_clientWrite()); |
1232 | + consume(_client_write()); |
1233 | } |
1234 | |
1235 | -void Connection::flushWrite(void) |
1236 | +void connection::flush_write(void) |
1237 | { |
1238 | if (_client != NULL) |
1239 | - _client->continueWrite(); |
1240 | + _client->continue_write(); |
1241 | } |
1242 | |
1243 | -void Connection::error(void) |
1244 | +void connection::error(void) |
1245 | { |
1246 | _shutdown = true; |
1247 | - runNow(); |
1248 | + run_now(); |
1249 | } |
1250 | |
1251 | -void Connection::run(void) |
1252 | +void connection::run(void) |
1253 | { |
1254 | if (_shutdown) |
1255 | { |
1256 | if (_client == NULL) |
1257 | { |
1258 | - static_cast<Service&>(_service).removeFromQueue(this); |
1259 | + static_cast<service&>(_service).remove_from_queue(this); |
1260 | remove(); |
1261 | return; |
1262 | } |
1263 | |
1264 | - static_cast<Service&>(_service).yieldClient(_client); |
1265 | + static_cast<service&>(_service).yield_client(_client); |
1266 | _client = NULL; |
1267 | return; |
1268 | } |
1269 | |
1270 | if (_client == NULL) |
1271 | - _client = static_cast<Service&>(_service).getClient(this, _need_handshake); |
1272 | + _client = static_cast<service&>(_service).get_client(this, _need_handshake); |
1273 | else if (_need_yield) |
1274 | { |
1275 | _need_yield = false; |
1276 | - static_cast<Service&>(_service).yieldClient(_client); |
1277 | + static_cast<service&>(_service).yield_client(_client); |
1278 | _client = NULL; |
1279 | } |
1280 | } |
1281 | |
1282 | -void Connection::yield(void) |
1283 | +void connection::yield(void) |
1284 | { |
1285 | _need_yield = true; |
1286 | - runNow(); |
1287 | + run_now(); |
1288 | } |
1289 | |
1290 | /* |
1291 | * Private methods. |
1292 | */ |
1293 | |
1294 | -size_t Connection::_clientWrite(void) |
1295 | +size_t connection::_client_write(void) |
1296 | { |
1297 | if (_shutdown) |
1298 | return 0; |
1299 | @@ -112,13 +114,13 @@ |
1300 | if (_need_yield) |
1301 | { |
1302 | _need_yield = false; |
1303 | - static_cast<Service&>(_service).yieldClient(_client); |
1304 | + static_cast<service&>(_service).yield_client(_client); |
1305 | _client = NULL; |
1306 | } |
1307 | |
1308 | if (_client == NULL) |
1309 | { |
1310 | - _client = static_cast<Service&>(_service).getClient(this, _need_handshake); |
1311 | + _client = static_cast<service&>(_service).get_client(this, _need_handshake); |
1312 | /* Just return here, the client will call this when ready. */ |
1313 | return 0; |
1314 | } |
1315 | @@ -133,7 +135,7 @@ |
1316 | |
1317 | _packet_size = 4 + (_buffer[0] | (static_cast<size_t>(_buffer[1]) << 8) | (static_cast<size_t>(_buffer[2]) << 16)); |
1318 | _state = CLIENT_HANDSHAKE_FLUSH; |
1319 | - _module.logDebug("C-HAND packet: %u", _packet_size); |
1320 | + _module.log_debug("C-HAND packet: %u", _packet_size); |
1321 | |
1322 | case CLIENT_HANDSHAKE_FLUSH: |
1323 | written = _client->write(_buffer, _packet_size, true); |
1324 | @@ -155,7 +157,7 @@ |
1325 | |
1326 | _packet_size = 4 + (_buffer[0] | (static_cast<size_t>(_buffer[1]) << 8) | (static_cast<size_t>(_buffer[2]) << 16)); |
1327 | _state = COMMAND_FLUSH; |
1328 | - _module.logDebug("COMMAND packet: %u", _packet_size); |
1329 | + _module.log_debug("COMMAND packet: %u", _packet_size); |
1330 | if (_packet_size == 10 && _size >= 10 && !memcmp("BEGIN", _buffer + 5, 5)) |
1331 | _in_transaction = true; |
1332 | else if (!_in_transaction || |
1333 | @@ -189,5 +191,5 @@ |
1334 | return written; |
1335 | } |
1336 | |
1337 | -} /* namespace DatabaseProxy */ |
1338 | -} /* namespace ScaleStack */ |
1339 | +} /* namespace database_proxy */ |
1340 | +} /* namespace scalestack */ |
1341 | |
1342 | === renamed file 'ScaleStack/DatabaseProxy/Connection.h' => 'scalestack/database_proxy/connection.h' |
1343 | --- ScaleStack/DatabaseProxy/Connection.h 2010-04-30 03:54:30 +0000 |
1344 | +++ scalestack/database_proxy/connection.h 2010-06-03 05:01:22 +0000 |
1345 | @@ -16,34 +16,36 @@ |
1346 | #ifndef SCALESTACK_DATABASEPROXY_CONNECTION_H |
1347 | #define SCALESTACK_DATABASEPROXY_CONNECTION_H |
1348 | |
1349 | -#include <ScaleStack/Network/Stream.h> |
1350 | - |
1351 | -namespace ScaleStack { |
1352 | -namespace DatabaseProxy { |
1353 | - |
1354 | -class Client; |
1355 | -class Service; |
1356 | - |
1357 | -class Connection: public Network::Stream |
1358 | +#include <scalestack/network/stream.h> |
1359 | + |
1360 | +namespace scalestack |
1361 | +{ |
1362 | +namespace database_proxy |
1363 | +{ |
1364 | + |
1365 | +class client; |
1366 | +class service; |
1367 | + |
1368 | +class connection: public network::stream |
1369 | { |
1370 | public: |
1371 | |
1372 | - Connection(Service& service); |
1373 | + connection(service& creator); |
1374 | |
1375 | /** |
1376 | - * See SocketTCP::Connection::read(). |
1377 | + * See network::stream::read(). |
1378 | */ |
1379 | size_t read(uint8_t* buffer, size_t size); |
1380 | |
1381 | /** |
1382 | * Continue writing to the client from the read buffer. |
1383 | */ |
1384 | - void continueWrite(void); |
1385 | + void continue_write(void); |
1386 | |
1387 | /** |
1388 | - * See SocketTCP::Connection::flushWrite(). |
1389 | + * See network::stream::flush_write(). |
1390 | */ |
1391 | - void flushWrite(void); |
1392 | + void flush_write(void); |
1393 | |
1394 | /** |
1395 | * Start shutdown process. |
1396 | @@ -65,18 +67,18 @@ |
1397 | /** |
1398 | * Don't allow copying of objects. |
1399 | */ |
1400 | - Connection(const Connection&); |
1401 | + connection(const connection&); |
1402 | |
1403 | /** |
1404 | * Don't allow assignment of objects. |
1405 | */ |
1406 | - Connection& operator=(const Connection&); |
1407 | + connection& operator=(const connection&); |
1408 | |
1409 | /** |
1410 | * Write data to the client. This is used by both the read() and |
1411 | - * continueWrite() methods. |
1412 | + * continue_write() methods. |
1413 | */ |
1414 | - size_t _clientWrite(void); |
1415 | + size_t _client_write(void); |
1416 | |
1417 | enum |
1418 | { |
1419 | @@ -92,10 +94,10 @@ |
1420 | size_t _size; |
1421 | size_t _packet_size; |
1422 | uint8_t* _buffer; |
1423 | - Client* _client; |
1424 | + client* _client; |
1425 | }; |
1426 | |
1427 | -} /* namespace DatabaseProxy */ |
1428 | -} /* namespace ScaleStack */ |
1429 | +} /* namespace database_proxy */ |
1430 | +} /* namespace scalestack */ |
1431 | |
1432 | #endif /* SCALESTACK_DATABASEPROXY_CONNECTION_H */ |
1433 | |
1434 | === renamed file 'ScaleStack/DatabaseProxy/DatabaseProxy.cc' => 'scalestack/database_proxy/database_proxy.cc' |
1435 | --- ScaleStack/DatabaseProxy/DatabaseProxy.cc 2010-04-28 06:41:33 +0000 |
1436 | +++ scalestack/database_proxy/database_proxy.cc 2010-06-03 05:01:22 +0000 |
1437 | @@ -15,28 +15,28 @@ |
1438 | |
1439 | #include "config.h" |
1440 | |
1441 | -#include <ScaleStack/DatabaseProxy/Service.h> |
1442 | -#include <ScaleStack/Kernel/Core.h> |
1443 | -#include <ScaleStack/Kernel/Module.h> |
1444 | +#include <scalestack/database_proxy/service.h> |
1445 | +#include <scalestack/kernel/core.h> |
1446 | +#include <scalestack/kernel/module.h> |
1447 | |
1448 | using namespace std; |
1449 | -using namespace ScaleStack; |
1450 | +using namespace scalestack; |
1451 | |
1452 | -static void options(Kernel::Module& module) |
1453 | +static void options(kernel::module& current) |
1454 | { |
1455 | - Network::IP::TCP::ListenerOptions(module, "7"); |
1456 | - module.addOption("client_host", "Host to proxy to.", "HOST", "127.0.0.1"); |
1457 | - module.addOption("client_port", "Port to proxy to.", "PORT", "12345"); |
1458 | - module.addOption("max_clients", "Maxiumum number of clients to use.", |
1459 | - "MAX", "1"); |
1460 | + network::ip::tcp::listener_options(current, "7"); |
1461 | + current.add_option("client_host", "Host to proxy to.", "HOST", "127.0.0.1"); |
1462 | + current.add_option("client_port", "Port to proxy to.", "PORT", "12345"); |
1463 | + current.add_option("max_clients", "Maxiumum number of clients to use.", |
1464 | + "MAX", "1"); |
1465 | } |
1466 | |
1467 | -static void start(Kernel::Module& module) |
1468 | +static void start(kernel::module& current) |
1469 | { |
1470 | - DatabaseProxy::Service* service = new DatabaseProxy::Service(module); |
1471 | + database_proxy::service* service = new database_proxy::service(current); |
1472 | try |
1473 | { |
1474 | - module.getCore().addService("DatabaseProxy", service); |
1475 | + current.get_core().add_service("Database_proxy", service); |
1476 | } |
1477 | catch (exception&) |
1478 | { |
1479 | @@ -45,9 +45,9 @@ |
1480 | } |
1481 | } |
1482 | |
1483 | -static void stop(Kernel::Module& module) |
1484 | +static void stop(kernel::module& current) |
1485 | { |
1486 | - delete module.getCore().removeService("DatabaseProxy"); |
1487 | + delete current.get_core().remove_service("Database_proxy"); |
1488 | } |
1489 | |
1490 | SCALESTACK_KERNEL_MODULE(options, start, stop, NULL, NULL); |
1491 | |
1492 | === modified file 'scalestack/database_proxy/plugin.ini' |
1493 | --- ScaleStack/DatabaseProxy/plugin.ini 2010-05-01 01:14:47 +0000 |
1494 | +++ scalestack/database_proxy/plugin.ini 2010-06-03 05:01:22 +0000 |
1495 | @@ -4,6 +4,6 @@ |
1496 | version=0.1 |
1497 | author=Eric Day <eday@oddments.org> |
1498 | license=BSD |
1499 | -sources=Client.cc ClientService.cc Connection.cc DatabaseProxy.cc Service.cc |
1500 | -headers=Client.h ClientService.h Connection.h Service.h |
1501 | -dependencies=Network::IP::TCP |
1502 | +sources=client.cc client_service.cc connection.cc database_proxy.cc service.cc |
1503 | +headers=client.h client_service.h connection.h service.h |
1504 | +dependencies=network::ip::tcp |
1505 | |
1506 | === renamed file 'ScaleStack/DatabaseProxy/Service.cc' => 'scalestack/database_proxy/service.cc' |
1507 | --- ScaleStack/DatabaseProxy/Service.cc 2010-04-30 03:54:30 +0000 |
1508 | +++ scalestack/database_proxy/service.cc 2010-06-03 05:01:22 +0000 |
1509 | @@ -15,54 +15,56 @@ |
1510 | |
1511 | #include "config.h" |
1512 | |
1513 | -#include <ScaleStack/DatabaseProxy/Connection.h> |
1514 | -#include <ScaleStack/DatabaseProxy/Service.h> |
1515 | +#include <scalestack/database_proxy/connection.h> |
1516 | +#include <scalestack/database_proxy/service.h> |
1517 | |
1518 | -namespace ScaleStack { |
1519 | -namespace DatabaseProxy { |
1520 | +namespace scalestack |
1521 | +{ |
1522 | +namespace database_proxy |
1523 | +{ |
1524 | |
1525 | /* |
1526 | * Public functions. |
1527 | */ |
1528 | |
1529 | -Service::Service(Kernel::Module& module): |
1530 | - Network::IP::TCP::ConnectionService(module), |
1531 | - _listener_service(module, *this), |
1532 | - _client_service(module) |
1533 | +service::service(kernel::module& creator): |
1534 | + network::ip::tcp::connection_service(creator), |
1535 | + _listener_service(creator, *this), |
1536 | + _client_service(creator) |
1537 | { |
1538 | } |
1539 | |
1540 | -Service::~Service() |
1541 | +service::~service() |
1542 | { |
1543 | _listener_service.shutdown(); |
1544 | shutdown(); |
1545 | _client_service.shutdown(); |
1546 | } |
1547 | |
1548 | -Network::Stream* Service::addStream(void) |
1549 | -{ |
1550 | - return new Connection(*this); |
1551 | -} |
1552 | - |
1553 | -void Service::removeStream(Network::Stream* stream) |
1554 | -{ |
1555 | - delete stream; |
1556 | -} |
1557 | - |
1558 | -Client* Service::getClient(Connection* connection, bool need_handshake) |
1559 | -{ |
1560 | - return _client_service.getClient(connection, need_handshake); |
1561 | -} |
1562 | - |
1563 | -void Service::yieldClient(Client* client) |
1564 | -{ |
1565 | - _client_service.yieldClient(client); |
1566 | -} |
1567 | - |
1568 | -void Service::removeFromQueue(Connection* connection) |
1569 | -{ |
1570 | - _client_service.removeFromQueue(connection); |
1571 | -} |
1572 | - |
1573 | -} /* namespace DatabaseProxy */ |
1574 | -} /* namespace ScaleStack */ |
1575 | +network::stream* service::add_stream(void) |
1576 | +{ |
1577 | + return new connection(*this); |
1578 | +} |
1579 | + |
1580 | +void service::remove_stream(network::stream* old_stream) |
1581 | +{ |
1582 | + delete old_stream; |
1583 | +} |
1584 | + |
1585 | +client* service::get_client(connection* bound_connection, bool need_handshake) |
1586 | +{ |
1587 | + return _client_service.get_client(bound_connection, need_handshake); |
1588 | +} |
1589 | + |
1590 | +void service::yield_client(client* bound_client) |
1591 | +{ |
1592 | + _client_service.yield_client(bound_client); |
1593 | +} |
1594 | + |
1595 | +void service::remove_from_queue(connection* bound_connection) |
1596 | +{ |
1597 | + _client_service.remove_from_queue(bound_connection); |
1598 | +} |
1599 | + |
1600 | +} /* namespace database_proxy */ |
1601 | +} /* namespace scalestack */ |
1602 | |
1603 | === renamed file 'ScaleStack/DatabaseProxy/Service.h' => 'scalestack/database_proxy/service.h' |
1604 | --- ScaleStack/DatabaseProxy/Service.h 2010-04-30 03:54:30 +0000 |
1605 | +++ scalestack/database_proxy/service.h 2010-06-03 05:01:22 +0000 |
1606 | @@ -16,66 +16,68 @@ |
1607 | #ifndef SCALESTACK_DATABASEPROXY_SERVICE_H |
1608 | #define SCALESTACK_DATABASEPROXY_SERVICE_H |
1609 | |
1610 | -#include <ScaleStack/DatabaseProxy/ClientService.h> |
1611 | -#include <ScaleStack/Network/IP/TCP/ConnectionService.h> |
1612 | -#include <ScaleStack/Network/IP/TCP/ListenerService.h> |
1613 | - |
1614 | -namespace ScaleStack { |
1615 | -namespace DatabaseProxy { |
1616 | - |
1617 | -class Client; |
1618 | -class Connection; |
1619 | - |
1620 | -class Service: public Network::IP::TCP::ConnectionService |
1621 | +#include <scalestack/database_proxy/client_service.h> |
1622 | +#include <scalestack/network/ip/tcp/connection_service.h> |
1623 | +#include <scalestack/network/ip/tcp/listener_service.h> |
1624 | + |
1625 | +namespace scalestack |
1626 | +{ |
1627 | +namespace database_proxy |
1628 | +{ |
1629 | + |
1630 | +class client; |
1631 | +class connection; |
1632 | + |
1633 | +class service: public network::ip::tcp::connection_service |
1634 | { |
1635 | public: |
1636 | |
1637 | - Service(Kernel::Module& module); |
1638 | - |
1639 | - ~Service(); |
1640 | - |
1641 | - /** |
1642 | - * See SocketTCP::ConnectionService::addConnection(). |
1643 | - */ |
1644 | - Network::Stream* addStream(void); |
1645 | - |
1646 | - /** |
1647 | - * See Socket::ConnectionService::removeConnection(). |
1648 | - */ |
1649 | - void removeStream(Network::Stream* stream); |
1650 | + service(kernel::module& creator); |
1651 | + |
1652 | + ~service(); |
1653 | + |
1654 | + /** |
1655 | + * See network::stream_service::add_stream(). |
1656 | + */ |
1657 | + network::stream* add_stream(void); |
1658 | + |
1659 | + /** |
1660 | + * See network::stream_service::remove_stream(). |
1661 | + */ |
1662 | + void remove_stream(network::stream* old_stream); |
1663 | |
1664 | /** |
1665 | * Get a client connection to proxy to. |
1666 | */ |
1667 | - Client* getClient(Connection* connection, bool need_handshake); |
1668 | + client* get_client(connection* bound_connection, bool need_handshake); |
1669 | |
1670 | /** |
1671 | * Yield a client to other pending transactions. |
1672 | */ |
1673 | - void yieldClient(Client* client); |
1674 | + void yield_client(client* bound_client); |
1675 | |
1676 | /** |
1677 | * Erase a connection from the queue. |
1678 | */ |
1679 | - void removeFromQueue(Connection* connection); |
1680 | + void remove_from_queue(connection* bound_connection); |
1681 | |
1682 | private: |
1683 | |
1684 | /** |
1685 | * Don't allow copying of objects. |
1686 | */ |
1687 | - Service(const Service&); |
1688 | + service(const service&); |
1689 | |
1690 | /** |
1691 | * Don't allow assignment of objects. |
1692 | */ |
1693 | - Service& operator=(const Service&); |
1694 | + service& operator=(const service&); |
1695 | |
1696 | - Network::IP::TCP::ListenerService _listener_service; |
1697 | - ClientService _client_service; |
1698 | + network::ip::tcp::listener_service _listener_service; |
1699 | + client_service _client_service; |
1700 | }; |
1701 | |
1702 | -} /* namespace DatabaseProxy */ |
1703 | -} /* namespace ScaleStack */ |
1704 | +} /* namespace database_proxy */ |
1705 | +} /* namespace scalestack */ |
1706 | |
1707 | #endif /* SCALESTACK_DATABASEPROXY_SERVICE_H */ |
1708 | |
1709 | === renamed directory 'ScaleStack/Echo' => 'scalestack/echo' |
1710 | === renamed directory 'ScaleStack/Echo/Flood' => 'scalestack/echo/flood' |
1711 | === renamed file 'ScaleStack/Echo/Flood/Datagram.cc' => 'scalestack/echo/flood/datagram.cc' |
1712 | --- ScaleStack/Echo/Flood/Datagram.cc 2010-05-16 06:20:02 +0000 |
1713 | +++ scalestack/echo/flood/datagram.cc 2010-06-03 05:01:22 +0000 |
1714 | @@ -17,48 +17,51 @@ |
1715 | |
1716 | #include <cstring> |
1717 | |
1718 | -#include <ScaleStack/Echo/Flood/Datagram.h> |
1719 | -#include <ScaleStack/Echo/Flood/Flood.h> |
1720 | -#include <ScaleStack/Kernel/Core.h> |
1721 | -#include <ScaleStack/Kernel/Module.h> |
1722 | -#include <ScaleStack/Kernel/Option.h> |
1723 | +#include <scalestack/echo/flood/datagram.h> |
1724 | +#include <scalestack/echo/flood/flood.h> |
1725 | +#include <scalestack/kernel/core.h> |
1726 | +#include <scalestack/kernel/module.h> |
1727 | +#include <scalestack/kernel/option.h> |
1728 | |
1729 | -namespace ScaleStack { |
1730 | -namespace Echo { |
1731 | -namespace Flood { |
1732 | +namespace scalestack |
1733 | +{ |
1734 | +namespace echo |
1735 | +{ |
1736 | +namespace flood |
1737 | +{ |
1738 | |
1739 | /* |
1740 | * Public methods. |
1741 | */ |
1742 | |
1743 | -void Datagram::Options(Kernel::Module& module) |
1744 | +void datagram::options(kernel::module& creator) |
1745 | { |
1746 | - module.addOption("iterations", "Number of iterations to run per datagram, 0 means forever.", "COUNT", "1"); |
1747 | - module.addOption("packet_size", "Size of packets to send.", "SIZE", "4096"); |
1748 | + creator.add_option("iterations", _("Number of iterations to run per datagram, 0 means forever."), "COUNT", "1"); |
1749 | + creator.add_option("packet_size", _("Size of packets to send."), "SIZE", "4096"); |
1750 | } |
1751 | |
1752 | -Datagram::Datagram(Network::DatagramService& service): |
1753 | - Network::Datagram(service), |
1754 | - _iterations(_module.getOption("iterations").getSizeValue()), |
1755 | - _packet_size(_module.getOption("packet_size").getSizeValue()), |
1756 | +datagram::datagram(network::datagram_service& creator): |
1757 | + network::datagram(creator), |
1758 | + _iterations(_module.get_option("iterations").get_size_value()), |
1759 | + _packet_size(_module.get_option("packet_size").get_size_value()), |
1760 | _read_offset(), |
1761 | _write_offset() |
1762 | { |
1763 | } |
1764 | |
1765 | -Datagram::~Datagram() |
1766 | -{ |
1767 | -} |
1768 | - |
1769 | -void Datagram::ready(void) |
1770 | -{ |
1771 | - flushSend(); |
1772 | -} |
1773 | - |
1774 | -size_t Datagram::receive(uint8_t* buffer, size_t size, struct sockaddr&, socklen_t) |
1775 | +datagram::~datagram() |
1776 | +{ |
1777 | +} |
1778 | + |
1779 | +void datagram::ready(void) |
1780 | +{ |
1781 | + flush_send(); |
1782 | +} |
1783 | + |
1784 | +size_t datagram::receive(uint8_t* buffer, size_t size, struct sockaddr&, socklen_t) |
1785 | { |
1786 | if (memcmp(random_buffer + _read_offset, buffer, size)) |
1787 | - _module.logFatal("Received data did not match what was sent"); |
1788 | + _module.log_fatal(_("Received data did not match what was sent")); |
1789 | |
1790 | _read_offset += size; |
1791 | |
1792 | @@ -69,18 +72,18 @@ |
1793 | _read_offset = 0; |
1794 | _write_offset = 0; |
1795 | |
1796 | - flushSend(); |
1797 | + flush_send(); |
1798 | } |
1799 | else |
1800 | - _module.getCore().shutdown(); |
1801 | + _module.get_core().shutdown(); |
1802 | } |
1803 | else |
1804 | - flushSend(); |
1805 | + flush_send(); |
1806 | |
1807 | return size; |
1808 | } |
1809 | |
1810 | -void Datagram::flushSend(void) |
1811 | +void datagram::flush_send(void) |
1812 | { |
1813 | size_t packet_size; |
1814 | |
1815 | @@ -92,12 +95,12 @@ |
1816 | _write_offset += send(random_buffer + _write_offset, packet_size); |
1817 | } |
1818 | |
1819 | -void Datagram::error(void) |
1820 | +void datagram::error(void) |
1821 | { |
1822 | - _module.getCore().shutdown(); |
1823 | + _module.get_core().shutdown(); |
1824 | remove(); |
1825 | } |
1826 | |
1827 | -} /* namespace Flood */ |
1828 | -} /* namespace Echo */ |
1829 | -} /* namespace ScaleStack */ |
1830 | +} /* namespace flood */ |
1831 | +} /* namespace echo */ |
1832 | +} /* namespace scalestack */ |
1833 | |
1834 | === renamed file 'ScaleStack/Echo/Flood/Datagram.h' => 'scalestack/echo/flood/datagram.h' |
1835 | --- ScaleStack/Echo/Flood/Datagram.h 2010-05-16 06:20:02 +0000 |
1836 | +++ scalestack/echo/flood/datagram.h 2010-06-03 05:01:22 +0000 |
1837 | @@ -16,42 +16,46 @@ |
1838 | #ifndef SCALESTACK_ECHO_FLOOD_DATAGRAM_H |
1839 | #define SCALESTACK_ECHO_FLOOD_DATAGRAM_H |
1840 | |
1841 | -#include <ScaleStack/Common/Macros.h> |
1842 | -#include <ScaleStack/Network/Datagram.h> |
1843 | - |
1844 | -namespace ScaleStack { |
1845 | -namespace Kernel { |
1846 | - |
1847 | -class Module; |
1848 | - |
1849 | -} /* namespace Kernel */ |
1850 | - |
1851 | -namespace Echo { |
1852 | -namespace Flood { |
1853 | +#include <scalestack/common/macros.h> |
1854 | +#include <scalestack/network/datagram.h> |
1855 | + |
1856 | +namespace scalestack |
1857 | +{ |
1858 | +namespace kernel |
1859 | +{ |
1860 | + |
1861 | +class module; |
1862 | + |
1863 | +} /* namespace kernel */ |
1864 | + |
1865 | +namespace echo |
1866 | +{ |
1867 | +namespace flood |
1868 | +{ |
1869 | |
1870 | /** |
1871 | * Class for handling datagram requests. |
1872 | */ |
1873 | -class SCALESTACK_API Datagram: public Network::Datagram |
1874 | +class SCALESTACK_API datagram: public network::datagram |
1875 | { |
1876 | public: |
1877 | |
1878 | /** |
1879 | * Add common options for datagrams. |
1880 | */ |
1881 | - static void Options(Kernel::Module& module); |
1882 | - |
1883 | - Datagram(Network::DatagramService& service); |
1884 | - |
1885 | - ~Datagram(); |
1886 | + static void options(kernel::module& creator); |
1887 | + |
1888 | + datagram(network::datagram_service& creator); |
1889 | + |
1890 | + ~datagram(); |
1891 | |
1892 | /** |
1893 | - * See Network::Datagram::ready(). |
1894 | + * See network::datagram::ready(). |
1895 | */ |
1896 | void ready(void); |
1897 | |
1898 | /** |
1899 | - * See Network::Datagram::receive(). |
1900 | + * See network::datagram::receive(). |
1901 | */ |
1902 | size_t receive(uint8_t* buffer, |
1903 | size_t size, |
1904 | @@ -59,12 +63,12 @@ |
1905 | socklen_t peer_size); |
1906 | |
1907 | /** |
1908 | - * See Network::Datagram::flushSend(). |
1909 | + * See network::datagram::flush_send(). |
1910 | */ |
1911 | - void flushSend(void); |
1912 | + void flush_send(void); |
1913 | |
1914 | /** |
1915 | - * See Network::Datagram::error(). |
1916 | + * See network::datagram::error(). |
1917 | */ |
1918 | void error(void); |
1919 | |
1920 | @@ -73,12 +77,12 @@ |
1921 | /** |
1922 | * Don't allow copying of objects. |
1923 | */ |
1924 | - Datagram(const Datagram&); |
1925 | + datagram(const datagram&); |
1926 | |
1927 | /** |
1928 | * Don't allow assignment of objects. |
1929 | */ |
1930 | - Datagram& operator=(const Datagram&); |
1931 | + datagram& operator=(const datagram&); |
1932 | |
1933 | size_t _iterations; |
1934 | size_t _packet_size; |
1935 | @@ -86,8 +90,8 @@ |
1936 | size_t _write_offset; |
1937 | }; |
1938 | |
1939 | -} /* namespace Flood */ |
1940 | -} /* namespace Echo */ |
1941 | -} /* namespace ScaleStack */ |
1942 | +} /* namespace flood */ |
1943 | +} /* namespace echo */ |
1944 | +} /* namespace scalestack */ |
1945 | |
1946 | #endif /* SCALESTACK_ECHO_FLOOD_DATAGRAM_H */ |
1947 | |
1948 | === renamed file 'ScaleStack/Echo/Flood/Flood.cc' => 'scalestack/echo/flood/flood.cc' |
1949 | --- ScaleStack/Echo/Flood/Flood.cc 2010-05-02 23:02:34 +0000 |
1950 | +++ scalestack/echo/flood/flood.cc 2010-06-03 05:01:22 +0000 |
1951 | @@ -17,17 +17,17 @@ |
1952 | |
1953 | #include <cstdlib> |
1954 | |
1955 | -#include <ScaleStack/Echo/Flood/Flood.h> |
1956 | -#include <ScaleStack/Kernel/Module.h> |
1957 | - |
1958 | -using namespace ScaleStack; |
1959 | - |
1960 | -uint8_t Echo::Flood::random_buffer[Echo::Flood::random_buffer_size]; |
1961 | - |
1962 | -static void start(Kernel::Module&) |
1963 | +#include <scalestack/echo/flood/flood.h> |
1964 | +#include <scalestack/kernel/module.h> |
1965 | + |
1966 | +using namespace scalestack; |
1967 | + |
1968 | +uint8_t echo::flood::random_buffer[echo::flood::random_buffer_size]; |
1969 | + |
1970 | +static void start(kernel::module&) |
1971 | { |
1972 | - for (size_t index = 0; index < Echo::Flood::random_buffer_size; index++) |
1973 | - Echo::Flood::random_buffer[index] = static_cast<uint8_t>(rand()); |
1974 | + for (size_t index = 0; index < echo::flood::random_buffer_size; index++) |
1975 | + echo::flood::random_buffer[index] = static_cast<uint8_t>(rand()); |
1976 | } |
1977 | |
1978 | SCALESTACK_KERNEL_MODULE(NULL, start, NULL, NULL, NULL); |
1979 | |
1980 | === renamed file 'ScaleStack/Echo/Flood/Flood.h' => 'scalestack/echo/flood/flood.h' |
1981 | --- ScaleStack/Echo/Flood/Flood.h 2010-05-16 06:20:02 +0000 |
1982 | +++ scalestack/echo/flood/flood.h 2010-06-03 05:01:22 +0000 |
1983 | @@ -19,15 +19,18 @@ |
1984 | #include <stdint.h> |
1985 | #include <sys/types.h> |
1986 | |
1987 | -namespace ScaleStack { |
1988 | -namespace Echo { |
1989 | -namespace Flood { |
1990 | +namespace scalestack |
1991 | +{ |
1992 | +namespace echo |
1993 | +{ |
1994 | +namespace flood |
1995 | +{ |
1996 | |
1997 | const size_t random_buffer_size = 385637; |
1998 | extern uint8_t random_buffer[random_buffer_size]; |
1999 | |
2000 | -} /* namespace Flood */ |
2001 | -} /* namespace Echo */ |
2002 | -} /* namespace ScaleStack */ |
2003 | +} /* namespace flood */ |
2004 | +} /* namespace echo */ |
2005 | +} /* namespace scalestack */ |
2006 | |
2007 | #endif /* SCALESTACK_ECHO_FLOOD_FLOOD_H */ |
2008 | |
2009 | === renamed directory 'ScaleStack/Echo/Flood/UnixStream' => 'scalestack/echo/flood/local_stream' |
2010 | === renamed file 'ScaleStack/Echo/Flood/UnixStream/UnixStream.cc' => 'scalestack/echo/flood/local_stream/local_stream.cc' |
2011 | --- ScaleStack/Echo/Flood/UnixStream/UnixStream.cc 2010-05-16 06:20:02 +0000 |
2012 | +++ scalestack/echo/flood/local_stream/local_stream.cc 2010-06-03 05:01:22 +0000 |
2013 | @@ -10,33 +10,33 @@ |
2014 | |
2015 | /** |
2016 | * @file |
2017 | - * @brief Echo Flood Unix Stream Module Definitions |
2018 | + * @brief Echo Flood Local Stream Module Definitions |
2019 | */ |
2020 | |
2021 | #include "config.h" |
2022 | |
2023 | -#include <ScaleStack/Echo/Flood/Stream.h> |
2024 | -#include <ScaleStack/Echo/Flood/UnixStream/Service.h> |
2025 | -#include <ScaleStack/Kernel/Core.h> |
2026 | -#include <ScaleStack/Kernel/Module.h> |
2027 | -#include <ScaleStack/Kernel/Option.h> |
2028 | +#include <scalestack/echo/flood/stream.h> |
2029 | +#include <scalestack/echo/flood/local_stream/service.h> |
2030 | +#include <scalestack/kernel/core.h> |
2031 | +#include <scalestack/kernel/module.h> |
2032 | +#include <scalestack/kernel/option.h> |
2033 | |
2034 | using namespace std; |
2035 | -using namespace ScaleStack; |
2036 | +using namespace scalestack; |
2037 | |
2038 | -static void options(Kernel::Module& module) |
2039 | +static void options(kernel::module& current) |
2040 | { |
2041 | - module.addOption("unix_socket", "Unix socket to connect to.", "SOCKET", "/tmp/echoserver.socket"); |
2042 | - module.addOption("count", "Number of concurrent connections to open.", "COUNT", "1"); |
2043 | - Echo::Flood::Stream::Options(module); |
2044 | + current.add_option("local_socket", "Local socket to connect to.", "SOCKET", "/tmp/echoserver.socket"); |
2045 | + current.add_option("count", "Number of concurrent connections to open.", "COUNT", "1"); |
2046 | + echo::flood::stream::options(current); |
2047 | } |
2048 | |
2049 | -static void start(Kernel::Module& module) |
2050 | +static void start(kernel::module& current) |
2051 | { |
2052 | - Echo::Flood::UnixStream::Service* service = new Echo::Flood::UnixStream::Service(module); |
2053 | + echo::flood::local_stream::service* service = new echo::flood::local_stream::service(current); |
2054 | try |
2055 | { |
2056 | - module.getCore().addService("Echo::Flood::UnixStream", service); |
2057 | + current.get_core().add_service("echo::flood::local_stream", service); |
2058 | } |
2059 | catch (exception&) |
2060 | { |
2061 | @@ -45,20 +45,20 @@ |
2062 | } |
2063 | } |
2064 | |
2065 | -static void stop(Kernel::Module& module) |
2066 | +static void stop(kernel::module& current) |
2067 | { |
2068 | - delete module.getCore().removeService("Echo::Flood::UnixStream"); |
2069 | + delete current.get_core().remove_service("echo::flood::local_stream"); |
2070 | } |
2071 | |
2072 | -static void run(Kernel::Module& module) |
2073 | +static void run(kernel::module& current) |
2074 | { |
2075 | - Echo::Flood::UnixStream::Service& service = static_cast<Echo::Flood::UnixStream::Service&>(module.getCore().getService("Echo::Flood::UnixStream")); |
2076 | + echo::flood::local_stream::service& service = static_cast<echo::flood::local_stream::service&>(current.get_core().get_service("echo::flood::local_stream")); |
2077 | |
2078 | - for (int count = module.getOption("count").getIntValue(); |
2079 | + for (int count = current.get_option("count").get_int_value(); |
2080 | count != 0; |
2081 | --count) |
2082 | { |
2083 | - service.addConnect(module.getOption("unix_socket").getValue()); |
2084 | + service.add_connect(current.get_option("local_socket").get_value()); |
2085 | } |
2086 | } |
2087 | |
2088 | |
2089 | === modified file 'scalestack/echo/flood/local_stream/plugin.ini' |
2090 | --- ScaleStack/Echo/Flood/UnixStream/plugin.ini 2010-05-01 05:23:39 +0000 |
2091 | +++ scalestack/echo/flood/local_stream/plugin.ini 2010-06-03 05:01:22 +0000 |
2092 | @@ -1,9 +1,9 @@ |
2093 | [plugin] |
2094 | -title=Echo Flood Unix Stream Service |
2095 | -description=Unix stream service for the echo flood client. |
2096 | +title=Echo Flood Local Stream Service |
2097 | +description=Local stream service for the echo flood client. |
2098 | version=0.1 |
2099 | author=Eric Day <eday@oddments.org> |
2100 | license=BSD |
2101 | -sources=Service.cc UnixStream.cc |
2102 | -headers=Service.h |
2103 | -dependencies=Echo::Flood Network::Unix::Stream |
2104 | +sources=service.cc local_stream.cc |
2105 | +headers=service.h |
2106 | +dependencies=echo::flood network::local::stream |
2107 | |
2108 | === renamed file 'ScaleStack/Echo/Flood/UnixStream/Service.cc' => 'scalestack/echo/flood/local_stream/service.cc' |
2109 | --- ScaleStack/Echo/Flood/UnixStream/Service.cc 2010-05-01 05:23:39 +0000 |
2110 | +++ scalestack/echo/flood/local_stream/service.cc 2010-06-03 05:01:22 +0000 |
2111 | @@ -10,44 +10,48 @@ |
2112 | |
2113 | /** |
2114 | * @file |
2115 | - * @brief Echo Flood Unix Stream Service Definitions |
2116 | + * @brief Echo Flood Local Stream Service Definitions |
2117 | */ |
2118 | |
2119 | #include "config.h" |
2120 | |
2121 | -#include <ScaleStack/Echo/Flood/Stream.h> |
2122 | -#include <ScaleStack/Echo/Flood/UnixStream/Service.h> |
2123 | +#include <scalestack/echo/flood/stream.h> |
2124 | +#include <scalestack/echo/flood/local_stream/service.h> |
2125 | |
2126 | -namespace ScaleStack { |
2127 | -namespace Echo { |
2128 | -namespace Flood { |
2129 | -namespace UnixStream { |
2130 | +namespace scalestack |
2131 | +{ |
2132 | +namespace echo |
2133 | +{ |
2134 | +namespace flood |
2135 | +{ |
2136 | +namespace local_stream |
2137 | +{ |
2138 | |
2139 | /* |
2140 | * Public functions. |
2141 | */ |
2142 | |
2143 | -Service::Service(Kernel::Module& module): |
2144 | - Network::Unix::Stream::ConnectionService(module) |
2145 | +service::service(kernel::module& creator): |
2146 | + network::local::stream::connection_service(creator) |
2147 | { |
2148 | } |
2149 | |
2150 | -Service::~Service() |
2151 | +service::~service() |
2152 | { |
2153 | shutdown(); |
2154 | } |
2155 | |
2156 | -Network::Stream* Service::addStream(void) |
2157 | +network::stream* service::add_stream(void) |
2158 | { |
2159 | - return new Stream(*this); |
2160 | + return new stream(*this); |
2161 | } |
2162 | |
2163 | -void Service::removeStream(Network::Stream* stream) |
2164 | +void service::remove_stream(network::stream* stream) |
2165 | { |
2166 | delete stream; |
2167 | } |
2168 | |
2169 | -} /* namespace UnixStream */ |
2170 | -} /* namespace Flood */ |
2171 | -} /* namespace Echo */ |
2172 | -} /* namespace ScaleStack */ |
2173 | +} /* namespace local_stream */ |
2174 | +} /* namespace flood */ |
2175 | +} /* namespace echo */ |
2176 | +} /* namespace scalestack */ |
2177 | |
2178 | === renamed file 'ScaleStack/Echo/Flood/UnixStream/Service.h' => 'scalestack/echo/flood/local_stream/service.h' |
2179 | --- ScaleStack/Echo/Flood/UnixStream/Service.h 2010-05-01 05:23:39 +0000 |
2180 | +++ scalestack/echo/flood/local_stream/service.h 2010-06-03 05:01:22 +0000 |
2181 | @@ -10,53 +10,57 @@ |
2182 | |
2183 | /** |
2184 | * @file |
2185 | - * @brief Echo Flood Unix Stream Service Declarations |
2186 | + * @brief Echo Flood Local Stream Service Declarations |
2187 | */ |
2188 | |
2189 | -#ifndef SCALESTACK_ECHO_FLOOD_UNIXSTREAM_SERVICE_H |
2190 | -#define SCALESTACK_ECHO_FLOOD_UNIXSTREAM_SERVICE_H |
2191 | - |
2192 | -#include <ScaleStack/Network/Unix/Stream/ConnectionService.h> |
2193 | - |
2194 | -namespace ScaleStack { |
2195 | -namespace Echo { |
2196 | -namespace Flood { |
2197 | -namespace UnixStream { |
2198 | - |
2199 | -class Service: public Network::Unix::Stream::ConnectionService |
2200 | +#ifndef SCALESTACK_ECHO_FLOOD_LOCAL_STREAM_SERVICE_H |
2201 | +#define SCALESTACK_ECHO_FLOOD_LOCAL_STREAM_SERVICE_H |
2202 | + |
2203 | +#include <scalestack/network/local/stream/connection_service.h> |
2204 | + |
2205 | +namespace scalestack |
2206 | +{ |
2207 | +namespace echo |
2208 | +{ |
2209 | +namespace flood |
2210 | +{ |
2211 | +namespace local_stream |
2212 | +{ |
2213 | + |
2214 | +class service: public network::local::stream::connection_service |
2215 | { |
2216 | public: |
2217 | |
2218 | - Service(Kernel::Module& module); |
2219 | - |
2220 | - ~Service(); |
2221 | - |
2222 | - /** |
2223 | - * See Network::StreamService::addStream(). |
2224 | - */ |
2225 | - Network::Stream *addStream(void); |
2226 | - |
2227 | - /** |
2228 | - * See Network::StreamService::removeStream(). |
2229 | - */ |
2230 | - void removeStream(Network::Stream* stream); |
2231 | + service(kernel::module& creator); |
2232 | + |
2233 | + ~service(); |
2234 | + |
2235 | + /** |
2236 | + * See network::stream_service::add_stream(). |
2237 | + */ |
2238 | + network::stream *add_stream(void); |
2239 | + |
2240 | + /** |
2241 | + * See network::stream_service::remove_stream(). |
2242 | + */ |
2243 | + void remove_stream(network::stream* stream); |
2244 | |
2245 | private: |
2246 | |
2247 | /** |
2248 | * Don't allow copying of objects. |
2249 | */ |
2250 | - Service(const Service&); |
2251 | + service(const service&); |
2252 | |
2253 | /** |
2254 | * Don't allow assignment of objects. |
2255 | */ |
2256 | - Service& operator=(const Service&); |
2257 | + service& operator=(const service&); |
2258 | }; |
2259 | |
2260 | -} /* namespace UnixStream */ |
2261 | -} /* namespace Flood */ |
2262 | -} /* namespace Echo */ |
2263 | -} /* namespace ScaleStack */ |
2264 | +} /* namespace local_stream */ |
2265 | +} /* namespace flood */ |
2266 | +} /* namespace echo */ |
2267 | +} /* namespace scalestack */ |
2268 | |
2269 | -#endif /* SCALESTACK_ECHO_FLOOD_UNIXSTREAM_SERVICE_H */ |
2270 | +#endif /* SCALESTACK_ECHO_FLOOD_LOCAL_STREAM_SERVICE_H */ |
2271 | |
2272 | === modified file 'scalestack/echo/flood/plugin.ini' |
2273 | --- ScaleStack/Echo/Flood/plugin.ini 2010-05-16 06:20:02 +0000 |
2274 | +++ scalestack/echo/flood/plugin.ini 2010-06-03 05:01:22 +0000 |
2275 | @@ -4,6 +4,6 @@ |
2276 | version=0.1 |
2277 | author=Eric Day <eday@oddments.org> |
2278 | license=BSD |
2279 | -sources=Datagram.cc Flood.cc Stream.cc |
2280 | -headers=Datagram.h Flood.h Stream.h |
2281 | -dependencies=Network |
2282 | +sources=datagram.cc flood.cc stream.cc |
2283 | +headers=datagram.h flood.h stream.h |
2284 | +dependencies=network |
2285 | |
2286 | === renamed file 'ScaleStack/Echo/Flood/Stream.cc' => 'scalestack/echo/flood/stream.cc' |
2287 | --- ScaleStack/Echo/Flood/Stream.cc 2010-05-16 06:20:02 +0000 |
2288 | +++ scalestack/echo/flood/stream.cc 2010-06-03 05:01:22 +0000 |
2289 | @@ -17,47 +17,50 @@ |
2290 | |
2291 | #include <cstring> |
2292 | |
2293 | -#include <ScaleStack/Echo/Flood/Flood.h> |
2294 | -#include <ScaleStack/Echo/Flood/Stream.h> |
2295 | -#include <ScaleStack/Kernel/Core.h> |
2296 | -#include <ScaleStack/Kernel/Module.h> |
2297 | -#include <ScaleStack/Kernel/Option.h> |
2298 | +#include <scalestack/echo/flood/flood.h> |
2299 | +#include <scalestack/echo/flood/stream.h> |
2300 | +#include <scalestack/kernel/core.h> |
2301 | +#include <scalestack/kernel/module.h> |
2302 | +#include <scalestack/kernel/option.h> |
2303 | |
2304 | -namespace ScaleStack { |
2305 | -namespace Echo { |
2306 | -namespace Flood { |
2307 | +namespace scalestack |
2308 | +{ |
2309 | +namespace echo |
2310 | +{ |
2311 | +namespace flood |
2312 | +{ |
2313 | |
2314 | /* |
2315 | * Public methods. |
2316 | */ |
2317 | |
2318 | -void Stream::Options(Kernel::Module& module) |
2319 | +void stream::options(kernel::module& creator) |
2320 | { |
2321 | - module.addOption("iterations", "Number of iterations to run per stream, 0 means forever.", "COUNT", "1"); |
2322 | - module.addOption("reconnect", "Whether to reconnect between iterations.", "BOOLEAN", "False"); |
2323 | + creator.add_option("iterations", _("Number of iterations to run per stream, 0 means forever."), "COUNT", "1"); |
2324 | + creator.add_option("reconnect", _("Whether to reconnect between iterations."), "BOOLEAN", "False"); |
2325 | } |
2326 | |
2327 | -Stream::Stream(Network::StreamService& service): |
2328 | - Network::Stream(service), |
2329 | - _iterations(_module.getOption("iterations").getSizeValue()), |
2330 | +stream::stream(network::stream_service& creator): |
2331 | + network::stream(creator), |
2332 | + _iterations(_module.get_option("iterations").get_size_value()), |
2333 | _read_offset(), |
2334 | _write_offset() |
2335 | { |
2336 | } |
2337 | |
2338 | -Stream::~Stream() |
2339 | -{ |
2340 | -} |
2341 | - |
2342 | -void Stream::connected(void) |
2343 | -{ |
2344 | - flushWrite(); |
2345 | -} |
2346 | - |
2347 | -size_t Stream::read(uint8_t* buffer, size_t size) |
2348 | +stream::~stream() |
2349 | +{ |
2350 | +} |
2351 | + |
2352 | +void stream::connected(void) |
2353 | +{ |
2354 | + flush_write(); |
2355 | +} |
2356 | + |
2357 | +size_t stream::read(uint8_t* buffer, size_t size) |
2358 | { |
2359 | if (memcmp(random_buffer + _read_offset, buffer, size)) |
2360 | - _module.logFatal("Read data did not match what was sent"); |
2361 | + _module.log_fatal(_("Read data did not match what was sent")); |
2362 | |
2363 | _read_offset += size; |
2364 | |
2365 | @@ -68,31 +71,31 @@ |
2366 | _read_offset = 0; |
2367 | _write_offset = 0; |
2368 | |
2369 | - if (_module.getOption("reconnect").getBoolValue()) |
2370 | + if (_module.get_option("reconnect").get_bool_value()) |
2371 | reconnect(); |
2372 | else |
2373 | - flushWrite(); |
2374 | + flush_write(); |
2375 | } |
2376 | else |
2377 | - _module.getCore().shutdown(); |
2378 | + _module.get_core().shutdown(); |
2379 | } |
2380 | |
2381 | return size; |
2382 | } |
2383 | |
2384 | -void Stream::flushWrite(void) |
2385 | +void stream::flush_write(void) |
2386 | { |
2387 | _write_offset += write(random_buffer + _write_offset, |
2388 | random_buffer_size - _write_offset, |
2389 | true); |
2390 | } |
2391 | |
2392 | -void Stream::error(void) |
2393 | +void stream::error(void) |
2394 | { |
2395 | - _module.getCore().shutdown(); |
2396 | + _module.get_core().shutdown(); |
2397 | remove(); |
2398 | } |
2399 | |
2400 | -} /* namespace Flood */ |
2401 | -} /* namespace Echo */ |
2402 | -} /* namespace ScaleStack */ |
2403 | +} /* namespace flood */ |
2404 | +} /* namespace echo */ |
2405 | +} /* namespace scalestack */ |
2406 | |
2407 | === renamed file 'ScaleStack/Echo/Flood/Stream.h' => 'scalestack/echo/flood/stream.h' |
2408 | --- ScaleStack/Echo/Flood/Stream.h 2010-05-16 06:20:02 +0000 |
2409 | +++ scalestack/echo/flood/stream.h 2010-06-03 05:01:22 +0000 |
2410 | @@ -16,52 +16,56 @@ |
2411 | #ifndef SCALESTACK_ECHO_FLOOD_STREAM_H |
2412 | #define SCALESTACK_ECHO_FLOOD_STREAM_H |
2413 | |
2414 | -#include <ScaleStack/Common/Macros.h> |
2415 | -#include <ScaleStack/Network/Stream.h> |
2416 | - |
2417 | -namespace ScaleStack { |
2418 | -namespace Kernel { |
2419 | - |
2420 | -class Module; |
2421 | - |
2422 | -} /* namespace Kernel */ |
2423 | - |
2424 | -namespace Echo { |
2425 | -namespace Flood { |
2426 | +#include <scalestack/common/macros.h> |
2427 | +#include <scalestack/network/stream.h> |
2428 | + |
2429 | +namespace scalestack |
2430 | +{ |
2431 | +namespace kernel |
2432 | +{ |
2433 | + |
2434 | +class module; |
2435 | + |
2436 | +} /* namespace kernel */ |
2437 | + |
2438 | +namespace echo |
2439 | +{ |
2440 | +namespace flood |
2441 | +{ |
2442 | |
2443 | /** |
2444 | * Class for handling stream requests. |
2445 | */ |
2446 | -class SCALESTACK_API Stream: public Network::Stream |
2447 | +class SCALESTACK_API stream: public network::stream |
2448 | { |
2449 | public: |
2450 | |
2451 | /** |
2452 | * Add common options for streams. |
2453 | */ |
2454 | - static void Options(Kernel::Module& module); |
2455 | - |
2456 | - Stream(Network::StreamService& service); |
2457 | - |
2458 | - ~Stream(); |
2459 | + static void options(kernel::module& creator); |
2460 | + |
2461 | + stream(network::stream_service& creator); |
2462 | + |
2463 | + ~stream(); |
2464 | |
2465 | /** |
2466 | - * See Network::Stream::connected(). |
2467 | + * See network::stream::connected(). |
2468 | */ |
2469 | void connected(void); |
2470 | |
2471 | /** |
2472 | - * See Network::Stream::read(). |
2473 | + * See network::stream::read(). |
2474 | */ |
2475 | size_t read(uint8_t* buffer, size_t size); |
2476 | |
2477 | /** |
2478 | - * See Network::Stream::flushWrite(). |
2479 | + * See network::stream::flush_write(). |
2480 | */ |
2481 | - void flushWrite(void); |
2482 | + void flush_write(void); |
2483 | |
2484 | /** |
2485 | - * See Network::Stream::error(). |
2486 | + * See network::stream::error(). |
2487 | */ |
2488 | void error(void); |
2489 | |
2490 | @@ -70,20 +74,20 @@ |
2491 | /** |
2492 | * Don't allow copying of objects. |
2493 | */ |
2494 | - Stream(const Stream&); |
2495 | + stream(const stream&); |
2496 | |
2497 | /** |
2498 | * Don't allow assignment of objects. |
2499 | */ |
2500 | - Stream& operator=(const Stream&); |
2501 | + stream& operator=(const stream&); |
2502 | |
2503 | size_t _iterations; |
2504 | size_t _read_offset; |
2505 | size_t _write_offset; |
2506 | }; |
2507 | |
2508 | -} /* namespace Flood */ |
2509 | -} /* namespace Echo */ |
2510 | -} /* namespace ScaleStack */ |
2511 | +} /* namespace flood */ |
2512 | +} /* namespace echo */ |
2513 | +} /* namespace scalestack */ |
2514 | |
2515 | #endif /* SCALESTACK_ECHO_FLOOD_STREAM_H */ |
2516 | |
2517 | === renamed directory 'ScaleStack/Echo/Flood/TCP' => 'scalestack/echo/flood/tcp' |
2518 | === modified file 'scalestack/echo/flood/tcp/plugin.ini' |
2519 | --- ScaleStack/Echo/Flood/TCP/plugin.ini 2010-05-01 05:23:39 +0000 |
2520 | +++ scalestack/echo/flood/tcp/plugin.ini 2010-06-03 05:01:22 +0000 |
2521 | @@ -4,6 +4,6 @@ |
2522 | version=0.1 |
2523 | author=Eric Day <eday@oddments.org> |
2524 | license=BSD |
2525 | -sources=Service.cc TCP.cc |
2526 | -headers=Service.h |
2527 | -dependencies=Echo::Flood Network::IP::TCP |
2528 | +sources=service.cc tcp.cc |
2529 | +headers=service.h |
2530 | +dependencies=echo::flood network::ip::tcp |
2531 | |
2532 | === renamed file 'ScaleStack/Echo/Flood/TCP/Service.cc' => 'scalestack/echo/flood/tcp/service.cc' |
2533 | --- ScaleStack/Echo/Flood/TCP/Service.cc 2010-05-01 05:23:39 +0000 |
2534 | +++ scalestack/echo/flood/tcp/service.cc 2010-06-03 05:01:22 +0000 |
2535 | @@ -15,39 +15,43 @@ |
2536 | |
2537 | #include "config.h" |
2538 | |
2539 | -#include <ScaleStack/Echo/Flood/Stream.h> |
2540 | -#include <ScaleStack/Echo/Flood/TCP/Service.h> |
2541 | +#include <scalestack/echo/flood/stream.h> |
2542 | +#include <scalestack/echo/flood/tcp/service.h> |
2543 | |
2544 | -namespace ScaleStack { |
2545 | -namespace Echo { |
2546 | -namespace Flood { |
2547 | -namespace TCP { |
2548 | +namespace scalestack |
2549 | +{ |
2550 | +namespace echo |
2551 | +{ |
2552 | +namespace flood |
2553 | +{ |
2554 | +namespace tcp |
2555 | +{ |
2556 | |
2557 | /* |
2558 | * Public functions. |
2559 | */ |
2560 | |
2561 | -Service::Service(Kernel::Module& module): |
2562 | - Network::IP::TCP::ConnectionService(module) |
2563 | +service::service(kernel::module& creator): |
2564 | + network::ip::tcp::connection_service(creator) |
2565 | { |
2566 | } |
2567 | |
2568 | -Service::~Service() |
2569 | +service::~service() |
2570 | { |
2571 | shutdown(); |
2572 | } |
2573 | |
2574 | -Network::Stream* Service::addStream(void) |
2575 | -{ |
2576 | - return new Stream(*this); |
2577 | -} |
2578 | - |
2579 | -void Service::removeStream(Network::Stream* stream) |
2580 | -{ |
2581 | - delete stream; |
2582 | -} |
2583 | - |
2584 | -} /* namespace TCP */ |
2585 | -} /* namespace Flood */ |
2586 | -} /* namespace Echo */ |
2587 | -} /* namespace ScaleStack */ |
2588 | +network::stream* service::add_stream(void) |
2589 | +{ |
2590 | + return new stream(*this); |
2591 | +} |
2592 | + |
2593 | +void service::remove_stream(network::stream* old_stream) |
2594 | +{ |
2595 | + delete old_stream; |
2596 | +} |
2597 | + |
2598 | +} /* namespace tcp */ |
2599 | +} /* namespace flood */ |
2600 | +} /* namespace echo */ |
2601 | +} /* namespace scalestack */ |
2602 | |
2603 | === renamed file 'ScaleStack/Echo/Flood/TCP/Service.h' => 'scalestack/echo/flood/tcp/service.h' |
2604 | --- ScaleStack/Echo/Flood/TCP/Service.h 2010-05-02 23:02:34 +0000 |
2605 | +++ scalestack/echo/flood/tcp/service.h 2010-06-03 05:01:22 +0000 |
2606 | @@ -16,47 +16,51 @@ |
2607 | #ifndef SCALESTACK_ECHO_FLOOD_TCP_SERVICE_H |
2608 | #define SCALESTACK_ECHO_FLOOD_TCP_SERVICE_H |
2609 | |
2610 | -#include <ScaleStack/Network/IP/TCP/ConnectionService.h> |
2611 | - |
2612 | -namespace ScaleStack { |
2613 | -namespace Echo { |
2614 | -namespace Flood { |
2615 | -namespace TCP { |
2616 | - |
2617 | -class Service: public Network::IP::TCP::ConnectionService |
2618 | +#include <scalestack/network/ip/tcp/connection_service.h> |
2619 | + |
2620 | +namespace scalestack |
2621 | +{ |
2622 | +namespace echo |
2623 | +{ |
2624 | +namespace flood |
2625 | +{ |
2626 | +namespace tcp |
2627 | +{ |
2628 | + |
2629 | +class service: public network::ip::tcp::connection_service |
2630 | { |
2631 | public: |
2632 | |
2633 | - Service(Kernel::Module& module); |
2634 | - |
2635 | - ~Service(); |
2636 | - |
2637 | - /** |
2638 | - * See Network::StreamService::addStream(). |
2639 | - */ |
2640 | - Network::Stream* addStream(void); |
2641 | - |
2642 | - /** |
2643 | - * See Network::StreamService::removeStream(). |
2644 | - */ |
2645 | - void removeStream(Network::Stream* stream); |
2646 | + service(kernel::module& creator); |
2647 | + |
2648 | + ~service(); |
2649 | + |
2650 | + /** |
2651 | + * See network::stream_service::add_stream(). |
2652 | + */ |
2653 | + network::stream* add_stream(void); |
2654 | + |
2655 | + /** |
2656 | + * See network::stream_service::remove_stream(). |
2657 | + */ |
2658 | + void remove_stream(network::stream* old_stream); |
2659 | |
2660 | private: |
2661 | |
2662 | /** |
2663 | * Don't allow copying of objects. |
2664 | */ |
2665 | - Service(const Service&); |
2666 | + service(const service&); |
2667 | |
2668 | /** |
2669 | * Don't allow assignment of objects. |
2670 | */ |
2671 | - Service& operator=(const Service&); |
2672 | + service& operator=(const service&); |
2673 | }; |
2674 | |
2675 | -} /* namespace TCP */ |
2676 | -} /* namespace Flood */ |
2677 | -} /* namespace Echo */ |
2678 | -} /* namespace ScaleStack */ |
2679 | +} /* namespace tcp */ |
2680 | +} /* namespace flood */ |
2681 | +} /* namespace echo */ |
2682 | +} /* namespace scalestack */ |
2683 | |
2684 | #endif /* SCALESTACK_ECHO_FLOOD_TCP_SERVICE_H */ |
2685 | |
2686 | === renamed file 'ScaleStack/Echo/Flood/TCP/TCP.cc' => 'scalestack/echo/flood/tcp/tcp.cc' |
2687 | --- ScaleStack/Echo/Flood/TCP/TCP.cc 2010-05-16 06:20:02 +0000 |
2688 | +++ scalestack/echo/flood/tcp/tcp.cc 2010-06-03 05:01:22 +0000 |
2689 | @@ -15,29 +15,29 @@ |
2690 | |
2691 | #include "config.h" |
2692 | |
2693 | -#include <ScaleStack/Echo/Flood/Stream.h> |
2694 | -#include <ScaleStack/Echo/Flood/TCP/Service.h> |
2695 | -#include <ScaleStack/Kernel/Core.h> |
2696 | -#include <ScaleStack/Kernel/Module.h> |
2697 | -#include <ScaleStack/Kernel/Option.h> |
2698 | +#include <scalestack/echo/flood/stream.h> |
2699 | +#include <scalestack/echo/flood/tcp/service.h> |
2700 | +#include <scalestack/kernel/core.h> |
2701 | +#include <scalestack/kernel/module.h> |
2702 | +#include <scalestack/kernel/option.h> |
2703 | |
2704 | using namespace std; |
2705 | -using namespace ScaleStack; |
2706 | +using namespace scalestack; |
2707 | |
2708 | -static void options(Kernel::Module& module) |
2709 | +static void options(kernel::module& current) |
2710 | { |
2711 | - module.addOption("host", "Host to connect to.", "HOST", "localhost"); |
2712 | - module.addOption("port", "Port to connect to.", "PORT", "7"); |
2713 | - module.addOption("count", "Number of concurrent connections to open.", "COUNT", "1"); |
2714 | - Echo::Flood::Stream::Options(module); |
2715 | + current.add_option("host", _("Host to connect to."), "HOST", "localhost"); |
2716 | + current.add_option("port", _("Port to connect to."), "PORT", "7"); |
2717 | + current.add_option("count", _("Number of concurrent connections to open."), "COUNT", "1"); |
2718 | + echo::flood::stream::options(current); |
2719 | } |
2720 | |
2721 | -static void start(Kernel::Module& module) |
2722 | +static void start(kernel::module& current) |
2723 | { |
2724 | - Echo::Flood::TCP::Service* service = new Echo::Flood::TCP::Service(module); |
2725 | + echo::flood::tcp::service* service = new echo::flood::tcp::service(current); |
2726 | try |
2727 | { |
2728 | - module.getCore().addService("Echo::Flood::TCP", service); |
2729 | + current.get_core().add_service("echo::flood::tcp", service); |
2730 | } |
2731 | catch (exception&) |
2732 | { |
2733 | @@ -46,21 +46,21 @@ |
2734 | } |
2735 | } |
2736 | |
2737 | -static void stop(Kernel::Module& module) |
2738 | +static void stop(kernel::module& current) |
2739 | { |
2740 | - delete module.getCore().removeService("Echo::Flood::TCP"); |
2741 | + delete current.get_core().remove_service("echo::flood::tcp"); |
2742 | } |
2743 | |
2744 | -static void run(Kernel::Module& module) |
2745 | +static void run(kernel::module& current) |
2746 | { |
2747 | - Echo::Flood::TCP::Service& service = static_cast<Echo::Flood::TCP::Service&>(module.getCore().getService("Echo::Flood::TCP")); |
2748 | + echo::flood::tcp::service& service = static_cast<echo::flood::tcp::service&>(current.get_core().get_service("echo::flood::tcp")); |
2749 | |
2750 | - for (int count = module.getOption("count").getIntValue(); |
2751 | + for (int count = current.get_option("count").get_int_value(); |
2752 | count != 0; |
2753 | --count) |
2754 | { |
2755 | - service.addConnect(module.getOption("host").getValue(), |
2756 | - module.getOption("port").getValue()); |
2757 | + service.add_connect(current.get_option("host").get_value(), |
2758 | + current.get_option("port").get_value()); |
2759 | } |
2760 | } |
2761 | |
2762 | |
2763 | === renamed directory 'ScaleStack/Echo/Flood/UDP' => 'scalestack/echo/flood/udp' |
2764 | === modified file 'scalestack/echo/flood/udp/plugin.ini' |
2765 | --- ScaleStack/Echo/Flood/UDP/plugin.ini 2010-05-02 23:02:34 +0000 |
2766 | +++ scalestack/echo/flood/udp/plugin.ini 2010-06-03 05:01:22 +0000 |
2767 | @@ -4,6 +4,6 @@ |
2768 | version=0.1 |
2769 | author=Chris Behrens <cbehrens@codestud.com> |
2770 | license=BSD |
2771 | -sources=Service.cc UDP.cc |
2772 | -headers=Service.h |
2773 | -dependencies=Echo::Flood Network::IP::UDP |
2774 | +sources=service.cc udp.cc |
2775 | +headers=service.h |
2776 | +dependencies=echo::flood network::ip::udp |
2777 | |
2778 | === renamed file 'ScaleStack/Echo/Flood/UDP/Service.cc' => 'scalestack/echo/flood/udp/service.cc' |
2779 | --- ScaleStack/Echo/Flood/UDP/Service.cc 2010-05-16 06:20:02 +0000 |
2780 | +++ scalestack/echo/flood/udp/service.cc 2010-06-03 05:01:22 +0000 |
2781 | @@ -15,39 +15,43 @@ |
2782 | |
2783 | #include "config.h" |
2784 | |
2785 | -#include <ScaleStack/Echo/Flood/Datagram.h> |
2786 | -#include <ScaleStack/Echo/Flood/UDP/Service.h> |
2787 | +#include <scalestack/echo/flood/datagram.h> |
2788 | +#include <scalestack/echo/flood/udp/service.h> |
2789 | |
2790 | -namespace ScaleStack { |
2791 | -namespace Echo { |
2792 | -namespace Flood { |
2793 | -namespace UDP { |
2794 | +namespace scalestack |
2795 | +{ |
2796 | +namespace echo |
2797 | +{ |
2798 | +namespace flood |
2799 | +{ |
2800 | +namespace udp |
2801 | +{ |
2802 | |
2803 | /* |
2804 | * Public functions. |
2805 | */ |
2806 | |
2807 | -Service::Service(Kernel::Module& module): |
2808 | - Network::IP::UDP::SocketService(module) |
2809 | +service::service(kernel::module& creator): |
2810 | + network::ip::udp::socket_service(creator) |
2811 | { |
2812 | } |
2813 | |
2814 | -Service::~Service() |
2815 | +service::~service() |
2816 | { |
2817 | shutdown(); |
2818 | } |
2819 | |
2820 | -Network::Datagram* Service::addDatagram(void) |
2821 | -{ |
2822 | - return new Datagram(*this); |
2823 | -} |
2824 | - |
2825 | -void Service::removeDatagram(Network::Datagram* datagram) |
2826 | -{ |
2827 | - delete datagram; |
2828 | -} |
2829 | - |
2830 | -} /* namespace UDP */ |
2831 | -} /* namespace Flood */ |
2832 | -} /* namespace Echo */ |
2833 | -} /* namespace ScaleStack */ |
2834 | +network::datagram* service::add_datagram(void) |
2835 | +{ |
2836 | + return new datagram(*this); |
2837 | +} |
2838 | + |
2839 | +void service::remove_datagram(network::datagram* old_datagram) |
2840 | +{ |
2841 | + delete old_datagram; |
2842 | +} |
2843 | + |
2844 | +} /* namespace udp */ |
2845 | +} /* namespace flood */ |
2846 | +} /* namespace echo */ |
2847 | +} /* namespace scalestack */ |
2848 | |
2849 | === renamed file 'ScaleStack/Echo/Flood/UDP/Service.h' => 'scalestack/echo/flood/udp/service.h' |
2850 | --- ScaleStack/Echo/Flood/UDP/Service.h 2010-05-16 06:20:02 +0000 |
2851 | +++ scalestack/echo/flood/udp/service.h 2010-06-03 05:01:22 +0000 |
2852 | @@ -16,47 +16,51 @@ |
2853 | #ifndef SCALESTACK_ECHO_FLOOD_UDP_SERVICE_H |
2854 | #define SCALESTACK_ECHO_FLOOD_UDP_SERVICE_H |
2855 | |
2856 | -#include <ScaleStack/Network/IP/UDP/SocketService.h> |
2857 | - |
2858 | -namespace ScaleStack { |
2859 | -namespace Echo { |
2860 | -namespace Flood { |
2861 | -namespace UDP { |
2862 | - |
2863 | -class Service: public Network::IP::UDP::SocketService |
2864 | +#include <scalestack/network/ip/udp/socket_service.h> |
2865 | + |
2866 | +namespace scalestack |
2867 | +{ |
2868 | +namespace echo |
2869 | +{ |
2870 | +namespace flood |
2871 | +{ |
2872 | +namespace udp |
2873 | +{ |
2874 | + |
2875 | +class service: public network::ip::udp::socket_service |
2876 | { |
2877 | public: |
2878 | |
2879 | - Service(Kernel::Module& module); |
2880 | - |
2881 | - ~Service(); |
2882 | - |
2883 | - /** |
2884 | - * See Network::DatagramService::addDatagram(). |
2885 | - */ |
2886 | - Network::Datagram* addDatagram(void); |
2887 | - |
2888 | - /** |
2889 | - * See Network::DatagramService::removeDatagram(). |
2890 | - */ |
2891 | - void removeDatagram(Network::Datagram* datagram); |
2892 | + service(kernel::module& creator); |
2893 | + |
2894 | + ~service(); |
2895 | + |
2896 | + /** |
2897 | + * See network::datagram_service::add_datagram(). |
2898 | + */ |
2899 | + network::datagram* add_datagram(void); |
2900 | + |
2901 | + /** |
2902 | + * See network::datagram_service::remove_datagram(). |
2903 | + */ |
2904 | + void remove_datagram(network::datagram* old_datagram); |
2905 | |
2906 | private: |
2907 | |
2908 | /** |
2909 | * Don't allow copying of objects. |
2910 | */ |
2911 | - Service(const Service&); |
2912 | + service(const service&); |
2913 | |
2914 | /** |
2915 | * Don't allow assignment of objects. |
2916 | */ |
2917 | - Service& operator=(const Service&); |
2918 | + service& operator=(const service&); |
2919 | }; |
2920 | |
2921 | -} /* namespace UDP */ |
2922 | -} /* namespace Flood */ |
2923 | -} /* namespace Echo */ |
2924 | -} /* namespace ScaleStack */ |
2925 | +} /* namespace udp */ |
2926 | +} /* namespace flood */ |
2927 | +} /* namespace echo */ |
2928 | +} /* namespace scalestack */ |
2929 | |
2930 | #endif /* SCALESTACK_ECHO_FLOOD_UDP_SERVICE_H */ |
2931 | |
2932 | === renamed file 'ScaleStack/Echo/Flood/UDP/UDP.cc' => 'scalestack/echo/flood/udp/udp.cc' |
2933 | --- ScaleStack/Echo/Flood/UDP/UDP.cc 2010-05-16 06:20:02 +0000 |
2934 | +++ scalestack/echo/flood/udp/udp.cc 2010-06-03 05:01:22 +0000 |
2935 | @@ -15,28 +15,28 @@ |
2936 | |
2937 | #include "config.h" |
2938 | |
2939 | -#include <ScaleStack/Echo/Flood/Datagram.h> |
2940 | -#include <ScaleStack/Echo/Flood/UDP/Service.h> |
2941 | -#include <ScaleStack/Kernel/Core.h> |
2942 | -#include <ScaleStack/Kernel/Module.h> |
2943 | -#include <ScaleStack/Kernel/Option.h> |
2944 | +#include <scalestack/echo/flood/datagram.h> |
2945 | +#include <scalestack/echo/flood/udp/service.h> |
2946 | +#include <scalestack/kernel/core.h> |
2947 | +#include <scalestack/kernel/module.h> |
2948 | +#include <scalestack/kernel/option.h> |
2949 | |
2950 | using namespace std; |
2951 | -using namespace ScaleStack; |
2952 | +using namespace scalestack; |
2953 | |
2954 | -static void options(Kernel::Module& module) |
2955 | +static void options(kernel::module& current) |
2956 | { |
2957 | - Network::IP::UDP::SocketService::Options(module, ":7"); |
2958 | - module.addOption("count", "Number of concurrent sockets to open.", "COUNT", "1"); |
2959 | - Echo::Flood::Datagram::Options(module); |
2960 | + network::ip::udp::socket_service::options(current, ":7"); |
2961 | + current.add_option("count", _("Number of concurrent sockets to open."), "COUNT", "1"); |
2962 | + echo::flood::datagram::options(current); |
2963 | } |
2964 | |
2965 | -static void start(Kernel::Module& module) |
2966 | +static void start(kernel::module& current) |
2967 | { |
2968 | - Echo::Flood::UDP::Service* service = new Echo::Flood::UDP::Service(module); |
2969 | + echo::flood::udp::service* service = new echo::flood::udp::service(current); |
2970 | try |
2971 | { |
2972 | - module.getCore().addService("Echo::Flood::UDP", service); |
2973 | + current.get_core().add_service("echo::flood::udp", service); |
2974 | } |
2975 | catch (exception&) |
2976 | { |
2977 | @@ -45,20 +45,20 @@ |
2978 | } |
2979 | } |
2980 | |
2981 | -static void stop(Kernel::Module& module) |
2982 | +static void stop(kernel::module& current) |
2983 | { |
2984 | - delete module.getCore().removeService("Echo::Flood::UDP"); |
2985 | + delete current.get_core().remove_service("echo::flood::udp"); |
2986 | } |
2987 | |
2988 | -static void run(Kernel::Module& module) |
2989 | +static void run(kernel::module& current) |
2990 | { |
2991 | - Echo::Flood::UDP::Service& service = static_cast<Echo::Flood::UDP::Service&>(module.getCore().getService("Echo::Flood::UDP")); |
2992 | + echo::flood::udp::service& service = static_cast<echo::flood::udp::service&>(current.get_core().get_service("echo::flood::udp")); |
2993 | |
2994 | - for (int count = module.getOption("count").getIntValue(); |
2995 | + for (int count = current.get_option("count").get_int_value(); |
2996 | count != 0; |
2997 | --count) |
2998 | { |
2999 | - service.addSocketWithPeer(); |
3000 | + service.add_socket_with_peer(); |
3001 | } |
3002 | } |
3003 | |
3004 | |
3005 | === renamed directory 'ScaleStack/Echo/Server' => 'scalestack/echo/server' |
3006 | === renamed file 'ScaleStack/Echo/Server/Datagram.cc' => 'scalestack/echo/server/datagram.cc' |
3007 | --- ScaleStack/Echo/Server/Datagram.cc 2010-05-16 06:20:02 +0000 |
3008 | +++ scalestack/echo/server/datagram.cc 2010-06-03 05:01:22 +0000 |
3009 | @@ -15,35 +15,38 @@ |
3010 | |
3011 | #include "config.h" |
3012 | |
3013 | -#include <ScaleStack/Echo/Server/Datagram.h> |
3014 | +#include <scalestack/echo/server/datagram.h> |
3015 | |
3016 | -namespace ScaleStack { |
3017 | -namespace Echo { |
3018 | -namespace Server { |
3019 | +namespace scalestack |
3020 | +{ |
3021 | +namespace echo |
3022 | +{ |
3023 | +namespace server |
3024 | +{ |
3025 | |
3026 | /* |
3027 | * Public methods. |
3028 | */ |
3029 | |
3030 | -Datagram::Datagram(Network::DatagramService& service): |
3031 | - Network::Datagram(service), |
3032 | +datagram::datagram(network::datagram_service& creator): |
3033 | + network::datagram(creator), |
3034 | _size(), |
3035 | _buffer() |
3036 | { |
3037 | } |
3038 | |
3039 | -Datagram::~Datagram() |
3040 | +datagram::~datagram() |
3041 | { |
3042 | } |
3043 | |
3044 | -size_t Datagram::receive(uint8_t* buffer, size_t size, struct sockaddr&, socklen_t) |
3045 | +size_t datagram::receive(uint8_t* buffer, size_t size, struct sockaddr&, socklen_t) |
3046 | { |
3047 | _size = size; |
3048 | _buffer = buffer; |
3049 | return _echo(); |
3050 | } |
3051 | |
3052 | -void Datagram::flushSend(void) |
3053 | +void datagram::flush_send(void) |
3054 | { |
3055 | consume(_echo()); |
3056 | } |
3057 | @@ -52,11 +55,11 @@ |
3058 | * Private methods. |
3059 | */ |
3060 | |
3061 | -size_t Datagram::_echo(void) |
3062 | +size_t datagram::_echo(void) |
3063 | { |
3064 | return send(_buffer, _size); |
3065 | } |
3066 | |
3067 | -} /* namespace Server */ |
3068 | -} /* namespace Echo */ |
3069 | -} /* namespace ScaleStack */ |
3070 | +} /* namespace server */ |
3071 | +} /* namespace echo */ |
3072 | +} /* namespace scalestack */ |
3073 | |
3074 | === renamed file 'ScaleStack/Echo/Server/Datagram.h' => 'scalestack/echo/server/datagram.h' |
3075 | --- ScaleStack/Echo/Server/Datagram.h 2010-05-16 06:20:02 +0000 |
3076 | +++ scalestack/echo/server/datagram.h 2010-06-03 05:01:22 +0000 |
3077 | @@ -16,23 +16,26 @@ |
3078 | #ifndef SCALESTACK_ECHO_SERVER_DATAGRAM_H |
3079 | #define SCALESTACK_ECHO_SERVER_DATAGRAM_H |
3080 | |
3081 | -#include <ScaleStack/Common/Macros.h> |
3082 | -#include <ScaleStack/Network/Datagram.h> |
3083 | - |
3084 | -namespace ScaleStack { |
3085 | -namespace Echo { |
3086 | -namespace Server { |
3087 | - |
3088 | -class SCALESTACK_API Datagram: public Network::Datagram |
3089 | +#include <scalestack/common/macros.h> |
3090 | +#include <scalestack/network/datagram.h> |
3091 | + |
3092 | +namespace scalestack |
3093 | +{ |
3094 | +namespace echo |
3095 | +{ |
3096 | +namespace server |
3097 | +{ |
3098 | + |
3099 | +class SCALESTACK_API datagram: public network::datagram |
3100 | { |
3101 | public: |
3102 | |
3103 | - Datagram(Network::DatagramService& service); |
3104 | + datagram(network::datagram_service& creator); |
3105 | |
3106 | - ~Datagram(); |
3107 | + ~datagram(); |
3108 | |
3109 | /** |
3110 | - * See Network::Datagram::receive(). |
3111 | + * See network::datagram::receive(). |
3112 | */ |
3113 | size_t receive(uint8_t* buffer, |
3114 | size_t size, |
3115 | @@ -40,25 +43,25 @@ |
3116 | socklen_t peer_size); |
3117 | |
3118 | /** |
3119 | - * See Network::Datagram::flushSend(). |
3120 | + * See network::datagram::flush_send(). |
3121 | */ |
3122 | - void flushSend(void); |
3123 | + void flush_send(void); |
3124 | |
3125 | private: |
3126 | |
3127 | /** |
3128 | * Don't allow copying of objects. |
3129 | */ |
3130 | - Datagram(const Datagram&); |
3131 | + datagram(const datagram&); |
3132 | |
3133 | /** |
3134 | * Don't allow assignment of objects. |
3135 | */ |
3136 | - Datagram& operator=(const Datagram&); |
3137 | + datagram& operator=(const datagram&); |
3138 | |
3139 | /** |
3140 | * Echo the data received back to the sender. This is used by both the |
3141 | - * receive() and flushSend() methods. |
3142 | + * receive() and flush_send() methods. |
3143 | */ |
3144 | SCALESTACK_LOCAL |
3145 | size_t _echo(void); |
3146 | @@ -67,8 +70,8 @@ |
3147 | uint8_t* _buffer; |
3148 | }; |
3149 | |
3150 | -} /* namespace Server */ |
3151 | -} /* namespace Echo */ |
3152 | -} /* namespace ScaleStack */ |
3153 | +} /* namespace server */ |
3154 | +} /* namespace echo */ |
3155 | +} /* namespace scalestack */ |
3156 | |
3157 | #endif /* SCALESTACK_ECHO_SERVER_DATAGRAM_H */ |
3158 | |
3159 | === renamed directory 'ScaleStack/Echo/Server/UnixStream' => 'scalestack/echo/server/local_stream' |
3160 | === renamed file 'ScaleStack/Echo/Server/UnixStream/UnixStream.cc' => 'scalestack/echo/server/local_stream/local_stream.cc' |
3161 | --- ScaleStack/Echo/Server/UnixStream/UnixStream.cc 2010-04-30 04:19:55 +0000 |
3162 | +++ scalestack/echo/server/local_stream/local_stream.cc 2010-06-03 05:01:22 +0000 |
3163 | @@ -10,29 +10,29 @@ |
3164 | |
3165 | /** |
3166 | * @file |
3167 | - * @brief Echo Server Unix Stream Module Definitions |
3168 | + * @brief Echo Server Local Stream Module Definitions |
3169 | */ |
3170 | |
3171 | #include "config.h" |
3172 | |
3173 | -#include <ScaleStack/Echo/Server/UnixStream/Service.h> |
3174 | -#include <ScaleStack/Kernel/Core.h> |
3175 | -#include <ScaleStack/Kernel/Module.h> |
3176 | +#include <scalestack/echo/server/local_stream/service.h> |
3177 | +#include <scalestack/kernel/core.h> |
3178 | +#include <scalestack/kernel/module.h> |
3179 | |
3180 | using namespace std; |
3181 | -using namespace ScaleStack; |
3182 | +using namespace scalestack; |
3183 | |
3184 | -static void options(Kernel::Module& module) |
3185 | +static void options(kernel::module& module) |
3186 | { |
3187 | - Network::Unix::Stream::ListenerOptions(module, "/tmp/echoserver.socket"); |
3188 | + network::local::stream::listener_options(module, "/tmp/echoserver.socket"); |
3189 | } |
3190 | |
3191 | -static void start(Kernel::Module& module) |
3192 | +static void start(kernel::module& module) |
3193 | { |
3194 | - Echo::Server::UnixStream::Service* service = new Echo::Server::UnixStream::Service(module); |
3195 | + echo::server::local_stream::service* service = new echo::server::local_stream::service(module); |
3196 | try |
3197 | { |
3198 | - module.getCore().addService("Echo::Server::UnixStream", service); |
3199 | + module.get_core().add_service("echo::server::local_stream", service); |
3200 | } |
3201 | catch (exception&) |
3202 | { |
3203 | @@ -41,9 +41,9 @@ |
3204 | } |
3205 | } |
3206 | |
3207 | -static void stop(Kernel::Module& module) |
3208 | +static void stop(kernel::module& module) |
3209 | { |
3210 | - delete module.getCore().removeService("Echo::Server::UnixStream"); |
3211 | + delete module.get_core().remove_service("echo::server::local_stream"); |
3212 | } |
3213 | |
3214 | SCALESTACK_KERNEL_MODULE(options, start, stop, NULL, NULL); |
3215 | |
3216 | === modified file 'scalestack/echo/server/local_stream/plugin.ini' |
3217 | --- ScaleStack/Echo/Server/UnixStream/plugin.ini 2010-05-01 05:23:39 +0000 |
3218 | +++ scalestack/echo/server/local_stream/plugin.ini 2010-06-03 05:01:22 +0000 |
3219 | @@ -1,10 +1,10 @@ |
3220 | [plugin] |
3221 | -title=Echo Server Unix Stream Service |
3222 | -description=Unix Stream Service for the echo server. |
3223 | +title=Echo Server Local Stream Service |
3224 | +description=Local Stream Service for the echo server. |
3225 | version=0.1 |
3226 | author=Chris Behrens <cbehrens@codestud.com> |
3227 | license=BSD |
3228 | -sources=Service.cc UnixStream.cc |
3229 | -headers=Service.h |
3230 | -dependencies=Echo::Server Network::Unix::Stream |
3231 | -tests=Test/Run |
3232 | +sources=service.cc local_stream.cc |
3233 | +headers=service.h |
3234 | +dependencies=echo::server network::local::stream |
3235 | +tests=test/run |
3236 | |
3237 | === renamed file 'ScaleStack/Echo/Server/UnixStream/Service.cc' => 'scalestack/echo/server/local_stream/service.cc' |
3238 | --- ScaleStack/Echo/Server/UnixStream/Service.cc 2010-04-30 04:19:55 +0000 |
3239 | +++ scalestack/echo/server/local_stream/service.cc 2010-06-03 05:01:22 +0000 |
3240 | @@ -10,46 +10,50 @@ |
3241 | |
3242 | /** |
3243 | * @file |
3244 | - * @brief Echo Server Unix Stream Service Definitions |
3245 | + * @brief Echo Server Local Stream Service Definitions |
3246 | */ |
3247 | |
3248 | #include "config.h" |
3249 | |
3250 | -#include <ScaleStack/Echo/Server/Stream.h> |
3251 | -#include <ScaleStack/Echo/Server/UnixStream/Service.h> |
3252 | +#include <scalestack/echo/server/stream.h> |
3253 | +#include <scalestack/echo/server/local_stream/service.h> |
3254 | |
3255 | -namespace ScaleStack { |
3256 | -namespace Echo { |
3257 | -namespace Server { |
3258 | -namespace UnixStream { |
3259 | +namespace scalestack |
3260 | +{ |
3261 | +namespace echo |
3262 | +{ |
3263 | +namespace server |
3264 | +{ |
3265 | +namespace local_stream |
3266 | +{ |
3267 | |
3268 | /* |
3269 | * Public functions. |
3270 | */ |
3271 | |
3272 | -Service::Service(Kernel::Module& module): |
3273 | - Network::Unix::Stream::ConnectionService(module), |
3274 | - _listener_service(module, *this) |
3275 | +service::service(kernel::module& creator): |
3276 | + network::local::stream::connection_service(creator), |
3277 | + _listener_service(creator, *this) |
3278 | { |
3279 | } |
3280 | |
3281 | -Service::~Service() |
3282 | +service::~service() |
3283 | { |
3284 | _listener_service.shutdown(); |
3285 | shutdown(); |
3286 | } |
3287 | |
3288 | -Network::Stream* Service::addStream(void) |
3289 | +network::stream* service::add_stream(void) |
3290 | { |
3291 | - return new Stream(*this); |
3292 | + return new stream(*this); |
3293 | } |
3294 | |
3295 | -void Service::removeStream(Network::Stream* stream) |
3296 | +void service::remove_stream(network::stream* stream) |
3297 | { |
3298 | delete stream; |
3299 | } |
3300 | |
3301 | -} /* namespace UnixStream */ |
3302 | -} /* namespace Server */ |
3303 | -} /* namespace Echo */ |
3304 | -} /* namespace ScaleStack */ |
3305 | +} /* namespace local_stream */ |
3306 | +} /* namespace server */ |
3307 | +} /* namespace echo */ |
3308 | +} /* namespace scalestack */ |
3309 | |
3310 | === renamed file 'ScaleStack/Echo/Server/UnixStream/Service.h' => 'scalestack/echo/server/local_stream/service.h' |
3311 | --- ScaleStack/Echo/Server/UnixStream/Service.h 2010-04-30 04:19:55 +0000 |
3312 | +++ scalestack/echo/server/local_stream/service.h 2010-06-03 05:01:22 +0000 |
3313 | @@ -10,56 +10,60 @@ |
3314 | |
3315 | /** |
3316 | * @file |
3317 | - * @brief Echo Server Unix Stream Service Declarations |
3318 | + * @brief Echo Server Local Stream Service Declarations |
3319 | */ |
3320 | |
3321 | -#ifndef SCALESTACK_ECHO_SERVER_UNIXSTREAM_SERVICE_H |
3322 | -#define SCALESTACK_ECHO_SERVER_UNIXSTREAM_SERVICE_H |
3323 | - |
3324 | -#include <ScaleStack/Network/Unix/Stream/ConnectionService.h> |
3325 | -#include <ScaleStack/Network/Unix/Stream/ListenerService.h> |
3326 | - |
3327 | -namespace ScaleStack { |
3328 | -namespace Echo { |
3329 | -namespace Server { |
3330 | -namespace UnixStream { |
3331 | - |
3332 | -class Service: public Network::Unix::Stream::ConnectionService |
3333 | +#ifndef SCALESTACK_ECHO_SERVER_LOCAL_STREAM_SERVICE_H |
3334 | +#define SCALESTACK_ECHO_SERVER_LOCAL_STREAM_SERVICE_H |
3335 | + |
3336 | +#include <scalestack/network/local/stream/connection_service.h> |
3337 | +#include <scalestack/network/local/stream/listener_service.h> |
3338 | + |
3339 | +namespace scalestack |
3340 | +{ |
3341 | +namespace echo |
3342 | +{ |
3343 | +namespace server |
3344 | +{ |
3345 | +namespace local_stream |
3346 | +{ |
3347 | + |
3348 | +class service: public network::local::stream::connection_service |
3349 | { |
3350 | public: |
3351 | |
3352 | - Service(Kernel::Module& module); |
3353 | - |
3354 | - ~Service(); |
3355 | - |
3356 | - /** |
3357 | - * See Network::StreamService::addStream(). |
3358 | - */ |
3359 | - Network::Stream *addStream(void); |
3360 | - |
3361 | - /** |
3362 | - * See Network::StreamService::removeStream(). |
3363 | - */ |
3364 | - void removeStream(Network::Stream* stream); |
3365 | + service(kernel::module& creator); |
3366 | + |
3367 | + ~service(); |
3368 | + |
3369 | + /** |
3370 | + * See network::stream_service::add_stream(). |
3371 | + */ |
3372 | + network::stream *add_stream(void); |
3373 | + |
3374 | + /** |
3375 | + * See network::stream_service::remove_stream(). |
3376 | + */ |
3377 | + void remove_stream(network::stream* stream); |
3378 | |
3379 | private: |
3380 | |
3381 | /** |
3382 | * Don't allow copying of objects. |
3383 | */ |
3384 | - Service(const Service&); |
3385 | + service(const service&); |
3386 | |
3387 | /** |
3388 | * Don't allow assignment of objects. |
3389 | */ |
3390 | - Service& operator=(const Service&); |
3391 | + service& operator=(const service&); |
3392 | |
3393 | - Network::Unix::Stream::ListenerService _listener_service; |
3394 | + network::local::stream::listener_service _listener_service; |
3395 | }; |
3396 | |
3397 | -} /* namespace UnixStream */ |
3398 | -} /* namespace Server */ |
3399 | -} /* namespace Echo */ |
3400 | -} /* namespace ScaleStack */ |
3401 | +} /* namespace local_stream */ |
3402 | +} /* namespace server */ |
3403 | +} /* namespace echo */ |
3404 | +} /* namespace scalestack */ |
3405 | |
3406 | -#endif /* SCALESTACK_ECHO_SERVER_UNIXSTREAM_SERVICE_H */ |
3407 | +#endif /* SCALESTACK_ECHO_SERVER_LOCAL_STREAM_SERVICE_H */ |
3408 | |
3409 | === renamed directory 'ScaleStack/Echo/Server/UnixStream/Test' => 'scalestack/echo/server/local_stream/test' |
3410 | === renamed file 'ScaleStack/Echo/Server/UnixStream/Test/Run.cc' => 'scalestack/echo/server/local_stream/test/run.cc' |
3411 | --- ScaleStack/Echo/Server/UnixStream/Test/Run.cc 2010-05-04 08:58:05 +0000 |
3412 | +++ scalestack/echo/server/local_stream/test/run.cc 2010-06-03 05:01:22 +0000 |
3413 | @@ -13,40 +13,41 @@ |
3414 | * @brief Echo Server Unix Domain Socket Stream Test |
3415 | */ |
3416 | |
3417 | -#include <ScaleStack/Common/Test.h> |
3418 | +#include <scalestack/common/test.h> |
3419 | |
3420 | #include <unistd.h> |
3421 | |
3422 | -static const char* test_socket = ".echoserver.unix.stream.test"; |
3423 | +static const char* test_socket = ".echoserver.local.stream.test"; |
3424 | + |
3425 | TEST_SUITE_BEGIN |
3426 | |
3427 | TEST_BEGIN(default) |
3428 | unlink(test_socket); |
3429 | - core.addModuleOptionValue("Event::Service", "", TEST_EVENT_SERVICE); |
3430 | - core.addModuleOptionValue("Echo::Server::UnixStream", "unix_sockets", test_socket); |
3431 | - core.addModuleOptionValue("Echo::Flood::UnixStream", "unix_socket", test_socket); |
3432 | - core.setSignalHandlers(); |
3433 | + core.add_module_option_value("event::service", "", TEST_EVENT_SERVICE); |
3434 | + core.add_module_option_value("echo::server::local_stream", "local_sockets", test_socket); |
3435 | + core.add_module_option_value("echo::flood::local_stream", "local_socket", test_socket); |
3436 | + core.set_signal_handlers(); |
3437 | core.run(); |
3438 | TEST_END |
3439 | |
3440 | TEST_BEGIN(iterations) |
3441 | unlink(test_socket); |
3442 | - core.addModuleOptionValue("Event::Service", "", TEST_EVENT_SERVICE); |
3443 | - core.addModuleOptionValue("Echo::Server::UnixStream", "unix_sockets", test_socket); |
3444 | - core.addModuleOptionValue("Echo::Flood::UnixStream", "unix_socket", test_socket); |
3445 | - core.addModuleOptionValue("Echo::Flood::UnixStream", "iterations", "5"); |
3446 | - core.setSignalHandlers(); |
3447 | + core.add_module_option_value("event::service", "", TEST_EVENT_SERVICE); |
3448 | + core.add_module_option_value("echo::server::local_stream", "local_sockets", test_socket); |
3449 | + core.add_module_option_value("echo::flood::local_stream", "local_socket", test_socket); |
3450 | + core.add_module_option_value("echo::flood::local_stream", "iterations", "5"); |
3451 | + core.set_signal_handlers(); |
3452 | core.run(); |
3453 | TEST_END |
3454 | |
3455 | TEST_BEGIN(reconnect) |
3456 | unlink(test_socket); |
3457 | - core.addModuleOptionValue("Event::Service", "", TEST_EVENT_SERVICE); |
3458 | - core.addModuleOptionValue("Echo::Server::UnixStream", "unix_sockets", test_socket); |
3459 | - core.addModuleOptionValue("Echo::Flood::UnixStream", "unix_socket", test_socket); |
3460 | - core.addModuleOptionValue("Echo::Flood::UnixStream", "iterations", "5"); |
3461 | - core.addModuleOptionValue("Echo::Flood::UnixStream", "reconnect", "True"); |
3462 | - core.setSignalHandlers(); |
3463 | + core.add_module_option_value("event::service", "", TEST_EVENT_SERVICE); |
3464 | + core.add_module_option_value("echo::server::local_stream", "local_sockets", test_socket); |
3465 | + core.add_module_option_value("echo::flood::local_stream", "local_socket", test_socket); |
3466 | + core.add_module_option_value("echo::flood::local_stream", "iterations", "5"); |
3467 | + core.add_module_option_value("echo::flood::local_stream", "reconnect", "True"); |
3468 | + core.set_signal_handlers(); |
3469 | core.run(); |
3470 | TEST_END |
3471 | |
3472 | |
3473 | === modified file 'scalestack/echo/server/plugin.ini' |
3474 | --- ScaleStack/Echo/Server/plugin.ini 2010-05-16 06:20:02 +0000 |
3475 | +++ scalestack/echo/server/plugin.ini 2010-06-03 05:01:22 +0000 |
3476 | @@ -4,6 +4,6 @@ |
3477 | version=0.1 |
3478 | author=Eric Day <eday@oddments.org> |
3479 | license=BSD |
3480 | -sources=Datagram.cc Server.cc Stream.cc |
3481 | -headers=Datagram.h Stream.h |
3482 | -dependencies=Network |
3483 | +sources=datagram.cc server.cc stream.cc |
3484 | +headers=datagram.h stream.h |
3485 | +dependencies=network |
3486 | |
3487 | === renamed file 'ScaleStack/Echo/Server/Server.cc' => 'scalestack/echo/server/server.cc' |
3488 | --- ScaleStack/Echo/Server/Server.cc 2010-04-29 07:39:49 +0000 |
3489 | +++ scalestack/echo/server/server.cc 2010-06-03 05:01:22 +0000 |
3490 | @@ -15,6 +15,6 @@ |
3491 | |
3492 | #include "config.h" |
3493 | |
3494 | -#include <ScaleStack/Kernel/Module.h> |
3495 | +#include <scalestack/kernel/module.h> |
3496 | |
3497 | SCALESTACK_KERNEL_MODULE(NULL, NULL, NULL, NULL, NULL); |
3498 | |
3499 | === renamed file 'ScaleStack/Echo/Server/Stream.cc' => 'scalestack/echo/server/stream.cc' |
3500 | --- ScaleStack/Echo/Server/Stream.cc 2010-04-29 07:39:49 +0000 |
3501 | +++ scalestack/echo/server/stream.cc 2010-06-03 05:01:22 +0000 |
3502 | @@ -15,35 +15,38 @@ |
3503 | |
3504 | #include "config.h" |
3505 | |
3506 | -#include <ScaleStack/Echo/Server/Stream.h> |
3507 | +#include <scalestack/echo/server/stream.h> |
3508 | |
3509 | -namespace ScaleStack { |
3510 | -namespace Echo { |
3511 | -namespace Server { |
3512 | +namespace scalestack |
3513 | +{ |
3514 | +namespace echo |
3515 | +{ |
3516 | +namespace server |
3517 | +{ |
3518 | |
3519 | /* |
3520 | * Public methods. |
3521 | */ |
3522 | |
3523 | -Stream::Stream(Network::StreamService& service): |
3524 | - Network::Stream(service), |
3525 | +stream::stream(network::stream_service& creator): |
3526 | + network::stream(creator), |
3527 | _size(), |
3528 | _buffer() |
3529 | { |
3530 | } |
3531 | |
3532 | -Stream::~Stream() |
3533 | +stream::~stream() |
3534 | { |
3535 | } |
3536 | |
3537 | -size_t Stream::read(uint8_t* buffer, size_t size) |
3538 | +size_t stream::read(uint8_t* buffer, size_t size) |
3539 | { |
3540 | _size = size; |
3541 | _buffer = buffer; |
3542 | return _echo(); |
3543 | } |
3544 | |
3545 | -void Stream::flushWrite(void) |
3546 | +void stream::flush_write(void) |
3547 | { |
3548 | consume(_echo()); |
3549 | } |
3550 | @@ -52,7 +55,7 @@ |
3551 | * Private methods. |
3552 | */ |
3553 | |
3554 | -size_t Stream::_echo(void) |
3555 | +size_t stream::_echo(void) |
3556 | { |
3557 | size_t written = write(_buffer, _size, true); |
3558 | _size -= written; |
3559 | @@ -60,6 +63,6 @@ |
3560 | return written; |
3561 | } |
3562 | |
3563 | -} /* namespace Server */ |
3564 | -} /* namespace Echo */ |
3565 | -} /* namespace ScaleStack */ |
3566 | +} /* namespace server */ |
3567 | +} /* namespace echo */ |
3568 | +} /* namespace scalestack */ |
3569 | |
3570 | === renamed file 'ScaleStack/Echo/Server/Stream.h' => 'scalestack/echo/server/stream.h' |
3571 | --- ScaleStack/Echo/Server/Stream.h 2010-05-16 06:20:02 +0000 |
3572 | +++ scalestack/echo/server/stream.h 2010-06-03 05:01:22 +0000 |
3573 | @@ -16,46 +16,49 @@ |
3574 | #ifndef SCALESTACK_ECHO_SERVER_STREAM_H |
3575 | #define SCALESTACK_ECHO_SERVER_STREAM_H |
3576 | |
3577 | -#include <ScaleStack/Common/Macros.h> |
3578 | -#include <ScaleStack/Network/Stream.h> |
3579 | - |
3580 | -namespace ScaleStack { |
3581 | -namespace Echo { |
3582 | -namespace Server { |
3583 | - |
3584 | -class SCALESTACK_API Stream: public Network::Stream |
3585 | +#include <scalestack/common/macros.h> |
3586 | +#include <scalestack/network/stream.h> |
3587 | + |
3588 | +namespace scalestack |
3589 | +{ |
3590 | +namespace echo |
3591 | +{ |
3592 | +namespace server |
3593 | +{ |
3594 | + |
3595 | +class SCALESTACK_API stream: public network::stream |
3596 | { |
3597 | public: |
3598 | |
3599 | - Stream(Network::StreamService& service); |
3600 | + stream(network::stream_service& creator); |
3601 | |
3602 | - ~Stream(); |
3603 | + ~stream(); |
3604 | |
3605 | /** |
3606 | - * See Network::Stream::read(). |
3607 | + * See network::stream::read(). |
3608 | */ |
3609 | size_t read(uint8_t* buffer, size_t size); |
3610 | |
3611 | /** |
3612 | - * See Network::Stream::flushWrite(). |
3613 | + * See network::stream::flush_write(). |
3614 | */ |
3615 | - void flushWrite(void); |
3616 | + void flush_write(void); |
3617 | |
3618 | private: |
3619 | |
3620 | /** |
3621 | * Don't allow copying of objects. |
3622 | */ |
3623 | - Stream(const Stream&); |
3624 | + stream(const stream&); |
3625 | |
3626 | /** |
3627 | * Don't allow assignment of objects. |
3628 | */ |
3629 | - Stream& operator=(const Stream&); |
3630 | + stream& operator=(const stream&); |
3631 | |
3632 | /** |
3633 | * Echo the data read back to the client. This is used by both the read() |
3634 | - * and flushWrite() methods. |
3635 | + * and flush_write() methods. |
3636 | */ |
3637 | SCALESTACK_LOCAL |
3638 | size_t _echo(void); |
3639 | @@ -64,8 +67,8 @@ |
3640 | uint8_t* _buffer; |
3641 | }; |
3642 | |
3643 | -} /* namespace Server */ |
3644 | -} /* namespace Echo */ |
3645 | -} /* namespace ScaleStack */ |
3646 | +} /* namespace server */ |
3647 | +} /* namespace echo */ |
3648 | +} /* namespace scalestack */ |
3649 | |
3650 | #endif /* SCALESTACK_ECHO_SERVER_STREAM_H */ |
3651 | |
3652 | === renamed directory 'ScaleStack/Echo/Server/TCP' => 'scalestack/echo/server/tcp' |
3653 | === modified file 'scalestack/echo/server/tcp/plugin.ini' |
3654 | --- ScaleStack/Echo/Server/TCP/plugin.ini 2010-05-01 05:23:39 +0000 |
3655 | +++ scalestack/echo/server/tcp/plugin.ini 2010-06-03 05:01:22 +0000 |
3656 | @@ -4,7 +4,7 @@ |
3657 | version=0.1 |
3658 | author=Eric Day <eday@oddments.org> |
3659 | license=BSD |
3660 | -sources=Service.cc TCP.cc |
3661 | -headers=Service.h |
3662 | -dependencies=Echo::Server Network::IP::TCP |
3663 | -tests=Test/Run |
3664 | +sources=service.cc tcp.cc |
3665 | +headers=service.h |
3666 | +dependencies=echo::server network::ip::tcp |
3667 | +tests=test/run |
3668 | |
3669 | === renamed file 'ScaleStack/Echo/Server/TCP/Service.cc' => 'scalestack/echo/server/tcp/service.cc' |
3670 | --- ScaleStack/Echo/Server/TCP/Service.cc 2010-04-29 07:39:49 +0000 |
3671 | +++ scalestack/echo/server/tcp/service.cc 2010-06-03 05:01:22 +0000 |
3672 | @@ -15,41 +15,45 @@ |
3673 | |
3674 | #include "config.h" |
3675 | |
3676 | -#include <ScaleStack/Echo/Server/Stream.h> |
3677 | -#include <ScaleStack/Echo/Server/TCP/Service.h> |
3678 | +#include <scalestack/echo/server/stream.h> |
3679 | +#include <scalestack/echo/server/tcp/service.h> |
3680 | |
3681 | -namespace ScaleStack { |
3682 | -namespace Echo { |
3683 | -namespace Server { |
3684 | -namespace TCP { |
3685 | +namespace scalestack |
3686 | +{ |
3687 | +namespace echo |
3688 | +{ |
3689 | +namespace server |
3690 | +{ |
3691 | +namespace tcp |
3692 | +{ |
3693 | |
3694 | /* |
3695 | * Public functions. |
3696 | */ |
3697 | |
3698 | -Service::Service(Kernel::Module& module): |
3699 | - Network::IP::TCP::ConnectionService(module), |
3700 | - _listener_service(module, *this) |
3701 | +service::service(kernel::module& creator): |
3702 | + network::ip::tcp::connection_service(creator), |
3703 | + _listener_service(creator, *this) |
3704 | { |
3705 | } |
3706 | |
3707 | -Service::~Service() |
3708 | +service::~service() |
3709 | { |
3710 | _listener_service.shutdown(); |
3711 | shutdown(); |
3712 | } |
3713 | |
3714 | -Network::Stream* Service::addStream(void) |
3715 | +network::stream* service::add_stream(void) |
3716 | { |
3717 | - return new Stream(*this); |
3718 | + return new stream(*this); |
3719 | } |
3720 | |
3721 | -void Service::removeStream(Network::Stream* stream) |
3722 | +void service::remove_stream(network::stream* stream) |
3723 | { |
3724 | delete stream; |
3725 | } |
3726 | |
3727 | -} /* namespace TCP */ |
3728 | -} /* namespace Server */ |
3729 | -} /* namespace Echo */ |
3730 | -} /* namespace ScaleStack */ |
3731 | +} /* namespace tcp */ |
3732 | +} /* namespace server */ |
3733 | +} /* namespace echo */ |
3734 | +} /* namespace scalestack */ |
3735 | |
3736 | === renamed file 'ScaleStack/Echo/Server/TCP/Service.h' => 'scalestack/echo/server/tcp/service.h' |
3737 | --- ScaleStack/Echo/Server/TCP/Service.h 2010-04-29 07:39:49 +0000 |
3738 | +++ scalestack/echo/server/tcp/service.h 2010-06-03 05:01:22 +0000 |
3739 | @@ -16,50 +16,54 @@ |
3740 | #ifndef SCALESTACK_ECHO_SERVER_TCP_SERVICE_H |
3741 | #define SCALESTACK_ECHO_SERVER_TCP_SERVICE_H |
3742 | |
3743 | -#include <ScaleStack/Network/IP/TCP/ConnectionService.h> |
3744 | -#include <ScaleStack/Network/IP/TCP/ListenerService.h> |
3745 | - |
3746 | -namespace ScaleStack { |
3747 | -namespace Echo { |
3748 | -namespace Server { |
3749 | -namespace TCP { |
3750 | - |
3751 | -class Service: public Network::IP::TCP::ConnectionService |
3752 | +#include <scalestack/network/ip/tcp/connection_service.h> |
3753 | +#include <scalestack/network/ip/tcp/listener_service.h> |
3754 | + |
3755 | +namespace scalestack |
3756 | +{ |
3757 | +namespace echo |
3758 | +{ |
3759 | +namespace server |
3760 | +{ |
3761 | +namespace tcp |
3762 | +{ |
3763 | + |
3764 | +class service: public network::ip::tcp::connection_service |
3765 | { |
3766 | public: |
3767 | |
3768 | - Service(Kernel::Module& module); |
3769 | - |
3770 | - ~Service(); |
3771 | - |
3772 | - /** |
3773 | - * See Network::StreamService::addStream(). |
3774 | - */ |
3775 | - Network::Stream *addStream(void); |
3776 | - |
3777 | - /** |
3778 | - * See Network::StreamService::removeStream(). |
3779 | - */ |
3780 | - void removeStream(Network::Stream* stream); |
3781 | + service(kernel::module& creator); |
3782 | + |
3783 | + ~service(); |
3784 | + |
3785 | + /** |
3786 | + * See network::stream_service::add_stream(). |
3787 | + */ |
3788 | + network::stream *add_stream(void); |
3789 | + |
3790 | + /** |
3791 | + * See network::stream_service::remove_stream(). |
3792 | + */ |
3793 | + void remove_stream(network::stream* stream); |
3794 | |
3795 | private: |
3796 | |
3797 | /** |
3798 | * Don't allow copying of objects. |
3799 | */ |
3800 | - Service(const Service&); |
3801 | + service(const service&); |
3802 | |
3803 | /** |
3804 | * Don't allow assignment of objects. |
3805 | */ |
3806 | - Service& operator=(const Service&); |
3807 | + service& operator=(const service&); |
3808 | |
3809 | - Network::IP::TCP::ListenerService _listener_service; |
3810 | + network::ip::tcp::listener_service _listener_service; |
3811 | }; |
3812 | |
3813 | -} /* namespace TCP */ |
3814 | -} /* namespace Server */ |
3815 | -} /* namespace Echo */ |
3816 | -} /* namespace ScaleStack */ |
3817 | +} /* namespace tcp */ |
3818 | +} /* namespace server */ |
3819 | +} /* namespace echo */ |
3820 | +} /* namespace scalestack */ |
3821 | |
3822 | #endif /* SCALESTACK_ECHO_SERVER_TCP_SERVICE_H */ |
3823 | |
3824 | === renamed file 'ScaleStack/Echo/Server/TCP/TCP.cc' => 'scalestack/echo/server/tcp/tcp.cc' |
3825 | --- ScaleStack/Echo/Server/TCP/TCP.cc 2010-05-16 09:17:44 +0000 |
3826 | +++ scalestack/echo/server/tcp/tcp.cc 2010-06-03 05:01:22 +0000 |
3827 | @@ -15,33 +15,33 @@ |
3828 | |
3829 | #include "config.h" |
3830 | |
3831 | -#include <ScaleStack/Echo/Server/TCP/Service.h> |
3832 | -#include <ScaleStack/Kernel/Core.h> |
3833 | -#include <ScaleStack/Kernel/Module.h> |
3834 | +#include <scalestack/echo/server/tcp/service.h> |
3835 | +#include <scalestack/kernel/core.h> |
3836 | +#include <scalestack/kernel/module.h> |
3837 | |
3838 | using namespace std; |
3839 | -using namespace ScaleStack; |
3840 | +using namespace scalestack; |
3841 | |
3842 | -static void options(Kernel::Module& module) |
3843 | +static void options(kernel::module& module) |
3844 | { |
3845 | - Network::IP::TCP::ListenerOptions(module, "7"); |
3846 | + network::ip::tcp::listener_options(module, "7"); |
3847 | } |
3848 | |
3849 | -static void start(Kernel::Module& module) |
3850 | +static void start(kernel::module& module) |
3851 | { |
3852 | - Echo::Server::TCP::Service* service = new Echo::Server::TCP::Service(module); |
3853 | + echo::server::tcp::service* service = new echo::server::tcp::service(module); |
3854 | try |
3855 | { |
3856 | - module.getCore().addService("Echo::Server::TCP", service); |
3857 | + module.get_core().add_service("echo::server::tcp", service); |
3858 | |
3859 | try |
3860 | { |
3861 | - /* For future possible revamp of Network::IP::TCP */ |
3862 | - //service->addListeners(); |
3863 | + /* For future possible revamp of network::ip::tcp */ |
3864 | + //service->add_listeners(); |
3865 | } |
3866 | catch (exception&) |
3867 | { |
3868 | - module.getCore().removeService("Echo::Server::TCP"); |
3869 | + module.get_core().remove_service("echo::server::tcp"); |
3870 | throw; |
3871 | } |
3872 | } |
3873 | @@ -52,9 +52,9 @@ |
3874 | } |
3875 | } |
3876 | |
3877 | -static void stop(Kernel::Module& module) |
3878 | +static void stop(kernel::module& module) |
3879 | { |
3880 | - delete module.getCore().removeService("Echo::Server::TCP"); |
3881 | + delete module.get_core().remove_service("echo::server::tcp"); |
3882 | } |
3883 | |
3884 | SCALESTACK_KERNEL_MODULE(options, start, stop, NULL, NULL); |
3885 | |
3886 | === renamed directory 'ScaleStack/Echo/Server/TCP/Test' => 'scalestack/echo/server/tcp/test' |
3887 | === renamed file 'ScaleStack/Echo/Server/TCP/Test/Run.cc' => 'scalestack/echo/server/tcp/test/run.cc' |
3888 | --- ScaleStack/Echo/Server/TCP/Test/Run.cc 2010-05-04 08:58:05 +0000 |
3889 | +++ scalestack/echo/server/tcp/test/run.cc 2010-06-03 05:01:22 +0000 |
3890 | @@ -13,36 +13,36 @@ |
3891 | * @brief Echo Server TCP Test |
3892 | */ |
3893 | |
3894 | -#include <ScaleStack/Common/Test.h> |
3895 | +#include <scalestack/common/test.h> |
3896 | |
3897 | static const char* test_port = "32123"; |
3898 | |
3899 | TEST_SUITE_BEGIN |
3900 | |
3901 | TEST_BEGIN(default) |
3902 | - core.addModuleOptionValue("Event::Service", "", TEST_EVENT_SERVICE); |
3903 | - core.addModuleOptionValue("Echo::Server::TCP", "ports", test_port); |
3904 | - core.addModuleOptionValue("Echo::Flood::TCP", "port", test_port); |
3905 | - core.setSignalHandlers(); |
3906 | + core.add_module_option_value("event::service", "", TEST_EVENT_SERVICE); |
3907 | + core.add_module_option_value("echo::server::tcp", "ports", test_port); |
3908 | + core.add_module_option_value("echo::flood::tcp", "port", test_port); |
3909 | + core.set_signal_handlers(); |
3910 | core.run(); |
3911 | TEST_END |
3912 | |
3913 | TEST_BEGIN(iterations) |
3914 | - core.addModuleOptionValue("Event::Service", "", TEST_EVENT_SERVICE); |
3915 | - core.addModuleOptionValue("Echo::Server::TCP", "ports", test_port); |
3916 | - core.addModuleOptionValue("Echo::Flood::TCP", "port", test_port); |
3917 | - core.addModuleOptionValue("Echo::Flood::TCP", "iterations", "5"); |
3918 | - core.setSignalHandlers(); |
3919 | + core.add_module_option_value("event::service", "", TEST_EVENT_SERVICE); |
3920 | + core.add_module_option_value("echo::server::tcp", "ports", test_port); |
3921 | + core.add_module_option_value("echo::flood::tcp", "port", test_port); |
3922 | + core.add_module_option_value("echo::flood::tcp", "iterations", "5"); |
3923 | + core.set_signal_handlers(); |
3924 | core.run(); |
3925 | TEST_END |
3926 | |
3927 | TEST_BEGIN(reconnect) |
3928 | - core.addModuleOptionValue("Event::Service", "", TEST_EVENT_SERVICE); |
3929 | - core.addModuleOptionValue("Echo::Server::TCP", "ports", test_port); |
3930 | - core.addModuleOptionValue("Echo::Flood::TCP", "port", test_port); |
3931 | - core.addModuleOptionValue("Echo::Flood::TCP", "iterations", "5"); |
3932 | - core.addModuleOptionValue("Echo::Flood::TCP", "reconnect", "True"); |
3933 | - core.setSignalHandlers(); |
3934 | + core.add_module_option_value("event::service", "", TEST_EVENT_SERVICE); |
3935 | + core.add_module_option_value("echo::server::tcp", "ports", test_port); |
3936 | + core.add_module_option_value("echo::flood::tcp", "port", test_port); |
3937 | + core.add_module_option_value("echo::flood::tcp", "iterations", "5"); |
3938 | + core.add_module_option_value("echo::flood::tcp", "reconnect", "True"); |
3939 | + core.set_signal_handlers(); |
3940 | core.run(); |
3941 | TEST_END |
3942 | |
3943 | |
3944 | === renamed directory 'ScaleStack/Echo/Server/UDP' => 'scalestack/echo/server/udp' |
3945 | === modified file 'scalestack/echo/server/udp/plugin.ini' |
3946 | --- ScaleStack/Echo/Server/UDP/plugin.ini 2010-05-02 23:02:34 +0000 |
3947 | +++ scalestack/echo/server/udp/plugin.ini 2010-06-03 05:01:22 +0000 |
3948 | @@ -4,7 +4,7 @@ |
3949 | version=0.1 |
3950 | author=Chris Behrens <cbehrens@codestud.com> |
3951 | license=BSD |
3952 | -sources=Service.cc UDP.cc |
3953 | -headers=Service.h |
3954 | -dependencies=Echo::Server Network::IP::UDP |
3955 | -tests=Test/Run |
3956 | +sources=service.cc udp.cc |
3957 | +headers=service.h |
3958 | +dependencies=echo::server network::ip::udp |
3959 | +tests=test/run |
3960 | |
3961 | === renamed file 'ScaleStack/Echo/Server/UDP/Service.cc' => 'scalestack/echo/server/udp/service.cc' |
3962 | --- ScaleStack/Echo/Server/UDP/Service.cc 2010-05-04 08:58:05 +0000 |
3963 | +++ scalestack/echo/server/udp/service.cc 2010-06-03 05:01:22 +0000 |
3964 | @@ -15,39 +15,43 @@ |
3965 | |
3966 | #include "config.h" |
3967 | |
3968 | -#include <ScaleStack/Echo/Server/Datagram.h> |
3969 | -#include <ScaleStack/Echo/Server/UDP/Service.h> |
3970 | +#include <scalestack/echo/server/datagram.h> |
3971 | +#include <scalestack/echo/server/udp/service.h> |
3972 | |
3973 | -namespace ScaleStack { |
3974 | -namespace Echo { |
3975 | -namespace Server { |
3976 | -namespace UDP { |
3977 | +namespace scalestack |
3978 | +{ |
3979 | +namespace echo |
3980 | +{ |
3981 | +namespace server |
3982 | +{ |
3983 | +namespace udp |
3984 | +{ |
3985 | |
3986 | /* |
3987 | * Public functions. |
3988 | */ |
3989 | |
3990 | -Service::Service(Kernel::Module& module): |
3991 | - Network::IP::UDP::SocketService(module) |
3992 | +service::service(kernel::module& creator): |
3993 | + network::ip::udp::socket_service(creator) |
3994 | { |
3995 | } |
3996 | |
3997 | -Service::~Service() |
3998 | +service::~service() |
3999 | { |
4000 | shutdown(); |
4001 | } |
4002 | |
4003 | -Network::Datagram* Service::addDatagram(void) |
4004 | +network::datagram* service::add_datagram(void) |
4005 | { |
4006 | - return new Datagram(*this); |
4007 | + return new datagram(*this); |
4008 | } |
4009 | |
4010 | -void Service::removeDatagram(Network::Datagram* datagram) |
4011 | +void service::remove_datagram(network::datagram* datagram) |
4012 | { |
4013 | delete datagram; |
4014 | } |
4015 | |
4016 | -} /* namespace UDP */ |
4017 | -} /* namespace Server */ |
4018 | -} /* namespace Echo */ |
4019 | -} /* namespace ScaleStack */ |
4020 | +} /* namespace udp */ |
4021 | +} /* namespace server */ |
4022 | +} /* namespace echo */ |
4023 | +} /* namespace scalestack */ |
4024 | |
4025 | === renamed file 'ScaleStack/Echo/Server/UDP/Service.h' => 'scalestack/echo/server/udp/service.h' |
4026 | --- ScaleStack/Echo/Server/UDP/Service.h 2010-05-16 06:20:02 +0000 |
4027 | +++ scalestack/echo/server/udp/service.h 2010-06-03 05:01:22 +0000 |
4028 | @@ -16,47 +16,51 @@ |
4029 | #ifndef SCALESTACK_ECHO_SERVER_UDP_SERVICE_H |
4030 | #define SCALESTACK_ECHO_SERVER_UDP_SERVICE_H |
4031 | |
4032 | -#include <ScaleStack/Network/IP/UDP/SocketService.h> |
4033 | - |
4034 | -namespace ScaleStack { |
4035 | -namespace Echo { |
4036 | -namespace Server { |
4037 | -namespace UDP { |
4038 | - |
4039 | -class Service: public Network::IP::UDP::SocketService |
4040 | +#include <scalestack/network/ip/udp/socket_service.h> |
4041 | + |
4042 | +namespace scalestack |
4043 | +{ |
4044 | +namespace echo |
4045 | +{ |
4046 | +namespace server |
4047 | +{ |
4048 | +namespace udp |
4049 | +{ |
4050 | + |
4051 | +class service: public network::ip::udp::socket_service |
4052 | { |
4053 | public: |
4054 | |
4055 | - Service(Kernel::Module& module); |
4056 | - |
4057 | - ~Service(); |
4058 | - |
4059 | - /** |
4060 | - * See Network::DatagramService::addDatagram(). |
4061 | - */ |
4062 | - Network::Datagram *addDatagram(void); |
4063 | - |
4064 | - /** |
4065 | - * See Network::DatagramService::removeDatagram(). |
4066 | - */ |
4067 | - void removeDatagram(Network::Datagram* datagram); |
4068 | + service(kernel::module& creator); |
4069 | + |
4070 | + ~service(); |
4071 | + |
4072 | + /** |
4073 | + * See network::datagram_service::add_datagram(). |
4074 | + */ |
4075 | + network::datagram *add_datagram(void); |
4076 | + |
4077 | + /** |
4078 | + * See network::datagram_service::remove_datagram(). |
4079 | + */ |
4080 | + void remove_datagram(network::datagram* datagram); |
4081 | |
4082 | private: |
4083 | |
4084 | /** |
4085 | * Don't allow copying of objects. |
4086 | */ |
4087 | - Service(const Service&); |
4088 | + service(const service&); |
4089 | |
4090 | /** |
4091 | * Don't allow assignment of objects. |
4092 | */ |
4093 | - Service& operator=(const Service&); |
4094 | + service& operator=(const service&); |
4095 | }; |
4096 | |
4097 | -} /* namespace UDP */ |
4098 | -} /* namespace Server */ |
4099 | -} /* namespace Echo */ |
4100 | -} /* namespace ScaleStack */ |
4101 | +} /* namespace udp */ |
4102 | +} /* namespace server */ |
4103 | +} /* namespace echo */ |
4104 | +} /* namespace scalestack */ |
4105 | |
4106 | #endif /* SCALESTACK_ECHO_SERVER_UDP_SERVICE_H */ |
4107 | |
4108 | === renamed directory 'ScaleStack/Echo/Server/UDP/Test' => 'scalestack/echo/server/udp/test' |
4109 | === renamed file 'ScaleStack/Echo/Server/UDP/Test/Run.cc' => 'scalestack/echo/server/udp/test/run.cc' |
4110 | --- ScaleStack/Echo/Server/UDP/Test/Run.cc 2010-05-16 16:49:23 +0000 |
4111 | +++ scalestack/echo/server/udp/test/run.cc 2010-06-03 05:01:22 +0000 |
4112 | @@ -13,35 +13,35 @@ |
4113 | * @brief Echo Server UDP Test |
4114 | */ |
4115 | |
4116 | -#include <ScaleStack/Common/Test.h> |
4117 | +#include <scalestack/common/test.h> |
4118 | |
4119 | static const char* test_hosts = "127.0.0.1:32123"; |
4120 | |
4121 | TEST_SUITE_BEGIN |
4122 | |
4123 | TEST_BEGIN(default) |
4124 | - core.addModuleOptionValue("Event::Service", "", TEST_EVENT_SERVICE); |
4125 | - core.addModuleOptionValue("Echo::Server::UDP", "hosts", test_hosts); |
4126 | - core.addModuleOptionValue("Echo::Flood::UDP", "hosts", test_hosts); |
4127 | - core.setSignalHandlers(); |
4128 | + core.add_module_option_value("event::service", "", TEST_EVENT_SERVICE); |
4129 | + core.add_module_option_value("echo::server::udp", "hosts", test_hosts); |
4130 | + core.add_module_option_value("echo::flood::udp", "hosts", test_hosts); |
4131 | + core.set_signal_handlers(); |
4132 | core.run(); |
4133 | TEST_END |
4134 | |
4135 | TEST_BEGIN(iterations) |
4136 | - core.addModuleOptionValue("Event::Service", "", TEST_EVENT_SERVICE); |
4137 | - core.addModuleOptionValue("Echo::Server::UDP", "hosts", test_hosts); |
4138 | - core.addModuleOptionValue("Echo::Flood::UDP", "hosts", test_hosts); |
4139 | - core.addModuleOptionValue("Echo::Flood::UDP", "iterations", "5"); |
4140 | - core.setSignalHandlers(); |
4141 | + core.add_module_option_value("event::service", "", TEST_EVENT_SERVICE); |
4142 | + core.add_module_option_value("echo::server::udp", "hosts", test_hosts); |
4143 | + core.add_module_option_value("echo::flood::udp", "hosts", test_hosts); |
4144 | + core.add_module_option_value("echo::flood::udp", "iterations", "5"); |
4145 | + core.set_signal_handlers(); |
4146 | core.run(); |
4147 | TEST_END |
4148 | |
4149 | TEST_BEGIN(packet_size) |
4150 | - core.addModuleOptionValue("Event::Service", "", TEST_EVENT_SERVICE); |
4151 | - core.addModuleOptionValue("Echo::Server::UDP", "hosts", test_hosts); |
4152 | - core.addModuleOptionValue("Echo::Flood::UDP", "hosts", test_hosts); |
4153 | - core.addModuleOptionValue("Echo::Flood::UDP", "packet_size", "128"); |
4154 | - core.setSignalHandlers(); |
4155 | + core.add_module_option_value("event::service", "", TEST_EVENT_SERVICE); |
4156 | + core.add_module_option_value("echo::server::udp", "hosts", test_hosts); |
4157 | + core.add_module_option_value("echo::flood::udp", "hosts", test_hosts); |
4158 | + core.add_module_option_value("echo::flood::udp", "packet_size", "128"); |
4159 | + core.set_signal_handlers(); |
4160 | core.run(); |
4161 | TEST_END |
4162 | |
4163 | |
4164 | === renamed file 'ScaleStack/Echo/Server/UDP/UDP.cc' => 'scalestack/echo/server/udp/udp.cc' |
4165 | --- ScaleStack/Echo/Server/UDP/UDP.cc 2010-05-16 06:20:02 +0000 |
4166 | +++ scalestack/echo/server/udp/udp.cc 2010-06-03 05:01:22 +0000 |
4167 | @@ -15,33 +15,33 @@ |
4168 | |
4169 | #include "config.h" |
4170 | |
4171 | -#include <ScaleStack/Echo/Server/UDP/Service.h> |
4172 | -#include <ScaleStack/Kernel/Core.h> |
4173 | -#include <ScaleStack/Kernel/Module.h> |
4174 | -#include <ScaleStack/Kernel/Option.h> |
4175 | +#include <scalestack/echo/server/udp/service.h> |
4176 | +#include <scalestack/kernel/core.h> |
4177 | +#include <scalestack/kernel/module.h> |
4178 | +#include <scalestack/kernel/option.h> |
4179 | |
4180 | using namespace std; |
4181 | -using namespace ScaleStack; |
4182 | +using namespace scalestack; |
4183 | |
4184 | -static void options(Kernel::Module& module) |
4185 | +static void options(kernel::module& module) |
4186 | { |
4187 | - Network::IP::UDP::SocketService::Options(module, ":7"); |
4188 | + network::ip::udp::socket_service::options(module, ":7"); |
4189 | } |
4190 | |
4191 | -static void start(Kernel::Module& module) |
4192 | +static void start(kernel::module& module) |
4193 | { |
4194 | - Echo::Server::UDP::Service* service = new Echo::Server::UDP::Service(module); |
4195 | + echo::server::udp::service* service = new echo::server::udp::service(module); |
4196 | try |
4197 | { |
4198 | - module.getCore().addService("Echo::Server::UDP", service); |
4199 | + module.get_core().add_service("echo::server::udp", service); |
4200 | |
4201 | try |
4202 | { |
4203 | - service->addSockets(); |
4204 | + service->add_sockets(); |
4205 | } |
4206 | catch (exception&) |
4207 | { |
4208 | - module.getCore().removeService("Echo::Server::UDP"); |
4209 | + module.get_core().remove_service("echo::server::udp"); |
4210 | throw; |
4211 | } |
4212 | } |
4213 | @@ -52,9 +52,9 @@ |
4214 | } |
4215 | } |
4216 | |
4217 | -static void stop(Kernel::Module& module) |
4218 | +static void stop(kernel::module& module) |
4219 | { |
4220 | - delete module.getCore().removeService("Echo::Server::UDP"); |
4221 | + delete module.get_core().remove_service("echo::server::udp"); |
4222 | } |
4223 | |
4224 | SCALESTACK_KERNEL_MODULE(options, start, stop, NULL, NULL); |
4225 | |
4226 | === renamed directory 'ScaleStack/Event' => 'scalestack/event' |
4227 | === renamed file 'ScaleStack/Event/Event.cc' => 'scalestack/event/event.cc' |
4228 | --- ScaleStack/Event/Event.cc 2010-03-24 05:15:11 +0000 |
4229 | +++ scalestack/event/event.cc 2010-06-03 05:01:22 +0000 |
4230 | @@ -15,6 +15,6 @@ |
4231 | |
4232 | #include "config.h" |
4233 | |
4234 | -#include <ScaleStack/Kernel/Module.h> |
4235 | +#include <scalestack/kernel/module.h> |
4236 | |
4237 | SCALESTACK_KERNEL_MODULE(NULL, NULL, NULL, NULL, NULL); |
4238 | |
4239 | === renamed file 'ScaleStack/Event/Handler.h' => 'scalestack/event/handler.h' |
4240 | --- ScaleStack/Event/Handler.h 2010-05-03 08:30:52 +0000 |
4241 | +++ scalestack/event/handler.h 2010-06-03 05:01:22 +0000 |
4242 | @@ -18,32 +18,34 @@ |
4243 | |
4244 | #include <ctime> |
4245 | |
4246 | -#include <ScaleStack/Common/Macros.h> |
4247 | -#include <ScaleStack/Event/Service.h> |
4248 | - |
4249 | -namespace ScaleStack { |
4250 | -namespace Event { |
4251 | - |
4252 | -class HandlerProvider; |
4253 | +#include <scalestack/common/macros.h> |
4254 | +#include <scalestack/event/service.h> |
4255 | + |
4256 | +namespace scalestack |
4257 | +{ |
4258 | +namespace event |
4259 | +{ |
4260 | + |
4261 | +class handler_provider; |
4262 | |
4263 | /** |
4264 | * This is the event handler base class. Other classes that want to add and |
4265 | * handle events must derive from this. |
4266 | */ |
4267 | -class SCALESTACK_API Handler |
4268 | +class SCALESTACK_API handler |
4269 | { |
4270 | - friend class HandlerProvider; |
4271 | + friend class handler_provider; |
4272 | |
4273 | public: |
4274 | |
4275 | - Handler(Service& service); |
4276 | + handler(service& creator); |
4277 | |
4278 | - virtual ~Handler(); |
4279 | + virtual ~handler(); |
4280 | |
4281 | /** |
4282 | * Get the service this handler belongs to. |
4283 | */ |
4284 | - Service& getService(void); |
4285 | + service& get_service(void); |
4286 | |
4287 | /** |
4288 | * This method is run after the event service has added it. |
4289 | @@ -67,12 +69,12 @@ |
4290 | * @param[in] seconds The number of seconds from now for the timer to |
4291 | * expire. A value of 0 cancels the timer. |
4292 | */ |
4293 | - void setTimer(time_t seconds); |
4294 | + void set_timer(time_t seconds); |
4295 | |
4296 | /** |
4297 | * Run when the timer expires. |
4298 | */ |
4299 | - virtual void timerExpired(void); |
4300 | + virtual void timer_expired(void); |
4301 | |
4302 | /** |
4303 | * Set the file descriptor to watch. |
4304 | @@ -80,42 +82,42 @@ |
4305 | * @param[in] file_descriptor The file descriptor to use when watching |
4306 | * for read and write events. |
4307 | */ |
4308 | - void setFileDescriptor(int file_descriptor); |
4309 | + void set_file_descriptor(int file_descriptor); |
4310 | |
4311 | /** |
4312 | * Watch the file descriptor for reading. |
4313 | */ |
4314 | - void watchRead(void); |
4315 | + void watch_read(void); |
4316 | |
4317 | /** |
4318 | * Run when the file descriptor is ready for reading. |
4319 | */ |
4320 | - virtual void readReady(int file_descriptor); |
4321 | + virtual void read_ready(int file_descriptor); |
4322 | |
4323 | /** |
4324 | * Watch the file descriptor for writing. |
4325 | */ |
4326 | - void watchWrite(void); |
4327 | + void watch_write(void); |
4328 | |
4329 | /** |
4330 | * Run when the file descriptor is ready for writing. |
4331 | */ |
4332 | - virtual void writeReady(int file_descriptor); |
4333 | + virtual void write_ready(int file_descriptor); |
4334 | |
4335 | /** |
4336 | * Notify the event service to run this handler now. |
4337 | */ |
4338 | - void runNow(void); |
4339 | + void run_now(void); |
4340 | |
4341 | /** |
4342 | - * Run when the event service receives a runNow() request. |
4343 | + * Run when the event service receives a run_now() request. |
4344 | */ |
4345 | virtual void run(void); |
4346 | |
4347 | protected: |
4348 | |
4349 | - Service& _service; |
4350 | - Kernel::Module& _module; |
4351 | + service& _service; |
4352 | + kernel::module& _module; |
4353 | |
4354 | private: |
4355 | |
4356 | @@ -123,102 +125,102 @@ |
4357 | * Don't allow copying of objects. |
4358 | */ |
4359 | SCALESTACK_LOCAL |
4360 | - Handler(const Handler&); |
4361 | + handler(const handler&); |
4362 | |
4363 | /** |
4364 | * Don't allow assignment of objects. |
4365 | */ |
4366 | SCALESTACK_LOCAL |
4367 | - Handler& operator=(const Handler&); |
4368 | + handler& operator=(const handler&); |
4369 | |
4370 | - HandlerProvider* _handler_provider; |
4371 | + handler_provider* _handler_provider; |
4372 | }; |
4373 | |
4374 | /** |
4375 | * This is the base class for classes that provide event handlers. Instances |
4376 | - * of this class are bound to Handler instances in order to provider the |
4377 | + * of this class are bound to handler instances in order to provider the |
4378 | * implementation. |
4379 | */ |
4380 | -class SCALESTACK_API HandlerProvider |
4381 | +class SCALESTACK_API handler_provider |
4382 | { |
4383 | public: |
4384 | |
4385 | - HandlerProvider(void); |
4386 | + handler_provider(void); |
4387 | |
4388 | - virtual ~HandlerProvider(); |
4389 | + virtual ~handler_provider(); |
4390 | |
4391 | /** |
4392 | - * Get the Handler bound to this provider. |
4393 | + * Get the handler bound to this provider. |
4394 | */ |
4395 | - Handler* getHandler(void) const; |
4396 | + handler* get_handler(void) const; |
4397 | |
4398 | /** |
4399 | - * Set the Handler for this HandlerProvider. This is used while initializing |
4400 | - * the event handler in the service class. This is required in order |
4401 | - * to reuse both Handler and HandlerProvider instances, which will be |
4402 | - * implemented by unrelated classes. |
4403 | + * Set the handler for this handler_provider. This is used while |
4404 | + * initializing the event handler in the service class. This is required |
4405 | + * in order to reuse both handler and handler_provider instances, which |
4406 | + * will be implemented by unrelated classes. |
4407 | * |
4408 | - * @param[in] handler Handler to set for this provider. |
4409 | + * @param[in] bound_handler Handler to bind to this provider. |
4410 | */ |
4411 | - void setHandler(Handler* handler); |
4412 | + void set_handler(handler* bound_handler); |
4413 | |
4414 | /** |
4415 | - * See Handler::start(). |
4416 | + * See handler::start(). |
4417 | */ |
4418 | void start(void); |
4419 | |
4420 | /** |
4421 | - * See Handler::remove(). |
4422 | + * See handler::remove(). |
4423 | */ |
4424 | virtual void remove(void) = 0; |
4425 | |
4426 | /** |
4427 | - * See Handler::error(). |
4428 | + * See handler::error(). |
4429 | */ |
4430 | void error(void); |
4431 | |
4432 | /** |
4433 | - * See Handler::setTimer(). |
4434 | - */ |
4435 | - virtual void setTimer(time_t seconds) = 0; |
4436 | - |
4437 | - /** |
4438 | - * See Handler::timerExpired(). |
4439 | - */ |
4440 | - void timerExpired(void); |
4441 | - |
4442 | - /** |
4443 | - * See Handler::setFileDescriptor(). |
4444 | - */ |
4445 | - virtual void setFileDescriptor(int file_descriptor) = 0; |
4446 | - |
4447 | - /** |
4448 | - * See Handler::watchRead(). |
4449 | - */ |
4450 | - virtual void watchRead(void) = 0; |
4451 | - |
4452 | - /** |
4453 | - * See Handler::readReady(). |
4454 | - */ |
4455 | - void readReady(int file_descriptor); |
4456 | - |
4457 | - /** |
4458 | - * See Handler::watchWrite(). |
4459 | - */ |
4460 | - virtual void watchWrite(void) = 0; |
4461 | - |
4462 | - /** |
4463 | - * See Handler::writeReady(). |
4464 | - */ |
4465 | - void writeReady(int file_descriptor); |
4466 | - |
4467 | - /** |
4468 | - * See Handler::runNow(). |
4469 | - */ |
4470 | - virtual void runNow(void) = 0; |
4471 | - |
4472 | - /** |
4473 | - * See Handler::run(). |
4474 | + * See handler::set_timer(). |
4475 | + */ |
4476 | + virtual void set_timer(time_t seconds) = 0; |
4477 | + |
4478 | + /** |
4479 | + * See handler::timer_expired(). |
4480 | + */ |
4481 | + void timer_expired(void); |
4482 | + |
4483 | + /** |
4484 | + * See handler::set_file_descriptor(). |
4485 | + */ |
4486 | + virtual void set_file_descriptor(int file_descriptor) = 0; |
4487 | + |
4488 | + /** |
4489 | + * See handler::watch_read(). |
4490 | + */ |
4491 | + virtual void watch_read(void) = 0; |
4492 | + |
4493 | + /** |
4494 | + * See handler::read_ready(). |
4495 | + */ |
4496 | + void read_ready(int file_descriptor); |
4497 | + |
4498 | + /** |
4499 | + * See handler::watch_write(). |
4500 | + */ |
4501 | + virtual void watch_write(void) = 0; |
4502 | + |
4503 | + /** |
4504 | + * See handler::write_ready(). |
4505 | + */ |
4506 | + void write_ready(int file_descriptor); |
4507 | + |
4508 | + /** |
4509 | + * See handler::run_now(). |
4510 | + */ |
4511 | + virtual void run_now(void) = 0; |
4512 | + |
4513 | + /** |
4514 | + * See handler::run(). |
4515 | */ |
4516 | void run(void); |
4517 | |
4518 | @@ -228,147 +230,147 @@ |
4519 | * Don't allow copying of objects. |
4520 | */ |
4521 | SCALESTACK_LOCAL |
4522 | - HandlerProvider(const HandlerProvider&); |
4523 | + handler_provider(const handler_provider&); |
4524 | |
4525 | /** |
4526 | * Don't allow assignment of objects. |
4527 | */ |
4528 | SCALESTACK_LOCAL |
4529 | - HandlerProvider& operator=(const HandlerProvider&); |
4530 | + handler_provider& operator=(const handler_provider&); |
4531 | |
4532 | - Handler* _handler; |
4533 | + handler* _handler; |
4534 | }; |
4535 | |
4536 | /* |
4537 | - * Public Handler methods. |
4538 | + * Public handler methods. |
4539 | */ |
4540 | |
4541 | -inline Handler::Handler(Service& service): |
4542 | - _service(service), |
4543 | - _module(service.getModule()), |
4544 | +inline handler::handler(service& creator): |
4545 | + _service(creator), |
4546 | + _module(creator.get_module()), |
4547 | _handler_provider(NULL) |
4548 | { |
4549 | } |
4550 | |
4551 | -inline Handler::~Handler() |
4552 | +inline handler::~handler() |
4553 | { |
4554 | } |
4555 | |
4556 | -inline Service& Handler::getService(void) |
4557 | +inline service& handler::get_service(void) |
4558 | { |
4559 | return _service; |
4560 | } |
4561 | |
4562 | -inline void Handler::start(void) |
4563 | +inline void handler::start(void) |
4564 | { |
4565 | } |
4566 | |
4567 | -inline void Handler::remove(void) |
4568 | +inline void handler::remove(void) |
4569 | { |
4570 | _handler_provider->remove(); |
4571 | } |
4572 | |
4573 | -inline void Handler::error(void) |
4574 | +inline void handler::error(void) |
4575 | { |
4576 | remove(); |
4577 | } |
4578 | |
4579 | -inline void Handler::setTimer(time_t timer) |
4580 | -{ |
4581 | - _handler_provider->setTimer(timer); |
4582 | -} |
4583 | - |
4584 | -inline void Handler::timerExpired(void) |
4585 | -{ |
4586 | -} |
4587 | - |
4588 | -inline void Handler::setFileDescriptor(int file_descriptor) |
4589 | -{ |
4590 | - _handler_provider->setFileDescriptor(file_descriptor); |
4591 | -} |
4592 | - |
4593 | -inline void Handler::watchRead(void) |
4594 | -{ |
4595 | - _handler_provider->watchRead(); |
4596 | -} |
4597 | - |
4598 | -inline void Handler::readReady(int) |
4599 | -{ |
4600 | -} |
4601 | - |
4602 | -inline void Handler::watchWrite(void) |
4603 | -{ |
4604 | - _handler_provider->watchWrite(); |
4605 | -} |
4606 | - |
4607 | -inline void Handler::writeReady(int) |
4608 | -{ |
4609 | -} |
4610 | - |
4611 | -inline void Handler::runNow(void) |
4612 | -{ |
4613 | - _handler_provider->runNow(); |
4614 | -} |
4615 | - |
4616 | -inline void Handler::run(void) |
4617 | +inline void handler::set_timer(time_t timer) |
4618 | +{ |
4619 | + _handler_provider->set_timer(timer); |
4620 | +} |
4621 | + |
4622 | +inline void handler::timer_expired(void) |
4623 | +{ |
4624 | +} |
4625 | + |
4626 | +inline void handler::set_file_descriptor(int file_descriptor) |
4627 | +{ |
4628 | + _handler_provider->set_file_descriptor(file_descriptor); |
4629 | +} |
4630 | + |
4631 | +inline void handler::watch_read(void) |
4632 | +{ |
4633 | + _handler_provider->watch_read(); |
4634 | +} |
4635 | + |
4636 | +inline void handler::read_ready(int) |
4637 | +{ |
4638 | +} |
4639 | + |
4640 | +inline void handler::watch_write(void) |
4641 | +{ |
4642 | + _handler_provider->watch_write(); |
4643 | +} |
4644 | + |
4645 | +inline void handler::write_ready(int) |
4646 | +{ |
4647 | +} |
4648 | + |
4649 | +inline void handler::run_now(void) |
4650 | +{ |
4651 | + _handler_provider->run_now(); |
4652 | +} |
4653 | + |
4654 | +inline void handler::run(void) |
4655 | { |
4656 | } |
4657 | |
4658 | /* |
4659 | - * Public HandlerProvider methods. |
4660 | + * Public handler_provider methods. |
4661 | */ |
4662 | |
4663 | -inline HandlerProvider::HandlerProvider(void): |
4664 | +inline handler_provider::handler_provider(void): |
4665 | _handler(NULL) |
4666 | { |
4667 | } |
4668 | |
4669 | -inline HandlerProvider::~HandlerProvider() |
4670 | +inline handler_provider::~handler_provider() |
4671 | { |
4672 | } |
4673 | |
4674 | -inline Handler* HandlerProvider::getHandler(void) const |
4675 | +inline handler* handler_provider::get_handler(void) const |
4676 | { |
4677 | return _handler; |
4678 | } |
4679 | |
4680 | -inline void HandlerProvider::setHandler(Handler* handler) |
4681 | +inline void handler_provider::set_handler(handler* bound_handler) |
4682 | { |
4683 | - _handler = handler; |
4684 | + _handler = bound_handler; |
4685 | _handler->_handler_provider = this; |
4686 | } |
4687 | |
4688 | -inline void HandlerProvider::start(void) |
4689 | +inline void handler_provider::start(void) |
4690 | { |
4691 | _handler->start(); |
4692 | } |
4693 | |
4694 | -inline void HandlerProvider::error(void) |
4695 | +inline void handler_provider::error(void) |
4696 | { |
4697 | _handler->error(); |
4698 | } |
4699 | |
4700 | -inline void HandlerProvider::timerExpired(void) |
4701 | -{ |
4702 | - _handler->timerExpired(); |
4703 | -} |
4704 | - |
4705 | -inline void HandlerProvider::readReady(int file_descriptor) |
4706 | -{ |
4707 | - _handler->readReady(file_descriptor); |
4708 | -} |
4709 | - |
4710 | -inline void HandlerProvider::writeReady(int file_descriptor) |
4711 | -{ |
4712 | - _handler->writeReady(file_descriptor); |
4713 | -} |
4714 | - |
4715 | -inline void HandlerProvider::run(void) |
4716 | +inline void handler_provider::timer_expired(void) |
4717 | +{ |
4718 | + _handler->timer_expired(); |
4719 | +} |
4720 | + |
4721 | +inline void handler_provider::read_ready(int file_descriptor) |
4722 | +{ |
4723 | + _handler->read_ready(file_descriptor); |
4724 | +} |
4725 | + |
4726 | +inline void handler_provider::write_ready(int file_descriptor) |
4727 | +{ |
4728 | + _handler->write_ready(file_descriptor); |
4729 | +} |
4730 | + |
4731 | +inline void handler_provider::run(void) |
4732 | { |
4733 | _handler->run(); |
4734 | } |
4735 | |
4736 | -} /* namespace Event */ |
4737 | -} /* namespace ScaleStack */ |
4738 | +} /* namespace event */ |
4739 | +} /* namespace scalestack */ |
4740 | |
4741 | #endif /* SCALESTACK_EVENT_HANDLER_H */ |
4742 | |
4743 | === renamed directory 'ScaleStack/Event/Libevent' => 'scalestack/event/libevent' |
4744 | === renamed file 'ScaleStack/Event/Libevent/HandlerProvider.cc' => 'scalestack/event/libevent/handler_provider.cc' |
4745 | --- ScaleStack/Event/Libevent/HandlerProvider.cc 2010-04-30 03:54:30 +0000 |
4746 | +++ scalestack/event/libevent/handler_provider.cc 2010-06-03 05:01:22 +0000 |
4747 | @@ -19,32 +19,35 @@ |
4748 | #include <fcntl.h> |
4749 | #include <unistd.h> |
4750 | |
4751 | -#include <ScaleStack/Event/Libevent/HandlerProvider.h> |
4752 | -#include <ScaleStack/Event/Libevent/Thread.h> |
4753 | -#include <ScaleStack/Kernel/Module.h> |
4754 | +#include <scalestack/event/libevent/handler_provider.h> |
4755 | +#include <scalestack/event/libevent/thread.h> |
4756 | +#include <scalestack/kernel/module.h> |
4757 | |
4758 | using namespace std; |
4759 | |
4760 | -namespace ScaleStack { |
4761 | -namespace Event { |
4762 | -namespace Libevent { |
4763 | +namespace scalestack |
4764 | +{ |
4765 | +namespace event |
4766 | +{ |
4767 | +namespace libevent |
4768 | +{ |
4769 | |
4770 | /* |
4771 | * Public functions. |
4772 | */ |
4773 | |
4774 | -extern "C" void HandlerProviderCallback(int file_descriptor, short events, |
4775 | +extern "C" void handler_provider_callback(int file_descriptor, short events, |
4776 | void* context) |
4777 | { |
4778 | - HandlerProvider* handler_provider = static_cast<HandlerProvider*>(context); |
4779 | - handler_provider->_callback(file_descriptor, events); |
4780 | + handler_provider* new_handler_provider = static_cast<handler_provider*>(context); |
4781 | + new_handler_provider->_callback(file_descriptor, events); |
4782 | } |
4783 | |
4784 | /* |
4785 | * Public methods. |
4786 | */ |
4787 | |
4788 | -HandlerProvider::HandlerProvider(Kernel::Module& module): |
4789 | +handler_provider::handler_provider(kernel::module& module): |
4790 | _in_check_queue(false), |
4791 | _need_start(false), |
4792 | _need_update(false), |
4793 | @@ -68,12 +71,12 @@ |
4794 | { |
4795 | } |
4796 | |
4797 | -HandlerProvider::~HandlerProvider() |
4798 | +handler_provider::~handler_provider() |
4799 | { |
4800 | - setThread(NULL); |
4801 | + set_thread(NULL); |
4802 | } |
4803 | |
4804 | -void HandlerProvider::setThread(Thread* thread) |
4805 | +void handler_provider::set_thread(thread* thread) |
4806 | { |
4807 | _thread = thread; |
4808 | |
4809 | @@ -89,23 +92,23 @@ |
4810 | { |
4811 | _need_start = true; |
4812 | if (!_in_check_queue) |
4813 | - _thread->checkHandlerProvider(this); |
4814 | + _thread->check_handler_provider(this); |
4815 | } |
4816 | } |
4817 | |
4818 | -bool HandlerProvider::addToCheckQueue(void) |
4819 | +bool handler_provider::add_to_check_queue(void) |
4820 | { |
4821 | if (_in_check_queue) |
4822 | return false; |
4823 | |
4824 | - _module.logInfo("[%X] Adding to check queue", this); |
4825 | + _module.log_info("[%X] Adding to check queue", this); |
4826 | _in_check_queue = true; |
4827 | return true; |
4828 | } |
4829 | |
4830 | -void HandlerProvider::check(void) |
4831 | +void handler_provider::check(void) |
4832 | { |
4833 | - _module.logInfo("[%X] Checking", this); |
4834 | + _module.log_info("[%X] Checking", this); |
4835 | |
4836 | _in_check_queue = false; |
4837 | _is_processing = true; |
4838 | @@ -124,33 +127,33 @@ |
4839 | |
4840 | _is_processing = false; |
4841 | _need_update = false; |
4842 | - _updateEvent(); |
4843 | + _update_event(); |
4844 | } |
4845 | |
4846 | -bool HandlerProvider::needRemove(void) |
4847 | +bool handler_provider::need_remove(void) |
4848 | { |
4849 | return _need_remove; |
4850 | } |
4851 | |
4852 | -void HandlerProvider::remove(void) |
4853 | +void handler_provider::remove(void) |
4854 | { |
4855 | - _module.logInfo("[%X] Removing", this); |
4856 | + _module.log_info("[%X] Removing", this); |
4857 | _need_remove = true; |
4858 | if (!_in_check_queue) |
4859 | - _thread->checkHandlerProvider(this); |
4860 | + _thread->check_handler_provider(this); |
4861 | } |
4862 | |
4863 | -void HandlerProvider::setTimer(time_t seconds) |
4864 | +void handler_provider::set_timer(time_t seconds) |
4865 | { |
4866 | if (seconds == 0) |
4867 | _expire_time = 0; |
4868 | else |
4869 | - _expire_time = _thread->getNow().tv_sec + seconds; |
4870 | + _expire_time = _thread->get_now().tv_sec + seconds; |
4871 | |
4872 | - _sendUpdateNotification(); |
4873 | + _send_update_notification(); |
4874 | } |
4875 | |
4876 | -void HandlerProvider::setFileDescriptor(int file_descriptor) |
4877 | +void handler_provider::set_file_descriptor(int file_descriptor) |
4878 | { |
4879 | _file_descriptor = file_descriptor; |
4880 | _file_descriptor_updated = true; |
4881 | @@ -161,47 +164,47 @@ |
4882 | if (return_code == -1) |
4883 | { |
4884 | close(_file_descriptor); |
4885 | - _module.logFatal("Failed fcntl: %d", errno); |
4886 | + _module.log_fatal("Failed fcntl: %d", errno); |
4887 | } |
4888 | |
4889 | return_code = fcntl(_file_descriptor, F_SETFL, return_code | O_NONBLOCK); |
4890 | if (return_code == -1) |
4891 | { |
4892 | close(_file_descriptor); |
4893 | - _module.logFatal("Failed fcntl: %d", errno); |
4894 | + _module.log_fatal("Failed fcntl: %d", errno); |
4895 | } |
4896 | } |
4897 | |
4898 | - _sendUpdateNotification(); |
4899 | + _send_update_notification(); |
4900 | } |
4901 | |
4902 | -void HandlerProvider::watchRead(void) |
4903 | +void handler_provider::watch_read(void) |
4904 | { |
4905 | _watch_read = true; |
4906 | - _sendUpdateNotification(); |
4907 | + _send_update_notification(); |
4908 | } |
4909 | |
4910 | -void HandlerProvider::watchWrite(void) |
4911 | +void handler_provider::watch_write(void) |
4912 | { |
4913 | _watch_write = true; |
4914 | - _sendUpdateNotification(); |
4915 | + _send_update_notification(); |
4916 | } |
4917 | |
4918 | -void HandlerProvider::runNow(void) |
4919 | +void handler_provider::run_now(void) |
4920 | { |
4921 | _need_run = true; |
4922 | if (!_in_check_queue) |
4923 | - _thread->checkHandlerProvider(this); |
4924 | + _thread->check_handler_provider(this); |
4925 | } |
4926 | |
4927 | /* |
4928 | * Private methods. |
4929 | */ |
4930 | |
4931 | -void HandlerProvider::_sendUpdateNotification(void) |
4932 | +void handler_provider::_send_update_notification(void) |
4933 | { |
4934 | /* |
4935 | - * We call updateEvent() after processing callbacks, so don't bother doing |
4936 | + * We call update_event() after processing callbacks, so don't bother doing |
4937 | * anything now if we're already in callbacks. This may be due to recursion |
4938 | * or coincidence with another thread. |
4939 | */ |
4940 | @@ -216,11 +219,11 @@ |
4941 | { |
4942 | _need_update = true; |
4943 | if (!_in_check_queue) |
4944 | - _thread->checkHandlerProvider(this); |
4945 | + _thread->check_handler_provider(this); |
4946 | } |
4947 | } |
4948 | |
4949 | -void HandlerProvider::_updateEvent(void) |
4950 | +void handler_provider::_update_event(void) |
4951 | { |
4952 | _need_update = false; |
4953 | |
4954 | @@ -256,12 +259,12 @@ |
4955 | events |= EV_WRITE; |
4956 | } |
4957 | |
4958 | - event_set(&_event, _file_descriptor, events, HandlerProviderCallback, this); |
4959 | + event_set(&_event, _file_descriptor, events, handler_provider_callback, this); |
4960 | |
4961 | - if (event_base_set(_thread->getEventBase(), &_event) == -1) |
4962 | + if (event_base_set(_thread->get_event_base(), &_event) == -1) |
4963 | { |
4964 | _is_set = false; |
4965 | - _module.logError("Failed event_base_set: -1"); |
4966 | + _module.log_error("Failed event_base_set: -1"); |
4967 | remove(); |
4968 | return; |
4969 | } |
4970 | @@ -286,7 +289,7 @@ |
4971 | if (return_code == -1) |
4972 | { |
4973 | _is_added = false; |
4974 | - _module.logError("Failed event_add: -1"); |
4975 | + _module.log_error("Failed event_add: -1"); |
4976 | remove(); |
4977 | return; |
4978 | } |
4979 | @@ -294,7 +297,7 @@ |
4980 | _is_added = true; |
4981 | } |
4982 | |
4983 | -void HandlerProvider::_callback(int file_descriptor, short events) |
4984 | +void handler_provider::_callback(int file_descriptor, short events) |
4985 | { |
4986 | _is_processing = true; |
4987 | |
4988 | @@ -302,33 +305,33 @@ |
4989 | { |
4990 | _set_expire_time = 0; |
4991 | |
4992 | - if (_thread->getNow().tv_sec >= _expire_time) |
4993 | + if (_thread->get_now().tv_sec >= _expire_time) |
4994 | { |
4995 | - _module.logDebug("[%X] Timer expired", this); |
4996 | + _module.log_debug("[%X] Timer expired", this); |
4997 | _expire_time = 0; |
4998 | - timerExpired(); |
4999 | + timer_expired(); |
5000 | } |
The diff has been truncated for viewing.