1 // Copyright 2010 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 // IPConn is the implementation of the Conn and PacketConn interfaces
13 // for IP network connections.
18 // ReadFromIP reads an IP packet from c, copying the payload into b.
19 // It returns the number of bytes copied into b and the return address
20 // that was on the packet.
22 // ReadFromIP can be made to time out and return an error with
23 // Timeout() == true after a fixed time limit; see SetDeadline and
25 func (c
*IPConn
) ReadFromIP(b
[]byte) (int, *IPAddr
, error
) {
26 return 0, nil, syscall
.EPLAN9
29 // ReadFrom implements the PacketConn ReadFrom method.
30 func (c
*IPConn
) ReadFrom(b
[]byte) (int, Addr
, error
) {
31 return 0, nil, syscall
.EPLAN9
34 // ReadMsgIP reads a packet from c, copying the payload into b and the
35 // associated out-of-band data into oob. It returns the number of
36 // bytes copied into b, the number of bytes copied into oob, the flags
37 // that were set on the packet and the source address of the packet.
38 func (c
*IPConn
) ReadMsgIP(b
, oob
[]byte) (n
, oobn
, flags
int, addr
*IPAddr
, err error
) {
39 return 0, 0, 0, nil, syscall
.EPLAN9
42 // WriteToIP writes an IP packet to addr via c, copying the payload
45 // WriteToIP can be made to time out and return an error with
46 // Timeout() == true after a fixed time limit; see SetDeadline and
47 // SetWriteDeadline. On packet-oriented connections, write timeouts
49 func (c
*IPConn
) WriteToIP(b
[]byte, addr
*IPAddr
) (int, error
) {
50 return 0, syscall
.EPLAN9
53 // WriteTo implements the PacketConn WriteTo method.
54 func (c
*IPConn
) WriteTo(b
[]byte, addr Addr
) (int, error
) {
55 return 0, syscall
.EPLAN9
58 // WriteMsgIP writes a packet to addr via c, copying the payload from
59 // b and the associated out-of-band data from oob. It returns the
60 // number of payload and out-of-band bytes written.
61 func (c
*IPConn
) WriteMsgIP(b
, oob
[]byte, addr
*IPAddr
) (n
, oobn
int, err error
) {
62 return 0, 0, syscall
.EPLAN9
65 // DialIP connects to the remote address raddr on the network protocol
66 // netProto, which must be "ip", "ip4", or "ip6" followed by a colon
67 // and a protocol number or name.
68 func DialIP(netProto
string, laddr
, raddr
*IPAddr
) (*IPConn
, error
) {
69 return dialIP(netProto
, laddr
, raddr
, noDeadline
)
72 func dialIP(netProto
string, laddr
, raddr
*IPAddr
, deadline time
.Time
) (*IPConn
, error
) {
73 return nil, syscall
.EPLAN9
76 // ListenIP listens for incoming IP packets addressed to the local
77 // address laddr. The returned connection's ReadFrom and WriteTo
78 // methods can be used to receive and send IP packets with per-packet
80 func ListenIP(netProto
string, laddr
*IPAddr
) (*IPConn
, error
) {
81 return nil, syscall
.EPLAN9