This is an idea proposed in 2011 as a Cambridge Computer Science Part II project, and has been completed by Farhān Mannān. It was supervised by Anil Madhavapeddy as part of the Personal Containers project.
The problem of getting a digital message from one place to another has a staggering range of possible scenarios, constraints and applications. Humans and devices are in constant dialogue, with various constraints and contracts being invisibly maintained. Even the most flippant instant message sets layers of protocols in motion, all straining to resolve identities and propagate information transparently across disparate physical components that must present a logically unified front to users. Subtleties like authentication, encryption and anonymity abound.
This project aims to build an OCaml-based simulator (using the ocamlgraph
library) to build an XMPP protocol simulator that can model the networks, agents and protocols involved in XMPP-based group communication. The project is twofold and modular: the core is a simulator which is used to investigate the properties of gossip protocols acting on different graph topologies. The simulator can be parameterised on an RPC implementation so that rather than using simulated graphs, it can monitor the performance of the algorithms on real networks as well. An attempted extension is implementation of a functional OCaml RPC abstraction over XMPP which would be compatible with the simulator and be usable with MirageOS.
The source code to the OCaml XMPP simulator is available publically. The dissertation PDF isn't available publically but should be in the Cambridge Computer Lab archives somewhere.