|
Qore Programming Language
0.8.3
|
00001 /* -*- mode: c++; indent-tabs-mode: nil -*- */ 00002 /* 00003 Restrictions.h 00004 00005 QORE programming language 00006 00007 Copyright 2003 - 2011 David Nichols 00008 00009 This library is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU Lesser General Public 00011 License as published by the Free Software Foundation; either 00012 version 2.1 of the License, or (at your option) any later version. 00013 00014 This library is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public 00020 License along with this library; if not, write to the Free Software 00021 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00022 */ 00023 00024 #ifndef _QORE_RESTRICTIONS_H 00025 00026 #define _QORE_RESTRICTIONS_H 00027 00032 #define PO_DEFAULT 0 //!< no restrictions (except parse option inheritance restrictions) 00033 #define PO_NO_GLOBAL_VARS (1 << 0) //!< cannot define new global variables 00034 #define PO_NO_SUBROUTINE_DEFS (1 << 1) //!< cannot define new user subroutines 00035 #define PO_NO_THREAD_CONTROL (1 << 2) //!< cannot launch new threads) use thread_exit) or access thread data 00036 #define PO_NO_THREAD_CLASSES (1 << 3) //!< no access to thread classes 00037 #define PO_NO_TOP_LEVEL_STATEMENTS (1 << 4) //!< cannot define new top-level statements (outside of sub or class defs) 00038 #define PO_NO_CLASS_DEFS (1 << 5) //!< cannot define new object classes 00039 #define PO_NO_NAMESPACE_DEFS (1 << 6) //!< cannot define new namespaces 00040 #define PO_NO_CONSTANT_DEFS (1 << 7) //!< cannot define new constants 00041 #define PO_NO_NEW (1 << 8) //!< cannot use the new operator (DEPRECATED: this option is not useful anymore because objects can be declared and created without "new") 00042 #define PO_NO_SYSTEM_CLASSES (1 << 9) //!< do not inherit system classes into this program space 00043 #define PO_NO_USER_CLASSES (1 << 10) //!< do not inherit user classes into this program space 00044 #define PO_NO_CHILD_PO_RESTRICTIONS (1 << 11) //!< turn off parse option inheritance restrictions 00045 #define PO_NO_EXTERNAL_PROCESS (1 << 12) //!< do not allow access to functionality that calls external processes: backquote op, system(), exec(), etc 00046 #define PO_REQUIRE_OUR (1 << 13) //!< require "our" for global var declaration 00047 #define PO_NO_PROCESS_CONTROL (1 << 14) //!< do not allow access to functionality that can affect the current process: fork(), exec(), abort(), etc 00048 #define PO_NO_NETWORK (1 << 15) //!< do not allow any network access (objs & subroutines) 00049 #define PO_NO_FILESYSTEM (1 << 16) //!< do not allow any filesystem access (objects & subroutines) 00050 #define PO_LOCK_WARNINGS (1 << 17) //!< do not allow programs to change the warning mask 00051 #define PO_NO_DATABASE (1 << 18) //!< do not allow database access 00052 #define PO_NO_GUI (1 << 19) //!< do not allow any GUI-relevant actions to be performed 00053 #define PO_NO_TERMINAL_IO (1 << 20) //!< do not allow any terminal I/O to be performed 00054 #define PO_REQUIRE_TYPES (1 << 21) //!< require type information for all declarations 00055 #define PO_NO_EXTERNAL_INFO (1 << 22) //!< do not allow any access to host, process, etc information 00056 #define PO_NO_THREAD_INFO (1 << 23) //!< do not allow any access to thread information 00057 #define PO_NO_LOCALE_CONTROL (1 << 24) //!< do not allow changes to program locale 00058 #define PO_REQUIRE_PROTOTYPES (1 << 25) //!< require types in method and function declarations 00059 #define PO_STRICT_ARGS (1 << 26) //!< do not allow access to RT_NOOP code or excess args 00060 #define PO_ALLOW_BARE_REFS (1 << 27) //!< do not allow '$' for vars and '$.' for class member refs 00061 #define PO_ASSUME_LOCAL (1 << 28) //!< assume local variable scope if not declared (implicit "my") 00062 00063 // combination options 00065 #define PO_NO_THREADS (PO_NO_THREAD_CONTROL|PO_NO_THREAD_CLASSES|PO_NO_THREAD_INFO) 00066 00068 #define PO_NO_EXTERNAL_ACCESS (PO_NO_PROCESS_CONTROL|PO_NO_NETWORK|PO_NO_FILESYSTEM|PO_NO_DATABASE|PO_NO_EXTERNAL_INFO|PO_NO_EXTERNAL_PROCESS) 00069 00071 #define PO_NO_IO (PO_NO_GUI|PO_NO_TERMINAL_IO|PO_NO_FILESYSTEM) 00072 00074 #define PO_LOCKDOWN (PO_NO_EXTERNAL_ACCESS|PO_NO_THREADS|PO_NO_IO) 00075 00077 #define PO_NEW_STYLE (PO_ALLOW_BARE_REFS|PO_ASSUME_LOCAL) 00078 00080 #define PO_POSITIVE_OPTIONS (PO_NO_CHILD_PO_RESTRICTIONS) 00081 00083 #define PO_FREE_OPTIONS (PO_ALLOW_BARE_REFS|PO_ASSUME_LOCAL) 00084 00085 #define QDOM_DEFAULT PO_DEFAULT //!< the default domain (no domain) 00086 #define QDOM_PROCESS PO_NO_PROCESS_CONTROL //!< provides process control functionality (can affect or stop the current process) 00087 #define QDOM_NETWORK PO_NO_NETWORK //!< provides network functionality 00088 #define QDOM_EXTERNAL_PROCESS PO_NO_EXTERNAL_PROCESS //!< provides external process control functionality (can affect) start) or stop external processes) 00089 #define QDOM_FILESYSTEM PO_NO_FILESYSTEM //!< provides access to the filesystem 00090 #define QDOM_THREAD_CLASS PO_NO_THREAD_CLASSES //!< provides thread control functionality 00091 #define QDOM_THREAD_CONTROL PO_NO_THREAD_CONTROL //!< provides the ability to check or manipulate threads (including starting new threads) 00092 #define QDOM_DATABASE PO_NO_DATABASE //!< provides access to databases 00093 #define QDOM_GUI PO_NO_GUI //!< provides GUI functionality 00094 #define QDOM_TERMINAL_IO PO_NO_TERMINAL_IO //!< provides terminal I/O functionality 00095 #define QDOM_EXTERNAL_INFO PO_NO_EXTERNAL_INFO //!< provides access to external information (ex: hostname, pid, process uid, etc) 00096 #define QDOM_THREAD_INFO PO_NO_THREAD_INFO //!< provides access to information regarding threading (tid, active threads, etc) 00097 #define QDOM_LOCALE_CONTROL PO_NO_LOCALE_CONTROL //!< provices access to functionality that changes locale information 00098 00099 #endif //_QORE_DOMAIN_H