Annotation of embedaddon/strongswan/src/libimcv/pa_tnc/pa_tnc_msg.h, revision 1.1.1.1

1.1       misho       1: /*
                      2:  * Copyright (C) 2011-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 pa_tnc_msg pa_tnc_msg
                     18:  * @{ @ingroup pa_tnc
                     19:  */
                     20: 
                     21: #ifndef PA_TNC_MSG_H_
                     22: #define PA_TNC_MSG_H_
                     23: 
                     24: typedef struct pa_tnc_msg_t pa_tnc_msg_t;
                     25: 
                     26: #define PA_TNC_VERSION         0x01
                     27: #define PA_TNC_HEADER_SIZE     8
                     28: 
                     29: #include "pa_tnc_attr.h"
                     30: 
                     31: #include <library.h>
                     32: 
                     33: /**
                     34:  * Interface for the RFC 5792 PA-TNC Posture Attribute protocol.
                     35:  *
                     36:  */
                     37: struct pa_tnc_msg_t {
                     38: 
                     39:        /**
                     40:         * Get the encoding of the PA-TNC message
                     41:         *
                     42:         * @return                                      encoded PA-TNC message
                     43:         */
                     44:        chunk_t (*get_encoding)(pa_tnc_msg_t *this);
                     45: 
                     46:        /**
                     47:         * Get the remaining space in octets left in the PA-TNC message
                     48:         *
                     49:         * @return                                      remaining space or 0 if max_msg_len is not set
                     50:         */
                     51:        size_t (*get_space)(pa_tnc_msg_t *this);
                     52: 
                     53:        /**
                     54:         * Add a PA-TNC attribute
                     55:         *
                     56:         * @param attr                          PA-TNC attribute to be added
                     57:         * @return                                      TRUE if attribute fit into message and was added
                     58:         */
                     59:        bool (*add_attribute)(pa_tnc_msg_t *this, pa_tnc_attr_t* attr);
                     60: 
                     61:        /**
                     62:         * Build the PA-TNC message
                     63:         *
                     64:         * @return                                      TRUE if PA-TNC message was built successfully
                     65:         */
                     66:        bool (*build)(pa_tnc_msg_t *this);
                     67: 
                     68:        /**
                     69:         * Process the PA-TNC message
                     70:         *
                     71:         * @return                                      return processing status
                     72:         */
                     73:        status_t (*process)(pa_tnc_msg_t *this);
                     74: 
                     75:        /**
                     76:         * Process all IETF standard error PA-TNC attributes
                     77:         *
                     78:         * @param non_fatal_types       list of non fatal unsupported attribute types
                     79:         * @return                                      TRUE if at least one fatal error processed
                     80:         */
                     81:        bool (*process_ietf_std_errors)(pa_tnc_msg_t *this,
                     82:                                                                    linked_list_t *non_fatal_types);
                     83: 
                     84:        /**
                     85:         * Enumerates over all PA-TNC attributes
                     86:         *
                     87:         * @return                              return attribute enumerator
                     88:         */
                     89:        enumerator_t* (*create_attribute_enumerator)(pa_tnc_msg_t *this);
                     90: 
                     91:        /**
                     92:         * Enumerates over all parsing errors
                     93:         *
                     94:         * @return                              return error enumerator
                     95:         */
                     96:        enumerator_t* (*create_error_enumerator)(pa_tnc_msg_t *this);
                     97: 
                     98:        /**
                     99:         * Destroys a pa_tnc_msg_t object.
                    100:         */
                    101:        void (*destroy)(pa_tnc_msg_t *this);
                    102: };
                    103: 
                    104: /**
                    105:  * Create an empty PA-TNC message
                    106:  */
                    107: pa_tnc_msg_t* pa_tnc_msg_create(size_t max_msg_len);
                    108: 
                    109: /**
                    110:  * Create an unprocessed PA-TNC message from received data
                    111:  *
                    112:  * @param data                                 PA-TNC message data
                    113:  */
                    114: pa_tnc_msg_t* pa_tnc_msg_create_from_data(chunk_t data);
                    115: 
                    116: #endif /** PA_TNC_MSG_H_ @}*/

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>