mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
r2253: Add test program, as small example of what's going on.
(This used to be commit fd31ae38df
)
This commit is contained in:
parent
0e6799177c
commit
3f7bf05f75
@ -22,6 +22,7 @@ use eparser;
|
||||
use validator;
|
||||
use util;
|
||||
use template;
|
||||
use swig;
|
||||
|
||||
my($opt_help) = 0;
|
||||
my($opt_parse) = 0;
|
||||
@ -33,6 +34,7 @@ my($opt_server) = 0;
|
||||
my($opt_parser) = 0;
|
||||
my($opt_eparser) = 0;
|
||||
my($opt_keep) = 0;
|
||||
my($opt_swig) = 0;
|
||||
my($opt_output);
|
||||
|
||||
my $idl_parser = new idl;
|
||||
@ -86,7 +88,8 @@ GetOptions (
|
||||
'parser' => \$opt_parser,
|
||||
'eparser' => \$opt_eparser,
|
||||
'diff' => \$opt_diff,
|
||||
'keep' => \$opt_keep
|
||||
'keep' => \$opt_keep,
|
||||
'swig' => \$opt_swig
|
||||
);
|
||||
|
||||
if ($opt_help) {
|
||||
@ -155,6 +158,13 @@ sub process_file($)
|
||||
close(OUT);
|
||||
}
|
||||
|
||||
if ($opt_swig) {
|
||||
my($filename) = $output;
|
||||
$filename =~ s/\/ndr_/\//;
|
||||
$filename = util::ChangeExtension($filename, ".i");
|
||||
util::FileSave($filename, IdlSwig::Parse($pidl));
|
||||
}
|
||||
|
||||
if ($opt_diff) {
|
||||
my($tempfile) = util::ChangeExtension($output, ".tmp");
|
||||
util::FileSave($tempfile, IdlDump::Dump($pidl));
|
||||
|
24
source4/build/pidl/swig.pm
Normal file
24
source4/build/pidl/swig.pm
Normal file
@ -0,0 +1,24 @@
|
||||
###################################################
|
||||
# Samba4 parser generator for swig wrappers
|
||||
# Copyright tpot@samba.org 2004
|
||||
# released under the GNU GPL
|
||||
|
||||
package IdlSwig;
|
||||
|
||||
use strict;
|
||||
|
||||
sub Parse($)
|
||||
{
|
||||
my($idl) = shift;
|
||||
my($res) = "";
|
||||
|
||||
$res = "/* header auto-generated by pidl */\n\n";
|
||||
|
||||
foreach my $x (@{$idl}) {
|
||||
# ($x->{TYPE} eq "INTERFACE") && HeaderInterface($x);
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
1;
|
@ -4,7 +4,7 @@ FULLBUILD=$1
|
||||
|
||||
[ -d librpc/gen_ndr ] || mkdir -p librpc/gen_ndr || exit 1
|
||||
|
||||
PIDL="$PERL ./build/pidl/pidl.pl --output librpc/gen_ndr/ndr_ --parse --header --parser --server"
|
||||
PIDL="$PERL ./build/pidl/pidl.pl --output librpc/gen_ndr/ndr_ --parse --header --parser --server --swig"
|
||||
TABLES="$PERL ./build/pidl/tables.pl --output librpc/gen_ndr/tables"
|
||||
|
||||
if [ x$FULLBUILD = xFULL ]; then
|
||||
|
@ -112,6 +112,8 @@ uint32 get_uint32_property(PyObject *dict, char *key)
|
||||
|
||||
%types(struct dcerpc_pipe *);
|
||||
|
||||
%rename(pipe_connect) dcerpc_pipe_connect;
|
||||
|
||||
NTSTATUS dcerpc_pipe_connect(struct dcerpc_pipe **OUT,
|
||||
const char *binding,
|
||||
const char *pipe_uuid,
|
||||
|
13
source4/scripting/swig/test
Executable file
13
source4/scripting/swig/test
Executable file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import dcerpc
|
||||
import gc
|
||||
gc.set_debug(gc.DEBUG_LEAK)
|
||||
|
||||
handle = dcerpc.pipe_connect("ncacn_np:win2k3dc",
|
||||
dcerpc.DCERPC_SAMR_UUID, dcerpc.DCERPC_SAMR_VERSION,
|
||||
"win2k3dom", "administrator", "penguin")
|
||||
|
||||
connect = {"system_name": "win2k3dc", "access_mask": 12345}
|
||||
|
||||
print dcerpc.samr_Connect2(handle, connect)
|
Loading…
Reference in New Issue
Block a user