package asn1-combinators

  1. Overview
  2. Docs

Object identifiers.

Magic numbers in a suit and tie. Their consulting fee is astronomical.

Object identifiers

type t = oid

OIDs are conceptually a sequence of non-negative integers, called nodes.

Every OID has at least two nodes.

val equal : t -> t -> bool
val compare : t -> t -> int
val hash : t -> int
val seeded_hash : int -> t -> int

Construction

val base : int -> int -> t

base n1 n2 is the OID n1.n2.

Either n1 is [0..1] and n2 is [0..39] (inclusive), or n1 is 2 and n2 is non-negative.

  • raises Invalid_argument

    if the components are out of range.

val (<|) : t -> int -> t

oid <| n is the OID oid.n.

  • raises Invalid_argument

    if n is negative.

val (<||) : t -> int list -> t

oid <|| ns is the old oid.n1.n2. ... if ns is [n1; n2; ...].

  • raises Invalid_argument

    if any of ns is negative.

Conversion

val to_nodes : t -> int * int * int list

to_nodes oid are the nodes this oid consists of. Every OID has at least two nodes; the rest are collected in the list.

val of_nodes : int -> int -> int list -> t option

of_nodes n1 n2 ns is the oid n1.n2.ns..., or None, if any of the components are out of range. See base and <|.

val pp : Format.formatter -> t -> unit

pp ppf oid pretty-prints oid on ppf as dotted-decimal.

val of_string : string -> t option

of_string s is the OID represented by s, or None, if s is not dotted-decimal or the components are out of range.

OCaml

Innovation. Community. Security.