packet.clj

Branches > main > 6f4938c > 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?)

(s/def ::packet (s/schema [::id]))

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