Category : Network Files
Archive   : KA9Q.ZIP
Filename : UDPDUMP.C

 
Output of file : UDPDUMP.C contained in archive : KA9Q.ZIP
#include
#include "global.h"
#include "mbuf.h"
#include "netuser.h"
#include "internet.h"
#include "udp.h"

extern FILE *trfp;

/* Dump a UDP header */
void
udp_dump(bpp,source,dest,check)
struct mbuf **bpp;
int32 source,dest;
int check; /* If 0, bypass checksum verify */
{
struct udp udp;
struct pseudo_header ph;
int16 csum;

if(bpp == NULLBUFP || *bpp == NULLBUF)
return;

printf(trfp,"UDP:");

/* Compute checksum */
ph.source = source;
ph.dest = dest;
ph.protocol = UDP_PTCL;
ph.length = len_mbuf(*bpp);
if((csum = cksum(&ph,*bpp,ph.length)) == 0)
check = 0; /* No checksum error */

ntohudp(&udp,bpp);

printf(trfp," %u->%u",udp.source,udp.dest);
printf(trfp," len %u",udp.length);
if(udp.checksum == 0)
check = 0;
if(check)
printf(trfp," CHECKSUM ERROR (%u)",csum);

printf(trfp,"\n");
}



  3 Responses to “Category : Network Files
Archive   : KA9Q.ZIP
Filename : UDPDUMP.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/