Commit 013b079f authored by Daniel Salzman's avatar Daniel Salzman

contrib: move base64 and base32hex from internal

parent a5579709
......@@ -31,6 +31,10 @@ libtap/tap/float.h
libtap/tap/macros.h
samples/Makefile.am
src/Makefile.am
src/contrib/base32hex.c
src/contrib/base32hex.h
src/contrib/base64.c
src/contrib/base64.h
src/contrib/endian.h
src/contrib/getline.c
src/contrib/getline.h
......@@ -353,10 +357,6 @@ src/libknot/dnssec/rrset-sign.c
src/libknot/dnssec/rrset-sign.h
src/libknot/errcode.c
src/libknot/errcode.h
src/libknot/internal/base32hex.c
src/libknot/internal/base32hex.h
src/libknot/internal/base64.c
src/libknot/internal/base64.h
src/libknot/internal/consts.h
src/libknot/internal/errcode.c
src/libknot/internal/errcode.h
......
......@@ -24,6 +24,8 @@ AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS)
libcontrib_ladir = $(includedir)
nobase_libcontrib_la_HEADERS = \
contrib/base32hex.h \
contrib/base64.h \
contrib/endian.h \
contrib/getline.h \
contrib/print.h \
......@@ -74,8 +76,6 @@ nobase_libknot_la_HEADERS = \
libknot_internal_ladir = $(includedir)
nobase_libknot_internal_la_HEADERS = \
libknot/internal/base32hex.h \
libknot/internal/base64.h \
libknot/internal/consts.h \
libknot/internal/errcode.h \
libknot/internal/hhash.h \
......@@ -101,6 +101,8 @@ nobase_libknot_yparser_la_HEADERS = \
# dynamic: libknot sources
libcontrib_la_SOURCES = \
contrib/base32hex.c \
contrib/base64.c \
contrib/getline.c \
contrib/print.c \
contrib/string.c \
......@@ -145,8 +147,6 @@ libknot_yparser_la_SOURCES = \
$(nobase_libknot_yparser_la_HEADERS)
libknot_internal_la_SOURCES = \
libknot/internal/base32hex.c \
libknot/internal/base64.c \
libknot/internal/errcode.c \
libknot/internal/hhash.c \
libknot/internal/lists.c \
......
......@@ -14,8 +14,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libknot/internal/macros.h"
#include "libknot/internal/base32hex.h"
#include "contrib/base32hex.h"
#include "libknot/internal/errcode.h"
#include <stdlib.h>
......
......@@ -14,22 +14,20 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*!
* \file base32hex.h
*
* \author Daniel Salzman <daniel.salzman@nic.cz>
* \file
*
* \brief Base32hex implementation (RFC 4648).
*
* \note Input Base32hex string can contain a-v characters. These characters
* are considered as A-V equivalent.
*
* \addtogroup common_lib
* \addtogroup contrib
* @{
*/
#pragma once
#include <stdint.h> // uint8_t
#include <stdint.h>
/*!
* \brief Encodes binary data using Base32hex.
......@@ -43,7 +41,7 @@
* \param out_len Size of output buffer.
*
* \retval >=0 length of output string.
* \retval errcode if error.
* \retval KNOT_E* if error.
*/
int32_t base32hex_encode(const uint8_t *in,
const uint32_t in_len,
......@@ -63,7 +61,7 @@ int32_t base32hex_encode(const uint8_t *in,
* \param out Output data buffer.
*
* \retval >=0 length of output string.
* \retval errcode if error.
* \retval KNOT_E* if error.
*/
int32_t base32hex_encode_alloc(const uint8_t *in,
const uint32_t in_len,
......@@ -82,7 +80,7 @@ int32_t base32hex_encode_alloc(const uint8_t *in,
* \param out_len Size of output buffer.
*
* \retval >=0 length of output data.
* \retval errcode if error.
* \retval KNOT_E* if error.
*/
int32_t base32hex_decode(const uint8_t *in,
const uint32_t in_len,
......@@ -103,7 +101,7 @@ int32_t base32hex_decode(const uint8_t *in,
* \param out Output data buffer.
*
* \retval >=0 length of output data.
* \retval errcode if error.
* \retval KNOT_E* if error.
*/
int32_t base32hex_decode_alloc(const uint8_t *in,
const uint32_t in_len,
......
......@@ -14,8 +14,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libknot/internal/macros.h"
#include "libknot/internal/base64.h"
#include "contrib/base64.h"
#include "libknot/internal/errcode.h"
#include <stdlib.h>
......
......@@ -14,19 +14,17 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*!
* \file base64.h
*
* \author Daniel Salzman <daniel.salzman@nic.cz>
* \file
*
* \brief Base64 implementation (RFC 4648).
*
* \addtogroup common_lib
* \addtogroup contrib
* @{
*/
#pragma once
#include <stdint.h> // uint8_t
#include <stdint.h>
/*!
* \brief Encodes binary data using Base64.
......@@ -40,7 +38,7 @@
* \param out_len Size of output buffer.
*
* \retval >=0 length of output string.
* \retval errcode if error.
* \retval KNOT_E* if error.
*/
int32_t base64_encode(const uint8_t *in,
const uint32_t in_len,
......@@ -60,7 +58,7 @@ int32_t base64_encode(const uint8_t *in,
* \param out Output data buffer.
*
* \retval >=0 length of output string.
* \retval errcode if error.
* \retval KNOT_E* if error.
*/
int32_t base64_encode_alloc(const uint8_t *in,
const uint32_t in_len,
......@@ -79,7 +77,7 @@ int32_t base64_encode_alloc(const uint8_t *in,
* \param out_len Size of output buffer.
*
* \retval >=0 length of output data.
* \retval errcode if error.
* \retval KNOT_E* if error.
*/
int32_t base64_decode(const uint8_t *in,
const uint32_t in_len,
......@@ -100,7 +98,7 @@ int32_t base64_decode(const uint8_t *in,
* \param out Output data buffer.
*
* \retval >=0 length of output data.
* \retval errcode if error.
* \retval KNOT_E* if error.
*/
int32_t base64_decode_alloc(const uint8_t *in,
const uint32_t in_len,
......
......@@ -17,7 +17,6 @@
#include <assert.h>
#include "dnssec/nsec.h"
#include "libknot/internal/base32hex.h"
#include "libknot/internal/macros.h"
#include "libknot/internal/wire_ctx.h"
#include "knot/dnssec/nsec3-chain.h"
......@@ -29,6 +28,7 @@
#include "knot/dnssec/nsec-chain.h"
#include "knot/dnssec/zone-sign.h"
#include "knot/dnssec/zone-nsec.h"
#include "contrib/base32hex.h"
/* - NSEC3 node comparison -------------------------------------------------- */
......
......@@ -22,7 +22,6 @@
#include "dnssec/error.h"
#include "dnssec/nsec.h"
#include "libknot/internal/base32hex.h"
#include "libknot/descriptor.h"
#include "libknot/packet/wire.h"
#include "libknot/rrtype/nsec3.h"
......@@ -33,6 +32,7 @@
#include "knot/dnssec/zone-sign.h"
#include "knot/zone/contents.h"
#include "knot/zone/zone-diff.h"
#include "contrib/base32hex.h"
/*!
* \brief Deletes NSEC3 chain if NSEC should be used.
......
......@@ -27,8 +27,8 @@
#include "knot/dnssec/zone-nsec.h"
#include "libknot/libknot.h"
#include "libknot/dnssec/rrset-sign.h"
#include "libknot/internal/base32hex.h"
#include "libknot/internal/mempattern.h"
#include "contrib/base32hex.h"
static char *error_messages[(-ZC_ERR_UNKNOWN) + 1] = {
[-ZC_ERR_MISSING_SOA] =
......
......@@ -19,8 +19,8 @@
#include "libknot/binary.h"
#include "libknot/errcode.h"
#include "libknot/internal/base64.h"
#include "libknot/internal/macros.h"
#include "contrib/base64.h"
#include "contrib/string.h"
_public_
......
......@@ -31,11 +31,11 @@
#include "libknot/consts.h"
#include "libknot/descriptor.h"
#include "libknot/errcode.h"
#include "libknot/internal/base64.h"
#include "libknot/internal/base32hex.h"
#include "libknot/internal/macros.h"
#include "libknot/internal/utils.h"
#include "libknot/internal/wire_ctx.h"
#include "contrib/base32hex.h"
#include "contrib/base64.h"
#define TAB_WIDTH 8
#define BLOCK_WIDTH 40
......
......@@ -22,9 +22,9 @@
#include "libknot/yparser/yptrafo.h"
#include "libknot/internal/macros.h"
#include "libknot/internal/base64.h"
#include "libknot/internal/sockaddr.h"
#include "libknot/libknot.h"
#include "contrib/base64.h"
enum {
UNIT_BYTE = 'B',
......
......@@ -20,7 +20,7 @@
#include <tap/basic.h>
#include "libknot/libknot.h"
#include "libknot/internal/base32hex.h"
#include "contrib/base32hex.h"
#include "contrib/openbsd/strlcpy.h"
#define BUF_LEN 256
......
......@@ -20,7 +20,7 @@
#include <tap/basic.h>
#include "libknot/libknot.h"
#include "libknot/internal/base64.h"
#include "contrib/base64.h"
#include "contrib/openbsd/strlcpy.h"
#define BUF_LEN 256
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment