sync with master
[platform/framework/native/appfw.git] / inc / FIoMessagePortManager.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  * @file                FIoMessagePortManager.h
19  * @brief               This is the header file for the %MessagePortManager class.
20  *
21  * This header file contains declarations of the %MessagePortManager class.
22  */
23 #ifndef _FIO_MESSAGE_PORT_MANAGER_H_
24 #define _FIO_MESSAGE_PORT_MANAGER_H_
25
26 #include <FBaseResult.h>
27 #include <FBaseObject.h>
28 #include <FBaseDataType.h>
29 #include <FIoLocalMessagePort.h>
30 #include <FIoRemoteMessagePort.h>
31 #include <FAppTypes.h>
32
33 namespace Tizen { namespace Io
34 {
35
36 /**
37 * @class    MessagePortManager
38 * @brief    This class provides methods for managing message ports.
39 *
40 * @since    2.0
41 *
42 * @final        This class is not intended for extension.
43 *
44 * The %MessagePortManager class provides methods for managing message ports.
45 *
46 * For more information on the class features,
47 * see <a href="../org.tizen.native.appprogramming/html/guide/io/messageport.htm">Message Port Communication</a>.
48 *
49 * @see Tizen::Io::LocalMessagePort
50 * @see Tizen::Io::RemoteMessagePort
51 */
52
53 class _OSP_EXPORT_ MessagePortManager
54 {
55 public:
56         /**
57         * Requests for a LocalMessagePort instance with the specified message port name. @n
58         * This method returns the same %LocalMessagePort instance if it has already been called with the same message port name. @n
59         *
60         * @since    2.0
61         *
62         * @return       A pointer to the LocalMessagePort instance, @n
63         *                       else @c null if it fails
64         * @param[in]     localMessagePortName   The name of a local message port
65         * @exception     E_SUCCESS           The method is successful.
66         * @exception     E_INVALID_ARG       The @c localMessagePortName is empty.
67         * @exception     E_SYSTEM            The method has failed due to a severe system error.
68         * @remarks       It is not recommended to use the message port names which start with "http://tizen.org/messageport". E_INVALID_ARG may be returned because they are reserved by platform.
69         * @remarks       The specific error code can be accessed using the GetLastResult() method.
70         */
71         static LocalMessagePort* RequestLocalMessagePort(const Tizen::Base::String& localMessagePortName);
72
73         /**
74         * Requests the RemoteMessagePort instance with the specified remote application ID and message port name. @n
75         * This method returns the same %RemoteMessagePort instance if it has already been called with the same remote application ID and message port name.
76         *
77         * @since    2.0
78         *
79         * @return       A pointer to the RemoteMessagePort instance, @n
80         *                       else @c null if it fails
81         * @param[in]     remoteAppId                    The remote application ID
82         * @param[in]     remoteMessagePortName  The remote message port name
83         * @exception     E_SUCCESS           The method is successful.
84         * @exception     E_INVALID_ARG       The remote application ID or the remote message port name is empty.
85         * @exception     E_OBJ_NOT_FOUND     The message port of the target application is not found.
86         * @exception     E_SYSTEM            The method cannot proceed due to a severe system error.
87         * @remarks       The specific error code can be accessed using the GetLastResult() method.
88         */
89         static RemoteMessagePort* RequestRemoteMessagePort(const Tizen::App::AppId& remoteAppId, const Tizen::Base::String& remoteMessagePortName);
90
91         /**
92         * Requests for a trusted LocalMessagePort instance with the specified message port name. @n
93         * This method returns the same %LocalMessagePort instance if it has already been called with the same message port name. @n
94         * Communications over a trusted message port is allowed only if both the applications are signed with a certificate that is uniquely assigned to the developer.
95         *
96         * @since    2.0
97         *
98         * @return       A pointer to the trusted LocalMessagePort instance, @n
99         *                       else @c null if it fails
100         * @param[in]     localMessagePortName   The name of a local message port
101         * @exception     E_SUCCESS           The method is successful.
102         * @exception     E_INVALID_ARG       The @c localMessagePortName is empty.
103         * @exception     E_SYSTEM            The method has failed due to a severe system error.
104         * @remarks       It is not recommended to use the message port names which start with "http://tizen.org/messageport". E_INVALID_ARG may be returned because they are reserved by platform.
105         * @remarks       The specific error code can be accessed using the GetLastResult() method.
106         */
107         static LocalMessagePort* RequestTrustedLocalMessagePort(const Tizen::Base::String& localMessagePortName);
108
109         /**
110         * Requests the trusted RemoteMessagePort instance with the specified message port name. @n
111         * This method returns the same %RemoteMessagePort instance if it has already been called with the same remote application ID and message port name. @n
112         * This message port allows communications only if the applications are signed with the same certificate which is uniquely assigned to the developer.
113         *
114         * @since    2.0
115         *
116         * @return       A pointer to the trusted RemoteMessagePort instance, @n
117         *                       else @c null if it fails
118         * @param[in]     remoteAppId                    The remote application ID
119         * @param[in]     remoteMessagePortName  The name of a remote message port
120         * @exception     E_SUCCESS           The method is successful.
121         * @exception     E_INVALID_ARG       Either @c remoteAppId or @c remoteMessagePortName is empty.
122         * @exception     E_OBJ_NOT_FOUND     The message port of the target application is not found.
123         * @exception     E_CERTIFICATE_VERIFICATION_FAILED    The target application is not signed with the same certificate.
124         * @exception     E_SYSTEM            The method has failed due to a severe system error.
125         * @remarks       The specific error code can be accessed using the GetLastResult() method.
126         */
127         static RemoteMessagePort* RequestTrustedRemoteMessagePort(const Tizen::App::AppId& remoteAppId, const Tizen::Base::String& remoteMessagePortName);
128
129 private:
130         /**
131         * This default constructor is intentionally declared as private because this class cannot be constructed.
132         */
133         MessagePortManager(void);
134
135         /**
136         * This destructor is intentionally declared as private because this class cannot be constructed.
137         */
138         virtual ~MessagePortManager(void);
139
140         /**
141         * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
142         */
143         MessagePortManager(const MessagePortManager& messagePortManager);
144
145         /**
146         * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
147         */
148         MessagePortManager& operator =(const MessagePortManager& messagePortManager);
149
150 }; // MessagePortManager
151
152 } } // Tizen::Io
153
154 #endif //_FIO_MESSAGE_PORT_MANAGER_H_