Date: Mon, 27 Dec 93 04:30:02 PST
From: Advanced Amateur Radio Networking Group <tcp-group@ucsd.edu>
Errors-To: TCP-Group-Errors@UCSD.Edu
Reply-To: TCP-Group@UCSD.Edu
Precedence: Bulk
Subject: TCP-Group Digest V93 #335
To: tcp-group-digest


TCP-Group Digest            Mon, 27 Dec 93       Volume 93 : Issue  335

Today's Topics:
                 Assembler / C interface help needed.
                            C question/DOS
                                Quench
                         What does this mean?

Send Replies or notes for publication to: <TCP-Group@UCSD.Edu>.
Subscription requests to <TCP-Group-REQUEST@UCSD.Edu>.
Problems you can't solve otherwise to brian@ucsd.edu.

Archives of past issues of the TCP-Group Digest are available
(by FTP only) from UCSD.Edu in directory "mailarchives".

We trust that readers are intelligent enough to realize that all text
herein consists of personal comments and does not represent the official
policies or positions of any party.  Your mileage may vary.  So there.
----------------------------------------------------------------------

Date: Sun, 26 Dec 93 07:37:45 CST
From: Jack Snodgrass                    <kf5mg@kf5mg.ampr.org>
Subject: Assembler / C interface help needed.
To: tcp-group mailling list             <tcp-group@ucsd.edu>

Can someone help me get this piece of code working. I'm trying to call a
PC BIOS routing to write data to a disk file. I've got everyting in the
code working, but it doesn't seem to print out the correct buffer/string.
I get garbage instead. The main problem is figuring out how to load the
address of a string, pointed to by a pointer, into the DX register. Here's
the code.... any help would be greatly appreciated. BTW... I can't use any
'C' printing routines because I don't want to call any malloc() routines
when I print out the disk message. I need to get this PC BIOS call working.
Thanks again.

#include <stdio.h>
#include <bios.h>
#include <dos.h>
#include <string.h>
#include <io.h>
#include <fcntl.h>

main(argc, argv, envp)
   int argc;
   char *argv[];
   char *envp[];
{
    union  REGS regs;
    int    ret;
    int    fp;
    char   fname[]   = "erase.me";         /* file name. Must exist. */
    char   test[80]  = "This is a test";   /* Test String.           */
    char   *ch;

    if((fp = open(fname, O_WRONLY|O_APPEND|O_BINARY)) == -1) {
       printf("Error opening file:%s.\n",fname);
       return;
    } /* endif */

    /* Seek to end of file. */
    lseek(fp,0,2);

    ch = test;

    regs.x.bx = fp;
    regs.x.dx = (unsigned) ch;      /* <--- here's the problem. */
    regs.x.cx = strlen(test);
    regs.h.ah = 0x40;

    ret =intdos(&regs,&regs);

    close(fp);
}

73's  de  Jack  -  kf5mg
Internet        -  kf5mg@kf5mg.ampr.org            -  44.28.0.14
AX25net         -  kf5mg@kf5mg.#dfw.tx.usa.noam    -  home (817) 488-4386
Dialup          -  kf5mg@tcet.unt.edu              -  work (not  any more)

------------------------------

Date: Sun, 26 Dec 1993 12:35:32 -0600 (CST)
From: ssampson@sabea-oc.af.mil (Steve Sampson)
Subject: C question/DOS
To: TCP-Group@UCSD.Edu

> Can someone help me get this piece of code working.

 regs.x.bx = fp;
 regs.x.dx = (unsigned) test;      /* <--- here's the problem. */
 regs.x.cx = strlen(test);
 regs.h.ah = 0x40;
 ret = intdos(&regs,&regs);


This will work in small model but not in large.  Karn has all the code for
the proper way to do it in DOS.C in his version.  Basically it's the same
as yours except:

 struct SREGS segregs;

 regs.x.bx = fp;
 regs.x.cx = strlen(test);
 segregs.ds = FP_SEG(test);
 regs.x.dx = FP_OFF(test);
 regs.h.ah = 0x40;
 intdosx(&regs,&regs,&segregs);

Notice the segment registers and the intdosx function.  Also make sure the
file "erase.me" is really zero length.  My Norton Editor puts a ^Z in when
I open and close a file with nothing in it.  Guess I need to modernize :-)
--
Steve

------------------------------

Date: Sun, 26 Dec 1993 09:45:15 -0600 (CST)
From: ssampson@sabea-oc.af.mil (Steve Sampson)
Subject: Quench
To: TCP-Group@UCSD.Edu

> I'm trying to telnet to k5vr in Colorado. I'm getting this back. What does
> it mean? I know that 44.32.0.32 is the Colorado gateway and that k5vr is
> on the other side, but that's about it. Any info would be appreciated.

> Sat Dec 25 09:39:31 1993 - tcpip recv:
> KISS: Port 0 Data
> AX25: KF5MG-10->KF5MG-4 UI pid=IP
> IP: len 56 44.32.0.32->44.28.0.14 ihl 20 ttl 252 prot ICMP
> ICMP: type Source Quench
> Returned IP: len 32 44.28.0.14->44.32.0.172 ihl 20 ttl 246 prot ICMP
> ICMP: type Echo Request id 65535 seq 0

It probably means he's got a talkie on the fridge and is about S-1 to the
IP node.  Try backing off your IRTT by some significant delay, or have
the other end improve the link quality or IRTT. (just off the top of my head).
-- 
Steve

------------------------------

Date: Sun, 26 Dec 93 12:43:38 EDT
From: "Ross Patterson" <n4yyh@wa2hee.ampr.org>
Subject: What does this mean?
To: tcp-group@UCSD.EDU

On Sat, 25 Dec 93 09:41:12 GMT, <kf5mg@kf5mg.ampr.org> wrote:

>Sat Dec 25 09:39:31 1993 - tcpip recv:
>KISS: Port 0 Data
>AX25: KF5MG-10->KF5MG-4 UI pid=IP
>IP: len 56 44.32.0.32->44.28.0.14 ihl 20 ttl 252 prot ICMP
>ICMP: type Source Quench

An ICMP Source Quench message is a request by either the target IP system
or one of the IP gateways between you and it to have you slow down.  For
whatever reason, 44.32.0.32 has decided that it can't handle as many
packets as it's getting, and has decided to ask you (44.28.0.14) to slow 
down a bit.  Note that it isn't necessarily your fault that the gateway
is overloaded, some IP implementations simply return the next packet to
arrive. To help your IP understand what packet failed, the first <n> bytes
of the packet are enclosed in the ICMP message.  That's the "returned IP"
mentioned in the next message.  

>Returned IP: len 32 44.28.0.14->44.32.0.172 ihl 20 ttl 246 prot ICMP
>ICMP: type Echo Request id 65535 seq 0

It looks like you were trying to ping 44.32.0.172, is it possible you
stressed the gateway too much?

73,
Ross N4YYH

------------------------------

End of TCP-Group Digest V93 #335
******************************
******************************