guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dhcp] 02/03: dhcp: refactor options/base.scm to use records instead of


From: Rohan Prinja
Subject: [dhcp] 02/03: dhcp: refactor options/base.scm to use records instead of goops
Date: Tue, 09 Jun 2015 01:39:16 +0000

wenderen pushed a commit to branch master
in repository dhcp.

commit a9f5c30360f00d38c37c18c57bf355a5c2824ac2
Author: Rohan Prinja <address@hidden>
Date:   Tue Jun 9 07:00:23 2015 +0530

    dhcp: refactor options/base.scm to use records instead of goops
---
 dhcp/options/base.scm |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/dhcp/options/base.scm b/dhcp/options/base.scm
index 500014e..b0fa14f 100644
--- a/dhcp/options/base.scm
+++ b/dhcp/options/base.scm
@@ -17,17 +17,23 @@
 
 (define-module (dhcp options base)
   #:export (<dhcp-option>
-           make-dhcp-option))
+           make-dhcp-option
+           dhcp-option?
+           dhcp-option-code
+           dhcp-option-len
+           dhcp-option-val))
 
-(use-modules (oop goops)
+(use-modules (srfi srfi-9)
             (rnrs bytevectors))
 
 ; DHCP option object.
 ; See RFC 2132 for a list of DHCP options.
-(define-class <dhcp-option> ()
-  (code #:init-keyword #:code)
-  (len #:init-keyword #:len)
-  (val #:init-keyword #:val))
+(define-record-type <dhcp-option>
+  (make-dhcp-option code len val)
+  dhcp-option?
+  (code dhcp-option-code)
+  (len dhcp-option-len)
+  (val dhcp-option-val))
 
 ; code = option code, lies between 0 and 255
 ; len = length of option in bytes when it is serialized into a,
@@ -40,7 +46,3 @@
 ; 'len' take up one byte each. Exceptions to this are the
 ; 'Pad' and 'End' options, both of which are 1 byte only.
 ; For such one-byte options, 'len' is 0 and 'val' is #nil.
-
-; Create a <dhcp-option> instance.
-(define-syntax-rule (make-dhcp-option code len val)
-  (make <dhcp-option> #:code code #:len len #:val val))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]