Janus
Home
Demos
Documentation
Cite us!
Discuss Janus
Meetecho
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
dtls.h
Go to the documentation of this file.
1
15
#ifndef _JANUS_DTLS_H
16
#define _JANUS_DTLS_H
17
18
#include <inttypes.h>
19
#include <glib.h>
20
#include <srtp/srtp.h>
21
22
#include "
sctp.h
"
23
#include "
dtls-bio.h
"
24
29
gint
janus_dtls_srtp_init
(gchar *server_pem, gchar *server_key);
31
SSL_CTX *
janus_dtls_get_ssl_ctx
(
void
);
33
gchar *
janus_dtls_get_local_fingerprint
(
void
);
34
35
37
typedef
enum
janus_dtls_role
{
38
JANUS_DTLS_ROLE_ACTPASS
= -1,
39
JANUS_DTLS_ROLE_SERVER
,
40
JANUS_DTLS_ROLE_CLIENT
,
41
}
janus_dtls_role
;
42
44
typedef
enum
janus_dtls_state
{
45
JANUS_DTLS_STATE_FAILED
= -1,
46
JANUS_DTLS_STATE_CREATED
,
47
JANUS_DTLS_STATE_TRYING
,
48
JANUS_DTLS_STATE_CONNECTED
,
49
}
janus_dtls_state
;
50
52
typedef
struct
janus_dtls_srtp
{
54
void
*
component
;
56
janus_dtls_role
dtls_role
;
58
janus_dtls_state
dtls_state
;
60
SSL *
ssl
;
62
BIO *
read_bio
;
64
BIO *
write_bio
;
66
BIO *
filter_bio
;
68
gint
srtp_valid
;
70
srtp_t
srtp_in
;
72
srtp_t
srtp_out
;
74
srtp_policy_t
remote_policy
;
76
srtp_policy_t
local_policy
;
78
janus_mutex
srtp_mutex
;
80
int
ready
;
81
#ifdef HAVE_SCTP
82
83
janus_sctp_association *sctp;
84
#endif
85
}
janus_dtls_srtp
;
86
87
92
janus_dtls_srtp
*
janus_dtls_srtp_create
(
void
*component,
janus_dtls_role
role);
95
void
janus_dtls_srtp_handshake
(
janus_dtls_srtp
*dtls);
100
void
janus_dtls_srtp_incoming_msg
(
janus_dtls_srtp
*dtls,
char
*buf, uint16_t len);
103
void
janus_dtls_srtp_send_alert
(
janus_dtls_srtp
*dtls);
106
void
janus_dtls_srtp_destroy
(
janus_dtls_srtp
*dtls);
107
112
void
janus_dtls_callback
(
const
SSL *ssl,
int
where,
int
ret);
113
118
int
janus_dtls_verify_callback
(
int
preverify_ok, X509_STORE_CTX *ctx);
119
123
void
janus_dtls_fd_bridge
(
janus_dtls_srtp
*dtls);
124
125
#ifdef HAVE_SCTP
126
130
void
janus_dtls_wrap_sctp_data(
janus_dtls_srtp
*dtls,
char
*buf,
int
len);
131
137
int
janus_dtls_send_sctp_data(
janus_dtls_srtp
*dtls,
char
*buf,
int
len);
138
143
void
janus_dtls_notify_data(
janus_dtls_srtp
*dtls,
char
*buf,
int
len);
144
#endif
145
150
gboolean
janus_dtls_retry
(gpointer stack);
151
152
156
const
gchar *
janus_get_srtp_error
(
int
error);
157
161
const
gchar *
janus_get_dtls_srtp_state
(
janus_dtls_state
state);
162
166
const
gchar *
janus_get_dtls_srtp_role
(
janus_dtls_role
role);
167
168
169
#endif