"Fossies" - the Fresh Open Source Software Archive

Member "knot-2.8.3/src/libknot/rrtype/rrsig.h" (16 Jul 2019, 2274 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 "rrsig.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  * \addtogroup rrtype
   20  * @{
   21  */
   22 
   23 #pragma once
   24 
   25 #include "libknot/dname.h"
   26 #include "libknot/rdata.h"
   27 #include "libknot/wire.h"
   28 
   29 static inline
   30 uint16_t knot_rrsig_type_covered(const knot_rdata_t *rdata)
   31 {
   32     assert(rdata);
   33     return knot_wire_read_u16(rdata->data);
   34 }
   35 
   36 static inline
   37 uint8_t knot_rrsig_alg(const knot_rdata_t *rdata)
   38 {
   39     assert(rdata);
   40     return *(rdata->data + 2);
   41 }
   42 
   43 static inline
   44 uint8_t knot_rrsig_labels(const knot_rdata_t *rdata)
   45 {
   46     assert(rdata);
   47     return *(rdata->data + 3);
   48 }
   49 
   50 static inline
   51 uint32_t knot_rrsig_original_ttl(const knot_rdata_t *rdata)
   52 {
   53     assert(rdata);
   54     return knot_wire_read_u32(rdata->data + 4);
   55 }
   56 
   57 static inline
   58 uint32_t knot_rrsig_sig_expiration(const knot_rdata_t *rdata)
   59 {
   60     assert(rdata);
   61     return knot_wire_read_u32(rdata->data + 8);
   62 }
   63 
   64 static inline
   65 uint32_t knot_rrsig_sig_inception(const knot_rdata_t *rdata)
   66 {
   67     assert(rdata);
   68     return knot_wire_read_u32(rdata->data + 12);
   69 }
   70 
   71 static inline
   72 uint16_t knot_rrsig_key_tag(const knot_rdata_t *rdata)
   73 {
   74     assert(rdata);
   75     return knot_wire_read_u16(rdata->data + 16);
   76 }
   77 
   78 static inline
   79 const knot_dname_t *knot_rrsig_signer_name(const knot_rdata_t *rdata)
   80 {
   81     assert(rdata);
   82     return rdata->data + 18;
   83 }
   84 
   85 static inline
   86 uint16_t knot_rrsig_signature_len(const knot_rdata_t *rdata)
   87 {
   88     assert(rdata);
   89     return rdata->len - 18 - knot_dname_size(knot_rrsig_signer_name(rdata));
   90 }
   91 
   92 static inline
   93 const uint8_t *knot_rrsig_signature(const knot_rdata_t *rdata)
   94 {
   95     assert(rdata);
   96     return rdata->data + 18 + knot_dname_size(knot_rrsig_signer_name(rdata));
   97 }
   98 
   99 /*! @} */