esx: Gather some XML generation macros in esx_vi.h

This commit is contained in:
Matthias Bolte 2010-04-18 19:58:58 +02:00
parent 7a056d0648
commit 3f52921d43
4 changed files with 39 additions and 62 deletions

View File

@ -38,38 +38,13 @@
#define VIR_FROM_THIS VIR_FROM_ESX #define VIR_FROM_THIS VIR_FROM_ESX
#define ESX_VI__SOAP__REQUEST_HEADER \
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \
"<soapenv:Envelope " \
"xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" " \
"xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" " \
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " \
"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" \
"<soapenv:Body>"
#define ESX_VI__SOAP__REQUEST_FOOTER \
"</soapenv:Body>" \
"</soapenv:Envelope>"
#define ESX_VI__SOAP__RESPONSE_XPATH(_type) \ #define ESX_VI__SOAP__RESPONSE_XPATH(_type) \
((char *)"/soapenv:Envelope/soapenv:Body/" \ ((char *)"/soapenv:Envelope/soapenv:Body/" \
"vim:"_type"Response/vim:returnval") "vim:"_type"Response/vim:returnval")
#define ESV_VI__XML_TAG__OPEN(_buffer, _element, _type) \
do { \
virBufferAddLit(_buffer, "<"); \
virBufferAdd(_buffer, _element, -1); \
virBufferAddLit(_buffer, " xmlns=\"urn:vim25\" xsi:type=\""); \
virBufferAdd(_buffer, _type, -1); \
virBufferAddLit(_buffer, "\">"); \
} while (0)
#define ESV_VI__XML_TAG__CLOSE(_buffer, _element) \
do { \
virBufferAddLit(_buffer, "</"); \
virBufferAdd(_buffer, _element, -1); \
virBufferAddLit(_buffer, ">"); \
} while (0)
#define ESX_VI__TEMPLATE__ALLOC(_type) \ #define ESX_VI__TEMPLATE__ALLOC(_type) \
int \ int \
@ -78,6 +53,8 @@
return esxVI_Alloc((void **)ptrptr, sizeof(esxVI_##_type)); \ return esxVI_Alloc((void **)ptrptr, sizeof(esxVI_##_type)); \
} }
#define ESX_VI__TEMPLATE__FREE(_type, _body) \ #define ESX_VI__TEMPLATE__FREE(_type, _body) \
void \ void \
esxVI_##_type##_Free(esxVI_##_type **ptrptr) \ esxVI_##_type##_Free(esxVI_##_type **ptrptr) \

View File

@ -40,6 +40,43 @@
#define ESX_VI__SOAP__REQUEST_HEADER \
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \
"<soapenv:Envelope\n" \
" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n" \
" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n" \
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" \
" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n" \
"<soapenv:Body>\n"
#define ESX_VI__SOAP__REQUEST_FOOTER \
"</soapenv:Body>\n" \
"</soapenv:Envelope>"
#define ESV_VI__XML_TAG__OPEN(_buffer, _element, _type) \
do { \
virBufferAddLit(_buffer, "<"); \
virBufferAdd(_buffer, _element, -1); \
virBufferAddLit(_buffer, " xmlns=\"urn:vim25\" xsi:type=\""); \
virBufferAdd(_buffer, _type, -1); \
virBufferAddLit(_buffer, "\">"); \
} while (0)
#define ESV_VI__XML_TAG__CLOSE(_buffer, _element) \
do { \
virBufferAddLit(_buffer, "</"); \
virBufferAdd(_buffer, _element, -1); \
virBufferAddLit(_buffer, ">"); \
} while (0)
typedef enum _esxVI_APIVersion esxVI_APIVersion; typedef enum _esxVI_APIVersion esxVI_APIVersion;
typedef enum _esxVI_ProductVersion esxVI_ProductVersion; typedef enum _esxVI_ProductVersion esxVI_ProductVersion;
typedef enum _esxVI_Occurrence esxVI_Occurrence; typedef enum _esxVI_Occurrence esxVI_Occurrence;

View File

@ -34,23 +34,6 @@
#define ESX_VI__SOAP__REQUEST_HEADER \
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \
"<soapenv:Envelope " \
"xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" " \
"xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" " \
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " \
"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" \
"<soapenv:Body>"
#define ESX_VI__SOAP__REQUEST_FOOTER \
"</soapenv:Body>" \
"</soapenv:Envelope>"
#define ESX_VI__METHOD__CHECK_OUTPUT__None \ #define ESX_VI__METHOD__CHECK_OUTPUT__None \
/* nothing */ /* nothing */

View File

@ -39,26 +39,6 @@
#define ESV_VI__XML_TAG__OPEN(_buffer, _element, _type) \
do { \
virBufferAddLit(_buffer, "<"); \
virBufferAdd(_buffer, _element, -1); \
virBufferAddLit(_buffer, " xmlns=\"urn:vim25\" xsi:type=\""); \
virBufferAdd(_buffer, _type, -1); \
virBufferAddLit(_buffer, "\">"); \
} while (0)
#define ESV_VI__XML_TAG__CLOSE(_buffer, _element) \
do { \
virBufferAddLit(_buffer, "</"); \
virBufferAdd(_buffer, _element, -1); \
virBufferAddLit(_buffer, ">"); \
} while (0)
#define ESX_VI__TEMPLATE__ALLOC(__type) \ #define ESX_VI__TEMPLATE__ALLOC(__type) \
int \ int \
esxVI_##__type##_Alloc(esxVI_##__type **ptrptr) \ esxVI_##__type##_Alloc(esxVI_##__type **ptrptr) \