aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/internal/wasi/sockets/v0.2.0/udp/abi.go
blob: 23a96c983e0cfceec369bb9b46332dd377077394 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// Code generated by wit-bindgen-go. DO NOT EDIT.

package udp

import (
	"internal/cm"
	"internal/wasi/sockets/v0.2.0/network"
	"unsafe"
)

// IPSocketAddressShape is used for storage in variant or result types.
type IPSocketAddressShape struct {
	shape [unsafe.Sizeof(network.IPSocketAddress{})]byte
}

func lower_IPv4Address(v network.IPv4Address) (f0 uint32, f1 uint32, f2 uint32, f3 uint32) {
	f0 = (uint32)(v[0])
	f1 = (uint32)(v[1])
	f2 = (uint32)(v[2])
	f3 = (uint32)(v[3])
	return
}

func lower_IPv4SocketAddress(v network.IPv4SocketAddress) (f0 uint32, f1 uint32, f2 uint32, f3 uint32, f4 uint32) {
	f0 = (uint32)(v.Port)
	f1, f2, f3, f4 = lower_IPv4Address(v.Address)
	return
}

func lower_IPv6Address(v network.IPv6Address) (f0 uint32, f1 uint32, f2 uint32, f3 uint32, f4 uint32, f5 uint32, f6 uint32, f7 uint32) {
	f0 = (uint32)(v[0])
	f1 = (uint32)(v[1])
	f2 = (uint32)(v[2])
	f3 = (uint32)(v[3])
	f4 = (uint32)(v[4])
	f5 = (uint32)(v[5])
	f6 = (uint32)(v[6])
	f7 = (uint32)(v[7])
	return
}

func lower_IPv6SocketAddress(v network.IPv6SocketAddress) (f0 uint32, f1 uint32, f2 uint32, f3 uint32, f4 uint32, f5 uint32, f6 uint32, f7 uint32, f8 uint32, f9 uint32, f10 uint32) {
	f0 = (uint32)(v.Port)
	f1 = (uint32)(v.FlowInfo)
	f2, f3, f4, f5, f6, f7, f8, f9 = lower_IPv6Address(v.Address)
	f10 = (uint32)(v.ScopeID)
	return
}

func lower_IPSocketAddress(v network.IPSocketAddress) (f0 uint32, f1 uint32, f2 uint32, f3 uint32, f4 uint32, f5 uint32, f6 uint32, f7 uint32, f8 uint32, f9 uint32, f10 uint32, f11 uint32) {
	f0 = (uint32)(v.Tag())
	switch f0 {
	case 0: // ipv4
		v1, v2, v3, v4, v5 := lower_IPv4SocketAddress(*v.IPv4())
		f1 = (uint32)(v1)
		f2 = (uint32)(v2)
		f3 = (uint32)(v3)
		f4 = (uint32)(v4)
		f5 = (uint32)(v5)
	case 1: // ipv6
		v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11 := lower_IPv6SocketAddress(*v.IPv6())
		f1 = (uint32)(v1)
		f2 = (uint32)(v2)
		f3 = (uint32)(v3)
		f4 = (uint32)(v4)
		f5 = (uint32)(v5)
		f6 = (uint32)(v6)
		f7 = (uint32)(v7)
		f8 = (uint32)(v8)
		f9 = (uint32)(v9)
		f10 = (uint32)(v10)
		f11 = (uint32)(v11)
	}
	return
}

// TupleIncomingDatagramStreamOutgoingDatagramStreamShape is used for storage in variant or result types.
type TupleIncomingDatagramStreamOutgoingDatagramStreamShape struct {
	shape [unsafe.Sizeof(cm.Tuple[IncomingDatagramStream, OutgoingDatagramStream]{})]byte
}

func lower_OptionIPSocketAddress(v cm.Option[network.IPSocketAddress]) (f0 uint32, f1 uint32, f2 uint32, f3 uint32, f4 uint32, f5 uint32, f6 uint32, f7 uint32, f8 uint32, f9 uint32, f10 uint32, f11 uint32, f12 uint32) {
	some := v.Some()
	if some != nil {
		f0 = 1
		v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12 := lower_IPSocketAddress(*some)
		f1 = (uint32)(v1)
		f2 = (uint32)(v2)
		f3 = (uint32)(v3)
		f4 = (uint32)(v4)
		f5 = (uint32)(v5)
		f6 = (uint32)(v6)
		f7 = (uint32)(v7)
		f8 = (uint32)(v8)
		f9 = (uint32)(v9)
		f10 = (uint32)(v10)
		f11 = (uint32)(v11)
		f12 = (uint32)(v12)
	}
	return
}