1 // Copyright 2017 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.
12 // BUG(mikio): On Windows, the Read and Write methods of
13 // syscall.RawConn are not implemented.
15 // BUG(mikio): On NaCl and Plan 9, the Control, Read and Write methods
16 // of syscall.RawConn are not implemented.
22 func (c
*rawConn
) ok() bool { return c
!= nil && c
.fd
!= nil }
24 func (c
*rawConn
) Control(f
func(uintptr)) error
{
28 err
:= c
.fd
.pfd
.RawControl(f
)
29 runtime
.KeepAlive(c
.fd
)
31 err
= &OpError
{Op
: "raw-control", Net
: c
.fd
.net
, Source
: nil, Addr
: c
.fd
.laddr
, Err
: err
}
36 func (c
*rawConn
) Read(f
func(uintptr) bool) error
{
40 err
:= c
.fd
.pfd
.RawRead(f
)
41 runtime
.KeepAlive(c
.fd
)
43 err
= &OpError
{Op
: "raw-read", Net
: c
.fd
.net
, Source
: c
.fd
.laddr
, Addr
: c
.fd
.raddr
, Err
: err
}
48 func (c
*rawConn
) Write(f
func(uintptr) bool) error
{
52 err
:= c
.fd
.pfd
.RawWrite(f
)
53 runtime
.KeepAlive(c
.fd
)
55 err
= &OpError
{Op
: "raw-write", Net
: c
.fd
.net
, Source
: c
.fd
.laddr
, Addr
: c
.fd
.raddr
, Err
: err
}
60 func newRawConn(fd
*netFD
) (*rawConn
, error
) {
61 return &rawConn
{fd
: fd
}, nil