| * Copyright(c) 2022 Vladislav Yaroshchuk <vladislav.yaroshchuk@jetbrains.com> |
| * This work is licensed under the terms of the GNU GPL, version 2 or later. |
| * See the COPYING file in the top-level directory. |
| #include <dispatch/dispatch.h> |
| * From vmnet.framework documentation |
| * Each read/write call allows up to 200 packets to be |
| * read or written for a maximum of 256KB. |
| * Each packet written should be a complete |
| * https://developer.apple.com/documentation/vmnet |
| #define VMNET_PACKETS_LIMIT 200 |
| typedef struct VmnetState { |
| uint64_t max_packet_size; |
| dispatch_queue_t if_queue; |
| struct vmpktdesc packets_buf[VMNET_PACKETS_LIMIT]; |
| int packets_send_current_pos; |
| int packets_send_end_pos; |
| struct iovec iov_buf[VMNET_PACKETS_LIMIT]; |
| const char *vmnet_status_map_str(vmnet_return_t status); |
| int vmnet_if_create(NetClientState *nc, |
| ssize_t vmnet_receive_common(NetClientState *nc, |
| void vmnet_cleanup_common(NetClientState *nc); |