| #ifndef _MCIPM_PACKET_H |
| #define _MCIPM_PACKET_H |
| |
| #include <stdint.h> |
| |
| #define MCIPM_GET_VERSION 1 |
| #define MCIPM_GET_ENTITIES 2 |
| #define MCIPM_REPLY_VERSION 128 |
| |
| #define MCIPM_GET_ENTITIES_SELECTOR_ALL 0 |
| #define MCIPM_GET_ENTITIES_SELECTOR_WORLD 1 |
| #define MCIPM_GET_ENTITIES_SELECTOR_ENTITY_ID 2 |
| #define MCIPM_GET_ENTITIES_SELECTOR_ENTITY_TYPE 3 |
| |
| #define MCIPM_PACKET_MAX_LENGTH (16 * 1024 * 1024) |
| |
| #define GET_PACKET_EOF -1 |
| #define GET_PACKET_ERROR -2 |
| #define GET_PACKET_SHORT_READ -3 |
| #define GET_PACKET_TOO_SMALL -4 |
| #define GET_PACKET_TOO_LARGE -5 |
| #define GET_PACKET_OUT_OF_MEMORY -6 |
| #define GET_PACKET_INCOMPLETE -7 |
| |
| struct mcipm_packet { |
| uint32_t length; |
| uint8_t type; |
| uint8_t data[0]; |
| }; |
| |
| int send_packet_get_version(int); |
| int receive_packet(int, struct mcipm_packet **, int); |
| |
| #endif |