|
| 1 | +// |
| 2 | +// virtualization_11.m |
| 3 | +// |
| 4 | +// Created by codehex. |
| 5 | +// |
| 6 | + |
| 7 | +#import "virtualization_26.h" |
| 8 | + |
| 9 | +// VZVmnetNetworkConfiguration |
| 10 | +void *newVZVmnetNetworkConfiguration(uint32_t mode, uint32_t *status) |
| 11 | +{ |
| 12 | +#ifdef INCLUDE_TARGET_OSX_26 |
| 13 | + if (@available(macOS 26, *)) { |
| 14 | + return vmnet_network_configuration_create(mode, status); |
| 15 | + } |
| 16 | +#endif |
| 17 | + RAISE_UNSUPPORTED_MACOS_EXCEPTION(); |
| 18 | +} |
| 19 | + |
| 20 | +uint32_t VZVmnetNetworkConfiguration_setExternalInterface(void *config, const char *ifname) |
| 21 | +{ |
| 22 | +#ifdef INCLUDE_TARGET_OSX_26 |
| 23 | + if (@available(macOS 26, *)) { |
| 24 | + return vmnet_network_configuration_set_external_interface((vmnet_network_configuration_ref)config, ifname); |
| 25 | + } |
| 26 | +#endif |
| 27 | + RAISE_UNSUPPORTED_MACOS_EXCEPTION(); |
| 28 | +} |
| 29 | + |
| 30 | +void VZVmnetNetworkConfiguration_disableNat44(void *config) |
| 31 | +{ |
| 32 | +#ifdef INCLUDE_TARGET_OSX_26 |
| 33 | + if (@available(macOS 26, *)) { |
| 34 | + vmnet_network_configuration_disable_nat44((vmnet_network_configuration_ref)config); |
| 35 | + return; |
| 36 | + } |
| 37 | +#endif |
| 38 | + RAISE_UNSUPPORTED_MACOS_EXCEPTION(); |
| 39 | +} |
| 40 | + |
| 41 | +void VZVmnetNetworkConfiguration_disableNat66(void *config) |
| 42 | +{ |
| 43 | +#ifdef INCLUDE_TARGET_OSX_26 |
| 44 | + if (@available(macOS 26, *)) { |
| 45 | + vmnet_network_configuration_disable_nat66((vmnet_network_configuration_ref)config); |
| 46 | + return; |
| 47 | + } |
| 48 | +#endif |
| 49 | + RAISE_UNSUPPORTED_MACOS_EXCEPTION(); |
| 50 | +} |
| 51 | + |
| 52 | +void VZVmnetNetworkConfiguration_disableDhcp(void *config) |
| 53 | +{ |
| 54 | +#ifdef INCLUDE_TARGET_OSX_26 |
| 55 | + if (@available(macOS 26, *)) { |
| 56 | + vmnet_network_configuration_disable_dhcp((vmnet_network_configuration_ref)config); |
| 57 | + return; |
| 58 | + } |
| 59 | +#endif |
| 60 | + RAISE_UNSUPPORTED_MACOS_EXCEPTION(); |
| 61 | +} |
| 62 | + |
| 63 | +void VZVmnetNetworkConfiguration_disableDnsProxy(void *config) |
| 64 | +{ |
| 65 | +#ifdef INCLUDE_TARGET_OSX_26 |
| 66 | + if (@available(macOS 26, *)) { |
| 67 | + vmnet_network_configuration_disable_dns_proxy((vmnet_network_configuration_ref)config); |
| 68 | + return; |
| 69 | + } |
| 70 | +#endif |
| 71 | + RAISE_UNSUPPORTED_MACOS_EXCEPTION(); |
| 72 | +} |
| 73 | + |
| 74 | +void VZVmnetNetworkConfiguration_disableRouterAdvertisement(void *config) |
| 75 | +{ |
| 76 | +#ifdef INCLUDE_TARGET_OSX_26 |
| 77 | + if (@available(macOS 26, *)) { |
| 78 | + vmnet_network_configuration_disable_router_advertisement((vmnet_network_configuration_ref)config); |
| 79 | + return; |
| 80 | + } |
| 81 | +#endif |
| 82 | + RAISE_UNSUPPORTED_MACOS_EXCEPTION(); |
| 83 | +} |
| 84 | + |
| 85 | +uint32_t VZVmnetNetworkConfiguration_setIPv4Subnet(void *config, struct in_addr const *subnet_addr, struct in_addr const *subnet_mask) |
| 86 | +{ |
| 87 | +#ifdef INCLUDE_TARGET_OSX_26 |
| 88 | + if (@available(macOS 26, *)) { |
| 89 | + return vmnet_network_configuration_set_ipv4_subnet((vmnet_network_configuration_ref)config, subnet_addr, subnet_mask); |
| 90 | + } |
| 91 | +#endif |
| 92 | + RAISE_UNSUPPORTED_MACOS_EXCEPTION(); |
| 93 | +} |
| 94 | + |
| 95 | +uint32_t VZVmnetNetworkConfiguration_setIPv6Prefix(void *config, struct in6_addr const *prefix, uint8_t prefix_len) |
| 96 | +{ |
| 97 | +#ifdef INCLUDE_TARGET_OSX_26 |
| 98 | + if (@available(macOS 26, *)) { |
| 99 | + return vmnet_network_configuration_set_ipv6_prefix((vmnet_network_configuration_ref)config, prefix, prefix_len); |
| 100 | + } |
| 101 | +#endif |
| 102 | + RAISE_UNSUPPORTED_MACOS_EXCEPTION(); |
| 103 | +} |
| 104 | + |
| 105 | +uint32_t VZVmnetNetworkConfiguration_addPortForwardingRule(void *config, uint8_t protocol, sa_family_t address_family, uint16_t internal_port, uint16_t external_port, void const *internal_address) |
| 106 | +{ |
| 107 | +#ifdef INCLUDE_TARGET_OSX_26 |
| 108 | + if (@available(macOS 26, *)) { |
| 109 | + return vmnet_network_configuration_add_port_forwarding_rule((vmnet_network_configuration_ref)config, protocol, address_family, internal_port, external_port, internal_address); |
| 110 | + } |
| 111 | +#endif |
| 112 | + RAISE_UNSUPPORTED_MACOS_EXCEPTION(); |
| 113 | +} |
| 114 | + |
| 115 | +uint32_t VZVmnetNetworkConfiguration_addDhcpReservation(void *config, ether_addr_t const *client, struct in_addr const *reservation) |
| 116 | +{ |
| 117 | +#ifdef INCLUDE_TARGET_OSX_26 |
| 118 | + if (@available(macOS 26, *)) { |
| 119 | + return vmnet_network_configuration_add_dhcp_reservation((vmnet_network_configuration_ref)config, client, reservation); |
| 120 | + } |
| 121 | +#endif |
| 122 | + RAISE_UNSUPPORTED_MACOS_EXCEPTION(); |
| 123 | +} |
| 124 | + |
| 125 | +uint32_t VZVmnetNetworkConfiguration_setMtu(void *config, uint32_t mtu) |
| 126 | +{ |
| 127 | +#ifdef INCLUDE_TARGET_OSX_26 |
| 128 | + if (@available(macOS 26, *)) { |
| 129 | + return vmnet_network_configuration_set_mtu((vmnet_network_configuration_ref)config, mtu); |
| 130 | + } |
| 131 | +#endif |
| 132 | + RAISE_UNSUPPORTED_MACOS_EXCEPTION(); |
| 133 | +} |
| 134 | + |
| 135 | +// vmnet_network |
| 136 | +void *newVZVmnetNetwork(void *config, uint32_t *status) |
| 137 | +{ |
| 138 | +#ifdef INCLUDE_TARGET_OSX_26 |
| 139 | + if (@available(macOS 26, *)) { |
| 140 | + return vmnet_network_create((vmnet_network_configuration_ref)config, status); |
| 141 | + } |
| 142 | +#endif |
| 143 | + RAISE_UNSUPPORTED_MACOS_EXCEPTION(); |
| 144 | +} |
| 145 | + |
| 146 | +// VZVmnetNetworkDeviceAttachment |
| 147 | +void *newVZVmnetNetworkDeviceAttachment(void *network) |
| 148 | +{ |
| 149 | +#ifdef INCLUDE_TARGET_OSX_26 |
| 150 | + if (@available(macOS 26, *)) { |
| 151 | + return [[VZVmnetNetworkDeviceAttachment alloc] initWithNetwork:network]; |
| 152 | + } |
| 153 | +#endif |
| 154 | + RAISE_UNSUPPORTED_MACOS_EXCEPTION(); |
| 155 | +} |
| 156 | + |
| 157 | +void *VZVmnetNetworkDeviceAttachment_network(void *attachment) |
| 158 | +{ |
| 159 | +#ifdef INCLUDE_TARGET_OSX_26 |
| 160 | + if (@available(macOS 26, *)) { |
| 161 | + return [(VZVmnetNetworkDeviceAttachment *)attachment network]; |
| 162 | + } |
| 163 | +#endif |
| 164 | + RAISE_UNSUPPORTED_MACOS_EXCEPTION(); |
| 165 | +} |
| 166 | + |
| 167 | +// vmnet_network get subnet |
| 168 | +void VZVmnetNetwork_getIPv6Prefix(void *network, struct in6_addr *prefix, uint8_t *prefix_len) |
| 169 | +{ |
| 170 | +#ifdef INCLUDE_TARGET_OSX_26 |
| 171 | + if (@available(macOS 26, *)) { |
| 172 | + vmnet_network_get_ipv6_prefix((vmnet_network_ref)network, prefix, prefix_len); |
| 173 | + return; |
| 174 | + } |
| 175 | +#endif |
| 176 | + RAISE_UNSUPPORTED_MACOS_EXCEPTION(); |
| 177 | +} |
| 178 | +void VZVmnetNetwork_getIPv4Subnet(void *network, struct in_addr *subnet, struct in_addr *mask) |
| 179 | +{ |
| 180 | +#ifdef INCLUDE_TARGET_OSX_26 |
| 181 | + if (@available(macOS 26, *)) { |
| 182 | + vmnet_network_get_ipv4_subnet((vmnet_network_ref)network, subnet, mask); |
| 183 | + return; |
| 184 | + } |
| 185 | +#endif |
| 186 | + RAISE_UNSUPPORTED_MACOS_EXCEPTION(); |
| 187 | +} |
0 commit comments