From 3692466424e33278e22faaa8c0c3ae61ac95ffd5 Mon Sep 17 00:00:00 2001 From: soukev Date: Tue, 9 Jun 2026 11:02:54 +0200 Subject: Move relevant parts to packet.lisp; add arrow-macros --- src/publisher.lisp | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'src/publisher.lisp') 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) -- cgit v1.2.3