NWScanNCPExtensions(3nw)


NWScanNCPExtensions -- iteratively returns information on registered NCP Extensions

Synopsis

   #include <ncpext.h> 
   

int NWScanNCPExtensions( LONG *NCPExtensionID, char *NCPExtensionName, BYTE *majorVersion, BYTE *minorVersion, BYTE *revision, void *queryData);

#include <nwncpext.h> or #include <nwcalls.h>

NWCCODE N_API NWScanNCPExtensions( NWCONN_HANDLE conn, pnuint32 NCPExtensionID, pnstr8 NCPExtensionName, pnuint8 majorVersion, pnuint8 minorVersion, pnuint8 revision, pnuint8 queryData);

Description

Note that two versions of this function are defined, depending on the header file in use.

The parameters are as follows:

conn
<nwncpext.h> and <nwcalls.h> version only: indicates the NetWare server connection handle.

NCPExtensionID
Points to the ID of the desired NCP Extension.

NCPExtensionName
Points to the name of the NCP Extension that was found.

majorVersion
Points to the major version number of the NCP Extension provider. (Optional: can be set to NULL if this information is not needed.)

minorVersion
Points to the minor version number of the NCP Extension provider. (Optional: can be set to NULL if this information is not needed.)

revision
Points to the revision number of the NCP Extension provider. (Optional: can be set to NULL if this information is not needed.)

queryData
Points to 32 bytes of information from the NCP Extension's service provider.

Return values

0 (0x00) SUCCESSFUL NCP Extension information was returned, and all non-NULL output parameters are filled.
1-16 - - An NCP error occurred; see <niterror.h>.
255 (0xFF) ERR_NO_ITEMS_FOUND No more NCP Extensions were found.

 
 0      (0x00)   SUCCESSFUL           NCP Extension 
                                      information was 
                                      returned, and 
                                      all non-NULL 
                                      output 
                                      parameters are 
                                      filled. 
 1-16   -        -                    An NCP error 
                                      occurred; see 
                                      <niterror.h>. 
 255    (0xFF)   ERR_NO_ITEMS_FOUND   No more NCP 
                                      Extensions were 
                                      found. 

Notices

NWScanNCPExtensions, NWGetNCPExtensionInfo (NLM), and NWSendNCPExtensionRequest are the client (NLM and workstation) functions for NCP Extensions.

NWScanNCPExtensions can be used iteratively to return the names of all the NCP Extensions registered on the server being queried. To scan the complete list of NCP Extensions, start with NCPExtensionID set to BEGIN_SCAN_NCP_EXTENSIONS. When NWScanNCPExtensions returns, NCPExtensionID is set to the ID of the first NCP Extension in the list, and the return value is SUCCESSFUL. Then use the ID in NCPExtensionID as a seed value to find the next NCP Extension ID. Continue calling NWScanNCPExtensions, using the new IDs returned in NCPExtensionID, until you find the information you want or until ERR_NO_ITEMS_FOUND is returned as shown in the example for NWScanNCPExtensions.

Note that the IDs of NCP Extensions are not always consecutive numbers. Therefore, you should not assume that if you increment the value in NCPExtensionID by one that it is a valid NCP Extension ID.

NWScanNCPExtensions is most likely to be used when you want to list the names of the NCP Extensions but are not looking for the name of a specific extension. If you know the name of your NCP Extension, such as ``My NCP Extension,'' you should call NWGetNCPExtensionInfo (NLM) to see if the extension is registered, because NWGetNCPExtensionInfo needs to be called only once.

Like NWGetNCPExtensionInfo, you can call NWScanNCPExtensions to do the following:

The NCPExtensionName should be set to a buffer that is MAX_NCP_EXTENSION_NAME_BYTES (33) bytes long. The returned name is case sensitive and is unique for each NCP Extension.

The fields majorVersion, minorVersion, and revision are assigned by the registering NLM when it calls NWRegisterNCPExtension. If you are going to have different versions or revisions of the NCP Extension, the client can use these fields to verify that the extension is of the correct version. If you do not want to use this information, you can pass NULL in these parameters.

In some cases NWScanNCPExtensionInfo can return all of the information you need, eliminating the need to call NWSendNCPExtensionRequest. This is accomplished through the queryData pointer which is set to point to the buffer (32 bytes or less) allocated when the NLM calls NWRegisterNCPExtension. If all the information you want can be returned in this buffer, you can simplify the service by obtaining the buffer contents with NWGetNCPExtensionInfo (NLM). (Receiving information in this manner does not call the NCP Extension handler.) This method is useful only if a one-way server-to-client message is sufficient.

If you do not need the information that is returned in the buffer, you can pass NULL for this parameter.

Services

NCP Extension

Example

   #include <stdio.h> 
   #include <ncpext.h> 
   #include <niterror.h> 
   

main() { BYTE majorVersion, minorVersion, revision; char NCPExtensionName[33]; int cCode; LONG NCPExtensionID; NCPExtensionID = BEGIN_SCAN_NCP_EXTENSIONS /* -1 */

do{ cCode = NWScanNCPExtensions(&NCPExtensionID,NCPExtensioName, &majorVersion,\ &minorVersion, &revision, NULL); if(cCode == 0) { printf(``\nExtension Name = %s, Extension ID = %d'',NCPExtensionName,\ NCPExtensionID); printf(``\nMajor Version = %d, Minor Version = %d, Revision = %d'',\ majorVersion, minorVersion, revision); } } while(cCode != ERR_NO_ITEMS_FOUND); }

References

NWGetNCPExtensionInfo(3nw), NWNCPExtensionRequest(3nw), NWFragNCPExtensionRequest(3nw), NWGetNCPExtensionInfoByName(3nw), NWGetNCPExtensionsList(3nw), NWDeRegisterNCPExtension(3nw), NWGetNumberNCPExtensions(3nw)
30 January 1998
© 1998 The Santa Cruz Operation, Inc. All rights reserved.