Zlib compression of network traffic. More...
#include "config.h"
#include <stdbool.h>
#include <string.h>
#include <time.h>
#include <zconf.h>
#include <zlib.h>
#include "mutt/lib.h"
#include "zstrm.h"
#include "connection.h"
Go to the source code of this file.
Data Structures | |
struct | ZstrmDirection |
A stream of data being (de-)compressed. More... | |
struct | ZstrmContext |
Data compression layer. More... | |
Functions | |
static void * | zstrm_malloc (void *opaque, unsigned int items, unsigned int size) |
Redirector function for zlib's malloc() | |
static void | zstrm_free (void *opaque, void *address) |
Redirector function for zlib's free() | |
static int | zstrm_open (struct Connection *conn) |
Open a socket - Implements Connection::open() -. | |
static int | zstrm_close (struct Connection *conn) |
Close a socket - Implements Connection::close() -. | |
static int | zstrm_read (struct Connection *conn, char *buf, size_t len) |
Read compressed data from a socket - Implements Connection::read() -. | |
static int | zstrm_poll (struct Connection *conn, time_t wait_secs) |
Check if any data is waiting on a socket - Implements Connection::poll() -. | |
static int | zstrm_write (struct Connection *conn, const char *buf, size_t count) |
Write compressed data to a socket - Implements Connection::write() -. | |
void | mutt_zstrm_wrap_conn (struct Connection *conn) |
Wrap a compression layer around a Connection. | |
Zlib compression of network traffic.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file zstrm.c.
|
static |
Redirector function for zlib's malloc()
opaque | Opaque zlib handle |
items | Number of blocks |
size | Size of blocks |
ptr | Memory on the heap |
Definition at line 71 of file zstrm.c.
|
static |
void mutt_zstrm_wrap_conn | ( | struct Connection * | conn | ) |
Wrap a compression layer around a Connection.
conn | Connection to wrap |
Replace the read/write functions with our compression functions. After reading from the socket, we decompress and pass on the data. Before writing to a socket, we compress the data.
Definition at line 291 of file zstrm.c.