summaryrefslogtreecommitdiff
path: root/src/worker.h
blob: 0e243afea9f986d12d147ecaf542d92abb8ab41e (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
#ifndef _BIRUDA_WORKER_HEADER_INCLUDED
#define _BIRUDA_WORKER_HEADER_INCLUDED

#include <stdio.h>

typedef enum {
	WORKER_EXECUTION_DISABLED = 0,
	WORKER_EXECUTION_DIRECT = 1
} worker_execution_mode_t;

typedef enum {
	WORKER_STATE_STOPPED = 0,
	WORKER_STATE_RUNNING = 1
} worker_state_t;

typedef struct {
	char *name;
	worker_execution_mode_t mode;
	char *command;
	worker_state_t state;
	void *execution_data;
	const char *control;
	const char *data;
} worker_t;

const char *worker_exection_mode_str( worker_execution_mode_t mode );
worker_execution_mode_t worker_execution_mode_from_str( const char *s );
const char *worker_state_str( worker_state_t state );
worker_state_t worker_state_from_str( const char *s );

int worker_init( worker_t *worker );
void worker_terminate( worker_t *worker );
int worker_free( );

#endif