]> git.cameronkatri.com Git - cgit.git/blob - cgit.h
Add a common commit parser
[cgit.git] / cgit.h
1 #ifndef CGIT_H
2 #define CGIT_H
3
4 #include "git.h"
5 #include <openssl/sha.h>
6 #include <ctype.h>
7 #include <sched.h>
8
9 typedef void (*configfn)(const char *name, const char *value);
10
11 struct cacheitem {
12 char *name;
13 struct stat st;
14 int ttl;
15 int fd;
16 };
17
18 struct commitinfo {
19 struct commit *commit;
20 char *author;
21 char *committer;
22 char *subject;
23 char *msg;
24 };
25
26 extern const char cgit_version[];
27
28 extern char *cgit_root;
29 extern char *cgit_root_title;
30 extern char *cgit_css;
31 extern char *cgit_logo;
32 extern char *cgit_logo_link;
33 extern char *cgit_virtual_root;
34 extern char *cgit_cache_root;
35
36 extern int cgit_max_lock_attempts;
37 extern int cgit_cache_root_ttl;
38 extern int cgit_cache_repo_ttl;
39 extern int cgit_cache_dynamic_ttl;
40 extern int cgit_cache_static_ttl;
41 extern int cgit_cache_max_create_time;
42
43 extern char *cgit_repo_name;
44 extern char *cgit_repo_desc;
45 extern char *cgit_repo_owner;
46
47 extern int cgit_query_has_symref;
48 extern int cgit_query_has_sha1;
49
50 extern char *cgit_querystring;
51 extern char *cgit_query_repo;
52 extern char *cgit_query_page;
53 extern char *cgit_query_head;
54 extern char *cgit_query_sha1;
55 extern int cgit_query_ofs;
56
57 extern int htmlfd;
58
59 extern void cgit_global_config_cb(const char *name, const char *value);
60 extern void cgit_repo_config_cb(const char *name, const char *value);
61 extern void cgit_querystring_cb(const char *name, const char *value);
62
63 extern char *fmt(const char *format,...);
64
65 extern void html(const char *txt);
66 extern void htmlf(const char *format,...);
67 extern void html_txt(char *txt);
68 extern void html_attr(char *txt);
69 extern void html_link_open(char *url, char *title, char *class);
70 extern void html_link_close(void);
71
72 extern int cgit_read_config(const char *filename, configfn fn);
73 extern int cgit_parse_query(char *txt, configfn fn);
74 extern struct commitinfo *cgit_parse_commit(struct commit *commit);
75
76 extern void cache_prepare(struct cacheitem *item);
77 extern int cache_lock(struct cacheitem *item);
78 extern int cache_unlock(struct cacheitem *item);
79 extern int cache_cancel_lock(struct cacheitem *item);
80 extern int cache_exist(struct cacheitem *item);
81 extern int cache_expired(struct cacheitem *item);
82
83 extern char *cgit_repourl(const char *reponame);
84 extern char *cgit_pageurl(const char *reponame, const char *pagename,
85 const char *query);
86
87 extern void cgit_print_error(char *msg);
88 extern void cgit_print_docstart(char *title, struct cacheitem *item);
89 extern void cgit_print_docend();
90 extern void cgit_print_pageheader(char *title);
91
92 extern void cgit_print_repolist(struct cacheitem *item);
93 extern void cgit_print_summary();
94 extern void cgit_print_log(const char *tip, int ofs, int cnt);
95 extern void cgit_print_view(char *hex);
96 extern void cgit_print_tree(const char *sha1);
97
98 #endif /* CGIT_H */