summaryrefslogtreecommitdiffstats
path: root/nsframework/framework_unified/client/NS_FrameworkCore/include/frameworkunified_framework_internal.h
blob: 4d38828a6f28ba4895e2303be17e1db7ec80dacc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
/*
 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

///////////////////////////////////////////////////////////////////////////////
/// \ingroup  tag_NSFramework
/// \brief   Internal functions of the application framework.
///
///
///
///////////////////////////////////////////////////////////////////////////////

#ifndef FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_INTERNAL_H_
#define FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_INTERNAL_H_

#include <native_service/ns_shared_mem_if.h>
#include <native_service/frameworkunified_types.h>
#include "frameworkunified_framework_core.h"
#define PASA_APPCONFIG_FILES "PASA_APPCONFIG_FILES"

#define FRAMEWORKUNIFIEDLOG_CUT(zone, funcname, print_fmt, args...)

//////////////////////////////////////////////////
// dispatcher internal functions
//////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////
/// FrameworkunifiedAttachSystemCallbacksDispatcher
/// All system defined callbacks will be attached to the dispatcher
///
/// \param [in] hApp
///         HANDLE - Handle to the application framework.
///
/// \return eStatus
///         EFrameworkunifiedStatus - success or error
///
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus FrameworkunifiedAttachSystemCallbacksDispatcher(HANDLE hApp);

////////////////////////////////////////////////////////////////////////////////////////////
/// FrameworkunifiedSendSystemErrMessage
/// This API is used to send application's critical error message to system manager.
///
/// \param [in] hApp
///         HANDLE - Handle to the application framework.
/// \param [in] eSystemError
///         EFrameworkunifiedSystemError - System error type
///
/// \return EFrameworkunifiedStatus - success or error
///
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus FrameworkunifiedSendSystemErrMessage(HANDLE hApp, EFrameworkunifiedSystemError eSystemError);

////////////////////////////////////////////////////////////////////////////////////////////
/// FrameworkunifiedCreateDispatcher
/// Creates and initializes an applications/threads dispatcher.
///
/// \param [in] cAppname
///         PCSTR - Application/ thread name
/// \param [out] hApp
///         HANDLE& - Reference of application handle
/// \param [in] bIsChildThread
///         BOOL - child thread
///
/// \return status
///         EFrameworkunifiedStatus - eFrameworkunifiedStatusOK if Success
///            possible errors from call CreateDispatcher
///
/// \see FrameworkunifiedDispatchBlock,
///      FrameworkunifiedDispatchProcess, FrameworkunifiedCloseDispatcher,
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus FrameworkunifiedCreateDispatcher(PCSTR cAppName, HANDLE &hApp, BOOL bIsChildThread);  // NOLINT  (readability/nolint)

////////////////////////////////////////////////////////////////////////////////////////////
/// FrameworkunifiedCreateHSMDispatcher
/// Creates and initializes an applications/threads hsm dispatcher.
///
/// \param [in] cAppname
///         PCSTR - Application/ thread name
/// \param [out] hApp
///         HANDLE& - Reference of application handle
/// \param [in] bIsThread
///         BOOL - child thread
/// \param [in] f_pFrameworkunifiedHSM
///         CFrameworkunifiedHSMFramework* - statemachine instances
///
/// \return status
///         EFrameworkunifiedStatus - eFrameworkunifiedStatusOK if Success
///            possible errors from call CreateDispatcher
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus FrameworkunifiedCreateHSMDispatcher(PCSTR cAppName,
                                  HANDLE &hApp,  // NOLINT  (readability/nolint)
                                  BOOL bIsThread,
                                  CFrameworkunifiedHSMFramework *f_pFrameworkunifiedHSM = NULL);

////////////////////////////////////////////////////////////////////////////////////////////
/// FrameworkunifiedDispatchBlock
/// Blocked until the dipatcher receives a notification of a service request or ack.
///
/// \param [in] hApp
///         HANDLE - Application framework handle
///
/// \return status
///         EFrameworkunifiedStatus -Success or error
///
/// \see FrameworkunifiedCreateDispatcher,
///      FrameworkunifiedDispatchProcess, FrameworkunifiedCloseDispatcher,
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus FrameworkunifiedDispatchBlock(HANDLE hApp);

////////////////////////////////////////////////////////////////////////////////////////////
/// frameworkunifiedFdHandler
/// FD POLLIN blocked & process.
///
/// \param [in] hApp
///         HANDLE - Application framework handle
/// \param [in] efd
///         int - epoll FD
///
/// \return status
///         EFrameworkunifiedStatus -Success or error
///
/// \see FrameworkunifiedCreateDispatcher, FrameworkunifiedDispatchProcess, FrameworkunifiedDispatchBlock,
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus frameworkunifiedFdHandler(HANDLE hApp , int efd);

////////////////////////////////////////////////////////////////////////////////////////////
/// FrameworkunifiedDispatchProcess
/// Processes the Service/system request or notification.
///
/// \param [in] hApp
///         HANDLE - Application framework handle
///
/// \return status
///         EFrameworkunifiedStatus -Success or error
///
/// \see FrameworkunifiedCreateDispatcher, FrameworkunifiedDispatchBlock
///      FrameworkunifiedCloseDispatcher,
///
/// \details
/// \code
/// Pseudo code:
///   IF message_source != Notification Service
///     FIND source_name
///       IF source_name available
///         FIND protocol_cmd
///           IF protocol_cmd available
///             execute callback
///           ELSE
///             ignore
///           END
///       ELSE
///         ignore
///       END
///   ELSE  // notification
///     FIND notification_callback
///       IF available
///         execute callback
///   END
/// \endcode
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus FrameworkunifiedDispatchProcess(HANDLE hApp);

////////////////////////////////////////////////////////////////////////////////////////////
/// FrameworkunifiedCloseDispatcher
/// Closing the dispatcher
///
/// \param [in] hApp
///         HANDLE - Application framework handle
///
/// \return status
///         EFrameworkunifiedStatus -Success or error
///
/// \see FrameworkunifiedCreateDispatcher, FrameworkunifiedDispatchBlock
///      FrameworkunifiedDispatchProcess.
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus FrameworkunifiedCloseDispatcher(HANDLE hApp);


////////////////////////////////////////////////////////////////////////////////////////////
/// FrameworkunifiedPopedDeferedMessage
/// Checks the Defer'ed Message Queue should be pop'ed off
/// the front of the queue!
///
/// \param [in] hApp
///         HANDLE - Application framework handle
///
/// \return status
///         BOOL -  TRUE (a message has been pop'ed of the defer'ed msg queue)
///         FALSE (no msg was pop'ed of the defer'ed msg queue)
///
/// \see FrameworkunifiedCreateDispatcher, FrameworkunifiedDispatchBlock
///      FrameworkunifiedDispatchProcess.
///
////////////////////////////////////////////////////////////////////////////////////////////
BOOL FrameworkunifiedPopedDeferedMessage(HANDLE hApp);



////////////////////////////////////////////////////////////////////////////////////////////
/// FrameworkunifiedDispatcherMain
/// Main processing loop that is shared between FrameworkunifiedDispacther and FrameworkunifiedDispatcherWithCmdLnArguments.
///
/// \param [in] hApp
///         HANDLE - Application framework handle
///
/// \return status
///         BOOL -  TRUE (a message has been pop'ed of the defer'ed msg queue)
///         FALSE (no msg was pop'ed of the defer'ed msg queue)
///
/// \see FrameworkunifiedCreateDispatcher, FrameworkunifiedDispatchBlock
///      FrameworkunifiedDispatchProcess.
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus FrameworkunifiedDispatcherMain(HANDLE hApp);

EFrameworkunifiedStatus FrameworkunifiedHSMDispatcherMain(HANDLE hApp);


////////////////////////////////////////////////////////////////////////////////////////////
/// FrameworkunifiedDispatcherMain
/// Main processing loop that is shared between FrameworkunifiedDispacther and FrameworkunifiedDispatcherWithCmdLnArguments.
///
/// \param [in] hApp
///         HANDLE - Application framework handle
///
/// \return status
///         BOOL -  TRUE (a message has been pop'ed of the defer'ed msg queue)
///         FALSE (no msg was pop'ed of the defer'ed msg queue)
///
/// \see FrameworkunifiedCreateDispatcher, FrameworkunifiedDispatchBlock
///      FrameworkunifiedDispatchProcess.
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus FrameworkunifiedArgumentParser(HANDLE hApp, int argc, char *argv[], CustomCommandLineOptions *cmdLineOptions);


EFrameworkunifiedStatus FrameworkunifiedOnInitializationInternal(HANDLE hApp);
EFrameworkunifiedStatus FrameworkunifiedOnDestroyInternal(HANDLE hApp);
EFrameworkunifiedStatus FrameworkunifiedOnStartInternal(HANDLE hApp);
EFrameworkunifiedStatus FrameworkunifiedOnStopInternal(HANDLE hApp);
EFrameworkunifiedStatus FrameworkunifiedOnPreStartInternal(HANDLE hApp);
EFrameworkunifiedStatus FrameworkunifiedOnPreStopInternal(HANDLE hApp);
EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStartInternal(HANDLE hApp);
EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStopInternal(HANDLE hApp);
EFrameworkunifiedStatus FrameworkunifiedOnDebugDumpInternal(HANDLE hApp);
EFrameworkunifiedStatus FrameworkunifiedCreateStateMachineInternal(HANDLE hApp);
EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterfaceInternal(HANDLE hApp);
EFrameworkunifiedStatus RegistDefaultCbHandler(const FrameworkunifiedDefaultCallbackHandler *CbHandler);


//////////////////////////////////////////////////
// message center internal functions
//////////////////////////////////////////////////



////////////////////////////////////////////////////////////////////////////////////////////
/// frameworkunifiedGetIsTypeOfSync
/// Gets if message type is sync, return TRUE. or not return FALSE
///
/// \param [in] hApp
///         HANDLE - Handle to a Application Framework
///
/// \return status
///         BOOL - TRUE or FALSE
///
/// \see FrameworkunifiedInvokeSync, frameworkunifiedSendSyncResponse
///
////////////////////////////////////////////////////////////////////////////////////////////
BOOL frameworkunifiedGetIsTypeOfSync(HANDLE hApp);

////////////////////////////////////////////////////////////////////////////////////////////
/// FrameworkunifiedSendSyncResponse
/// Send Sync Response to the hApp.
///
/// \param [in] hApp
///         HANDLE - Handle to the dispatcher to receive message
/// \param [in] seq_id
///         UI_32 - Sync sequence ID
/// \param [in] retValue
///         EFrameworkunifiedStatus - Return Status
/// \param [in] length
///         UI_32 - Length of the data to be receive response.
/// \param [in] data
///         PVOID - Pointer to the response data.
///
/// \return status
///         EFrameworkunifiedStatus - success or error
///
/// \see FrameworkunifiedInvokeSync
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus frameworkunifiedSendSyncResponse(HANDLE hApp, UI_32 iCmd, UI_32 seq_id, EFrameworkunifiedStatus retValue, UI_32 length, PCVOID data);

//////////////////////////////////////////////////
// logger internal functions
//////////////////////////////////////////////////
EFrameworkunifiedStatus FrameworkunifiedAttachLoggerCallbacksDispatcher(HANDLE hApp);

#ifdef DISPATCHER_PROFILER
////////////////////////////////////////////////////////////////////////////////////////////
/// FrameworkunifiedAttachMsgProfilerCallbacksDispatcher
/// This function attaches callback function for profiler protocol for main thread.
/// Protocol is attached considering the source as "nsprofilerutil"
///
/// \param [in] hApp
///         HANDLE - Handle to a Application Framework
///
/// \return status
///         EFrameworkunifiedStatus - success or error
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus FrameworkunifiedAttachMsgProfilerCallbacksDispatcher(HANDLE hApp);

////////////////////////////////////////////////////////////////////////////////////////////
/// FrameworkunifiedAttachMsgProfilerCallbacksDispatcher
/// This function attaches callback function for profiler protocol for child threads.
/// Protocol is attached considering the source as parent thread
///
/// \param [in] hApp
///         HANDLE - Handle to a Application Framework
///
/// \return status
///         EFrameworkunifiedStatus - success or error
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus FrameworkunifiedAttachChildMsgProfilerCallbacksDispatcher(HANDLE hApp);
#endif

EFrameworkunifiedStatus FrameworkunifiedSetLogMask(HANDLE hApp);
EFrameworkunifiedStatus FrameworkunifiedGetLogMask(HANDLE hApp);
EFrameworkunifiedStatus FrameworkunifiedSetOutputLogOpts(HANDLE hApp);
EFrameworkunifiedStatus FrameworkunifiedGetOutputLogOpts(HANDLE hApp);
EFrameworkunifiedStatus FrameworkunifiedSetLogSeverity(HANDLE hApp);
EFrameworkunifiedStatus FrameworkunifiedGetLogSeverity(HANDLE hApp);
EFrameworkunifiedStatus FrameworkunifiedDebugDumpRequest(HANDLE hApp);

EFrameworkunifiedStatus NSRcsSetLogSettings(HANDLE hApp);
EFrameworkunifiedStatus NSRcsGetLogSettings(HANDLE hApp);
EFrameworkunifiedStatus NSRcsSetLogMask(HANDLE hApp);
EFrameworkunifiedStatus NSRcsSetOutputLogOpts(HANDLE hApp);
EFrameworkunifiedStatus NSRcsSetLogSeverity(HANDLE hApp);

////////////////////////////////////////////////////////////////////////////////////////////
/// SetConfigHandle
/// This Function opens the configuration file from given path and sets the file handle in hApp
///
/// \param [in] cAppname
///         HANDLE - Application handle
/// \param [in] sFilePath
///         PCHAR - File path of the config file
///
/// \return status of the operation
///
/// \see SetDefaultFilePath,
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus SetConfigHandle(HANDLE hApp, PCHAR sFilePath);

////////////////////////////////////////////////////////////////////////////////////////////
/// SetDefaultFilePath
/// This Function fetches the default config path, opens the configuration file and sets the file
/// handle in the application
///
/// \param [in] cAppname
///         HANDLE - Application handle
/// \param [in] sFilePath
///         PCHAR - File path of the config file
///
/// \return status of the operation
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus SetDefaultConfigFile(HANDLE hApp);

EFrameworkunifiedStatus FrameworkunifiedProcessServiceProtocolHSMEvent(HANDLE hApp, PCSTR pRequester);

////////////////////////////////////////////////////////////////////////////////////////////
/// ProcessProtocolEvents
/// This Function registers the events of server with the client.
/// If the event is published previously and is a state event then send the event data to the client.
///
/// \param [in] hApp
///         HANDLE - Application handle
///
/// \return status of the operation
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus ProcessProtocolEvents(HANDLE hApp);

////////////////////////////////////////////////////////////////////////////////////////////
/// ProcessPrivateEvents
/// This Function registers the events of server with the client.
/// If the event is published previously and is a state event then send the event data to the client.
///
/// \param [in] hApp
///         HANDLE - Application handle
///
/// \return status of the operation
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus ProcessPrivateEvents(HANDLE hApp);

////////////////////////////////////////////////////////////////////////////////////////////
/// CleanAllEventsOfSession
/// This Function closes the session handle and removes its entry from the table of
/// ServiceSessionHandleTable of application framework handle.
///
/// \param [in] hApp
///         HANDLE - Application handle
/// \param [in] serviceName
///         PCSTR - Name of a service
/// \param [in] sessionId
///         UI_32 - Session id
///
/// \return status of the operation
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus CleanAllEventsOfSession(HANDLE hApp, PCSTR serviceName, UI_32 sessionId);

////////////////////////////////////////////////////////////////////////////////////////////
/// RemoveEntryFromSessionEventInfoTable
/// This Function removes the entry of event id from the session table based on the service
/// name and session id.
///
/// \param [in] hApp
///         HANDLE - Application handle
/// \param [in] serviceName
///         PCSTR - Name of service
/// \param [in] sessionId
///         UI_32 - Session id
/// \param [in] eventId
///         UI_32 - Event id which needs to be removed from internal table
///
/// \return eFrameworkunifiedStatusOK- Success, or eFrameworkunifiedStatusFail
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus RemoveEntryFromSessionEventInfoTable(HANDLE hApp, PCSTR serviceName, UI_32 sessionId, UI_32 eventId);

////////////////////////////////////////////////////////////////////////////////////////////
/// HandleSessionEventOnCloseSession
/// This Function does the handling of session events on close session request
///
/// \param [in] hApp
///         HANDLE - Application handle
///
/// \return status of the operation
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus HandleSessionEventOnCloseSession(HANDLE hApp);

////////////////////////////////////////////////////////////////////////////////////////////
/// UnregisterPrivateEvents
/// This Function unregisters the private event.
///
/// \param [in] hApp
///         HANDLE - Application handle
///
/// \return status of the operation
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus UnregisterPrivateEvents(HANDLE hApp);

////////////////////////////////////////////////////////////////////////////////////////////
/// GetMsgQueueHandle
/// Gets the message queue handle from servicesessionhandletable map.
///
/// \param [in] hApp
///         HANDLE - Application handle
/// \param [in] serviceName
///         PCSTR - Service name of receiver
/// \param [in] uiSessionId
///         UI_32 - session id
///
/// \return Message queue handle
///
////////////////////////////////////////////////////////////////////////////////////////////
HANDLE GetMsgQueueHandle(HANDLE hApp, PCSTR serviceName, const UI_32 uiSessionId);

////////////////////////////////////////////////////////////////////////////////////////////
/// GetNewMsgQueueHandle
/// This function creates and returns the message queue handle.
///
/// \param [in] hApp
///         HANDLE - Application handle
/// \param [in] serviceName
///         PCSTR - Service name of receiver
/// \param [in] uiSessionId
///         UI_32 - session id
/// \param [in] uiEventId
///         const UI_32 - event id
///
/// \return Message queue handle
///
////////////////////////////////////////////////////////////////////////////////////////////
HANDLE GetNewHandleAndUpdateEventInfoTable(HANDLE hApp, PCSTR serviceName, const UI_32 uiSessionId,
                                           const UI_32 uiEventId);

////////////////////////////////////////////////////////////////////////////////////////////
/// IsEventAlreadyRegistered
/// Searches for the session id in the vector
///
/// \param [in] vSessionIdList
///         SessionIdList - list of sessions id's
/// \param [in] uiSessionId
///         UI_32 - session id
///
/// \return true or false
///
////////////////////////////////////////////////////////////////////////////////////////////
BOOL IsEventAlreadyRegistered(const SessionIdList &vSessionIdList, const UI_32 uiSessionId);

////////////////////////////////////////////////////////////////////////////////////////////
/// RemoveEventEntryFromEventTable
/// This Function removes the entry of event for received service on the active session id
/// from Event Table.
///
/// \param [in] hApp
///         HANDLE - Application handle
/// \param [in] uiEventId
///         UI_32 - event id
/// \param [in] serviceName
///         PCSTR - Service name of receiver
/// \param [in] uiSessionId
///         UI_32 - session id
///
/// \return success or failure
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus RemoveEventEntryFromEventTable(HANDLE hApp, UI_32 uiEventId, PCSTR cServiceName, const UI_32 uiSessionId);

////////////////////////////////////////////////////////////////////////////////////////////
/// SendEventMessage
/// This function sends the private event message to all the sessions of service registered
/// for event.
///
/// \param [in] hApp
///         HANDLE - Application handle
/// \param [in] vSessionIdList
///         SessionIdList - session id list
/// \param [in] uiEventId
///         UI_32 - event id
/// \param [in] cServiceName
///         PCSTR - Service name of receiver
/// \param [in] pData
///         PCVOID - data to send
/// \param [in] uiLength
///         UI_32 - length of data
///
/// \return success or failure
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus SendEventMessage(HANDLE hApp, const SessionIdList &vSessionIdList, UI_32 uiEventId, PCSTR cServiceName,
                            PCVOID pData, UI_32 uiLength);

////////////////////////////////////////////////////////////////////////////////////////////
/// UpdatePublicStateEventData
/// This API updates the event data of public state event for all the session of
/// all subscribed clients.
///
/// \param [in] hApp
///         HANDLE - Application handle
/// \param [in] uiEventId
///         UI_32 - event id
/// \param [in] pData
///         PCVOID - data to send
/// \param [in] uiLength
///         UI_32 - length of data
///
/// \return success or failure
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus UpdatePublicStateEventData(HANDLE hApp, UI_32 uiEventId, PCVOID pData, UI_32 uiLength);

////////////////////////////////////////////////////////////////////////////////////////////
/// UpdatePrivateStateEventData
/// This API updates the event data of private state event for session with
/// session id uiSessionId of client pClientName.
///
/// \param [in] hApp
///         HANDLE - Application handle
/// \param [in] uiEventId
///         UI_32 - event id
/// \param [in] pClientName
///         PCSTR - Event Subscriber name
/// \param [in] uiSessionId
///         UI_32 - session id
/// \param [in] pData
///         PCVOID - data to send
/// \param [in] uiLength
///         UI_32 - length of data
///
/// \return success or failure
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus UpdatePrivateStateEventData(HANDLE hApp, UI_32 uiEventId, PCSTR pClientName, UI_32 uiSessionId, PCVOID pData,
                                       UI_32 uiLength);

////////////////////////////////////////////////////////////////////////////////////////////
/// DeleteSessionEventData
/// This function is called while destroying the session with client.
/// This method removes the private event data associated with the session.
///
/// \param [in] hApp
///         HANDLE - Application handle
/// \param [in] pClientName
///         PCSTR - Event Subscriber name
/// \param [in] uiSessionId
///         UI_32 - session id
///
/// \return success or failure
///
////////////////////////////////////////////////////////////////////////////////////////////
EFrameworkunifiedStatus DeleteSessionEventData(HANDLE hApp, PCSTR pClientName, UI_32 uiSessionId);

////////////////////////////////////////////////////////////////////////////////////////////
/// FrameworkunifiedGetDataUSID
/// Gets the shared memory ID
///
/// \param [in] hApp
///         HANDLE - Application framework handle
///
/// \return status
///         UI_32 - success or error
///
/// \see FrameworkunifiedMcOpenSender, FrameworkunifiedMcClose, FrameworkunifiedSendMsg, FrameworkunifiedGetMsgLength, FrameworkunifiedGetMsgSrc, FrameworkunifiedGetMsgDataOfSize,
///      FrameworkunifiedClearMsgData, FrameworkunifiedForwardMessage, FrameworkunifiedGetSystemInfo
///
////////////////////////////////////////////////////////////////////////////////////////////
TMemID FrameworkunifiedGetDataUSID(HANDLE hApp);

////////////////////////////////////////////////////////////////////////////////////////////
/// FrameworkunifiedIsAutoPublishServiceAvailableEnabled
/// This function is used to check whether auto publishing of service availability is
/// enabled or not.
///
/// \param None
///
/// \return BOOL
///         BOOL - true if auto publish is enabled for service else false
///
////////////////////////////////////////////////////////////////////////////////////////////
BOOL FrameworkunifiedIsAutoPublishServiceAvailableEnabled();

////////////////////////////////////////////////////////////////////////////////////////////
/// FrameworkunifiedIsWaitInStoppingStateEnabled
/// Check if wait in stopping state is enabled.
///
/// \param [in] none
///
/// \return BOOL - TRUE if enabled or FALSE
///
////////////////////////////////////////////////////////////////////////////////////////////
BOOL FrameworkunifiedIsWaitInStoppingStateEnabled();

#endif  // FRAMEWORK_UNIFIED_CLIENT_NS_FRAMEWORKCORE_INCLUDE_FRAMEWORKUNIFIED_FRAMEWORK_INTERNAL_H_