[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/snap_io.c File Reference

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <netinet/in.h>
#include <linux/ip.h>
#include "snap.h"
#include "config.h"
#include "myassert.h"
#include "consts.h"
#include "bytecode.h"
#include "io.h"
#include "memalloc.h"
#include "packet.h"
#include "timers.h"
#include "d_printf.h"
#include "wassert.h"

Include dependency graph for snap_io.c:

Include dependency graph

Go to the source code of this file.


Defines

#define VERIFY(e)
#define IF_IN_FROM_HEAP(ho, sizeb, hmin, hmax, hmin2, hmax2)
#define ELSE_NOT_IN_FROM_HEAP   } else
#define IN_TOSPACE_HEAP(hdst, sizeb, toh, tohmax)   (((void *)(hdst) >= (toh)) && (((void *)(hdst) + (sizeb)) <= (tohmax)))

Functions

packet_tunmarshal_packet (char *buffer, int packet_lenb, int buf_lenb)
int marshal_packet (packet_t *p, int stack_amt, buffer_t *bufstr)
int file_to_str (int fd, buffer_t *buf)

Define Documentation

#define ELSE_NOT_IN_FROM_HEAP   } else
 

Definition at line 53 of file snap_io.c.

Referenced by marshal_packet().

#define IF_IN_FROM_HEAP ho,
sizeb,
hmin,
hmax,
hmin2,
hmax2   
 

Value:

if ((((void *)(ho) >= (void *)(hmin)) &&                 \
     ((void *)(ho) < (void *)(hmax)) &&                  \
     (((void *)(ho) +                            \
       ((sizeb) = (ho)->len + sizeof(heap_obj))) <= (void *)(hmax))) ||  \
    (((void *)(ho) >= (void *)(hmin2)) &&                \
     ((void *)(ho) < (void *)(hmax2)) &&                 \
     (((void *)(ho) +                            \
       ((sizeb) = (ho)->len + sizeof(heap_obj))) <= (void *)(hmax2)))) { \
  if (((sizeb) & 0x3) != 0) {                        \
    (sizeb) = ((sizeb) & ~0x3) + 4;                  \
  }

Definition at line 40 of file snap_io.c.

Referenced by marshal_packet().

#define IN_TOSPACE_HEAP hdst,
sizeb,
toh,
tohmax       (((void *)(hdst) >= (toh)) && (((void *)(hdst) + (sizeb)) <= (tohmax)))
 

Definition at line 55 of file snap_io.c.

#define VERIFY  
 

Value:

if (e);                                 \
  else {                                \
    fprintf(stderr,"%s:%d: packet check failed\n",__FILE__,__LINE__);   \
    return NULL;                            \
  }

Definition at line 31 of file snap_io.c.

Referenced by unmarshal_packet().


Function Documentation

int file_to_str int    fd,
buffer_t   buf
 

Definition at line 750 of file snap_io.c.

References buffer_t::lenb, memalloc, and buffer_t::s.

Referenced by init_request(), and main().

int marshal_packet packet_t   p,
int    stack_amt,
buffer_t   bufstr
 

Definition at line 162 of file snap_io.c.

References ADDI, BCASTI, BOGUSV, CALLS, packet_t::code_max, packet_t::code_min, snaphdr::code_sizeb, d_printf(), DIVI, ELSE_NOT_IN_FROM_HEAP, EQADR, EQFLT, EQI, EQSTR, EQTUP, FADDI, FDIVI, FGEQI, FGTI, heap_obj::flag, FLEQI, FLTI, FMULI, FSUBI, GEQI, GET_LIT, GET_OP, GTI, packet_t::h_alloc_heap_max, packet_t::hdr, packet_t::heap_max, packet_t::heap_min, snaphdr::heap_sizeb, IF_IN_FROM_HEAP, instr_t, packet_t::iph, packet_t::is_contiguous, heap_obj::len, buffer_t::lenb, LEQI, LTI, memalloc, MULTI, NEQI, NQADR, NQFLT, NQSTR, NQTUP, PADDR, packet_t::pc, PFLT, print_anti_timer, print_timer, PSTR, PTUP, PUSH, heap_obj::s, buffer_t::s, SET_LIT, SNETI, packet_t::sp, packet_t::stack_max, packet_t::stack_min, snaphdr::stack_sizeb, SUBI, SVCV, and value_t.

Referenced by main().

packet_t* unmarshal_packet char *    buffer,
int    packet_lenb,
int    buf_lenb
 

Definition at line 63 of file snap_io.c.

References packet_t::code_max, packet_t::code_min, snaphdr::code_sizeb, d_printf(), snaphdr::entry_point, packet_t::h_alloc_heap_max, packet_t::handler, packet_t::hdr, packet_t::heap_max, packet_t::heap_min, snaphdr::heap_sizeb, instr_t, packet_t::iph, packet_t::is_contiguous, packet_t::pc, print_anti_timer, print_timer, packet_t::sp, packet_t::stack_max, packet_t::stack_min, snaphdr::stack_sizeb, uint32, value_t, and VERIFY.

Referenced by main(), and snap_recv_pkt().