typeconversion.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright 2005 - 2016 Zarafa and its licensors
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Affero General Public License, version 3,
  6. * as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU Affero General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Affero General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. *
  16. */
  17. #ifndef TYPECONVERSION_H
  18. #define TYPECONVERSION_H
  19. /*
  20. * These functions convert from MAPI types (structs) to PHP arrays and types and vice versa
  21. */
  22. #include "globals.h"
  23. ZEND_EXTERN_MODULE_GLOBALS(mapi)
  24. #include <kopano/charset/convert.h>
  25. #include <inetmapi/options.h>
  26. /*
  27. * PHP -> MAPI
  28. *
  29. * All functions return a newly allocation MAPI structure which must be MAPIFreeBuffer()'ed by
  30. * the caller.
  31. */
  32. // These allocate the structure and copy the data into it, then returns the entire allocated structure, allocation
  33. // via lpBase if non null, otherwise just as MAPIAllocateBuffer
  34. HRESULT PHPArraytoSBinaryArray(zval * entryid_array, void *lpBase, LPENTRYLIST *lppEntryList TSRMLS_DC);
  35. HRESULT PHPArraytoSortOrderSet(zval * sortorder_array, void *lpBase, LPSSortOrderSet *lppSortOrderSet TSRMLS_DC);
  36. HRESULT PHPArraytoPropTagArray(zval * prop_value_array, void *lpBase, LPSPropTagArray *lppPropTagArray TSRMLS_DC);
  37. HRESULT PHPArraytoPropValueArray(zval* phpArray, void *lpBase, ULONG *lpcValues, LPSPropValue *lppPropValues TSRMLS_DC);
  38. HRESULT PHPArraytoAdrList(zval *phpArray, void *lpBase, LPADRLIST *lppAdrList TSRMLS_DC);
  39. HRESULT PHPArraytoRowList(zval *phpArray, void *lpBase, LPROWLIST *lppRowList TSRMLS_DC);
  40. HRESULT PHPArraytoSRestriction(zval *phpVal, void *lpBase, LPSRestriction *lppRestriction TSRMLS_DC);
  41. HRESULT PHPArraytoReadStateArray(zval *phpVal, void *lpBase, ULONG *lpcValues, LPREADSTATE *lppReadStates TSRMLS_DC);
  42. HRESULT PHPArraytoGUIDArray(zval *phpVal, void *lpBase, ULONG *lpcValues, LPGUID *lppGUIDs TSRMLS_DC);
  43. // These functions fill a pre-allocated structure, possibly allocating more memory via lpBase
  44. HRESULT PHPArraytoSBinaryArray(zval * entryid_array, void *lpBase, LPENTRYLIST lpEntryList TSRMLS_DC);
  45. extern HRESULT PHPArraytoSRestriction(zval *, void *base, SRestriction * TSRMLS_DC) __attribute__((nonnull(2)));
  46. /* imtoinet, imtomapi options */
  47. HRESULT PHPArraytoSendingOptions(zval *phpArray, sending_options *lpSOPT);
  48. HRESULT PHPArraytoDeliveryOptions(zval *phpArray, delivery_options *lpDOPT);
  49. /*
  50. * MAPI -> PHP
  51. *
  52. * All functions return a newly allocated ZVAL structure which must be FREE_ZVAL()'ed by the caller.
  53. */
  54. HRESULT SBinaryArraytoPHPArray(SBinaryArray *lpBinaryArray, zval *ret TSRMLS_DC);
  55. HRESULT PropTagArraytoPHPArray(ULONG cValues, LPSPropTagArray lpPropTagArray, zval *ret TSRMLS_DC);
  56. HRESULT PropValueArraytoPHPArray(ULONG cValues, LPSPropValue pPropValueArray, zval *ret TSRMLS_DC);
  57. HRESULT SRestrictiontoPHPArray(LPSRestriction lpRes, int level, zval *ret TSRMLS_DC);
  58. HRESULT RowSettoPHPArray(LPSRowSet lpRowSet, zval *ret TSRMLS_DC);
  59. HRESULT ReadStateArraytoPHPArray(ULONG cValues, LPREADSTATE lpReadStates, zval *ret TSRMLS_DC);
  60. HRESULT NotificationstoPHPArray(ULONG cNotifs, LPNOTIFICATION lpNotifs, zval *ret TSRMLS_DC);
  61. #endif