(file) Return to peg_slp_agent.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / slp

  1 mday  1.1 //%///-*-c++-*-/////////////////////////////////////////////////////////////////
  2           //
  3           // Copyright (c) 2003 BMC Software, Hewlett-Packard Company, IBM,
  4           // The Open Group, Tivoli Systems
  5           //
  6           // Permission is hereby granted, free of charge, to any person obtaining a copy
  7           // of this software and associated documentation files (the "Software"), to
  8           // deal in the Software without restriction, including without limitation the
  9           // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 10           // sell copies of the Software, and to permit persons to whom the Software is
 11           // furnished to do so, subject to the following conditions:
 12           // 
 13           // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 14           // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 15           // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 16           // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 17           // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 18           // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 19           // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 20           // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 21           //
 22 mday  1.1 //==============================================================================
 23           //
 24           // Author: Mike Day (mdday@us.ibm.com)
 25           //
 26           // Modified By:
 27           //
 28           //%/////////////////////////////////////////////////////////////////////////////
 29           
 30           
 31           #ifndef Pegasus_slp_agent_h
 32           #define Pegasus_slp_agent_h
 33           
 34           #include <Pegasus/Common/Config.h>
 35 mday  1.2 #include <Pegasus/Common/System.h>
 36 mday  1.1 #include <Pegasus/Common/IPC.h>
 37           #include <Pegasus/Common/Thread.h>
 38 mday  1.2 #include <Pegasus/Common/HashTable.h>
 39 mday  1.3 #include <Pegasus/Common/Exception.h>
 40 mday  1.2 #include "Linkage.h"
 41 mday  1.1 #include <Pegasus/../Unsupported/slp_client/src/cmd-utils/slp_client/slp_client.h>
 42           
 43           PEGASUS_NAMESPACE_BEGIN
 44           
 45           
 46 mday  1.2 class sa_reg_params;
 47           
 48           struct slpTableEqual
 49           {
 50               static Boolean equal(const String & x, const String & y)
 51               {
 52                   if (0 == String::compareNoCase(x, y))
 53                       return true;
 54                   return false;
 55               }
 56           };
 57 mday  1.1 
 58 mday  1.2 struct slpTableHash
 59           {
 60                 static Uint32 hash(const String & str)
 61                 {
 62           	 String cpy(str);
 63           	 cpy.toLower();
 64           	 Uint32 h = 0;
 65           	 for(Uint32 i = 0, n = cpy.size(); i < n; i++)
 66                       h = 5 * h + cpy[i];
 67           	 return h;
 68                 }
 69           };
 70           
 71           typedef HashTable<String, sa_reg_params*, slpTableEqual, slpTableHash > slp_reg_table;
 72           
 73           class PEGASUS_SLP_LINKAGE slp_service_agent
 74 mday  1.1 {
 75              public:
 76                 slp_service_agent(void);
 77                 slp_service_agent(const char *local_interface, 
 78           			unsigned short target_port,
 79           			const char *scopes,
 80           			Boolean listen,
 81           			Boolean use_da);
 82                 ~slp_service_agent(void);
 83                 
 84 mday  1.2       Boolean srv_register(const char *url, 
 85           		       const char *attributes, 
 86           		       const char *type,
 87           		       const char *scopes, 
 88           		       unsigned short lifetime);
 89 mday  1.1       
 90 mday  1.3       Uint32 test_registration(const char *url, 
 91 mday  1.1 			       const char *attrs, 
 92 mday  1.3 			       const char *type, 
 93 mday  1.1 			       const char *scopes);
 94           
 95                 static PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL service_listener(void *);
 96 mday  1.2       
 97                 void start_listener(void);
 98                 void unregister(void);
 99 mday  1.1 			
100              private:
101 mday  1.2 
102           
103           
104 mday  1.1       slp_service_agent(const slp_service_agent & );
105                 slp_service_agent & operator= (const slp_service_agent &);
106           
107 mday  1.2       struct slp_client* _rep;
108 mday  1.1 
109                 slp_client * (*_create_client )(const int8 *,
110           				      const int8 *, 
111           				      uint16,
112           				      const int8 *, 
113           				      const int8 *, 
114           				      BOOL, 
115           				      BOOL);
116 mday  1.2       void (*_destroy_client)(struct slp_client *);
117 mday  1.1       
118 mday  1.2       
119                 int (*_find_das)(struct slp_client *client, 
120           		       const int8 *predicate, 
121           		       const int8 *scopes);
122           
123 mday  1.1       uint32 (*_test_reg)(int8 *, 
124           			  int8 *, 
125           			  int8 *, 
126           			  int8 *);
127                 
128                 DynamicLibraryHandle _lib_handle;
129                 String _lib_fileName;
130           
131                 void _init(void);
132                 void _de_init(void);
133 mday  1.2       Thread _listen_thread;
134                 AtomicInt _should_listen;
135                 AtomicInt _initialized;
136                 AtomicInt _using_das;
137                 slp_reg_table _internal_regs;
138 mday  1.1 };
139           
140           
141           // class PEGASUS_SLP_LINKAGE slp_user_agent
142           // {
143           
144           // };
145           
146           
147           
148           PEGASUS_NAMESPACE_END
149           
150           #endif // Pegasus_slp_agent_h

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2