modified: src1/input.c
[GalaxyCodeBases.git] / c_cpp / lib / klib / kurl.h
blobf07f64118a88f1327621c96c139dd0bb4fb2bdab
1 #ifndef KURL_H
2 #define KURL_H
4 #include <sys/types.h>
6 #define KURL_NULL 1
7 #define KURL_INV_WHENCE 2
8 #define KURL_SEEK_OUT 3
9 #define KURL_NO_AUTH 4
11 struct kurl_t;
12 typedef struct kurl_t kurl_t;
14 typedef struct {
15 const char *s3keyid;
16 const char *s3secretkey;
17 const char *s3key_fn;
18 } kurl_opt_t;
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
24 int kurl_init(void);
25 void kurl_destroy(void);
27 kurl_t *kurl_open(const char *url, kurl_opt_t *opt);
28 kurl_t *kurl_dopen(int fd);
29 int kurl_close(kurl_t *ku);
30 ssize_t kurl_read(kurl_t *ku, void *buf, size_t nbytes);
31 off_t kurl_seek(kurl_t *ku, off_t offset, int whence);
32 int kurl_buflen(kurl_t *ku, int len);
34 off_t kurl_tell(const kurl_t *ku);
35 int kurl_eof(const kurl_t *ku);
36 int kurl_fileno(const kurl_t *ku);
37 int kurl_error(const kurl_t *ku);
39 #ifdef __cplusplus
41 #endif
43 #ifndef KNETFILE_H
44 #define KNETFILE_H
45 typedef kurl_t knetFile;
46 #define knet_open(fn, mode) kurl_open(fn, 0)
47 #define knet_dopen(fd, mode) kurl_dopen(fd)
48 #define knet_close(fp) kurl_close(fp)
49 #define knet_read(fp, buf, len) kurl_read(fp, buf, len)
50 #define knet_seek(fp, off, whence) kurl_seek(fp, off, whence)
51 #define knet_tell(fp) kurl_tell(fp)
52 #define knet_fileno(fp) kurl_fileno(fp)
53 #define knet_win32_init() kurl_init()
54 #define knet_win32_destroy() kurl_destroy()
55 #endif
57 #endif