@@ -29,11 +29,8 @@
#endif
#define TYPE_QCRYPTO_TLS_CREDS "tls-creds"
-typedef struct QCryptoTLSCreds QCryptoTLSCreds;
-DECLARE_INSTANCE_CHECKER(QCryptoTLSCreds, QCRYPTO_TLS_CREDS,
- TYPE_QCRYPTO_TLS_CREDS)
-
-typedef struct QCryptoTLSCredsClass QCryptoTLSCredsClass;
+OBJECT_DECLARE_SIMPLE_TYPE(QCryptoTLSCreds, qcrypto_tls_creds,
+ QCRYPTO_TLS_CREDS, Object)
#define QCRYPTO_TLS_CREDS_DH_PARAMS "dh-params.pem"
@@ -58,10 +55,4 @@ struct QCryptoTLSCreds {
char *priority;
};
-
-struct QCryptoTLSCredsClass {
- ObjectClass parent_class;
-};
-
-
#endif /* QCRYPTO_TLSCREDS_H */
@@ -25,12 +25,8 @@
#include "qom/object.h"
#define TYPE_QCRYPTO_TLS_CREDS_ANON "tls-creds-anon"
-typedef struct QCryptoTLSCredsAnon QCryptoTLSCredsAnon;
-DECLARE_INSTANCE_CHECKER(QCryptoTLSCredsAnon, QCRYPTO_TLS_CREDS_ANON,
- TYPE_QCRYPTO_TLS_CREDS_ANON)
-
-
-typedef struct QCryptoTLSCredsAnonClass QCryptoTLSCredsAnonClass;
+OBJECT_DECLARE_SIMPLE_TYPE(QCryptoTLSCredsAnon, qcrypto_tls_creds_anon,
+ QCRYPTO_TLS_CREDS_ANON, QCryptoTLSCreds)
/**
* QCryptoTLSCredsAnon:
@@ -103,10 +99,4 @@ struct QCryptoTLSCredsAnon {
#endif
};
-
-struct QCryptoTLSCredsAnonClass {
- QCryptoTLSCredsClass parent_class;
-};
-
-
#endif /* QCRYPTO_TLSCREDSANON_H */
@@ -25,11 +25,8 @@
#include "qom/object.h"
#define TYPE_QCRYPTO_TLS_CREDS_PSK "tls-creds-psk"
-typedef struct QCryptoTLSCredsPSK QCryptoTLSCredsPSK;
-DECLARE_INSTANCE_CHECKER(QCryptoTLSCredsPSK, QCRYPTO_TLS_CREDS_PSK,
- TYPE_QCRYPTO_TLS_CREDS_PSK)
-
-typedef struct QCryptoTLSCredsPSKClass QCryptoTLSCredsPSKClass;
+OBJECT_DECLARE_SIMPLE_TYPE(QCryptoTLSCredsPSK, qcrypto_tls_creds_psk,
+ QCRYPTO_TLS_CREDS_PSK, QCryptoTLSCreds)
#define QCRYPTO_TLS_CREDS_PSKFILE "keys.psk"
@@ -98,10 +95,4 @@ struct QCryptoTLSCredsPSK {
#endif
};
-
-struct QCryptoTLSCredsPSKClass {
- QCryptoTLSCredsClass parent_class;
-};
-
-
#endif /* QCRYPTO_TLSCREDSPSK_H */
@@ -25,11 +25,8 @@
#include "qom/object.h"
#define TYPE_QCRYPTO_TLS_CREDS_X509 "tls-creds-x509"
-typedef struct QCryptoTLSCredsX509 QCryptoTLSCredsX509;
-DECLARE_INSTANCE_CHECKER(QCryptoTLSCredsX509, QCRYPTO_TLS_CREDS_X509,
- TYPE_QCRYPTO_TLS_CREDS_X509)
-
-typedef struct QCryptoTLSCredsX509Class QCryptoTLSCredsX509Class;
+OBJECT_DECLARE_SIMPLE_TYPE(QCryptoTLSCredsX509, qcrypto_tls_creds_x509,
+ QCRYPTO_TLS_CREDS_X509, QCryptoTLSCreds)
#define QCRYPTO_TLS_CREDS_X509_CA_CERT "ca-cert.pem"
#define QCRYPTO_TLS_CREDS_X509_CA_CRL "ca-crl.pem"
@@ -105,10 +102,4 @@ struct QCryptoTLSCredsX509 {
char *passwordid;
};
-
-struct QCryptoTLSCredsX509Class {
- QCryptoTLSCredsClass parent_class;
-};
-
-
#endif /* QCRYPTO_TLSCREDSX509_H */
@@ -24,6 +24,9 @@
#include "tlscredspriv.h"
#include "trace.h"
+OBJECT_DEFINE_ABSTRACT_TYPE(QCryptoTLSCreds, qcrypto_tls_creds,
+ QCRYPTO_TLS_CREDS, OBJECT)
+
#define DH_BITS 2048
#ifdef CONFIG_GNUTLS
@@ -258,20 +261,3 @@ qcrypto_tls_creds_finalize(Object *obj)
g_free(creds->dir);
g_free(creds->priority);
}
-
-
-static const TypeInfo qcrypto_tls_creds_info = {
- .parent = TYPE_OBJECT,
- .name = TYPE_QCRYPTO_TLS_CREDS,
- .instance_size = sizeof(QCryptoTLSCreds),
- .instance_init = qcrypto_tls_creds_init,
- .instance_finalize = qcrypto_tls_creds_finalize,
- .class_init = qcrypto_tls_creds_class_init,
- .class_size = sizeof(QCryptoTLSCredsClass),
- .abstract = true,
-};
-TYPE_INFO(qcrypto_tls_creds_info)
-
-
-
-
@@ -26,6 +26,9 @@
#include "qom/object_interfaces.h"
#include "trace.h"
+OBJECT_DEFINE_TYPE_WITH_INTERFACES(QCryptoTLSCredsAnon, qcrypto_tls_creds_anon,
+ QCRYPTO_TLS_CREDS_ANON, QCRYPTO_TLS_CREDS,
+ { TYPE_USER_CREATABLE }, { NULL })
#ifdef CONFIG_GNUTLS
@@ -191,20 +194,7 @@ qcrypto_tls_creds_anon_class_init(ObjectClass *oc, void *data)
}
-static const TypeInfo qcrypto_tls_creds_anon_info = {
- .parent = TYPE_QCRYPTO_TLS_CREDS,
- .name = TYPE_QCRYPTO_TLS_CREDS_ANON,
- .instance_size = sizeof(QCryptoTLSCredsAnon),
- .instance_finalize = qcrypto_tls_creds_anon_finalize,
- .class_size = sizeof(QCryptoTLSCredsAnonClass),
- .class_init = qcrypto_tls_creds_anon_class_init,
- .interfaces = (InterfaceInfo[]) {
- { TYPE_USER_CREATABLE },
- { }
- }
-};
-TYPE_INFO(qcrypto_tls_creds_anon_info)
-
-
-
-
+static void
+qcrypto_tls_creds_anon_init(Object *obj)
+{
+}
@@ -27,6 +27,10 @@
#include "trace.h"
+OBJECT_DEFINE_TYPE_WITH_INTERFACES(QCryptoTLSCredsPSK, qcrypto_tls_creds_psk,
+ QCRYPTO_TLS_CREDS_PSK, QCRYPTO_TLS_CREDS,
+ { TYPE_USER_CREATABLE }, { NULL })
+
#ifdef CONFIG_GNUTLS
static int
@@ -281,21 +285,7 @@ qcrypto_tls_creds_psk_class_init(ObjectClass *oc, void *data)
qcrypto_tls_creds_psk_prop_set_username);
}
-
-static const TypeInfo qcrypto_tls_creds_psk_info = {
- .parent = TYPE_QCRYPTO_TLS_CREDS,
- .name = TYPE_QCRYPTO_TLS_CREDS_PSK,
- .instance_size = sizeof(QCryptoTLSCredsPSK),
- .instance_finalize = qcrypto_tls_creds_psk_finalize,
- .class_size = sizeof(QCryptoTLSCredsPSKClass),
- .class_init = qcrypto_tls_creds_psk_class_init,
- .interfaces = (InterfaceInfo[]) {
- { TYPE_USER_CREATABLE },
- { }
- }
-};
-TYPE_INFO(qcrypto_tls_creds_psk_info)
-
-
-
-
+static void
+qcrypto_tls_creds_psk_init(Object *obj)
+{
+}
@@ -28,6 +28,10 @@
#include "trace.h"
+OBJECT_DEFINE_TYPE_WITH_INTERFACES(QCryptoTLSCredsX509, qcrypto_tls_creds_x509,
+ QCRYPTO_TLS_CREDS_X509, QCRYPTO_TLS_CREDS,
+ { TYPE_USER_CREATABLE }, { NULL })
+
#ifdef CONFIG_GNUTLS
#include <gnutls/x509.h>
@@ -814,23 +818,3 @@ qcrypto_tls_creds_x509_class_init(ObjectClass *oc, void *data)
qcrypto_tls_creds_x509_prop_get_passwordid,
qcrypto_tls_creds_x509_prop_set_passwordid);
}
-
-
-static const TypeInfo qcrypto_tls_creds_x509_info = {
- .parent = TYPE_QCRYPTO_TLS_CREDS,
- .name = TYPE_QCRYPTO_TLS_CREDS_X509,
- .instance_size = sizeof(QCryptoTLSCredsX509),
- .instance_init = qcrypto_tls_creds_x509_init,
- .instance_finalize = qcrypto_tls_creds_x509_finalize,
- .class_size = sizeof(QCryptoTLSCredsX509Class),
- .class_init = qcrypto_tls_creds_x509_class_init,
- .interfaces = (InterfaceInfo[]) {
- { TYPE_USER_CREATABLE },
- { }
- }
-};
-TYPE_INFO(qcrypto_tls_creds_x509_info)
-
-
-
-