Skip to content

Commit

Permalink
net: extend sockaddr interface to the all address families
Browse files Browse the repository at this point in the history
This CL extends existing sockaddr interface to accommodate not only
internet protocol family endpoint addressess but unix network family
endpoint addresses.

This is in preparation for runtime-integrated network pollster for BSD
variants.

Update #5199

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/11979043
  • Loading branch information
cixtor committed Jul 28, 2013
1 parent bf61a97 commit e257cd8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
9 changes: 0 additions & 9 deletions src/pkg/net/ipsock_posix.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,6 @@ func favoriteAddrFamily(net string, laddr, raddr sockaddr, mode string) (family

// Internet sockets (TCP, UDP, IP)

// A sockaddr represents a TCP, UDP or IP network address that can
// be converted into a syscall.Sockaddr.
type sockaddr interface {
Addr
family() int
isWildcard() bool
sockaddr(family int) (syscall.Sockaddr, error)
}

func internetSocket(net string, laddr, raddr sockaddr, deadline time.Time, sotype, proto int, mode string, toAddr func(syscall.Sockaddr) Addr) (fd *netFD, err error) {
var la, ra syscall.Sockaddr
family, ipv6only := favoriteAddrFamily(net, laddr, raddr, mode)
Expand Down
10 changes: 10 additions & 0 deletions src/pkg/net/sock_posix.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ import (
"time"
)

// A sockaddr represents a TCP, UDP, IP network endpoint address that
// can be converted into a syscall.Sockaddr.
type sockaddr interface {
Addr
family() int
isWildcard() bool
sockaddr(family int) (syscall.Sockaddr, error)
toAddr() sockaddr
}

// Generic POSIX socket creation.
func socket(net string, f, t, p int, ipv6only bool, ulsa, ursa syscall.Sockaddr, deadline time.Time, toAddr func(syscall.Sockaddr) Addr) (fd *netFD, err error) {
s, err := sysSocket(f, t, p)
Expand Down

0 comments on commit e257cd8

Please sign in to comment.