Annotation of embedaddon/strongswan/src/libtls/tls_fragmentation.h, revision 1.1

1.1     ! misho       1: /*
        !             2:  * Copyright (C) 2010 Martin Willi
        !             3:  * Copyright (C) 2010 revosec AG
        !             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 tls_fragmentation tls_fragmentation
        !            18:  * @{ @ingroup libtls
        !            19:  */
        !            20: 
        !            21: #ifndef TLS_FRAGMENTATION_H_
        !            22: #define TLS_FRAGMENTATION_H_
        !            23: 
        !            24: #include <library.h>
        !            25: 
        !            26: typedef struct tls_fragmentation_t tls_fragmentation_t;
        !            27: 
        !            28: #include "tls.h"
        !            29: #include "tls_alert.h"
        !            30: #include "tls_handshake.h"
        !            31: 
        !            32: /**
        !            33:  * TLS record protocol fragmentation layer.
        !            34:  */
        !            35: struct tls_fragmentation_t {
        !            36: 
        !            37:        /**
        !            38:         * Process a fragmented TLS record, pass it to upper layers.
        !            39:         *
        !            40:         * @param type          type of the TLS record to process
        !            41:         * @param data          associated TLS record data
        !            42:         * @return
        !            43:         *                                      - SUCCESS if TLS negotiation complete
        !            44:         *                                      - FAILED if TLS handshake failed
        !            45:         *                                      - NEED_MORE if more invocations to process/build needed
        !            46:         */
        !            47:        status_t (*process)(tls_fragmentation_t *this,
        !            48:                                                tls_content_type_t type, chunk_t data);
        !            49: 
        !            50:        /**
        !            51:         * Query upper layer for TLS messages, build fragmented records.
        !            52:         *
        !            53:         * @param type          type of the built TLS record
        !            54:         * @param data          allocated data of the built TLS record
        !            55:         * @return
        !            56:         *                                      - SUCCESS if TLS negotiation complete
        !            57:         *                                      - FAILED if TLS handshake failed
        !            58:         *                                      - NEED_MORE if upper layers have more records to send
        !            59:         *                                      - INVALID_STATE if more input records required
        !            60:         */
        !            61:        status_t (*build)(tls_fragmentation_t *this,
        !            62:                                          tls_content_type_t *type, chunk_t *data);
        !            63: 
        !            64:        /**
        !            65:         * Has the application layer finished (returned SUCCESS)?.
        !            66:         *
        !            67:         * @return                      TRUE if application layer finished
        !            68:         */
        !            69:        bool (*application_finished)(tls_fragmentation_t *this);
        !            70: 
        !            71:        /**
        !            72:         * Destroy a tls_fragmentation_t.
        !            73:         */
        !            74:        void (*destroy)(tls_fragmentation_t *this);
        !            75: };
        !            76: 
        !            77: /**
        !            78:  * Create a tls_fragmentation instance.
        !            79:  *
        !            80:  * @param handshake                    upper layer handshake protocol
        !            81:  * @param alert                                TLS alert handler
        !            82:  * @param application          upper layer application data or NULL
        !            83:  * @param purpose                      type of context this TLS stack is running in
        !            84:  * @return                                     TLS fragmentation layer
        !            85:  */
        !            86: tls_fragmentation_t *tls_fragmentation_create(tls_handshake_t *handshake,
        !            87:                                                        tls_alert_t *alert, tls_application_t *application,
        !            88:                                                        tls_purpose_t purpose);
        !            89: 
        !            90: #endif /** TLS_FRAGMENTATION_H_ @}*/

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