/[resiprocate]/main/resip/dum/KeepAliveManager.hxx
ViewVC logotype

Contents of /main/resip/dum/KeepAliveManager.hxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9033 - (show annotations) (download)
Sun Feb 27 17:17:15 2011 UTC (8 years, 8 months ago) by sgodin
File MIME type: text/plain
File size: 4393 byte(s)
-merge work from b-client-outbound-20110213 - client outbound support (RFC 5626)
   - New UserProfile settings
      - clientOutboundEnabled
      - setRegId
   - UserProfile now tracks flow used at registration time if server indicates outbound support, and 
     all usages that are assigned the same UserProfile will use this flow
   - ;ob parameter is added to contact headers of non-REGISTER requests if clientOutboundEnabled
   - ;reg-id parameter is added to contact headers of REGISTER requests if configured
   - ;+sip.instance is added to all contact headers if configured
   - ClientRegistration tagContact is now static and is used in RegistrationCreator for consistency
   - Keep alive pong responses are now routed from Stack to DUM Keepalive Manager
   - DUM Keep alive manager will terminate flows if a pong response is not received from 
     an outbound enabled connection after a default of 10 seconds
   -removed a bunch of non-implemented methods from DialogUsageManager.hxx
   -optimized some accesses to user profile from usages
   -added new makeInviteSession calls that accept an InviteSessionHandle and add an appropriate replaces header
   -treat internal 503 errors the same as 408 errors when dispatching onRequestRetry callback for
    ClientRegistration, ClientSubscription and ClientPublication
      - allows retry logic that is consistent when using both UDP or TCP/TLS transports
      - note:  TCP/TLS transports get a 503 error when they cannot connect, UDP transports typically
               get a 408 error when the far end is not present
   -ClientRegistration changes to ensure calling requestRefresh will not assert in any state
      - allow calling requestRefresh while a retry timer is running to request an immediate retry 
   -created onFlowTerminated callbacks on:
      - ClientRegistrationHandler - default implementation is to retry registration immediately
      - InviteSessionHandler - current default implementation is to do nothing
      - ServerSubscriptionHandler - default implementation is to end the Subscription
      - ClientSubscriptionHandler - default implementation is to reSubscribe (new Dialog)
   -fix for ContactInstanceRecord equality checks - registration server was not treating contacts with the same
    instance id as equal if the contact URI was different
1 #ifndef RESIP_KEEPALIVE_MANAGER_HXX
2 #define RESIP_KEEPALIVE_MANAGER_HXX
3
4 #include <map>
5 #include "resip/stack/Tuple.hxx"
6
7 namespace resip
8 {
9
10 class KeepAliveTimeout;
11 class KeepAlivePongTimeout;
12 class DialogUsageManager;
13
14 class KeepAliveManager
15 {
16 public:
17 // Defaults to 10000ms (10s) as specified in RFC5626 section 4.4.1
18 static int mKeepAlivePongTimeoutMs; // ?slg? move to Profile setting?
19
20 struct NetworkAssociationInfo
21 {
22 int refCount;
23 int keepAliveInterval; // In seconds
24 int id;
25 bool supportsOutbound;
26 bool pongReceivedForLastPing;
27 };
28
29 // .slg. We track unique Network Associations per transport transport type, transport family,
30 // target ip addr, target port, and source/transport flow key
31 // This means that if we have two different TCP connections to the same destination,
32 // each originating from a different NIC, then we will send keepalives on each separately.
33 // For UDP, this is not currently the case, when the transport is bound to any interface
34 // (ie. 0.0.0.0), as the flow key will be same regardless of the source interface used to
35 // send the UDP message - fixing this for UDP remains an outstanding item.
36 typedef std::map<Tuple, NetworkAssociationInfo, Tuple::FlowKeyCompare> NetworkAssociationMap;
37
38 KeepAliveManager() : mCurrentId(0) {}
39 virtual ~KeepAliveManager() {}
40 void setDialogUsageManager(DialogUsageManager* dum) { mDum = dum; }
41 virtual void add(const Tuple& target, int keepAliveInterval, bool targetSupportsOutbound);
42 virtual void remove(const Tuple& target);
43 virtual void process(KeepAliveTimeout& timeout);
44 virtual void process(KeepAlivePongTimeout& timeout);
45 virtual void receivedPong(const Tuple& flow);
46
47 protected:
48 DialogUsageManager* mDum;
49 NetworkAssociationMap mNetworkAssociations;
50 unsigned int mCurrentId;
51 };
52
53 }
54
55
56 #endif
57
58 /* ====================================================================
59 * The Vovida Software License, Version 1.0
60 *
61 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
62 *
63 * Redistribution and use in source and binary forms, with or without
64 * modification, are permitted provided that the following conditions
65 * are met:
66 *
67 * 1. Redistributions of source code must retain the above copyright
68 * notice, this list of conditions and the following disclaimer.
69 *
70 * 2. Redistributions in binary form must reproduce the above copyright
71 * notice, this list of conditions and the following disclaimer in
72 * the documentation and/or other materials provided with the
73 * distribution.
74 *
75 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
76 * and "Vovida Open Communication Application Library (VOCAL)" must
77 * not be used to endorse or promote products derived from this
78 * software without prior written permission. For written
79 * permission, please contact vocal@vovida.org.
80 *
81 * 4. Products derived from this software may not be called "VOCAL", nor
82 * may "VOCAL" appear in their name, without prior written
83 * permission of Vovida Networks, Inc.
84 *
85 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
86 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
87 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
88 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
89 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
90 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
91 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
92 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
93 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
94 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
95 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
96 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
97 * DAMAGE.
98 *
99 * ====================================================================
100 *
101 * This software consists of voluntary contributions made by Vovida
102 * Networks, Inc. and many individuals on behalf of Vovida Networks,
103 * Inc. For more information on Vovida Networks, Inc., please see
104 * <http://www.vovida.org/>.
105 *
106 */

Properties

Name Value
svn:eol-style native
svn:mime-type text/plain

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27