4 * Copyright(c) 2022 Vladislav Yaroshchuk <vladislav.yaroshchuk@jetbrains.com>
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
13 #include "vmnet_int.h"
16 #include <vmnet/vmnet.h>
17 #include <dispatch/dispatch.h>
20 * From vmnet.framework documentation
22 * Each read/write call allows up to 200 packets to be
23 * read or written for a maximum of 256KB.
25 * Each packet written should be a complete
28 * https://developer.apple.com/documentation/vmnet
30 #define VMNET_PACKETS_LIMIT 200
32 typedef struct VmnetState
{
34 interface_ref vmnet_if
;
37 uint64_t max_packet_size
;
39 dispatch_queue_t if_queue
;
43 struct vmpktdesc packets_buf
[VMNET_PACKETS_LIMIT
];
44 int packets_send_current_pos
;
45 int packets_send_end_pos
;
47 struct iovec iov_buf
[VMNET_PACKETS_LIMIT
];
50 const char *vmnet_status_map_str(vmnet_return_t status
);
52 int vmnet_if_create(NetClientState
*nc
,
56 ssize_t
vmnet_receive_common(NetClientState
*nc
,
60 void vmnet_cleanup_common(NetClientState
*nc
);
62 #endif /* VMNET_INT_H */