• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2014, Ericsson AB. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without modification,
5  * are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright notice, this
8  * list of conditions and the following disclaimer.
9  *
10  * 2. Redistributions in binary form must reproduce the above copyright notice, this
11  * list of conditions and the following disclaimer in the documentation and/or other
12  * materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17  * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
18  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
21  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
23  * OF SUCH DAMAGE.
24  */
25 
26 #ifndef gstdtlsagent_h
27 #define gstdtlsagent_h
28 
29 #include "gstdtlscertificate.h"
30 
31 #include <glib-object.h>
32 
33 G_BEGIN_DECLS
34 
35 #define GST_TYPE_DTLS_AGENT            (gst_dtls_agent_get_type())
36 #define GST_DTLS_AGENT(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DTLS_AGENT, GstDtlsAgent))
37 #define GST_DTLS_AGENT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DTLS_AGENT, GstDtlsAgentClass))
38 #define GST_IS_DTLS_AGENT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DTLS_AGENT))
39 #define GST_IS_DTLS_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DTLS_AGENT))
40 #define GST_DTLS_AGENT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_DTLS_AGENT, GstDtlsAgentClass))
41 
42 typedef gpointer GstDtlsAgentContext;
43 
44 typedef struct _GstDtlsAgent        GstDtlsAgent;
45 typedef struct _GstDtlsAgentClass   GstDtlsAgentClass;
46 typedef struct _GstDtlsAgentPrivate GstDtlsAgentPrivate;
47 
48 /*
49  * GstDtlsAgent:
50  *
51  * A context for creating GstDtlsConnections with a GstDtlsCertificate.
52  * GstDtlsAgent needs to be constructed with the "certificate" property set.
53  */
54 struct _GstDtlsAgent {
55     GObject parent_instance;
56 
57     GstDtlsAgentPrivate *priv;
58 };
59 
60 struct _GstDtlsAgentClass {
61     GObjectClass parent_class;
62 };
63 
64 GType gst_dtls_agent_get_type(void) G_GNUC_CONST;
65 
66 /*
67  * Returns the certificate used by the agent.
68  */
69 GstDtlsCertificate *gst_dtls_agent_get_certificate(GstDtlsAgent *);
70 
71 /*
72  * Returns the certificate used by the agent, in PEM format.
73  */
74 gchar *gst_dtls_agent_get_certificate_pem(GstDtlsAgent *self);
75 
76 /* internal */
77 void _gst_dtls_init_openssl(void);
78 const GstDtlsAgentContext _gst_dtls_agent_peek_context(GstDtlsAgent *);
79 
80 G_END_DECLS
81 
82 #endif /* gstdtlsagent_h */
83