vfs: check userland buffers before reading them.
[haiku.git] / src / tests / kits / app / bmessenger / SMTarget.h
bloba30b6aba73b2ba76c1bd0a0db10d317a350767c4
1 // SMTarget.h
3 #ifndef SM_TARGET_H
4 #define SM_TARGET_H
6 #include <Messenger.h>
8 class SMHandler;
9 class SMLooper;
11 // SMTarget
12 class SMTarget {
13 public:
14 SMTarget();
15 virtual ~SMTarget();
17 virtual void Init(bigtime_t unblockTime, bigtime_t replyDelay);
19 virtual BHandler *Handler();
20 virtual BMessenger Messenger();
21 virtual bool DeliverySuccess();
24 // LocalSMTarget
25 class LocalSMTarget : public SMTarget {
26 public:
27 LocalSMTarget(bool preferred);
28 virtual ~LocalSMTarget();
30 virtual void Init(bigtime_t unblockTime, bigtime_t replyDelay);
32 virtual BHandler *Handler();
33 virtual BMessenger Messenger();
35 virtual bool DeliverySuccess();
37 private:
38 SMHandler *fHandler;
39 SMLooper *fLooper;
42 // RemoteSMTarget
43 class RemoteSMTarget : public SMTarget {
44 public:
45 RemoteSMTarget(bool preferred);
46 virtual ~RemoteSMTarget();
48 virtual void Init(bigtime_t unblockTime, bigtime_t replyDelay);
50 virtual BMessenger Messenger();
52 virtual bool DeliverySuccess();
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);
59 private:
60 port_id fLocalPort;
61 port_id fRemotePort;
62 BMessenger fTarget;
64 static int32 fID;
67 #endif // SM_TARGET_H