-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharp-capture.lisp
More file actions
25 lines (22 loc) · 1.01 KB
/
arp-capture.lisp
File metadata and controls
25 lines (22 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
(in-package :lispcap)
(defclass capture-metadata ()
((sec :initarg :sec)
(usec :initarg :usec)
(caplen :initarg :caplen)
(len :initarg :len)))
(defclass arp-capture ()
((ethernet-header :initarg :ethernet-header)
(arp-header :initarg :arp-header)
(capture-metadata :initarg :capture-metadata)))
(defun parse-arp-frame (sec usec caplen len buffer)
(with-input-from-sequence (buffer-stream buffer)
(let ((binary-types:*endian* :big-endian))
(make-instance 'arp-capture
:ethernet-header (read-binary 'ethernet-header
buffer-stream)
:arp-header (read-binary 'arp buffer-stream)
:capture-metadata (make-instance 'capture-metadata
:sec sec
:usec usec
:caplen caplen
:len len)))))