Fork me on GitHub
 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);
34 
35 
37 typedef enum janus_dtls_role {
42 
44 typedef enum janus_dtls_state {
50 
52 typedef struct janus_dtls_srtp {
54  void *component;
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;
80  int ready;
81 #ifdef HAVE_SCTP
82 
83  janus_sctp_association *sctp;
84 #endif
86 
87 
100 void janus_dtls_srtp_incoming_msg(janus_dtls_srtp *dtls, char *buf, uint16_t len);
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 
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