1 // Copyright 2016 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
9 func (typ RIBType) parseable() bool { return true }
11 // RouteMetrics represents route metrics.
12 type RouteMetrics struct {
13 PathMTU int // path maximum transmission unit
16 // SysType implements the SysType method of Sys interface.
17 func (rmx *RouteMetrics) SysType() SysType { return SysMetrics }
19 // Sys implements the Sys method of Message interface.
20 func (m *RouteMessage) Sys() []Sys {
23 PathMTU: int(nativeEndian.Uint64(m.raw[m.extOff+8 : m.extOff+16])),
28 // InterfaceMetrics represents interface metrics.
29 type InterfaceMetrics struct {
30 Type int // interface type
31 MTU int // maximum transmission unit
34 // SysType implements the SysType method of Sys interface.
35 func (imx *InterfaceMetrics) SysType() SysType { return SysMetrics }
37 // Sys implements the Sys method of Message interface.
38 func (m *InterfaceMessage) Sys() []Sys {
41 Type: int(m.raw[m.extOff]),
42 MTU: int(nativeEndian.Uint32(m.raw[m.extOff+8 : m.extOff+12])),
47 func probeRoutingStack() (int, map[int]*wireFormat) {
49 rtm := &wireFormat{extOff: 40, bodyOff: sizeofRtMsghdrDragonFlyBSD4}
50 rtm.parse = rtm.parseRouteMessage
51 ifm := &wireFormat{extOff: 16, bodyOff: sizeofIfMsghdrDragonFlyBSD4}
52 ifm.parse = ifm.parseInterfaceMessage
53 ifam := &wireFormat{extOff: sizeofIfaMsghdrDragonFlyBSD4, bodyOff: sizeofIfaMsghdrDragonFlyBSD4}
54 ifam.parse = ifam.parseInterfaceAddrMessage
55 ifmam := &wireFormat{extOff: sizeofIfmaMsghdrDragonFlyBSD4, bodyOff: sizeofIfmaMsghdrDragonFlyBSD4}
56 ifmam.parse = ifmam.parseInterfaceMulticastAddrMessage
57 ifanm := &wireFormat{extOff: sizeofIfAnnouncemsghdrDragonFlyBSD4, bodyOff: sizeofIfAnnouncemsghdrDragonFlyBSD4}
58 ifanm.parse = ifanm.parseInterfaceAnnounceMessage
59 return int(unsafe.Sizeof(p)), map[int]*wireFormat{
72 sysRTM_NEWMADDR: ifmam,
73 sysRTM_DELMADDR: ifmam,
74 sysRTM_IFANNOUNCE: ifanm,