Ethereal->Wireshark
[obnox/wireshark/wip.git] / plugins / docsis / packet-bpkmattr.c
1 /* packet-bpkmattr.c
2  * Routines for Baseline Privacy Key Management Attributes dissection
3  * Copyright 2002, Anand V. Narwani <anand[AT]narwani.org>
4  *
5  * $Id$
6  *
7  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
9  * Copyright 1998 Gerald Combs
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24  */
25
26 #ifdef HAVE_CONFIG_H
27 # include "config.h"
28 #endif
29
30 #include "moduleinfo.h"
31
32 #include <stdio.h>
33 #include <stdlib.h>
34 #include <string.h>
35
36 #include <gmodule.h>
37
38 #include <epan/packet.h>
39
40 /* BPKM Attributes defined in:
41  * http://www.cablemodem.com/downloads/specs/SP-BPI+_I10-030730.pdf
42  */
43 #define BPKM_RESERVED 0
44 #define BPKM_SERIAL_NUM 1
45 #define BPKM_MANUFACTURER_ID 2
46 #define BPKM_MAC_ADDR 3
47 #define BPKM_RSA_PUB_KEY 4
48 #define BPKM_CM_ID 5
49 #define BPKM_DISPLAY_STR 6
50 #define BPKM_AUTH_KEY 7
51 #define BPKM_TEK 8
52 #define BPKM_KEY_LIFETIME 9
53 #define BPKM_KEY_SEQ_NUM 10
54 #define BPKM_HMAC_DIGEST 11
55 #define BPKM_SAID 12
56 #define BPKM_TEK_PARAM 13
57 #define BPKM_OBSOLETED 14
58 #define BPKM_CBC_IV 15
59 #define BPKM_ERROR_CODE 16
60 #define BPKM_CA_CERT 17
61 #define BPKM_CM_CERT 18
62 #define BPKM_SEC_CAPABILITIES 19
63 #define BPKM_CRYPTO_SUITE 20
64 #define BPKM_CRYPTO_SUITE_LIST 21
65 #define BPKM_BPI_VERSION 22
66 #define BPKM_SA_DESCRIPTOR 23
67 #define BPKM_SA_TYPE 24
68 #define BPKM_SA_QUERY 25
69 #define BPKM_SA_QUERY_TYPE 26
70 #define BPKM_IP_ADDRESS 27
71 #define BPKM_DNLD_PARAMS 28
72 #define BPKM_VENDOR_DEFINED 127
73
74 /* Initialize the protocol and registered fields */
75 static int proto_docsis_bpkmattr = -1;
76 static int hf_docsis_bpkmattr = -1;
77 static int hf_docsis_bpkmattr_serial_num = -1;
78 static int hf_docsis_bpkmattr_manf_id = -1;
79 static int hf_docsis_bpkmattr_mac_addr = -1;
80 static int hf_docsis_bpkmattr_rsa_pub_key = -1;
81 static int hf_docsis_bpkmattr_cm_id = -1;
82 static int hf_docsis_bpkmattr_display_str = -1;
83 static int hf_docsis_bpkmattr_auth_key = -1;
84 static int hf_docsis_bpkmattr_tek = -1;
85 static int hf_docsis_bpkmattr_key_life = -1;
86 static int hf_docsis_bpkmattr_key_seq = -1;
87 static int hf_docsis_bpkmattr_hmac_digest = -1;
88 static int hf_docsis_bpkmattr_said = -1;
89 static int hf_docsis_bpkmattr_tek_params = -1;
90 static int hf_docsis_bpkmattr_cbc_iv = -1;
91 static int hf_docsis_bpkmattr_error_code = -1;
92 static int hf_docsis_bpkmattr_vendor_def = -1;
93 static int hf_docsis_bpkmattr_ca_cert = -1;
94 static int hf_docsis_bpkmattr_cm_cert = -1;
95 static int hf_docsis_bpkmattr_security_cap = -1;
96 static int hf_docsis_bpkmattr_crypto_suite = -1;
97 static int hf_docsis_bpkmattr_crypto_suite_list = -1;
98 static int hf_docsis_bpkmattr_bpi_version = -1;
99 static int hf_docsis_bpkmattr_sa_descr = -1;
100 static int hf_docsis_bpkmattr_sa_type = -1;
101 static int hf_docsis_bpkmattr_sa_query = -1;
102 static int hf_docsis_bpkmattr_sa_query_type = -1;
103 static int hf_docsis_bpkmattr_ip_address = -1;
104 static int hf_docsis_bpkmattr_download_param = -1;
105
106
107
108 /* Initialize the subtree pointers */
109 static gint ett_docsis_bpkmattr = -1;
110 static gint ett_docsis_bpkmattr_cmid = -1;
111 static gint ett_docsis_bpkmattr_scap = -1;
112 static gint ett_docsis_bpkmattr_tekp = -1;
113 static gint ett_docsis_bpkmattr_sadsc = -1;
114 static gint ett_docsis_bpkmattr_saqry = -1;
115 static gint ett_docsis_bpkmattr_dnld = -1;
116
117
118 static const value_string error_code_vals[] = {
119   {0, "no information"},
120   {1, "Unauthorized CM"},
121   {2, "Unauthorized SAID"},
122   {3, "Unsolicited"},
123   {4, "Invalid Key Sequence Number"},
124   {5, "Key Request authentication failure"},
125   {6, "Permanent Authorization Failure"},
126   {7, "Not authorized for requested downstream traffic flow"},
127   {8, "Downstream traffic flow not mapped to BPI+ SAID"},
128   {9, "Time of day not acquired"},
129   {0, NULL},
130 };
131
132 static const value_string crypto_suite_attr_vals[] = {
133   {0x0100, "CBC Mode, 56 Bit DES & no Data Authentication"},
134   {0x0200, "CBC Mode, 40 Bit DES & no Data Authentication"},
135   {0, NULL},
136 };
137
138 static const value_string bpi_ver_vals[] = {
139   {0, "Reserved"},
140   {1, "BPI+"},
141   {0, NULL},
142 };
143
144 /* Code to actually dissect the packets */
145
146 /* The dissect_attrs() function does the actual work to dissect the
147  * attributes.  It's called recursively, to dissect embedded attributes
148  */
149 static void
150 dissect_attrs (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
151 {
152   guint8 type;
153   guint16 length;
154   int pos = 0;
155   gint total_len;
156   proto_item *cmid_it, *tekp_it, *scap_it;
157   proto_item *saqry_it, *dnld_it, *sadsc_it;
158   proto_tree *cmid_tree, *tekp_tree, *scap_tree;
159   proto_tree *saqry_tree, *dnld_tree, *sadsc_tree;
160   tvbuff_t *cmid_tvb, *tekp_tvb, *scap_tvb;
161   tvbuff_t *saqry_tvb, *dnld_tvb, *sadsc_tvb;
162
163   total_len = tvb_reported_length_remaining (tvb, 0);
164   while (pos < total_len)
165     {
166       type = tvb_get_guint8 (tvb, pos++);
167       length = tvb_get_ntohs (tvb, pos);
168       pos += 2;
169       switch (type)
170         {
171         case BPKM_RESERVED:
172           break;
173         case BPKM_SERIAL_NUM:
174           proto_tree_add_item (tree, hf_docsis_bpkmattr_serial_num, tvb, pos,
175                                length, FALSE);
176           break;
177         case BPKM_MANUFACTURER_ID:
178           if (length == 3)
179             proto_tree_add_item (tree, hf_docsis_bpkmattr_manf_id, tvb, pos,
180                                  length, FALSE);
181           else
182             THROW (ReportedBoundsError);
183           break;
184         case BPKM_MAC_ADDR:
185           if (length == 6)
186             proto_tree_add_item (tree, hf_docsis_bpkmattr_mac_addr, tvb, pos,
187                                  length, FALSE);
188           else
189             THROW (ReportedBoundsError);
190           break;
191         case BPKM_RSA_PUB_KEY:
192           proto_tree_add_item (tree, hf_docsis_bpkmattr_rsa_pub_key, tvb, pos,
193                                length, FALSE);
194           break;
195         case BPKM_CM_ID:
196           cmid_it =
197             proto_tree_add_text (tree, tvb, pos, length,
198                                  "5 CM Identification");
199           cmid_tree =
200             proto_item_add_subtree (cmid_it, ett_docsis_bpkmattr_cmid);
201           cmid_tvb = tvb_new_subset (tvb, pos, length, length);
202           dissect_attrs (cmid_tvb, pinfo, cmid_tree);
203           break;
204         case BPKM_DISPLAY_STR:
205           proto_tree_add_item (tree, hf_docsis_bpkmattr_display_str, tvb, pos,
206                                length, FALSE);
207           break;
208         case BPKM_AUTH_KEY:
209           if ((length == 96) || (length == 128))
210             proto_tree_add_item (tree, hf_docsis_bpkmattr_auth_key, tvb, pos,
211                                  length, FALSE);
212           else
213             THROW (ReportedBoundsError);
214           break;
215         case BPKM_TEK:
216           if (length == 8)
217             proto_tree_add_item (tree, hf_docsis_bpkmattr_tek, tvb, pos,
218                                  length, FALSE);
219           else
220             THROW (ReportedBoundsError);
221           break;
222         case BPKM_KEY_LIFETIME:
223           if (length == 4)
224             proto_tree_add_item (tree, hf_docsis_bpkmattr_key_life, tvb, pos,
225                                  length, FALSE);
226           else
227             THROW (ReportedBoundsError);
228           break;
229         case BPKM_KEY_SEQ_NUM:
230           if (length == 1)
231             proto_tree_add_item (tree, hf_docsis_bpkmattr_key_seq, tvb, pos,
232                                  length, FALSE);
233           else
234             THROW (ReportedBoundsError);
235           break;
236         case BPKM_HMAC_DIGEST:
237           if (length == 20)
238             proto_tree_add_item (tree, hf_docsis_bpkmattr_hmac_digest, tvb,
239                                  pos, length, FALSE);
240           else
241             THROW (ReportedBoundsError);
242           break;
243         case BPKM_SAID:
244           if (length == 2)
245             proto_tree_add_item (tree, hf_docsis_bpkmattr_said, tvb, pos,
246                                  length, FALSE);
247           else
248             THROW (ReportedBoundsError);
249           break;
250         case BPKM_TEK_PARAM:
251           tekp_it =
252             proto_tree_add_text (tree, tvb, pos, length, "13 TEK Parameters");
253           tekp_tree =
254             proto_item_add_subtree (tekp_it, ett_docsis_bpkmattr_tekp);
255           tekp_tvb = tvb_new_subset (tvb, pos, length, length);
256           dissect_attrs (tekp_tvb, pinfo, tekp_tree);
257           break;
258         case BPKM_OBSOLETED:
259           break;
260         case BPKM_CBC_IV:
261           if (length == 8)
262             proto_tree_add_item (tree, hf_docsis_bpkmattr_cbc_iv, tvb, pos,
263                                  length, FALSE);
264           else
265             THROW (ReportedBoundsError);
266           break;
267         case BPKM_ERROR_CODE:
268           if (length == 1)
269             proto_tree_add_item (tree, hf_docsis_bpkmattr_error_code, tvb,
270                                  pos, length, FALSE);
271           else
272             THROW (ReportedBoundsError);
273           break;
274         case BPKM_CA_CERT:
275           proto_tree_add_item (tree, hf_docsis_bpkmattr_ca_cert, tvb, pos,
276                                length, FALSE);
277           break;
278         case BPKM_CM_CERT:
279           proto_tree_add_item (tree, hf_docsis_bpkmattr_cm_cert, tvb, pos,
280                                length, FALSE);
281           break;
282         case BPKM_SEC_CAPABILITIES:
283           scap_it =
284             proto_tree_add_text (tree, tvb, pos, length,
285                                  "19 Security Capabilities");
286           scap_tree =
287             proto_item_add_subtree (scap_it, ett_docsis_bpkmattr_scap);
288           scap_tvb = tvb_new_subset (tvb, pos, length, length);
289           dissect_attrs (scap_tvb, pinfo, scap_tree);
290           break;
291         case BPKM_CRYPTO_SUITE:
292           if (length == 2)
293             proto_tree_add_item (tree, hf_docsis_bpkmattr_crypto_suite, tvb,
294                                  pos, length, FALSE);
295           else
296             THROW (ReportedBoundsError);
297           break;
298         case BPKM_CRYPTO_SUITE_LIST:
299           proto_tree_add_item (tree, hf_docsis_bpkmattr_crypto_suite_list,
300                                tvb, pos, length, FALSE);
301           break;
302         case BPKM_BPI_VERSION:
303           if (length == 1)
304             proto_tree_add_item (tree, hf_docsis_bpkmattr_bpi_version, tvb,
305                                  pos, length, FALSE);
306           else
307             THROW (ReportedBoundsError);
308           break;
309         case BPKM_SA_DESCRIPTOR:
310           sadsc_it =
311             proto_tree_add_text (tree, tvb, pos, length, "23 SA Descriptor");
312           sadsc_tree =
313             proto_item_add_subtree (sadsc_it, ett_docsis_bpkmattr_sadsc);
314           sadsc_tvb = tvb_new_subset (tvb, pos, length, length);
315           dissect_attrs (sadsc_tvb, pinfo, sadsc_tree);
316           break;
317         case BPKM_SA_TYPE:
318           if (length == 1)
319             proto_tree_add_item (tree, hf_docsis_bpkmattr_sa_type, tvb, pos,
320                                  length, FALSE);
321           else
322             THROW (ReportedBoundsError);
323           break;
324         case BPKM_SA_QUERY:
325           saqry_it =
326             proto_tree_add_text (tree, tvb, pos, length, "25 SA Query");
327           saqry_tree =
328             proto_item_add_subtree (saqry_it, ett_docsis_bpkmattr_saqry);
329           saqry_tvb = tvb_new_subset (tvb, pos, length, length);
330           dissect_attrs (saqry_tvb, pinfo, saqry_tree);
331           break;
332         case BPKM_SA_QUERY_TYPE:
333           if (length == 1)
334             proto_tree_add_item (tree, hf_docsis_bpkmattr_sa_query_type, tvb,
335                                  pos, length, FALSE);
336           else
337             THROW (ReportedBoundsError);
338           break;
339         case BPKM_IP_ADDRESS:
340           if (length == 4)
341             proto_tree_add_item (tree, hf_docsis_bpkmattr_ip_address, tvb,
342                                  pos, length, FALSE);
343           else
344             THROW (ReportedBoundsError);
345           break;
346         case BPKM_VENDOR_DEFINED:
347           proto_tree_add_item (tree, hf_docsis_bpkmattr_vendor_def, tvb, pos,
348                                length, FALSE);
349         case BPKM_DNLD_PARAMS:
350           dnld_it =
351             proto_tree_add_text (tree, tvb, pos, length,
352                                  "28 Download Parameters");
353           dnld_tree =
354             proto_item_add_subtree (dnld_it, ett_docsis_bpkmattr_dnld);
355           dnld_tvb = tvb_new_subset (tvb, pos, length, length);
356           dissect_attrs (dnld_tvb, pinfo, dnld_tree);
357           break;
358         default:
359           proto_tree_add_item (tree, hf_docsis_bpkmattr_vendor_def, tvb, pos,
360                                length, FALSE);
361           break;
362         }
363       pos += length;            /* switch */
364     }                           /* while */
365 }
366
367 static void
368 dissect_bpkmattr (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
369 {
370
371   proto_item *it;
372   proto_tree *bpkmattr_tree;
373
374   if (tree)
375     {
376       it =
377         proto_tree_add_protocol_format (tree, proto_docsis_bpkmattr, tvb, 0, -1,
378                                         "BPKM Attributes");
379       bpkmattr_tree = proto_item_add_subtree (it, ett_docsis_bpkmattr);
380       dissect_attrs (tvb, pinfo, bpkmattr_tree);
381     }
382
383 }
384
385
386
387 /* Register the protocol with Wireshark */
388
389 /* this format is require because a script is used to build the C function
390    that calls all the protocol registration.
391 */
392
393
394 void
395 proto_register_docsis_bpkmattr (void)
396 {
397
398 /* Setup list of header fields  See Section 1.6.1 for details*/
399   static hf_register_info hf[] = {
400     {&hf_docsis_bpkmattr,
401      {"BPKM Attributes", "docsis.bpkmattr",
402       FT_BYTES, BASE_HEX, NULL, 0x0,
403       "BPKM Attributes", HFILL}
404      },
405     {&hf_docsis_bpkmattr_serial_num,
406      {"1 Serial Number", "docsis.bpkmattr.serialnum",
407       FT_STRING, BASE_DEC, NULL, 0x0,
408       "Serial Number", HFILL}
409      },
410     {&hf_docsis_bpkmattr_manf_id,
411      {"2 Manufacturer Id", "docsis.bpkmattr.manfid",
412       FT_BYTES, BASE_HEX, NULL, 0x0,
413       "Manufacturer Id", HFILL}
414      },
415     {&hf_docsis_bpkmattr_mac_addr,
416      {"3 Mac Address", "docsis.bpkmattr.macaddr",
417       FT_ETHER, BASE_HEX, NULL, 0x0,
418       "Mac Address", HFILL}
419      },
420     {&hf_docsis_bpkmattr_rsa_pub_key,
421      {"4 RSA Public Key", "docsis.bpkmattr.rsa_pub_key",
422       FT_BYTES, BASE_HEX, NULL, 0x0,
423       "RSA Public Key", HFILL}
424      },
425     {&hf_docsis_bpkmattr_cm_id,
426      {"5 CM Identification", "docsis.bpkmattr.cmid",
427       FT_BYTES, BASE_HEX, NULL, 0x0,
428       "CM Identification", HFILL}
429      },
430     {&hf_docsis_bpkmattr_display_str,
431      {"6 Display String", "docsis.bpkmattr.dispstr",
432       FT_STRING, BASE_DEC, NULL, 0x0,
433       "Display String", HFILL}
434      },
435     {&hf_docsis_bpkmattr_auth_key,
436      {"7 Auth Key", "docsis.bpkmattr.auth_key",
437       FT_BYTES, BASE_HEX, NULL, 0x0,
438       "Auth Key", HFILL}
439      },
440     {&hf_docsis_bpkmattr_tek,
441      {"8 Traffic Encryption Key", "docsis.bpkmattr.tek",
442       FT_BYTES, BASE_HEX, NULL, 0x0,
443       "Traffic Encryption Key", HFILL}
444      },
445     {&hf_docsis_bpkmattr_key_life,
446      {"9 Key Lifetime (s)", "docsis.bpkmattr.keylife",
447       FT_UINT32, BASE_DEC, NULL, 0x0,
448       "Key Lifetime (s)", HFILL}
449      },
450     {&hf_docsis_bpkmattr_key_seq,
451      {"10 Key Sequence Number", "docsis.bpkmattr.keyseq",
452       FT_UINT8, BASE_DEC, NULL, 0x0,
453       "Key Sequence Number", HFILL}
454      },
455     {&hf_docsis_bpkmattr_hmac_digest,
456      {"11 HMAC Digest", "docsis.bpkmattr.hmacdigest",
457       FT_BYTES, BASE_HEX, NULL, 0x0,
458       "HMAC Digest", HFILL}
459      },
460     {&hf_docsis_bpkmattr_said,
461      {"12 SAID", "docsis.bpkmattr.said",
462       FT_UINT16, BASE_DEC, NULL, 0x0,
463       "Security Association ID", HFILL}
464      },
465     {&hf_docsis_bpkmattr_tek_params,
466      {"13 TEK Parameters", "docsis.bpkmattr.tekparams",
467       FT_BYTES, BASE_HEX, NULL, 0x0,
468       "TEK Parameters", HFILL}
469      },
470     {&hf_docsis_bpkmattr_cbc_iv,
471      {"14 CBC IV", "docsis.bpkmattr.cbciv",
472       FT_BYTES, BASE_HEX, NULL, 0x0,
473       "Cypher Block Chaining", HFILL}
474      },
475     {&hf_docsis_bpkmattr_error_code,
476      {"16 Error Code", "docsis.bpkmattr.errcode",
477       FT_UINT8, BASE_DEC, VALS (error_code_vals), 0x0,
478       "Error Code", HFILL}
479      },
480     {&hf_docsis_bpkmattr_vendor_def,
481      {"127 Vendor Defined", "docsis.bpkmattr.vendordef",
482       FT_BYTES, BASE_HEX, NULL, 0x0,
483       "Vendor Defined", HFILL}
484      },
485     {&hf_docsis_bpkmattr_ca_cert,
486      {"17 CA Certificate", "docsis.bpkmattr.cacert",
487       FT_BYTES, BASE_HEX, NULL, 0x0,
488       "CA Certificate", HFILL}
489      },
490     {&hf_docsis_bpkmattr_cm_cert,
491      {"18 CM Certificate", "docsis.bpkmattr.cmcert",
492       FT_BYTES, BASE_HEX, NULL, 0x0,
493       "CM Certificate", HFILL}
494      },
495     {&hf_docsis_bpkmattr_security_cap,
496      {"19 Security Capabilities", "docsis.bpkmattr.seccap",
497       FT_BYTES, BASE_HEX, NULL, 0x0,
498       "Security Capabilities", HFILL}
499      },
500     {&hf_docsis_bpkmattr_crypto_suite,
501      {"20 Cryptographic Suite", "docsis.bpkmattr.cryptosuite",
502       FT_UINT16, BASE_HEX, VALS(crypto_suite_attr_vals), 0x0,
503       "Cryptographic Suite", HFILL}
504      },
505     {&hf_docsis_bpkmattr_crypto_suite_list,
506      {"21 Cryptographic Suite List", "docsis.bpkmattr.crypto_suite_lst",
507       FT_BYTES, BASE_HEX, NULL, 0x0,
508       "Cryptographic Suite", HFILL}
509      },
510     {&hf_docsis_bpkmattr_bpi_version,
511      {"22 BPI Version", "docsis.bpkmattr.bpiver",
512       FT_UINT8, BASE_DEC, VALS (bpi_ver_vals), 0x0,
513       "BPKM Attributes", HFILL}
514      },
515     {&hf_docsis_bpkmattr_sa_descr,
516      {"23 SA Descriptor", "docsis.bpkmattr.sadescr",
517       FT_BYTES, BASE_HEX, NULL, 0x0,
518       "SA Descriptor", HFILL}
519      },
520     {&hf_docsis_bpkmattr_sa_type,
521      {"24 SA Type", "docsis.bpkmattr.satype",
522       FT_UINT8, BASE_DEC, NULL, 0x0,
523       "SA Type", HFILL}
524      },
525     {&hf_docsis_bpkmattr_sa_query,
526      {"25 SA Query", "docsis.bpkmattr.saquery",
527       FT_BYTES, BASE_HEX, NULL, 0x0,
528       "SA Query", HFILL}
529      },
530     {&hf_docsis_bpkmattr_sa_query_type,
531      {"26 SA Query Type", "docsis.bpkmattr.saquery_type",
532       FT_UINT8, BASE_HEX, NULL, 0x0,
533       "SA Query Type", HFILL}
534      },
535     {&hf_docsis_bpkmattr_ip_address,
536      {"27 IP Address", "docsis.bpkmattr.ipaddr",
537       FT_IPv4, BASE_DEC, NULL, 0x0,
538       "IP Address", HFILL}
539      },
540     {&hf_docsis_bpkmattr_download_param,
541      {"28 Download Parameters", "docsis.bpkmattr.dnld_params",
542       FT_BYTES, BASE_HEX, NULL, 0x0,
543       "Download Parameters", HFILL}
544      },
545   };
546
547 /* Setup protocol subtree array */
548   static gint *ett[] = {
549     &ett_docsis_bpkmattr,
550     &ett_docsis_bpkmattr_cmid,
551     &ett_docsis_bpkmattr_scap,
552     &ett_docsis_bpkmattr_tekp,
553     &ett_docsis_bpkmattr_sadsc,
554     &ett_docsis_bpkmattr_saqry,
555     &ett_docsis_bpkmattr_dnld
556   };
557
558 /* Register the protocol name and description */
559   proto_docsis_bpkmattr =
560     proto_register_protocol
561     ("DOCSIS Baseline Privacy Key Management Attributes", "DOCSIS BPKM-ATTR",
562      "docsis_bpkmattr");
563
564 /* Required function calls to register the header fields and subtrees used */
565   proto_register_field_array (proto_docsis_bpkmattr, hf, array_length (hf));
566   proto_register_subtree_array (ett, array_length (ett));
567
568   register_dissector ("docsis_bpkmattr", dissect_bpkmattr,
569                       proto_docsis_bpkmattr);
570 }
571
572
573 /* If this dissector uses sub-dissector registration add a registration routine.
574    This format is required because a script is used to find these routines and
575    create the code that calls these routines.
576 */
577 void
578 proto_reg_handoff_docsis_bpkmattr (void)
579 {
580   dissector_handle_t docsis_bpkmattr_handle;
581
582   docsis_bpkmattr_handle = find_dissector ("docsis_bpkmattr");
583   dissector_add ("docsis", 0xFE, docsis_bpkmattr_handle);
584
585 }