;;; SPDX-License-Identifier: LGPL-3.0-or-later
;;; SPDX-FileCopyrightText: Copyright © 2010-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>

#lang syndicate

(provide (all-defined-out))

;; Addressing
(assertion-struct server-tcp-connection (host port scope))
(assertion-struct server-loopback-connection (scope))

(define (standard-localhost-server/tcp [scope "broker"])
  (server-tcp-connection "localhost" 8001 scope))

;; Client protocol
(assertion-struct to-server (address assertion))
(assertion-struct from-server (address assertion))
(assertion-struct server-connection (address))
(assertion-struct server-connected (address))
(message-struct force-server-disconnect (address))

;; Federation configuration
;; e.g. (federated-uplink "scope1" (server-tcp-connection "peer.example" 8001 "local") "scope2")
(assertion-struct federated-uplink (local-scope peer remote-scope))
(assertion-struct federated-uplink-connected (link))

(assertion-struct federation-management-scope (name))
