cl-rw

Layered streams for Common Lisp
git clone https://logand.com/git/cl-rw.git/
Log | Files | Refs

commit b6fbcdd2acd6a1331fc86a1c76f21dfd78e010a1
parent 7eaac7306d96b79b44e3b41f106d82aa56d922e1
Author: Tomas Hlavaty <tom@logand.com>
Date:   Sun,  6 Dec 2015 09:25:11 +0100

network-interfaces on linux

Diffstat:
Mnet.lisp | 27+++++++++++++++++++++++++++
1 file changed, 27 insertions(+), 0 deletions(-)

diff --git a/net.lisp b/net.lisp @@ -30,6 +30,33 @@ (in-package :rw.net) +(defun network-interfaces () + #-linux + (error "TODO rw.net::network-interfaces not ported") + #+linux + (sort (loop + for d in (directory "/sys/class/net/*.*") + collect (let ((x (pathname-directory d))) + (ecase (car x) + (:absolute (car (last x)))))) + #'string<)) + +;;(network-interfaces) + +(defun virtual-network-interface-p (name) + #-linux + (error "TODO rw.net::virtual-network-interface-p not ported") + #+linux + (let ((d (directory (merge-pathnames name "/sys/class/net/")))) + (assert d) + (assert (not (cdr d))) + (let ((x (pathname-directory (car d)))) + (ecase (car x) + (:absolute (and (find "virtual" x :test #'equal) t)))))) + +;;(virtual-network-interface-p "enp4s0f0") +;;(virtual-network-interface-p "tun0") + (defun wget (url &key request-file response-file content-type) (rw.os:run-command "wget"