diff options
author | Gyuhwan Park <unstabler@unstabler.pl> | 2022-05-24 15:40:18 +0300 |
---|---|---|
committer | Gyuhwan Park <unstabler@unstabler.pl> | 2022-05-24 15:40:18 +0300 |
commit | bc794094dae8f22b58c303a90cae2cb90fd3bad5 (patch) | |
tree | 759fa55e625aa5e3e087db1d57cc4509c4d23909 | |
parent | b6ef5978972f342d072fee852bfc2c211f0171c6 (diff) |
checkpoint: update ipc messages definition from ulalacacore
-rw-r--r-- | messages/_global.h | 22 | ||||
-rw-r--r-- | messages/broker.h | 28 | ||||
-rw-r--r-- | messages/projector.h | 107 |
3 files changed, 79 insertions, 78 deletions
diff --git a/messages/_global.h b/messages/_global.h index 4da55e0..e12de21 100644 --- a/messages/_global.h +++ b/messages/_global.h @@ -1,6 +1,28 @@ #ifndef ULALACA_CORE_IPC_MESSAGES_GLOBAL_H #define ULALACA_CORE_IPC_MESSAGES_GLOBAL_H +/** + * FIXME: naming + */ #define FIXME_MARK_AS_PACKED_STRUCT __attribute__ ((packed)) +struct ULIPCRect { + short x; + short y; + short width; + short height; +} FIXME_MARK_AS_PACKED_STRUCT; + +struct ULIPCHeader { + uint16_t messageType; + + uint64_t id; + uint64_t replyTo; + + uint64_t timestamp; + + uint64_t length; +} FIXME_MARK_AS_PACKED_STRUCT; + + #endif
\ No newline at end of file diff --git a/messages/broker.h b/messages/broker.h index b84c29c..131278f 100644 --- a/messages/broker.h +++ b/messages/broker.h @@ -5,39 +5,35 @@ #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; +/* constants: message type (server -> client) */ +static const uint16_t TYPE_SESSION_REQUEST_RESOLVED = 0xA100; +static const uint16_t TYPE_SESSION_REQUEST_REJECTED = 0xA101; -struct BrokerMessageHeader { - uint32_t version; +/* constants: message type (client -> server) */ +static const uint16_t TYPE_SESSION_REQUEST = 0xA011; - uint16_t messageType; - uint64_t timestamp; - - uint64_t length; -} FIXME_MARK_AS_PACKED_STRUCT; +/* constants: reject reason */ 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 { + +/* message definition: server -> client */ +struct ULIPCSessionRequestResolved { uint64_t sessionId; uint8_t isLoginSession; char path[1024]; } FIXME_MARK_AS_PACKED_STRUCT; -struct RequestRejection { +struct ULIPCSessionRequestRejected { uint8_t reason; } FIXME_MARK_AS_PACKED_STRUCT; -struct RequestSession { +/* message definition: client -> server */ +struct ULIPCSessionRequest { char username[64]; char password[256]; } FIXME_MARK_AS_PACKED_STRUCT; diff --git a/messages/projector.h b/messages/projector.h index 6d7134c..bcd0e84 100644 --- a/messages/projector.h +++ b/messages/projector.h @@ -5,109 +5,92 @@ #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; +/* constants: message type (server -> client) */ +static const uint16_t TYPE_SCREEN_UPDATE_NOTIFY = 0x0101; +static const uint16_t TYPE_SCREEN_UPDATE_COMMIT = 0x0102; -static const uint16_t OUT_SCREEN_UPDATE_REQUEST = 0x0201; +/* constants: message type (client -> server) */ +static const uint16_t TYPE_EVENT_INVALIDATION = 0x0201; +static const uint16_t TYPE_EVENT_KEYBOARD = 0x0311; +static const uint16_t TYPE_EVENT_MOUSE_MOVE = 0x0321; +static const uint16_t TYPE_EVENT_MOUSE_BUTTON = 0x0322; +static const uint16_t TYPE_EVENT_MOUSE_WHEEL = 0x0323; -static const uint16_t OUT_KEYBOARD_EVENT = 0x0311; +/* constants: Screen update notification */ +static const uint8_t SCREEN_UPDATE_NOTIFY_TYPE_ENTIRE_SCREEN = 0; +static const uint8_t SCREEN_UPDATE_NOTIFY_TYPE_PARTIAL = 1; -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; +/* constants: Event Flags */ +/** Ignores time-ordered queue. (event will be emitted immediately) */ +static const uint16_t EVENT_IGNORE_TIMESTAMP_QUEUE = 0b00000001; -struct ProjectorMessageHeader { - uint16_t messageType; - uint64_t id; - uint64_t replyTo; +/* constants: Invalidation Event Types */ +static const uint8_t INVALIDATION_EVENT_TYPE_ENTIRE_SCREEN = 0; +static const uint8_t INVALIDATION_EVENT_TYPE_PARTIAL = 1; - uint64_t timestamp; +/* constants: Keyboard Event Types */ +static const uint8_t KEYBOARD_EVENT_TYPE_NOOP = 0; +static const uint8_t KEYBOARD_EVENT_TYPE_KEYUP = 1; +static const uint8_t KEYBOARD_EVENT_TYPE_KEYDOWN = 2; +/** force release all pressed keys. */ +static const uint8_t KEY_EVENT_TYPE_RESET = 4; - uint64_t length; -} FIXME_MARK_AS_PACKED_STRUCT; -/** - * incoming message - */ -struct ScreenUpdateEvent { - uint8_t type; +/* constants: Mouse Button Event */ +static const uint8_t MOUSE_EVENT_TYPE_NOOP = 0; +static const uint8_t MOUSE_EVENT_TYPE_UP = 1; +static const uint8_t MOUSE_EVENT_TYPE_DOWN = 2; - struct Rect rect; +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; + +/* message definition: server -> client */ +struct ULIPCScreenUpdateNotify { + uint8_t type; + struct ULIPCRect rect; } FIXME_MARK_AS_PACKED_STRUCT; -struct ScreenCommitUpdate { - struct Rect screenRect; +struct ULIPCScreenUpdateCommit { + struct ULIPCRect 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 { +/* message definition: client -> server */ +struct ULIPCInvalidationEvent { uint8_t type; - - struct Rect rect; + struct ULIPCRect 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 { +struct ULIPCKeyboardEvent { uint8_t type; uint32_t keyCode; uint16_t flags; } FIXME_MARK_AS_PACKED_STRUCT; - - -struct MouseMoveEvent { +struct ULIPCMouseMoveEvent { 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 { +struct ULIPCMouseButtonEvent { uint8_t type; uint8_t button; uint16_t flags; } FIXME_MARK_AS_PACKED_STRUCT; -struct MouseWheelEvent { +struct ULIPCMouseWheelEvent { int32_t deltaX; int32_t deltaY; uint16_t flags; } FIXME_MARK_AS_PACKED_STRUCT; - #endif
\ No newline at end of file |