Time_Request_Reply.h

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

Generated on Thu Nov 9 09:42:07 2006 for ACE by doxygen 1.3.6