NWRegisterNCPExtension
Registers a service to be provided as an NCP extension
#include <nlm\nwncpx.h>
int NWRegisterNCPExtension (
const char *NCPExtensionName,
BYTE (*NCPExtensionHandler)(
NCPExtensionClient *client,
void * requestData,
LONG requestDataLen,
void * replyData,
LONG *replyDataLen),
void (*ConnectionEventHandler)(
LONG connection,
LONG eventType)
void (*ReplyBufferManager)(
NCPExtensionClient *client,
void * replyBuffer),
BYTE majorVersion,
BYTE minorVersion,
BYTE revision,
void **queryData);
The following table lists return values and descriptions.
NWRegisterNCPExtension is called by the service-providing NLM applications in conjunction with the NWDeRegisterNCPExtension function.
NCP extension names are case sensitive and must be unique. They have a maximum length of 32 bytes plus a NULL terminator.
The queryData parameter can be used by the service provider to return up to 32 bytes of information to the client and is aligned on a DWORD (32-bit) boundary. This information can then be retrieved by calling the NWGetNCPExtensionInfo (NLM) or NWScanNCPExtensions (NLM) function. The queryData parameter is also used by the registering NLM as the NCP extension handle when the NWDeRegisterNCPExtension function is called.
NOTE:The NCPExtensionHandler parameter returns a BYTE representing the value returned when the NWSendNCPExtensionRequest function is called. The extension handler can return any value other than those used by the lower-level NCP-transport services (see niterror.h). However, information is placed into the replyData parameter after the NCPExtensionHandler parameter returns SUCCESSFUL.
Other status information can be returned to the client with the extension handler. However, do not return any values (other than SUCCESSFUL) that NWRegisterNCPExtension can return. Otherwise, future versions of the OS might return values you have defined and confuse their meaning. If the extension handler always returns SUCCESSFUL and then uses a "status" field in the replyData parameter to return status information, the meaning of each return value will be clear.
If you can provide all needed information by updating the 32-byte queryData buffer, pass NULL to the NCPExtensionHandler parameter. Then call either the NWGetNCPExtensionInfo (NLM) or NWScanNCPExtensions (NLM) function to obtain information in the queryData buffer. This is a passive method of passing information. The NCP extension will not be notified that the queryData parameter was accessed.
NOTE:The NCPExtensionHandler, ConnectionEventHandler, and ReplyBufferManager parameters are function callbacks that run as OS threads. They need to have CLIB context if they are going to make calls into CLIB that need context.
The function pointed to by the NCPExtensionHandler parameter has the following parameters:
The function pointed to by the ConnectionEventHandler parameter has the following parameters:
You must decide if it is important for your service to be aware of when clients (particularly the NCP extension clients) log out or terminate a connection.
The ConnectionEventHandler parameter does not return a value.
The function pointed to by the ReplyBufferManager parameter has the following parameters: