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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8200 - (hide annotations) (download)
Fri Aug 15 19:43:07 2008 UTC (11 years, 3 months ago) by bcampen
File size: 3299 byte(s)
Merge work from branches/dialog-event-20080108.

1 bcampen 8200 #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     // .jjg. we'll only have the DialogSetId if we aren't yet in the 'early' state;
80     // once we get to early, we'll remove the DialogSetId in favour of the DialogId.
81     // The comparator/key of the map must have an ordering so that a key can be
82     // contructed which points to the beginning of a dialogSet. This could be done by
83     // no remote tag being always, which might be the existing behaviour, but
84     // shouldn't be relied on.
85     std::map<DialogId, DialogEventInfo*, DialogIdComparator> mDialogIdToEventInfo;
86    
87     DialogEventHandler* mDialogEventHandler;
88     };
89    
90     }
91     #endif

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27