diff options
author | Finn Behrens <me@kloenk.de> | 2021-02-19 11:13:53 +0100 |
---|---|---|
committer | Finn Behrens <me@kloenk.de> | 2021-02-19 11:13:53 +0100 |
commit | 92b180374eee440aec9537bdd4380f14edbfa28d (patch) | |
tree | da378ca5bee95abebba1f9b0f0af64edc614fa80 /protocol.h | |
parent | 1fb5e6e7514a54abbfbde689a74d325ad4382f5e (diff) | |
download | mcc-92b180374eee440aec9537bdd4380f14edbfa28d.tar.gz mcc-92b180374eee440aec9537bdd4380f14edbfa28d.tar.xz mcc-92b180374eee440aec9537bdd4380f14edbfa28d.zip |
move ev to socket.c
Diffstat (limited to 'protocol.h')
-rw-r--r-- | protocol.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/protocol.h b/protocol.h new file mode 100644 index 0000000..a002bf8 --- /dev/null +++ b/protocol.h @@ -0,0 +1,35 @@ +// +// protocol.h +// mcc@exe +// +// Created by Finn Behrens on 19.02.21. +// + +#ifndef protocol_h +#define protocol_h + +#include <sys/types.h> +#include <stdio.h> +#include <errno.h> +#include <byteswap.h> + + +#if __BYTE_ORDER == __BIG_ENDIAN +#define BE32_TO_H(x) (x) +#else +#define BE32_TO_H(x) bswap_32(x) +#endif + +#if __BYTE_ORDER == __BIG_ENDIAN +#define H_TO_BE32(x) (x) +#else +#define H_TO_BE32(x) bswap_32(x) +#endif + +int read_var_int(int *dest, uint8_t *src); +int read_var_long(long *dest, uint8_t *src); + +int write_var_int(int value, uint8_t *dest); +int write_var_long(long value, uint8_t *dest); + +#endif /* protocol_h */ |