aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikio Hara <mikioh.mikioh@gmail.com>2011-06-03 15:16:05 -0400
committerRuss Cox <rsc@golang.org>2011-06-03 15:16:05 -0400
commit0015e8eb5ee192df0a9907aa4d0741a0803992fd (patch)
treebca8df534af8094c8e91de913363f2950cdb4e85
parent518331dfeadfe60b7ccb7402030ac8883858c54b (diff)
downloadgo-0015e8eb5ee192df0a9907aa4d0741a0803992fd.tar.gz
go-0015e8eb5ee192df0a9907aa4d0741a0803992fd.zip
net: fix windows build
R=rsc CC=golang-dev https://golang.org/cl/4539108
-rw-r--r--src/pkg/net/interface.go44
-rw-r--r--src/pkg/net/interface_bsd.go43
-rw-r--r--src/pkg/net/interface_linux.go43
-rw-r--r--src/pkg/net/interface_stub.go28
4 files changed, 114 insertions, 44 deletions
diff --git a/src/pkg/net/interface.go b/src/pkg/net/interface.go
index 7463a11713..f622487ab0 100644
--- a/src/pkg/net/interface.go
+++ b/src/pkg/net/interface.go
@@ -10,7 +10,6 @@ import (
"bytes"
"fmt"
"os"
- "syscall"
)
// A HardwareAddr represents a physical hardware address.
@@ -38,49 +37,6 @@ type Interface struct {
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.
func (ifi *Interface) Addrs() ([]Addr, os.Error) {
if ifi == nil {
diff --git a/src/pkg/net/interface_bsd.go b/src/pkg/net/interface_bsd.go
index c410881dd8..0c6ce767cd 100644
--- a/src/pkg/net/interface_bsd.go
+++ b/src/pkg/net/interface_bsd.go
@@ -11,6 +11,49 @@ import (
"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
// network interfaces. Otheriwse it returns a mapping of a specific
// interface.
diff --git a/src/pkg/net/interface_linux.go b/src/pkg/net/interface_linux.go
index f41befe69a..5c9657834e 100644
--- a/src/pkg/net/interface_linux.go
+++ b/src/pkg/net/interface_linux.go
@@ -12,6 +12,49 @@ import (
"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
// network interfaces. Otheriwse it returns a mapping of a specific
// interface.
diff --git a/src/pkg/net/interface_stub.go b/src/pkg/net/interface_stub.go
index 24a7431c56..feb871bb5b 100644
--- a/src/pkg/net/interface_stub.go
+++ b/src/pkg/net/interface_stub.go
@@ -8,6 +8,34 @@ package net
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
// network interfaces. Otheriwse it returns a mapping of a specific
// interface.