⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 oparse.y

📁 wifi 无线网络路由协议OLSR linux下C代码
💻 Y
📖 第 1 页 / 共 2 页
字号:
  PARSER_DEBUG_PRINTF("\tHELLO validity: %0.2f\n", $2->floating);  while(ifcnt)    {      ifs->cnf->hello_params.validity_time = $2->floating;            ifs = ifs->next;      ifcnt--;    }  free($2);};isettcint: TOK_TCINT TOK_FLOAT{  int ifcnt = ifs_in_curr_cfg;  struct olsr_if *ifs = cnf->interfaces;  PARSER_DEBUG_PRINTF("\tTC interval: %0.2f\n", $2->floating);  while(ifcnt)    {      ifs->cnf->tc_params.emission_interval = $2->floating;            ifs = ifs->next;      ifcnt--;    }  free($2);};isettcval: TOK_TCVAL TOK_FLOAT{  int ifcnt = ifs_in_curr_cfg;  struct olsr_if *ifs = cnf->interfaces;    PARSER_DEBUG_PRINTF("\tTC validity: %0.2f\n", $2->floating);  while(ifcnt)    {      ifs->cnf->tc_params.validity_time = $2->floating;            ifs = ifs->next;      ifcnt--;    }  free($2);};isetmidint: TOK_MIDINT TOK_FLOAT{  int ifcnt = ifs_in_curr_cfg;  struct olsr_if *ifs = cnf->interfaces;  PARSER_DEBUG_PRINTF("\tMID interval: %0.2f\n", $2->floating);  while(ifcnt)    {      ifs->cnf->mid_params.emission_interval = $2->floating;            ifs = ifs->next;      ifcnt--;    }  free($2);};isetmidval: TOK_MIDVAL TOK_FLOAT{  int ifcnt = ifs_in_curr_cfg;  struct olsr_if *ifs = cnf->interfaces;  PARSER_DEBUG_PRINTF("\tMID validity: %0.2f\n", $2->floating);  while(ifcnt)    {      ifs->cnf->mid_params.validity_time = $2->floating;            ifs = ifs->next;      ifcnt--;    }  free($2);};isethnaint: TOK_HNAINT TOK_FLOAT{  int ifcnt = ifs_in_curr_cfg;  struct olsr_if *ifs = cnf->interfaces;    PARSER_DEBUG_PRINTF("\tHNA interval: %0.2f\n", $2->floating);  while(ifcnt)    {      ifs->cnf->hna_params.emission_interval = $2->floating;            ifs = ifs->next;      ifcnt--;    }  free($2);};isethnaval: TOK_HNAVAL TOK_FLOAT{  int ifcnt = ifs_in_curr_cfg;  struct olsr_if *ifs = cnf->interfaces;  PARSER_DEBUG_PRINTF("\tHNA validity: %0.2f\n", $2->floating);  while(ifcnt)    {      ifs->cnf->hna_params.validity_time = $2->floating;            ifs = ifs->next;      ifcnt--;    }  free($2);};isetautodetchg: TOK_AUTODETCHG TOK_BOOLEAN{  int ifcnt = ifs_in_curr_cfg;  struct olsr_if *ifs = cnf->interfaces;  PARSER_DEBUG_PRINTF("\tAutodetect changes: %s\n", $2->boolean ? "YES" : "NO");  while(ifcnt)    {      ifs->cnf->autodetect_chg = $2->boolean;            ifs = ifs->next;      ifcnt--;    }  free($2);};isetlqmult: TOK_LQ_MULT TOK_DEFAULT TOK_FLOAT{  if (lq_mult_helper($2, $3) < 0)    YYABORT;}          | TOK_LQ_MULT TOK_IP4_ADDR TOK_FLOAT{  if (lq_mult_helper($2, $3) < 0)    YYABORT;}          | TOK_LQ_MULT TOK_IP6_ADDR TOK_FLOAT{  if (lq_mult_helper($2, $3) < 0)    YYABORT;}          ;idebug:       TOK_DEBUGLEVEL TOK_INTEGER{  cnf->debug_level = $2->integer;  PARSER_DEBUG_PRINTF("Debug level: %d\n", cnf->debug_level);  free($2);};iipversion:    TOK_IPVERSION TOK_INTEGER{  if($2->integer == 4)    cnf->ip_version = AF_INET;  else if($2->integer == 6)    cnf->ip_version = AF_INET6;  else    {      fprintf(stderr, "IPversion must be 4 or 6!\n");      YYABORT;    }  PARSER_DEBUG_PRINTF("IpVersion: %d\n", $2->integer);  free($2);};ihna4entry:     TOK_IP4_ADDR TOK_IP4_ADDR{  struct hna4_entry *h = malloc(sizeof(struct hna4_entry));  struct in_addr in;  PARSER_DEBUG_PRINTF("HNA IPv4 entry: %s/%s\n", $1->string, $2->string);  if(h == NULL)    {      fprintf(stderr, "Out of memory(HNA4)\n");      YYABORT;    }  if(inet_aton($1->string, &in) == 0)    {      fprintf(stderr, "ihna4entry: Failed converting IP address %s\n", $1->string);      return -1;    }  h->net.v4 = in.s_addr;  if(inet_aton($2->string, &in) == 0)    {      fprintf(stderr, "ihna4entry: Failed converting IP address %s\n", $1->string);      return -1;    }  h->netmask.v4 = in.s_addr;  h->net.v4 &= h->netmask.v4;  /* Queue */  h->next = cnf->hna4_entries;  cnf->hna4_entries = h;  free($1->string);  free($1);  free($2->string);  free($2);};ihna6entry:     TOK_IP6_ADDR TOK_INTEGER{  struct hna6_entry *h = malloc(sizeof(struct hna6_entry));  struct in6_addr in6;  PARSER_DEBUG_PRINTF("HNA IPv6 entry: %s/%d\n", $1->string, $2->integer);  if(h == NULL)    {      fprintf(stderr, "Out of memory(HNA6)\n");      YYABORT;    }  if(inet_pton(AF_INET6, $1->string, &in6) < 0)    {      fprintf(stderr, "ihna6entry: Failed converting IP address %s\n", $1->string);      return -1;    }  memcpy(&h->net, &in6, sizeof(struct in6_addr));  if($2->integer > 128)    {      fprintf(stderr, "ihna6entry: Illegal IPv6 prefix length %d\n", $2->integer);      return -1;    }  h->prefix_len = $2->integer;  /* Queue */  h->next = cnf->hna6_entries;  cnf->hna6_entries = h;  free($1->string);  free($1);  free($2);};ifstart: TOK_INTERFACE{  PARSER_DEBUG_PRINTF("setting ifs_in_curr_cfg = 0\n");  ifs_in_curr_cfg = 0;};ifnick: TOK_STRING{  struct olsr_if *in = malloc(sizeof(struct olsr_if));    if(in == NULL)    {      fprintf(stderr, "Out of memory(ADD IF)\n");      YYABORT;    }  in->cnf = get_default_if_config();  if(in->cnf == NULL)    {      fprintf(stderr, "Out of memory(ADD IFRULE)\n");      YYABORT;    }  in->name = $1->string;  /* Queue */  in->next = cnf->interfaces;  cnf->interfaces = in;  ifs_in_curr_cfg++;  free($1);};bnoint: TOK_NOINT TOK_BOOLEAN{  PARSER_DEBUG_PRINTF("Noint set to %d\n", $2->boolean);  cnf->allow_no_interfaces = $2->boolean;  free($2);};atos: TOK_TOS TOK_INTEGER{  PARSER_DEBUG_PRINTF("TOS: %d\n", $2->integer);  cnf->tos = $2->integer;  free($2);};arttable: TOK_RTTABLE TOK_INTEGER{  if(PARSER_DEBUG) printf("RtTable: %d\n", $2->integer);  cnf->rttable = $2->integer;  free($2);};awillingness: TOK_WILLINGNESS TOK_INTEGER{  cnf->willingness_auto = OLSR_FALSE;  PARSER_DEBUG_PRINTF("Willingness: %d\n", $2->integer);  cnf->willingness = $2->integer;  free($2);};busehyst: TOK_USEHYST TOK_BOOLEAN{  cnf->use_hysteresis = $2->boolean;  if(cnf->use_hysteresis)    {      PARSER_DEBUG_PRINTF("Hysteresis enabled\n");    }  else    {      PARSER_DEBUG_PRINTF("Hysteresis disabled\n");    }  free($2);};fhystscale: TOK_HYSTSCALE TOK_FLOAT{  cnf->hysteresis_param.scaling = $2->floating;  PARSER_DEBUG_PRINTF("Hysteresis Scaling: %0.2f\n", $2->floating);  free($2);};fhystupper: TOK_HYSTUPPER TOK_FLOAT{  cnf->hysteresis_param.thr_high = $2->floating;  PARSER_DEBUG_PRINTF("Hysteresis UpperThr: %0.2f\n", $2->floating);  free($2);};fhystlower: TOK_HYSTLOWER TOK_FLOAT{  cnf->hysteresis_param.thr_low = $2->floating;  PARSER_DEBUG_PRINTF("Hysteresis LowerThr: %0.2f\n", $2->floating);  free($2);};fpollrate: TOK_POLLRATE TOK_FLOAT{  PARSER_DEBUG_PRINTF("Pollrate %0.2f\n", $2->floating);  cnf->pollrate = $2->floating;  free($2);};fnicchgspollrt: TOK_NICCHGSPOLLRT TOK_FLOAT{  PARSER_DEBUG_PRINTF("NIC Changes Pollrate %0.2f\n", $2->floating);  cnf->nic_chgs_pollrate = $2->floating;  free($2);};atcredundancy: TOK_TCREDUNDANCY TOK_INTEGER{  PARSER_DEBUG_PRINTF("TC redundancy %d\n", $2->integer);  cnf->tc_redundancy = $2->integer;  free($2);};amprcoverage: TOK_MPRCOVERAGE TOK_INTEGER{  PARSER_DEBUG_PRINTF("MPR coverage %d\n", $2->integer);  cnf->mpr_coverage = $2->integer;  free($2);};alq_level: TOK_LQ_LEVEL TOK_INTEGER{  PARSER_DEBUG_PRINTF("Link quality level %d\n", $2->integer);  cnf->lq_level = $2->integer;  free($2);};alq_fish: TOK_LQ_FISH TOK_INTEGER{  PARSER_DEBUG_PRINTF("Link quality fish eye %d\n", $2->integer);  cnf->lq_fish = $2->integer;  free($2);};alq_dlimit: TOK_LQ_DLIMIT TOK_INTEGER TOK_FLOAT{  PARSER_DEBUG_PRINTF("Link quality dijkstra limit %d, %0.2f\n", $2->integer, $3->floating);  cnf->lq_dlimit = $2->integer;  cnf->lq_dinter = $3->floating;  free($2);};alq_wsize: TOK_LQ_WSIZE TOK_INTEGER{  PARSER_DEBUG_PRINTF("Link quality window size %d\n", $2->integer);  cnf->lq_wsize = $2->integer;  free($2);};bclear_screen: TOK_CLEAR_SCREEN TOK_BOOLEAN{  cnf->clear_screen = $2->boolean;  PARSER_DEBUG_PRINTF("Clear screen %s\n", cnf->clear_screen ? "enabled" : "disabled");  free($2);};plblock: TOK_PLUGIN TOK_STRING{  struct plugin_entry *pe = malloc(sizeof(struct plugin_entry));    if(pe == NULL)    {      fprintf(stderr, "Out of memory(ADD PL)\n");      YYABORT;    }  pe->name = $2->string;  pe->params = NULL;    PARSER_DEBUG_PRINTF("Plugin: %s\n", $2->string);  /* Queue */  pe->next = cnf->plugins;  cnf->plugins = pe;  free($2);};plparam: TOK_PLPARAM TOK_STRING TOK_STRING{  struct plugin_param *pp = malloc(sizeof(struct plugin_param));    if(pp == NULL)    {      fprintf(stderr, "Out of memory(ADD PP)\n");      YYABORT;    }    PARSER_DEBUG_PRINTF("Plugin param key:\"%s\" val: \"%s\"\n", $2->string, $3->string);    pp->key = $2->string;  pp->value = $3->string;  /* Queue */  pp->next = cnf->plugins->params;  cnf->plugins->params = pp;  free($2);  free($3);};vcomment:       TOK_COMMENT{    //PARSER_DEBUG_PRINTF("Comment\n");};%%void yyerror (char *string){  fprintf(stderr, "Config line %d: %s\n", current_line, string);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -