LCOV - code coverage report
Current view: top level - src - SSLv3Automaton.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 22 49 44.9 %
Date: 2010-12-13 Functions: 6 18 33.3 %
Branches: 12 54 22.2 %

           Branch data     Line data    Source code
       1                 :            : // $Id: SSLv3Automaton.cc 80 2004-07-14 20:15:50Z jason $
       2                 :            : 
       3                 :            : // ---SSLv3_Automaton----------------------------------------------------------
       4                 :            : 
       5                 :            : #include "SSLv3Automaton.h"
       6                 :            : 
       7                 :            : SSLv3_Automaton::SSLv3_Automaton(int arg_num_states, int num_trans,
       8                 :          3 :                                         int error_state)
       9                 :            :         {
      10                 :          3 :         num_states = arg_num_states;
      11                 :          3 :         states = new SSLv3_State*[num_states];
      12 [ +  + ][ #  # ]:         63 :         for ( int i = 0; i < num_states; ++i )
      13                 :         60 :                 states[i] = new SSLv3_State(num_trans, error_state);
      14                 :          3 :         }
      15                 :            : 
      16                 :          3 : SSLv3_Automaton::~SSLv3_Automaton()
      17                 :            :         {
      18 [ #  # ][ +  + ]:         63 :         for ( int i = 0; i < num_states; ++i )
                 [ #  # ]
      19 [ #  # ][ +  - ]:         60 :                 delete states[i];
                 [ #  # ]
      20 [ #  # ][ +  - ]:          3 :         delete [] states;
                 [ #  # ]
      21 [ #  # ][ -  + ]:          3 :         }
                 [ #  # ]
      22                 :            : 
      23                 :          0 : void SSLv3_Automaton::Describe(ODesc* d) const
      24                 :            :         {
      25                 :          0 :         d->Add("sslAutomaton");
      26                 :          0 :         }
      27                 :            : 
      28                 :          0 : void SSLv3_Automaton::setStartState(int state)
      29                 :            :         {
      30         [ #  # ]:          0 :         if ( state < num_states )
      31                 :          0 :                 startState = state;
      32                 :          0 :         }
      33                 :            : 
      34                 :          0 : void SSLv3_Automaton::addTrans(int state1, int trans, int state2)
      35                 :            :         {
      36 [ #  # ][ #  # ]:          0 :         if ( state1 < num_states && state2 < num_states )
      37                 :          0 :                 states[state1]->addTrans(trans, state2);
      38                 :          0 :         }
      39                 :            : 
      40                 :          0 : int SSLv3_Automaton::getNextState(int state, int trans)
      41                 :            :         {
      42         [ #  # ]:          0 :         if ( state < num_states )
      43                 :          0 :                 return states[state]->getNextState(trans);
      44                 :            :         else
      45                 :          0 :                 return 0;
      46                 :            :         }
      47                 :            : 
      48                 :          0 : int SSLv3_Automaton::getStartState()
      49                 :            :         {
      50         [ #  # ]:          0 :         if (startState >= 0)
      51                 :          0 :                 return startState;
      52                 :            :         else
      53                 :          0 :                 return -1;
      54                 :            :         }
      55                 :            : 
      56                 :            : // ---SSLv3_State--------------------------------------------------------------
      57                 :            : 
      58                 :         60 : SSLv3_State::SSLv3_State(int num_trans, int error_state)
      59                 :            :         {
      60                 :         60 :         this->num_trans = num_trans;
      61                 :         60 :         transitions = new int[num_trans];
      62 [ +  + ][ #  # ]:        720 :         for ( int i = 0; i < num_trans; ++i )
      63                 :        660 :                 transitions[i] = error_state;
      64                 :         60 :         }
      65                 :            : 
      66                 :         60 : SSLv3_State::~SSLv3_State()
      67                 :            :         {
      68 [ +  - ][ #  # ]:         60 :         delete [] transitions;
      69                 :         60 :         }
      70                 :            : 
      71                 :          0 : void SSLv3_State::addTrans(int trans, int state)
      72                 :            :         {
      73         [ #  # ]:          0 :         if ( trans < num_trans )
      74                 :          0 :                 transitions[trans] = state;
      75                 :          0 :         }
      76                 :            : 
      77                 :          0 : int SSLv3_State::getNextState(int trans)
      78                 :            :         {
      79         [ #  # ]:          0 :         if ( trans < num_trans )
      80                 :          0 :                 return transitions[trans];
      81                 :            :         else
      82                 :          0 :                 return 0;
      83 [ +  - ][ +  - ]:          6 :         }

Generated by: LCOV version 1.8