Skip to content
Snippets Groups Projects
Commit e272abf5 authored by Marcus Weiner's avatar Marcus Weiner
Browse files

Provide helpers for router options

parent 1c696c88
No related branches found
No related tags found
1 merge request!2Packet/ospfv3
......@@ -48,6 +48,22 @@ type RouterOptions struct {
Flags uint16
}
func OptionsFromFlags(flags ...uint16) RouterOptions {
opts := RouterOptions{Flags: 0}
for _, flag := range flags {
opts.Flags = opts.Flags | flag
}
return opts
}
func (r *RouterOptions) HasFlag(flag uint16) bool {
return r.Flags&flag != 0
}
func (r *RouterOptions) SetFlag(flag uint16) {
r.Flags = r.Flags | flag
}
func (r *RouterOptions) Serialize(buf *bytes.Buffer) {
buf.WriteByte(0)
buf.Write(convert.Uint16Byte(uint16(r.Flags)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment