You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.4 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /******************************************************************
  2. * $Id: soap-ctx.h,v 1.9 2006/03/06 13:37:38 m0gg Exp $
  3. *
  4. * CSOAP Project: A SOAP client/server library in C
  5. * Copyright (C) 2003-2004 Ferhat Ayaz
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Library General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Library General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Library General Public
  18. * License along with this library; if not, write to the
  19. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20. * Boston, MA 02111-1307, USA.
  21. *
  22. * Email: ferhatayaz@jprogrammer.net
  23. ******************************************************************/
  24. #ifndef cSOAP_CTX_H
  25. #define cSOAP_CTX_H
  26. #include <nanohttp/nanohttp-common.h>
  27. #include <nanohttp/nanohttp-server.h>
  28. #include <libcsoap/soap-env.h>
  29. #define SOAP_ERROR_NO_FILE_ATTACHED 4001
  30. #define SOAP_ERROR_EMPTY_ATTACHMENT 4002
  31. #define MAX_HREF_SIZE 150
  32. typedef struct _SoapCtx
  33. {
  34. SoapEnv *env;
  35. char *action;
  36. hrequest_t *http;
  37. attachments_t *attachments;
  38. } SoapCtx;
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42. SoapCtx *soap_ctx_new(SoapEnv * env); /* should only be used internally */
  43. /**
  44. Returns the attached file if any found.
  45. @param ctx the SoapCtx object which should contain the part
  46. @param node the xml node which points to a file via the "href" xml attribute
  47. @returns a part_t object of attachment was found, NULL otherwise.
  48. */
  49. part_t *soap_ctx_get_file(SoapCtx * ctx, xmlNodePtr node);
  50. /**
  51. Creates a new soap context object.
  52. */
  53. herror_t soap_ctx_new_with_method(const char *urn, const char *method,
  54. SoapCtx ** out);
  55. /* Size of destination dest_href should be MAX_HREF_SIZE */
  56. herror_t soap_ctx_add_file(SoapCtx * ctx, const char *filename,
  57. const char *content_type, char *dest_href);
  58. /*
  59. Used internally. Will switch the deleteOnExit flag from the
  60. given one to the added part.
  61. */
  62. void soap_ctx_add_files(SoapCtx * ctx, attachments_t * attachments);
  63. void soap_ctx_free(SoapCtx * ctx);
  64. #ifdef __cplusplus
  65. }
  66. #endif
  67. #endif