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.

104 lines
2.4 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /******************************************************************
  2. * $Id: soap-service.c,v 1.8 2006/07/09 16:24:19 snowdrop Exp $
  3. *
  4. * CSOAP Project: A SOAP client/server library in C
  5. * Copyright (C) 2003 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: ayaz@jprogrammer.net
  23. ******************************************************************/
  24. #ifdef HAVE_CONFIG_H
  25. #include <config.h>
  26. #endif
  27. #ifdef HAVE_STRING_H
  28. #include <string.h>
  29. #endif
  30. #include <nanohttp/nanohttp-logging.h>
  31. #include <nanohttp/nanohttp-common.h>
  32. #include "soap-service.h"
  33. SoapServiceNode *
  34. soap_service_node_new(SoapService * service, SoapServiceNode * next)
  35. {
  36. SoapServiceNode *node;
  37. node = (SoapServiceNode *) malloc(sizeof(SoapServiceNode));
  38. node->service = service;
  39. node->next = next;
  40. return node;
  41. }
  42. SoapService *
  43. soap_service_new(const char *urn, const char *method, SoapServiceFunc f)
  44. {
  45. SoapService *service;
  46. service = (SoapService *) malloc(sizeof(SoapService));
  47. service->func = f;
  48. if (urn != NULL)
  49. {
  50. service->urn = (char *) malloc(strlen(urn) + 1);
  51. strcpy(service->urn, urn);
  52. }
  53. else
  54. {
  55. log_warn1("urn is NULL");
  56. service->urn = "";
  57. }
  58. if (method != NULL)
  59. {
  60. service->method = (char *) malloc(strlen(method) + 1);
  61. strcpy(service->method, method);
  62. }
  63. else
  64. {
  65. log_warn1("method is NULL");
  66. service->method = "";
  67. }
  68. return service;
  69. }
  70. void
  71. soap_service_free(SoapService * service)
  72. {
  73. log_verbose2("enter: service=%p", service);
  74. if (service == NULL)
  75. return;
  76. if (strcmp(service->urn, ""))
  77. free(service->urn);
  78. if (strcmp(service->method, ""))
  79. free(service->method);
  80. free(service);
  81. log_verbose1("leave with success");
  82. }