From 3f52921d431a744906833c1f40dbf61c3431916a Mon Sep 17 00:00:00 2001 From: Matthias Bolte Date: Sun, 18 Apr 2010 19:58:58 +0200 Subject: [PATCH] esx: Gather some XML generation macros in esx_vi.h --- src/esx/esx_vi.c | 31 ++++--------------------------- src/esx/esx_vi.h | 37 +++++++++++++++++++++++++++++++++++++ src/esx/esx_vi_methods.c | 17 ----------------- src/esx/esx_vi_types.c | 20 -------------------- 4 files changed, 41 insertions(+), 64 deletions(-) diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index c6854f155e..e405c8038f 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -38,38 +38,13 @@ #define VIR_FROM_THIS VIR_FROM_ESX -#define ESX_VI__SOAP__REQUEST_HEADER \ - "\n" \ - "" \ - "" - -#define ESX_VI__SOAP__REQUEST_FOOTER \ - "" \ - "" + #define ESX_VI__SOAP__RESPONSE_XPATH(_type) \ ((char *)"/soapenv:Envelope/soapenv:Body/" \ "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, ""); \ - } while (0) + #define ESX_VI__TEMPLATE__ALLOC(_type) \ int \ @@ -78,6 +53,8 @@ return esxVI_Alloc((void **)ptrptr, sizeof(esxVI_##_type)); \ } + + #define ESX_VI__TEMPLATE__FREE(_type, _body) \ void \ esxVI_##_type##_Free(esxVI_##_type **ptrptr) \ diff --git a/src/esx/esx_vi.h b/src/esx/esx_vi.h index a3d9363ce5..e0d731e79c 100644 --- a/src/esx/esx_vi.h +++ b/src/esx/esx_vi.h @@ -40,6 +40,43 @@ +#define ESX_VI__SOAP__REQUEST_HEADER \ + "\n" \ + "\n" \ + "\n" + + + +#define ESX_VI__SOAP__REQUEST_FOOTER \ + "\n" \ + "" + + + +#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, ""); \ + } while (0) + + + typedef enum _esxVI_APIVersion esxVI_APIVersion; typedef enum _esxVI_ProductVersion esxVI_ProductVersion; typedef enum _esxVI_Occurrence esxVI_Occurrence; diff --git a/src/esx/esx_vi_methods.c b/src/esx/esx_vi_methods.c index 5c52167b99..8f841e3eb6 100644 --- a/src/esx/esx_vi_methods.c +++ b/src/esx/esx_vi_methods.c @@ -34,23 +34,6 @@ -#define ESX_VI__SOAP__REQUEST_HEADER \ - "\n" \ - "" \ - "" - - - -#define ESX_VI__SOAP__REQUEST_FOOTER \ - "" \ - "" - - - #define ESX_VI__METHOD__CHECK_OUTPUT__None \ /* nothing */ diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c index ed4674b3b2..7d2c02cda9 100644 --- a/src/esx/esx_vi_types.c +++ b/src/esx/esx_vi_types.c @@ -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, ""); \ - } while (0) - - - #define ESX_VI__TEMPLATE__ALLOC(__type) \ int \ esxVI_##__type##_Alloc(esxVI_##__type **ptrptr) \ -- GitLab