diff options
author | Jakub Zawadzki <darkjames-ws@darkjames.pl> | 2013-07-10 18:14:15 +0000 |
---|---|---|
committer | Jakub Zawadzki <darkjames-ws@darkjames.pl> | 2013-07-10 18:14:15 +0000 |
commit | f3ed13c22ea9a73cad6f65488eacc59770197b0c (patch) | |
tree | 2524817ad70d4daef086fd0d287bf941228267af /epan/tvbuff-int.h | |
parent | dffa72af511e227bb59822673ae2f6a053ff28e2 (diff) | |
download | wireshark-f3ed13c22ea9a73cad6f65488eacc59770197b0c.tar.gz |
tvbuff: replace type with operation vtable
It's begin of work to allow adding new tvbuff types (think: wtap_tvbuff, base64_tvbuff).
svn path=/trunk/; revision=50486
Diffstat (limited to 'epan/tvbuff-int.h')
-rw-r--r-- | epan/tvbuff-int.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/epan/tvbuff-int.h b/epan/tvbuff-int.h index 6f7e9818a0..e85e661d25 100644 --- a/epan/tvbuff-int.h +++ b/epan/tvbuff-int.h @@ -26,6 +26,19 @@ #ifndef __TVBUFF_INT_H__ #define __TVBUFF_INT_H__ +struct tvbuff; + +struct tvb_ops { + void (*tvb_init)(struct tvbuff *tvb); + void (*tvb_free)(struct tvbuff *tvb); + guint (*tvb_offset)(const struct tvbuff *tvb, guint counter); + const guint8 *(*tvb_get_ptr)(struct tvbuff *tvb, const guint abs_offset, const guint abs_length); + void *(*tvb_memcpy)(struct tvbuff *tvb, void *target, guint offset, size_t length); + + gint (*tvb_find_guint8)(tvbuff_t *tvb, guint abs_offset, guint limit, guint8 needle); + gint (*tvb_pbrk_guint8)(tvbuff_t *tvb, guint abs_offset, guint limit, guint8 *needles, guchar *found_needle); +}; + typedef struct { /** The backing tvbuff_t */ struct tvbuff *tvb; @@ -59,7 +72,7 @@ struct tvbuff { tvbuff_t *previous; /* Record-keeping */ - tvbuff_type type; + const struct tvb_ops *ops; gboolean initialized; guint flags; struct tvbuff *ds_tvb; /**< data source top-level tvbuff */ |