// 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.

package route

func ( RIBType) () bool {
	switch  {
	case sysNET_RT_STAT, sysNET_RT_TRASH:
		return false
	default:
		return true
	}
}

// RouteMetrics represents route metrics.
type RouteMetrics struct {
	PathMTU int // path maximum transmission unit
}

// SysType implements the SysType method of Sys interface.
func ( *RouteMetrics) () SysType { return SysMetrics }

// Sys implements the Sys method of Message interface.
func ( *RouteMessage) () []Sys {
	return []Sys{
		&RouteMetrics{
			PathMTU: int(nativeEndian.Uint32(.raw[.extOff+4 : .extOff+8])),
		},
	}
}

// InterfaceMetrics represents interface metrics.
type InterfaceMetrics struct {
	Type int // interface type
	MTU  int // maximum transmission unit
}

// SysType implements the SysType method of Sys interface.
func ( *InterfaceMetrics) () SysType { return SysMetrics }

// Sys implements the Sys method of Message interface.
func ( *InterfaceMessage) () []Sys {
	return []Sys{
		&InterfaceMetrics{
			Type: int(.raw[.extOff]),
			MTU:  int(nativeEndian.Uint32(.raw[.extOff+8 : .extOff+12])),
		},
	}
}

func () (int, map[int]*wireFormat) {
	 := &wireFormat{extOff: 36, bodyOff: sizeofRtMsghdrDarwin15}
	.parse = .parseRouteMessage
	 := &wireFormat{extOff: 36, bodyOff: sizeofRtMsghdr2Darwin15}
	.parse = .parseRouteMessage
	 := &wireFormat{extOff: 16, bodyOff: sizeofIfMsghdrDarwin15}
	.parse = .parseInterfaceMessage
	 := &wireFormat{extOff: 32, bodyOff: sizeofIfMsghdr2Darwin15}
	.parse = .parseInterfaceMessage
	 := &wireFormat{extOff: sizeofIfaMsghdrDarwin15, bodyOff: sizeofIfaMsghdrDarwin15}
	.parse = .parseInterfaceAddrMessage
	 := &wireFormat{extOff: sizeofIfmaMsghdrDarwin15, bodyOff: sizeofIfmaMsghdrDarwin15}
	.parse = .parseInterfaceMulticastAddrMessage
	 := &wireFormat{extOff: sizeofIfmaMsghdr2Darwin15, bodyOff: sizeofIfmaMsghdr2Darwin15}
	.parse = .parseInterfaceMulticastAddrMessage
	// Darwin kernels require 32-bit aligned access to routing facilities.
	return 4, map[int]*wireFormat{
		sysRTM_ADD:       ,
		sysRTM_DELETE:    ,
		sysRTM_CHANGE:    ,
		sysRTM_GET:       ,
		sysRTM_LOSING:    ,
		sysRTM_REDIRECT:  ,
		sysRTM_MISS:      ,
		sysRTM_LOCK:      ,
		sysRTM_RESOLVE:   ,
		sysRTM_NEWADDR:   ,
		sysRTM_DELADDR:   ,
		sysRTM_IFINFO:    ,
		sysRTM_NEWMADDR:  ,
		sysRTM_DELMADDR:  ,
		sysRTM_IFINFO2:   ,
		sysRTM_NEWMADDR2: ,
		sysRTM_GET2:      ,
	}
}