| // Copyright 2016 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| // +build darwin dragonfly freebsd netbsd openbsd |
| // A Message represents a routing message. |
| // Note: This interface will be changed to support Marshal method in |
| // Sys returns operating system-specific information. |
| // A Sys reprensents operating system-specific information. |
| // SysType returns a type of operating system-specific |
| // A SysType represents a type of operating system-specific |
| SysMetrics SysType = iota |
| // ParseRIB parses b as a routing information base and returns a list |
| func ParseRIB(typ RIBType, b []byte) ([]Message, error) { |
| return nil, errUnsupportedMessage |
| l := int(nativeEndian.Uint16(b[:2])) |
| if b[2] != sysRTM_VERSION { |
| if fn, ok := parseFns[mtyp]; !ok { |
| // We failed to parse any of the messages - version mismatch? |
| if nmsgs != len(msgs)+nskips { |
| return nil, errMessageMismatch |