00001 // -*- C++ -*- 00002 00003 //========================================================================== 00004 /** 00005 * @file Remote_Name_Space.h 00006 * 00007 * Remote_Name_Space.h,v 4.20 2005/10/28 16:14:55 ossama Exp 00008 * 00009 * @author Prashant Jain 00010 */ 00011 //========================================================================== 00012 00013 00014 #ifndef ACE_REMOTE_NAME_SPACE_H 00015 #define ACE_REMOTE_NAME_SPACE_H 00016 00017 #include /**/ "ace/pre.h" 00018 00019 #include "ace/ACE_export.h" 00020 00021 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00022 # pragma once 00023 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00024 00025 #include "ace/Name_Proxy.h" 00026 #include "ace/Name_Space.h" 00027 00028 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00029 00030 class ACE_NS_WString; 00031 00032 typedef ACE_Unbounded_Set<ACE_NS_WString> ACE_WSTRING_SET; 00033 00034 /** 00035 * @class ACE_Remote_Name_Space 00036 * 00037 * @brief Maintaining accesses Remote Name Server Database. Allows to 00038 * add NameBindings, change them, remove them and resolve 00039 * NameBindings. 00040 * 00041 * Manages a Naming Service for a remote name space which 00042 * includes bindings for net_local naming context. All strings 00043 * are stored in wide character format. A Name Binding consists 00044 * of a name (that's the key), a value string and an optional 00045 * type string (no wide chars). 00046 */ 00047 class ACE_Export ACE_Remote_Name_Space : public ACE_Name_Space 00048 { 00049 public: 00050 // = Initialization and termination methods. 00051 /// "Do-nothing" constructor. 00052 ACE_Remote_Name_Space (void); 00053 00054 /** 00055 * Specifies the scope of this namespace, opens and memory-maps the 00056 * associated file (if accessible) or contacts the dedicated name 00057 * server process for NET_LOCAL namespace. 00058 */ 00059 ACE_Remote_Name_Space (const ACE_TCHAR *hostname, u_short port); 00060 00061 /** 00062 * Specifies the scope of this namespace, opens and memory-maps the 00063 * associated file (if accessible) or contacts the dedicated name 00064 * server process for NET_LOCAL namespace. 00065 */ 00066 int open (const ACE_TCHAR *servername, u_short port); 00067 00068 /// destructor, do some cleanup :TBD: last dtor should "compress" 00069 /// file 00070 ~ACE_Remote_Name_Space (void); 00071 00072 /// Bind a new name to a naming context (Wide character strings). 00073 virtual int bind (const ACE_NS_WString &name_in, 00074 const ACE_NS_WString &value_in, 00075 const char *type_in = ""); 00076 00077 /** 00078 * Overwrite the value or type of an existing name in a 00079 * ACE_Remote_Name_Space or bind a new name to the context, if it 00080 * didn't exist yet. (Wide charcter strings interface). 00081 */ 00082 virtual int rebind (const ACE_NS_WString &name_in, 00083 const ACE_NS_WString &value_in, 00084 const char *type_in = ""); 00085 00086 /// Delete a name from a ACE_Remote_Name_Space (Wide charcter strings 00087 /// Interface). 00088 virtual int unbind (const ACE_NS_WString &name_in); 00089 00090 /// Get value and type of a given name binding (Wide chars). The 00091 /// caller is responsible for deleting both <value_out> and <type_out>! 00092 virtual int resolve (const ACE_NS_WString &name_in, 00093 ACE_NS_WString &value_out, 00094 char *&type_out); 00095 00096 /// Get a set of names matching a specified pattern (wchars). Matching 00097 /// means the names must begin with the pattern string. 00098 virtual int list_names (ACE_WSTRING_SET &set_out, 00099 const ACE_NS_WString &pattern_in); 00100 00101 /// Get a set of values matching a specified pattern (wchars). Matching 00102 /// means the values must begin with the pattern string. 00103 virtual int list_values (ACE_WSTRING_SET &set_out, 00104 const ACE_NS_WString &pattern_in); 00105 00106 /// Get a set of types matching a specified pattern (wchars). Matching 00107 /// means the types must begin with the pattern string. 00108 virtual int list_types (ACE_WSTRING_SET &set_out, 00109 const ACE_NS_WString &pattern_in); 00110 00111 /** 00112 * Get a set of names matching a specified pattern (wchars). Matching 00113 * means the names must begin with the pattern string. Returns the 00114 * complete binding associated each pattern match. 00115 */ 00116 virtual int list_name_entries (ACE_BINDING_SET &set, 00117 const ACE_NS_WString &pattern); 00118 00119 /** 00120 * Get a set of values matching a specified pattern (wchars). Matching 00121 * means the values must begin with the pattern string. Returns the 00122 * complete binding associated each pattern match. 00123 */ 00124 virtual int list_value_entries (ACE_BINDING_SET &set, 00125 const ACE_NS_WString &pattern); 00126 00127 /** 00128 * Get a set of types matching a specified pattern (wchars). Matching 00129 * means the types must begin with the pattern string. Returns the 00130 * complete binding associated each pattern match. 00131 */ 00132 virtual int list_type_entries (ACE_BINDING_SET &set, 00133 const ACE_NS_WString &pattern); 00134 00135 /// Dump the state of the object. 00136 virtual void dump (void) const; 00137 00138 private: 00139 /// Interface to Name server process for NET_LOCAL namespace. 00140 ACE_Name_Proxy ns_proxy_; 00141 }; 00142 00143 ACE_END_VERSIONED_NAMESPACE_DECL 00144 00145 #include /**/ "ace/post.h" 00146 00147 #endif /* ACE_REMOTE_NAME_SPACE_H */