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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8973 - (show annotations) (download)
Mon Jan 17 22:14:07 2011 UTC (8 years, 10 months ago) by bcampen
File size: 3380 byte(s)
Fixing a few crashes. Fixing all of the non-threadsafe accesses to DUM
stuff is going to take a _while_.

1 #if !defined(RESIP_DialogEventStateManager_HXX)
2 #define RESIP_DialogEventStateManager_HXX
3
4 #include "resip/dum/DialogEventInfo.hxx"
5 #include "resip/dum/DialogEventHandler.hxx"
6 #include "resip/dum/InviteSessionHandler.hxx"
7 #include "resip/dum/Dialog.hxx"
8 #include "resip/dum/DialogSet.hxx"
9
10 namespace resip
11 {
12
13 /**
14 * Implements the FSM for dialog state as spec'd in RFC 4235.
15 * Called from DialogSet, ClientInviteSession, and ServerInviteSession.
16 */
17 class DialogEventStateManager
18 {
19 public:
20 typedef std::vector<DialogEventInfo> DialogEventInfos;
21 DialogEventInfos getDialogEventInfo() const;
22
23 virtual ~DialogEventStateManager();
24
25 private:
26 DialogEventStateManager();
27
28 void onTryingUas(Dialog& dialog, const SipMessage& invite);
29 void onTryingUac(DialogSet& dialogSet, const SipMessage& invite);
30 void onProceedingUac(const DialogSet& dialogSet, const SipMessage& response);
31
32 //?dcm? how is direction determined when the onEarly is the first use of
33 //this dialog?
34 void onEarly(const Dialog& dialog, InviteSessionHandle is);
35
36 void onConfirmed(const Dialog& dialog, InviteSessionHandle is);
37 void onTerminated(const Dialog& dialog, const SipMessage& msg, InviteSessionHandler::TerminatedReason reason);
38
39 void onTerminated(const DialogSet& dialogSet, const SipMessage& msg, InviteSessionHandler::TerminatedReason reason);
40
41
42 // order by DialogSet, such that the following ordering occurs
43 // DialogSetId remoteTag
44 // a null
45 // a 1
46 // a 2
47 // b 1
48 // b 2
49 class DialogIdComparator
50 {
51 public:
52 bool operator()(const DialogId& x, const DialogId& y) const
53 {
54 if (x.getDialogSetId() == y.getDialogSetId())
55 {
56 return (x.getRemoteTag() < y.getRemoteTag());
57 }
58 return (x.getDialogSetId() < y.getDialogSetId());
59 }
60 };
61
62 DialogEventInfo* findOrCreateDialogInfo(const Dialog& dialog);
63
64 void onDialogSetTerminatedImpl(const DialogSetId& dialogSetId, const SipMessage& msg, InviteSessionHandler::TerminatedReason reason);
65 TerminatedDialogEvent* onDialogTerminatedImpl(DialogEventInfo* eventInfo, InviteSessionHandler::TerminatedReason reason,
66 int responseCode = 0, Uri* remoteTarget = NULL);
67
68 static int getResponseCode(const SipMessage& msg);
69 static Uri* getFrontContact(const SipMessage& msg);
70
71 private:
72
73 friend class DialogUsageManager;
74 friend class ServerInviteSession;
75 friend class ClientInviteSession;
76 friend class InviteSession;
77 friend class DialogSet;
78
79 // disabled
80 DialogEventStateManager(const DialogEventStateManager& orig);
81
82 // .jjg. we'll only have the DialogSetId if we aren't yet in the 'early' state;
83 // once we get to early, we'll remove the DialogSetId in favour of the DialogId.
84 // The comparator/key of the map must have an ordering so that a key can be
85 // contructed which points to the beginning of a dialogSet. This could be done by
86 // no remote tag being always, which might be the existing behaviour, but
87 // shouldn't be relied on.
88 std::map<DialogId, DialogEventInfo*, DialogIdComparator> mDialogIdToEventInfo;
89
90 DialogEventHandler* mDialogEventHandler;
91 };
92
93 }
94 #endif

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27