Virgil IoT KIT
snap.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 
52 #ifndef AP_SECURITY_SDK_SNAP_H
53 #define AP_SECURITY_SDK_SNAP_H
54 
55 #include <stdint.h>
56 
59 
60 #ifdef __cplusplus
61 namespace VirgilIoTKit {
62 extern "C" {
63 #endif
64 
79 vs_snap_init(vs_netif_t *default_netif,
80  const vs_device_manufacture_id_t manufacturer_id,
81  const vs_device_type_t device_type,
82  const vs_device_serial_t device_serial,
83  uint32_t device_roles);
84 
92 
99 
104 const vs_device_type_t *
105 vs_snap_device_type(void);
106 
111 const vs_device_serial_t *
113 
118 uint32_t
120 
125 const vs_netif_t *
127 
140 vs_snap_send(const vs_netif_t *netif, const uint8_t *data, uint16_t data_sz);
141 
152 
163 vs_snap_mac_addr(const vs_netif_t *netif, vs_mac_addr_t *mac_addr);
164 
169 const vs_mac_addr_t *
171 
186 vs_snap_send_request(const vs_netif_t *netif,
187  const vs_mac_addr_t *mac,
188  vs_snap_service_id_t service_id,
189  vs_snap_element_t element_id,
190  const uint8_t *data,
191  uint16_t data_sz);
192 
199 
200 #ifdef __cplusplus
201 } // extern "C"
202 } // namespace VirgilIoTKit
203 #endif
204 
205 #endif // AP_SECURITY_SDK_SNAP_H
vs_device_manufacture_id_t
uint8_t vs_device_manufacture_id_t[VS_DEVICE_MANUFACTURE_ID_SIZE]
Manufacture ID type.
Definition: provision-structs.h:120
vs_snap_default_netif
const vs_netif_t * vs_snap_default_netif(void)
Return device network interface.
vs_snap_mac_addr
vs_status_e vs_snap_mac_addr(const vs_netif_t *netif, vs_mac_addr_t *mac_addr)
MAC address.
vs_snap_service_id_t
uint32_t vs_snap_service_id_t
SNAP service ID.
Definition: snap-structs.h:64
vs_snap_device_manufacture
const vs_device_manufacture_id_t * vs_snap_device_manufacture(void)
Return current manufacture ID.
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_element_t
uint32_t vs_snap_element_t
SNAP element ID.
Definition: snap-structs.h:70
vs_snap_get_statistics
vs_snap_stat_t vs_snap_get_statistics(void)
Return SNAP statistics.
vs_snap_deinit
vs_status_e vs_snap_deinit()
Destroy SNAP.
vs_device_type_t
uint8_t vs_device_type_t[VS_DEVICE_TYPE_SIZE]
Device type.
Definition: provision-structs.h:127
vs_snap_device_serial
const vs_device_serial_t * vs_snap_device_serial(void)
Return current device serial number.
vs_snap_device_roles
uint32_t vs_snap_device_roles(void)
Return device role.
status_code.h
Status codes and macroses.
snap-structs.h
SNAP structures.
vs_snap_service_t
SNAP service descriptor.
Definition: snap-structs.h:312
vs_netif_t
Network interface.
Definition: snap-structs.h:293
vs_snap_device_type
const vs_device_type_t * vs_snap_device_type(void)
Return current device type.
vs_snap_broadcast_mac
const vs_mac_addr_t * vs_snap_broadcast_mac(void)
Return MAC address.
vs_snap_stat_t
SNAP statistics.
Definition: snap-structs.h:324
vs_snap_init
vs_status_e vs_snap_init(vs_netif_t *default_netif, const vs_device_manufacture_id_t manufacturer_id, const vs_device_type_t device_type, const vs_device_serial_t device_serial, uint32_t device_roles)
Init SNAP.
vs_snap_send_request
vs_status_e vs_snap_send_request(const vs_netif_t *netif, const vs_mac_addr_t *mac, vs_snap_service_id_t service_id, vs_snap_element_t element_id, const uint8_t *data, uint16_t data_sz)
Prepare and send SNAP message.
vs_snap_register_service
vs_status_e vs_snap_register_service(const vs_snap_service_t *service)
Register SNAP service.
vs_device_serial_t
uint8_t vs_device_serial_t[VS_DEVICE_SERIAL_SIZE]
Device serial number type.
Definition: provision-structs.h:134
vs_snap_send
vs_status_e vs_snap_send(const vs_netif_t *netif, const uint8_t *data, uint16_t data_sz)
Send SNAP message.