perl::NetApp::NaElemenUser Contributed Perl Documentperl::NetApp::NaElement(3)



1mNAME0m
	 NaElement ‐ class encapsulating Netapp XML request elements

1mDESCRIPTION0m
	 An NaElement encapsulates one level of an XML element.
	 Elements can be arbitrarily nested.  They have names,
	 corresponding to XML tags, attributes (only used for
	 results), values (always strings) and possibly children,
	 corresponding to nested tagged items.	See NaServer for
	 instructions on using NaElements to invoke ONTAPI API calls.

	 The following routines are available for constructing and
	 accessing the contents of NaElements.

       1mnew($name, $value)0m

	 Construct a new NaElement.  The $value parameter is
	 optional for top level elements.

       4mresults_status()0m

	 Indicates success or failure of API call.
	 Returns either "passed" or "failed".

       4mresults_reason()0m

	 Human‐readable string describing a failure.
	 Only present if results_status does not return "passed’.

       4mresults_errno()0m

	 Returns an error number, 0 on success.

       1mchild_get($name)0m

	 Get a named child of an element, which is also an
	 element.  Elements can be nested arbitrarily, so
	 the element you get with this could also have other
	 children.  The return is either an NaElement named
	 $name, or undef if none is found.

       1mset_content($content)0m

	 Set the element’s value to $content.  This is
	 not needed in normal development.

       4mget_content()0m

	 Get the content of the element.

       1madd_content($content)0m

	 Add the element’s value to $content.  This is
	 not needed in normal development.

       4mhas_children()0m

	 Returns "1" if the element has any children,
	 "0" otherwise.

       1mchild_add($elt)0m

	 Add the element $elt to the children list of
	 the current object, which is also an element.

       1mchild_add_string($name, $value)0m

	 Construct an element with name $name and contents
	 $value, and add it to the current object, which
	 is also an element.

       1mchild_get_string($name)0m

	 Gets the child named $name from the current object
	 and returns its value.	 If no child named $name is
	 found, returns undef.

       1mchild_get_int($name)0m

	 Gets the child named $name from the current object
	 and returns its value as an integer.  If no child
	 named $name is found, returns undef.

       4mchildren_get()0m

	 Returns the list of children as an array.

       4msprintf()0m

	 Sprintf pretty‐prints the element and its children,
	 recursively, in XML‐ish format.  This is of use
	 mainly in exploratory and utility programs.  Use
	 child_get_string() to dig values out of a top‐level
	 element’s children.

       1mchild_add_string_encrypted($name, $value22m, $key)

	 Same as child_add_string, but encrypts $value
	 with $key before adding the element to the current
	 object.  This is only used at present for certain
	 key exchange operations.  Both client and server
	 must know the value of $key and agree to use this
	 routine and its companion, child_get_string_encrypted().
	 The default key will be used if the given key is undef.
       =cut

       sub child_add_string_encrypted($$$) {	  my $self = shift;	 my
       $name = shift;	   my $value = shift;	   my $key = shift;

	       if (!$name or !$value) {
		       die "Invalid input specified for name or value";
	       }
	       if (!$key) {
		       $key = $DEFAULT_KEY;
	       }
	       if (length($key) != 16) {
		       die "Invalid key, key length should be 16";
	       }
	       my $encrypted_value = RC4($key, $value);
	       $self‐>child_add_string($name, unpack("H*", $encrypted_value));
       }

       #============================================================#

       1mchild_get_string_encrypted($name, $key)0m

	 Get the value of child $name, and decrypt
	 it with $key before returning it.
	 The default key will be used if the given key is undef.
       =cut

       sub child_get_string_encrypted($$) {	 my $self = shift;	my
       $name = shift;	   my $key = shift;

	       if (!$key) {
		       $key = $DEFAULT_KEY;
	       }
	       if (length($key) != 16) {
		       die "Invalid key, key length should be 16";
	       }
	       my $value = $self‐>child_get_string($name);
	       my $plaintext = RC4($key, pack("H*", $value));
	       return ($plaintext);
       }

       #============================================================#

       4mtoEncodedString()0m

	 Encodes string embedded with special chars like &,<,>.
	 This is mainly useful when passing string values embedded
	 with special chars like &,<,> to API.

	 Example :
	 $server‐>invoke("qtree‐create","qtree","abc<qt0",volume,"vol0");

1mCOPYRIGHT0m
	 Copyright 2002‐2003 Network Appliance, Inc. All rights
	 reserved. Specifications subject to change without notice.

	 This SDK sample code is provided AS IS, with no support or
	 warranties of any kind, including but not limited to
	 warranties of merchantability or fitness of any kind,
	 expressed or implied.	This code is subject to the license
	 agreement that accompanies the SDK.



perl v5.8.8			  2011‐09‐28	    perl::NetApp::NaElement(3)
