コード例 #1
0
ファイル: atm.c プロジェクト: Nymphetaminer/dsl-n55u
static void 
atm_init1(void)
{
  set_var_str(&atm_unit, "version", rcsid);

  Debug_unit(&atm_unit,"Initialized");
}
コード例 #2
0
ファイル: connect.c プロジェクト: earthGavinLee/hg556a_source
/* Initialization for data that needs other units */
static void
conn_init1(void)
{
  set_var_str(&conn_unit, "version", rcsid);
  conn_main();
  add_event_handler(CE_DATA, &data_handler, "data_handler", NULL);
  add_event_handler(CE_TIMER, &timer_handler, "timer_handler", NULL);
  Debug_unit(&conn_unit, "Initialized.");
}
コード例 #3
0
ファイル: load.c プロジェクト: earthGavinLee/hg556a_source
/* Initialization for data that needs other units */
static void
load_init1(void)
{
  set_var_str(&load_unit, "version", rcsid);
  /*
   * Load variables from file
   * For example:
   * [main]
   * debug=True
   * memdebug=True
   * [conn]
   * #S4, Join Timeout, s
   * S4=60
   */
  load_vars(var_file);

  Debug_unit(&load_unit, "Initialized.");
}
コード例 #4
0
ファイル: connect.c プロジェクト: earthGavinLee/hg556a_source
static void
conn_main(void)
{
  const AtmAddr_t *addr;
  int main_conn;
  const char *str;
  int i;

  addr = get_var_addr(&conn_unit, "S1");
  if (addr == NULL) {
    dump_printf(EL_ERROR, "S1 (LES Address) must be specified");
    event_put(&conn_unit, CE_EXIT, NULL);
  }
  else {
    str = get_var_str(&conn_unit,"S2");
    if (str == NULL) {
      set_var_str(&conn_unit, "S2", S2_default);
    }
    i = get_var_int(&conn_unit,"S3");
    if (i == 0) {
      set_var_int(&conn_unit,"S3", S3_default);
    }
    i = get_var_int(&conn_unit,"S4");
    if (i == 0) {
      set_var_int(&conn_unit,"S4", S4_default);
    }
    i = get_var_int(&conn_unit,"S5");
    if (i == 0) {
      set_var_int(&conn_unit,"S5", S5_default);
    }
    addr = get_var_addr(&conn_unit, "S6");
    if (addr == NULL) {
      dump_printf(EL_ERROR, "S6 (BUS Address) must be specified");
      event_put(&conn_unit, CE_EXIT, NULL);
    } else {
      main_conn = atm_create_socket(CONTROL_DIRECT, 
				    get_var_addr(&conn_unit, "S1"));
      if (main_conn >= 0) {
	(void)conn_add(CT_MAIN, main_conn,0);
      }
    }
  }
}
コード例 #5
0
ファイル: dump.c プロジェクト: ebichu/dd-wrt
/* Initialization for data that needs other units */
static void
dump_init1(void)
{
  set_var_str(&dump_unit, "version", rcsid);
  Debug_unit(&dump_unit, "Initialized.");
}
コード例 #6
0
ファイル: timers.c プロジェクト: MCherifiOSS/stblinux-2.6.37
/* Initialization for data that needs other units */
static void
timer_init1(void)
{
  set_var_str(&timer_unit, "version", rcsid);
  Debug_unit(&timer_unit, "Initialized.");
}
コード例 #7
0
ファイル: load.c プロジェクト: earthGavinLee/hg556a_source
void
load_vars(const char *file)
{
  const Unit_t *curr_unit = NULL;

  int ret = 0;   /* to silence gcc 2.7.2.1 */
  char *varname;
  InitPvc_t *pvc;
  LaneDestList_t *ltmp;
  int read_flag = 1;

  assert(file != NULL);
  Debug_unit(&load_unit, "Loading variables from file %s", file);
  yyin = fopen(file, "r");
  if (!yyin) {
    Debug_unit(&load_unit, "Cannot open file %s: %s", file, strerror(errno));
    return;
  }
  g_buf_index = 0;
  do {
    if (read_flag)
      ret = yylex();
    else
      read_flag =1;
    switch(ret) {
    case END:
      Debug_unit(&load_unit, "EOF");
      break;
    case UNIT:
      Debug_unit(&load_unit, "Got unit %s", g_return.stringgi);
      curr_unit = find_unit(g_return.stringgi);
      if (curr_unit == NULL) {
	Debug_unit(&load_unit, "Unknown unit %s", g_return.stringgi);
      }
      Debug_unit(&load_unit, "Got unit %s", g_return.stringgi);
      mem_free(&load_unit,g_return.stringgi);
      break;
    case VARNAME:
      varname = g_return.stringgi;
      Debug_unit(&load_unit, "Got variable name %s", varname);
      ret = yylex();
      switch(ret) {
      case STRING:
	Debug_unit(&load_unit, "Variable is string: %s", g_return.stringgi);
	set_var_str(curr_unit, varname, g_return.stringgi);
	break;
      case BOOLEAN:
	Debug_unit(&load_unit, "Variable is boolean: %s", 
		   g_return.bool==BL_TRUE?"True":"False");
	set_var_bool(curr_unit, varname, g_return.bool);
	break;
      case INTEGER:
	Debug_unit(&load_unit, "Variable is integer: %d", g_return.intti);
	set_var_int(curr_unit, varname, g_return.intti);
	break;
      case ATMADDRESS:
	Debug_unit(&load_unit, "Variable is atmaddress ");
	dump_atmaddr(g_return.atmaddress);
	set_var_addr(curr_unit, varname, g_return.atmaddress);
	break;
      case LANEDEST:
	Debug_unit(&load_unit, "Invalid variable value for %s", varname);
	mem_free(&load_unit, g_return.destaddr);
	break;
      case UNIT:
	Debug_unit(&load_unit, "Invalid variable value for %s", varname);
	mem_free(&load_unit, g_return.stringgi);
	break;
      case VCC:
	Debug_unit(&load_unit, "Variable is vcc");
	pvc = (InitPvc_t *)mem_alloc(curr_unit, sizeof(InitPvc_t));
	pvc->pvc = (LaneVcc_t *)mem_alloc(curr_unit, sizeof(LaneVcc_t));
	pvc->pvc->port = g_return.vcc.port;
	pvc->pvc->vpi = g_return.vcc.vpi;
	pvc->pvc->vci = g_return.vcc.vci;
	pvc->address = NULL;
	pvc->lecid = 0;
	pvc->destinations = NULL;
	ret = yylex();
	if (ret != ATMADDRESS) {
	  Debug_unit(&load_unit, "Invalid atm_address for pvc %d,%d,%d",
		     pvc->pvc->port, pvc->pvc->vpi, pvc->pvc->vci);
	  switch(ret) {
	  case UNIT:
	  case STRING:
	  case VARNAME:
	    mem_free(&load_unit, g_return.stringgi);
	    break;
	  case LANEDEST:
	    mem_free(&load_unit, g_return.destaddr);
	    break;
	  }
	} else {
	  pvc->address = g_return.atmaddress;
	}
	ret = yylex();
	if (ret != INTEGER) {
	  Debug_unit(&load_unit, "Invalid lecid for pvc %d,%d,%d\n",
		     pvc->pvc->port,pvc->pvc->vpi,pvc->pvc->vci);
	  switch(ret) {
	  case UNIT:
	  case STRING:
	  case VARNAME:
	    mem_free(&load_unit, g_return.stringgi);
	    break;
	  case LANEDEST:
	    mem_free(&load_unit, g_return.destaddr);
	    break;
	  case ATMADDRESS:
	    mem_free(&load_unit, g_return.atmaddress);
	    break;
	  }
	} else {
	  pvc->lecid = g_return.intti;
	}
	while((ret=yylex())==LANEDEST) {
	  ltmp=(LaneDestList_t *)mem_alloc(&load_unit, sizeof(LaneDestList_t));
	  ltmp->addr = g_return.destaddr;
	  ltmp->next = pvc->destinations;
	  pvc->destinations = ltmp;
	}
	read_flag=0;
	set_var_vcc(curr_unit, varname, pvc);
	break;	
      default:
	Debug_unit(&load_unit, "Invalid variable value for %s", varname);
	break;
      }
      break;
    case STRING:
      Debug_unit(&load_unit,"Invalid string placement %s",g_return.stringgi);
      mem_free(&load_unit, g_return.stringgi);
      break;
    case ATMADDRESS:
      Debug_unit(&load_unit, "Invalid atm address placement");
      mem_free(&load_unit, g_return.atmaddress);
      break;
    case LANEDEST:
      Debug_unit(&load_unit, "Invalid lane destination placement");
      mem_free(&load_unit, g_return.destaddr);
      break;
    case INTEGER:
      Debug_unit(&load_unit, "Invalid integer placement");
      break;
    default:
      Debug_unit(&load_unit, "Invalid input");
      break;
    }
  } while (ret != END);
  if (fclose(yyin) != 0) {
    Debug_unit(&load_unit, "Cannot close file %s: %s", file, strerror(errno));
  }
}