OLD | NEW |
1 /* | 1 /* |
2 * srtp.h | 2 * srtp.h |
3 * | 3 * |
4 * interface to libsrtp | 4 * interface to libsrtp |
5 * | 5 * |
6 * David A. McGrew | 6 * David A. McGrew |
7 * Cisco Systems, Inc. | 7 * Cisco Systems, Inc. |
8 */ | 8 */ |
9 /* | 9 /* |
10 * | 10 * |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 */ | 43 */ |
44 | 44 |
45 | 45 |
46 #ifndef SRTP_H | 46 #ifndef SRTP_H |
47 #define SRTP_H | 47 #define SRTP_H |
48 | 48 |
49 #ifdef __cplusplus | 49 #ifdef __cplusplus |
50 extern "C" { | 50 extern "C" { |
51 #endif | 51 #endif |
52 | 52 |
53 #include "crypto_kernel.h" | 53 #include <stdint.h> |
| 54 #include "crypto.h" |
| 55 #include "crypto_types.h" |
| 56 #include "err.h" |
54 | 57 |
55 /** | 58 /** |
56 * @defgroup SRTP Secure RTP | 59 * @defgroup SRTP Secure RTP |
57 * | 60 * |
58 * @brief libSRTP provides functions for protecting RTP and RTCP. See | 61 * @brief libSRTP provides functions for protecting RTP and RTCP. See |
59 * Section @ref Overview for an introduction to the use of the library. | 62 * Section @ref Overview for an introduction to the use of the library. |
60 * | 63 * |
61 * @{ | 64 * @{ |
62 */ | 65 */ |
63 | 66 |
(...skipping 17 matching lines...) Expand all Loading... |
81 /** | 84 /** |
82 * SRTP_MAX_TRAILER_LEN is the maximum length of the SRTP trailer | 85 * SRTP_MAX_TRAILER_LEN is the maximum length of the SRTP trailer |
83 * (authentication tag and MKI) supported by libSRTP. This value is | 86 * (authentication tag and MKI) supported by libSRTP. This value is |
84 * the maximum number of octets that will be added to an RTP packet by | 87 * the maximum number of octets that will be added to an RTP packet by |
85 * srtp_protect(). | 88 * srtp_protect(). |
86 * | 89 * |
87 * @brief the maximum number of octets added by srtp_protect(). | 90 * @brief the maximum number of octets added by srtp_protect(). |
88 */ | 91 */ |
89 #define SRTP_MAX_TRAILER_LEN SRTP_MAX_TAG_LEN | 92 #define SRTP_MAX_TRAILER_LEN SRTP_MAX_TAG_LEN |
90 | 93 |
| 94 /* |
| 95 * SRTP_AEAD_SALT_LEN is the length of the SALT values used with |
| 96 * GCM mode. GCM mode requires an IV. The SALT value is used |
| 97 * as part of the IV formation logic applied to each RTP packet. |
| 98 */ |
| 99 #define SRTP_AEAD_SALT_LEN 12 |
| 100 #define AES_128_GCM_KEYSIZE_WSALT SRTP_AEAD_SALT_LEN + 16 |
| 101 #define AES_192_GCM_KEYSIZE_WSALT SRTP_AEAD_SALT_LEN + 24 |
| 102 #define AES_256_GCM_KEYSIZE_WSALT SRTP_AEAD_SALT_LEN + 32 |
| 103 |
| 104 |
| 105 |
91 /* | 106 /* |
92 * nota bene: since libSRTP doesn't support the use of the MKI, the | 107 * nota bene: since libSRTP doesn't support the use of the MKI, the |
93 * SRTP_MAX_TRAILER_LEN value is just the maximum tag length | 108 * SRTP_MAX_TRAILER_LEN value is just the maximum tag length |
94 */ | 109 */ |
95 | 110 |
96 /** | 111 /** |
97 * @brief sec_serv_t describes a set of security services. | 112 * @brief sec_serv_t describes a set of security services. |
98 * | 113 * |
99 * A sec_serv_t enumeration is used to describe the particular | 114 * A sec_serv_t enumeration is used to describe the particular |
100 * security services that will be applied by a particular crypto | 115 * security services that will be applied by a particular crypto |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 * | 312 * |
298 * The sequence numbers of the RTP packets presented to this function | 313 * The sequence numbers of the RTP packets presented to this function |
299 * need not be consecutive, but they @b must be out of order by less | 314 * need not be consecutive, but they @b must be out of order by less |
300 * than 2^15 = 32,768 packets. | 315 * than 2^15 = 32,768 packets. |
301 * | 316 * |
302 * @warning This function assumes that it can write the authentication | 317 * @warning This function assumes that it can write the authentication |
303 * tag into the location in memory immediately following the RTP | 318 * tag into the location in memory immediately following the RTP |
304 * packet, and assumes that the RTP packet is aligned on a 32-bit | 319 * packet, and assumes that the RTP packet is aligned on a 32-bit |
305 * boundary. | 320 * boundary. |
306 * | 321 * |
| 322 * @warning This function assumes that it can write SRTP_MAX_TRAILER_LEN |
| 323 * into the location in memory immediately following the RTP packet. |
| 324 * Callers MUST ensure that this much writable memory is available in |
| 325 * the buffer that holds the RTP packet. |
| 326 * |
307 * @param ctx is the SRTP context to use in processing the packet. | 327 * @param ctx is the SRTP context to use in processing the packet. |
308 * | 328 * |
309 * @param rtp_hdr is a pointer to the RTP packet (before the call); after | 329 * @param rtp_hdr is a pointer to the RTP packet (before the call); after |
310 * the function returns, it points to the srtp packet. | 330 * the function returns, it points to the srtp packet. |
311 * | 331 * |
312 * @param len_ptr is a pointer to the length in octets of the complete | 332 * @param len_ptr is a pointer to the length in octets of the complete |
313 * RTP packet (header and body) before the function call, and of the | 333 * RTP packet (header and body) before the function call, and of the |
314 * complete SRTP packet after the call, if err_status_ok was returned. | 334 * complete SRTP packet after the call, if err_status_ok was returned. |
315 * Otherwise, the value of the data to which it points is undefined. | 335 * Otherwise, the value of the data to which it points is undefined. |
316 * | 336 * |
(...skipping 18 matching lines...) Expand all Loading... |
335 * otherwise, no assumptions should be made about the value of either | 355 * otherwise, no assumptions should be made about the value of either |
336 * data elements. | 356 * data elements. |
337 * | 357 * |
338 * The sequence numbers of the RTP packets presented to this function | 358 * The sequence numbers of the RTP packets presented to this function |
339 * need not be consecutive, but they @b must be out of order by less | 359 * need not be consecutive, but they @b must be out of order by less |
340 * than 2^15 = 32,768 packets. | 360 * than 2^15 = 32,768 packets. |
341 * | 361 * |
342 * @warning This function assumes that the SRTP packet is aligned on a | 362 * @warning This function assumes that the SRTP packet is aligned on a |
343 * 32-bit boundary. | 363 * 32-bit boundary. |
344 * | 364 * |
345 * @param ctx is a pointer to the srtp_t which applies to the | 365 * @param ctx is the SRTP session which applies to the particular packet. |
346 * particular packet. | |
347 * | 366 * |
348 * @param srtp_hdr is a pointer to the header of the SRTP packet | 367 * @param srtp_hdr is a pointer to the header of the SRTP packet |
349 * (before the call). after the function returns, it points to the | 368 * (before the call). after the function returns, it points to the |
350 * rtp packet if err_status_ok was returned; otherwise, the value of | 369 * rtp packet if err_status_ok was returned; otherwise, the value of |
351 * the data to which it points is undefined. | 370 * the data to which it points is undefined. |
352 * | 371 * |
353 * @param len_ptr is a pointer to the length in octets of the complete | 372 * @param len_ptr is a pointer to the length in octets of the complete |
354 * srtp packet (header and body) before the function call, and of the | 373 * srtp packet (header and body) before the function call, and of the |
355 * complete rtp packet after the call, if err_status_ok was returned. | 374 * complete rtp packet after the call, if err_status_ok was returned. |
356 * Otherwise, the value of the data to which it points is undefined. | 375 * Otherwise, the value of the data to which it points is undefined. |
(...skipping 12 matching lines...) Expand all Loading... |
369 srtp_unprotect(srtp_t ctx, void *srtp_hdr, int *len_ptr); | 388 srtp_unprotect(srtp_t ctx, void *srtp_hdr, int *len_ptr); |
370 | 389 |
371 | 390 |
372 /** | 391 /** |
373 * @brief srtp_create() allocates and initializes an SRTP session. | 392 * @brief srtp_create() allocates and initializes an SRTP session. |
374 | 393 |
375 * The function call srtp_create(session, policy, key) allocates and | 394 * The function call srtp_create(session, policy, key) allocates and |
376 * initializes an SRTP session context, applying the given policy and | 395 * initializes an SRTP session context, applying the given policy and |
377 * key. | 396 * key. |
378 * | 397 * |
379 * @param session is the SRTP session to which the policy is to be added. | 398 * @param session is a pointer to the SRTP session to which the policy is |
| 399 * to be added. |
380 * | 400 * |
381 * @param policy is the srtp_policy_t struct that describes the policy | 401 * @param policy is the srtp_policy_t struct that describes the policy |
382 * for the session. The struct may be a single element, or it may be | 402 * for the session. The struct may be a single element, or it may be |
383 * the head of a list, in which case each element of the list is | 403 * the head of a list, in which case each element of the list is |
384 * processed. It may also be NULL, in which case streams should be added | 404 * processed. It may also be NULL, in which case streams should be added |
385 * later using srtp_add_stream(). The final element of the list @b must | 405 * later using srtp_add_stream(). The final element of the list @b must |
386 * have its `next' field set to NULL. | 406 * have its `next' field set to NULL. |
387 * | 407 * |
388 * @return | 408 * @return |
389 * - err_status_ok if creation succeded. | 409 * - err_status_ok if creation succeded. |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 * authentication tags be used for SRTCP. See Section 7.5 of RFC 3711 | 671 * authentication tags be used for SRTCP. See Section 7.5 of RFC 3711 |
652 * (http://www.ietf.org/rfc/rfc3711.txt). | 672 * (http://www.ietf.org/rfc/rfc3711.txt). |
653 * | 673 * |
654 * @return void. | 674 * @return void. |
655 * | 675 * |
656 */ | 676 */ |
657 | 677 |
658 void | 678 void |
659 crypto_policy_set_aes_cm_256_hmac_sha1_32(crypto_policy_t *p); | 679 crypto_policy_set_aes_cm_256_hmac_sha1_32(crypto_policy_t *p); |
660 | 680 |
| 681 /** |
| 682 * @brief crypto_policy_set_aes_cm_256_null_auth() sets a crypto |
| 683 * policy structure to an encryption-only policy |
| 684 * |
| 685 * @param p is a pointer to the policy structure to be set |
| 686 * |
| 687 * The function call crypto_policy_set_aes_cm_256_null_auth(&p) sets |
| 688 * the crypto_policy_t at location p to use the SRTP default cipher |
| 689 * (AES-256 Counter Mode), but to use no authentication method. This |
| 690 * policy is NOT RECOMMENDED unless it is unavoidable; see Section 7.5 |
| 691 * of RFC 3711 (http://www.ietf.org/rfc/rfc3711.txt). |
| 692 * |
| 693 * This function is a convenience that helps to avoid dealing directly |
| 694 * with the policy data structure. You are encouraged to initialize |
| 695 * policy elements with this function call. Doing so may allow your |
| 696 * code to be forward compatible with later versions of libSRTP that |
| 697 * include more elements in the crypto_policy_t datatype. |
| 698 * |
| 699 * @warning This policy is NOT RECOMMENDED for SRTP unless it is |
| 700 * unavoidable, and it is NOT RECOMMENDED at all for SRTCP; see |
| 701 * Section 7.5 of RFC 3711 (http://www.ietf.org/rfc/rfc3711.txt). |
| 702 * |
| 703 * @return void. |
| 704 * |
| 705 */ |
| 706 void |
| 707 crypto_policy_set_aes_cm_256_null_auth(crypto_policy_t *p); |
| 708 |
| 709 /** |
| 710 * @brief crypto_policy_set_aes_gcm_128_8_auth() sets a crypto |
| 711 * policy structure to an AEAD encryption policy. |
| 712 * |
| 713 * @param p is a pointer to the policy structure to be set |
| 714 * |
| 715 * The function call crypto_policy_set_aes_gcm_128_8_auth(&p) sets |
| 716 * the crypto_policy_t at location p to use the SRTP default cipher |
| 717 * (AES-128 Galois Counter Mode) with 8 octet auth tag. This |
| 718 * policy applies confidentiality and authentication to both the |
| 719 * RTP and RTCP packets. |
| 720 * |
| 721 * This function is a convenience that helps to avoid dealing directly |
| 722 * with the policy data structure. You are encouraged to initialize |
| 723 * policy elements with this function call. Doing so may allow your |
| 724 * code to be forward compatible with later versions of libSRTP that |
| 725 * include more elements in the crypto_policy_t datatype. |
| 726 * |
| 727 * @return void. |
| 728 * |
| 729 */ |
| 730 void |
| 731 crypto_policy_set_aes_gcm_128_8_auth(crypto_policy_t *p); |
| 732 |
| 733 /** |
| 734 * @brief crypto_policy_set_aes_gcm_256_8_auth() sets a crypto |
| 735 * policy structure to an AEAD encryption policy |
| 736 * |
| 737 * @param p is a pointer to the policy structure to be set |
| 738 * |
| 739 * The function call crypto_policy_set_aes_gcm_256_8_auth(&p) sets |
| 740 * the crypto_policy_t at location p to use the SRTP default cipher |
| 741 * (AES-256 Galois Counter Mode) with 8 octet auth tag. This |
| 742 * policy applies confidentiality and authentication to both the |
| 743 * RTP and RTCP packets. |
| 744 * |
| 745 * This function is a convenience that helps to avoid dealing directly |
| 746 * with the policy data structure. You are encouraged to initialize |
| 747 * policy elements with this function call. Doing so may allow your |
| 748 * code to be forward compatible with later versions of libSRTP that |
| 749 * include more elements in the crypto_policy_t datatype. |
| 750 * |
| 751 * @return void. |
| 752 * |
| 753 */ |
| 754 void |
| 755 crypto_policy_set_aes_gcm_256_8_auth(crypto_policy_t *p); |
| 756 |
| 757 /** |
| 758 * @brief crypto_policy_set_aes_gcm_128_8_only_auth() sets a crypto |
| 759 * policy structure to an AEAD authentication-only policy |
| 760 * |
| 761 * @param p is a pointer to the policy structure to be set |
| 762 * |
| 763 * The function call crypto_policy_set_aes_gcm_128_8_only_auth(&p) sets |
| 764 * the crypto_policy_t at location p to use the SRTP default cipher |
| 765 * (AES-128 Galois Counter Mode) with 8 octet auth tag. This policy |
| 766 * applies confidentiality and authentication to the RTP packets, |
| 767 * but only authentication to the RTCP packets. |
| 768 * |
| 769 * This function is a convenience that helps to avoid dealing directly |
| 770 * with the policy data structure. You are encouraged to initialize |
| 771 * policy elements with this function call. Doing so may allow your |
| 772 * code to be forward compatible with later versions of libSRTP that |
| 773 * include more elements in the crypto_policy_t datatype. |
| 774 * |
| 775 * @return void. |
| 776 * |
| 777 */ |
| 778 void |
| 779 crypto_policy_set_aes_gcm_128_8_only_auth(crypto_policy_t *p); |
| 780 |
| 781 /** |
| 782 * @brief crypto_policy_set_aes_gcm_256_8_only_auth() sets a crypto |
| 783 * policy structure to an AEAD authentication-only policy |
| 784 * |
| 785 * @param p is a pointer to the policy structure to be set |
| 786 * |
| 787 * The function call crypto_policy_set_aes_gcm_256_8_only_auth(&p) sets |
| 788 * the crypto_policy_t at location p to use the SRTP default cipher |
| 789 * (AES-256 Galois Counter Mode) with 8 octet auth tag. This policy |
| 790 * applies confidentiality and authentication to the RTP packets, |
| 791 * but only authentication to the RTCP packets. |
| 792 * |
| 793 * This function is a convenience that helps to avoid dealing directly |
| 794 * with the policy data structure. You are encouraged to initialize |
| 795 * policy elements with this function call. Doing so may allow your |
| 796 * code to be forward compatible with later versions of libSRTP that |
| 797 * include more elements in the crypto_policy_t datatype. |
| 798 * |
| 799 * @return void. |
| 800 * |
| 801 */ |
| 802 void |
| 803 crypto_policy_set_aes_gcm_256_8_only_auth(crypto_policy_t *p); |
| 804 |
| 805 /** |
| 806 * @brief crypto_policy_set_aes_gcm_128_16_auth() sets a crypto |
| 807 * policy structure to an AEAD encryption policy. |
| 808 * |
| 809 * @param p is a pointer to the policy structure to be set |
| 810 * |
| 811 * The function call crypto_policy_set_aes_gcm_128_16_auth(&p) sets |
| 812 * the crypto_policy_t at location p to use the SRTP default cipher |
| 813 * (AES-128 Galois Counter Mode) with 16 octet auth tag. This |
| 814 * policy applies confidentiality and authentication to both the |
| 815 * RTP and RTCP packets. |
| 816 * |
| 817 * This function is a convenience that helps to avoid dealing directly |
| 818 * with the policy data structure. You are encouraged to initialize |
| 819 * policy elements with this function call. Doing so may allow your |
| 820 * code to be forward compatible with later versions of libSRTP that |
| 821 * include more elements in the crypto_policy_t datatype. |
| 822 * |
| 823 * @return void. |
| 824 * |
| 825 */ |
| 826 void |
| 827 crypto_policy_set_aes_gcm_128_16_auth(crypto_policy_t *p); |
| 828 |
| 829 /** |
| 830 * @brief crypto_policy_set_aes_gcm_256_16_auth() sets a crypto |
| 831 * policy structure to an AEAD encryption policy |
| 832 * |
| 833 * @param p is a pointer to the policy structure to be set |
| 834 * |
| 835 * The function call crypto_policy_set_aes_gcm_256_16_auth(&p) sets |
| 836 * the crypto_policy_t at location p to use the SRTP default cipher |
| 837 * (AES-256 Galois Counter Mode) with 16 octet auth tag. This |
| 838 * policy applies confidentiality and authentication to both the |
| 839 * RTP and RTCP packets. |
| 840 * |
| 841 * This function is a convenience that helps to avoid dealing directly |
| 842 * with the policy data structure. You are encouraged to initialize |
| 843 * policy elements with this function call. Doing so may allow your |
| 844 * code to be forward compatible with later versions of libSRTP that |
| 845 * include more elements in the crypto_policy_t datatype. |
| 846 * |
| 847 * @return void. |
| 848 * |
| 849 */ |
| 850 void |
| 851 crypto_policy_set_aes_gcm_256_16_auth(crypto_policy_t *p); |
| 852 |
661 | 853 |
662 /** | 854 /** |
663 * @brief srtp_dealloc() deallocates storage for an SRTP session | 855 * @brief srtp_dealloc() deallocates storage for an SRTP session |
664 * context. | 856 * context. |
665 * | 857 * |
666 * The function call srtp_dealloc(s) deallocates storage for the | 858 * The function call srtp_dealloc(s) deallocates storage for the |
667 * SRTP session context s. This function should be called no more | 859 * SRTP session context s. This function should be called no more |
668 * than one time for each of the contexts allocated by the function | 860 * than one time for each of the contexts allocated by the function |
669 * srtp_create(). | 861 * srtp_create(). |
670 * | 862 * |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 * *len_ptr) using the SRTP session context ctx. If err_status_ok is | 1008 * *len_ptr) using the SRTP session context ctx. If err_status_ok is |
817 * returned, then rtp_hdr points to the resulting SRTCP packet and | 1009 * returned, then rtp_hdr points to the resulting SRTCP packet and |
818 * *len_ptr is the number of octets in that packet; otherwise, no | 1010 * *len_ptr is the number of octets in that packet; otherwise, no |
819 * assumptions should be made about the value of either data elements. | 1011 * assumptions should be made about the value of either data elements. |
820 * | 1012 * |
821 * @warning This function assumes that it can write the authentication | 1013 * @warning This function assumes that it can write the authentication |
822 * tag into the location in memory immediately following the RTCP | 1014 * tag into the location in memory immediately following the RTCP |
823 * packet, and assumes that the RTCP packet is aligned on a 32-bit | 1015 * packet, and assumes that the RTCP packet is aligned on a 32-bit |
824 * boundary. | 1016 * boundary. |
825 * | 1017 * |
| 1018 * @warning This function assumes that it can write SRTP_MAX_TRAILER_LEN+4 |
| 1019 * into the location in memory immediately following the RTCP packet. |
| 1020 * Callers MUST ensure that this much writable memory is available in |
| 1021 * the buffer that holds the RTCP packet. |
| 1022 * |
826 * @param ctx is the SRTP context to use in processing the packet. | 1023 * @param ctx is the SRTP context to use in processing the packet. |
827 * | 1024 * |
828 * @param rtcp_hdr is a pointer to the RTCP packet (before the call); after | 1025 * @param rtcp_hdr is a pointer to the RTCP packet (before the call); after |
829 * the function returns, it points to the srtp packet. | 1026 * the function returns, it points to the srtp packet. |
830 * | 1027 * |
831 * @param pkt_octet_len is a pointer to the length in octets of the | 1028 * @param pkt_octet_len is a pointer to the length in octets of the |
832 * complete RTCP packet (header and body) before the function call, | 1029 * complete RTCP packet (header and body) before the function call, |
833 * and of the complete SRTCP packet after the call, if err_status_ok | 1030 * and of the complete SRTCP packet after the call, if err_status_ok |
834 * was returned. Otherwise, the value of the data to which it points | 1031 * was returned. Otherwise, the value of the data to which it points |
835 * is undefined. | 1032 * is undefined. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 * | 1080 * |
884 */ | 1081 */ |
885 | 1082 |
886 err_status_t | 1083 err_status_t |
887 srtp_unprotect_rtcp(srtp_t ctx, void *srtcp_hdr, int *pkt_octet_len); | 1084 srtp_unprotect_rtcp(srtp_t ctx, void *srtcp_hdr, int *pkt_octet_len); |
888 | 1085 |
889 /** | 1086 /** |
890 * @} | 1087 * @} |
891 */ | 1088 */ |
892 | 1089 |
| 1090 |
| 1091 /** |
| 1092 * @defgroup User data associated to a SRTP session. |
| 1093 * @ingroup SRTP |
| 1094 * |
| 1095 * @brief Store custom user data within a SRTP session. |
| 1096 * |
| 1097 * @{ |
| 1098 */ |
| 1099 |
| 1100 /** |
| 1101 * @brief srtp_set_user_data() stores the given pointer into the SRTP |
| 1102 * session for later retrieval. |
| 1103 * |
| 1104 * @param ctx is the srtp_t context in which the given data pointer is |
| 1105 * stored. |
| 1106 * |
| 1107 * @param data is a pointer to the custom information (struct, function, |
| 1108 * etc) associated with the SRTP session. |
| 1109 * |
| 1110 * @return void. |
| 1111 * |
| 1112 */ |
| 1113 |
| 1114 void |
| 1115 srtp_set_user_data(srtp_t ctx, void *data); |
| 1116 |
| 1117 /** |
| 1118 * @brief srtp_get_user_data() retrieves the pointer to the custom data |
| 1119 * previously stored with srtp_set_user_data(). |
| 1120 * |
| 1121 * This function is mostly useful for retrieving data associated to a |
| 1122 * SRTP session when an event fires. The user can then get such a custom |
| 1123 * data by calling this function with the session field of the |
| 1124 * srtp_event_data_t struct as argument. |
| 1125 * |
| 1126 * @param ctx is the srtp_t context in which the given data pointer was |
| 1127 * stored. |
| 1128 * |
| 1129 * @return void* pointer to the user data. |
| 1130 * |
| 1131 */ |
| 1132 |
| 1133 void* |
| 1134 srtp_get_user_data(srtp_t ctx); |
| 1135 |
| 1136 /** |
| 1137 * @} |
| 1138 */ |
| 1139 |
| 1140 |
893 /** | 1141 /** |
894 * @defgroup SRTPevents SRTP events and callbacks | 1142 * @defgroup SRTPevents SRTP events and callbacks |
895 * @ingroup SRTP | 1143 * @ingroup SRTP |
896 * | 1144 * |
897 * @brief libSRTP can use a user-provided callback function to | 1145 * @brief libSRTP can use a user-provided callback function to |
898 * handle events. | 1146 * handle events. |
899 * | 1147 * |
900 * | 1148 * |
901 * libSRTP allows a user to provide a callback function to handle | 1149 * libSRTP allows a user to provide a callback function to handle |
902 * events that need to be dealt with outside of the data plane (see | 1150 * events that need to be dealt with outside of the data plane (see |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 * | 1232 * |
985 * @param func is a pointer to a fuction that takes an srtp_event_data_t | 1233 * @param func is a pointer to a fuction that takes an srtp_event_data_t |
986 * pointer as an argument and returns void. This function | 1234 * pointer as an argument and returns void. This function |
987 * will be used by libSRTP to handle events. | 1235 * will be used by libSRTP to handle events. |
988 */ | 1236 */ |
989 | 1237 |
990 err_status_t | 1238 err_status_t |
991 srtp_install_event_handler(srtp_event_handler_func_t func); | 1239 srtp_install_event_handler(srtp_event_handler_func_t func); |
992 | 1240 |
993 /** | 1241 /** |
| 1242 * @brief Returns the version string of the library. |
| 1243 * |
| 1244 */ |
| 1245 const char *srtp_get_version_string(void); |
| 1246 |
| 1247 /** |
| 1248 * @brief Returns the numeric representation of the library version. |
| 1249 * |
| 1250 */ |
| 1251 unsigned int srtp_get_version(void); |
| 1252 |
| 1253 /** |
994 * @} | 1254 * @} |
995 */ | 1255 */ |
996 /* in host order, so outside the #if */ | 1256 /* in host order, so outside the #if */ |
997 #define SRTCP_E_BIT 0x80000000 | 1257 #define SRTCP_E_BIT 0x80000000 |
998 /* for byte-access */ | 1258 /* for byte-access */ |
999 #define SRTCP_E_BYTE_BIT 0x80 | 1259 #define SRTCP_E_BYTE_BIT 0x80 |
1000 #define SRTCP_INDEX_MASK 0x7fffffff | 1260 #define SRTCP_INDEX_MASK 0x7fffffff |
1001 | 1261 |
1002 #ifdef __cplusplus | 1262 #ifdef __cplusplus |
1003 } | 1263 } |
1004 #endif | 1264 #endif |
1005 | 1265 |
1006 #endif /* SRTP_H */ | 1266 #endif /* SRTP_H */ |
OLD | NEW |