tsip_transport_ipsec.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * Copyright (C) 2010-2011 Mamadou Diop.
  3. *
  4. * Contact: Mamadou Diop <diopmamadou(at)doubango[dot]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. /**@file tsip_transport_ipsec.h
  23. * @brief SIP/IPSec transport.
  24. *
  25. * @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
  26. *
  27. */
  28. #ifndef TINYSIP_TRANSPORT_IPSEC_H
  29. #define TINYSIP_TRANSPORT_IPSEC_H
  30. #include "tinysip_config.h"
  31. #include "tinysip/transports/tsip_transport.h"
  32. #include "tinysip/headers/tsip_header_Security_Verify.h"
  33. #include "tipsec.h"
  34. TSIP_BEGIN_DECLS
  35. #define TSIP_TRANSPORT_IPSEC(self) ((tsip_transport_ipsec_t*)(self))
  36. typedef struct tsip_ipsec_association_s {
  37. TSK_DECLARE_OBJECT;
  38. const tsip_transport_t* transport;
  39. tipsec_ctx_t* ctx;
  40. tnet_socket_t *socket_uc;
  41. tnet_socket_t *socket_us;
  42. tnet_ip_t ip_remote;
  43. tnet_ip_t ip_local;
  44. tnet_port_t port_local;
  45. }
  46. tsip_ipsec_association_t;
  47. typedef struct tsip_transport_ipsec_s {
  48. TSIP_DECLARE_TRANSPORT;
  49. tsip_header_Security_Verifies_L_t* secVerifies;
  50. tsip_ipsec_association_t* asso_active;
  51. tsip_ipsec_association_t* asso_temporary;
  52. }
  53. tsip_transport_ipsec_t;
  54. tsip_transport_ipsec_t* tsip_transport_ipsec_create(struct tsip_stack_s* stack, const char* host, tnet_port_t port, tnet_socket_type_t type, const char* description);
  55. int tsip_transport_ipsec_createTempSAs(tsip_transport_ipsec_t* self);
  56. int tsip_transport_ipsec_ensureTempSAs(tsip_transport_ipsec_t* self, const tsip_response_t *r401_407, int64_t expires);
  57. int tsip_transport_ipsec_startSAs(tsip_transport_ipsec_t* self, const tipsec_key_t* ik, const tipsec_key_t* ck);
  58. int tsip_transport_ipsec_cleanupSAs(tsip_transport_ipsec_t* self);
  59. tnet_fd_t tsip_transport_ipsec_getFD(tsip_transport_ipsec_t* self, int isRequest);
  60. int tsip_transport_ipsec_updateMSG(tsip_transport_ipsec_t* self, tsip_message_t *msg);
  61. TINYSIP_GEXTERN const tsk_object_def_t *tsip_transport_ipsec_def_t;
  62. TSIP_END_DECLS
  63. #endif /* TINYSIP_TRANSPORT_IPSEC_H */