diff options
| author | soukev <soukev@soukev.xyz> | 2026-06-09 11:02:54 +0200 |
|---|---|---|
| committer | soukev <soukev@soukev.xyz> | 2026-06-09 11:02:54 +0200 |
| commit | 3692466424e33278e22faaa8c0c3ae61ac95ffd5 (patch) | |
| tree | 204440dbb9ceafbbc6a60a5fd209ebbe76d98c88 /src/publisher.lisp | |
| parent | 8a62a3f1f60521082bdb5c27be6d7246ebf12306 (diff) | |
Move relevant parts to packet.lisp; add arrow-macros
Diffstat (limited to 'src/publisher.lisp')
| -rw-r--r-- | src/publisher.lisp | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/src/publisher.lisp b/src/publisher.lisp index bcff655..0b3fe86 100644 --- a/src/publisher.lisp +++ b/src/publisher.lisp @@ -1,7 +1,6 @@ ;; Doesn't currently work. I'm unable to join the multicast group to listen for messages. (defpackage :cl-mdns/publisher - (:use :cl - :cl-mdns/packet) + (:use :cl :cl-mdns/packet) (:local-nicknames (:nb :nibbles) (:f :fsocket))) (in-package :cl-mdns/publisher) @@ -9,26 +8,6 @@ (defvar *mdns-address* #(224 0 0 251)) (defvar *mdns-port* 5353) -; TODO: Bring cl-arrows lib so I can thread expressions -(defun parse-query-body-message (lst) - "Parses the body of message. -The rest of the packet (meaning the tail) is ignored." - (labels ((parse-rec (acc rem-lst) - (destructuring-bind (cnt &rest msg) rem-lst - (if (or (null cnt) (zerop cnt)) - acc - (parse-rec - (concatenate 'list acc (list (coerce (map 'list #'code-char (subseq msg 0 cnt)) 'string))) - (nthcdr cnt msg)))))) - (parse-rec nil lst))) - -(defun parse-query (query) - "Parses question/query and returns domain name. -Completely ignores header and tail of packet for now." - (let ((message (subseq query 12))) - (format nil "~{~A~^.~}" - (parse-query-body-message message)))) - (defun publish () (f:with-poll (pc) (f:with-socket (sock :datagram) |
