Add API to expose "expert info" summary.
[metze/wireshark/wip.git] / epan / expert.c
1 /* expert.c
2  * Collecting Expert information.
3  *
4  * Implemented as a tap named "expert".
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  */
24
25 #include "config.h"
26
27 #include <stdio.h>
28 #include <stdlib.h>
29
30 #include "packet.h"
31 #include "expert.h"
32 #include "uat.h"
33 #include "prefs.h"
34 #include "wmem/wmem.h"
35 #include "tap.h"
36
37 /* proto_expert cannot be static because it's referenced in the
38  * print routines
39  */
40 int proto_expert              = -1;
41
42 static int proto_malformed    = -1;
43
44 static int expert_tap         = -1;
45 static int highest_severity   =  0;
46
47 static int ett_expert         = -1;
48 static int ett_subexpert      = -1;
49
50 static int hf_expert_msg      = -1;
51 static int hf_expert_group    = -1;
52 static int hf_expert_severity = -1;
53
54 struct expert_module
55 {
56         const char *proto_name;
57         int         proto_id;      /* Cache this for registering hfs */
58 };
59
60 /* List which stores protocols and expert_info that have been registered */
61 typedef struct _gpa_expertinfo_t {
62         guint32             len;
63         guint32             allocated_len;
64         expert_field_info **ei;
65 } gpa_expertinfo_t;
66 static gpa_expertinfo_t gpa_expertinfo;
67
68 /* Hash table of abbreviations and IDs */
69 static GHashTable *gpa_name_map = NULL;
70
71 const value_string expert_group_vals[] = {
72         { PI_CHECKSUM,          "Checksum" },
73         { PI_SEQUENCE,          "Sequence" },
74         { PI_RESPONSE_CODE,     "Response" },
75         { PI_REQUEST_CODE,      "Request" },
76         { PI_UNDECODED,         "Undecoded" },
77         { PI_REASSEMBLE,        "Reassemble" },
78         { PI_MALFORMED,         "Malformed" },
79         { PI_DEBUG,             "Debug" },
80         { PI_PROTOCOL,          "Protocol" },
81         { PI_SECURITY,          "Security" },
82         { PI_COMMENTS_GROUP,    "Comment" },
83         { PI_DECRYPTION,        "Decryption" },
84         { 0, NULL }
85 };
86
87 const value_string expert_severity_vals[] = {
88         { PI_ERROR,             "Error" },
89         { PI_WARN,              "Warn" },
90         { PI_NOTE,              "Note" },
91         { PI_CHAT,              "Chat" },
92         { PI_COMMENT,           "Comment" },
93         { 1,                    "Ok" },
94         { 0, NULL }
95 };
96
97 /* Possible values for a checksum evaluation */
98 const value_string expert_checksum_vals[] = {
99         { EXPERT_CHECKSUM_DISABLED,   "Disabled"  },
100         { EXPERT_CHECKSUM_UNKNOWN,    "Unknown"  },
101         { EXPERT_CHECKSUM_GOOD,       "Good"  },
102         { EXPERT_CHECKSUM_BAD,        "Bad" },
103         { 0,        NULL }
104 };
105
106 static expert_field_info *expert_registrar_get_byname(const char *field_name);
107
108 /*----------------------------------------------------------------------------*/
109 /* UAT for customizing severity levels.                                       */
110 /*----------------------------------------------------------------------------*/
111 typedef struct
112 {
113         char    *field;
114         guint32  severity;
115 } expert_level_entry_t;
116
117 static expert_level_entry_t *uat_expert_entries = NULL;
118 static guint expert_level_entry_count = 0;
119 /* Array of field names currently in UAT */
120 static GArray *uat_saved_fields = NULL;
121
122 UAT_CSTRING_CB_DEF(uat_expert_entries, field, expert_level_entry_t)
123 UAT_VS_DEF(uat_expert_entries, severity, expert_level_entry_t, guint32, PI_ERROR, "Error")
124
125 static gboolean uat_expert_update_cb(void *r, char **err)
126 {
127         expert_level_entry_t *rec = (expert_level_entry_t *)r;
128
129         if (expert_registrar_get_byname(rec->field) == NULL) {
130                 *err = g_strdup_printf("Expert Info field doesn't exist");
131                 return FALSE;
132         }
133         return TRUE;
134 }
135
136 static void *uat_expert_copy_cb(void *n, const void *o, size_t siz _U_)
137 {
138         expert_level_entry_t       *new_record = (expert_level_entry_t*)n;
139         const expert_level_entry_t *old_record = (const expert_level_entry_t *)o;
140
141         if (old_record->field) {
142                 new_record->field = g_strdup(old_record->field);
143         } else {
144                 new_record->field = NULL;
145         }
146
147         new_record->severity = old_record->severity;
148
149         return new_record;
150 }
151
152 static void uat_expert_free_cb(void*r)
153 {
154         expert_level_entry_t *rec = (expert_level_entry_t *)r;
155
156         if (rec->field)
157                 g_free(rec->field);
158 }
159
160 static void uat_expert_post_update_cb(void)
161 {
162         guint              i;
163         expert_field_info *field;
164
165         /* Reset any of the previous list of expert info fields to their original severity */
166         for ( i = 0 ; i < uat_saved_fields->len; i++ ) {
167                 field = g_array_index(uat_saved_fields, expert_field_info*, i);
168                 if (field != NULL) {
169                         field->severity = field->orig_severity;
170                 }
171         }
172
173         g_array_set_size(uat_saved_fields, 0);
174
175         for (i = 0; i < expert_level_entry_count; i++)
176         {
177                 field = expert_registrar_get_byname(uat_expert_entries[i].field);
178                 if (field != NULL)
179                 {
180                         field->severity = uat_expert_entries[i].severity;
181                         g_array_append_val(uat_saved_fields, field);
182                 }
183         }
184 }
185
186 #define EXPERT_REGISTRAR_GET_NTH(eiindex, expinfo)                                               \
187         if((guint)eiindex >= gpa_expertinfo.len && getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG"))   \
188                 g_error("Unregistered expert info! index=%d", eiindex);                          \
189         DISSECTOR_ASSERT_HINT((guint)eiindex < gpa_expertinfo.len, "Unregistered expert info!"); \
190         expinfo = gpa_expertinfo.ei[eiindex];
191
192 void
193 expert_packet_init(void)
194 {
195         module_t *module_expert;
196         uat_t    *expert_uat;
197
198         static hf_register_info hf[] = {
199                 { &hf_expert_msg,
200                         { "Message", "_ws.expert.message", FT_STRING, BASE_NONE, NULL, 0, "Wireshark expert information", HFILL }
201                 },
202                 { &hf_expert_group,
203                         { "Group", "_ws.expert.group", FT_UINT32, BASE_HEX, VALS(expert_group_vals), 0, "Wireshark expert group", HFILL }
204                 },
205                 { &hf_expert_severity,
206                         { "Severity level", "_ws.expert.severity", FT_UINT32, BASE_HEX, VALS(expert_severity_vals), 0, "Wireshark expert severity level", HFILL }
207                 }
208         };
209         static gint *ett[] = {
210                 &ett_expert,
211                 &ett_subexpert
212         };
213
214         /* UAT for overriding severity levels */
215         static uat_field_t custom_expert_fields[] = {
216                 UAT_FLD_CSTRING(uat_expert_entries, field, "Field name", "Expert Info filter name"),
217                 UAT_FLD_VS(uat_expert_entries, severity, "Severity", expert_severity_vals, "Custom severity level"),
218                 UAT_END_FIELDS
219         };
220
221         if (expert_tap == -1) {
222                 expert_tap = register_tap("expert");
223         }
224
225         if (proto_expert == -1) {
226                 proto_expert = proto_register_protocol("Expert Info", "Expert", "_ws.expert");
227                 proto_register_field_array(proto_expert, hf, array_length(hf));
228                 proto_register_subtree_array(ett, array_length(ett));
229                 proto_set_cant_toggle(proto_expert);
230
231                 module_expert = prefs_register_protocol(proto_expert, NULL);
232
233                 expert_uat = uat_new("Expert Info Severity Level Configuration",
234                         sizeof(expert_level_entry_t),
235                         "expert_severity",
236                         TRUE,
237                         (void **)&uat_expert_entries,
238                         &expert_level_entry_count,
239                         UAT_AFFECTS_DISSECTION,
240                         NULL,
241                         uat_expert_copy_cb,
242                         uat_expert_update_cb,
243                         uat_expert_free_cb,
244                         uat_expert_post_update_cb,
245                         custom_expert_fields);
246
247                 prefs_register_uat_preference(module_expert,
248                         "expert_severity_levels",
249                         "Severity Level Configuration",
250                         "A table that overrides Expert Info field severity levels to user configured levels",
251                         expert_uat);
252
253         }
254
255         highest_severity = 0;
256
257         proto_malformed = proto_get_id_by_filter_name("_ws.malformed");
258 }
259
260 void
261 expert_init(void)
262 {
263         gpa_expertinfo.len           = 0;
264         gpa_expertinfo.allocated_len = 0;
265         gpa_expertinfo.ei            = NULL;
266         gpa_name_map                 = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
267         uat_saved_fields             = g_array_new(FALSE, FALSE, sizeof(expert_field_info*));
268 }
269
270 void
271 expert_packet_cleanup(void)
272 {
273 }
274
275 void
276 expert_cleanup(void)
277 {
278         if (gpa_expertinfo.allocated_len) {
279                 gpa_expertinfo.len           = 0;
280                 gpa_expertinfo.allocated_len = 0;
281                 g_free(gpa_expertinfo.ei);
282                 gpa_expertinfo.ei          = NULL;
283         }
284
285         /* Free the abbrev/ID GTree */
286         if (gpa_name_map) {
287                 g_hash_table_destroy(gpa_name_map);
288                 gpa_name_map = NULL;
289         }
290
291         /* Free the UAT saved fields */
292         if (uat_saved_fields) {
293                 g_array_free(uat_saved_fields, TRUE);
294                 uat_saved_fields = NULL;
295         }
296 }
297
298
299 int
300 expert_get_highest_severity(void)
301 {
302         return highest_severity;
303 }
304
305 void
306 expert_update_comment_count(guint64 count)
307 {
308         if (count==0 && highest_severity==PI_COMMENT)
309                 highest_severity = 0;
310 }
311
312 expert_module_t *expert_register_protocol(int id)
313 {
314         expert_module_t *module;
315         protocol_t      *protocol;
316
317         protocol = find_protocol_by_id(id);
318
319         module = wmem_new(wmem_epan_scope(), expert_module_t);
320         module->proto_id = id;
321         module->proto_name = proto_get_protocol_short_name(protocol);
322
323         return module;
324 }
325
326 void expert_deregister_protocol (expert_module_t *module)
327 {
328     wmem_free(wmem_epan_scope(), module);
329 }
330
331 static int
332 expert_register_field_init(expert_field_info *expinfo, expert_module_t *module)
333 {
334         expinfo->protocol      = module->proto_name;
335
336         /* if we always add and never delete, then id == len - 1 is correct */
337         if (gpa_expertinfo.len >= gpa_expertinfo.allocated_len) {
338                 if (!gpa_expertinfo.ei) {
339                         gpa_expertinfo.allocated_len = PRE_ALLOC_EXPERT_FIELDS_MEM;
340                         gpa_expertinfo.ei = (expert_field_info **)g_malloc(sizeof(expert_field_info *)*PRE_ALLOC_EXPERT_FIELDS_MEM);
341                 } else {
342                         gpa_expertinfo.allocated_len += 1000;
343                         gpa_expertinfo.ei = (expert_field_info **)g_realloc(gpa_expertinfo.ei,
344                                                    sizeof(expert_field_info *)*gpa_expertinfo.allocated_len);
345                 }
346         }
347         gpa_expertinfo.ei[gpa_expertinfo.len] = expinfo;
348         gpa_expertinfo.len++;
349         expinfo->id = gpa_expertinfo.len - 1;
350         /* Save the original severity so it can be restored by the UAT */
351         expinfo->orig_severity = expinfo->severity;
352
353         /* save field name for lookup */
354         g_hash_table_insert(gpa_name_map, (gpointer) (expinfo->name), expinfo);
355
356         return expinfo->id;
357 }
358
359
360 /* for use with static arrays only, since we don't allocate our own copies
361 of the expert_field_info struct contained within the exp_register_info struct */
362 void
363 expert_register_field_array(expert_module_t *module, ei_register_info *exp, const int num_records)
364 {
365         int               i;
366         ei_register_info *ptr = exp;
367
368         for (i = 0; i < num_records; i++, ptr++) {
369                 /*
370                  * Make sure we haven't registered this yet.
371                  * Most fields have variables associated with them
372                  * that are initialized to -1; some have array elements,
373                  * or possibly uninitialized variables, so we also allow
374                  * 0 (which is unlikely to be the field ID we get back
375                  * from "expert_register_field_init()").
376                  */
377                 if (ptr->ids->ei != -1 && ptr->ids->ei != 0) {
378                         fprintf(stderr,
379                                 "Duplicate field detected in call to expert_register_field_array: '%s' is already registered, name=%s\n",
380                                 ptr->eiinfo.summary, ptr->eiinfo.name);
381                         return;
382                 }
383
384                 /* Register the field with the experts */
385                 ptr->ids->ei = expert_register_field_init(&ptr->eiinfo, module);
386
387                 /* Register with the header field info, so it's display filterable */
388                 ptr->eiinfo.hf_info.p_id = &ptr->ids->hf;
389                 ptr->eiinfo.hf_info.hfinfo.abbrev = ptr->eiinfo.name;
390                 ptr->eiinfo.hf_info.hfinfo.blurb = ptr->eiinfo.summary;
391
392                 proto_register_field_array(module->proto_id, &ptr->eiinfo.hf_info, 1);
393         }
394 }
395
396 /* Finds a record in the expert array by name.
397  * For the moment, this function is only used "internally"
398  * but may find a reason to be exported
399  */
400 static expert_field_info *
401 expert_registrar_get_byname(const char *field_name)
402 {
403         expert_field_info *hfinfo;
404
405         if (!field_name)
406                 return NULL;
407
408         hfinfo = (expert_field_info*)g_hash_table_lookup(gpa_name_map, field_name);
409
410         return hfinfo;
411 }
412
413 /**
414  * Get summary text of an expert_info field.
415  * This is intended for use in expert_add_info_format or proto_tree_add_expert_format
416  * to get the "base" string to then append additional information
417  */
418 const gchar* expert_get_summary(expert_field *eiindex)
419 {
420         expert_field_info *eiinfo;
421
422         /* Look up the item */
423         EXPERT_REGISTRAR_GET_NTH(eiindex->ei, eiinfo);
424
425     return eiinfo->summary;
426 }
427
428 /** clear flags according to the mask and set new flag values */
429 #define FI_REPLACE_FLAGS(fi, mask, flags_in) { \
430         (fi->flags = (fi)->flags & ~(mask)); \
431         (fi->flags = (fi)->flags | (flags_in)); \
432 }
433
434 /* set's the PI_ flags to a protocol item
435  * (and its parent items till the toplevel) */
436 static void
437 expert_set_item_flags(proto_item *pi, const int group, const guint severity)
438 {
439         if (pi != NULL && PITEM_FINFO(pi) != NULL && (severity >= FI_GET_FLAG(PITEM_FINFO(pi), PI_SEVERITY_MASK))) {
440                 FI_REPLACE_FLAGS(PITEM_FINFO(pi), PI_GROUP_MASK, group);
441                 FI_REPLACE_FLAGS(PITEM_FINFO(pi), PI_SEVERITY_MASK, severity);
442
443                 /* propagate till toplevel item */
444                 pi = proto_item_get_parent(pi);
445                 expert_set_item_flags(pi, group, severity);
446         }
447 }
448
449 static proto_tree*
450 expert_create_tree(proto_item *pi, int group, int severity, const char *msg)
451 {
452         proto_tree *tree;
453         proto_item *ti;
454
455         tree = proto_item_add_subtree(pi, ett_expert);
456         ti = proto_tree_add_protocol_format(tree, proto_expert, NULL, 0, 0, "Expert Info (%s/%s): %s",
457                                             val_to_str(severity, expert_severity_vals, "Unknown (%u)"),
458                                             val_to_str(group, expert_group_vals, "Unknown (%u)"),
459                                             msg);
460         PROTO_ITEM_SET_GENERATED(ti);
461
462         if (group == PI_MALFORMED) {
463                 /* Add hidden malformed protocol filter */
464                 proto_item *malformed_ti = proto_tree_add_item(tree, proto_malformed, NULL, 0, 0, ENC_NA);
465                 PROTO_ITEM_SET_HIDDEN(malformed_ti);
466         }
467
468         return proto_item_add_subtree(ti, ett_subexpert);
469 }
470
471 static void
472 expert_set_info_vformat(packet_info *pinfo, proto_item *pi, int group, int severity, int hf_index, gboolean use_vaformat,
473                         const char *format, va_list ap)
474 {
475         char           formatted[ITEM_LABEL_LENGTH];
476         int            tap;
477         expert_info_t *ei;
478         proto_tree    *tree;
479         proto_item    *ti;
480
481         if (pinfo == NULL && pi && pi->tree_data) {
482                 pinfo = PTREE_DATA(pi)->pinfo;
483         }
484
485         /* if this packet isn't loaded because of a read filter, don't output anything */
486         if (pinfo == NULL || PINFO_FD_NUM(pinfo) == 0) {
487                 return;
488         }
489
490         if (severity > highest_severity) {
491                 highest_severity = severity;
492         }
493
494         /* XXX: can we get rid of these checks and make them programming errors instead now? */
495         if (pi != NULL && PITEM_FINFO(pi) != NULL) {
496                 expert_set_item_flags(pi, group, severity);
497         }
498
499         if ((pi == NULL) || (PITEM_FINFO(pi) == NULL) ||
500                 ((guint)severity >= FI_GET_FLAG(PITEM_FINFO(pi), PI_SEVERITY_MASK))) {
501                 col_add_str(pinfo->cinfo, COL_EXPERT, val_to_str(severity, expert_severity_vals, "Unknown (%u)"));
502         }
503
504         if (use_vaformat) {
505                 g_vsnprintf(formatted, ITEM_LABEL_LENGTH, format, ap);
506         } else {
507                 g_strlcpy(formatted, format, ITEM_LABEL_LENGTH);
508         }
509
510         tree = expert_create_tree(pi, group, severity, formatted);
511
512         if (hf_index == -1) {
513                 /* If no filterable expert info, just add the message */
514                 ti = proto_tree_add_string(tree, hf_expert_msg, NULL, 0, 0, formatted);
515                 PROTO_ITEM_SET_GENERATED(ti);
516         } else {
517                 /* If filterable expert info, hide the "generic" form of the message,
518                    and generate the formatted filterable expert info */
519                 ti = proto_tree_add_none_format(tree, hf_index, NULL, 0, 0, "%s", formatted);
520                 PROTO_ITEM_SET_GENERATED(ti);
521                 ti = proto_tree_add_string(tree, hf_expert_msg, NULL, 0, 0, formatted);
522                 PROTO_ITEM_SET_HIDDEN(ti);
523         }
524
525         ti = proto_tree_add_uint_format_value(tree, hf_expert_severity, NULL, 0, 0, severity,
526                                               "%s", val_to_str_const(severity, expert_severity_vals, "Unknown"));
527         PROTO_ITEM_SET_GENERATED(ti);
528         ti = proto_tree_add_uint_format_value(tree, hf_expert_group, NULL, 0, 0, group,
529                                               "%s", val_to_str_const(group, expert_group_vals, "Unknown"));
530         PROTO_ITEM_SET_GENERATED(ti);
531
532         tap = have_tap_listener(expert_tap);
533
534         if (!tap)
535                 return;
536
537         ei = wmem_new(wmem_packet_scope(), expert_info_t);
538
539         ei->packet_num  = PINFO_FD_NUM(pinfo);
540         ei->group       = group;
541         ei->severity    = severity;
542         ei->hf_index    = hf_index;
543         ei->protocol    = pinfo->current_proto;
544         ei->summary     = wmem_strdup(wmem_packet_scope(), formatted);
545
546         /* if we have a proto_item (not a faked item), set expert attributes to it */
547         if (pi != NULL && PITEM_FINFO(pi) != NULL) {
548                 ei->pitem = pi;
549         }
550         /* XXX: remove this because we don't have an internal-only function now? */
551         else {
552                 ei->pitem = NULL;
553         }
554
555         tap_queue_packet(expert_tap, pinfo, ei);
556 }
557
558 /* Helper function for expert_add_info() to work around compiler's special needs on ARM */
559 static inline void
560 expert_add_info_internal(packet_info *pinfo, proto_item *pi, expert_field *expindex, ...)
561 {
562         /* the va_list is ignored */
563         va_list            unused;
564         expert_field_info *eiinfo;
565
566         /* Look up the item */
567         EXPERT_REGISTRAR_GET_NTH(expindex->ei, eiinfo);
568
569         va_start(unused, expindex);
570         expert_set_info_vformat(pinfo, pi, eiinfo->group, eiinfo->severity, *eiinfo->hf_info.p_id, FALSE, eiinfo->summary, unused);
571         va_end(unused);
572 }
573
574 void
575 expert_add_info(packet_info *pinfo, proto_item *pi, expert_field *expindex)
576 {
577         expert_add_info_internal(pinfo, pi, expindex);
578 }
579
580 void
581 expert_add_info_format(packet_info *pinfo, proto_item *pi, expert_field *expindex, const char *format, ...)
582 {
583         va_list            ap;
584         expert_field_info *eiinfo;
585
586         /* Look up the item */
587         EXPERT_REGISTRAR_GET_NTH(expindex->ei, eiinfo);
588
589         va_start(ap, format);
590         expert_set_info_vformat(pinfo, pi, eiinfo->group, eiinfo->severity, *eiinfo->hf_info.p_id, TRUE, format, ap);
591         va_end(ap);
592 }
593
594 /* Helper function for expert_add_expert() to work around compiler's special needs on ARM */
595 static inline proto_item *
596 proto_tree_add_expert_internal(proto_tree *tree, packet_info *pinfo, expert_field *expindex,
597                 tvbuff_t *tvb, gint start, gint length, ...)
598 {
599         expert_field_info *eiinfo;
600         proto_item        *ti;
601         va_list            unused;
602
603         /* Look up the item */
604         EXPERT_REGISTRAR_GET_NTH(expindex->ei, eiinfo);
605
606         ti = proto_tree_add_text(tree, tvb, start, length, "%s", eiinfo->summary);
607         va_start(unused, length);
608         expert_set_info_vformat(pinfo, ti, eiinfo->group, eiinfo->severity, *eiinfo->hf_info.p_id, FALSE, eiinfo->summary, unused);
609         va_end(unused);
610         return ti;
611 }
612
613 proto_item *
614 proto_tree_add_expert(proto_tree *tree, packet_info *pinfo, expert_field *expindex,
615                 tvbuff_t *tvb, gint start, gint length)
616 {
617         return proto_tree_add_expert_internal(tree, pinfo, expindex, tvb, start, length);
618 }
619
620 proto_item *
621 proto_tree_add_expert_format(proto_tree *tree, packet_info *pinfo, expert_field *expindex,
622                 tvbuff_t *tvb, gint start, gint length, const char *format, ...)
623 {
624         va_list            ap;
625         expert_field_info *eiinfo;
626         proto_item        *ti;
627
628         /* Look up the item */
629         EXPERT_REGISTRAR_GET_NTH(expindex->ei, eiinfo);
630
631         va_start(ap, format);
632         ti = proto_tree_add_text_valist(tree, tvb, start, length, format, ap);
633         va_end(ap);
634
635         va_start(ap, format);
636         expert_set_info_vformat(pinfo, ti, eiinfo->group, eiinfo->severity, *eiinfo->hf_info.p_id, TRUE, format, ap);
637         va_end(ap);
638
639         return ti;
640 }
641
642 /*
643  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
644  *
645  * Local variables:
646  * c-basic-offset: 8
647  * tab-width: 8
648  * indent-tabs-mode: t
649  * End:
650  *
651  * vi: set shiftwidth=8 tabstop=8 noexpandtab:
652  * :indentSize=8:tabSize=8:noTabs=false:
653  */