SNAP structures.
More...
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <virgil/iot/provision/provision-structs.h>
Go to the source code of this file.
|
typedef uint16_t | vs_snap_transaction_id_t |
| SNAP transaction ID. More...
|
|
typedef uint32_t | vs_snap_service_id_t |
| SNAP service ID. More...
|
|
typedef uint32_t | vs_snap_element_t |
| SNAP element ID. More...
|
|
typedef vs_status_e(* | vs_netif_rx_cb_t) (struct vs_netif_t *netif, const uint8_t *data, const uint16_t data_sz, const uint8_t **packet_data, uint16_t *packet_data_sz) |
| Received data. More...
|
|
typedef vs_status_e(* | vs_netif_process_cb_t) (struct vs_netif_t *netif, const uint8_t *data, const uint16_t data_sz) |
| Preprocessed data. More...
|
|
typedef vs_status_e(* | vs_netif_tx_t) (struct vs_netif_t *netif, const uint8_t *data, const uint16_t data_sz) |
| Send data. More...
|
|
typedef vs_status_e(* | vs_netif_mac_t) (const struct vs_netif_t *netif, struct vs_mac_addr_t *mac_addr) |
| Get MAC address. More...
|
|
typedef vs_status_e(* | vs_netif_init_t) (struct vs_netif_t *netif, const vs_netif_rx_cb_t rx_cb, const vs_netif_process_cb_t process_cb) |
| Initializer. More...
|
|
typedef vs_status_e(* | vs_netif_deinit_t) (struct vs_netif_t *netif) |
| Destructor. More...
|
|
typedef vs_status_e(* | vs_snap_service_request_processor_t) (const struct vs_netif_t *netif, vs_snap_element_t element_id, const uint8_t *request, const uint16_t request_sz, uint8_t *response, const uint16_t response_buf_sz, uint16_t *response_sz) |
| SNAP Service Request Processor. More...
|
|
typedef vs_status_e(* | vs_snap_service_response_processor_t) (const struct vs_netif_t *netif, vs_snap_element_t element_id, bool is_ack, const uint8_t *response, const uint16_t response_sz) |
| SNAP Service Response Processor. More...
|
|
typedef vs_status_e(* | vs_snap_service_periodical_processor_t) (void) |
| SNAP Periodical data. More...
|
|
typedef vs_status_e(* | vs_snap_service_deinit_t) (void) |
| SNAP Service Destructor. More...
|
|
◆ ETH_ADDR_LEN
◆ ETH_CRC_LEN
◆ ETH_HEADER_LEN
◆ ETH_MIN_LEN
◆ ETH_MTU
◆ ETH_TYPE_LEN
◆ VS_ETHERTYPE_VIRGIL
◆ VS_NETIF_PACKET_BUF_SIZE
#define VS_NETIF_PACKET_BUF_SIZE (1024) |
◆ vs_netif_deinit_t
Destructor.
Callback for deinit member of vs_netif_t structure. This callback is used to destroy SNAP implementation. Called from vs_snap_deinit call.
- Parameters
-
[in] | netif | vs_netif_t Network interface. Cannot be NULL. |
- Returns
- VS_CODE_OK in case of success or error code.
◆ vs_netif_init_t
Initializer.
Callback for init member of vs_netif_t structure. This callback is used to initialize SNAP implementation. Called from vs_snap_init call.
- Parameters
-
- Returns
- VS_CODE_OK in case of success or error code.
◆ vs_netif_mac_t
Get MAC address.
Callback for mac_addr member of vs_netif_t structure. This callback is used to receive current MAC address. Called from vs_snap_mac_addr call.
- Parameters
-
[in] | netif | vs_netif_t Network interface. Cannot be NULL. |
[out] | mac_addr | vs_mac_addr_t MAC address buffer. Cannot be NULL. |
- Returns
- VS_CODE_OK in case of success or error code.
◆ vs_netif_process_cb_t
typedef vs_status_e(* vs_netif_process_cb_t) (struct vs_netif_t *netif, const uint8_t *data, const uint16_t data_sz) |
Preprocessed data.
Callback for vs_netif_init_t function callback. This callback is used to preprocess data.
- Parameters
-
[in] | netif | vs_netif_t Network interface. Cannot be NULL. |
[in] | data | Data buffer. Cannot be NULL. |
[in] | data_sz | Size in bytes of data portion. Cannot be zero. |
- Returns
- VS_CODE_OK in case of success or error code.
◆ vs_netif_rx_cb_t
typedef vs_status_e(* vs_netif_rx_cb_t) (struct vs_netif_t *netif, const uint8_t *data, const uint16_t data_sz, const uint8_t **packet_data, uint16_t *packet_data_sz) |
Received data.
Callback for vs_netif_init_t function callback. This callback is used when new SNAP data has been loaded.
- Parameters
-
[in] | netif | vs_netif_t Network interface. Cannot be NULL. |
[in] | data | Received portion of data. Cannot be NULL. |
[in] | data_sz | Size in bytes of data portion. Cannot be zero. |
[out] | packet_data | Buffer to store packed data. Cannot be NULL. |
[out] | packet_data_sz | Output buffer to store packet data size in bytes. Cannot be NULL. |
- Returns
- VS_CODE_OK in case of success or error code.
◆ vs_netif_tx_t
typedef vs_status_e(* vs_netif_tx_t) (struct vs_netif_t *netif, const uint8_t *data, const uint16_t data_sz) |
Send data.
Callback for tx member of vs_netif_t structure. This callback is used to send data. Called from vs_snap_send call.
- Parameters
-
[in] | netif | vs_netif_t Network interface. Cannot be NULL. |
[in] | data | Data buffer. Cannot be NULL. |
[in] | data_sz | Size in bytes of data portion. Cannot be zero. |
- Returns
- VS_CODE_OK in case of success or error code.
◆ vs_snap_element_t
SNAP element ID.
Used by service to identify its request/process commands.
◆ vs_snap_service_deinit_t
SNAP Service Destructor.
Callback for deinit member of vs_snap_service_t structure. This callback is called to destroy SNAP service.
- Returns
- VS_CODE_OK in case of success or error code.
◆ vs_snap_service_id_t
SNAP service ID.
Used to identify service. Library provides FLDT, INFO, PRVS services.
◆ vs_snap_service_periodical_processor_t
typedef vs_status_e(* vs_snap_service_periodical_processor_t) (void) |
SNAP Periodical data.
Callback for periodical_process member of vs_snap_service_t structure. This callback is called when there is no input data. It can be used to send some statistical data as it is done for INFO service.
- Returns
- VS_CODE_OK in case of success or error code.
◆ vs_snap_service_request_processor_t
typedef vs_status_e(* vs_snap_service_request_processor_t) (const struct vs_netif_t *netif, vs_snap_element_t element_id, const uint8_t *request, const uint16_t request_sz, uint8_t *response, const uint16_t response_buf_sz, uint16_t *response_sz) |
SNAP Service Request Processor.
Callback for request_process member of vs_snap_service_t structure. This callback is called to process SNAP service request and to prepare response if needed.
- Parameters
-
[in] | netif | Network interface. |
[in] | element_id | vs_snap_element_t service element. Normally this is command ID. |
[in] | request | Request data buffer. |
[in] | request_sz | Request data size. |
[out] | response | Response output buffer. |
[in] | response_buf_sz | Response output buffer size. |
[out] | response_sz | Stored output data size. Must be not more than response_buf_size. Cannot be NULL. |
- Returns
- VS_CODE_OK in case of success or error code.
◆ vs_snap_service_response_processor_t
SNAP Service Response Processor.
Callback for response_process member of vs_snap_service_t structure. This callback is called to process SNAP service response.
- Parameters
-
[in] | netif | Network interface. |
[in] | element_id | vs_snap_element_t service element. Normally this is command ID. |
[in] | is_ack | Boolean flag indicating successful packet receiving |
[in] | response | Response buffer. |
[in] | response_sz | Response size. |
- Returns
- VS_CODE_OK in case of success or error code.
◆ vs_snap_transaction_id_t
◆ vs_snap_device_role_e
Device roles.
Enumeration with mask bits to describe device roles.
Enumerator |
---|
VS_SNAP_DEV_GATEWAY | Gateway role.
|
VS_SNAP_DEV_THING | Thing role.
|
VS_SNAP_DEV_CONTROL | Control role.
|
VS_SNAP_DEV_LOGGER | Logger role.
|
VS_SNAP_DEV_SNIFFER | Sniffer role.
|
VS_SNAP_DEV_DEBUGGER | Debugger role.
|
VS_SNAP_DEV_INITIALIZER | Initializer role.
|
◆ vs_snap_flags_e
SNAP Flags.
Enumerator |
---|
VS_SNAP_FLAG_ACK | Confirmation about receiving a correct packet.
|
VS_SNAP_FLAG_NACK | Notification about rejecting a packet.
|