[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.h

Go to the documentation of this file.
00001 /* $Id: packet.h,v 1.1.1.1 2002/12/04 18:59:42 wdebruij Exp $ */
00002 
00003 
00004 #ifndef _SNAP_PACKET_H_
00005 #define _SNAP_PACKET_H_
00006 
00007 #ifdef __KERNEL__
00008 #include <linux/skbuff.h>
00009 #include <snap/bytecode.h>
00010 #else
00011 #include "bytecode.h"
00012 #endif
00013 
00014 
00015 /* a heap is just a buffer with some meta-data off the front */
00016 typedef struct {
00017   int lenb;         /* for now, length in bytes */
00018   char *h;          /* the heap */
00019 } heap_t;
00020 
00021 /* packet header layout */
00022 #include "snap.h"
00023 typedef struct snaphdr header_t;
00024 
00025 /* active packets */
00026 typedef struct {
00027   header_t *hdr;
00028   unsigned char rb;
00029   /* code */
00030   instr_t *code_min;
00031   instr_t *pc;
00032   instr_t *handler;
00033   instr_t *code_max;
00034   /* stack */
00035   value_t *stack_min;
00036   value_t *sp;        /* points above top value (i.e. alloc, then incr) */
00037   value_t *stack_max;
00038   /* in-packet heap */
00039   void *heap_min;
00040   void *h_alloc_ptr;      /* used only during assembly */
00041   void *heap_max;
00042   /* heap allocation pointer at runtime is stack_max, growing down;
00043      value pointed to by stack_max is legal (i.e. decr, then alloc) */
00044   void *h_alloc_heap_max; /* essentially the top of the buffer */
00045   /* used for optimizing marshalling---allows the marshaller to
00046      assume that the packet is already marshalled, starting at the
00047      hdr address. */
00048   unsigned int is_contiguous;
00049   int resized;          /* whether we have resized the buffer
00050                    or not */
00051 #ifdef __KERNEL__
00052   struct sk_buff *skb;
00053 #else
00054   struct iphdr *iph;        /* points to the IP header of the
00055                    buffer the packet is stored in */
00056 #endif /* __KERNEL__ */
00057 } packet_t;
00058 
00059 #ifndef __KERNEL__
00060 extern void fprintf_packet(FILE *f,packet_t *p);
00061 #endif /* !__KERNEL__ */
00062 
00063 #endif /* _SNAP_PACKET_H_ */