objc2_virtualization/generated/
VZFileHandleNetworkDeviceAttachment.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// Network device attachment sending raw network packets over a file handle.
12    ///
13    /// The file handle attachment transmits the raw packets/frames between the virtual network interface and a file handle.
14    /// The data transmitted through this attachment is at the level of the data link layer.
15    ///
16    /// The file handle must hold a connected datagram socket.
17    ///
18    ///
19    /// See: VZNetworkDeviceConfiguration
20    ///
21    /// See: VZVirtioNetworkDeviceConfiguration
22    ///
23    /// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzfilehandlenetworkdeviceattachment?language=objc)
24    #[unsafe(super(VZNetworkDeviceAttachment, NSObject))]
25    #[derive(Debug, PartialEq, Eq, Hash)]
26    #[cfg(feature = "VZNetworkDeviceAttachment")]
27    pub struct VZFileHandleNetworkDeviceAttachment;
28);
29
30#[cfg(feature = "VZNetworkDeviceAttachment")]
31extern_conformance!(
32    unsafe impl NSObjectProtocol for VZFileHandleNetworkDeviceAttachment {}
33);
34
35#[cfg(feature = "VZNetworkDeviceAttachment")]
36impl VZFileHandleNetworkDeviceAttachment {
37    extern_methods!(
38        /// Initialize the attachment with a file handle.
39        ///
40        /// Parameter `fileHandle`: File handle holding a connected datagram socket.
41        #[unsafe(method(initWithFileHandle:))]
42        #[unsafe(method_family = init)]
43        pub unsafe fn initWithFileHandle(
44            this: Allocated<Self>,
45            file_handle: &NSFileHandle,
46        ) -> Retained<Self>;
47
48        /// The file handle associated with this attachment.
49        #[unsafe(method(fileHandle))]
50        #[unsafe(method_family = none)]
51        pub unsafe fn fileHandle(&self) -> Retained<NSFileHandle>;
52
53        /// The maximum transmission unit (MTU) associated with this attachment.
54        ///
55        /// The client side of the associated datagram socket must be properly configured with the appropriate values for
56        /// `SO_SNDBUF`, and `SO_RCVBUF`, which can be set using the `setsockopt` system call. The value of `SO_RCVBUF` is
57        /// expected to be at least double the value of `SO_SNDBUF`, and for optimal performance, the value of `SO_RCVBUF`
58        /// is recommended to be four times the value of `SO_SNDBUF`.
59        ///
60        /// The default MTU is 1500.
61        /// The maximum MTU allowed is 65535, and the minimum MTU allowed is 1500. An invalid MTU value will result in an invalid
62        /// virtual machine configuration.
63        #[unsafe(method(maximumTransmissionUnit))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn maximumTransmissionUnit(&self) -> NSInteger;
66
67        /// Setter for [`maximumTransmissionUnit`][Self::maximumTransmissionUnit].
68        #[unsafe(method(setMaximumTransmissionUnit:))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn setMaximumTransmissionUnit(&self, maximum_transmission_unit: NSInteger);
71    );
72}
73
74/// Methods declared on superclass `VZNetworkDeviceAttachment`.
75#[cfg(feature = "VZNetworkDeviceAttachment")]
76impl VZFileHandleNetworkDeviceAttachment {
77    extern_methods!(
78        #[unsafe(method(new))]
79        #[unsafe(method_family = new)]
80        pub unsafe fn new() -> Retained<Self>;
81
82        #[unsafe(method(init))]
83        #[unsafe(method_family = init)]
84        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
85    );
86}