****************************** MODULE HEADER *******************************
*                                                                          *
* PRODUCT  : CTOS LANce R1.0                                               *
*                                                                          *
* FILE NAME: NetBIOS.Inc                                                   *
*                                                                          *
* COMPILER : Ctos PASCAL			                                        *
*                                                                          *
* 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) 1992 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.                *

CONST
      W_ADD_GP_NM		= 36
      N_ADD_GP_NM		= B6
      W_ADD_NAME		= 30
      N_ADD_NAME		= B0
      W_CALL			= 10
      N_CALL			= 90
      W_CHAIN_SND		= 17
      N_CHAIN_SND		= 97
      W_CHN_SND_NACK	= 72
      N_CHN_SND_NACK	= F2
      W_DELETE_NM		= 31
      N_DELETE_NM		= B1
      W_FIND_NAME		= 78
      N_FIND_NAME		= F8
      W_HANG_UP			= 12
      N_HANG_UP			= 92
      W_LISTEN			= 11
      N_LISTEN			= 91
      W_RECEIVE			= 15
      N_RECEIVE			= 95
      W_RECEIVE_ANY		= 16
      N_RECEIVE_ANY		= 96
      W_RCV_BRC_DG		= 23
      N_RCV_BRC_DG		= A3
      W_RECEIVE_DG		= 21
      N_RECEIVE_DG		= A1
      W_SEND			= 14
      N_SEND			= 94
      W_SND_BRC_DG		= 22
      N_SND_BRC_DG		= A2
      W_SEND_DG			= 20
      N_SEND_DG			= A0
      W_SEND_NACK		= 71
      N_SEND_NACK		= F1
      W_SESS_STAT		= 34
      N_SESS_STAT		= B4
      W_STATUS			= 33
      N_STATUS			= B3
      W_TRACE			= 79
      N_TRACE			= F9
      W_CANCEL			= 35
      W_RESET			= 32
      W_UNLINK			= 70
      N_LAN_STA_ALRT	= F3


* NetBIOS NCB RETURN CODES *

      RET_OK				= 00	* Good Return							*
      RET_INVBUFLEN			= 01	* Illegal Buffer Length				*
      RET_INVCMD			= 03	* Invalid Command						*
      RET_CMDTIMEOUT		= 05	* Command Timed Out					*
      RET_MSGINCMPLT		= 06	* Message Incomplete					*
      RET_NODATANACK		= 07	* Data for SEND type NO.ACK not rcvd	*
      RET_INVLCLSESS		= 08	* Illegal Local Session Id				*
      RET_NORESOURCES		= 09	* No resources available				*
      RET_SESSCLOSED		= 0A	* Session Closed						*
      RET_CMDCNCLD			= 0B	* Command Cancelled					*
      RET_DUPLCLNAME		= 0D	* Duplicate name in local name table	*
      RET_NAMETBLFULL		= 0E	* Name Table Full						*
      RET_NAMEDEREGOK		= 0F	* Name has active sess and now dereg	*
      RET_LCLSESSTBLFULL	= 11	* Local Session Table Full				*
      RET_SESSOPENREJECT	= 12	* Session Open Rejected				*
      RET_INVNAMENUM		= 13	* Illegal Name Number					*
      RET_CLDNMENOTFND		= 14	* Called name cannot be found			*
      RET_NAMENOTFOUND		= 15	* Name not found or Cannot specify *	*
      RET_NAMEINUSE			= 16	* Name in use by remote NETBIOS		*
      RET_NAMEDELETED		= 17	* Name Deleted							*
      RET_SESSENDABNORM		= 18	* Session ended abnormally				*
      RET_NAMECONFLICT		= 19	* Name Conflict Detected				*
      RET_INTFCBUSY			= 21	* Interface Busy						*
      RET_TOOMANYCMDS		= 22	* Too many Commands Outstanding		*
      RET_INVLANANUM		= 23	* Invalid Number in NCB_LANA_NUM field	*
      RET_CMDCOMPCNCL		= 24	* Command Completed while cancel occur	*
      RET_INVCANCELCMD		= 26	* Command not valid to Cancel			*
      RET_NAMEDEFINED		= 30	* Name defined by another environment	*
      RET_ENVNOTDEFINED		= 34	* Environment Not Defined; Issue Reset	*
      RET_NOOSRESOURCES		= 35	* OS Resources Exhausted; Retry later	*
      RET_MAXAPPLEXCEED		= 36	* Maximum Applications exceeded		*
      RET_NONETBIOSSAPS		= 37	* No SAPs available for NETBIOS		*
      RET_REQRSRCSNA		= 38	* Requested Resource(s) not available 	*
      RET_INVNCBLENGTH		= 39	* Invalid NCB Address or length		*
      RET_RESETINV			= 3A	* Reset may not be issued by NETBIOS	*
      RET_INVDDID			= 3B	* Invalid NCB_DD_ID value				*
      RET_NETBLOCKFAIL		= 3C	* NETBIOS lock user storage failure	*
      RET_NETBDDRIVERR		= 3F	* NETBIOS Device Driver open error		*
      RET_OS2ERROR			= 40	* OS2 (or CTOS) Error detected			*
      RET_NETSTATUS1		= 4E	* Network Status  bits 1214 Timeout	*
      RET_NETSTATUS2		= 4F	* Network Status  bits 811 on		*
      RET_CCBERROR			= F6	* Unexpected error on CCB completion	*
      RET_DIRINITERR		= F7	* Error in implicit DIR.INITIALIZE		*
      RET_DIROPENERR		= F8	* Error in implicit DIR.OPEN.ADAPTOR	*
      RET_ADAPTERERR		= F9	* Adapter Support Software error		*
      RET_ADAPTERCHECK		= FA	* Adapter Check						*
      RET_NONETBIOS			= FB	* NETBIOS program not loaded in PC		*
      RET_DIROPENFAIL		= FC	* DIR.OPEN or DLC.OPEN failure			*
      RET_UNXADPTRCLS		= FD	* Unexpected adaptor close				*
      RET_NETBIOSNOOP		= FE	* NETBIOS Not operational				*

TYPE
      Erctype = Word;
      Pointer = Ads of Byte;
      Quad    = Ads of Word;

* NETWORK CONTROL BLOCK (NCB) STRUCTURE *

	NCBType = Record
		NCB_command		[00] : Byte;
		NCB_retcode		[01] : Byte;
		NCB_lsn			[02] : Byte;
		NCB_num			[03] : Byte;
 		NCB_buffer		[04] : Pointer;
		NCB_length		[08] : Word;
	 	NCB_callname	[10] : string(16);
	 	NCB_localname	[26] : string(16);
		NCB_rto			[42] : Word;
		NCB_sto			[44] : Word;
	 	NCB_post		[46] : Pointer;
		NCB_adptr_id	[50] : Byte;
		NCB_cmd_cmpl	[51] : Byte;

******************************************************************************
	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.
******************************************************************************
		pbRouteInfo		[52] : Pointer; 				 4 Bytes.
		cbRouteInfo		[56] : Byte;    				 1 Byte.
		Reserved		[57] : Array [1..9] of Byte;     NEVER USE THIS AREA
	End;

	pNCBType = Ads of NCBType;

* CTOS NCB INTERFACE *

FUNCTION NetBIOS( pNcb 	:	pNCBType ) : ErcType; EXTERN;

20
      N_SEND_DG			= A0
      W_SEND_NACK		= 71
      N_SEND_NACK		= F1
      W_