0cd9cbbc3d2e4078eb44f6943dc025ce4b15137e
[platform/framework/native/appfw.git] / inc / FIoMessagePortManager.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 /**
17  * @file                FIoMessagePortManager.h
18  * @brief               This is the header file for the %MessagePortManager class.
19  *
20  * This header file contains declarations of the %MessagePortManager class.
21  */
22 #ifndef _FIO_MESSAGE_PORT_MANAGER_H_
23 #define _FIO_MESSAGE_PORT_MANAGER_H_
24
25 #include <FBaseResult.h>
26 #include <FBaseObject.h>
27 #include <FBaseDataType.h>
28 #include <FIoLocalMessagePort.h>
29 #include <FIoRemoteMessagePort.h>
30 #include <FAppTypes.h>
31
32 namespace Tizen { namespace Io
33 {
34
35 /**
36 * @class    MessagePortManager
37 * @brief    This class provides methods for managing message ports.
38 *
39 * @since    2.0
40 *
41 * @final        This class is not intended for extension.
42 *
43 * The %MessagePortManager class provides methods for managing message ports.
44 *
45 * For more information on the class features,
46 * see <a href="../org.tizen.native.appprogramming/html/guide/io/messageport.htm">Message Port Communication</a>.
47 *
48 * @see Tizen::Io::LocalMessagePort
49 * @see Tizen::Io::RemoteMessagePort
50 */
51
52 class _OSP_EXPORT_ MessagePortManager
53 {
54 public:
55         /**
56         * Requests for a LocalMessagePort instance with the specified message port name. @n
57         * This method returns the same %LocalMessagePort instance if it has already been called with the same message port name. @n
58         *
59         * @since    2.0
60         *
61         * @return       A pointer to the LocalMessagePort instance, @n
62         *                       else @c null if it fails
63         * @param[in]     localMessagePortName   The name of a local message port
64         * @exception     E_SUCCESS           The method is successful.
65         * @exception     E_INVALID_ARG       The @c localMessagePortName is empty.
66         * @exception     E_SYSTEM            The method has failed due to a severe system error.
67         * @remarks       It is not recommended to use the message port names that start with "http://tizen.org/messageport". @c E_INVALID_ARG may be returned because they are reserved by platform.
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       It is not recommended to use the message port names that start with "http://tizen.org/messageport". @c E_INVALID_ARG may be returned because they are reserved by platform.
104         * @remarks       The specific error code can be accessed using the GetLastResult() method.
105         */
106         static LocalMessagePort* RequestTrustedLocalMessagePort(const Tizen::Base::String& localMessagePortName);
107
108         /**
109         * Requests the trusted RemoteMessagePort instance with the specified message port name. @n
110         * This method returns the same %RemoteMessagePort instance if it has already been called with the same remote application ID and message port name. @n
111         * This message port allows communications only if the applications are signed with the same certificate which is uniquely assigned to the developer.
112         *
113         * @since    2.0
114         *
115         * @return       A pointer to the trusted RemoteMessagePort instance, @n
116         *                       else @c null if it fails
117         * @param[in]     remoteAppId                    The remote application ID
118         * @param[in]     remoteMessagePortName  The name of a remote message port
119         * @exception     E_SUCCESS           The method is successful.
120         * @exception     E_INVALID_ARG       Either @c remoteAppId or @c remoteMessagePortName is empty.
121         * @exception     E_OBJ_NOT_FOUND     The message port of the target application is not found.
122         * @exception     E_CERTIFICATE_VERIFICATION_FAILED    The target application is not signed with the same certificate.
123         * @exception     E_SYSTEM            The method has failed due to a severe system error.
124         * @remarks       The specific error code can be accessed using the GetLastResult() method.
125         */
126         static RemoteMessagePort* RequestTrustedRemoteMessagePort(const Tizen::App::AppId& remoteAppId, const Tizen::Base::String& remoteMessagePortName);
127
128 private:
129         /**
130         * This default constructor is intentionally declared as private because this class cannot be constructed.
131         */
132         MessagePortManager(void);
133
134         /**
135         * This destructor is intentionally declared as private because this class cannot be constructed.
136         */
137         virtual ~MessagePortManager(void);
138
139         /**
140         * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
141         */
142         MessagePortManager(const MessagePortManager& messagePortManager);
143
144         /**
145         * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
146         */
147         MessagePortManager& operator =(const MessagePortManager& messagePortManager);
148
149 }; // MessagePortManager
150
151 } } // Tizen::Io
152
153 #endif //_FIO_MESSAGE_PORT_MANAGER_H_