home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Pier Shareware 6
/
The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso
/
024
/
psi110g.zip
/
KISSDUMP.C
< prev
next >
Wrap
C/C++ Source or Header
|
1994-04-17
|
2KB
|
90 lines
/* Tracing routines for KISS TNC
* Copyright 1991 Phil Karn, KA9Q
*
* Modified by G1EMM 19/11/90 to support multiport KISS mode.
*/
#include "global.h"
#include "mbuf.h"
#include "kiss.h"
#include "devparam.h"
#include "ax25.h"
#include "trace.h"
void
ki_dump(fp,bpp,check)
FILE *fp;
struct mbuf **bpp;
int check;
{
int type,t;
int val;
#ifdef MONITOR
if (!Trace_compact_header)
#endif
fprintf(fp,"KISS: ");
type = PULLCHAR(bpp);
t = type & 0x0f;
if(t == PARAM_DATA || t == PARAM_CRCREQ){
#ifdef MONITOR
if (!Trace_compact_header)
#endif
fprintf(fp,"Port %d Data\n", type >> 4);
ax25_dump(fp,bpp,check);
return;
}
if(type == PARAM_RETURN){
fprintf(fp,"RETURN\n");
return;
} else {
#ifdef MONITOR
if (!Trace_compact_header)
#endif
fprintf(fp,"Port %d ", type >> 4);
}
val = PULLCHAR(bpp);
switch(t){
case PARAM_TXDELAY:
fprintf(fp,"TX Delay: %lu ms\n",val * 10L);
break;
case PARAM_PERSIST:
fprintf(fp,"Persistence: %u/256\n",val + 1);
break;
case PARAM_SLOTTIME:
fprintf(fp,"Slot time: %lu ms\n",val * 10L);
break;
case PARAM_TXTAIL:
fprintf(fp,"TX Tail time: %lu ms\n",val * 10L);
break;
case PARAM_FULLDUP:
fprintf(fp,"Duplex: %s\n",val == 0 ? "Half" : "Full");
break;
case PARAM_HW:
fprintf(fp,"Hardware %u\n",val);
break;
case PARAM_POLL:
fprintf(fp,"Poll\n");
break;
default:
fprintf(fp,"code %u arg %u\n",type,val);
break;
}
}
int
ki_forus(iface,bp)
struct iface *iface;
struct mbuf *bp;
{
struct mbuf *bpp;
int i;
if((bp->data[0] & 0x0f) != PARAM_DATA)
return 0;
dup_p(&bpp,bp,1,AXALEN);
i = ax_forus(iface,bpp);
free_p(bpp);
return i;
}