2 * Copyright (C) 2017 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * @defgroup imv_swima imv_swima
18 * @ingroup libimcv_plugins
20 * @defgroup imv_swima_state_t imv_swima_state
21 * @{ @ingroup imv_swima
24 #ifndef IMV_SWIMA_STATE_H_
25 #define IMV_SWIMA_STATE_H_
27 #include <imv/imv_state.h>
28 #include <swima/swima_inventory.h>
29 #include <swima/swima_events.h>
34 typedef struct imv_swima_state_t imv_swima_state_t
;
35 typedef enum imv_swima_handshake_state_t imv_swima_handshake_state_t
;
38 * IMV OS Handshake States (state machine)
40 enum imv_swima_handshake_state_t
{
42 IMV_SWIMA_STATE_WORKITEMS
,
47 * Internal state of an imv_swima_t connection instance
49 struct imv_swima_state_t
{
52 * imv_state_t interface
54 imv_state_t interface
;
57 * Set state of the handshake
59 * @param new_state the handshake state of IMV
61 void (*set_handshake_state
)(imv_swima_state_t
*this,
62 imv_swima_handshake_state_t new_state
);
65 * Get state of the handshake
67 * @return the handshake state of IMV
69 imv_swima_handshake_state_t (*get_handshake_state
)(imv_swima_state_t
*this);
72 * Set the SWID request ID
74 * @param request_id SWID request ID to be set
76 void (*set_request_id
)(imv_swima_state_t
*this, uint32_t request_id
);
79 * Get the SWID request ID
81 * @return SWID request ID
83 uint32_t (*get_request_id
)(imv_swima_state_t
*this);
86 * Set or extend the SWID Tag ID inventory in the state
88 * @param inventory SWID Tags ID inventory to be added
90 void (*set_inventory
)(imv_swima_state_t
*this, swima_inventory_t
*inventory
);
93 * Get the encoding of the complete SWID Tag ID inventory
95 * @return SWID Tags ID inventory as a JSON array
97 json_object
* (*get_inventory
)(imv_swima_state_t
*this);
100 * Set or extend the SWID Tag ID Events in the state
102 * @param inventory SWID Tags ID inventory to be added
104 void (*set_events
)(imv_swima_state_t
*this, swima_events_t
*events
);
107 * Get the encoding of the complete Software ID Events
109 * @return Software ID events as a JSON array
111 json_object
* (*get_events
)(imv_swima_state_t
*this);
114 * Set the number of still missing SW [ID] records or envents
116 * @param count Number of missing SW [ID] records or envents
118 void (*set_missing
)(imv_swima_state_t
*this, uint32_t count
);
121 * Get the number of still missing SWID Tags or Tag IDs
123 * @result Number of missing SWID Tags or Tag IDs
125 uint32_t (*get_missing
)(imv_swima_state_t
*this);
128 * Set [or with multiple attributes increment] SWID Tag [ID] counters
130 * @param tag_id_count Number of received SWID Tag IDs
131 * @param tag_count Number of received SWID Tags
132 * @param imc_id SWID IMC ID
134 void (*set_count
)(imv_swima_state_t
*this, int tag_id_count
, int tag_count
,
138 * Set [or with multiple attributes increment] SWID Tag [ID] counters
140 * @param tag_id_count Number of received SWID Tag IDs
141 * @param tag_count Number of received SWID Tags
143 void (*get_count
)(imv_swima_state_t
*this, int *tag_id_count
, int *tag_count
);
148 * @return SWID IMC ID
150 TNC_UInt32 (*get_imc_id
)(imv_swima_state_t
*this);
154 * Create an imv_swima_state_t instance
156 * @param id connection ID
158 imv_state_t
* imv_swima_state_create(TNC_ConnectionID id
);
160 #endif /** IMV_SWIMA_STATE_H_ @}*/