![]() |
|
|
Ðåôåðàò: Èíòðàíåò ñåòè3.7. Ñîâìåñòíàÿ ðàáîòà TCP/IP è SPX/IPX ã================¬ ¦ NetWare Server ¦ ---------------¬ ¦ ¦ ¦ UNIX Server ¦ L=========T======- L-------T------- 129.1.0.3 ¦ ¦ 129.1.0.1 ¦ ¦ ¦IPX Net=84404556 ¦ IP Net=129.1.0.0 ------T---+------------T----+------------T------------- ¦ ¦ ¦ ¦ ¦ ¦ ------+--------¬ -----+---------¬ ¦ 129.1.0.2 ¦NetWare Client¦ ¦NetWare Client¦ -----+-----------¬ ¦ ¦ ¦ ¦ ¦UNIX Workstation¦ L--------------- L--------------- L----------------- Ðèñ.3.7. Ñåòè IP è IPX ìîãóò ïîäêëþ÷àòüñÿ ê îäíîìó ñåðâåðó NetWare. Êëè- åíòû UNIX ìîãóò èñïîëüçîâàòü ôàéëîâîå ïðîñòðàíñòâî ñåðâåðà ñ ïî- ìîùüþ Netware NFS (ðèñ.3.8.). Ïîäêëþ÷åíèå ñåòåé TCP/IP è SPX/IPX ê ñåðâåðó ---------------------¬ --------------¬ ¦Ðàáî÷àÿ ñòàíöèÿ UNIX¦ ¦ Ñåðâåð UNIX ¦ L---------T----------- L-----T-------- ¦129.1.0.2 ¦129.1.0.1 ¦ ¦ ¦ ¦Ñåòü IP=129.1.0.0 -----------+----------------T------+------------------- 129.1.03 ¦ ã========¦=========¬ ¦ Ñåðâåð NetWare ¦ L=========T========- ¦ Ñåòü IPX = 84404556 ¦ Ñåòü Token Ring ------------------------+-----------------------¬ L------T------------------------------------T---- ¦ ¦ -------+-------¬ -------+-------¬ ¦Êëèåíò NetWare¦ ¦Êëèåíò NetWare¦ L--------------- L--------------- Ðèñ.3.8. Åñòü âîçìîæíîñòü ìàðøðóòèçàöèè ïàêåòîâ IP ÷åðåç ñåðâåð NetWare. Íà ðèñ.3.9. TCP/IP â ñåðâåðå Netware 1 îáåñïå÷èâàþò ìàðøðóòèçàöèþ ïàêåòîâ IP, äàâàÿ âîçìîæíîñòü êëèåíòàì UNIX èç ñåòè IP Ethernet ðàáîòàòü ñ ñåðâåðîì Netware 2. Ìàðøðóòèçàöèÿ ïàêåòîâ IP ÷åðåç ñåðâåð NetWare ---------------------¬ --------------¬ ¦Ðàáî÷àÿ ñòàíöèÿ UNIX¦ ¦ Ñåðâåð UNIX ¦ L---------T----------- L-----T-------- ¦129.1.0.2 ¦129.1.0.1 ¦ ¦ ¦ ¦Ñåòü IP=129.1.0.0 -----------+----------------T------+------------------- 129.1.03 ¦ ã========¦=========¬ ¦ Ñåðâåð NetWare 1¦ L=========T========- ¦ Ñåòü IPX = 84404556 ¦ Ñåòü Token Ring ------------------------+-----------------------¬ L----T------------------T-----------------T------ ¦ ¦ ¦ -------+-------¬ ã=======¦========¬ -------+-------¬ ¦Êëèåíò NetWare¦ ¦Ñåðâåð NetWare 2¦ ¦Êëèåíò NetWare¦ L--------------- L================- L--------------- Ðèñ.3.9. Âêëþ÷èâ â ñîñòàâ ñåòè IP, èçîáðàæåííîé íà ðèñ.3.10.-, ìàðøðóòè- çàòîð IP ìîæíî îáåñïå÷èòü âûõîä â ãëîáàëüíóþ èíòåðñåòü IP. Ñðåäñòâà ïðîêëàäêè òóííåëåé IP îáåñïå÷èâàþò ïðîçðà÷íîå âçàèìî- äåéñòâèå ñåòåé IPX ÷åðåç èíòåðñåòü IP. Òóííåëü IP ïðåäñòàâëÿåò ñòàíäàðòíûé èíòåðôåéñ äðàéâåðà ëîêàëüíîé ñåòè äëÿ ñèñòåìû NetWare. Ñàìà èíòåðñåòü IP ÿâëÿåòñÿ ñðåäîé ïåðåäà÷è.  ýòîì ñìûñëå àäðåñ IP âûïîëíÿåò â ñðåäå IP òó æå ôóíêöèþ, ÷òî ôèçè÷åñêèé àäðåñ â ôèçè- ÷åñêîé ñðåäå. Ïðèìåð èñïîëüçîâàíèÿ òóííåëÿ IP äëÿ âçàèìîäåéñòâèÿ ñåòåé IPX ÷åðåç èíòåðñåòü IP ïðèâåäåí íà ðèñ.3.10. Âçàèìîäåéñòâèå ñåòåé NetWare ÷åðåç òóííåëü IP Òóííåëü IP ã============¬ ¦ ¦ Ñåòü IPX ¦ ¦ L======T=====- ¦ ¦ -----------------¬ ¦ ã============¬ ----------+------¬ ¦ Ñåðâåð NetWare +-+-¦Èíòåðñåòü IP¦---+ Ñåðâåð NetWare ¦ ¦ +---¦ ¦-T-+ ¦ L--------T-------- L============- ¦ L----------------- ¦ ¦ ¦ ¦ ã========¦=======¬ Òóííåëü IP ¦ Ñåòü IPX ¦ L================- Ðèñ.3.10. 4. ÎÁÌÅÍ ÑÎÎÁÙÅÍÈßÌÈ Â ÑÅÒÈ. Äâå ïðîãðàììû, ðàáîòàþùèå íà ðàçíûõ óçëàõ ñåòè, ìîãóò îáìåíè- âàòüñÿ äàííûìè äâóìÿ ñïîñîáàìè: ïåðåñûëêà ïàêåòîâ ÷åðåç íèçêîóðîâ- íåâûé äðàéâåð ñåòè è ïåðåñûëêà ñîîáùåíèé ÷åðåç îáùèé ôàéë-ñåðâåð. Ïðèìåð ïðîãðàììû, ïîñûëàþùåé ñîîáùåíèå íà êîíñîëü ñåðâåðà : Uses Dos; var k : integer; sendString : string; Procedure SendToCon(Message : string); var reg : registers; s : array [0..64] of byte; i : integer; begin s[0] := 0; s[1] := 4; s[2] := $09; s[3] := length(Message); for i := 1 to Length(Message) do s[i+3] := ord(Message[i]); reg.ah := $0E1; reg.bx := reg.ds; reg.ds := seg(s); reg.si := ofs(s); intr($21,reg); reg.ds := reg.bx; end; begin If ParamCount = 0 then begin Writeln('Send message to console utility by S.Perevoznik, 1993'); Writeln('Usage : ssend <message>'); halt; end; for k := 1 to paramcount do begin SendString := SendString + Paramstr(k) + ' '; end; SendToCon(sendString); Writeln('Message send to console ...'); end. Äëÿ ïåðåäà÷è ñîîáùåíèÿ êîíêðåòíîìó ïîëüçîâàòåëþ ìîæíî èñïîëüçîâàòü ñëåäóþùèå ôóíêöèè : {$F+,O+} Unit UICNet; Interface Uses Dos; Function GetUserName(ConnectionNumber : byte; Var ObjectFree : boolean) : string; Function LocalDisk : boolean; Procedure SendBroadcastMessage(Message:string;ConnectionNumber:byte); Implementation Function GetUserName(ConnectionNumber : byte; Var ObjectFree : boolean) : string; var WordPtr:^Word; r : registers; SendPacket : array[0..4] of byte; ReplyPacket : array[0..64] of byte; UserName : string; ObjectType : word; function GetWord(P: pointer): word; var WordPtr :^word; begin WordPtr := P; GetWord := swap(WordPtr^); end; begin SendPacket[2] := $16; SendPacket[3] := ConnectionNumber; WordPtr := addr(SendPacket); WordPtr^:=2; WordPtr := addr(SendPacket); WordPtr^ := 62; r.ah := $e3; r.ds := seg(SendPacket); r.si := ofs(SendPacket); r.es := seg(ReplyPacket); r.di := ofs(ReplyPacket); intr($21,r); if r.al = 0 then begin ObjectType := GetWord(addr(ReplyPacket[6])); if ObjectType = 0 then ObjectFree := true else ObjectFree := false; move(ReplyPacket[8],UserName[1],48); UserName[0] := chr(48); GetUserName := Username; end; end; Function LocalDisk : boolean; var r : registers; begin r.ah := $19; intr($21,r); r.dl := r.al+1; r.ah := $e9; r.al := 0; r.dh := 0; intr($21,r); if r.ah = 128 then localdisk := true else localdisk := false; end; Procedure SendBroadcastMessage(Message:string; ConnectionNumber:byte); var r : registers; WordPtr : ^word; SendPacket : array [0..160] of byte; ReplyPacket : array [0..103] of byte; begin SendPacket[2] := 0; SendPacket[3] := 1; SendPacket[4] := ConnectionNumber; SendPacket[5] := length(Message); move(Message[1],SendPacket[6],length(Message)); WordPtr := addr(SendPacket); WordPtr^ := Length(Message) + 4; r.ah := $e1; r.ds := seg(SendPacket); r.si := ofs(SendPacket); r.es := seg(ReplyPacket); r.di := ofs(ReplyPacket); intr($21,r); end; end. Ñëåäóþùàÿ ïðîãðàììà äåìîíñòðèðóåò âîçìîæíîñòü ïîëó÷åíèÿ ñïèñêà ïîëü- çîâàòåëåé, ïîäêëþ÷åííûõ ê ñåòè: uses Dos; function GetWord(P: pointer): word; var WordPtr :^word; begin WordPtr := P; GetWord := swap(WordPtr^); end; Function GetLong(P:Pointer): longint; type long= record case integer of 1:(Long1: Longint); 2:(Word1,Word2:word); end; var LongPtr :^Long; L : long; begin LongPtr := P; L.Word1 := swap(LongPtr^.Word2); L.Word2 := swap(LongPtr^.Word1); GetLong:= L.Long1; end; Function GetConnectionInformation(ConnectionNumber:byte; Var ObjectName : string; var ObjectType : word; var ObjectID : longint; var LoginTime : string): byte; var WordPtr:^Word; r:registers; SendPacket : array[0..4] of byte; ReplyPacket : array[0..64] of byte; begin SendPacket[2] := $16; SendPacket[3] := ConnectionNumber; WordPtr := addr(SendPacket); WordPtr^:=2; WordPtr := addr(SendPacket); WordPtr^ := 62; r.ah := $e3; r.ds := seg(SendPacket); r.si := ofs(SendPacket); r.es := seg(ReplyPacket); r.di := ofs(ReplyPacket); intr($21,r); if r.al = 0 then begin ObjectID := GetLong(addr(ReplyPacket[2])); ObjectType := GetWord(addr(ReplyPacket[6])); move(ReplyPacket[8],ObjectName[1],48); ObjectName[0] := chr(48); move(ReplyPacket[56],LoginTime[1],7); LoginTime[0] := chr(7); end; GetConnectionInformation := r.al; end; var ObjectName,LoginTime : string; ObjectType : word; ObjectID : longint; ConnectionNumber, CCode : byte; begin ConnectionNumber := 1; CCode := GetConnectionInformation(ConnectionNumber, ObjectName,ObjectType,ObjectID,LoginTime); while (CCode <> 253) and (ConnectionNumber<255) do begin if CCode <> 0 then writeln('Cod ',CCode,ConnectionNumber) else if ObjectType <>0 then begin Writeln(ConnectionNumber,' ',ObjectType,' ',ObjectID); Writeln(ObjectName); end; inc(ConnectionNumber); CCode := GetConnectionInformation(ConnectionNumber, ObjectName,ObjectType,ObjectID,LoginTime); end; end. 5. ÐÀÁÎÒÀ Ñ ÔÀÉËÀÌÈ Â ËÂÑ. Íèæå ïðèâîäÿòñÿ òåêñòû ïðîöåäóð, èñïîëüçóåìûõ ïðè ðàáîòå â ËÂÑ äëÿ îáñëóæèâàíèÿ ôàéëîâîé ñèñòåìû: ; Äàííàÿ áèáëèîòåêà ïðîöåäóð ðàçðàáîòàíà äëÿ èñïîëüçîâàíèÿ â ïðîã- ; ðàììàõ, íàïèñàííûõ íà Òóðáî-Ïàñêàëå âåðñèè 4.0 è âûøå. ; Joe R. Doupnik and Sergey V. Perevoznik, 1988 - 1993 lprog equ 1 ; 0 for small memory, 1 for large memory model ; Modify lprog to match the memory model if lprog x equ 6 ; prologue overhead for large memory model else x equ 4 ; ditto, small memory model endif begin macro name ; begin a function, near or far public name if lprog name proc far else name proc near endif endm ; define Borland Pascal segments ; use neither Group nor Class data segment word public data ends cseg segment byte public assume cs:cseg, ds:data, es:nothing ;-------------------------------- ; Extended Open a File func(61) (3DH) ; ; var ; Mode, Handle, RetCode : Integer; ; Filename : String[n]; ; ; RetCode := xtndopn(Mode, Handle, Filename); ; begin xtndopn push bp mov bp,sp push ds lds si,[bp+x+8] ; put the mode in ax mov ax,[si] mov ah,03Dh ; put the function in ah lds dx,[bp+x] ; ptr to ASCIIZ string inc dx ; add 1 to get to the beginning of the string int 21h jc xtndopx ; carry set means failure lds di,[bp+x+4] ; put the handle into the variable mov [di],ax ; if there is no error and xor ax,ax ; return a 0 xtndopx:pop ds pop bp ret 14 xtndopn endp ;-------------------------------- ; Get or Set File Attributes(handle) func(67) (43H) ; ; var ; Func, Attribute, ErrCode : Integer; ; Filename : String[n]; ; ;ErrCode := setattr(Func, Attribute, Filename); ; begin setattr push bp mov bp,sp push ds lds si,[bp+x+8] ; put the subfunction in ax mov ax,[si] mov ah,043h ; put the function in ah lds dx,[bp+x] ; ptr to var desc block for ASCIIZ string inc dx ; add 1 to get the address of the string lds si,[bp+x+4] ; put the attribute to set in cx mov cx,[si] int 21h jc setattx ; carry set means failure lds di,[bp+x+4] ; put the returned attributes in the mov [di],cx ; variable if there is no error xor ax,ax ; and return zero setattx:mov ah,0 pop ds pop bp ret 14 setattr endp ;-------------------------------- ; End of Job Flag Status func(187) (BBH) ; ; var ; Flag : Integer; ; ;ErrCode := eojstat(Flag); ; begin eojstat push bp mov bp,sp push ds lds si,[bp+x] ; put the flag in ax mov ax,[si] mov ah,0BBh ; put the function in ah int 21h mov ah,0 lds di,[bp+x] mov [di],ax pop ds pop bp ret 6 eojstat endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Physical Record Lock: Log Record BCH ; ; var ; ErrCode,FileHandle,HiByteOffset,LoByteOffset : Integer ; HiLockLen,LoLockLen,Flags,TimeOut : Integer ; ;ErrCode := PRLH_Log(FileHandle,HiByteOffset,LoByteOffset,HiLockLen, ; LoLockLen,Flags,TimeOut); ; begin PRLH_Log push bp mov bp,sp push ds lds si,[bp+x+24] ; FileHandle mov bx,[si] lds si,[bp+x+20] ; ByteOffset mov cx,[si] lds si,[bp+x+16] mov dx,[si] lds si,[bp+x+4] ; AL = Log Flags mov ax,[si] lds si,[bp+x+12] ; LockLen mov si,[si] lds di,[bp+x+8] mov di,[di] lds bp,[bp+x] ; time out mov bp,[bp] mov ah,0BCH int 21H mov ah,0 ; clear the high byte of the return pop ds pop bp ret 30 PRLH_Log endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Physical Record Lock: Release Rec BDH ; ; var ; FileHandle,HiByteOffset,LoByteOffset,ErrCode, ; HiWordLen,LoWordLen : integer; ; ErrCode := PRLH_Rel(FileHandle,HiByteOffset,LoByteOffset,HiWordLen, ; LoWordLen:integer); begin PRLH_Rel push bp mov bp,sp push ds lds si,[bp+x+16] ; FileHandle mov bx,[si] lds si,[bp+x+12] ; HiByteOffset mov cx,[si] lds si,[bp+x+8] ; LoByte mov dx,[si] lds si,[bp+x+4] ; HiWordLen mov si,[si] lds di,[bp+x] ; LoWordLen mov di,[di] mov ah,0BDH int 21H mov ah,0 pop ds pop bp ret 22 PRLH_Rel endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Physical Record Lock: Release Clr BEH ; ; var ; FileHandle,HiByteOffset,LoByteOffset,ErrCode, ; HiWordLen,LoWordLen : integer; ; ErrCode := PRLH_Rel(FileHandle,HiByteOffset,LoByteOffset,HiWordLen, ; LoWordLen:integer); ; begin PRLH_Clr push bp mov bp,sp push ds lds si,[bp+x+16] ; FileHandle mov bx,[si] lds si,[bp+x+12] ; ByteOffset mov cx,[si] lds si,[bp+x+8] mov dx,[si] lds si,[bp+x+4] ; HiWordLen mov si,[si] lds di,[bp+x] ; LoWordLen mov di,[di] mov ah,0BEH int 21H mov ah,0 pop ds pop bp ret 22 PRLH_Clr endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Physical Record Lock: Log Rec FCB BFH ; ; var ; ErrCode,fcb,HiByteOffset,LoByteOffset : Integer; ; HiLockLen,LoLockLen,Flags,TimeOut : Integer; ; ; ErrCode := PRLF_Log(fcb,HiByteOffset,LoByteOffset,HiLockLen,LoLockLen,Flags,TimeOut); ; begin PRLF_Log push bp mov bp,sp push ds lds si,[bp+x+24] ; FCB mov dx,[si] lds si,[bp+x+20] ; ByteOffset mov bx,[si] lds si,[bp+x+16] mov cx,[si] lds si,[bp+x+4] ; AL = Log Flags mov ax,[si] lds si,[bp+x+8] ; low lock length mov di,[si] lds si,[bp+x+12] ; hi lock length mov si,[si] mov bp,[bp+x] ; timeout value mov bp,[bp] mov ah,0BFH int 21H mov ah,0 pop ds pop bp ret 28 PRLF_Log endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Physical Record Lock: Rel Rec FCB C0H ; ; var ; ErrCode,fcb,HiByteOffset,LoByteOffset : Integer; ; ; ErrCode := PRLF_Rel(fcb,HiByteOffset,LoByteOffset); ; begin PRLF_Rel push bp mov bp,sp push ds lds dx,[bp+x+8] ; FCB lds si,[bp+x+4] ; ByteOffset mov bx,[si] lds si,[bp+x] mov cx,[si] mov ah,0C0H int 21H mov ah,0 pop ds pop bp ret 12 PRLF_Rel endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Physical Record Lock: Clr Rec FCB C1H ; ; var ; ErrCode,fcb,HiByteOffset,LoByteOffset : Integer; ; ; ErrCode := PRLF_clr(fcb,HiByteOffset,LoByteOffset); ; begin PRLF_Clr push bp mov bp,sp push ds lds dx,[bp+x+8] ; FCB lds si,[bp+x+4] ; ByteOffset mov bx,[si] lds si,[bp+x] mov cx,[si] mov ah,0C0H int 21H mov ah,0 pop ds pop bp ret 12 PRLF_Clr endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Lock Record Set C2H ; ; var ; ErrCode, Flags, TimeOut : Integer; ; ; ErrCode := PRLS_Lck(Flags,TimeOut); ; begin PRLS_Lck push bp mov bp,sp push ds lds si,[bp+x+4] ; AL = Lock flag bits mov ax,[si] lds si,[bp+x] ; TimeOut Value mov bp,[si] mov ah,0C2h int 21h mov ah,0 pop ds pop bp ret 10 PRLS_Lck endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Release Record Set C3H ; ; var ; ErrCode : Integer; ; ; ErrCode := PRLS_Rel; ; begin PRLS_Rel mov ah,0C3h int 21h mov ah,0 ret PRLS_Rel endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Clear Record Set C4H ; ; var ; ErrCode : Integer; ; ; errcode := PRLS_Clr; ; begin PRLS_Clr mov ah,0C4h int 21h mov ah,0 ret PRLS_Clr endp ;-------------------------------- ; Semaphores func(197) (C5H) subfunction 00h ; ; var ; RetCode,SemaValu,HiHandle,LoHandle,OpenCnt : Integer; ; Sema4 : String[n]; ; ; RetCode := OpenSem(Sema4,SemaValu,HiHandle,LoHandle,OpenCnt); ; begin OpenSem push bp mov bp,sp push ds lds dx,[bp+x+16] ; ptr to Semaphore string ; inc dx ; add 1 to get the address of the string lds si,[bp+x+12] ; set semaphore value mov cx,[si] mov ax,0C500h ; set the function int 21h mov bh,00h lds di,[bp+x] ; return the open count mov [di],bx lds di,[bp+x+4] ; return low handle mov [di],cx |
|
|||||||||||||||||||||||||||||
![]() |
|
Ðåôåðàòû áåñïëàòíî, ðåôåðàò áåñïëàòíî, êóðñîâûå ðàáîòû, ðåôåðàò, äîêëàäû, ðåôåðàòû, ðåôåðàòû ñêà÷àòü, ðåôåðàòû íà òåìó, ñî÷èíåíèÿ, êóðñîâûå, äèïëîìû, íàó÷íûå ðàáîòû è ìíîãîå äðóãîå. |
||
Ïðè èñïîëüçîâàíèè ìàòåðèàëîâ - ññûëêà íà ñàéò îáÿçàòåëüíà. |