SipMessage.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Copyright (C) 2010-2011 Mamadou Diop.
  3. *
  4. * Contact: Mamadou Diop <diopmamadou(at)doubango.org>
  5. *
  6. * This file is part of Open Source Doubango Framework.
  7. *
  8. * DOUBANGO is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * DOUBANGO is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with DOUBANGO.
  20. *
  21. */
  22. #ifndef TINYWRAP_SIPMESSAGE_H
  23. #define TINYWRAP_SIPMESSAGE_H
  24. #include "tinyWRAP_config.h"
  25. #include "tinysip.h"
  26. class TINYWRAP_API SdpMessage
  27. {
  28. public:
  29. SdpMessage();
  30. #if !defined(SWIG)
  31. SdpMessage(tsdp_message_t *sdpmessage);
  32. #endif
  33. virtual ~SdpMessage();
  34. char* getSdpHeaderValue(const char* media, char name, unsigned index = 0);
  35. char* getSdpHeaderAValue(const char* media, const char* attributeName);
  36. #if !defined(SWIG)
  37. const tsdp_message_t * getWrappedSdpMessage() {
  38. return m_pSdpMessage;
  39. }
  40. #endif
  41. private:
  42. tsdp_message_t *m_pSdpMessage;
  43. };
  44. class TINYWRAP_API SipMessage
  45. {
  46. public:
  47. SipMessage();
  48. #if !defined(SWIG)
  49. SipMessage(tsip_message_t *sipmessage);
  50. #endif
  51. virtual ~SipMessage();
  52. bool isResponse();
  53. tsip_request_type_t getRequestType();
  54. short getResponseCode();
  55. const char* getResponsePhrase();
  56. char* getSipHeaderValue(const char* name, unsigned index = 0);
  57. char* getSipHeaderParamValue(const char* name, const char* param, unsigned index = 0);
  58. unsigned getSipContentLength();
  59. unsigned getSipContent(void* output, unsigned maxsize);
  60. #if !defined(SWIG)
  61. const void* getSipContentPtr();
  62. const tsip_message_t* getWrappedSipMessage()const {
  63. return m_pSipMessage;
  64. }
  65. #endif
  66. const SdpMessage* getSdpMessage();
  67. private:
  68. const tsip_header_t* getSipHeader(const char* name, unsigned index = 0);
  69. private:
  70. tsip_message_t *m_pSipMessage;
  71. SdpMessage *m_pSdpMessage;
  72. };
  73. #endif /* TINYWRAP_SIPMESSAGE_H */