Annotation of embedaddon/strongswan/src/libcharon/encoding/payloads/cp_payload.h, revision 1.1

1.1     ! misho       1: /*
        !             2:  * Copyright (C) 2005-2009 Martin Willi
        !             3:  * Copyright (C) 2005 Jan Hutter
        !             4:  * HSR Hochschule fuer Technik Rapperswil
        !             5:  *
        !             6:  * This program is free software; you can redistribute it and/or modify it
        !             7:  * under the terms of the GNU General Public License as published by the
        !             8:  * Free Software Foundation; either version 2 of the License, or (at your
        !             9:  * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
        !            10:  *
        !            11:  * This program is distributed in the hope that it will be useful, but
        !            12:  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
        !            13:  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        !            14:  * for more details.
        !            15:  */
        !            16: 
        !            17: /**
        !            18:  * @defgroup cp_payload cp_payload
        !            19:  * @{ @ingroup payloads
        !            20:  */
        !            21: 
        !            22: #ifndef CP_PAYLOAD_H_
        !            23: #define CP_PAYLOAD_H_
        !            24: 
        !            25: typedef enum config_type_t config_type_t;
        !            26: typedef struct cp_payload_t cp_payload_t;
        !            27: 
        !            28: #include <library.h>
        !            29: #include <encoding/payloads/payload.h>
        !            30: #include <encoding/payloads/configuration_attribute.h>
        !            31: #include <collections/enumerator.h>
        !            32: 
        !            33: /**
        !            34:  * Config Type of an Configuration Payload.
        !            35:  */
        !            36: enum config_type_t {
        !            37:        CFG_REQUEST = 1,
        !            38:        CFG_REPLY = 2,
        !            39:        CFG_SET = 3,
        !            40:        CFG_ACK = 4,
        !            41: };
        !            42: 
        !            43: /**
        !            44:  * enum name for config_type_t.
        !            45:  */
        !            46: extern enum_name_t *config_type_names;
        !            47: 
        !            48: /**
        !            49:  * Class representing an IKEv2 configuration / IKEv1 attribute payload.
        !            50:  */
        !            51: struct cp_payload_t {
        !            52: 
        !            53:        /**
        !            54:         * The payload_t interface.
        !            55:         */
        !            56:        payload_t payload_interface;
        !            57: 
        !            58:        /**
        !            59:         * Creates an enumerator of stored configuration_attribute_t objects.
        !            60:         *
        !            61:         * @return                      enumerator over configuration_attribute_t
        !            62:         */
        !            63:        enumerator_t *(*create_attribute_enumerator) (cp_payload_t *this);
        !            64: 
        !            65:        /**
        !            66:         * Adds a configuration attribute to the configuration payload.
        !            67:         *
        !            68:         * @param attribute     attribute to add
        !            69:         */
        !            70:        void (*add_attribute)(cp_payload_t *this,
        !            71:                                                  configuration_attribute_t *attribute);
        !            72: 
        !            73:        /**
        !            74:         * Get the configuration payload type.
        !            75:         *
        !            76:         * @return                      type of configuration payload
        !            77:         */
        !            78:        config_type_t (*get_type) (cp_payload_t *this);
        !            79: 
        !            80:        /**
        !            81:         * Set the configuration payload identifier (IKEv1 only).
        !            82:         *
        !            83:         @param identifier      identifier to set
        !            84:         */
        !            85:        void (*set_identifier) (cp_payload_t *this, uint16_t identifier);
        !            86: 
        !            87:        /**
        !            88:         * Get the configuration payload identifier (IKEv1 only).
        !            89:         *
        !            90:         * @return                      identifier
        !            91:         */
        !            92:        uint16_t (*get_identifier) (cp_payload_t *this);
        !            93: 
        !            94:        /**
        !            95:         * Destroys an cp_payload_t object.
        !            96:         */
        !            97:        void (*destroy) (cp_payload_t *this);
        !            98: };
        !            99: 
        !           100: /**
        !           101:  * Creates an empty configuration payload
        !           102:  *
        !           103:  * @param type         payload type, PLV2_CONFIGURATION or PLV1_CONFIGURATION
        !           104:  * @return                     empty configuration payload
        !           105:  */
        !           106: cp_payload_t *cp_payload_create(payload_type_t type);
        !           107: 
        !           108: /**
        !           109:  * Creates an cp_payload_t with type and value
        !           110:  *
        !           111:  * @param type         payload type, PLV2_CONFIGURATION or PLV1_CONFIGURATION
        !           112:  * @param cfg_type     type of configuration payload to create
        !           113:  * @return                     created configuration payload
        !           114:  */
        !           115: cp_payload_t *cp_payload_create_type(payload_type_t type, config_type_t cfg_type);
        !           116: 
        !           117: #endif /** CP_PAYLOAD_H_ @}*/

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