summaryrefslogtreecommitdiff
path: root/uclient-backend.h
blob: 50227155dd45feaa44b9d985a4c705085fd01a99 (plain)
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
#ifndef __UCLIENT_INTERNAL_H
#define __UCLIENT_INTERNAL_H

struct uclient_url;

struct uclient_backend {
	const char * const * prefix;

	struct uclient *(*alloc)(void);
	void (*free)(struct uclient *cl);
	void (*update_url)(struct uclient *cl);

	int (*connect)(struct uclient *cl);
	int (*request)(struct uclient *cl);

	int (*read)(struct uclient *cl, char *buf, unsigned int len);
	int (*write)(struct uclient *cl, char *buf, unsigned int len);
};

struct uclient_url {
	const struct uclient_backend *backend;
	int prefix;

	const char *host;
	const char *port;
	const char *location;

	const char *auth;
};

extern const struct uclient_backend uclient_backend_http;
void uclient_backend_set_eof(struct uclient *cl);
void uclient_backend_reset_state(struct uclient *cl);

#endif