diff options
author | jxh <jxh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-03-06 10:03:21 +0000 |
---|---|---|
committer | jxh <jxh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-03-06 10:03:21 +0000 |
commit | 396f3ff921c5de1e3f73f9a810582942a96b9e03 (patch) | |
tree | 3bc1e5ea17f916bb416f804a773c2f17bcc37e5f /apps | |
parent | 36cf51a3b43768b3f8ea58edb8eba1c312923642 (diff) | |
download | ATCD-396f3ff921c5de1e3f73f9a810582942a96b9e03.tar.gz |
Getting closer to a simple HTTP server.
Diffstat (limited to 'apps')
-rw-r--r-- | apps/JAWS/server/PROTOTYPE/HTTP_10.h | 23 | ||||
-rw-r--r-- | apps/JAWS/server/PROTOTYPE/HTTP_Policy.cpp | 15 | ||||
-rw-r--r-- | apps/JAWS/server/PROTOTYPE/HTTP_Policy.h | 20 | ||||
-rw-r--r-- | apps/JAWS/server/PROTOTYPE/main.cpp | 65 |
4 files changed, 120 insertions, 3 deletions
diff --git a/apps/JAWS/server/PROTOTYPE/HTTP_10.h b/apps/JAWS/server/PROTOTYPE/HTTP_10.h index 9e5b300be0a..039aff1e68f 100644 --- a/apps/JAWS/server/PROTOTYPE/HTTP_10.h +++ b/apps/JAWS/server/PROTOTYPE/HTTP_10.h @@ -11,6 +11,8 @@ public: JAWS_HTTP_IO_Handler (JAWS_IO *io); ~JAWS_HTTP_IO_Handler (void); + ACE_Message_Block *state (void); + protected: // The following methods are inherited from JAWS_IO_Handler @@ -25,13 +27,28 @@ protected: virtual void write_error (void); virtual void confirmation_message_complete (void); virtual void error_message_complete (void); - + private: + ACE_Message_Block *state_; + // This maintains the state of the request. + JAWS_IO *io_; // The reference to our IO interface (synch vs. asynch) - void *state_; - // This maintains the state so that we can short circuit the stream calls + JAWS_Pipeline *pipeline_; + // This is a reference to the next stage of the pipeline when the IO + // request completes. + + JAWS_HTTP_IO_Handler_Factory *factory_; +}; + +class JAWS_HTTP_Data_Block : public ACE_Data_Block +{ +public: + JAWS_HTTP_Data_Block (void); + virtual ~JAWS_HTTP_Data_Block (void); + +private: }; diff --git a/apps/JAWS/server/PROTOTYPE/HTTP_Policy.cpp b/apps/JAWS/server/PROTOTYPE/HTTP_Policy.cpp new file mode 100644 index 00000000000..9b8d3dd36a6 --- /dev/null +++ b/apps/JAWS/server/PROTOTYPE/HTTP_Policy.cpp @@ -0,0 +1,15 @@ +// $Id$ + +#include "HTTP_Policy.h" + +HTTP_Policy::HTTP_Policy (JAWS_Concurrency *concurrency) + : concurrency_ (concurrency) +{ +} + +JAWS_Concurrency_Base * +HTTP_Policy update (void *) +{ + /* for now, we always return the same concurrency strategy */ + returh this->concurrency_; +} diff --git a/apps/JAWS/server/PROTOTYPE/HTTP_Policy.h b/apps/JAWS/server/PROTOTYPE/HTTP_Policy.h new file mode 100644 index 00000000000..75da0784e57 --- /dev/null +++ b/apps/JAWS/server/PROTOTYPE/HTTP_Policy.h @@ -0,0 +1,20 @@ +/* -*- c++ -*- */ + +#if !defined (HTTP_POLICY_H) +#define HTTP_POLICY_H + +#include "JAWS/Concurrency.h" + +/* create a policy */ +class HTTP_Policy : public JAWS_Dispatch_Policy +{ +public: + HTTP_Policy (JAWS_Concurrency_Base *concurrency); + virtual JAWS_Concurrency_Base * update (void *state = 0); + +private: + JAWS_Concurrency_Base *concurrency_; +}; + + +#endif /* !defined (HTTP_POLICY_H) */ diff --git a/apps/JAWS/server/PROTOTYPE/main.cpp b/apps/JAWS/server/PROTOTYPE/main.cpp new file mode 100644 index 00000000000..58cec321523 --- /dev/null +++ b/apps/JAWS/server/PROTOTYPE/main.cpp @@ -0,0 +1,65 @@ +// $Id$ + +#include "ace/Get_Opt.h" + +#include "HTTP_Policy.h" + +// Parse arguments + +struct SERVER_FLAGS +{ + int port; // port to listen on + int concurrency; // 0 => pool, 1 => per + int nthreads; // number of threads + int maxthreads; // maximum number of threads + long flags; // thread creation flags +}; + +static SERVER_FLAGS parse_args (int argc, char *argv[]) +{ + int c; + SERVER_FLAGS sflags; + + sflags.port = 5432; + sflags.concurrency = 0; + sflags.nthreads = 5; + sflags.maxthreads = 20; + sflags.flags = THR_NEW_LWP; + + ACE_Get_Opt getopt (argc, argv, "p:c:n:m:f:"); + while ((c = getopt ()) != -1) + switch (c) + { + case 'p': + sflags.port = ACE_OS::atoi (getopt.optarg); + break; + case 'c': + sflags.concurrency = + (ACE_OS::strcmp (getopt.optarg, "PER_REQUEST") == 0); + break; + case 'n': + sflags.nthreads = ACE_OS::atoi (getopt.optarg); + break; + case 'm': + sflags.maxthreads = ACE_OS::atoi (getopt.optarg); + break; + case 'f': + if (ACE_OS::strcmp (getopt.optarg, "THR_BOUND") == 0) + sflags.flags |= THR_BOUND; + else if (ACE_OS::strcmp (getopt.optarg, "THR_DAEMON") == 0) + sflags.flags |= THR_DAEMON; + else if (ACE_OS::strcmp (getopt.optarg, "THR_DETACHED") == 0) + sflags.flags |= THR_DETACHED; + break; + } + + return sflags; +} + +int +main (int argc, char *argv[]) +{ + + + return 0; +} |