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