Return to tls_compression.c CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / strongswan / src / libtls |
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: #include "tls_compression.h" ! 17: ! 18: typedef struct private_tls_compression_t private_tls_compression_t; ! 19: ! 20: /** ! 21: * Private data of an tls_compression_t object. ! 22: */ ! 23: struct private_tls_compression_t { ! 24: ! 25: /** ! 26: * Public tls_compression_t interface. ! 27: */ ! 28: tls_compression_t public; ! 29: ! 30: /** ! 31: * Upper layer, TLS record fragmentation ! 32: */ ! 33: tls_fragmentation_t *fragmentation; ! 34: }; ! 35: ! 36: METHOD(tls_compression_t, process, status_t, ! 37: private_tls_compression_t *this, tls_content_type_t type, chunk_t data) ! 38: { ! 39: return this->fragmentation->process(this->fragmentation, type, data); ! 40: } ! 41: ! 42: METHOD(tls_compression_t, build, status_t, ! 43: private_tls_compression_t *this, tls_content_type_t *type, chunk_t *data) ! 44: { ! 45: return this->fragmentation->build(this->fragmentation, type, data); ! 46: } ! 47: ! 48: METHOD(tls_compression_t, destroy, void, ! 49: private_tls_compression_t *this) ! 50: { ! 51: free(this); ! 52: } ! 53: ! 54: /** ! 55: * See header ! 56: */ ! 57: tls_compression_t *tls_compression_create(tls_fragmentation_t *fragmentation, ! 58: tls_alert_t *alert) ! 59: { ! 60: private_tls_compression_t *this; ! 61: ! 62: INIT(this, ! 63: .public = { ! 64: .process = _process, ! 65: .build = _build, ! 66: .destroy = _destroy, ! 67: }, ! 68: .fragmentation = fragmentation, ! 69: ); ! 70: ! 71: return &this->public; ! 72: }