[insert project logo here (125x200px max)]

Navigator

Mailinglists

Please report any errors or ommissions you find to our `Help' mailinglist, or post a message in the Forums.

Copyright and Licensing Information

Snap is (c) Jonathan T. Moore, 1999-2002 and licensed under the GNU General Public License (GPL).

All other parts of Splash are (c) Willem de Bruijn, 2002-2003 and licensed under the BSD Open Source License.

All sourcecode is made publicly available.

Acknowledgement

Splash and the Splash website are hosted by SourceForge.net

SourceForge.net Logo

osi-open source certified logo

Splash - Documentation

SNMP Plus a Lightweight API for SNAP Handling

Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

snap-1.1-wjdb/lib/packet.c

Go to the documentation of this file.
00001 /* snap-1.0. Copyright (C) 2000 by Jonathan T. Moore and Michael Hicks.
00002  *
00003  * packet.c : routines for debugging output of SNAP packets
00004  *
00005  * $Id: packet.c,v 1.1.1.1 2002/12/04 18:59:42 wdebruij Exp $
00006  */
00007 
00008 #include <netinet/in.h>
00009 #include <stdio.h>
00010 #include "bytecode.h"
00011 #include "packet.h"
00012 
00013 extern int fprintf_addr(FILE *f, unsigned int addr);
00014 extern int fprintf_instr(packet_t *p, FILE *f, instr_t *i);
00015 extern int fprintf_value(packet_t *p, FILE *f, value_t *v);
00016 
00017 void fprintf_packet(FILE *outfile,packet_t *p) {
00018   instr_t *codeptr;
00019   value_t *stackptr;
00020   unsigned int inum, entry_point;
00021 
00022   fprintf(outfile,"#sport\t%d\n",ntohs(p->hdr->sport));
00023   
00024   codeptr = p->code_min;
00025   inum = 0;
00026   entry_point = ntohs(p->hdr->entry_point);
00027   while(codeptr < p->code_max) {
00028     if (inum == entry_point) {
00029       fprintf(outfile,"main:\n");
00030     }
00031     fprintf(outfile,"\t");
00032     fprintf_instr(p->heap_min,outfile,codeptr);
00033     fprintf(outfile,"\n");
00034     codeptr++;
00035     inum++;
00036   }
00037   
00038   stackptr = p->stack_min;
00039   while(stackptr < p->sp) {
00040     fprintf(outfile,"#data\t");
00041     fprintf_value(p->heap_min,outfile,stackptr);
00042     fprintf(outfile,"\n");
00043     stackptr++;
00044   }
00045 }