Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals

io.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2005, 2006 by KoanLogic s.r.l. <http://www.koanlogic.com>
00003  * All rights reserved.
00004  *
00005  * This file is part of KLone, and as such it is subject to the license stated
00006  * in the LICENSE file which you have received as part of this distribution.
00007  *
00008  * $Id: io.h,v 1.15 2006/05/12 09:02:58 tat Exp $
00009  */
00010 
00011 #ifndef _KLONE_IO_H_ 
00012 #define _KLONE_IO_H_
00013 
00014 #include "klone_conf.h"
00015 #include <sys/types.h>
00016 #include <stdio.h>
00017 #ifdef HAVE_LIBOPENSSL
00018 #include <openssl/ssl.h>
00019 #include <openssl/err.h>
00020 #endif /* HAVE_LIBOPENSSL */
00021 #include <klone/codec.h>
00022 
00023 #ifdef __cplusplus
00024 extern "C" {
00025 #endif 
00026 
00027 struct io_s;
00028 typedef struct io_s io_t;
00029 
00030 enum io_fd_flags {
00031     IO_FD_NO_FLAGS,
00032     IO_FD_CLOSE /* close(2) fd on io_free           */
00033 };
00034 
00035 enum io_mem_flags {
00036     IO_MEM_NO_FLAGS,
00037     IO_MEM_FREE_BUF     /* free(3) io mem buf on io_free    */
00038 };
00039 
00040 int io_fd_create(int fd, int flags, io_t **pio);
00041 int io_mem_create(char *buf, size_t size, int flags, io_t **pio);
00042 #ifdef HAVE_LIBOPENSSL
00043 int io_ssl_create(int fd, int flags, SSL_CTX *ssl_tx, io_t **pio);
00044 int io_ssl_get_SSL(io_t *io_ssl, SSL **pssl);
00045 #endif
00046 int io_close(io_t *io);
00047 int io_free(io_t *io);
00048 int io_dup(io_t *io, io_t **pio);
00049 int io_name_set(io_t *io, const char* name);
00050 int io_name_get(io_t *io, char* name, size_t sz);
00051 ssize_t io_read(io_t *io, char* buf, size_t size);
00052 ssize_t io_write(io_t *io, const char* buf, size_t size);
00053 ssize_t io_flush(io_t *io);
00054 ssize_t io_seek(io_t *io, size_t off);
00055 ssize_t io_tell(io_t *io);
00056 ssize_t io_copy(io_t *out, io_t *in, size_t size);
00057 ssize_t io_pipe(io_t *out, io_t *in);
00058 ssize_t io_gets(io_t *io, char *buf, size_t size);
00059 ssize_t io_getc(io_t *io, char *c);
00060 ssize_t io_printf(io_t *io, const char* fmt, ...);
00061 ssize_t io_putc(io_t *io, char c);
00062 int io_codec_add_head(io_t *io, codec_t* codec);
00063 int io_codec_add_tail(io_t *io, codec_t* codec);
00064 int io_codecs_remove(io_t *io);
00065 int io_is_secure(io_t *io);
00066 
00067 #ifdef __cplusplus
00068 }
00069 #endif 
00070 
00071 #endif

←Products
© 2005-2006 - KoanLogic S.r.l. - All rights reserved