### Why Should I Care about Lexicographic Ordering?

You should care about lexicographic ordering because it is required by GETNEXT and GETBULK operations. See RFC 1157 section 4.1.3 for SNMPv1 operations. See RFC 1905 section 4.2.2 for SNMPv2 GETNEXT and section 4.2.3 for SNMPv2 GETBULK.

Given two sequences,

```
S=(s(1), s(2), ...s(p))
(it has "p" elements)
T=(t(1), t(2), ... t(q))
(it has "q" elements)
```

Note that an OID value is a sequence of non-negative integers, and that "names of objects" (as specified in RFC 1157 and 1905) are OID values.

Sequence S is lexicographically **equal to** sequence T if the lengths are equal (that is, p=q) and:

`for all i<=p, s(i)=t(i)`

Sequence S is lexicographically **less than** sequence T if either of the following are true:

```
(1) p < q, and for all i <= p, s(i)=t(i)
(2) there exists an i such that (i<=p) & (i<=q), s(i) < t(i) and for all j < i, s(j)=t(j)
```

© 2020 InterWorking Labs, Inc. dba IWL. ALL RIGHTS RESERVED.

Web: https://iwl.com

Phone: +1.831.460.7010

Email: info@iwl.com