void KeepControlPromises() { Constraint *cp; Rval retval; CFD_MAXPROCESSES = 30; MAXTRIES = 5; CFD_INTERVAL = 0; DENYBADCLOCKS = true; CFRUNCOMMAND[0] = '\0'; SetChecksumUpdates(true); /* Keep promised agent behaviour - control bodies */ Banner("Server control promises.."); HashControls(); /* Now expand */ for (cp = ControlBodyConstraints(cf_server); cp != NULL; cp = cp->next) { if (IsExcluded(cp->classes)) { continue; } if (GetVariable("control_server", cp->lval, &retval) == cf_notype) { CfOut(cf_error, "", "Unknown lval %s in server control body", cp->lval); continue; } if (strcmp(cp->lval, CFS_CONTROLBODY[cfs_serverfacility].lval) == 0) { SetFacility(retval.item); continue; } if (strcmp(cp->lval, CFS_CONTROLBODY[cfs_denybadclocks].lval) == 0) { DENYBADCLOCKS = GetBoolean(retval.item); CfOut(cf_verbose, "", "SET denybadclocks = %d\n", DENYBADCLOCKS); continue; } if (strcmp(cp->lval, CFS_CONTROLBODY[cfs_logencryptedtransfers].lval) == 0) { LOGENCRYPT = GetBoolean(retval.item); CfOut(cf_verbose, "", "SET LOGENCRYPT = %d\n", LOGENCRYPT); continue; } if (strcmp(cp->lval, CFS_CONTROLBODY[cfs_logallconnections].lval) == 0) { LOGCONNS = GetBoolean(retval.item); CfOut(cf_verbose, "", "SET LOGCONNS = %d\n", LOGCONNS); continue; } if (strcmp(cp->lval, CFS_CONTROLBODY[cfs_maxconnections].lval) == 0) { CFD_MAXPROCESSES = (int) Str2Int(retval.item); MAXTRIES = CFD_MAXPROCESSES / 3; CfOut(cf_verbose, "", "SET maxconnections = %d\n", CFD_MAXPROCESSES); continue; } if (strcmp(cp->lval, CFS_CONTROLBODY[cfs_cfruncommand].lval) == 0) { strncpy(CFRUNCOMMAND, retval.item, CF_BUFSIZE - 1); CfOut(cf_verbose, "", "SET cfruncommand = %s\n", CFRUNCOMMAND); continue; } if (strcmp(cp->lval, CFS_CONTROLBODY[cfs_allowconnects].lval) == 0) { Rlist *rp; CfOut(cf_verbose, "", "SET Allowing connections from ...\n"); for (rp = (Rlist *) retval.item; rp != NULL; rp = rp->next) { if (!IsItemIn(NONATTACKERLIST, rp->item)) { AppendItem(&NONATTACKERLIST, rp->item, cp->classes); } } continue; } if (strcmp(cp->lval, CFS_CONTROLBODY[cfs_denyconnects].lval) == 0) { Rlist *rp; CfOut(cf_verbose, "", "SET Denying connections from ...\n"); for (rp = (Rlist *) retval.item; rp != NULL; rp = rp->next) { if (!IsItemIn(ATTACKERLIST, rp->item)) { AppendItem(&ATTACKERLIST, rp->item, cp->classes); } } continue; } if (strcmp(cp->lval, CFS_CONTROLBODY[cfs_skipverify].lval) == 0) { Rlist *rp; CfOut(cf_verbose, "", "SET Skip verify connections from ...\n"); for (rp = (Rlist *) retval.item; rp != NULL; rp = rp->next) { if (!IsItemIn(SKIPVERIFY, rp->item)) { AppendItem(&SKIPVERIFY, rp->item, cp->classes); } } continue; } if (strcmp(cp->lval, CFS_CONTROLBODY[cfs_dynamicaddresses].lval) == 0) { Rlist *rp; CfOut(cf_verbose, "", "SET Dynamic addresses from ...\n"); for (rp = (Rlist *) retval.item; rp != NULL; rp = rp->next) { if (!IsItemIn(DHCPLIST, rp->item)) { AppendItem(&DHCPLIST, rp->item, cp->classes); } } continue; } if (strcmp(cp->lval, CFS_CONTROLBODY[cfs_allowallconnects].lval) == 0) { Rlist *rp; CfOut(cf_verbose, "", "SET Allowing multiple connections from ...\n"); for (rp = (Rlist *) retval.item; rp != NULL; rp = rp->next) { if (!IsItemIn(MULTICONNLIST, rp->item)) { AppendItem(&MULTICONNLIST, rp->item, cp->classes); } } continue; } if (strcmp(cp->lval, CFS_CONTROLBODY[cfs_allowusers].lval) == 0) { Rlist *rp; CfOut(cf_verbose, "", "SET Allowing users ...\n"); for (rp = (Rlist *) retval.item; rp != NULL; rp = rp->next) { if (!IsItemIn(ALLOWUSERLIST, rp->item)) { AppendItem(&ALLOWUSERLIST, rp->item, cp->classes); } } continue; } if (strcmp(cp->lval, CFS_CONTROLBODY[cfs_trustkeysfrom].lval) == 0) { Rlist *rp; CfOut(cf_verbose, "", "SET Trust keys from ...\n"); for (rp = (Rlist *) retval.item; rp != NULL; rp = rp->next) { if (!IsItemIn(TRUSTKEYLIST, rp->item)) { AppendItem(&TRUSTKEYLIST, rp->item, cp->classes); } } continue; } if (strcmp(cp->lval, CFS_CONTROLBODY[cfs_portnumber].lval) == 0) { SHORT_CFENGINEPORT = (short) Str2Int(retval.item); strncpy(STR_CFENGINEPORT, retval.item, 15); CfOut(cf_verbose, "", "SET default portnumber = %u = %s = %s\n", (int) SHORT_CFENGINEPORT, STR_CFENGINEPORT, ScalarRvalValue(retval)); SHORT_CFENGINEPORT = htons((short) Str2Int(retval.item)); continue; } if (strcmp(cp->lval, CFS_CONTROLBODY[cfs_keyttl].lval) == 0) { CfOut(cf_verbose, "", "Ignoring deprecated option keycacheTTL"); continue; } if (strcmp(cp->lval, CFS_CONTROLBODY[cfs_bindtointerface].lval) == 0) { strncpy(BINDINTERFACE, retval.item, CF_BUFSIZE - 1); CfOut(cf_verbose, "", "SET bindtointerface = %s\n", BINDINTERFACE); continue; } } if (GetVariable("control_common", CFG_CONTROLBODY[cfg_syslog_host].lval, &retval) != cf_notype) { SetSyslogHost(Hostname2IPString(retval.item)); } if (GetVariable("control_common", CFG_CONTROLBODY[cfg_syslog_port].lval, &retval) != cf_notype) { SetSyslogPort(Str2Int(retval.item)); } if (GetVariable("control_common", CFG_CONTROLBODY[cfg_fips_mode].lval, &retval) != cf_notype) { FIPS_MODE = GetBoolean(retval.item); CfOut(cf_verbose, "", "SET FIPS_MODE = %d\n", FIPS_MODE); } if (GetVariable("control_common", CFG_CONTROLBODY[cfg_lastseenexpireafter].lval, &retval) != cf_notype) { LASTSEENEXPIREAFTER = Str2Int(retval.item) * 60; } }
static int PaneIsFocusChainSlotValid (lua_State * L) { return GetBoolean(L, Pane_IsFocusChainSlotValid); }
static int PaneIsValid (lua_State * L) { return GetBoolean(L, Pane_IsValid); }
static int ListboxIsItemSelected (lua_State * L) { return GetBoolean(L, Listbox_IsItemSelected); }
static int PaneIsCaught (lua_State * L) { return GetBoolean(L, Pane_IsCaught); }
static int CheckboxIsClickAllowed (lua_State * L) { return GetBoolean(L, Checkbox_IsClickAllowed); }
static int ListboxIsItemClickAllowed (lua_State * L) { return GetBoolean(L, Listbox_IsItemClickAllowed); }
void KeepControlPromises() { struct Constraint *cp; char rettype; void *retval; struct Rlist *rp; for (cp = ControlBodyConstraints(cf_agent); cp != NULL; cp=cp->next) { if (IsExcluded(cp->classes)) { continue; } if (GetVariable("control_common",cp->lval,&retval,&rettype) != cf_notype) { /* Already handled in generic_agent */ continue; } if (GetVariable("control_agent",cp->lval,&retval,&rettype) == cf_notype) { CfOut(cf_error,"","Unknown lval %s in agent control body",cp->lval); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_maxconnections].lval) == 0) { CFA_MAXTHREADS = (int)Str2Int(retval); CfOut(cf_verbose,"","SET maxconnections = %d\n",CFA_MAXTHREADS); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_checksum_alert_time].lval) == 0) { CF_PERSISTENCE = (int)Str2Int(retval); CfOut(cf_verbose,"","SET checksum_alert_time = %d\n",CF_PERSISTENCE); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_agentfacility].lval) == 0) { SetFacility(retval); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_agentaccess].lval) == 0) { ACCESSLIST = (struct Rlist *) retval; CheckAgentAccess(ACCESSLIST); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_refresh_processes].lval) == 0) { struct Rlist *rp; if (VERBOSE) { printf("%s> SET refresh_processes when starting: ",VPREFIX); for (rp = (struct Rlist *) retval; rp != NULL; rp = rp->next) { printf(" %s",(char *)rp->item); PrependItem(&PROCESSREFRESH,rp->item,NULL); } printf("\n"); } continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_abortclasses].lval) == 0) { struct Rlist *rp; CfOut(cf_verbose,"","SET Abort classes from ...\n"); for (rp = (struct Rlist *) retval; rp != NULL; rp = rp->next) { char name[CF_MAXVARSIZE] = ""; strncpy(name, rp->item, CF_MAXVARSIZE - 1); CanonifyNameInPlace(name); if (!IsItemIn(ABORTHEAP,name)) { AppendItem(&ABORTHEAP,name,cp->classes); } } continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_abortbundleclasses].lval) == 0) { struct Rlist *rp; CfOut(cf_verbose,"","SET Abort bundle classes from ...\n"); for (rp = (struct Rlist *) retval; rp != NULL; rp = rp->next) { char name[CF_MAXVARSIZE] = ""; strncpy(name, rp->item, CF_MAXVARSIZE - 1); CanonifyNameInPlace(name); if (!IsItemIn(ABORTBUNDLEHEAP,name)) { AppendItem(&ABORTBUNDLEHEAP,name,cp->classes); } } continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_addclasses].lval) == 0) { struct Rlist *rp; CfOut(cf_verbose,"","-> Add classes ...\n"); for (rp = (struct Rlist *) retval; rp != NULL; rp = rp->next) { CfOut(cf_verbose,""," -> ... %s\n",rp->item); NewClass(rp->item); } continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_auditing].lval) == 0) { AUDIT = GetBoolean(retval); CfOut(cf_verbose,"","SET auditing = %d\n",AUDIT); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_alwaysvalidate].lval) == 0) { ALWAYS_VALIDATE = GetBoolean(retval); CfOut(cf_verbose,"","SET alwaysvalidate = %d\n",ALWAYS_VALIDATE); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_secureinput].lval) == 0) { CFPARANOID = GetBoolean(retval); CfOut(cf_verbose,"","SET secure input = %d\n",CFPARANOID); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_binarypaddingchar].lval) == 0) { PADCHAR = *(char *)retval; CfOut(cf_verbose,"","SET binarypaddingchar = %c\n",PADCHAR); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_bindtointerface].lval) == 0) { strncpy(BINDINTERFACE,retval,CF_BUFSIZE-1); CfOut(cf_verbose,"","SET bindtointerface = %s\n",BINDINTERFACE); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_hashupdates].lval) == 0) { CHECKSUMUPDATES = GetBoolean(retval); CfOut(cf_verbose,"","SET ChecksumUpdates %d\n",CHECKSUMUPDATES); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_exclamation].lval) == 0) { EXCLAIM = GetBoolean(retval); CfOut(cf_verbose,"","SET exclamation %d\n",EXCLAIM); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_childlibpath].lval) == 0) { char output[CF_BUFSIZE]; snprintf(output,CF_BUFSIZE,"LD_LIBRARY_PATH=%s",(char *)retval); if (putenv(strdup(output)) == 0) { CfOut(cf_verbose,"","Setting %s\n",output); } continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_defaultcopytype].lval) == 0) { DEFAULT_COPYTYPE = (char *)retval; CfOut(cf_verbose,"","SET defaultcopytype = %c\n",DEFAULT_COPYTYPE); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_fsinglecopy].lval) == 0) { SINGLE_COPY_LIST = (struct Rlist *)retval; CfOut(cf_verbose,"","SET file single copy list\n"); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_fautodefine].lval) == 0) { AUTO_DEFINE_LIST = (struct Rlist *)retval; CfOut(cf_verbose,"","SET file auto define list\n"); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_dryrun].lval) == 0) { DONTDO = GetBoolean(retval); CfOut(cf_verbose,"","SET dryrun = %c\n",DONTDO); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_inform].lval) == 0) { INFORM = GetBoolean(retval); CfOut(cf_verbose,"","SET inform = %c\n",INFORM); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_verbose].lval) == 0) { VERBOSE = GetBoolean(retval); CfOut(cf_verbose,"","SET inform = %c\n",VERBOSE); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_repository].lval) == 0) { VREPOSITORY = strdup(retval); CfOut(cf_verbose,"","SET repository = %s\n",VREPOSITORY); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_skipidentify].lval) == 0) { SKIPIDENTIFY = GetBoolean(retval); CfOut(cf_verbose,"","SET skipidentify = %d\n",SKIPIDENTIFY); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_suspiciousnames].lval) == 0) { for (rp = (struct Rlist *) retval; rp != NULL; rp = rp->next) { PrependItem(&SUSPICIOUSLIST,rp->item,NULL); CfOut(cf_verbose,"", "-> Concidering %s as suspicious file", rp->item); } continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_repchar].lval) == 0) { REPOSCHAR = *(char *)retval; CfOut(cf_verbose,"","SET repchar = %c\n",REPOSCHAR); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_mountfilesystems].lval) == 0) { CF_MOUNTALL = GetBoolean(retval); CfOut(cf_verbose,"","SET mountfilesystems = %d\n",CF_MOUNTALL); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_editfilesize].lval) == 0) { EDITFILESIZE = Str2Int(retval); CfOut(cf_verbose,"","SET EDITFILESIZE = %d\n",EDITFILESIZE); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_ifelapsed].lval) == 0) { VIFELAPSED = Str2Int(retval); CfOut(cf_verbose,"","SET ifelapsed = %d\n",VIFELAPSED); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_expireafter].lval) == 0) { VEXPIREAFTER = Str2Int(retval); CfOut(cf_verbose,"","SET ifelapsed = %d\n",VEXPIREAFTER); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_timeout].lval) == 0) { CONNTIMEOUT = Str2Int(retval); CfOut(cf_verbose,"","SET timeout = %d\n",CONNTIMEOUT); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_max_children].lval) == 0) { CFA_BACKGROUND_LIMIT = Str2Int(retval); CfOut(cf_verbose,"","SET MAX_CHILDREN = %d\n",CFA_BACKGROUND_LIMIT); if (CFA_BACKGROUND_LIMIT > 10) { CfOut(cf_error,"","Silly value for max_children in agent control promise (%d > 10)",CFA_BACKGROUND_LIMIT); CFA_BACKGROUND_LIMIT = 1; } continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_syslog].lval) == 0) { LOGGING = GetBoolean(retval); CfOut(cf_verbose,"","SET syslog = %d\n",LOGGING); continue; } if (strcmp(cp->lval,CFA_CONTROLBODY[cfa_environment].lval) == 0) { struct Rlist *rp; CfOut(cf_verbose,"","SET environment variables from ...\n"); for (rp = (struct Rlist *) retval; rp != NULL; rp = rp->next) { if (putenv(rp->item) != 0) { CfOut(cf_error, "putenv", "Failed to set environment variable %s", rp->item); } } continue; } } if (GetVariable("control_common",CFG_CONTROLBODY[cfg_lastseenexpireafter].lval,&retval,&rettype) != cf_notype) { LASTSEENEXPIREAFTER = Str2Int(retval); } if (GetVariable("control_common",CFG_CONTROLBODY[cfg_fips_mode].lval,&retval,&rettype) != cf_notype) { FIPS_MODE = GetBoolean(retval); CfOut(cf_verbose,"","SET FIPS_MODE = %d\n",FIPS_MODE); } if (GetVariable("control_common",CFG_CONTROLBODY[cfg_syslog_port].lval,&retval,&rettype) != cf_notype) { SYSLOGPORT = (unsigned short)Str2Int(retval); CfOut(cf_verbose,"","SET syslog_port to %d",SYSLOGPORT); } if (GetVariable("control_common",CFG_CONTROLBODY[cfg_syslog_host].lval,&retval,&rettype) != cf_notype) { strncpy(SYSLOGHOST,Hostname2IPString(retval),CF_MAXVARSIZE-1); CfOut(cf_verbose,"","SET syslog_host to %s",SYSLOGHOST); } #ifdef HAVE_NOVA Nova_Initialize(); #endif }
void KeepControlPromises(Policy *policy) { Rval retval; Rlist *rp; Seq *constraints = ControlBodyConstraints(policy, AGENT_TYPE_AGENT); if (constraints) { for (size_t i = 0; i < SeqLength(constraints); i++) { Constraint *cp = SeqAt(constraints, i); if (IsExcluded(cp->classes, NULL)) { continue; } if (GetVariable("control_common", cp->lval, &retval) != DATA_TYPE_NONE) { /* Already handled in generic_agent */ continue; } if (GetVariable("control_agent", cp->lval, &retval) == DATA_TYPE_NONE) { CfOut(cf_error, "", "Unknown lval %s in agent control body", cp->lval); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_maxconnections].lval) == 0) { CFA_MAXTHREADS = (int) Str2Int(retval.item); CfOut(cf_verbose, "", "SET maxconnections = %d\n", CFA_MAXTHREADS); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_checksum_alert_time].lval) == 0) { CF_PERSISTENCE = (int) Str2Int(retval.item); CfOut(cf_verbose, "", "SET checksum_alert_time = %d\n", CF_PERSISTENCE); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_agentfacility].lval) == 0) { SetFacility(retval.item); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_agentaccess].lval) == 0) { ACCESSLIST = (Rlist *) retval.item; CheckAgentAccess(ACCESSLIST, InputFiles(policy)); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_refresh_processes].lval) == 0) { Rlist *rp; if (VERBOSE) { printf("%s> SET refresh_processes when starting: ", VPREFIX); for (rp = (Rlist *) retval.item; rp != NULL; rp = rp->next) { printf(" %s", (char *) rp->item); PrependItem(&PROCESSREFRESH, rp->item, NULL); } printf("\n"); } continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_abortclasses].lval) == 0) { Rlist *rp; CfOut(cf_verbose, "", "SET Abort classes from ...\n"); for (rp = (Rlist *) retval.item; rp != NULL; rp = rp->next) { char name[CF_MAXVARSIZE] = ""; strncpy(name, rp->item, CF_MAXVARSIZE - 1); AddAbortClass(name, cp->classes); } continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_abortbundleclasses].lval) == 0) { Rlist *rp; CfOut(cf_verbose, "", "SET Abort bundle classes from ...\n"); for (rp = (Rlist *) retval.item; rp != NULL; rp = rp->next) { char name[CF_MAXVARSIZE] = ""; strncpy(name, rp->item, CF_MAXVARSIZE - 1); if (!IsItemIn(ABORTBUNDLEHEAP, name)) { AppendItem(&ABORTBUNDLEHEAP, name, cp->classes); } } continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_addclasses].lval) == 0) { Rlist *rp; CfOut(cf_verbose, "", "-> Add classes ...\n"); for (rp = (Rlist *) retval.item; rp != NULL; rp = rp->next) { CfOut(cf_verbose, "", " -> ... %s\n", ScalarValue(rp)); NewClass(rp->item, NULL); } continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_auditing].lval) == 0) { CfOut(cf_verbose, "", "This option does nothing and is retained for compatibility reasons"); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_alwaysvalidate].lval) == 0) { ALWAYS_VALIDATE = GetBoolean(retval.item); CfOut(cf_verbose, "", "SET alwaysvalidate = %d\n", ALWAYS_VALIDATE); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_allclassesreport].lval) == 0) { ALLCLASSESREPORT = GetBoolean(retval.item); CfOut(cf_verbose, "", "SET allclassesreport = %d\n", ALLCLASSESREPORT); } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_secureinput].lval) == 0) { CFPARANOID = GetBoolean(retval.item); CfOut(cf_verbose, "", "SET secure input = %d\n", CFPARANOID); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_binarypaddingchar].lval) == 0) { CfOut(cf_verbose, "", "binarypaddingchar is obsolete and does nothing\n"); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_bindtointerface].lval) == 0) { strncpy(BINDINTERFACE, retval.item, CF_BUFSIZE - 1); CfOut(cf_verbose, "", "SET bindtointerface = %s\n", BINDINTERFACE); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_hashupdates].lval) == 0) { bool enabled = GetBoolean(retval.item); SetChecksumUpdates(enabled); CfOut(cf_verbose, "", "SET ChecksumUpdates %d\n", enabled); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_exclamation].lval) == 0) { CfOut(cf_verbose, "", "exclamation control is deprecated and does not do anything\n"); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_childlibpath].lval) == 0) { char output[CF_BUFSIZE]; snprintf(output, CF_BUFSIZE, "LD_LIBRARY_PATH=%s", (char *) retval.item); if (putenv(xstrdup(output)) == 0) { CfOut(cf_verbose, "", "Setting %s\n", output); } continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_defaultcopytype].lval) == 0) { DEFAULT_COPYTYPE = (char *) retval.item; CfOut(cf_verbose, "", "SET defaultcopytype = %s\n", DEFAULT_COPYTYPE); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_fsinglecopy].lval) == 0) { SINGLE_COPY_LIST = (Rlist *) retval.item; CfOut(cf_verbose, "", "SET file single copy list\n"); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_fautodefine].lval) == 0) { SetFileAutoDefineList(ListRvalValue(retval)); CfOut(cf_verbose, "", "SET file auto define list\n"); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_dryrun].lval) == 0) { DONTDO = GetBoolean(retval.item); CfOut(cf_verbose, "", "SET dryrun = %c\n", DONTDO); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_inform].lval) == 0) { INFORM = GetBoolean(retval.item); CfOut(cf_verbose, "", "SET inform = %c\n", INFORM); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_verbose].lval) == 0) { VERBOSE = GetBoolean(retval.item); CfOut(cf_verbose, "", "SET inform = %c\n", VERBOSE); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_repository].lval) == 0) { SetRepositoryLocation(retval.item); CfOut(cf_verbose, "", "SET repository = %s\n", ScalarRvalValue(retval)); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_skipidentify].lval) == 0) { bool enabled = GetBoolean(retval.item); SetSkipIdentify(enabled); CfOut(cf_verbose, "", "SET skipidentify = %d\n", (int) enabled); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_suspiciousnames].lval) == 0) { for (rp = (Rlist *) retval.item; rp != NULL; rp = rp->next) { AddFilenameToListOfSuspicious(ScalarValue(rp)); CfOut(cf_verbose, "", "-> Considering %s as suspicious file", ScalarValue(rp)); } continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_repchar].lval) == 0) { char c = *(char *) retval.item; SetRepositoryChar(c); CfOut(cf_verbose, "", "SET repchar = %c\n", c); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_mountfilesystems].lval) == 0) { CF_MOUNTALL = GetBoolean(retval.item); CfOut(cf_verbose, "", "SET mountfilesystems = %d\n", CF_MOUNTALL); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_editfilesize].lval) == 0) { EDITFILESIZE = Str2Int(retval.item); CfOut(cf_verbose, "", "SET EDITFILESIZE = %d\n", EDITFILESIZE); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_ifelapsed].lval) == 0) { VIFELAPSED = Str2Int(retval.item); CfOut(cf_verbose, "", "SET ifelapsed = %d\n", VIFELAPSED); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_expireafter].lval) == 0) { VEXPIREAFTER = Str2Int(retval.item); CfOut(cf_verbose, "", "SET ifelapsed = %d\n", VEXPIREAFTER); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_timeout].lval) == 0) { CONNTIMEOUT = Str2Int(retval.item); CfOut(cf_verbose, "", "SET timeout = %jd\n", (intmax_t) CONNTIMEOUT); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_max_children].lval) == 0) { CFA_BACKGROUND_LIMIT = Str2Int(retval.item); CfOut(cf_verbose, "", "SET MAX_CHILDREN = %d\n", CFA_BACKGROUND_LIMIT); if (CFA_BACKGROUND_LIMIT > 10) { CfOut(cf_error, "", "Silly value for max_children in agent control promise (%d > 10)", CFA_BACKGROUND_LIMIT); CFA_BACKGROUND_LIMIT = 1; } continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_syslog].lval) == 0) { CfOut(cf_verbose, "", "SET syslog = %d\n", GetBoolean(retval.item)); continue; } if (strcmp(cp->lval, CFA_CONTROLBODY[cfa_environment].lval) == 0) { Rlist *rp; CfOut(cf_verbose, "", "SET environment variables from ...\n"); for (rp = (Rlist *) retval.item; rp != NULL; rp = rp->next) { if (putenv(rp->item) != 0) { CfOut(cf_error, "putenv", "Failed to set environment variable %s", ScalarValue(rp)); } } continue; } } } if (GetVariable("control_common", CFG_CONTROLBODY[cfg_lastseenexpireafter].lval, &retval) != DATA_TYPE_NONE) { LASTSEENEXPIREAFTER = Str2Int(retval.item) * 60; } if (GetVariable("control_common", CFG_CONTROLBODY[cfg_fips_mode].lval, &retval) != DATA_TYPE_NONE) { FIPS_MODE = GetBoolean(retval.item); CfOut(cf_verbose, "", "SET FIPS_MODE = %d\n", FIPS_MODE); } if (GetVariable("control_common", CFG_CONTROLBODY[cfg_syslog_port].lval, &retval) != DATA_TYPE_NONE) { SetSyslogPort(Str2Int(retval.item)); CfOut(cf_verbose, "", "SET syslog_port to %s", ScalarRvalValue(retval)); } if (GetVariable("control_common", CFG_CONTROLBODY[cfg_syslog_host].lval, &retval) != DATA_TYPE_NONE) { SetSyslogHost(Hostname2IPString(retval.item)); CfOut(cf_verbose, "", "SET syslog_host to %s", Hostname2IPString(retval.item)); } #ifdef HAVE_NOVA Nova_Initialize(); #endif }
static int Twosided(lua_State *L) { return GetBoolean(L, NULL, AI_MATKEY_TWOSIDED); }
static int Wireframe(lua_State *L) { return GetBoolean(L, NULL, AI_MATKEY_ENABLE_WIREFRAME); }
/**--------------------------------------------------------------------------<BR> C2DPolyBase::GetBoolean <BR> \brief Gets the union / intersect etc depending on the inside / outside flags. <P>---------------------------------------------------------------------------*/ void C2DPolyBase::GetBoolean(const C2DPolyBase& Other, C2DHoledPolyBaseSet& HoledPolys, bool bThisInside, bool bOtherInside, CGrid::eDegenerateHandling eDegen) const { if (m_BoundingRect.Overlaps(Other.GetBoundingRect() )) { switch (eDegen) { case CGrid::None: { C2DLineBaseSetSet Routes1, Routes2; C2DPolyBase::GetRoutes( *this, bThisInside, Other, bOtherInside, Routes1, Routes2); Routes1 << Routes2; if (Routes1.size() > 0) { // Add all the joining routes together to form closed routes Routes1.MergeJoining(); // Set up some temporary polygons. C2DPolyBaseSet Polygons; // Turn the routes into polygons. for (int i = Routes1.size() - 1; i >= 0; i--) { C2DLineBaseSet* pRoute = Routes1.GetAt(i); if (pRoute->IsClosed() && pRoute->size() > 2) { Polygons.Add(new C2DPolyBase); Polygons.GetLast()->CreateDirect( *pRoute); } else { CGrid::LogDegenerateError(); } } // Set up some temporary holed polygons C2DHoledPolyBaseSet NewComPolys; // Turn the set of polygons into holed polygons. // Only if not the intersection. (CR) if (!(bThisInside && bOtherInside) ) { C2DHoledPolyBase::PolygonsToHoledPolygons(NewComPolys, Polygons); if (NewComPolys.size() != 1 && bThisInside == bOtherInside ) // union must be 1 { CGrid::LogDegenerateError(); } } else { HoledPolys << Polygons; } // Now add them all to the provided set. HoledPolys << NewComPolys; } } break; case CGrid::RandomPerturbation: { C2DPolyBase OtherCopy(Other); OtherCopy.RandomPerturb(); GetBoolean( OtherCopy, HoledPolys, bThisInside, bOtherInside, CGrid::None); } break; case CGrid::DynamicGrid: { C2DRect Rect; if (GetBoundingRect().Overlaps(Other.GetBoundingRect(), Rect)) { double dOldGrid = CGrid::GetGridSize(); CGrid::SetToMinGridSize(Rect); GetBoolean( Other, HoledPolys, bThisInside, bOtherInside, CGrid::PreDefinedGrid); CGrid::SetGridSize(dOldGrid); } } break; case CGrid::PreDefinedGrid: { C2DPolyBase P1(*this), P2(Other); P1.SnapToGrid(); P2.SnapToGrid(); C2DVector V1( P1.GetBoundingRect().GetTopLeft(), P2.GetBoundingRect().GetTopLeft()); double dPerturbation = CGrid::GetGridSize(); // ensure it snaps back to original grid positions. V1.i > 0 ? V1.i = dPerturbation: V1.i = -dPerturbation; // move away slightly if possible V1.j > 0 ? V1.j = dPerturbation: V1.j = -dPerturbation; // move away slightly if possible V1.i *= 0.411923;// ensure it snaps back to original grid positions. V1.j *= 0.313131;// ensure it snaps back to original grid positions. P2.Move( V1 ); P1.GetBoolean( P2, HoledPolys, bThisInside, bOtherInside, CGrid::None); HoledPolys.SnapToGrid(); } break; case CGrid::PreDefinedGridPreSnapped: { C2DPolyBase P2(Other); C2DVector V1( this->GetBoundingRect().GetTopLeft(), P2.GetBoundingRect().GetTopLeft()); double dPerturbation = CGrid::GetGridSize(); // ensure it snaps back to original grid positions. V1.i > 0 ? V1.i = dPerturbation: V1.i = -dPerturbation; // move away slightly if possible V1.j > 0 ? V1.j = dPerturbation: V1.j = -dPerturbation; // move away slightly if possible V1.i *= 0.411923;// ensure it snaps back to original grid positions. V1.j *= 0.313131;// ensure it snaps back to original grid positions. P2.Move( V1 ); GetBoolean( P2, HoledPolys, bThisInside, bOtherInside, CGrid::None); HoledPolys.SnapToGrid(); } break; } } }
/**--------------------------------------------------------------------------<BR> C2DPolyBase::GetUnion <BR> \brief Returns the combined areas of this and the other polygon. If there is no interaction, nothing is done. <P>---------------------------------------------------------------------------*/ void C2DPolyBase::GetUnion(const C2DPolyBase& Other, C2DHoledPolyBaseSet& Polygons, CGrid::eDegenerateHandling eDegen) const { GetBoolean( Other, Polygons, false, false, eDegen); }
/**--------------------------------------------------------------------------<BR> C2DPolyBase::GetOverlaps <BR> \brief Gets the overlaps. <P>---------------------------------------------------------------------------*/ void C2DPolyBase::GetOverlaps(const C2DPolyBase& Other, C2DHoledPolyBaseSet& Polygons, CGrid::eDegenerateHandling eDegen) const { GetBoolean( Other, Polygons, true, true, eDegen); }
static int ButtonIsPushed (lua_State * L) { return GetBoolean(L, Button_IsPushed); }
void KeepControlPromises(Policy *policy) { Constraint *cp; Rval retval; RUNATTR.copy.trustkey = false; RUNATTR.copy.encrypt = true; RUNATTR.copy.force_ipv4 = false; RUNATTR.copy.portnumber = SHORT_CFENGINEPORT; /* Keep promised agent behaviour - control bodies */ for (cp = ControlBodyConstraints(policy, cf_runagent); cp != NULL; cp = cp->next) { if (IsExcluded(cp->classes, NULL)) { continue; } if (GetVariable("control_runagent", cp->lval, &retval) == cf_notype) { CfOut(cf_error, "", "Unknown lval %s in runagent control body", cp->lval); continue; } if (strcmp(cp->lval, CFR_CONTROLBODY[cfr_force_ipv4].lval) == 0) { RUNATTR.copy.force_ipv4 = GetBoolean(retval.item); CfOut(cf_verbose, "", "SET force_ipv4 = %d\n", RUNATTR.copy.force_ipv4); continue; } if (strcmp(cp->lval, CFR_CONTROLBODY[cfr_trustkey].lval) == 0) { RUNATTR.copy.trustkey = GetBoolean(retval.item); CfOut(cf_verbose, "", "SET trustkey = %d\n", RUNATTR.copy.trustkey); continue; } if (strcmp(cp->lval, CFR_CONTROLBODY[cfr_encrypt].lval) == 0) { RUNATTR.copy.encrypt = GetBoolean(retval.item); CfOut(cf_verbose, "", "SET encrypt = %d\n", RUNATTR.copy.encrypt); continue; } if (strcmp(cp->lval, CFR_CONTROLBODY[cfr_portnumber].lval) == 0) { RUNATTR.copy.portnumber = (short) Str2Int(retval.item); CfOut(cf_verbose, "", "SET default portnumber = %u\n", (int) RUNATTR.copy.portnumber); continue; } if (strcmp(cp->lval, CFR_CONTROLBODY[cfr_background].lval) == 0) { /* * Only process this option if are is no -b or -i options specified on * command line. */ if (BACKGROUND || INTERACTIVE) { CfOut(cf_error, "", "Warning: 'background_children' setting from 'body runagent control' is overriden by command-line option."); } else { BACKGROUND = GetBoolean(retval.item); } continue; } if (strcmp(cp->lval, CFR_CONTROLBODY[cfr_maxchild].lval) == 0) { MAXCHILD = (short) Str2Int(retval.item); continue; } if (strcmp(cp->lval, CFR_CONTROLBODY[cfr_output_to_file].lval) == 0) { OUTPUT_TO_FILE = GetBoolean(retval.item); continue; } if (strcmp(cp->lval, CFR_CONTROLBODY[cfr_output_directory].lval) == 0) { if (IsAbsPath(retval.item)) { strncpy(OUTPUT_DIRECTORY, retval.item, CF_BUFSIZE - 1); CfOut(cf_verbose, "", "SET output direcory to = %s\n", OUTPUT_DIRECTORY); } continue; } if (strcmp(cp->lval, CFR_CONTROLBODY[cfr_timeout].lval) == 0) { RUNATTR.copy.timeout = (short) Str2Int(retval.item); continue; } if (strcmp(cp->lval, CFR_CONTROLBODY[cfr_hosts].lval) == 0) { if (HOSTLIST == NULL) // Don't override if command line setting { HOSTLIST = retval.item; } continue; } } if (GetVariable("control_common", CFG_CONTROLBODY[cfg_lastseenexpireafter].lval, &retval) != cf_notype) { LASTSEENEXPIREAFTER = Str2Int(retval.item) * 60; } }
static int ButtonIsValid (lua_State * L) { return GetBoolean(L, Button_IsValid); }
static int Get(lua_State *L) { GLenum pname = checkpname(L, 1); switch(pname) { case GL_CONTEXT_FLAGS: return GetBitfield(L, pname, &ContextFlagBitfield); case GL_MAJOR_VERSION: return GetInt(L, pname); case GL_MAX_SERVER_WAIT_TIMEOUT: return GetInt(L, pname); case GL_MIN_MAP_BUFFER_ALIGNMENT: return GetInt(L, pname); case GL_MINOR_VERSION: return GetInt(L, pname); case GL_NUM_EXTENSIONS: return GetInt(L, pname); case GL_NUM_SPIR_V_EXTENSIONS: return GetInt(L, pname); //GL_VERSION_4_6 case GL_NUM_SHADING_LANGUAGE_VERSIONS: return GetInt(L, pname); case GL_TIMESTAMP: return GetInt(L, pname); /* Buffer Binding State */ case GL_ARRAY_BUFFER_BINDING: return GetInt(L, pname); case GL_COPY_READ_BUFFER_BINDING: return GetInt(L, pname); case GL_COPY_WRITE_BUFFER_BINDING: return GetInt(L, pname); case GL_DRAW_INDIRECT_BUFFER_BINDING: return GetInt(L, pname); case GL_ELEMENT_ARRAY_BUFFER_BINDING: return GetInt(L, pname); case GL_PARAMETER_BUFFER_BINDING: return GetInt(L, pname); //GL_VERSION_4_6 case GL_QUERY_BUFFER_BINDING: return GetInt(L, pname); case GL_TEXTURE_BUFFER_BINDING: return GetInt(L, pname); case GL_VERTEX_ARRAY_BINDING: return GetInt(L, pname); case GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS: return GetInt(L, pname); case GL_ATOMIC_COUNTER_BUFFER_BINDING: return GetIntOptIndex(L, pname); case GL_ATOMIC_COUNTER_BUFFER_START: return GetIntOptIndex(L, pname); case GL_ATOMIC_COUNTER_BUFFER_SIZE: return GetIntOptIndex(L, pname); case GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS: return GetInt(L, pname); case GL_SHADER_STORAGE_BUFFER_BINDING: return GetIntOptIndex(L, pname); case GL_SHADER_STORAGE_BUFFER_START: return GetIntIndex(L, pname); case GL_SHADER_STORAGE_BUFFER_SIZE: return GetIntIndex(L, pname); /* case GL_MAX_TRANSFORM_FEEDBACK_BUFFER_BINDINGS: */ case GL_MAX_TRANSFORM_FEEDBACK_BUFFERS: return GetInt(L, pname); case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: return GetIntOptIndex(L, pname); case GL_TRANSFORM_FEEDBACK_BUFFER_START: return GetIntIndex(L, pname); case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: return GetIntIndex(L, pname); case GL_MAX_UNIFORM_BUFFER_BINDINGS: return GetInt(L, pname); case GL_UNIFORM_BUFFER_BINDING: return GetIntOptIndex(L, pname); case GL_UNIFORM_BUFFER_START: return GetIntIndex(L, pname); case GL_UNIFORM_BUFFER_SIZE: return GetIntIndex(L, pname); case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: return GetInt(L, pname); case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: return GetInt(L, pname); case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: return GetInt(L, pname); case GL_TRANSFORM_FEEDBACK_PAUSED: return GetBoolean(L, pname); case GL_TRANSFORM_FEEDBACK_ACTIVE: return GetBoolean(L, pname); /* Debug Output State */ case GL_DEBUG_GROUP_STACK_DEPTH: return GetInt(L, pname); case GL_DEBUG_LOGGED_MESSAGES: return GetInt(L, pname); case GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH: return GetInt(L, pname); case GL_DEBUG_OUTPUT: return GetBoolean(L, pname); case GL_DEBUG_OUTPUT_SYNCHRONOUS: return GetBoolean(L, pname); case GL_MAX_DEBUG_LOGGED_MESSAGES: return GetInt(L, pname); case GL_MAX_DEBUG_MESSAGE_LENGTH: return GetInt(L, pname); case GL_MAX_DEBUG_GROUP_STACK_DEPTH: return GetInt(L, pname); case GL_MAX_LABEL_LENGTH: return GetInt(L, pname); /* Framebuffers */ case GL_COLOR_CLEAR_VALUE: return GetFloat4(L, pname); case GL_COLOR_WRITEMASK: return GetBoolean4OptIndex(L, pname); case GL_DEPTH_CLEAR_VALUE: return GetFloat(L, pname); case GL_DEPTH_FUNC: return GetEnum(L, pname, DOMAIN_STENCIL_FUNC); case GL_DEPTH_TEST: return GetBoolean(L, pname); case GL_DEPTH_WRITEMASK: return GetBoolean(L, pname); case GL_DOUBLEBUFFER: return GetBoolean(L, pname); case GL_DRAW_BUFFER: case GL_DRAW_BUFFER0: case GL_DRAW_BUFFER1: case GL_DRAW_BUFFER2: case GL_DRAW_BUFFER3: case GL_DRAW_BUFFER4: case GL_DRAW_BUFFER5: case GL_DRAW_BUFFER6: case GL_DRAW_BUFFER7: case GL_DRAW_BUFFER8: case GL_DRAW_BUFFER9: case GL_DRAW_BUFFER10: case GL_DRAW_BUFFER11: case GL_DRAW_BUFFER12: case GL_DRAW_BUFFER13: case GL_DRAW_BUFFER14: case GL_DRAW_BUFFER15: return GetEnum(L, pname, DOMAIN_BUFFER); case GL_DRAW_FRAMEBUFFER_BINDING: return GetInt(L, pname); case GL_MAX_COLOR_ATTACHMENTS: return GetInt(L, pname); case GL_MAX_COLOR_TEXTURE_SAMPLES: return GetInt(L, pname); case GL_MAX_DEPTH_TEXTURE_SAMPLES: return GetInt(L, pname); case GL_MAX_DRAW_BUFFERS: return GetInt(L, pname); case GL_MAX_DUAL_SOURCE_DRAW_BUFFERS: return GetInt(L, pname); case GL_MAX_FRAMEBUFFER_HEIGHT: return GetInt(L, pname); case GL_MAX_FRAMEBUFFER_LAYERS: return GetInt(L, pname); case GL_MAX_FRAMEBUFFER_SAMPLES: return GetInt(L, pname); case GL_MAX_FRAMEBUFFER_WIDTH: return GetInt(L, pname); case GL_MAX_INTEGER_SAMPLES: return GetInt(L, pname); case GL_MAX_SAMPLES: return GetInt(L, pname); case GL_READ_BUFFER: return GetEnum(L, pname, DOMAIN_BUFFER); case GL_READ_FRAMEBUFFER_BINDING: return GetInt(L, pname); case GL_RENDERBUFFER_BINDING: return GetInt(L, pname); case GL_STENCIL_BACK_FAIL: return GetEnum(L, pname, DOMAIN_STENCIL_OP); case GL_STENCIL_BACK_FUNC: return GetEnum(L, pname, DOMAIN_STENCIL_FUNC); case GL_STENCIL_BACK_PASS_DEPTH_FAIL: return GetEnum(L, pname, DOMAIN_STENCIL_OP); case GL_STENCIL_BACK_PASS_DEPTH_PASS: return GetEnum(L, pname, DOMAIN_STENCIL_OP); case GL_STENCIL_BACK_REF: return GetInt(L, pname); case GL_STENCIL_BACK_VALUE_MASK: return GetInt(L, pname); case GL_STENCIL_BACK_WRITEMASK: return GetInt(L, pname); case GL_STENCIL_CLEAR_VALUE: return GetInt(L, pname); case GL_STENCIL_FAIL: return GetEnum(L, pname, DOMAIN_STENCIL_OP); case GL_STENCIL_FUNC: return GetEnum(L, pname, DOMAIN_STENCIL_FUNC); case GL_STENCIL_PASS_DEPTH_FAIL: return GetEnum(L, pname, DOMAIN_STENCIL_OP); case GL_STENCIL_PASS_DEPTH_PASS: return GetEnum(L, pname, DOMAIN_STENCIL_OP); case GL_STENCIL_REF: return GetInt(L, pname); case GL_STENCIL_TEST: return GetBoolean(L, pname); case GL_STENCIL_VALUE_MASK: return GetInt(L, pname); case GL_STENCIL_WRITEMASK: return GetInt(L, pname); case GL_STEREO: return GetBoolean(L, pname); /* Hints */ case GL_FRAGMENT_SHADER_DERIVATIVE_HINT: return GetEnum(L, pname, DOMAIN_HINT_MODE); case GL_LINE_SMOOTH_HINT: return GetEnum(L, pname, DOMAIN_HINT_MODE); case GL_POLYGON_SMOOTH_HINT: return GetEnum(L, pname, DOMAIN_HINT_MODE); case GL_TEXTURE_COMPRESSION_HINT: return GetEnum(L, pname, DOMAIN_HINT_MODE); /* Image State */ case GL_IMAGE_BINDING_ACCESS: return GetIntIndex(L, pname); case GL_IMAGE_BINDING_FORMAT: return GetIntIndex(L, pname); case GL_IMAGE_BINDING_NAME: return GetIntIndex(L, pname); case GL_IMAGE_BINDING_LAYER: return GetIntIndex(L, pname); case GL_IMAGE_BINDING_LAYERED: return GetIntIndex(L, pname); case GL_IMAGE_BINDING_LEVEL: return GetIntIndex(L, pname); /* Multisampling */ case GL_MAX_SAMPLE_MASK_WORDS: return GetInt(L, pname); case GL_MULTISAMPLE: return GetBoolean(L, pname); case GL_SAMPLE_ALPHA_TO_COVERAGE: return GetBoolean(L, pname); case GL_SAMPLE_ALPHA_TO_ONE: return GetBoolean(L, pname); case GL_SAMPLE_BUFFERS: return GetInt(L, pname); case GL_SAMPLE_COVERAGE: return GetBoolean(L, pname); case GL_SAMPLE_COVERAGE_INVERT: return GetBoolean(L, pname); case GL_SAMPLE_COVERAGE_VALUE: return GetFloat(L, pname); case GL_SAMPLE_MASK: return GetBoolean(L, pname); case GL_SAMPLE_MASK_VALUE: return GetIntIndex(L, pname); case GL_SAMPLES: return GetInt(L, pname); /* Pixel Operations */ case GL_BLEND: return GetBooleanOptIndex(L, pname); case GL_BLEND_COLOR: return GetFloat4OptIndex(L, pname); case GL_BLEND_DST_ALPHA: return GetEnum(L, pname, DOMAIN_BLEND_FACTOR); case GL_BLEND_DST_RGB: return GetEnumOptIndex(L, pname, DOMAIN_BLEND_FACTOR); case GL_BLEND_EQUATION_RGB: return GetEnumOptIndex(L, pname, DOMAIN_BLEND_MODE); case GL_BLEND_EQUATION_ALPHA: return GetEnumOptIndex(L, pname, DOMAIN_BLEND_MODE); case GL_BLEND_SRC_ALPHA: return GetEnumOptIndex(L, pname, DOMAIN_BLEND_FACTOR); case GL_BLEND_SRC_RGB: return GetEnumOptIndex(L, pname, DOMAIN_BLEND_FACTOR); case GL_COLOR_LOGIC_OP: return GetBoolean(L, pname); case GL_DITHER: return GetBoolean(L, pname); case GL_LOGIC_OP_MODE: return GetEnum(L, pname, DOMAIN_LOGIC_OP); case GL_SCISSOR_BOX: return GetFloat4Index(L, pname); case GL_SCISSOR_TEST: return GetBoolean4Index(L, pname); /* Pixel Transfer Operations */ case GL_CLAMP_READ_COLOR: return GetEnum(L, pname, DOMAIN_CLAMP); case GL_IMPLEMENTATION_COLOR_READ_FORMAT: return GetEnum(L, pname, DOMAIN_FORMAT); case GL_IMPLEMENTATION_COLOR_READ_TYPE: return GetEnum(L, pname, DOMAIN_TYPE); case GL_PACK_ALIGNMENT: return GetInt(L, pname); case GL_PACK_COMPRESSED_BLOCK_DEPTH: return GetInt(L, pname); case GL_PACK_COMPRESSED_BLOCK_HEIGHT: return GetInt(L, pname); case GL_PACK_COMPRESSED_BLOCK_SIZE: return GetInt(L, pname); case GL_PACK_COMPRESSED_BLOCK_WIDTH: return GetInt(L, pname); case GL_PACK_IMAGE_HEIGHT: return GetInt(L, pname); case GL_PACK_LSB_FIRST: return GetBoolean(L, pname); case GL_PACK_ROW_LENGTH: return GetInt(L, pname); case GL_PACK_SKIP_IMAGES: return GetInt(L, pname); case GL_PACK_SKIP_PIXELS: return GetInt(L, pname); case GL_PACK_SKIP_ROWS: return GetInt(L, pname); case GL_PACK_SWAP_BYTES: return GetBoolean(L, pname); case GL_PIXEL_PACK_BUFFER_BINDING: return GetInt(L, pname); case GL_PIXEL_UNPACK_BUFFER_BINDING: return GetInt(L, pname); case GL_UNPACK_ALIGNMENT: return GetInt(L, pname); case GL_UNPACK_COMPRESSED_BLOCK_DEPTH: return GetInt(L, pname); case GL_UNPACK_COMPRESSED_BLOCK_HEIGHT: return GetInt(L, pname); case GL_UNPACK_COMPRESSED_BLOCK_SIZE: return GetInt(L, pname); case GL_UNPACK_COMPRESSED_BLOCK_WIDTH: return GetInt(L, pname); case GL_UNPACK_IMAGE_HEIGHT: return GetInt(L, pname); case GL_UNPACK_LSB_FIRST: return GetBoolean(L, pname); case GL_UNPACK_ROW_LENGTH: return GetInt(L, pname); case GL_UNPACK_SKIP_IMAGES: return GetInt(L, pname); case GL_UNPACK_SKIP_PIXELS: return GetInt(L, pname); case GL_UNPACK_SKIP_ROWS: return GetInt(L, pname); case GL_UNPACK_SWAP_BYTES: return GetBoolean(L, pname); /* Programs */ case GL_CURRENT_PROGRAM: return GetInt(L, pname); case GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE: return GetInt(L, pname); case GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES: return GetInt(L, pname); case GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS: return GetInt(L, pname); case GL_MAX_IMAGE_SAMPLES: return GetInt(L, pname); case GL_MAX_IMAGE_UNITS: return GetInt(L, pname); case GL_MAX_PROGRAM_TEXEL_OFFSET: return GetInt(L, pname); case GL_MAX_SHADER_STORAGE_BLOCK_SIZE: return GetInt(L, pname); case GL_MAX_SUBROUTINES: return GetInt(L, pname); case GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS: return GetInt(L, pname); case GL_MAX_UNIFORM_BLOCK_SIZE: return GetInt(L, pname); case GL_MAX_UNIFORM_LOCATIONS: return GetInt(L, pname); case GL_MAX_VARYING_VECTORS: return GetInt(L, pname); case GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET: return GetInt(L, pname); case GL_MAX_VERTEX_ATTRIB_BINDINGS: return GetInt(L, pname); case GL_MAX_VERTEX_ATTRIB_STRIDE: return GetInt(L, pname); case GL_MIN_PROGRAM_TEXEL_OFFSET: return GetInt(L, pname); case GL_NUM_PROGRAM_BINARY_FORMATS: return GetInt(L, pname); case GL_NUM_SHADER_BINARY_FORMATS: return GetInt(L, pname); case GL_PROGRAM_BINARY_FORMATS: return GetIntN(L, pname, GL_NUM_PROGRAM_BINARY_FORMATS); case GL_PROGRAM_PIPELINE_BINDING: return GetInt(L, pname); case GL_SHADER_BINARY_FORMATS: return GetEnumN(L, pname, GL_NUM_SHADER_BINARY_FORMATS, DOMAIN_SHADER_BINARY_FORMAT); //GL_VERSION_4_6 case GL_SHADER_COMPILER: return GetBoolean(L, pname); case GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT: return GetInt(L, pname); case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT: return GetInt(L, pname); /* Provoking Vertices */ case GL_VIEWPORT_INDEX_PROVOKING_VERTEX: return GetEnum(L, pname, DOMAIN_PROVOKE_MODE); case GL_LAYER_PROVOKING_VERTEX: return GetEnum(L, pname, DOMAIN_PROVOKE_MODE); case GL_PROVOKING_VERTEX: return GetEnum(L, pname, DOMAIN_PROVOKE_MODE); /* Rasterization */ case GL_ALIASED_LINE_WIDTH_RANGE: return GetFloat2(L, pname); case GL_CULL_FACE: return GetBoolean(L, pname); case GL_CULL_FACE_MODE: return GetEnum(L, pname, DOMAIN_CULL_FACE_MODE); case GL_FRONT_FACE: return GetEnum(L, pname, DOMAIN_FRONT_FACE_MODE); case GL_LINE_SMOOTH: return GetBoolean(L, pname); case GL_LINE_WIDTH: return GetFloat(L, pname); case GL_POINT_FADE_THRESHOLD_SIZE: return GetFloat(L, pname); case GL_POINT_SIZE: return GetFloat(L, pname); case GL_POINT_SIZE_GRANULARITY: return GetFloat(L, pname); case GL_POINT_SIZE_RANGE: return GetFloat2(L, pname); case GL_POINT_SPRITE_COORD_ORIGIN: return GetEnum(L, pname, DOMAIN_ORIGIN); case GL_POLYGON_MODE: return GetEnum2(L, pname, DOMAIN_POLYGON_MODE_MODE); case GL_POLYGON_OFFSET_FACTOR: return GetFloat(L, pname); case GL_POLYGON_OFFSET_FILL: return GetBoolean(L, pname); case GL_POLYGON_OFFSET_LINE: return GetBoolean(L, pname); case GL_POLYGON_OFFSET_POINT: return GetBoolean(L, pname); case GL_POLYGON_OFFSET_CLAMP: return GetFloat(L, pname); //GL_VERSION_4_6 case GL_POLYGON_OFFSET_UNITS: return GetFloat(L, pname); case GL_POLYGON_SMOOTH: return GetBoolean(L, pname); case GL_PROGRAM_POINT_SIZE: return GetBoolean(L, pname); case GL_RASTERIZER_DISCARD: return GetBoolean(L, pname); case GL_SMOOTH_LINE_WIDTH_RANGE: return GetFloat2(L, pname); case GL_SMOOTH_LINE_WIDTH_GRANULARITY: return GetFloat(L, pname); case GL_SUBPIXEL_BITS: return GetInt(L, pname); /* Shader Execution */ case GL_FRAGMENT_INTERPOLATION_OFFSET_BITS: return GetInt(L, pname); case GL_MAX_FRAGMENT_INTERPOLATION_OFFSET: return GetFloat(L, pname); case GL_MIN_FRAGMENT_INTERPOLATION_OFFSET: return GetFloat(L, pname); /* Shaders */ case GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS: case GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS: case GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS: case GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS: case GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS: case GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS: case GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS: case GL_MAX_COMBINED_ATOMIC_COUNTERS: case GL_MAX_COMPUTE_ATOMIC_COUNTERS: case GL_MAX_FRAGMENT_ATOMIC_COUNTERS: case GL_MAX_GEOMETRY_ATOMIC_COUNTERS: case GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS: case GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS: case GL_MAX_VERTEX_ATOMIC_COUNTERS: case GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS: case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: case GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS: case GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS: case GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS: case GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: case GL_MAX_COMBINED_IMAGE_UNIFORMS: case GL_MAX_COMPUTE_IMAGE_UNIFORMS: case GL_MAX_FRAGMENT_IMAGE_UNIFORMS: case GL_MAX_GEOMETRY_IMAGE_UNIFORMS: case GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS: case GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS: case GL_MAX_VERTEX_IMAGE_UNIFORMS: case GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS: case GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS: case GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS: case GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS: case GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS: case GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS: case GL_MAX_COMPUTE_UNIFORM_COMPONENTS: case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS: case GL_MAX_GEOMETRY_UNIFORM_COMPONENTS: case GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS: case GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS: case GL_MAX_VERTEX_UNIFORM_COMPONENTS: case GL_MAX_TEXTURE_IMAGE_UNITS: case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: case GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS: case GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS: case GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS: case GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS: case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: case GL_MAX_COMBINED_UNIFORM_BLOCKS: case GL_MAX_COMPUTE_UNIFORM_BLOCKS: case GL_MAX_FRAGMENT_UNIFORM_BLOCKS: case GL_MAX_GEOMETRY_UNIFORM_BLOCKS: case GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS: case GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS: case GL_MAX_VERTEX_UNIFORM_BLOCKS: return GetInt(L, pname); /* Compute Shaders */ case GL_DISPATCH_INDIRECT_BUFFER_BINDING: return GetInt(L, pname); case GL_MAX_COMPUTE_SHARED_MEMORY_SIZE: return GetInt(L, pname); case GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS: return GetInt(L, pname); case GL_MAX_COMPUTE_WORK_GROUP_COUNT: return GetIntIndex(L, pname); case GL_MAX_COMPUTE_WORK_GROUP_SIZE: return GetIntIndex(L, pname); /* Fragment Shaders */ case GL_MAX_FRAGMENT_INPUT_COMPONENTS: return GetInt(L, pname); case GL_MAX_FRAGMENT_UNIFORM_VECTORS: return GetInt(L, pname); case GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET: return GetInt(L, pname); case GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET: return GetInt(L, pname); /* Geometry Shaders */ case GL_MAX_GEOMETRY_INPUT_COMPONENTS: return GetInt(L, pname); case GL_MAX_GEOMETRY_OUTPUT_COMPONENTS: return GetInt(L, pname); case GL_MAX_GEOMETRY_OUTPUT_VERTICES: return GetInt(L, pname); case GL_MAX_GEOMETRY_SHADER_INVOCATIONS: return GetInt(L, pname); case GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS: return GetInt(L, pname); case GL_MAX_VERTEX_STREAMS: return GetInt(L, pname); /* Tessellation Control Shaders */ case GL_MAX_PATCH_VERTICES: return GetInt(L, pname); case GL_MAX_TESS_CONTROL_INPUT_COMPONENTS: return GetInt(L, pname); case GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS: return GetInt(L, pname); case GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS: return GetInt(L, pname); case GL_MAX_TESS_GEN_LEVEL: return GetInt(L, pname); case GL_MAX_TESS_PATCH_COMPONENTS: return GetInt(L, pname); case GL_PATCH_DEFAULT_INNER_LEVEL: return GetFloat2(L, pname); case GL_PATCH_DEFAULT_OUTER_LEVEL: return GetFloat4(L, pname); case GL_PATCH_VERTICES: return GetInt(L, pname); /* Tessellation Evaluation Shaders */ case GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS: return GetInt(L, pname); case GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS: return GetInt(L, pname); /* Vertex Shaders */ case GL_MAX_VERTEX_ATTRIBS: return GetInt(L, pname); case GL_MAX_VERTEX_OUTPUT_COMPONENTS: return GetInt(L, pname); case GL_MAX_VERTEX_UNIFORM_VECTORS: return GetInt(L, pname); /* Textures */ case GL_ACTIVE_TEXTURE: return GetActiveTexture(L, pname); case GL_COMPRESSED_TEXTURE_FORMATS: return GetEnumN(L, pname, GL_NUM_COMPRESSED_TEXTURE_FORMATS, DOMAIN_INTERNAL_FORMAT); case GL_MAX_3D_TEXTURE_SIZE: return GetInt(L, pname); case GL_MAX_ARRAY_TEXTURE_LAYERS: return GetInt(L, pname); case GL_MAX_CUBE_MAP_TEXTURE_SIZE: return GetInt(L, pname); case GL_MAX_RECTANGLE_TEXTURE_SIZE: return GetInt(L, pname); case GL_MAX_RENDERBUFFER_SIZE: return GetInt(L, pname); case GL_MAX_TEXTURE_BUFFER_SIZE: return GetInt(L, pname); case GL_MAX_TEXTURE_LOD_BIAS: return GetFloat(L, pname); case GL_MAX_TEXTURE_SIZE: return GetInt(L, pname); case GL_MAX_TEXTURE_MAX_ANISOTROPY: return GetFloat(L, pname); //GL_VERSION_4_6 case GL_NUM_COMPRESSED_TEXTURE_FORMATS: return GetInt(L, pname); case GL_SAMPLER_BINDING: return GetInt(L, pname); case GL_TEXTURE_BINDING_1D: return GetInt(L, pname); case GL_TEXTURE_BINDING_1D_ARRAY: return GetInt(L, pname); case GL_TEXTURE_BINDING_2D: return GetInt(L, pname); case GL_TEXTURE_BINDING_2D_ARRAY: return GetInt(L, pname); case GL_TEXTURE_BINDING_2D_MULTISAMPLE: return GetInt(L, pname); case GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY: return GetInt(L, pname); case GL_TEXTURE_BINDING_3D: return GetInt(L, pname); case GL_TEXTURE_BINDING_BUFFER: return GetInt(L, pname); case GL_TEXTURE_BINDING_CUBE_MAP: return GetInt(L, pname); case GL_TEXTURE_BINDING_RECTANGLE: return GetInt(L, pname); case GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT: return GetInt(L, pname); case GL_TEXTURE_CUBE_MAP_SEAMLESS: return GetBoolean(L, pname); /* Transformation State */ case GL_CLIP_DISTANCE0: case GL_CLIP_DISTANCE1: case GL_CLIP_DISTANCE2: case GL_CLIP_DISTANCE3: case GL_CLIP_DISTANCE4: case GL_CLIP_DISTANCE5: case GL_CLIP_DISTANCE6: case GL_CLIP_DISTANCE7: return GetBoolean(L, pname); case GL_DEPTH_CLAMP: return GetBoolean(L, pname); case GL_DEPTH_RANGE: return GetFloat2(L, pname); case GL_MAX_CLIP_DISTANCES: return GetInt(L, pname); case GL_MAX_VIEWPORT_DIMS: return GetFloat2(L, pname); case GL_MAX_VIEWPORTS: return GetInt(L, pname); case GL_TRANSFORM_FEEDBACK_BINDING: return GetInt(L, pname); case GL_VIEWPORT: return GetInt4OptIndex(L, pname); case GL_VIEWPORT_BOUNDS_RANGE: return GetFloat2(L, pname); case GL_VIEWPORT_SUBPIXEL_BITS: return GetInt(L, pname); /* Vertex Arrays */ case GL_MAX_ELEMENT_INDEX: return GetInt(L, pname); case GL_MAX_ELEMENTS_INDICES: return GetInt(L, pname); case GL_MAX_ELEMENTS_VERTICES: return GetInt(L, pname); case GL_PRIMITIVE_RESTART: return GetBoolean(L, pname); case GL_PRIMITIVE_RESTART_FIXED_INDEX: return GetBoolean(L, pname); case GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED: return GetBoolean(L, pname); case GL_PRIMITIVE_RESTART_INDEX: return GetInt(L, pname); case GL_VERTEX_BINDING_DIVISOR: return GetIntIndex(L, pname); case GL_VERTEX_BINDING_OFFSET: return GetIntIndex(L, pname); case GL_VERTEX_BINDING_STRIDE: return GetIntIndex(L, pname); // case GL_MAX_VARYING_COMPONENTS = GL_MAX_VARYING_FLOATS case GL_MAX_VARYING_FLOATS: return GetInt(L, pname); case GL_RESET_NOTIFICATION_STRATEGY: return GetEnum(L, pname, DOMAIN_RESET_NOTIFICATION_STRATEGY); default: luaL_error(L, UNEXPECTED_ERROR); } return 0; }
static int CheckboxIsValid (lua_State * L) { return GetBoolean(L, Checkbox_IsValid); }
static int TextboxIsSpotClickAllowed (lua_State * L) { return GetBoolean(L, Textbox_IsSpotClickAllowed); }
static int ListboxIsDragOverAllowed (lua_State * L) { return GetBoolean(L, Listbox_IsDragOverAllowed); }
static int TextboxIsValid (lua_State * L) { return GetBoolean(L, Textbox_IsValid); }
static int ListboxIsValid (lua_State * L) { return GetBoolean(L, Listbox_IsValid); }
static int UserInterfaceIsFrameSlotValid (lua_State * L) { return GetBoolean(L, UserInterface_IsFrameSlotValid); }
static int PaneIsDragAllowed (lua_State * L) { return GetBoolean(L, Pane_IsDragAllowed); }
static int WidgetIsLoaded (lua_State * L) { return GetBoolean(L, Widget_IsLoaded); }
static int PaneIsLoaded (lua_State * L) { return GetBoolean(L, Pane_IsLoaded); }
static int WidgetIsValid (lua_State * L) { return GetBoolean(L, Widget_IsValid); }
static int PaneItemIsFocusChainItem (lua_State * L) { return GetBoolean(L, PaneItem_IsFocusChainItem); }
bool AnimaRenderer::GetBoolean(const char* propertyName) { AnimaString str(propertyName, _allocator); return GetBoolean(str); }