sdp_crypto.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Asterisk -- An open source telephony toolkit.
  3. *
  4. * Copyright (C) 2006 - 2007, Mikael Magnusson
  5. *
  6. * Mikael Magnusson <mikma@users.sourceforge.net>
  7. *
  8. * See http://www.asterisk.org for more information about
  9. * the Asterisk project. Please do not directly contact
  10. * any of the maintainers of this project for assistance;
  11. * the project provides a web site, mailing lists and IRC
  12. * channels for your use.
  13. *
  14. * This program is free software, distributed under the terms of
  15. * the GNU General Public License Version 2. See the LICENSE file
  16. * at the top of the source tree.
  17. */
  18. /*! \file sdp_crypto.h
  19. *
  20. * \brief SDP Security descriptions
  21. *
  22. * Specified in RFC 4568
  23. *
  24. * \author Mikael Magnusson <mikma@users.sourceforge.net>
  25. */
  26. #ifndef _SDP_CRYPTO_H
  27. #define _SDP_CRYPTO_H
  28. #include <asterisk/rtp_engine.h>
  29. struct sdp_crypto;
  30. struct sip_srtp;
  31. /*! \brief Initialize an return an sdp_crypto struct
  32. *
  33. * \details
  34. * This function allocates a new sdp_crypto struct and initializes its values
  35. *
  36. * \retval NULL on failure
  37. * \retval a pointer to a new sdp_crypto structure
  38. */
  39. struct sdp_crypto *sdp_crypto_setup(void);
  40. /*! \brief Destroy a previously allocated sdp_crypto struct */
  41. void sdp_crypto_destroy(struct sdp_crypto *crypto);
  42. /*! \brief Parse the a=crypto line from SDP and set appropriate values on the
  43. * sdp_crypto struct.
  44. *
  45. * \param p A valid sdp_crypto struct
  46. * \param attr the a:crypto line from SDP
  47. * \param rtp The rtp instance associated with the SDP being parsed
  48. * \param srtp SRTP structure
  49. *
  50. * \retval 0 success
  51. * \retval nonzero failure
  52. */
  53. int sdp_crypto_process(struct sdp_crypto *p, const char *attr, struct ast_rtp_instance *rtp, struct sip_srtp *srtp);
  54. /*! \brief Generate an SRTP a=crypto offer
  55. *
  56. * \details
  57. * The offer is stored on the sdp_crypto struct in a_crypto
  58. *
  59. * \param A valid sdp_crypto struct
  60. *
  61. * \retval 0 success
  62. * \retval nonzero failure
  63. */
  64. int sdp_crypto_offer(struct sdp_crypto *p, int taglen);
  65. /*! \brief Return the a_crypto value of the sdp_crypto struct
  66. *
  67. * \param p An sdp_crypto struct that has had sdp_crypto_offer called
  68. *
  69. * \retval The value of the a_crypto for p
  70. */
  71. const char *sdp_crypto_attrib(struct sdp_crypto *p);
  72. #endif /* _SDP_CRYPTO_H */