summaryrefslogtreecommitdiff
path: root/src/libimcv/ietf/ietf_attr_op_status.h
blob: b70fab608ba1c7b669383d5d3e229a494cf39d60 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
 * Copyright (C) 2012 Andreas Steffen
 * HSR Hochschule fuer Technik Rapperswil
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 */

/**
 * @defgroup ietf_attr_op_statust ietf_attr_op_status
 * @{ @ingroup ietf_attr
 */

#ifndef IETF_ATTR_OP_STATUS_H_
#define IETF_ATTR_OP_STATUS_H_

typedef struct ietf_attr_op_status_t ietf_attr_op_status_t;
typedef enum op_status_t op_status_t;
typedef enum op_result_t op_result_t;

#include "ietf_attr.h"
#include "pa_tnc/pa_tnc_attr.h"

/**
 * Operational Status type
 */
enum op_status_t {
	OP_STATUS_UNKNOWN =       0,
	OP_STATUS_NOT_INSTALLED = 1,
	OP_STATUS_INSTALLED =     2,
	OP_STATUS_OPERATIONAL =   3,
	OP_STATUS_ROOF =          3
};

extern enum_name_t *op_status_names;

/**
 * Operational Result type
 */
enum op_result_t {
	OP_RESULT_UNKNOWN =      0,
	OP_RESULT_SUCCESSFUL =   1,
	OP_RESULT_ERRORED =      2,
	OP_RESULT_UNSUCCESSFUL = 3,
	OP_RESULT_ROOF         = 3
};

extern enum_name_t *op_result_names;

/**
 * Class implementing the IETF PA-TNC Operational Status attribute.
 *
 */
struct ietf_attr_op_status_t {

	/**
	 * Public PA-TNC attribute interface
	 */
	pa_tnc_attr_t pa_tnc_attribute;

	/**
	 * Gets the Operational Status
	 *
	 * @return				Operational Status
	 */
	u_int8_t (*get_status)(ietf_attr_op_status_t *this);

	/**
	 * Gets the Operational Result
	 *
	 * @return				Operational Result
	 */
	u_int8_t (*get_result)(ietf_attr_op_status_t *this);

	/**
	 * Gets the time of last use
	 *
	 * @return				Time of last use
	 */
	time_t (*get_last_use)(ietf_attr_op_status_t *this);
};

/**
 * Creates an ietf_attr_op_status_t object
 *
 * @param status			Operational Status
 * @param result			Operational Result
 * @param last_use			Time of last use
 */
pa_tnc_attr_t* ietf_attr_op_status_create(u_int8_t status, u_int8_t result,
										  time_t last_use);

/**
 * Creates an ietf_attr_op_status_t object from received data
 *
 * @param value				unparsed attribute value
 */
pa_tnc_attr_t* ietf_attr_op_status_create_from_data(chunk_t value);

#endif /** IETF_ATTR_OP_STATUS_H_ @}*/