summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/option_nontemporaryaddress.go
diff options
context:
space:
mode:
Diffstat (limited to 'dhcpv6/option_nontemporaryaddress.go')
-rw-r--r--dhcpv6/option_nontemporaryaddress.go17
1 files changed, 8 insertions, 9 deletions
diff --git a/dhcpv6/option_nontemporaryaddress.go b/dhcpv6/option_nontemporaryaddress.go
index 76f6f4c..2734931 100644
--- a/dhcpv6/option_nontemporaryaddress.go
+++ b/dhcpv6/option_nontemporaryaddress.go
@@ -102,21 +102,20 @@ func (op *OptIANA) LongString(indentSpace int) string {
return fmt.Sprintf("%s: IAID=%#x T1=%s T2=%s Options=%s", op.Code(), op.IaId, op.T1, op.T2, op.Options.LongString(indentSpace))
}
-// ParseOptIANA builds an OptIANA structure from a sequence of bytes. The
+// FromBytes builds an OptIANA structure from a sequence of bytes. The
// input data does not include option code and length bytes.
-func ParseOptIANA(data []byte) (*OptIANA, error) {
- var opt OptIANA
+func (op *OptIANA) FromBytes(data []byte) error {
buf := uio.NewBigEndianBuffer(data)
- buf.ReadBytes(opt.IaId[:])
+ buf.ReadBytes(op.IaId[:])
var t1, t2 Duration
t1.Unmarshal(buf)
t2.Unmarshal(buf)
- opt.T1 = t1.Duration
- opt.T2 = t2.Duration
+ op.T1 = t1.Duration
+ op.T2 = t2.Duration
- if err := opt.Options.FromBytes(buf.ReadAll()); err != nil {
- return nil, err
+ if err := op.Options.FromBytes(buf.ReadAll()); err != nil {
+ return err
}
- return &opt, buf.FinError()
+ return buf.FinError()
}