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

1.1     ! misho       1: /*
        !             2:  * Copyright (C) 2015 Tobias Brunner
        !             3:  * Copyright (C) 2005-2006 Martin Willi
        !             4:  * Copyright (C) 2005 Jan Hutter
        !             5:  * HSR Hochschule fuer Technik Rapperswil
        !             6:  *
        !             7:  * This program is free software; you can redistribute it and/or modify it
        !             8:  * under the terms of the GNU General Public License as published by the
        !             9:  * Free Software Foundation; either version 2 of the License, or (at your
        !            10:  * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
        !            11:  *
        !            12:  * This program is distributed in the hope that it will be useful, but
        !            13:  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
        !            14:  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        !            15:  * for more details.
        !            16:  */
        !            17: 
        !            18: /**
        !            19:  * @defgroup unknown_payload unknown_payload
        !            20:  * @{ @ingroup payloads
        !            21:  */
        !            22: 
        !            23: #ifndef UNKNOWN_PAYLOAD_H_
        !            24: #define UNKNOWN_PAYLOAD_H_
        !            25: 
        !            26: typedef struct unknown_payload_t unknown_payload_t;
        !            27: 
        !            28: #include <library.h>
        !            29: #include <encoding/payloads/payload.h>
        !            30: 
        !            31: /**
        !            32:  * Payload which can't be processed further.
        !            33:  *
        !            34:  * When the parser finds an unknown payload, he builds an instance of
        !            35:  * this class. This allows further processing of this payload, such as
        !            36:  * a check for the critical bit in the header.
        !            37:  */
        !            38: struct unknown_payload_t {
        !            39: 
        !            40:        /**
        !            41:         * The payload_t interface.
        !            42:         */
        !            43:        payload_t payload_interface;
        !            44: 
        !            45:        /**
        !            46:         * Get the original payload type as sent by the peer.
        !            47:         *
        !            48:         * @return                              type of the original payload
        !            49:         */
        !            50:        payload_type_t (*get_type) (unknown_payload_t *this);
        !            51: 
        !            52:        /**
        !            53:         * Get the raw data of this payload, without
        !            54:         * the generic payload header.
        !            55:         *
        !            56:         * Returned data are NOT copied and must not be freed.
        !            57:         *
        !            58:         * @return                              data as chunk_t
        !            59:         */
        !            60:        chunk_t (*get_data) (unknown_payload_t *this);
        !            61: 
        !            62:        /**
        !            63:         * Get the critical flag.
        !            64:         *
        !            65:         * @return                              TRUE if payload is critical, FALSE if not
        !            66:         */
        !            67:        bool (*is_critical) (unknown_payload_t *this);
        !            68: 
        !            69:        /**
        !            70:         * Destroys an unknown_payload_t object.
        !            71:         */
        !            72:        void (*destroy) (unknown_payload_t *this);
        !            73: };
        !            74: 
        !            75: /**
        !            76:  * Creates an empty unknown_payload_t.
        !            77:  *
        !            78:  * @param                      type of the payload
        !            79:  * @return                     unknown_payload_t object
        !            80:  */
        !            81: unknown_payload_t *unknown_payload_create(payload_type_t type);
        !            82: 
        !            83: /**
        !            84:  * Create an unknown payload with data.
        !            85:  *
        !            86:  * @param type         type of payload to create
        !            87:  * @param critical     TRUE to set critical bit
        !            88:  * @param data         data to set for this payload, gets owned by payload
        !            89:  * @return                     payload object
        !            90:  */
        !            91: unknown_payload_t *unknown_payload_create_data(payload_type_t type,
        !            92:                                                                                           bool critical, chunk_t data);
        !            93: 
        !            94: #endif /** UNKNOWN_PAYLOAD_H_ @}*/

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