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