Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-msn-messenger.c
blobe402426129816efdc86449c7edd776c06a54bdcf
1 /* packet-msn-messenger.c
2 * Routines for MSN Messenger Service packet dissection
3 * Copyright 2003, Chris Waters <chris@waters.co.nz>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * Copied from packet-pop.c
11 * SPDX-License-Identifier: GPL-2.0-or-later
14 #include "config.h"
16 #include <epan/packet.h>
17 #include <epan/strutil.h>
19 void proto_register_msnms(void);
20 void proto_reg_handoff_msnms(void);
22 static dissector_handle_t msnms_handle;
25 * The now-expired Internet-Draft for the MSN Messenger 1.0 protocol
26 * can, as of the time of the writing of this comment, be found at:
28 * http://praya.sourceforge.net/draft-movva-msn-messenger-protocol-00.txt
30 * http://mono.es.gnome.org/imsharp/tutoriales/msn/appendixa.html
32 * http://www.hypothetic.org/docs/msn/ietf_draft.php
34 * http://babble.wundsam.net/docs/protocol-msn-im.txt
36 * Note that it's Yet Another FTP-Like Command/Response Protocol,
37 * so it arguably should be dissected as such, although you do have
38 * to worry about the MSG command, as only the first line of it
39 * should be parsed as a command, the rest should be parsed as the
40 * message body. We therefore leave "hf_msnms_command", "tokenlen",
41 * and "next_token", even though they're unused, as reminders that
42 * this should be done.
45 static int proto_msnms;
46 /* static int hf_msnms_command; */
48 static int ett_msnms;
50 #define TCP_PORT_MSNMS 1863
52 static int
53 dissect_msnms(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
55 proto_tree *msnms_tree;
56 proto_item *ti;
57 int offset = 0;
58 const unsigned char *line;
59 int next_offset;
60 int linelen;
61 /* int tokenlen; */
62 /* const unsigned char *next_token; */
64 col_set_str(pinfo->cinfo, COL_PROTOCOL, "MSNMS");
67 * Find the end of the first line.
69 * Note that "tvb_find_line_end()" will return a value that is
70 * not longer than what's in the buffer, so the "tvb_get_ptr()"
71 * call won't throw an exception.
73 linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, false);
74 line = tvb_get_ptr(tvb, offset, linelen);
78 * Put the first line from the buffer into the summary.
80 col_add_str(pinfo->cinfo, COL_INFO,
81 format_text(pinfo->pool, line, linelen));
83 if (tree) {
84 ti = proto_tree_add_item(tree, proto_msnms, tvb, offset, -1,
85 ENC_NA);
86 msnms_tree = proto_item_add_subtree(ti, ett_msnms);
89 * Show the rest of the packet as text,
90 * a line at a time.
92 while (tvb_offset_exists(tvb, offset)) {
94 * Find the end of the line.
96 tvb_find_line_end(tvb, offset, -1,
97 &next_offset, false);
100 * Put this line.
102 proto_tree_add_format_text(msnms_tree, tvb, offset, next_offset - offset);
103 offset = next_offset;
106 return tvb_captured_length(tvb);
109 void
110 proto_register_msnms(void)
112 static int *ett[] = {
113 &ett_msnms,
116 proto_msnms = proto_register_protocol("MSN Messenger Service", "MSNMS", "msnms");
117 proto_register_subtree_array(ett, array_length(ett));
119 msnms_handle = register_dissector("msnms", dissect_msnms, proto_msnms);
122 void
123 proto_reg_handoff_msnms(void)
125 dissector_add_uint_with_preference("tcp.port", TCP_PORT_MSNMS, msnms_handle);
127 * For MSN Messenger Protocol over HTTP
129 dissector_add_string("media_type", "application/x-msn-messenger", msnms_handle);
133 * Editor modelines - https://www.wireshark.org/tools/modelines.html
135 * Local variables:
136 * c-basic-offset: 4
137 * tab-width: 8
138 * indent-tabs-mode: nil
139 * End:
141 * vi: set shiftwidth=4 tabstop=8 expandtab:
142 * :indentSize=4:tabSize=8:noTabs=true: