~ubuntu-branches/ubuntu/saucy/resiprocate/saucy-proposed

« back to all changes in this revision

Viewing changes to resip/stack/ExtensionHeader.cxx

  • Committer: Package Import Robot
  • Author(s): Daniel Pocock
  • Date: 2012-05-17 19:29:59 UTC
  • Revision ID: package-import@ubuntu.com-20120517192959-vv00m77isztdy64q
Tags: upstream-1.8.2
ImportĀ upstreamĀ versionĀ 1.8.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#if defined(HAVE_CONFIG_H)
 
2
#include "config.h"
 
3
#endif
 
4
 
 
5
#include "ExtensionHeader.hxx"
 
6
#include "HeaderTypes.hxx"
 
7
#include "rutil/Logger.hxx"
 
8
 
 
9
#include <cassert>
 
10
#include "rutil/ParseBuffer.hxx"
 
11
 
 
12
#define RESIPROCATE_SUBSYSTEM Subsystem::SIP
 
13
 
 
14
using namespace resip;
 
15
 
 
16
ExtensionHeader::ExtensionHeader(const char* name)
 
17
   : mName(name)
 
18
{
 
19
   assert(name);
 
20
   if (mName.empty())
 
21
   {
 
22
      assert(false);
 
23
      throw Exception("Empty extension header",__FILE__,__LINE__);
 
24
   }
 
25
   assert(Headers::getType(mName.data(), (int)mName.size()) == Headers::UNKNOWN);
 
26
}
 
27
 
 
28
ExtensionHeader::ExtensionHeader(const Data& name)
 
29
   : mName(name)
 
30
{
 
31
   if (mName.empty())
 
32
   {
 
33
      assert(false);
 
34
      throw Exception("Empty extension header",__FILE__,__LINE__);
 
35
   }
 
36
   assert(Headers::getType(mName.data(), (int)mName.size()) == Headers::UNKNOWN);
 
37
}
 
38
 
 
39
const Data&
 
40
ExtensionHeader::getName() const 
 
41
{
 
42
   return mName;
 
43
}
 
44
 
 
45
ExtensionHeader::Exception::Exception(const Data& msg, const Data& file, const int line)
 
46
   : BaseException(msg, file, line) 
 
47
{}
 
48
 
 
49
const char* 
 
50
ExtensionHeader::Exception::name() const
 
51
{
 
52
 return "ExtensionHeader::Exception"; 
 
53
}
 
54
 
 
55
/* ====================================================================
 
56
 * The Vovida Software License, Version 1.0 
 
57
 * 
 
58
 * Copyright (c) 2005 Vovida Networks, Inc.  All rights reserved.
 
59
 * 
 
60
 * Redistribution and use in source and binary forms, with or without
 
61
 * modification, are permitted provided that the following conditions
 
62
 * are met:
 
63
 * 
 
64
 * 1. Redistributions of source code must retain the above copyright
 
65
 *    notice, this list of conditions and the following disclaimer.
 
66
 * 
 
67
 * 2. Redistributions in binary form must reproduce the above copyright
 
68
 *    notice, this list of conditions and the following disclaimer in
 
69
 *    the documentation and/or other materials provided with the
 
70
 *    distribution.
 
71
 * 
 
72
 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
 
73
 *    and "Vovida Open Communication Application Library (VOCAL)" must
 
74
 *    not be used to endorse or promote products derived from this
 
75
 *    software without prior written permission. For written
 
76
 *    permission, please contact vocal@vovida.org.
 
77
 *
 
78
 * 4. Products derived from this software may not be called "VOCAL", nor
 
79
 *    may "VOCAL" appear in their name, without prior written
 
80
 *    permission of Vovida Networks, Inc.
 
81
 * 
 
82
 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
 
83
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 
84
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
 
85
 * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
 
86
 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
 
87
 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
 
88
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 
89
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 
90
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 
91
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
92
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
 
93
 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 
94
 * DAMAGE.
 
95
 * 
 
96
 * ====================================================================
 
97
 * 
 
98
 * This software consists of voluntary contributions made by Vovida
 
99
 * Networks, Inc. and many individuals on behalf of Vovida Networks,
 
100
 * Inc.  For more information on Vovida Networks, Inc., please see
 
101
 * <http://www.vovida.org/>.
 
102
 *
 
103
 */