diff options
Diffstat (limited to 'NodeStateManager')
-rw-r--r-- | NodeStateManager/Makefile.am | 21 | ||||
-rw-r--r-- | NodeStateManager/NodeStateManager.c | 65 | ||||
-rw-r--r-- | NodeStateManager/config/node-state-manager.pc.in | 13 | ||||
-rw-r--r-- | NodeStateManager/config/nodestatemanager-daemon.service.in | 11 |
4 files changed, 63 insertions, 47 deletions
diff --git a/NodeStateManager/Makefile.am b/NodeStateManager/Makefile.am index 6de96e5..260ca74 100644 --- a/NodeStateManager/Makefile.am +++ b/NodeStateManager/Makefile.am @@ -20,7 +20,7 @@ NodeStateManager_SOURCES = NodeStateManager.c NodeStateManager_CFLAGS = \ -I$(top_srcdir)/NodeStateMachineStub \ - -I$(top_srcdir)/NodeStateAccessStub \ + -I$(top_srcdir)/NodeStateAccess \ $(DLT_CFLAGS) \ $(GIO_CFLAGS) \ $(GIO_UNIX_CFLAGS) \ @@ -29,10 +29,11 @@ NodeStateManager_CFLAGS = \ $(PLATFORM_CFLAGS) NodeStateManager_LDFLAGS = \ - $(PLATFORM_LDFLAGS) + $(PLATFORM_LDFLAGS) \ + -export-dynamic NodeStateManager_LDADD = \ - -L$(top_srcdir)/NodeStateAccessStub -lNodeStateAccess \ + -L$(top_srcdir)/NodeStateAccess -lNodeStateAccess \ -L$(top_srcdir)/NodeStateMachineStub -lNodeStateMachine \ $(DLT_LIBS) \ $(GIO_LIBS) \ @@ -44,12 +45,20 @@ include_HEADERS = NodeStateManager.h NodeStateTypes.h systemdsystemunit_DATA = config/nodestatemanager-daemon.service - dbussystemunit_DATA = config/org.genivi.NodeStateManager.LifeCycleControl.service +dbuspolicy_DATA = config/org.genivi.NodeStateManager.conf +# Write the package config file of the NHM to it destination +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = config/node-state-manager.pc -dbuspolicy_DATA = config/org.genivi.NodeStateManager.conf +# Export the dbus interface descrition of the NHM +dbusinterfaces_DATA = $(top_srcdir)/NodeStateAccess/model/org.genivi.NodeStateManager.Consumer.xml \ + $(top_srcdir)/NodeStateAccess/model/org.genivi.NodeStateManager.LifecycleConsumer.xml \ + $(top_srcdir)/NodeStateAccess/model/org.genivi.NodeStateManager.LifecycleControl.xml \ + $(top_srcdir)/NodeStateTest/org.genivi.NodeStateMachineTest.xml EXTRA_DIST = $(systemdsystemunit_DATA) \ $(dbussystemunit_DATA) \ - $(dbuspolicy_DATA) + $(dbuspolicy_DATA) \ + $(dbusinterfaces_DATA) diff --git a/NodeStateManager/NodeStateManager.c b/NodeStateManager/NodeStateManager.c index c92188f..4ed5150 100644 --- a/NodeStateManager/NodeStateManager.c +++ b/NodeStateManager/NodeStateManager.c @@ -37,6 +37,9 @@ * the handling of life cycle clients (timeout observation) * is done by the NSMA. * 01.11.2012 C. Domke CSP_WZ#666: Instrumented with LTPRO messages +* 10.01.2013 Jean-Pierre Bogler CSP_WZ#1322: Initialize variables at declaration instead of using +* memset and use g_utf8_strlen instead of strlen to +* simplify configure srcipt (avoid some checks). * **********************************************************************************************************************/ @@ -1412,18 +1415,15 @@ static NsmErrorStatus_e NSM__enOnHandleRegisterSession(const gchar * /* Function local variables */ NsmSession_s *pNewSession = NULL; /* Pointer to new created session */ GSList *pListEntry = NULL; /* Pointer to list entry */ - size_t u32SessionNameLen = 0; /* Length of passed session owner */ - size_t u32SessionOwnerLen = 0; /* Length of passed session name */ - NsmSession_s stSearchSession; /* To search for existing session */ + glong u32SessionNameLen = 0; /* Length of passed session owner */ + glong u32SessionOwnerLen = 0; /* Length of passed session name */ + NsmSession_s stSearchSession = {0}; /* To search for existing session */ gboolean boOwnerValid = FALSE; NsmErrorStatus_e enRetVal = NsmErrorStatus_NotSet; - /* Initialize variables */ - memset(&stSearchSession, 0, sizeof(stSearchSession)); - /* Check if the passed parameters are valid */ - u32SessionNameLen = strlen(sSessionName); - u32SessionOwnerLen = strlen(sSessionOwner); + u32SessionNameLen = g_utf8_strlen(sSessionName, -1); + u32SessionOwnerLen = g_utf8_strlen(sSessionOwner, -1); boOwnerValid = (g_strcmp0(sSessionOwner, NSM_DEFAULT_SESSION_OWNER) != 0); if( (boOwnerValid == TRUE ) @@ -1522,17 +1522,14 @@ static NsmErrorStatus_e NSM__enOnHandleUnRegisterSession(const gchar *sSessi /* Function local variables */ NsmSession_s *pExistingSession = NULL; /* Pointer to existing session */ GSList *pListEntry = NULL; /* Pointer to list entry */ - size_t u32SessionNameLen = 0; /* Length of passed session owner */ - size_t u32SessionOwnerLen = 0; /* Length of passed session name */ - NsmSession_s stSearchSession; /* To search for existing session */ + glong u32SessionNameLen = 0; /* Length of passed session owner */ + glong u32SessionOwnerLen = 0; /* Length of passed session name */ + NsmSession_s stSearchSession = {0}; /* To search for existing session */ NsmErrorStatus_e enRetVal = NsmErrorStatus_NotSet; - /* Initialize variables */ - memset(&stSearchSession, 0, sizeof(stSearchSession)); - /* Check if the passed parameters are valid */ - u32SessionNameLen = strlen(sSessionName); - u32SessionOwnerLen = strlen(sSessionOwner); + u32SessionNameLen = g_utf8_strlen(sSessionName, -1); + u32SessionOwnerLen = g_utf8_strlen(sSessionOwner, -1); if( (u32SessionNameLen < NSM_MAX_SESSION_NAME_LENGTH ) && (u32SessionOwnerLen < NSM_MAX_SESSION_OWNER_LENGTH)) @@ -1782,14 +1779,11 @@ static NsmErrorStatus_e NSM__enOnHandleGetSessionState(const gchar *sSessi { /* Function local variables */ NsmErrorStatus_e enRetVal = NsmErrorStatus_NotSet; - size_t u32SessionNameLen = 0; /* Length of passed session owner */ - NsmSession_s stSearchSession; /* To search for existing session */ - - /* Initialize variables */ - memset(&stSearchSession, 0, sizeof(stSearchSession)); + glong u32SessionNameLen = 0; /* Length of passed session owner */ + NsmSession_s stSearchSession = {0}; /* To search for existing session */ /* Check if the passed parameters are valid */ - u32SessionNameLen = strlen(sSessionName); + u32SessionNameLen = g_utf8_strlen(sSessionName, -1); if(u32SessionNameLen < NSM_MAX_SESSION_OWNER_LENGTH) { @@ -1833,16 +1827,13 @@ static NsmErrorStatus_e NSM__enOnHandleSetSessionState(const gchar * { /* Function local variables */ NsmErrorStatus_e enRetVal = NsmErrorStatus_NotSet; - size_t u32SessionNameLen = 0; /* Length of passed session owner */ - size_t u32SessionOwnerLen = 0; /* Length of passed session name */ - NsmSession_s stSession; /* Session object passed to internal function */ - - /* Initialize variables */ - memset(&stSession, 0, sizeof(stSession)); + glong u32SessionNameLen = 0; /* Length of passed session owner */ + glong u32SessionOwnerLen = 0; /* Length of passed session name */ + NsmSession_s stSession = {0}; /* Session object passed to internal function */ /* Check if the passed parameters are valid */ - u32SessionNameLen = strlen(sSessionName); - u32SessionOwnerLen = strlen(sSessionOwner); + u32SessionNameLen = g_utf8_strlen(sSessionName, -1); + u32SessionOwnerLen = g_utf8_strlen(sSessionOwner, -1); if( (u32SessionNameLen < NSM_MAX_SESSION_NAME_LENGTH ) && (u32SessionOwnerLen < NSM_MAX_SESSION_OWNER_LENGTH)) @@ -1927,10 +1918,7 @@ static void NSM__vDisableSessionsForApp(NSM__tstFailedApplication* pstFailedApp) /* Function local variables */ GSList *pSessionListEntry = NULL; NsmSession_s *pstExistingSession = NULL; - NsmSession_s stSearchSession; - - /* Initialize variables */ - memset(&stSearchSession, 0, sizeof(stSearchSession)); + NsmSession_s stSearchSession = {0}; /* Only set the "owner" of the session (to the AppName) to search for all sessions of the app. */ g_strlcpy(stSearchSession.sOwner, pstFailedApp->sName, sizeof(stSearchSession.sOwner)); @@ -2043,12 +2031,9 @@ static NsmErrorStatus_e NSM__enSetAppStateFailed(NSM__tstFailedApplication* pstF static NsmErrorStatus_e NSM__enOnHandleSetAppHealthStatus(const gchar *sAppName, const gboolean boAppState) { - /* Function local variables */ - NSM__tstFailedApplication stSearchApplication; /* Temporary application object for search */ - NsmErrorStatus_e enRetVal = NsmErrorStatus_NotSet; - - /* Initialize variables */ - memset(&stSearchApplication, 0, sizeof(stSearchApplication)); + /* Function local variables */ + NSM__tstFailedApplication stSearchApplication = {0}; /* Temporary application object for search */ + NsmErrorStatus_e enRetVal = NsmErrorStatus_NotSet; /* Check if passed parameters are valid */ if(strlen(sAppName) < NSM_MAX_SESSION_OWNER_LENGTH) diff --git a/NodeStateManager/config/node-state-manager.pc.in b/NodeStateManager/config/node-state-manager.pc.in new file mode 100644 index 0000000..480ff5d --- /dev/null +++ b/NodeStateManager/config/node-state-manager.pc.in @@ -0,0 +1,13 @@ +# Package config file for NodeStateManager + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +dbusinterfacesdir=@dbusinterfacesdir@ + +Name: NodeStateManager (NSM) +Description: Package information for the NHM. +URL: http://www.genivi.org +Version: @VERSION@ +Cflags: -I${includedir} diff --git a/NodeStateManager/config/nodestatemanager-daemon.service.in b/NodeStateManager/config/nodestatemanager-daemon.service.in index 03177bb..6842cbd 100644 --- a/NodeStateManager/config/nodestatemanager-daemon.service.in +++ b/NodeStateManager/config/nodestatemanager-daemon.service.in @@ -1,4 +1,13 @@ -# This file is for starting the nodestatemanager-daemon as a service with systemd +# +# Copyright (C) 2012 Continental Automotive Systems, Inc. +# +# Author: Jean-Pierre.Bogler@continental-corporation.com +# +# This file is for starting the nodestatemanager-daemon as a service with systemd +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. [Unit] Description=NodeStateManager to provide system states, session and shutdown handling |