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

1.1     ! misho       1: /*
        !             2:  * Copyright (C) 2014 Tobias Brunner
        !             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 encrypted_fragment_payload encrypted_fragment_payload
        !            18:  * @{ @ingroup payloads
        !            19:  */
        !            20: 
        !            21: #ifndef ENCRYPTED_FRAGMENT_PAYLOAD_H_
        !            22: #define ENCRYPTED_FRAGMENT_PAYLOAD_H_
        !            23: 
        !            24: typedef struct encrypted_fragment_payload_t encrypted_fragment_payload_t;
        !            25: 
        !            26: #include <encoding/payloads/encrypted_payload.h>
        !            27: 
        !            28: /**
        !            29:  * The Encrypted Fragment Payload as described in RFC 7383
        !            30:  *
        !            31:  * The implementation is located in encrypted_payload.c as it is very similar.
        !            32:  */
        !            33: struct encrypted_fragment_payload_t {
        !            34: 
        !            35:        /**
        !            36:         * Implements payload_t interface.
        !            37:         */
        !            38:        encrypted_payload_t encrypted;
        !            39: 
        !            40:        /**
        !            41:         * Get the fragment number.
        !            42:         *
        !            43:         * @return                      fragment number
        !            44:         */
        !            45:        uint16_t (*get_fragment_number)(encrypted_fragment_payload_t *this);
        !            46: 
        !            47:        /**
        !            48:         * Get the total number of fragments.
        !            49:         *
        !            50:         * @return                      total number of fragments
        !            51:         */
        !            52:        uint16_t (*get_total_fragments)(encrypted_fragment_payload_t *this);
        !            53: 
        !            54:        /**
        !            55:         * Get the (decrypted) content of this payload.
        !            56:         *
        !            57:         * @return                      internal payload data
        !            58:         */
        !            59:        chunk_t (*get_content)(encrypted_fragment_payload_t *this);
        !            60: 
        !            61:        /**
        !            62:         * Destroys an encrypted_fragment_payload_t object.
        !            63:         */
        !            64:        void (*destroy)(encrypted_fragment_payload_t *this);
        !            65: };
        !            66: 
        !            67: /**
        !            68:  * Creates an empty encrypted_fragment_payload_t object.
        !            69:  *
        !            70:  * @return                     encrypted_fragment_payload_t object
        !            71:  */
        !            72: encrypted_fragment_payload_t *encrypted_fragment_payload_create();
        !            73: 
        !            74: /**
        !            75:  * Creates an encrypted fragment payload from the given data.
        !            76:  *
        !            77:  * @param num          fragment number (first one should be 1)
        !            78:  * @param total                total number of fragments
        !            79:  * @param data         fragment data (gets cloned)
        !            80:  * @return                     encrypted_fragment_payload_t object
        !            81:  */
        !            82: encrypted_fragment_payload_t *encrypted_fragment_payload_create_from_data(
        !            83:                                                                uint16_t num, uint16_t total, chunk_t data);
        !            84: 
        !            85: #endif /** ENCRYPTED_FRAGMENT_PAYLOAD_H_ @}*/

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