blob: 6b0cd16be2b96b23ae5ce14a07a8ad130af8d5bb [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,
Jeff King59b38652014-12-03 22:46:48 -050010 quit:1,
Jeff Kinga78fbb42011-12-10 05:31:34 -050011 use_http_path:1;
Jeff Kingabca9272011-12-10 05:31:11 -050012
13 char *username;
14 char *password;
15 char *protocol;
16 char *host;
17 char *path;
18};
19
20#define CREDENTIAL_INIT { STRING_LIST_INIT_DUP }
21
22void credential_init(struct credential *);
23void credential_clear(struct credential *);
24
25void credential_fill(struct credential *);
26void credential_approve(struct credential *);
27void credential_reject(struct credential *);
28
29int credential_read(struct credential *, FILE *);
Matthieu Moy2d6dc182012-06-24 13:40:00 +020030void credential_write(const struct credential *, FILE *);
Jeff Kingd3e847c2011-12-10 05:31:17 -050031void credential_from_url(struct credential *, const char *url);
Jeff King11825072011-12-10 05:31:24 -050032int credential_match(const struct credential *have,
33 const struct credential *want);
Jeff Kingabca9272011-12-10 05:31:11 -050034
35#endif /* CREDENTIAL_H */