Likewise Service Manager
|
Client API. More...
Data Structures | |
struct | PLW_SERVICE_INFO |
Service information. More... | |
struct | PLW_SERVICE_STATUS |
Service status. More... | |
Typedefs | |
typedef struct _LW_SERVICE_HANDLE * | LW_SERVICE_HANDLE |
Opaque service handle. More... | |
Functions | |
DWORD | LwSmAcquireServiceHandle (LW_PCWSTR pwszServiceName, PLW_SERVICE_HANDLE phHandle) |
Acquire service handle. More... | |
DWORD | LwSmReleaseServiceHandle (LW_SERVICE_HANDLE hHandle) |
Release a service handle. More... | |
DWORD | LwSmEnumerateServices (PWSTR **pppwszServiceNames) |
Enumerate available services. More... | |
VOID | LwSmFreeServiceNameList (PWSTR *ppwszServiceNames) |
Free service name list. More... | |
DWORD | LwSmAddService (PCLW_SERVICE_INFO pServiceInfo, PLW_SERVICE_HANDLE phHandle) |
Add new service. More... | |
DWORD | LwSmRemoveService (LW_SERVICE_HANDLE hHandle) |
Remove an existing service. More... | |
DWORD | LwSmUpdateServiceInfo (LW_SERVICE_HANDLE hHandle, PCLW_SERVICE_INFO pServiceInfo, LW_SERVICE_INFO_MASK mask) |
Update service information. More... | |
DWORD | LwSmStartService (LW_SERVICE_HANDLE hHandle) |
Start a service. More... | |
DWORD | LwSmStopService (LW_SERVICE_HANDLE hHandle) |
Stop a service. More... | |
DWORD | LwSmQueryServiceStatus (LW_SERVICE_HANDLE hHandle, PLW_SERVICE_STATUS pStatus) |
Get service status. More... | |
DWORD | LwSmWaitService (LW_SERVICE_HANDLE hHandle, LW_SERVICE_STATE currentState, PLW_SERVICE_STATE pNewState) |
Wait for service state change. More... | |
DWORD | LwSmRefreshService (LW_SERVICE_HANDLE hHandle) |
Refresh service. More... | |
DWORD | LwSmSetServiceLogTarget (LW_SERVICE_HANDLE hHandle, LW_PCSTR pFacility, LW_SM_LOGGER_TYPE type, PCSTR pTarget) |
Sets log target for a service. More... | |
DWORD | LwSmSetServiceLogLevel (LW_SERVICE_HANDLE hHandle, LW_PCSTR pFacility, LW_SM_LOG_LEVEL level) |
Set maximum log level for a service. More... | |
DWORD | LwSmGetServiceLogState (LW_SERVICE_HANDLE hHandle, LW_PCSTR pFacility, PLW_SM_LOGGER_TYPE pType, LW_PSTR *ppTarget, PLW_SM_LOG_LEVEL pLevel) |
Get current logging state for a service. More... | |
VOID | LwSmFreeLogTarget (LW_PSTR pTarget) |
Free logging target. More... | |
DWORD | LwSmEnumerateServiceLogFacilities (LW_SERVICE_HANDLE hHandle, LW_PWSTR **pppFacilities) |
Enumerate logging facilities for a service. More... | |
VOID | LwSmFreeLogFacilityList (LW_PWSTR *ppFacilities) |
Free log facility list. More... | |
DWORD | LwSmQueryServiceInfo (LW_SERVICE_HANDLE hHandle, PLW_SERVICE_INFO *ppInfo) |
Get service info. More... | |
DWORD | LwSmQueryServiceDependencyClosure (LW_SERVICE_HANDLE hHandle, PWSTR **pppwszServiceList) |
Get recursive dependency list. More... | |
DWORD | LwSmQueryServiceReverseDependencyClosure (LW_SERVICE_HANDLE hHandle, PWSTR **pppwszServiceList) |
Get recursive reverse dependency list. More... | |
VOID | LwSmFreeServiceInfo (PLW_SERVICE_INFO pInfo) |
Free service info structure. More... | |
DWORD | LwSmRefresh (VOID) |
Refresh service manager. More... | |
DWORD | LwSmShutdown (VOID) |
Shutdown. More... | |
DWORD | LwSmSetGlobal (LW_IN LW_SM_GLOBAL_SETTING Setting,...) |
Change global setting. More... | |
DWORD | LwSmGetGlobal (LW_IN LW_SM_GLOBAL_SETTING Setting,...) |
Get global setting. More... | |
VOID | LwSmFreeGlobal (LW_IN LW_SM_GLOBAL_SETTING Setting,...) |
Free global setting value. More... | |
This module contains the client-side API used to query and control services in the Likewise Service Manager (lwsmd)
typedef struct _LW_SERVICE_HANDLE* LW_SERVICE_HANDLE |
A handle to a particular service that can be used to query or perform operations upon it.
enum LW_SM_LOG_LEVEL |
Describes the level of a log message in terms of importance.
enum LW_SM_LOGGER_TYPE |
enum LW_SERVICE_STATE |
Represents the state of a service (running, stopped, etc.)
enum LW_SERVICE_TYPE |
Represents the type of a service
enum LW_SERVICE_HOME |
Denotes the location of a running service.
enum LW_SERVICE_INFO_MASK |
A bitmask which indicates which fields to update in an LwSmUpdateServiceInfo() call.
enum LW_SM_GLOBAL_SETTING |
DWORD LwSmAcquireServiceHandle | ( | LW_PCWSTR | pwszServiceName, |
PLW_SERVICE_HANDLE | phHandle | ||
) |
Gets a handle to a known service by name
[in] | pwszServiceName | the name of the service |
[out] | phHandle | a service handle |
LW_ERROR_SUCCESS | success |
LW_ERROR_NO_SUCH_SERVICE | no service with the specified name exists |
DWORD LwSmReleaseServiceHandle | ( | LW_SERVICE_HANDLE | hHandle | ) |
Releases a handle previously acquired with LwSmAcquireServiceHandle().
[in] | hHandle | the service handle |
LW_ERROR_SUCCESS | success |
DWORD LwSmEnumerateServices | ( | PWSTR ** | pppwszServiceNames | ) |
Returns a NULL-terminated list of strings containing the names of all known services. The list should be freed with LwSmFreeServiceNameList() when done.
[out] | pppwszServiceNames | the returned list of services |
LW_ERROR_SUCCESS | success |
VOID LwSmFreeServiceNameList | ( | PWSTR * | ppwszServiceNames | ) |
Frees a service name list as returned by e.g. LwSmEnumerateServices()
[in,out] | ppwszServiceNames | the list of services |
DWORD LwSmAddService | ( | PCLW_SERVICE_INFO | pServiceInfo, |
PLW_SERVICE_HANDLE | phHandle | ||
) |
Adds a new service to the service manager described by the provided service info structure and returns a handle to it.
[in] | pServiceInfo | a service info structure describing the new service |
[out] | phHandle | the created service |
DWORD LwSmRemoveService | ( | LW_SERVICE_HANDLE | hHandle | ) |
Removes an existing service from the service manager. The service will not actually be removed until the last handle to it is released with LwSmReleaseServiceHandle().
[in] | hHandle | the service handle |
LW_ERROR_SUCCESS | success |
DWORD LwSmUpdateServiceInfo | ( | LW_SERVICE_HANDLE | hHandle, |
PCLW_SERVICE_INFO | pServiceInfo, | ||
LW_SERVICE_INFO_MASK | mask | ||
) |
Updates the basic information for a service.
[in] | hHandle | the service handle |
[in] | pServiceInfo | service information |
[in] | mask | a bitmask describing which information fields to update |
LW_ERROR_SUCCESS | success |
LW_ERROR_ACCESS_DENIED | the caller does not have permission to update the service |
DWORD LwSmStartService | ( | LW_SERVICE_HANDLE | hHandle | ) |
Starts the service represented by the given service handle. If the service is already started, this function trivially succeeds. If the service is not started, it will attempt to start it and wait for it finish starting. If the service is in the process of starting, it will wait for it to finish starting.
[in] | hHandle | the service handle |
LW_ERROR_SUCCESS | success |
LW_ERROR_SERVICE_UNRESPONSIVE | the service did not respond to requests to start |
LW_ERROR_SERVICE_DEPENDENCY_UNMET | the service depends on another service which is not running |
LW_ERROR_INVALID_SERVICE_TRANSITION | the service cannot be started in its present state |
DWORD LwSmStopService | ( | LW_SERVICE_HANDLE | hHandle | ) |
Stops the service represented by the given service handle. If the service is already stopped, this function trivially succeeds. If the service is not stopped, it will attempt to stop it and wait for it finish stopping. If the service is in the process of stopping, it will wait for it to finish stopping.
[in] | hHandle | the service handle |
LW_ERROR_SUCCESS | success |
LW_ERROR_SERVICE_UNRESPONSIVE | the service did not respond to requests to stop |
LW_ERROR_DEPENDENT_SERVICE_STILL_RUNNING | the service cannot be stopped as another running service depends on it |
LW_ERROR_INVALID_SERVICE_TRANSITION | the service cannot be started in its present state |
DWORD LwSmQueryServiceStatus | ( | LW_SERVICE_HANDLE | hHandle, |
PLW_SERVICE_STATUS | pStatus | ||
) |
Gets the current status of the service represented by the given service handle.
[in] | hHandle | the service handle |
[out] | pStatus | the status of the service |
LW_ERROR_SUCCESS | success |
DWORD LwSmWaitService | ( | LW_SERVICE_HANDLE | hHandle, |
LW_SERVICE_STATE | currentState, | ||
PLW_SERVICE_STATE | pNewState | ||
) |
Waits for the given service's state to change. The last known state of the service must be specified as a parameter, and the new state will be returned when a change occurs.
[in] | hHandle | the service handle |
[in] | currentState | the last known state of the service |
[out] | pNewState | the new state of the service |
DWORD LwSmRefreshService | ( | LW_SERVICE_HANDLE | hHandle | ) |
Refreshes the service represented by the given service handle, which typically entails it reloading its configuration.
[in] | hHandle | the service handle |
LW_ERROR_SUCCESS | success |
DWORD LwSmSetServiceLogTarget | ( | LW_SERVICE_HANDLE | hHandle, |
LW_PCSTR | pFacility, | ||
LW_SM_LOGGER_TYPE | type, | ||
PCSTR | pTarget | ||
) |
Sets the log target for a service. If the service is running in a container, all services in the same container will be affected.
[in] | hHandle | the service handle, or NULL to specify lwsmd itself |
[in] | pFacility | the facility to redirect, or NULL to set the default log target |
[in] | type | the type of logging target |
[in] | pTarget | the logging target, or NULL for target types that don't require it |
ERROR_SUCCESS | success |
ERROR_NOT_SUPPORTED | the specified service does not support setting log targets |
DWORD LwSmSetServiceLogLevel | ( | LW_SERVICE_HANDLE | hHandle, |
LW_PCSTR | pFacility, | ||
LW_SM_LOG_LEVEL | level | ||
) |
Sets the maximum log level for a service. If the service is running in a container, all services in the same container will be affected.
[in] | hHandle | the service handle, or NULL to specify lwsmd itself |
[in] | pFacility | the facility to set the level for, or NULL to set the default log level |
[in] | level | the maximum log level to set |
ERROR_SUCCESS | success |
ERROR_NOT_SUPPORTED | the specified service does not support setting log targets |
DWORD LwSmGetServiceLogState | ( | LW_SERVICE_HANDLE | hHandle, |
LW_PCSTR | pFacility, | ||
PLW_SM_LOGGER_TYPE | pType, | ||
LW_PSTR * | ppTarget, | ||
PLW_SM_LOG_LEVEL | pLevel | ||
) |
Gets the current logging target and maximum log level for a service. If the service is running in a container, the returned values apply to all services in the same container. The returned logging target string can be freed with LwSmFreeLogTarget().
[in] | hHandle | the service handle, or NULL to specify lwsmd itself |
[in] | pFacility | the facility to get state for, or NULL for the default state |
[out] | pType | set to the logging target type |
[out] | ppTarget | set to the logging target if applicable or NULL otherwise |
[out] | pLevel | set to the maximum log level |
ERROR_SUCCESS | |
ERROR_NOT_SUPPORTED | the specified service does not support getting log state |
VOID LwSmFreeLogTarget | ( | LW_PSTR | pTarget | ) |
Frees a logging target string returned by a previous call to LwSmGetServiceLogState().
[in,out] | pTarget |
DWORD LwSmEnumerateServiceLogFacilities | ( | LW_SERVICE_HANDLE | hHandle, |
LW_PWSTR ** | pppFacilities | ||
) |
Enumerates all logging facilities for a service that have a non-default configuration.
[in] | hHandle | the service handle, or NULL to specify lwsmd itself |
[out] | pppFacilities | set to the list of facilities |
ERROR_SUCCESS | |
ERROR_NOT_SUPPORTED | the specified service does not support getting log state |
VOID LwSmFreeLogFacilityList | ( | LW_PWSTR * | ppFacilities | ) |
Frees a list of logging facilities returned by LwSmEnumerateServiceLogFacilities().
DWORD LwSmQueryServiceInfo | ( | LW_SERVICE_HANDLE | hHandle, |
PLW_SERVICE_INFO * | ppInfo | ||
) |
Gets the service info structore of the service represented by the given service handle. The structure should be freed with LwSmFreeServiceInfo() when done.
[in] | hHandle | the service handle |
[out] | ppInfo | the info structure for the service |
LW_ERROR_SUCCESS | success |
DWORD LwSmQueryServiceDependencyClosure | ( | LW_SERVICE_HANDLE | hHandle, |
PWSTR ** | pppwszServiceList | ||
) |
Gets a list of all recursive dependencies of the service represented by the given service handle – that is, all services the given service depends on directly or indirectly. The entries in the list will be in the order in which they would need to be started in order to start the given service. The list should be freed with LwSmFreeServiceNameList() when done.
[in] | hHandle | the service handle |
[out] | pppwszServiceList | the service dependency list |
LW_ERROR_SUCCESS | success |
DWORD LwSmQueryServiceReverseDependencyClosure | ( | LW_SERVICE_HANDLE | hHandle, |
PWSTR ** | pppwszServiceList | ||
) |
Gets a list of all recursive reverse dependencies of the service represented by the given service handle – that is, all services which depend on the given service directly or indirectly. The entries in the list will be in the order in which they would need to be stopped in order to stop the given service. The list should be freed with LwSmFreeServiceNameList() when done.
[in] | hHandle | the service handle |
[out] | pppwszServiceList | the service reverse dependency list |
LW_ERROR_SUCCESS | success |
VOID LwSmFreeServiceInfo | ( | PLW_SERVICE_INFO | pInfo | ) |
Frees a service info structure as returned by e.g. LwSmQueryServiceInfo()
[in,out] | pInfo | the service info structure to free |
DWORD LwSmRefresh | ( | VOID | ) |
Causes the service manager to reread its own configuration. To refresh the configuration of a particular service, use LwSmRefreshService().
LW_ERROR_SUCCESS | success |
DWORD LwSmShutdown | ( | VOID | ) |
Causes the service manager to shut down completely.
LW_ERROR_SUCCESS | success |
DWORD LwSmSetGlobal | ( | LW_IN LW_SM_GLOBAL_SETTING | Setting, |
... | |||
) |
Changes a global setting. See the description of each global setting for the type of parameters to pass as the trailing arguments.
[in] | Setting | the setting to change |
[in] | ... | value or values for the given setting |
#ERROR_SUCCESS | success |
#ERROR_INVALID_PARAMETER | invalid setting or value |
DWORD LwSmGetGlobal | ( | LW_IN LW_SM_GLOBAL_SETTING | Setting, |
... | |||
) |
Gets the value of a global setting. The trailing parameters should be out pointers to the appropriate types listed in the description of the setting to change.
[in] | Setting | the setting to get |
[out] | ... | set to the value or values for the given setting |
VOID LwSmFreeGlobal | ( | LW_IN LW_SM_GLOBAL_SETTING | Setting, |
... | |||
) |
Frees the value of a global setting previously returned by LwSmGetGlobal().
[in] | Setting | the setting associated with the value to free |
[in,out] | ... | the value or values to free |