home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Scene Xplorer 1
/
Scene_Xplorer_1.iso
/
Tools
/
ProNet
/
source
/
filesystem
/
pronet-handler.s
< prev
next >
Wrap
Text File
|
1978-01-11
|
29KB
|
1,397 lines
;: pronet-handler.s
;:
;:
;: 19.07.1994 started..
;: 17-04-1995 READ-Transfer umgebaut v34.0
;: 29-04-1995 EXAMINE-Packets neu programmiert v34.1
;: 18-06-1995 "+"-Exansion -> Unitnumber v34.2
DEBUG equ 0
include "exec/exec.i"
include "dos/dos.i"
include "dos/dosextens.i"
include "dos/filehandler.i"
include "devices/timer.i"
include "devices/input.i"
include "devices/inputevent.i"
include "A:ProNET/include/devices/pronet.i"
include "A:OSmacros.i"
include "A:ProNET/source/network.i"
include "exec_lib.i"
include "dos_lib.i"
; -- Convert given BPTR to FileLock in FL->fl_Key data or NULL if FL=0
; -- Changes d0 !!
GETsFL macro ;GETsFL dp_Arg1(a2),a0
GETBPTR \1,\2
move.l \2,d0
beq.s .\@getsfl
move.l fl_Key(\2),\2
.\@getsfl
endm
; -- Struktur zum Speichern der Volumes
STRUCTURE PHVolNode,0
STRUCT phvn_node,MLN_SIZE ;zur Verkettung
APTR phvn_doslist ;*VolumeNode
BPTR phvn_locklist ;BPTR->LockList
BPTR phvn_srvdoslist ;BPTR->VolNode beim Server
LABEL phvn_SIZEOF
j
IFNE DEBUG
bsr dinit
ENDC
move.l 4.w,a6
move.l ThisTask(a6),d0
move.l d0,ourprocess
move.l d0,a0
lea pr_MsgPort(a0),a0
move.l a0,ourport
move.b MP_SIGBIT(a0),Signal.packet
move.l ourport(pc),a0
LIBCALL WaitPort
bsr GetPacket
move.l d0,startuppacket
move.l d0,a0
move.l dp_Arg3(a0),a0
add.l a0,a0
add.l a0,a0
move.l a0,devnode
GETBPTR dol_Startup(a0),a0
move.l fssm_Unit(a0),d0
GETBPTR fssm_Environ(a0),a0
tst.l de_HighCyl(a0)
beq.s .ok1
add.b #"0",d0
move.b d0,plusflag
.ok1 lea dosname(pc),a1
moveq #36,d0
jsr -552(a6)
move.l d0,dosbase
beq nodos
bsr startpronet
tst.w d0
bne nopronet
; jetzt neuen Handler anmelden.
move.l pronetio(pc),a4
lea sendbuf,a3
move.l #ACTION_NEWHANDLER,(a3)+
move.l IO_DEVICE(a4),a6
move.l devnode(pc),a0
move.l dn_Name(a0),a0
add.l a0,a0
add.l a0,a0
addq.l #1,a0
lea localbuf,a1
.copyloc1 move.b (a0)+,(a1)+
bne.s .copyloc1
move.b #":",-1(a1)
clr.b (a1)
lea localbuf,a0
LIBCALL GetConfigString
move.l d0,a1
move.l d0,a0
.cc1 move.b (a0)+,(a3)+
bne.s .cc1
move.l a1,a0
LIBCALL FreeConfigString
bsr sendpnpacket
move.l pronetmsgport(pc),a0
move.l 4.w,a6
LIBCALL WaitPort
move.l pronetmsgport(pc),a0
LIBCALL GetMsg
move.l d0,actpronetmsg
move.l d0,a2
lea MN_SIZE+2(a2),a2
move.l 4(a2),d0
beq.s .cc0
move.l actpronetmsg(pc),a1
LIBCALL ReplyMsg
bra noserver
.cc0 move.l actpronetmsg(pc),a1
LIBCALL ReplyMsg
; alles klar jetzt..
move.l devnode(pc),a0
move.l ourport(pc),dol_Task(a0)
move.l startuppacket(pc),a0
moveq #DOSTRUE,d0
moveq #0,d1
bsr ReturnPacket ;Startuppacket zurückgeben
IFNE DEBUG
st debok
ENDC
bsr Wait4Message
clr.l startuppacket ;damit es nicht nochmal zurückgeht
noserver bsr stoppronet
nopronet move.l dosbase(pc),a1
move.l 4.w,a6
jsr -414(a6)
nodos move.l startuppacket(pc),d0
beq.s .0
move.l d0,a0
move.l #DOSFALSE,d0
move.l #ERROR_NO_FREE_STORE,d1
bsr ReturnPacket
.0 moveq #0,d0
rts
dc.b "$VER: pronet-handler 34.2 (18-06-95)",13,10,0
even
startpronet moveq #pnr_Size,d0
bsr GetIORequest
move.l d0,pronetio
beq spnoioreq
bsr CreatePort
move.l d0,pronetmsgport
beq spnomsgport
move.l devnode(pc),a1 ;Device, Unit und Flags
move.l dn_Startup(a1),a1 ;aus der Mountlist nehmen!!
add.l a1,a1
add.l a1,a1
move.l fssm_Unit(a1),d0
move.l fssm_Flags(a1),d1
move.l fssm_Device(a1),a0
add.l a0,a0
add.l a0,a0
addq.w #1,a0
move.l pronetio(pc),a1
move.w #PNP_NEXTFREE,pnr_NetSourcePort(a1)
move.l pronetmsgport(pc),pnr_MsgPort(a1)
move.l 4.w,a6
LIBCALL OpenDevice
tst.l d0
bne spnodev
move.l pronetio(pc),a1
move.w #CMD_WRITE,IO_COMMAND(a1)
clr.l pnr_Length2(a1)
clr.w pnr_NetDestPort(a1)
move.l pronetmsgport(pc),a0
move.b MP_SIGBIT(a0),Signal.pronet
moveq #0,d0
rts
stoppronet move.l 4.w,a6
move.l pronetio(pc),a1
LIBCALL CloseDevice
spnodev move.l pronetmsgport(pc),a0
bsr DeletePort
spnomsgport move.l pronetio(pc),a0
bsr FreeIORequest
spnoioreq moveq #-1,d0
rts
w4mquitflag dc.w 0
Wait4Message tst.w w4mquitflag
bne .quit
clr.w w4mquitflag
lea Signals(pc),a3 * auf die Messages
moveq #0,d0 * an allen möglichen
moveq #numports-1,d1 * Ports warten
.loop1 move.b (a3),d2
bmi.s .0
bset d2,d0
.0 addq.w #6,a3
dbra d1,.loop1
move.l 4.w,a6
LIBCALL Wait
* entsprechende Routinen
moveq #31,d7 * aufrufen
.00 rol.l d0
bcc.s .notthisbit
lea Signals(pc),a3
moveq #numports-1,d4
.01 cmp.b (a3),d7
bne.s .notthisport
movem.l d0/d4/d7/a3,-(sp)
move.l 2(a3),a3
jsr (a3)
movem.l (sp)+,d0/d4/d7/a3
.notthisport addq.w #6,a3
dbra d4,.01
.notthisbit dbra d7,.00
bra Wait4Message
.quit rts
Signals:
Signal.pronet dc.b -1,0 ;Signalbit
dc.l GetProNETMsg ;entsprechende Routine
Signal.packet dc.b -1,0
dc.l GetPacketMsg
numports equ 2
GetProNETMsg move.l pronetmsgport(pc),a0
move.l 4.w,a6
LIBCALL GetMsg
move.l d0,actpronetmsg
beq.s GetPacketMsg ;Ende !!
move.l d0,a3
lea MN_SIZE+2(a3),a3
move.l (a3)+,d2
move.l actpacket(pc),a2
cmp.l #ACTION_DISKINS,d2
beq ACT_DISKINS
cmp.l #ACTION_DISKREM,d2
beq ACT_DISKREM
move.l actanswerroutine(pc),a0
jsr (a0)
clr.l actpacket
move.l actpronetmsg(pc),d0
beq.s .0
move.l d0,a1
move.l 4.w,a6
LIBCALL ReplyMsg
.0 bra.s GetProNETMsg
; -- hier wird immer nur ein Packet geholt, dann auf die Abarbeitung ge-
; wartet und nachdem alle ProNETMsgs erledigt sind, wird nochmal versucht,
; ob hier Messages anliegen. Erst wenn beide Ports leer sind, wird der
; Task in Sleepstatus gelegt.
GetPacketMsg
move.l actpacket(pc),d0 ;Wird ein anderes Packet
bne.s .ende ;gerade bearbeitet ? --> Warten
move.l 4.w,a6
bsr GetPacket
move.l d0,actpacket
beq.s .ende
move.l d0,a2 ;[a2] DosPacket
move.l dp_Action(a2),d0
IFNE DEBUG
bsr dcr
bsr dtypedec
ENDC
lea sendbuf,a3 ;[a3] sendbuf
move.l d0,(a3)+
move.l pronetio(pc),a4 ;[a4] PNRequest
lea at(pc),a0
moveq #atl-1,d1
.findroutloop cmp.l (a0),d0
bcs.s .next
cmp.l 4(a0),d0
bls.s .jsrroutine
.next lea 12(a0),a0
dbra d1,.findroutloop
bsr ACT_NIL
bra.s GetPacketMsg
.jsrroutine sub.l (a0),d0
add.l d0,d0
move.l 8(a0),a0
lea at(pc),a1
add.w (a0,d0.l),a1
jsr (a1)
bra.s GetPacketMsg
.ende rts
cnop 0,4
at ;dc.l lowerbound,upperbound,tableaddress
dc.l 7,34,actiontable1
dc.l 40,40,actiontable2
dc.l 82,82,actiontable3
dc.l 87,87,actiontable4
dc.l 1004,1008,actiontable5
dc.l 1020,1034,actiontable6
dc.l 2008,2009,actiontable7
dc.l 4097,4098,actiontable8
dc.l 4200,4200,actiontable9
atl equ (*-at)/12
actiontable1 dc.w ACT_CURRENT_VOLUME-at
dc.w ACT_LOCATE_OBJECT-at,ACT_RENAME_DISK-at,ACT_NIL-at,ACT_NIL-at
dc.w ACT_NIL-at,ACT_NIL-at,ACT_NIL-at,ACT_FREE_LOCK-at,ACT_DELETE_OBJECT-at
dc.w ACT_RENAME_OBJECT-at,ACT_MORE_CACHE-at,ACT_COPY_DIR-at,ACT_NIL-at
dc.w ACT_SET_PROTECT-at,ACT_CREATE_DIR-at,ACT_EXAMINE_OBJECT-at,ACT_EXAMINE_OBJECT-at
dc.w ACT_DISK_INFO-at,ACT_INFO-at,ACT_FLUSH-at,ACT_SET_COMMENT-at
dc.w ACT_PARENT-at,ACT_NIL-at,ACT_INHIBIT-at,ACT_NIL-at
dc.w ACT_NIL-at,ACT_SET_DATE-at
actiontable2 dc.w ACT_SAME_LOCK-at
actiontable3 dc.w ACT_READ-at
actiontable4 dc.w ACT_WRITE-at
actiontable5 dc.w ACT_FINDxxx-at
dc.w ACT_FINDxxx-at,ACT_FINDxxx-at,ACT_END-at,ACT_SEEK-at
actiontable6 dc.w ACT_FORMAT-at,ACT_MAKE_LINK-at,ACT_SET_FILE_SIZE-at,ACT_WRITE_PROTECT-at
dc.w ACT_READ_LINK-at,ACT_NIL-at,ACT_FH_FROM_LOCK-at,ACT_IS_FILESYSTEM-at
dc.w ACT_CHANGE_MODE-at,ACT_NIL-at,ACT_COPY_DIR_FH-at,ACT_PARENT_FH-at
dc.w ACT_NIL-at,ACT_NIL-at,ACT_EXAMINE_FH-at
actiontable7 dc.w ACT_LOCK_RECORD-at,ACT_FREE_RECORD-at
actiontable8 dc.w ACT_ADD_NOTIFY-at,ACT_REMOVE_NOTIFY-at
actiontable9 dc.w ACT_SERIALIZE_DISK-at
** The routines will be called with the registers containing following:
** a6 Execbase
** a4 PNRequest (pnr_NetDestPort is ready !)
** a3 sendbuf+4 (first long already contains dp_Action..)
** a2 DosPacket
** Answerroutine will be called with:
** a6 Execbase
** a3 data received from server (without dp_Action -> Res1,Res2,Data..)
** a2 DosPacket to be returned
** d2 dp_A