lib/param: generate the param_functions.h containing the prototypes
authorGarming Sam <garming@catalyst.net.nz>
Wed, 15 Jan 2014 04:18:13 +0000 (17:18 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 12 Feb 2014 00:17:13 +0000 (13:17 +1300)
Pair-programmed-with: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
lib/param/param.h
lib/param/wscript_build
source4/script/mkproto.pl
wscript_build

index 77c3c77..428a2a3 100644 (file)
@@ -49,6 +49,7 @@ struct gensec_settings;
 
 #ifdef CONFIG_H_IS_FROM_SAMBA
 #include "lib/param/param_proto.h"
+#include "lib/param/param_functions.h"
 #endif
 
 const char **lpcfg_interfaces(struct loadparm_context *);
@@ -61,7 +62,7 @@ int lpcfg_allow_dns_updates(struct loadparm_context *);
 void reload_charcnv(struct loadparm_context *lp_ctx);
 
 struct loadparm_service *lpcfg_default_service(struct loadparm_context *lp_ctx);
-
+bool lpcfg_autoloaded(struct loadparm_service *, struct loadparm_service *);
 
 char *lpcfg_tls_keyfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
 char *lpcfg_tls_certfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
@@ -69,6 +70,8 @@ char *lpcfg_tls_cafile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
 char *lpcfg_tls_dhpfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
 char *lpcfg_tls_crlfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
 
+const char *lpcfg_dnsdomain(struct loadparm_context *);
+
 const char *lpcfg_servicename(const struct loadparm_service *service);
 
 
index 1b26c5b..2a32133 100644 (file)
@@ -6,6 +6,12 @@ bld.SAMBA_GENERATOR('param_functions.c',
                     group='build_source',
                     rule='${PYTHON} ${SRC[0].abspath(env)} --file ${SRC[1].abspath(env)} --output ${TGT} --mode=FUNCTIONS')
 
+bld.SAMBA_GENERATOR('param_functions.h',
+                    source= '../../script/generate_param.py ../../docs-xml/smbdotconf/parameters.all.xml',
+                    target='param_functions.h',
+                    group='build_source',
+                    rule='${PYTHON} ${SRC[0].abspath(env)} --file ${SRC[1].abspath(env)} --output ${TGT} --mode=LIBPROTO')
+
 bld.SAMBA_GENERATOR('param_local_h',
                     source= '../../script/mkparamdefs.pl loadparm.c param_functions.c ',
                     target='param_local.h',
@@ -38,8 +44,7 @@ bld.SAMBA_LIBRARY('samba-hostconfig',
        deps='DYNCONFIG server-role',
        public_deps='samba-util param_local_h',
        public_headers='param.h',
-       autoproto='param_proto.h',
-       autoproto_extra_source='param_functions.c'
+       autoproto='param_proto.h'
        )
 
 
index 348f150..2c3ebac 100755 (executable)
@@ -124,45 +124,6 @@ sub print_footer($$)
        $file->("\n#endif /* $header_name */\n\n");
 }
 
-sub handle_loadparm($$) 
-{
-       my ($file,$line) = @_;
-       my $scope;
-       my $type;
-       my $name;
-       my $var;
-
-       if ($line =~ /^FN_(GLOBAL|LOCAL)_(CONST_STRING|STRING|BOOL|bool|CHAR|INTEGER|LIST)\((\w+),(.*)\)/o) {
-               $scope = $1;
-               $type = $2;
-               $name = $3;
-               $var = $4;
-       } elsif ($line =~ /^FN_(GLOBAL|LOCAL)_PARM_(CONST_STRING|STRING|BOOL|bool|CHAR|INTEGER|LIST)\((\w+),(.*)\)/o) {
-               $scope = $1;
-               $type = $2;
-               $name = $3;
-               $var = $4;
-       } else {
-               return;
-       }
-
-       my %tmap = (
-               "BOOL" => "bool ",
-               "CONST_STRING" => "const char *",
-               "STRING" => "const char *",
-               "INTEGER" => "int ",
-               "CHAR" => "char ",
-               "LIST" => "const char **",
-       );
-
-       my %smap = (
-               "GLOBAL" => "struct loadparm_context *",
-               "LOCAL" => "struct loadparm_service *, struct loadparm_service *"
-               );
-
-       $file->("$tmap{$type}lpcfg_$name($smap{$scope});\n");
-}
-
 sub process_file($$$) 
 {
        my ($public_file, $private_file, $filename) = @_;
@@ -203,8 +164,6 @@ sub process_file($$$)
                next if ($line =~ /^\/|[;]/);
 
                if ($line =~ /^FN_/) {
-                       handle_loadparm($public_file, $line);
-                       handle_loadparm($private_file, $line);
                        next;
                }
 
index f28c08c..9228d15 100644 (file)
@@ -20,7 +20,7 @@ bld.env.build_public_headers = 'include/public'
 
 # these are includes which appear in public headers, but with #ifdef conditional
 # compilation, so they are safe
-bld.env.public_headers_skip = ['lib/param/param_proto.h']
+bld.env.public_headers_skip = ['lib/param/param_proto.h', 'lib/param/param_functions.h']
 
 samba_version.load_version(bld.env, is_install=bld.is_install)
 bld.SAMBA_MKVERSION('version.h')