1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/dist/tools/zep_dispatch/zep_parser.h

54 lines
1.2 KiB
C

/*
* Copyright (C) 2021 Benjamin Valentin
*
* This file is subject to the terms and conditions of the GNU General Public
* License v2. See the file LICENSE for more details.
*/
#ifndef ZEP_PARSER_H
#define ZEP_PARSER_H
#include <stdbool.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Get the payload of a ZEP frame
*
* @param[in] buffer ZEP frame
* @param[in, out] len size of buffer, will contain size of payload
*
* @return pointer to payload on success
* NULL if no payload was found
*/
const void *zep_get_payload(const void *buffer, size_t *len);
/**
* @brief Parse l2 source address of a ZEP frame
*
* @param[in] buffer ZEP frame
* @param[in] len size of buffer
* @param[out] out destination for l2 address
* @param[out] out_len l2 address length
*
* @return true if l2 address was found
*/
bool zep_parse_mac(const void *buffer, size_t len, void *out, uint8_t *out_len);
/**
* @brief Set link quality information in ZEP frame
*
* @param[out] buffer ZEP frame to modify
* @param[in] lqi link quality to write to ZEP header
*/
void zep_set_lqi(void *buffer, uint8_t lqi);
#ifdef __cplusplus
}
#endif
#endif /* ZEP_PARSER_H */