]> git.cameronkatri.com Git - cgit.git/blob - cgit.h
5e19b117b3fd5c42da99d3e938f37fd53db2fc98
[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 *author_email;
22 unsigned long author_date;
23 char *committer;
24 char *committer_email;
25 unsigned long committer_date;
26 char *subject;
27 char *msg;
28 };
29
30 extern const char cgit_version[];
31
32 extern char *cgit_root;
33 extern char *cgit_root_title;
34 extern char *cgit_css;
35 extern char *cgit_logo;
36 extern char *cgit_logo_link;
37 extern char *cgit_virtual_root;
38 extern char *cgit_cache_root;
39
40 extern int cgit_nocache;
41 extern int cgit_max_lock_attempts;
42 extern int cgit_cache_root_ttl;
43 extern int cgit_cache_repo_ttl;
44 extern int cgit_cache_dynamic_ttl;
45 extern int cgit_cache_static_ttl;
46 extern int cgit_cache_max_create_time;
47
48 extern char *cgit_repo_name;
49 extern char *cgit_repo_desc;
50 extern char *cgit_repo_owner;
51
52 extern int cgit_query_has_symref;
53 extern int cgit_query_has_sha1;
54
55 extern char *cgit_querystring;
56 extern char *cgit_query_repo;
57 extern char *cgit_query_page;
58 extern char *cgit_query_search;
59 extern char *cgit_query_head;
60 extern char *cgit_query_sha1;
61 extern char *cgit_query_sha2;
62 extern char *cgit_query_path;
63 extern int cgit_query_ofs;
64
65 extern int htmlfd;
66
67 extern void cgit_global_config_cb(const char *name, const char *value);
68 extern void cgit_repo_config_cb(const char *name, const char *value);
69 extern void cgit_querystring_cb(const char *name, const char *value);
70
71 extern int hextoint(char c);
72
73 extern void *cgit_free_commitinfo(struct commitinfo *info);
74
75 extern char *fmt(const char *format,...);
76
77 extern void html(const char *txt);
78 extern void htmlf(const char *format,...);
79 extern void html_txt(char *txt);
80 extern void html_ntxt(int len, char *txt);
81 extern void html_attr(char *txt);
82 extern void html_hidden(char *name, char *value);
83 extern void html_link_open(char *url, char *title, char *class);
84 extern void html_link_close(void);
85 extern void html_filemode(unsigned short mode);
86
87 extern int cgit_read_config(const char *filename, configfn fn);
88 extern int cgit_parse_query(char *txt, configfn fn);
89 extern struct commitinfo *cgit_parse_commit(struct commit *commit);
90
91 extern char *cache_safe_filename(const char *unsafe);
92 extern int cache_lock(struct cacheitem *item);
93 extern int cache_unlock(struct cacheitem *item);
94 extern int cache_cancel_lock(struct cacheitem *item);
95 extern int cache_exist(struct cacheitem *item);
96 extern int cache_expired(struct cacheitem *item);
97
98 extern char *cgit_repourl(const char *reponame);
99 extern char *cgit_pageurl(const char *reponame, const char *pagename,
100 const char *query);
101
102 extern void cgit_print_error(char *msg);
103 extern void cgit_print_date(unsigned long secs);
104 extern void cgit_print_docstart(char *title, struct cacheitem *item);
105 extern void cgit_print_docend();
106 extern void cgit_print_pageheader(char *title, int show_search);
107
108 extern void cgit_print_repolist(struct cacheitem *item);
109 extern void cgit_print_summary();
110 extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep);
111 extern void cgit_print_view(const char *hex);
112 extern void cgit_print_tree(const char *hex, char *path);
113 extern void cgit_print_commit(const char *hex);
114 extern void cgit_print_diff(const char *old_hex, const char *new_hex);
115
116 #endif /* CGIT_H */