mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +00:00
Cleanup remote protocol definitions
The standard remote protocol for libvirtd no longer needs to include definitions of the generic message header/error structs or status codes. This is all defined in the generic RPC protocol * src/remote/remote_protocol.x: Remove all RPC message definitions * src/remote/remote_protocol.h, src/remote/remote_protocol.c: Re-generate * daemon/remote_generate_stubs.pl: Delete obsolete script
This commit is contained in:
parent
ea9694b21a
commit
6818cf8690
@ -60,15 +60,6 @@
|
||||
|
||||
/*----- Data types. -----*/
|
||||
|
||||
/* Maximum total message size (serialised). */
|
||||
const REMOTE_MESSAGE_MAX = 262144;
|
||||
|
||||
/* Size of struct remote_message_header (serialized)*/
|
||||
const REMOTE_MESSAGE_HEADER_MAX = 24;
|
||||
|
||||
/* Size of message payload */
|
||||
const REMOTE_MESSAGE_PAYLOAD_MAX = 262120;
|
||||
|
||||
/* Length of long, but not unbounded, strings.
|
||||
* This is an arbitrary limit designed to stop the decoder from trying
|
||||
* to allocate unbounded amounts of memory when fed with a bad message.
|
||||
@ -2409,109 +2400,3 @@ enum remote_procedure {
|
||||
* <offset> specifies at which offset the stream parameter is inserted
|
||||
* in the function parameter list. */
|
||||
};
|
||||
|
||||
/*
|
||||
* RPC wire format
|
||||
*
|
||||
* Each message consists of:
|
||||
*
|
||||
* Name | Type | Description
|
||||
* -----------+-----------------------+------------------
|
||||
* Length | int | Total number of bytes in message _including_ length.
|
||||
* Header | remote_message_header | Control information about procedure call
|
||||
* Payload | - | Variable payload data per procedure
|
||||
*
|
||||
* In header, the 'serial' field varies according to:
|
||||
*
|
||||
* - type == REMOTE_CALL
|
||||
* * serial is set by client, incrementing by 1 each time
|
||||
*
|
||||
* - type == REMOTE_REPLY
|
||||
* * serial matches that from the corresponding REMOTE_CALL
|
||||
*
|
||||
* - type == REMOTE_MESSAGE
|
||||
* * serial is always zero
|
||||
*
|
||||
* - type == REMOTE_STREAM
|
||||
* * serial matches that from the corresponding REMOTE_CALL
|
||||
*
|
||||
* and the 'status' field varies according to:
|
||||
*
|
||||
* - type == REMOTE_CALL
|
||||
* * REMOTE_OK always
|
||||
*
|
||||
* - type == REMOTE_REPLY
|
||||
* * REMOTE_OK if RPC finished successfully
|
||||
* * REMOTE_ERROR if something failed
|
||||
*
|
||||
* - type == REMOTE_MESSAGE
|
||||
* * REMOTE_OK always
|
||||
*
|
||||
* - type == REMOTE_STREAM
|
||||
* * REMOTE_CONTINUE if more data is following
|
||||
* * REMOTE_OK if stream is complete
|
||||
* * REMOTE_ERROR if stream had an error
|
||||
*
|
||||
* Payload varies according to type and status:
|
||||
*
|
||||
* - type == REMOTE_CALL
|
||||
* XXX_args for procedure
|
||||
*
|
||||
* - type == REMOTE_REPLY
|
||||
* * status == REMOTE_OK
|
||||
* XXX_ret for procedure
|
||||
* * status == REMOTE_ERROR
|
||||
* remote_error Error information
|
||||
*
|
||||
* - type == REMOTE_MESSAGE
|
||||
* * status == REMOTE_OK
|
||||
* XXX_args for procedure
|
||||
* * status == REMOTE_ERROR
|
||||
* remote_error Error information
|
||||
*
|
||||
* - type == REMOTE_STREAM
|
||||
* * status == REMOTE_CONTINUE
|
||||
* byte[] raw stream data
|
||||
* * status == REMOTE_ERROR
|
||||
* remote_error error information
|
||||
* * status == REMOTE_OK
|
||||
* <empty>
|
||||
*/
|
||||
enum remote_message_type {
|
||||
/* client -> server. args from a method call */
|
||||
REMOTE_CALL = 0,
|
||||
/* server -> client. reply/error from a method call */
|
||||
REMOTE_REPLY = 1,
|
||||
/* either direction. async notification */
|
||||
REMOTE_MESSAGE = 2,
|
||||
/* either direction. stream data packet */
|
||||
REMOTE_STREAM = 3
|
||||
};
|
||||
|
||||
enum remote_message_status {
|
||||
/* Status is always REMOTE_OK for calls.
|
||||
* For replies, indicates no error.
|
||||
*/
|
||||
REMOTE_OK = 0,
|
||||
|
||||
/* For replies, indicates that an error happened, and a struct
|
||||
* remote_error follows.
|
||||
*/
|
||||
REMOTE_ERROR = 1,
|
||||
|
||||
/* For streams, indicates that more data is still expected
|
||||
*/
|
||||
REMOTE_CONTINUE = 2
|
||||
};
|
||||
|
||||
/* 4 byte length word per header */
|
||||
const REMOTE_MESSAGE_HEADER_XDR_LEN = 4;
|
||||
|
||||
struct remote_message_header {
|
||||
unsigned prog; /* REMOTE_PROGRAM */
|
||||
unsigned vers; /* REMOTE_PROTOCOL_VERSION */
|
||||
int proc; /* REMOTE_PROC_x */
|
||||
remote_message_type type;
|
||||
unsigned serial; /* Serial number of message. */
|
||||
remote_message_status status;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user