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