~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

Viewing changes to src/pkg/net/iprawsock_plan9.go

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-20 14:06:23 UTC
  • mfrom: (14.1.23 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130820140623-b414jfxi3m0qkmrq
Tags: 2:1.1.2-2ubuntu1
* Merge from Debian unstable (LP: #1211749, #1202027). Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - d/control,control.cross: Update Breaks/Replaces for Ubuntu
    versions to ensure smooth upgrades, regenerate control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
// Use of this source code is governed by a BSD-style
3
3
// license that can be found in the LICENSE file.
4
4
 
5
 
// (Raw) IP sockets stubs for Plan 9
6
 
 
7
5
package net
8
6
 
9
7
import (
11
9
        "time"
12
10
)
13
11
 
14
 
// IPConn is the implementation of the Conn and PacketConn
15
 
// interfaces for IP network connections.
16
 
type IPConn bool
17
 
 
18
 
// SetDeadline implements the Conn SetDeadline method.
19
 
func (c *IPConn) SetDeadline(t time.Time) error {
20
 
        return syscall.EPLAN9
21
 
}
22
 
 
23
 
// SetReadDeadline implements the Conn SetReadDeadline method.
24
 
func (c *IPConn) SetReadDeadline(t time.Time) error {
25
 
        return syscall.EPLAN9
26
 
}
27
 
 
28
 
// SetWriteDeadline implements the Conn SetWriteDeadline method.
29
 
func (c *IPConn) SetWriteDeadline(t time.Time) error {
30
 
        return syscall.EPLAN9
31
 
}
32
 
 
33
 
// Implementation of the Conn interface - see Conn for documentation.
34
 
 
35
 
// Read implements the Conn Read method.
36
 
func (c *IPConn) Read(b []byte) (int, error) {
37
 
        return 0, syscall.EPLAN9
38
 
}
39
 
 
40
 
// Write implements the Conn Write method.
41
 
func (c *IPConn) Write(b []byte) (int, error) {
42
 
        return 0, syscall.EPLAN9
43
 
}
44
 
 
45
 
// Close closes the IP connection.
46
 
func (c *IPConn) Close() error {
47
 
        return syscall.EPLAN9
48
 
}
49
 
 
50
 
// LocalAddr returns the local network address.
51
 
func (c *IPConn) LocalAddr() Addr {
52
 
        return nil
53
 
}
54
 
 
55
 
// RemoteAddr returns the remote network address, a *IPAddr.
56
 
func (c *IPConn) RemoteAddr() Addr {
57
 
        return nil
58
 
}
59
 
 
60
 
// IP-specific methods.
61
 
 
62
 
// ReadFromIP reads a IP packet from c, copying the payload into b.
 
12
// IPConn is the implementation of the Conn and PacketConn interfaces
 
13
// for IP network connections.
 
14
type IPConn struct {
 
15
        conn
 
16
}
 
17
 
 
18
// ReadFromIP reads an IP packet from c, copying the payload into b.
63
19
// It returns the number of bytes copied into b and the return address
64
20
// that was on the packet.
65
21
//
75
31
        return 0, nil, syscall.EPLAN9
76
32
}
77
33
 
78
 
// WriteToIP writes a IP packet to addr via c, copying the payload from b.
 
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
 
40
}
 
41
 
 
42
// WriteToIP writes an IP packet to addr via c, copying the payload
 
43
// from b.
79
44
//
80
 
// WriteToIP can be made to time out and return
81
 
// an error with Timeout() == true after a fixed time limit;
82
 
// see SetDeadline and SetWriteDeadline.
83
 
// On packet-oriented connections, write timeouts are rare.
 
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
 
48
// are rare.
84
49
func (c *IPConn) WriteToIP(b []byte, addr *IPAddr) (int, error) {
85
50
        return 0, syscall.EPLAN9
86
51
}
90
55
        return 0, syscall.EPLAN9
91
56
}
92
57
 
93
 
// DialIP connects to the remote address raddr on the network protocol netProto,
94
 
// which must be "ip", "ip4", or "ip6" followed by a colon and a protocol number or name.
 
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
 
63
}
 
64
 
 
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.
95
68
func DialIP(netProto string, laddr, raddr *IPAddr) (*IPConn, error) {
 
69
        return dialIP(netProto, laddr, raddr, noDeadline)
 
70
}
 
71
 
 
72
func dialIP(netProto string, laddr, raddr *IPAddr, deadline time.Time) (*IPConn, error) {
96
73
        return nil, syscall.EPLAN9
97
74
}
98
75
 
99
 
// ListenIP listens for incoming IP packets addressed to the
100
 
// local address laddr.  The returned connection c's ReadFrom
101
 
// and WriteTo methods can be used to receive and send IP
102
 
// packets with per-packet addressing.
 
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
 
79
// addressing.
103
80
func ListenIP(netProto string, laddr *IPAddr) (*IPConn, error) {
104
81
        return nil, syscall.EPLAN9
105
82
}