	IFND	DIGNET_I
DIGNET_I	SET	1

**
**	dignet.library include
**
**	Copyright © 1997 by Kenneth "Kenny" Nilsen/Digital Surface
**
**	$VER: DIGNET_I 1.3 (14.7.97)
**
**

	IFND	EXEC_TYPES_I
	include	"exec/types.i"
	ENDC

	IFND	DOS_I
	include	"dos/dos.i"
	ENDC

* Error codes

DNETERROR_OK		EQU	0	;everything is ok
DNETERROR_OVERFLOW	EQU	-1	;buffer overflow (your string buffer)
DNETERROR_WRONGNET	EQU	-2	;you tried to free wrong net structure
DNETERROR_TIMEOUT	EQU	-3	;timed out waiting to receivce chars
DNETERROR_POINTERERROR	EQU	-4	;wrong pointer (null ptr.)
DNETERROR_OUTOFMEMORY	EQU	-5	;not enough memory (Send/ReceiveNet())
DNETERROR_FILEERROR	EQU	-6	;file not found (Send/ReceiveNet())
DNETERROR_PROTOCOL	EQU	-7	;protocol error (not a protocol in
					;the other end?)
DNETERROR_ABORTED	EQU	-8	;protocol was aborted

* IOEXT

DNIOEXT_SIZEOF		EQU	80	;max size for IOEXT structure

* InitModem buffer size

INITMODEMBUFFER		EQU	16	;length of initmodem's buffer

* Resource tracking public structure

   STRUCTURE DIGNETRT,0
	ULONG	DNRT_ID			;net ID
	APTR	DNRT_NET		;ptr. to netstructure
	APTR	DNRT_TASK		;ptr. to task structure using the net
	APTR	DNRT_TASKNAME		;ptr. to task name of that task
	APTR	DNRT_DEVICENAME		;ptr. to device name in use
	UWORD	DNRT_UNIT		;unit number in use
	APTR	DNRT_SP			;return address
	APTR	DNRT_MESSAGEPORT	;ptr. to message port of device
	APTR	DNRT_MESSAGESTRUCT	;ptr. to IO message of device
	ULONG	DNRT_LASTCOMMAND	;command number on last librarycall
	WORD	DNRT_TASKSTATUS		;BOOL on the tasks existance (true=ok)
	STRUCT	DNRT_reserved,20	;reserved for future extensions
	LABEL	DNRT_SIZEOF

; NOTE WELL: The public structure is NOT compatible with the private structure!


* Command numbers:

CMDALLOCNET		EQU	1
CMDREADNET		EQU	2
CMDWRITENET		EQU	3
CMDQUERYNET		EQU	4
CMDABORTNET		EQU	5
CMDINITIOEXT		EQU	6
CMDREADIOEXT		EQU	7
CMDSENDNET		EQU	8
CMDRECEIVENET		EQU	9
CMDTIMEOUT		EQU	10
;** new from v2
CMDREADSTRING		EQU	11
CMDWRITESTRING		EQU	12
CMDGETNETPORT		EQU	13
;** new from v3
CMDINITMODEM		EQU	14
CMDCALLMODEMDT		EQU	15
CMDCALLMODEMDP		EQU	16
CMDWAITMODEM		EQU	17
CMDHANGUPMODEM		EQU	18
CMDSTOPWAITING		EQU	19
CMDFLUSHNET		EQU	20
CMDSETBAUD		EQU	21
CMDCONVERTMODEMSTRING	EQU	22
CMDGETIOMSG		EQU	23
CMDGETMODEMSTATUS	EQU	24
CMDGETCURRENTDEVICE	EQU	25
CMDGETCURRENTUNIT	EQU	26
CMDGETBAUDRATE		EQU	27
CMDPARSECONNECT		EQU	28
CMDSETDEFAULT		EQU	29
CMDCONVERTTOPC		EQU	30
CMDCONVERTTOAMIGA	EQU	31
CMDFREECONVERT		EQU	32
CMDOBTAINNET		EQU	33
;** new from v4
CMDWAITTEXT		EQU	34
CMDCONVERSETEXT		EQU	35
CMDCAPTURETEXTSTART	EQU	36
CMDCAPTURETEXTEND	EQU	37
CMDSETPARITY		EQU	38
CMDSETHANDSHAKE		EQU	39
CMDSETSTOPBITS		EQU	40
CMDSETBITWIDTH		EQU	41
CMDGETPARITY		EQU	42
CMDGETHANDSHAKE		EQU	43
CMDGETSTOPBITS		EQU	44
CMDGETBITWIDTH		EQU	45

* New from 3.1:

; Update structure for the DigNet protocol:

     STRUCTURE	DNUPDATE,0

	STRUCT	DNU_FILENAME,108		;name of file without path
	ULONG	DNU_FILESIZE			;size of file in bytes
	ULONG	DNU_RATE			;transfer rate bytes/s
	STRUCT	DNU_EXPECTED,ds_SIZEOF		;expected time on transfer
	STRUCT	DNU_USED,ds_SIZEOF		;time used on transfer
	UWORD	DNU_STATUS			;status flags
	LONG	DNU_HOOK			;hook to be called after each
						;block transfer
	LABEL	DNU_SIZEOF

DNUSTATUS_OK		EQU	$0		;everything is ok
DNUSTATUS_ERROR		EQU	$1		;transfer had an error
DNUSTATUS_RESENDING	EQU	$2		;resending block/file
DNUSTATUS_WAITING	EQU	$4		;waiting to receive/send file
DNUSTATUS_ABORT		EQU	$8		;was aborted
						;(if you set this flag the
						;protocol will be aborted)
DNUSTATUS_END		EQU	$10		;end of file (done)

;To let user abort a protocol transfer you need to create a subtask that will
;check for user input such as keypress/mousebutton/gadget etc. If user want to
;abort transfer you must set the _abort flag. The other end of the protocol
;will read  this as user abort and end. If not this flag can be interacted the
;protocol will not stop until the whole file is transfered/resent error free.

*** CaptureTextStart modes:

DNCAPTURENEW		EQU	0
DNCAPTUREAPPEND		EQU	-1

*** Modes for SetParity

DNPARITYNONE		EQU	0
DNPARITYEVEN		EQU	1
DNPARITYODD		EQU	2
DNPARITYMARK		EQU	3
DNPARITYSPACE		EQU	4

*** Modes for SetHandshake

DNHANDSHAKENONE		EQU	0
DNHANDSHAKE7WIRE	EQU	1		;RTS/CTS
DNHANDSHAKEX		EQU	2		;XON/XOFF


	ENDC	;DIGNET_I
