Home | History | Annotate | Line # | Download | only in doc
      1 When adding a new configuration option to NSD, several files need to be
      2 touched. This file is an enumeration of files that need to be edited.
      3 Suppose we are going to add a configuration option 'dummy:' that can take
      4 a string. We need to update the following files:
      5 
      6 	1. configlexer.lex
      7 	2. configparser.y
      8 	3. options.h
      9 	4. options.c
     10 	5. nsd.conf.sample.in
     11 	6. nsd.conf.5.in
     12 	7. nsd-checkconf.c
     13 	8. tpkg/checkconf.tpkg
     14 
     15 1. Update configlexer.lex
     16 
     17 Make sure that zonec understands the new option by adding the following
     18 line into configlexer.lex
     19 
     20 	dummy{COLON}  { LEXOUT(("v(%s) ", yytext)); return VAR_DUMMY;}
     21 
     22 2. Update configparser.y
     23 
     24 Make sure that zonec can parse the new option by adding VAR_DUMMY to the set
     25 of tokens:
     26 
     27 	%token VAR_DUMMY
     28 
     29 Update the grammar. For example, if it a server option, extend content_server:
     30 
     31 	content_server: server_ip_address | ...
     32 		server_hide_version | server_dummy;
     33 
     34 And write down the dummy rule:
     35 
     36 	server_dummy: VAR_DUMMY STRING
     37         {
     38                 OUTYY(("P(server_dummy:%s)\n", $2));
     39                 cfg_parser->opt->dummy =
     40 			region_strdup(cfg_parser->opt->region, $2);
     41         }
     42         ;
     43 
     44 3. Update options.h
     45 
     46 Make sure that there is storage for the dummy option. In struct nsd_options,
     47 add:
     48 
     49 	const char* dummy;
     50 
     51 4. Update options.c
     52 
     53 Set a default dummy string. In the function nsd_options_create(), add:
     54 
     55 	opt->dummy = "dummy";
     56 
     57 5. Update nsd.conf.sample.in
     58 
     59 Add a reference in the sample configuration file:
     60 
     61 	# This option does nothing.
     62 	# dummy: "dummy"
     63 
     64 6. Update nsd.conf.5.in
     65 
     66 Update the nsd.conf manpage:
     67 
     68 	.TP
     69 	.B dummy:\fR <filename>
     70 	Does nothing.
     71 
     72 7. Update nsd-checkconf.c
     73 
     74 Make the checkconf tool aware of the new option. In config_print_zone(), add:
     75 
     76 	SERV_GET_STR(dummy, o);
     77 
     78 and in config_test_print_server(), add:
     79 
     80 	print_string_var("dummy:", opt->dummy);
     81 
     82 8. Update tpkg/checkconf.tpkg
     83 
     84 Make the test aware of the new option. Extract checkconf.tpkg:
     85 
     86 	$ cd tpkg;
     87 	$ tpkg extract checkconf.tpkg
     88 	$ cd checkconf.dir
     89 
     90 And add to the various checkconf.check[1-9] files:
     91 
     92 	dummy: "dummy"
     93 
     94 Go back to the tpkg directory and create the new test:
     95 
     96 	$ cd ..
     97 	$ tpkg create checkconf.tpkg
     98 
     99 9. Update other files
    100 
    101 You might need to edit other files too:
    102 
    103 - If the new option requires to be enabled at build time, you need to add
    104   stuff to configure.ac and Makefile.in.
    105 
    106 - Update documentation files, like doc/README, doc/RELNOTES, doc/Changelog.
    107 
    108 - Obviously, the source code files need to be edited to implement the new
    109   functionality.
    110 
    111 
    112