Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
udpdump.c
Package: export.zip [view]
Upload User: hepax88
Upload Date: 2007-01-03
Package Size: 1101k
Code Size: 1k
Category:
TCP/IP Stack
Development Platform:
Visual C++
- /* UDP packet tracing
- * Copyright 1991 Phil Karn, KA9Q
- */
- #include <stdio.h>
- #include "global.h"
- #include "mbuf.h"
- #include "netuser.h"
- #include "internet.h"
- #include "udp.h"
- #include "ip.h"
- #include "socket.h"
- #include "trace.h"
- /* Dump a UDP header */
- void
- udp_dump(fp,bpp,source,dest,check)
- FILE *fp;
- struct mbuf **bpp;
- int32 source,dest;
- int check; /* If 0, bypass checksum verify */
- {
- struct udp udp;
- struct pseudo_header ph;
- uint16 csum;
- if(bpp == NULL || *bpp == NULL)
- return;
- fprintf(fp,"UDP:");
- /* Compute checksum */
- ph.source = source;
- ph.dest = dest;
- ph.protocol = UDP_PTCL;
- ph.length = len_p(*bpp);
- if((csum = cksum(&ph,*bpp,ph.length)) == 0)
- check = 0; /* No checksum error */
- ntohudp(&udp,bpp);
- fprintf(fp," len %u",udp.length);
- fprintf(fp," %u->%u",udp.source,udp.dest);
- if(udp.length > UDPHDR)
- fprintf(fp," Data %u",udp.length - UDPHDR);
- if(udp.checksum == 0)
- check = 0;
- if(check)
- fprintf(fp," CHECKSUM ERROR (%u)",csum);
- putc('n',fp);
- switch(udp.dest){
- case IPPORT_RIP:
- rip_dump(fp,bpp);
- }
- }