/work/fwupd-jcat-struct.c
Line | Count | Source |
1 | | /* |
2 | | * This file is auto-generated, do not modify! |
3 | | * |
4 | | * SPDX-License-Identifier: LGPL-2.1-or-later |
5 | | */ |
6 | | |
7 | | #include "config.h" |
8 | | |
9 | | #include <glib.h> |
10 | | |
11 | | #include "fwupd-jcat-struct.h" |
12 | | |
13 | | #ifdef G_LOG_DOMAIN |
14 | | #undef G_LOG_DOMAIN |
15 | | #endif |
16 | | #define G_LOG_DOMAIN "FuStruct" |
17 | | |
18 | | /** |
19 | | * fwupd_jcat_blob_kind_to_string: |
20 | | * @val: value, e.g. %FWUPD_JCAT_BLOB_KIND_SHA256 |
21 | | * |
22 | | * Converts an enumerated value to a string. |
23 | | * |
24 | | * Returns: identifier string |
25 | | * |
26 | | * Since: 2.1.3 |
27 | | **/ |
28 | | const gchar * |
29 | | fwupd_jcat_blob_kind_to_string(FwupdJcatBlobKind val) |
30 | 0 | { |
31 | 0 | if (val == FWUPD_JCAT_BLOB_KIND_SHA256) |
32 | 0 | return "sha256"; |
33 | 0 | if (val == FWUPD_JCAT_BLOB_KIND_GPG) |
34 | 0 | return "gpg"; |
35 | 0 | if (val == FWUPD_JCAT_BLOB_KIND_PKCS7) |
36 | 0 | return "pkcs7"; |
37 | 0 | if (val == FWUPD_JCAT_BLOB_KIND_SHA1) |
38 | 0 | return "sha1"; |
39 | 0 | if (val == FWUPD_JCAT_BLOB_KIND_BT_MANIFEST) |
40 | 0 | return "bt-manifest"; |
41 | 0 | if (val == FWUPD_JCAT_BLOB_KIND_BT_CHECKPOINT) |
42 | 0 | return "bt-checkpoint"; |
43 | 0 | if (val == FWUPD_JCAT_BLOB_KIND_BT_INCLUSION_PROOF) |
44 | 0 | return "bt-inclusion-proof"; |
45 | 0 | if (val == FWUPD_JCAT_BLOB_KIND_BT_VERIFIER) |
46 | 0 | return "bt-verifier"; |
47 | 0 | if (val == FWUPD_JCAT_BLOB_KIND_ED25519) |
48 | 0 | return "ed25519"; |
49 | 0 | if (val == FWUPD_JCAT_BLOB_KIND_SHA512) |
50 | 0 | return "sha512"; |
51 | 0 | if (val == FWUPD_JCAT_BLOB_KIND_BT_LOGINDEX) |
52 | 0 | return "bt-logindex"; |
53 | 0 | return NULL; |
54 | 0 | } |
55 | | /** |
56 | | * fwupd_jcat_blob_kind_from_string: |
57 | | * @val: (nullable): a string, e.g. `sha256` |
58 | | * |
59 | | * Converts a string to an enumerated value. |
60 | | * |
61 | | * Returns: enumerated value |
62 | | * |
63 | | * Since: 2.1.3 |
64 | | **/ |
65 | | FwupdJcatBlobKind |
66 | | fwupd_jcat_blob_kind_from_string(const gchar *val) |
67 | 0 | { |
68 | 0 | if (g_strcmp0(val, "sha256") == 0) |
69 | 0 | return FWUPD_JCAT_BLOB_KIND_SHA256; |
70 | 0 | if (g_strcmp0(val, "gpg") == 0) |
71 | 0 | return FWUPD_JCAT_BLOB_KIND_GPG; |
72 | 0 | if (g_strcmp0(val, "pkcs7") == 0) |
73 | 0 | return FWUPD_JCAT_BLOB_KIND_PKCS7; |
74 | 0 | if (g_strcmp0(val, "sha1") == 0) |
75 | 0 | return FWUPD_JCAT_BLOB_KIND_SHA1; |
76 | 0 | if (g_strcmp0(val, "bt-manifest") == 0) |
77 | 0 | return FWUPD_JCAT_BLOB_KIND_BT_MANIFEST; |
78 | 0 | if (g_strcmp0(val, "bt-checkpoint") == 0) |
79 | 0 | return FWUPD_JCAT_BLOB_KIND_BT_CHECKPOINT; |
80 | 0 | if (g_strcmp0(val, "bt-inclusion-proof") == 0) |
81 | 0 | return FWUPD_JCAT_BLOB_KIND_BT_INCLUSION_PROOF; |
82 | 0 | if (g_strcmp0(val, "bt-verifier") == 0) |
83 | 0 | return FWUPD_JCAT_BLOB_KIND_BT_VERIFIER; |
84 | 0 | if (g_strcmp0(val, "ed25519") == 0) |
85 | 0 | return FWUPD_JCAT_BLOB_KIND_ED25519; |
86 | 0 | if (g_strcmp0(val, "sha512") == 0) |
87 | 0 | return FWUPD_JCAT_BLOB_KIND_SHA512; |
88 | 0 | if (g_strcmp0(val, "bt-logindex") == 0) |
89 | 0 | return FWUPD_JCAT_BLOB_KIND_BT_LOGINDEX; |
90 | 0 | return FWUPD_JCAT_BLOB_KIND_UNKNOWN; |
91 | 0 | } |
92 | | |
93 | | /** |
94 | | * fwupd_jcat_blob_method_to_string: |
95 | | * @val: value, e.g. %FWUPD_JCAT_BLOB_METHOD_CHECKSUM |
96 | | * |
97 | | * Converts an enumerated value to a string. |
98 | | * |
99 | | * Returns: identifier string |
100 | | * |
101 | | * Since: 2.1.3 |
102 | | **/ |
103 | | const gchar * |
104 | | fwupd_jcat_blob_method_to_string(FwupdJcatBlobMethod val) |
105 | 0 | { |
106 | 0 | if (val == FWUPD_JCAT_BLOB_METHOD_CHECKSUM) |
107 | 0 | return "checksum"; |
108 | 0 | if (val == FWUPD_JCAT_BLOB_METHOD_SIGNATURE) |
109 | 0 | return "signature"; |
110 | 0 | return NULL; |
111 | 0 | } |
112 | | |
113 | | /** |
114 | | * fwupd_jcat_blob_flags_to_string: |
115 | | * @val: value, e.g. %FWUPD_JCAT_BLOB_FLAG_IS_UTF8 |
116 | | * |
117 | | * Converts an enumerated value to a string. |
118 | | * |
119 | | * Returns: identifier string |
120 | | * |
121 | | * |
122 | | * Since: 2.1.3 |
123 | | **/ |
124 | | gchar * |
125 | | fwupd_jcat_blob_flags_to_string(FwupdJcatBlobFlags val) |
126 | 0 | { |
127 | 0 | const gchar *data[2] = {0}; |
128 | 0 | guint idx = 0; |
129 | 0 | if (val == FWUPD_JCAT_BLOB_FLAG_NONE) |
130 | 0 | return g_strdup("none"); |
131 | 0 | if (val & FWUPD_JCAT_BLOB_FLAG_IS_UTF8) |
132 | 0 | data[idx++] = "is-utf8"; |
133 | 0 | return g_strjoinv(",", (gchar **)data); |
134 | 0 | } |