[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dhcp] 04/12: dhcp: change module names to reflect directory structure
From: |
Rohan Prinja |
Subject: |
[dhcp] 04/12: dhcp: change module names to reflect directory structure |
Date: |
Sat, 06 Jun 2015 18:16:55 +0000 |
wenderen pushed a commit to branch master
in repository dhcp.
commit c616589cbbe2300d8c9da66d779dd212863825ac
Author: Rohan Prinja <address@hidden>
Date: Thu Jun 4 02:51:14 2015 +0530
dhcp: change module names to reflect directory structure
---
dhcp/options/base.scm | 46 ++++++++++++++++++++++++++++++++++++++++++++++
dhcp/options/names.scm | 2 +-
2 files changed, 47 insertions(+), 1 deletions(-)
diff --git a/dhcp/options/base.scm b/dhcp/options/base.scm
new file mode 100644
index 0000000..500014e
--- /dev/null
+++ b/dhcp/options/base.scm
@@ -0,0 +1,46 @@
+;;; GNU Guix DHCP Client.
+;;;
+;;; Copyright 2015 Free Software Foundation, Inc.
+;;;
+;;; This program is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; This program is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (dhcp options base)
+ #:export (<dhcp-option>
+ make-dhcp-option))
+
+(use-modules (oop goops)
+ (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))
+
+; code = option code, lies between 0 and 255
+; len = length of option in bytes when it is serialized into a,
+; bytevector, excluding 'code' and 'len' fields
+; val = bytevector of length 'len' containing the option value
+; name = option name, stored as a symbol
+
+; Note: the actual net length of the option when serialized as a
+; bytevector is (+ len 2), and not 'len', because 'code' and
+; '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))
diff --git a/dhcp/options/names.scm b/dhcp/options/names.scm
index 0502f96..1786cad 100644
--- a/dhcp/options/names.scm
+++ b/dhcp/options/names.scm
@@ -15,7 +15,7 @@
;;; You should have received a copy of the GNU General Public License
;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
-(define-module (options names)
+(define-module (dhcp options names)
#:export (map-name-to-code))
(use-modules (rnrs enums))
- [dhcp] branch master updated (30d7a60 -> d6b11dd), Rohan Prinja, 2015/06/06
- [dhcp] 02/12: dhcp: tell git to ignore log files, Rohan Prinja, 2015/06/06
- [dhcp] 05/12: dhcp: add in deprecated time-offset option, Rohan Prinja, 2015/06/06
- [dhcp] 01/12: dhcp: arp hardware address identifiers, Rohan Prinja, 2015/06/06
- [dhcp] 04/12: dhcp: change module names to reflect directory structure,
Rohan Prinja <=
- [dhcp] 08/12: dhcp: code for sending packets, incomplete, untested, Rohan Prinja, 2015/06/06
- [dhcp] 10/12: dhcp: source for .so, used by some now-redundant functions in interfaces.scm, Rohan Prinja, 2015/06/06
- [dhcp] 06/12: dhcp: packet objects, untested, Rohan Prinja, 2015/06/06
- [dhcp] 03/12: dhcp: add unused and private-use options, fix some other mistakes, Rohan Prinja, 2015/06/06
- [dhcp] 09/12: dhcp: dhcp configuration objects, Rohan Prinja, 2015/06/06
- [dhcp] 07/12: dhcp: code to read info about network interfaces, untested, Rohan Prinja, 2015/06/06
- [dhcp] 12/12: dhcp: client code, incomplete, Rohan Prinja, 2015/06/06
- [dhcp] 11/12: dhcp: tests for the (dhcp *) modules, incomplete, Rohan Prinja, 2015/06/06