/src/swift-nio/Sources/NIOPosix/VsockChannelEvents.swift
Line | Count | Source |
1 | | //===----------------------------------------------------------------------===// |
2 | | // |
3 | | // This source file is part of the SwiftNIO open source project |
4 | | // |
5 | | // Copyright (c) 2023 Apple Inc. and the SwiftNIO project authors |
6 | | // Licensed under Apache License v2.0 |
7 | | // |
8 | | // See LICENSE.txt for license information |
9 | | // See CONTRIBUTORS.txt for the list of SwiftNIO project authors |
10 | | // |
11 | | // SPDX-License-Identifier: Apache-2.0 |
12 | | // |
13 | | //===----------------------------------------------------------------------===// |
14 | | |
15 | | #if !os(WASI) |
16 | | |
17 | | import NIOCore |
18 | | |
19 | | public enum VsockChannelEvents: Sendable { |
20 | | /// Fired as an outbound event when NIO would like to ask itself to bind the socket. |
21 | | /// |
22 | | /// This flow for connect is required because we cannot extend `enum SocketAddress` without |
23 | | /// breaking public API. |
24 | | public struct BindToAddress: Hashable, Sendable { |
25 | | public var address: VsockAddress |
26 | | |
27 | 0 | public init(_ address: VsockAddress) { |
28 | 0 | self.address = address |
29 | 0 | } |
30 | | } |
31 | | |
32 | | /// Fired as an outbound event when NIO would like to ask itself to connect the socket. |
33 | | /// |
34 | | /// This flow for connect is required because we cannot extend `enum SocketAddress` without |
35 | | /// breaking public API. |
36 | | public struct ConnectToAddress: Hashable, Sendable { |
37 | | public var address: VsockAddress |
38 | | |
39 | 0 | public init(_ address: VsockAddress) { |
40 | 0 | self.address = address |
41 | 0 | } |
42 | | } |
43 | | } |
44 | | #endif // !os(WASI) |