;*****************************************************************************
; GETCONN.ASM
;
; 90-12-27 Matt Hagen, Novell, Inc.
;*****************************************************************************

ConnIDTable		struc
 InUse			db	?
 Order			db	?
 Net			db	4 dup(?)
 Node			db	6 dup(?)
 Socket			db	2 dup(?)
 Timeout		db	2 dup(2)
 ImmedAddr		db	6 dup(?)
 Sequence		db	?
 ConnectionNum		db	?
 ConnectionStatus	db	?
 MaxTimeout		db	2 dup(?)
 Reserved		db	5 dup(?)
ConnIDTable		ends

DOSSEG
.MODEL	SMALL
.DATA
.CODE
	public _GetConnectionIDTableEntry

;*****************************************************************************
; int GetConnectionIDTableEntry(
;	WORD connID,
;	ConnIDTable *entry)
;
; connID is an index (1..8) into the table.  entry is a pointer to a buffer
; big enough to hold a ConnIDTable structure.  The routine copies the specified
; Connection ID Table entry into the buffer.  The routine returns a value of 0
; for successful and a non-zero value if connID is an invalid number.
;*****************************************************************************

_GetConnectionIDTableEntry	proc
	ARG	connID:WORD, entry:DATAPTR
	push	bp
	mov	bp, sp
	push	si
	push	di
	push	ds

	mov	ax, connID
	dec	ax
	cmp	ax, 7
	ja	InvalidIndex

	mov	bl, size ConnIDTable
	mul	bl
	mov	bx, ax

	mov	ax, 0ef03h
	int	21h

	add	si, bx
	mov	bx, es

IF	@DataSize EQ 0
	mov	di, entry
	mov	ax, ds
	mov	es, ax
ELSE
	les	di, entry
ENDIF
	mov	ds, bx
	mov	cx, size ConnIDTable
	shr	cx, 1
	rep	movsw
	xor	ax, ax

InvalidIndex:
	pop	ds
	pop	di
	pop	si
	pop	bp
	ret
_GetConnectionIDTableEntry	endp
	end

;*****************************************************************************
;*****************************************************************************
