Annotation of embedaddon/strongswan/src/libimcv/seg/seg_env.h, revision 1.1
1.1 ! misho 1: /*
! 2: * Copyright (C) 2014-2015 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: * @defgroup seg_env seg_env
! 18: * @{ @ingroup libimcv_seg
! 19: */
! 20:
! 21: #ifndef SEG_ENV_H_
! 22: #define SEG_ENV_H_
! 23:
! 24: typedef struct seg_env_t seg_env_t;
! 25: typedef enum seg_env_flags_t seg_env_flags_t;
! 26:
! 27: #include <library.h>
! 28:
! 29: #include <pa_tnc/pa_tnc_attr.h>
! 30:
! 31: /**
! 32: * Segment Envelope flags
! 33: */
! 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)
! 38: };
! 39:
! 40: /**
! 41: * Interface for a PA-TNC attribute segment envelope object
! 42: */
! 43: struct seg_env_t {
! 44:
! 45: /**
! 46: * Get Base Attribute ID
! 47: *
! 48: * @return Base Attribute ID
! 49: */
! 50: uint32_t (*get_base_attr_id)(seg_env_t *this);
! 51:
! 52: /**
! 53: * Get Base Attribute if it contains processed [incremental] data
! 54: *
! 55: * @return Base Attribute (must be destroyed) or NULL
! 56: */
! 57: pa_tnc_attr_t* (*get_base_attr)(seg_env_t *this);
! 58:
! 59: /**
! 60: * Base Attribute Info to be used by PA-TNC error messages
! 61: *
! 62: * @return Message info string
! 63: */
! 64: chunk_t (*get_base_attr_info)(seg_env_t *this);
! 65:
! 66: /**
! 67: * Generate the first segment envelope of the base attribute
! 68: *
! 69: * @param max_attr_len Maximum size of first attribute segment envelope
! 70: * @return First attribute segment envelope
! 71: */
! 72: pa_tnc_attr_t* (*first_segment)(seg_env_t *this, size_t max_attr_len);
! 73:
! 74: /**
! 75: * Generate the next segment envelope of the base attribute
! 76: *
! 77: * @param last TRUE if last segment
! 78: * @return Next attribute segment envelope
! 79: */
! 80: pa_tnc_attr_t* (*next_segment)(seg_env_t *this, bool *last);
! 81:
! 82: /**
! 83: * Generate the first segment envelope of the base attribute
! 84: *
! 85: * @param segment Attribute segment to be added
! 86: * @param error Error attribute if a parsing error occurred
! 87: * return TRUE if segment was successfully added
! 88: */
! 89: bool (*add_segment)(seg_env_t *this, chunk_t segment,
! 90: pa_tnc_attr_t** error);
! 91:
! 92: /**
! 93: * Destroys a seg_env_t object.
! 94: */
! 95: void (*destroy)(seg_env_t *this);
! 96: };
! 97:
! 98: /**
! 99: * Create a PA-TNC attribute segment envelope object
! 100: *
! 101: * @param base_attr_id Base Attribute ID
! 102: * @param base_attr Base Attribute to be segmented, owned by seg_env_t
! 103: * @param max_seg_size Maximum segment size
! 104: */
! 105: seg_env_t* seg_env_create(uint32_t base_attr_id, pa_tnc_attr_t *base_attr,
! 106: uint32_t max_seg_size);
! 107:
! 108: /**
! 109: * Create a PA-TNC attribute segment envelope object
! 110: *
! 111: * @param base_attr_id Base Attribute ID
! 112: * @param data First attribute segment
! 113: * @param max_seg_size Maximum segment size
! 114: * @param error Error attribute if a parsing error occurred
! 115: */
! 116: seg_env_t* seg_env_create_from_data(uint32_t base_attr_id, chunk_t data,
! 117: uint32_t max_seg_size,
! 118: pa_tnc_attr_t** error);
! 119:
! 120: #endif /** SEG_ENV_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>