libgo: update to Go 1.11
[official-gcc.git] / libgo / go / syscall / net_js.go
blobd5bf1f4f99332a50943c01cf06386e10d7e14e18
1 // Copyright 2018 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.
5 // js/wasm uses fake networking directly implemented in the net package.
6 // This file only exists to make the compiler happy.
8 // +build js,wasm
10 package syscall
12 const (
13 AF_UNSPEC = iota
14 AF_UNIX
15 AF_INET
16 AF_INET6
19 const (
20 SOCK_STREAM = 1 + iota
21 SOCK_DGRAM
22 SOCK_RAW
23 SOCK_SEQPACKET
26 const (
27 IPPROTO_IP = 0
28 IPPROTO_IPV4 = 4
29 IPPROTO_IPV6 = 0x29
30 IPPROTO_TCP = 6
31 IPPROTO_UDP = 0x11
34 const (
35 _ = iota
36 IPV6_V6ONLY
37 SOMAXCONN
38 SO_ERROR
41 // Misc constants expected by package net but not supported.
42 const (
43 _ = iota
44 F_DUPFD_CLOEXEC
45 SYS_FCNTL = 500 // unsupported; same value as net_nacl.go
48 type Sockaddr interface {
51 type SockaddrInet4 struct {
52 Port int
53 Addr [4]byte
56 type SockaddrInet6 struct {
57 Port int
58 ZoneId uint32
59 Addr [16]byte
62 type SockaddrUnix struct {
63 Name string
66 func Socket(proto, sotype, unused int) (fd int, err error) {
67 return 0, ENOSYS
70 func Bind(fd int, sa Sockaddr) error {
71 return ENOSYS
74 func StopIO(fd int) error {
75 return ENOSYS
78 func Listen(fd int, backlog int) error {
79 return ENOSYS
82 func Accept(fd int) (newfd int, sa Sockaddr, err error) {
83 return 0, nil, ENOSYS
86 func Connect(fd int, sa Sockaddr) error {
87 return ENOSYS
90 func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) {
91 return 0, nil, ENOSYS
94 func Sendto(fd int, p []byte, flags int, to Sockaddr) error {
95 return ENOSYS
98 func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn, recvflags int, from Sockaddr, err error) {
99 return 0, 0, 0, nil, ENOSYS
102 func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) {
103 return 0, ENOSYS
106 func GetsockoptInt(fd, level, opt int) (value int, err error) {
107 return 0, ENOSYS
110 func SetsockoptInt(fd, level, opt int, value int) error {
111 return nil
114 func SetReadDeadline(fd int, t int64) error {
115 return ENOSYS
118 func SetWriteDeadline(fd int, t int64) error {
119 return ENOSYS
122 func Shutdown(fd int, how int) error {
123 return ENOSYS
126 func SetNonblock(fd int, nonblocking bool) error {
127 return nil