e56693dc176e1c4d097bdc32bf7555f171f97964
[platform/framework/native/channel-service.git] / inc / FIo_MessagePortStub.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file        FIo_MessagePortStub.h
20  * @brief       This is the header file for the _MessagePortStub class.
21  *
22  * This file contains the declarations of _MessagePortStub.
23  */
24
25
26 #ifndef _FIO_INTERNAL_MESSAGE_PORT_STUB_H_
27 #define _FIO_INTERNAL_MESSAGE_PORT_STUB_H_
28
29 #include <FBaseResult.h>
30 #include <FBaseObject.h>
31 #include <FBaseColArrayList.h>
32 #include <FBaseColHashMap.h>
33 #include <FAppTypes.h>
34
35 #include <FIo_IIpcServerEventListener.h>
36
37 namespace IPC
38 {
39 class Message;
40 }
41
42 namespace Tizen { namespace Io
43 {
44 class _IpcServer;
45
46 class _MessagePortService;
47
48 class _MessagePortStub
49         : public Tizen::Io::_IIpcServerEventListener
50 {
51 public:
52         _MessagePortStub(void);
53         virtual ~_MessagePortStub(void);
54
55         virtual result Construct(void);
56
57         result SendMessage(int clientId,
58                                                 const Tizen::Base::String& destPort,
59                                                 bool isTrusted,
60                                                 const Tizen::Base::Collection::HashMap* pMap);
61
62         result SendMessage(int clientId,
63                                                 const Tizen::Base::String& destPort,
64                                                 bool isTrustedDest,
65                                                 const Tizen::Base::String& src,
66                                                 const Tizen::Base::String& srcPort,
67                                                 bool isTrustedSrc,
68                                                 const Tizen::Base::Collection::HashMap* pMap);
69
70         void SetMessagePortService(_MessagePortService& service);
71
72
73 private:
74         bool OnRegisterMessagePort(const Tizen::Base::String& appId, const Tizen::Base::String& port, bool isTrusted,  int* pResult);
75
76         bool OnRequestRemotePort(const Tizen::App::AppId& remoteAppId, const Tizen::Base::String& remotePort, bool isTrusted, int* pResult);
77
78         bool OnSendMessage(const Tizen::Base::String& dest,
79                                         const Tizen::Base::String& destPort,
80                                         bool isTrusted,
81                                         const Tizen::Base::Collection::HashMap& map,
82                                         int* pResult);
83
84         bool OnSendBidirMessage(const Tizen::Base::String& src,
85                                                         const Tizen::Base::String& srcPort,
86                                                         bool isTrusted,
87                                                         const Tizen::Base::String& dest,
88                                                         const Tizen::Base::String& destPort,
89                                                         const Tizen::Base::Collection::HashMap& map,
90                                                         int* pResult);
91
92         bool OnSendTrustedBidirMessage(const Tizen::Base::String& src,
93                                                         const Tizen::Base::String& srcPort,
94                                                         bool isTrusted,
95                                                         const Tizen::Base::String& dest,
96                                                         const Tizen::Base::String& destPort,
97                                                         const Tizen::Base::Collection::HashMap& map,
98                                                         int* pResult);
99
100         virtual void OnIpcRequestReceived(Tizen::Io::_IpcServer& server, const IPC::Message& message);
101
102         virtual void OnIpcServerStarted(const Tizen::Io::_IpcServer& server);
103
104         virtual void OnIpcServerStopped(const Tizen::Io::_IpcServer& server);
105
106         virtual void OnIpcClientConnected(const Tizen::Io::_IpcServer& server, int clientId);
107
108         virtual void OnIpcClientDisconnected(const Tizen::Io::_IpcServer& server, int clientId);
109
110         _MessagePortStub(const _MessagePortStub& value);
111         _MessagePortStub& operator = (const _MessagePortStub& value);
112
113 private:
114         Tizen::Io::_IpcServer* __pIpcServer;
115         _MessagePortService* __pService;
116
117 }; // _MessagePortStub
118
119 } } // Tizen::Io
120
121 #endif // _FIO_INTERNAL_MESSAGE_PORT_STUB_H_
122