reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
ResponseContext.hxx
Go to the documentation of this file.
1#if !defined(RESIP_RESPONSE_CONTEXT_HXX)
2#define RESIP_RESPONSE_CONTEXT_HXX
3
4#include <iosfwd>
5#include <map>
6#include <list>
7
8#include "rutil/HashMap.hxx"
11#include "resip/stack/Via.hxx"
12#include "resip/stack/Uri.hxx"
14
15#include "repro/Target.hxx"
17
18namespace resip
19{
20class SipMessage;
21class Transport;
22}
23
24namespace repro
25{
26
27class RequestContext;
28
30{
31 public:
33 {
34 public:
35 bool operator()(const resip::SipMessage& lhs, const resip::SipMessage& rhs) const;
36 };
37
38 virtual ~ResponseContext();
39
51 resip::Data addTarget(const resip::NameAddr& target, bool beginImmediately=false);
52
73 bool addTarget(std::unique_ptr<repro::Target> target, bool beginImmediately = false, bool checkDuplicates = true);
74
97
104
115
127
139
149
161
165 Target* getTarget(const resip::Data& serial) const;
166
167 //Keyed by transaction id
168 typedef std::map<resip::Data,repro::Target*> TransactionMap;
169
181
185 bool hasCandidateTransactions() const;
186
191 bool hasActiveTransactions() const;
192
196 bool hasTerminatedTransactions() const;
197
198 bool hasTargets() const;
199
203 bool isCandidate(const resip::Data& tid) const;
204
209 bool isActive(const resip::Data& tid) const;
210
214 bool isTerminated(const resip::Data& tid) const;
215
219 bool areAllTransactionsTerminated() const;
220
221
222 int getPriority(const resip::SipMessage& msg);
223
225 //tightly coupled.
227
228 std::list<std::list<resip::Data> > mTransactionQueueCollection;
230
231 protected:
232 // only constructed by RequestContext
234
235 // These methods are really private. These are not intended to be used
236 // by anything other than RequestContext or ResponseContext.
237
238 // call this from RequestContext when a CANCEL comes in
240
241 // call this from RequestContext after the lemur chain for any response
243
244 void updateTimerC(const resip::Data &tid);
245 void processTimerC(const resip::Data &tid, int serial);
246
249
251 void removeClientTransaction(const resip::Data& transactionId);
252
253 //There is no terminateClientTransaction(Target target) since terminating
254 //a branch is very simple. The guts can be found in the API functions.
255
260 Target* target,
261 bool doPathInstead=false);
263 bool outboundFlowTokenNeeded(Target* target);
264 bool needsFlowTokenToWork(const resip::NameAddr& contact) const;
265 bool sendingToSelf(Target* target);
266
267 std::unique_ptr<resip::SipMessage> buildTargetRequest(Target *target);
269
270 TransactionMap mCandidateTransactionMap; //Targets with status Candidate.
271 TransactionMap mActiveTransactionMap; //Targets with status Trying, Proceeding, or WaitingToCancel.
272 TransactionMap mTerminatedTransactionMap; //Targets with status Terminated.
273
274 //Maybe someday canonicalized Uris will go here, and checking for duplicates
275 //will be much faster
277
278 bool isDuplicate(const repro::Target* target) const;
279
283 bool mIsClientBehindNAT; // Only set if InteropHelper::getClientNATDetectionEnabled() is true
284
285 static const int TimerCSerialInit = 0;
286 std::unordered_map<resip::Data, int> mTimerCSerial; // Keeping track of the latest TimerC for each of the client TXs
287
288 virtual void forwardBestResponse();
289
290 friend class RequestContext;
292};
293
296
297}
298#endif
299
300/* ====================================================================
301 * The Vovida Software License, Version 1.0
302 *
303 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
304 *
305 * Redistribution and use in source and binary forms, with or without
306 * modification, are permitted provided that the following conditions
307 * are met:
308 *
309 * 1. Redistributions of source code must retain the above copyright
310 * notice, this list of conditions and the following disclaimer.
311 *
312 * 2. Redistributions in binary form must reproduce the above copyright
313 * notice, this list of conditions and the following disclaimer in
314 * the documentation and/or other materials provided with the
315 * distribution.
316 *
317 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
318 * and "Vovida Open Communication Application Library (VOCAL)" must
319 * not be used to endorse or promote products derived from this
320 * software without prior written permission. For written
321 * permission, please contact vocal@vovida.org.
322 *
323 * 4. Products derived from this software may not be called "VOCAL", nor
324 * may "VOCAL" appear in their name, without prior written
325 * permission of Vovida Networks, Inc.
326 *
327 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
328 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
329 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
330 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
331 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
332 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
333 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
334 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
335 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
336 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
337 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
338 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
339 * DAMAGE.
340 *
341 * ====================================================================
342 *
343 * This software consists of voluntary contributions made by Vovida
344 * Networks, Inc. and many individuals on behalf of Vovida Networks,
345 * Inc. For more information on Vovida Networks, Inc., please see
346 * <http://www.vovida.org/>.
347 *
348 */
Wraps your platform's implementation of hash_map, hash_multimap, and hash_set.
bool operator()(const resip::SipMessage &lhs, const resip::SipMessage &rhs) const
const TransactionMap & getCandidateTransactionMap() const
Self-explanatory.
virtual void forwardBestResponse()
bool isDuplicate(const repro::Target *target) const
void removeClientTransaction(const resip::Data &transactionId)
bool isTerminated(const resip::Data &tid) const
bool needsFlowTokenToWork(const resip::NameAddr &contact) const
std::unique_ptr< resip::SipMessage > buildTargetRequest(Target *target)
bool cancelAllClientTransactions(const resip::Tokens *reasons=0)
Cancels all active client transactions.
int getPriority(const resip::SipMessage &msg)
resip::Data addTarget(const resip::NameAddr &target, bool beginImmediately=false)
Adds this Target as a SimpleTarget to the collection of Targets.
RequestContext & mRequestContext
bwc! This should probably not be private, since these two classes are
resip::Data getInboundFlowToken(bool doPathInstead)
std::map< resip::Data, repro::Target * > TransactionMap
bool hasTerminatedTransactions() const
bool sendingToSelf(Target *target)
bool hasCandidateTransactions() const
TransactionMap mTerminatedTransactionMap
bool isActive(const resip::Data &tid) const
static const int TimerCSerialInit
void processTimerC(const resip::Data &tid, int serial)
resip::SipMessage mBestResponse
bool addTargetBatch(TargetPtrList &targets, bool highPriority=false)
Adds a batch of Targets.
void sendRequest(resip::SipMessage &request)
void terminateClientTransaction(const resip::Data &tid)
void updateTimerC(const resip::Data &tid)
bool outboundFlowTokenNeeded(Target *target)
bool cancelClientTransaction(const resip::Data &serial, const resip::Tokens *reasons=0)
Cancels this client transaction if active, or Terminates it if Candidate.
void processCancel(const resip::SipMessage &request)
friend EncodeStream & operator<<(EncodeStream &strm, const repro::ResponseContext &rc)
bool beginClientTransaction(const resip::Data &serial)
Begins a client transaction.
std::list< std::list< resip::Data > > mTransactionQueueCollection
Target * getTarget(const resip::Data &serial) const
Self-explanatory.
std::unordered_map< resip::Data, int > mTimerCSerial
void processResponse(resip::SipMessage &response)
bool clearCandidateTransactions(const resip::Tokens *reasons=0)
Removes all Candidate transactions.
void insertRecordRoute(resip::SipMessage &outgoing, const resip::Tuple &receivedTransportTuple, const resip::NameAddr &receivedTransportRecordRoute, bool transportSpecificRecordRoute, Target *target, bool doPathInstead=false)
TransactionMap mActiveTransactionMap
TransactionMap mCandidateTransactionMap
resip::ContactList mTargetList
bool beginClientTransactions()
Begins all Candidate client transactions.
bool isCandidate(const resip::Data &tid) const
bool cancelActiveClientTransactions(const resip::Tokens *reasons=0)
Cancels all active client transactions.
bool areAllTransactionsTerminated() const
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
Represents the "name-addr" and the "addr-spec" elements in the RFC 3261 grammar.
Definition NameAddr.hxx:19
Represents a SIP message.
Represents a network address.
Definition Tuple.hxx:59
This Class is used to implement a primitive form of RPC using loose XML formatting.
EncodeStream & operator<<(EncodeStream &os, const repro::Processor &rp)
Definition Processor.cxx:69
std::list< Target * > TargetPtrList
Definition Target.hxx:81
dcm! – add UnusedChecking(_enum) below;
std::list< ContactInstanceRecord > ContactList
Replaces STL streams for general encoding purposes.
#define EncodeStream
void list()
Definition userAdmin.cxx:66