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 >
C/C++ Source or Header  |  1994-04-17  |  2KB  |  90 lines

  1. /* Tracing routines for KISS TNC
  2.  * Copyright 1991 Phil Karn, KA9Q
  3.  *
  4.  * Modified by G1EMM  19/11/90 to support multiport KISS mode.
  5.  */
  6.   
  7. #include "global.h"
  8. #include "mbuf.h"
  9. #include "kiss.h"
  10. #include "devparam.h"
  11. #include "ax25.h"
  12. #include "trace.h"
  13.   
  14. void
  15. ki_dump(fp,bpp,check)
  16. FILE *fp;
  17. struct mbuf **bpp;
  18. int check;
  19. {
  20.     int type,t;
  21.     int val;
  22.   
  23. #ifdef MONITOR
  24.     if (!Trace_compact_header)
  25. #endif
  26.         fprintf(fp,"KISS: ");
  27.     type = PULLCHAR(bpp);
  28.     t = type & 0x0f;
  29.     if(t == PARAM_DATA || t == PARAM_CRCREQ){
  30. #ifdef MONITOR
  31.         if (!Trace_compact_header)
  32. #endif
  33.             fprintf(fp,"Port %d Data\n", type >> 4);
  34.         ax25_dump(fp,bpp,check);
  35.         return;
  36.     }
  37.     if(type == PARAM_RETURN){
  38.         fprintf(fp,"RETURN\n");
  39.         return;
  40.     } else {
  41. #ifdef MONITOR
  42.         if (!Trace_compact_header)
  43. #endif
  44.             fprintf(fp,"Port %d ", type >> 4);
  45.     }
  46.     val = PULLCHAR(bpp);
  47.     switch(t){
  48.         case PARAM_TXDELAY:
  49.             fprintf(fp,"TX Delay: %lu ms\n",val * 10L);
  50.             break;
  51.         case PARAM_PERSIST:
  52.             fprintf(fp,"Persistence: %u/256\n",val + 1);
  53.             break;
  54.         case PARAM_SLOTTIME:
  55.             fprintf(fp,"Slot time: %lu ms\n",val * 10L);
  56.             break;
  57.         case PARAM_TXTAIL:
  58.             fprintf(fp,"TX Tail time: %lu ms\n",val * 10L);
  59.             break;
  60.         case PARAM_FULLDUP:
  61.             fprintf(fp,"Duplex: %s\n",val == 0 ? "Half" : "Full");
  62.             break;
  63.         case PARAM_HW:
  64.             fprintf(fp,"Hardware %u\n",val);
  65.             break;
  66.         case PARAM_POLL:
  67.             fprintf(fp,"Poll\n");
  68.             break;
  69.         default:
  70.             fprintf(fp,"code %u arg %u\n",type,val);
  71.             break;
  72.     }
  73. }
  74.   
  75. int
  76. ki_forus(iface,bp)
  77. struct iface *iface;
  78. struct mbuf *bp;
  79. {
  80.     struct mbuf *bpp;
  81.     int i;
  82.   
  83.     if((bp->data[0] & 0x0f) != PARAM_DATA)
  84.         return 0;
  85.     dup_p(&bpp,bp,1,AXALEN);
  86.     i = ax_forus(iface,bpp);
  87.     free_p(bpp);
  88.     return i;
  89. }
  90.