LCOV - code coverage report
Current view: top level - acl - loader.cc (source / functions) Hit Total Coverage
Test: report.info Lines: 9 10 90.0 %
Date: 2012-05-15 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 12 14 85.7 %

           Branch data     Line data    Source code
       1                 :            : // Copyright (C) 2011  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 "loader.h"
      16                 :            : 
      17                 :            : using namespace std;
      18                 :            : 
      19                 :            : namespace isc {
      20                 :            : namespace acl {
      21                 :            : 
      22                 :        214 : BasicAction defaultActionLoader(data::ConstElementPtr actionEl) {
      23                 :            :     try {
      24         [ +  + ]:        422 :         const string action(actionEl->stringValue());
      25         [ +  + ]:        208 :         if (action == "ACCEPT") {
      26                 :            :             return (ACCEPT);
      27         [ +  + ]:         67 :         } else if (action == "REJECT") {
      28                 :            :             return (REJECT);
      29         [ +  + ]:         50 :         } else if (action == "DROP") {
      30                 :            :             return (DROP);
      31                 :            :         } else {
      32                 :            :             throw LoaderError(__FILE__, __LINE__,
      33                 :          3 :                               string("Unknown action '" + action + "'").
      34                 :            :                                   c_str(),
      35         [ +  - ]:          9 :                               actionEl);
      36                 :            :         }
      37                 :            :     }
      38         [ +  + ]:         15 :     catch (const data::TypeError&) {
      39                 :            :         throw LoaderError(__FILE__, __LINE__,
      40                 :            :                           "Invalid element type for action, must be string",
      41         [ -  + ]:         12 :                           actionEl);
      42                 :            :     }
      43                 :            : }
      44                 :            : 
      45                 :            : }
      46                 :          0 : }

Generated by: LCOV version 1.9