****************************** MODULE HEADER *******************************
*                                                                          *
* PRODUCT  : CTOS LANce c1.0BULL                                          *
*                                                                          *
* FILE NAME: NetBIOS.h                                                     *
*                                                                          *
* COMPILER : BTOS C 1.0.1 or later                                         *
*                                                                          *
* DESCRIPTION: Include file for NetBIOS Application programs.              *
*                                                                          *
*                      PROPRIETARY PROGRAM MATERIAL                        *
*                                                                          *
*         THIS  MATERIAL IS PROPRIETARY TO UNISYS CORPORATION AND          *
*         IS NOT TO  BE  REPRODUCED,  USED OR DISCLOSED EXCEPT IN          *
*         ACCORDANCE   WITH   PROGRAM   LICENSE  OR  UPON WRITTEN          *
*         AUTHORIZATION OF THE GENERAL COUNSEL, OFFICE OF GENERAL          *
*         COUNSEL, UNISYS CORPORATION,  BLUE BELL, PA. 19424, USA          *
*                                                                          *
*         COPYRIGHT (C) 1993 UNISYS CORPORATION                            *
*                                                                          *
*         THE WITHIN INFORMATION IS NOT INTENDED TO BE NOR SHOULD          *
*         SUCH BE CONSTRUED AS AN AFFIRMATION OF FACT, REPRESENT          *
*         ATION OR  WARRANTY BY  UNISYS  CORPORATION OF ANY TYPE,          *
*         KIND, OR CHARACTER.  THE WITHIN PRODUCT AND THE RELATED          *
*         MATERIALS ARE  ONLY  FURNISHED  PURSUANT AND SUBJECT TO          *
*         THE  TERMS AND  CONDITIONS  OF A DULY  EXECUTED LICENSE          *
*         AGREEMENT.  THE  ONLY  WARRANTIES  MADE BY  UNISYS WITH          *
*         RESPECT TO THE PRODUCTS  DESCRIBED IN THIS MATERIAL ARE          *
*         SET FORTH  IN THE ABOVE FURNISHED  MENTIONED AGREEMENT.          *
*                                                                          *
*         THE  CUSTOMER SHOULD EXERCISE CARE TO ASSURE THAT USE OF         *
*         THE SOFTWARE WILL BE IN FULL COMPLIANCE WITH LAWS, RULES         *
*         AND  REGULATIONS OF  THE JURISDICTIONS  WITH RESPECT  TO         *
*         WHICH IT IS USED.                                                *
*                                                                          *
************************** END MODULE HEADER *******************************

	* NetBIOS NCB COMMAND CODES:                                         *
	*  Most NCB commands are available in two flavors, WAIT and NO_WAIT. *
	*  In the list below, codes for WAIT commands have a 'W_' prefix,    *
	*  and codes for NO_WAIT commands have a 'N_' prefix.                *

define W_ADD_GP_NM		0x36
define N_ADD_GP_NM		0xB6
define W_ADD_NAME		0x30
define N_ADD_NAME		0xB0
define W_CALL			0x10
define N_CALL			0x90
define W_CHAIN_SND		0x17
define N_CHAIN_SND		0x97
define W_CHN_SND_NACK	0x72
define N_CHN_SND_NACK	0xF2
define W_DELETE_NM		0x31
define N_DELETE_NM		0xB1
define W_FIND_NAME		0x78
define N_FIND_NAME		0xF8
define W_HANG_UP		0x12
define N_HANG_UP		0x92
define W_LISTEN		0x11
define N_LISTEN		0x91
define W_RECEIVE		0x15
define N_RECEIVE		0x95
define W_RECEIVE_ANY	0x16
define N_RECEIVE_ANY	0x96
define W_RCV_BRC_DG	0x23
define N_RCV_BRC_DG	0xA3
define W_RECEIVE_DG	0x21
define N_RECEIVE_DG	0xA1
define W_SEND			0x14
define N_SEND			0x94
define W_SND_BRC_DG	0x22
define N_SND_BRC_DG	0xA2
define W_SEND_DG		0x20
define N_SEND_DG		0xA0
define W_SEND_NACK		0x71
define N_SEND_NACK		0xF1
define W_SESS_STAT		0x34
define N_SESS_STAT		0xB4
define W_STATUS		0x33
define N_STATUS		0xB3
define W_TRACE			0x79
define N_TRACE			0xF9
define W_CANCEL		0x35
define W_RESET			0x32
define W_UNLINK		0x70
define N_LAN_STA_ALRT	0xF3


	* NetBIOS NCB RETURN CODES *

define RET_OK				0x00	* Good Return							*
define RET_INVBUFLEN		0x01	* Illegal Buffer Length				*
define RET_INVCMD			0x03	* Invalid Command						*
define RET_CMDTIMEOUT		0x05	* Command Timed Out					*
define RET_MSGINCMPLT		0x06	* Message Incomplete					*
define RET_NODATANACK		0x07	* Data for SEND type NO.ACK not rcvd	*
define RET_INVLCLSESS		0x08	* Illegal Local Session Id				*
define RET_NORESOURCES		0x09	* No resources available				*
define RET_SESSCLOSED		0x0A	* Session Closed						*
define RET_CMDCNCLD		0x0B	* Command Cancelled					*
define RET_DUPLCLNAME		0x0D	* Duplicate name in local name table	*
define RET_NAMETBLFULL		0x0E	* Name Table Full						*
define RET_NAMEDEREGOK		0x0F	* Name has active sess and now dereg	*
define RET_LCLSESSTBLFULL	0x11	* Local Session Table Full				*
define RET_SESSOPENREJECT	0x12	* Session Open Rejected				*
define RET_INVNAMENUM		0x13	* Illegal Name Number					*
define RET_CLDNMENOTFND	0x14	* Called name cannot be found			*
define RET_NAMENOTFOUND	0x15	* Name not found or Cannot specify *	*
define RET_NAMEINUSE		0x16	* Name in use by remote NETBIOS		*
define RET_NAMEDELETED		0x17	* Name Deleted							*
define RET_SESSENDABNORM	0x18	* Session ended abnormally				*
define RET_NAMECONFLICT	0x19	* Name Conflict Detected				*
define RET_INTFCBUSY		0x21	* Interface Busy						*
define RET_TOOMANYCMDS		0x22	* Too many Commands Outstanding		*
define RET_INVLANANUM		0x23	* Invalid Number in NCB_LANA_NUM field	*
define RET_CMDCOMPCNCL		0x24	* Command Completed while cancel occur	*
define RET_INVCANCELCMD	0x26	* Command not valid to Cancel			*
define RET_NAMEDEFINED		0x30	* Name defined by another environment	*
define RET_ENVNOTDEFINED	0x34	* Environment Not Defined; Issue Reset	*
define RET_NOOSRESOURCES	0x35	* OS Resources Exhausted; Retry later	*
define RET_MAXAPPLEXCEED	0x36	* Maximum Applications exceeded		*
define RET_NONETBIOSSAPS	0x37	* No SAPs available for NETBIOS		*
define RET_REQRSRCSNA		0x38	* Requested Resource(s) not available 	*
define RET_INVNCBLENGTH	0x39	* Invalid NCB Address or length		*
define RET_RESETINV		0x3A	* Reset may not be issued by NETBIOS	*
define RET_INVDDID			0x3B	* Invalid NCB_DD_ID value				*
define RET_NETBLOCKFAIL	0x3C	* NETBIOS lock user storage failure	*
define RET_NETBDDRIVERR	0x3F	* NETBIOS Device Driver open error		*
define RET_OS2ERROR		0x40	* OS2 (or CTOS) Error detected			*
define RET_NETSTATUS1		0x4E	* Network Status  bits 1214 Timeout	*
define RET_NETSTATUS2		0x4F	* Network Status  bits 811 on		*
define RET_CCBERROR		0xF6	* Unexpected error on CCB completion	*
define RET_DIRINITERR		0xF7	* Error in implicit DIR.INITIALIZE		*
define RET_DIROPENERR		0xF8	* Error in implicit DIR.OPEN.ADAPTOR	*
define RET_ADAPTERERR		0xF9	* Adapter Support Software error		*
define RET_ADAPTERCHECK	0xFA	* Adapter Check						*
define RET_NONETBIOS		0xFB	* NETBIOS program not loaded in PC		*
define RET_DIROPENFAIL		0xFC	* DIR.OPEN or DLC.OPEN failure			*
define RET_UNXADPTRCLS		0xFD	* Unexpected adaptor close				*
define RET_NETBIOSNOOP		0xFE	* NETBIOS Not operational				*

	* NETWORK CONTROL BLOCK (NCB) STRUCTURE *

typedef struct {
  unsigned char		NCB_command;
  unsigned char		NCB_retcode;
  unsigned char		NCB_lsn;
  unsigned char		NCB_num;
  unsigned char 	*NCB_buffer;
  unsigned 			NCB_length;
  unsigned char 	NCB_callname[16];
  unsigned char 	NCB_localname[16];
  unsigned char		NCB_rto;
  unsigned char		NCB_sto;
  void				(* NCB_post)(void);
  unsigned char		NCB_adptr_id;
  unsigned char		NCB_cmd_cmpl;

******************************************************************************
	The following fields are contained in the reserved area of the NCB.  This
	area is reserved and used internally by NetBIOS.  The user is only allowed
	to use the first 5 bytes of this area.  All other byte MUST BE SET TO 0x00.
	If the first 5 bytes are not used THEY TOO SHOULD BE SET TO 0x00. The first
	5 bytes are used as follows:
	pbRouteInfo: Memory address of a string containing the BNET nodename of
				 the CTOS server on which the NetBIOS Service is installed.
				 If the service is installed locally, this field can be set
				 to ZERO.
	cbRouteInfo: Length of the BNET nodename.  This field must be ZERO if no
				 nodename is specified.
******************************************************************************

  unsigned char		*pbRouteInfo;
  unsigned char		cbRouteInfo;
  unsigned			wCtosErc;
  unsigned char		Reserved[7];  * NEVER USE THIS AREA *
} NCB_Type, *pNCB_Type;

	* CTOS NCB INTERFACE *

ifdef _MSC
extern unsigned _far _plm NetBios ( pNCB_Type pNCB );
else
extern unsigned NetBios plm far ( pNCB_Type pNCB );
endif

ne N_SEND_NACK		0xF1
define W_SESS_STAT		0x34
define N_SESS_STAT		0xB4
define W_STATUS		0x33
define N_STATUS		0xB3
d