sync with tizen_2.0
[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       The specific error code can be accessed using the GetLastResult() method.
69         */
70         static LocalMessagePort* RequestLocalMessagePort(const Tizen::Base::String& localMessagePortName);
71
72         /**
73         * Requests the RemoteMessagePort instance with the specified remote application ID and message port name. @n
74         * This method returns the same %RemoteMessagePort instance if it has already been called with the same remote application ID and message port name.
75         *
76         * @since    2.0
77         *
78         * @return       A pointer to the RemoteMessagePort instance, @n
79         *                       else @c null if it fails
80         * @param[in]     remoteAppId                    The remote application ID
81         * @param[in]     remoteMessagePortName  The remote message port name
82         * @exception     E_SUCCESS           The method is successful.
83         * @exception     E_INVALID_ARG       The remote application ID or the remote message port name is empty.
84         * @exception     E_OBJ_NOT_FOUND     The message port of the target application is not found.
85         * @exception     E_SYSTEM            The method cannot proceed due to a severe system error.
86         * @remarks       The specific error code can be accessed using the GetLastResult() method.
87         */
88         static RemoteMessagePort* RequestRemoteMessagePort(const Tizen::App::AppId& remoteAppId, const Tizen::Base::String& remoteMessagePortName);
89
90         /**
91         * Requests for a trusted LocalMessagePort instance with the specified message port name. @n
92         * This method returns the same %LocalMessagePort instance if it has already been called with the same message port name. @n
93         * 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.
94         *
95         * @since    2.0
96         *
97         * @return       A pointer to the trusted LocalMessagePort instance, @n
98         *                       else @c null if it fails
99         * @param[in]     localMessagePortName   The name of a local message port
100         * @exception     E_SUCCESS           The method is successful.
101         * @exception     E_INVALID_ARG       The @c localMessagePortName is empty.
102         * @exception     E_SYSTEM            The method has failed due to a severe system error.
103         * @remarks       The specific error code can be accessed using the GetLastResult() method.
104         */
105         static LocalMessagePort* RequestTrustedLocalMessagePort(const Tizen::Base::String& localMessagePortName);
106
107         /**
108         * Requests the trusted RemoteMessagePort instance with the specified message port name. @n
109         * This method returns the same %RemoteMessagePort instance if it has already been called with the same remote application ID and message port name. @n
110         * This message port allows communications only if the applications are signed with the same certificate which is uniquely assigned to the developer.
111         *
112         * @since    2.0
113         *
114         * @return       A pointer to the trusted RemoteMessagePort instance, @n
115         *                       else @c null if it fails
116         * @param[in]     remoteAppId                    The remote application ID
117         * @param[in]     remoteMessagePortName  The name of a remote message port
118         * @exception     E_SUCCESS           The method is successful.
119         * @exception     E_INVALID_ARG       Either @c remoteAppId or @c remoteMessagePortName is empty.
120         * @exception     E_OBJ_NOT_FOUND     The message port of the target application is not found.
121         * @exception     E_CERTIFICATE_VERIFICATION_FAILED    The target application is not signed with the same certificate.
122         * @exception     E_SYSTEM            The method has failed due to a severe system error.
123         * @remarks       The specific error code can be accessed using the GetLastResult() method.
124         */
125         static RemoteMessagePort* RequestTrustedRemoteMessagePort(const Tizen::App::AppId& remoteAppId, const Tizen::Base::String& remoteMessagePortName);
126
127 private:
128         /**
129         * This default constructor is intentionally declared as private because this class cannot be constructed.
130         */
131         MessagePortManager(void);
132
133         /**
134         * This destructor is intentionally declared as private because this class cannot be constructed.
135         */
136         virtual ~MessagePortManager(void);
137
138         /**
139         * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
140         */
141         MessagePortManager(const MessagePortManager& messagePortManager);
142
143         /**
144         * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
145         */
146         MessagePortManager& operator =(const MessagePortManager& messagePortManager);
147
148 }; // MessagePortManager
149
150 } } // Tizen::Io
151
152 #endif //_FIO_MESSAGE_PORT_MANAGER_H_