Annotation of embedaddon/strongswan/src/libimcv/pa_tnc/pa_tnc_attr_manager.h, revision 1.1
1.1 ! misho 1: /*
! 2: * Copyright (C) 2011-2014 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 pa_tnc_attr_manager pa_tnc_attr_manager
! 18: * @{ @ingroup pa_tnc
! 19: */
! 20:
! 21: #ifndef PA_TNC_ATTR_MANAGER_H_
! 22: #define PA_TNC_ATTR_MANAGER_H_
! 23:
! 24: typedef struct pa_tnc_attr_manager_t pa_tnc_attr_manager_t;
! 25:
! 26: #include "pa_tnc_attr.h"
! 27:
! 28: #include <library.h>
! 29: #include <bio/bio_reader.h>
! 30:
! 31: typedef pa_tnc_attr_t* (*pa_tnc_attr_create_t)(uint32_t type, size_t length,
! 32: chunk_t value);
! 33:
! 34: /**
! 35: * Manages PA-TNC attributes for arbitrary PENs
! 36: */
! 37: struct pa_tnc_attr_manager_t {
! 38:
! 39: /**
! 40: * Add vendor-specific attribute names and creation method
! 41: *
! 42: * @param vendor_id Private Enterprise Number (PEN)
! 43: * @param attr_create Vendor-specific attribute create method
! 44: * @param attr_names Vendor-specific attribute names
! 45: */
! 46: void (*add_vendor)(pa_tnc_attr_manager_t *this, pen_t vendor_id,
! 47: pa_tnc_attr_create_t attr_create,
! 48: enum_name_t *attr_names);
! 49:
! 50: /**
! 51: * Remove vendor-specific attribute names and creation method
! 52: *
! 53: * @param vendor_id Private Enterprise Number (PEN)
! 54: */
! 55: void (*remove_vendor)(pa_tnc_attr_manager_t *this, pen_t vendor_id);
! 56:
! 57: /*
! 58: * Return the PA-TNC attribute names for a given vendor ID
! 59: *
! 60: * @param vendor_id Private Enterprise Number (PEN)
! 61: * @return PA-TNC attribute names if found, NULL else
! 62: */
! 63: enum_name_t* (*get_names)(pa_tnc_attr_manager_t *this, pen_t vendor_id);
! 64:
! 65: /**
! 66: * Create and pre-parse a PA-TNC attribute object from data
! 67: *
! 68: * @param reader PA-TNC attribute as encoded data
! 69: * @param segmented TRUE if attribute is segmented
! 70: * @param offset Offset in bytes where an error has been found
! 71: * @param msg_info Message info added to an error attribute
! 72: * @param error Error attribute if an error occurred
! 73: * @return PA-TNC attribute object if supported, NULL else
! 74: */
! 75: pa_tnc_attr_t* (*create)(pa_tnc_attr_manager_t *this, bio_reader_t *reader,
! 76: bool segmented, uint32_t *offset, chunk_t msg_info,
! 77: pa_tnc_attr_t **error);
! 78:
! 79: /**
! 80: * Generically construct a PA-TNC attribute from type and data
! 81: *
! 82: * @param vendor_id Private Enterprise Number (PEN)
! 83: * @param type PA-TNC attribute type
! 84: * @param value PA-TNC attribute value as encoded data
! 85: * @return PA-TNC attribute object if supported, NULL else
! 86: */
! 87: pa_tnc_attr_t* (*construct)(pa_tnc_attr_manager_t *this, pen_t vendor_id,
! 88: uint32_t type, chunk_t value);
! 89:
! 90: /**
! 91: * Destroys a pa_tnc_attr_manager_t object.
! 92: */
! 93: void (*destroy)(pa_tnc_attr_manager_t *this);
! 94: };
! 95:
! 96: /**
! 97: * Create a PA-TNC attribute manager
! 98: */
! 99: pa_tnc_attr_manager_t* pa_tnc_attr_manager_create(void);
! 100:
! 101: #endif /** PA_TNC_ATTR_MANAGER_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>