Coverage Report

Created: 2025-11-11 06:44

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/work/fu-cros-ec-struct.c
Line
Count
Source
1
/* auto-generated, do not modify */
2
#include "config.h"
3
4
#include <glib.h>
5
6
#include "fu-cros-ec-struct.h"
7
#include "fu-byte-array.h"
8
#include "fu-mem-private.h"
9
#include "fu-string.h"
10
11
#ifdef G_LOG_DOMAIN
12
  #undef G_LOG_DOMAIN
13
#endif
14
0
#define G_LOG_DOMAIN "FuStruct"
15
16
17
18
/**
19
 * fu_struct_cros_ec_update_frame_header_ref: (skip):
20
 **/
21
FuStructCrosEcUpdateFrameHeader *
22
fu_struct_cros_ec_update_frame_header_ref(FuStructCrosEcUpdateFrameHeader *st)
23
0
{
24
0
    g_return_val_if_fail(st != NULL, NULL);
25
0
    st->refcount++;
26
0
    return st;
27
0
}
28
/**
29
 * fu_struct_cros_ec_update_frame_header_unref: (skip):
30
 **/
31
void
32
fu_struct_cros_ec_update_frame_header_unref(FuStructCrosEcUpdateFrameHeader *st)
33
0
{
34
0
    g_return_if_fail(st != NULL);
35
0
    if (st->refcount == 0) {
36
0
        g_critical("FuStructCrosEcUpdateFrameHeader refcount already zero");
37
0
        return;
38
0
    }
39
0
    if (--st->refcount > 0)
40
0
        return;
41
0
    if (st->buf != NULL)
42
0
        g_byte_array_unref(st->buf);
43
0
    g_free(st);
44
0
}
45
static FuStructCrosEcUpdateFrameHeader *
46
fu_struct_cros_ec_update_frame_header_new_internal(void)
47
0
{
48
0
    FuStructCrosEcUpdateFrameHeader *st = g_new0(FuStructCrosEcUpdateFrameHeader, 1);
49
0
    st->refcount = 1;
50
0
    return st;
51
0
}
52
53
/* getters */
54
55
/* setters */
56
/**
57
 * fu_struct_cros_ec_update_frame_header_set_block_size: (skip):
58
 **/
59
void
60
fu_struct_cros_ec_update_frame_header_set_block_size(FuStructCrosEcUpdateFrameHeader *st, guint32 value)
61
0
{
62
0
    g_return_if_fail(st != NULL);
63
0
    fu_memwrite_uint32(st->buf->data + 0, value, G_BIG_ENDIAN);
64
0
}
65
/**
66
 * fu_struct_cros_ec_update_frame_header_set_cmd_block_digest: (skip):
67
 **/
68
void
69
fu_struct_cros_ec_update_frame_header_set_cmd_block_digest(FuStructCrosEcUpdateFrameHeader *st, guint32 value)
70
0
{
71
0
    g_return_if_fail(st != NULL);
72
0
    fu_memwrite_uint32(st->buf->data + 4, value, G_BIG_ENDIAN);
73
0
}
74
/**
75
 * fu_struct_cros_ec_update_frame_header_set_cmd_block_base: (skip):
76
 **/
77
void
78
fu_struct_cros_ec_update_frame_header_set_cmd_block_base(FuStructCrosEcUpdateFrameHeader *st, guint32 value)
79
0
{
80
0
    g_return_if_fail(st != NULL);
81
0
    fu_memwrite_uint32(st->buf->data + 8, value, G_BIG_ENDIAN);
82
0
}
83
/**
84
 * fu_struct_cros_ec_update_frame_header_new: (skip):
85
 **/
86
FuStructCrosEcUpdateFrameHeader *
87
fu_struct_cros_ec_update_frame_header_new(void)
88
0
{
89
0
    FuStructCrosEcUpdateFrameHeader *st = fu_struct_cros_ec_update_frame_header_new_internal();
90
0
    st->buf = g_byte_array_sized_new(12);
91
0
    fu_byte_array_set_size(st->buf, 12, 0x0);
92
0
    return st;
93
0
}
94
/**
95
 * fu_struct_cros_ec_update_done_ref: (skip):
96
 **/
97
FuStructCrosEcUpdateDone *
98
fu_struct_cros_ec_update_done_ref(FuStructCrosEcUpdateDone *st)
99
0
{
100
0
    g_return_val_if_fail(st != NULL, NULL);
101
0
    st->refcount++;
102
0
    return st;
103
0
}
104
/**
105
 * fu_struct_cros_ec_update_done_unref: (skip):
106
 **/
107
void
108
fu_struct_cros_ec_update_done_unref(FuStructCrosEcUpdateDone *st)
109
0
{
110
0
    g_return_if_fail(st != NULL);
111
0
    if (st->refcount == 0) {
112
0
        g_critical("FuStructCrosEcUpdateDone refcount already zero");
113
0
        return;
114
0
    }
115
0
    if (--st->refcount > 0)
116
0
        return;
117
0
    if (st->buf != NULL)
118
0
        g_byte_array_unref(st->buf);
119
0
    g_free(st);
120
0
}
121
static FuStructCrosEcUpdateDone *
122
fu_struct_cros_ec_update_done_new_internal(void)
123
0
{
124
0
    FuStructCrosEcUpdateDone *st = g_new0(FuStructCrosEcUpdateDone, 1);
125
0
    st->refcount = 1;
126
0
    return st;
127
0
}
128
129
/* getters */
130
131
/* setters */
132
/**
133
 * fu_struct_cros_ec_update_done_set_value: (skip):
134
 **/
135
static void
136
fu_struct_cros_ec_update_done_set_value(FuStructCrosEcUpdateDone *st, guint32 value)
137
0
{
138
0
    g_return_if_fail(st != NULL);
139
0
    fu_memwrite_uint32(st->buf->data + 0, value, G_BIG_ENDIAN);
140
0
}
141
/**
142
 * fu_struct_cros_ec_update_done_new: (skip):
143
 **/
144
FuStructCrosEcUpdateDone *
145
fu_struct_cros_ec_update_done_new(void)
146
0
{
147
0
    FuStructCrosEcUpdateDone *st = fu_struct_cros_ec_update_done_new_internal();
148
0
    st->buf = g_byte_array_sized_new(4);
149
0
    fu_byte_array_set_size(st->buf, 4, 0x0);
150
0
    fu_struct_cros_ec_update_done_set_value(st, 0xB007AB1E);
151
0
    return st;
152
0
}
153
/**
154
 * fu_struct_cros_ec_signed_header_version_ref: (skip):
155
 **/
156
FuStructCrosEcSignedHeaderVersion *
157
fu_struct_cros_ec_signed_header_version_ref(FuStructCrosEcSignedHeaderVersion *st)
158
0
{
159
0
    g_return_val_if_fail(st != NULL, NULL);
160
0
    st->refcount++;
161
0
    return st;
162
0
}
163
/**
164
 * fu_struct_cros_ec_signed_header_version_unref: (skip):
165
 **/
166
void
167
fu_struct_cros_ec_signed_header_version_unref(FuStructCrosEcSignedHeaderVersion *st)
168
0
{
169
0
    g_return_if_fail(st != NULL);
170
0
    if (st->refcount == 0) {
171
0
        g_critical("FuStructCrosEcSignedHeaderVersion refcount already zero");
172
0
        return;
173
0
    }
174
0
    if (--st->refcount > 0)
175
0
        return;
176
0
    if (st->buf != NULL)
177
0
        g_byte_array_unref(st->buf);
178
0
    g_free(st);
179
0
}
180
181
/* getters */
182
183
/* setters */
184
/**
185
 * fu_struct_cros_ec_first_response_pdu_ref: (skip):
186
 **/
187
FuStructCrosEcFirstResponsePdu *
188
fu_struct_cros_ec_first_response_pdu_ref(FuStructCrosEcFirstResponsePdu *st)
189
0
{
190
0
    g_return_val_if_fail(st != NULL, NULL);
191
0
    st->refcount++;
192
0
    return st;
193
0
}
194
/**
195
 * fu_struct_cros_ec_first_response_pdu_unref: (skip):
196
 **/
197
void
198
fu_struct_cros_ec_first_response_pdu_unref(FuStructCrosEcFirstResponsePdu *st)
199
0
{
200
0
    g_return_if_fail(st != NULL);
201
0
    if (st->refcount == 0) {
202
0
        g_critical("FuStructCrosEcFirstResponsePdu refcount already zero");
203
0
        return;
204
0
    }
205
0
    if (--st->refcount > 0)
206
0
        return;
207
0
    if (st->buf != NULL)
208
0
        g_byte_array_unref(st->buf);
209
0
    g_free(st);
210
0
}
211
static FuStructCrosEcFirstResponsePdu *
212
fu_struct_cros_ec_first_response_pdu_new_internal(void)
213
0
{
214
0
    FuStructCrosEcFirstResponsePdu *st = g_new0(FuStructCrosEcFirstResponsePdu, 1);
215
0
    st->refcount = 1;
216
0
    return st;
217
0
}
218
219
/* getters */
220
/**
221
 * fu_struct_cros_ec_first_response_pdu_get_return_value: (skip):
222
 **/
223
guint32
224
fu_struct_cros_ec_first_response_pdu_get_return_value(const FuStructCrosEcFirstResponsePdu *st)
225
0
{
226
0
    g_return_val_if_fail(st != NULL, 0x0);
227
0
    return fu_memread_uint32(st->buf->data + 0, G_BIG_ENDIAN);
228
0
}
229
/**
230
 * fu_struct_cros_ec_first_response_pdu_get_header_type: (skip):
231
 **/
232
FuStructCrosEcFirstResponsePduHeaderType
233
fu_struct_cros_ec_first_response_pdu_get_header_type(const FuStructCrosEcFirstResponsePdu *st)
234
0
{
235
0
    g_return_val_if_fail(st != NULL, 0x0);
236
0
    return fu_memread_uint16(st->buf->data + 4, G_BIG_ENDIAN);
237
0
}
238
/**
239
 * fu_struct_cros_ec_first_response_pdu_get_protocol_version: (skip):
240
 **/
241
guint16
242
fu_struct_cros_ec_first_response_pdu_get_protocol_version(const FuStructCrosEcFirstResponsePdu *st)
243
0
{
244
0
    g_return_val_if_fail(st != NULL, 0x0);
245
0
    return fu_memread_uint16(st->buf->data + 6, G_BIG_ENDIAN);
246
0
}
247
/**
248
 * fu_struct_cros_ec_first_response_pdu_get_maximum_pdu_size: (skip):
249
 **/
250
guint32
251
fu_struct_cros_ec_first_response_pdu_get_maximum_pdu_size(const FuStructCrosEcFirstResponsePdu *st)
252
0
{
253
0
    g_return_val_if_fail(st != NULL, 0x0);
254
0
    return fu_memread_uint32(st->buf->data + 8, G_BIG_ENDIAN);
255
0
}
256
/**
257
 * fu_struct_cros_ec_first_response_pdu_get_flash_protection: (skip):
258
 **/
259
guint32
260
fu_struct_cros_ec_first_response_pdu_get_flash_protection(const FuStructCrosEcFirstResponsePdu *st)
261
0
{
262
0
    g_return_val_if_fail(st != NULL, 0x0);
263
0
    return fu_memread_uint32(st->buf->data + 12, G_BIG_ENDIAN);
264
0
}
265
/**
266
 * fu_struct_cros_ec_first_response_pdu_get_offset: (skip):
267
 **/
268
guint32
269
fu_struct_cros_ec_first_response_pdu_get_offset(const FuStructCrosEcFirstResponsePdu *st)
270
0
{
271
0
    g_return_val_if_fail(st != NULL, 0x0);
272
0
    return fu_memread_uint32(st->buf->data + 16, G_BIG_ENDIAN);
273
0
}
274
/**
275
 * fu_struct_cros_ec_first_response_pdu_get_version: (skip):
276
 **/
277
gchar *
278
fu_struct_cros_ec_first_response_pdu_get_version(const FuStructCrosEcFirstResponsePdu *st)
279
0
{
280
0
    g_return_val_if_fail(st != NULL, NULL);
281
0
    return fu_memstrsafe(st->buf->data, st->buf->len, 20, 32, NULL);
282
0
}
283
284
/* setters */
285
/**
286
 * fu_struct_cros_ec_first_response_pdu_set_return_value: (skip):
287
 **/
288
void
289
fu_struct_cros_ec_first_response_pdu_set_return_value(FuStructCrosEcFirstResponsePdu *st, guint32 value)
290
0
{
291
0
    g_return_if_fail(st != NULL);
292
0
    fu_memwrite_uint32(st->buf->data + 0, value, G_BIG_ENDIAN);
293
0
}
294
/**
295
 * fu_struct_cros_ec_first_response_pdu_set_header_type: (skip):
296
 **/
297
void
298
fu_struct_cros_ec_first_response_pdu_set_header_type(FuStructCrosEcFirstResponsePdu *st, FuStructCrosEcFirstResponsePduHeaderType value)
299
0
{
300
0
    g_return_if_fail(st != NULL);
301
0
    fu_memwrite_uint16(st->buf->data + 4, value, G_BIG_ENDIAN);
302
0
}
303
/**
304
 * fu_struct_cros_ec_first_response_pdu_set_protocol_version: (skip):
305
 **/
306
void
307
fu_struct_cros_ec_first_response_pdu_set_protocol_version(FuStructCrosEcFirstResponsePdu *st, guint16 value)
308
0
{
309
0
    g_return_if_fail(st != NULL);
310
0
    fu_memwrite_uint16(st->buf->data + 6, value, G_BIG_ENDIAN);
311
0
}
312
/**
313
 * fu_struct_cros_ec_first_response_pdu_set_maximum_pdu_size: (skip):
314
 **/
315
void
316
fu_struct_cros_ec_first_response_pdu_set_maximum_pdu_size(FuStructCrosEcFirstResponsePdu *st, guint32 value)
317
0
{
318
0
    g_return_if_fail(st != NULL);
319
0
    fu_memwrite_uint32(st->buf->data + 8, value, G_BIG_ENDIAN);
320
0
}
321
/**
322
 * fu_struct_cros_ec_first_response_pdu_set_flash_protection: (skip):
323
 **/
324
void
325
fu_struct_cros_ec_first_response_pdu_set_flash_protection(FuStructCrosEcFirstResponsePdu *st, guint32 value)
326
0
{
327
0
    g_return_if_fail(st != NULL);
328
0
    fu_memwrite_uint32(st->buf->data + 12, value, G_BIG_ENDIAN);
329
0
}
330
/**
331
 * fu_struct_cros_ec_first_response_pdu_set_offset: (skip):
332
 **/
333
void
334
fu_struct_cros_ec_first_response_pdu_set_offset(FuStructCrosEcFirstResponsePdu *st, guint32 value)
335
0
{
336
0
    g_return_if_fail(st != NULL);
337
0
    fu_memwrite_uint32(st->buf->data + 16, value, G_BIG_ENDIAN);
338
0
}
339
/**
340
 * fu_struct_cros_ec_first_response_pdu_set_version: (skip):
341
 **/
342
gboolean
343
fu_struct_cros_ec_first_response_pdu_set_version(FuStructCrosEcFirstResponsePdu *st, const gchar *value, GError **error)
344
0
{
345
0
    gsize len;
346
0
    g_return_val_if_fail(st != NULL, FALSE);
347
0
    g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
348
0
    if (value == NULL) {
349
0
        memset(st->buf->data + 20, 0x0, 32);
350
0
        return TRUE;
351
0
    }
352
0
    len = strlen(value);
353
0
    if (len > 32) {
354
0
        g_set_error(error,
355
0
                    FWUPD_ERROR,
356
0
                    FWUPD_ERROR_INVALID_DATA,
357
0
                    "string '%s' (0x%x bytes) does not fit in FuStructCrosEcFirstResponsePdu.version (0x%x bytes)",
358
0
                    value, (guint) len, (guint) 32);
359
0
        return FALSE;
360
0
    }
361
0
    return fu_memcpy_safe(st->buf->data, st->buf->len, 20, (const guint8 *)value, len, 0x0, len, error);
362
0
}
363
/**
364
 * fu_struct_cros_ec_first_response_pdu_new: (skip):
365
 **/
366
FuStructCrosEcFirstResponsePdu *
367
fu_struct_cros_ec_first_response_pdu_new(void)
368
0
{
369
0
    FuStructCrosEcFirstResponsePdu *st = fu_struct_cros_ec_first_response_pdu_new_internal();
370
0
    st->buf = g_byte_array_sized_new(60);
371
0
    fu_byte_array_set_size(st->buf, 60, 0x0);
372
0
    return st;
373
0
}