bottrap
< Prev Back to Table of Contents Next >

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 any database, testValue is the value (or record) to be compared against the pattern rule, and patternType is one of the following keywords specifying the test to perform, listed below.

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:

Keyword Description
ucidentifier Matches an uppercase identifier such as a type descriptor.
lcidentifier Matches a lowercase identifier such as a value descriptor.
identifier Matches either an upper OR lowercase identifier.
namednumber Matches a named-number such as "active(1)".
number Matches an integer decimal value.
objectidentifier Matches any form for an OID accepted by the SDK APIs.
importable Matches any importable identifier.
typeref Matches any form for a type reference accepted by the SDK APIs. (e.g. an uppercase identifier, "OCTET STRING", or "module:descriptor" form)
valueref Matches any form for a value reference accepted by the SDK APIs. (e.g. a lowercase identifier, object identifier or "module:descriptor" form)
document Matches if the record type is that of a file.
module Matches if the record is a module.
moduleid Matches if the record is a MODULE-IDENTITY.
typedef Matches if the record is a type assignment or TEXTUAL-CONVENTION.
valuedef Matches if the record is an ASN.1 value assignment (*)
compliance Matches if the record is a MODULE-COMPLIANCE statement.
capability Matches if the record is an AGENT-CAPABILITIES statement.
confmodule Matches if the record is a conformance module.
confgroup Matches if the record is a GROUP in a compliance module.
variation Matches if the record is a variation.
node Matches if the record is an OID value assignment or OBJECT-IDENTITY.
objectgroup Matches if the record is an OBJECT-GROUP.
notifygroup Matches if the record is a NOTIFICATION-GROUP.
notification Matches if the record is a NOTIFICATION-TYPE or TRAP-TYPE.
leaf Matches if the record is an OBJECT-TYPE.
defined Matches if the record the record has been defined.
< Prev Back to Table of Contents Next >