-
Notifications
You must be signed in to change notification settings - Fork 557
/
kurl.h
57 lines (46 loc) · 1.27 KB
/
kurl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef KURL_H
#define KURL_H
#include <sys/types.h>
#define KURL_NULL 1
#define KURL_INV_WHENCE 2
#define KURL_SEEK_OUT 3
#define KURL_NO_AUTH 4
struct kurl_t;
typedef struct kurl_t kurl_t;
typedef struct {
const char *s3keyid;
const char *s3secretkey;
const char *s3key_fn;
} kurl_opt_t;
#ifdef __cplusplus
extern "C" {
#endif
int kurl_init(void);
void kurl_destroy(void);
kurl_t *kurl_open(const char *url, kurl_opt_t *opt);
kurl_t *kurl_dopen(int fd);
int kurl_close(kurl_t *ku);
ssize_t kurl_read(kurl_t *ku, void *buf, size_t nbytes);
off_t kurl_seek(kurl_t *ku, off_t offset, int whence);
int kurl_buflen(kurl_t *ku, int len);
off_t kurl_tell(const kurl_t *ku);
int kurl_eof(const kurl_t *ku);
int kurl_fileno(const kurl_t *ku);
int kurl_error(const kurl_t *ku);
#ifdef __cplusplus
}
#endif
#ifndef KNETFILE_H
#define KNETFILE_H
typedef kurl_t knetFile;
#define knet_open(fn, mode) kurl_open(fn, 0)
#define knet_dopen(fd, mode) kurl_dopen(fd)
#define knet_close(fp) kurl_close(fp)
#define knet_read(fp, buf, len) kurl_read(fp, buf, len)
#define knet_seek(fp, off, whence) kurl_seek(fp, off, whence)
#define knet_tell(fp) kurl_tell(fp)
#define knet_fileno(fp) kurl_fileno(fp)
#define knet_win32_init() kurl_init()
#define knet_win32_destroy() kurl_destroy()
#endif
#endif