1 mike 1.2 //%/////////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2000, 2001 BMC Software, Hewlett Packard, IBM, The Open Group,
4 // 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 mike 1.2 //==============================================================================
23 //
24 // Author: Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)
25 //
26 // Modified By:
27 //
28 //%/////////////////////////////////////////////////////////////////////////////
29
30 #include <Pegasus/Common/Config.h>
31 #include <iostream>
32 #include <Pegasus/Handler/CIMHandler.h>
33 #include <Pegasus/Repository/CIMRepository.h>
34
35 #include "snmpIndicationHandler.h"
36
37 #ifdef HPUX_EMANATE
38 #include "snmpDeliverTrap_emanate.h"
39 #else
40 #include "snmpDeliverTrap_stub.h"
41 #endif
42
43 mike 1.2 PEGASUS_NAMESPACE_BEGIN
44
45 PEGASUS_USING_STD;
46
47 //#define DDD(X) X
48 #define DDD(X) // X
49
50 DDD(static const char* _SNMPINDICATIONHANDLER = "snmpIndicationHandler::";)
51
52 void snmpIndicationHandler::initialize(CIMRepository* repository)
53 {
54 _repository = repository;
55 DDD(cout << _SNMPINDICATIONHANDLER << "initialize()" << endl;)
56 }
57
|
92 kumpf 1.3 qualifierPos = trapProp.findQualifier("MappingStrings");
93 trapQualifier = trapProp.getQualifier(qualifierPos);
94
95 mapstr1.clear();
96 mapstr1 = trapQualifier.getValue().toString();
97
98 if ((mapstr1.find("OID.IETF") != PEG_NOT_FOUND) &&
99 (mapstr1.find("DataType.IETF") != PEG_NOT_FOUND))
100 {
101 if (mapstr1.subString(0, 8) == "OID.IETF")
102 {
103 mapstr1 = mapstr1.subString(mapstr1.find("SNMP.")+5);
104 if (mapstr1.find("|") != PEG_NOT_FOUND)
105 {
106 mapstr2.clear();
107 mapstr2 = mapstr1.subString(0,
108 mapstr1.find("DataType.IETF")-1);
109 propOIDs.append(mapstr2);
110
111 propValue.clear();
112 propValue = prop.getValue().toString();
113 kumpf 1.3 propVALUEs.append(propValue);
114
115 mapstr2 = mapstr1.subString(mapstr1.find("|")+2);
|
135 kumpf 1.3 if ((handler.findProperty("TrapDestination") != PEG_NOT_FOUND) &&
136 (handler.findProperty("SNMPVersion") != PEG_NOT_FOUND) &&
137 (indication.findQualifier("TrapOid") != PEG_NOT_FOUND))
138 {
139 String community, trapType, destination; // from handler instance
140 String trapOid; // from indication instance
141
142 trapOid = indication.getQualifier(
143 indication.findQualifier("TrapOid")).getValue().toString();
144
145 community = handler.getProperty(
146 handler.findProperty("SNMPCommunityName")).getValue().toString();
147
148 destination = handler.getProperty(
149 handler.findProperty("TrapDestination")).getValue().toString();
150
151 trapType = handler.getProperty(
152 handler.findProperty("SNMPVersion")).getValue().toString();
153
154 emanateTrap.deliverTrap(
155 trapOid,
156 kumpf 1.3 community,
157 destination,
158 trapType,
159 propOIDs,
160 propTYPEs,
161 propVALUEs);
|