void Node::Kill(bool bState) { if(bState) Enabled(false); else Enabled(m_bInitEnabled); }
static int ipv6cp_LayerUp(struct fsm *fp) { /* We're now up */ struct ipv6cp *ipv6cp = fsm2ipv6cp(fp); char tbuff[40]; log_Printf(LogIPV6CP, "%s: LayerUp.\n", fp->link->name); if (!ipv6cp_InterfaceUp(ipv6cp)) return 0; snprintf(tbuff, sizeof tbuff, "%s", ncpaddr_ntoa(&ipv6cp->myaddr)); log_Printf(LogIPV6CP, "myaddr %s hisaddr = %s\n", tbuff, ncpaddr_ntoa(&ipv6cp->hisaddr)); #ifndef NORADIUS radius_Account_Set_Ipv6(&fp->bundle->radacct6, ipv6cp->his_ifid); radius_Account(&fp->bundle->radius, &fp->bundle->radacct6, fp->bundle->links, RAD_START, &ipv6cp->throughput); /* * XXX: Avoid duplicate evaluation of filterid between IPCP and * IPV6CP. When IPCP is enabled and rejected, filterid is not * evaluated. */ if (!Enabled(fp->bundle, OPT_IPCP)) { if (fp->bundle->radius.cfg.file && fp->bundle->radius.filterid) system_Select(fp->bundle, fp->bundle->radius.filterid, LINKUPFILE, NULL, NULL); } #endif /* * XXX this stuff should really live in the FSM. Our config should * associate executable sections in files with events. */ if (system_Select(fp->bundle, tbuff, LINKUPFILE, NULL, NULL) < 0) { /* * XXX: Avoid duplicate evaluation of label between IPCP and * IPV6CP. When IPCP is enabled and rejected, label is not * evaluated. */ if (bundle_GetLabel(fp->bundle) && !Enabled(fp->bundle, OPT_IPCP)) { if (system_Select(fp->bundle, bundle_GetLabel(fp->bundle), LINKUPFILE, NULL, NULL) < 0) system_Select(fp->bundle, "MYADDR6", LINKUPFILE, NULL, NULL); } else system_Select(fp->bundle, "MYADDR6", LINKUPFILE, NULL, NULL); } fp->more.reqs = fp->more.naks = fp->more.rejs = ipv6cp->cfg.fsm.maxreq * 3; log_DisplayPrompts(); return 1; }
static void BundNcpsUp(Bund b) { if (Enabled(&b->conf.options, BUND_CONF_IPCP)) IpcpUp(b); if (Enabled(&b->conf.options, BUND_CONF_IPV6CP)) Ipv6cpUp(b); if (Enabled(&b->conf.options, BUND_CONF_COMPRESSION)) CcpUp(b); if (Enabled(&b->conf.options, BUND_CONF_ENCRYPTION)) EcpUp(b); }
static void ipv6cp_LayerDown(struct fsm *fp) { /* About to come down */ struct ipv6cp *ipv6cp = fsm2ipv6cp(fp); static int recursing; char addr[40]; if (!recursing++) { snprintf(addr, sizeof addr, "%s", ncpaddr_ntoa(&ipv6cp->myaddr)); log_Printf(LogIPV6CP, "%s: LayerDown: %s\n", fp->link->name, addr); #ifndef NORADIUS radius_Flush(&fp->bundle->radius); radius_Account(&fp->bundle->radius, &fp->bundle->radacct6, fp->bundle->links, RAD_STOP, &ipv6cp->throughput); /* * XXX: Avoid duplicate evaluation of filterid between IPCP and * IPV6CP. When IPCP is enabled and rejected, filterid is not * evaluated. */ if (!Enabled(fp->bundle, OPT_IPCP)) { if (fp->bundle->radius.cfg.file && fp->bundle->radius.filterid) system_Select(fp->bundle, fp->bundle->radius.filterid, LINKDOWNFILE, NULL, NULL); } #endif /* * XXX this stuff should really live in the FSM. Our config should * associate executable sections in files with events. */ if (system_Select(fp->bundle, addr, LINKDOWNFILE, NULL, NULL) < 0) { /* * XXX: Avoid duplicate evaluation of label between IPCP and * IPV6CP. When IPCP is enabled and rejected, label is not * evaluated. */ if (bundle_GetLabel(fp->bundle) && !Enabled(fp->bundle, OPT_IPCP)) { if (system_Select(fp->bundle, bundle_GetLabel(fp->bundle), LINKDOWNFILE, NULL, NULL) < 0) system_Select(fp->bundle, "MYADDR6", LINKDOWNFILE, NULL, NULL); } else system_Select(fp->bundle, "MYADDR6", LINKDOWNFILE, NULL, NULL); } ipv6cp_Setup(ipv6cp); } recursing--; }
/// SimpleMarkText() static void SimpleMarkText(struct InstData *data, LONG startx, struct line_node *startline, LONG stopx, struct line_node *stopline) { ENTER(); if(Enabled(data)) { data->blockinfo.enabled = FALSE; MarkText(data, data->blockinfo.startx, data->blockinfo.startline, data->blockinfo.stopx, data->blockinfo.stopline); } // else { SetCursor(data, data->CPos_X, data->actualline, FALSE); } data->blockinfo.startline = startline; data->blockinfo.startx = startx; data->blockinfo.stopline = data->actualline = stopline; data->blockinfo.stopx = data->CPos_X = stopx; data->blockinfo.enabled = TRUE; ScrollIntoDisplay(data); MarkText(data, startx, startline, stopx, stopline); LEAVE(); }
void InverseMuscleCurrent::Load(CStdXml &oXml) { VerifySystemPointers(); oXml.IntoElem(); //Into Item Element m_strID = Std_CheckString(oXml.GetChildString("ID")); if(Std_IsBlank(m_strID)) THROW_ERROR(Al_Err_lIDBlank, Al_Err_strIDBlank); m_strName = oXml.GetChildString("Name", ""); //This will add this object to the object list of the simulation. m_lpSim->AddToObjectList(this); TargetNodeID(oXml.GetChildString("TargetNodeID")); AlwaysActive(oXml.GetChildBool("AlwaysActive", m_bAlwaysActive)); Enabled(oXml.GetChildBool("Enabled", m_bEnabled)); MuscleID(oXml.GetChildString("MuscleID", "")); MuscleLengthData(oXml.GetChildString("LengthData", "")); Conductance(oXml.GetChildFloat("Conductance", m_fltConductance)); RestPotential(oXml.GetChildFloat("RestPotential", m_fltRestPotential)); oXml.OutOfElem(); //OutOf Simulus Element }
static void physical_Found(struct physical *p) { FILE *lockfile; char fn[PATH_MAX]; if (*p->name.full == '/') { snprintf(fn, sizeof fn, "%s%s.if", _PATH_VARRUN, p->name.base); lockfile = ID0fopen(fn, "w"); if (lockfile != NULL) { fprintf(lockfile, "%s%d\n", TUN_NAME, p->dl->bundle->unit); fclose(lockfile); } #ifndef RELEASE_CRUNCH else log_Printf(LogALERT, "%s: Can't create %s: %s\n", p->link.name, fn, strerror(errno)); #endif } throughput_start(&p->link.stats.total, "physical throughput", Enabled(p->dl->bundle, OPT_THROUGHPUT)); p->connect_count++; p->input.sz = 0; log_Printf(LogPHASE, "%s: Connected!\n", p->link.name); }
static struct mbuf * tcpmss_Check(struct bundle *bundle, struct mbuf *bp) { struct ip *pip; size_t hlen, plen; if (!Enabled(bundle, OPT_TCPMSSFIXUP)) return bp; bp = m_pullup(bp); plen = m_length(bp); pip = (struct ip *)MBUF_CTOP(bp); hlen = pip->ip_hl << 2; /* * Check for MSS option only for TCP packets with zero fragment offsets * and correct total and header lengths. */ if (pip->ip_p == IPPROTO_TCP && (ntohs(pip->ip_off) & IP_OFFMASK) == 0 && ntohs(pip->ip_len) == plen && hlen <= plen && plen >= sizeof(struct tcphdr) + hlen) MSSFixup((struct tcphdr *)(MBUF_CTOP(bp) + hlen), plen - hlen, MAXMSS(bundle->iface->mtu)); return bp; }
void cUIControlAnim::DisableFadeOut( const cTime& Time, const bool& AlphaChilds, const Ease::Interpolation& Type ) { Enabled( false ); StartAlphaAnim ( mAlpha, 0.f, Time, AlphaChilds, Type ); mControlFlags |= UI_CTRL_FLAG_DISABLE_FADE_OUT; }
void GColourSelect::OnPaint(GSurface *pDC) { GDropDown::OnPaint(pDC); GRect r = GetClient(); r.x2 -= 14; r.Size(5, 5); if (IsOpen()) r.Offset(1, 1); bool HasColour = Enabled() && c32 != 0; pDC->Colour(HasColour ? LC_BLACK : LC_LOW, 24); pDC->Box(&r); r.Size(1, 1); pDC->Colour(HasColour ? c32 : Rgb24To32(LC_LOW), 32); if (HasColour) { pDC->Rectangle(&r); } else { pDC->Line(r.x1, r.y1, r.x2, r.y2); pDC->Line(r.x1, r.y2, r.x2, r.y1); } }
// // Note: This method is from ViewerToggleAction but was transplanted // here to ensure that the action was updated. When using the // immediate base class's Update method the popup menu was not // updating on some platforms. // void SetToolbarIconSizeActionUI::Update() { // Update the action's enabled state. bool actionShouldBeEnabled = Enabled(); if(action->isEnabled() != actionShouldBeEnabled) action->setEnabled(actionShouldBeEnabled); // Update the action's toggled state if it is a toggle action. if(action->isCheckable()) { bool actionShouldBeToggled = Checked(); if(toggled != actionShouldBeToggled) { // Set the appropriate icon into the action. if (!GetViewerProperties()->GetNowin() && !action->icon().isNull()) { if(actionShouldBeToggled) SetIcon(QIcon(*toggledIcon)); else SetIcon(QIcon(*regularIcon)); } action->blockSignals(true); action->setChecked(actionShouldBeToggled); action->blockSignals(false); } toggled = actionShouldBeToggled; } }
static void CcpConfigure(Fsm fp) { Bund b = (Bund)fp->arg; CcpState const ccp = &b->ccp; int k; /* Reset state */ ccp->self_reject = 0; ccp->peer_reject = 0; ccp->crypt_check = 0; ccp->xmit = NULL; ccp->recv = NULL; for (k = 0; k < CCP_NUM_PROTOS; k++) { CompType const ct = gCompTypes[k]; if (ct->Configure) { if ((*ct->Configure)(b)) { if (Enabled(&ccp->options, k)) { Log(LG_CCP, ("[%s] CCP: Protocol %s disabled " "as useless for this setup", b->name, ct->name)); } CCP_SELF_REJ(ccp, k); }; } } }
void BundOpenLinks(Bund b) { int k; TimerStop(&b->reOpenTimer); if (Enabled(&b->conf.options, BUND_CONF_BWMANAGE)) { if (b->n_links != 0) return; for (k = 0; k < NG_PPP_MAX_LINKS; k++) { if (b->links[k]) { BundOpenLink(b->links[k]); break; } else if (b->conf.linkst[k][0]) { BundCreateOpenLink(b, k); break; } } } else { for (k = 0; k < NG_PPP_MAX_LINKS; k++) { if (b->links[k]) BundOpenLink(b->links[k]); else if (b->conf.linkst[k][0]) BundCreateOpenLink(b, k); } } }
bool RobotInterface::SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError) { std::string strType = Std_CheckString(strDataType); if(strType == "ENABLED") { Enabled(Std_ToBool(strValue)); return true; } if(strType == "PHYSICSTIMESTEP") { PhysicsTimeStep((float) atof(strValue.c_str())); return true; } if(strType == "SYNCHSIM") { SynchSim(Std_ToBool(strValue)); return true; } if(AnimatBase::SetData(strType, strValue, false)) return true; //If it was not one of those above then we have a problem. if(bThrowError) THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType, "Data Type", strDataType); return false; }
void CLuaDepScreen::CoreUpdateList() { if (!Enabled()) { Enable(true); NNCurses::TUI.ActivateGroup(this); } m_pTextField->ClearText(); for (TDepList::const_iterator it=GetDepList().begin(); it!=GetDepList().end(); it++) { m_pTextField->AddText(CreateText("%s: %s\n", GetTranslation("Name"), GetTranslation(it->name).c_str())); if (!it->description.empty()) m_pTextField->AddText(CreateText("%s: %s\n", GetTranslation("Description"), GetTranslation(it->description).c_str())); m_pTextField->AddText(CreateText("%s: %s\n\n", GetTranslation("Problem"), GetTranslation(it->problem).c_str())); } if (GetDepList().empty()) m_bClose = true; }
void Init() { if (!Enabled()) return; gmlShareLists = configHandler->GetBool("MultiThreadShareLists"); if (!gmlShareLists) { gmlMaxServerThreadNum = GML_LOAD_THREAD_NUM; gmlMaxShareThreadNum = GML_LOAD_THREAD_NUM; gmlNoGLThreadNum = GML_SIM_THREAD_NUM; } gmlThreadCountOverride = configHandler->GetInt("MultiThreadCount"); gmlThreadCount = GML_CPU_COUNT; if (gmlShareLists) { // create offscreen OpenGL contexts for (int i = 0; i < gmlThreadCount; ++i) ogc[i] = new COffscreenGLContext(); } gmlProcessor = new gmlClientServer<void, int, CUnit*>; #if GML_ENABLE_SIM gmlMultiThreadSim = configHandler->GetBool("MultiThreadSim"); gmlKeepRunning = true; gmlStartSim = false; // start sim thread gmlProcessor->AuxWork(&gmlSimLoop, NULL); #endif }
void Node::ResetSimulation() { AnimatBase::ResetSimulation(); //Reset the enabled state to the value that it had before the sim started. //It is possible that stimuli turned off the enabled state during the simulation. Enabled(m_bInitEnabled); }
float AxisBinding::GetValue() { if (!Enabled()) return 0.0f; float value = Pi::JoystickAxisState(joystick, axis); if (direction == POSITIVE) return value; else return -value; }
void CWidget::Draw() { assert(Enabled()); if (!m_bInitialized) { Init(); m_bInitialized = true; } CoreDraw(); }
bool cUIMenu::Hide() { Enabled( false ); Visible( false ); if ( NULL != mItemSelected ) mItemSelected->SetSkinState( cUISkinState::StateNormal ); mItemSelected = NULL; mItemSelectedIndex = eeINDEX_NOT_FOUND; return true; }
void CToolbar::EnableAll(BOOL fEnable, ...) { va_list argptr; va_start(argptr, fEnable); INT * idList = (INT*) argptr; for(INT i = 0; idList[i]; ++i) Enabled(idList[i], fEnable); va_end(argptr); }
// ----------------------------------------------------------------------------- // CMceMediaSink::DoEnableL // ----------------------------------------------------------------------------- // void CMceMediaSink::DoEnableL() { if ( MCE_ENDPOINT_ITC_ALLOWED( *this ) ) { DoITCSendL( EMceItcEnable, ETrue ); } else { MCECLI_DEBUG("CMceMediaSink::DoEnableL, done locally"); Enabled( ETrue ); } }
static void ipv6cp_LayerStart(struct fsm *fp) { /* We're about to start up ! */ struct ipv6cp *ipv6cp = fsm2ipv6cp(fp); log_Printf(LogIPV6CP, "%s: LayerStart.\n", fp->link->name); throughput_start(&ipv6cp->throughput, "IPV6CP throughput", Enabled(fp->bundle, OPT_THROUGHPUT)); fp->more.reqs = fp->more.naks = fp->more.rejs = ipv6cp->cfg.fsm.maxreq * 3; ipv6cp->peer_tokenreq = 0; }
void Menu::Popup(Event& e) { if (Enabled()) { World* w; IntCoord wx, wy; e.GetAbsolute(w, wx, wy); if (w != world_) { world_ = w; Setup(); } InsertBody(wx - rel_x_, wy - rel_y_); State()->Selection(this); } }
bool SimThreadRunning() { if (!Enabled()) return false; #if GML_ENABLE_SIM if (!gmlStartSim && gmlMultiThreadSim && gs->frameNum > 0) { gmlStartSim = true; } return (gmlStartSim && gmlMultiThreadSim); #else return false; #endif }
void VsSpring::SetupPhysics() { if(m_vxSpring) DeletePhysics(); if(m_aryAttachmentPoints.GetSize() == 2) { Attachment *lpPrimaryAttachment = m_aryAttachmentPoints[0]; Attachment *lpSecondaryAttachment = m_aryAttachmentPoints[1]; if(!lpPrimaryAttachment && !lpSecondaryAttachment) { Enabled(false); return; } VsRigidBody *lpVsPrimary = dynamic_cast<VsRigidBody *>(lpPrimaryAttachment->Parent()); VsRigidBody *lpVsSecondary = dynamic_cast<VsRigidBody *>(lpSecondaryAttachment->Parent()); if(!lpVsPrimary && !lpVsSecondary) { Enabled(false); return; } m_vxSpring = new AnimatVxSpring(lpVsPrimary->Part(), lpVsSecondary->Part(), m_fltNaturalLength, m_fltStiffness, m_fltDamping); // attached to the reference frame. CStdFPoint vPrimPos = lpPrimaryAttachment->AbsolutePosition(); CStdFPoint vSecPos = lpSecondaryAttachment->AbsolutePosition(); m_vxSpring->setPartAttachmentPosition(0, vPrimPos.x, vPrimPos.y, vPrimPos.z); m_vxSpring->setPartAttachmentPosition(1, vSecPos.x, vSecPos.y, vSecPos.z); m_vxSpring->enable(m_bEnabled); GetVsSimulator()->Universe()->addConstraint(m_vxSpring); } else Enabled(false); }
int auth_Validate(struct bundle *bundle, const char *name, const char *key, struct physical *physical) { /* Used by PAP routines */ FILE *fp; int n, lineno; char *vector[5], buff[LINE_LEN]; const char *slash; fp = OpenSecret(SECRETFILE); again: lineno = 0; if (fp != NULL) { while (fgets(buff, sizeof buff, fp)) { lineno++; if (buff[0] == '#') continue; buff[strcspn(buff, "\n")] = '\0'; memset(vector, '\0', sizeof vector); if ((n = MakeArgs(buff, vector, VECSIZE(vector), PARSE_REDUCE)) < 0) log_Printf(LogWARN, "%s: %d: Invalid line\n", SECRETFILE, lineno); if (n < 2) continue; if (strcmp(vector[0], name) == 0) { CloseSecret(fp); return auth_CheckPasswd(name, vector[1], key); } } } if ((slash = strrchr(name, '\\')) != NULL && slash[1]) { /* Look for the name without the leading domain */ name = slash + 1; if (fp != NULL) { rewind(fp); goto again; } } if (fp != NULL) CloseSecret(fp); #ifndef NOPASSWDAUTH if (Enabled(bundle, OPT_PASSWDAUTH)) return auth_CheckPasswd(name, "*", key); #endif return 0; /* Invalid */ }
static void ChangeConfigControls (NetConfigPtr ncp) { Boolean hasProxy; Int2 val; if (ncp == NULL) return; val = GetValue (ncp->srvConnMode); if (val == 1) { SafeHide (ncp->netGroup); } if (val == 3) { if (! Enabled (ncp->proxyHost)) { SafeSetTitle (ncp->proxyHost, ncp->proxyValue); } Enable (ncp->proxyHost); if (! Enabled (ncp->firewallProxy)) { SafeSetTitle (ncp->firewallProxy, ncp->firewallValue); } Enable (ncp->firewallProxy); } else { if (Enabled (ncp->proxyHost)) { GetTitle (ncp->proxyHost, ncp->proxyValue, sizeof (ncp->proxyValue)); SafeSetTitle (ncp->proxyHost, NULL); } Disable (ncp->proxyHost); if (Enabled (ncp->firewallProxy)) { GetTitle (ncp->firewallProxy, ncp->firewallValue, sizeof (ncp->firewallValue)); SafeSetTitle (ncp->firewallProxy, NULL); } Disable (ncp->firewallProxy); } hasProxy = (Boolean) (! TextHasNoText (ncp->proxyHost)); if (hasProxy) { if (! Enabled (ncp->proxyHost)) { SafeSetTitle (ncp->proxyHost, ncp->proxyValue); } Enable (ncp->proxyHost); if (! Enabled (ncp->proxyPort)) { SafeSetTitle (ncp->proxyPort, ncp->portValue); } Enable (ncp->proxyPort); } else { if (Enabled (ncp->proxyPort)) { GetTitle (ncp->proxyPort, ncp->portValue, sizeof (ncp->portValue)); SafeSetTitle (ncp->proxyPort, NULL); } Disable (ncp->proxyPort); } if (val != 1) { SafeShow (ncp->netGroup); } }
// ----------------------------------------------------------------------------- // CMceMediaSink::DoDisableL // ----------------------------------------------------------------------------- // void CMceMediaSink::DoDisableL() { if ( MCE_ENDPOINT_ITC_ALLOWED( *this ) ) { __ASSERT_ALWAYS( iStream->State() != CMceMediaStream::ETranscodingRequired, User::Leave( KErrNotReady ) ); DoITCSendL( EMceItcDisable, EFalse ); } else { Enabled( EFalse ); MCECLI_DEBUG("CMceMediaSink::DoDisableL, done locally"); } }
void GCommand::Enabled(bool e) { if (Enabled() != e) { if (ToolButton) { ToolButton->Enabled(e); } if (MenuItem) { MenuItem->Enabled(e); } } }