(* $Id$ *)
(** Support for remote types not already covered by [Netnumber] *)
(** {2 Integers} *)
(** Short *)
type uint2 = int
val read_uint2 : Bytes.t -> int -> uint2
val read_uint2_unsafe : Bytes.t -> int -> uint2
val read_string_uint2 : string -> int -> uint2
val read_string_uint2_unsafe : string -> int -> uint2
val write_uint2 : Bytes.t -> int -> uint2 -> unit
val write_uint2_unsafe : Bytes.t -> int -> uint2 -> unit
val uint2_as_string : uint2 -> string
(** {2 Strings} *)
val decode_shortstr : string -> int ref -> int -> string
val decode_longstr : string -> int ref -> int -> string
val encode_shortstr : string -> (Bytes.t list * int)
val encode_longstr : string -> (Bytes.t list * int)
(* result (list, n): [list] is the list of part strings in reverse order,
[n] is the length of the [list] contents in bytes
*)
(** {2 Tables} *)
(** Convention:
- [Sint<n>]: signed integer with n bytes
- [Uint<n>]: unsigned integer with n bytes
Note that there is confusion about what is allowed in tables, see
http://dev.rabbitmq.com/wiki/Amqp091Errata. For best compatibility
one should only use [`Sint4], [`Decimal], [`Longstr], [`Timestamp],
[`Table], and [`Null].
*)
type ('table_field,'table) table_field_standard =
[ `Sint4 of Netnumber.int4
| `Decimal of int * Netnumber.uint4
| `Longstr of string (* up to 4G chars *)
| `Timestamp of float (* only int precision *)
| `Table of 'table
| `Null
]
type ('table_field,'table) table_field_ok =
[ `Bool of bool
| `Sint1 of int
| `Float of float (* single precision only *)
| `Double of float
]
type ('table_field,'table) table_field_problematic =
[ `Uint1 of int
| `Sint2 of int
| `Uint2 of int
| `Uint4 of Netnumber.uint4
| `Sint8 of Netnumber.int8
| `Uint8 of Netnumber.uint8
| `Shortstr of string (* up to 255 chars *)
| `Array of 'table_field list
]
type table_field =
[ (table_field,table) table_field_standard
| (table_field,table) table_field_ok
(* | table_field_problematic *)
]
and table =
(string * table_field) list
val decode_table : string -> int ref -> int -> table
val encode_table : table -> (Bytes.t list * int)
(** {2 Misc} *)
val unsafe_rev_concat : Bytes.t list -> int -> Bytes.t
val mk_mstring : Bytes.t -> Netxdr_mstring.mstring