00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090 #ifndef vacm_h_
00091 #define vacm_h_
00092
00093 #include <agent_pp/vacm_class.h>
00094 #include <agent_pp/mib.h>
00095 #include <agent_pp/snmp_textual_conventions.h>
00096
00097 #ifdef AGENTPP_NAMESPACE
00098 namespace Agentpp {
00099 #endif
00100
00101
00102 #define oidSnmpModules "1.3.6.1.6.3"
00103 #define oidSnmpVacmMIB "1.3.6.1.6.3.16"
00104 #define oidVacmMIBObjects "1.3.6.1.6.3.16.1"
00105 #define oidVacmMIBConformance "1.3.6.1.6.3.16.2"
00106
00107
00108 #define oidVacmContextTable "1.3.6.1.6.3.16.1.1"
00109 #define oidVacmContextEntry "1.3.6.1.6.3.16.1.1.1"
00110 #define oidVacmContextName "1.3.6.1.6.3.16.1.1.1.1"
00111
00112 #define oidVacmSecurityToGroupTable "1.3.6.1.6.3.16.1.2"
00113 #define oidVacmSecurityToGroupEntry "1.3.6.1.6.3.16.1.2.1"
00114 #define oidVacmSecurityModel "1.3.6.1.6.3.16.1.2.1.1" // 1.index
00115 #define oidVacmSecurityName "1.3.6.1.6.3.16.1.2.1.2" // 2.index
00116 #define oidVacmGroupName "1.3.6.1.6.3.16.1.2.1.3"
00117 #define oidVacmSecurityToGroupStorageType "1.3.6.1.6.3.16.1.2.1.4"
00118 #define oidVacmSecurityToGroupStatus "1.3.6.1.6.3.16.1.2.1.5"
00119
00120
00121 #define oidVacmAccessTable "1.3.6.1.6.3.16.1.4"
00122 #define oidVacmAccessEntry "1.3.6.1.6.3.16.1.4.1" // groupName 1. index
00123 #define oidVacmAccessContextPrefix "1.3.6.1.6.3.16.1.4.1.1" // 2. index
00124 #define oidVacmAccessSecurityModel "1.3.6.1.6.3.16.1.4.1.2" // 3. index
00125 #define oidVacmAccessSecurityLevel "1.3.6.1.6.3.16.1.4.1.3" // 4. index
00126 #define oidVacmAccessContextMatch "1.3.6.1.6.3.16.1.4.1.4"
00127 #define oidVacmAccessReadViewName "1.3.6.1.6.3.16.1.4.1.5"
00128 #define oidVacmAccessWriteViewName "1.3.6.1.6.3.16.1.4.1.6"
00129 #define oidVacmAccessNotifyViewName "1.3.6.1.6.3.16.1.4.1.7"
00130 #define oidVacmAccessStorageType "1.3.6.1.6.3.16.1.4.1.8"
00131 #define oidVacmAccessStatus "1.3.6.1.6.3.16.1.4.1.9"
00132
00133 #define oidVacmMIBViews "1.3.6.1.6.3.16.1.5"
00134 #define oidVacmViewSpinLock "1.3.6.1.6.3.16.1.5.1"
00135 #define oidVacmViewTreeFamilyTable "1.3.6.1.6.3.16.1.5.2"
00136 #define oidVacmViewTreeFamilyEntry "1.3.6.1.6.3.16.1.5.2.1"
00137 #define oidVacmViewTreeFamilyViewName "1.3.6.1.6.3.16.1.5.2.1.1" // 1. index
00138 #define oidVacmViewTreeFamilySubtree "1.3.6.1.6.3.16.1.5.2.1.2" // 2. index
00139 #define oidVacmViewTreeFamilyMask "1.3.6.1.6.3.16.1.5.2.1.3"
00140 #define oidVacmViewTreeFamilyType "1.3.6.1.6.3.16.1.5.2.1.4"
00141 #define oidVacmViewTreeFamilyStorageType "1.3.6.1.6.3.16.1.5.2.1.5"
00142 #define oidVacmViewTreeFamilyStatus "1.3.6.1.6.3.16.1.5.2.1.6"
00143
00144 #define oidVacmMIBCompliances "1.3.6.1.6.3.16.2.1"
00145 #define oidVacmMIBGroups "1.3.6.1.6.3.16.2.2"
00146
00147
00148 #ifndef oidSnmpUnavailableContexts
00149 #define oidSnmpUnavailableContexts "1.3.6.1.6.3.12.1.4.0"
00150 #define oidSnmpUnknownContexts "1.3.6.1.6.3.12.1.5.0"
00151 #endif
00152
00153 #define VACM_accessAllowed 0
00154 #define VACM_notInView 1
00155 #define VACM_noSuchView 2
00156 #define VACM_noSuchContext 3
00157 #define VACM_noGroupName 4
00158 #define VACM_noAccessEntry 5
00159 #define VACM_otherError 6
00160
00161
00162
00163 class AGENTPP_DECL SnmpUnavailableContexts: public MibLeaf {
00164
00165 public:
00166 SnmpUnavailableContexts();
00167 void incValue();
00168 NS_SNMP SnmpInt32 getValue();
00169 };
00170
00171
00172 class AGENTPP_DECL SnmpUnknownContexts: public MibLeaf {
00173
00174 public:
00175 SnmpUnknownContexts();
00176 void incValue();
00177 NS_SNMP SnmpInt32 getValue();
00178 };
00179
00180
00181
00182
00183
00184
00185
00186 class AGENTPP_DECL VacmContextTable: public MibTable {
00187
00188 public:
00189 VacmContextTable();
00190 ~VacmContextTable();
00191
00192 boolean isContextSupported(const NS_SNMP OctetStr& context);
00193 boolean addNewRow(const NS_SNMP OctetStr& context);
00194 void deleteRow(const NS_SNMP OctetStr& context);
00195 };
00196
00197
00198
00199
00200
00201
00202 class AGENTPP_DECL VacmSecurityToGroupTable: public StorageTable {
00203
00204 public:
00205 VacmSecurityToGroupTable();
00206 virtual ~VacmSecurityToGroupTable();
00207
00208 virtual boolean ready_for_service(Vbx*, int);
00209 virtual boolean could_ever_be_managed(const Oidx&, int&);
00210 virtual void row_added(MibTableRow*, const Oidx&, MibTable*);
00211 boolean getGroupName(const int& securiyModel,
00212 const NS_SNMP OctetStr& securityName,
00213 NS_SNMP OctetStr& groupName);
00214 boolean isGroupNameOK(const NS_SNMP OctetStr&);
00215 boolean addNewRow(int securityModel,
00216 const NS_SNMP OctetStr& securityName,
00217 const NS_SNMP OctetStr& groupName, int storageType);
00218 void deleteRow(int securityModel,
00219 const NS_SNMP OctetStr& securityName);
00220 };
00221
00222
00223
00224
00225
00226
00227
00228 class AGENTPP_DECL VacmAccessTable: public StorageTable {
00229
00230 public:
00231 VacmAccessTable(VacmSecurityToGroupTable*);
00232 virtual ~VacmAccessTable();
00233
00234 virtual boolean ready_for_service(Vbx*, int);
00235 virtual boolean could_ever_be_managed(const Oidx&, int&);
00236 virtual void row_added(MibTableRow*, const Oidx&, MibTable*);
00237 boolean getViewName(const NS_SNMP OctetStr&, const NS_SNMP OctetStr&,
00238 int&, int&, const int&, NS_SNMP OctetStr&);
00239
00240 boolean addNewRow(const NS_SNMP OctetStr& groupName,
00241 const NS_SNMP OctetStr& prefix,
00242 int securityModel, int securityLevel,
00243 int match, const NS_SNMP OctetStr& readView,
00244 const NS_SNMP OctetStr& writeView,
00245 const NS_SNMP OctetStr& notifyView, int storageType);
00246 void deleteRow(const NS_SNMP OctetStr& groupName, const NS_SNMP OctetStr& prefix,
00247 int securityModel, int securityLevel);
00248 protected:
00249 VacmSecurityToGroupTable* securityToGroupTable;
00250
00251 };
00252
00253 class AGENTPP_DECL VacmAccessTableStatus: public snmpRowStatus
00254 {
00255 public:
00256 VacmAccessTableStatus(const Oidx&, int);
00257 virtual ~VacmAccessTableStatus() { }
00258
00259 virtual MibEntryPtr clone();
00260
00261 protected:
00262 int base_len;
00263
00264 };
00265
00266 class AGENTPP_DECL ViewNameIndex {
00267
00268 public:
00269 ViewNameIndex(const NS_SNMP OctetStr& vname): name(vname) { }
00270 ~ViewNameIndex()
00271 { views.clear(); }
00272
00273 void add(MibTableRow* row) { views.add(row); }
00274 void remove(MibTableRow* row) { views.remove(row); }
00275 boolean isEmpty() { return views.empty(); }
00276
00277 NS_SNMP OctetStr name;
00278 List<MibTableRow> views;
00279 };
00280
00281
00282
00283
00284
00285
00286
00287 #if !defined (AGENTPP_DECL_TEMPL_LIST_VIEWNAMEINDEX)
00288 #define AGENTPP_DECL_TEMPL_LIST_VIEWNAMEINDEX
00289 AGENTPP_DECL_TEMPL template class AGENTPP_DECL List<ViewNameIndex>;
00290 #endif
00291
00292 class AGENTPP_DECL VacmViewTreeFamilyTable: public StorageTable {
00293 friend class VacmViewTreeFamilyTableStatus;
00294 public:
00295 VacmViewTreeFamilyTable();
00296 virtual ~VacmViewTreeFamilyTable();
00297
00298 virtual boolean ready_for_service(Vbx*, int);
00299 virtual boolean could_ever_be_managed(const Oidx&, int&);
00300 virtual void row_added(MibTableRow*, const Oidx&, MibTable*);
00301 virtual void row_activated(MibTableRow*, const Oidx&, MibTable*);
00302 virtual void row_deactivated(MibTableRow*, const Oidx&, MibTable*);
00303 virtual void row_delete(MibTableRow*, const Oidx&, MibTable*);
00304 virtual void row_init(MibTableRow*, const Oidx&, MibTable* t=0);
00305 boolean isInMibView(const NS_SNMP OctetStr&, const Oidx&);
00306 boolean addNewRow(const NS_SNMP OctetStr& viewName, const Oidx& subtree,
00307 const NS_SNMP OctetStr& mask, int type, int storageType);
00308 void deleteRow(const NS_SNMP OctetStr& viewName, const Oidx& subtree);
00309 virtual void clear() { StorageTable::clear(); buildViewNameIndex();}
00310 virtual void reset() { StorageTable::reset(); buildViewNameIndex();}
00311
00312 protected:
00313 boolean bit(unsigned int, NS_SNMP OctetStr&);
00314 ViewNameIndex* viewsOf(const NS_SNMP OctetStr& viewName);
00315 void buildViewNameIndex();
00316
00317 List<ViewNameIndex> viewNameIndex;
00318 };
00319
00320
00321 class AGENTPP_DECL VacmViewTreeFamilyTableStatus: public snmpRowStatus
00322 {
00323 public:
00324 VacmViewTreeFamilyTableStatus(const Oidx&, int);
00325 virtual ~VacmViewTreeFamilyTableStatus() { }
00326 virtual int set(const Vbx&);
00327 virtual MibEntryPtr clone();
00328
00329 protected:
00330 int base_len;
00331 };
00332
00333
00334
00335
00336
00337
00338
00339 class AGENTPP_DECL VacmMIB: public MibGroup {
00340
00341 public:
00342 VacmMIB(Vacm::ClassPointers);
00343 };
00344
00345 #ifdef AGENTPP_NAMESPACE
00346 }
00347 #endif
00348 #endif
00349