Enable Lua tcp tap userdata.
[obnox/wireshark/wip.git] / epan / dissectors / packet-radius_packetcable.c
1 /*
2  * packet-radius_packetcable.c
3  *
4  * Routines for Packetcable's RADIUS AVPs dissection
5  *
6  * $Id$
7  *
8  * Wireshark - Network traffic analyzer
9  * By Gerald Combs <gerald@wireshark.org>
10  * Copyright 1998 Gerald Combs
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25  *
26  */
27
28
29 /*
30  * Some of the development of the RADIUS protocol decoder was sponsored by
31  * Cable Television Laboratories, Inc. ("CableLabs") based upon proprietary
32  * CableLabs' specifications. Your license and use of this protocol decoder
33  * does not mean that you are licensed to use the CableLabs'
34  * specifications.  If you have questions about this protocol, contact
35  * jf.mule [AT] cablelabs.com or c.stuart [AT] cablelabs.com for additional
36  * information.
37  */
38
39 #ifdef HAVE_CONFIG_H
40 #include "config.h"
41 #endif
42
43 #include <epan/packet.h>
44 #include <epan/sminmpec.h>
45
46 #include "packet-radius.h"
47
48
49
50 static int proto_packetcable = -1;
51
52 static int hf_packetcable_em_header_version_id = -1;
53 static int hf_packetcable_bcid_timestamp = -1;
54 static int hf_packetcable_bcid_event_counter = -1;
55 static int hf_packetcable_em_header_event_message_type = -1;
56 static int hf_packetcable_em_header_element_type = -1;
57 static int hf_packetcable_em_header_sequence_number = -1;
58 static int hf_packetcable_em_header_status = -1;
59 static int hf_packetcable_em_header_status_error_indicator = -1;
60 static int hf_packetcable_em_header_status_event_origin = -1;
61 static int hf_packetcable_em_header_status_event_message_proxied = -1;
62 static int hf_packetcable_em_header_priority = -1;
63 static int hf_packetcable_em_header_attribute_count = -1;
64 static int hf_packetcable_em_header_event_object = -1;
65 static int hf_packetcable_call_termination_cause_source_document = -1;
66 static int hf_packetcable_call_termination_cause_code = -1;
67 static int hf_packetcable_trunk_group_id_trunk_type = -1;
68 static int hf_packetcable_trunk_group_id_trunk_number = -1;
69 static int hf_packetcable_qos_status = -1;
70 static int hf_packetcable_qos_status_indication = -1;
71 static int hf_packetcable_time_adjustment = -1;
72 static int hf_packetcable_redirected_from_info_number_of_redirections = -1;
73 static int hf_packetcable_electronic_surveillance_indication_df_cdc_address = -1;
74 static int hf_packetcable_electronic_surveillance_indication_df_ccc_address = -1;
75 static int hf_packetcable_electronic_surveillance_indication_cdc_port = -1;
76 static int hf_packetcable_electronic_surveillance_indication_ccc_port = -1;
77 static int hf_packetcable_terminal_display_info_terminal_display_status_bitmask = -1;
78 static int hf_packetcable_terminal_display_info_sbm_general_display = -1;
79 static int hf_packetcable_terminal_display_info_sbm_calling_number = -1;
80 static int hf_packetcable_terminal_display_info_sbm_calling_name = -1;
81 static int hf_packetcable_terminal_display_info_sbm_message_waiting = -1;
82 static int hf_packetcable_terminal_display_info_general_display = -1;
83 static int hf_packetcable_terminal_display_info_calling_number = -1;
84 static int hf_packetcable_terminal_display_info_calling_name = -1;
85 static int hf_packetcable_terminal_display_info_message_waiting = -1;
86
87 /* This is slightly ugly.  */
88 static int hf_packetcable_qos_desc_flags[] =
89 {
90         -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
91 };
92 static int hf_packetcable_qos_desc_fields[] =
93 {
94         -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
95 };
96
97
98 static gint ett_radius_vendor_packetcable_bcid = -1;
99 static gint ett_radius_vendor_packetcable_status = -1;
100 static gint ett_radius_vendor_packetcable_qos_status = -1;
101 static gint ett_packetcable_term_dsply = -1;
102
103
104 #define PACKETCABLE_QOS_STATE_INDICATION_MASK 0X0003
105 #define PACKETCABLE_SERVICE_FLOW_SCHEDULING_TYPE_MASK  (1 << 2)
106 #define PACKETCABLE_NOMINAL_GRANT_INTERVAL_MASK        (1 << 3)
107 #define PACKETCABLE_TOLERATED_GRANT_JITTER_MASK        (1 << 4)
108 #define PACKETCABLE_GRANTS_PER_INTERVAL_MASK   (1 << 5)
109 #define PACKETCABLE_UNSOLICITED_GRANT_SIZE_MASK        (1 << 6)
110 #define PACKETCABLE_TRAFFIC_PRIORITY_MASK      (1 << 7)
111 #define PACKETCABLE_MAXIMUM_SUSTAINED_RATE_MASK        (1 << 8)
112 #define PACKETCABLE_MAXIMUM_TRAFFIC_BURST_MASK (1 << 9)
113 #define PACKETCABLE_MINIMUM_RESERVED_TRAFFIC_RATE_MASK (1 << 10)
114 #define PACKETCABLE_MINIMUM_PACKET_SIZE_MASK   (1 << 11)
115 #define PACKETCABLE_MAXIMUM_CONCATENATED_BURST_MASK    (1 << 12)
116 #define PACKETCABLE_REQUEST_TRANSMISSION_POLICY_MASK   (1 << 13)
117 #define PACKETCABLE_NOMINAL_POLLING_INTERVAL_MASK      (1 << 14)
118 #define PACKETCABLE_TOLERATED_POLL_JITTER_MASK (1 << 15)
119 #define PACKETCABLE_IP_TYPE_OF_SERVICE_OVERRIDE_MASK   (1 << 16)
120 #define PACKETCABLE_MAXIMUM_DOWNSTREAM_LATENCY_MASK    (1 << 17)
121
122 #define PACKETCABLE_QOS_DESC_BITFIELDS 16
123
124 #define PACKETCABLE_EMHS_EI_MASK 0X0003
125 #define PACKETCABLE_EMHS_EO_MASK 0X0004
126 #define PACKETCABLE_EMHS_EMP_MASK 0X0008
127 #define PACKETCABLE_EMHS_RESERVED_MASK 0Xfff0
128
129
130 static guint32 packetcable_qos_desc_mask[] =
131 {
132         PACKETCABLE_SERVICE_FLOW_SCHEDULING_TYPE_MASK,
133         PACKETCABLE_NOMINAL_GRANT_INTERVAL_MASK,
134         PACKETCABLE_TOLERATED_GRANT_JITTER_MASK,
135         PACKETCABLE_GRANTS_PER_INTERVAL_MASK,
136         PACKETCABLE_UNSOLICITED_GRANT_SIZE_MASK,
137         PACKETCABLE_TRAFFIC_PRIORITY_MASK,
138         PACKETCABLE_MAXIMUM_SUSTAINED_RATE_MASK,
139         PACKETCABLE_MAXIMUM_TRAFFIC_BURST_MASK,
140         PACKETCABLE_MINIMUM_RESERVED_TRAFFIC_RATE_MASK,
141         PACKETCABLE_MINIMUM_PACKET_SIZE_MASK,
142         PACKETCABLE_MAXIMUM_CONCATENATED_BURST_MASK,
143         PACKETCABLE_REQUEST_TRANSMISSION_POLICY_MASK,
144         PACKETCABLE_NOMINAL_POLLING_INTERVAL_MASK,
145         PACKETCABLE_TOLERATED_POLL_JITTER_MASK,
146         PACKETCABLE_IP_TYPE_OF_SERVICE_OVERRIDE_MASK,
147         PACKETCABLE_MAXIMUM_DOWNSTREAM_LATENCY_MASK
148 };
149
150 static const value_string radius_vendor_packetcable_event_message_vals[] =
151 {
152         {0,  "Reserved"},
153         {1,  "Signaling_Start"},
154         {2,  "Signaling_Stop"},
155         {3,  "Database_Query"},
156         {4,  "Intelligent_Peripheral_Usage_Start"},
157         {5,  "Intelligent_Peripheral_Usage_Stop"},
158         {6,  "Service_Instance"},
159         {7,  "QoS_Reserve"},
160         {8,  "QoS_Release"},
161         {9,  "Service_Activation"},
162         {10, "Service_Deactivation"},
163         {11,  "Media_Report"},
164         {12,  "Signal_Instance"},
165         {13, "Interconnect_(Signaling)_Start"},
166         {14, "Interconnect_(Signaling)_Stop"},
167         {15, "Call_Answer"},
168         {16, "Call_Disconnect"},
169         {17, "Time_Change"},
170         {19, "QoS_Commit"},
171         {20, "Media_Alive"},
172         {31,  "Policy_Request"},
173         {32,  "Policy_Delete"},
174         {33,  "Policy_Update"},
175         {0, NULL}
176 };
177
178 static const value_string packetcable_em_header_element_type_vals[] =
179 {
180         {0,  "Reserved"},
181         {1,  "CMS"},
182         {2,  "CMTS"},
183         {3,  "Media Gateway Controller"},
184         {4,  "Policy Server"},
185         {0, NULL}
186 };
187
188 static const value_string packetcable_em_header_status_error_indicator_vals[] =
189 {
190         {0,  "No Error"},
191         {1,  "Possible Error"},
192         {2,  "Known Error"},
193         {3,  "Reserved"},
194         {0, NULL}
195 };
196
197 static const value_string packetcable_em_header_status_event_origin_vals[] =
198 {
199         {0,  "Trusted Element"},
200         {1,  "Untrusted Element"},
201         {0, NULL}
202 };
203
204 static const value_string packetcable_em_header_status_event_message_proxied_vals[] =
205 {
206         {0,  "Not proxied"},
207         {1,  "Proxied"},
208         {0, NULL}
209 };
210
211 static const value_string packetcable_call_termination_cause_vals[] =
212 {
213         {0,  "Reserved"},
214         {1,  "BAF"},
215         {2,  "Reserved"},
216         {0, NULL}
217 };
218
219 static const value_string packetcable_trunk_type_vals[] =
220 {
221         {1,  "Not Used"},
222         {2,  "Not Used"},
223         {3,  "SS7 direct trunk group member"},
224         {4,  "SS7 from IC to AT and SS7 from AT to EO"},
225         {5,  "Not Used"},
226         {6,  "SS7 from IC to AT and non-SS7 from AT to EO (terminating only)"},
227         {9,  "Signaling type not specified"},
228         {0, NULL}
229 };
230
231 static const value_string packetcable_state_indication_vals[] =
232 {
233         {0,  "Illegal Value"},
234         {1,  "Resource Reserved but not Activated"},
235         {2,  "Resource Activated"},
236         {3,  "Resource Reserved & Activated"},
237         { 0, NULL }
238 };
239
240
241 /* Decode a PacketCable BCID. */
242 /* XXX - This should probably be combinde with the equivalent COPS code */
243 static void decode_packetcable_bcid (tvbuff_t *tvb, proto_tree *tree, int offset)
244 {
245         guint8 packetcable_buf[64];
246
247         proto_tree_add_item(tree, hf_packetcable_bcid_timestamp,
248                                                 tvb, offset, 4, FALSE);
249         tvb_memcpy(tvb, packetcable_buf, offset + 4, 8); packetcable_buf[8] = '\0';
250         proto_tree_add_text(tree, tvb, offset + 4, 8,
251                                                 "Element ID: %s", packetcable_buf);
252         tvb_memcpy(tvb, packetcable_buf, offset + 13, 7); packetcable_buf[7] = '\0';
253         proto_tree_add_text(tree, tvb, offset + 12, 8,
254                                                 "Time Zone: DST: %c, Offset: %s", tvb_get_guint8(tvb, offset + 12),
255                                                 packetcable_buf);
256         proto_tree_add_item(tree, hf_packetcable_bcid_event_counter,
257                                                 tvb, offset + 20, 4, FALSE);
258 }
259
260 static const gchar* dissect_packetcable_em_hdr(proto_tree* tree, tvbuff_t* tvb) {
261         guint8 packetcable_buf[64];
262         proto_item *ti;
263         proto_tree *obj_tree;
264
265         proto_tree_add_item(tree, hf_packetcable_em_header_version_id, tvb,  0, 2, FALSE);
266         ti = proto_tree_add_text(tree, tvb,  2, 24, "BCID");
267         obj_tree = proto_item_add_subtree(ti, ett_radius_vendor_packetcable_bcid);
268         decode_packetcable_bcid(tvb, obj_tree,  2);
269
270         proto_tree_add_item(tree, hf_packetcable_em_header_event_message_type, tvb,  26, 2, FALSE);
271         proto_tree_add_item(tree, hf_packetcable_em_header_element_type, tvb,  28, 2, FALSE);
272         tvb_memcpy(tvb, packetcable_buf,  30, 8); packetcable_buf[8] = '\0';
273         proto_tree_add_text(tree, tvb,  30, 8, "Element ID: %s", packetcable_buf );
274         tvb_memcpy(tvb, packetcable_buf,  39, 7); packetcable_buf[7] = '\0';
275         proto_tree_add_text(tree, tvb,  38, 8, "Time Zone: DST: %c, Offset: %s", tvb_get_guint8(tvb,  38), packetcable_buf);
276         proto_tree_add_item(tree, hf_packetcable_em_header_sequence_number, tvb,  46, 4, FALSE);
277         tvb_memcpy(tvb, packetcable_buf,  50, 18); packetcable_buf[18] = '\0';
278         proto_tree_add_text(tree, tvb,  50, 18, "Event Time: %s", packetcable_buf);
279
280         ti = proto_tree_add_item(tree, hf_packetcable_em_header_status, tvb,  68, 4, FALSE);
281         obj_tree = proto_item_add_subtree(ti, ett_radius_vendor_packetcable_status);
282         proto_tree_add_item(obj_tree, hf_packetcable_em_header_status_error_indicator, tvb,  68, 4, FALSE);
283         proto_tree_add_item(obj_tree, hf_packetcable_em_header_status_event_origin, tvb,  68, 4, FALSE);
284         proto_tree_add_item(obj_tree, hf_packetcable_em_header_status_event_message_proxied, tvb,  68, 4, FALSE);
285
286         proto_tree_add_item(tree, hf_packetcable_em_header_priority, tvb,  72, 1, FALSE);
287         proto_tree_add_item(tree, hf_packetcable_em_header_attribute_count, tvb,  73, 2, FALSE);
288         proto_tree_add_item(tree, hf_packetcable_em_header_event_object, tvb,  75, 1, FALSE);
289         return "";
290 }
291
292 static const gchar* dissect_packetcable_call_term_cause(proto_tree* tree, tvbuff_t* tvb) {
293         proto_tree_add_item(tree, hf_packetcable_call_termination_cause_source_document,
294                                                 tvb, 0, 2, FALSE);
295         proto_tree_add_item(tree, hf_packetcable_call_termination_cause_code,
296                                                 tvb, 2, 4, FALSE);
297
298         return "";
299 }
300
301 static const gchar* dissect_packetcable_rel_call_billing_correlation(proto_tree* tree, tvbuff_t* tvb) {
302         decode_packetcable_bcid(tvb, tree, 0);
303         return "";
304 }
305
306 static const gchar* dissect_packetcable_trunk_group_id(proto_tree* tree, tvbuff_t* tvb) {
307         proto_tree_add_item(tree, hf_packetcable_trunk_group_id_trunk_type,
308                                                 tvb, 0, 2, FALSE);
309         proto_tree_add_item(tree, hf_packetcable_trunk_group_id_trunk_number,
310                                                 tvb, 2, 4, FALSE);
311         return "";
312 }
313
314 static const gchar* dissect_packetcable_qos_descriptor(proto_tree* tree, tvbuff_t* tvb) {
315         guint8 packetcable_buf[64];
316         guint32 intval;
317         guint32 packetcable_qos_flags = tvb_get_ntohl(tvb, 0);
318         proto_item* ti = proto_tree_add_item(tree, hf_packetcable_qos_status, tvb, 0, 4, FALSE);
319         proto_tree* obj_tree = proto_item_add_subtree(ti, ett_radius_vendor_packetcable_qos_status);
320
321         guint packetcable_qos_off = 20;
322
323         proto_tree_add_item(obj_tree, hf_packetcable_qos_status_indication, tvb, 0, 4, FALSE);
324
325         for (intval = 0; intval < PACKETCABLE_QOS_DESC_BITFIELDS; intval++) {
326                 proto_tree_add_item(obj_tree, hf_packetcable_qos_desc_flags[intval], tvb, 0, 4, FALSE);
327         }
328
329         tvb_memcpy(tvb, packetcable_buf, 4, 16);
330         packetcable_buf[16] = '\0';
331
332         proto_tree_add_text(tree, tvb, 4, 16, "Service Class Name: %s", packetcable_buf);
333
334         for (intval = 0; intval < PACKETCABLE_QOS_DESC_BITFIELDS; intval++) {
335                 if (packetcable_qos_flags & packetcable_qos_desc_mask[intval]) {
336                         proto_tree_add_item(tree, hf_packetcable_qos_desc_fields[intval],
337                                                                 tvb, packetcable_qos_off, 4, FALSE);
338                         packetcable_qos_off += 4;
339                 }
340         }
341
342         return "";
343 }
344
345 static const gchar* dissect_packetcable_time_adjustment(proto_tree* tree, tvbuff_t* tvb) {
346         proto_tree_add_item(tree, hf_packetcable_time_adjustment, tvb, 0, 8, FALSE);
347
348         return "";
349 }
350
351 static const gchar* dissect_packetcable_redirected_from_info(proto_tree* tree, tvbuff_t* tvb) {
352         guint8 packetcable_buf[64];
353
354         tvb_memcpy(tvb, packetcable_buf, 0, 20); packetcable_buf[20] = '\0';
355         proto_tree_add_text(tree, tvb, 0, 20,
356                                                 "Last-Redirecting-Party: %s", packetcable_buf);
357
358         tvb_memcpy(tvb, packetcable_buf, 20, 20); packetcable_buf[20] = '\0';
359         proto_tree_add_text(tree, tvb, 20, 20,
360                                                 "Original-Called-Party: %s", packetcable_buf);
361
362         proto_tree_add_item(tree, hf_packetcable_redirected_from_info_number_of_redirections,
363                                                 tvb, 40, 2, FALSE);
364
365         return "";
366 }
367
368 static const gchar* dissect_packetcable_time_electr_surv_ind(proto_tree* tree, tvbuff_t* tvb) {
369
370         if (tvb_length(tvb) == 0)
371                 return "None";
372
373         proto_tree_add_item(tree, hf_packetcable_electronic_surveillance_indication_df_cdc_address,
374                                                 tvb, 0, 4, FALSE);
375         proto_tree_add_item(tree, hf_packetcable_electronic_surveillance_indication_df_ccc_address,
376                                                 tvb, 4, 4, FALSE);
377         proto_tree_add_item(tree, hf_packetcable_electronic_surveillance_indication_cdc_port,
378                                                 tvb, 8, 2, FALSE);
379         proto_tree_add_item(tree, hf_packetcable_electronic_surveillance_indication_ccc_port,
380                                                 tvb, 10, 2, FALSE);
381         proto_tree_add_text(tree, tvb, 12, tvb_length(tvb) - 12, "DF-DF-Key");
382
383         return "";
384 }
385
386 static const gchar* dissect_packetcable_surv_df_sec(proto_tree* tree _U_, tvbuff_t* tvb _U_) {
387                 return "";
388 }
389
390 #define PACKETCABLE_GENERAL_DISPLAY (1 << 0)
391 #define PACKETCABLE_CALLING_NUMBER  (1 << 1)
392 #define PACKETCABLE_CALLING_NAME    (1 << 2)
393 #define PACKETCABLE_MESSAGE_WAITING (1 << 3)
394
395 static const gchar* dissect_packetcable_term_dsply_info(proto_tree* tree, tvbuff_t* tvb) {
396         guint8 bitmask = tvb_get_guint8(tvb, 2);
397         guint intval = 1;
398         proto_item* ti = proto_tree_add_item(tree, hf_packetcable_terminal_display_info_terminal_display_status_bitmask,
399                                                          tvb, 0, 1, FALSE);
400         proto_tree* obj_tree = proto_item_add_subtree(ti, ett_packetcable_term_dsply);
401
402         proto_tree_add_item(obj_tree, hf_packetcable_terminal_display_info_sbm_general_display,
403                                                 tvb, 0, 1, bitmask);
404         proto_tree_add_item(obj_tree, hf_packetcable_terminal_display_info_sbm_calling_number,
405                                                 tvb, 0, 1, bitmask);
406         proto_tree_add_item(obj_tree, hf_packetcable_terminal_display_info_sbm_calling_name,
407                                                 tvb, 0, 1, bitmask);
408         proto_tree_add_item(obj_tree, hf_packetcable_terminal_display_info_sbm_message_waiting,
409                                                 tvb, 0, 1, bitmask);
410
411         if (bitmask & PACKETCABLE_GENERAL_DISPLAY) {
412                 proto_tree_add_item(obj_tree, hf_packetcable_terminal_display_info_general_display,
413                                                         tvb, intval, 80, FALSE);
414                 intval += 80;
415         }
416
417         if (bitmask & PACKETCABLE_CALLING_NUMBER) {
418                 proto_tree_add_item(obj_tree, hf_packetcable_terminal_display_info_calling_number,
419                                                         tvb, intval, 40, FALSE);
420                 intval += 40;
421         }
422
423         if (bitmask & PACKETCABLE_CALLING_NAME) {
424                 proto_tree_add_item(obj_tree, hf_packetcable_terminal_display_info_calling_name,
425                                                         tvb, intval, 40, FALSE);
426                 intval += 40;
427         }
428
429         if (bitmask & PACKETCABLE_MESSAGE_WAITING) {
430                 proto_tree_add_item(obj_tree, hf_packetcable_terminal_display_info_message_waiting,
431                                                         tvb, intval, 40, FALSE);
432                 intval += 40;
433         }
434
435         return "";
436 }
437
438
439 void proto_register_packetcable(void) {
440
441         static hf_register_info hf[] = {
442                 { &hf_packetcable_em_header_version_id,
443                 { "Event Message Version ID","radius.vendor.pkt.emh.vid",
444                         FT_UINT16, BASE_DEC, NULL, 0x0,
445                         "PacketCable Event Message header version ID", HFILL }
446                 },
447                 { &hf_packetcable_bcid_timestamp,
448                 { "Timestamp","radius.vendor.pkt.bcid.ts",
449                         FT_UINT32, BASE_DEC, NULL, 0x0,
450                         "PacketCable Event Message BCID Timestamp", HFILL }
451                 },
452                 { &hf_packetcable_bcid_event_counter,
453                 { "Event Counter","radius.vendor.pkt.bcid.ec",
454                         FT_UINT32, BASE_DEC, NULL, 0x0,
455                         "PacketCable Event Message BCID Event Counter", HFILL }
456                 },
457                 { &hf_packetcable_em_header_event_message_type,
458                 { "Event Message Type","radius.vendor.pkt.emh.emt",
459                         FT_UINT16, BASE_DEC, radius_vendor_packetcable_event_message_vals, 0x0,
460                         "PacketCable Event Message Type", HFILL }
461                 },
462                 { &hf_packetcable_em_header_element_type,
463                 { "Element Type","radius.vendor.pkt.emh.et",
464                         FT_UINT16, BASE_DEC, packetcable_em_header_element_type_vals, 0x0,
465                         "PacketCable Event Message Element Type", HFILL }
466                 },
467                 { &hf_packetcable_em_header_sequence_number,
468                 { "Sequence Number","radius.vendor.pkt.emh.sn",
469                         FT_UINT32, BASE_DEC, NULL, 0x0,
470                         "PacketCable Event Message Sequence Number", HFILL }
471                 },
472                 { &hf_packetcable_em_header_status,
473                 { "Status","radius.vendor.pkt.emh.st",
474                         FT_UINT32, BASE_HEX, NULL, 0x0,
475                         "PacketCable Event Message Status", HFILL }
476                 },
477                 { &hf_packetcable_em_header_status_error_indicator,
478                 { "Status","radius.vendor.pkt.emh.st.ei",
479                         FT_UINT32, BASE_HEX, packetcable_em_header_status_error_indicator_vals,
480                         PACKETCABLE_EMHS_EI_MASK,
481                         "PacketCable Event Message Status Error Indicator", HFILL }
482                 },
483                 { &hf_packetcable_em_header_status_event_origin,
484                 { "Event Origin","radius.vendor.pkt.emh.st.eo",
485                         FT_UINT32, BASE_HEX, packetcable_em_header_status_event_origin_vals,
486                         PACKETCABLE_EMHS_EO_MASK,
487                         "PacketCable Event Message Status Event Origin", HFILL }
488                 },
489                 { &hf_packetcable_em_header_status_event_message_proxied,
490                 { "Event Message Proxied","radius.vendor.pkt.emh.st.emp",
491                         FT_UINT32, BASE_HEX, packetcable_em_header_status_event_message_proxied_vals,
492                         PACKETCABLE_EMHS_EMP_MASK,
493                         "PacketCable Event Message Status Event Message Proxied", HFILL }
494                 },
495                 { &hf_packetcable_em_header_priority,
496                 { "Priority","radius.vendor.pkt.emh.priority",
497                         FT_UINT8, BASE_DEC, NULL, 0x0,
498                         "PacketCable Event Message Priority", HFILL }
499                 },
500                 { &hf_packetcable_em_header_attribute_count,
501                 { "Attribute Count","radius.vendor.pkt.emh.ac",
502                         FT_UINT16, BASE_DEC, NULL, 0x0,
503                         "PacketCable Event Message Attribute Count", HFILL }
504                 },
505                 { &hf_packetcable_em_header_event_object,
506                 { "Event Object","radius.vendor.pkt.emh.eo",
507                         FT_UINT8, BASE_DEC, NULL, 0x0,
508                         "PacketCable Event Message Event Object", HFILL }
509                 },
510                 { &hf_packetcable_call_termination_cause_source_document,
511                 { "Source Document","radius.vendor.pkt.ctc.sd",
512                         FT_UINT16, BASE_HEX, packetcable_call_termination_cause_vals, 0x0,
513                         "PacketCable Call Termination Cause Source Document", HFILL }
514                 },
515                 { &hf_packetcable_call_termination_cause_code,
516                 { "Event Object","radius.vendor.pkt.ctc.cc",
517                         FT_UINT32, BASE_DEC, NULL, 0x0,
518                         "PacketCable Call Termination Cause Code", HFILL }
519                 },
520                 { &hf_packetcable_trunk_group_id_trunk_type,
521                 { "Trunk Type","radius.vendor.pkt.tgid.tt",
522                         FT_UINT16, BASE_HEX, packetcable_trunk_type_vals, 0x0,
523                         "PacketCable Trunk Group ID Trunk Type", HFILL }
524                 },
525                 { &hf_packetcable_trunk_group_id_trunk_number,
526                 { "Event Object","radius.vendor.pkt.tgid.tn",
527                         FT_UINT32, BASE_DEC, NULL, 0x0,
528                         "PacketCable Trunk Group ID Trunk Number", HFILL }
529                 },
530                 { &hf_packetcable_qos_status,
531                 { "QoS Status","radius.vendor.pkt.qs",
532                         FT_UINT32, BASE_HEX, NULL, 0x0,
533                         "PacketCable QoS Descriptor Attribute QoS Status", HFILL }
534                 },
535                 { &hf_packetcable_qos_status_indication,
536                 { "Status Indication","radius.vendor.pkt.qs.si",
537                         FT_UINT32, BASE_DEC, packetcable_state_indication_vals, PACKETCABLE_QOS_STATE_INDICATION_MASK,
538                         "PacketCable QoS Descriptor Attribute QoS State Indication", HFILL }
539                 },
540                 { &hf_packetcable_qos_desc_flags[0],
541                 { "Service Flow Scheduling Type","radius.vendor.pkt.qs.flags.sfst",
542                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_SERVICE_FLOW_SCHEDULING_TYPE_MASK,
543                         "PacketCable QoS Descriptor Attribute Bitmask: Service Flow Scheduling Type", HFILL }
544                 },
545                 { &hf_packetcable_qos_desc_flags[1],
546                 { "Grant Interval","radius.vendor.pkt.qs.flags.gi",
547                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_NOMINAL_GRANT_INTERVAL_MASK,
548                         "PacketCable QoS Descriptor Attribute Bitmask: Grant Interval", HFILL }
549                 },
550                 { &hf_packetcable_qos_desc_flags[2],
551                 { "Tolerated Grant Jitter","radius.vendor.pkt.qs.flags.tgj",
552                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_TOLERATED_GRANT_JITTER_MASK,
553                         "PacketCable QoS Descriptor Attribute Bitmask: Tolerated Grant Jitter", HFILL }
554                 },
555                 { &hf_packetcable_qos_desc_flags[3],
556                 { "Grants Per Interval","radius.vendor.pkt.qs.flags.gpi",
557                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_GRANTS_PER_INTERVAL_MASK,
558                         "PacketCable QoS Descriptor Attribute Bitmask: Grants Per Interval", HFILL }
559                 },
560                 { &hf_packetcable_qos_desc_flags[4],
561                 { "Unsolicited Grant Size","radius.vendor.pkt.qs.flags.ugs",
562                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_UNSOLICITED_GRANT_SIZE_MASK,
563                         "PacketCable QoS Descriptor Attribute Bitmask: Unsolicited Grant Size", HFILL }
564                 },
565                 { &hf_packetcable_qos_desc_flags[5],
566                 { "Traffic Priority","radius.vendor.pkt.qs.flags.tp",
567                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_TRAFFIC_PRIORITY_MASK,
568                         "PacketCable QoS Descriptor Attribute Bitmask: Traffic Priority", HFILL }
569                 },
570                 { &hf_packetcable_qos_desc_flags[6],
571                 { "Maximum Sustained Rate","radius.vendor.pkt.qs.flags.msr",
572                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_MAXIMUM_SUSTAINED_RATE_MASK,
573                         "PacketCable QoS Descriptor Attribute Bitmask: Maximum Sustained Rate", HFILL }
574                 },
575                 { &hf_packetcable_qos_desc_flags[7],
576                 { "Maximum Traffic Burst","radius.vendor.pkt.qs.flags.mtb",
577                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_MAXIMUM_TRAFFIC_BURST_MASK,
578                         "PacketCable QoS Descriptor Attribute Bitmask: Maximum Traffic Burst", HFILL }
579                 },
580                 { &hf_packetcable_qos_desc_flags[8],
581                 { "Minimum Reserved Traffic Rate","radius.vendor.pkt.qs.flags.mrtr",
582                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_MINIMUM_RESERVED_TRAFFIC_RATE_MASK,
583                         "PacketCable QoS Descriptor Attribute Bitmask: Minimum Reserved Traffic Rate", HFILL }
584                 },
585                 { &hf_packetcable_qos_desc_flags[9],
586                 { "Minimum Packet Size","radius.vendor.pkt.qs.flags.mps",
587                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_MINIMUM_PACKET_SIZE_MASK,
588                         "PacketCable QoS Descriptor Attribute Bitmask: Minimum Packet Size", HFILL }
589                 },
590                 { &hf_packetcable_qos_desc_flags[10],
591                 { "Maximum Concatenated Burst","radius.vendor.pkt.qs.flags.mcb",
592                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_MAXIMUM_CONCATENATED_BURST_MASK,
593                         "PacketCable QoS Descriptor Attribute Bitmask: Maximum Concatenated Burst", HFILL }
594                 },
595                 { &hf_packetcable_qos_desc_flags[11],
596                 { "Status Request/Transmission Policy","radius.vendor.pkt.qs.flags.srtp",
597                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_REQUEST_TRANSMISSION_POLICY_MASK,
598                         "PacketCable QoS Descriptor Attribute Bitmask: Status Request/Transmission Policy", HFILL }
599                 },
600                 { &hf_packetcable_qos_desc_flags[12],
601                 { "Nominal Polling Interval","radius.vendor.pkt.qs.flags.npi",
602                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_NOMINAL_POLLING_INTERVAL_MASK,
603                         "PacketCable QoS Descriptor Attribute Bitmask: Nominal Polling Interval", HFILL }
604                 },
605                 { &hf_packetcable_qos_desc_flags[13],
606                 { "Tolerated Poll Jitter","radius.vendor.pkt.qs.flags.tpj",
607                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_TOLERATED_POLL_JITTER_MASK,
608                         "PacketCable QoS Descriptor Attribute Bitmask: Tolerated Poll Jitter", HFILL }
609                 },
610                 { &hf_packetcable_qos_desc_flags[14],
611                 { "Type of Service Override","radius.vendor.pkt.qs.flags.toso",
612                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_IP_TYPE_OF_SERVICE_OVERRIDE_MASK,
613                         "PacketCable QoS Descriptor Attribute Bitmask: Type of Service Override", HFILL }
614                 },
615                 { &hf_packetcable_qos_desc_flags[15],
616                 { "Maximum Downstream Latency","radius.vendor.pkt.qs.flags.mdl",
617                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_MAXIMUM_DOWNSTREAM_LATENCY_MASK,
618                         "PacketCable QoS Descriptor Attribute Bitmask: Maximum Downstream Latency", HFILL }
619                 },
620                 { &hf_packetcable_qos_desc_fields[0],
621                 { "Service Flow Scheduling Type","radius.vendor.pkt.qs.sfst",
622                         FT_UINT32, BASE_DEC, NULL, 0x0,
623                         "PacketCable QoS Descriptor Attribute Service Flow Scheduling Type", HFILL }
624                 },
625                 { &hf_packetcable_qos_desc_fields[1],
626                 { "Grant Interval","radius.vendor.pkt.qs.gi",
627                         FT_UINT32, BASE_DEC, NULL, 0x0,
628                         "PacketCable QoS Descriptor Attribute Grant Interval", HFILL }
629                 },
630                 { &hf_packetcable_qos_desc_fields[2],
631                 { "Tolerated Grant Jitter","radius.vendor.pkt.qs.tgj",
632                         FT_UINT32, BASE_DEC, NULL, 0x0,
633                         "PacketCable QoS Descriptor Attribute Tolerated Grant Jitter", HFILL }
634                 },
635                 { &hf_packetcable_qos_desc_fields[3],
636                 { "Grants Per Interval","radius.vendor.pkt.qs.gpi",
637                         FT_UINT32, BASE_DEC, NULL, 0x0,
638                         "PacketCable QoS Descriptor Attribute Grants Per Interval", HFILL }
639                 },
640                 { &hf_packetcable_qos_desc_fields[4],
641                 { "Unsolicited Grant Size","radius.vendor.pkt.qs.ugs",
642                         FT_UINT32, BASE_DEC, NULL, 0x0,
643                         "PacketCable QoS Descriptor Attribute Unsolicited Grant Size", HFILL }
644                 },
645                 { &hf_packetcable_qos_desc_fields[5],
646                 { "Traffic Priority","radius.vendor.pkt.qs.tp",
647                         FT_UINT32, BASE_DEC, NULL, 0x0,
648                         "PacketCable QoS Descriptor Attribute Traffic Priority", HFILL }
649                 },
650                 { &hf_packetcable_qos_desc_fields[6],
651                 { "Maximum Sustained Rate","radius.vendor.pkt.qs.msr",
652                         FT_UINT32, BASE_DEC, NULL, 0x0,
653                         "PacketCable QoS Descriptor Attribute Maximum Sustained Rate", HFILL }
654                 },
655                 { &hf_packetcable_qos_desc_fields[7],
656                 { "Maximum Traffic Burst","radius.vendor.pkt.qs.mtb",
657                         FT_UINT32, BASE_DEC, NULL, 0x0,
658                         "PacketCable QoS Descriptor Attribute Maximum Traffic Burst", HFILL }
659                 },
660                 { &hf_packetcable_qos_desc_fields[8],
661                 { "Minimum Reserved Traffic Rate","radius.vendor.pkt.qs.mrtr",
662                         FT_UINT32, BASE_DEC, NULL, 0x0,
663                         "PacketCable QoS Descriptor Attribute Minimum Reserved Traffic Rate", HFILL }
664                 },
665                 { &hf_packetcable_qos_desc_fields[9],
666                 { "Minimum Packet Size","radius.vendor.pkt.qs.mps",
667                         FT_UINT32, BASE_DEC, NULL, 0x0,
668                         "PacketCable QoS Descriptor Attribute Minimum Packet Size", HFILL }
669                 },
670                 { &hf_packetcable_qos_desc_fields[10],
671                 { "Maximum Concatenated Burst","radius.vendor.pkt.qs.mcb",
672                         FT_UINT32, BASE_DEC, NULL, 0x0,
673                         "PacketCable QoS Descriptor Attribute Maximum Concatenated Burst", HFILL }
674                 },
675                 { &hf_packetcable_qos_desc_fields[11],
676                 { "Status Request/Transmission Policy","radius.vendor.pkt.qs.srtp",
677                         FT_UINT32, BASE_DEC, NULL, 0x0,
678                         "PacketCable QoS Descriptor Attribute Status Request/Transmission Policy", HFILL }
679                 },
680                 { &hf_packetcable_qos_desc_fields[12],
681                 { "Nominal Polling Interval","radius.vendor.pkt.qs.npi",
682                         FT_UINT32, BASE_DEC, NULL, 0x0,
683                         "PacketCable QoS Descriptor Attribute Nominal Polling Interval", HFILL }
684                 },
685                 { &hf_packetcable_qos_desc_fields[13],
686                 { "Tolerated Poll Jitter","radius.vendor.pkt.qs.tpj",
687                         FT_UINT32, BASE_DEC, NULL, 0x0,
688                         "PacketCable QoS Descriptor Attribute Tolerated Poll Jitter", HFILL }
689                 },
690                 { &hf_packetcable_qos_desc_fields[14],
691                 { "Type of Service Override","radius.vendor.pkt.qs.toso",
692                         FT_UINT32, BASE_DEC, NULL, 0x0,
693                         "PacketCable QoS Descriptor Attribute Type of Service Override", HFILL }
694                 },
695                 { &hf_packetcable_qos_desc_fields[15],
696                 { "Maximum Downstream Latency","radius.vendor.pkt.qs.mdl",
697                         FT_UINT32, BASE_DEC, NULL, 0x0,
698                         "PacketCable QoS Descriptor Attribute Maximum Downstream Latency", HFILL }
699                 },
700                 { &hf_packetcable_time_adjustment,
701                 { "Time Adjustment","radius.vendor.pkt.ti",
702                         FT_UINT64, BASE_DEC, NULL, 0x0,
703                         "PacketCable Time Adjustment", HFILL }
704                 },
705                 { &hf_packetcable_redirected_from_info_number_of_redirections,
706                 { "Number-of-Redirections","radius.vendor.pkt.rfi.nr",
707                         FT_UINT16, BASE_DEC, NULL, 0x0,
708                         "PacketCable Redirected-From-Info Number-of-Redirections", HFILL }
709                 },
710                 { &hf_packetcable_electronic_surveillance_indication_df_cdc_address,
711                 { "DF_CDC_Address","radius.vendor.pkt.esi.dfcdca",
712                         FT_IPv4, BASE_DEC, NULL, 0x0,
713                         "PacketCable Electronic-Surveillance-Indication DF_CDC_Address", HFILL }
714                 },
715                 { &hf_packetcable_electronic_surveillance_indication_df_ccc_address,
716                 { "DF_CDC_Address","radius.vendor.pkt.esi.dfccca",
717                         FT_IPv4, BASE_DEC, NULL, 0x0,
718                         "PacketCable Electronic-Surveillance-Indication DF_CCC_Address", HFILL }
719                 },
720                 { &hf_packetcable_electronic_surveillance_indication_cdc_port,
721                 { "CDC-Port","radius.vendor.pkt.esi.cdcp",
722                         FT_UINT16, BASE_DEC, NULL, 0x0,
723                         "PacketCable Electronic-Surveillance-Indication CDC-Port", HFILL }
724                 },
725                 { &hf_packetcable_electronic_surveillance_indication_ccc_port,
726                 { "CCC-Port","radius.vendor.pkt.esi.cccp",
727                         FT_UINT16, BASE_DEC, NULL, 0x0,
728                         "PacketCable Electronic-Surveillance-Indication CCC-Port", HFILL }
729                 },
730
731                 { &hf_packetcable_terminal_display_info_terminal_display_status_bitmask,
732                 { "Terminal_Display_Status_Bitmask","radius.vendor.pkt.tdi.sbm",
733                         FT_UINT8, BASE_HEX, NULL, 0xff,
734                         "PacketCable Terminal_Display_Info Terminal_Display_Status_Bitmask", HFILL }
735                 },
736                 { &hf_packetcable_terminal_display_info_sbm_general_display,
737                 { "General_Display","radius.vendor.pkt.tdi.sbm.gd",
738                         FT_BOOLEAN, 8, NULL, 0x01,
739                         "PacketCable Terminal_Display_Info Terminal_Display_Status_Bitmask General_Display", HFILL }
740                 },
741                 { &hf_packetcable_terminal_display_info_sbm_calling_number,
742                 { "Calling_Number","radius.vendor.pkt.tdi.sbm.cnum",
743                         FT_BOOLEAN, 8, NULL, 0x02,
744                         "PacketCable Terminal_Display_Info Terminal_Display_Status_Bitmask Calling_Number", HFILL }
745                 },
746                 { &hf_packetcable_terminal_display_info_sbm_calling_name,
747                 { "Calling_Name","radius.vendor.pkt.tdi.sbm.cname",
748                         FT_BOOLEAN, 8, NULL, 0x04,
749                         "PacketCable Terminal_Display_Info Terminal_Display_Status_Bitmask Calling_Name", HFILL }
750                 },
751                 { &hf_packetcable_terminal_display_info_sbm_message_waiting,
752                 { "Message_Waiting","radius.vendor.pkt.tdi.sbm.mw",
753                         FT_BOOLEAN, 8, NULL, 0x08,
754                         "PacketCable Terminal_Display_Info Terminal_Display_Status_Bitmask Message_Waiting", HFILL }
755                 },
756                 { &hf_packetcable_terminal_display_info_general_display,
757                 { "General_Display","radius.vendor.pkt.tdi.gd",
758                         FT_STRING, BASE_NONE, NULL, 0,
759                         "PacketCable Terminal_Display_Info General_Display", HFILL }
760                 },
761                 { &hf_packetcable_terminal_display_info_calling_number,
762                 { "Calling_Number","radius.vendor.pkt.tdi.cnum",
763                         FT_STRING, BASE_NONE, NULL, 0,
764                         "PacketCable Terminal_Display_Info Calling_Number", HFILL }
765                 },
766                 { &hf_packetcable_terminal_display_info_calling_name,
767                 { "Calling_Name","radius.vendor.pkt.tdi.cname",
768                         FT_STRING, BASE_NONE, NULL, 0,
769                         "PacketCable Terminal_Display_Info Calling_Name", HFILL }
770                 },
771                 { &hf_packetcable_terminal_display_info_message_waiting,
772                 { "Message_Waiting","radius.vendor.pkt.tdi.mw",
773                         FT_STRING, BASE_NONE, NULL, 0,
774                         "PacketCable Terminal_Display_Info Message_Waiting", HFILL }
775                 }
776         };
777
778         static gint *ett[] = {
779                 &ett_radius_vendor_packetcable_bcid,
780                 &ett_radius_vendor_packetcable_status,
781                 &ett_radius_vendor_packetcable_qos_status,
782                 &ett_packetcable_term_dsply
783         };
784
785         proto_packetcable = proto_register_protocol("PacketCable AVPs", "PACKETCABLE", "paketcable_avps");
786
787         proto_register_field_array(proto_packetcable, hf, array_length(hf));
788         proto_register_subtree_array(ett, array_length(ett));
789 }
790
791 void
792 proto_reg_handoff_packetcable(void)
793 {
794
795         radius_register_avp_dissector(VENDOR_CABLELABS, 1, dissect_packetcable_em_hdr);
796         radius_register_avp_dissector(VENDOR_CABLELABS, 11, dissect_packetcable_call_term_cause);
797         radius_register_avp_dissector(VENDOR_CABLELABS, 13, dissect_packetcable_rel_call_billing_correlation);
798         radius_register_avp_dissector(VENDOR_CABLELABS, 24, dissect_packetcable_trunk_group_id);
799         radius_register_avp_dissector(VENDOR_CABLELABS, 32, dissect_packetcable_qos_descriptor);
800         radius_register_avp_dissector(VENDOR_CABLELABS, 38, dissect_packetcable_time_adjustment);
801         radius_register_avp_dissector(VENDOR_CABLELABS, 43, dissect_packetcable_redirected_from_info);
802         radius_register_avp_dissector(VENDOR_CABLELABS, 44, dissect_packetcable_time_electr_surv_ind);
803         radius_register_avp_dissector(VENDOR_CABLELABS, 47, dissect_packetcable_surv_df_sec);
804         radius_register_avp_dissector(VENDOR_CABLELABS, 54, dissect_packetcable_term_dsply_info);
805 /*      radius_register_avp_dissector(VENDOR_CABLELABS, 90, dissect_packetcable_party_info);
806         radius_register_avp_dissector(VENDOR_CABLELABS, 91, dissect_packetcable_party_info);
807         radius_register_avp_dissector(VENDOR_CABLELABS, 92, dissect_packetcable_party_info); */
808 }
809