sipxportlib  Version 3.3
OsRpcMsg.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2006 SIPfoundry Inc.
3 // Licensed by SIPfoundry under the LGPL license.
4 //
5 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
6 // Licensed to SIPfoundry under a Contributor Agreement.
7 //
8 // $$
10 
11 
12 #ifndef _OsRpcMsg_h_
13 #define _OsRpcMsg_h_
14 
15 // SYSTEM INCLUDES
16 
17 // APPLICATION INCLUDES
18 #include "os/OsDefs.h"
19 #include "os/OsMsg.h"
20 #include "os/OsMsgQ.h"
21 
22 // DEFINES
23 // MACROS
24 // EXTERNAL FUNCTIONS
25 // EXTERNAL VARIABLES
26 // CONSTANTS
27 // STRUCTS
28 // TYPEDEFS
29 
30 // FORWARD DECLARATIONS
31 class OsEvent;
32 
33 //:Message object used for synchronous (RPC-style) inter-task communication
34 // RPC inter-task communication works as follows:
35 // <p>The client task sends an RPC message to the server task. The RPC message
36 // includes a pointer to an OsEvent object. After sending the message, the
37 // client either polls or blocks while waiting for the completion event to
38 // be signaled. <p>When the server finishes the requested operation, it uses
39 // the OsEvent to specify an integer result and to signal that the operation
40 // has completed.
41 
42 class OsRpcMsg : public OsMsg
43 {
44 /* //////////////////////////// PUBLIC //////////////////////////////////// */
45 public:
46 
48  {
49  REQUEST // message from client to server
50  };
52 
53 /* ============================ CREATORS ================================== */
54 
55  OsRpcMsg(const unsigned char msgType, const unsigned char msgSubType,
56  const OsEvent& rEvent);
57  //:Constructor
58 
59  OsRpcMsg(const OsRpcMsg& rOsRpcMsg);
60  //:Copy constructor
61 
62  virtual OsMsg* createCopy(void) const;
63  //:Create a copy of this msg object (which may be of a derived type)
64 
65  virtual
66  ~OsRpcMsg();
67  //:Destructor
68 
69 /* ============================ MANIPULATORS ============================== */
70 
71  OsRpcMsg& operator=(const OsRpcMsg& rhs);
72  //:Assignment operator
73 
74 /* ============================ ACCESSORS ================================= */
75 
76  virtual int getMsgSize(void) const;
77  //:Return the size of the message in bytes
78  // This is a virtual method so that it will return the accurate size for
79  // the message object even if that object has been upcast to the type of
80  // an ancestor class.
81 
82  virtual OsEvent* getEvent(void) const;
83  //:Return the pointer to the OsEvent object used to signal completion
84 
85 /* ============================ INQUIRY =================================== */
86 
87 /* //////////////////////////// PROTECTED ///////////////////////////////// */
88 protected:
89 
90 /* //////////////////////////// PRIVATE /////////////////////////////////// */
91 private:
92  OsEvent* mpEvent; // pointer to the OsEvent used to signal completion
93 
94 };
95 
96 /* ============================ INLINE METHODS ============================ */
97 
98 #endif // _OsRpcMsg_h_
99 
OsRpcMsgType
Definition: OsRpcMsg.h:47
virtual ~OsRpcMsg()
Definition: OsRpcMsg.cpp:52
virtual OsEvent * getEvent(void) const
Definition: OsRpcMsg.cpp:84
virtual OsMsg * createCopy(void) const
Definition: OsRpcMsg.cpp:46
OsRpcMsg & operator=(const OsRpcMsg &rhs)
Definition: OsRpcMsg.cpp:61
Definition: OsRpcMsg.h:49
Events are used to synchronize a task with an ISR or between two tasks.
Definition: OsEvent.h:70
OsRpcMsg(const unsigned char msgType, const unsigned char msgSubType, const OsEvent &rEvent)
enumcode: Request - Message from client to server
Definition: OsRpcMsg.cpp:28
Definition: OsRpcMsg.h:42
Definition: OsMsg.h:36
virtual int getMsgSize(void) const
Definition: OsRpcMsg.cpp:78