Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Time_Request_Reply.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 //=============================================================================
00003 /**
00004  *  @file    Time_Request_Reply.h
00005  *
00006  *  $Id: Time_Request_Reply.h,v 1.1.1.4 2003/02/21 18:36:32 chad Exp $
00007  *
00008  *  Define the format used to exchange messages between the
00009  *  ACE_Time_Server and clerks.
00010  *
00011  *  @author  Prashant Jain
00012  */
00013 //=============================================================================
00014 
00015 
00016 #ifndef ACE_TIME_REQUEST_REPLY_H
00017 #define ACE_TIME_REQUEST_REPLY_H
00018 #include "ace/pre.h"
00019 
00020 #include "ace/Time_Value.h"
00021 
00022 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00023 # pragma once
00024 #endif /* ACE_LACKS_PRAGMA_ONCE */
00025 
00026 #include "ace/SString.h"
00027 
00028 /**
00029  * @class ACE_Time_Request
00030  *
00031  * @brief Message format for delivering requests to the ACE_Time Server.
00032  *
00033  * This class is implemented to minimize data copying.
00034  * In particular, all marshaling is done in situ...
00035  */
00036 class ACE_Export ACE_Time_Request
00037 {
00038 public:
00039   enum Constants
00040   {
00041     /// Request message types.
00042     TIME_UPDATE = 01,
00043 
00044     /// Class-specific constant values.
00045     MAX_TIME_LEN = MAXPATHLEN + 1
00046   };
00047 
00048   /// Default constructor.
00049   ACE_Time_Request (void);
00050 
00051   /**
00052    * Create a ACE_Time_Request message.
00053    * @param msg_type Type of request.
00054    * @param time Time.
00055    * @param timeout Max time waiting for request.
00056    */
00057   ACE_Time_Request (ACE_INT32 msg_type,
00058                     const ACE_UINT32 time,
00059                     ACE_Time_Value *timeout = 0);
00060 
00061   /**
00062    * Initialize length_ in order to ensure correct byte ordering before a
00063    * request is sent.
00064    * @deprecated This method is a no-op.
00065    */
00066   void init (void);
00067 
00068   // Get the fixed size of message
00069   ssize_t size (void) const;
00070 
00071   /// Get the type of the message.
00072   ACE_INT32 msg_type (void) const;
00073 
00074   /// Set the type of the message.
00075   void msg_type (ACE_INT32);
00076 
00077   /// Get the time
00078   ACE_UINT32 time (void) const;
00079 
00080   // Set the time
00081   void time (ACE_UINT32 t);
00082 
00083   /// Get the blocking semantics.
00084   ACE_UINT32 block_forever (void) const;
00085 
00086   ///  Set the blocking semantics.
00087   void block_forever (ACE_UINT32);
00088 
00089   /// Get the timeout.
00090   ACE_Time_Value timeout (void) const;
00091 
00092   /// Set the timeout.
00093   void timeout (const ACE_Time_Value& timeout);
00094 
00095   /// Encode the message before transmission.
00096   int encode (void *&);
00097 
00098   /// Decode message after reception.
00099   int decode (void);
00100 
00101   /// Print out the values of the message for debugging purposes.
00102   void dump (void) const;
00103 
00104 private:
00105   // = The 5 fields in the <Transfer> struct are transmitted to the server.
00106   // The remaining 2 fields are not tranferred -- they are used only on
00107   // the server-side to simplify lookups.
00108 
00109   struct Transfer
00110   {
00111     /// Type of the request (i.e., <TIME_UPDATE>)
00112     ACE_INT32 msg_type_;
00113 
00114     /// Indicates if we should block forever.  If 0, then sec_timeout_
00115     /// and usec_timeout_ indicates how long we should wait.
00116     ACE_UINT32 block_forever_;
00117 
00118     /// Max seconds willing to wait for name if not blocking forever.
00119     ACE_UINT32 sec_timeout_;
00120 
00121     /// Max micro seconds to wait for name if not blocking forever.
00122     ACE_UINT32 usec_timeout_;
00123 
00124     /// The data portion contains <time_>
00125     ACE_UINT32 time_;
00126   };
00127 
00128   /// Transfer buffer.
00129   Transfer transfer_;
00130 
00131   /// Time
00132   ACE_UINT32 time_;
00133 };
00134 
00135 
00136 #include "ace/post.h"
00137 #endif /* ACE_TIME_REQUEST_REPLY_H */

Generated on Mon Jun 16 11:21:47 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002