Dolda2000 GitWeb
/
lisp-utils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
37df166
)
Enabled initialization of IP addresses from another host address.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Thu, 13 May 2010 02:45:40 +0000
(
04:45
+0200)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Thu, 13 May 2010 02:45:40 +0000
(
04:45
+0200)
common-net.lisp
patch
|
blob
|
blame
|
history
diff --git
a/common-net.lisp
b/common-net.lisp
index
00ae20d
..
fadf080
100644
(file)
--- a/
common-net.lisp
+++ b/
common-net.lisp
@@
-349,8
+349,11
@@
(error "Too few octets in IPv4 address")
buf)))
(error "Too few octets in IPv4 address")
buf)))
-(defmethod initialize-instance :after ((instance ipv4-address) &key host-bytes host-string)
+(defmethod initialize-instance :after ((instance ipv4-address) &key host-bytes host-string
host-address
)
(let ((octets (or host-bytes
(let ((octets (or host-bytes
+ (when host-address
+ (check-type host-address ipv4-address)
+ (slot-value host-address 'host-bytes))
(when host-string (parse-dotted-quad host-string))
'(0 0 0 0))))
(assert (and (typep octets 'sequence)
(when host-string (parse-dotted-quad host-string))
'(0 0 0 0))))
(assert (and (typep octets 'sequence)
@@
-373,7
+376,9
@@
(aref host-bytes 2)
(aref host-bytes 3))))
(aref host-bytes 2)
(aref host-bytes 3))))
-(export '(ipv4-address make-ipv4-address parse-ipv4-address))
+(defparameter *ipv4-localhost* (make-instance 'ipv4-host-address :host-bytes '(127 0 0 1)))
+
+(export '(ipv4-address ipv4-host-address make-ipv4-address parse-ipv4-address *ipv4-localhost*))
;;; IPv6 addresses
;;; IPv6 addresses
@@
-386,8
+391,11
@@
(declare (ignore string))
(error "IPv6 parsing not implemented yet"))
(declare (ignore string))
(error "IPv6 parsing not implemented yet"))
-(defmethod initialize-instance :after ((instance ipv6-address) &key host-bytes host-string)
+(defmethod initialize-instance :after ((instance ipv6-address) &key host-bytes host-string
host-address
)
(let ((octets (or host-bytes
(let ((octets (or host-bytes
+ (when host-address
+ (check-type host-address ipv6-address)
+ (slot-value host-address 'host-bytes))
(when host-string (parse-ipv6-string host-string))
'(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0))))
(assert (and (typep octets 'sequence)
(when host-string (parse-ipv6-string host-string))
'(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0))))
(assert (and (typep octets 'sequence)
@@
-402,7
+410,9
@@
(defun parse-ipv6-host-address (string)
(make-instance 'ipv6-host-address :host-string string))
(defun parse-ipv6-host-address (string)
(make-instance 'ipv6-host-address :host-string string))
-(export '(ipv6-address parse-ipv6-address))
+(defparameter *ipv6-localhost* (make-instance 'ipv6-host-address :host-bytes '(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1)))
+
+(export '(ipv6-address ipv6-host-address parse-ipv6-address *ipv6-localhost*))
;;; TCP code
;;; TCP code