summaryrefslogtreecommitdiffstats
path: root/tinyRTP/include/tinyrtp/trtp_srtp.h
diff options
context:
space:
mode:
Diffstat (limited to 'tinyRTP/include/tinyrtp/trtp_srtp.h')
-rwxr-xr-xtinyRTP/include/tinyrtp/trtp_srtp.h78
1 files changed, 36 insertions, 42 deletions
diff --git a/tinyRTP/include/tinyrtp/trtp_srtp.h b/tinyRTP/include/tinyrtp/trtp_srtp.h
index 9992bbb..2b3ac13 100755
--- a/tinyRTP/include/tinyrtp/trtp_srtp.h
+++ b/tinyRTP/include/tinyrtp/trtp_srtp.h
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2012 Mamadou Diop
* Copyright (C) 2012-2013 Doubango Telecom <http://www.doubango.org>
-*
+*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
-*
+*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-*
+*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
@@ -26,48 +26,45 @@
#include "tinyrtp_config.h"
#if HAVE_SRTP
-# include "tsk_common.h"
+# include "tsk_common.h"
# include <srtp/srtp.h>
struct trtp_manager_s;
-typedef enum trtp_srtp_dtls_event_type_e
-{
- trtp_srtp_dtls_event_type_handshake_failed,
- trtp_srtp_dtls_event_type_handshake_succeed,
- trtp_srtp_dtls_event_type_fatal_error,
- trtp_srtp_dtls_event_type_started
+typedef enum trtp_srtp_dtls_event_type_e {
+ trtp_srtp_dtls_event_type_handshake_failed,
+ trtp_srtp_dtls_event_type_handshake_succeed,
+ trtp_srtp_dtls_event_type_fatal_error,
+ trtp_srtp_dtls_event_type_started
}
trtp_srtp_dtls_event_type_t;
-typedef enum trtp_srtp_crypto_type_e
-{
- NONE = -1,
- HMAC_SHA1_80,
- HMAC_SHA1_32,
+typedef enum trtp_srtp_crypto_type_e {
+ NONE = -1,
+ HMAC_SHA1_80,
+ HMAC_SHA1_32,
- SRTP_CRYPTO_TYPES_MAX
+ SRTP_CRYPTO_TYPES_MAX
}
trtp_srtp_crypto_type_t;
-typedef enum trtp_srtp_state_e
-{
- trtp_srtp_state_none,
- /* at this state we're able to generated DTLS "fingerprints" and SDES "crypro" attributes
+typedef enum trtp_srtp_state_e {
+ trtp_srtp_state_none,
+ /* at this state we're able to generated DTLS "fingerprints" and SDES "crypro" attributes
but neither encrypt() nor decrypt() is possible.
it's possible to move backward and disable SRTP (e.g. because of negotiation error)
it's required to move to this state in order to be able to negotiate SRTP when mode is "optional" or "mandatory"
*/
- trtp_srtp_state_enabled,
- /* at this state both required parameters (e.g. "crypto" attributes) have been successfuly proceeded
+ trtp_srtp_state_enabled,
+ /* at this state both required parameters (e.g. "crypto" attributes) have been successfuly proceeded
it's not possible to move backward and disable SRTP
if type="SDES": start()ing the engine means we'll be imediately able to encrypt()/decrypt() data
if type="DTLS": start()ing the engine doesn't mean we will be able to encrypt()/decrypt() data unless handshaking process successfuly completed
*/
- trtp_srtp_state_activated,
- /* at this state we're able to encrypt()/decrypt() SRTP data
+ trtp_srtp_state_activated,
+ /* at this state we're able to encrypt()/decrypt() SRTP data
*/
- trtp_srtp_state_started
+ trtp_srtp_state_started
}
trtp_srtp_state_t;
@@ -79,31 +76,28 @@ typedef int (*trtp_srtp_dtls_cb_f)(const void* usrdata, enum trtp_srtp_dtls_eve
#define TRTP_SRTP_LINE_IDX_LOCAL 0
#define TRTP_SRTP_LINE_IDX_REMOTE 1
-static const char* trtp_srtp_crypto_type_strings[2] =
-{
- TRTP_SRTP_AES_CM_128_HMAC_SHA1_80, TRTP_SRTP_AES_CM_128_HMAC_SHA1_32
+static const char* trtp_srtp_crypto_type_strings[2] = {
+ TRTP_SRTP_AES_CM_128_HMAC_SHA1_80, TRTP_SRTP_AES_CM_128_HMAC_SHA1_32
};
-typedef struct trtp_srtp_ctx_internal_xs
-{
- int32_t tag;
- trtp_srtp_crypto_type_t crypto_type;
- char key_str[SRTP_MAX_KEY_LEN];
- char key_bin[SRTP_MASTER_KEY_LEN];
+typedef struct trtp_srtp_ctx_internal_xs {
+ int32_t tag;
+ trtp_srtp_crypto_type_t crypto_type;
+ char key_str[SRTP_MAX_KEY_LEN];
+ char key_bin[SRTP_MASTER_KEY_LEN];
tsk_bool_t have_valid_key;
- srtp_t session;
- srtp_policy_t policy;
- tsk_bool_t initialized;
+ srtp_t session;
+ srtp_policy_t policy;
+ tsk_bool_t initialized;
}
trtp_srtp_ctx_internal_xt;
-typedef struct trtp_srtp_ctx_xs
-{
- // (rtp == rtcp) for SDES but different for DTLS
- struct trtp_srtp_ctx_internal_xs rtp;
- struct trtp_srtp_ctx_internal_xs rtcp;
+typedef struct trtp_srtp_ctx_xs {
+ // (rtp == rtcp) for SDES but different for DTLS
+ struct trtp_srtp_ctx_internal_xs rtp;
+ struct trtp_srtp_ctx_internal_xs rtcp;
}
trtp_srtp_ctx_xt;
OpenPOWER on IntegriCloud