refact auth

This commit is contained in:
2025-06-08 10:06:28 +01:00
parent 71b6cb7878
commit 214cf1ee04
236 changed files with 466 additions and 251 deletions

View File

@@ -1,17 +1,39 @@
#ifndef AUTH_H
#define AUTH_H
#pragma once
#include <stdbool.h>
#include <freertos/FreeRTOS.h>
#include <freertos/queue.h>
void auth_init(void); // Iniciar serviço
void auth_set_enabled(bool enabled); // Habilitar ou desabilitar leitura
bool auth_is_enabled(void); // Verificar estado
#ifdef __cplusplus
extern "C" {
#endif
bool auth_add_tag(const char *tag); // Adiciona uma tag válida
bool auth_remove_tag(const char *tag); // Remove tag
bool auth_tag_exists(const char *tag); // Verifica se tag é válida
void auth_list_tags(void); // Opcional: listar no log
#define AUTH_TAG_MAX_LEN 20
typedef struct {
char tag[AUTH_TAG_MAX_LEN];
bool authorized;
} auth_event_t;
// Inicializa autenticação (ex: tabela de tags)
void auth_init(void);
// Ativa ou desativa o sistema de autenticação
void auth_set_enabled(bool value);
bool auth_is_enabled(void);
// Gerenciamento de tags
bool auth_add_tag(const char *tag);
bool auth_remove_tag(const char *tag);
bool auth_tag_exists(const char *tag);
void auth_list_tags(void);
// Integração com fila de eventos
void auth_set_event_queue(QueueHandle_t queue);
#ifdef __cplusplus
}
#endif
#endif // AUTH_H