80ce3f4534ed6cd5dbf888138e229eb296a2436b
[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_SCAN = 11,
44 IMV_WORKITEM_UDP_SCAN = 12
45 };
46
47 extern enum_name_t *imv_workitem_type_names;
48
49 /**
50 * IMV database interface
51 */
52 struct imv_workitem_t {
53
54 /**
55 * Get primary workitem key
56 *
57 * @return Primary workitem key
58 */
59 int (*get_id)(imv_workitem_t *this);
60
61 /**
62 * Get workitem type
63 *
64 * @return Workitem type
65 */
66 imv_workitem_type_t (*get_type)(imv_workitem_t *this);
67
68 /**
69 * Set IMV ID
70 *
71 * @param id IMV ID
72 */
73 void (*set_imv_id)(imv_workitem_t *this, TNC_IMVID imv_id);
74
75 /**
76 * Get IMV ID
77 *
78 * @return IMV ID
79 */
80 TNC_IMVID (*get_imv_id)(imv_workitem_t *this);
81
82 /**
83 * Get string argument
84 *
85 * @return Argument string
86 */
87 char* (*get_arg_str)(imv_workitem_t *this);
88
89 /**
90 * Get integer argument
91 *
92 * @return Argument integer
93 */
94 int (*get_arg_int)(imv_workitem_t *this);
95
96 /**
97 * Set result string
98 *
99 * @param result Result string
100 * @param eval Evaluation Result
101 * @return Action Recommendation
102 */
103 TNC_IMV_Action_Recommendation (*set_result)(imv_workitem_t *this,
104 char *result, TNC_IMV_Evaluation_Result eval);
105
106 /**
107 * Set result string
108 *
109 * @param result Result string
110 * @return Action Recommendatino
111 */
112 TNC_IMV_Action_Recommendation (*get_result)(imv_workitem_t *this,
113 char **result);
114
115 /**
116 * Destroys an imv_workitem_t object
117 */
118 void (*destroy)(imv_workitem_t *this);
119 };
120
121 /**
122 * Create an imv_workitem_t instance
123 *
124 * @param id Primary workitem key
125 * @param type Workitem type
126 * @param arg_str String argument
127 * @param arg_int Integer argument
128 * @param rec_fail Recommendation with minor/major non-compliance case
129 * @param rec_noresult Recommendation in don't know/error case
130 */
131 imv_workitem_t *imv_workitem_create(int id, imv_workitem_type_t type,
132 char *arg_str, int arg_int,
133 TNC_IMV_Action_Recommendation rec_fail,
134 TNC_IMV_Action_Recommendation rec_noresult);
135
136 #endif /** IMV_WORKITEM_H_ @}*/