4 个版本 (破坏性更新)
0.4.0 | 2022年10月7日 |
---|---|
0.3.0 | 2022年8月3日 |
0.2.0 | 2022年3月18日 |
0.1.0 | 2021年12月15日 |
#20 in #hypervisor
17KB
297 行
panda-channels
一个用于通过通道方式与宿主机通信的 Rust 库(带有 C 绑定)。主要用于与虚拟机插件 API 一起使用。
C API 文档
/**
* Initialize the channel library, should be run at the start of main() in your guest plu
*/
void hyperchannel_init(void);
/**
* Uninitialize the channel library, should be run at the end of main() in your guest plu
*/
void hyperchannel_uninit(void);
/**
* Read from a channel descriptor into a buffer
*
* Returns: the number of bytes read into the buffer.
*/
uintptr_t channel_read(uint32_t channel, uint8_t *out, uintptr_t out_len);
/**
* Write a buffer to a given channel descriptor
*/
void channel_write(uint32_t channel, const uint8_t *buf, uintptr_t buf_len);
/**
* Gets the main channel for a plugin of a given name
*
* Returns: the number of bytes read into the buffer, or -1 if the plugin wasn't found
*/
int32_t get_main_channel(const uint8_t *name, uintptr_t len);
/**
* Get a new channel not associated with any specific plugin
*
* Returns: the channel, or -1 if an error occurs
*/
int32_t get_new_channel(void);
依赖关系
~0.5–1.7MB
~22K SLoC