packet-ldap: fix regression for SASL handling
[wireshark-sm.git] / epan / unit_strings.c
blob2d7d6681557f66737340c3611a02254d5fe51ddc
1 /* unit_strings.c
2 * Units to append to field values
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
11 #include "config.h"
13 #include <wsutil/utf8_entities.h>
14 #include <wsutil/str_util.h>
15 #include "unit_strings.h"
17 /** Returns the unit string appropriate for the 32 bit value. */
18 const char* unit_name_string_get_value(guint32 value, const unit_name_string* units)
20 if (units->plural == NULL)
21 return units->singular;
23 return plurality(value, units->singular, units->plural);
26 /** Returns the unit string appropriate for the 64 bit value. */
27 const char* unit_name_string_get_value64(guint64 value, const unit_name_string* units)
29 if (units->plural == NULL)
30 return units->singular;
32 return plurality(value, units->singular, units->plural);
35 /** Returns the unit string appropriate for the double value. */
36 const char* unit_name_string_get_double(double value, const unit_name_string* units)
38 if (units->plural == NULL)
39 return units->singular;
41 return plurality(value, units->singular, units->plural);
45 * A default set of unit strings that dissectors can use for
46 * header fields. Some units intentionally have a space
47 * character in them for spacing between unit and value
49 const unit_name_string units_foot_feet = { " foot", " feet" };
50 const unit_name_string units_bit_bits = { " bit", " bits" };
51 const unit_name_string units_byte_bytes = { " byte", " bytes" };
52 const unit_name_string units_byte_bytespsecond = { " byte/s", " bytes/s" };
53 const unit_name_string units_octet_octets = { " octet", " octets" };
54 const unit_name_string units_word_words = { " word", " words" };
55 const unit_name_string units_tick_ticks = { " tick", " ticks" };
56 const unit_name_string units_meters = { "m", NULL };
57 const unit_name_string units_meter_meters = { " meter", " meters" };
58 const unit_name_string units_week_weeks = { " week", " weeks" };
59 const unit_name_string units_day_days = { " day", " days" };
60 const unit_name_string units_hour_hours = { " hour", " hours" };
61 const unit_name_string units_hours = { "h", NULL };
62 const unit_name_string units_minute_minutes = { " minute", " minutes" };
63 const unit_name_string units_minutes = { "min", NULL };
64 const unit_name_string units_second_seconds = { " second", " seconds" };
65 const unit_name_string units_seconds = { "s", NULL };
66 const unit_name_string units_millisecond_milliseconds = { " millisecond", " milliseconds" };
67 const unit_name_string units_milliseconds = { "ms", NULL };
68 const unit_name_string units_microsecond_microseconds = { " microsecond", " microseconds" };
69 const unit_name_string units_microseconds = { UTF8_MICRO_SIGN "s", NULL };
70 const unit_name_string units_nanosecond_nanoseconds = { " nanosecond", " nanoseconds" };
71 const unit_name_string units_nanoseconds = { "ns", NULL };
72 const unit_name_string units_nanometers = { "nm", NULL };
73 const unit_name_string units_degree_degrees = { " degree", " degrees" };
74 const unit_name_string units_degree_celsius = { UTF8_DEGREE_SIGN "C", NULL };
75 const unit_name_string units_degree_bearing = { UTF8_DEGREE_SIGN, NULL };
76 const unit_name_string units_centibels = { " cB", NULL };
77 const unit_name_string units_decibels = { " dB", NULL };
78 const unit_name_string units_dbm = { " dBm", NULL };
79 const unit_name_string units_dbi = { " dBi", NULL };
80 const unit_name_string units_mbm = { " mBm", NULL };
81 const unit_name_string units_percent = { "%", NULL };
82 const unit_name_string units_khz = { "kHz", NULL };
83 const unit_name_string units_mhz = { "MHz", NULL };
84 const unit_name_string units_ghz = { "GHz", NULL };
85 const unit_name_string units_hz = { "Hz", NULL };
86 const unit_name_string units_hz_s = { "Hz/s", NULL };
87 const unit_name_string units_kbit = { "kbit", NULL };
88 const unit_name_string units_kbps = { "Kbps", NULL };
89 const unit_name_string units_kibps = { "KiB/s", NULL };
90 const unit_name_string units_pkts = { " pkts", NULL };
91 const unit_name_string units_pkts_per_sec = { " pkts/s", NULL };
92 const unit_name_string units_km = { "km", NULL };
93 const unit_name_string units_kmh = { "km/h", NULL };
94 const unit_name_string units_bit_sec = { "bits/s", NULL };
95 const unit_name_string units_milliamps = { "mA", NULL };
96 const unit_name_string units_microwatts = { UTF8_MICRO_SIGN "W", NULL };
97 const unit_name_string units_volt = { "V", NULL };
98 const unit_name_string units_grams_per_second = { "g/s", NULL };
99 const unit_name_string units_meter_sec = { "m/s", NULL };
100 const unit_name_string units_meter_sec_squared = { "m/s" UTF8_SUPERSCRIPT_TWO , NULL };
101 const unit_name_string units_segment_remaining = { " segment remaining", " segments remaining" };
102 const unit_name_string units_frame_frames = { " frame", " frames" };
103 const unit_name_string units_revolutions_per_minute = { "rpm", NULL };
104 const unit_name_string units_kilopascal = { "kPa", NULL };
105 const unit_name_string units_newton_metre = { "Nm", NULL };
106 const unit_name_string units_liter_per_hour = { "L/h", NULL };
107 const unit_name_string units_amp = { "A", NULL };
108 const unit_name_string units_watthour = { "Wh", NULL };
109 const unit_name_string units_watt = { "W", NULL };
110 const unit_name_string units_bpm = { " BPM", NULL };
111 const unit_name_string units_calorie = { " cal", NULL };
115 * Editor modelines
117 * Local Variables:
118 * c-basic-offset: 4
119 * tab-width: 8
120 * indent-tabs-mode: nil
121 * End:
123 * ex: set shiftwidth=4 tabstop=8 expandtab:
124 * :indentSize=4:tabSize=8:noTabs=true: