log_protocol.x 3.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/* -*- c -*-
 */

%#include "internal.h"

typedef opaque virLogManagerProtocolUUID[VIR_UUID_BUFLEN];

/* 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.
 */
const VIR_LOG_MANAGER_PROTOCOL_STRING_MAX = 4194304;

/* A long string, which may NOT be NULL. */
typedef string virLogManagerProtocolNonNullString<VIR_LOG_MANAGER_PROTOCOL_STRING_MAX>;

/* A long string, which may be NULL. */
typedef virLogManagerProtocolNonNullString *virLogManagerProtocolString;

20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
struct virLogManagerProtocolDomain {
    virLogManagerProtocolUUID uuid;
    virLogManagerProtocolNonNullString name;
};
typedef struct virLogManagerProtocolDomain virLogManagerProtocolDomain;

struct virLogManagerProtocolLogFilePosition {
    unsigned hyper inode;
    unsigned hyper offset;
};
typedef struct virLogManagerProtocolLogFilePosition virLogManagerProtocolLogFilePosition;

/* Obtain a file handle suitable for writing to a
 * log file for a domain
 */
struct virLogManagerProtocolDomainOpenLogFileArgs {
    virLogManagerProtocolNonNullString driver;
    virLogManagerProtocolDomain dom;
38
    virLogManagerProtocolNonNullString path;
39 40 41 42 43 44 45 46
    unsigned int flags;
};

struct virLogManagerProtocolDomainOpenLogFileRet {
    virLogManagerProtocolLogFilePosition pos;
};

struct virLogManagerProtocolDomainGetLogFilePositionArgs {
47
    virLogManagerProtocolNonNullString path;
48 49 50 51 52 53 54 55
    unsigned int flags;
};

struct virLogManagerProtocolDomainGetLogFilePositionRet {
    virLogManagerProtocolLogFilePosition pos;
};

struct virLogManagerProtocolDomainReadLogFileArgs {
56
    virLogManagerProtocolNonNullString path;
57 58 59 60 61 62 63 64 65
    virLogManagerProtocolLogFilePosition pos;
    unsigned hyper maxlen;
    unsigned int flags;
};

struct virLogManagerProtocolDomainReadLogFileRet {
    virLogManagerProtocolNonNullString data;
};

66 67 68
/* Define the program number, protocol version and procedure numbers here. */
const VIR_LOG_MANAGER_PROTOCOL_PROGRAM = 0x87539319;
const VIR_LOG_MANAGER_PROTOCOL_PROGRAM_VERSION = 1;
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114

enum virLogManagerProtocolProcedure {
    /* Each function must be preceded by a comment providing one or
     * more annotations:
     *
     * - @generate: none|client|server|both
     *
     *   Whether to generate the dispatch stubs for the server
     *   and/or client code.
     *
     * - @readstream: paramnumber
     * - @writestream: paramnumber
     *
     *   The @readstream or @writestream annotations let daemon and src/remote
     *   create a stream.  The direction is defined from the src/remote point
     *   of view.  A readstream transfers data from daemon to src/remote.  The
     *   <paramnumber> specifies at which offset the stream parameter is inserted
     *   in the function parameter list.
     *
     * - @priority: low|high
     *
     *   Each API that might eventually access hypervisor's  monitor (and thus
     *   block) MUST fall into low priority. However, there are some exceptions
     *   to this rule, e.g. domainDestroy. Other APIs MAY  be marked as high
     *   priority. If in doubt, it's safe to choose low. Low is taken as default,
     *   and thus can be left out.
     */

    /**
     * @generate: none
     * @acl: none
     */
    VIR_LOG_MANAGER_PROTOCOL_PROC_DOMAIN_OPEN_LOG_FILE = 1,

    /**
     * @generate: none
     * @acl: none
     */
    VIR_LOG_MANAGER_PROTOCOL_PROC_DOMAIN_GET_LOG_FILE_POSITION = 2,

    /**
     * @generate: none
     * @acl: none
     */
    VIR_LOG_MANAGER_PROTOCOL_PROC_DOMAIN_READ_LOG_FILE = 3
};