some compilers dont like unnamed unions and structs
[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 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 value_string packetcable_em_header_element_type_vals[] =
179 {
180         {0,  "Reserved"},
181         {1,  "CMS"},
182         {2,  "CMTS"},
183         {3,  "Media Gateway Controller"},
184         {0, NULL}
185 };
186
187 static value_string packetcable_em_header_status_error_indicator_vals[] =
188 {
189         {0,  "No Error"},
190         {1,  "Possible Error"},
191         {2,  "Known Error"},
192         {3,  "Reserved"},
193         {0, NULL},
194 };
195
196 static value_string packetcable_em_header_status_event_origin_vals[] =
197 {
198         {0,  "Trusted Element"},
199         {1,  "Untrusted Element"},
200         {0, NULL},
201 };
202
203 static value_string packetcable_em_header_status_event_message_proxied_vals[] =
204 {
205         {0,  "Not proxied"},
206         {1,  "Proxied"},
207         {0, NULL},
208 };
209
210 static value_string packetcable_call_termination_cause_vals[] =
211 {
212         {0,  "Reserved"},
213         {1,  "BAF"},
214         {2,  "Reserved"},
215         {0, NULL},
216 };
217
218 static value_string packetcable_trunk_type_vals[] =
219 {
220         {1,  "Not Used"},
221         {2,  "Not Used"},
222         {3,  "SS7 direct trunk group member"},
223         {4,  "SS7 from IC to AT and SS7 from AT to EO"},
224         {5,  "Not Used"},
225         {6,  "SS7 from IC to AT and non-SS7 from AT to EO (terminating only)"},
226         {9,  "Signaling type not specified"},
227         {0, NULL},
228 };
229
230 static value_string packetcable_state_indication_vals[] =
231 {
232         {0,  "Illegal Value"},
233         {1,  "Resource Reserved but not Activated"},
234         {2,  "Resource Activated"},
235         {3,  "Resource Reserved & Activated"},
236         { 0, NULL }
237 };
238
239
240 /* Decode a PacketCable BCID. */
241 /* XXX - This should probably be combinde with the equivalent COPS code */
242 static void decode_packetcable_bcid (tvbuff_t *tvb, proto_tree *tree, int offset)
243 {
244         guint8 packetcable_buf[64];
245
246         proto_tree_add_item(tree, hf_packetcable_bcid_timestamp,
247                                                 tvb, offset, 4, FALSE);
248         tvb_memcpy(tvb, packetcable_buf, offset + 4, 8); packetcable_buf[8] = '\0';
249         proto_tree_add_text(tree, tvb, offset + 4, 8,
250                                                 "Element ID: %s", packetcable_buf);
251         tvb_memcpy(tvb, packetcable_buf, offset + 13, 7); packetcable_buf[7] = '\0';
252         proto_tree_add_text(tree, tvb, offset + 12, 8,
253                                                 "Time Zone: DST: %c, Offset: %s", tvb_get_guint8(tvb, offset + 12),
254                                                 packetcable_buf);
255         proto_tree_add_item(tree, hf_packetcable_bcid_event_counter,
256                                                 tvb, offset + 20, 4, FALSE);
257 }
258
259 static const gchar* dissect_packetcable_em_hdr(proto_tree* tree, tvbuff_t* tvb) {
260         guint8 packetcable_buf[64];
261         proto_item *ti;
262         proto_tree *obj_tree;
263
264         proto_tree_add_item(tree, hf_packetcable_em_header_version_id, tvb,  0, 2, FALSE);
265         ti = proto_tree_add_text(tree, tvb,  2, 24, "BCID");
266         obj_tree = proto_item_add_subtree(ti, ett_radius_vendor_packetcable_bcid);
267         decode_packetcable_bcid(tvb, obj_tree,  2);
268
269         proto_tree_add_item(tree, hf_packetcable_em_header_event_message_type, tvb,  26, 2, FALSE);
270         proto_tree_add_item(tree, hf_packetcable_em_header_element_type, tvb,  28, 2, FALSE);
271         tvb_memcpy(tvb, packetcable_buf,  30, 8); packetcable_buf[8] = '\0';
272         proto_tree_add_text(tree, tvb,  30, 8, "Element ID: %s", packetcable_buf );
273         tvb_memcpy(tvb, packetcable_buf,  39, 7); packetcable_buf[7] = '\0';
274         proto_tree_add_text(tree, tvb,  38, 8, "Time Zone: DST: %c, Offset: %s", tvb_get_guint8(tvb,  40), packetcable_buf);
275         proto_tree_add_item(tree, hf_packetcable_em_header_sequence_number, tvb,  46, 4, FALSE);
276         tvb_memcpy(tvb, packetcable_buf,  50, 18); packetcable_buf[18] = '\0';
277         proto_tree_add_text(tree, tvb,  50, 18, "Event Time: %s", packetcable_buf);
278
279         ti = proto_tree_add_item(tree, hf_packetcable_em_header_status, tvb,  68, 4, FALSE);
280         obj_tree = proto_item_add_subtree(ti, ett_radius_vendor_packetcable_status);
281         proto_tree_add_item(obj_tree, hf_packetcable_em_header_status_error_indicator, tvb,  68, 4, FALSE);
282         proto_tree_add_item(obj_tree, hf_packetcable_em_header_status_event_origin, tvb,  68, 4, FALSE);
283         proto_tree_add_item(obj_tree, hf_packetcable_em_header_status_event_message_proxied, tvb,  68, 4, FALSE);
284
285         proto_tree_add_item(tree, hf_packetcable_em_header_priority, tvb,  72, 1, FALSE);
286         proto_tree_add_item(tree, hf_packetcable_em_header_attribute_count, tvb,  73, 2, FALSE);
287         proto_tree_add_item(tree, hf_packetcable_em_header_event_object, tvb,  75, 1, FALSE);
288         return "";
289 }
290
291 static const gchar* dissect_packetcable_call_term_cause(proto_tree* tree, tvbuff_t* tvb) {
292         proto_tree_add_item(tree, hf_packetcable_call_termination_cause_source_document,
293                                                 tvb, 0, 2, FALSE);
294         proto_tree_add_item(tree, hf_packetcable_call_termination_cause_code,
295                                                 tvb, 2, 4, FALSE);
296
297         return "";
298 }
299
300 static const gchar* dissect_packetcable_rel_call_billing_correlation(proto_tree* tree, tvbuff_t* tvb) {
301         decode_packetcable_bcid(tvb, tree, 0);
302         return "";
303 }
304
305 static const gchar* dissect_packetcable_trunk_group_id(proto_tree* tree, tvbuff_t* tvb) {
306         proto_tree_add_item(tree, hf_packetcable_trunk_group_id_trunk_type,
307                                                 tvb, 0, 2, FALSE);
308         proto_tree_add_item(tree, hf_packetcable_trunk_group_id_trunk_number,
309                                                 tvb, 2, 4, FALSE);
310         return "";
311 }
312
313 static const gchar* dissect_packetcable_qos_descriptor(proto_tree* tree, tvbuff_t* tvb) {
314         guint8 packetcable_buf[64];
315         guint32 intval;
316         guint32 packetcable_qos_flags = tvb_get_ntohl(tvb, 0);
317         proto_item* ti = proto_tree_add_item(tree, hf_packetcable_qos_status, tvb, 0, 4, FALSE);
318         proto_tree* obj_tree = proto_item_add_subtree(ti, ett_radius_vendor_packetcable_qos_status);
319
320         guint packetcable_qos_off = 20;
321
322         proto_tree_add_item(obj_tree, hf_packetcable_qos_status_indication, tvb, 0, 4, FALSE);
323
324         for (intval = 0; intval < PACKETCABLE_QOS_DESC_BITFIELDS; intval++) {
325                 proto_tree_add_item(obj_tree, hf_packetcable_qos_desc_flags[intval], tvb, 0, 4, FALSE);
326         }
327
328         tvb_memcpy(tvb, packetcable_buf, 4, 16);
329         packetcable_buf[16] = '\0';
330
331         proto_tree_add_text(tree, tvb, 4, 16, "Service Class Name: %s", packetcable_buf);
332
333         for (intval = 0; intval < PACKETCABLE_QOS_DESC_BITFIELDS; intval++) {
334                 if (packetcable_qos_flags & packetcable_qos_desc_mask[intval]) {
335                         proto_tree_add_item(tree, hf_packetcable_qos_desc_fields[intval],
336                                                                 tvb, packetcable_qos_off, 4, FALSE);
337                         packetcable_qos_off += 4;
338                 }
339         }
340
341         return "";
342 }
343
344 static const gchar* dissect_packetcable_time_adjustment(proto_tree* tree, tvbuff_t* tvb) {
345         proto_tree_add_item(tree, hf_packetcable_time_adjustment, tvb, 0, 8, FALSE);
346
347         return "";
348 }
349
350 static const gchar* dissect_packetcable_redirected_from_info(proto_tree* tree, tvbuff_t* tvb) {
351         guint8 packetcable_buf[64];
352
353         tvb_memcpy(tvb, packetcable_buf, 0, 20); packetcable_buf[20] = '\0';
354         proto_tree_add_text(tree, tvb, 0, 20,
355                                                 "Last-Redirecting-Party: %s", packetcable_buf);
356
357         tvb_memcpy(tvb, packetcable_buf, 20, 20); packetcable_buf[20] = '\0';
358         proto_tree_add_text(tree, tvb, 20, 20,
359                                                 "Original-Called-Party: %s", packetcable_buf);
360
361         proto_tree_add_item(tree, hf_packetcable_redirected_from_info_number_of_redirections,
362                                                 tvb, 40, 2, FALSE);
363
364         return "";
365 }
366
367 static const gchar* dissect_packetcable_time_electr_surv_ind(proto_tree* tree, tvbuff_t* tvb) {
368
369         if (tvb_length(tvb) == 0)
370                 return "None";
371
372         proto_tree_add_item(tree, hf_packetcable_electronic_surveillance_indication_df_cdc_address,
373                                                 tvb, 0, 4, FALSE);
374         proto_tree_add_item(tree, hf_packetcable_electronic_surveillance_indication_df_ccc_address,
375                                                 tvb, 4, 4, FALSE);
376         proto_tree_add_item(tree, hf_packetcable_electronic_surveillance_indication_cdc_port,
377                                                 tvb, 8, 2, FALSE);
378         proto_tree_add_item(tree, hf_packetcable_electronic_surveillance_indication_ccc_port,
379                                                 tvb, 10, 2, FALSE);
380         proto_tree_add_text(tree, tvb, 12, tvb_length(tvb) - 12, "DF-DF-Key");
381
382         return "";
383 }
384
385 static const gchar* dissect_packetcable_surv_df_sec(proto_tree* tree _U_, tvbuff_t* tvb _U_) {
386                 return "";
387 }
388
389 #define PACKETCABLE_GENERAL_DISPLAY (1 << 0)
390 #define PACKETCABLE_CALLING_NUMBER  (1 << 1)
391 #define PACKETCABLE_CALLING_NAME    (1 << 2)
392 #define PACKETCABLE_MESSAGE_WAITING (1 << 3)
393
394 static const gchar* dissect_packetcable_term_dsply_info(proto_tree* tree, tvbuff_t* tvb) {
395         guint8 bitmask = tvb_get_guint8(tvb, 2);
396         guint intval = 1;
397         proto_item* ti = proto_tree_add_item(tree, hf_packetcable_terminal_display_info_terminal_display_status_bitmask,
398                                                          tvb, 0, 1, FALSE);
399         proto_tree* obj_tree = proto_item_add_subtree(ti, ett_packetcable_term_dsply);
400
401         proto_tree_add_item(obj_tree, hf_packetcable_terminal_display_info_sbm_general_display,
402                                                 tvb, 0, 1, bitmask);
403         proto_tree_add_item(obj_tree, hf_packetcable_terminal_display_info_sbm_calling_number,
404                                                 tvb, 0, 1, bitmask);
405         proto_tree_add_item(obj_tree, hf_packetcable_terminal_display_info_sbm_calling_name,
406                                                 tvb, 0, 1, bitmask);
407         proto_tree_add_item(obj_tree, hf_packetcable_terminal_display_info_sbm_message_waiting,
408                                                 tvb, 0, 1, bitmask);
409
410         if (bitmask & PACKETCABLE_GENERAL_DISPLAY) {
411                 proto_tree_add_item(obj_tree, hf_packetcable_terminal_display_info_general_display,
412                                                         tvb, intval, 80, FALSE);
413                 intval += 80;
414         }
415
416         if (bitmask & PACKETCABLE_CALLING_NUMBER) {
417                 proto_tree_add_item(obj_tree, hf_packetcable_terminal_display_info_calling_number,
418                                                         tvb, intval, 40, FALSE);
419                 intval += 40;
420         }
421
422         if (bitmask & PACKETCABLE_CALLING_NAME) {
423                 proto_tree_add_item(obj_tree, hf_packetcable_terminal_display_info_calling_name,
424                                                         tvb, intval, 40, FALSE);
425                 intval += 40;
426         }
427
428         if (bitmask & PACKETCABLE_MESSAGE_WAITING) {
429                 proto_tree_add_item(obj_tree, hf_packetcable_terminal_display_info_message_waiting,
430                                                         tvb, intval, 40, FALSE);
431                 intval += 40;
432         }
433
434         return "";
435 }
436
437
438 void proto_register_packetcable(void) {
439
440         static hf_register_info hf[] = {
441                 { &hf_packetcable_em_header_version_id,
442                 { "Event Message Version ID","radius.vendor.pkt.emh.vid",
443                         FT_UINT16, BASE_DEC, NULL, 0x0,
444                         "PacketCable Event Message header version ID", HFILL }
445                 },
446                 { &hf_packetcable_bcid_timestamp,
447                 { "Timestamp","radius.vendor.pkt.bcid.ts",
448                         FT_UINT32, BASE_DEC, NULL, 0x0,
449                         "PacketCable Event Message BCID Timestamp", HFILL }
450                 },
451                 { &hf_packetcable_bcid_event_counter,
452                 { "Event Counter","radius.vendor.pkt.bcid.ec",
453                         FT_UINT32, BASE_DEC, NULL, 0x0,
454                         "PacketCable Event Message BCID Event Counter", HFILL }
455                 },
456                 { &hf_packetcable_em_header_event_message_type,
457                 { "Event Message Type","radius.vendor.pkt.emh.emt",
458                         FT_UINT16, BASE_DEC, radius_vendor_packetcable_event_message_vals, 0x0,
459                         "PacketCable Event Message Type", HFILL }
460                 },
461                 { &hf_packetcable_em_header_element_type,
462                 { "Element Type","radius.vendor.pkt.emh.et",
463                         FT_UINT16, BASE_DEC, packetcable_em_header_element_type_vals, 0x0,
464                         "PacketCable Event Message Element Type", HFILL }
465                 },
466                 { &hf_packetcable_em_header_sequence_number,
467                 { "Sequence Number","radius.vendor.pkt.emh.sn",
468                         FT_UINT32, BASE_DEC, NULL, 0x0,
469                         "PacketCable Event Message Sequence Number", HFILL }
470                 },
471                 { &hf_packetcable_em_header_status,
472                 { "Status","radius.vendor.pkt.emh.st",
473                         FT_UINT32, BASE_HEX, NULL, 0x0,
474                         "PacketCable Event Message Status", HFILL }
475                 },
476                 { &hf_packetcable_em_header_status_error_indicator,
477                 { "Status","radius.vendor.pkt.emh.st.ei",
478                         FT_UINT32, BASE_HEX, packetcable_em_header_status_error_indicator_vals,
479                         PACKETCABLE_EMHS_EI_MASK,
480                         "PacketCable Event Message Status Error Indicator", HFILL }
481                 },
482                 { &hf_packetcable_em_header_status_event_origin,
483                 { "Event Origin","radius.vendor.pkt.emh.st.eo",
484                         FT_UINT32, BASE_HEX, packetcable_em_header_status_event_origin_vals,
485                         PACKETCABLE_EMHS_EO_MASK,
486                         "PacketCable Event Message Status Event Origin", HFILL }
487                 },
488                 { &hf_packetcable_em_header_status_event_message_proxied,
489                 { "Event Message Proxied","radius.vendor.pkt.emh.st.emp",
490                         FT_UINT32, BASE_HEX, packetcable_em_header_status_event_message_proxied_vals,
491                         PACKETCABLE_EMHS_EMP_MASK,
492                         "PacketCable Event Message Status Event Message Proxied", HFILL }
493                 },
494                 { &hf_packetcable_em_header_priority,
495                 { "Priority","radius.vendor.pkt.emh.priority",
496                         FT_UINT8, BASE_DEC, NULL, 0x0,
497                         "PacketCable Event Message Priority", HFILL }
498                 },
499                 { &hf_packetcable_em_header_attribute_count,
500                 { "Attribute Count","radius.vendor.pkt.emh.ac",
501                         FT_UINT16, BASE_DEC, NULL, 0x0,
502                         "PacketCable Event Message Attribute Count", HFILL }
503                 },
504                 { &hf_packetcable_em_header_event_object,
505                 { "Event Object","radius.vendor.pkt.emh.eo",
506                         FT_UINT8, BASE_DEC, NULL, 0x0,
507                         "PacketCable Event Message Event Object", HFILL }
508                 },
509                 { &hf_packetcable_call_termination_cause_source_document,
510                 { "Source Document","radius.vendor.pkt.ctc.sd",
511                         FT_UINT16, BASE_HEX, packetcable_call_termination_cause_vals, 0x0,
512                         "PacketCable Call Termination Cause Source Document", HFILL }
513                 },
514                 { &hf_packetcable_call_termination_cause_code,
515                 { "Event Object","radius.vendor.pkt.ctc.cc",
516                         FT_UINT32, BASE_DEC, NULL, 0x0,
517                         "PacketCable Call Termination Cause Code", HFILL }
518                 },
519                 { &hf_packetcable_trunk_group_id_trunk_type,
520                 { "Trunk Type","radius.vendor.pkt.tgid.tt",
521                         FT_UINT16, BASE_HEX, packetcable_trunk_type_vals, 0x0,
522                         "PacketCable Trunk Group ID Trunk Type", HFILL }
523                 },
524                 { &hf_packetcable_trunk_group_id_trunk_number,
525                 { "Event Object","radius.vendor.pkt.tgid.tn",
526                         FT_UINT32, BASE_DEC, NULL, 0x0,
527                         "PacketCable Trunk Group ID Trunk Number", HFILL }
528                 },
529                 { &hf_packetcable_qos_status,
530                 { "QoS Status","radius.vendor.pkt.qs",
531                         FT_UINT32, BASE_HEX, NULL, 0x0,
532                         "PacketCable QoS Descriptor Attribute QoS Status", HFILL }
533                 },
534                 { &hf_packetcable_qos_status_indication,
535                 { "Status Indication","radius.vendor.pkt.qs.si",
536                         FT_UINT32, BASE_DEC, packetcable_state_indication_vals, PACKETCABLE_QOS_STATE_INDICATION_MASK,
537                         "PacketCable QoS Descriptor Attribute QoS State Indication", HFILL }
538                 },
539                 { &hf_packetcable_qos_desc_flags[0],
540                 { "Service Flow Scheduling Type","radius.vendor.pkt.qs.flags.sfst",
541                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_SERVICE_FLOW_SCHEDULING_TYPE_MASK,
542                         "PacketCable QoS Descriptor Attribute Bitmask: Service Flow Scheduling Type", HFILL }
543                 },
544                 { &hf_packetcable_qos_desc_flags[1],
545                 { "Grant Interval","radius.vendor.pkt.qs.flags.gi",
546                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_NOMINAL_GRANT_INTERVAL_MASK,
547                         "PacketCable QoS Descriptor Attribute Bitmask: Grant Interval", HFILL }
548                 },
549                 { &hf_packetcable_qos_desc_flags[2],
550                 { "Tolerated Grant Jitter","radius.vendor.pkt.qs.flags.tgj",
551                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_TOLERATED_GRANT_JITTER_MASK,
552                         "PacketCable QoS Descriptor Attribute Bitmask: Tolerated Grant Jitter", HFILL }
553                 },
554                 { &hf_packetcable_qos_desc_flags[3],
555                 { "Grants Per Interval","radius.vendor.pkt.qs.flags.gpi",
556                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_GRANTS_PER_INTERVAL_MASK,
557                         "PacketCable QoS Descriptor Attribute Bitmask: Grants Per Interval", HFILL }
558                 },
559                 { &hf_packetcable_qos_desc_flags[4],
560                 { "Unsolicited Grant Size","radius.vendor.pkt.qs.flags.ugs",
561                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_UNSOLICITED_GRANT_SIZE_MASK,
562                         "PacketCable QoS Descriptor Attribute Bitmask: Unsolicited Grant Size", HFILL }
563                 },
564                 { &hf_packetcable_qos_desc_flags[5],
565                 { "Traffic Priority","radius.vendor.pkt.qs.flags.tp",
566                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_TRAFFIC_PRIORITY_MASK,
567                         "PacketCable QoS Descriptor Attribute Bitmask: Traffic Priority", HFILL }
568                 },
569                 { &hf_packetcable_qos_desc_flags[6],
570                 { "Maximum Sustained Rate","radius.vendor.pkt.qs.flags.msr",
571                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_MAXIMUM_SUSTAINED_RATE_MASK,
572                         "PacketCable QoS Descriptor Attribute Bitmask: Maximum Sustained Rate", HFILL }
573                 },
574                 { &hf_packetcable_qos_desc_flags[7],
575                 { "Maximum Traffic Burst","radius.vendor.pkt.qs.flags.mtb",
576                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_MAXIMUM_TRAFFIC_BURST_MASK,
577                         "PacketCable QoS Descriptor Attribute Bitmask: Maximum Traffic Burst", HFILL }
578                 },
579                 { &hf_packetcable_qos_desc_flags[8],
580                 { "Minimum Reserved Traffic Rate","radius.vendor.pkt.qs.flags.mrtr",
581                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_MINIMUM_RESERVED_TRAFFIC_RATE_MASK,
582                         "PacketCable QoS Descriptor Attribute Bitmask: Minimum Reserved Traffic Rate", HFILL }
583                 },
584                 { &hf_packetcable_qos_desc_flags[9],
585                 { "Minium Packet Size","radius.vendor.pkt.qs.flags.mps",
586                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_MINIMUM_PACKET_SIZE_MASK,
587                         "PacketCable QoS Descriptor Attribute Bitmask: Minimum Packet Size", HFILL }
588                 },
589                 { &hf_packetcable_qos_desc_flags[10],
590                 { "Maximum Concatenated Burst","radius.vendor.pkt.qs.flags.mcb",
591                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_MAXIMUM_CONCATENATED_BURST_MASK,
592                         "PacketCable QoS Descriptor Attribute Bitmask: Maximum Concatenated Burst", HFILL }
593                 },
594                 { &hf_packetcable_qos_desc_flags[11],
595                 { "Status Request/Transmission Policy","radius.vendor.pkt.qs.flags.srtp",
596                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_REQUEST_TRANSMISSION_POLICY_MASK,
597                         "PacketCable QoS Descriptor Attribute Bitmask: Status Request/Transmission Policy", HFILL }
598                 },
599                 { &hf_packetcable_qos_desc_flags[12],
600                 { "Nominal Polling Interval","radius.vendor.pkt.qs.flags.npi",
601                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_NOMINAL_POLLING_INTERVAL_MASK,
602                         "PacketCable QoS Descriptor Attribute Bitmask: Nominal Polling Interval", HFILL }
603                 },
604                 { &hf_packetcable_qos_desc_flags[13],
605                 { "Tolerated Poll Jitter","radius.vendor.pkt.qs.flags.tpj",
606                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_TOLERATED_POLL_JITTER_MASK,
607                         "PacketCable QoS Descriptor Attribute Bitmask: Tolerated Poll Jitter", HFILL }
608                 },
609                 { &hf_packetcable_qos_desc_flags[14],
610                 { "Type of Service Override","radius.vendor.pkt.qs.flags.toso",
611                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_IP_TYPE_OF_SERVICE_OVERRIDE_MASK,
612                         "PacketCable QoS Descriptor Attribute Bitmask: Type of Service Override", HFILL }
613                 },
614                 { &hf_packetcable_qos_desc_flags[15],
615                 { "Maximum Downstream Latency","radius.vendor.pkt.qs.flags.mdl",
616                         FT_UINT32, BASE_DEC, NULL, PACKETCABLE_MAXIMUM_DOWNSTREAM_LATENCY_MASK,
617                         "PacketCable QoS Descriptor Attribute Bitmask: Maximum Downstream Latency", HFILL }
618                 },
619                 { &hf_packetcable_qos_desc_fields[0],
620                 { "Service Flow Scheduling Type","radius.vendor.pkt.qs.sfst",
621                         FT_UINT32, BASE_DEC, NULL, 0x0,
622                         "PacketCable QoS Descriptor Attribute Service Flow Scheduling Type", HFILL }
623                 },
624                 { &hf_packetcable_qos_desc_fields[1],
625                 { "Grant Interval","radius.vendor.pkt.qs.gi",
626                         FT_UINT32, BASE_DEC, NULL, 0x0,
627                         "PacketCable QoS Descriptor Attribute Grant Interval", HFILL }
628                 },
629                 { &hf_packetcable_qos_desc_fields[2],
630                 { "Tolerated Grant Jitter","radius.vendor.pkt.qs.tgj",
631                         FT_UINT32, BASE_DEC, NULL, 0x0,
632                         "PacketCable QoS Descriptor Attribute Tolerated Grant Jitter", HFILL }
633                 },
634                 { &hf_packetcable_qos_desc_fields[3],
635                 { "Grants Per Interval","radius.vendor.pkt.qs.gpi",
636                         FT_UINT32, BASE_DEC, NULL, 0x0,
637                         "PacketCable QoS Descriptor Attribute Grants Per Interval", HFILL }
638                 },
639                 { &hf_packetcable_qos_desc_fields[4],
640                 { "Unsolicited Grant Size","radius.vendor.pkt.qs.ugs",
641                         FT_UINT32, BASE_DEC, NULL, 0x0,
642                         "PacketCable QoS Descriptor Attribute Unsolicited Grant Size", HFILL }
643                 },
644                 { &hf_packetcable_qos_desc_fields[5],
645                 { "Traffic Priority","radius.vendor.pkt.qs.tp",
646                         FT_UINT32, BASE_DEC, NULL, 0x0,
647                         "PacketCable QoS Descriptor Attribute Traffic Priority", HFILL }
648                 },
649                 { &hf_packetcable_qos_desc_fields[6],
650                 { "Maximum Sustained Rate","radius.vendor.pkt.qs.msr",
651                         FT_UINT32, BASE_DEC, NULL, 0x0,
652                         "PacketCable QoS Descriptor Attribute Maximum Sustained Rate", HFILL }
653                 },
654                 { &hf_packetcable_qos_desc_fields[7],
655                 { "Maximum Traffic Burst","radius.vendor.pkt.qs.mtb",
656                         FT_UINT32, BASE_DEC, NULL, 0x0,
657                         "PacketCable QoS Descriptor Attribute Maximum Traffic Burst", HFILL }
658                 },
659                 { &hf_packetcable_qos_desc_fields[8],
660                 { "Minimum Reserved Traffic Rate","radius.vendor.pkt.qs.mrtr",
661                         FT_UINT32, BASE_DEC, NULL, 0x0,
662                         "PacketCable QoS Descriptor Attribute Minimum Reserved Traffic Rate", HFILL }
663                 },
664                 { &hf_packetcable_qos_desc_fields[9],
665                 { "Minium Packet Size","radius.vendor.pkt.qs.mps",
666                         FT_UINT32, BASE_DEC, NULL, 0x0,
667                         "PacketCable QoS Descriptor Attribute Minimum Packet Size", HFILL }
668                 },
669                 { &hf_packetcable_qos_desc_fields[10],
670                 { "Maximum Concatenated Burst","radius.vendor.pkt.qs.mcb",
671                         FT_UINT32, BASE_DEC, NULL, 0x0,
672                         "PacketCable QoS Descriptor Attribute Maximum Concatenated Burst", HFILL }
673                 },
674                 { &hf_packetcable_qos_desc_fields[11],
675                 { "Status Request/Transmission Policy","radius.vendor.pkt.qs.srtp",
676                         FT_UINT32, BASE_DEC, NULL, 0x0,
677                         "PacketCable QoS Descriptor Attribute Status Request/Transmission Policy", HFILL }
678                 },
679                 { &hf_packetcable_qos_desc_fields[12],
680                 { "Nominal Polling Interval","radius.vendor.pkt.qs.npi",
681                         FT_UINT32, BASE_DEC, NULL, 0x0,
682                         "PacketCable QoS Descriptor Attribute Nominal Polling Interval", HFILL }
683                 },
684                 { &hf_packetcable_qos_desc_fields[13],
685                 { "Tolerated Poll Jitter","radius.vendor.pkt.qs.tpj",
686                         FT_UINT32, BASE_DEC, NULL, 0x0,
687                         "PacketCable QoS Descriptor Attribute Tolerated Poll Jitter", HFILL }
688                 },
689                 { &hf_packetcable_qos_desc_fields[14],
690                 { "Type of Service Override","radius.vendor.pkt.qs.toso",
691                         FT_UINT32, BASE_DEC, NULL, 0x0,
692                         "PacketCable QoS Descriptor Attribute Type of Service Override", HFILL }
693                 },
694                 { &hf_packetcable_qos_desc_fields[15],
695                 { "Maximum Downstream Latency","radius.vendor.pkt.qs.mdl",
696                         FT_UINT32, BASE_DEC, NULL, 0x0,
697                         "PacketCable QoS Descriptor Attribute Maximum Downstream Latency", HFILL }
698                 },
699                 { &hf_packetcable_time_adjustment,
700                 { "Time Adjustment","radius.vendor.pkt.ti",
701                         FT_UINT64, BASE_DEC, NULL, 0x0,
702                         "PacketCable Time Adjustment", HFILL }
703                 },
704                 { &hf_packetcable_redirected_from_info_number_of_redirections,
705                 { "Number-of-Redirections","radius.vendor.pkt.rfi.nr",
706                         FT_UINT16, BASE_DEC, NULL, 0x0,
707                         "PacketCable Redirected-From-Info Number-of-Redirections", HFILL }
708                 },
709                 { &hf_packetcable_electronic_surveillance_indication_df_cdc_address,
710                 { "DF_CDC_Address","radius.vendor.pkt.esi.dfcdca",
711                         FT_IPv4, BASE_DEC, NULL, 0x0,
712                         "PacketCable Electronic-Surveillance-Indication DF_CDC_Address", HFILL }
713                 },
714                 { &hf_packetcable_electronic_surveillance_indication_df_ccc_address,
715                 { "DF_CDC_Address","radius.vendor.pkt.esi.dfccca",
716                         FT_IPv4, BASE_DEC, NULL, 0x0,
717                         "PacketCable Electronic-Surveillance-Indication DF_CCC_Address", HFILL }
718                 },
719                 { &hf_packetcable_electronic_surveillance_indication_cdc_port,
720                 { "CDC-Port","radius.vendor.pkt.esi.cdcp",
721                         FT_UINT16, BASE_DEC, NULL, 0x0,
722                         "PacketCable Electronic-Surveillance-Indication CDC-Port", HFILL }
723                 },
724                 { &hf_packetcable_electronic_surveillance_indication_ccc_port,
725                 { "CCC-Port","radius.vendor.pkt.esi.cccp",
726                         FT_UINT16, BASE_DEC, NULL, 0x0,
727                         "PacketCable Electronic-Surveillance-Indication CCC-Port", HFILL }
728                 },
729
730                 { &hf_packetcable_terminal_display_info_terminal_display_status_bitmask,
731                 { "Terminal_Display_Status_Bitmask","radius.vendor.pkt.tdi.sbm",
732                         FT_UINT8, BASE_HEX, NULL, 0xff,
733                         "PacketCable Terminal_Display_Info Terminal_Display_Status_Bitmask", HFILL }
734                 },
735                 { &hf_packetcable_terminal_display_info_sbm_general_display,
736                 { "General_Display","radius.vendor.pkt.tdi.sbm.gd",
737                         FT_BOOLEAN, 8, NULL, 0x01,
738                         "PacketCable Terminal_Display_Info Terminal_Display_Status_Bitmask General_Display", HFILL }
739                 },
740                 { &hf_packetcable_terminal_display_info_sbm_calling_number,
741                 { "Calling_Number","radius.vendor.pkt.tdi.sbm.cnum",
742                         FT_BOOLEAN, 8, NULL, 0x02,
743                         "PacketCable Terminal_Display_Info Terminal_Display_Status_Bitmask Calling_Number", HFILL }
744                 },
745                 { &hf_packetcable_terminal_display_info_sbm_calling_name,
746                 { "Calling_Name","radius.vendor.pkt.tdi.sbm.cname",
747                         FT_BOOLEAN, 8, NULL, 0x04,
748                         "PacketCable Terminal_Display_Info Terminal_Display_Status_Bitmask Calling_Name", HFILL }
749                 },
750                 { &hf_packetcable_terminal_display_info_sbm_message_waiting,
751                 { "Message_Waiting","radius.vendor.pkt.tdi.sbm.mw",
752                         FT_BOOLEAN, 8, NULL, 0x08,
753                         "PacketCable Terminal_Display_Info Terminal_Display_Status_Bitmask Message_Waiting", HFILL }
754                 },
755                 { &hf_packetcable_terminal_display_info_general_display,
756                 { "General_Display","radius.vendor.pkt.tdi.gd",
757                         FT_STRING, BASE_NONE, NULL, 0,
758                         "PacketCable Terminal_Display_Info General_Display", HFILL }
759                 },
760                 { &hf_packetcable_terminal_display_info_calling_number,
761                 { "Calling_Number","radius.vendor.pkt.tdi.cnum",
762                         FT_STRING, BASE_NONE, NULL, 0,
763                         "PacketCable Terminal_Display_Info Calling_Number", HFILL }
764                 },
765                 { &hf_packetcable_terminal_display_info_calling_name,
766                 { "Calling_Name","radius.vendor.pkt.tdi.cname",
767                         FT_STRING, BASE_NONE, NULL, 0,
768                         "PacketCable Terminal_Display_Info Calling_Name", HFILL }
769                 },
770                 { &hf_packetcable_terminal_display_info_message_waiting,
771                 { "Message_Waiting","radius.vendor.pkt.tdi.mw",
772                         FT_STRING, BASE_NONE, NULL, 0,
773                         "PacketCable Terminal_Display_Info Message_Waiting", HFILL }
774                 }
775         };
776
777         static gint *ett[] = {
778                 &ett_radius_vendor_packetcable_bcid,
779                 &ett_radius_vendor_packetcable_status,
780                 &ett_radius_vendor_packetcable_qos_status,
781                 &ett_packetcable_term_dsply
782         };
783
784         proto_packetcable = proto_register_protocol("PacketCable AVPs", "PACKETCABLE", "paketcable_avps");
785
786         proto_register_field_array(proto_packetcable, hf, array_length(hf));
787         proto_register_subtree_array(ett, array_length(ett));
788 }
789
790 void
791 proto_reg_handoff_packetcable(void)
792 {
793
794         radius_register_avp_dissector(VENDOR_CABLELABS, 1, dissect_packetcable_em_hdr);
795         radius_register_avp_dissector(VENDOR_CABLELABS, 11, dissect_packetcable_call_term_cause);
796         radius_register_avp_dissector(VENDOR_CABLELABS, 13, dissect_packetcable_rel_call_billing_correlation);
797         radius_register_avp_dissector(VENDOR_CABLELABS, 24, dissect_packetcable_trunk_group_id);
798         radius_register_avp_dissector(VENDOR_CABLELABS, 32, dissect_packetcable_qos_descriptor);
799         radius_register_avp_dissector(VENDOR_CABLELABS, 38, dissect_packetcable_time_adjustment);
800         radius_register_avp_dissector(VENDOR_CABLELABS, 43, dissect_packetcable_redirected_from_info);
801         radius_register_avp_dissector(VENDOR_CABLELABS, 44, dissect_packetcable_time_electr_surv_ind);
802         radius_register_avp_dissector(VENDOR_CABLELABS, 47, dissect_packetcable_surv_df_sec);
803         radius_register_avp_dissector(VENDOR_CABLELABS, 54, dissect_packetcable_term_dsply_info);
804 /*      radius_register_avp_dissector(VENDOR_CABLELABS, 90, dissect_packetcable_party_info);
805         radius_register_avp_dissector(VENDOR_CABLELABS, 91, dissect_packetcable_party_info);
806         radius_register_avp_dissector(VENDOR_CABLELABS, 92, dissect_packetcable_party_info); */
807 }
808