Files
battleship/include/network_credentials.h
T

26 lines
1.2 KiB
C

#ifndef NETWORK_CREDENTIALS_H
#define NETWORK_CREDENTIALS_H
#include <stdbool.h>
#include <stdint.h>
#include "network_state.h"
typedef struct { uint32_t magic; uint16_t version; uint16_t reserved; network_profile_t profile; uint32_t checksum; } network_credential_record_t;
typedef bool (*network_credential_read_fn)(void *context, network_credential_record_t *record);
typedef bool (*network_credential_write_fn)(void *context, const network_credential_record_t *record);
typedef bool (*network_credential_delete_fn)(void *context);
typedef struct {
void *context;
network_credential_read_fn read;
network_credential_write_fn write;
network_credential_delete_fn remove;
} network_credential_backend_t;
bool network_credential_encode(const network_profile_t *profile, network_credential_record_t *record);
bool network_credential_decode(const network_credential_record_t *record, network_profile_t *profile);
bool network_credential_load(const network_credential_backend_t *backend, network_profile_t *profile);
bool network_credential_replace(const network_credential_backend_t *backend, const network_profile_t *profile);
bool network_credential_delete(const network_credential_backend_t *backend);
#endif