/[radius]/radius/radiusd/config.y
ViewVC logotype

Diff of /radius/radiusd/config.y

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.54 by gray, Tue Apr 29 13:57:59 2003 UTC revision 1.55 by gray, Wed Apr 30 08:38:30 2003 UTC
# Line 1  Line 1 
1  %{  %{
2  /* This file is part of GNU RADIUS.  /* This file is part of GNU Radius.
3     Copyright (C) 2000,2001, Sergey Poznyakoff     Copyright (C) 2000,2001,2002,2003, Sergey Poznyakoff
4        
5     This program is free software; you can redistribute it and/or modify     GNU Radius is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.     (at your option) any later version.
9        
10     This program is distributed in the hope that it will be useful,     GNU Radius is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.     GNU General Public License for more details.
14        
15     You should have received a copy of the GNU General Public License     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software Foundation,     along with GNU Radius; if not, write to the Free Software Foundation,
17     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18    
 #ifndef lint  
 static char rcsid[] =  
         "@(#) $Id$";  
 #endif  
   
19  #ifdef HAVE_CONFIG_H  #ifdef HAVE_CONFIG_H
20  # include <config.h>  # include <config.h>
21  #endif  #endif
# Line 386  again: Line 381  again:
381  }  }
382    
383  void  void
384  putback(tok, length)  putback(char *tok, int length)
         char *tok;  
         int length;  
385  {  {
386          if (length > curp - buffer) {          if (length > curp - buffer) {
387                  radlog(L_CRIT,                  radlog(L_CRIT,
# Line 418  skipline() Line 411  skipline()
411  }  }
412    
413  int  int
414  isword(c)  isword(int c)
         int c;  
415  {  {
416          return isalnum(c) || c == '_' || c == '-';          return isalnum(c) || c == '_' || c == '-';
417  }  }
# Line 477  copy_digit() Line 469  copy_digit()
469  }  }
470    
471  struct keyword booleans[] = {  struct keyword booleans[] = {
472          "on", 1,          { "on", 1 },
473          "off", 0,          { "off", 0 },
474          "yes", 1,          { "yes", 1 },
475          "no", 0,          { "no", 0 },
476          0          0
477  };  };
478    
# Line 498  keyword() Line 490  keyword()
490    
491    
492  int  int
493  yyerror(s)  yyerror(char *s)
         char *s;  
494  {  {
495          radlog(L_ERR, "%s:%d: %s", cfg_filename, cfg_line_num, s);          radlog(L_ERR, "%s:%d: %s", cfg_filename, cfg_line_num, s);
496  }  }
# Line 508  yyerror(s) Line 499  yyerror(s)
499  /* Internal functions */  /* Internal functions */
500    
501  void  void
502  _cfg_run_begin(stmt, up_data)  _cfg_run_begin(struct cfg_stmt *stmt, void *up_data)
         struct cfg_stmt *stmt;  
         void *up_data;  
503  {  {
504          for ( ; stmt->keyword; stmt++) {          for ( ; stmt->keyword; stmt++) {
505                  if (stmt->term)                  if (stmt->term)
# Line 521  _cfg_run_begin(stmt, up_data) Line 510  _cfg_run_begin(stmt, up_data)
510  }  }
511    
512  void  void
513  _cfg_run_finish(stmt, up_data)  _cfg_run_finish(struct cfg_stmt *stmt, void *up_data)
         struct cfg_stmt *stmt;  
         void *up_data;  
514  {  {
515          for ( ; stmt->keyword; stmt++) {          for ( ; stmt->keyword; stmt++) {
516                  if (stmt->term)                  if (stmt->term)
# Line 550  _cfg_free_memory_pool() Line 537  _cfg_free_memory_pool()
537  }  }
538    
539  int  int
540  _cfg_make_argv(argv, keyword, vlist)  _cfg_make_argv(cfg_value_t **argv, char *keyword, VLIST *vlist)
         cfg_value_t **argv;  
         char *keyword;  
         VLIST *vlist;  
541  {  {
542          int i, argc;          int i, argc;
543          struct value_list *p;          struct value_list *p;
# Line 573  _cfg_make_argv(argv, keyword, vlist) Line 557  _cfg_make_argv(argv, keyword, vlist)
557  }  }
558    
559  void  void
560  _cfg_free_argv(argc, argv)  _cfg_free_argv(int argc, cfg_value_t *argv)
         int argc;  
         cfg_value_t *argv;  
561  {  {
562          efree(argv);          efree(argv);
563  }  }
564                                    
565  VLIST *  VLIST *
566  _cfg_vlist_create(val)  _cfg_vlist_create(cfg_value_t *val)
         cfg_value_t *val;  
567  {  {
568          VLIST *vlist = cfg_malloc(sizeof(*vlist), _cfg_vlist_destroy);          VLIST *vlist = cfg_malloc(sizeof(*vlist), _cfg_vlist_destroy);
569          struct value_list *p = emalloc(sizeof(*p));          struct value_list *p = emalloc(sizeof(*p));
# Line 594  _cfg_vlist_create(val) Line 575  _cfg_vlist_create(val)
575  }  }
576    
577  VLIST *  VLIST *
578  _cfg_vlist_append(vlist, val)  _cfg_vlist_append(VLIST *vlist, cfg_value_t *val)
         VLIST *vlist;  
         cfg_value_t *val;  
579  {  {
580          struct value_list *p = emalloc(sizeof(*p));          struct value_list *p = emalloc(sizeof(*p));
581          p->val = *val;          p->val = *val;
# Line 607  _cfg_vlist_append(vlist, val) Line 586  _cfg_vlist_append(vlist, val)
586  }  }
587    
588  void  void
589  _cfg_vlist_destroy(arg)  _cfg_vlist_destroy(void *arg)
         void *arg;  
590  {  {
591          VLIST *vlist = arg;          VLIST *vlist = arg;
592          struct value_list *p, *next;          struct value_list *p, *next;
# Line 622  _cfg_vlist_destroy(arg) Line 600  _cfg_vlist_destroy(arg)
600  }  }
601    
602  void  void
603  _cfg_push_block(stmt, end, block_data)  _cfg_push_block(struct cfg_stmt *stmt, cfg_end_fp end, void *block_data)
         struct cfg_stmt *stmt;  
         cfg_end_fp end;  
         void *block_data;  
604  {  {
605          struct syntax_block *p = emalloc(sizeof(*p));          struct syntax_block *p = emalloc(sizeof(*p));
606          p->stmt = stmt;          p->stmt = stmt;
# Line 650  _cfg_pop_block() Line 625  _cfg_pop_block()
625  }  }
626    
627  struct cfg_stmt *  struct cfg_stmt *
628  _cfg_find_keyword(stmt, str)  _cfg_find_keyword(struct cfg_stmt *stmt, char *str)
         struct cfg_stmt *stmt;  
         char *str;  
629  {  {
630          if (stmt)          if (stmt)
631                  for (; stmt->keyword; stmt++) {                  for (; stmt->keyword; stmt++) {
# Line 663  _cfg_find_keyword(stmt, str) Line 636  _cfg_find_keyword(stmt, str)
636  }  }
637    
638  int  int
639  _get_value(arg, type, base)  _get_value(cfg_value_t *arg, int type, void *base)
         cfg_value_t *arg;  
         int type;  
         void *base;  
640  {  {
641          struct servent *s;          struct servent *s;
642          UINT4 ipaddr;          UINT4 ipaddr;
# Line 766  _get_value(arg, type, base) Line 736  _get_value(arg, type, base)
736  /* Global functions */  /* Global functions */
737    
738  void *  void *
739  cfg_malloc(size, destructor)  cfg_malloc(size_t size, void (*destructor)(void *))
         size_t size;  
         void (*destructor)(void *);  
740  {  {
741          struct cfg_memblock *p = emalloc(size + sizeof(*p));          struct cfg_memblock *p = emalloc(size + sizeof(*p));
742          p->next = cfg_memory_pool;          p->next = cfg_memory_pool;
# Line 779  cfg_malloc(size, destructor) Line 747  cfg_malloc(size, destructor)
747  }  }
748    
749  void  void
750  cfg_type_error(type)  cfg_type_error(int type)
         int type;  
751  {  {
752          radlog(L_ERR,          radlog(L_ERR,
753                 _("%s:%d: wrong datatype (should be %s)"),                 _("%s:%d: wrong datatype (should be %s)"),
# Line 788  cfg_type_error(type) Line 755  cfg_type_error(type)
755  }  }
756    
757  void  void
758  cfg_argc_error(few)  cfg_argc_error(int few)
         int few;  
759  {  {
760          radlog(L_ERR,          radlog(L_ERR,
761                 "%s:%d: %s",                 "%s:%d: %s",
# Line 804  cfg_argc_error(few) Line 770  cfg_argc_error(few)
770   }                 }              
771    
772  int  int
773  cfg_get_ipaddr(argc, argv, block_data, handler_data)  cfg_get_ipaddr(int argc, cfg_value_t *argv, void *block_data,
774          int argc;                 void *handler_data)
         cfg_value_t *argv;  
         void *block_data;  
         void *handler_data;  
775  {  {
776          _check_argc(argc, 1);          _check_argc(argc, 1);
777          return _get_value(&argv[1], CFG_IPADDR, handler_data);          return _get_value(&argv[1], CFG_IPADDR, handler_data);
778  }  }
779    
780  int  int
781  cfg_get_integer(argc, argv, block_data, handler_data)  cfg_get_integer(int argc, cfg_value_t *argv, void *block_data,
782          int argc;                  void *handler_data)
         cfg_value_t *argv;  
         void *block_data;  
         void *handler_data;  
783  {  {
784          _check_argc(argc, 1);          _check_argc(argc, 1);
785          return _get_value(&argv[1], CFG_INTEGER, handler_data);          return _get_value(&argv[1], CFG_INTEGER, handler_data);
786  }  }
787    
788  int  int
789  cfg_get_string(argc, argv, block_data, handler_data)  cfg_get_string(int argc, cfg_value_t *argv, void *block_data,
790          int argc;                 void *handler_data)
         cfg_value_t *argv;  
         void *block_data;  
         void *handler_data;  
791  {  {
792          _check_argc(argc, 1);          _check_argc(argc, 1);
793          return _get_value(&argv[1], CFG_STRING, handler_data);          return _get_value(&argv[1], CFG_STRING, handler_data);
794  }  }
795    
796  int  int
797  cfg_get_boolean(argc, argv, block_data, handler_data)  cfg_get_boolean(int argc, cfg_value_t *argv, void *block_data,
798          int argc;                  void *handler_data)
         cfg_value_t *argv;  
         void *block_data;  
         void *handler_data;  
799  {  {
800          _check_argc(argc, 1);          _check_argc(argc, 1);
801          return _get_value(&argv[1], CFG_BOOLEAN, handler_data);          return _get_value(&argv[1], CFG_BOOLEAN, handler_data);
802  }  }
803    
804  int  int
805  cfg_get_network(argc, argv, block_data, handler_data)  cfg_get_network(int argc, cfg_value_t *argv,
806          int argc;                  void *block_data, void *handler_data)
         cfg_value_t *argv;  
         void *block_data;  
         void *handler_data;  
807  {  {
808          _check_argc(argc, 1);          _check_argc(argc, 1);
809          return _get_value(&argv[1], CFG_NETWORK, handler_data);          return _get_value(&argv[1], CFG_NETWORK, handler_data);
810  }  }
811    
812  int  int
813  cfg_get_port(argc, argv, block_data, handler_data)  cfg_get_port(int argc, cfg_value_t *argv,
814          int argc;               void *block_data, void *handler_data)
         cfg_value_t *argv;  
         void *block_data;  
         void *handler_data;  
815  {  {
816          _check_argc(argc, 1);          _check_argc(argc, 1);
817          return _get_value(&argv[1], CFG_PORT, handler_data);          return _get_value(&argv[1], CFG_PORT, handler_data);
818  }  }
819    
820  int  int
821  cfg_read(fname, syntax, data)  cfg_read(char *fname, struct cfg_stmt *syntax, void *data)
         char *fname;  
         struct cfg_stmt *syntax;  
         void *data;  
822  {  {
823          struct stat st;          struct stat st;
824          int fd;          int fd;

Legend:
Removed from v.1.54  
changed lines
  Added in v.1.55

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26