In several contexts within CCNx it is useful to have a consistent ordering of names and name components. Names in CCNx consist of a sequence of Components, and each Component is a sequence of zero or more 8-bit bytes. The ordering for components is such that:

  • If a is shorter than b (i.e., has fewer bytes), then a comes before b.

  • If a is the same length as, but different than, b, and i is the first place they differ, then a comes before b if and only if a[i] < b[i] (treating a[i] and b[i] as unsigned 8-bit values). (This is just memcmp() ordering.)

For Names, the ordering is just based on the ordering of the first component where they differ. If one name is a proper prefix of the other, then it comes first.