dhcp.node-client

Framework for creating DHCP client implementations. Also includes a runnable DHCP client.

client-message-handler

(client-message-handler cfg buf rinfo)

Read/decode DHCP messages from a server. If buf is nil then this means we are responding to a trigger (i.e. send DISCOVER) rather than to an actual received message.

create-client

(create-client {:keys [if-name port buffsz server-ip unicast client-message-handler log-msg error-handler], :as cfg, :or {port dhcp/SEND-PORT, client-message-handler client-message-handler, log-msg (fn* [& rest__3377#] (apply println rest__3377#)), error-handler (fn* [p1__3378#] (prn :err p1__3378#))}})

send-message

(send-message {:keys [sock log-msg]} msg-map addr port)

start-pcap-listener

(start-pcap-listener {:keys [log-msg hw-addr if-name port], :as cfg, :or {port dhcp/SEND-PORT}})

Start a pcap listener socket so that we can receive broadcast messages on an interface if-name even before we have an address assigned to that interface. We only listen for UDP packets that we didn’t send (from hw-addr) and that are destined for dhcp/SEND-PORT