summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-12-27 16:22:35 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:47:48 -0500
commitd658de65d32e6746ac51aeb4da7aa74b3da40c2b (patch)
tree3057af6864b3eb0b26d523aa4c100213380551f5 /source4/pidl/lib/Parse/Pidl
parent8270e1e31071d23915cc3aa408ad6c7074ea1c11 (diff)
downloadsamba-d658de65d32e6746ac51aeb4da7aa74b3da40c2b.tar.gz
samba-d658de65d32e6746ac51aeb4da7aa74b3da40c2b.tar.bz2
samba-d658de65d32e6746ac51aeb4da7aa74b3da40c2b.zip
r12512: Use GUID structs in API functions everywhere rather then converting back and
forth between GUID structs and strings in several places. (This used to be commit 3564e2f967ef72d6301b4f7e9a311cebcded4d75)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm4
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm9
-rw-r--r--source4/pidl/lib/Parse/Pidl/Util.pm16
3 files changed, 22 insertions, 7 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index bb9d32487a..2247fcbf81 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -9,7 +9,7 @@ package Parse::Pidl::Samba4::NDR::Parser;
use strict;
use Parse::Pidl::Typelist qw(hasType getType mapType);
-use Parse::Pidl::Util qw(has_property ParseExpr);
+use Parse::Pidl::Util qw(has_property ParseExpr print_uuid);
use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
use vars qw($VERSION);
@@ -2218,7 +2218,7 @@ sub FunctionTable($)
pidl "\nconst struct dcerpc_interface_table dcerpc_table_$interface->{NAME} = {";
pidl "\t.name\t\t= \"$interface->{NAME}\",";
- pidl "\t.uuid\t\t= DCERPC_$uname\_UUID,";
+ pidl "\t.uuid\t\t= ". print_uuid($interface->{UUID}) .",";
pidl "\t.if_version\t= DCERPC_$uname\_VERSION,";
pidl "\t.helpstring\t= DCERPC_$uname\_HELPSTRING,";
pidl "\t.num_calls\t= $count,";
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm
index 585209b733..8710f08cc7 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Server.pm
@@ -7,6 +7,7 @@
package Parse::Pidl::Samba4::NDR::Server;
use strict;
+use Parse::Pidl::Util;
use vars qw($VERSION);
$VERSION = '0.01';
@@ -76,7 +77,7 @@ sub Boilerplate_Iface($)
my($interface) = shift;
my $name = $interface->{NAME};
my $uname = uc $name;
- my $uuid = Parse::Pidl::Util::make_str(lc($interface->{PROPERTIES}->{uuid}));
+ my $uuid = lc($interface->{PROPERTIES}->{uuid});
my $if_version = $interface->{PROPERTIES}->{version};
pidl "
@@ -187,7 +188,7 @@ static NTSTATUS $name\__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_C
static const struct dcesrv_interface $name\_interface = {
.name = \"$name\",
- .uuid = $uuid,
+ .uuid = ".print_uuid($uuid).",
.if_version = $if_version,
.bind = $name\__op_bind,
.unbind = $name\__op_unbind,
@@ -227,10 +228,10 @@ static NTSTATUS $name\__op_init_server(struct dcesrv_context *dce_ctx, const str
return NT_STATUS_OK;
}
-static BOOL $name\__op_interface_by_uuid(struct dcesrv_interface *iface, const char *uuid, uint32_t if_version)
+static BOOL $name\__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version)
{
if ($name\_interface.if_version == if_version &&
- strcmp($name\_interface.uuid, uuid)==0) {
+ GUID_equal(\&$name\_interface.uuid, uuid)) {
memcpy(iface,&$name\_interface, sizeof(*iface));
return True;
}
diff --git a/source4/pidl/lib/Parse/Pidl/Util.pm b/source4/pidl/lib/Parse/Pidl/Util.pm
index ec6a1420ab..ff615a21ba 100644
--- a/source4/pidl/lib/Parse/Pidl/Util.pm
+++ b/source4/pidl/lib/Parse/Pidl/Util.pm
@@ -6,7 +6,7 @@ package Parse::Pidl::Util;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT = qw(has_property property_matches ParseExpr is_constant make_str);
+@EXPORT = qw(has_property property_matches ParseExpr is_constant make_str print_uuid);
use vars qw($VERSION);
$VERSION = '0.01';
@@ -75,6 +75,20 @@ sub make_str($)
return "\"" . $str . "\"";
}
+sub print_uuid($)
+{
+ my ($uuid) = @_;
+ $uuid =~ s/"//g;
+ my ($time_low,$time_mid,$time_hi,$clock_seq,$node) = split /-/, $uuid;
+
+ my @clock_seq = $clock_seq =~ /(..)/g;
+ my @node = $node =~ /(..)/g;
+
+ return "{0x$time_low,0x$time_mid,0x$time_hi," .
+ "{".join(',', map {"0x$_"} @clock_seq)."}," .
+ "{".join(',', map {"0x$_"} @node)."}}";
+}
+
# a hack to build on platforms that don't like negative enum values
my $useUintEnums = 0;
sub setUseUintEnums($)