package obus
Module OBus_matchSource
Matching rules
Rules
type argument_filter = | AF_string of string(*
*)AF_string strmatches any string argument which is equal tostr| AF_string_path of string(*AF_string_path pathmatches any string or object-path argumentargsuch that one of the following conditions hold:argis equal topathpathends with'/'and is a prefix ofargargends with'/'and is a prefix ofpath
| AF_namespace of string(*
*)AF_namespace namespacematches any string argumentargsuch thatargis a bus or interface name in the namespace ofnamespace. For exampleAF_namespace "a.b.c"matches any string of the form"a.b.c","a.b.c.foo","a.b.c.foo.bar", ...
Type of an argument filter. Argument filters are used in match rules to match message arguments.
Type of lists of argument filters. The private type ensures that such lists are always sorted by argument number, do not contain duplicates and indexes are in the range 0..63..
Creates an arguments filter from a list of filters. It raises Invalid_argument if one of the argument filters use a number outside of the range 1..63
Returns the list of filters for the given arguments filter.
type rule = {typ : [ `Signal | `Error | `Method_call | `Method_return ] option;sender : OBus_name.bus;interface : OBus_name.interface;member : OBus_name.member;path : OBus_path.t option;destination : OBus_name.bus;arguments : arguments;eavesdrop : bool option;
}Type of a rule used to match a message
Rule projections
Rule construction
val rule :
?typ:[ `Signal | `Error | `Method_call | `Method_return ] ->
?sender:OBus_name.bus ->
?interface:OBus_name.interface ->
?member:OBus_name.member ->
?path:OBus_path.t ->
?destination:OBus_name.bus ->
?arguments:arguments ->
?eavesdrop:bool ->
unit ->
ruleCreate a matching rule.
Matching
match_message rule message returns wether message is matched by rule
match_values filters values returns whether values are matched by the given list of argument filters.
Comparison
type comparison_result = | More_general(*
*)r1is more general thanr2, i.e. any message matched byr2is also matched byr1| Less_general(*
*)r1is less general thanr2, i.e. any message matched byr1is also matched byr2| Equal(*
*)r1andr2are equal| Incomparable(*r1andr2are incomparable, i.e. there exists two messagem1andm2such that:m1is matched byr1but not byr2m2is matched byr2but not byr1
Result of the comparisong of two rules r1 and r2:
compare_rules r1 r2 compares the two matching rules r1 and r2
Parsing/printing
Parse_failure(string, position, reason) is raised when parsing a rule failed
Rules and message buses
export ?switch connection rule registers rule on the message bus. If another rule more general than rule is already exported, then it does nothihng.
You can provide a switch to manually disable the export.