Commit 0015e8eb authored by Mikio Hara's avatar Mikio Hara Committed by Russ Cox

net: fix windows build

R=rsc
CC=golang-dev
https://golang.org/cl/4539108
parent 518331df
...@@ -10,7 +10,6 @@ import ( ...@@ -10,7 +10,6 @@ import (
"bytes" "bytes"
"fmt" "fmt"
"os" "os"
"syscall"
) )
// A HardwareAddr represents a physical hardware address. // A HardwareAddr represents a physical hardware address.
...@@ -38,49 +37,6 @@ type Interface struct { ...@@ -38,49 +37,6 @@ type Interface struct {
rawFlags int rawFlags int
} }
// IsUp returns true if ifi is up.
func (ifi *Interface) IsUp() bool {
if ifi == nil {
return false
}
return ifi.rawFlags&syscall.IFF_UP != 0
}
// IsLoopback returns true if ifi is a loopback interface.
func (ifi *Interface) IsLoopback() bool {
if ifi == nil {
return false
}
return ifi.rawFlags&syscall.IFF_LOOPBACK != 0
}
// CanBroadcast returns true if ifi supports a broadcast access
// capability.
func (ifi *Interface) CanBroadcast() bool {
if ifi == nil {
return false
}
return ifi.rawFlags&syscall.IFF_BROADCAST != 0
}
// IsPointToPoint returns true if ifi belongs to a point-to-point
// link.
func (ifi *Interface) IsPointToPoint() bool {
if ifi == nil {
return false
}
return ifi.rawFlags&syscall.IFF_POINTOPOINT != 0
}
// CanMulticast returns true if ifi supports a multicast access
// capability.
func (ifi *Interface) CanMulticast() bool {
if ifi == nil {
return false
}
return ifi.rawFlags&syscall.IFF_MULTICAST != 0
}
// Addrs returns interface addresses for a specific interface. // Addrs returns interface addresses for a specific interface.
func (ifi *Interface) Addrs() ([]Addr, os.Error) { func (ifi *Interface) Addrs() ([]Addr, os.Error) {
if ifi == nil { if ifi == nil {
......
...@@ -11,6 +11,49 @@ import ( ...@@ -11,6 +11,49 @@ import (
"syscall" "syscall"
) )
// IsUp returns true if ifi is up.
func (ifi *Interface) IsUp() bool {
if ifi == nil {
return false
}
return ifi.rawFlags&syscall.IFF_UP != 0
}
// IsLoopback returns true if ifi is a loopback interface.
func (ifi *Interface) IsLoopback() bool {
if ifi == nil {
return false
}
return ifi.rawFlags&syscall.IFF_LOOPBACK != 0
}
// CanBroadcast returns true if ifi supports a broadcast access
// capability.
func (ifi *Interface) CanBroadcast() bool {
if ifi == nil {
return false
}
return ifi.rawFlags&syscall.IFF_BROADCAST != 0
}
// IsPointToPoint returns true if ifi belongs to a point-to-point
// link.
func (ifi *Interface) IsPointToPoint() bool {
if ifi == nil {
return false
}
return ifi.rawFlags&syscall.IFF_POINTOPOINT != 0
}
// CanMulticast returns true if ifi supports a multicast access
// capability.
func (ifi *Interface) CanMulticast() bool {
if ifi == nil {
return false
}
return ifi.rawFlags&syscall.IFF_MULTICAST != 0
}
// If the ifindex is zero, interfaceTable returns mappings of all // If the ifindex is zero, interfaceTable returns mappings of all
// network interfaces. Otheriwse it returns a mapping of a specific // network interfaces. Otheriwse it returns a mapping of a specific
// interface. // interface.
......
...@@ -12,6 +12,49 @@ import ( ...@@ -12,6 +12,49 @@ import (
"unsafe" "unsafe"
) )
// IsUp returns true if ifi is up.
func (ifi *Interface) IsUp() bool {
if ifi == nil {
return false
}
return ifi.rawFlags&syscall.IFF_UP != 0
}
// IsLoopback returns true if ifi is a loopback interface.
func (ifi *Interface) IsLoopback() bool {
if ifi == nil {
return false
}
return ifi.rawFlags&syscall.IFF_LOOPBACK != 0
}
// CanBroadcast returns true if ifi supports a broadcast access
// capability.
func (ifi *Interface) CanBroadcast() bool {
if ifi == nil {
return false
}
return ifi.rawFlags&syscall.IFF_BROADCAST != 0
}
// IsPointToPoint returns true if ifi belongs to a point-to-point
// link.
func (ifi *Interface) IsPointToPoint() bool {
if ifi == nil {
return false
}
return ifi.rawFlags&syscall.IFF_POINTOPOINT != 0
}
// CanMulticast returns true if ifi supports a multicast access
// capability.
func (ifi *Interface) CanMulticast() bool {
if ifi == nil {
return false
}
return ifi.rawFlags&syscall.IFF_MULTICAST != 0
}
// If the ifindex is zero, interfaceTable returns mappings of all // If the ifindex is zero, interfaceTable returns mappings of all
// network interfaces. Otheriwse it returns a mapping of a specific // network interfaces. Otheriwse it returns a mapping of a specific
// interface. // interface.
......
...@@ -8,6 +8,34 @@ package net ...@@ -8,6 +8,34 @@ package net
import "os" import "os"
// IsUp returns true if ifi is up.
func (ifi *Interface) IsUp() bool {
return false
}
// IsLoopback returns true if ifi is a loopback interface.
func (ifi *Interface) IsLoopback() bool {
return false
}
// CanBroadcast returns true if ifi supports a broadcast access
// capability.
func (ifi *Interface) CanBroadcast() bool {
return false
}
// IsPointToPoint returns true if ifi belongs to a point-to-point
// link.
func (ifi *Interface) IsPointToPoint() bool {
return false
}
// CanMulticast returns true if ifi supports a multicast access
// capability.
func (ifi *Interface) CanMulticast() bool {
return false
}
// If the ifindex is zero, interfaceTable returns mappings of all // If the ifindex is zero, interfaceTable returns mappings of all
// network interfaces. Otheriwse it returns a mapping of a specific // network interfaces. Otheriwse it returns a mapping of a specific
// interface. // interface.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment