For proto_tree_add_item(..., proto_xxx, ...)use ENC_NA as the encoding arg.
[obnox/wireshark/wip.git] / epan / dissectors / packet-cpfi.c
1 /* packet-cpfi.c
2  * Routines for CPFI Cross Point Frame Injector dissection
3  * CPFI - Cross Point Frame Injector is a CNT proprietary
4  * protocol used to carry Fibre Channel data over UDP
5  *
6  * Copyright 2003, Dave Sclarsky <dave_sclarsky[AT]cnt.com>
7  *
8  * $Id$
9  *
10  * Wireshark - Network traffic analyzer
11  * By Gerald Combs <gerald@wireshark.org>
12  * Copyright 1998 Gerald Combs
13  *
14  * Copied from packet-m2tp.c
15  * Thanks to Heinz Prantner for his motivation and assistance
16  *
17  * This program is free software; you can redistribute it and/or
18  * modify it under the terms of the GNU General Public License
19  * as published by the Free Software Foundation; either version 2
20  * of the License, or (at your option) any later version.
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30  */
31
32 #ifdef HAVE_CONFIG_H
33 # include "config.h"
34 #endif
35
36 #include <glib.h>
37
38 #include <epan/packet.h>
39 #include <epan/prefs.h>
40 #include <epan/strutil.h>
41
42 void proto_reg_handoff_cpfi(void);
43
44 #define CPFI_DEFAULT_UDP_PORT      5000
45 #define CPFI_DEFAULT_TTOT_UDP_PORT 5001
46
47 #define FIRST_TIO_CARD_ADDRESS    0x380
48
49
50 /* SOF defines */
51 #define CPFI_FRAME_TYPE_MASK  0xF0000000
52 #define CPFI_FRAME_TYPE_SHIFT 28
53 #define CPFI_SOURCE_MASK      0x0FFC0000
54 #define CPFI_SOURCE_SHIFT     18
55 #define CPFI_DEST_MASK        0x0003FF00
56 #define CPFI_DEST_SHIFT       8
57 #define CPFI_SOF_TYPE_MASK    0x000000F0
58 #define CPFI_SPEED_MASK       0x0000000C
59 #define CPFI_OPM_ERROR_MASK   0x00000002
60 #define CPFI_FROM_LCM_MASK    0x00000001
61
62 /* EOF defines */
63 #define CPFI_EOF_TYPE_MASK    0x78000000
64 #define CPFI_EOF_ERROR_MASK   0x7FE00000
65
66 /* configurable parameters */
67 static guint gbl_cpfi_udp_port      = CPFI_DEFAULT_UDP_PORT;
68 static guint gbl_cpfi_ttot_udp_port = CPFI_DEFAULT_TTOT_UDP_PORT;
69 static gboolean cpfi_arrow_moves    = TRUE;
70
71 /* Initialize the protocol and registered fields */
72 static int proto_cpfi = -1;
73 static int hf_cpfi_word_one = -1;
74 static int hf_cpfi_word_two = -1;
75 /* SOF word 1: */
76 static int hf_cpfi_frame_type = -1;
77 static int hf_cpfi_source = -1;
78 static int hf_cpfi_dest = -1;
79 static int hf_cpfi_SOF_type = -1;
80 static int hf_cpfi_speed = -1;
81 static int hf_cpfi_OPM_error = -1;
82 static int hf_cpfi_from_LCM = -1;
83 /* EOF */
84 static int hf_cpfi_CRC_32 = -1;
85 static int hf_cpfi_EOF_type = -1;
86 /* Hidden items */
87 static int hf_cpfi_t_instance = -1;
88 static int hf_cpfi_t_src_instance = -1;
89 static int hf_cpfi_t_dst_instance = -1;
90 static int hf_cpfi_t_board = -1;
91 static int hf_cpfi_t_src_board = -1;
92 static int hf_cpfi_t_dst_board = -1;
93 static int hf_cpfi_t_port = -1;
94 static int hf_cpfi_t_src_port = -1;
95 static int hf_cpfi_t_dst_port = -1;
96
97 static guint32 word1;
98 static guint32 word2;
99 static guint8 frame_type;
100 static char src_str[20];
101 static char dst_str[20];
102 static char l_to_r_arrow[] = "-->";
103 static char r_to_l_arrow[] = "<--";
104 static const char *left = src_str;
105 static const char *right = dst_str;
106 static const char *arrow = l_to_r_arrow;
107 static const char direction_and_port_string[] = "[%s %s %s] ";
108
109
110 /* Initialize the subtree pointers */
111 static gint ett_cpfi = -1;
112 static gint ett_cpfi_header = -1;
113 static gint ett_cpfi_footer = -1;
114
115 static dissector_handle_t fc_handle;
116 static dissector_handle_t data_handle;
117
118
119 static const value_string sof_type_vals[] = {
120     {0,     "SOFf"},
121     {1,     "SOFi2"},
122     {2,     "SOFn2"},
123     {3,     "SOFi3"},
124     {4,     "SOFn3"},
125     {5,     "SOFc1"},
126     {6,     "SOFi1"},
127     {7,     "SOFn1"},
128     {8,     "SOFc4"},
129     {9,     "SOFi4"},
130     {10,    "SOFn4"},
131     {0, NULL},
132 };
133
134 static const value_string speed_vals[] = {
135     {0,     "1 GBIT"},
136     {1,     "2 GBIT"},
137     {2,     "4 GBIT"},
138     {3,     "10 GBIT"},
139     {0, NULL},
140 };
141
142 static const value_string eof_type_vals[] = {
143     {0,     "EOFn"},
144     {1,     "EOFt"},
145     {2,     "EOFni"},
146     {3,     "EOFa"},
147     {4,     "EOFdt"},
148     {5,     "EOFdti"},
149     {6,     "EOFrt"},
150     {7,     "EOFrti"},
151     {0, NULL},
152 };
153
154 /* Header */
155 static void
156 dissect_cpfi_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
157 {
158   guint32 tda;
159   guint32 src;
160   guint8 src_instance = 0;
161   guint8 src_board = 0;
162   guint8 src_port = 0;
163   guint32 dst;
164   guint8 dst_instance = 0;
165   guint8 dst_board = 0;
166   guint8 dst_port = 0;
167   proto_item *extra_item = NULL;
168   proto_tree *extra_tree = NULL;
169   proto_item *hidden_item;
170
171   /* add a tree for the header */
172   if ( tree != NULL)
173   {
174     extra_item = proto_tree_add_protocol_format(tree, proto_cpfi, tvb, 0, -1, "Header");
175     extra_tree = proto_item_add_subtree(extra_item, ett_cpfi_header);
176   }
177
178   /* Extract the common header, and get the bits we need */
179   word1 = tvb_get_ntohl (tvb, 0);
180   word2 = tvb_get_ntohl (tvb, sizeof(word1));
181
182   /* Figure out where the frame came from. dstTDA is source of frame! */
183   tda = (word1 & CPFI_DEST_MASK) >> CPFI_DEST_SHIFT;
184   if ( tda >= FIRST_TIO_CARD_ADDRESS )
185   {
186     g_strlcpy(src_str, " CPFI", sizeof(src_str));
187     src = 0;                            /* Make it smallest */
188   }
189   else
190   {
191     const guint8 *srcmac;
192
193     /* Make sure this is an Ethernet address. */
194     DISSECTOR_ASSERT(pinfo->src.type == AT_ETHER);
195     srcmac = pinfo->src.data;
196
197     src_instance = srcmac[2]-1;
198     src_board = tda >> 4;
199     src_port = tda & 0x0f;
200     src = (1 << 24)  +  (src_instance << 16) + (src_board << 8) + src_port;
201     g_snprintf(src_str, sizeof(src_str), "%u.%u.%u", src_instance, src_board, src_port);
202   }
203
204   /* Figure out where the frame is going. srcTDA is destination of frame! */
205   tda = (word1 & CPFI_SOURCE_MASK) >> CPFI_SOURCE_SHIFT;
206   if ( tda >= FIRST_TIO_CARD_ADDRESS )
207   {
208     g_strlcpy(dst_str, " CPFI", sizeof(dst_str));
209     dst = 0;                            /* Make it smallest */
210   }
211   else
212   {
213     const guint8 *dstmac;
214
215     /* Make sure this is an Ethernet address. */
216     DISSECTOR_ASSERT(pinfo->dst.type == AT_ETHER);
217     dstmac = pinfo->dst.data;
218
219     dst_instance = dstmac[2]-1;
220     dst_board = tda >> 4;
221     dst_port = tda & 0x0f;
222     dst = (1 << 24)  +  (dst_instance << 16) + (dst_board << 8) + dst_port;
223     g_snprintf(dst_str, sizeof(dst_str), "%u.%u.%u", dst_instance, dst_board, dst_port);
224   }
225
226   /* Set up the source and destination and arrow per user configuration. */
227   if ( cpfi_arrow_moves  &&  (dst < src) )
228   {
229     left = dst_str;
230     arrow = r_to_l_arrow;
231     right = src_str;
232   }
233   else
234   {
235     left = src_str;
236     arrow = l_to_r_arrow;
237     right = dst_str;
238   }
239
240   if (extra_tree) {
241     /* For "real" TDAs (i.e. not for microTDAs), add hidden addresses to allow filtering */
242     if ( src != 0 )
243     {
244       hidden_item = proto_tree_add_bytes(extra_tree, hf_cpfi_t_instance, tvb, 0, 1, &src_instance);
245       PROTO_ITEM_SET_HIDDEN(hidden_item);
246       hidden_item = proto_tree_add_bytes(extra_tree, hf_cpfi_t_src_instance, tvb, 0, 1, &src_instance);
247       PROTO_ITEM_SET_HIDDEN(hidden_item);
248       hidden_item = proto_tree_add_bytes(extra_tree, hf_cpfi_t_board, tvb, 0, 1, &src_board);
249       PROTO_ITEM_SET_HIDDEN(hidden_item);
250       hidden_item = proto_tree_add_bytes(extra_tree, hf_cpfi_t_src_board, tvb, 0, 1, &src_board);
251       PROTO_ITEM_SET_HIDDEN(hidden_item);
252       hidden_item = proto_tree_add_bytes(extra_tree, hf_cpfi_t_port, tvb, 0, 1, &src_port);
253       PROTO_ITEM_SET_HIDDEN(hidden_item);
254       hidden_item = proto_tree_add_bytes(extra_tree, hf_cpfi_t_src_port, tvb, 0, 1, &src_port);
255       PROTO_ITEM_SET_HIDDEN(hidden_item);
256     }
257     if ( dst != 0 )
258     {
259       hidden_item = proto_tree_add_bytes(extra_tree, hf_cpfi_t_instance, tvb, 0, 1, &dst_instance);
260       PROTO_ITEM_SET_HIDDEN(hidden_item);
261       hidden_item = proto_tree_add_bytes(extra_tree, hf_cpfi_t_dst_instance, tvb, 0, 1, &dst_instance);
262       PROTO_ITEM_SET_HIDDEN(hidden_item);
263       hidden_item = proto_tree_add_bytes(extra_tree, hf_cpfi_t_board, tvb, 0, 1, &dst_board);
264       PROTO_ITEM_SET_HIDDEN(hidden_item);
265       hidden_item = proto_tree_add_bytes(extra_tree, hf_cpfi_t_dst_board, tvb, 0, 1, &dst_board);
266       PROTO_ITEM_SET_HIDDEN(hidden_item);
267       hidden_item = proto_tree_add_bytes(extra_tree, hf_cpfi_t_port, tvb, 0, 1, &dst_port);
268       PROTO_ITEM_SET_HIDDEN(hidden_item);
269       hidden_item = proto_tree_add_bytes(extra_tree, hf_cpfi_t_dst_port, tvb, 0, 1, &dst_port);
270       PROTO_ITEM_SET_HIDDEN(hidden_item);
271     }
272
273     /* add word 1 components to the protocol tree */
274     proto_tree_add_item(extra_tree, hf_cpfi_word_one  , tvb, 0, 4, ENC_BIG_ENDIAN);
275
276     proto_tree_add_item(extra_tree, hf_cpfi_frame_type, tvb, 0, 4, ENC_BIG_ENDIAN);
277     proto_tree_add_item(extra_tree, hf_cpfi_source    , tvb, 0, 4, ENC_BIG_ENDIAN);
278     proto_tree_add_item(extra_tree, hf_cpfi_dest      , tvb, 0, 4, ENC_BIG_ENDIAN);
279     proto_tree_add_item(extra_tree, hf_cpfi_SOF_type  , tvb, 0, 4, ENC_BIG_ENDIAN);
280     proto_tree_add_item(extra_tree, hf_cpfi_speed     , tvb, 0, 4, ENC_BIG_ENDIAN);
281     proto_tree_add_item(extra_tree, hf_cpfi_OPM_error , tvb, 0, 4, ENC_BIG_ENDIAN);
282     proto_tree_add_item(extra_tree, hf_cpfi_from_LCM  , tvb, 0, 4, ENC_BIG_ENDIAN);
283
284     /* add word 2 components to the protocol tree */
285     proto_tree_add_item(extra_tree, hf_cpfi_word_two  , tvb, 4, 4, ENC_BIG_ENDIAN);
286   };
287 }
288
289 /* Footer */
290 static void
291 dissect_cpfi_footer(tvbuff_t *tvb, proto_tree *tree)
292 {
293   proto_item *extra_item = NULL;
294   proto_tree *extra_tree = NULL;
295
296   /* add a tree for the footer */
297   if ( tree != NULL)
298   {
299     extra_item = proto_tree_add_protocol_format(tree, proto_cpfi, tvb, 0, -1, "Footer");
300     extra_tree = proto_item_add_subtree(extra_item, ett_cpfi_footer);
301   }
302
303   if (extra_tree) {
304     proto_tree_add_item(extra_tree, hf_cpfi_CRC_32  , tvb, 0, 4, ENC_BIG_ENDIAN);
305     proto_tree_add_item(extra_tree, hf_cpfi_EOF_type, tvb, 4, 4, ENC_BIG_ENDIAN);
306   }
307 }
308
309 /* CPFI */
310 static int
311 dissect_cpfi(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree)
312 {
313   tvbuff_t *header_tvb, *body_tvb, *footer_tvb;
314   proto_item *cpfi_item = NULL;
315   proto_tree *cpfi_tree = NULL;
316   gint length, reported_length, body_length, reported_body_length;
317
318   frame_type = (tvb_get_ntohl (message_tvb, 0) & CPFI_FRAME_TYPE_MASK) >> CPFI_FRAME_TYPE_SHIFT;
319
320   /*  If this is not a CPFI frame, return 0 to let another dissector try to
321    *  dissect it.
322    */
323   if ( !((frame_type == 9) && fc_handle) )
324     return 0;
325
326   /* If we don't have Ethernet addresses, can't do further dissection... */
327   if (pinfo->dst.type != AT_ETHER || pinfo->src.type != AT_ETHER)
328     return 0;
329
330   length = tvb_length_remaining(message_tvb, 8);
331   reported_length = tvb_reported_length_remaining(message_tvb, 8);
332   if (reported_length < 8)
333   {
334     /* We don't even have enough for the footer. */
335     return 0;
336   }
337
338   /* Length of packet, minus the footer. */
339   reported_body_length = reported_length - 8;
340   /* How much of that do we have in the tvbuff? */
341   body_length = length;
342   if (body_length > reported_body_length)
343     body_length = reported_body_length;
344
345   length = tvb_length_remaining(message_tvb, 8+body_length);
346   if (length < 0)
347   {
348     /* The footer wasn't captured at all.
349        XXX - we'd like to throw a BoundsError if that's the case. */
350     return 0;
351   }
352
353   /* In the interest of speed, if "tree" is NULL, don't do any work not
354      necessary to generate protocol tree items. */
355   if (tree) {
356     /* create the protocol tree */
357     cpfi_item = proto_tree_add_item(tree, proto_cpfi, message_tvb, 0, -1, ENC_NA);
358     cpfi_tree = proto_item_add_subtree(cpfi_item, ett_cpfi);
359   }
360
361   /* Set up the frame controls - can we do better than this? */
362   pinfo->sof_eof = 0;
363   pinfo->sof_eof = PINFO_SOF_FIRST_FRAME;
364   pinfo->sof_eof |= PINFO_EOF_LAST_FRAME;
365   pinfo->sof_eof |= PINFO_EOF_INVALID;
366
367   /* dissect the message */
368
369   /* extract and process the header */
370   header_tvb = tvb_new_subset(message_tvb, 0, 8, 8);
371   dissect_cpfi_header(header_tvb, pinfo, cpfi_tree);
372
373   body_tvb = tvb_new_subset(message_tvb, 8, body_length, reported_body_length);
374   call_dissector(fc_handle, body_tvb, pinfo, tree);
375
376   /* add more info, now that FC added it's */
377   proto_item_append_text(cpfi_item, direction_and_port_string, left, arrow, right);
378   col_prepend_fstr(pinfo->cinfo, COL_INFO, direction_and_port_string, left, arrow, right);
379
380   /* Do the footer */
381   footer_tvb = tvb_new_subset(message_tvb, 8+body_length, length, 8);
382   dissect_cpfi_footer(footer_tvb, cpfi_tree);
383
384   return(tvb_length(message_tvb));
385
386 }
387
388 /* Register the protocol with Wireshark */
389 void
390 proto_register_cpfi(void)
391 {
392   module_t *cpfi_module;
393
394   /* Setup list of header fields */
395   static hf_register_info hf[] = {
396
397     { &hf_cpfi_word_one,
398       { "Word one", "cpfi.word_one",
399         FT_UINT32, BASE_HEX, NULL, 0x0,
400         NULL, HFILL}},
401     { &hf_cpfi_word_two,
402       { "Word two", "cpfi.word_two",
403         FT_UINT32, BASE_HEX, NULL, 0x0,
404         NULL, HFILL}},
405
406     { &hf_cpfi_frame_type,
407       { "FrmType", "cpfi.frmtype",
408         FT_UINT32, BASE_HEX, NULL, CPFI_FRAME_TYPE_MASK,
409         "Frame Type", HFILL}},
410     { &hf_cpfi_source,
411       { "srcTDA", "cpfi.srcTDA",
412         FT_UINT32, BASE_HEX, NULL, CPFI_SOURCE_MASK,
413         "Source TDA (10 bits)", HFILL}},
414     { &hf_cpfi_dest,
415       { "dstTDA", "cpfi.dstTDA",
416         FT_UINT32, BASE_HEX, NULL, CPFI_DEST_MASK,
417         "Source TDA (10 bits)", HFILL}},
418     { &hf_cpfi_SOF_type,
419       { "SOFtype", "cpfi.SOFtype",
420         FT_UINT32, BASE_HEX, VALS(sof_type_vals), CPFI_SOF_TYPE_MASK,
421         "SOF Type", HFILL}},
422     { &hf_cpfi_speed,
423       { "speed", "cpfi.speed",
424         FT_UINT32, BASE_HEX, VALS(speed_vals), CPFI_SPEED_MASK,
425         "SOF Type", HFILL}},
426     { &hf_cpfi_OPM_error,
427       { "OPMerror", "cpfi.OPMerror",
428         FT_BOOLEAN, 32, NULL, CPFI_OPM_ERROR_MASK,
429         "OPM Error?", HFILL}},
430     { &hf_cpfi_from_LCM,
431       { "fromLCM", "cpfi.fromLCM",
432         FT_BOOLEAN, 32, NULL, CPFI_FROM_LCM_MASK,
433         "from LCM?", HFILL}},
434
435     { &hf_cpfi_CRC_32,
436       { "CRC-32", "cpfi.crc-32",
437         FT_UINT32, BASE_HEX, NULL, 0x0,
438         NULL, HFILL}},
439
440     { &hf_cpfi_EOF_type,
441       { "EOFtype", "cpfi.EOFtype",
442         FT_UINT32, BASE_HEX, VALS(eof_type_vals), CPFI_EOF_TYPE_MASK,
443         "EOF Type", HFILL}},
444
445     { &hf_cpfi_t_instance,
446       { "Instance", "cpfi.instance",
447         FT_BYTES, BASE_NONE,
448        NULL, 0x0, NULL, HFILL}},
449
450     { &hf_cpfi_t_src_instance,
451       { "Source Instance", "cpfi.src_instance",
452         FT_BYTES, BASE_NONE,
453        NULL, 0x0, NULL, HFILL}},
454
455     { &hf_cpfi_t_dst_instance,
456       { "Destination Instance", "cpfi.dst_instance",
457         FT_BYTES, BASE_NONE,
458        NULL, 0x0, NULL, HFILL}},
459
460     { &hf_cpfi_t_board,
461       { "Board", "cpfi.board",
462         FT_BYTES, BASE_NONE,
463        NULL, 0x0, NULL, HFILL}},
464
465     { &hf_cpfi_t_src_board,
466       { "Source Board", "cpfi.src_board",
467         FT_BYTES, BASE_NONE,
468        NULL, 0x0, NULL, HFILL}},
469
470     { &hf_cpfi_t_dst_board,
471       { "Destination Board", "cpfi.dst_board",
472         FT_BYTES, BASE_NONE,
473        NULL, 0x0, NULL, HFILL}},
474
475     { &hf_cpfi_t_port,
476       { "Port", "cpfi.port",
477         FT_BYTES, BASE_NONE,
478        NULL, 0x0, NULL, HFILL}},
479
480     { &hf_cpfi_t_src_port,
481       { "Source Port", "cpfi.src_port",
482         FT_BYTES, BASE_NONE,
483        NULL, 0x0, NULL, HFILL}},
484
485     { &hf_cpfi_t_dst_port,
486       { "Destination Port", "cpfi.dst_port",
487         FT_BYTES, BASE_NONE,
488        NULL, 0x0, NULL, HFILL}},
489   };
490
491
492   /* Setup protocol subtree array */
493   static gint *ett[] = {
494     &ett_cpfi,
495     &ett_cpfi_header,
496     &ett_cpfi_footer
497   };
498
499
500   /* Register the protocol name and description */
501   proto_cpfi = proto_register_protocol("Cross Point Frame Injector", "CPFI",  "cpfi");
502
503   /* Required function calls to register the header fields and subtrees used */
504   proto_register_field_array(proto_cpfi, hf, array_length(hf));
505   proto_register_subtree_array(ett, array_length(ett));
506
507   /* Register our configuration options for CPFI */
508   cpfi_module = prefs_register_protocol(proto_cpfi, proto_reg_handoff_cpfi);
509   prefs_register_uint_preference(cpfi_module, "udp.port", "CPFI UDP Port",
510                  "Set the port for CPFI messages (if other"
511                  " than the default of 5000)",
512                  10, &gbl_cpfi_udp_port);
513   prefs_register_uint_preference(cpfi_module, "udp.port2", "InstanceToInstance UDP Port",
514                  "Set the port for InstanceToInstance messages (if other"
515                  " than the default of 5001)",
516                  10, &gbl_cpfi_ttot_udp_port);
517   prefs_register_bool_preference(cpfi_module, "arrow_ctl",
518                 "Enable Active Arrow Control",
519                 "Control the way the '-->' is displayed."
520                 " When enabled, keeps the 'lowest valued' endpoint of the src-dest pair"
521                 " on the left, and the arrow moves to distinguish source from dest."
522                 " When disabled, keeps the arrow pointing right so the source of the frame"
523                 " is always on the left.",
524                 &cpfi_arrow_moves);
525
526 }
527
528 void
529 proto_reg_handoff_cpfi(void)
530 {
531   static gboolean cpfi_init_complete = FALSE;
532   static dissector_handle_t cpfi_handle;
533   static dissector_handle_t ttot_handle;
534   static guint cpfi_udp_port;
535   static guint cpfi_ttot_udp_port;
536
537   if ( !cpfi_init_complete )
538   {
539     fc_handle     = find_dissector("fc");
540     data_handle   = find_dissector("data");
541     cpfi_handle   = new_create_dissector_handle(dissect_cpfi, proto_cpfi);
542     ttot_handle   = new_create_dissector_handle(dissect_cpfi, proto_cpfi);
543     cpfi_init_complete = TRUE;
544   }
545   else
546   {
547     dissector_delete_uint("udp.port", cpfi_udp_port, cpfi_handle);
548     dissector_delete_uint("udp.port", cpfi_ttot_udp_port, ttot_handle);
549   }
550
551   cpfi_udp_port      = gbl_cpfi_udp_port;
552   cpfi_ttot_udp_port = gbl_cpfi_ttot_udp_port;
553
554   dissector_add_uint("udp.port", cpfi_udp_port, cpfi_handle);
555   dissector_add_uint("udp.port", cpfi_ttot_udp_port, ttot_handle);
556 }