Coverage Report

Created: 2024-07-23 06:39

/src/resiprocate/resip/stack/SendData.hxx
Line
Count
Source (jump to first uncovered line)
1
#ifndef RESIP_SendData_HXX
2
#define RESIP_SendData_HXX
3
4
#include "rutil/Data.hxx"
5
#include "resip/stack/Tuple.hxx"
6
7
namespace resip
8
{
9
10
/**
11
   @internal
12
*/
13
class SendData
14
{
15
   public:
16
      enum SendDataCommand
17
      {
18
         NoCommand,
19
         CloseConnection,
20
         EnableFlowTimer
21
      };
22
23
      SendData() : isAlreadyCompressed(false), command(NoCommand)
24
0
      {}
25
26
      SendData(const Tuple& dest,
27
               const Data& pdata,
28
               const Data& tid,
29
               const Data& scid,
30
               bool isCompressed = false): 
31
         destination(dest),
32
         data(pdata),
33
         transactionId(tid),
34
         sigcompId(scid),
35
         isAlreadyCompressed(isCompressed),
36
         command(NoCommand)
37
0
      {
38
0
      }
39
40
      // This interface is only used for stun responses
41
      SendData(const Tuple& dest, char* buffer, int length) : 
42
         destination(dest),
43
         data(Data::Take, buffer, length),
44
         transactionId(Data::Empty),
45
         sigcompId(Data::Empty),
46
         isAlreadyCompressed(false),
47
         command(NoCommand)
48
0
      {
49
0
      }
50
51
      SendData* clone() const
52
0
      {
53
0
         return new SendData(*this);
54
0
      }
55
56
      void clear()
57
0
      {
58
0
         data.clear();
59
0
      }
60
61
      bool empty() const
62
0
      {
63
0
         return data.empty();
64
0
      }
65
66
      Tuple destination;
67
      Data data;
68
      Data transactionId;
69
      Data sigcompId;
70
      bool isAlreadyCompressed;
71
72
      // .bwc. Used for special commands: ie. to close connections, and enable flow timers
73
      SendDataCommand command;
74
};
75
76
}
77
78
#endif
79
80
/* ====================================================================
81
 * The Vovida Software License, Version 1.0 
82
 * 
83
 * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
84
 * 
85
 * Redistribution and use in source and binary forms, with or without
86
 * modification, are permitted provided that the following conditions
87
 * are met:
88
 * 
89
 * 1. Redistributions of source code must retain the above copyright
90
 *    notice, this list of conditions and the following disclaimer.
91
 * 
92
 * 2. Redistributions in binary form must reproduce the above copyright
93
 *    notice, this list of conditions and the following disclaimer in
94
 *    the documentation and/or other materials provided with the
95
 *    distribution.
96
 * 
97
 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
98
 *    and "Vovida Open Communication Application Library (VOCAL)" must
99
 *    not be used to endorse or promote products derived from this
100
 *    software without prior written permission. For written
101
 *    permission, please contact vocal@vovida.org.
102
 *
103
 * 4. Products derived from this software may not be called "VOCAL", nor
104
 *    may "VOCAL" appear in their name, without prior written
105
 *    permission of Vovida Networks, Inc.
106
 * 
107
 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
108
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
109
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
110
 * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
111
 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
112
 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
113
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
114
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
115
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
116
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
117
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
118
 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
119
 * DAMAGE.
120
 * 
121
 * ====================================================================
122
 * 
123
 * This software consists of voluntary contributions made by Vovida
124
 * Networks, Inc. and many individuals on behalf of Vovida Networks,
125
 * Inc.  For more information on Vovida Networks, Inc., please see
126
 * <http://www.vovida.org/>.
127
 *
128
 */