• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2018 Intel Corporation
4  * All rights reserved.
5  */
6 
7 #ifndef TCTI_MSSIM_H
8 #define TCTI_MSSIM_H
9 
10 #include <limits.h>
11 
12 #include "tcti-common.h"
13 #include "util/io.h"
14 
15 /*
16  * longest possible conf string:
17  * HOST_NAME_MAX + max char uint16 (5) + strlen ("host=,port=") (11)
18  */
19 #define TCTI_MSSIM_CONF_MAX (_HOST_NAME_MAX + 16)
20 #define TCTI_MSSIM_DEFAULT_HOST "localhost"
21 #define TCTI_MSSIM_DEFAULT_PORT 2321
22 #define MSSIM_CONF_DEFAULT_INIT { \
23     .host = TCTI_MSSIM_DEFAULT_HOST, \
24     .port = TCTI_MSSIM_DEFAULT_PORT, \
25 }
26 
27 #define TCTI_MSSIM_MAGIC 0xf05b04cd9f02728dULL
28 
29 typedef struct {
30     char *host;
31     uint16_t port;
32 } mssim_conf_t;
33 
34 typedef struct {
35     TSS2_TCTI_COMMON_CONTEXT common;
36     SOCKET platform_sock;
37     SOCKET tpm_sock;
38 /* Flag indicating if a command has been cancelled.
39  * This is a temporary flag, which will be changed into
40  * a tcti state when support for asynch operation will be added */
41     bool cancel;
42 } TSS2_TCTI_MSSIM_CONTEXT;
43 
44 #endif /* TCTI_MSSIM_H */
45