/src/swift-nio/Sources/NIOPosix/VsockChannelEvents.swift
Line | Count | Source (jump to first uncovered line) |
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 | | import NIOCore |
15 | | |
16 | | public enum VsockChannelEvents: Sendable { |
17 | | /// Fired as an outbound event when NIO would like to ask itself to bind the socket. |
18 | | /// |
19 | | /// This flow for connect is required because we cannot extend `enum SocketAddress` without |
20 | | /// breaking public API. |
21 | | public struct BindToAddress: Hashable, Sendable { |
22 | | public var address: VsockAddress |
23 | | |
24 | 0 | public init(_ address: VsockAddress) { |
25 | 0 | self.address = address |
26 | 0 | } |
27 | | } |
28 | | |
29 | | /// Fired as an outbound event when NIO would like to ask itself to connect the socket. |
30 | | /// |
31 | | /// This flow for connect is required because we cannot extend `enum SocketAddress` without |
32 | | /// breaking public API. |
33 | | public struct ConnectToAddress: Hashable, Sendable { |
34 | | public var address: VsockAddress |
35 | | |
36 | 0 | public init(_ address: VsockAddress) { |
37 | 0 | self.address = address |
38 | 0 | } |
39 | | } |
40 | | } |