From a41dffcb6a0a2dcb6bbcf3ecbb4a7a1df47d85df Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 11 May 2010 07:09:05 +0200 Subject: pidl: added a new type dnsp_name This is a name type used in DNS where each DNS component maps to a length byte followed by the string We want these to map to a char *, which is why we need to do this in PIDL --- pidl/lib/Parse/Pidl/NDR.pm | 3 ++- pidl/lib/Parse/Pidl/Samba4/Python.pm | 6 ++++++ pidl/lib/Parse/Pidl/Typelist.pm | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pidl/lib/Parse/Pidl/NDR.pm b/pidl/lib/Parse/Pidl/NDR.pm index a875ec8756..c1ac6001da 100644 --- a/pidl/lib/Parse/Pidl/NDR.pm +++ b/pidl/lib/Parse/Pidl/NDR.pm @@ -74,7 +74,8 @@ my $scalar_alignment = { 'COMRESULT' => 4, 'nbt_string' => 4, 'wrepl_nbt_name' => 4, - 'ipv4address' => 4 + 'ipv4address' => 4, + 'dnsp_name' => 1 }; sub GetElementLevelTable($$) diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm index 4c5cc1b378..75aa0a8172 100644 --- a/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -883,6 +883,11 @@ sub ConvertObjectFromPythonData($$$$$$;$) return; } + if ($actual_ctype->{TYPE} eq "SCALAR" and $actual_ctype->{NAME} eq "dnsp_name") { + $self->pidl("$target = PyString_AsString($cvar);"); + return; + } + if ($actual_ctype->{TYPE} eq "SCALAR" and $actual_ctype->{NAME} eq "NTSTATUS") { $self->pidl("$target = NT_STATUS(PyInt_AsLong($cvar));"); @@ -1018,6 +1023,7 @@ sub ConvertScalarToPython($$$) # Not yet supported if ($ctypename eq "string_array") { return "PyCObject_FromTallocPtr($cvar)"; } if ($ctypename eq "ipv4address") { return "PyString_FromString($cvar)"; } + if ($ctypename eq "dnsp_name") { return "PyString_FromString($cvar)"; } if ($ctypename eq "pointer") { return "PyCObject_FromTallocPtr($cvar)"; } diff --git a/pidl/lib/Parse/Pidl/Typelist.pm b/pidl/lib/Parse/Pidl/Typelist.pm index 1d82dee833..b00f0e4bed 100644 --- a/pidl/lib/Parse/Pidl/Typelist.pm +++ b/pidl/lib/Parse/Pidl/Typelist.pm @@ -57,6 +57,7 @@ my %scalars = ( "nbt_string" => "const char *", "wrepl_nbt_name"=> "struct nbt_name *", "ipv4address" => "const char *", + "dnsp_name" => "const char *", ); my %aliases = ( -- cgit