Message.Base
type unicast_header =
| Unicast_header of {
src : Com.pubkey;
dst : Com.pubkey;
ttl : Com.ttl;
exp : Com.expiry;
}
type multicast_header =
| Multicast_header of {
grp : Commons.multicast_group_pubkey;
ttl : Com.ttl;
exp : Com.expiry;
seen : Com.seen;
}
type t =
| Unicast_message of {
header : unicast_header;
body : body;
sign : sign;
via : via option;
}
| Multicast_message of {
header : multicast_header;
body : body;
sign : sign;
via : via option;
}
val fold :
(unicast_header -> body -> sign -> via option -> 'a) ->
(multicast_header -> body -> sign -> via option -> 'a) ->
t ->
'a
val fold_unwrap :
(unicast_header -> string -> string -> Com.pubkey option -> 'a) ->
(multicast_header -> string -> string -> Com.pubkey option -> 'a) ->
t ->
'a
val fold_unwrap' :
(Com.pubkey -> string -> string -> Com.pubkey option -> 'a) ->
(Commons.multicast_group_pubkey ->
string ->
string ->
Com.pubkey option ->
'a) ->
t ->
'a
val fold_flip_multi :
t ->
(multicast_header -> body -> sign -> via option -> 'a) ->
'a
val fold_flip_multi_unwrap :
t ->
(multicast_header -> string -> string -> Com.pubkey option -> 'a) ->
'a
val fold_flip_multi_unwrap' :
t ->
(Commons.multicast_group_pubkey ->
string ->
string ->
Com.pubkey option ->
'a) ->
'a
val fold_header :
(Com.pubkey -> Com.pubkey -> Com.ttl -> Com.expiry -> 'a) ->
(Commons.multicast_group_pubkey -> Com.ttl -> Com.expiry -> Com.seen -> 'a) ->
t ->
'a
val fold_header' :
(unicast_header -> 'a) ->
(multicast_header -> 'a) ->
t ->
'a
module Acc : sig ... end
module T : sig ... end
module Pp : sig ... end
module Decode : sig ... end
module Encode : sig ... end
val is_unicast : t -> bool
val is_multicast : t -> bool
val sign_prepare :
[< `Multi of multicast_header | `Uni of unicast_header ] ->
string ->
string
val sign_message :
Upsycle_router__Commons.privkey ->
[< `Multi of multicast_header | `Uni of unicast_header ] ->
string ->
string
val verify_signature : Upsycle_router__Commons.pubkey -> t -> unit Lwt.t
module Mk : sig ... end
val pp : Stdlib.Format.formatter -> t -> unit
val pp_short : Stdlib.Format.formatter -> t -> unit
val get_uni_field : [< `Dst | `Src ] -> t -> Com.pubkey
val get_multi_field : [< `Grp ] -> t -> Commons.multicast_group_pubkey
val get_uni_src : t -> Com.pubkey
These raise an exception on multicast messages: caller must be sure it's a unicast message
val get_uni_dst : t -> Com.pubkey
val get_multi_group : t -> Commons.multicast_group_pubkey
These raise an exception on unicast messages: caller must be sure it's a multicast message
val get_multi_group' : t -> Upsycle_router__Commons.pubkey
val is_for : Com.pubkey -> t -> bool
Returns `false` for a multicast message and therefore doesn't raise any exceptions. Works by checking the `dst` field.
val via_set : Com.pubkey -> t -> t
val message_id_s :
[< `Blake2b_256 | `Blake2b_32 | `Blake2s_128 | `Blake2s_32 ] ->
t ->
string
val message_id :
[< `Blake2b_256 | `Blake2b_32 | `Blake2s_128 | `Blake2s_32 ] ->
t ->
Com.msg_id