1 // SMTarget.h 2 3 #ifndef SM_TARGET_H 4 #define SM_TARGET_H 5 6 #include <Messenger.h> 7 8 class SMHandler; 9 class SMLooper; 10 11 // SMTarget 12 class SMTarget { 13 public: 14 SMTarget(); 15 virtual ~SMTarget(); 16 17 virtual void Init(bigtime_t unblockTime, bigtime_t replyDelay); 18 19 virtual BHandler *Handler(); 20 virtual BMessenger Messenger(); 21 virtual bool DeliverySuccess(); 22 }; 23 24 // LocalSMTarget 25 class LocalSMTarget : public SMTarget { 26 public: 27 LocalSMTarget(bool preferred); 28 virtual ~LocalSMTarget(); 29 30 virtual void Init(bigtime_t unblockTime, bigtime_t replyDelay); 31 32 virtual BHandler *Handler(); 33 virtual BMessenger Messenger(); 34 35 virtual bool DeliverySuccess(); 36 37 private: 38 SMHandler *fHandler; 39 SMLooper *fLooper; 40 }; 41 42 // RemoteSMTarget 43 class RemoteSMTarget : public SMTarget { 44 public: 45 RemoteSMTarget(bool preferred); 46 virtual ~RemoteSMTarget(); 47 48 virtual void Init(bigtime_t unblockTime, bigtime_t replyDelay); 49 50 virtual BMessenger Messenger(); 51 52 virtual bool DeliverySuccess(); 53 54 private: 55 status_t _SendRequest(int32 code, const void *buffer = NULL, 56 size_t size = 0); 57 status_t _GetReply(int32 code, void *buffer, size_t size); 58 59 private: 60 port_id fLocalPort; 61 port_id fRemotePort; 62 BMessenger fTarget; 63 64 static int32 fID; 65 }; 66 67 #endif // SM_TARGET_H 68