#ifndef BASE64_H #define BASE64_H /* * Copyright (c) Alex Holden 2000, 2001. * * This code is public domain; you can do whatever you want with it, though I * would prefer you to contribute any bug fixes back to me if possible. * This software comes with NO WARRANTY WHATSOEVER, not even the implied * warranties of merchantability and fitness for a particular purpose. */ #define BASE64_BUFLEN 1024 #define BASE64_LINELEN 76 typedef int(*base64_markerfunc)(void *, char *, size_t); typedef struct { int used; int storedbytes; int linelen; char buf[BASE64_BUFLEN]; u8 lastbyte; char enc[4]; int state; u8 dec[3]; int decpos; char *line; size_t size; long pos; long ex; int fd; base64_markerfunc marker; void *arg; unsigned int decoding : 1; } b64state; extern b64state *base64_init(int fd, base64_markerfunc marker, void *arg); extern ssize_t base64_read(b64state *state, void *buf, size_t len); extern ssize_t base64_write(b64state *state, void *buf, size_t len); extern ssize_t base64_flush(b64state *state); extern void base64_destroy(b64state *state); #ifdef BASE64_PRIV #endif #endif