SipStack.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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_SIPSTACK_H
  23. #define TINYWRAP_SIPSTACK_H
  24. #include "tinyWRAP_config.h"
  25. #include "SipCallback.h"
  26. #include "SafeObject.h"
  27. #include "tinydav/tdav.h"
  28. #include "tinysip.h"
  29. #include "tinyhttp.h"
  30. class DDebugCallback;
  31. class TINYWRAP_API SipStack: public SafeObject
  32. {
  33. public: /* ctor() and dtor() */
  34. SipStack(SipCallback* pCallback, const char* realm_uri, const char* impi_uri, const char* impu_uri);
  35. ~SipStack();
  36. public: /* API functions */
  37. bool start();
  38. bool setDebugCallback(DDebugCallback* pCallback);
  39. bool setDisplayName(const char* display_name);
  40. bool setRealm(const char* realm_uri);
  41. bool setIMPI(const char* impi);
  42. bool setIMPU(const char* impu_uri);
  43. bool setPassword(const char* password);
  44. bool setAMF(const char* amf);
  45. bool setOperatorId(const char* opid);
  46. bool setProxyCSCF(const char* fqdn, unsigned short port, const char* transport, const char* ipversion);
  47. bool setLocalIP(const char* ip, const char* transport=tsk_null);
  48. bool setLocalPort(unsigned short port, const char* transport=tsk_null);
  49. bool setEarlyIMS(bool enabled);
  50. bool addHeader(const char* name, const char* value);
  51. bool removeHeader(const char* name);
  52. bool addDnsServer(const char* ip);
  53. bool setDnsDiscovery(bool enabled);
  54. bool setAoR(const char* ip, int port);
  55. #if !defined(SWIG)
  56. bool setMode(enum tsip_stack_mode_e mode);
  57. #endif
  58. bool setSigCompParams(unsigned dms, unsigned sms, unsigned cpb, bool enablePresDict);
  59. bool addSigCompCompartment(const char* compId);
  60. bool removeSigCompCompartment(const char* compId);
  61. bool setSTUNEnabledForICE(bool enabled); // @deprecated
  62. bool setSTUNServer(const char* hostname, unsigned short port); // @deprecated
  63. bool setSTUNCred(const char* login, const char* password); // @deprecated
  64. bool setSTUNEnabled(bool enabled);
  65. bool setTLSSecAgree(bool enabled);
  66. bool setSSLCertificates(const char* privKey, const char* pubKey, const char* caKey, bool verify = false);
  67. bool setSSLCretificates(const char* privKey, const char* pubKey, const char* caKey, bool verify = false); /*@deprecated: typo */
  68. bool setIPSecSecAgree(bool enabled);
  69. bool setIPSecParameters(const char* algo, const char* ealgo, const char* mode, const char* proto);
  70. char* dnsENUM(const char* service, const char* e164num, const char* domain);
  71. char* dnsNaptrSrv(const char* domain, const char* service, unsigned short *OUTPUT);
  72. char* dnsSrv(const char* service, unsigned short* OUTPUT);
  73. bool setMaxFDs(unsigned max_fds);
  74. char* getLocalIPnPort(const char* protocol, unsigned short* OUTPUT);
  75. char* getPreferredIdentity();
  76. bool isValid();
  77. bool stop();
  78. static bool initialize();
  79. static bool deInitialize();
  80. static void setCodecs(tdav_codec_id_t codecs);
  81. static void setCodecs_2(int64_t codecs); // For stupid languages
  82. static bool setCodecPriority(tdav_codec_id_t codec_id, int priority);
  83. static bool setCodecPriority_2(int codec, int priority);// For stupid languages
  84. static bool isCodecSupported(tdav_codec_id_t codec_id);
  85. static bool isIPSecSupported();
  86. public: /* Public helper function */
  87. #if !defined(SWIG)
  88. inline tsip_stack_handle_t* getHandle()const {
  89. return m_pHandle;
  90. }
  91. inline SipCallback* getCallback()const {
  92. return m_pCallback;
  93. }
  94. inline DDebugCallback* getDebugCallback() const {
  95. return m_pDebugCallback;
  96. }
  97. #endif
  98. private:
  99. SipCallback* m_pCallback;
  100. DDebugCallback* m_pDebugCallback;
  101. tsip_stack_handle_t* m_pHandle;
  102. static bool g_bInitialized;
  103. };
  104. #endif /* TINYWRAP_SIPSTACK_H */