make PHP_SAPI dynamic based on execution mode
[hiphop-php.git] / hphp / runtime / base / intercept.h
blob4b255f546c52d9f6ba780eb8295fb16e8b43aecc
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
16 #ifndef incl_HPHP_INTERCEPT_H_
17 #define incl_HPHP_INTERCEPT_H_
19 #include "hphp/runtime/base/types.h"
20 #include "hphp/runtime/base/complex_types.h"
21 #include "hphp/util/case_insensitive.h"
23 namespace HPHP {
24 ///////////////////////////////////////////////////////////////////////////////
25 // fb_intercept()
27 /**
28 * When an interceptable point is hit, invoke handler with all parameters
29 * instead. If it returns FALSE, continues execution. Otherwise, return its
30 * return.
32 bool register_intercept(CStrRef name, CVarRef callback, CVarRef data);
34 /**
35 * Check to see if it is actually intercepted for current request.
37 Variant *get_intercept_handler(CStrRef name, char* flag);
39 /**
40 * Check to see if it is actually intercepted for current request,
41 * when we already know its flag is set
43 Variant *get_enabled_intercept_handler(CStrRef name);
45 /**
46 * Call intercept handler with original parameters.
48 bool handle_intercept(CVarRef handler, CStrRef name, CArrRef params,
49 Variant &ret);
51 /**
52 * Removes a previously registered flag.
54 void unregister_intercept_flag(CStrRef name, char *flag);
56 ///////////////////////////////////////////////////////////////////////////////
57 // fb_rename_function()
59 /**
60 * Functions on the specified list will be the only ones that are allowed
61 * to rename. Without calling this function, all functions are allowed to
62 * rename, even including built-in functions.
64 void check_renamed_functions(CArrRef names);
66 /**
67 * Checks to see if the specified function is on the allow list.
69 bool check_renamed_function(CStrRef name);
71 /**
72 * Rename a function.
74 void rename_function(CStrRef old_name, CStrRef new_name);
76 /**
77 * Get the actual function to call.
79 String get_renamed_function(CStrRef name);
81 extern DECLARE_THREAD_LOCAL_NO_CHECK(bool, s_hasRenamedFunction);
83 ///////////////////////////////////////////////////////////////////////////////
86 #endif // incl_HPHP_INTERCEPT_H_