Built-in Pattern Matching
MIB Smithy SDK provides a number of built-in pattern matching functions for verifying that provided information conforms to expected rules. This is useful, for example, to verify that user input is valid before passing the input on to the API so that appropriate actions may be performed (or prevented) rather than relying on an error result from the API. Using the provided pattern matching APIs can simplify this task, particularly where the required regular expressions can be very complex. In addition, this command can also be used to determine if a specified record is of a particular record type.
Syntax:
% dbcmd is patternType testValue
Where:
dbcmd
- is the name of the database;
patternType
- is one of the keywords specifying the pattern matching to perform, listed below; and
testValue
- is the value (or record) to be compared against the pattern rule.
Returns:
1
if the value or record matches the specified pattern.
0
if the value or record does not match the specified pattern.
Pattern Specifiers:
capability
- Matches if the record is an AGENT-CAPABILITIES statement.
compliance
- Matches if the record is a MODULE-COMPLIANCE statement.
confgroup
- Matches if the record is a GROUP in a compliance module.
confmodule
- Matches if the record is a conformance module.
defined
- Matches if the record the record has been defined.
document
- Matches if the record type is that of a file.
identifier
- Matches either an upper OR lowercase identifier.
importable
- Matches any importable identifier.
lcidentifier
- Matches a lowercase identifier such as a value descriptor.
leaf
- Matches if the record is an OBJECT-TYPE.
module
- Matches if the record is a module.
moduleid
- Matches if the record is a MODULE-IDENTITY.
namednumber
- Matches a named-number such as "active(1)".
node
- Matches if the record is an OID value assignment or OBJECT-IDENTITY.
notification
- Matches if the record is a NOTIFICATION-TYPE or TRAP-TYPE.
notifygroup
- Matches if the record is a NOTIFICATION-GROUP.
number
- Matches an integer decimal value.
objectgroup
- Matches if the record is an OBJECT-GROUP.
objectidentifier
- Matches any form for an OID accepted by the SDK APIs.
typedef
- Matches if the record is a type assignment or TEXTUAL-CONVENTION.
typeref
- Matches any form for a type reference accepted by the SDK APIs. (e.g. an uppercase identifier, "OCTET STRING", or
module:descriptor
form)
ucidentifier
- Matches an uppercase identifier such as a type descriptor.
valuedef
- Matches if the record is an ASN.1 value assignment (*)
valueref
- Matches any form for a value reference accepted by the SDK APIs. (e.g. a lowercase identifier, object identifier or
module:descriptor
form)
variation
- Matches if the record is a variation.
See Also