; Copyright (c) 1996 Brian Fisher ; All rights reserved. ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions ; are met: ; 1. Redistributions of source code must retain the above copyright ; notice, this list of conditions and the following disclaimer. ; 2. Redistributions in binary form must reproduce the above copyright ; notice, this list of conditions and the following disclaimer in the ; documentation and/or other materials provided with the distribution. ; 3. The name of the author may not be used to endorse or promote products ; derived from this software without specific prior written permission. ; ; THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ; OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ; IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ; NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ;*************************************************************************** ;*** IPX send and receive routines ;* Hope this works.. ;* Brian Fisher ;* ;* .286 Ideal Model Small Public IPXsetup,Opensock,openbsock,Closesock,sendpack,sendbpack,getpack,getbpack,waitpack,waitbpack,cancelget,cancelbget,cancelsend,getaddress,getbaddress,saybye CodeSeg struc ECB LinkOff dw ? LinkSeg dw ? ESRAddOff dw 0 ESRAddSeg dw 0 InUse db ? CompCode db ? Sock dw ? IPXWorkSpc dd ? DrvWorkSpc db 12 dup (?) ImmAdd db 6 dup (?) FragNum dw 2 HeaderOff dw ? HeaderSeg dw ? HeaderSize dw 30 PackOff dw ? PackSeg dw ? PackSize dw ? ends ECB struc IPX Checksum dw ? length dw ? control db ? packtype db ? Destnet dd ? DestNode db 6 dup (?) DestSock dw ? SourceNet dd ? SourceNode db 6 dup (?) SourceSock dw ? ends IPX ECBS ecb <> ECBR ecb <> ECBA ecb <> IPXS ipx <> IPXR ipx <> IPXA ipx <> sock dw 0 asock dw 0 myaddr db 6 dup (?) netid dd ? netnode db 6 dup (?) netsock dw ? Proc IPXsetup push ds si es di mov ax,07a00h int 2fh cmp al,0ffh jne noipx mov bx,9 mov ax,seg netid mov es,ax mov si,offset netid int 7ah mov cx,3 mov ax,seg myaddr mov es,ax mov di,offset myaddr mov ax,seg netnode mov ds,ax mov si,offset netnode rep movsw mov [ecbs.headeroff],offset ipxs mov [ecbr.headeroff],offset ipxr mov [ecba.headeroff],offset ipxa mov [ecbs.headerseg],seg ipxs mov [ecbr.headerseg],seg ipxr mov [ecba.headerseg],seg ipxa mov al,1 noipx: xor ah,ah pop di es si ds retf endp IPXsetup proc OpenSock ;socket push bp mov bp,sp mov dx,[ss:bp+06] mov ax,0 mov bx,0 int 7ah cmp al,0feh js nosockets mov [sock],dx mov ax,dx jmp gotsocket nosockets: mov ax,0 gotsocket: pop bp retf 2 endp OpenSock proc OpenbSock ;socket push bp mov bp,sp mov dx,[ss:bp+06] mov ax,0 mov bx,0 int 7ah cmp al,0feh js nobsockets mov [asock],dx mov ax,dx jmp gotbsocket nobsockets: mov ax,0 gotbsocket: pop bp retf 2 endp OpenbSock proc CloseSock mov dx,[sock] cmp dx,0 jz nosock mov ax,0 mov bx,1 int 7ah mov [sock],0 nosock: mov dx,[asock] cmp dx,0 jz noasock mov ax,0 mov bx,1 int 7ah mov [asock],0 noasock: retf endp CloseSock proc SendPack ;address array length push bp mov bp,sp push ds si es di mov ax,0ffffh mov bx,[sock] cmp bx,0 jne itopen jmp notopen ;skip if no socket opened itopen: mov [ecbs.sock],bx mov [ipxs.destsock],bx ;store socket mov si,[ss:bp+10] add si,2 mov si,[ds:si] mov ax,seg ecbs.immadd mov es,ax mov di,offset ecbs.immadd mov cx,3 rep movsw mov ax,seg ipxs.destnet mov es,ax mov di,offset ipxs.destnet mov cx,5 rep movsw ;store destination call sendit notopen: pop di es si ds bp retf 6 endp SendPack proc SendbPack ;array length push bp mov bp,sp push ds si es di mov ax,0ffffh mov bx,[asock] cmp bx,0 jne bopen jmp bnotopen ;skip if no socket opened bopen: mov [ecbs.sock],bx mov [ipxs.destsock],bx ;store socket mov ax,seg ecbs.immadd mov es,ax mov di,offset ecbs.immadd mov cx,3 mov ax,0ffffh rep stosw mov ax,seg ipxs.destnet mov es,ax mov di,offset ipxs.destnet xor ax,ax mov cx,2 rep stosw ;store destination mov ax,0ffffh mov cx,3 rep stosw call sendit bnotopen: pop di es si ds bp retf 4 endp SendbPack proc Sendit mov bx,[ss:bp+08] mov ax,[ds:bx+02h] mov [ecbs.packseg],ax mov ax,[ds:bx+0ah] mov [ecbs.packoff],ax mov ax,[ss:bp+06] mov [ecbs.packsize],ax ;set pointer to data add ax,30 mov [ipxs.length],ax ;store packet length xor ax,ax mov [ipxs.checksum],ax mov [ipxs.control],al mov [ipxs.packtype],al mov [ecbs.esraddoff],ax mov [ecbs.esraddseg],ax mov bx,3 mov ax,seg ECBS mov es,ax mov si,offset ecbs int 7ah waitforsend: mov bx,0ah mov ax,0 int 7ah cmp [ecbs.inuse],0ffh je waitforsend mov al,[ecbs.compcode] xor ah,ah retn endp sendit proc Getpack ;array length push bp mov bp,sp push ds si es di mov ax,-1 mov bx,[sock] cmp bx,0 je nonetolisten cmp [ecbr.inuse],0 je finetodo mov bx,6 mov ax,seg ecbr mov es,ax mov si,offset ecbr int 07ah finetodo: mov [ecbr.sock],bx mov bx,[ss:bp+08] mov ax,[ds:bx+0ah] mov [ecbr.packoff],ax mov ax,[ds:bx+02h] mov [ecbr.packseg],ax mov ax,[ss:bp+06] mov [ecbr.packsize],ax add ax,30 mov [ipxr.length],ax xor ax,ax mov [ecbr.esraddoff],ax mov [ecbr.esraddseg],ax mov bx,4 mov ax,seg ecbr mov es,ax mov si,offset ecbr int 7ah xor ax,ax nonetolisten: pop di es si ds bp retf 4 endp Getpack proc Getbpack ;array length push bp mov bp,sp push ds si es di mov ax,-1 mov bx,[asock] cmp bx,0 je nobtolisten cmp [ecba.inuse],0 je bfinetodo mov bx,6 mov ax,seg ecba mov es,ax mov si,offset ecba int 07ah bfinetodo: mov [ecba.sock],bx mov bx,[ss:bp+08] mov ax,[ds:bx+0ah] mov [ecba.packoff],ax mov ax,[ds:bx+02h] mov [ecba.packseg],ax mov ax,[ss:bp+06] mov [ecba.packsize],ax add ax,30 mov [ipxa.length],ax xor ax,ax mov [ecba.esraddoff],ax mov [ecba.esraddseg],ax mov bx,4 mov ax,seg ecba mov es,ax mov si,offset ecba int 7ah xor ax,ax nobtolisten: pop di es si ds bp retf 4 endp Getbpack proc Waitpack mov ax,-1 cmp [ecbr.inuse],0 jne notyet xor ax,ax notyet: retf endp Waitpack proc Waitbpack mov ax,-1 cmp [ecba.inuse],0 jne nobyet xor ax,ax nobyet: retf endp Waitbpack proc Cancelget mov bx,6 mov ax,seg ecbr mov es,ax mov si,offset ecbr int 07ah xor ah,ah retf endp cancelget proc Cancelbget mov bx,6 mov ax,seg ecba mov es,ax mov si,offset ecba int 07ah xor ah,ah retf endp cancelbget proc Cancelsend mov bx,6 mov ax,seg ecbs mov es,ax mov si,offset ecbs int 07ah xor ah,ah retf endp cancelsend proc Getaddress ;string push bp mov bp,sp push ds si es di mov si,[ss:bp+06] add si,2 mov di,[ds:si] mov ax,ds mov es,ax mov ax,seg ecbr.immadd mov ds,ax mov si,offset ecbr.immadd mov cx,3 rep movsw mov ax,seg ipxr.sourcenet mov ds,ax mov si,offset ipxr.sourcenet mov cx,5 rep movsw pop di es si ds bp retf 2 endp Getaddress proc Getbaddress ;string push bp mov bp,sp push ds si es di mov si,[ss:bp+06] add si,2 mov di,[ds:si] mov ax,ds mov es,ax mov ax,seg ecba.immadd mov ds,ax mov si,offset ecba.immadd mov cx,3 rep movsw mov ax,seg ipxa.sourcenet mov ds,ax mov si,offset ipxa.sourcenet mov cx,5 rep movsw pop di es si ds bp retf 2 endp Getbaddress proc Saybye ;address push bp mov bp,sp push ds si es di pop di es si ds retf 2 endp saybye end