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