package obus

  1. Overview
  2. Docs
Pure Ocaml implementation of the D-Bus protocol

Install

Dune Dependency

Authors

Maintainers

Sources

1.2.2.tar.gz
sha256=3bf0aeb00bf90cd4111483b37cefcb39af38ad6db1aeb6949a2fbecc13ff9a90
md5=7dd48f9bde3e069898fa08e9972596b5

doc/obus.internals/OBus_string/index.html

Module OBus_string

Restriction on strings used with D-Bus

There are a lot of restrictions for strings used in D-Bus. OBus only verifies strings when a message is sent or received

type error = {
  1. typ : string;
    (*

    Type of string ("string", "bus name", "error name", "path", ...)

    *)
  2. str : string;
    (*

    The string which fail to validate

    *)
  3. ofs : int;
    (*

    is the position in bytes where the validation failed

    *)
  4. msg : string;
    (*

    explains why the string failed to validate

    *)
}
val error_message : error -> string

error_message error returns a human-readable error message

Error projections
val typ : error -> string
val str : error -> string
val ofs : error -> int
val msg : error -> string
Validators
type validator = string -> error option

Tests if a string is correct.

  • if it is, returns None
  • if not, returns Some(ofs, msg)
exception Invalid_string of error
val assert_validate : validator -> string -> unit

Raises Invalid_string if the given string failed to validate

Common strings
type t = string

Type for common strings, restrictions are:

  • a string must be encoded in valid UTF-8
  • a string must not contains the null byte
val validate : validator

Validation function for common strings

OCaml

Innovation. Community. Security.