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
slhcdump.c
Package: export.zip [view]
Upload User: hepax88
Upload Date: 2007-01-03
Package Size: 1101k
Code Size: 3k
Category:
TCP/IP Stack
Development Platform:
Visual C++
- #include <stdio.h>
- #include "global.h"
- #include "mbuf.h"
- #include "internet.h"
- #include "ip.h"
- #include "slhc.h"
- #include "trace.h"
- static uint16 decodeint(struct mbuf **bpp);
- static uint16
- decodeint(bpp)
- struct mbuf **bpp;
- {
- uint8 tmpbuf[2];
- pullup(bpp,tmpbuf,1);
- if (tmpbuf[0] == 0)
- pullup(bpp,tmpbuf,2);
- else {
- tmpbuf[1] = tmpbuf[0];
- tmpbuf[0] = 0;
- }
- return(get16(tmpbuf));
- }
- void
- vjcomp_dump(fp,bpp,unused)
- FILE *fp;
- struct mbuf **bpp;
- int unused;
- {
- uint8 changes;
- uint8 tmpbuf[2];
- if(bpp == NULL || *bpp == NULL)
- return;
- /* Dump compressed TCP/IP header */
- changes = pullchar(bpp);
- fprintf(fp,"tchanges: 0x%02x",changes);
- if (changes & NEW_C) {
- pullup(bpp,tmpbuf,1);
- fprintf(fp," connection: 0x%02x",tmpbuf[0]);
- }
- pullup(bpp,tmpbuf,2);
- fprintf(fp," TCP checksum: 0x%04x",get16(tmpbuf));
- if (changes & TCP_PUSH_BIT)
- fprintf(fp," PUSH");
- fprintf(fp,"n");
- switch (changes & SPECIALS_MASK) {
- case SPECIAL_I:
- fprintf(fp,"tdelta ACK and delta SEQ implied by length of datan");
- break;
- case SPECIAL_D:
- fprintf(fp,"tdelta SEQ implied by length of datan");
- break;
- default:
- if (changes & NEW_U) {
- fprintf(fp,"tUrgent pointer: 0x%02x",decodeint(bpp));
- }
- if (changes & NEW_W)
- fprintf(fp,"tdelta WINDOW: 0x%02x",decodeint(bpp));
- if (changes & NEW_A)
- fprintf(fp,"tdelta ACK: 0x%02x",decodeint(bpp));
- if (changes & NEW_S)
- fprintf(fp,"tdelta SEQ: 0x%02x",decodeint(bpp));
- break;
- };
- if (changes & NEW_I) {
- fprintf(fp,"tdelta ID: 0x%02xn",decodeint(bpp));
- } else {
- fprintf(fp,"tincrement IDn");
- }
- }
- /* dump serial line IP packet; may have Van Jacobson TCP header compression */
- void
- sl_dump(fp,bpp,unused)
- FILE *fp;
- struct mbuf **bpp;
- int unused;
- {
- struct mbuf *bp, *tbp;
- unsigned char c;
- int len;
- bp = *bpp;
- c = bp->data[0];
- if (c & SL_TYPE_COMPRESSED_TCP) {
- fprintf(fp,"serial line VJ Compressed TCP: len %3un",
- len_p(*bpp));
- vjcomp_dump(fp,bpp,0);
- } else if ( c >= SL_TYPE_UNCOMPRESSED_TCP ) {
- fprintf(fp,"serial line VJ Uncompressed TCP: len %3un",
- len = len_p(bp));
- /* Get our own copy so we can mess with the data */
- if ( (tbp = copy_p(bp, len)) == NULL )
- return;
- fprintf(fp,"tconnection ID = %dn",
- tbp->data[9]); /* FIX THIS! */
- /* Restore the bytes used with Uncompressed TCP */
- tbp->data[0] &= 0x4f; /* FIX THIS! */
- tbp->data[9] = TCP_PTCL; /* FIX THIS! */
- /* Dump contents as a regular IP packet */
- ip_dump(fp,&tbp,1);
- free_p(&tbp);
- } else {
- fprintf(fp,"serial line IP: len: %3un",len_p(*bpp));
- ip_dump(fp,bpp,1);
- }
- }