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
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// Virtio Socket Device
///
/// This is a paravirtualized socket device which facilitates data transfer between the guest and the host without using Ethernet or IP protocols.
/// This device is created through instantiating a VZVirtioSocketDeviceConfiguration in a VZVirtualMachineConfiguration and is available in the VZVirtualMachine.socketDevices property.
///
/// See: VZVirtioSocketDeviceConfiguration
///
/// See: VZVirtioSocketDeviceConnection
///
/// See: VZVirtioSocketDeviceListener
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzvirtiosocketdevice?language=objc)
#[unsafe(super(VZSocketDevice, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "VZSocketDevice")]
pub struct VZVirtioSocketDevice;
);
#[cfg(feature = "VZSocketDevice")]
extern_conformance!(
unsafe impl NSObjectProtocol for VZVirtioSocketDevice {}
);
#[cfg(feature = "VZSocketDevice")]
impl VZVirtioSocketDevice {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "VZVirtioSocketListener")]
/// Sets a listener at a specified port.
///
/// There is only one listener per port, any existing listener will be removed, and the specified listener here will be set instead.
/// The same listener can be registered on multiple ports.
/// The listener's delegate will be called whenever the guest connects to that port.
///
/// Parameter `listener`: The VZVirtioSocketListener object to be set.
///
/// Parameter `port`: The port number to set the listener at.
#[unsafe(method(setSocketListener:forPort:))]
#[unsafe(method_family = none)]
pub unsafe fn setSocketListener_forPort(
&self,
listener: &VZVirtioSocketListener,
port: u32,
);
/// Removes the listener at a specified port.
///
/// Does nothing if the port had no listener.
///
/// Parameter `port`: The port number at which the listener is to be removed.
#[unsafe(method(removeSocketListenerForPort:))]
#[unsafe(method_family = none)]
pub unsafe fn removeSocketListenerForPort(&self, port: u32);
#[cfg(all(feature = "VZVirtioSocketConnection", feature = "block2"))]
/// Connects to a specified port.
///
/// Does nothing if the guest does not listen on that port.
///
/// Parameter `port`: The port number to connect to.
///
/// Parameter `completionHandler`: Block called after the connection has been successfully established or on error.
/// The error parameter passed to the block is nil if the connection was successful.
#[unsafe(method(connectToPort:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn connectToPort_completionHandler(
&self,
port: u32,
completion_handler: &block2::DynBlock<
dyn Fn(*mut VZVirtioSocketConnection, *mut NSError),
>,
);
);
}