IPSecCtx.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* Copyright (C) 2010-2014 Mamadou DIOP
  2. * Copyright (C) 2011-2014 Doubango Telecom <http://www.doubango.org>
  3. *
  4. * This file is part of Open Source Doubango Framework.
  5. *
  6. * DOUBANGO is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * DOUBANGO is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with DOUBANGO.
  18. */
  19. #ifndef IPSEC_CTX_H
  20. #define IPSEC_CTX_H
  21. #include "tipsec.h"
  22. class IPSecCtx
  23. {
  24. public:
  25. IPSecCtx(tipsec_ipproto_t ipproto,
  26. bool use_ipv6,
  27. tipsec_mode_t mode,
  28. tipsec_ealg_t ealg,
  29. tipsec_alg_t alg,
  30. tipsec_proto_t protocol);
  31. virtual ~IPSecCtx();
  32. tipsec_error_t start();
  33. tipsec_error_t setLocal(const char* addr_local, const char* addr_remote, tipsec_port_t port_uc, tipsec_port_t port_us);
  34. tipsec_error_t setKeys(const tipsec_key_t* ik, const tipsec_key_t* ck);
  35. tipsec_error_t setRemote(tipsec_spi_t spi_pc, tipsec_spi_t spi_ps, tipsec_port_t port_pc, tipsec_port_t port_ps, tipsec_lifetime_t lifetime);
  36. tipsec_error_t stop();
  37. tipsec_spi_t getSpiUC();
  38. tipsec_spi_t getSpiUS();
  39. tipsec_spi_t getSpiPC();
  40. tipsec_spi_t getSpiPS();
  41. private:
  42. static bool sInitialized;
  43. tipsec_ctx_t* m_pCtx;
  44. };
  45. #endif /* IPSEC_CTX_H */