My own corner of monopam
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

README.md

mal#

Pure OCaml implementation of the CCSDS Mission Operations Message Abstraction Layer (MAL), as defined in CCSDS 521.0-B-1.

Overview#

MAL is a service-oriented architecture framework for mission operations. It provides a standard set of interaction patterns and data types that decouple service consumers from service providers, allowing mission operations services to be deployed over different transport technologies.

Six interaction patterns are supported: Send, Submit, Request, Invoke, Progress, and Pub-Sub. Each prescribes a fixed sequence of typed messages between consumer and provider.

Installation#

Install with opam:

$ opam install mal

If opam cannot find the package, it may not yet be released in the public opam-repository. Add the overlay repository, then install it:

$ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git
$ opam update
$ opam install mal

Usage#

let run () =
  (* Create an in-memory transport for testing *)
  let provider = Mal.Mem_transport.create "mal:provider" in
  let consumer = Mal.Mem_transport.create "mal:consumer" in
  (* Build a Request message *)
  let tid = Mal.next_transaction_id () in
  let msg =
    Mal.header
      ~uri_from:"mal:consumer" ~uri_to:"mal:provider"
      ~interaction_type:Mal.Request ~stage:Mal.Request_stage
      ~transaction_id:tid ~area:1 ~service:1 ~operation:1
      ~body:"ping" ()
  in
  (* Send and dispatch *)
  let _ = Mal.Mem_transport.send consumer msg in
  (match Mal.Mem_transport.recv provider with
   | Ok received -> Printf.printf "Got: %s\n" received.Mal.body
   | Error code -> Fmt.pr "Error: %a\n" Mal.pp_error_code code);
  Mal.Mem_transport.close provider;
  Mal.Mem_transport.close consumer

API Overview#

  • Interaction patterns -- Send, Submit, Request, Invoke, Progress, Pub_sub
  • Data types -- blob, identifier, uri, time, fine_time, duration
  • Message header -- Full routing metadata: URIs, QoS, session, transaction ID
  • Service registry -- register_area, register_handler, dispatch
  • Transport module type -- Abstract transport binding (send, recv, close)
  • Mem_transport -- In-memory transport for testing and local use
  • header, next_transaction_id, validate_stage -- Helpers

References#

Licence#

ISC License. See LICENSE.md for details.