aboutsummaryrefslogtreecommitdiffstats
path: root/epan/tvbuff.h
AgeCommit message (Collapse)AuthorFilesLines
2008-04-09Remove:Anders Broman1-4/+0
#ifdef NEED_G_ASCII_STRCASECMP_H #include "g_ascii_strcasecmp.h" #endif svn path=/trunk/; revision=24859
2007-12-09Move the routines tvb_skip_wsp() to tvbuff.cAnders Broman1-0/+21
svn path=/trunk/; revision=23818
2007-11-27strcasecmp(), strncasecmp(), g_strcasecmp(), and g_strncasecmp() delendaGuy Harris1-2/+6
est. Use g_ascii_strcasecmp() and g_ascii_strncasecmp(), and supply our own versions if they're missing from GLib (as is the case with GLib 1.x). In the code to build the list of named fields for Diameter, don't use g_strdown(); do our own g_ascii_-style upper-case to lower-case mapping in the hash function and use g_ascii_strcasecmp() in the compare function. We do this because there is no guarantee that toupper(), tolower(), and functions that use them will, for example, map between "I" and "i" in all locales; in Turkish locales, for example, there are, in both upper case and lower case, versions of "i" with and without a dot, and the upper-case version of "i" is "I"-with-a-dot and the lower-case version of "I" is "i"-without-a-dot. This causes strings that should match not to match. This finishes fixing bug 2010 - an earlier checkin prevented the crash (as there are other ways to produce the same crash, e.g. a bogus dictionary.xml file), but didn't fix the case-insensitive string matching. svn path=/trunk/; revision=23623
2007-05-18Split tvb_get_bits64 into tvb_get_bits8 tvb_get_bits16 tvb_get_bits32 and ↵Anders Broman1-1/+4
tvb_get_bits64 and use them in proto_tree_add_bits_ret_val(). svn path=/trunk/; revision=21828
2007-04-28Make tvb_memdup(), like ep_tvb_memdup(), return a "void *".Guy Harris1-1/+1
svn path=/trunk/; revision=21610
2007-04-28Add:Anders Broman1-0/+2
proto_tree_add_bits_ret_val() tvb_get_bits() And modify proto_tree_add_bits() not to return a value. little endian is not yet implemented. svn path=/trunk/; revision=21607
2007-04-24"memcpy()" takes void *'s as arguments and returns a void *; haveGuy Harris1-2/+2
tvb_memcpy() be similar, to avoid unnecessarily alignment warnings. Do the same with "ep_tvb_memdup()". svn path=/trunk/; revision=21554
2007-04-23Add some GCC warnings to the standard set, and add some others to theGuy Harris1-1/+1
--enable-extra-gcc-checks set. If we turn on -pedantic, try turning on -Wno-long-long as well, so that it's not *so* pedantic that it rejects the 64-bit integral data types that we explicitly require. Constify a bunch of stuff, and make some other changes, to get rid of warnings. Clean up some indentation. svn path=/trunk/; revision=21526
2006-06-19New rutine tvb_format_text_wsp() which will change "whiite space" characters ↵Anders Broman1-0/+6
to space before output. svn path=/trunk/; revision=18519
2006-05-21name changeRonnie Sahlberg1-3/+3
svn path=/trunk/; revision=18197
2006-03-10new FT_GUID handling - big/little endian supportedTomas Kukosa1-0/+7
svn path=/trunk/; revision=17566
2005-09-21fix/add doxygen commentsUlf Lamping1-2/+2
svn path=/trunk/; revision=15941
2005-09-11Replace tvb_memcpy() calls that extract IPv4 addresses into a guint32,Guy Harris1-0/+1
and that extract IPv6 addresses into a "struct e_in6_addr", with tvb_get_ipv4() and tvb_get_ipv6() calls - except for some that we remove, by using proto_tree_add_item(), rather than replacing. Have epan/tvbuff.h include epan/ipv6-utils.h, to define "struct e_in6_addr" (not necessary to declare the tvbuff routines, but including it there means "struct e_in6_addr" is guaranteed to be defined before those declarations, so we don't get compiler complaints if we define it *after* those declarations). svn path=/trunk/; revision=15758
2005-09-10Add "tvb_get_ipv4()" and "tvb_get_ipv6()" addresses, to fetch IPv4 andGuy Harris1-0/+9
IPv6 addresses. Use "tvb_get_ipv4()" in the WINS Replication dissector, so that it gets the right answer on little-endian *AND* big-endian machines. svn path=/trunk/; revision=15753
2005-08-17snprintf -> g_snprintfUlf Lamping1-1/+1
svn path=/trunk/; revision=15398
2005-08-10add new function tvb_get_ephemeral_stringz()Ronnie Sahlberg1-0/+9
svn path=/trunk/; revision=15273
2005-08-10rename ep_tvb_fake_unicode() to tvb_get_ephemeral_faked_unicode() and update ↵Ronnie Sahlberg1-8/+11
the README file. svn path=/trunk/; revision=15271
2005-08-10rename ep_tvb_get_string() to tvb_get_ephemeral_string() asnd update the ↵Ronnie Sahlberg1-5/+11
documentation in README.developer svn path=/trunk/; revision=15270
2005-07-28add an ep version of tvb_fake_unicode()Ronnie Sahlberg1-0/+6
svn path=/trunk/; revision=15128
2005-07-26new functions:Luis Ontanon1-0/+6
ep_tvb_memdup() ep_alloc0() ep_strsplit() add all of the ep_ allocators to libethereal.def svn path=/trunk/; revision=15100
2005-07-24addRonnie Sahlberg1-0/+5
ep_tvb_get_string that acts the same as tvb_get_string but the buffer returned need not be freed. svn path=/trunk/; revision=15024
2005-01-07Doxygen cleanups, from Mike Duigou.Guy Harris1-47/+58
svn path=/trunk/; revision=12980
2004-12-30Add a "tvb_bytes_to_str_punct()" routine, which wrapsGuy Harris1-0/+8
"bytes_to_str_punct()", and use it instead of extracting the bytes and formatting them by hand. svn path=/trunk/; revision=12876
2004-08-22Add "tvb_get_ntoh64()" and "tvb_get_letoh64()" routines to fetch 64-bitGuy Harris1-0/+2
integers. Make FT_INT64 and FT_UINT64 add numerical values, rather than byte-array values, to the protocol tree, and add routines to add specified 64-bit integer values to the protocol tree. Use those routines in the RSVP dissector. svn path=/trunk/; revision=11796
2004-07-18Set the svn:eol-style property on all text files to "native", so thatGuy Harris1-1/+1
they have LF at the end of the line on UN*X and CR/LF on Windows; hopefully this means that if a CR/LF version is checked in on Windows, the CRs will be stripped so that they show up only when checked out on Windows, not on UN*X. svn path=/trunk/; revision=11400
2004-05-05From Jerry Talkington:Olivier Biot1-1/+8
- Helper functions for uncompressing compressed tvbuffers. - Compressed content coding dissection in HTTP. svn path=/trunk/; revision=10799
2004-03-23Use "tvb_format_text()" to display strings, so we handle non-printableGuy Harris1-1/+7
characters. Some strings appear to be null-padded; add a "tvb_format_stringzpad()" routine to handle them, so that we don't show the padding characters as "\000". svn path=/trunk/; revision=10461
2004-02-19Constify a bunch of stuff.Guy Harris1-2/+2
svn path=/trunk/; revision=10106
2004-02-01Make "tvb_strneql()" take a "gchar *" rather than a "guint8 *" as theGuy Harris1-2/+2
string argument. Add some casts to squelch compiler warnings. svn path=/trunk/; revision=9951
2004-02-01packet-dcerpc-afs4int.cJörg Mayer1-2/+2
svn path=/trunk/; revision=9938
2004-01-23Change return type of tvb_format_text from guint8* to gchar*.Jörg Mayer1-2/+2
Remove now unnecessary casts in two files. svn path=/trunk/; revision=9801
2003-12-03performance updateRonnie Sahlberg1-2/+5
replace tvb_raw_offset() which is essentially a simple assignment and which is called a lot with a macro. this makes my tethereal testcase 2-3% faster. svn path=/trunk/; revision=9152
2003-12-02Move the definition of the tvbuff_t structure and friends to tvbuff.hRonnie Sahlberg1-6/+68
so that we can change tvb_get_ds_tvb() into a macro. This function was a single line assignment and was called a lot. This made tethereal ~2.5% faster in one testcase I use. svn path=/trunk/; revision=9141
2003-08-27Add a "contains" operator for byte-strings, strings, and tvbuffs (protocols).Gilbert Ramirez1-1/+8
The search uses a naive approach; more work is required to add a Boyer-Moore Search algorithm. svn path=/trunk/; revision=8280
2003-06-12Add new routines:Guy Harris1-1/+21
tvb_get_string() - takes a tvbuff, an offset, and a length as arguments, allocates a buffer big enough to hold a string with the specified number of bytes plus an added null terminator (i.e., length+1), copies the specified number of bytes from the tvbuff, at the specified offset, to that buffer and puts in a null terminator, and returns a pointer to that buffer (or throws an exception before allocating the buffer if that many bytes aren't available in the tvbuff); tvb_get_stringz() - takes a tvbuff, an offset, and a pointer to a "gint" as arguments, gets the size of the null-terminated string starting at the specified offset in the tvbuff (throwing an exception if the null terminator isn't found), allocates a buffer big enough to hold that string, copies the string to that buffer, and returns a pointer to that buffer and stores the length of the string (including the terminating null) in the variable pointed to by the "gint" pointer. Replace many pieces of code allocating a buffer and copying a string with calls to "tvb_get_string()" (for one thing, "tvb_get_string()" doesn't require you to remember that the argument to "tvb_get_nstringz0()" is the size of the buffer into which you're copying the string, which might be the length of the string to be copied *plus 1*). Don't use fixed-length buffers for null-terminated strings (even if the code that generates those packets has a #define to limit the length of the string). Use "tvb_get_stringz()", instead. In some cases where a value is fetched but is only used to pass an argument to a "proto_tree_add_XXX" routine, use "proto_tree_add_item()" instead. svn path=/trunk/; revision=7859
2003-05-19More tvb_get_nstringz0() fixes. Timo Sirainen pointed out that BadGerald Combs1-1/+3
Things can happen if we pass a zero buffer length to tvb_get_nstringz0(). Throw an exception if this happens. In various dissectors make sure the tvb_get_nstringz0()'s buffer length is greater than zero. svn path=/trunk/; revision=7688
2003-04-30Modify tvb_get_nstringz*() to behave more like snprintf(). Make changesGerald Combs1-6/+6
where necessary to reflect the new behavior. svn path=/trunk/; revision=7607
2003-02-24Rename "fake_unicode()" to "tvb_fake_unicode()" as it works on a tvbuff,Guy Harris1-1/+8
give it a byte-order argument, and move it to "epan/tvbuff.c". Use it to handle UCS-2 strings in version 1 of the Service Location Protocol. In SRVLOC V1, use registered fields that are already there for SRVLOC V2, and add some as needed. Fix some field names. svn path=/trunk/; revision=7186
2002-08-28Removed trailing whitespaces from .h and .c files using theJörg Mayer1-5/+5
winapi_cleanup tool written by Patrik Stridvall for the wine project. svn path=/trunk/; revision=6116
2002-07-17Add an extra argument to "tvb_find_line_end()", which specifies what itGuy Harris1-4/+14
should do if it doesn't find an EOL; if FALSE, it behaves as before, returning values that treat the line as ending at the end of the tvbuff, and if TRUE, it returns -1, so its caller can do segment reassembly until it gets the EOL. Add an option to the SMTP dissector to do segment reassembly, and do segment reassembly of the first line. svn path=/trunk/; revision=5891
2002-05-13Add a "tvb_ensure_bytes_exist()", which is like "tvb_bytes_exist()" onlyGuy Harris1-3/+7
it throws the appropriate exception if the bytes don't exist. Use it in the GIOP and ASN.1 code to check whether the bytes to be copied to a buffer exist before allocating the buffer. Make "check_offset_length_no_exception()" check for an overflow, so that it can be used in "tvb_ensure_bytes_exist()" and do all the checking that the code "tvb_ensure_bytes_exist()" replaces did. Make "get_CDR_wchar()" return a "gint", so that if the length octet it fetched has a value between 128 and 255, the length can be returned correctly. Fix some comments not to specify the exception thrown by various routines that can throw various exceptions. svn path=/trunk/; revision=5453
2002-05-05Make "tvb_ensure_length_remaining()" return a "guint" - it can't returnGuy Harris1-2/+2
a negative value. Use "tvb_ensure_length_remaining()" in "tcp_dissect_pdus()", rather than checking the return value of "tvb_length_remaining()" ourselves, and make various variables and parameters in it "guint" as appropriate. svn path=/trunk/; revision=5396
2002-04-24Use "gfloat" and "gdouble", rather than "float" and "double", as theGuy Harris1-5/+5
return types of the tvbuff accessors for floating-point types, to more closely match the tvbuff accessors for integral types. Fix an error in the code for fetching doubles on VAXes, and get rid of unused union members on VAXes. svn path=/trunk/; revision=5245
2002-04-12Add (untested) routines to fetch IEEE single-precision andGuy Harris1-1/+5
double-precision floating-point numbers, in big-endian and little-endian format (hopefully there aren't any middle-endian formats; if there are, we'll have to add them), from a tvbuff, and to return floats (for single-precision) and doubles (for double-precision). svn path=/trunk/; revision=5147
2002-03-06tvb_get_nstringz() needs to terminate a string with a NUL if theGilbert Ramirez1-1/+8
end of the tvbuff is reached before the maximum_length passed by the caller is reached and before a terminating NUL is found. In this case, tvb_get_nstringz() returns a -1, but if the string is not artificially terminated with a NUL by tvb_get_nstringz(), the caller has no idea where the string should end because 1) the return value "-1" gives the impression that the string ends at the end of the buffer but 2) the string does not end at the end of the buffer, but somewhere in the middle, due to the packet being shorter than expected. tvb_get_nstringz() and tvb_get_nstringz0() were both modified. The FT_STRINGZ case in proto_tree_add_item() is made simpler. During regression testing, when investigating a regression that I later corrected, I discovered that strings added through proto_tree_add_item (FT_STRING, FT_STRINGZ, and FT_UINT_STRING) leaked memory due to double allocation of the string. The proto_tree_add_string*() functions do not leak memory, since they only copy the string once. The memory leak was fixed by adding another argument to the static function proto_tree_set_string() to let the string ftype code know to g_strdup() the string or not. svn path=/trunk/; revision=4891
2002-02-18Don't give tvbuffs names; instead, give data sources names, where aGuy Harris1-3/+3
"data source" has a name and a top-level tvbuff, and frames can have a list of data sources associated with them. Use the tvbuff pointer to determine which data source is the data source for a given field; this means we don't have to worry about multiple data sources with the same name - the only thing the name does is label the notebook tab for the display of the data source, and label the hex dump of the data source in print/Tethereal output. Clean up a bunch of things discovered in the process of doing the above. svn path=/trunk/; revision=4749
2002-02-01Provide tvb_ensure_length_remaining(), which is likeGilbert Ramirez1-1/+4
tvb_length_remaining() except that it throws BoundsError if 'offset' is out-of-bounds. Allow a length argument of -1 for FT_STRING and FT_BYTES fields in proto_tree_add_item(). Change some dissectors to either use -1 for the length argument in calls to proto_tree_add_item(), or call tvb_ensure_length_remaining() instead of tvb_length_remaining(), or to check the return-value of tvb_length_remaining(). Changes to more dissectors are necessary, but will follow later. svn path=/trunk/; revision=4656
2001-11-20Get rid of "tvb_compat()"; it's no longer needed (the one remaining callGuy Harris1-9/+2
to it returns data that's no longer used). svn path=/trunk/; revision=4237
2001-11-15Get rid of NullTVB, the "compat_top_tvb" member of the "packet_info"Guy Harris1-5/+2
structure, the check for a null tvbuff pointer in "alloc_field_info()", and the "tvb_create_from_top()" macro; they're no longer needed, as there's no non-tvbuffified dissector code remaining. svn path=/trunk/; revision=4205
2001-11-13Hopefully the last time I have to change my e-mail address.Gilbert Ramirez1-2/+2
svn path=/trunk/; revision=4199