diff options
author | insomniac <insomniacslk@users.noreply.github.com> | 2018-08-13 10:39:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-13 10:39:40 +0100 |
commit | b773f618967811e235b334516b0c40563c3a1464 (patch) | |
tree | 75676531481c1e0a4f00fa8210178e35ca74f168 /dhcpv4/dhcpv4.go | |
parent | a6212f1f72e94821a29894fb66656a981bd035d0 (diff) | |
parent | 79d05d5ba9ac8fb488fc6aa1692366d933dee3e1 (diff) |
add IsOptionRequested (#122)
Diffstat (limited to 'dhcpv4/dhcpv4.go')
-rw-r--r-- | dhcpv4/dhcpv4.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/dhcpv4/dhcpv4.go b/dhcpv4/dhcpv4.go index 5005375..ad6e319 100644 --- a/dhcpv4/dhcpv4.go +++ b/dhcpv4/dhcpv4.go @@ -682,6 +682,19 @@ func (d *DHCPv4) ValidateOptions() { } } +// IsOptionRequested returns true if that option is within the requested +// options of the DHCPv4 message. +func (d *DHCPv4) IsOptionRequested(requested OptionCode) bool { + for _, optprl := range d.GetOption(OptionParameterRequestList) { + for _, o := range optprl.(*OptParameterRequestList).RequestedOpts { + if o == requested { + return true + } + } + } + return false +} + // ToBytes encodes a DHCPv4 structure into a sequence of bytes in its wire // format. func (d *DHCPv4) ToBytes() []byte { |