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 gstdtlscertificate_h 27 #define gstdtlscertificate_h 28 29 #include <glib-object.h> 30 31 G_BEGIN_DECLS 32 33 #define GST_TYPE_DTLS_CERTIFICATE (gst_dtls_certificate_get_type()) 34 #define GST_DTLS_CERTIFICATE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DTLS_CERTIFICATE, GstDtlsCertificate)) 35 #define GST_DTLS_CERTIFICATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DTLS_CERTIFICATE, GstDtlsCertificateClass)) 36 #define GST_IS_DTLS_CERTIFICATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DTLS_CERTIFICATE)) 37 #define GST_IS_DTLS_CERTIFICATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DTLS_CERTIFICATE)) 38 #define GST_DTLS_CERTIFICATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_DTLS_CERTIFICATE, GstDtlsCertificateClass)) 39 40 typedef gpointer GstDtlsCertificateInternalCertificate; 41 typedef gpointer GstDtlsCertificateInternalKey; 42 43 typedef struct _GstDtlsCertificate GstDtlsCertificate; 44 typedef struct _GstDtlsCertificateClass GstDtlsCertificateClass; 45 typedef struct _GstDtlsCertificatePrivate GstDtlsCertificatePrivate; 46 47 /* 48 * GstDtlsCertificate: 49 * 50 * Handles a X509 certificate and a private key. 51 * If a certificate is created without the "pem" property, a self-signed certificate is generated. 52 */ 53 struct _GstDtlsCertificate { 54 GObject parent_instance; 55 56 GstDtlsCertificatePrivate *priv; 57 }; 58 59 struct _GstDtlsCertificateClass { 60 GObjectClass parent_class; 61 }; 62 63 GType gst_dtls_certificate_get_type(void) G_GNUC_CONST; 64 65 /* internal */ 66 GstDtlsCertificateInternalCertificate _gst_dtls_certificate_get_internal_certificate(GstDtlsCertificate *); 67 GstDtlsCertificateInternalKey _gst_dtls_certificate_get_internal_key(GstDtlsCertificate *); 68 gchar *_gst_dtls_x509_to_pem(gpointer x509); 69 70 G_END_DECLS 71 72 #endif /* gstdtlscertificate_h */ 73