diff options
author | Nathan Binkert <nate@binkert.org> | 2009-03-17 12:49:03 -0700 |
---|---|---|
committer | Nathan Binkert <nate@binkert.org> | 2009-03-17 12:49:03 -0700 |
commit | a102f845404461bb3dade04fe3cdc754949bd248 (patch) | |
tree | 00db8cd096009d287ef796f95b2a9221bdb63416 /ext/dnet/blob.h | |
parent | f3621f11d5fe19557984e5554983a69bb89fb8a2 (diff) | |
download | gem5-a102f845404461bb3dade04fe3cdc754949bd248.tar.xz |
includes: add ext to the includes path.
move dnet to the correct place so that we use this
--HG--
rename : ext/dnet/dnet/addr.h => ext/dnet/addr.h
rename : ext/dnet/dnet/arp.h => ext/dnet/arp.h
rename : ext/dnet/dnet/blob.h => ext/dnet/blob.h
rename : ext/dnet/dnet/eth.h => ext/dnet/eth.h
rename : ext/dnet/dnet/fw.h => ext/dnet/fw.h
rename : ext/dnet/dnet/icmp.h => ext/dnet/icmp.h
rename : ext/dnet/dnet/intf.h => ext/dnet/intf.h
rename : ext/dnet/dnet/ip.h => ext/dnet/ip.h
rename : ext/dnet/dnet/ip6.h => ext/dnet/ip6.h
rename : ext/dnet/dnet/os.h => ext/dnet/os.h
rename : ext/dnet/dnet/rand.h => ext/dnet/rand.h
rename : ext/dnet/dnet/route.h => ext/dnet/route.h
rename : ext/dnet/dnet/tcp.h => ext/dnet/tcp.h
rename : ext/dnet/dnet/udp.h => ext/dnet/udp.h
Diffstat (limited to 'ext/dnet/blob.h')
-rw-r--r-- | ext/dnet/blob.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/ext/dnet/blob.h b/ext/dnet/blob.h new file mode 100644 index 000000000..a3be7897d --- /dev/null +++ b/ext/dnet/blob.h @@ -0,0 +1,56 @@ +/* + * blob.h + * + * Binary blob handling. + * + * Copyright (c) 2002 Dug Song <dugsong@monkey.org> + * + * $Id: blob.h,v 1.2 2002/04/05 03:06:44 dugsong Exp $ + */ + +#ifndef DNET_BLOB_H +#define DNET_BLOB_H + +typedef struct blob { + u_char *base; /* start of data */ + int off; /* offset into data */ + int end; /* end of data */ + int size; /* size of allocation */ +} blob_t; + +__BEGIN_DECLS +blob_t *blob_new(void); + +int blob_read(blob_t *b, void *buf, int len); +int blob_write(blob_t *b, const void *buf, int len); + +int blob_seek(blob_t *b, int off, int whence); +#define blob_skip(b, l) blob_seek(b, l, SEEK_CUR) +#define blob_rewind(b) blob_seek(b, 0, SEEK_SET) + +#define blob_offset(b) ((b)->off) +#define blob_left(b) ((b)->end - (b)->off) + +int blob_index(blob_t *b, const void *buf, int len); +int blob_rindex(blob_t *b, const void *buf, int len); + +int blob_pack(blob_t *b, const char *fmt, ...); +int blob_unpack(blob_t *b, const char *fmt, ...); + +int blob_insert(blob_t *b, const void *buf, int len); +int blob_delete(blob_t *b, void *buf, int len); + +int blob_print(blob_t *b, char *style, int len); + +blob_t *blob_free(blob_t *b); + +int blob_register_alloc(size_t size, void *(*bmalloc)(size_t), + void (*bfree)(void *), void *(*brealloc)(void *, size_t)); +#ifdef va_start +typedef int (*blob_fmt_cb)(int pack, int len, blob_t *b, va_list *arg); + +int blob_register_pack(char c, blob_fmt_cb fmt_cb); +#endif +__END_DECLS + +#endif /* DNET_BLOB_H */ |