Re-organized sub-directory by category
[staging/basesystem.git] / service / native / framework_unified / client / NS_MessageCenter / include / ns_message_center_internal.h
1 /*
2  * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
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 #ifndef FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGECENTER_INCLUDE_NS_MESSAGE_CENTER_INTERNAL_H_
18 #define FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGECENTER_INCLUDE_NS_MESSAGE_CENTER_INTERNAL_H_
19
20 #include <native_service/frameworkunified_types.h>
21 #include <native_service/ns_shared_mem_if.h>
22
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 ////////////////////////////////////////////////////////////////////////////////////////////
29 ///  mcOpenMonitor
30 ///  for Server API
31 ///
32 /// \param [in] name
33 ///         PCSTR - Service name
34 ///
35 /// \return int
36 ///     -1 - error
37 ///     >0 - Listen socket FD
38 ////////////////////////////////////////////////////////////////////////////////////////////
39 int mcOpenMonitor(PCSTR name);
40
41 ////////////////////////////////////////////////////////////////////////////////////////////
42 ///  mcCloseMonitor
43 ///  for Server API
44 ///
45 /// \param [in] name
46 ///         PCSTR - Service name
47 ///
48 /// \return int
49 ///     -1 - error
50 ///      0 - success
51 ////////////////////////////////////////////////////////////////////////////////////////////
52 int mcCloseMonitor(PCSTR name);
53
54 ////////////////////////////////////////////////////////////////////////////////////////////
55 ///  mcSetConnectKey
56 ///  for Common API
57 ///
58 /// \param [out] buf
59 ///         char * - buffer
60 /// \param [in] size
61 ///         int - buffer size
62 /// \param [in] serverName
63 ///         PCSTR - Server name
64 /// \param [in] clientName
65 ///         PCSTR - Client name
66 ///
67 /// \return int
68 ///     -1 - error
69 ///     >0 - Connect socket FD
70 ////////////////////////////////////////////////////////////////////////////////////////////
71 int mcSetConnectKey(char *buf, size_t size, PCSTR serverName, PCSTR clientName);
72
73 ////////////////////////////////////////////////////////////////////////////////////////////
74 ///  mcConnectMonitor
75 ///  for Client API
76 ///
77 /// \param [in] serverName
78 ///         PCSTR - server name
79 /// \param [in] clientName
80 ///         PCSTR - client name
81 ///
82 /// \return int
83 ///     -1 - error
84 ///     >0 - Connect socket FD
85 ////////////////////////////////////////////////////////////////////////////////////////////
86 int mcConnectMonitor(PCSTR serverName, PCSTR clientName);
87
88 ////////////////////////////////////////////////////////////////////////////////////////////
89 ///  mcCloseConnectMonitor
90 ///  for Client API
91 ///
92 /// \param [in] serverName
93 ///         PCSTR - server name
94 /// \param [in] clientName
95 ///         PCSTR - client name
96 ///
97 /// \return int
98 ///     -1 - error
99 ///     >0 - Connect socket FD
100 ////////////////////////////////////////////////////////////////////////////////////////////
101 int mcCloseConnectMonitor(PCSTR serverName, PCSTR clientName);
102
103 ////////////////////////////////////////////////////////////////////////////////////////////
104 ///  mcAcceptMonitor
105 ///  for Server API
106 ///
107 /// \param [in] serverName
108 ///         PCSTR - server name
109 /// \param [in] listenMonitorFd
110 ///         int - Listen socket FD
111 ///
112 /// \return int
113 ///     -1 - error
114 ///     >0 - Accept socket FD
115 ////////////////////////////////////////////////////////////////////////////////////////////
116 int mcAcceptMonitor(PCSTR serverName, int listenMonitorFd);
117
118 ////////////////////////////////////////////////////////////////////////////////////////////
119 ///  mcGetAcceptMonitor
120 ///  for Server API
121 ///
122 /// \param [in] serverName
123 ///         PCSTR - server name
124 /// \param [in] clientName
125 ///         PCSTR - client name
126 ///
127 /// \return int
128 ///     -1 - error
129 ///     >0 - Accept socket FD
130 ////////////////////////////////////////////////////////////////////////////////////////////
131 int mcGetAcceptMonitor(PCSTR serverName, PCSTR clientName);
132
133 ////////////////////////////////////////////////////////////////////////////////////////////
134 ///  mcCloseAcceptMonitor
135 ///  for Server API
136 ///
137 /// \param [in] serverName
138 ///         PCSTR - server name
139 /// \param [in] clientName
140 ///         PCSTR - client name
141 ///
142 /// \return int
143 ///     -1 - error
144 ///     >0 - Accept socket FD
145 ////////////////////////////////////////////////////////////////////////////////////////////
146 int mcCloseAcceptMonitor(PCSTR serverName, PCSTR clientName);
147
148 ////////////////////////////////////////////////////////////////////////////////////////////
149 ///  mcGetClientNameFromConnectKey
150 ///  for Server API
151 ///
152 /// \param [in] connectKey
153 ///         PCSTR - connect key
154 /// \param [out] clientName
155 ///         PCHAR - client name
156 /// \param [out] len
157 ///         size_t - clientname buffer length
158 ///
159 /// \return int
160 ///     -1 - error
161 ///     >0 - Accept socket FD
162 ////////////////////////////////////////////////////////////////////////////////////////////
163 int mcGetClientNameFromConnectKey(PCSTR connectKey, PCHAR clientName, size_t len);
164
165 ////////////////////////////////////////////////////////////////////////////////////////////
166 ///  mcGetServerNameFromConnectKey
167 ///  for Client API
168 ///
169 /// \param [in] connectKey
170 ///         PCSTR - connect key
171 /// \param [out] serverName
172 ///         PCHAR - client name
173 /// \param [out] len
174 ///         size_t - serverName buffer length
175 ///
176 /// \return int
177 ///     -1 - error
178 ///     >0 - Accept socket FD
179 ////////////////////////////////////////////////////////////////////////////////////////////
180 int mcGetServerNameFromConnectKey(PCSTR connectKey, PCHAR serverName, size_t len);
181
182 #ifdef __cplusplus
183 }
184 #endif
185 #endif  // FRAMEWORK_UNIFIED_CLIENT_NS_MESSAGECENTER_INCLUDE_NS_MESSAGE_CENTER_INTERNAL_H_