NetBios

  UCHAR Netbios(pncb);    
  PNCB pncb; /* address of the NCB */

The Netbios function interprets and executes the specified network control block (NCB).

Parameters

pncb

Points to an NCB structure describing the NCB to process.

The NCB structure has the following format:

typedef struct _NCB { /* ncb */

UCHAR ncb_command; /* command code */

UCHAR ncb_retcode; /* return code */

UCHAR ncb_lsn; /* local session number */

UCHAR ncb_num; /* number of network name */

PUCHAR ncb_buffer; /* address of message buffer */

WORD ncb_length; /* size of message buffer */

UCHAR ncb_callname[NCBNAMSZ]; /* blank-padded name of remote */

UCHAR ncb_name[NCBNAMSZ]; /* blank-padded name of local */

UCHAR ncb_rto; /* receive timeout/retry count */

UCHAR ncb_sto; /* send timeout/system timeout */

void (*ncb_post) (struct _NCB *); /* POST routine address */

UCHAR ncb_lana_num; /* lana (adapter) number */

UCHAR ncb_cmd_cplt; /* 0xff => command pending */

UCHAR ncb_reserve[10]; /* reserved, used by BIOS */

HANDLE ncb_event; /* signaled when ASYNCH completes */

} NCB, *PNCB;

Return Value

For accepted asynchronous requests, the return value is zero.

For non-asynchronous requests, the return value is the completion code (also returned in the ncb_retcode member of the NCB structure).

Comments

The Netbios function is provided primarily for applications that were written for the IBM Netbios system and need to be ported to Windows. Applications that do not have this requirement typically use other interfaces, such as mailboxes and named pipes, instead of Netbios.

The Netbios function contains extensions to the standard IBM Netbios 3.0 specification to allow POST routines to be called from C and to operate efficiently in the Windows environment.

When an asyychronous NCB completes and ncb_post is non-zero, the routine specified in ncb_post is called with a single parameter of type PNCB. This parameter contains the address of the completing NCB. (In standard IBM Netbios 3.0 the address of the NCB is supplied in a non-portable interface.)

Another extension to the NCB structure is a handle to an event (ncb_event). The event is set to the signalled state by the system when an asynchronous NCB completes. Using ncb_event to submit asynchronous requests requires fewer system resources than using ncb_post. Also, when ncb_event is non-zero, the pending request is canceled if the thread terminates before the request is processed. (This cancelation behavior is not true for requests sent with ncb_post.)

See Also

NCB