/[resiprocate]/main/resip/dum/test/UserAgent.hxx
ViewVC logotype

Contents of /main/resip/dum/test/UserAgent.hxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9493 - (show annotations) (download)
Sat Apr 7 10:56:50 2012 UTC (7 years, 5 months ago) by dpocock
File MIME type: text/plain
File size: 9033 byte(s)
Include config.h from even more places where it may be needed
1 #if !defined(DUM_UserAgent_hxx)
2 #define DUM_UserAgent_hxx
3
4 #ifdef HAVE_CONFIG_H
5 #include "config.h"
6 #endif
7
8 #include "CommandLineParser.hxx"
9
10 #include "resip/stack/StackThread.hxx"
11 #include "resip/dum/MasterProfile.hxx"
12 #include "resip/dum/RegistrationHandler.hxx"
13 #include "resip/dum/SubscriptionHandler.hxx"
14 #include "resip/dum/PublicationHandler.hxx"
15 #include "resip/dum/OutOfDialogHandler.hxx"
16 #include "resip/dum/InviteSessionHandler.hxx"
17 #include "resip/dum/DialogUsageManager.hxx"
18
19 namespace resip
20 {
21
22 class UserAgent : public CommandLineParser,
23 public ClientRegistrationHandler,
24 public ClientSubscriptionHandler,
25 public ClientPublicationHandler,
26 public OutOfDialogHandler,
27 public InviteSessionHandler
28 {
29 public:
30 UserAgent(int argc, char** argv);
31 virtual ~UserAgent();
32
33 virtual void startup();
34 virtual void shutdown();
35
36 void process();
37
38 public:
39 // Invite Session Handler /////////////////////////////////////////////////////
40 virtual void onNewSession(ClientInviteSessionHandle h, InviteSession::OfferAnswerType oat, const SipMessage& msg);
41 virtual void onNewSession(ServerInviteSessionHandle h, InviteSession::OfferAnswerType oat, const SipMessage& msg);
42 virtual void onFailure(ClientInviteSessionHandle h, const SipMessage& msg);
43 virtual void onEarlyMedia(ClientInviteSessionHandle, const SipMessage&, const SdpContents&);
44 virtual void onProvisional(ClientInviteSessionHandle, const SipMessage& msg);
45 virtual void onConnected(ClientInviteSessionHandle h, const SipMessage& msg);
46 virtual void onConnected(InviteSessionHandle, const SipMessage& msg);
47 virtual void onStaleCallTimeout(ClientInviteSessionHandle);
48 virtual void onTerminated(InviteSessionHandle h, InviteSessionHandler::TerminatedReason reason, const SipMessage* msg);
49 virtual void onRedirected(ClientInviteSessionHandle, const SipMessage& msg);
50 virtual void onAnswer(InviteSessionHandle, const SipMessage& msg, const SdpContents&);
51 virtual void onOffer(InviteSessionHandle handle, const SipMessage& msg, const SdpContents& offer);
52 virtual void onOfferRequired(InviteSessionHandle, const SipMessage& msg);
53 virtual void onOfferRejected(InviteSessionHandle, const SipMessage* msg);
54 virtual void onDialogModified(InviteSessionHandle, InviteSession::OfferAnswerType oat, const SipMessage& msg);
55 virtual void onInfo(InviteSessionHandle, const SipMessage& msg);
56 virtual void onInfoSuccess(InviteSessionHandle, const SipMessage& msg);
57 virtual void onInfoFailure(InviteSessionHandle, const SipMessage& msg);
58 virtual void onRefer(InviteSessionHandle, ServerSubscriptionHandle, const SipMessage& msg);
59 virtual void onReferAccepted(InviteSessionHandle, ClientSubscriptionHandle, const SipMessage& msg);
60 virtual void onReferRejected(InviteSessionHandle, const SipMessage& msg);
61 virtual void onReferNoSub(InviteSessionHandle, const SipMessage& msg);
62
63 virtual void onMessage(InviteSessionHandle, const SipMessage& msg);
64 virtual void onMessageSuccess(InviteSessionHandle, const SipMessage& msg);
65 virtual void onMessageFailure(InviteSessionHandle, const SipMessage& msg);
66
67 // Registration Handler ////////////////////////////////////////////////////////
68 virtual void onSuccess(ClientRegistrationHandle h, const SipMessage& response);
69 virtual void onFailure(ClientRegistrationHandle h, const SipMessage& response);
70 virtual void onRemoved(ClientRegistrationHandle h, const SipMessage& response);
71 virtual int onRequestRetry(ClientRegistrationHandle h, int retryMinimum, const SipMessage& msg);
72
73 // ClientSubscriptionHandler ///////////////////////////////////////////////////
74 virtual void onUpdatePending(ClientSubscriptionHandle h, const SipMessage& notify, bool outOfOrder);
75 virtual void onUpdateActive(ClientSubscriptionHandle h, const SipMessage& notify, bool outOfOrder);
76 virtual void onUpdateExtension(ClientSubscriptionHandle, const SipMessage& notify, bool outOfOrder);
77 virtual void onTerminated(ClientSubscriptionHandle h, const SipMessage* notify);
78 virtual void onNewSubscription(ClientSubscriptionHandle h, const SipMessage& notify);
79 virtual int onRequestRetry(ClientSubscriptionHandle h, int retryMinimum, const SipMessage& notify);
80
81 // ClientPublicationHandler ////////////////////////////////////////////////////
82 virtual void onSuccess(ClientPublicationHandle h, const SipMessage& status);
83 virtual void onRemove(ClientPublicationHandle h, const SipMessage& status);
84 virtual void onFailure(ClientPublicationHandle h, const SipMessage& response);
85 virtual int onRequestRetry(ClientPublicationHandle h, int retryMinimum, const SipMessage& response);
86
87 // OutOfDialogHandler //////////////////////////////////////////////////////////
88 virtual void onSuccess(ClientOutOfDialogReqHandle, const SipMessage& response);
89 virtual void onFailure(ClientOutOfDialogReqHandle, const SipMessage& response);
90 virtual void onReceivedRequest(ServerOutOfDialogReqHandle, const SipMessage& request);
91 virtual void onForkDestroyed(ClientInviteSessionHandle);
92
93 class EndInviteSessionCommand : public DumCommand
94 {
95 public:
96 EndInviteSessionCommand(InviteSessionHandle h) : mHandle(h)
97 {}
98
99 virtual void executeCommand()
100 {
101 if(mHandle.isValid() && !mHandle->isTerminated())
102 {
103 mHandle->end();
104 }
105 }
106
107 virtual Message* clone() const
108 {
109 return new EndInviteSessionCommand(mHandle);
110 }
111
112 #ifdef RESIP_USE_STL_STREAMS
113 virtual std::ostream& encode(std::ostream& str) const
114 #else
115 virtual EncodeStream& encode(EncodeStream& str) const
116 #endif
117 {
118 return str << "EndInviteSessionCommand";
119 }
120
121 #ifdef RESIP_USE_STL_STREAMS
122 virtual std::ostream& encodeBrief(std::ostream& str) const
123 #else
124 virtual EncodeStream& encodeBrief(EncodeStream& str) const
125 #endif
126 {
127 return encode(str);
128 }
129
130 private:
131 InviteSessionHandle mHandle;
132 };
133
134 protected:
135 void addTransport(TransportType type, int port);
136
137 SharedPtr<MasterProfile> mProfile;
138 Security* mSecurity;
139 SipStack mStack;
140 DialogUsageManager mDum;
141 StackThread mStackThread;
142 };
143
144 }
145
146 #endif
147
148 /* ====================================================================
149 * The Vovida Software License, Version 1.0
150 *
151 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
152 *
153 * Redistribution and use in source and binary forms, with or without
154 * modification, are permitted provided that the following conditions
155 * are met:
156 *
157 * 1. Redistributions of source code must retain the above copyright
158 * notice, this list of conditions and the following disclaimer.
159 *
160 * 2. Redistributions in binary form must reproduce the above copyright
161 * notice, this list of conditions and the following disclaimer in
162 * the documentation and/or other materials provided with the
163 * distribution.
164 *
165 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
166 * and "Vovida Open Communication Application Library (VOCAL)" must
167 * not be used to endorse or promote products derived from this
168 * software without prior written permission. For written
169 * permission, please contact vocal@vovida.org.
170 *
171 * 4. Products derived from this software may not be called "VOCAL", nor
172 * may "VOCAL" appear in their name, without prior written
173 * permission of Vovida Networks, Inc.
174 *
175 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
176 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
177 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
178 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
179 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
180 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
181 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
182 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
183 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
184 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
185 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
186 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
187 * DAMAGE.
188 *
189 * ====================================================================
190 *
191 * This software consists of voluntary contributions made by Vovida
192 * Networks, Inc. and many individuals on behalf of Vovida Networks,
193 * Inc. For more information on Vovida Networks, Inc., please see
194 * <http://www.vovida.org/>.
195 *
196 */

Properties

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

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.26