diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1998-08-30 23:47:15 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1998-08-30 23:47:15 +0000 |
commit | 890e81acbee4c4a7f2b0102b8ecf755de473831c (patch) | |
tree | f0bfddf4d121c1bff2d25b73b35392d69393b5c8 /docs/tutorials/001 | |
parent | c2f47b50d1060ea5666500da1327d0e2d8416233 (diff) | |
download | ATCD-890e81acbee4c4a7f2b0102b8ecf755de473831c.tar.gz |
*** empty log message ***
Diffstat (limited to 'docs/tutorials/001')
-rw-r--r-- | docs/tutorials/001/Makefile | 16 | ||||
-rw-r--r-- | docs/tutorials/001/Source.tgz | bin | 1776 -> 1745 bytes | |||
-rw-r--r-- | docs/tutorials/001/acceptor.h | 63 | ||||
-rw-r--r-- | docs/tutorials/001/foo | 0 | ||||
-rw-r--r-- | docs/tutorials/001/logger.h | 84 | ||||
-rw-r--r-- | docs/tutorials/001/page02.html | 2 | ||||
-rw-r--r-- | docs/tutorials/001/server.cpp | 4 |
7 files changed, 88 insertions, 81 deletions
diff --git a/docs/tutorials/001/Makefile b/docs/tutorials/001/Makefile index 6bd430974cf..8a1d6069d48 100644 --- a/docs/tutorials/001/Makefile +++ b/docs/tutorials/001/Makefile @@ -1,5 +1,5 @@ #---------------------------------------------------------------------------- -# $Id$ +# $Id$ # # Makefile for the Reactor Server Logging Daemon #---------------------------------------------------------------------------- @@ -26,13 +26,13 @@ BUILD = $(VBIN) # Include macros and targets #---------------------------------------------------------------------------- -include $(WRAPPER_ROOT)/include/makeinclude/wrapper_macros.GNU -include $(WRAPPER_ROOT)/include/makeinclude/macros.GNU -include $(WRAPPER_ROOT)/include/makeinclude/rules.common.GNU -include $(WRAPPER_ROOT)/include/makeinclude/rules.nonested.GNU -include $(WRAPPER_ROOT)/include/makeinclude/rules.lib.GNU -include $(WRAPPER_ROOT)/include/makeinclude/rules.bin.GNU -include $(WRAPPER_ROOT)/include/makeinclude/rules.local.GNU +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU +include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU +include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU #---------------------------------------------------------------------------- # Local targets diff --git a/docs/tutorials/001/Source.tgz b/docs/tutorials/001/Source.tgz Binary files differindex 9789c46e1e2..b36b8a6e16d 100644 --- a/docs/tutorials/001/Source.tgz +++ b/docs/tutorials/001/Source.tgz diff --git a/docs/tutorials/001/acceptor.h b/docs/tutorials/001/acceptor.h index 443750f88a7..8b114e73d6c 100644 --- a/docs/tutorials/001/acceptor.h +++ b/docs/tutorials/001/acceptor.h @@ -1,8 +1,9 @@ -/* -*- C++ -*- */ + // $Id$ -#if !defined (_LOGGING_ACCEPTOR_H) -#define _LOGGING_ACCEPTOR_H + +#if !defined (_CLIENT_ACCEPTOR_H) +#define _CLIENT_ACCEPTOR_H #include "ace/SOCK_Acceptor.h" #include "ace/Event_Handler.h" @@ -11,54 +12,56 @@ class Logging_Acceptor : public ACE_Event_Handler { - friend class Logging_Handler; + +friend class Logging_Handler; + public: Logging_Acceptor ( const ACE_INET_Addr &addr) : peer_acceptor_(addr) - { - } + { + } ~Logging_Acceptor (void) - { - this->handle_close (ACE_INVALID_HANDLE, ACE_Event_Handler::READ_MASK); - } + { + this->handle_close (ACE_INVALID_HANDLE, ACE_Event_Handler::READ_MASK); + } virtual int open (const ACE_INET_Addr &addr) - { - if (this->peer_acceptor_.open (addr, 1) == -1) - return -1; - else - return 0; - } + { + if (this->peer_acceptor_.open (addr, 1) == -1) + return -1; + else + return 0; + } private: virtual ACE_HANDLE get_handle (void) const - { - return this->peer_acceptor_.get_handle (); - } + { + return this->peer_acceptor_.get_handle (); + } virtual int handle_input (ACE_HANDLE) - { - Logging_Handler *svc_handler = new Logging_Handler; + { + Logging_Handler *svc_handler = new Logging_Handler; - if (this->peer_acceptor_.accept (*svc_handler) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p", "accept failed"), -1); - else if (svc_handler->open () == -1) - svc_handler->close (); + if (this->peer_acceptor_.accept (*svc_handler) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p", "accept failed"), -1); + else if (svc_handler->open () == -1) + svc_handler->close (); - return 0; - } + return 0; + } virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask) - { - return this->peer_acceptor_.close (); - } + { + return this->peer_acceptor_.close (); + } ACE_SOCK_Acceptor peer_acceptor_; }; -#endif /* _LOGGING_ACCEPTOR_H */ +#endif /* _CLIENT_ACCEPTOR_H */ diff --git a/docs/tutorials/001/foo b/docs/tutorials/001/foo new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/docs/tutorials/001/foo diff --git a/docs/tutorials/001/logger.h b/docs/tutorials/001/logger.h index 0a4a4d12ba3..f37f5f0ea83 100644 --- a/docs/tutorials/001/logger.h +++ b/docs/tutorials/001/logger.h @@ -1,7 +1,9 @@ + // $Id$ -#if !defined (_LOGGING_HANDLER_H) -#define _LOGGING_HANDLER_H + +#if !defined (_CLIENT_HANDLER_H) +#define _CLIENT_HANDLER_H #include "ace/Event_Handler.h" #include "ace/INET_Addr.h" @@ -11,65 +13,65 @@ class Logging_Handler : public ACE_Event_Handler { public: Logging_Handler (void) - { - } + { + } virtual int open (void) - { - if (g_reactor-> register_handler (this, ACE_Event_Handler::READ_MASK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) can't register with reactor\n"), -1); - } + { + if (g_reactor-> register_handler (this, ACE_Event_Handler::READ_MASK) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) can't register with reactor\n"), -1); + } virtual int close (void) - { - return this->handle_close (ACE_INVALID_HANDLE, ACE_Event_Handler::RWE_MASK); - } + { + return this->handle_close (ACE_INVALID_HANDLE, ACE_Event_Handler::RWE_MASK); + } operator ACE_SOCK_Stream &() - { - return this->cli_stream_; - } + { + return this->cli_stream_; + } protected: virtual ACE_HANDLE get_handle (void) const - { - return this->cli_stream_.get_handle (); - } + { + return this->cli_stream_.get_handle (); + } virtual int handle_input (ACE_HANDLE) - { - char buf[128]; - memset(buf,0,sizeof(buf)); + { + char buf[128]; + memset(buf,0,sizeof(buf)); - switch( this->cli_stream_.recv(buf,sizeof buf) ) - { - case -1: - ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p bad read\n", "client logger"), -1); - case 0: - ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) closing log daemon (fd = %d)\n", - this->get_handle ()), -1); - default: - ACE_DEBUG ((LM_DEBUG, "(%P|%t) from client: %s",buf)); - } + switch( this->cli_stream_.recv(buf,sizeof buf) ) + { + case -1: + ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p bad read\n", "client logger"), -1); + case 0: + ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) closing log daemon (fd = %d)\n", + this->get_handle ()), -1); + default: + ACE_DEBUG ((LM_DEBUG, "(%P|%t) from client: %s",buf)); + } - return 0; - } + return 0; + } virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask) - { - delete this; - return 0; - } + { + delete this; + return 0; + } virtual ~Logging_Handler (void) - { - g_reactor-> cancel_timer (this); - this->cli_stream_.close (); - } + { + g_reactor-> cancel_timer (this); + this->cli_stream_.close (); + } private: ACE_SOCK_Stream cli_stream_; }; -#endif /* _LOGGING_HANDLER_H */ +#endif /* _CLIENT_HANDLER_H */ diff --git a/docs/tutorials/001/page02.html b/docs/tutorials/001/page02.html index 24672f85cbf..5f4ca811e83 100644 --- a/docs/tutorials/001/page02.html +++ b/docs/tutorials/001/page02.html @@ -114,7 +114,7 @@ to new connection requests.</P> <P> <HR WIDTH="100%"></P> -<CENTER><P>[<A HREF="../../Tutorial">Tutorial Index</A>] [<A HREF="page01.html">Previous +<CENTER><P>[<A HREF="..">Tutorial Index</A>] [<A HREF="page01.html">Previous Page</A>] [<A HREF="page03.html">Continue This Tutorial</A>] </P></CENTER> </BODY> diff --git a/docs/tutorials/001/server.cpp b/docs/tutorials/001/server.cpp index 09e21bc6b74..a2a89d22d1a 100644 --- a/docs/tutorials/001/server.cpp +++ b/docs/tutorials/001/server.cpp @@ -1,5 +1,7 @@ + // $Id$ + #include "ace/Reactor.h" ACE_Reactor * g_reactor; @@ -26,7 +28,7 @@ main (int argc, char *argv[]) ACE_DEBUG ((LM_DEBUG, "(%P|%t) starting up server logging daemon\n")); while (!finished) - g_reactor-> handle_events (); + g_reactor-> handle_events (); ACE_DEBUG ((LM_DEBUG, "(%P|%t) shutting down server logging daemon\n")); |