sipxportlib  Version 3.3
OsMsg.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2007 SIPez LLC.
3 // Licensed to SIPfoundry under a Contributor Agreement.
4 //
5 // Copyright (C) 2004-2007 SIPfoundry Inc.
6 // Licensed by SIPfoundry under the LGPL license.
7 //
8 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
9 // Licensed to SIPfoundry under a Contributor Agreement.
10 //
11 // $$
13 
14 
15 #ifndef _OsMsg_h_
16 #define _OsMsg_h_
17 
18 // SYSTEM INCLUDES
19 
20 // APPLICATION INCLUDES
21 #include "os/OsDefs.h"
22 #include "utl/UtlContainable.h"
23 #include "os/OsAtomics.h"
24 
25 // DEFINES
26 // MACROS
27 // EXTERNAL FUNCTIONS
28 // EXTERNAL VARIABLES
29 // CONSTANTS
30 // STRUCTS
31 // TYPEDEFS
32 // FORWARD DECLARATIONS
33 
34 //:Base class for message queue buffers
35 
36 class OsMsg : public UtlContainable
37 {
38 /* //////////////////////////// PUBLIC //////////////////////////////////// */
39 public:
40 
41  enum MsgTypes
42  {
44  OS_SHUTDOWN, // Task shutdown request message
45  OS_TIMER, // Timer request messages
46  OS_EVENT, // Event notification messages
47  PS_MSG, // Phone set messages
48  PHONE_APP, // Phone application messages
49  MP_TASK_MSG, // Media processing task messages
50  MP_FLOWGRAPH_MSG, // Media processing flowgraph messages
51  MP_RESOURCE_MSG, // Media resource messages
52  MP_RES_NOTF_MSG, // Media resource notification messages
53  MP_BUFFER_MSG, // Media processing buffer queue messages
54  MI_NOTF_MSG, // Media Interface notification messages
55  SIP_PROXY_STATE, // SIP proxy call state message
56  TAO_MSG, // Tao messages
57  TAO_EVENT, // Tao listener event messages
58  TAO_LISTENER_EVENT_MSG,// Tao listener event message (call backs)
59  PINGER_MSG, // Pinger messages
62  OS_SYSLOG, // OS SysLog events
63  STREAMING_MSG, // Streaming related messages
64  USER_START = 128
65  };
78 
79  static const UtlContainableType TYPE ;
80 /* ============================ CREATORS ================================== */
81 
82  OsMsg(const unsigned char msgType, const unsigned char msgSubType);
83  //:Constructor
84 
85  OsMsg(const OsMsg& rOsMsg);
86  //:Copy constructor
87 
88  virtual OsMsg* createCopy(void) const;
89  //:Create a copy of this msg object (which may be of a derived type)
90 
91  virtual void releaseMsg(void);
92  //:Done with message, delete it or mark it unused
93 
94  virtual
95  ~OsMsg();
96  //:Destructor
97 
98 /* ============================ MANIPULATORS ============================== */
99 
100  OsMsg& operator=(const OsMsg& rhs);
101  //:Assignment operator
102 
103  virtual void setMsgSubType(unsigned char subType);
104  //:Set the message subtype
105 
106  virtual void setSentFromISR(UtlBoolean sentFromISR);
107  //:Set the SentFromISR (interrupt service routine) flag
108 
109  virtual void setReusable(UtlBoolean isReusable);
110  //:Set the Is Reusable (from permanent pool) flag
111 
112  virtual void setInUse(UtlBoolean isInUse);
113  //:Set the Is In Use flag
114 
115 /* ============================ ACCESSORS ================================= */
116 
117  virtual unsigned char getMsgType(void) const;
118  //:Return the message type
119 
120  virtual unsigned char getMsgSubType(void) const;
121  //:Return the message subtype
122 
123  virtual int getMsgSize(void) const;
124  //:Return the size of the message in bytes
125  // This is a virtual method so that it will return the accurate size for
126  // the message object even if that object has been upcast to the type of
127  // an ancestor class.
128 
129  virtual UtlBoolean getSentFromISR(void) const;
130  //:Return TRUE if msg was sent from an interrupt svc routine, else FALSE
131 
132  virtual UtlBoolean isMsgReusable(void) const;
133  //:Return TRUE if msg is from a permanent pool, else FALSE
134 
135  virtual UtlBoolean isMsgInUse(void) const;
136  //:Return TRUE if msg is currently in use, else FALSE
137 
139  virtual unsigned hash() const;
140 
141  virtual UtlContainableType getContainableType() const;
142 
143  virtual int compareTo(UtlContainable const *) const;
144 
145 /* ============================ INQUIRY =================================== */
146 
147 /* //////////////////////////// PROTECTED ///////////////////////////////// */
148 protected:
149 
150 /* //////////////////////////// PRIVATE /////////////////////////////////// */
151 private:
152  unsigned char mMsgType;
153  unsigned char mMsgSubType;
154  UtlBoolean mSentFromISR;
155  UtlBoolean mReusable;
156  OsAtomicLightBool mInUse;
157 
162 };
163 
164 /* ============================ INLINE METHODS ============================ */
165 
166 #endif // _OsMsg_h_
Definition: OsMsg.h:47
virtual void setReusable(UtlBoolean isReusable)
Definition: OsMsg.cpp:103
Definition: OsMsg.h:60
Definition: OsMsg.h:61
virtual unsigned char getMsgType(void) const
Definition: OsMsg.cpp:117
virtual OsMsg * createCopy(void) const
Definition: OsMsg.cpp:50
virtual unsigned hash() const
Implements the interface for a UtlContainable.
Definition: OsMsg.cpp:156
Definition: OsMsg.h:54
OsAtomicLight< bool > OsAtomicLightBool
Definition: OsAtomics.h:357
Definition: OsMsg.h:64
virtual unsigned char getMsgSubType(void) const
Definition: OsMsg.cpp:123
OsMsg(const unsigned char msgType, const unsigned char msgSubType)
Definition: OsMsg.cpp:29
OsMsg & operator=(const OsMsg &rhs)
Definition: OsMsg.cpp:76
Definition: OsMsg.h:55
const char *const UtlContainableType
Definition: UtlDefs.h:70
virtual void setSentFromISR(UtlBoolean sentFromISR)
Definition: OsMsg.cpp:97
Definition: OsMsg.h:62
Definition: OsMsg.h:45
Definition: OsMsg.h:52
Definition: UtlContainable.h:37
Definition: OsMsg.h:53
Definition: OsMsg.h:58
Definition: OsMsg.h:51
Definition: OsMsg.h:63
virtual UtlBoolean isMsgInUse(void) const
Definition: OsMsg.cpp:150
Definition: OsMsg.h:59
virtual UtlBoolean getSentFromISR(void) const
Definition: OsMsg.cpp:138
virtual UtlContainableType getContainableType() const
Definition: OsMsg.cpp:161
Definition: OsMsg.h:43
virtual UtlBoolean isMsgReusable(void) const
Definition: OsMsg.cpp:144
virtual void releaseMsg(void)
Definition: OsMsg.cpp:56
Definition: OsMsg.h:50
Definition: OsMsg.h:49
virtual void setInUse(UtlBoolean isInUse)
Definition: OsMsg.cpp:109
MsgTypes
Definition: OsMsg.h:41
int UtlBoolean
Definition: UtlDefs.h:41
Definition: OsMsg.h:36
Definition: OsMsg.h:44
virtual int getMsgSize(void) const
Definition: OsMsg.cpp:132
virtual int compareTo(UtlContainable const *) const
Compare this object to another object.
Definition: OsMsg.cpp:166
virtual ~OsMsg()
Definition: OsMsg.cpp:66
static const UtlContainableType TYPE
enumcode: OS_SHUTDOWN - Task shutdown request message enumcode: OS_TIMER - Timer request messages enu...
Definition: OsMsg.h:79
Definition: OsMsg.h:48
Definition: OsMsg.h:46
Definition: OsMsg.h:57
Definition: OsMsg.h:56
virtual void setMsgSubType(unsigned char subType)
Definition: OsMsg.cpp:91