diff options
author | Pablo Mazzini <pmazzini@gmail.com> | 2020-03-09 17:27:45 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-09 17:27:45 +0000 |
commit | 00901efc824ad5efb860c98ae3cd2e50a3ba610d (patch) | |
tree | 8a9626b86dcadf6c206ffd613c99b45d21c714df /dhcpv6/dhcpv6message.go | |
parent | 19ee83379cf483ab151dd1ad4e36d09483d6a223 (diff) | |
parent | 59c22a151d6899aedd143445953e5906b0d11574 (diff) |
Merge branch 'master' into feature/dhcp4-o-dhcp6
Diffstat (limited to 'dhcpv6/dhcpv6message.go')
-rw-r--r-- | dhcpv6/dhcpv6message.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/dhcpv6/dhcpv6message.go b/dhcpv6/dhcpv6message.go index 2ec3203..3b850fb 100644 --- a/dhcpv6/dhcpv6message.go +++ b/dhcpv6/dhcpv6message.go @@ -167,6 +167,30 @@ func (mo MessageOptions) BootFileParam() []string { return nil } +// UserClasses returns a list of user classes. +func (mo MessageOptions) UserClasses() [][]byte { + opt := mo.Options.GetOne(OptionUserClass) + if opt == nil { + return nil + } + if t, ok := opt.(*OptUserClass); ok { + return t.UserClasses + } + return nil +} + +// VendorOpts returns the enterprise number and a list of vendor options. +func (mo MessageOptions) VendorOpts() (uint32, Options) { + opt := mo.Options.GetOne(OptionVendorOpts) + if opt == nil { + return 0, nil + } + if t, ok := opt.(*OptVendorOpts); ok { + return t.EnterpriseNumber, t.VendorOpts + } + return 0, nil +} + // ElapsedTime returns the Elapsed Time option as defined by RFC 3315 Section 22.9. // // ElapsedTime returns a duration of 0 if the option is not present. |