reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
DialogUsage.hxx
Go to the documentation of this file.
1#if !defined(RESIP_DIALOGUSAGE_HXX)
2#define RESIP_DIALOGUSAGE_HXX
3
9
10#include <memory>
11#include <utility>
12
13namespace resip
14{
15
16class DialogUsageManager;
17class Dialog;
18class DialogId;
19class DumTimeout;
20class SipMessage;
21class NameAddr;
22
23class DialogUsage : public BaseUsage
24{
25 public:
26 class Exception final : public BaseException
27 {
28 public:
29 Exception(const Data& msg, const Data& file, int line);
30 const char* name() const noexcept override;
31 };
32
35
36 // Convenience methods for accessing attributes of a dialog.
37
38 const NameAddr& myAddr() const noexcept;
39 const NameAddr& peerAddr() const noexcept;
40 const NameAddr& remoteTarget() const noexcept;
41 const NameAddr& pendingRemoteTarget() const;
42 const NameAddrs& getRouteSet() const noexcept;
43 const DialogId& getDialogId() const;
44 const Data& getCallId() const;
45 std::shared_ptr<UserProfile> getUserProfile() const;
46
47 protected:
48 friend class DialogSet;
49 friend class DialogUsageManager;
51
53 {
54 public:
55 DialogUsageSendCommand(DialogUsage& usage, std::shared_ptr<SipMessage> msg)
56 : mDialogUsage(usage),
57 mMessage(msg)
58 {
59 }
60
61 void executeCommand() override
62 {
63 mDialogUsage.send(mMessage);
64 }
65
66 EncodeStream& encodeBrief(EncodeStream& strm) const override
67 {
68 return strm << "DialogUsageSendCommand";
69 }
70 private:
71 DialogUsage& mDialogUsage;
72 std::shared_ptr<SipMessage> mMessage;
73 };
74
75
76 //virtual void send(SipMessage& msg);
77 virtual void send(std::shared_ptr<SipMessage> msg);
78 virtual void sendCommand(std::shared_ptr<SipMessage> msg);
79
80 // any usage that wants to give app a chance to adorn the message
81 // should override this method.
82 virtual void onReadyToSend(SipMessage&) {}
83
85 virtual ~DialogUsage();
86
88};
89
90}
91
92#endif
93
94/* ====================================================================
95 * The Vovida Software License, Version 1.0
96 *
97 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
98 *
99 * Redistribution and use in source and binary forms, with or without
100 * modification, are permitted provided that the following conditions
101 * are met:
102 *
103 * 1. Redistributions of source code must retain the above copyright
104 * notice, this list of conditions and the following disclaimer.
105 *
106 * 2. Redistributions in binary form must reproduce the above copyright
107 * notice, this list of conditions and the following disclaimer in
108 * the documentation and/or other materials provided with the
109 * distribution.
110 *
111 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
112 * and "Vovida Open Communication Application Library (VOCAL)" must
113 * not be used to endorse or promote products derived from this
114 * software without prior written permission. For written
115 * permission, please contact vocal@vovida.org.
116 *
117 * 4. Products derived from this software may not be called "VOCAL", nor
118 * may "VOCAL" appear in their name, without prior written
119 * permission of Vovida Networks, Inc.
120 *
121 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
122 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
123 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
124 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
125 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
126 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
127 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
128 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
129 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
130 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
131 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
132 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
133 * DAMAGE.
134 *
135 * ====================================================================
136 *
137 * This software consists of voluntary contributions made by Vovida
138 * Networks, Inc. and many individuals on behalf of Vovida Networks,
139 * Inc. For more information on Vovida Networks, Inc., please see
140 * <http://www.vovida.org/>.
141 *
142 */
static void usage(void)
Definition adig.c:755
The abstract base-class for all exceptions thrown by resip code.
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
DialogUsageSendCommand(DialogUsage &usage, std::shared_ptr< SipMessage > msg)
EncodeStream & encodeBrief(EncodeStream &strm) const override
output a brief description to stream
const char * name() const noexcept override
virtual void sendCommand(std::shared_ptr< SipMessage > msg)
const NameAddr & remoteTarget() const noexcept
std::shared_ptr< UserProfile > getUserProfile() const
const NameAddr & myAddr() const noexcept
virtual void onReadyToSend(SipMessage &)
AppDialogSetHandle getAppDialogSet() const
AppDialogHandle getAppDialog() const
const NameAddr & pendingRemoteTarget() const
const DialogId & getDialogId() const
const NameAddrs & getRouteSet() const noexcept
virtual void send(std::shared_ptr< SipMessage > msg)
const NameAddr & peerAddr() const noexcept
const Data & getCallId() const
dcm! – kill typedef std::list<DialogId> DialogIdSet;
Definition Dialog.hxx:29
Represents the "name-addr" and the "addr-spec" elements in the RFC 3261 grammar.
Definition NameAddr.hxx:19
Represents a SIP message.
dcm! – add UnusedChecking(_enum) below;
Handle< AppDialog > AppDialogHandle
Definition Handles.hxx:28
#define EncodeStream