X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/tripe/blobdiff_plain/786989941b7b4504f0234c4a318f929802e981ad..aec8bcc80d152089426e63cacf455cd456787036:/wireshark/packet-tripe.c diff --git a/wireshark/packet-tripe.c b/wireshark/packet-tripe.c index 5ea7b978..28bfc83e 100644 --- a/wireshark/packet-tripe.c +++ b/wireshark/packet-tripe.c @@ -1,13 +1,11 @@ /* -*-c-*- - * - * $Id$ * * TrIPE protocol dissector for Wireshark * * (c) 2003 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of Trivial IP Encryption (TrIPE). * @@ -15,12 +13,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * TrIPE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with TrIPE; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -85,7 +83,7 @@ static void prefcb(void) { } static gint gethash(proto_tree *tt, int hf, tvbuff_t *b, gint off) { proto_tree_add_item(tt, hf, b, off, hashsz, FALSE); - return (off + hashsz); + return (off + hashsz); } static gint getmp(proto_tree *tt, const hfmp *hf, tvbuff_t *b, gint off) @@ -119,7 +117,7 @@ static gint getge(proto_tree *tt, const hfge *hf, tvbuff_t *b, gint off) proto_tree_add_item(tt, hf->hfy_len, b, off + 2 + len, 2, FALSE); proto_tree_add_item(tt, hf->hfy_val, b, off + 4 + len, len2, FALSE); r = off + len + len2 + 4; - } + } return (r); } @@ -133,86 +131,82 @@ static void dissect_tripe(tvbuff_t *b, packet_info *p, proto_tree *t) /* --- Initialize the summary cells --- */ - if (check_col(p->cinfo, COL_PROTOCOL)) - col_set_str(p->cinfo, COL_PROTOCOL, "TrIPE"); - if (check_col(p->cinfo, COL_INFO)) - col_clear(p->cinfo, COL_INFO); + col_set_str(p->cinfo, COL_PROTOCOL, "TrIPE"); + col_clear(p->cinfo, COL_INFO); ty = tvb_get_guint8(b, 0); - if (check_col(p->cinfo, COL_INFO)) { - col_clear(p->cinfo, COL_INFO); - switch (ty & MSG_CATMASK) { - case MSG_PACKET: - switch (ty & MSG_TYPEMASK) { - case 0: - col_set_str(p->cinfo, COL_INFO, "Packet data"); - break; - default: - col_add_fstr(p->cinfo, COL_INFO, - "Packet data, unknown type code %u", - ty & MSG_TYPEMASK); - break; - } - break; - case MSG_KEYEXCH: - switch (ty & MSG_TYPEMASK) { - case KX_PRECHAL: - col_set_str(p->cinfo, COL_INFO, "Key exchange, prechallenge"); - break; - case KX_CHAL: - col_set_str(p->cinfo, COL_INFO, "Key exchange, challenge"); - break; - case KX_REPLY: - col_set_str(p->cinfo, COL_INFO, "Key exchange, reply"); - break; - case KX_SWITCH: - col_set_str(p->cinfo, COL_INFO, "Key exchange, switch request"); - break; - case KX_SWITCHOK: - col_set_str(p->cinfo, COL_INFO, "Key exchange, switch response"); - break; - default: - col_add_fstr(p->cinfo, COL_INFO, - "Key exchange, unknown type code %u", - ty & MSG_TYPEMASK); - break; - } - break; - case MSG_MISC: - switch (ty & MSG_TYPEMASK) { - case MISC_NOP: - col_set_str(p->cinfo, COL_INFO, "Miscellaneous, no-operation"); - break; - case MISC_PING: - col_set_str(p->cinfo, COL_INFO, "Miscellaneous, transport ping"); - break; - case MISC_PONG: - col_set_str(p->cinfo, COL_INFO, - "Miscellaneous, transport ping reply"); - break; - case MISC_EPING: - col_set_str(p->cinfo, COL_INFO, "Miscellaneous, encrypted ping"); - break; - case MISC_EPONG: - col_set_str(p->cinfo, COL_INFO, - "Miscellaneous, encrypted ping reply"); - break; - case MISC_GREET: - col_set_str(p->cinfo, COL_INFO, - "Miscellaneous, greeting"); - break; - default: - col_add_fstr(p->cinfo, COL_INFO, - "Miscellaneous, unknown type code %u", - ty & MSG_TYPEMASK); - break; - } - break; - default: - col_add_fstr(p->cinfo, COL_INFO, - "Unknown category code %u, unknown type code %u", - ty & MSG_CATMASK, ty & MSG_TYPEMASK); - break; - } + col_clear(p->cinfo, COL_INFO); + switch (ty & MSG_CATMASK) { + case MSG_PACKET: + switch (ty & MSG_TYPEMASK) { + case 0: + col_set_str(p->cinfo, COL_INFO, "Packet data"); + break; + default: + col_add_fstr(p->cinfo, COL_INFO, + "Packet data, unknown type code %u", + ty & MSG_TYPEMASK); + break; + } + break; + case MSG_KEYEXCH: + switch (ty & MSG_TYPEMASK) { + case KX_PRECHAL: + col_set_str(p->cinfo, COL_INFO, "Key exchange, prechallenge"); + break; + case KX_CHAL: + col_set_str(p->cinfo, COL_INFO, "Key exchange, challenge"); + break; + case KX_REPLY: + col_set_str(p->cinfo, COL_INFO, "Key exchange, reply"); + break; + case KX_SWITCH: + col_set_str(p->cinfo, COL_INFO, "Key exchange, switch request"); + break; + case KX_SWITCHOK: + col_set_str(p->cinfo, COL_INFO, "Key exchange, switch response"); + break; + default: + col_add_fstr(p->cinfo, COL_INFO, + "Key exchange, unknown type code %u", + ty & MSG_TYPEMASK); + break; + } + break; + case MSG_MISC: + switch (ty & MSG_TYPEMASK) { + case MISC_NOP: + col_set_str(p->cinfo, COL_INFO, "Miscellaneous, no-operation"); + break; + case MISC_PING: + col_set_str(p->cinfo, COL_INFO, "Miscellaneous, transport ping"); + break; + case MISC_PONG: + col_set_str(p->cinfo, COL_INFO, + "Miscellaneous, transport ping reply"); + break; + case MISC_EPING: + col_set_str(p->cinfo, COL_INFO, "Miscellaneous, encrypted ping"); + break; + case MISC_EPONG: + col_set_str(p->cinfo, COL_INFO, + "Miscellaneous, encrypted ping reply"); + break; + case MISC_GREET: + col_set_str(p->cinfo, COL_INFO, + "Miscellaneous, greeting"); + break; + default: + col_add_fstr(p->cinfo, COL_INFO, + "Miscellaneous, unknown type code %u", + ty & MSG_TYPEMASK); + break; + } + break; + default: + col_add_fstr(p->cinfo, COL_INFO, + "Unknown category code %u, unknown type code %u", + ty & MSG_CATMASK, ty & MSG_TYPEMASK); + break; } /* --- Fill in the tree --- */ @@ -306,7 +300,7 @@ static void dissect_tripe(tvbuff_t *b, packet_info *p, proto_tree *t) proto_tree_add_item(ti, hf_tripe_ct_ct, b, off, -1, FALSE); goto done; done:; - } + } } void proto_register_tripe(void) @@ -468,7 +462,7 @@ void proto_reg_handoff_tripe(void) dissector_handle_t dh; dh = create_dissector_handle(dissect_tripe, proto_tripe); - dissector_add("udp.port", 22003, dh); + dissector_add_uint("udp.port", TRIPE_PORT, dh); } G_MODULE_EXPORT void plugin_reg_handoff(void)