libvirt-host: Move virTypedParam* to libvirt-common

Commits 0472cef6, 9afc115f, 8cd1d546 exported typed params handlers internally,
but a commit which would move the public definition from libvirt-host to
libvirt-common was missing.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Erik Skultety 2016-02-04 15:23:00 +01:00
parent dc7aeeade1
commit f5d9c5d00c
2 changed files with 185 additions and 186 deletions

View File

@ -120,6 +120,191 @@ typedef enum {
# endif
} virConnectCloseReason;
/**
* virTypedParameterType:
*
* Express the type of a virTypedParameter
*/
typedef enum {
VIR_TYPED_PARAM_INT = 1, /* integer case */
VIR_TYPED_PARAM_UINT = 2, /* unsigned integer case */
VIR_TYPED_PARAM_LLONG = 3, /* long long case */
VIR_TYPED_PARAM_ULLONG = 4, /* unsigned long long case */
VIR_TYPED_PARAM_DOUBLE = 5, /* double case */
VIR_TYPED_PARAM_BOOLEAN = 6, /* boolean(character) case */
VIR_TYPED_PARAM_STRING = 7, /* string case */
# ifdef VIR_ENUM_SENTINELS
VIR_TYPED_PARAM_LAST
# endif
} virTypedParameterType;
/**
* virTypedParameterFlags:
*
* Flags related to libvirt APIs that use virTypedParameter.
*
* These enums should not conflict with those of virDomainModificationImpact.
*/
typedef enum {
/* 1 << 0 is reserved for virDomainModificationImpact */
/* 1 << 1 is reserved for virDomainModificationImpact */
/* Older servers lacked the ability to handle string typed
* parameters. Attempts to set a string parameter with an older
* server will fail at the client, but attempts to retrieve
* parameters must not return strings from a new server to an
* older client, so this flag exists to identify newer clients to
* newer servers. This flag is automatically set when needed, so
* the user does not have to worry about it; however, manually
* setting the flag can be used to reject servers that cannot
* return typed strings, even if no strings would be returned.
*/
VIR_TYPED_PARAM_STRING_OKAY = 1 << 2,
} virTypedParameterFlags;
/**
* VIR_TYPED_PARAM_FIELD_LENGTH:
*
* Macro providing the field length of virTypedParameter name
*/
# define VIR_TYPED_PARAM_FIELD_LENGTH 80
/**
* virTypedParameter:
*
* A named parameter, including a type and value.
*
* The types virSchedParameter, virBlkioParameter, and
* virMemoryParameter are aliases of this type, for use when
* targeting libvirt earlier than 0.9.2.
*/
typedef struct _virTypedParameter virTypedParameter;
struct _virTypedParameter {
char field[VIR_TYPED_PARAM_FIELD_LENGTH]; /* parameter name */
int type; /* parameter type, virTypedParameterType */
union {
int i; /* type is INT */
unsigned int ui; /* type is UINT */
long long int l; /* type is LLONG */
unsigned long long int ul; /* type is ULLONG */
double d; /* type is DOUBLE */
char b; /* type is BOOLEAN */
char *s; /* type is STRING, may not be NULL */
} value; /* parameter value */
};
/**
* virTypedParameterPtr:
*
* a pointer to a virTypedParameter structure.
*/
typedef virTypedParameter *virTypedParameterPtr;
virTypedParameterPtr
virTypedParamsGet (virTypedParameterPtr params,
int nparams,
const char *name);
int
virTypedParamsGetInt (virTypedParameterPtr params,
int nparams,
const char *name,
int *value);
int
virTypedParamsGetUInt (virTypedParameterPtr params,
int nparams,
const char *name,
unsigned int *value);
int
virTypedParamsGetLLong (virTypedParameterPtr params,
int nparams,
const char *name,
long long *value);
int
virTypedParamsGetULLong (virTypedParameterPtr params,
int nparams,
const char *name,
unsigned long long *value);
int
virTypedParamsGetDouble (virTypedParameterPtr params,
int nparams,
const char *name,
double *value);
int
virTypedParamsGetBoolean(virTypedParameterPtr params,
int nparams,
const char *name,
int *value);
int
virTypedParamsGetString (virTypedParameterPtr params,
int nparams,
const char *name,
const char **value);
int
virTypedParamsAddInt (virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
int value);
int
virTypedParamsAddUInt (virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
unsigned int value);
int
virTypedParamsAddLLong (virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
long long value);
int
virTypedParamsAddULLong (virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
unsigned long long value);
int
virTypedParamsAddDouble (virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
double value);
int
virTypedParamsAddBoolean(virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
int value);
int
virTypedParamsAddString (virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
const char *value);
int
virTypedParamsAddStringList(virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
const char **values);
int
virTypedParamsAddFromString(virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
int type,
const char *value);
void
virTypedParamsClear (virTypedParameterPtr params,
int nparams);
void
virTypedParamsFree (virTypedParameterPtr params,
int nparams);
# ifdef __cplusplus
}
# endif

View File

@ -140,192 +140,6 @@ struct _virSecurityModel {
*/
typedef virSecurityModel *virSecurityModelPtr;
/* Common data types shared among interfaces with name/type/value lists. */
/**
* virTypedParameterType:
*
* Express the type of a virTypedParameter
*/
typedef enum {
VIR_TYPED_PARAM_INT = 1, /* integer case */
VIR_TYPED_PARAM_UINT = 2, /* unsigned integer case */
VIR_TYPED_PARAM_LLONG = 3, /* long long case */
VIR_TYPED_PARAM_ULLONG = 4, /* unsigned long long case */
VIR_TYPED_PARAM_DOUBLE = 5, /* double case */
VIR_TYPED_PARAM_BOOLEAN = 6, /* boolean(character) case */
VIR_TYPED_PARAM_STRING = 7, /* string case */
# ifdef VIR_ENUM_SENTINELS
VIR_TYPED_PARAM_LAST
# endif
} virTypedParameterType;
/**
* virTypedParameterFlags:
*
* Flags related to libvirt APIs that use virTypedParameter.
*
* These enums should not conflict with those of virDomainModificationImpact.
*/
typedef enum {
/* 1 << 0 is reserved for virDomainModificationImpact */
/* 1 << 1 is reserved for virDomainModificationImpact */
/* Older servers lacked the ability to handle string typed
* parameters. Attempts to set a string parameter with an older
* server will fail at the client, but attempts to retrieve
* parameters must not return strings from a new server to an
* older client, so this flag exists to identify newer clients to
* newer servers. This flag is automatically set when needed, so
* the user does not have to worry about it; however, manually
* setting the flag can be used to reject servers that cannot
* return typed strings, even if no strings would be returned.
*/
VIR_TYPED_PARAM_STRING_OKAY = 1 << 2,
} virTypedParameterFlags;
/**
* VIR_TYPED_PARAM_FIELD_LENGTH:
*
* Macro providing the field length of virTypedParameter name
*/
# define VIR_TYPED_PARAM_FIELD_LENGTH 80
/**
* virTypedParameter:
*
* A named parameter, including a type and value.
*
* The types virSchedParameter, virBlkioParameter, and
* virMemoryParameter are aliases of this type, for use when
* targeting libvirt earlier than 0.9.2.
*/
typedef struct _virTypedParameter virTypedParameter;
struct _virTypedParameter {
char field[VIR_TYPED_PARAM_FIELD_LENGTH]; /* parameter name */
int type; /* parameter type, virTypedParameterType */
union {
int i; /* type is INT */
unsigned int ui; /* type is UINT */
long long int l; /* type is LLONG */
unsigned long long int ul; /* type is ULLONG */
double d; /* type is DOUBLE */
char b; /* type is BOOLEAN */
char *s; /* type is STRING, may not be NULL */
} value; /* parameter value */
};
/**
* virTypedParameterPtr:
*
* a pointer to a virTypedParameter structure.
*/
typedef virTypedParameter *virTypedParameterPtr;
virTypedParameterPtr
virTypedParamsGet (virTypedParameterPtr params,
int nparams,
const char *name);
int
virTypedParamsGetInt (virTypedParameterPtr params,
int nparams,
const char *name,
int *value);
int
virTypedParamsGetUInt (virTypedParameterPtr params,
int nparams,
const char *name,
unsigned int *value);
int
virTypedParamsGetLLong (virTypedParameterPtr params,
int nparams,
const char *name,
long long *value);
int
virTypedParamsGetULLong (virTypedParameterPtr params,
int nparams,
const char *name,
unsigned long long *value);
int
virTypedParamsGetDouble (virTypedParameterPtr params,
int nparams,
const char *name,
double *value);
int
virTypedParamsGetBoolean(virTypedParameterPtr params,
int nparams,
const char *name,
int *value);
int
virTypedParamsGetString (virTypedParameterPtr params,
int nparams,
const char *name,
const char **value);
int
virTypedParamsAddInt (virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
int value);
int
virTypedParamsAddUInt (virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
unsigned int value);
int
virTypedParamsAddLLong (virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
long long value);
int
virTypedParamsAddULLong (virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
unsigned long long value);
int
virTypedParamsAddDouble (virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
double value);
int
virTypedParamsAddBoolean(virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
int value);
int
virTypedParamsAddString (virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
const char *value);
int
virTypedParamsAddStringList(virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
const char **values);
int
virTypedParamsAddFromString(virTypedParameterPtr *params,
int *nparams,
int *maxparams,
const char *name,
int type,
const char *value);
void
virTypedParamsClear (virTypedParameterPtr params,
int nparams);
void
virTypedParamsFree (virTypedParameterPtr params,
int nparams);
/* data types related to virNodePtr */