This repository has been archived on 2022-01-16. You can view files and clone it, but cannot push or open issues or pull requests.
corelibs/src/encoding/baseven/baseven.h

43 lines
1.4 KiB
C

/*
* This file is part of corelibs. (https://git.redxen.eu/corelibs)
* Copyright (c) 2021 Alex-David Denes
*
* corelibs is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* corelibs is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with corelibs. If not, see <https://www.gnu.org/licenses/>.
*/
#include "types/error/error.h"
#include <stdbool.h> // bool
#include <stddef.h> // size_t
#include <stdint.h> // uintmax_t
#ifndef CORELIBS_GUARD_BASEVEN
#define CORELIBS_GUARD_BASEVEN
typedef struct cl_baseven_t cl_baseven_t;
struct corelibs_baseven_interface {
cl_error_t (*const encode) (const uint8_t *src, size_t len, uint8_t *dest, size_t cap),
(*const decode) (const uint8_t *src, size_t len, uint8_t *dest, size_t cap);
const struct {
uintmax_t (*const decoded) (uintmax_t enc_size),
(*const encoded) (uintmax_t dec_size);
} size;
};
extern const struct corelibs_baseven_interface cl_baseven;
#endif /* CORELIBS_GUARD_BASEVEN */