OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [go/] [syscall/] [route_openbsd.go] - Blame information for rev 833

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
// 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.
4
 
5
// Routing sockets and messages for OpenBSD
6
 
7
package syscall
8
 
9
import (
10
        "unsafe"
11
)
12
 
13
func (any *anyMessage) toRoutingMessage(buf []byte) RoutingMessage {
14
        switch any.Type {
15
        case RTM_ADD, RTM_DELETE, RTM_CHANGE, RTM_GET, RTM_LOSING, RTM_REDIRECT, RTM_MISS, RTM_LOCK, RTM_RESOLVE:
16
                p := (*RouteMessage)(unsafe.Pointer(any))
17
                rtm := &RouteMessage{}
18
                rtm.Header = p.Header
19
                rtm.Data = buf[SizeofRtMsghdr:any.Msglen]
20
                return rtm
21
        case RTM_IFINFO:
22
                p := (*InterfaceMessage)(unsafe.Pointer(any))
23
                ifm := &InterfaceMessage{}
24
                ifm.Header = p.Header
25
                ifm.Data = buf[SizeofIfMsghdr:any.Msglen]
26
                return ifm
27
        case RTM_NEWADDR, RTM_DELADDR:
28
                p := (*InterfaceAddrMessage)(unsafe.Pointer(any))
29
                ifam := &InterfaceAddrMessage{}
30
                ifam.Header = p.Header
31
                ifam.Data = buf[SizeofIfaMsghdr:any.Msglen]
32
                return ifam
33
        }
34
        return nil
35
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.