objc2_virtualization/generated/VZVirtioSocketConnection.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::*;
6
7use crate::*;
8
9extern_class!(
10 /// The VZVirtioSocketConnection object represents a Virtio socket device's connection.
11 ///
12 /// The connection encompasses a source port, destination port, and an associated file descriptor.
13 ///
14 /// See: VZVirtioSocketDevice
15 ///
16 /// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzvirtiosocketconnection?language=objc)
17 #[unsafe(super(NSObject))]
18 #[derive(Debug, PartialEq, Eq, Hash)]
19 pub struct VZVirtioSocketConnection;
20);
21
22extern_conformance!(
23 unsafe impl NSObjectProtocol for VZVirtioSocketConnection {}
24);
25
26impl VZVirtioSocketConnection {
27 extern_methods!(
28 #[unsafe(method(new))]
29 #[unsafe(method_family = new)]
30 pub unsafe fn new() -> Retained<Self>;
31
32 #[unsafe(method(init))]
33 #[unsafe(method_family = init)]
34 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
35
36 /// The destination port number of the connection.
37 #[unsafe(method(destinationPort))]
38 #[unsafe(method_family = none)]
39 pub unsafe fn destinationPort(&self) -> u32;
40
41 /// The source port number of the connection.
42 #[unsafe(method(sourcePort))]
43 #[unsafe(method_family = none)]
44 pub unsafe fn sourcePort(&self) -> u32;
45
46 /// The file descriptor associated with the socket.
47 ///
48 /// Data is sent by writing to the file descriptor.
49 /// Data is received by reading from the file descriptor.
50 /// A file descriptor of -1 indicates a closed connection.
51 ///
52 /// The file descriptor is owned by the VZVirtioSocketConnection. It is automatically closed when the object is destroyed.
53 #[unsafe(method(fileDescriptor))]
54 #[unsafe(method_family = none)]
55 pub unsafe fn fileDescriptor(&self) -> c_int;
56
57 /// Close the file descriptor that's associated with the socket.
58 #[unsafe(method(close))]
59 #[unsafe(method_family = none)]
60 pub unsafe fn close(&self);
61 );
62}