/[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 8415 - (show annotations) (download)
Wed Feb 18 16:35:08 2009 UTC (10 years, 11 months ago) by adam
File MIME type: text/plain
File size: 8984 byte(s)
DUM test driver fixes, as proposed by Chris Brody

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

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