1 // Copyright 2011 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.
5 // Routing sockets and messages for OpenBSD
11 func (any *anyMessage) toRoutingMessage(b []byte) RoutingMessage {
13 case RTM_ADD, RTM_DELETE, RTM_CHANGE, RTM_GET, RTM_LOSING, RTM_REDIRECT, RTM_MISS, RTM_LOCK, RTM_RESOLVE:
14 p := (*RouteMessage)(unsafe.Pointer(any))
15 return &RouteMessage{Header: p.Header, Data: b[SizeofRtMsghdr:any.Msglen]}
17 p := (*InterfaceMessage)(unsafe.Pointer(any))
18 return &InterfaceMessage{Header: p.Header, Data: b[SizeofIfMsghdr:any.Msglen]}
20 p := (*InterfaceAnnounceMessage)(unsafe.Pointer(any))
21 return &InterfaceAnnounceMessage{Header: p.Header}
22 case RTM_NEWADDR, RTM_DELADDR:
23 p := (*InterfaceAddrMessage)(unsafe.Pointer(any))
24 return &InterfaceAddrMessage{Header: p.Header, Data: b[SizeofIfaMsghdr:any.Msglen]}
29 // InterfaceAnnounceMessage represents a routing message containing
30 // network interface arrival and depature information.
31 type InterfaceAnnounceMessage struct {
32 Header IfAnnounceMsghdr
35 func (m *InterfaceAnnounceMessage) sockaddr() (sas []Sockaddr) { return nil }