diff options
Diffstat (limited to 'lib/snmp/include')
-rw-r--r-- | lib/snmp/include/SNMPv2-TC.hrl | 52 | ||||
-rw-r--r-- | lib/snmp/include/snmp_tables.hrl | 109 | ||||
-rw-r--r-- | lib/snmp/include/snmp_types.hrl | 395 |
3 files changed, 556 insertions, 0 deletions
diff --git a/lib/snmp/include/SNMPv2-TC.hrl b/lib/snmp/include/SNMPv2-TC.hrl new file mode 100644 index 0000000000..231be39220 --- /dev/null +++ b/lib/snmp/include/SNMPv2-TC.hrl @@ -0,0 +1,52 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% + +%% This file was automatically generated by snmp_mib_to_hrl v3.0 +%% Date: 22-Jan-2004::15:38:42 + +-ifndef('SNMPv2-TC'). +-define('SNMPv2-TC', true). + +-define(snmpv2TC, [1,3,6,1,6,3,0]). + +%% Range values + + +%% Definitions from 'StorageType' +-define('StorageType_readOnly', 5). +-define('StorageType_permanent', 4). +-define('StorageType_nonVolatile', 3). +-define('StorageType_volatile', 2). +-define('StorageType_other', 1). + +%% Definitions from 'RowStatus' +-define('RowStatus_destroy', 6). +-define('RowStatus_createAndWait', 5). +-define('RowStatus_createAndGo', 4). +-define('RowStatus_notReady', 3). +-define('RowStatus_notInService', 2). +-define('RowStatus_active', 1). + +%% Definitions from 'TruthValue' +-define('TruthValue_false', 2). +-define('TruthValue_true', 1). + +%% Default values + +-endif. diff --git a/lib/snmp/include/snmp_tables.hrl b/lib/snmp/include/snmp_tables.hrl new file mode 100644 index 0000000000..4eea5ec282 --- /dev/null +++ b/lib/snmp/include/snmp_tables.hrl @@ -0,0 +1,109 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2004-2009. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% + +%%----------------------------------------------------------------- +%% This file contains the record definitions of the agent SNMP MIB +%% tables to be used when creating the tables in Mnesia, for users +%% that want to store this data in Mnesia rather than config files +%% and ets/dets. +%%----------------------------------------------------------------- + +-include("SNMPv2-TM.hrl"). +-include("SNMPv2-TC.hrl"). + +-record(snmpCommunityTable, + {snmpCommunityIndex, + snmpCommunityName, + snmpCommunitySecurityName, + snmpCommunityContextEngineID, + snmpCommunityContextName = "", + snmpCommunityTransportTag, + snmpCommunityStorageType = ?StorageType_nonVolatile, + snmpCommunityStatus = ?RowStatus_active}). + +-record(snmpNotifyTable, + {snmpNotifyName, + snmpNotifyTag, + snmpNotifyType, + snmpNotifyStorageType = ?StorageType_nonVolatile, + snmpNotifyRowStatus = ?RowStatus_active}). + +-record(snmpTargetAddrTable, + {snmpTargetAddrName, + snmpTargetAddrTDomain = ?snmpUDPDomain, + snmpTargetAddrTAddress, + snmpTargetAddrTimeout = 1500, + snmpTargetAddrRetryCount = 3, + snmpTargetAddrTagList, + snmpTargetAddrParams, + snmpTargetAddrStorageType = ?StorageType_nonVolatile, + snmpTargetAddrRowStatus = ?RowStatus_active, + snmpTargetAddrEngineId = "", % not SNMP accessible + snmpTargetAddrTMask = [], % part of ext table + snmpTargetAddrMMS = 2048}). % part of ext table + +-record(snmpTargetParamsTable, + {snmpTargetParamsName, + snmpTargetParamsMPModel, + snmpTargetParamsSecurityModel, + snmpTargetParamsSecurityName, + snmpTargetParamsSecurityLevel, + snmpTargetParamsStorageType = ?StorageType_nonVolatile, + snmpTargetParamsRowStatus = ?RowStatus_active}). + +-record(usmUserTable, + {key, % {usmUserEngineID, usmUserName} + usmUserSecurityName, + usmUserCloneFrom, + usmUserAuthProtocol, + usmUserAuthKeyChange, + usmUserOwnAuthKeyChange, + usmUserPrivProtocol, + usmUserPrivKeyChange, + usmUserOwnPrivKeyChange, + usmUserPublic, + usmUserStorageType = ?StorageType_nonVolatile, + usmUserStatus = ?RowStatus_active, + authKey, % not SNMP accessible + privKey}). % not SNMP accessible + +-record(vacmSecurityToGroupTable, + {key, % {vacmSecurityModel, vacmSecurityName} + vacmGroupName, + vacmSecurityToGroupStorageType = ?StorageType_nonVolatile, + vacmSecurityToGroupStatus = ?RowStatus_active}). + +-record(vacmAccessTable, + {key, % {vacmGroupName, vacmAccessContextPrefix, + % vacmSecurityModel, vacmAccessSecurityLevel} + vacmAccessContextMatch, + vacmAccessReadViewName, + vacmAccessWriteViewName, + vacmAccessNotifyViewName, + vacmAccessStorageType = ?StorageType_nonVolatile, + vacmAccessStatus = ?RowStatus_active}). + +-record(vacmViewTreeFamilyTable, + {key, % {vacmViewTreeFamilyViewName, vacmViewTreeFamilySubtree} + vacmViewTreeFamilyMask, + vacmViewTreeFamilyType, + vacmViewTreeFamilyStorageType = ?StorageType_nonVolatile, + vacmViewTreeFamilyStatus = ?RowStatus_active}). + + diff --git a/lib/snmp/include/snmp_types.hrl b/lib/snmp/include/snmp_types.hrl new file mode 100644 index 0000000000..1fd6d153c9 --- /dev/null +++ b/lib/snmp/include/snmp_types.hrl @@ -0,0 +1,395 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 1996-2009. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% + +%%---------------------------------------------------------------------- +%% Note: All internal representations may be changed without notice. +%%---------------------------------------------------------------------- + +%%---------------------------------------------------------------------- +%% Variablebinding +%% oid: a list of integers (see snmp_misc:is_oid) +%% variabletype corresponds to type in the asn1_type. +%% variabletype=='NULL' => +%% value== 'NULL' | noSuchObject | noSuchInstance | endOfMibView +%% else: variabletype == <one of the types defined in rfc1903>; +%% 'INTEGER' | 'Integer32' | 'OCTET STRING' | +%% 'OBJECT IDENTIFIER' | 'IpAddress' | 'Counter32' | +%% 'TimeTicks' | 'Opaque' | 'Counter64' | 'Unsigned32' +%% value: a value. +%% org_index: an integer. Its position in the original varbindlist (the one +%% from the get- or set-request). +%%---------------------------------------------------------------------- +-record(varbind, + {oid, + variabletype, + value, + org_index + } + ). + +%%----------------------------------------------------------------- +%% Internal Variablebinding +%% status = noError | ErrorStatus +%% mibentry = A mibentry if status == noError +%% varbind = a varbind-record +%%----------------------------------------------------------------- +-record(ivarbind, + {status = noError, + mibentry, + varbind + } + ). + +%%---------------------------------------------------------------------- +%% ASN1_type. Everything that is needed to represent a typed variable. +%% BERtype: Type used during Basic Encoding/Decoding Rules +%% aliasname: The name of the derived type as defined in the MIB +%% assocList can be list of: +%% {enums, [{up, 1}, {down, 2}, {right, 3}, {left, 4}]} +%%---------------------------------------------------------------------- +-record(asn1_type, + {bertype, + lo, + hi, + assocList = [], + imported = false, + aliasname, + implied = false, + display_hint + } + ). + + +%%----------------------------------------------------------------- +%% TableInfo - stored in snmp_symbolic_store for use by the +%% generic table functions. +%% nbr_of_cols is an integer +%% defvals is a list of {Col, Defval}, ordered by column +%% number +%% status_col is an integer +%% not_accessible a sorted list of columns (> first_accessible) +%% that are 'not-accessible' +%% indextypes is a list of #asn1_type for the index-columns, +%% ordered by column number +%% first_accessible is an integer, the first non-accessible +%% column +%% first_own_index is an integer. 0 if there is no such index for +%% this table. +%% This is not the same as the last integer in the oid! +%% Example: If a table has one own index (oid.1), one +%% column (oid.2) and one imported index then +%% first_own_index will be 2. +%%----------------------------------------------------------------- + +-record(table_info, + {nbr_of_cols, + defvals = [], + status_col, + not_accessible, + index_types, + first_accessible = 1, + first_own_index + } + ). + + +%%----------------------------------------------------------------- +%% TableInfo - stored in snmp_symbolic_store for use by the +%% generic variable functions. +%% defval is a default value for the variable +%%----------------------------------------------------------------- +-record(variable_info, + { + defval + } + ). + + +%%---------------------------------------------------------------------- +%% MibEntry +%% aliasname is the name for the oid. +%% asn1_type is a record of asn1_type. +%% entrytype: variable | table | table_column | internal +%% access: notAccessible | readOnly | readWrite | readCreate (see rfc 1142) +%% assocList: list of +%% {table_info, #table_info} when entrytype == table +%% {varable_info, #variable_info} when entrytype == variable +%% {table_name, TableName} when entrytype == table_column +%% {table_entry_with_sequence, NameOfSequence} when entrytype == table_entry +%% description: DESCRIPTIONS field +%%---------------------------------------------------------------------- +-record(me, + { + oid, + entrytype, + aliasname, + asn1_type, + access, + mfa, + imported = false, + assocList = [], + description = undefined, + units + } + ). + + +%% oidobjects is a list of {oid, asn1_type} to be sent in the trap +%% with the description field included. +-record(trap, + {trapname, + enterpriseoid, + specificcode, + oidobjects, + description = undefined + } + ). + +%% oidobjects is a list of {oid, asn1_type} to be sent in the trap +%% with the description field included. +-record(notification, + {trapname, + oid, + oidobjects, + description = undefined + } + ). + +%%---------------------------------------------------------------------- +%% This is how a mib is represented on disk (as a binary) +%% types is: [asn1_type()] +%% variable_infos is a list of {Name, variable_info-record} +%% table_infos is a list of {Name, table_info-record} +%% +%% The mib format version is a string with the following +%% structure: Major.Minor +%% The Major number is changed when the mib format is changed so +%% that it is incompatible with previous versions. It still _might_ +%% be possible to convert (off-line or in run-time), but don't count +%% on it. +%% The Minor number is changed when a minor change has been made that +%% does not effect the backward compatibillity. +%% Both Major and Minor are integers. +%% +%% So, "2.0" is compatible with "2.1", but not with "3.0". +%% +%%---------------------------------------------------------------------- +-record(mib, + {misc = [], + mib_format_version = "3.1", + name = "", + module_identity, %% Not in SMIv1, and only with +module_identity + mes = [], + asn1_types = [], + traps = [], + variable_infos = [], + table_infos = [], + imports %% only with +imports + } + ). + +-record(module_identity, + {last_updated, + organization, + contact_info, + description, + revisions + } + ). + +%%---------------------------------------------------------------------- +%% version = 'version-1' | 'version-2' | 'version-3' +%% vsn_hdr is dependent on version. If v1 | v2 it's the community string, +%% if v3 its a v3_hdr record +%% data is a PDU (v1 & v2c) or a (possibly encrypted) ScopedPDU (v3) +%% +%% The constant SNMP_USE_V3 is used for compatibility reasons. In earlier +%% versions, the vsn_hdr field was called 'community'. This only worked +%% for v1 and v2c. Thus, the field is renamed to vsn_hdr, and the +%% content depend on the version as described above. An application +%% that handles not only v1 and v2c, but also v3, *must* define the +%% constant SNMP_USE_V3 before including this header file. This +%% ensures that the application can refer to the field as 'vsn_hdr'. +%% An old application, that doesn't handle v3, doesn't define +%% the constant, can still refer to the field as 'coomunity'. +%%---------------------------------------------------------------------- +-ifdef(SNMP_USE_V3). +-record(message, {version, vsn_hdr, data}). +-else. +-record(message, {version, community, data}). +-endif. + +-record(v3_hdr, + {msgID, + msgMaxSize, + msgFlags, + msgSecurityModel, + msgSecurityParameters, + hdr_size + } + ). + +-record(scopedPdu, + {contextEngineID, + contextName, + data + } + ). + +%%----------------------------------------------------------------- +%% USM Security Model +%%----------------------------------------------------------------- +-record(usmSecurityParameters, + {msgAuthoritativeEngineID, + msgAuthoritativeEngineBoots, + msgAuthoritativeEngineTime, + msgUserName, + msgAuthenticationParameters, + msgPrivacyParameters + } + ). + +%%---------------------------------------------------------------------- +%% type: 'get-request' | 'get-next-request' | 'get-bulk-request' | +%% 'get-response' | 'set-request' | 'inform-request' | 'snmpv2-trap' | report +%% (see rfc 1905) +%% request_id, error_status and error_index are integers. +%% varbinds: a list of varbinds. +%%---------------------------------------------------------------------- +%% if bulk non-repeaters max-repetitions resp +-record(pdu, + {type, + request_id, + error_status, + error_index, + varbinds + } + ). + +-record(trappdu, + {enterprise, + agent_addr, + generic_trap, + specific_trap, + time_stamp, + varbinds + } + ). + + +%%----------------------------------------------------------------- +%% This record should be used when a Mnesia table for variables +%% is created. +%%----------------------------------------------------------------- +-record(snmp_variables, + {name, + value + } + ). + + +%%----------------------------------------------------------------- +%% STD security models (from rfc2271) +%%----------------------------------------------------------------- +-define(SEC_ANY, 0). +-define(SEC_V1, 1). +-define(SEC_V2C, 2). +-define(SEC_USM, 3). + + +%%----------------------------------------------------------------- +%% The OTP Security Model (ericsson * 256 + otp) +%% (works for Community based SNMP i.e. v1 and v2c) +%%----------------------------------------------------------------- +-define(SEC_OTP, 49427). + + +%%----------------------------------------------------------------- +%% STD message processing models (from rfc2271) +%%----------------------------------------------------------------- +-define(MP_V1, 0). +-define(MP_V2C, 1). +-define('MP_V2U*', 2). +-define(MP_V3, 3). + + +%%----------------------------------------------------------------- +%% Mib Views +%%----------------------------------------------------------------- +-define(view_included, 1). +-define(view_excluded, 2). + + +%%----------------------------------------------------------------- +%% From SNMPv2-SMI +%%----------------------------------------------------------------- +-define(zeroDotZero, [0,0]). + + +%%----------------------------------------------------------------- +%% Incremental timer +%% +%% The timer sleeps in WaitFor milli seconds and when it +%% times out, a new time out value is computed: +%% +%% WaitFor2 = WaitFor * Factor + Incr +%% +%% And the timer starts all over again with the new WaitFor value. +%% The procedure is repeated at most MaxRetries. +%%----------------------------------------------------------------- + +-record(snmp_incr_timer, + {wait_for = timer:seconds(5), + factor = 2, + incr = 0, + max_retries = infinity + } + ). + +%%----------------------------------------------------------------- +%% Inform delivery information +%% +%% This record defines the info related to inform delivery info. +%% That is, when sending an inform, info about the delivery (such +%% if it was acknowledged) will be delivered using the info in +%% this record. +%% +%% The delivery will be performed according to: +%% +%% Mod:inform_delivery_targets(Tag, Addresses, Extra) +%% Mod:inform_delivery_info(Tag, Address, DeliveryResult, Extra) +%% +%% The Extra is any term, provided by the user. +%% +%% The fields of this record has the following meaning: +%% tag - term() - Value selected by the user to identify this +%% sending +%% mod - module() - The callback module implementing the +%% snmpa_notification_delivery_info_receiver +%% behaviour +%% extra - term() - Any extra info the user wants passed along +%% +%%----------------------------------------------------------------- + +-record(snmpa_notification_delivery_info, + { + tag, + mod, + extra + }). |