LCOV - code coverage report
Current view: top level - dns - rrtype.cc (source / functions) Hit Total Coverage
Test: report.info Lines: 20 20 100.0 %
Date: 2012-05-15 Functions: 6 6 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 4 6 66.7 %

           Branch data     Line data    Source code
       1                 :            : // Copyright (C) 2010  Internet Systems Consortium, Inc. ("ISC")
       2                 :            : //
       3                 :            : // Permission to use, copy, modify, and/or distribute this software for any
       4                 :            : // purpose with or without fee is hereby granted, provided that the above
       5                 :            : // copyright notice and this permission notice appear in all copies.
       6                 :            : //
       7                 :            : // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
       8                 :            : // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
       9                 :            : // AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
      10                 :            : // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
      11                 :            : // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
      12                 :            : // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
      13                 :            : // PERFORMANCE OF THIS SOFTWARE.
      14                 :            : 
      15                 :            : #include <stdint.h>
      16                 :            : 
      17                 :            : #include <string>
      18                 :            : #include <ostream>
      19                 :            : 
      20                 :            : #include <exceptions/exceptions.h>
      21                 :            : 
      22                 :            : #include <util/buffer.h>
      23                 :            : #include <dns/messagerenderer.h>
      24                 :            : #include <dns/rrparamregistry.h>
      25                 :            : #include <dns/rrtype.h>
      26                 :            : 
      27                 :            : using namespace std;
      28                 :            : using namespace isc::util;
      29                 :            : using isc::dns::RRType;
      30                 :            : 
      31                 :            : namespace isc {
      32                 :            : namespace dns {
      33                 :            : 
      34                 :      35767 : RRType::RRType(const string& typestr) {
      35                 :      35767 :     typecode_ = RRParamRegistry::getRegistry().textToTypeCode(typestr);
      36                 :      35744 : }
      37                 :            : 
      38                 :         15 : RRType::RRType(InputBuffer& buffer) {
      39         [ +  + ]:         15 :     if (buffer.getLength() - buffer.getPosition() < sizeof(uint16_t)) {
      40         [ +  - ]:          4 :         isc_throw(IncompleteRRType, "incomplete wire-format RR type");
      41                 :            :     }
      42                 :         13 :     typecode_ = buffer.readUint16();
      43                 :         13 : }
      44                 :            : 
      45                 :            : const string
      46                 :      21030 : RRType::toText() const {
      47                 :      21030 :     return (RRParamRegistry::getRegistry().codeToTypeText(typecode_));
      48                 :            : }
      49                 :            : 
      50                 :            : void
      51                 :        104 : RRType::toWire(OutputBuffer& buffer) const {
      52                 :        104 :     buffer.writeUint16(typecode_);
      53                 :        104 : }
      54                 :            : 
      55                 :            : void
      56                 :       1726 : RRType::toWire(AbstractMessageRenderer& renderer) const {
      57                 :       1726 :     renderer.writeUint16(typecode_);
      58                 :       1726 : }
      59                 :            : 
      60                 :            : ostream&
      61                 :       8573 : operator<<(ostream& os, const RRType& rrtype) {
      62         [ +  - ]:       8573 :     os << rrtype.toText();
      63                 :       8573 :     return (os);
      64                 :            : }
      65                 :            : }
      66                 :       3571 : }

Generated by: LCOV version 1.9