Introduced workitems to Scanner IMV
[strongswan.git] / src / libimcv / imv / imv_workitem.h
1 /*
2 * Copyright (C) 2013 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 /**
17 *
18 * @defgroup imv_workitem_t imv_workitem
19 * @{ @ingroup libimcv_imv
20 */
21
22 #ifndef IMV_WORKITEM_H_
23 #define IMV_WORKITEM_H_
24
25 #include <tncifimv.h>
26
27 #include <library.h>
28
29 typedef struct imv_workitem_t imv_workitem_t;
30 typedef enum imv_workitem_type_t imv_workitem_type_t;
31
32 enum imv_workitem_type_t {
33 IMV_WORKITEM_PACKAGES = 1,
34 IMV_WORKITEM_UNKNOWN_SOURCE = 2,
35 IMV_WORKITEM_FORWARDING = 3,
36 IMV_WORKITEM_DEFAULT_PWD = 4,
37 IMV_WORKITEM_FILE_REF_MEAS = 5,
38 IMV_WORKITEM_FILE_MEAS = 6,
39 IMV_WORKITEM_FILE_META = 7,
40 IMV_WORKITEM_DIR_REF_MEAS = 8,
41 IMV_WORKITEM_DIR_MEAS = 9,
42 IMV_WORKITEM_DIR_META = 10,
43 IMV_WORKITEM_TCP_PORT_OPEN = 11,
44 IMV_WORKITEM_TCP_PORT_BLOCK = 12,
45 IMV_WORKITEM_UDP_PORT_OPEN = 13,
46 IMV_WORKITEM_UDP_PORT_BLOCK = 14
47 };
48
49 extern enum_name_t *imv_workitem_type_names;
50
51 /**
52 * IMV database interface
53 */
54 struct imv_workitem_t {
55
56 /**
57 * Get primary workitem key
58 *
59 * @return Primary workitem key
60 */
61 int (*get_id)(imv_workitem_t *this);
62
63 /**
64 * Get workitem type
65 *
66 * @return Workitem type
67 */
68 imv_workitem_type_t (*get_type)(imv_workitem_t *this);
69
70 /**
71 * Set IMV ID
72 *
73 * @param id IMV ID
74 */
75 void (*set_imv_id)(imv_workitem_t *this, TNC_IMVID imv_id);
76
77 /**
78 * Get IMV ID
79 *
80 * @return IMV ID
81 */
82 TNC_IMVID (*get_imv_id)(imv_workitem_t *this);
83
84 /**
85 * Get string argument
86 *
87 * @return Argument string
88 */
89 char* (*get_arg_str)(imv_workitem_t *this);
90
91 /**
92 * Get integer argument
93 *
94 * @return Argument integer
95 */
96 int (*get_arg_int)(imv_workitem_t *this);
97
98 /**
99 * Set result string
100 *
101 * @param result Result string
102 * @param eval Evaluation Result
103 * @return Action Recommendation
104 */
105 TNC_IMV_Action_Recommendation (*set_result)(imv_workitem_t *this,
106 char *result, TNC_IMV_Evaluation_Result eval);
107
108 /**
109 * Set result string
110 *
111 * @param result Result string
112 * @return Action Recommendatino
113 */
114 TNC_IMV_Action_Recommendation (*get_result)(imv_workitem_t *this,
115 char **result);
116
117 /**
118 * Destroys an imv_workitem_t object
119 */
120 void (*destroy)(imv_workitem_t *this);
121 };
122
123 /**
124 * Create an imv_workitem_t instance
125 *
126 * @param id Primary workitem key
127 * @param type Workitem type
128 * @param arg_str String argument
129 * @param arg_int Integer argument
130 * @param rec_fail Recommendation with minor/major non-compliance case
131 * @param rec_noresult Recommendation in don't know/error case
132 */
133 imv_workitem_t *imv_workitem_create(int id, imv_workitem_type_t type,
134 char *arg_str, int arg_int,
135 TNC_IMV_Action_Recommendation rec_fail,
136 TNC_IMV_Action_Recommendation rec_noresult);
137
138 #endif /** IMV_WORKITEM_H_ @}*/