From f0099bbddf52b7189f252e1ee21b1bb04bee276e Mon Sep 17 00:00:00 2001 From: Daniel Salzman Date: Tue, 25 Apr 2017 17:26:26 +0200 Subject: [PATCH] yparser: change visibility to public --- src/Makefile.am | 26 +++++++++++--------------- src/libknot/yparser/yparser.c | 8 +++++++- src/libknot/yparser/ypformat.c | 6 +++++- src/libknot/yparser/ypscheme.c | 10 ++++++++++ src/libknot/yparser/yptrafo.c | 27 +++++++++++++++++++++++++++ 5 files changed, 60 insertions(+), 17 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 9e394491e..d00f3e024 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -9,8 +9,7 @@ check-compile: lib_LTLIBRARIES = \ libknot.la noinst_LTLIBRARIES = \ - libcontrib.la \ - libknot-yparser.la + libcontrib.la AM_CPPFLAGS = \ -include $(top_builddir)/src/config.h \ @@ -99,18 +98,6 @@ endif !HAVE_LMDB libcontrib_la_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAG_VISIBILITY) libcontrib_la_LDFLAGS = $(AM_LDFLAGS) $(LDFLAG_EXCLUDE_LIBS) -# static: libknot-yparser sources -libknot_yparser_la_SOURCES = \ - libknot/yparser/yparser.c \ - libknot/yparser/yparser.h \ - libknot/yparser/ypbody.c \ - libknot/yparser/ypformat.c \ - libknot/yparser/ypformat.h \ - libknot/yparser/ypscheme.c \ - libknot/yparser/ypscheme.h \ - libknot/yparser/yptrafo.c \ - libknot/yparser/yptrafo.h - # libknot headers libknot_ladir = $(includedir) nobase_libknot_la_HEADERS = \ @@ -156,6 +143,10 @@ nobase_libknot_la_HEADERS = \ libknot/rrtype/txt.h \ libknot/tsig-op.h \ libknot/tsig.h \ + libknot/yparser/yparser.h \ + libknot/yparser/ypformat.h \ + libknot/yparser/ypscheme.h \ + libknot/yparser/yptrafo.h \ libknot/version.h # dynamic: libknot sources @@ -192,6 +183,11 @@ libknot_la_SOURCES = \ libknot/rrtype/tsig.c \ libknot/tsig-op.c \ libknot/tsig.c \ + libknot/yparser/yparser.c \ + libknot/yparser/ypbody.c \ + libknot/yparser/ypformat.c \ + libknot/yparser/ypscheme.c \ + libknot/yparser/yptrafo.c \ $(nobase_libknot_la_HEADERS) libknot_la_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAG_VISIBILITY) $(lmdb_CFLAGS) @@ -397,7 +393,7 @@ libknotd_la_SOURCES = \ libknotd_la_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAG_VISIBILITY) $(systemd_CFLAGS) $(liburcu_CFLAGS) $(lmdb_CFLAGS) -DKNOTD_MOD_STATIC libknotd_la_LDFLAGS = $(AM_LDFLAGS) $(systemd_LIBS) $(liburcu_LIBS) -export-symbols-regex '^knotd_' -libknotd_la_LIBADD = libknot.la libknot-yparser.la zscanner/libzscanner.la $(liburcu_LIBS) +libknotd_la_LIBADD = libknot.la zscanner/libzscanner.la $(liburcu_LIBS) ################### # Knot DNS Daemon # diff --git a/src/libknot/yparser/yparser.c b/src/libknot/yparser/yparser.c index 157927158..91d472dff 100644 --- a/src/libknot/yparser/yparser.c +++ b/src/libknot/yparser/yparser.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 CZ.NIC, z.s.p.o. +/* Copyright (C) 2017 CZ.NIC, z.s.p.o. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,11 +22,13 @@ #include #include "libknot/yparser/yparser.h" +#include "libknot/attribute.h" #include "libknot/errcode.h" extern int _yp_start_state; extern int _yp_parse(yp_parser_t *parser); +_public_ void yp_init( yp_parser_t *parser) { @@ -41,6 +43,7 @@ void yp_init( parser->line_count = 1; } +_public_ void yp_deinit( yp_parser_t *parser) { @@ -56,6 +59,7 @@ void yp_deinit( } } +_public_ int yp_set_input_string( yp_parser_t *parser, const char *input, @@ -78,6 +82,7 @@ int yp_set_input_string( return KNOT_EOK; } +_public_ int yp_set_input_file( yp_parser_t *parser, const char *file_name) @@ -136,6 +141,7 @@ int yp_set_input_file( return KNOT_EOK; } +_public_ int yp_parse( yp_parser_t *parser) { diff --git a/src/libknot/yparser/ypformat.c b/src/libknot/yparser/ypformat.c index 9ed979bd9..2648c7571 100644 --- a/src/libknot/yparser/ypformat.c +++ b/src/libknot/yparser/ypformat.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 CZ.NIC, z.s.p.o. +/* Copyright (C) 2017 CZ.NIC, z.s.p.o. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,6 +17,7 @@ #include #include "libknot/yparser/yptrafo.h" +#include "libknot/attribute.h" #include "libknot/errcode.h" static int format_item( @@ -72,6 +73,7 @@ static int format_item( return KNOT_EOK; } +_public_ int yp_format_key0( const yp_item_t *item, const uint8_t *data, @@ -86,6 +88,7 @@ int yp_format_key0( first_value, last_value); } +_public_ int yp_format_id( const yp_item_t *item, const uint8_t *data, @@ -102,6 +105,7 @@ int yp_format_id( true, true); } +_public_ int yp_format_key1( const yp_item_t *item, const uint8_t *data, diff --git a/src/libknot/yparser/ypscheme.c b/src/libknot/yparser/ypscheme.c index c3ea43b8a..ebbcf5772 100644 --- a/src/libknot/yparser/ypscheme.c +++ b/src/libknot/yparser/ypscheme.c @@ -20,6 +20,7 @@ #include "libknot/yparser/ypscheme.h" #include "libknot/yparser/yptrafo.h" +#include "libknot/attribute.h" #include "libknot/errcode.h" static size_t scheme_count( @@ -182,6 +183,7 @@ static int scheme_copy( return KNOT_EOK; } +_public_ int yp_scheme_copy( yp_item_t **dst, const yp_item_t *src) @@ -207,6 +209,7 @@ int yp_scheme_copy( return KNOT_EOK; } +_public_ int yp_scheme_merge( yp_item_t **dst, const yp_item_t *src1, @@ -242,6 +245,7 @@ int yp_scheme_merge( return KNOT_EOK; } +_public_ void yp_scheme_purge_dynamic( yp_item_t *scheme) { @@ -256,6 +260,7 @@ void yp_scheme_purge_dynamic( } } +_public_ void yp_scheme_free( yp_item_t *scheme) { @@ -291,6 +296,7 @@ static const yp_item_t* find_item( return NULL; } +_public_ const yp_item_t* yp_scheme_find( const yp_name_t *name, const yp_name_t *parent_name, @@ -312,6 +318,7 @@ const yp_item_t* yp_scheme_find( } } +_public_ yp_check_ctx_t* yp_scheme_check_init( yp_item_t **scheme) { @@ -428,6 +435,7 @@ static int check_item( } } +_public_ int yp_scheme_check_parser( yp_check_ctx_t *ctx, const yp_parser_t *parser) @@ -480,6 +488,7 @@ int yp_scheme_check_parser( return ret; } +_public_ int yp_scheme_check_str( yp_check_ctx_t *ctx, const char *key0, @@ -555,6 +564,7 @@ int yp_scheme_check_str( return KNOT_EOK; } +_public_ void yp_scheme_check_deinit( yp_check_ctx_t* ctx) { diff --git a/src/libknot/yparser/yptrafo.c b/src/libknot/yparser/yptrafo.c index 09b8e4234..81f7ca139 100644 --- a/src/libknot/yparser/yptrafo.c +++ b/src/libknot/yparser/yptrafo.c @@ -21,6 +21,7 @@ #include #include "libknot/yparser/yptrafo.h" +#include "libknot/attribute.h" #include "libknot/consts.h" #include "libknot/dname.h" #include "libknot/lookup.h" @@ -66,6 +67,7 @@ static wire_ctx_t copy_in( return ctx; } +_public_ int yp_str_to_bin( YP_TXT_BIN_PARAMS) { @@ -79,6 +81,7 @@ int yp_str_to_bin( YP_CHECK_RET; } +_public_ int yp_str_to_txt( YP_BIN_TXT_PARAMS) { @@ -94,6 +97,7 @@ int yp_str_to_txt( YP_CHECK_RET; } +_public_ int yp_bool_to_bin( YP_TXT_BIN_PARAMS) { @@ -114,6 +118,7 @@ int yp_bool_to_bin( YP_CHECK_RET; } +_public_ int yp_bool_to_txt( YP_BIN_TXT_PARAMS) { @@ -198,6 +203,7 @@ static int remove_unit( return KNOT_EOK; } +_public_ int yp_int_to_bin( YP_TXT_BIN_PARAMS, int64_t min, @@ -304,6 +310,7 @@ static void add_unit( } } +_public_ int yp_int_to_txt( YP_BIN_TXT_PARAMS, yp_style_t style) @@ -349,6 +356,7 @@ static uint8_t sock_type_guess( } } +_public_ int yp_addr_noport_to_bin( YP_TXT_BIN_PARAMS, bool allow_unix) @@ -391,6 +399,7 @@ int yp_addr_noport_to_bin( YP_CHECK_RET; } +_public_ int yp_addr_noport_to_txt( YP_BIN_TXT_PARAMS) { @@ -431,6 +440,7 @@ int yp_addr_noport_to_txt( YP_CHECK_RET; } +_public_ int yp_addr_to_bin( YP_TXT_BIN_PARAMS) { @@ -468,6 +478,7 @@ int yp_addr_to_bin( YP_CHECK_RET; } +_public_ int yp_addr_to_txt( YP_BIN_TXT_PARAMS) { @@ -502,6 +513,7 @@ int yp_addr_to_txt( YP_CHECK_RET; } +_public_ int yp_addr_range_to_bin( YP_TXT_BIN_PARAMS) { @@ -577,6 +589,7 @@ int yp_addr_range_to_bin( YP_CHECK_RET; } +_public_ int yp_addr_range_to_txt( YP_BIN_TXT_PARAMS) { @@ -618,6 +631,7 @@ int yp_addr_range_to_txt( YP_CHECK_RET; } +_public_ int yp_option_to_bin( YP_TXT_BIN_PARAMS, const knot_lookup_t *opts) @@ -636,6 +650,7 @@ int yp_option_to_bin( return KNOT_EINVAL; } +_public_ int yp_option_to_txt( YP_BIN_TXT_PARAMS, const knot_lookup_t *opts) @@ -659,6 +674,7 @@ int yp_option_to_txt( return KNOT_EINVAL; } +_public_ int yp_dname_to_bin( YP_TXT_BIN_PARAMS) { @@ -696,6 +712,7 @@ int yp_dname_to_bin( YP_CHECK_RET; } +_public_ int yp_dname_to_txt( YP_BIN_TXT_PARAMS) { @@ -719,6 +736,7 @@ static int hex_to_num(char hex) { return -1; } +_public_ int yp_hex_to_bin( YP_TXT_BIN_PARAMS) { @@ -761,6 +779,7 @@ int yp_hex_to_bin( YP_CHECK_RET; } +_public_ int yp_hex_to_txt( YP_BIN_TXT_PARAMS) { @@ -803,6 +822,7 @@ int yp_hex_to_txt( YP_CHECK_RET; } +_public_ int yp_base64_to_bin( YP_TXT_BIN_PARAMS) { @@ -826,6 +846,7 @@ int yp_base64_to_bin( YP_CHECK_RET; } +_public_ int yp_base64_to_txt( YP_BIN_TXT_PARAMS) { @@ -848,6 +869,7 @@ int yp_base64_to_txt( YP_CHECK_RET; } +_public_ int yp_item_to_bin( const yp_item_t *item, const char *txt, @@ -921,6 +943,7 @@ int yp_item_to_bin( return KNOT_EOK; } +_public_ int yp_item_to_txt( const yp_item_t *item, const uint8_t *bin, @@ -1009,6 +1032,7 @@ int yp_item_to_txt( return KNOT_EOK; } +_public_ struct sockaddr_storage yp_addr_noport( const uint8_t *data) { @@ -1036,12 +1060,14 @@ struct sockaddr_storage yp_addr_noport( return ss; } +_public_ int64_t yp_int( const uint8_t *data) { return (int64_t)wire_read_u64(data); } +_public_ struct sockaddr_storage yp_addr( const uint8_t *data, bool *no_port) @@ -1076,6 +1102,7 @@ struct sockaddr_storage yp_addr( return ss; } +_public_ const size_t yp_bin_len( const uint8_t *data) {