diff options
Diffstat (limited to 'ACE/apps/JAWS')
-rw-r--r-- | ACE/apps/JAWS/clients/Blobby/Blob.h | 85 | ||||
-rw-r--r-- | ACE/apps/JAWS/clients/Blobby/Blob_Handler.h | 65 | ||||
-rw-r--r-- | ACE/apps/JAWS/clients/Blobby/Options.h | 51 | ||||
-rw-r--r-- | ACE/apps/JAWS/clients/Blobby/blobby.cpp | 43 | ||||
-rw-r--r-- | ACE/apps/JAWS/clients/Caching/ID_Generator.h | 49 | ||||
-rw-r--r-- | ACE/apps/JAWS/clients/Caching/Local_Locator.h | 102 | ||||
-rw-r--r-- | ACE/apps/JAWS/clients/Caching/Locator_Request_Reply.h | 167 | ||||
-rw-r--r-- | ACE/apps/JAWS/clients/Caching/URL_Array_Helper.h | 25 | ||||
-rw-r--r-- | ACE/apps/JAWS/clients/Caching/URL_Locator.h | 75 | ||||
-rw-r--r-- | ACE/apps/JAWS/clients/Caching/URL_Properties.h | 153 | ||||
-rw-r--r-- | ACE/apps/JAWS/clients/Caching/http_client.cpp | 31 | ||||
-rw-r--r-- | ACE/apps/JAWS/clients/Caching/http_handler.cpp | 25 | ||||
-rw-r--r-- | ACE/apps/JAWS/clients/Caching/http_handler.h | 68 |
13 files changed, 471 insertions, 468 deletions
diff --git a/ACE/apps/JAWS/clients/Blobby/Blob.h b/ACE/apps/JAWS/clients/Blobby/Blob.h index 9ba35fb0176..8a3c68247e4 100644 --- a/ACE/apps/JAWS/clients/Blobby/Blob.h +++ b/ACE/apps/JAWS/clients/Blobby/Blob.h @@ -1,22 +1,19 @@ /* -*- C++ -*- */ -// $Id$ - -//============================================================================ -// -// = LIBRARY -// JAWS -// -// = FILENAME -// Blob.h -// -// = DESCRIPTION -// This is the ACE_Blob class, which is the API for doing file -// uploads/downloads. -// -// = AUTHOR -// Prashant Jain and Sumedh Mungee -// -//============================================================================ + +//============================================================================= +/** + * @file Blob.h + * + * $Id$ + * + * This is the ACE_Blob class, which is the API for doing file + * uploads/downloads. + * + * + * @author Prashant Jain and Sumedh Mungee + */ +//============================================================================= + #ifndef ACE_BLOB_H #define ACE_BLOB_H @@ -34,53 +31,59 @@ #include "ace/Message_Block.h" #include "Blob_Handler.h" +/** + * @class ACE_Blob + * + * @brief Blob is intended to provide application API to + * classes that wish to do network i/o at a very + * high level of abstraction. + * = This class provides the ability to retrieve data from + * the network, of specified length and offset, and potentially + * use any protocol "under the hood" to do so. It currently + * uses HTTP. See Blob_Handler also. + */ class ACE_Blob - // = TITLE - // Blob is intended to provide application API to - // classes that wish to do network i/o at a very - // high level of abstraction. - // - // = This class provides the ability to retrieve data from - // the network, of specified length and offset, and potentially - // use any protocol "under the hood" to do so. It currently - // uses HTTP. See Blob_Handler also. { public: ACE_Blob (void); ~ACE_Blob (void); + /// initializes the class with the given filename, hostname and port. + /// it should be called with the filename, before any read/write calls int open (const ACE_TCHAR *filename, const ACE_TCHAR *hostname = ACE_DEFAULT_SERVER_HOST, u_short port = 80); - // initializes the class with the given filename, hostname and port. - // it should be called with the filename, before any read/write calls + /** + * starts a connection, and reads a file from the server, + * of length and offset as specified, into Message_Block mb + * The message block should have capacity to hold length number + * of bytes + */ int read (ACE_Message_Block *mb, size_t length, size_t offset); - // starts a connection, and reads a file from the server, - // of length and offset as specified, into Message_Block mb - // The message block should have capacity to hold length number - // of bytes + /** + * starts a connection, and writes a file to the server, + * of length and offset as specified, from Message_Block mb + * thus the message block should contain atleast length + offset + * bytes of data + */ int write (ACE_Message_Block *mb, size_t length, size_t offset); - // starts a connection, and writes a file to the server, - // of length and offset as specified, from Message_Block mb - // thus the message block should contain atleast length + offset - // bytes of data + /// Frees memory allocated for filename. int close (); - // Frees memory allocated for filename. private: + /// store the internet address of the server ACE_INET_Addr inet_addr_; - // store the internet address of the server + /// The filename ACE_TCHAR *filename_; - // The filename + /// The connector endpoint to initiate the client connection ACE_Connector<ACE_Blob_Handler, ACE_SOCK_CONNECTOR> connector_; - // The connector endpoint to initiate the client connection }; diff --git a/ACE/apps/JAWS/clients/Blobby/Blob_Handler.h b/ACE/apps/JAWS/clients/Blobby/Blob_Handler.h index 41e13ff9c03..6e59d2828d4 100644 --- a/ACE/apps/JAWS/clients/Blobby/Blob_Handler.h +++ b/ACE/apps/JAWS/clients/Blobby/Blob_Handler.h @@ -1,23 +1,20 @@ /* -*- C++ -*- */ -// $Id$ - -//============================================================================ -// -// = LIBRARY -// JAWS -// -// = FILENAME -// Blob.h -// -// = DESCRIPTION -// ACE_Blob_Handler is a base class for ACE_Blob_Reader and -// ACE_Blob_Writer which are created in response to calls to -// read/write, as appropriate -// -// = AUTHOR -// Prashant Jain and Sumedh Mungee -// -//============================================================================ + +//============================================================================= +/** + * @file Blob_Handler.h + * + * $Id$ + * + * ACE_Blob_Handler is a base class for ACE_Blob_Reader and + * ACE_Blob_Writer which are created in response to calls to + * read/write, as appropriate + * + * + * @author Prashant Jain and Sumedh Mungee + */ +//============================================================================= + #ifndef ACE_BLOB_HANDLER_H #define ACE_BLOB_HANDLER_H @@ -32,35 +29,37 @@ #include "ace/Svc_Handler.h" #include "ace/Message_Block.h" +/** + * @class ACE_Blob_Handler + * + * @brief Blob is intended to provide application API to + * classes that wish to do network i/o at a very + * high level of abstraction. + * = This class provides the ability to retrieve data from + * the network, of specified length and offset, and potentially + * use any protocol "under the hood" to do so. It currently + * uses HTTP. See Blob_Handler also. + */ class ACE_Blob_Handler : public ACE_Svc_Handler <ACE_SOCK_STREAM, ACE_NULL_SYNCH> - // = TITLE - // Blob is intended to provide application API to - // classes that wish to do network i/o at a very - // high level of abstraction. - // - // = This class provides the ability to retrieve data from - // the network, of specified length and offset, and potentially - // use any protocol "under the hood" to do so. It currently - // uses HTTP. See Blob_Handler also. { public: + /// Null constructor, insures that it works properly with Connector ACE_Blob_Handler (void); - // Null constructor, insures that it works properly with Connector + /// Always use this constructor to make Blob_Handlers ACE_Blob_Handler (ACE_Message_Block *mb, size_t length, size_t offset, ACE_TCHAR *filename); - // Always use this constructor to make Blob_Handlers + /// returns the number of bytes read/written in the last operation. int byte_count (void); - // returns the number of bytes read/written in the last operation. + /// Activate this instance of the <ACE_Blob_Handler> virtual int open (void * = 0); - // Activate this instance of the <ACE_Blob_Handler> + /// Close down the Blob virtual int close (u_long flags = 0); - // Close down the Blob ~ACE_Blob_Handler (void); diff --git a/ACE/apps/JAWS/clients/Blobby/Options.h b/ACE/apps/JAWS/clients/Blobby/Options.h index 8396cf5535b..5c379729f45 100644 --- a/ACE/apps/JAWS/clients/Blobby/Options.h +++ b/ACE/apps/JAWS/clients/Blobby/Options.h @@ -1,21 +1,18 @@ /* -*- C++ -*- */ -// $Id$ - -//============================================================================ -// -// = LIBRARY -// JAWS -// -// = FILENAME -// Options.h -// -// = DESCRIPTION -// Options is an Singleton for blobby -// -// = AUTHOR -// Prashant Jain and Sumedh Mungee -// -//============================================================================ + +//============================================================================= +/** + * @file Options.h + * + * $Id$ + * + * Options is an Singleton for blobby + * + * + * @author Prashant Jain and Sumedh Mungee + */ +//============================================================================= + #ifndef ACE_BLOBBY_OPTIONS_H #define ACE_BLOBBY_OPTIONS_H @@ -33,39 +30,39 @@ class Options { public: + /// Returns the singleton instance static Options *instance (void); - // Returns the singleton instance + /// parses commandline arguments void parse_args (int argc, ACE_TCHAR *argv[]); - // parses commandline arguments + /// Hostname to connect to ACE_TCHAR *hostname_; - // Hostname to connect to + /// Port number to use u_short port_; - // Port number to use + /// Filename to upload/download ACE_TCHAR *filename_; - // Filename to upload/download + /// number of bytes to read/write int length_; - // number of bytes to read/write + /// offset to read/write int offset_; - // offset to read/write + /// "r" means download (read), and "w" means upload (write). char operation_; - // "r" means download (read), and "w" means upload (write). + /// turns on verbosity int debug_; - // turns on verbosity protected: Options (void); // protected constructor, singleton + /// the singleton static Options *instance_; - // the singleton }; #endif /* ACE_BLOBBY_OPTIONS_H */ diff --git a/ACE/apps/JAWS/clients/Blobby/blobby.cpp b/ACE/apps/JAWS/clients/Blobby/blobby.cpp index 0ecc4c8b1ff..5d3e3e7e552 100644 --- a/ACE/apps/JAWS/clients/Blobby/blobby.cpp +++ b/ACE/apps/JAWS/clients/Blobby/blobby.cpp @@ -1,26 +1,23 @@ -// $Id$ - -//============================================================================ -// -// = LIBRARY -// JAWS -// -// = FILENAME -// blobby.c -// -// = DESCRIPTION -// Simple client application to illustrate the use of the ACE_Blob class -// -// It reads "length" number of bytes, after skipping offset "offset" -// from hostname, port and filename as specified. (if -r specified) -// -// It writes "length" number of bytes, after skipping offset "offset" -// to hostname, port and filename as specified (if -w specified) -// -// = AUTHOR -// Prashant Jain and Sumedh Mungee -// -//============================================================================ + +//============================================================================= +/** + * @file blobby.c + * + * $Id$ + * + * Simple client application to illustrate the use of the ACE_Blob class + * + * It reads "length" number of bytes, after skipping offset "offset" + * from hostname, port and filename as specified. (if -r specified) + * + * It writes "length" number of bytes, after skipping offset "offset" + * to hostname, port and filename as specified (if -w specified) + * + * + * @author Prashant Jain and Sumedh Mungee + */ +//============================================================================= + #include "Options.h" #include "ace/OS_main.h" diff --git a/ACE/apps/JAWS/clients/Caching/ID_Generator.h b/ACE/apps/JAWS/clients/Caching/ID_Generator.h index 73c78fc5506..71ba6a493c4 100644 --- a/ACE/apps/JAWS/clients/Caching/ID_Generator.h +++ b/ACE/apps/JAWS/clients/Caching/ID_Generator.h @@ -1,19 +1,16 @@ /* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// none -// -// = FILENAME -// ID_Generator.h -// -// = AUTHOR -// Nanbor Wang -// -// ============================================================================ + +//============================================================================= +/** + * @file ID_Generator.h + * + * $Id$ + * + * @author Nanbor Wang + */ +//============================================================================= + #ifndef ACE_ID_GENERATOR_H #define ACE_ID_GENERATOR_h @@ -26,11 +23,13 @@ #define ACE_OFFER_ID_LENGTH 21 +/** + * @class ACE_ID_Generator + * + * @brief An unique ID generator. + * + */ class ACE_ID_Generator - // = TITLE - // An unique ID generator. - // - // = DESCRIPTION // Generate an offer ID according to current time and avoid // duplicate ID. It guarantees ID uniqueness within a process, @@ -38,25 +37,25 @@ class ACE_ID_Generator // similar method like the backery algorithm. { public: + /// allocate a new ID string and point <id> to it. static char *get_new_id (char *id); - // allocate a new ID string and point <id> to it. private: + /// Atomically get info required to generate an offer ID. static void get_serial_id (time_t &t, size_t &s); - // Atomically get info required to generate an offer ID. + /// Get the lock instance. static ACE_SYNCH_MUTEX *get_lock (void); - // Get the lock instance. + /// Record the time last offer ID generated. static time_t last_time_; - // Record the time last offer ID generated. + /// Record serial number of last offer ID with same + /// generation time. static size_t last_number_; - // Record serial number of last offer ID with same - // generation time. + /// mutex to access private member. static ACE_SYNCH_MUTEX *lock_; - // mutex to access private member. }; #endif /* ACE_ID_GENERATOR_H */ diff --git a/ACE/apps/JAWS/clients/Caching/Local_Locator.h b/ACE/apps/JAWS/clients/Caching/Local_Locator.h index 38f25d1cab5..26591c28300 100644 --- a/ACE/apps/JAWS/clients/Caching/Local_Locator.h +++ b/ACE/apps/JAWS/clients/Caching/Local_Locator.h @@ -1,19 +1,15 @@ // -*- C++ -*- -// -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// none -// -// = FILENAME -// Local_Locator.h -// -// = AUTHOR -// Nanbor Wang -// -// ============================================================================ + +//============================================================================= +/** + * @file Local_Locator.h + * + * $Id$ + * + * @author Nanbor Wang + */ +//============================================================================= + #ifndef ACE_LOCAL_LOCATOR_H #define ACE_LOCAL_LOCATOR_H @@ -27,28 +23,32 @@ #include "ID_Generator.h" +/** + * @class ACE_URL_Record + * + * @brief A URL Record. + * + * A record placed in URL repository. Notice that + * both member pointers are own by URL_Record. + * They will get deallocated when the object goes + * out of scope. + */ class ACE_Svc_Export ACE_URL_Record - // = TITLE - // A URL Record. - // - // = DESCRIPTION - // A record placed in URL repository. Notice that - // both member pointers are own by URL_Record. - // They will get deallocated when the object goes - // out of scope. { + /** + * We are making ACE_Node as friend class because we don't want + * others to access default constructor and pushing in an invalid + * record. However, container classes need to use default constructor + * for its head record. + */ friend class ACE_URL_Local_Locator; friend class ACE_Node<ACE_URL_Record>; - // We are making ACE_Node as friend class because we don't want - // others to access default constructor and pushing in an invalid - // record. However, container classes need to use default constructor - // for its head record. public: + /// ctor. ACE_URL_Record (ACE_URL_Offer *offer); - // ctor. + /// dtor. ~ACE_URL_Record (void); - // dtor. /// Two records are equal if they have the same offer id. bool operator== (const ACE_URL_Record &rhs) const; @@ -58,55 +58,59 @@ public: private: + /// Default ctor. This is put here to prevent users from + /// pushing in an invalid record. ACE_URL_Record (void); - // Default ctor. This is put here to prevent users from - // pushing in an invalid record. + /// Offer ID in the repository. ACE_WString *id_; - // Offer ID in the repository. + /// Offer (and its properties). ACE_URL_Offer *offer_; - // Offer (and its properties). }; +/** + * @class ACE_URL_Local_Locator + * + * @brief A simple URL repository to store URL offer locally. + * + * This class manage a collection of URL offers + * for local query and registration. But we should + * really use it within a server. + */ class ACE_Svc_Export ACE_URL_Local_Locator - // = TITLE - // A simple URL repository to store URL offer locally. - // - // = DESCRIPTION - // This class manage a collection of URL offers - // for local query and registration. But we should - // really use it within a server. { + /// Default destructor. virtual ~ACE_URL_Local_Locator (void); - // Default destructor. + /** + * Query the locator for HTTP with designate properties (none, some, + * or all). The locator being queried will return a sequence of + * offers with <how_many> offers in it. This interface allocates + * <offer> so users must deallocate it after use. + */ virtual int url_query (const ACE_URL_Locator::ACE_Selection_Criteria how, const ACE_URL_Property_Seq *pseq, const size_t how_many, size_t &num_query, ACE_URL_Offer_Seq *offer); - // Query the locator for HTTP with designate properties (none, some, - // or all). The locator being queried will return a sequence of - // offers with <how_many> offers in it. This interface allocates - // <offer> so users must deallocate it after use. + /// Export an offer to the locator. virtual int export_offer (ACE_URL_Offer *offer, ACE_WString &offer_id); - // Export an offer to the locator. + /// Withdraw an offer. return 0 if succeed, -1 otherwise. virtual int withdraw_offer (const ACE_WString &offer_id); - // Withdraw an offer. return 0 if succeed, -1 otherwise. + /// Query a specific offer. virtual int describe_offer (const ACE_WString &offer_id, ACE_URL_Offer *offer); - // Query a specific offer. + /// Modify a previously registered offer. virtual int modify_offer (const ACE_WString &offer_id, const ACE_WString *url = 0, const ACE_URL_Property_Seq *del = 0, const ACE_URL_Property_Seq *modify = 0); - // Modify a previously registered offer. protected: ACE_Unbounded_Set<ACE_URL_Record> repository_; diff --git a/ACE/apps/JAWS/clients/Caching/Locator_Request_Reply.h b/ACE/apps/JAWS/clients/Caching/Locator_Request_Reply.h index a4e6e5f993a..055f5269c98 100644 --- a/ACE/apps/JAWS/clients/Caching/Locator_Request_Reply.h +++ b/ACE/apps/JAWS/clients/Caching/Locator_Request_Reply.h @@ -1,80 +1,84 @@ /* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// none -// -// = FILENAME -// Locator_Request_Response.h -// -// = AUTHOR -// Nanbor Wang -// -// ============================================================================ + +//============================================================================= +/** + * @file Locator_Request_Reply.h + * + * $Id$ + * + * @author Nanbor Wang + */ +//============================================================================= + #ifndef ACE_LOCATOR_REQUEST_REPLY_H #define ACE_LOCATOR_REQUEST_REPLY_H #include "URL_Properties.h" +/** + * @class ACE_URL_Locator_Request + * + * @brief A URL request message formater/wrapper. + * + * This class defines a URL request data. It is used + * to transform requests to an object so that we can + * ship them across network. + */ class ACE_Svc_Export ACE_URL_Locator_Request - // = TITLE - // A URL request message formater/wrapper. - // - // = DESCRIPTION - // This class defines a URL request data. It is used - // to transform requests to an object so that we can - // ship them across network. { public: + /// Default ctor. ACE_URL_Locator_Request (void); - // Default ctor. + /// Default dtor. ~ACE_URL_Locator_Request (void); - // Default dtor. + /** + * Query the locator for HTTP with designate properties (none, some, + * or all). The locator being queried will return a sequence of + * offers with <how_many> offers in it. This interface allocates + * <offer> so users must deallocate it after use. + */ int url_query (const int how, const ACE_URL_Property_Seq &pseq, const int how_many); - // Query the locator for HTTP with designate properties (none, some, - // or all). The locator being queried will return a sequence of - // offers with <how_many> offers in it. This interface allocates - // <offer> so users must deallocate it after use. + /// Export an offer to the locator. int export_offer (const ACE_URL_Offer &offer); - // Export an offer to the locator. + /// Withdraw an offer. return 0 if succeed, -1 otherwise. int withdraw_offer (const ACE_WString &offer_id); - // Withdraw an offer. return 0 if succeed, -1 otherwise. + /// Query a specific offer. int describe_offer (const ACE_WString &offer_id); - // Query a specific offer. + /// Modify a previously registered offer. int modify_offer (const ACE_WString &offer_id, const char *url = 0, const ACE_URL_Property_Seq &del = 0, const ACE_URL_Property_Seq &modify = 0); - // Modify a previously registered offer. + /// Modify a previously registered offer. int modify_offer (const ACE_WString &offer_id, const ACE_WString *url = 0, const ACE_URL_Property_Seq &del = 0, const ACE_URL_Property_Seq &modify = 0); - // Modify a previously registered offer. + /// Encode request for network communication. If succeed, + /// returns the size of the buffer, otherwise, return 0. size_t encode (void); - // Encode request for network communication. If succeed, - // returns the size of the buffer, otherwise, return 0. + /** + * Restore from network data. Returns size of the buffer + * if succeed, 0 otherwise. When passing in a buffer, + * caller must take the responsibility to delete the buffer + * afterward, if so needed. + */ size_t decode (void *buffer); - // Restore from network data. Returns size of the buffer - // if succeed, 0 otherwise. When passing in a buffer, - // caller must take the responsibility to delete the buffer - // afterward, if so needed. + /// A bunch of methods to access internal data. const int how (void) const; const int how_many (void) const; const u_int opcode (void) const; @@ -85,15 +89,14 @@ public: const ACE_WString &id (void) const; const ACE_WString &url (void) const; const char *buffer (void) const; - // A bunch of methods to access internal data. + /// Print out this object. void dump (void) const; - // Print out this object. protected: + /// Return the size of the buffer required to encode + /// this request. size_t size (void); - // Return the size of the buffer required to encode - // this request. enum { VALID_SEQ1 = 0x1, @@ -102,73 +105,77 @@ protected: }; // These constants used to indicate which pointers are valid. + /// Request type code. u_int code_; - // Request type code. + /// Query method (if code_ == QUERY.) int how_; - // Query method (if code_ == QUERY.) + /// How many offers are we interested in in this query. int how_many_; - // How many offers are we interested in in this query. + /// Bit flag to mark valid pointers within this object. int valid_ptr_; - // Bit flag to mark valid pointers within this object. + /// For query or del in modify_offer. ACE_URL_Property_Seq *seq1_; - // For query or del in modify_offer. + /// For modify seq. in modify_offer. ACE_URL_Property_Seq *seq2_; - // For modify seq. in modify_offer. + /// Offer to export. ACE_URL_Offer *offer_; - // Offer to export. + /// Offer ID. ACE_WString id_; - // Offer ID. + /// URL of this offer. ACE_WString url_; - // URL of this offer. + /// Buffer to store encoded data. char *buffer_; - // Buffer to store encoded data. }; +/** + * @class ACE_URL_Locator_Reply + * + * @brief A URL reply message formater/wrapper. + * + * This class defines a URL reply data. It is used + * to transform reply messages to an object so that we can + * ship them across network. + */ class ACE_Svc_Export ACE_URL_Locator_Reply - // = TITLE - // A URL reply message formater/wrapper. - // - // = DESCRIPTION - // This class defines a URL reply data. It is used - // to transform reply messages to an object so that we can - // ship them across network. { public: + /// Default ctor. ACE_URL_Locator_Reply (void); - // Default ctor. + /// Default dtor. ~ACE_URL_Locator_Reply (void); - // Default dtor. + /// Setup a reply message for EXPORT, WITHDRAW, or MODIFY operations. int status_reply (u_int op, int result); - // Setup a reply message for EXPORT, WITHDRAW, or MODIFY operations. + /// Setup a reply for QUERY operation. int query_reply (int result, size_t num, const ACE_URL_Offer_Seq &offers); - // Setup a reply for QUERY operation. + /// Construct a reply for DESCRIBE operation. int describe_reply (int result, const ACE_URL_Offer &offer); - // Construct a reply for DESCRIBE operation. + /// Encode request for network communication. If succeed, + /// returns the size of the buffer, otherwise, return 0. size_t encode (void); - // Encode request for network communication. If succeed, - // returns the size of the buffer, otherwise, return 0. + /** + * Restore from network data. Returns size of the buffer + * if succeed, 0 otherwise. When passing in a buffer, + * caller must take the responsibility to delete the buffer + * afterward, if so needed. + */ size_t decode (void *buffer); - // Restore from network data. Returns size of the buffer - // if succeed, 0 otherwise. When passing in a buffer, - // caller must take the responsibility to delete the buffer - // afterward, if so needed. // Accessor function. const size_t num_offers (void) const; @@ -178,13 +185,13 @@ public: const u_int status (void) const; const char *buffer (void) const ; + /// Print out this object. void dump (void) const ; - // Print out this object. protected: + /// Return the size of the buffer required to encode + /// this request. size_t size (void); - // Return the size of the buffer required to encode - // this request. enum { VALID_OFFER = 0x1, @@ -192,26 +199,26 @@ protected: }; // Valid pointer masks. + /// Holds the original op code. u_int code_; - // Holds the original op code. + /// Holds the result of an operation from the Location Server. int status_; - // Holds the result of an operation from the Location Server. + /// Holds the number of valid offers in the offers_ sequence. size_t num_offers_; - // Holds the number of valid offers in the offers_ sequence. + /// Flag that marks valid internal pointers. int valid_ptr_; - // Flag that marks valid internal pointers. + /// Holds a single offer. Used in query offer property. ACE_URL_Offer *offer_; - // Holds a single offer. Used in query offer property. + /// Holds the replying offer sequence from a Locator. ACE_URL_Offer_Seq *offers_; - // Holds the replying offer sequence from a Locator. + /// Buffer to store encoded data. char *buffer_; - // Buffer to store encoded data. }; #if defined (__ACE_INLINE__) #include "Locator_Request_Reply.inl" diff --git a/ACE/apps/JAWS/clients/Caching/URL_Array_Helper.h b/ACE/apps/JAWS/clients/Caching/URL_Array_Helper.h index f38f9ebf5dd..33f80c3d7f3 100644 --- a/ACE/apps/JAWS/clients/Caching/URL_Array_Helper.h +++ b/ACE/apps/JAWS/clients/Caching/URL_Array_Helper.h @@ -1,18 +1,15 @@ /* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// none -// -// = FILENAME -// URL_Array_Helper.h -// -// = AUTHOR -// Nanbor Wang -// -// ============================================================================ + +//============================================================================= +/** + * @file URL_Array_Helper.h + * + * $Id$ + * + * @author Nanbor Wang + */ +//============================================================================= + #ifndef ACE_URL_ARRAY_HELPER_H #define ACE_URL_ARRAY_HELPER_H diff --git a/ACE/apps/JAWS/clients/Caching/URL_Locator.h b/ACE/apps/JAWS/clients/Caching/URL_Locator.h index 751de52cfe5..a78155f9dae 100644 --- a/ACE/apps/JAWS/clients/Caching/URL_Locator.h +++ b/ACE/apps/JAWS/clients/Caching/URL_Locator.h @@ -1,36 +1,35 @@ /* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// none -// -// = FILENAME -// URL_Locator.h -// -// = AUTHOR -// Nanbor Wang -// -// ============================================================================ + +//============================================================================= +/** + * @file URL_Locator.h + * + * $Id$ + * + * @author Nanbor Wang + */ +//============================================================================= + #ifndef ACE_URL_LOCATOR_H #define ACE_URL_LOCATOR_H #include "URL_Properties.h" +/** + * @class ACE_URL_Locator + * + * @brief Abstract Base class designates what interfaces a URL_Locator + * should provide. + * + * This class defines the basic URL_Locator APIs. + * An URL locator provides services for URL clients to + * query specific URL location that has certain properties + * and URL providers to export their services and a set of + * APIs to maintain their offers. + */ class ACE_Svc_Export ACE_URL_Locator - // = TITLE - // Abstract Base class designates what interfaces a URL_Locator - // should provide. - // - // = DESCRIPTION - // This class defines the basic URL_Locator APIs. - // An URL locator provides services for URL clients to - // query specific URL location that has certain properties - // and URL providers to export their services and a set of - // APIs to maintain their offers. { public: // Request type @@ -44,8 +43,8 @@ public: INVALID_OPERATION // LAST }; + /// Human Readable operation name. static const char * const opname[]; - // Human Readable operation name. // = Specify how to select offers. enum ACE_Selection_Criteria @@ -58,8 +57,8 @@ public: static const char * const selection_name[]; + /// errno will set to one of these value. enum ACE_URL_Locator_Error - // errno will set to one of these value. { OK, // Everything is fine. OFFER_EXIST, // trying to register an offer. @@ -72,41 +71,43 @@ public: }; // Possible error code of URL_Locator. + /// Human readable error status. static const char * const err_name[]; - // Human readable error status. + /// Default destructor. virtual ~ACE_URL_Locator (void) = 0; - // Default destructor. + /** + * Query the locator for HTTP with designate properties (none, some, + * or all). The locator being queried will return a sequence of + * offers with <how_many> offers in it. This interface allocates + * <offer> so users must deallocate it after use. + */ virtual int url_query (const ACE_Selection_Criteria how, const ACE_URL_Property_Seq *pseq, const size_t how_many, size_t &num_query, ACE_URL_Offer_Seq *offer) = 0; - // Query the locator for HTTP with designate properties (none, some, - // or all). The locator being queried will return a sequence of - // offers with <how_many> offers in it. This interface allocates - // <offer> so users must deallocate it after use. + /// Export an offer to the locator. virtual int export_offer (ACE_URL_Offer *offer, ACE_WString &offer_id) = 0; - // Export an offer to the locator. + /// Withdraw an offer. return 0 if succeed, -1 otherwise. virtual int withdraw_offer (const ACE_WString &offer_id) = 0; - // Withdraw an offer. return 0 if succeed, -1 otherwise. + /// Query a specific offer. virtual int describe_offer (const ACE_WString &offer_id, ACE_URL_Offer *offer) = 0; - // Query a specific offer. + /// Modify a previously registered offer. virtual int modify_offer (const ACE_WString &offer_id, const ACE_WString *url = 0, const ACE_URL_Property_Seq *del = 0, const ACE_URL_Property_Seq *modify = 0) = 0; - // Modify a previously registered offer. + /// Provide a human readable error status. virtual const char *error_status (void); - // Provide a human readable error status. }; #endif /* ACE_WEB_LOCATOR_H */ diff --git a/ACE/apps/JAWS/clients/Caching/URL_Properties.h b/ACE/apps/JAWS/clients/Caching/URL_Properties.h index d4094ec2ebd..7cf0556ac42 100644 --- a/ACE/apps/JAWS/clients/Caching/URL_Properties.h +++ b/ACE/apps/JAWS/clients/Caching/URL_Properties.h @@ -1,19 +1,16 @@ // -*- C++ -*- -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// none -// -// = FILENAME -// URL_Locator.h -// -// = AUTHOR -// Nanbor Wang -// -// ============================================================================ + +//============================================================================= +/** + * @file URL_Properties.h + * + * $Id$ + * + * @author Nanbor Wang + */ +//============================================================================= + #ifndef ACE_URL_PROPERTIES_H #define ACE_URL_PROPERTIES_H @@ -26,63 +23,69 @@ #include "ace/Containers.h" +/** + * @class ACE_WString_Helper + * + * @brief Some helper functions for manipulate ACE_WString. + * + * These functions simplify encoding/decoding of + * ACE_WString objects for network communication. + */ class ACE_Svc_Export ACE_WString_Helper - // = TITLE - // Some helper functions for manipulate ACE_WString. - // - // = DESCRIPTION - // These functions simplify encoding/decoding of - // ACE_WString objects for network communication. { public: + /// Returns the actual size (in bytes) required to contain the + /// ACE_WString. static size_t size (const ACE_WString &wstr); - // Returns the actual size (in bytes) required to contain the - // ACE_WString. + /// Encode <wstr> into <buf> for network communication. + /// Return total octets consumed. static size_t encode (void *buf, const ACE_WString &wstr); - // Encode <wstr> into <buf> for network communication. - // Return total octets consumed. + /** + * This function doesn't relate to ACE_WString directly. + * It converts an ACE_UINT16 string from network + * byte order to host byte order. Returns size of the string. + */ static size_t decode (void *buf); - // This function doesn't relate to ACE_WString directly. - // It converts an ACE_UINT16 string from network - // byte order to host byte order. Returns size of the string. }; +/** + * @class ACE_URL_Property + * + * @brief Defines a property of a URL. + * + * A property contains a <name> and a <value>. + * A URL may contain some properties and we can "locate" + * the URL's we are looking for by examming URL for certain + * properties that match our need. + */ class ACE_Svc_Export ACE_URL_Property - // = TITLE - // Defines a property of a URL. - // - // = DESCRIPTION - // A property contains a <name> and a <value>. - // A URL may contain some properties and we can "locate" - // the URL's we are looking for by examming URL for certain - // properties that match our need. { public: + /// Create a new property. ACE_URL_Property (const char *name = 0, const char *value=0); - // Create a new property. + /// Create a new property using wchar strings. This is mostly used + /// to support DBCS or UNICODE. ACE_URL_Property (const ACE_UINT16 *name, const ACE_UINT16 *value); - // Create a new property using wchar strings. This is mostly used - // to support DBCS or UNICODE. + /// Copy constructor. ACE_URL_Property (const ACE_URL_Property &p); - // Copy constructor. + /// Destructor. ~ACE_URL_Property (void); - // Destructor. + /// Assignment operator. ACE_URL_Property &operator= (const ACE_URL_Property &rhs); - // Assignment operator. + /// Equals operator. bool operator== (const ACE_URL_Property &rhs) const; - // Equals operator. + /// Inequality operator. bool operator!= (const ACE_URL_Property &rhs) const; - // Inequality operator. // = Query property name. ACE_WString &name_rep (void); @@ -101,58 +104,60 @@ public: void value (const char *v); // = Helper functions for encoding and decoding. + /// Returns memory size (in bytes) required to encode this object. size_t size (void) const; - // Returns memory size (in bytes) required to encode this object. + /// Encodes this object into buf for network transmission. size_t encode (void *buf) const; - // Encodes this object into buf for network transmission. + /// Decodes buf and modifies this object, you should + /// probably create this with default ctor. size_t decode (void *buf); - // Decodes buf and modifies this object, you should - // probably create this with default ctor. + /// Dump out this object for debug. void dump (void) const; - // Dump out this object for debug. protected: + /// Property name pointer. ACE_WString name_; - // Property name pointer. + /// Property value. ACE_WString value_; - // Property value. } ; typedef ACE_Array<ACE_URL_Property> ACE_URL_Property_Seq; // type of URL_Property collections. +/** + * @class ACE_URL_Offer + * + * @brief Defines a URL offer. + * + * A URL offer is defined by a <url> and an + * <ACE_URL_Property_Seq>. An offer is stored at server end + * thru registering or reported back to querying client from the + * sever. + */ class ACE_Svc_Export ACE_URL_Offer - // = TITLE - // Defines a URL offer. - // - // = DESCRIPTION - // A URL offer is defined by a <url> and an - // <ACE_URL_Property_Seq>. An offer is stored at server end - // thru registering or reported back to querying client from the - // sever. { public: + /// Create an offer. ACE_URL_Offer (const size_t size = 1, const char *url = 0); - // Create an offer. + /// Copy ctor. ACE_URL_Offer (const ACE_URL_Offer &o); - // Copy ctor. + /// Default destructor. ~ACE_URL_Offer (void); - // Default destructor. + /// Assignment operator. ACE_URL_Offer &operator= (const ACE_URL_Offer &rhs); - // Assignment operator. + /// Equality operator. bool operator== (const ACE_URL_Offer &rhs) const; - // Equality operator. + /// Inequality operator. bool operator!= (const ACE_URL_Offer &rhs) const; - // Inequality operator. // = Get URL string. ACE_WString &url_rep (void); @@ -162,33 +167,33 @@ public: void url (const char *url); void url (const ACE_UINT16 *url); + /// Get properties of this offer. ACE_URL_Property_Seq &url_properties (void); - // Get properties of this offer. + /// Set properties of this offer. This operation virtually get a + /// copy of the passed in prop. void url_properties (const ACE_URL_Property_Seq &prop); - // Set properties of this offer. This operation virtually get a - // copy of the passed in prop. // = Helper functions for encoding and decoding. + /// Returns memory size (in bytes) required to encode this object. size_t size (void) const; - // Returns memory size (in bytes) required to encode this object. + /// Encodes this object into buf for network transmission. size_t encode (void *buf) const; - // Encodes this object into buf for network transmission. + /// Decodes buf into current object, you better use + /// the default ctor. size_t decode (void *buf); - // Decodes buf into current object, you better use - // the default ctor. + /// Dump this object for debug. void dump (void) const; - // Dump this object for debug. protected: + /// URL of this offer. ACE_WString url_; - // URL of this offer. + /// Properties associate with this offer. ACE_URL_Property_Seq prop_; - // Properties associate with this offer. }; typedef ACE_Array<ACE_URL_Offer> ACE_URL_Offer_Seq; diff --git a/ACE/apps/JAWS/clients/Caching/http_client.cpp b/ACE/apps/JAWS/clients/Caching/http_client.cpp index e330833fe9d..fe3ad94814e 100644 --- a/ACE/apps/JAWS/clients/Caching/http_client.cpp +++ b/ACE/apps/JAWS/clients/Caching/http_client.cpp @@ -1,21 +1,18 @@ -// $Id$ -// ============================================================================ -// -// = LIBRARY -// apps/JAWS/clients/Caching -// -// = FILENAME -// http_client.cpp -// -// = DESCRIPTION -// This is a very simple client. It accepts URLs from a prompt, and -// will try to fetch them. Also accepts shell escapes. -// -// = AUTHOR -// James Hu -// -// ============================================================================ +//============================================================================= +/** + * @file http_client.cpp + * + * $Id$ + * + * This is a very simple client. It accepts URLs from a prompt, and + * will try to fetch them. Also accepts shell escapes. + * + * + * @author James Hu + */ +//============================================================================= + #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" diff --git a/ACE/apps/JAWS/clients/Caching/http_handler.cpp b/ACE/apps/JAWS/clients/Caching/http_handler.cpp index aa94fdf68cd..99affb4ba76 100644 --- a/ACE/apps/JAWS/clients/Caching/http_handler.cpp +++ b/ACE/apps/JAWS/clients/Caching/http_handler.cpp @@ -1,17 +1,14 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// apps/JAWS/clients/Caching -// -// = FILENAME -// http_handler.cpp -// -// = AUTHOR -// James Hu -// -// ============================================================================ + +//============================================================================= +/** + * @file http_handler.cpp + * + * $Id$ + * + * @author James Hu + */ +//============================================================================= + #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" diff --git a/ACE/apps/JAWS/clients/Caching/http_handler.h b/ACE/apps/JAWS/clients/Caching/http_handler.h index db4c68aa200..95b7471e527 100644 --- a/ACE/apps/JAWS/clients/Caching/http_handler.h +++ b/ACE/apps/JAWS/clients/Caching/http_handler.h @@ -1,19 +1,15 @@ /* -*- c++ -*- */ -// Hey, Emacs! This is a C++ file. -// $Id$ -// ============================================================================ -// -// = LIBRARY -// apps/JAWS/clients/Caching -// -// = FILENAME -// http_handler.h -// -// = AUTHOR -// James Hu -// -// ============================================================================ +//============================================================================= +/** + * @file http_handler.h + * + * $Id$ + * + * @author James Hu + */ +//============================================================================= + #include "ace/SOCK_Connector.h" @@ -24,28 +20,30 @@ #include "ace/Connector.h" #include "ace/Svc_Handler.h" +/** + * @class HTTP_Handler + * + * @brief A simple HTTP protocol handler for clients. + * + * Checks to see if the requested file is already cached. If + * so, it says so. If not, the request is issued to the + * connection. The fetched file is cached. + */ class HTTP_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> - // = TITLE - // A simple HTTP protocol handler for clients. - // - // = DESCRIPTION - // Checks to see if the requested file is already cached. If - // so, it says so. If not, the request is issued to the - // connection. The fetched file is cached. { public: // = Initialization methods. HTTP_Handler (void); HTTP_Handler (const char * path); + /// Open hook. virtual int open (void *); - // Open hook. + /// Entry points defined by the abstract Svc_Handler. virtual int svc (void); - // Entry points defined by the abstract Svc_Handler. + /// Accessor to the file being fetched. const char *filename (void) const; - // Accessor to the file being fetched. private: char request_[BUFSIZ]; @@ -55,27 +53,29 @@ private: size_t response_size_; }; +/** + * @class HTTP_Connector + * + * @brief A simple HTTP connector. + * + * Creates an HTTP Handler based on the URL, and then delegates + * to to the SOCK_CONNECTOR. Adapter pattern. + */ class HTTP_Connector - // = TITLE - // A simple HTTP connector. - // - // = DESCRIPTION - // Creates an HTTP Handler based on the URL, and then delegates - // to to the SOCK_CONNECTOR. Adapter pattern. { public: + /// User entry point into the HTTP connector. int connect (const char * url); - // User entry point into the HTTP connector. private: + /// Helper function. int parseurl (const char *url, char *host, u_short *port, char *path); - // Helper function. private: + /// Factory that actively establishes a connection with an HTTP + /// server. ACE_Connector<HTTP_Handler, ACE_SOCK_CONNECTOR> connector_; - // Factory that actively establishes a connection with an HTTP - // server. }; |