iprawsock_plan9.go 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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.
  4. package net
  5. import (
  6. "syscall"
  7. "time"
  8. )
  9. // IPConn is the implementation of the Conn and PacketConn interfaces
  10. // for IP network connections.
  11. type IPConn struct {
  12. conn
  13. }
  14. // ReadFromIP reads an IP packet from c, copying the payload into b.
  15. // It returns the number of bytes copied into b and the return address
  16. // that was on the packet.
  17. //
  18. // ReadFromIP can be made to time out and return an error with
  19. // Timeout() == true after a fixed time limit; see SetDeadline and
  20. // SetReadDeadline.
  21. func (c *IPConn) ReadFromIP(b []byte) (int, *IPAddr, error) {
  22. return 0, nil, syscall.EPLAN9
  23. }
  24. // ReadFrom implements the PacketConn ReadFrom method.
  25. func (c *IPConn) ReadFrom(b []byte) (int, Addr, error) {
  26. return 0, nil, syscall.EPLAN9
  27. }
  28. // ReadMsgIP reads a packet from c, copying the payload into b and the
  29. // associated out-of-band data into oob. It returns the number of
  30. // bytes copied into b, the number of bytes copied into oob, the flags
  31. // that were set on the packet and the source address of the packet.
  32. func (c *IPConn) ReadMsgIP(b, oob []byte) (n, oobn, flags int, addr *IPAddr, err error) {
  33. return 0, 0, 0, nil, syscall.EPLAN9
  34. }
  35. // WriteToIP writes an IP packet to addr via c, copying the payload
  36. // from b.
  37. //
  38. // WriteToIP can be made to time out and return an error with
  39. // Timeout() == true after a fixed time limit; see SetDeadline and
  40. // SetWriteDeadline. On packet-oriented connections, write timeouts
  41. // are rare.
  42. func (c *IPConn) WriteToIP(b []byte, addr *IPAddr) (int, error) {
  43. return 0, syscall.EPLAN9
  44. }
  45. // WriteTo implements the PacketConn WriteTo method.
  46. func (c *IPConn) WriteTo(b []byte, addr Addr) (int, error) {
  47. return 0, syscall.EPLAN9
  48. }
  49. // WriteMsgIP writes a packet to addr via c, copying the payload from
  50. // b and the associated out-of-band data from oob. It returns the
  51. // number of payload and out-of-band bytes written.
  52. func (c *IPConn) WriteMsgIP(b, oob []byte, addr *IPAddr) (n, oobn int, err error) {
  53. return 0, 0, syscall.EPLAN9
  54. }
  55. // DialIP connects to the remote address raddr on the network protocol
  56. // netProto, which must be "ip", "ip4", or "ip6" followed by a colon
  57. // and a protocol number or name.
  58. func DialIP(netProto string, laddr, raddr *IPAddr) (*IPConn, error) {
  59. return dialIP(netProto, laddr, raddr, noDeadline)
  60. }
  61. func dialIP(netProto string, laddr, raddr *IPAddr, deadline time.Time) (*IPConn, error) {
  62. return nil, syscall.EPLAN9
  63. }
  64. // ListenIP listens for incoming IP packets addressed to the local
  65. // address laddr. The returned connection's ReadFrom and WriteTo
  66. // methods can be used to receive and send IP packets with per-packet
  67. // addressing.
  68. func ListenIP(netProto string, laddr *IPAddr) (*IPConn, error) {
  69. return nil, syscall.EPLAN9
  70. }