kissdump.c
资源名称:export.zip [点击查看]
上传用户:hepax88
上传日期:2007-01-03
资源大小:1101k
文件大小:1k
源码类别:
TCP/IP协议栈
开发平台:
Visual C++
- /* Tracing routines for KISS TNC
- * Copyright 1991 Phil Karn, KA9Q
- */
- #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;
- int val;
- fprintf(fp,"KISS: ");
- type = PULLCHAR(bpp);
- if(type == PARAM_DATA){
- fprintf(fp,"Datan");
- ax25_dump(fp,bpp,check);
- return;
- }
- val = PULLCHAR(bpp);
- switch(type){
- case PARAM_TXDELAY:
- fprintf(fp,"TX Delay: %lu msn",val * 10L);
- break;
- case PARAM_PERSIST:
- fprintf(fp,"Persistence: %u/256n",val + 1);
- break;
- case PARAM_SLOTTIME:
- fprintf(fp,"Slot time: %lu msn",val * 10L);
- break;
- case PARAM_TXTAIL:
- fprintf(fp,"TX Tail time: %lu msn",val * 10L);
- break;
- case PARAM_FULLDUP:
- fprintf(fp,"Duplex: %sn",val == 0 ? "Half" : "Full");
- break;
- case PARAM_HW:
- fprintf(fp,"Hardware %un",val);
- break;
- case PARAM_RETURN:
- fprintf(fp,"RETURNn");
- break;
- default:
- fprintf(fp,"code %u arg %un",type,val);
- break;
- }
- }
- int
- ki_forus(iface,bp)
- struct iface *iface;
- struct mbuf *bp;
- {
- struct mbuf *bpp;
- int i;
- if(bp->data[0] != PARAM_DATA)
- return 0;
- dup_p(&bpp,bp,1,AXALEN);
- i = ax_forus(iface,bpp);
- free_p(&bpp);
- return i;
- }