From Solomon Peachy: WEP cleanups, WEP decryption support and other
[obnox/wireshark/wip.git] / packet-ipp.c
1 /* packet-ipp.c
2  * Routines for IPP packet disassembly
3  *
4  * Guy Harris <guy@alum.mit.edu>
5  *
6  * $Id: packet-ipp.c,v 1.31 2002/05/30 01:56:55 guy Exp $
7  *
8  * Ethereal - Network traffic analyzer
9  * By Gerald Combs <gerald@ethereal.com>
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 #ifdef HAVE_CONFIG_H
28 #include "config.h"
29 #endif
30
31 #ifdef HAVE_SYS_TYPES_H
32 #include <sys/types.h>
33 #endif
34
35 #include <string.h>
36 #include <ctype.h>
37
38 #include <glib.h>
39 #include <epan/packet.h>
40 #include <epan/strutil.h>
41 #include "packet-http.h"
42
43 static int proto_ipp = -1;
44
45 static gint ett_ipp = -1;
46 static gint ett_ipp_as = -1;
47 static gint ett_ipp_attr = -1;
48
49 static dissector_handle_t data_handle;
50
51 #define PRINT_JOB               0x0002
52 #define PRINT_URI               0x0003
53 #define VALIDATE_JOB            0x0004
54 #define CREATE_JOB              0x0005
55 #define SEND_DOCUMENT           0x0006
56 #define SEND_URI                0x0007
57 #define CANCEL_JOB              0x0008
58 #define GET_JOB_ATTRIBUTES      0x0009
59 #define GET_JOBS                0x000A
60 #define GET_PRINTER_ATTRIBUTES  0x000B
61
62 static const value_string operation_vals[] = {
63     { PRINT_JOB,              "Print-Job" },
64     { PRINT_URI,              "Print-URI" },
65     { VALIDATE_JOB,           "Validate-Job" },
66     { CREATE_JOB,             "Create-Job" },
67     { SEND_DOCUMENT,          "Send-Document" },
68     { SEND_URI,               "Send-URI" },
69     { CANCEL_JOB,             "Cancel-Job" },
70     { GET_JOB_ATTRIBUTES,     "Get-Job-Attributes" },
71     { GET_JOBS,               "Get-Jobs" },
72     { GET_PRINTER_ATTRIBUTES, "Get-Printer-Attributes" },
73     { 0,                      NULL }
74 };
75
76 #define STATUS_SUCCESSFUL       0x0000
77 #define STATUS_INFORMATIONAL    0x0100
78 #define STATUS_REDIRECTION      0x0200
79 #define STATUS_CLIENT_ERROR     0x0400
80 #define STATUS_SERVER_ERROR     0x0500
81
82 #define STATUS_TYPE_MASK        0xFF00
83
84 #define SUCCESSFUL_OK                           0x0000
85 #define SUCCESSFUL_OK_IGN_OR_SUB_ATTR           0x0001
86 #define SUCCESSFUL_OK_CONFLICTING_ATTR          0x0002
87
88 #define CLIENT_ERROR_BAD_REQUEST                0x0400
89 #define CLIENT_ERROR_FORBIDDEN                  0x0401
90 #define CLIENT_ERROR_NOT_AUTHENTICATED          0x0402
91 #define CLIENT_ERROR_NOT_AUTHORIZED             0x0403
92 #define CLIENT_ERROR_NOT_POSSIBLE               0x0404
93 #define CLIENT_ERROR_TIMEOUT                    0x0405
94 #define CLIENT_ERROR_NOT_FOUND                  0x0406
95 #define CLIENT_ERROR_GONE                       0x0407
96 #define CLIENT_ERROR_REQ_ENTITY_TOO_LRG         0x0408
97 #define CLIENT_ERROR_REQ_VALUE_TOO_LONG         0x0409
98 #define CLIENT_ERROR_DOC_FMT_NOT_SUPP           0x040A
99 #define CLIENT_ERROR_ATTR_OR_VAL_NOT_SUPP       0x040B
100 #define CLIENT_ERROR_URI_SCHEME_NOT_SUPP        0x040C
101 #define CLIENT_ERROR_CHARSET_NOT_SUPP           0x040D
102 #define CLIENT_ERROR_CONFLICTING_ATTRS          0x040E
103
104 #define SERVER_ERROR_INTERNAL_ERROR             0x0500
105 #define SERVER_ERROR_OPERATION_NOT_SUPP         0x0501
106 #define SERVER_ERROR_SERVICE_UNAVAIL            0x0502
107 #define SERVER_ERROR_VERSION_NOT_SUPP           0x0503
108 #define SERVER_ERROR_DEVICE_ERROR               0x0504
109 #define SERVER_ERROR_TEMPORARY_ERROR            0x0505
110 #define SERVER_ERROR_NOT_ACCEPTING_JOBS         0x0506
111 #define SERVER_ERROR_BUSY                       0x0507
112 #define SERVER_ERROR_JOB_CANCELED               0x0508
113
114 static const value_string status_vals[] = {
115     { SUCCESSFUL_OK,                     "Successful-OK" },
116     { SUCCESSFUL_OK_IGN_OR_SUB_ATTR,     "Successful-OK-Ignored-Or-Substituted-Attributes" },
117     { SUCCESSFUL_OK_CONFLICTING_ATTR,    "Successful-OK-Conflicting-Attributes" },
118     { CLIENT_ERROR_BAD_REQUEST,          "Client-Error-Bad-Request" },
119     { CLIENT_ERROR_FORBIDDEN,            "Client-Error-Forbidden" },
120     { CLIENT_ERROR_NOT_AUTHENTICATED,    "Client-Error-Not-Authenticated" },
121     { CLIENT_ERROR_NOT_AUTHORIZED,       "Client-Error-Not-Authorized" },
122     { CLIENT_ERROR_NOT_POSSIBLE,         "Client-Error-Not-Possible" },
123     { CLIENT_ERROR_TIMEOUT,              "Client-Error-Timeout" },
124     { CLIENT_ERROR_NOT_FOUND,            "Client-Error-Not-Found" },
125     { CLIENT_ERROR_GONE,                 "Client-Error-Gone" },
126     { CLIENT_ERROR_REQ_ENTITY_TOO_LRG,   "Client-Error-Request-Entity-Too-Large" },
127     { CLIENT_ERROR_REQ_VALUE_TOO_LONG,   "Client-Error-Request-Value-Too-Long" },
128     { CLIENT_ERROR_DOC_FMT_NOT_SUPP,     "Client-Error-Document-Format-Not-Supported" },
129     { CLIENT_ERROR_ATTR_OR_VAL_NOT_SUPP, "Client-Error-Attributes-Or-Values-Not-Supported" },
130     { CLIENT_ERROR_URI_SCHEME_NOT_SUPP,  "Client-Error-URI-Scheme-Not-Supported" },
131     { CLIENT_ERROR_CHARSET_NOT_SUPP,     "Client-Error-Charset-Not-Supported" },
132     { CLIENT_ERROR_CONFLICTING_ATTRS,    "Client-Error-Conflicting-Attributes" },
133     { SERVER_ERROR_INTERNAL_ERROR,       "Server-Error-Internal-Error" },
134     { SERVER_ERROR_OPERATION_NOT_SUPP,   "Server-Error-Operation-Not-Supported" },
135     { SERVER_ERROR_SERVICE_UNAVAIL,      "Server-Error-Service-Unavailable" },
136     { SERVER_ERROR_VERSION_NOT_SUPP,     "Server-Error-Version-Not-Supported" },
137     { SERVER_ERROR_DEVICE_ERROR,         "Server-Error-Device-Error" },
138     { SERVER_ERROR_TEMPORARY_ERROR,      "Server-Error-Temporary-Error" },
139     { SERVER_ERROR_NOT_ACCEPTING_JOBS,   "Server-Error-Not-Accepting-Jobs" },
140     { SERVER_ERROR_BUSY,                 "Server-Error-Busy" },
141     { SERVER_ERROR_JOB_CANCELED,         "Server-Error-Job-Canceled" },
142     { 0,                                 NULL }
143 };
144
145 static int parse_attributes(tvbuff_t *tvb, int offset, proto_tree *tree);
146 static proto_tree *add_integer_tree(proto_tree *tree, tvbuff_t *tvb,
147     int offset, int name_length, int value_length);
148 static void add_integer_value(gchar *tag_desc, proto_tree *tree,
149     tvbuff_t *tvb, int offset, int name_length, int value_length);
150 static proto_tree *add_octetstring_tree(proto_tree *tree, tvbuff_t *tvb,
151     int offset, int name_length, int value_length);
152 static void add_octetstring_value(gchar *tag_desc, proto_tree *tree,
153     tvbuff_t *tvb, int offset, int name_length, int value_length);
154 static proto_tree *add_charstring_tree(proto_tree *tree, tvbuff_t *tvb,
155     int offset, int name_length, int value_length);
156 static void add_charstring_value(gchar *tag_desc, proto_tree *tree,
157     tvbuff_t *tvb, int offset, int name_length, int value_length);
158 static int add_value_head(gchar *tag_desc, proto_tree *tree, tvbuff_t *tvb,
159     int offset, int name_length, int value_length);
160
161 static void
162 dissect_ipp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
163 {
164         proto_tree *ipp_tree;
165         proto_item *ti;
166         int offset = 0;
167         gboolean is_request = (pinfo->destport == 631);
168         guint16 status_code;
169         gchar *status_fmt;
170
171         if (check_col(pinfo->cinfo, COL_PROTOCOL))
172                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPP");
173         if (check_col(pinfo->cinfo, COL_INFO)) {
174                 if (is_request)
175                         col_set_str(pinfo->cinfo, COL_INFO, "IPP request");
176                 else
177                         col_set_str(pinfo->cinfo, COL_INFO, "IPP response");
178         }
179
180         if (tree) {
181                 ti = proto_tree_add_item(tree, proto_ipp, tvb, offset, -1,
182                     FALSE);
183                 ipp_tree = proto_item_add_subtree(ti, ett_ipp);
184
185                 proto_tree_add_text(ipp_tree, tvb, offset, 2, "Version: %u.%u",
186                     tvb_get_guint8(tvb, offset),
187                     tvb_get_guint8(tvb, offset + 1));
188                 offset += 2;
189
190                 if (is_request) {
191                         proto_tree_add_text(ipp_tree, tvb, offset, 2, "Operation-id: %s",
192                             val_to_str(tvb_get_ntohs(tvb, offset), operation_vals,
193                                 "Unknown (0x%04x)"));
194                 } else {
195                         status_code = tvb_get_ntohs(tvb, offset);
196                         switch (status_code & STATUS_TYPE_MASK) {
197
198                         case STATUS_SUCCESSFUL:
199                                 status_fmt = "Successful (0x%04x)";
200                                 break;
201
202                         case STATUS_INFORMATIONAL:
203                                 status_fmt = "Informational (0x%04x)";
204                                 break;
205
206                         case STATUS_REDIRECTION:
207                                 status_fmt = "Redirection (0x%04x)";
208                                 break;
209
210                         case STATUS_CLIENT_ERROR:
211                                 status_fmt = "Client error (0x%04x)";
212                                 break;
213
214                         case STATUS_SERVER_ERROR:
215                                 status_fmt = "Server error (0x%04x)";
216                                 break;
217
218                         default:
219                                 status_fmt = "Unknown (0x%04x)";
220                                 break;
221                         }
222                         proto_tree_add_text(ipp_tree, tvb, offset, 2, "Status-code: %s",
223                             val_to_str(status_code, status_vals, status_fmt));
224                 }
225                 offset += 2;
226
227                 proto_tree_add_text(ipp_tree, tvb, offset, 4, "Request ID: %u",
228                     tvb_get_ntohl(tvb, offset));
229                 offset += 4;
230
231                 offset = parse_attributes(tvb, offset, ipp_tree);
232
233                 if (tvb_offset_exists(tvb, offset)) {
234                         call_dissector(data_handle,
235                             tvb_new_subset(tvb, offset, -1, -1), pinfo,
236                             ipp_tree);
237                 }
238         }
239 }
240
241 #define TAG_TYPE(tag)           ((tag) & 0xF0)
242 #define TAG_TYPE_DELIMITER      0x00
243 #define TAG_TYPE_INTEGER        0x20
244 #define TAG_TYPE_OCTETSTRING    0x30
245 #define TAG_TYPE_CHARSTRING     0x40
246
247 #define TAG_END_OF_ATTRIBUTES   0x03
248
249 #define TAG_INTEGER             0x21
250 #define TAG_BOOLEAN             0x22
251 #define TAG_ENUM                0x23
252
253 #define TAG_OCTETSTRING         0x30
254 #define TAG_DATETIME            0x31
255 #define TAG_RESOLUTION          0x32
256 #define TAG_RANGEOFINTEGER      0x33
257 #define TAG_TEXTWITHLANGUAGE    0x35
258 #define TAG_NAMEWITHLANGUAGE    0x36
259
260 #define TAG_TEXTWITHOUTLANGUAGE 0x41
261 #define TAG_NAMEWITHOUTLANGUAGE 0x42
262 #define TAG_KEYWORD             0x44
263 #define TAG_URI                 0x45
264 #define TAG_URISCHEME           0x46
265 #define TAG_CHARSET             0x47
266 #define TAG_NATURALLANGUAGE     0x48
267 #define TAG_MIMEMEDIATYPE       0x49
268
269 static const value_string tag_vals[] = {
270         /* Delimiter tags */
271         { 0x01,                    "Operation attributes" },
272         { 0x02,                    "Job attributes" },
273         { TAG_END_OF_ATTRIBUTES,   "End of attributes" },
274         { 0x04,                    "Printer attributes" },
275         { 0x05,                    "Unsupported attributes" },
276
277         /* Value tags */
278         { 0x10,                    "Unsupported" },
279         { 0x12,                    "Unknown" },
280         { 0x13,                    "No value" },
281         { TAG_INTEGER,             "Integer" },
282         { TAG_BOOLEAN,             "Boolean" },
283         { TAG_ENUM,                "Enum" },
284         { TAG_OCTETSTRING,         "Octet string" },
285         { TAG_DATETIME,            "Date/Time" },
286         { TAG_RESOLUTION,          "Resolution" },
287         { TAG_RANGEOFINTEGER,      "Range of integer" },
288         { TAG_TEXTWITHLANGUAGE,    "Text with language" },
289         { TAG_NAMEWITHLANGUAGE,    "Name with language" },
290         { TAG_TEXTWITHOUTLANGUAGE, "Text without language" },
291         { TAG_NAMEWITHOUTLANGUAGE, "Name without language" },
292         { TAG_KEYWORD,             "Keyword" },
293         { TAG_URI,                 "URI" },
294         { TAG_URISCHEME,           "URI scheme" },
295         { TAG_CHARSET,             "Character set" },
296         { TAG_NATURALLANGUAGE,     "Natural language" },
297         { TAG_MIMEMEDIATYPE,       "MIME media type" },
298         { 0,                       NULL }
299 };
300
301 static int
302 parse_attributes(tvbuff_t *tvb, int offset, proto_tree *tree)
303 {
304         guint8 tag;
305         gchar *tag_desc;
306         int name_length, value_length;
307         proto_tree *as_tree = tree;
308         proto_item *tas = NULL;
309         int start_offset = offset;
310         proto_tree *attr_tree = tree;
311
312         while (tvb_offset_exists(tvb, offset)) {
313                 tag = tvb_get_guint8(tvb, offset);
314                 tag_desc = val_to_str(tag, tag_vals, "Reserved (0x%02x)");
315                 if (TAG_TYPE(tag) == TAG_TYPE_DELIMITER) {
316                         /*
317                          * If we had an attribute sequence we were
318                          * working on, we're done with it; set its
319                          * length to the length of all the stuff
320                          * we've done so far.
321                          */
322                         if (tas != NULL)
323                                 proto_item_set_len(tas, offset - start_offset);
324
325                         /*
326                          * This tag starts a new attribute sequence;
327                          * create a new tree under this tag when we see
328                          * a non-delimiter tag, under which to put
329                          * those attributes.
330                          */
331                         as_tree = NULL;
332                         attr_tree = tree;
333
334                         /*
335                          * Remember the offset at which this attribute
336                          * sequence started, so we can use it to compute
337                          * its length when it's finished.
338                          */
339                         start_offset = offset;
340
341                         /*
342                          * Now create a new item for this tag.
343                          */
344                         tas = proto_tree_add_text(tree, tvb, offset, 1,
345                             "%s", tag_desc);
346                         offset++;
347                         if (tag == TAG_END_OF_ATTRIBUTES) {
348                                 /*
349                                  * No more attributes.
350                                  */
351                                 break;
352                         }
353                 } else {
354                         /*
355                          * Value tag - get the name length.
356                          */
357                         name_length = tvb_get_ntohs(tvb, offset + 1);
358
359                         /*
360                          * OK, get the value length.
361                          */
362                         value_length = tvb_get_ntohs(tvb, offset + 1 + 2 + name_length);
363
364                         /*
365                          * OK, does the value run past the end of the
366                          * frame?
367                          */
368                         if (as_tree == NULL) {
369                                 /*
370                                  * OK, there's an attribute to hang
371                                  * under a delimiter tag, but we don't
372                                  * have a tree for that tag yet; create
373                                  * a tree.
374                                  */
375                                 as_tree = proto_item_add_subtree(tas,
376                                     ett_ipp_as);
377                                 attr_tree = as_tree;
378                         }
379
380                         switch (TAG_TYPE(tag)) {
381
382                         case TAG_TYPE_INTEGER:
383                                 if (name_length != 0) {
384                                         /*
385                                          * This is an attribute, not
386                                          * an additional value, so
387                                          * start a tree for it.
388                                          */
389                                         attr_tree = add_integer_tree(as_tree,
390                                             tvb, offset, name_length,
391                                             value_length);
392                                 }
393                                 add_integer_value(tag_desc, attr_tree, tvb,
394                                     offset, name_length, value_length);
395                                 break;
396
397                         case TAG_TYPE_OCTETSTRING:
398                                 if (name_length != 0) {
399                                         /*
400                                          * This is an attribute, not
401                                          * an additional value, so
402                                          * start a tree for it.
403                                          */
404                                         attr_tree = add_octetstring_tree(as_tree,
405                                             tvb, offset, name_length,
406                                             value_length);
407                                 }
408                                 add_octetstring_value(tag_desc, attr_tree, tvb,
409                                     offset, name_length, value_length);
410                                 break;
411
412                         case TAG_TYPE_CHARSTRING:
413                                 if (name_length != 0) {
414                                         /*
415                                          * This is an attribute, not
416                                          * an additional value, so
417                                          * start a tree for it.
418                                          */
419                                         attr_tree = add_charstring_tree(as_tree,
420                                             tvb, offset, name_length,
421                                             value_length);
422                                 }
423                                 add_charstring_value(tag_desc, attr_tree, tvb,
424                                     offset, name_length, value_length);
425                                 break;
426                         }
427                         offset += 1 + 2 + name_length + 2 + value_length;
428                 }
429         }
430
431         return offset;
432 }
433
434 static proto_tree *
435 add_integer_tree(proto_tree *tree, tvbuff_t *tvb, int offset,
436     int name_length, int value_length)
437 {
438         proto_item *ti;
439
440         if (value_length != 4) {
441                 ti = proto_tree_add_text(tree, tvb, offset,
442                     1 + 2 + name_length + 2 + value_length,
443                     "%.*s: Invalid integer (length is %u, should be 4)",
444                     name_length,
445                     tvb_get_ptr(tvb, offset + 1 + 2, name_length),
446                     value_length);
447         } else {
448                 ti = proto_tree_add_text(tree, tvb, offset,
449                     1 + 2 + name_length + 2 + value_length,
450                     "%.*s: %u",
451                     name_length,
452                     tvb_get_ptr(tvb, offset + 1 + 2, name_length),
453                     tvb_get_ntohl(tvb, offset + 1 + 2 + name_length + 2));
454         }
455         return proto_item_add_subtree(ti, ett_ipp_attr);
456 }
457
458 static void
459 add_integer_value(gchar *tag_desc, proto_tree *tree, tvbuff_t *tvb,
460     int offset, int name_length, int value_length)
461 {
462         offset = add_value_head(tag_desc, tree, tvb, offset, name_length,
463             value_length);
464         if (value_length == 4) {
465                 proto_tree_add_text(tree, tvb, offset, value_length,
466                     "Value: %u", tvb_get_ntohl(tvb, offset));
467         }
468 }
469
470 static proto_tree *
471 add_octetstring_tree(proto_tree *tree, tvbuff_t *tvb, int offset,
472     int name_length, int value_length)
473 {
474         proto_item *ti;
475
476         ti = proto_tree_add_text(tree, tvb, offset,
477             1 + 2 + name_length + 2 + value_length,
478             "%.*s: %s",
479             name_length,
480             tvb_get_ptr(tvb, offset + 1 + 2, name_length),
481             tvb_bytes_to_str(tvb, offset + 1 + 2 + name_length + 2, value_length));
482         return proto_item_add_subtree(ti, ett_ipp_attr);
483 }
484
485 static void
486 add_octetstring_value(gchar *tag_desc, proto_tree *tree, tvbuff_t *tvb,
487     int offset, int name_length, int value_length)
488 {
489         offset = add_value_head(tag_desc, tree, tvb, offset, name_length,
490             value_length);
491         proto_tree_add_text(tree, tvb, offset, value_length,
492             "Value: %s", tvb_bytes_to_str(tvb, offset, value_length));
493 }
494
495 static proto_tree *
496 add_charstring_tree(proto_tree *tree, tvbuff_t *tvb, int offset,
497     int name_length, int value_length)
498 {
499         proto_item *ti;
500
501         ti = proto_tree_add_text(tree, tvb, offset,
502             1 + 2 + name_length + 2 + value_length,
503             "%.*s: %.*s",
504             name_length,
505             tvb_get_ptr(tvb, offset + 1 + 2, name_length),
506             value_length,
507             tvb_get_ptr(tvb, offset + 1 + 2 + name_length + 2, value_length));
508         return proto_item_add_subtree(ti, ett_ipp_attr);
509 }
510
511 static void
512 add_charstring_value(gchar *tag_desc, proto_tree *tree, tvbuff_t *tvb,
513     int offset, int name_length, int value_length)
514 {
515         offset = add_value_head(tag_desc, tree, tvb, offset, name_length,
516             value_length);
517         proto_tree_add_text(tree, tvb, offset, value_length,
518             "Value: %.*s", value_length, tvb_get_ptr(tvb, offset, value_length));
519 }
520
521 static int
522 add_value_head(gchar *tag_desc, proto_tree *tree, tvbuff_t *tvb, int offset,
523     int name_length, int value_length)
524 {
525         proto_tree_add_text(tree, tvb, offset, 1, "Tag: %s", tag_desc);
526         offset += 1;
527         proto_tree_add_text(tree, tvb, offset, 2, "Name length: %u",
528             name_length);
529         offset += 2;
530         if (name_length != 0) {
531                 proto_tree_add_text(tree, tvb, offset, name_length,
532                     "Name: %.*s", name_length,
533                     tvb_get_ptr(tvb, offset, name_length));
534         }
535         offset += name_length;
536         proto_tree_add_text(tree, tvb, offset, 2, "Value length: %u",
537             value_length);
538         offset += 2;
539         return offset;
540 }
541
542 void
543 proto_register_ipp(void)
544 {
545 /*        static hf_register_info hf[] = {
546                 { &variable,
547                 { "Name",           "ipp.abbreviation", TYPE, VALS_POINTER }},
548         };*/
549         static gint *ett[] = {
550                 &ett_ipp,
551                 &ett_ipp_as,
552                 &ett_ipp_attr,
553         };
554
555         proto_ipp = proto_register_protocol("Internet Printing Protocol",
556             "IPP", "ipp");
557  /*       proto_register_field_array(proto_ipp, hf, array_length(hf));*/
558         proto_register_subtree_array(ett, array_length(ett));
559 }
560
561 void
562 proto_reg_handoff_ipp(void)
563 {
564         dissector_handle_t ipp_handle;
565
566         /*
567          * Register ourselves as running atop HTTP and using port 631.
568          */
569         ipp_handle = create_dissector_handle(dissect_ipp, proto_ipp);
570         http_dissector_add(631, ipp_handle);
571         data_handle = find_dissector("data");
572 }