diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-06-20 10:53:02 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-06-24 13:02:24 -0300 |
commit | 09605cec03ea23e87ee285fd950a23ce8d23678d (patch) | |
tree | 19cb2d23c1c8b37fd01155fb7612191d6e3217a5 /src/nvim/os/msgpack_rpc.h | |
parent | c0b0bd07fd1bc92665be2b0e1eb6d5d9c736ddb1 (diff) | |
download | rneovim-09605cec03ea23e87ee285fd950a23ce8d23678d.tar.gz rneovim-09605cec03ea23e87ee285fd950a23ce8d23678d.tar.bz2 rneovim-09605cec03ea23e87ee285fd950a23ce8d23678d.zip |
channel/msgpack_rpc: Refactor msgpack_rpc_notification/serialize_event
- Generalize some argument names(event type -> event name,
event data -> event arg)
- Rename serialize_event to serialize_message
- Rename msgpack_rpc_notification to msgpack_rpc_message
- Extract the message type out of msgpack_rpc_message
- Add 'id' parameter to msgpack_rpc_message/serialize_message to create messages
that are not notifications
Diffstat (limited to 'src/nvim/os/msgpack_rpc.h')
-rw-r--r-- | src/nvim/os/msgpack_rpc.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/nvim/os/msgpack_rpc.h b/src/nvim/os/msgpack_rpc.h index baabff20aa..9858eab960 100644 --- a/src/nvim/os/msgpack_rpc.h +++ b/src/nvim/os/msgpack_rpc.h @@ -24,13 +24,20 @@ typedef enum { void msgpack_rpc_call(uint64_t id, msgpack_object *req, msgpack_packer *res) FUNC_ATTR_NONNULL_ARG(2) FUNC_ATTR_NONNULL_ARG(3); -/// Packs a notification message +/// Packs a message /// -/// @param type The message type, an arbitrary string -/// @param data The notification data +/// @param type The message type +/// @param id The message id, must be an unique integer > 0 or will be +/// ignored(the message array will have 3 elements instead of 4). +/// @param method The message name, an arbitrary string +/// @param arg The message argument /// @param packer Where the notification will be packed to -void msgpack_rpc_notification(String type, Object data, msgpack_packer *pac) - FUNC_ATTR_NONNULL_ARG(3); +void msgpack_rpc_message(int type, + uint64_t id, + String method, + Object arg, + msgpack_packer *pac) + FUNC_ATTR_NONNULL_ARG(5); /// Dispatches to the actual API function after basic payload validation by /// `msgpack_rpc_call`. It is responsible for validating/converting arguments |