aboutsummaryrefslogtreecommitdiffstats
path: root/epan/to_str.c
AgeCommit message (Collapse)AuthorFilesLines
2018-10-30to_str: Fixed incorrect order of checks in bytestring_to_str.Martin Boye Petersen1-4/+4
Issue revealed by commit 281dd22da96daa105580bf25f064ddfdc99a719d. The commit that revealed the issue allowed bytestring_to_str to be called when len was 0 and *ad was NULL causing a dissector bug to be reported. Change-Id: I01c2c04154e0514dc2702b5c1c43ed5074d0ac11 Reviewed-on: https://code.wireshark.org/review/30421 Reviewed-by: Anders Broman <a.broman58@gmail.com> Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-08-27epan: Use UTF8 horizontal ellipsis to indicate truncationStig Bjørlykke1-2/+3
Use UTF8_HORIZONTAL_ELLIPSIS to indicate string truncation in bytestring_to_str() and bytes_to_str(). We also use UTF8_HORIZONTAL_ELLIPSIS in the Packet List. Change-Id: Iaf5c2de97fa71369a8f29ac65fa81f71ed814752 Reviewed-on: https://code.wireshark.org/review/29291 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2018-02-08epan: use SPDX indentifiers.Dario Lombardo1-13/+1
Skipping dissectors dir for now. Change-Id: I717b66bfbc7cc81b83f8c2cbc011fcad643796aa Reviewed-on: https://code.wireshark.org/review/25694 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-06Convert PT_EXCHG into using conversation endpointsMichael Mann1-1/+0
Change-Id: Id5857a58513c38dd0ab5b30b61113bcc14e1ecee Reviewed-on: https://code.wireshark.org/review/24258 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-11-05Convert TIPC to use endpoint conversationsMichael Mann1-1/+0
Change-Id: Iab03ebbfc982bf7182851f63c17fa59bc71d7709 Reviewed-on: https://code.wireshark.org/review/24219 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-01Add ability to create endpoints through conversationsMichael Mann1-1/+0
Add endpoint information to the packet_info structure for dissectors to potentially use as their data to create conversations. This patch includes a simple "example" of using conversation_create_endpoint with TDMoP. The assignment of the PT_TDMOP "port type" has been replaced by setting ENDPOINT_TDMOP within the endpoint structure. Then when subdissectors of TDMoP call find_or_create_conversation(), it implicitly picks up the conversation information set by TDMoP Change-Id: I11dc29989cccd3b0f0349ee901babb455ca02d19 Reviewed-on: https://code.wireshark.org/review/24190 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Andrew Chernyh <andrew.chernyh@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-10-30Remove port_type values not set in pinfo->ptypeMichael Mann1-1/+0
NCP and SBCCS values used for conversation (endpoints) and not to pass "type" to subdissectors. Change-Id: I56a13d2bb7d718b340e9b5a102c43f6e0012bfb9 Reviewed-on: https://code.wireshark.org/review/24174 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-10-29Add conversation endpoint typeMichael Mann1-1/+0
For the moment this mirrors the port_type enumeration (PT_XXX), but the intent is to move away from using "port types", eliminating most (if not all) Added conversation_pt_to_endpoint_type() so that conversations deal with the correct enumeration. This is for dissector that use pinfo->ptype as input to conversation APIs. Explicit use of port types are converted to using ENDPOINT_XXX type. Change-Id: Ia0bf553a3943b702c921f185407e03ce93ebf0ef Reviewed-on: https://code.wireshark.org/review/24166 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-10-29Improve our ip6_to_str_buf() implementationJoão Valverde1-6/+28
Change-Id: I02b5d01797e526299a6dc5a031662cb78e4f8423 Reviewed-on: https://code.wireshark.org/review/24163 Reviewed-by: João Valverde <j@v6e.pt>
2017-10-29Get rid of MAX_IP_STR_LEN and MAX_IP6_STR_LEN.Guy Harris1-1/+1
We have WS_INET_ADDRSTRLEN and WS_INET6_ADDRSTRLEN; use them. Change-Id: Idade0da9fae70d891901acd787b06d21e2ddbc5f Reviewed-on: https://code.wireshark.org/review/24156 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-26Add a ws_in6_addr typedef for struct e_in6_addr.Guy Harris1-1/+1
That allows a parallel typedef of ws_in4_addr for guint32. Change-Id: I03b230247065e0e3840eb87635315a8e523ef562 Reviewed-on: https://code.wireshark.org/review/24073 Reviewed-by: Guy Harris <guy@alum.mit.edu>
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>