Ejemplo n.º 1
0
void lex_FacName(const char *FacName)
{
  sFacilityCB *facp = (sFacilityCB *)calloc(1, sizeof(sFacilityCB));

  LstIni(&facp->MsgH);
  facp->f.FacName = MSG_NEW_STRING(FacName);

  LstIns(&lFacH, facp, FacL);

}
Ejemplo n.º 2
0
void lex_MsgName(const char *MsgName)
{
  sMsgCB *msgp = (sMsgCB *)calloc(1, sizeof(sMsgCB));
  int i;
  int len = strlen(MsgName);
  msgp->m.MsgName = malloc(len + 1);

  for (i = 0; i < len; i++)
    msgp->m.MsgName[i] = toupper(MsgName[i]);
  msgp->m.MsgName[i] = '\0';

  (void) LstIns(&LstObj(LstLas(&lFacH))->MsgH, msgp, MsgL);

}
Ejemplo n.º 3
0
static void detect (
  pwr_sClass_NodeLinkSup *o,
  pwr_tBoolean con,
  sNode *np
)
{

  /* For DSup we compare with control position, but for NodeLink
     we only detect LinkDown  */

  if (o->LinkUp) {
    if (o->Action) o->Action = FALSE;
    if (o->ReturnCheck) {
      time_GetTime(&o->ReturnTime);
      o->ReturnCheck = FALSE;
      o->ReturnSend = TRUE;
    }
    if (o->AlarmCheck && !o->DetectCheck) {
      o->TimerFlag = FALSE;
      o->DetectCheck = TRUE;
    }
  } else if (con) {
    if (!o->Action) o->Action = TRUE;
    if (o->AlarmCheck && o->DetectOn && !o->Blocked) {
      if (o->DetectCheck) {

	o->TimerCount = (o->TimerTime * 1000) / cTimerTimeDetect;
	if (!o->TimerFlag && o->TimerCount > 0) {
	  if (!LstInl(&np->timer_l)) {
	    LstIns(&timer_l, np, timer_l);
	  }
	  o->TimerFlag = TRUE;
	}
	time_GetTime(&o->DetectTime);
	o->DetectCheck = FALSE;
      }
      if (!o->TimerFlag) {
	o->DetectSend = TRUE;
	o->ReturnCheck = TRUE;
	o->Acked = FALSE;
	o->AlarmCheck = FALSE;
      }
    }
  }
}
Ejemplo n.º 4
0
static sTimer *
allocTimer (
)
{
  const int		cAllocCount = 100;
  sTimer		*ftp;
  LstLink(sTimer)	*ftl;
  int			i;

  if (LstEmp(&free_lh)) {
    ftp = (sTimer *) calloc(cAllocCount, sizeof(sTimer));
    for (i=0; i < cAllocCount; i++, ftp++) {
      LstIns(&LstEnd(free_lh), ftp, ll);
    }
  }

  ftl = LstFir(&free_lh);
  LstRem(ftl);
  return LstObj(ftl);
}
Ejemplo n.º 5
0
static void
reinit_nodes ()
{
  pwr_tStatus sts;
  LstLink(sNode) *nl;
  sNode *np;
  pwr_tObjid oid;

  /* Mark all links in the NodeLink list */
  for (nl= LstFir(&node_l); nl != LstEnd(&node_l); nl = LstNex(nl))
    LstObj(nl)->found = FALSE;

  for (
    sts = gdh_GetClassList(pwr_cClass_NodeLinkSup, &oid);
    ODD(sts);
    sts = gdh_GetNextObject(oid, &oid)
  ) {
    if ((np = get_nodes(oid)) == NULL) {
      np = init_node(oid, NULL, 1);
      if (np != NULL) {
	nl = LstIns(nl, np, node_l);
	np->found = TRUE;
      }
    } else {
      update_node(np);
    }
  }

  for (nl = LstFir(&node_l); nl != LstEnd(&node_l); nl = LstNex(nl)) {
    np = LstObj(nl);
    if (!np->found) {
      nl = LstPre(&np->node_l);
      LstRem(&np->node_l);
      LstNul(&np->node_l);
      gdh_SubUnrefObjectInfo (np->o->SubId);
      gdh_DLUnrefObjectInfo(np->dlid);
      free(np);
    }
  }	    
}
Ejemplo n.º 6
0
void lex_FacNum(int facnum)
{
  LstLink(sFacilityCB) *fl;
 
  /*
   * To do: Check that the facility number is within the valid range 
   *
   */
  
  /* Insert in ascending order */
  for (fl = LstFir(&lFacH); fl != LstEnd(&lFacH); fl = LstNex(fl)) {
    if (LstObj(fl)->facnum > facnum) {
      break;
    }
  }


  CurrFac->facnum = facnum;
  LstIns(fl, CurrFac, FacL);
  CurrFac = NULL;

}