blob: 72990288142711220fc91e7fc4fb50889fd644c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
 * The dispatch table that maps the page name in a request to the function
 * rendering it. Each entry also records what the request needs resolved
 * first, so the caller can look up the repository or the path within the tree
 * and reject a bad request once, rather than every page repeating the check.
 */

#ifndef CGIT_CMD_H
#define CGIT_CMD_H

typedef void (*cgit_cmd_fn)(void);

struct cgit_cmd {
	const char *name;
	cgit_cmd_fn fn;
	unsigned int want_repo:1,
		want_vpath:1,
		is_clone:1;
};

// The entry naming ctx.qry.page, or NULL when no page goes by that name.
extern const struct cgit_cmd *cgit_get_cmd(void);

#endif // CGIT_CMD_H