Virgil IoT KIT
prvs-client.h
Go to the documentation of this file.
1 // Copyright (C) 2015-2020 Virgil Security, Inc.
2 //
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // (1) Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //
12 // (2) Redistributions in binary form must reproduce the above copyright
13 // notice, this list of conditions and the following disclaimer in
14 // the documentation and/or other materials provided with the
15 // distribution.
16 //
17 // (3) Neither the name of the copyright holder nor the names of its
18 // contributors may be used to endorse or promote products derived from
19 // this software without specific prior written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR
22 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 // DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
25 // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30 // IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 // POSSIBILITY OF SUCH DAMAGE.
32 //
33 // Lead Maintainer: Virgil Security Inc. <support@virgilsecurity.com>
34 
70 #ifndef VS_SECURITY_SDK_SNAP_SERVICES_PRVS_CLIENT_H
71 #define VS_SECURITY_SDK_SNAP_SERVICES_PRVS_CLIENT_H
72 
73 #if PRVS_CLIENT
74 
78 
79 #ifdef __cplusplus
80 namespace VirgilIoTKit {
81 extern "C" {
82 #endif
83 
96 typedef vs_status_e (*vs_snap_prvs_stop_wait_t)(int *condition, int expect);
97 
108 typedef vs_status_e (*vs_snap_prvs_wait_t)(uint32_t wait_ms, int *condition, int idle);
109 
111 typedef struct {
115 
124 const vs_snap_service_t *
126 
138 vs_snap_prvs_enum_devices(const vs_netif_t *netif, vs_snap_prvs_dnid_list_t *list, uint32_t wait_ms);
139 
155  const vs_mac_addr_t *mac,
156  uint8_t *asav_res,
157  uint16_t buf_sz,
158  uint32_t wait_ms);
159 
174  const vs_mac_addr_t *mac,
175  vs_snap_prvs_devi_t *device_info,
176  uint16_t buf_sz,
177  uint32_t wait_ms);
178 
196  const vs_mac_addr_t *mac,
197  const uint8_t *data,
198  uint16_t data_sz,
199  uint8_t *signature,
200  uint16_t buf_sz,
201  uint16_t *signature_sz,
202  uint32_t wait_ms);
203 
220 vs_snap_prvs_set(const vs_netif_t *netif,
221  const vs_mac_addr_t *mac,
222  vs_snap_prvs_element_e element,
223  const uint8_t *data,
224  uint16_t data_sz,
225  uint32_t wait_ms);
226 
244 vs_snap_prvs_get(const vs_netif_t *netif,
245  const vs_mac_addr_t *mac,
246  vs_snap_prvs_element_e element,
247  uint8_t *data,
248  uint16_t buf_sz,
249  uint16_t *data_sz,
250  uint32_t wait_ms);
251 
267  const vs_mac_addr_t *mac,
268  const uint8_t *data,
269  uint16_t data_sz,
270  uint32_t wait_ms);
271 
272 
286  const vs_mac_addr_t *mac,
287  const uint8_t *data,
288  uint16_t data_sz,
289  uint32_t wait_ms);
290 
291 #ifdef __cplusplus
292 } // extern "C"
293 } // namespace VirgilIoTKit
294 #endif
295 
296 #endif // PRVS_CLIENT
297 
298 #endif // VS_SECURITY_SDK_SNAP_SERVICES_PRVS_CLIENT_H
vs_snap_prvs_element_e
vs_snap_prvs_element_e
Provision operations.
Definition: provision-structs.h:143
vs_snap_prvs_stop_wait_t
vs_status_e(* vs_snap_prvs_stop_wait_t)(int *condition, int expect)
Stop waiting implementation.
Definition: prvs-client.h:96
vs_status_e
vs_status_e
Status code.
Definition: status_code.h:77
vs_mac_addr_t
MAC address.
Definition: snap-structs.h:252
vs_snap_prvs_enum_devices
vs_status_e vs_snap_prvs_enum_devices(const vs_netif_t *netif, vs_snap_prvs_dnid_list_t *list, uint32_t wait_ms)
Enumerate devices, which don't have initialization provision yet.
vs_snap_prvs_get
vs_status_e vs_snap_prvs_get(const vs_netif_t *netif, const vs_mac_addr_t *mac, vs_snap_prvs_element_e element, uint8_t *data, uint16_t buf_sz, uint16_t *data_sz, uint32_t wait_ms)
Get data.
vs_snap_prvs_device_info
vs_status_e vs_snap_prvs_device_info(const vs_netif_t *netif, const vs_mac_addr_t *mac, vs_snap_prvs_devi_t *device_info, uint16_t buf_sz, uint32_t wait_ms)
Request device information.
provision-structs.h
Provision interface structures.
vs_snap_prvs_client_impl_t::wait_func
vs_snap_prvs_wait_t wait_func
Wait implementation.
Definition: prvs-client.h:113
vs_snap_prvs_devi_t
Device information.
Definition: prvs-structs.h:83
vs_snap_prvs_sign_data
vs_status_e vs_snap_prvs_sign_data(const vs_netif_t *netif, const vs_mac_addr_t *mac, const uint8_t *data, uint16_t data_sz, uint8_t *signature, uint16_t buf_sz, uint16_t *signature_sz, uint32_t wait_ms)
Sign data.
vs_snap_prvs_client_impl_t
PRVS client implementation.
Definition: prvs-client.h:111
vs_snap_prvs_dnid_list_t
Devices enumeration.
Definition: prvs-structs.h:72
vs_snap_prvs_set
vs_status_e vs_snap_prvs_set(const vs_netif_t *netif, const vs_mac_addr_t *mac, vs_snap_prvs_element_e element, const uint8_t *data, uint16_t data_sz, uint32_t wait_ms)
Set data.
snap-structs.h
SNAP structures.
vs_snap_service_t
SNAP service descriptor.
Definition: snap-structs.h:312
vs_snap_prvs_client_impl_t::stop_wait_func
vs_snap_prvs_stop_wait_t stop_wait_func
Stop waiting implementation.
Definition: prvs-client.h:112
vs_netif_t
Network interface.
Definition: snap-structs.h:293
prvs-structs.h
PRVS structures.
vs_snap_prvs_set_tl_footer
vs_status_e vs_snap_prvs_set_tl_footer(const vs_netif_t *netif, const vs_mac_addr_t *mac, const uint8_t *data, uint16_t data_sz, uint32_t wait_ms)
Set Trust List footer.
vs_snap_prvs_wait_t
vs_status_e(* vs_snap_prvs_wait_t)(uint32_t wait_ms, int *condition, int idle)
Wait implementation.
Definition: prvs-client.h:108
vs_snap_prvs_save_provision
vs_status_e vs_snap_prvs_save_provision(const vs_netif_t *netif, const vs_mac_addr_t *mac, uint8_t *asav_res, uint16_t buf_sz, uint32_t wait_ms)
Save provision.
vs_snap_prvs_client
const vs_snap_service_t * vs_snap_prvs_client(vs_snap_prvs_client_impl_t impl)
PRVS Client SNAP Service implementation.
vs_snap_prvs_set_tl_header
vs_status_e vs_snap_prvs_set_tl_header(const vs_netif_t *netif, const vs_mac_addr_t *mac, const uint8_t *data, uint16_t data_sz, uint32_t wait_ms)
Set Trust List header.