aboutsummaryrefslogtreecommitdiffstats
path: root/epan/to_str.c
AgeCommit message (Collapse)AuthorFilesLines
2017-01-01Fix backwards #if defined.Guy Harris1-1/+1
Left over from some stuff I was fiddling with. Bug: 11785 Change-Id: Ifb06e8b65db65037b336c46e5e180012ae5b7a59 Reviewed-on: https://code.wireshark.org/review/19487 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-01-01Always use the Windows time zone code on Windows.Guy Harris1-25/+29
We *have* to use the Windows code on Windows for the reasons given in the comment. However, some versions of Visual Studio have a time.h that CMake thinks defines tzname[] (which the header will do under some circumstances), so HAVE_TZNAME gets defined on Windows. We check for Windows *before* checking for HAVE_TZNAME - or HAVE_STRUCT_TM_TM_ZONE. Bug: 11785 Change-Id: I61360daf08203dbd9d109a87c05727b4dbecea66 Reviewed-on: https://code.wireshark.org/review/19483 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-19Improve support for single-character fields and filter expressions.Guy Harris1-0/+6
Add an FT_CHAR type, which is like FT_UINT8 except that the value is displayed as a C-style character constant. Allow use of C-style character constants in filter expressions; they can be used in comparisons with all integral types, and in "contains" operators. Use that type for some fields that appear (based on the way they're displayed, or on the use of C-style character constants in their value_string tables) to be 1-byte characters rather than 8-bit numbers. Change-Id: I39a9f0dda0bd7f4fa02a9ca8373216206f4d7135 Reviewed-on: https://code.wireshark.org/review/17787 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-06Move ip6_to_str_buf() to to_str.c and make it take the buffer length.João Valverde1-0/+11
Also make it use ws_inet_ntop6() (rather than implementing the string conversion ourselves). Remove ip6_to_str_buf_len(). Change-Id: I1eff3a8941e00987c2ff0c4dcfda13476af86191 Reviewed-on: https://code.wireshark.org/review/15692 Reviewed-by: João Valverde <j@v6e.pt> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-05-09Give the time_[m]secs_to routines names that begin with "[un]signed_".Guy Harris1-15/+15
Indicate whether they take a signed time delta or an unsigned time delta. Export unsigned_time_secs_to_str() while we're at it. Change-Id: I0fbe87f1825efa886364caa61a3358b79d285947 Reviewed-on: https://code.wireshark.org/review/15324 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-09Handle -2^31 as a negative time-in-seconds.Guy Harris1-46/+25
Its absolute value *is* expressible as an unsigned 32-bit value, so have time_secs_to_str_buf(), for negative values, just put a - at the front of the string and then pass the absolute value to time_secs_to_str_buf_unsigned(). Change-Id: I87252fe541d9aac4902f81493c9f032ec3ed1500 Reviewed-on: https://code.wireshark.org/review/15323 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-09Shuffle some routines to put absolute-time and relative-time code together.Guy Harris1-208/+218
Put the routines that handle absolute time ("relative to the Epoch") together and the routines that handle relative time together. Change-Id: I15256921091ab67a1d92026385bf1b27aa52b404 Reviewed-on: https://code.wireshark.org/review/15316 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-02Use AC_STRUCT_TIMEZONEJoão Valverde1-1/+1
Change-Id: I96c12dce662691d37d6eb6c1893c5e9d91a8ea6f Reviewed-on: https://code.wireshark.org/review/14753 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2016-01-07Remove constness from bytestring_to_str() [-Wcast-qual]João Valverde1-1/+1
Change-Id: I7f942787dfdc4f76dd0ad5111d1eb528b20f0ba9 Reviewed-on: https://code.wireshark.org/review/13011 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: João Valverde <j@v6e.pt>
2015-09-13Make other_decode_bitfield_value private to proto.c.Michael Mann1-35/+0
This is further encouragement to not try to manually create a bitstring while formatting a field. Change-Id: I4efbeb39a210cf1fd26203cd8560859276b333b0 Reviewed-on: https://code.wireshark.org/review/10494 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-08-19Added TDMoP protocol dissectorAndrew Chernyh1-0/+1
Bug: 11340 Change-Id: I04408db376718c7a5392f9521d7d75d0481ec30e Reviewed-on: https://code.wireshark.org/review/9514 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-06-21Fix memory leak printing eui64sEvan Huus1-1/+2
The scope that is passed in should only be used for the return value - other temporary buffers we must alloc/free ourselves, since if the scope is NULL they will not be managed automatically. Bug: 11293 Change-Id: I27be856f1c5cdf47f78e766192a29523664a543e Reviewed-on: https://code.wireshark.org/review/9007 Reviewed-by: Evan Huus <eapache@gmail.com> Petri-Dish: Evan Huus <eapache@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-05-07fix FT_UINT64 fields output in tsharkMoeller, Thies1-18/+19
Bug: 11170 Change-Id: Ica259867e2c8e0b4b680bca94970e13962a8dbb1 Reviewed-on: https://code.wireshark.org/review/8290 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-03-19Eliminate decode_bitfield_value from "public" use.Michael Mann1-11/+0
This "encourages" (forces) dissectors to use the bitmask field of the header_field_info structure to get "bitmask formatting" of a field. other_decode_bitfield_value should be treated the same (eventually eliminated), but there are still replacements to be made in the dissectors. Change-Id: I8a0d829c3fef2d5e5a588667a259e231bca559e6 Reviewed-on: https://code.wireshark.org/review/7736 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-21More wrapping of constants with G_GUINT64_CONSTANT().Guy Harris1-18/+18
Change-Id: I11771b08cc4e57692c42dd3fc8976fe390b3025d Reviewed-on: https://code.wireshark.org/review/7299 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-21The shortening to 32 bits is intentional, so add a cast.Guy Harris1-4/+4
The cast reassures the compiler that we do, in fact, know what we're doing, so it doesn't issue a warning. Change-Id: Ie3bc4e1c955f9c5cad5506e26fc72e12f7a8f854 Reviewed-on: https://code.wireshark.org/review/7295 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-21Make FT_{U}INT64 behave more like FT_{U}INT32, add support for ↵JC Wren1-9/+164
FT_{U}INT{40,48,56} Change-Id: I57354c309ecf3a0c8f0c7cff485638027f30bb19 Reviewed-on: https://code.wireshark.org/review/5813 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-09Add fixed length function for address types.Michael Mann1-0/+17
This allows for even more cleanup with respect to how address types are handled, including removing address_to_str.c. Most of the functionality was folded into address_types.c, but the remainder was just dispersed because it didn't make sense to keep the file. Change-Id: Id4e9391f0c3c26eff8c27b362e4f7a1970d718b4 Reviewed-on: https://code.wireshark.org/review/7038 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-09Add address type registration.Michael Mann1-1/+1
Now address types are setup just like field types and must be registered with a structure that provides its string representation (and more things in the future). Address types that are limited to a single dissector are registered by the dissector. More "common" ones are globally registered. There are still a few that really belong in a dissector, but have other dependencies currently not accounted for in the address type support. Many of the "address to string" conversions that involved g_sprintf have be changed to use more "performance friendly" methods (some at the cost of needing to_str-int.h) Leaving all comments regarding this "solution" in address_to_str.c in until all have been implemented Change-Id: I494f413e016b22859c44675def11135f228796e0 Reviewed-on: https://code.wireshark.org/review/7019 Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-18Remove some apparently-unnecessary includes of emem.h.Guy Harris1-1/+0
Change-Id: Ib7d1b587b439ff21ec6b7f1756ce6ccf25b66f80 Reviewed-on: https://code.wireshark.org/review/6635 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-17Replace the last of ep_alloc and ep_alloc0 with wmem equivalent.Michael Mann1-1/+1
Change-Id: I0338d0acda5e4b9957aad4825ca2cfd6fa506ead Reviewed-on: https://code.wireshark.org/review/6596 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-10to_str (epan): fix parameter 'scope' not found in the function declaration ↵Alexis La Goutte1-2/+2
[-Wdocumentation] Change-Id: Ie414d28415b71a79780d37fae454b90a7a610e1c Reviewed-on: https://code.wireshark.org/review/6475 Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-08guid_to_ep_str -> guid_to_strMichael Mann1-2/+2
guid_to_str now uses wmem allocation. Change-Id: I8e48d1a720942fbefbaa6227ae0929cb9f856359 Reviewed-on: https://code.wireshark.org/review/6391 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-08Remove decode_numeric_bitfield.Michael Mann1-21/+0
It was only used by 1 dissector and that dissector can just use bitmasking in the hf_ field. Change-Id: I99179356dd7cbfab0c7be1512357a7e4c0eecde6 Reviewed-on: https://code.wireshark.org/review/6390 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-08bytes_to_ep_str -> bytes_to_strMichael Mann1-27/+0
Change-Id: Ifcda8328dedec0ef4104c3a124d6246f99493750 Reviewed-on: https://code.wireshark.org/review/6389 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-07Squelch a compiler warning.Guy Harris1-1/+1
No need for buflen to be bigger than len, which it will be on LP64 and LLP64 platforms if it's size_t and len is guint32. Change-Id: Iffd2940187180cde1ad55ff7d3bd7c45acf22eba Reviewed-on: https://code.wireshark.org/review/6380 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-07Replace bytes_to_ep_str_punct with wmem equivalent.Michael Mann1-32/+0
Change-Id: I8aa7d7374db94685fd875cbf358c3bfbc83f3255 Reviewed-on: https://code.wireshark.org/review/6370 Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-07tvb_bytes_to_ep_str_punct -> tvb_bytes_to_str_punctMichael Mann1-14/+20
Also change bytestring_to_str to match bytes_to_ep_str_punct functionality (limiting byte string size) Change-Id: Idb958c7f0c203d103629469302b81fa922714f7e Reviewed-on: https://code.wireshark.org/review/6369 Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-07Remove bytestring_to_ep_strMichael Mann1-32/+0
Use wmem equivalent bytestring_to_str Change-Id: I1ec7509e3adb36ab0f65317459653cb3b4b11af8 Reviewed-on: https://code.wireshark.org/review/6368 Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-06Replace ep_address_to_str with address_to_str.Michael Mann1-1/+1
Change-Id: I4f1078b20f41800f72a751612703ad0d4c2ae87b Reviewed-on: https://code.wireshark.org/review/6323 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-04Make all Lua code use wmem not ememHadriel Kaplan1-0/+27
Changed all remaining code in wslua that was using emem, to use wmem or simpler methods. Bug: 9927 Change-Id: I3d19a770e0fd77d996bdb6b61a76a722cc2bcd55 Reviewed-on: https://code.wireshark.org/review/6109 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-10-13Follow-up of ged0b19b (Make boolean bitmask type 64-bit wide)Pascal Quantin1-2/+2
- use G_GINT64_MODIFIER instead of "%ll" - use G_GUINT64_CONSTANT instead of ULL - add some missing explicit casts Change-Id: Ic048d9ee8966ea504ea542cefe55688edcfb2dc7 Reviewed-on: https://code.wireshark.org/review/4644 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-10-12Make boolean bitmask type 64-bit wideDaniel Mack1-6/+6
There are protocols out there that have 64-bit wide bit mask fields, so make the internal representation and bitfield decoders 64-bit aware. For this, the ws_ctz() fallback and bits_count_ones() have to be tweaked slightly. Change-Id: I19237b954a69c9e6c55864f281993c1e8731a233 Reviewed-on: https://code.wireshark.org/review/4158 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-09-16Fix spelling: cant-->can't, wont-->won't, etcBill Meier1-1/+1
Change-Id: Ia6c3e7a25615bf8e052c3bacf096d76df775c9c2 Reviewed-on: https://code.wireshark.org/review/4126 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-09-04Fix up some formatting.Jeff Morriss1-18/+39
Change-Id: Ib38561ad5cf0f532e43ae3e10bbb857bb24ab9b6 Reviewed-on: https://code.wireshark.org/review/3980 Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2014-07-30Fix up some white space.Jeff Morriss1-12/+12
Change-Id: Ie8f1006d6b3a27fe0c8187ce99051c09dea09b66 (cherry picked from commit a3a5c33dad8669e37502f2ce4d0687f7ff7e87a1) Reviewed-on: https://code.wireshark.org/review/3257 Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2014-06-16Convert more time_to_str functions to wmemEvan Huus1-18/+18
Change-Id: Ibaae0e79935dc62f12f713f2df5b57d0f3f799b9 Reviewed-on: https://code.wireshark.org/review/2254 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-16Convert a bunch of time_to_str functions to wmemEvan Huus1-47/+56
Change-Id: I24fe3cc4a3589dadc4528a77fe7ff13d06b1a983 Reviewed-on: https://code.wireshark.org/review/2245 Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-05-01Try to fix warning C4244: '-=' : conversion from '__int64' to 'int',AndersBroman1-1/+1
possible loss of data Change-Id: I8cf74090e507f21eebfb40d72a3630d9f9bb0390 Reviewed-on: https://code.wireshark.org/review/1451 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-30Document to_str-int.h functions.Jakub Zawadzki1-5/+5
Change argument name of hex_to_str_back pad->len it seems to sounds better. Make uint_to_str_back_len() value uint32, to be sure about required buffer size. Change-Id: I48fd560683c5c0845cbb60813887a18328ec01e6 Reviewed-on: https://code.wireshark.org/review/1448 Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-30Optimize display_signed_time() - remove g_snprintfJakub Zawadzki1-10/+60
When tshark is printing columns (default) display_signed_time() is called for every frame. Current implemention is using g_snprintf() which makes this function costly when there is lot frames. Change-Id: I109c8699d38bfbd05475d457ae4173e937c6812d Reviewed-on: https://code.wireshark.org/review/1447 Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(Using sed : sed -i '/^ \* \$Id\$/,+1 d') Fix manually some typo (in export_object_dicom.c and crc16-plain.c) Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8 Reviewed-on: https://code.wireshark.org/review/497 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-01-26Drop support of Visual Studio 2005Alexis La Goutte1-42/+27
* Remove _MSC_VER < 1500 check * Cleanup config.nmake See http://www.wireshark.org/lists/wireshark-dev/201305/msg00159.html svn path=/trunk/; revision=54965
2013-12-19Add bytestring_to_str() which takes a wmem scope and is otherwise identical toEvan Huus1-0/+28
bytestring_to_ep_str (now deprecated). Use the new one in a few obvious places. Also just print directly to the buffer when loading ethernet addresses for resolution. The straight-to-buffer bytes_to_hexstr seems useful, maybe it shouldn't be in a private header... svn path=/trunk/; revision=54270
2013-12-19Rename more to_str functions to have ep_ in the name if they return ephemeralEvan Huus1-42/+14
buffers. Remove two unused functions. svn path=/trunk/; revision=54250
2013-12-19Rename a couple of to_str functions to have ep_ in the name. This makes itEvan Huus1-6/+6
obvious that the returned string is ephemeral, and opens up the original names in the API for versions that take a wmem pool (and thus can work in any scope). svn path=/trunk/; revision=54249
2013-12-19Modelines and consistent indentation.Evan Huus1-553/+565
svn path=/trunk/; revision=54248
2013-12-09Fix warningsJakub Zawadzki1-2/+0
svn path=/trunk/; revision=53885
2013-11-09Put "private" to_str.c functions to to_str-int.hJakub Zawadzki1-0/+1
svn path=/trunk/; revision=53187
2013-08-15[trivial] Use g_stpcpy()Jakub Zawadzki1-2/+2
svn path=/trunk/; revision=51381