mirror of
https://github.com/danderson/netboot.git
synced 2025-10-16 18:11:21 +02:00
Document dhcp.Options.Uint16.
This commit is contained in:
parent
21d22e747d
commit
60581f4259
@ -138,18 +138,19 @@ func (o Options) marshalLimited(w io.Writer, nBytes int, skip52 bool) (Options,
|
|||||||
|
|
||||||
// Byte returns the value of single-byte option n, if the option value
|
// Byte returns the value of single-byte option n, if the option value
|
||||||
// is indeed a single byte.
|
// is indeed a single byte.
|
||||||
func (o Options) Byte(n int) (byte, bool) {
|
func (o Options) Byte(n int) (v byte, ok bool) {
|
||||||
v := o[n]
|
bs := o[n]
|
||||||
if v == nil || len(v) != 1 {
|
if bs == nil || len(bs) != 1 {
|
||||||
return 0, false
|
return 0, false
|
||||||
}
|
}
|
||||||
return v[0], true
|
return bs[0], true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o Options) Uint16(n int) (uint16, bool) {
|
// Uint16 returns the value of option n interpreted as a uint16.
|
||||||
v := o[n]
|
func (o Options) Uint16(n int) (v uint16, ok bool) {
|
||||||
if v == nil || len(v) != 2 {
|
bs := o[n]
|
||||||
|
if bs == nil || len(bs) != 2 {
|
||||||
return 0, false
|
return 0, false
|
||||||
}
|
}
|
||||||
return binary.BigEndian.Uint16(v[:2]), true
|
return binary.BigEndian.Uint16(bs[:2]), true
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user