packet.clj

Branches > client-handling-rewrite > 1d94988 > files / src / net / bowmap / packet.clj

(ns net.bowmap.packet
  (:require [clojure.alpha.spec :as s]))

; The protocol id, i.e. 0x00, 0x80, etc.
(s/def ::numeric-id pos-int?)
; The name of the packet id keyword, i.e. ::server/handshaking
(s/def ::id qualified-keyword?)

; Packets will have a bunch of unqualified keys for their fields
; See net.bowmap.packets.client and net.bowmap.packets.server for those
(s/def ::packet (s/schema [::id]))

(defn packet? [x]
  (some? (::id x)))