File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / strongswan / src / libtls / tls_compression.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Jun 3 09:46:45 2020 UTC (4 years, 3 months ago) by misho
Branches: strongswan, MAIN
CVS tags: v5_9_2p0, v5_8_4p7, HEAD
Strongswan

    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_compression tls_compression
   18:  * @{ @ingroup libtls
   19:  */
   20: 
   21: #ifndef TLS_COMPRESSION_H_
   22: #define TLS_COMPRESSION_H_
   23: 
   24: #include <library.h>
   25: 
   26: typedef struct tls_compression_t tls_compression_t;
   27: 
   28: #include "tls.h"
   29: #include "tls_alert.h"
   30: #include "tls_fragmentation.h"
   31: 
   32: /**
   33:  * TLS record protocol compression layer.
   34:  */
   35: struct tls_compression_t {
   36: 
   37: 	/**
   38: 	 * Process a compressed 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_compression_t *this,
   48: 						tls_content_type_t type, chunk_t data);
   49: 
   50: 	/**
   51: 	 * Query upper layer for TLS record, build compressed record.
   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_compression_t *this,
   62: 					  tls_content_type_t *type, chunk_t *data);
   63: 
   64: 	/**
   65: 	 * Destroy a tls_compression_t.
   66: 	 */
   67: 	void (*destroy)(tls_compression_t *this);
   68: };
   69: 
   70: /**
   71:  * Create a tls_compression instance.
   72:  *
   73:  * @param fragmentation		fragmentation layer of TLS stack
   74:  * @param alert				TLS alert handler
   75:  * @return					TLS compression layer.
   76:  */
   77: tls_compression_t *tls_compression_create(tls_fragmentation_t *fragmentation,
   78: 										  tls_alert_t *alert);
   79: 
   80: #endif /** TLS_COMPRESSION_H_ @}*/

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