1 martin 1.40 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.41 //
|
3 martin 1.40 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
|
9 martin 1.41 //
|
10 martin 1.40 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
|
16 martin 1.41 //
|
17 martin 1.40 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.41 //
|
20 martin 1.40 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.41 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.40 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27 martin 1.41 //
|
28 martin 1.40 //////////////////////////////////////////////////////////////////////////
|
29 mike 1.2 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #include <Pegasus/Common/Config.h>
|
33 kumpf 1.7 #include <Pegasus/Common/PegasusVersion.h>
34
|
35 mike 1.2 #include <iostream>
36 #include <Pegasus/Handler/CIMHandler.h>
37 #include <Pegasus/Repository/CIMRepository.h>
|
38 kumpf 1.23 #include <Pegasus/Common/Tracer.h>
|
39 mike 1.2
40 #include "snmpIndicationHandler.h"
41
42 #ifdef HPUX_EMANATE
|
43 kumpf 1.34 # include "snmpDeliverTrap_emanate.h"
|
44 yi.zhou 1.27 #elif defined (PEGASUS_USE_NET_SNMP)
|
45 kumpf 1.34 # include "snmpDeliverTrap_netsnmp.h"
|
46 mike 1.2 #endif
47
|
48 humberto 1.15 #include <Pegasus/Common/MessageLoader.h>
49
|
50 kumpf 1.32 PEGASUS_USING_STD;
51
|
52 mike 1.2 PEGASUS_NAMESPACE_BEGIN
53
|
54 kumpf 1.32 snmpIndicationHandler::snmpIndicationHandler()
55 {
56 PEG_METHOD_ENTER (TRC_IND_HANDLER,
57 "snmpIndicationHandler::snmpIndicationHandler");
|
58 mike 1.2
|
59 yi.zhou 1.30 #ifdef HPUX_EMANATE
|
60 kumpf 1.32 _snmpTrapSender = new snmpDeliverTrap_emanate();
|
61 yi.zhou 1.30 #elif defined (PEGASUS_USE_NET_SNMP)
|
62 kumpf 1.32 _snmpTrapSender = new snmpDeliverTrap_netsnmp();
|
63 yi.zhou 1.30 #endif
64
65 PEG_METHOD_EXIT();
66 }
67
|
68 mike 1.2 void snmpIndicationHandler::initialize(CIMRepository* repository)
69 {
|
70 yi.zhou 1.30 PEG_METHOD_ENTER (TRC_IND_HANDLER,
71 "snmpIndicationHandler::initialize");
72
|
73 mike 1.2 _repository = repository;
|
74 yi.zhou 1.30
|
75 kumpf 1.32 _snmpTrapSender->initialize();
|
76 yi.zhou 1.30
77 PEG_METHOD_EXIT();
78 }
79
80 void snmpIndicationHandler::terminate()
81 {
|
82 kumpf 1.34 PEG_METHOD_ENTER(TRC_IND_HANDLER,
|
83 yi.zhou 1.30 "snmpIndicationHandler::terminate");
84
|
85 kumpf 1.32 _snmpTrapSender->terminate();
|
86 yi.zhou 1.30
87 PEG_METHOD_EXIT();
88 }
89
90 snmpIndicationHandler::~snmpIndicationHandler()
91 {
|
92 kumpf 1.34 PEG_METHOD_ENTER(TRC_IND_HANDLER,
|
93 yi.zhou 1.30 "snmpIndicationHandler::~snmpIndicationHandler");
94
|
95 kumpf 1.32 delete _snmpTrapSender;
|
96 yi.zhou 1.30
97 PEG_METHOD_EXIT();
|
98 mike 1.2 }
99
|
100 chuck 1.14 // l10n - note: ignoring indication language
|
101 kumpf 1.16 void snmpIndicationHandler::handleIndication(
102 const OperationContext& context,
|
103 yi.zhou 1.26 const String nameSpace,
104 CIMInstance& indication,
|
105 kumpf 1.34 CIMInstance& handler,
|
106 yi.zhou 1.26 CIMInstance& subscription,
|
107 kumpf 1.28 ContentLanguageList & contentLanguages)
|
108 mike 1.2 {
109 Array<String> propOIDs;
110 Array<String> propTYPEs;
111 Array<String> propVALUEs;
112
|
113 yi.zhou 1.36 Array<String> mapStr;
|
114 mike 1.2
|
115 kumpf 1.34 PEG_METHOD_ENTER(TRC_IND_HANDLER,
116 "snmpIndicationHandler::handleIndication");
|
117 mike 1.2
|
118 kumpf 1.20 try
119 {
|
120 marek 1.38 PEG_TRACE ((TRC_INDICATION_GENERATION, Tracer::LEVEL4,
|
121 w.otsuka 1.37 "snmpIndicationHandler %s:%s.%s processing %s Indication",
122 (const char*)(nameSpace.getCString()),
123 (const char*)(handler.getClassName().getString().getCString()),
124 (const char*)(handler.getProperty(
125 handler.findProperty(PEGASUS_PROPERTYNAME_NAME)).
126 getValue().toString().getCString()),
127 (const char*)(indication.getClassName().getString().
128 getCString())));
|
129 kumpf 1.34 CIMClass indicationClass = _repository->getClass(
130 nameSpace, indication.getClassName(), false, true,
131 false, CIMPropertyList());
|
132 kumpf 1.20
|
133 kumpf 1.34 Uint32 propertyCount = indication.getPropertyCount();
|
134 kumpf 1.13
|
135 kumpf 1.34 for (Uint32 i=0; i < propertyCount; i++)
136 {
|
137 yi.zhou 1.36 CIMProperty prop = indication.getProperty(i);
|
138 mike 1.2
|
139 yi.zhou 1.36 Uint32 propDeclPos = indicationClass.findProperty(prop.getName());
140 if (propDeclPos != PEG_NOT_FOUND)
|
141 kumpf 1.4 {
|
142 yi.zhou 1.36 CIMProperty propDecl = indicationClass.getProperty(propDeclPos);
143
144 Uint32 qualifierPos =
145 propDecl.findQualifier(CIMName("MappingStrings"));
146 if (qualifierPos != PEG_NOT_FOUND)
|
147 kumpf 1.20 {
|
148 yi.zhou 1.36 //
149 // We are looking for following fields:
|
150 kumpf 1.42 // MappingStrings {"OID.IETF | SNMP." oidStr,
|
151 yi.zhou 1.36 // "DataType.IETF |" dataType}
152 // oidStr is the object identifier (e.g. "1.3.6.1.2.1.5..."
|
153 kumpf 1.42 // dataType is either Integer, or OctetString,
|
154 yi.zhou 1.36 // or OID
155 // Following is one example:
156 // MappingStrings {"OID.IETF | SNMP.1.3.6.6.3.1.1.5.2",
157 // "DataType.IETF | Integer"}
158 //
159
160 propDecl.getQualifier(qualifierPos).getValue().get(
161 mapStr);
|
162 kumpf 1.42
|
163 yi.zhou 1.36 String oidStr, dataType;
164 String mapStr1, mapStr2;
165 Boolean isValidAuthority = false;
166 Boolean isValidDataType = false;
|
167 mike 1.2
|
168 yi.zhou 1.36 for (Uint32 j=0; j < mapStr.size(); j++)
|
169 kumpf 1.20 {
|
170 yi.zhou 1.36 Uint32 barPos = mapStr[j].find("|");
|
171 kumpf 1.42
172 if (barPos != PEG_NOT_FOUND)
|
173 yi.zhou 1.36 {
174 mapStr1 = mapStr[j].subString(0, barPos);
175 mapStr2 = mapStr[j].subString(barPos + 1);
|
176 kumpf 1.34
|
177 yi.zhou 1.36 _trimWhitespace(mapStr1);
178 _trimWhitespace(mapStr2);
|
179 kumpf 1.42
|
180 yi.zhou 1.36 if ((mapStr1 == "OID.IETF") &&
|
181 kumpf 1.42 (String::compare(mapStr2,
|
182 yi.zhou 1.36 String("SNMP."), 5) == 0))
183 {
184 isValidAuthority = true;
185 oidStr = mapStr2.subString(5);
186 }
187 else if (mapStr1 == "DataType.IETF")
188 {
189 isValidDataType = true;
190 dataType = mapStr2;
191 }
|
192 kumpf 1.34
|
193 kumpf 1.42 if (isValidAuthority && isValidDataType)
|
194 kumpf 1.34 {
|
195 yi.zhou 1.36 propOIDs.append(oidStr);
196 propTYPEs.append(dataType);
197 propVALUEs.append(prop.getValue().toString());
198
199 break;
|
200 kumpf 1.34 }
201 }
202 }
|
203 kumpf 1.20 }
|
204 kumpf 1.4 }
|
205 mike 1.2 }
206
207 // Collected complete data in arrays and ready to send the trap.
208 // trap destination and SNMP type are defined in handlerInstance
209 // and passing this instance as it is to deliverTrap() call
210
|
211 kumpf 1.34 Uint32 targetHostPos = handler.findProperty(CIMName("TargetHost"));
212 Uint32 targetHostFormatPos =
213 handler.findProperty(CIMName("TargetHostFormat"));
214 Uint32 otherTargetHostFormatPos =
215 handler.findProperty(CIMName("OtherTargetHostFormat"));
216 Uint32 portNumberPos = handler.findProperty(CIMName("PortNumber"));
217 Uint32 snmpVersionPos = handler.findProperty(CIMName("SNMPVersion"));
218 Uint32 securityNamePos =
219 handler.findProperty(CIMName("SNMPSecurityName"));
220 Uint32 engineIDPos = handler.findProperty(CIMName("SNMPEngineID"));
|
221 sahana.prabhakar 1.43 Uint32 snmpSecLevelPos =
222 handler.findProperty(CIMName("SNMPSecurityLevel"));
223 Uint32 snmpSecAuthProtoPos =
224 handler.findProperty(CIMName("SNMPSecurityAuthProtocol"));
225 Uint32 snmpSecAuthKeyPos =
226 handler.findProperty(CIMName("SNMPSecurityAuthKey"));
227 Uint32 snmpSecPrivProtoPos =
228 handler.findProperty(CIMName("SNMPSecurityPrivProtocol"));
229 Uint32 snmpSecPrivKeyPos =
230 handler.findProperty(CIMName("SNMPSecurityPrivKey"));
|
231 kumpf 1.20
|
232 w.otsuka 1.37 if (targetHostPos == PEG_NOT_FOUND)
233 {
|
234 marek 1.38 PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL1,
|
235 w.otsuka 1.37 "Target host is not set for IndicationHandlerSNMPMapper %s"
236 " Indication.",
237 (const char*)(indication.getClassName().getString().
238 getCString())));
239 PEG_METHOD_EXIT();
240 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
241 "Handler.snmpIndicationHandler.snmpIndicationHandler."
242 "INVALID_SNMP_INSTANCE",
243 "Invalid IndicationHandlerSNMPMapper instance"));
244 }
245 if (targetHostFormatPos == PEG_NOT_FOUND)
246 {
|
247 marek 1.38 PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL1,
|
248 w.otsuka 1.37 "Target host format is not set for IndicationHandlerSNMPMapper"
249 " %s Indication.",
250 (const char*)(indication.getClassName().getString().
251 getCString())));
252 PEG_METHOD_EXIT();
253 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
254 "Handler.snmpIndicationHandler.snmpIndicationHandler."
255 "INVALID_SNMP_INSTANCE",
256 "Invalid IndicationHandlerSNMPMapper instance"));
257 }
258 if (snmpVersionPos == PEG_NOT_FOUND)
259 {
|
260 marek 1.38 PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL1,
|
261 w.otsuka 1.37 "SNMP Version is not set for IndicationHandlerSNMPMapper %s"
262 " Indication.",
263 (const char*)(indication.getClassName().getString().
264 getCString())));
265 PEG_METHOD_EXIT();
266 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
267 "Handler.snmpIndicationHandler.snmpIndicationHandler."
268 "INVALID_SNMP_INSTANCE",
269 "Invalid IndicationHandlerSNMPMapper instance"));
270 }
271 else
|
272 kumpf 1.16 {
|
273 kumpf 1.34 // properties from the handler instance
|
274 kumpf 1.20 String targetHost;
|
275 kumpf 1.34 String otherTargetHostFormat = String();
276 String securityName = String();
277 String engineID = String();
278 Uint16 targetHostFormat = 0;
279 Uint16 snmpVersion = 0;
280 Uint32 portNumber;
|
281 sahana.prabhakar 1.43 Uint8 snmpSecLevel = 1; // noAuthnoPriv
282 Uint8 snmpSecAuthProto = 0;
283 Array<Uint8> snmpSecAuthKey;// no key
284 Uint8 snmpSecPrivProto = 0;
285 Array<Uint8> snmpSecPrivKey ;// no key
|
286 kumpf 1.20
|
287 kumpf 1.34 String trapOid;
|
288 yi.zhou 1.36 Boolean trapOidAvailable = false;
|
289 kumpf 1.34 //
|
290 kumpf 1.20 // Get snmpTrapOid from context
291 //
|
292 kumpf 1.34 if (context.contains(SnmpTrapOidContainer::NAME))
293 {
294 SnmpTrapOidContainer trapContainer =
295 context.get(SnmpTrapOidContainer::NAME);
|
296 kumpf 1.16
|
297 kumpf 1.20 trapOid = trapContainer.getSnmpTrapOid();
|
298 yi.zhou 1.36 trapOidAvailable = true;
|
299 kumpf 1.34 }
300 else
|
301 kumpf 1.20 {
|
302 kumpf 1.34 // get trapOid from indication Class
|
303 kumpf 1.16
|
304 kumpf 1.34 Uint32 pos =
305 indicationClass.findQualifier(CIMName("MappingStrings"));
306 if (pos != PEG_NOT_FOUND)
307 {
|
308 yi.zhou 1.36 Array<String> classMapStr;
309 indicationClass.getQualifier(pos).getValue().
310 get(classMapStr);
|
311 kumpf 1.20
|
312 yi.zhou 1.36 for (Uint32 i=0; i < classMapStr.size(); i++)
313 {
314 Uint32 barPos = classMapStr[i].find("|");
|
315 kumpf 1.20
|
316 kumpf 1.42 if (barPos != PEG_NOT_FOUND)
|
317 yi.zhou 1.36 {
|
318 kumpf 1.42 String authorityName =
|
319 yi.zhou 1.36 classMapStr[i].subString(0, barPos);
320 String oidStr = classMapStr[i].subString(
321 barPos+1, PEG_NOT_FOUND);
322
323 _trimWhitespace(authorityName);
324 _trimWhitespace(oidStr);
325
326 if ((authorityName == "OID.IETF") &&
|
327 kumpf 1.42 (String::compare(oidStr,
|
328 yi.zhou 1.36 String("SNMP."), 5) == 0))
329 {
|
330 kumpf 1.42 trapOid = oidStr.subString(5);
|
331 yi.zhou 1.36 trapOidAvailable = true;
332 break;
333 }
334 }
|
335 kumpf 1.20 }
|
336 yi.zhou 1.36
337 if (!trapOidAvailable)
|
338 kumpf 1.34 {
|
339 marek 1.38 PEG_TRACE((
340 TRC_IND_HANDLER,
341 Tracer::LEVEL1,
342 "No MappingStrings for snmp trap is specified "
343 "for class: %s",
344 (const char*)
345 indication.getClassName().getString().getCString()
346 ));
|
347 yi.zhou 1.36
|
348 kumpf 1.34 PEG_METHOD_EXIT();
|
349 yi.zhou 1.36
|
350 marek 1.38 throw PEGASUS_CIM_EXCEPTION_L(
351 CIM_ERR_FAILED,
|
352 kumpf 1.34 MessageLoaderParms(
353 "Handler.snmpIndicationHandler."
|
354 yi.zhou 1.36 "snmpIndicationHandler.NO_MS_FOR_SNMP_TRAP",
|
355 marek 1.38 "No MappingStrings for snmp trap is specified "
356 "for class: $0",
357 indication.getClassName().getString()));
|
358 kumpf 1.34 }
359 }
360 else
361 {
|
362 marek 1.38 PEG_TRACE_CSTRING(TRC_IND_HANDLER, Tracer::LEVEL1,
|
363 kumpf 1.34 "Qualifier MappingStrings can not be found.");
364 PEG_METHOD_EXIT();
365 MessageLoaderParms parms(
366 "Handler.snmpIndicationHandler.snmpIndicationHandler."
367 "QUALIFIER_MAPPINGS_NOT_FOUND",
368 "Qualifier MappingStrings can not be found");
369 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, parms);
370 }
371 }
372
373 handler.getProperty(targetHostPos).getValue().get(targetHost);
374 handler.getProperty(targetHostFormatPos).getValue().get(
375 targetHostFormat);
376 if (otherTargetHostFormatPos != PEG_NOT_FOUND)
377 {
378 handler.getProperty(otherTargetHostFormatPos).getValue().get(
379 otherTargetHostFormat);
380 }
381 if (portNumberPos != PEG_NOT_FOUND)
382 {
383 handler.getProperty(portNumberPos).getValue().get(portNumber);
384 kumpf 1.34 }
385 else
386 {
387 // default port
388 portNumber = SNMP_TRAP_DEFAULT_PORT;
389 }
390
391 handler.getProperty(snmpVersionPos).getValue().get(snmpVersion);
392 if (securityNamePos != PEG_NOT_FOUND)
393 {
394 handler.getProperty(securityNamePos).getValue().get(
395 securityName);
396 }
397 if (engineIDPos != PEG_NOT_FOUND)
398 {
399 handler.getProperty(engineIDPos).getValue().get(engineID);
400 }
|
401 kumpf 1.13
|
402 sahana.prabhakar 1.43 if(snmpVersion == 5) // SNMPv3 Trap
403 {
404 //fetch the security data
405 if(snmpSecLevelPos != PEG_NOT_FOUND)
406 {
407 handler.getProperty(snmpSecLevelPos).getValue(). \
408 get(snmpSecLevel);
409 }
410 if(snmpSecAuthProtoPos != PEG_NOT_FOUND)
411 {
412 handler.getProperty(snmpSecAuthProtoPos).getValue(). \
413 get(snmpSecAuthProto);
414 }
415 if(snmpSecAuthKeyPos != PEG_NOT_FOUND)
416 {
417 handler.getProperty(snmpSecAuthKeyPos).getValue(). \
418 get(snmpSecAuthKey);
419 }
420 if(snmpSecPrivProtoPos != PEG_NOT_FOUND)
421 {
422 handler.getProperty(snmpSecPrivProtoPos).getValue(). \
423 sahana.prabhakar 1.43 get(snmpSecPrivProto);
424 }
425 if(snmpSecPrivKeyPos!= PEG_NOT_FOUND)
426 {
427 handler.getProperty(snmpSecPrivKeyPos).getValue(). \
428 get(snmpSecPrivKey);
429 }
430 }
431
|
432 marek 1.38 PEG_TRACE ((TRC_INDICATION_GENERATION, Tracer::LEVEL4,
|
433 w.otsuka 1.37 "snmpIndicationHandler sending %s Indication trap %s to target"
434 " host %s target port %d",
435 (const char*)(indication.getClassName().getString().
436 getCString()),
437 (const char*)(trapOid.getCString()),
438 (const char*)(targetHost.getCString()),portNumber));
439 _snmpTrapSender->deliverTrap(
|
440 kumpf 1.20 trapOid,
441 securityName,
442 targetHost,
443 targetHostFormat,
|
444 kumpf 1.34 otherTargetHostFormat,
445 portNumber,
446 snmpVersion,
447 engineID,
|
448 sahana.prabhakar 1.43 snmpSecLevel,
449 snmpSecAuthProto,
450 snmpSecAuthKey,
451 snmpSecPrivProto,
452 snmpSecPrivKey,
|
453 kumpf 1.34 propOIDs,
454 propTYPEs,
|
455 kumpf 1.20 propVALUEs);
|
456 w.otsuka 1.37
|
457 marek 1.38 PEG_TRACE ((TRC_INDICATION_GENERATION, Tracer::LEVEL4,
|
458 w.otsuka 1.37 "%s Indication trap %s sent to target host %s target port %d "
459 "successfully",
460 (const char*)(indication.getClassName().getString().getCString()),
461 (const char*)(trapOid.getCString()),
462 (const char*)(targetHost.getCString()),portNumber));
|
463 kumpf 1.20 }
|
464 kumpf 1.34 }
465 catch (CIMException& c)
|
466 kumpf 1.20 {
|
467 thilo.boehm 1.39 PEG_TRACE((TRC_IND_HANDLER, Tracer::LEVEL1, "CIMException %s",
468 (const char*)c.getMessage().getCString()));
|
469 kumpf 1.34 PEG_METHOD_EXIT();
470 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, c.getMessage());
|
471 kumpf 1.20 }
472 catch (Exception& e)
473 {
|
474 thilo.boehm 1.39 PEG_TRACE((TRC_IND_HANDLER, Tracer::LEVEL1, "Exception %s",
475 (const char*)e.getMessage().getCString()));
|
476 kumpf 1.34 PEG_METHOD_EXIT();
|
477 kumpf 1.20
|
478 kumpf 1.34 throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, e.getMessage());
|
479 kumpf 1.20 }
480 catch (...)
481 {
|
482 marek 1.38 PEG_TRACE_CSTRING(TRC_IND_HANDLER, Tracer::LEVEL1,
|
483 kumpf 1.34 "Failed to deliver trap.");
484 PEG_METHOD_EXIT();
485
486 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms(
487 "Handler.snmpIndicationHandler.snmpIndicationHandler."
488 "FAILED_TO_DELIVER_TRAP",
489 "Failed to deliver trap."));
|
490 kumpf 1.13 }
|
491 yi.zhou 1.30 PEG_METHOD_EXIT();
|
492 mike 1.2 }
493
|
494 yi.zhou 1.36 void snmpIndicationHandler::_trimWhitespace(
495 String & nameStr)
496 {
497 PEG_METHOD_ENTER(TRC_IND_HANDLER,
498 "snmpIndicationHandler::_trimWhitespace");
499
500 Uint32 ps = 0;
501 // skip begining whitespace
502 for (ps = 0; ps < nameStr.size(); ps++)
503 {
504 if (nameStr[ps] != ' ')
505 {
506 break;
507 }
508 }
509
510 if (ps != 0)
511 {
512 nameStr.remove(0, ps);
513 }
514
515 yi.zhou 1.36 // skip the appended whitespace
516 for (ps = nameStr.size(); ps != 0; ps--)
517 {
518 if (nameStr[ps-1] != ' ')
519 {
520 break;
521 }
522 }
523
524 if (ps != nameStr.size())
525 {
526 nameStr.remove(ps);
527 }
528
529 PEG_METHOD_EXIT();
530 }
531
|
532 kumpf 1.32 PEGASUS_NAMESPACE_END
533
534 PEGASUS_USING_PEGASUS;
535
|
536 kumpf 1.33 // This is the entry point into this dynamic module.
|
537 mike 1.2
|
538 kumpf 1.33 extern "C" PEGASUS_EXPORT CIMHandler* PegasusCreateHandler(
539 const String& handlerName)
|
540 kumpf 1.32 {
|
541 kumpf 1.33 if (handlerName == "snmpIndicationHandler")
542 {
543 return new snmpIndicationHandler;
544 }
545
546 return 0;
|
547 mike 1.2 }
|