summaryrefslogtreecommitdiff
path: root/gcr/gcr-certificate-field-private.h
blob: bfd5bcf668a2e934f2b13d5f42ef952b50048726 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
 * Copyright 2021 Collabora Ltd.
 * Copyright Corentin Noël <corentin.noel@collabora.com>
 * SPDX-License-Identifier: LGPL-2.1-or-later
 */

#ifndef __GCR_CERTIFICATE_FIELD_PRIVATE_H__
#define __GCR_CERTIFICATE_FIELD_PRIVATE_H__

#if !defined (__GCR_INSIDE_HEADER__) && !defined (GCR_COMPILATION)
#error "Only <gcr/gcr.h> can be included directly."
#endif

#include "gcr-types.h"
#include "gcr-certificate-field.h"

#include <glib-object.h>

G_BEGIN_DECLS

GcrCertificateSection *_gcr_certificate_section_new (const char *label,
                                                     gboolean    important);
void                   _gcr_certificate_section_append_field (GcrCertificateSection *section,
                                                              GcrCertificateField   *field);
GcrCertificateField   *_gcr_certificate_field_new_take_value (GcrCertificateSection *section,
                                                              const char            *label,
                                                              char                  *value);
GcrCertificateField   *_gcr_certificate_field_new_take_values (GcrCertificateSection *section,
                                                               const char            *label,
                                                               GStrv                  value);
GcrCertificateField   *_gcr_certificate_field_new_take_bytes (GcrCertificateSection *section,
                                                              const char            *label,
                                                              GBytes                *bytes);

static inline void
_gcr_certificate_section_new_field_take_value (GcrCertificateSection *section,
                                               const char            *label,
                                               char                  *value)
{
	GcrCertificateField *field = _gcr_certificate_field_new_take_value (section, label, value);
	_gcr_certificate_section_append_field (section, field);
	g_object_unref (field);
}

static inline void
_gcr_certificate_section_new_field_take_values (GcrCertificateSection *section,
                                                const char            *label,
                                                GStrv                  values)
{
	GcrCertificateField *field = _gcr_certificate_field_new_take_values (section, label, values);
	_gcr_certificate_section_append_field (section, field);
	g_object_unref (field);
}

static inline void
_gcr_certificate_section_new_field_take_bytes (GcrCertificateSection *section,
                                               const char            *label,
                                               GBytes                *bytes)
{
	GcrCertificateField *field = _gcr_certificate_field_new_take_bytes (section, label, bytes);
	_gcr_certificate_section_append_field (section, field);
	g_object_unref (field);
}

static inline void
_gcr_certificate_section_new_field (GcrCertificateSection *section,
                                    const char            *label,
                                    const char            *value)
{
	_gcr_certificate_section_new_field_take_value (section, label, g_strdup (value));
}

G_END_DECLS

#endif /* __GCR_CERTIFICATE_FIELD_PRIVATE_H__ */