Coverage Report

Created: 2026-01-09 06:37

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