ncp_open

Creates a NetWare Core Protocol (NCP) session with the named NetWare server.

Library:LibC
Classification:Novell
Service:NCP Client

Syntax

  #include <client.h>
   
  int ncp_open (
     const char     *servername,
     int             oflag,
     unsigned long   flags,
     int             identity );
  

Parameters

servername

(IN) Points to the name of the NetWare server, either local or remote.

oflag

(IN) Specifies the open mode with one of the following values:

Flag

Value

Description

0

Indicates that the file descriptor should remain open.

FD_CLOEXEC

0x00008000

Closes the file descriptor on execution. The O_CREAT flag must also be specified with FD_CLOEXEC. (These flags are defined in the fcntl.h file. Do not include any of the other flags; they cause an error.)

flags

(IN) Specifies whether the servername parameter points to a name or a network address.

Flag

Value

Description

ORIGIN_NAME

0x0010

Indicates that the value in the servername parameter should be treated as a string.

ORIGIN_ADDRESS

0x0020

Indicates that the value in the servername parameter should be treated as a network address (netaddr_t format). If used, it must also specify the type of address: ADDR_IPX, ADDR_IP, or ADDR_IPV6. Not currently supported.

identity

(IN) Specifies an identity returned from a call to the create_identity function.

Return Values

If successful, returns an NCP session handle. Otherwise returns -1 and sets errno.

Decimal

Constant

Description

5

ENOMEM

Unable to allocate memory for the task.

9

EINVAL

One of the parameters contains invalid data. The identity is invalid. The oflag parameter contains illegal values. The flags parameter contains ORIGIN_ADDRESS without the type of address.

65

ENAMETOOLONG

The servername value is too long.

105

ENOCONTEXT

The calling thread has no context.

116

ENCP

A client error occurred. Check clienterrno for the NCP client error that has occurred.

Remarks

Once you have an NCP session handle, you use ncp_send to send requests to the server.

The close() function is used to dismantel the session and disposes of all associated resources. It does not, however, dispose of the user identity passed to ncp_open. For information on deleting an identity token, see the delete_identity function.

An identity created with the create_server_identity function does not work when attempting to create a session with a remote server.

Most file system operation functions do not work with session descriptors; the select function is one that does although it always returns ready except when in the third array. The session descriptor can be dup’d and is open and accessible in children created with fork as well as exec’d children as long as FD_CLOEXEC was not passed in oflag when the parent opened the session.

Certain file system operation requests (such as eof, ioctl, filelength, tell, lseek, read, write, readv, writev, pread, and pwrite) make no sense with an NCP session handle. When one of these functions is called using an NCP session handle, EWRNGKND is passed back to signal this fact.

See Also