Open SCAP Library

worker.h
1 /*
2 * Copyright 2011 Red Hat Inc., Durham, North Carolina.
3 * All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * Authors:
20 * Daniel Kopecek <dkopecek@redhat.com>
21 */
22 #ifndef WORKER_H
23 #define WORKER_H
24
25 #include <seap.h>
26 #include <sexp.h>
27 #include <pthread.h>
28 #include "probe.h"
29
30 #ifndef PROBE_WORKER_DEFAULT_MAX_THREADS
31 # define PROBE_WORKER_DEFAULT_MAX_THREADS 64
32 #endif
33
34 #ifndef PROBE_WORKER_DEFAULT_MAX_CHDEPTH
35 # define PROBE_WORKER_DEFAULT_MAX_CHDEPTH 8
36 #endif
37
38 typedef struct {
39 SEAP_msgid_t sid;
40 pthread_t tid;
41 SEXP_t * (*msg_handler)(probe_t *, SEAP_msg_t *, int *);
42 SEAP_msg_t *msg;
43 } probe_worker_t;
44
45 typedef struct {
46 probe_t *probe;
47 probe_worker_t *pth;
48 } probe_pwpair_t;
49
50 probe_worker_t *probe_worker_new(void);
51 void *probe_worker_runfn(void *arg);
52 SEXP_t *probe_worker(probe_t *probe, SEAP_msg_t *msg_in, int *ret);
53
54 #endif /* WORKER_H */
probe_pwpair_t
Definition: worker.h:45
probe_t
Definition: probe.h:39
probe_worker_t
Definition: worker.h:38
probe_worker_t::tid
pthread_t tid
thread ID
Definition: worker.h:40
probe_worker_t::sid
SEAP_msgid_t sid
SEAP message handled by this thread.
Definition: worker.h:39
SEXP
Definition: sexp-types.h:82
probe_worker_t::msg
SEAP_msg_t * msg
the message being handled
Definition: worker.h:42
SEAP_msg
Definition: _seap-message.h:39