blob: 0c3e85e8e4232ad9298372efebf7696a77dc94b1 [file] [log] [blame]
Jeff Kingabca9272011-12-10 05:31:11 -05001#ifndef CREDENTIAL_H
2#define CREDENTIAL_H
3
4#include "string-list.h"
5
6struct credential {
7 struct string_list helpers;
Jeff King11825072011-12-10 05:31:24 -05008 unsigned approved:1,
Jeff Kinga78fbb42011-12-10 05:31:34 -05009 configured:1,
10 use_http_path:1;
Jeff Kingabca9272011-12-10 05:31:11 -050011
12 char *username;
13 char *password;
14 char *protocol;
15 char *host;
16 char *path;
17};
18
19#define CREDENTIAL_INIT { STRING_LIST_INIT_DUP }
20
21void credential_init(struct credential *);
22void credential_clear(struct credential *);
23
24void credential_fill(struct credential *);
25void credential_approve(struct credential *);
26void credential_reject(struct credential *);
27
28int credential_read(struct credential *, FILE *);
Matthieu Moy2d6dc182012-06-24 13:40:00 +020029void credential_write(const struct credential *, FILE *);
Jeff Kingd3e847c2011-12-10 05:31:17 -050030void credential_from_url(struct credential *, const char *url);
Jeff King11825072011-12-10 05:31:24 -050031int credential_match(const struct credential *have,
32 const struct credential *want);
Jeff Kingabca9272011-12-10 05:31:11 -050033
34#endif /* CREDENTIAL_H */