buffer.h

00001 /*
00002  * Buffer handling functions of the IFD handler library
00003  *
00004  * Copyright (C) 2003, Olaf Kirch <okir@suse.de>
00005  */
00006 
00007 #ifndef OPENCT_BUFFER_H
00008 #define OPENCT_BUFFER_H
00009 
00010 #ifdef __cplusplus
00011 extern "C" {
00012 #endif
00013 
00014 #include <sys/types.h>
00015 
00016 typedef struct ct_buf {
00017         unsigned char *         base;
00018         unsigned int            head, tail, size;
00019         unsigned int            overrun;
00020 } ct_buf_t;
00021 
00022 extern void             ct_buf_init(ct_buf_t *, void *, size_t);
00023 extern void             ct_buf_set(ct_buf_t *, void *, size_t);
00024 extern void             ct_buf_clear(ct_buf_t *);
00025 extern int              ct_buf_get(ct_buf_t *, void *, size_t);
00026 extern int              ct_buf_gets(ct_buf_t *, char *, size_t);
00027 extern int              ct_buf_put(ct_buf_t *, const void *, size_t);
00028 extern int              ct_buf_putc(ct_buf_t *, int);
00029 extern int              ct_buf_puts(ct_buf_t *, const char *);
00030 extern int              ct_buf_push(ct_buf_t *, const void *, size_t);
00031 extern unsigned int     ct_buf_avail(ct_buf_t *);
00032 extern unsigned int     ct_buf_tailroom(ct_buf_t *);
00033 extern unsigned int     ct_buf_size(ct_buf_t *);
00034 extern void *           ct_buf_head(ct_buf_t *);
00035 extern void *           ct_buf_tail(ct_buf_t *);
00036 extern int              ct_buf_read(ct_buf_t *, int);
00037 extern void             ct_buf_compact(ct_buf_t *);
00038 extern int              ct_buf_overrun(ct_buf_t *);
00039 
00040 #ifdef __cplusplus
00041 }
00042 #endif
00043 
00044 #endif /* OPENCT_BUFFER_H */

libp11, Copyright (C) 2005 Olaf Kirch <okir@lst.de>OpenSC-Project.org Logo