summaryrefslogtreecommitdiff
path: root/pidl/lib/Parse/Pidl/Samba4/NDR
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2009-12-10 10:04:48 +0300
committerStefan Metzmacher <metze@samba.org>2009-12-12 10:26:05 +0100
commit678f2ca14b97c2bf0d5ef8fd0f0313425803c9ea (patch)
tree4ecbbb5cc8268f8dd7abbadc9e47f1c1387c810f /pidl/lib/Parse/Pidl/Samba4/NDR
parentf0054da041b961bde25f63791d3b33cc834bd365 (diff)
downloadsamba-678f2ca14b97c2bf0d5ef8fd0f0313425803c9ea.tar.gz
samba-678f2ca14b97c2bf0d5ef8fd0f0313425803c9ea.tar.bz2
samba-678f2ca14b97c2bf0d5ef8fd0f0313425803c9ea.zip
pidl: Introduce new dirrective: relative_short
relative_short is like relative but instead of having the offset coded on 4 bytes it's coded on 2 bytes. Such things happen in GET_DFS_REFERAL messages. Signed-off-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'pidl/lib/Parse/Pidl/Samba4/NDR')
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm17
1 files changed, 14 insertions, 3 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index af28bda108..bd6909361b 100644
--- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -573,6 +573,9 @@ sub ParseElementPushLevel
if ($l->{POINTER_TYPE} eq "relative") {
$self->pidl("NDR_CHECK(ndr_push_relative_ptr2($ndr, $var_name));");
}
+ if ($l->{POINTER_TYPE} eq "relative_short") {
+ $self->pidl("NDR_CHECK(ndr_push_short_relative_ptr2($ndr, $var_name));");
+ }
}
$var_name = get_value_of($var_name);
$self->ParseElementPushLevel($e, GetNextLevel($e, $l), $ndr, $var_name, $env, 1, 1);
@@ -670,6 +673,8 @@ sub ParsePtrPush($$$$$)
}
} elsif ($l->{POINTER_TYPE} eq "relative") {
$self->pidl("NDR_CHECK(ndr_push_relative_ptr1($ndr, $var_name));");
+ } elsif ($l->{POINTER_TYPE} eq "relative_short") {
+ $self->pidl("NDR_CHECK(ndr_push_short_relative_ptr1($ndr, $var_name));");
} elsif ($l->{POINTER_TYPE} eq "unique") {
$self->pidl("NDR_CHECK(ndr_push_unique_ptr($ndr, $var_name));");
} elsif ($l->{POINTER_TYPE} eq "full") {
@@ -1038,7 +1043,7 @@ sub ParseElementPullLevel
$self->pidl("if ($var_name) {");
$self->indent;
- if ($l->{POINTER_TYPE} eq "relative") {
+ if ($l->{POINTER_TYPE} eq "relative" or $l->{POINTER_TYPE} eq "relative_short") {
$self->pidl("uint32_t _relative_save_offset;");
$self->pidl("_relative_save_offset = $ndr->offset;");
$self->pidl("NDR_CHECK(ndr_pull_relative_ptr2($ndr, $var_name));");
@@ -1170,6 +1175,8 @@ sub ParsePtrPull($$$$$)
($l->{POINTER_TYPE} eq "relative") or
($l->{POINTER_TYPE} eq "full")) {
$self->pidl("NDR_CHECK(ndr_pull_generic_ptr($ndr, &_ptr_$e->{NAME}));");
+ } elsif ($l->{POINTER_TYPE} eq "relative_short") {
+ $self->pidl("NDR_CHECK(ndr_pull_relative_ptr_short($ndr, &_ptr_$e->{NAME}));");
} else {
die("Unhandled pointer type $l->{POINTER_TYPE}");
}
@@ -1190,7 +1197,7 @@ sub ParsePtrPull($$$$$)
}
#$self->pidl("memset($var_name, 0, sizeof($var_name));");
- if ($l->{POINTER_TYPE} eq "relative") {
+ if ($l->{POINTER_TYPE} eq "relative" or $l->{POINTER_TYPE} eq "relative_short") {
$self->pidl("NDR_CHECK(ndr_pull_relative_ptr1($ndr, $var_name, _ptr_$e->{NAME}));");
}
$self->deindent;
@@ -1471,9 +1478,13 @@ sub DeclarePtrVariables($$)
{
my ($self,$e) = @_;
foreach my $l (@{$e->{LEVELS}}) {
+ my $size = 32;
if ($l->{TYPE} eq "POINTER" and
not ($l->{POINTER_TYPE} eq "ref" and $l->{LEVEL} eq "TOP")) {
- $self->pidl("uint32_t _ptr_$e->{NAME};");
+ if ($l->{POINTER_TYPE} eq "relative_short") {
+ $size = 16;
+ }
+ $self->pidl("uint${size}_t _ptr_$e->{NAME};");
last;
}
}