Coverage Report

Created: 2025-12-14 06:38

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/resiprocate/resip/stack/RportParameter.cxx
Line
Count
Source
1
#if defined(HAVE_CONFIG_H)
2
#include "config.h"
3
#endif
4
5
#include "resip/stack/RportParameter.hxx"
6
#include "resip/stack/Symbols.hxx"
7
#include "rutil/ParseBuffer.hxx"
8
#include "rutil/Logger.hxx"
9
#include "rutil/BaseException.hxx"
10
#include "rutil/WinLeakCheck.hxx"
11
12
using namespace resip;
13
using namespace std;
14
15
#define RESIPROCATE_SUBSYSTEM resip::Subsystem::SIP
16
17
RportParameter::RportParameter(ParameterTypes::Type type,
18
                               ParseBuffer& pb, 
19
                               const std::bitset<256>& terminators)
20
0
   : Parameter(type),
21
0
     mValue(0),
22
0
     mHasValue(false)
23
0
{
24
0
   pb.skipWhitespace();
25
0
   if (!pb.eof() && *pb.position() == Symbols::EQUALS[0])
26
0
   {
27
0
      mHasValue = true;
28
      
29
0
      pb.skipChar();
30
0
      pb.skipWhitespace();
31
32
      // Catch the exception gracefully to handle seeing ;rport=
33
0
      try
34
0
      {
35
0
      mValue = pb.integer();
36
0
      }
37
0
      catch(BaseException&  e )
38
0
      {
39
0
         ErrLog(<<"Caught exception: "<< e);
40
0
         mHasValue = false;
41
0
      }
42
0
   }
43
0
}
44
45
RportParameter::RportParameter(ParameterTypes::Type type, int value)
46
0
   : Parameter(type),
47
0
     mValue(value),
48
0
     mHasValue(true)
49
0
{
50
0
}
51
52
RportParameter::RportParameter(ParameterTypes::Type type)
53
0
   : Parameter(type),
54
0
     mValue(-1),
55
0
     mHasValue(false)
56
0
{
57
0
}
58
59
Parameter* 
60
RportParameter::clone() const
61
0
{
62
0
   return new RportParameter(*this);
63
0
}
64
65
EncodeStream&
66
RportParameter::encode(EncodeStream& stream) const
67
0
{
68
0
   if (mHasValue || mValue > 0)
69
0
   {
70
0
      return stream << getName() << Symbols::EQUALS << mValue;
71
0
   }
72
0
   else
73
0
   {
74
0
      return stream << getName();
75
0
   }
76
0
}
77
78
79
/* ====================================================================
80
 * The Vovida Software License, Version 1.0 
81
 * 
82
 * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
83
 * 
84
 * Redistribution and use in source and binary forms, with or without
85
 * modification, are permitted provided that the following conditions
86
 * are met:
87
 * 
88
 * 1. Redistributions of source code must retain the above copyright
89
 *    notice, this list of conditions and the following disclaimer.
90
 * 
91
 * 2. Redistributions in binary form must reproduce the above copyright
92
 *    notice, this list of conditions and the following disclaimer in
93
 *    the documentation and/or other materials provided with the
94
 *    distribution.
95
 * 
96
 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
97
 *    and "Vovida Open Communication Application Library (VOCAL)" must
98
 *    not be used to endorse or promote products derived from this
99
 *    software without prior written permission. For written
100
 *    permission, please contact vocal@vovida.org.
101
 *
102
 * 4. Products derived from this software may not be called "VOCAL", nor
103
 *    may "VOCAL" appear in their name, without prior written
104
 *    permission of Vovida Networks, Inc.
105
 * 
106
 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
107
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
108
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
109
 * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
110
 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
111
 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
112
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
113
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
114
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
115
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
116
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
117
 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
118
 * DAMAGE.
119
 * 
120
 * ====================================================================
121
 * 
122
 * This software consists of voluntary contributions made by Vovida
123
 * Networks, Inc. and many individuals on behalf of Vovida Networks,
124
 * Inc.  For more information on Vovida Networks, Inc., please see
125
 * <http://www.vovida.org/>.
126
 *
127
 */