Choco OS  V.0.16.9.0
Join to the chocolate world
oc_service.h File Reference

interface for handling services More...

#include <oc_errors.h>
#include <oc_thread.h>
#include <oc_process.h>
#include <oc_module.h>

Go to the source code of this file.

Data Structures

struct  oC_Service_Registration_t
 

Typedefs

typedef struct Service_toC_Service_t
 object for storing service data More...
 

Functions

oC_Service_t oC_Service_New (const oC_Service_Registration_t *Registration)
 allocates memory for a new service More...
 
bool oC_Service_Delete (oC_Service_t *Service)
 releases memory allocated for a service More...
 
bool oC_Service_IsCorrect (oC_Service_t Service)
 returns true if the service object is correct
 
oC_ErrorCode_t oC_Service_Start (oC_Service_t Service)
 starts the service More...
 
oC_ErrorCode_t oC_Service_Stop (oC_Service_t Service)
 stops the service More...
 
bool oC_Service_IsActive (oC_Service_t Service)
 returns true if the service is correct and active
 
const char * oC_Service_GetName (oC_Service_t Service)
 returns name of the service
 
oC_Process_t oC_Service_GetProcess (oC_Service_t Service)
 returns process associated with the service
 

Detailed Description


Author
Patryk Kubiak - (Created on: 18.01.2017 19:09:18)
Note
Copyright (C) 2017 Patryk Kubiak patry.nosp@m.k.ku.nosp@m.biak@.nosp@m.choc.nosp@m.oos.o.nosp@m.rg
           This program is free software; you can redistribute it and/or modify
           it under the terms of the GNU General Public License as published by
           the Free Software Foundation; either version 2 of the License, or
           (at your option) any later version.

           This program is distributed in the hope that it will be useful,
           but WITHOUT ANY WARRANTY; without even the implied warranty of
           MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
           GNU General Public License for more details.

           You should have received a copy of the GNU General Public License
           along with this program; if not, write to the Free Software
           Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

Definition in file oc_service.h.

Typedef Documentation

typedef struct Service_t* oC_Service_t

The type is for storing service object data.

Definition at line 70 of file oc_service.h.

Function Documentation

bool oC_Service_Delete ( oC_Service_t Service)

The function is for releasing memory allocated for the service object. It also kills the service process and service thread.

Parameters
ServicePointer to the memory where the service object is stored.
Returns
true if the memory has been released

Definition at line 175 of file oc_service.c.

oC_Service_t oC_Service_New ( const oC_Service_Registration_t Registration)

The function is for allocating memory for a service object.

Note
If the function returns NULL, you will find an error description in the errors stack.
Parameters
RegistrationStructure with registration of the service
Returns
pointer to the allocated and initialized service object or NULL in case of error

Definition at line 111 of file oc_service.c.

oC_ErrorCode_t oC_Service_Start ( oC_Service_t  Service)

The function starts the given service. The service cannot be already started. If it is, you have to stop it first by calling oC_Service_Stop.

Parameters
ServiceService object created by the function oC_Service_New
Returns
code of error or oC_ErrorCode_None in case of success

Definition at line 232 of file oc_service.c.

oC_ErrorCode_t oC_Service_Stop ( oC_Service_t  Service)

The function stops the given service. The service has to be already started. If it is not, you have to start it first by calling oC_Service_Start.

Parameters
ServiceService object created by the function oC_Service_New
Returns
code of error or oC_ErrorCode_None in case of success

Definition at line 273 of file oc_service.c.