~ubuntu-branches/ubuntu/saucy/resiprocate/saucy-proposed

« back to all changes in this revision

Viewing changes to tfm/tfdum/ServerSubscriptionEvent.hxx

  • Committer: Package Import Robot
  • Author(s): Daniel Pocock
  • Date: 2012-05-17 19:29:59 UTC
  • Revision ID: package-import@ubuntu.com-20120517192959-vv00m77isztdy64q
Tags: upstream-1.8.2
ImportĀ upstreamĀ versionĀ 1.8.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#if !defined ServerSubscriptionEvent_hxx
 
2
#define ServerSubscriptionEvent_hxx
 
3
 
 
4
#include "resip/stack/SipMessage.hxx"
 
5
#include "tfm/Event.hxx"
 
6
#include "tfm/tfdum/DumEvent.hxx"
 
7
 
 
8
class DumUserAgent;
 
9
 
 
10
typedef enum
 
11
{
 
12
   ServerSubscription_Refresh,
 
13
   ServerSubscription_Published,
 
14
   ServerSubscription_Error,
 
15
   ServerSubscription_ExpiredByClient,
 
16
   ServerSubscription_Expired,
 
17
   ServerSubscription_Terminated,
 
18
   ServerSubscription_NewSubscription,
 
19
   ServerSubscription_NewSubscriptionFromRefer,
 
20
   ServerSubscription_ReadyToSend
 
21
} ServerSubscriptionEventType;
 
22
 
 
23
static const char* ServerSubscriptionEventTypeText[] =
 
24
{
 
25
   "Refresh",
 
26
   "Published",
 
27
   "Error",
 
28
   "Expired By Client",
 
29
   "Expired",
 
30
   "Terminated",
 
31
   "New Subscription",
 
32
   "New Subscription From Refer",
 
33
   "Ready-To-Send"
 
34
};
 
35
 
 
36
class ServerSubscriptionEvent : public DumEvent
 
37
{
 
38
   public:
 
39
      typedef ServerSubscriptionEventType Type;
 
40
      typedef resip::ServerSubscriptionHandle HandleType;
 
41
 
 
42
      ServerSubscriptionEvent(DumUserAgent* dua, Type type, resip::ServerSubscriptionHandle h) 
 
43
         : DumEvent(dua),
 
44
           mType(type),
 
45
           mHandle(h)
 
46
      {
 
47
      }
 
48
 
 
49
      ServerSubscriptionEvent(DumUserAgent* dua, Type type, resip::ServerSubscriptionHandle h, const resip::SipMessage& msg)
 
50
         : DumEvent(dua, msg),
 
51
           mType(type),
 
52
           mHandle(h)
 
53
      {
 
54
      }
 
55
 
 
56
      ServerSubscriptionEvent(DumUserAgent* dua, Type type, resip::ServerSubscriptionHandle h, resip::ServerPublicationHandle pub,
 
57
                              const resip::Contents* contents, const resip::SecurityAttributes* attrs)
 
58
         :DumEvent(dua),
 
59
          mType(type),
 
60
          mHandle(h),
 
61
          mServerPublication(pub)
 
62
      {
 
63
      }
 
64
 
 
65
      virtual resip::Data toString() const
 
66
      {
 
67
         resip::Data buffer;
 
68
         {
 
69
            resip::DataStream strm(buffer);
 
70
            strm << "ServerSubscriptionEvent - " << ServerSubscriptionEventTypeText[mType];
 
71
         }
 
72
         return buffer;
 
73
      }
 
74
 
 
75
      virtual resip::Data briefString() const
 
76
      {
 
77
         return toString();
 
78
      }
 
79
 
 
80
      static resip::Data getName() { return "ServerSubscriptionEvent"; }
 
81
      static resip::Data getTypeName(Type type) { return ServerSubscriptionEventTypeText[type]; }
 
82
 
 
83
      Type getType() const { return mType; }
 
84
      
 
85
      resip::ServerSubscriptionHandle& getHandle() { return mHandle; }
 
86
      
 
87
 
 
88
   protected:
 
89
      Type mType;
 
90
      resip::ServerSubscriptionHandle mHandle;
 
91
      resip::ServerPublicationHandle mServerPublication;
 
92
};
 
93
 
 
94
#endif