package ldap

  1. Overview
  2. Docs

A library for parsing rfc2252 schemas as returned by directory servers

module Oid : sig ... end
val format_oid : Oid.t -> unit
module Lcstring : sig ... end
val format_lcstring : Lcstring.t -> unit
type octype =
  1. | Abstract
  2. | Structural
  3. | Auxiliary
type objectclass = {
  1. oc_name : string list;
  2. oc_oid : Oid.t;
  3. oc_desc : string;
  4. oc_obsolete : bool;
  5. oc_sup : Lcstring.t list;
  6. oc_must : Lcstring.t list;
  7. oc_may : Lcstring.t list;
  8. oc_type : octype;
  9. oc_xattr : string list;
}

The type representing an objectclass definition

type attribute = {
  1. at_name : string list;
  2. at_desc : string;
  3. at_oid : Oid.t;
  4. at_equality : string;
  5. at_ordering : string;
  6. at_substr : Oid.t;
  7. at_syntax : Oid.t;
  8. at_length : Int64.t;
  9. at_obsolete : bool;
  10. at_single_value : bool;
  11. at_collective : bool;
  12. at_no_user_modification : bool;
  13. at_usage : string;
  14. at_sup : Lcstring.t list;
  15. at_xattr : string list;
}

The type representing an attribute definition

type schema = {
  1. objectclasses : (Lcstring.t, objectclass) Hashtbl.t;
  2. objectclasses_byoid : (Oid.t, objectclass) Hashtbl.t;
  3. attributes : (Lcstring.t, attribute) Hashtbl.t;
  4. attributes_byoid : (Oid.t, attribute) Hashtbl.t;
}

The type representing the whole schema. Consists of hashtbls indexed by two useful keys. For both attributes and objectclasses there exists a hashtbl indexed by OID, and one indexed by lower case canonical name. There exist functions in Ldap_ooclient to look up attributes and objectclasses by non canonical names if that is necessary for you to do. see attrToOid, and ocToOid. They will find the oid of an attribute or objectclass given any name, not just the canonical one. Not that this is somewhat (like several orders of magnitude) slower than lookups by canonical name.

val schema_print_depth : int ref

This reference controls the dept of printing for the schema in the toplevel. The default is 10 keys from each table will be printed. OID tables are not currently printed.

val format_schema : schema -> unit

A formatter for the schema, prints the structure, and expands the hashtbls to show the keys. The number of keys printed is controled by schema_print_depth.

exception Parse_error_oc of Lexing.lexbuf * objectclass * string
exception Parse_error_at of Lexing.lexbuf * attribute * string
exception Syntax_error_oc of Lexing.lexbuf * objectclass * string
exception Syntax_error_at of Lexing.lexbuf * attribute * string
val readSchema : string list -> string list -> schema

readSchema attribute_list objectclass_list, parse the schema into a schema type given a list of attribute definition lines, and objectclass definition lines.

OCaml

Innovation. Community. Security.