2 * Copyright (C) 2014 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
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>.
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
17 * @defgroup seg_env seg_env
18 * @{ @ingroup libimcv_seg
24 typedef struct seg_env_t seg_env_t
;
25 typedef enum seg_env_flags_t seg_env_flags_t
;
29 #include <pa_tnc/pa_tnc_attr.h>
32 * Segment Envelope flags
34 enum seg_env_flags_t
{
35 SEG_ENV_FLAG_NONE
= 0,
36 SEG_ENV_FLAG_MORE
= (1<<7),
37 SEG_ENV_FLAG_START
= (1<<6)
41 * Interface for a PA-TNC attribute segment envelope object
46 * Get Base Attribute ID
48 * @return Base Attribute ID
50 uint32_t (*get_base_attr_id
)(seg_env_t
*this);
53 * Get Base Attribute if it contains processed [incremental] data
55 * @return Base Attribute (must be destroyed) or NULL
57 pa_tnc_attr_t
* (*get_base_attr
)(seg_env_t
*this);
60 * Base Attribute Info to be used by PA-TNC error messages
62 * @return Message info string
64 chunk_t (*get_base_attr_info
)(seg_env_t
*this);
67 * Generate the first segment envelope of the base attribute
69 * @return First attribute segment envelope
71 pa_tnc_attr_t
* (*first_segment
)(seg_env_t
*this);
74 * Generate the next segment envelope of the base attribute
76 * @param last TRUE if last segment
77 * @return Next attribute segment envelope
79 pa_tnc_attr_t
* (*next_segment
)(seg_env_t
*this, bool *last
);
82 * Generate the first segment envelope of the base attribute
84 * @param segment Attribute segment to be added
85 * @param error Error attribute if a parsing error occurred
86 * return TRUE if segment was successfully added
88 bool (*add_segment
)(seg_env_t
*this, chunk_t segment
,
89 pa_tnc_attr_t
** error
);
92 * Destroys a seg_env_t object.
94 void (*destroy
)(seg_env_t
*this);
98 * Create a PA-TNC attribute segment envelope object
100 * @param base_attr_id Base Attribute ID
101 * @param base_attr Base Attribute to be segmented, owned by seg_env_t
102 * @param max_seg_size Maximum segment size
104 seg_env_t
* seg_env_create(uint32_t base_attr_id
, pa_tnc_attr_t
*base_attr
,
105 uint32_t max_seg_size
);
108 * Create a PA-TNC attribute segment envelope object
110 * @param base_attr_id Base Attribute ID
111 * @param data First attribute segment
112 * @param max_seg_size Maximum segment size
113 * @param error Error attribute if a parsing error occurred
115 seg_env_t
* seg_env_create_from_data(uint32_t base_attr_id
, chunk_t data
,
116 uint32_t max_seg_size
,
117 pa_tnc_attr_t
** error
);
119 #endif /** SEG_ENV_H_ @}*/