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")]
31unsafe impl NSObjectProtocol for VZFileHandleNetworkDeviceAttachment {}
32
33#[cfg(feature = "VZNetworkDeviceAttachment")]
34impl VZFileHandleNetworkDeviceAttachment {
35    extern_methods!(
36        /// Initialize the attachment with a file handle.
37        ///
38        /// Parameter `fileHandle`: File handle holding a connected datagram socket.
39        #[unsafe(method(initWithFileHandle:))]
40        #[unsafe(method_family = init)]
41        pub unsafe fn initWithFileHandle(
42            this: Allocated<Self>,
43            file_handle: &NSFileHandle,
44        ) -> Retained<Self>;
45
46        /// The file handle associated with this attachment.
47        #[unsafe(method(fileHandle))]
48        #[unsafe(method_family = none)]
49        pub unsafe fn fileHandle(&self) -> Retained<NSFileHandle>;
50
51        /// The maximum transmission unit (MTU) associated with this attachment.
52        ///
53        /// The client side of the associated datagram socket must be properly configured with the appropriate values for
54        /// `SO_SNDBUF`, and `SO_RCVBUF`, which can be set using the `setsockopt` system call. The value of `SO_RCVBUF` is
55        /// expected to be at least double the value of `SO_SNDBUF`, and for optimal performance, the value of `SO_RCVBUF`
56        /// is recommended to be four times the value of `SO_SNDBUF`.
57        ///
58        /// The default MTU is 1500.
59        /// The maximum MTU allowed is 65535, and the minimum MTU allowed is 1500. An invalid MTU value will result in an invalid
60        /// virtual machine configuration.
61        #[unsafe(method(maximumTransmissionUnit))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn maximumTransmissionUnit(&self) -> NSInteger;
64
65        /// Setter for [`maximumTransmissionUnit`][Self::maximumTransmissionUnit].
66        #[unsafe(method(setMaximumTransmissionUnit:))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn setMaximumTransmissionUnit(&self, maximum_transmission_unit: NSInteger);
69    );
70}
71
72/// Methods declared on superclass `VZNetworkDeviceAttachment`.
73#[cfg(feature = "VZNetworkDeviceAttachment")]
74impl VZFileHandleNetworkDeviceAttachment {
75    extern_methods!(
76        #[unsafe(method(new))]
77        #[unsafe(method_family = new)]
78        pub unsafe fn new() -> Retained<Self>;
79
80        #[unsafe(method(init))]
81        #[unsafe(method_family = init)]
82        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
83    );
84}