use NDSm::Buf_T; use NDSm::NDSContext;
$Context = new NDSm::NDSContext; $Buf = new NDSm::Buf_T;
Then you should use the methods outlined below. Look in the t/ directory for examples.
This extension enables you to modify the data stored in Novell NDS. from perl 5.004 or higher. This module have all the methods for adding, modify and delete data in NDS. You must also use NDSContext.pm to get a handle. You should get the NWSDK with same version as this module from http://developer.novell.com to understand what each method do.
Creates a new Buf_T.
Create a object called $ObjectName (You'll have to use methods for adding data to the buf before calling AddObject) The $iter value should be set to -1. $iters value is returned. I haven't figured this out yet.. Returns undef on failure.
Creates the root object of a new NDS partition but is now obsolete. The server parameter identifies the server where the master replica of the new partition is to be stored. Call AddReplica() and SplitPartition() instead. Returns $iter which can be used in sequensiell calls. Returns undef on failure.
Alloc memory to hold values you specify with Put* methods With no args the alloced space is a default defined in NWSDK. You can also feed it $Size (Integer value). Returns 0 on success.
Compare the attributes stored in $Buf with the attributes associated with object $ObjectName. The value of $match give the result of the compare. 0 : No match. non-zero : Match. returns undef on internal failure.
This method set the internal debugging of a class to a given level. uhmmm, Only 0 and and 1 are in use in version 0.13.03.
Frees the memory allocated for internal structs, giving you a chance to make the buf larger or smaller. Use InitBuf() to initiate already allocated memory. return 0 on success.
Get the number of attributes stored in $Buf. The number of attributes are returned in $AttrCount. return undef on success.
Get the name of the attribute ($AttrName) stored in buf and the number of values associated with the attribute ($Valcount). The $syntaxID associated with this attribute is also returned.
Return the 'human-readable' data stored in $Buf. This method require you to know what kind of data is returned: Read more about this in datatypes.txt. Returns the value as string or integer. returns undef on failure.
Internal use only!!!, if you use this it returns the memory-address of the actual buffer. Please don't use this!!.
Returns the numeric value of a named constant, mostly for internal use.
Returns the number of object stored in the buffer after a Read() in parameter $ObjectCount. Returns undef on failure.
Returns the $ObjectName, number of attributes ($AttrCount), and a hash giving more info about the object in $Buf. The hash has the same keys as the names of the field in the struct Object_Info_T defined in NWSDK.
This method open a SYN_STREAM attribute (login-scripts and other), and associates a file handle with it. The $flag value determines if the file is to opened in read only or write only. "r" or "w". Returns a filehandle that can be used in normal file operations if successful, undef if not. Remember that if you try to open a SYN_STREAM attribute for writing, any attribute value defined is deleted before you get the handle. NB! Remember to call $FilHandle->truncate after you're done writing. If you don't some 'old' lines may included. =cut sub OpenStream($Context, $ObjectName, $AttrName, $flag) { my $self = shift; my ($Context, $ObjectName, $AttrName, $flag) = @_; my ($nwHandle, $fh, $Retval); undef $fh; # First we need to delete the existing value if we are going to write $Retval = 0; if ($flag eq "w") { my $Buf = new NDSm::Buf_T; if (!defined($Buf)){ return undef;} $Retval |= $Buf->AllocBuf(); $Retval |= $Buf->InitBuf($Context, "DSV_MODIFY_ENTRY"); $Retval |= $Buf->PutChange($Context, "DS_OVERWRITE_VALUE", $AttrName); $Retval |= $Buf->PutAttrVal($Context, "SYN_STREAM", 0); $Buf->ModifyObject($Context, $ObjectName, 0, 0); undef $Buf; } if (!($Retval)) { $nwHandle = &NDSm::NWDSOpenStream ($Context, $ObjectName, $AttrName, ($flag eq "w") ? 2 : 1); if (defined($nwHandle)) { $fh = new IO::Handle; if (!($fh->fdopen($nwHandle, $flag))) { if ($self->{DEBUG}) { warn("Could not open SYN_STREAM attribute\n"); warn("Maybe attribute never used before or broken C _open_osfhandle()\n"); } } }else { $self->{LAST_ERR} = &NDSm::GetLastErr(); warn "NWDSOpenStream returning <undef>\n" if $self->{DEBUG}; } } $fh; }
Initiates the buffer for use with a certain operation, Return 0 on success. operations are snipped out of the Novell SDK: Name Related Function(s) DSV_READ ExtSyncRead, ListAttrsEffectiveRights, Read, ReadReferences DSVCOMPARE Compare DSV_SEARCH ExtSyncList, ExtSyncSearch, ListByClassAndName, ListContainers, PutFilter, Search DSV_ADD_ENTRY AddObject DSV_MODIFY_ENTRY ModifyObject DSV_READ_ATTR_DEF ReadAttrDef DSV_DEFINE_CLASS DefineClass DSV_READ_CLASS_DEF ReadClassDef DSV_MODIFY_CLASS_DEF ModifyClassDef DSV_LIST_CONTAINABLE_CLASSES ListContainableClasses DSV_READ_SYNTAXES GetSyntaxDef, PutSyntaxName, and ReadSyntaxes
Returns TRUE (1) if attribute with syntaxId can be read with integer.
Returns TRUE (1) if attribute with syntaxId can be read with string.
Returns TRUE (1) if attribute with $syntaxId is a multiline string.
Return the last error-number from $Buf. The error-number is often an NDS error which is described if you press <F1> in NWadmin (MS Windows) and search for 'Error'.
Query for the subordiantes of $ObjectName (typically a O or OU). $Buf will receive all objects. They can be retrieved by $Buf->GetObjectName(). & $Buf->GetAttrVal. See also t/Browse.t Returns undef on failure and -1 when no more iterations are needed.
Execute a modify object operation on the object named in $ObjName. If iterations are needed the handle is returned in $Iter. See also t/ChangeAttr.t return undef on failure.
Put the attribute name of the attribute to delete, modify, add .... See also t/ChangeAttr.t and t/* Returns 0 on success.
Insert the value of a attribute to delete, modify, add .... This method require that you understand what's outlined in datatypes.txt included with this package. Examples are included in the t/ directory. You unziped with -d didn't you? Returns 0 on success.
Tells the buffer that a change is to be made on a given attribute. ($AttributeName) $OperationName is one of: "DS_OVERWRITE_VALUE", "DS_REMOVE_VALUE", "DS_ADD_VALUE". See also t/ChangeAttr.t Returns 0 on success
Read data from NDS. See t/GetAttr.t Returns undef on failure.
Set a EOF mark in a SYN_STREAM attribute.
http://www.ahs.hist.no/distr/NDSm/
Copyright (c) Steinar Kleven 1997. All rights reserved.
Steinar Kleven, mailto:Steinar.Kleven@ahs.hist.no