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