diff options
author | Gyuhwan Park <unstabler@unstabler.pl> | 2022-05-23 14:14:28 +0300 |
---|---|---|
committer | Gyuhwan Park <unstabler@unstabler.pl> | 2022-05-23 14:14:28 +0300 |
commit | cc869b8d5898bcf0772b31392bf6aa4a80f899de (patch) | |
tree | 5678e13100bb3cdcd843ec3625cf7bba6a360dd5 | |
parent | 721fced542fd4b839245811c2bca48b76708454d (diff) |
xxx: copy messages header from ulalacacore
-rw-r--r-- | messages/_global.h | 6 | ||||
-rw-r--r-- | messages/broker.h | 45 | ||||
-rw-r--r-- | messages/projector.h | 113 |
3 files changed, 164 insertions, 0 deletions
diff --git a/messages/_global.h b/messages/_global.h new file mode 100644 index 0000000..4da55e0 --- /dev/null +++ b/messages/_global.h @@ -0,0 +1,6 @@ +#ifndef ULALACA_CORE_IPC_MESSAGES_GLOBAL_H +#define ULALACA_CORE_IPC_MESSAGES_GLOBAL_H + +#define FIXME_MARK_AS_PACKED_STRUCT __attribute__ ((packed)) + +#endif
\ No newline at end of file diff --git a/messages/broker.h b/messages/broker.h new file mode 100644 index 0000000..b84c29c --- /dev/null +++ b/messages/broker.h @@ -0,0 +1,45 @@ +#ifndef ULALACA_CORE_IPC_MESSAGES_BROKER_H +#define ULALACA_CORE_IPC_MESSAGES_BROKER_H + +#include <stdint.h> + +#include "_global.h" + +static const uint16_t RESPONSE_SESSION_READY = 0xA100; +static const uint16_t RESPONSE_REJECTION = 0xA101; +static const uint16_t REQUEST_SESSION = 0xA011; + +struct BrokerMessageHeader { + uint32_t version; + + uint16_t messageType; + uint64_t timestamp; + + uint64_t length; +} FIXME_MARK_AS_PACKED_STRUCT; + +static const uint8_t REJECT_REASON_INTERNAL_ERROR = 0; +static const uint8_t REJECT_REASON_AUTHENTICATION_FAILED = 1; +static const uint8_t REJECT_REASON_SESSION_NOT_AVAILABLE = 2; +static const uint8_t REJECT_REASON_INCOMPATIBLE_VERSION = 3; + +/** + * incoming message + */ +struct SessionReady { + uint64_t sessionId; + uint8_t isLoginSession; + + char path[1024]; +} FIXME_MARK_AS_PACKED_STRUCT; + +struct RequestRejection { + uint8_t reason; +} FIXME_MARK_AS_PACKED_STRUCT; + +struct RequestSession { + char username[64]; + char password[256]; +} FIXME_MARK_AS_PACKED_STRUCT; + +#endif
\ No newline at end of file diff --git a/messages/projector.h b/messages/projector.h new file mode 100644 index 0000000..6d7134c --- /dev/null +++ b/messages/projector.h @@ -0,0 +1,113 @@ +#ifndef ULALACA_CORE_IPC_MESSAGES_PROJECTOR_H +#define ULALACA_CORE_IPC_MESSAGES_PROJECTOR_H + +#include <stdint.h> + +#include "_global.h" + +struct Rect { + short x; + short y; + short width; + short height; +} __attribute__ ((packed)); + +static const uint16_t IN_SCREEN_UPDATE_EVENT = 0x0101; +static const uint16_t IN_SCREEN_COMMIT_UPDATE = 0x0102; + +static const uint16_t OUT_SCREEN_UPDATE_REQUEST = 0x0201; + +static const uint16_t OUT_KEYBOARD_EVENT = 0x0311; + +static const uint16_t OUT_MOUSE_MOVE_EVENT = 0x0321; +static const uint16_t OUT_MOUSE_BUTTON_EVENT = 0x0322; +static const uint16_t OUT_MOUSE_WHEEL_EVENT = 0x0323; + +struct ProjectorMessageHeader { + uint16_t messageType; + + uint64_t id; + uint64_t replyTo; + + uint64_t timestamp; + + uint64_t length; +} FIXME_MARK_AS_PACKED_STRUCT; + +/** + * incoming message + */ +struct ScreenUpdateEvent { + uint8_t type; + + struct Rect rect; +} FIXME_MARK_AS_PACKED_STRUCT; + +struct ScreenCommitUpdate { + struct Rect screenRect; + uint64_t bitmapLength; +} FIXME_MARK_AS_PACKED_STRUCT; + +static const uint8_t UPDATE_REQUEST_TYPE_ENTIRE_SCREEN = 0; +static const uint8_t UPDATE_REQUEST_TYPE_PARTIAL = 1; + +struct ScreenUpdateRequest { + uint8_t type; + + struct Rect rect; +}; + + +static const uint16_t FLAG_IGNORE_TIMESTAMP_QUEUE = 0b00000001; +static const uint16_t FLAG_EMIT_EVENT_USING_KARABINER = 0b00010000; + +static const uint8_t KEY_EVENT_TYPE_NOOP = 0; +static const uint8_t KEY_EVENT_TYPE_KEYUP = 1; +static const uint8_t KEY_EVENT_TYPE_KEYDOWN = 2; + +/** + * force release pressed keys + */ +static const uint8_t KEY_EVENT_TYPE_RESET = 4; + +struct KeyboardEvent { + uint8_t type; + uint32_t keyCode; + + uint16_t flags; +} FIXME_MARK_AS_PACKED_STRUCT; + + + +struct MouseMoveEvent { + uint16_t x; + uint16_t y; + + uint16_t flags; +} FIXME_MARK_AS_PACKED_STRUCT; + + +static const uint8_t MOUSE_EVENT_TYPE_NOOP = 0; +static const uint8_t MOUSE_EVENT_TYPE_MOUSEUP = 1; +static const uint8_t MOUSE_EVENT_TYPE_MOUSEDOWN = 2; + +static const uint8_t MOUSE_EVENT_BUTTON_LEFT = 0; +static const uint8_t MOUSE_EVENT_BUTTON_RIGHT = 1; +static const uint8_t MOUSE_EVENT_BUTTON_MIDDLE = 2; + +struct MouseButtonEvent { + uint8_t type; + uint8_t button; + + uint16_t flags; +} FIXME_MARK_AS_PACKED_STRUCT; + +struct MouseWheelEvent { + int32_t deltaX; + int32_t deltaY; + + uint16_t flags; +} FIXME_MARK_AS_PACKED_STRUCT; + + +#endif
\ No newline at end of file |