monotone

monotone Mtn Source Tree

Root/lua.hh

1#ifndef __LUA__
2#define __LUA__
3
4// copyright (C) 2002, 2003 graydon hoare <graydon@pobox.com>
5// all rights reserved.
6// licensed to the public under the terms of the GNU GPL (>= 2)
7// see the file COPYING for details
8
9// this file defines a typed C++ interface to the various hooks
10// we expose to the user as lua functions or variables
11
12#include <string>
13#include <set>
14#include "file_io.hh"
15#include "vocab.hh"
16
17struct lua_State;
18
19class lua_hooks
20{
21 struct lua_State * st;
22 template <typename RES>
23 std::pair<bool,RES> call_hook(char const * name, int nargs, ...);
24
25public:
26 lua_hooks();
27 ~lua_hooks();
28#ifdef BUILD_UNIT_TESTS
29 void add_test_hooks();
30#endif
31 void add_std_hooks();
32 void working_copy_rcfilename(fs::path & file);
33 void default_rcfilename(fs::path & file);
34 void add_rcfile(fs::path const & file);
35
36 // cert hooks
37 bool hook_get_branch_key(cert_value const & branchname, rsa_keypair_id & k);
38 bool hook_get_passphrase(rsa_keypair_id const & k, std::string & phrase);
39 bool hook_get_author(cert_value const & branchname, std::string & author);
40 bool hook_edit_comment(std::string const & commentary, std::string & result);
41 bool hook_persist_phrase_ok();
42 bool hook_non_blocking_rng_ok();
43 bool hook_get_manifest_cert_trust(std::set<rsa_keypair_id> const & signers,
44 hexenc<id> const & id,
45 cert_name const & name,
46 cert_value const & val);
47 bool hook_get_file_cert_trust(std::set<rsa_keypair_id> const & signers,
48hexenc<id> const & id,
49cert_name const & name,
50cert_value const & val);
51 bool hook_accept_testresult_change(std::map<rsa_keypair_id, bool> const & old_results,
52 std::map<rsa_keypair_id, bool> const & new_results);
53
54 // network hooks
55 bool hook_get_news_sender(url const & serv, std::string & sender);
56 bool hook_get_mail_sender(url const & serv, std::string & sender);
57 bool hook_get_mail_hostname(url const & serv, std::string & sender);
58 bool hook_get_http_auth(url const & serv, rsa_keypair_id & pubkey);
59 bool hook_get_post_targets(cert_value const & branchname,
60 std::set<url> & targets);
61 bool hook_get_fetch_sources(cert_value const & branchname,
62 std::set<url> & sources);
63
64 bool hook_get_connect_addr(std::string const & proto,
65 std::string const & host,
66 unsigned long port,
67 std::string & host_out,
68 unsigned long & port_out);
69
70 bool hook_get_http_proxy(std::string const & host,
71 unsigned long port,
72 std::string & host_out,
73 unsigned long & port_out);
74
75 bool hook_get_netsync_read_permitted(std::string const & collection,
76 rsa_keypair_id const & identity);
77 bool hook_get_netsync_anonymous_read_permitted(std::string const & collection);
78 bool hook_get_netsync_write_permitted(std::string const & collection,
79rsa_keypair_id const & identity);
80
81 // local repo hooks
82 bool hook_ignore_file(file_path const & p);
83 bool hook_get_sorter(std::string const & certname, std::string & sort_type);
84 bool hook_merge2(data const & left,
85 data const & right,
86 data & result);
87 bool hook_merge3(data const & ancestor,
88 data const & left,
89 data const & right,
90 data & result);
91
92 // attribute hooks
93 bool hook_apply_attribute(std::string const & attr,
94 file_path const & filename,
95 std::string const & value);
96
97 // conversion hooks
98 bool hook_get_system_linesep(std::string & linesep);
99 bool hook_get_charset_conv(file_path const & p,
100 std::string & db, std::string & ext);
101 bool hook_get_linesep_conv(file_path const & p,
102 std::string & db, std::string & ext);
103
104};
105
106#endif // __LUA_HH__

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status