// Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above // copyright notice and this permission notice appear in all copies. // // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace boost; using namespace isc::util; using namespace isc::util::encode; using namespace isc::util::str; // BEGIN_ISC_NAMESPACE // BEGIN_RDATA_NAMESPACE /// This is a straightforward representation of TSIG RDATA fields. struct TSIG::TSIGImpl { TSIGImpl(const Name& algorithm, uint64_t time_signed, uint16_t fudge, vector& mac, uint16_t original_id, uint16_t error, vector& other_data) : algorithm_(algorithm), time_signed_(time_signed), fudge_(fudge), mac_(mac), original_id_(original_id), error_(error), other_data_(other_data) {} TSIGImpl(const Name& algorithm, uint64_t time_signed, uint16_t fudge, size_t macsize, const void* mac, uint16_t original_id, uint16_t error, size_t other_len, const void* other_data) : algorithm_(algorithm), time_signed_(time_signed), fudge_(fudge), mac_(static_cast(mac), static_cast(mac) + macsize), original_id_(original_id), error_(error), other_data_(static_cast(other_data), static_cast(other_data) + other_len) {} template void toWireCommon(Output& output) const; const Name algorithm_; const uint64_t time_signed_; const uint16_t fudge_; const vector mac_; const uint16_t original_id_; const uint16_t error_; const vector other_data_; }; /// \brief Constructor from string. /// /// \c tsig_str must be formatted as follows: /// \code