#'parse-integer
(split dotted-quads nil '(#\.))))
+(define-condition unknown-protocol ()
+ ((name :initarg :name
+ :reader unknown-protocol-name))
+ (:report (lambda (c s)
+ (format s "Protocol not found: ~a" (prin1-to-string
+ (unknown-protocol-name c))))))
+
;;; getprotobyname only works in the internet domain, which is why this
;;; is here
(defun get-protocol-by-name (name) ;exported
;; for extra brownie points, could return canonical protocol name
;; and aliases as extra values
(let ((ent (sockint::getprotobyname name)))
+ (if (sb-grovel::foreign-nullp ent)
+ (error 'unknown-protocol :name name))
(sockint::protoent-proto ent)))
;;; our protocol provides make-sockaddr-for, size-of-sockaddr,
(equalp (make-inet-address "242.1.211.3") #(242 1 211 3))
t)
+(deftest get-protocol-by-name/tcp
+ (integerp (get-protocol-by-name "tcp"))
+ t)
+
+(deftest get-protocol-by-name/udp
+ (integerp (get-protocol-by-name "udp"))
+ t)
+
+(deftest get-protocol-by-name/error
+ (handler-case (get-protocol-by-name "nonexistent-protocol")
+ (unknown-protocol ()
+ t)
+ (:no-error ()
+ nil))
+ t)
+
(deftest make-inet-socket
;; make a socket
(let ((s (make-instance 'inet-socket :type :stream :protocol (get-protocol-by-name "tcp"))))
;;; checkins which aren't released. (And occasionally for internal
;;; versions, especially for internal versions off the main CVS
;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.9.9.3"
+"0.9.9.4"