1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2017 - 2018, Intel Corporation
4  * All rights reserved.
5  */
6 #ifndef COMMAND_ATTRS_H
7 #define COMMAND_ATTRS_H
8 
9 #include <glib.h>
10 #include <glib-object.h>
11 #include <stdint.h>
12 #include <stdlib.h>
13 
14 #include <tss2/tss2_tpm2_types.h>
15 
16 G_BEGIN_DECLS
17 
18 typedef struct _CommandAttrsClass {
19     GObjectClass    parent;
20 } CommandAttrsClass;
21 
22 typedef struct _CommandAttrs {
23     GObject                parent_instance;
24     TPMA_CC               *command_attrs;
25     UINT32                 count;
26 } CommandAttrs;
27 
28 #include "tpm2.h"
29 
30 #define TYPE_COMMAND_ATTRS              (command_attrs_get_type   ())
31 #define COMMAND_ATTRS(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj),   TYPE_COMMAND_ATTRS, CommandAttrs))
32 #define COMMAND_ATTRS_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST    ((klass), TYPE_COMMAND_ATTRS, CommandAttrsClass))
33 #define IS_COMMAND_ATTRS(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj),   TYPE_COMMAND_ATTRS))
34 #define IS_COMMAND_ATTRS_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE    ((klass), TYPE_COMMAND_ATTRS))
35 #define COMMAND_ATTRS_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS  ((obj),   TYPE_COMMAND_ATTRS, CommandAttrsClass))
36 
37 GType            command_attrs_get_type    (void);
38 CommandAttrs*    command_attrs_new         (void);
39 gint             command_attrs_init_tpm    (CommandAttrs     *attrs,
40                                             Tpm2 *tpm2);
41 TPMA_CC          command_attrs_from_cc     (CommandAttrs     *attrs,
42                                             TPM2_CC            command_code);
43 
44 G_END_DECLS
45 #endif /* COMMAND_ATTRS_H */
46