f72c11fb3ad2f5eee7b14c09b96b64bb32d2ab33
[project/uclient.git] / uclient-backend.h
1 #ifndef __UCLIENT_INTERNAL_H
2 #define __UCLIENT_INTERNAL_H
3
4 struct uclient_url;
5
6 struct uclient_backend {
7         const char * const * prefix;
8
9         struct uclient *(*alloc)(void);
10         void (*free)(struct uclient *cl);
11
12         int (*connect)(struct uclient *cl);
13         int (*request)(struct uclient *cl);
14
15         int (*read)(struct uclient *cl, char *buf, unsigned int len);
16         int (*write)(struct uclient *cl, char *buf, unsigned int len);
17         int (*set_write_len)(struct uclient *cl, unsigned int len);
18 };
19
20 struct uclient_url {
21         const struct uclient_backend *backend;
22         int prefix;
23
24         const char *host;
25         const char *port;
26         const char *location;
27
28         const char *auth;
29 };
30
31 extern const struct uclient_backend uclient_backend_http;
32 void uclient_backend_set_eof(struct uclient *cl);
33 void uclient_backend_reset_state(struct uclient *cl);
34
35 #endif