"Fossies" - the Fresh Open Source Software Archive

Member "knot-2.8.3/src/libzscanner/functions.h" (16 Jul 2019, 4109 Bytes) of package /linux/misc/dns/knot-2.8.3.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "functions.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 2.7.6_vs_2.8.0.

    1 /*  Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
    2 
    3     This program is free software: you can redistribute it and/or modify
    4     it under the terms of the GNU General Public License as published by
    5     the Free Software Foundation, either version 3 of the License, or
    6     (at your option) any later version.
    7 
    8     This program is distributed in the hope that it will be useful,
    9     but WITHOUT ANY WARRANTY; without even the implied warranty of
   10     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   11     GNU General Public License for more details.
   12 
   13     You should have received a copy of the GNU General Public License
   14     along with this program.  If not, see <https://www.gnu.org/licenses/>.
   15  */
   16 /*!
   17  * \file
   18  *
   19  * \brief Zone scanner auxiliary functions.
   20  *
   21  * \addtogroup zone_scanner
   22  * @{
   23  */
   24 
   25 #pragma once
   26 
   27 #include <stdint.h>
   28 
   29 /*! \brief Transforms digit char to number. */
   30 extern const uint8_t digit_to_num[];
   31 
   32 /*! \brief Transforms first hex char to the part of the total number. */
   33 extern const uint8_t first_hex_to_num[];
   34 /*! \brief Transforms second hex char to the part of the total number. */
   35 extern const uint8_t second_hex_to_num[];
   36 
   37 /*! \brief Transforms first Base64 char. */
   38 extern const uint8_t first_base64_to_num[];
   39 /*! \brief Transforms left part of the second Base64 char. */
   40 extern const uint8_t second_left_base64_to_num[];
   41 /*! \brief Transforms left part of the second Base64 char. */
   42 extern const uint8_t second_right_base64_to_num[];
   43 /*! \brief Transforms left part of the third Base64 char. */
   44 extern const uint8_t third_left_base64_to_num[];
   45 /*! \brief Transforms left part of the third Base64 char. */
   46 extern const uint8_t third_right_base64_to_num[];
   47 /*! \brief Transforms fourth Base64 char. */
   48 extern const uint8_t fourth_base64_to_num[];
   49 
   50 /*! \brief Transforms first Base32hex char. */
   51 extern const uint8_t first_base32hex_to_num[];
   52 /*! \brief Transforms left part of the second Base32hex char. */
   53 extern const uint8_t second_left_base32hex_to_num[];
   54 /*! \brief Transforms right part of the second Base32hex char. */
   55 extern const uint8_t second_right_base32hex_to_num[];
   56 /*! \brief Transforms third Base32hex char. */
   57 extern const uint8_t third_base32hex_to_num[];
   58 /*! \brief Transforms left part of the fourth Base32hex char. */
   59 extern const uint8_t fourth_left_base32hex_to_num[];
   60 /*! \brief Transforms right part of the fourth Base32hex char. */
   61 extern const uint8_t fourth_right_base32hex_to_num[];
   62 /*! \brief Transforms left part of the fifth Base32hex char. */
   63 extern const uint8_t fifth_left_base32hex_to_num[];
   64 /*! \brief Transforms right part of the fifth Base32hex char. */
   65 extern const uint8_t fifth_right_base32hex_to_num[];
   66 /*! \brief Transforms sixth Base32hex char. */
   67 extern const uint8_t sixth_base32hex_to_num[];
   68 /*! \brief Transforms left part of the seventh Base32hex char. */
   69 extern const uint8_t seventh_left_base32hex_to_num[];
   70 /*! \brief Transforms right part of the seventh Base32hex char. */
   71 extern const uint8_t seventh_right_base32hex_to_num[];
   72 /*! \brief Transforms eighth Base32hex char. */
   73 extern const uint8_t eighth_base32hex_to_num[];
   74 
   75 /*!
   76  * \brief Converts YYYYMMDDHHMMSS time string to unsigned 32-bit timestamp.
   77  *
   78  * \param buff      Buffer containing time string.
   79  * \param timestamp Computed timestamp.
   80  *
   81  * \retval KNOT_EOK if success.
   82  * \retval error_code   if error.
   83  */
   84 int date_to_timestamp(uint8_t *buff, uint32_t *timestamp);
   85 
   86 /*!
   87  * \brief Converts wire-format dname to text dname.
   88  *
   89  * \param data      Buffer containg wire-format dname.
   90  * \param data_len  Length of the buffer.
   91  * \param text      Text output.
   92  */
   93 void wire_dname_to_str(const uint8_t  *data,
   94                        const uint32_t data_len,
   95                        char *text);
   96 
   97 /*!
   98  * \brief Converts unsigned integer to mantisa*10^(exponent).
   99  *
  100  * Given number is encoded as two 4-bit numbers. First part is mantisa [0-9],
  101  * second part is decimal exponent [0-15]. Result is concatenation of these
  102  * two blocks.
  103  *
  104  * \param number    Number to convert.
  105  *
  106  * \retval number   encoded number.
  107  */
  108 uint8_t loc64to8(uint64_t number);
  109 
  110 /*! @} */