Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

blob.c File Reference

#include "config.h"
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dnet.h"

Go to the source code of this file.

Functions

static int fmt_D (int, int, blob_t *, va_list *)
static int fmt_H (int, int, blob_t *, va_list *)
static int fmt_b (int, int, blob_t *, va_list *)
static int fmt_c (int, int, blob_t *, va_list *)
static int fmt_d (int, int, blob_t *, va_list *)
static int fmt_h (int, int, blob_t *, va_list *)
static int fmt_s (int, int, blob_t *, va_list *)
static void print_hexl (blob_t *)
blob_tblob_new (void)
static int blob_reserve (blob_t *b, int len)
int blob_read (blob_t *b, void *buf, int len)
int blob_write (blob_t *b, const void *buf, int len)
int blob_insert (blob_t *b, const void *buf, int len)
int blob_delete (blob_t *b, void *buf, int len)
static int blob_fmt (blob_t *b, int pack, const char *fmt, va_list *ap)
int blob_pack (blob_t *b, const char *fmt,...)
int blob_unpack (blob_t *b, const char *fmt,...)
int blob_seek (blob_t *b, int off, int whence)
int blob_index (blob_t *b, const void *buf, int len)
int blob_rindex (blob_t *b, const void *buf, int len)
int blob_print (blob_t *b, char *style, int len)
int blob_sprint (blob_t *b, char *style, int len, char *dst, int size)
blob_tblob_free (blob_t *b)
int blob_register_alloc (size_t size, void *(bmalloc)(size_t), void(*bfree)(void *), void *(*brealloc)(void *, size_t))
int blob_register_pack (char c, blob_fmt_cb fmt_cb)

Variables

static void *(* bl_malloc )(size_t) = malloc
static void *(* bl_realloc )(void *, size_t) = realloc
static void(* bl_free )(void *) = free
static int bl_size = BUFSIZ
static blob_fmt_cb blob_ascii_fmt []
blob_printer blob_printers []


Function Documentation

int blob_delete blob_t b,
void *  buf,
int  len
 

Definition at line 139 of file blob.c.

References blob::base, blob::end, memcpy, memmove, NULL, blob::off, and blob::size.

Referenced by START_TEST().

static int blob_fmt blob_t b,
int  pack,
const char *  fmt,
va_list *  ap
[static]
 

Definition at line 152 of file blob.c.

References blob::base, blob_ascii_fmt, blob_reserve(), blob::end, NULL, blob::off, and strtol().

Referenced by blob_pack(), and blob_unpack().

blob_t* blob_free blob_t b  ) 
 

Definition at line 263 of file blob.c.

References blob::base, bl_free, NULL, and blob::size.

Referenced by START_TEST().

int blob_index blob_t b,
const void *  buf,
int  len
 

Definition at line 221 of file blob.c.

References memcmp().

Referenced by START_TEST().

int blob_insert blob_t b,
const void *  buf,
int  len
 

Definition at line 126 of file blob.c.

References blob::base, blob_reserve(), blob::end, memcpy, memmove, blob::off, and blob::size.

Referenced by START_TEST().

blob_t* blob_new void   ) 
 

Definition at line 62 of file blob.c.

References bl_free, bl_malloc, bl_size, and NULL.

Referenced by START_TEST().

int blob_pack blob_t b,
const char *  fmt,
  ...
 

Definition at line 191 of file blob.c.

References blob_fmt().

Referenced by START_TEST().

int blob_print blob_t b,
char *  style,
int  len
 

Definition at line 245 of file blob.c.

References blob_printers, blob_printer::name, NULL, and blob_printer::print.

Referenced by START_TEST().

int blob_read blob_t b,
void *  buf,
int  len
 

Definition at line 102 of file blob.c.

References blob::base, blob::end, memcpy, and blob::off.

Referenced by fmt_b(), fmt_c(), fmt_D(), fmt_d(), fmt_H(), fmt_h(), and START_TEST().

int blob_register_alloc size_t  size,
void *  (bmalloc)(size_t),
void(*)(void *)  bfree,
void *(*)(void *, size_t brealloc
 

Definition at line 272 of file blob.c.

References bl_free, bl_malloc, bl_realloc, bl_size, and NULL.

int blob_register_pack char  c,
blob_fmt_cb  fmt_cb
 

Definition at line 286 of file blob.c.

References blob_ascii_fmt, and NULL.

static int blob_reserve blob_t b,
int  len
[static]
 

Definition at line 78 of file blob.c.

References bl_realloc, bl_size, and NULL.

Referenced by blob_fmt(), blob_insert(), and blob_write().

int blob_rindex blob_t b,
const void *  buf,
int  len
 

Definition at line 233 of file blob.c.

References blob::base, blob::end, and memcmp().

Referenced by START_TEST().

int blob_seek blob_t b,
int  off,
int  whence
 

Definition at line 207 of file blob.c.

Referenced by START_TEST().

int blob_sprint blob_t b,
char *  style,
int  len,
char *  dst,
int  size
 

Definition at line 257 of file blob.c.

int blob_unpack blob_t b,
const char *  fmt,
  ...
 

Definition at line 199 of file blob.c.

References blob_fmt().

Referenced by START_TEST().

int blob_write blob_t b,
const void *  buf,
int  len
 

Definition at line 114 of file blob.c.

References blob_reserve(), and memcpy.

Referenced by fmt_b(), fmt_c(), fmt_D(), fmt_d(), fmt_H(), fmt_h(), fmt_s(), and START_TEST().

static int fmt_b int  ,
int  ,
blob_t ,
va_list * 
[static]
 

Definition at line 334 of file blob.c.

References blob_read(), and blob_write().

static int fmt_c int  ,
int  ,
blob_t ,
va_list * 
[static]
 

Definition at line 347 of file blob.c.

References blob_read(), and blob_write().

static int fmt_d int  ,
int  ,
blob_t ,
va_list * 
[static]
 

Definition at line 361 of file blob.c.

References blob_read(), and blob_write().

static int fmt_D int  ,
int  ,
blob_t ,
va_list * 
[static]
 

Definition at line 296 of file blob.c.

References blob_read(), and blob_write().

static int fmt_h int  ,
int  ,
blob_t ,
va_list * 
[static]
 

Definition at line 375 of file blob.c.

References blob_read(), and blob_write().

static int fmt_H int  ,
int  ,
blob_t ,
va_list * 
[static]
 

Definition at line 315 of file blob.c.

References blob_read(), and blob_write().

static int fmt_s int  ,
int  ,
blob_t ,
va_list * 
[static]
 

Definition at line 389 of file blob.c.

References blob::base, blob_write(), blob::end, and blob::off.

static void print_hexl blob_t  )  [static]
 

Definition at line 424 of file blob.c.

References blob::base, blob::end, and blob::off.


Variable Documentation

void(* bl_free)(void *) = free [static]
 

Definition at line 21 of file blob.c.

Referenced by blob_free(), blob_new(), and blob_register_alloc().

void*(* bl_malloc)(size_t) = malloc [static]
 

Definition at line 19 of file blob.c.

Referenced by blob_new(), and blob_register_alloc().

void*(* bl_realloc)(void *, size_t) = realloc [static]
 

Definition at line 20 of file blob.c.

Referenced by blob_register_alloc(), and blob_reserve().

int bl_size = BUFSIZ [static]
 

Definition at line 22 of file blob.c.

Referenced by blob_new(), blob_register_alloc(), and blob_reserve().

blob_fmt_cb blob_ascii_fmt[] [static]
 

Initial value:

 {
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        NULL,   NULL,   NULL,   NULL,   fmt_D,  NULL,   NULL,   NULL,
        fmt_H,  NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        NULL,   NULL,   fmt_b,  fmt_c,  fmt_d,  NULL,   NULL,   NULL,
        fmt_h,  NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,
        NULL,   NULL,   NULL,   fmt_s,  NULL,   NULL,   NULL,   NULL,
        NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL
}

Definition at line 34 of file blob.c.

Referenced by blob_fmt(), and blob_register_pack().

struct blob_printer blob_printers[]
 

Referenced by blob_print().


Generated on Sun May 14 14:51:21 2006 by  doxygen 1.4.2