Coverage Report

Created: 2024-07-23 06:39

/src/resiprocate/resip/stack/MultipartMixedContents.hxx
Line
Count
Source (jump to first uncovered line)
1
#if !defined(RESIP_MULTIPARTMIXEDCONTENTS_HXX)
2
#define RESIP_MULTIPARTMIXEDCONTENTS_HXX 
3
4
#include <vector>
5
6
#include "resip/stack/Contents.hxx"
7
#include "rutil/Data.hxx"
8
9
namespace resip
10
{
11
12
class Mime;
13
class ParseBuffer;
14
15
/**
16
   @ingroup sip_payload
17
   @brief SIP body type for holding Multipart-Mixed body contents (MIME content-type multipart/mixed).
18
*/
19
class MultipartMixedContents : public Contents
20
{
21
   public:
22
      MultipartMixedContents();
23
      explicit MultipartMixedContents(const Mime& contentType);
24
      MultipartMixedContents(const HeaderFieldValue& hfv, const Mime& contentType);
25
      MultipartMixedContents(const MultipartMixedContents& rhs);
26
      virtual ~MultipartMixedContents();
27
      MultipartMixedContents& operator=(const MultipartMixedContents& rhs);
28
29
      /** @brief duplicate an MultipartMixedContents object
30
          @return pointer to a new MultipartMixedContents object  
31
        **/
32
      virtual Contents* clone() const;
33
34
      static const Mime& getStaticType() ;
35
36
      virtual EncodeStream& encodeParsed(EncodeStream& str) const;
37
      virtual void parse(ParseBuffer& pb);
38
39
      typedef std::vector<Contents*> Parts;
40
0
      Parts& parts() {checkParsed(); return mContents;}
41
0
      const Parts& parts() const {checkParsed(); return mContents;}
42
43
      void setBoundary(const Data& boundary);
44
45
      /**
46
      @brief Thrown when there is an error parsing a multi-part mixed contents envelope.
47
      @sa resip::BaseException
48
      */
49
      class Exception final : public BaseException
50
      {
51
        public:
52
         Exception(const Data& msg, const Data& file, const int line)
53
0
            : BaseException(msg, file, line) {}
54
55
0
         const char* name() const noexcept override { return "MultipartMixedContents::Exception"; }
56
      };
57
      
58
      static bool init();
59
      
60
   protected:
61
      void clear();
62
      
63
   private:
64
      void setBoundary();
65
      std::vector<Contents*> mContents;
66
};
67
68
static bool invokeMultipartMixedContentsInit = MultipartMixedContents::init();
69
70
}
71
72
#endif
73
74
/* ====================================================================
75
 * The Vovida Software License, Version 1.0 
76
 * 
77
 * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
78
 * 
79
 * Redistribution and use in source and binary forms, with or without
80
 * modification, are permitted provided that the following conditions
81
 * are met:
82
 * 
83
 * 1. Redistributions of source code must retain the above copyright
84
 *    notice, this list of conditions and the following disclaimer.
85
 * 
86
 * 2. Redistributions in binary form must reproduce the above copyright
87
 *    notice, this list of conditions and the following disclaimer in
88
 *    the documentation and/or other materials provided with the
89
 *    distribution.
90
 * 
91
 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
92
 *    and "Vovida Open Communication Application Library (VOCAL)" must
93
 *    not be used to endorse or promote products derived from this
94
 *    software without prior written permission. For written
95
 *    permission, please contact vocal@vovida.org.
96
 *
97
 * 4. Products derived from this software may not be called "VOCAL", nor
98
 *    may "VOCAL" appear in their name, without prior written
99
 *    permission of Vovida Networks, Inc.
100
 * 
101
 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
102
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
103
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
104
 * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
105
 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
106
 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
107
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
108
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
109
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
110
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
111
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
112
 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
113
 * DAMAGE.
114
 * 
115
 * ====================================================================
116
 * 
117
 * This software consists of voluntary contributions made by Vovida
118
 * Networks, Inc. and many individuals on behalf of Vovida Networks,
119
 * Inc.  For more information on Vovida Networks, Inc., please see
120
 * <http://www.vovida.org/>.
121
 *
122
 */