Coverage Report

Created: 2026-01-17 06:19

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
2.10M
   : Parameter(ParameterTypes::UNKNOWN),
18
2.10M
     mName(startName, nameSize),
19
2.10M
     mValue(),
20
2.10M
     mIsQuoted(false)
21
2.10M
{
22
2.10M
   pb.skipWhitespace();
23
2.10M
   if (!pb.eof() && *pb.position() == Symbols::EQUALS[0])
24
46.1k
   {
25
46.1k
      pb.skipChar(Symbols::EQUALS[0]);
26
46.1k
      pb.skipWhitespace();
27
46.1k
      if (*pb.position() == Symbols::DOUBLE_QUOTE[0])
28
2.20k
      {
29
2.20k
         setQuoted(true);
30
2.20k
         pb.skipChar();
31
2.20k
         const char* pos = pb.position();
32
2.20k
         pb.skipToEndQuote();
33
2.20k
         pb.data(mValue, pos);
34
2.20k
         pb.skipChar();
35
2.20k
      }
36
43.9k
      else
37
43.9k
      {
38
43.9k
         const char* pos = pb.position();
39
43.9k
         pb.skipToOneOf(terminators);
40
43.9k
         pb.data(mValue, pos);
41
43.9k
      }
42
      
43
46.1k
   }
44
2.06M
   else
45
2.06M
   {
46
      // must be a terminator -- exists style
47
2.06M
   }
48
2.10M
}
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
15.9M
{
60
15.9M
   return mName;
61
15.9M
}
62
63
64
Parameter* 
65
UnknownParameter::clone() const
66
7.02k
{
67
7.02k
   return new UnknownParameter(*this);
68
7.02k
}
69
70
EncodeStream&
71
UnknownParameter::encode(EncodeStream& stream) const
72
5.63k
{
73
5.63k
   if (mIsQuoted)
74
80
   {
75
80
      return stream << getName() << Symbols::EQUALS 
76
80
                    << Symbols::DOUBLE_QUOTE << mValue << Symbols::DOUBLE_QUOTE;
77
80
   }
78
5.55k
   else if (!mValue.empty())
79
673
   {
80
673
      return stream << getName() << Symbols::EQUALS << mValue;
81
673
   }
82
4.87k
   else
83
4.87k
   {
84
4.87k
      return stream << getName();
85
4.87k
   }
86
5.63k
}
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
 */