|The expression to be evaluated. This object is the same
as a DisplayString (RFC 1903) except for its maximum length.
Except for the variable names the expression is in ANSI C
syntax. Only the subset of ANSI C operators and functions
listed here is allowed.
Variables are expressed as a dollar sign ('$') and an
integer that corresponds to an expObjectIndex. An
example of a valid expression is:
Expressions may not be recursive, that is although an
expression may use the results of another expression, it
may not contain any variable that is directly or
indirectly a result of its own evaluation.
The only allowed operators are:
+ - * / %
& | ^ << >> ~
! && || == != > >= < <=
Note the parentheses are included for parenthesizing the
expression, not for casting data types.
The only constant types defined are:
int (32-bit signed)
long (64-bit signed)
The default type for a positive integer is int unless it
is too large in which case it is long.
All but oid are as defined for ANSI C. Note that a
hexadecimal constant may end up as a scalar or an array of
8-bit integers. A string constant is enclosed in double
quotes and may contain back-slashed individual characters
as in ANSI C.
An oid constant comprises 32-bit, unsigned integers and at
least one period, for example:
Integer-typed objects are treated as 32- or 64-bit, signed
or unsigned integers, as appropriate. The results of
mixing them are as for ANSI C, including the type of the
result. Note that a 32-bit value is thus promoted to 64
bits only in an operation with a 64-bit value. There is
no provision for larger values to handle overflow.
Relative to SNMP data types, a resulting value becomes
unsigned when calculating it uses any unsigned value,
including a counter. To force the final value to be of
data type counter the expression must explicitly use the
counter32() or counter64() function (defined below).
OCTET STRINGS and OBJECT IDENTIFIERs are treated as 1-based
arrays of unsigned 8-bit integers and unsigned 32-bit
IpAddresses are treated as 32-bit, unsigned integers in
network byte order, that is, the hex version of 255.0.0.0 is
Conditional expressions result in a 32-bit, unsigned integer
of value 0 for false or 1 for true. When an arbitrary value
is used as a boolean 0 is false and non-zero is true.
Rules for the resulting data type from an operation, based
on the operator:
For << and >> the result is the same as the left hand
For &&, ||, ==, !=, <, <=, >, and >= the result is always
For unary - the result is always Integer32.
For +, -, *, /, %, &, |, and ^ the result is promoted
according to the following rules, in order from most to
If left hand and right hand operands are the same
type, use that.
If either side is Counter64, use that.
If either side is IpAddress, use that.
If either side is TimeTicks, use that.
If either side is Counter32, use that.
Otherwise use Unsigned32.
The following rules say what operators apply with what
data types. Any combination not explicitly defined does
For all operators any of the following can be the left
hand or right hand operand: Integer32, Counter32,
The operators +, -, *, /, %, <, <=, >, and >= also work with
The operators &, |, and ^ also work with IpAddress.
The operators << and >> also work with IpAddress but only
as the left hand operand.
The + operator performs a concatenation of two OCTET STRINGs
or two OBJECT IDENTIFIERs.
The operators &, | perform bitwise operations on
OCTET STRINGs. If the OCTET STRING happens to be a
DisplayString the results may be meaningless, but the agent
system does not check this as some such systems do not
have this information.
The operators << and >> perform bitwise operations on
OCTET STRINGs appearing as the left hand operand.
The only functions defined are:
The following function definitions indicate their by naming
the data type of the parameter in the parameter's position
in the parameter list. The parameter must be of the type
indicated and generally may be a constant, a MIB object, a
function, or an expression.
counter32(integer) - wrapped around an integer value
counter32 forces Counter32 as a data type.
counter64(integer) - similar to counter32 except that the
resulting data type is 'counter64'.
arraySection(array, integer, integer) - selects a piece of
an array (i.e. part of an OCTET STRING or
OBJECT IDENTIFIER). The integer arguments are in the
range 0 to 4,294,967,295. The first is an initial array
index (1-based) and the second is an ending array index.
A value of 0 indicates first or last element, respectively.
If the first element is larger than the array length the
result is 0 length. If the second integer is less than or
equal to the first, the result is 0 length. If the second
is larger than the array length it indicates last element.
stringBegins/Ends/Contains(octetString, octetString) -
looks for the second string (which can be a string constant)
in the first and returns the 1-based index where the match
began. A return value of 0 indicates no match (i.e.
oidBegins/Ends/Contains(oid, oid) - looks for the second OID
(which can be an OID constant) in the first and returns the
the 1-based index where the match began. A return value
of 0 indicates no match (i.e. boolean false).
sum(integerObject*) - sums all availiable values of the
wildcarded integer object, resulting in an integer scalar.
Must be used with caution as it wraps on overflow with no
exists(anyTypeObject) - verifies the object instance
exists. A return value of 0 indicates NoSuchInstance
(i.e. boolean false).