From: Nick Y. <ni...@ho...> - 2004-06-08 15:02:20
|
Jon and Mark, Thank you very much! I will try it again according to your advises tomorrow! Best Regards, Nick >From: Jon Maloy <jon...@er...> >To: "Yin, Hu" <hu...@in...> >CC: Mark Haverkamp <ma...@os...>, tipc ><tip...@li...> >Subject: [Tipc-discussion] Re: TIPC protocol number! >Date: Tue, 08 Jun 2004 10:47:06 -0400 > >Hi, >There is only one number now, 0x88ca, which has been >registered with IEEE as the official TIPC protocol number. >The two numbers we were using earlier were not properly >registered, and can hence not be used in open environments. >And, as Mark said, the separation between the two is now >done in tipc_recv_msg. > >I don't know about tipcdump, but you should perhaps have >a look at the ethereal module we used in TIPCv1 (attached). >If we refurbish this one, we could make it available at SF. > >Regards /jon > >Yin, Hu wrote: > >>Hello Jon and Mark, >> >>Now I'm trying to enable tipcdump to work on TIPCv2, which developed by >>Ling Xiaofeng and can work on TIPCv1. Through investigating I find maybe >>you have changed the number of TIPC >>configuration protocol from 0x0807 to 0x88ca and the number of TIPC >>message protocol from 0x0807 to 0x0800, >>thus tipcdump cannot scratch the package with different protocol number at >>the same time. And we cannot >>distinguish the TIPC package from the >>general IP package if we use protocol number 0x0800. Is that correct? If >>it was correct how can we solve this problem? Thank you in advance! >> >>Best Regards, >> >>Nick >> > > >/* >***************************************************************************** >** >** @(#) Id: >** @(#) File: packet-tipc.c >** @(#) Subsystem: >** @(#) Date: 2002/08/030 >** @(#) Time: 13:00:00 >** @(#) Revision: 1.0 >** @(#) Author: Martin Peterzon >** >** Copyright (C) 2002 by Ericsson Telecom. All rights reserved. >** >***************************************************************************** > >***************************************************************************** >** 2 HISTORY OF DEVELOPMENT. >***************************************************************************** >** date responsible notes >** -------- -------------------- >------------------------------------------ >** 02/08/30 Martin Peterzon Initial release. >** 03/04/28 Jon Maloy Some terminology changes >*/ > > >/* INSTALL > * Instructions how to install is at the end of this file. */ > > >/* packet-tipc.c > * Routines for TIPC dissection > * Martin Peterzon <ua...@ua...> > * > * $Id: README.developer,v 1.51 2002/03/18 00:20:18 guy Exp $ > * > * Ethereal - Network traffic analyzer > * By Gerald Combs <ge...@et...> > * Copyright 1998 Gerald Combs > * > * This program is free software; you can redistribute it and/or > * modify 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. > * > * This program 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 this program; if not, write to the Free Software > * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, >USA. > */ > > > >#ifdef HAVE_CONFIG_H ># include "config.h" >#endif > >#include <stdio.h> >#include <stdlib.h> >#include <string.h> > >#ifdef HAVE_SYS_TYPES_H ># include <sys/types.h> >#endif > >#ifdef HAVE_NETINET_IN_H ># include <netinet/in.h> >#endif > >#include <glib.h> > >#ifdef NEED_SNPRINTF_H ># include "snprintf.h" >#endif > >#include <epan/packet.h> >#include "etypes.h" > > >/* Initialize the protocol and registered fields */ >static int proto_tipc = -1; >static int hf_tipc_ver = -1; >static int hf_tipc_rr = -1; >static int hf_tipc_imp = -1; >static int hf_tipc_user = -1; >static int hf_tipc_err = -1; >static int hf_tipc_mtype = -1; >static int hf_tipc_octetcount = -1; >static int hf_tipc_ack = -1; >static int hf_tipc_seqno = -1; >static int hf_tipc_originproc = -1; >static int hf_tipc_originport = -1; >static int hf_tipc_destport = -1; >static int hf_tipc_sourceproc = -1; >static int hf_tipc_nametype = -1; >static int hf_tipc_nameid = -1; >static int hf_tipc_destlinks = -1; >static int hf_tipc_nameidupp = -1; >static int hf_tipc_nameidlow = -1; >static int hf_tipc_key = -1; >static int hf_tipc_portref = -1; >static int hf_tipc_pub = -1; >static int hf_tipc_nextsent = -1; >static int hf_tipc_gap = -1; >static int hf_tipc_bearerid = -1; >static int hf_tipc_msgcount = -1; >static int hf_tipc_ols = -1; >static int hf_tipc_msgcountasm = -1; >static int hf_tipc_cfgtype = -1; >static int hf_tipc_cfgzone = -1; >static int hf_tipc_cfgsubnet = -1; >static int hf_tipc_cfgproc = -1; >static int hf_tipc_cfgsysgenid = -1; >static int hf_tipc_cfgbearnn = -1; >static int hf_tipc_hdrsize = -1; >static int hf_tipc_msgsize = -1; >static int hf_tipc_ackllseqno = -1; >static int hf_tipc_llseqno = -1; >static int hf_tipc_prevproc = -1; >static int hf_tipc_actid = -1; >static int hf_tipc_destproc = -1; >static int hf_tipc_portnametype = -1; >static int hf_tipc_portnameinst = -1; >static int hf_tipc_linksel = -1; >static int hf_tipc_probe = -1; >static int hf_tipc_remoteadr = -1; >static int hf_tipc_seqgap = -1; >static int hf_tipc_nextsentpack = -1; >static int hf_tipc_netwid = -1; >static int hf_tipc_linkprio = -1; >static int hf_tipc_linktolerance = -1; >static int hf_tipc_ifname = -1; > >/* Initialize the subtree pointer */ >static gint ett_tipc = -1; > > >/* Table of importances */ >gchar *imp_list[] = { > "Low", > "Normal", > "High", > "Non Rejectable", >}; > >/* Table of users for version 0*/ >gchar *user_list_v0[] = { > "Data", > "", > "", > "", > "Name Manager", > "Connection Manager", > "Link Protocol Handler", > "Changeover Protocol Handler", > "Transport Protocol Handler", > "Segmentation Manager", > "Message Bundler", >}; > >/* Table of users for version 1*/ >gchar *user_list_v1[] = { > "Data", > "Data", > "Data", > "Data", > "", > "", > "", > "", > "Routing Manager", > "Name Distributor", > "Connection Manager", > "Link Protocol", > "", > "Changeover Protocol", > "Segmentation Manager", > "Message Bundler", >}; > >/* Table of errors for version 0 */ >gchar *err_list_v0[] = { > "Ok", > "No Port Name", > "No Remote Port", > "No Remote Processor", > "Destination Overload", > "No Connection", > "Not defined", > "", > "", > "", > "", > "", > "", > "", > "", > "", >}; > >/* Table of errors for version 1 */ >gchar *err_list_v1[] = { > "Ok", > "No Port Name", > "No Remote Port", > "No Remote Processor", > "Destination Overload", > "", > "No Connection", > "Communication Error", > "", > "", > "", > "", > "", > "", > "", > "", >}; > >/* Table of message types, depends on user */ >gchar *mtype_list_v0[18][11] = { > {"Warning >Connected","","","","Publication","","","Duplicate","","","Open"}, > {"Connected","","","","Withdrawal","","","Redirect","","","Closed"}, > {"Named","","","","Bulk publication","","","","Info","",""}, > {"Direct","","","","","","","","","",""}, > {"Overload Warning","","","","","","","","","",""}, > {"","","","","","","","","","",""}, > {"","","","","","","","","","",""}, > {"","","","","","","","","","",""}, > {"","","","","","","","","","",""}, > {"","","","","","","","","","",""}, > {"","","","","","","Reset","","","",""}, > {"","","","","","","Activate","","","",""}, > {"","","","","","","Ack","","","",""}, > {"","","","","","","Reply","","","",""}, > {"","","","","","","Nack","","","",""}, > {"","","","","","","Probe","","","",""}, > {"","","","","","Port Probe","ProbeReply","","","",""}, > {"","","","","","Port Probe Reply","","","","",""}, >}; > >gchar *mtype_list_v1[13][16] = { > {"Connected","Connected","Connected","Connected","","","","","Ext Routing >Table","Publication","Connection Probe","","","Duplicate Message","",""}, > {"","","","","","","","","Local Routing Table","Withdrawal","Connection >Probe Reply","","","Original Message","First Segment",""}, > {"Named","Named","Named","Named","","","","","DP Routing >Table","","","","","Info Message","Segment"}, > {"Direct","Direct","Direct","Named","","","","","Route >Addition","","","","","","",""}, > {"Overload","Overload","Overload","Overload","","","","","Route >Removal","","","","","","",""}, > {"","","","","","","","","","","","","","","",""}, > {"","","","","","","","","","","","","","","",""}, > {"","","","","","","","","","","","","","","",""}, > {"","","","","","","","","","","","","","","",""}, > {"","","","","","","","","","","","","","","",""}, > {"","","","","","","","","","","","Reset Message","","","",""}, > {"","","","","","","","","","","","Activate Message","","","",""}, > {"","","","","","","","","","","","State Message","","","",""}, >}; > > > > > >/* Code that dissects packets of ethernet type (a type definition > of the payload of an ethernet packet, that is which protocol that > is on the next level) 0x0807. This number indicates that it is > an usual TIPC message. */ >static void >dissect_tipc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) >{ > > proto_item *ti; > proto_tree *tipc_tree; > gint first_word[4]; > gint version, ipc_user, mtype, pub, hdr_size, msg_size; > char temp[30]; > int i; > int data_start, data_length; > > /* Load the first four bytes in an array. */ > for(i=0; i<4; i++) > first_word[i] = tvb_get_guint8(tvb, i); > > /* Version is set by the first three bits */ > version = (first_word[0] & 0xe0) >> 5; > > if(version == 0) { > ipc_user = first_word[2] & 0x0f; > mtype = first_word[3] & 0x1f; > /* Make sure that there is no access outside name arrays. New values >point > to elements with empty strings */ > if(ipc_user > 10) > ipc_user = 1; > if(mtype > 17) > mtype = 5; > } > > if(version == 1) { > ipc_user = (first_word[0] & 0x1e) >> 1; > hdr_size = (first_word[0] & 0x01) * 32 + ((first_word[1] & 0xe0) >> 3); > msg_size = 65536*(first_word[1] & 0x01) + first_word[2] * 256 + >first_word[3]; > mtype = (tvb_get_guint8(tvb,20) & 0xf0) >> 4; > /* Make sure that there is no access outside name arrays. New values >point > to elements with empty strings */ > if(ipc_user > 15) > ipc_user = 3; > if(mtype > 12) > mtype = 5; > if (hdr_size == 20) > mtype = 0; > } > > /* Make entry in Protocol column on summary display */ > if (check_col(pinfo->cinfo, COL_PROTOCOL)) > col_set_str(pinfo->cinfo, COL_PROTOCOL, "TIPC"); > > /* User and mtype is diplayed in summary window */ > if (check_col(pinfo->cinfo, COL_INFO) && version == 0) { > col_clear(pinfo->cinfo, COL_INFO); > col_add_str(pinfo->cinfo, COL_INFO, user_list_v0[ipc_user]); > col_append_str(pinfo->cinfo, COL_INFO, ", "); > col_append_str(pinfo->cinfo, COL_INFO, mtype_list_v0 [mtype][ipc_user]); > } > if (check_col(pinfo->cinfo, COL_INFO) && version == 1) { > sprintf(temp,"%s %u", mtype_list_v1 >[mtype][ipc_user],tvb_get_ntohs(tvb, 6)); > col_clear(pinfo->cinfo, COL_INFO); > col_add_str(pinfo->cinfo, COL_INFO, user_list_v1[ipc_user]); > col_append_str(pinfo->cinfo, COL_INFO, ", "); > //col_append_str(pinfo->cinfo, COL_INFO, mtype_list_v1 >[mtype][ipc_user]); > col_append_str(pinfo->cinfo, COL_INFO, temp); > } > > /* If "tree" is NULL, not necessary to generate protocol tree items. */ > if (tree) { > > /* create display subtree for the protocol */ > ti = proto_tree_add_item(tree, proto_tipc, tvb, 0, -1, FALSE); > tipc_tree = proto_item_add_subtree(ti, ett_tipc); > > /* This is where the creation of the protocol tree starts. The > specification of the TIPC protocol version 0 can be found in > the document UAB/F-00:101, PA5. To be able to understand the > code, this document is probably necessary. */ > > if( version == 0 ) { > > /* Adding header for version 0 of the protocol. This is equal > for all TIPC messages. Header includes version, reroute > counter, importance, user, error, message type, octet count, > ack, sequence number and origin processor. */ > proto_tree_add_uint(tipc_tree, hf_tipc_ver, tvb, 0, 1, > version); > proto_tree_add_uint(tipc_tree, hf_tipc_rr, tvb, 0, 1, > (first_word[0] & 0x0f) >> 1); > proto_tree_add_string(tipc_tree, hf_tipc_imp, tvb, 2, 1, > imp_list[(first_word[2] & 0x30) >> 4]); > proto_tree_add_string(tipc_tree, hf_tipc_user, tvb, 2, 1, > user_list_v0[ipc_user]); > proto_tree_add_string(tipc_tree, hf_tipc_err, tvb, 3, 1, > err_list_v0[(first_word[3] & 0xe0) >> 5]); > proto_tree_add_string(tipc_tree, hf_tipc_mtype, tvb, 3, 1, > mtype_list_v0 [mtype][ipc_user]); > proto_tree_add_uint(tipc_tree, hf_tipc_octetcount, tvb, 6, 2, > tvb_get_ntohs(tvb, 6)); > proto_tree_add_uint(tipc_tree, hf_tipc_ack, tvb, 8, 2, > tvb_get_ntohs(tvb, 8)); > proto_tree_add_uint(tipc_tree, hf_tipc_seqno, tvb, 10, 2, > tvb_get_ntohs(tvb, 10)); > sprintf(temp, "%d.%d.%d", tvb_get_guint8(tvb, 12), > tvb_get_ntohs(tvb, 13) >> 4, > tvb_get_ntohs(tvb, 14) & 0x0fff); > proto_tree_add_string(tipc_tree, hf_tipc_originproc, tvb, 12, 4, > temp); > > > /* Depending on which TIPC user the packet has the interpretation > will look different. This case statement deals with all > possible packets types. At the end of every case the data_start > integer is set to the position where the data part of the > message starts. */ > > switch(ipc_user) { > case 0: > > /* Create subtree > tp = proto_tree_add_text(tipc_tree, tvb, 16, -1, "Ports", NULL); > tipc_tree_p = proto_item_add_subtree(tp, ett_tipc_ports); */ > > /* All data message with user 0 includes origin port and dest. > port. Depending on message type some more fields might > be included. */ > proto_tree_add_uint(tipc_tree, hf_tipc_originport, tvb, 16, 4, > tvb_get_ntohl(tvb,16)); > proto_tree_add_uint(tipc_tree, hf_tipc_destport, tvb, 20, 4, > tvb_get_ntohl(tvb,20)); > > /* Data message with user 0 and mtype 2 contains source > processor, name type and name identity. */ > if (mtype == 2) { > temp[0] = '\0'; > sprintf(temp, "%d.%d.%d", tvb_get_guint8(tvb, 28), > tvb_get_ntohs(tvb, 29) >> 4, > tvb_get_ntohs(tvb, 30) & 0x0fff); > proto_tree_add_string(tipc_tree, hf_tipc_sourceproc, tvb, 28, 4, > temp); > proto_tree_add_uint(tipc_tree, hf_tipc_nametype, tvb, 32, 4, > tvb_get_ntohl(tvb,32)); > proto_tree_add_uint(tipc_tree, hf_tipc_nameid, tvb, 36, 4, > tvb_get_ntohl(tvb,36)); > data_start = 40; > } > > > /* Data message with user 0 and mtype 3 contains source > processor */ > else if (mtype == 3) { > temp[0] = '\0'; > sprintf(temp, "%d.%d.%d", tvb_get_guint8(tvb, 28), > tvb_get_ntohs(tvb, 29) >> 4, > tvb_get_ntohs(tvb, 30) & 0x0fff); > proto_tree_add_string(tipc_tree, hf_tipc_sourceproc, tvb, 28, 4, > temp); > data_start = 32; > } > > /* Data message with user 0 and mtype 0,1 or 4 contains > no further fields. */ > else { > data_start = 28; > } > > break; > > case 4: > > /* Name manager message with user 4 all contains destination > link selector and the message type (that is not displayed > in the tree. */ > proto_tree_add_uint(tipc_tree, hf_tipc_destlinks, tvb, 16, 4, > tvb_get_ntohl(tvb,16)); > > > /* Name manager messages with user 4 and mtype 0 contains > name type, name identity lower, name identity upper, > origin port and key. */ > if (mtype == 0) { > proto_tree_add_uint(tipc_tree, hf_tipc_nametype, tvb, 24, 4, > tvb_get_ntohl(tvb,24)); > proto_tree_add_uint(tipc_tree, hf_tipc_nameidlow, tvb, 28, 4, > tvb_get_ntohl(tvb,28)); > proto_tree_add_uint(tipc_tree, hf_tipc_nameidupp, tvb, 32, 4, > tvb_get_ntohl(tvb,32)); > proto_tree_add_uint(tipc_tree, hf_tipc_originport, tvb, 36, 4, > tvb_get_ntohl(tvb,36)); > proto_tree_add_uint(tipc_tree, hf_tipc_key, tvb, 40, 4, > tvb_get_ntohl(tvb,40)); > data_start = 44; > } > > /* Name manager messages with user 4 and mtype 1 contains > name type, name identity lower and key. */ > else if (mtype == 1) { > proto_tree_add_uint(tipc_tree, hf_tipc_nametype, tvb, 24, 4, > tvb_get_ntohl(tvb,24)); > proto_tree_add_uint(tipc_tree, hf_tipc_nameidlow, tvb, 28, 4, > tvb_get_ntohl(tvb,28)); > proto_tree_add_uint(tipc_tree, hf_tipc_key, tvb, 32, 4, > tvb_get_ntohl(tvb,32)); > data_start = 36; > } > > /* Name manager messages with user 4 and mtype 2 contains > publication (that tells the number of publication to > follow). After this field comes the publications that > contains name type, name identity lower, name identity > upper, port reference and key. */ > else { > pub = tvb_get_ntohl(tvb,24); > proto_tree_add_uint(tipc_tree, hf_tipc_pub, tvb, 24, 4, > pub); > for(i=0; i<pub; i++) { > proto_tree_add_uint(tipc_tree, hf_tipc_nametype, tvb, 28+20*i, 4, > tvb_get_ntohl(tvb,28+20*i)); > proto_tree_add_uint(tipc_tree, hf_tipc_nameidlow, tvb, 32+20*i, 4, > tvb_get_ntohl(tvb,32+20*i)); > proto_tree_add_uint(tipc_tree, hf_tipc_nameidupp, tvb, 36+20*i, 4, > tvb_get_ntohl(tvb,36+20*i)); > proto_tree_add_uint(tipc_tree, hf_tipc_portref, tvb, 40+20*i, 4, > tvb_get_ntohl(tvb,40+20*i)); > proto_tree_add_uint(tipc_tree, hf_tipc_key, tvb, 44+20*i, 4, > tvb_get_ntohl(tvb,44+20*i)); > } > data_start = 28 + i*20; > } > break; > case 5: > > /* Connection manager message with user 5 contains origin > port and destination port. */ > > proto_tree_add_uint(tipc_tree, hf_tipc_originport, tvb, 16, 4, > tvb_get_ntohl(tvb,16)); > proto_tree_add_uint(tipc_tree, hf_tipc_destport, tvb, 20, 4, > tvb_get_ntohl(tvb,20)); > data_start = 28; > break; > > case 6: > > /* Link protocol message with user 6 contains next message > to be sent, number of messages need to be retransmitted > and bearer identification. */ > > proto_tree_add_uint(tipc_tree, hf_tipc_nextsent, tvb, 16, 4, > tvb_get_ntohl(tvb,16)); > proto_tree_add_uint(tipc_tree, hf_tipc_gap, tvb, 20, 4, > tvb_get_ntohl(tvb,20)); > proto_tree_add_uint(tipc_tree, hf_tipc_bearerid, tvb, 27, 1, > tvb_get_guint8(tvb, 23) & 0x3f); > data_start=28; > break; > > case 7: > > /* Changeover protocol message with user 7 contains dest. > link selector, message count and berared id. */ > > proto_tree_add_uint(tipc_tree, hf_tipc_destlinks, tvb, 16, 4, > tvb_get_ntohl(tvb,16)); > proto_tree_add_uint(tipc_tree, hf_tipc_msgcount, tvb, 21, 2, > tvb_get_ntohs(tvb,21)); > proto_tree_add_uint(tipc_tree, hf_tipc_bearerid, tvb, 23, 1, > tvb_get_guint8(tvb, 23) & 0x3f); > data_start=24; > break; > > case 9: > > /* Segmentation manager message with user 9 includes dest. > link selector and original link selector. */ > > proto_tree_add_uint(tipc_tree, hf_tipc_destlinks, tvb, 16, 4, > tvb_get_ntohl(tvb,16)); > proto_tree_add_uint(tipc_tree, hf_tipc_ols, tvb, 23, 1, > tvb_get_guint8(tvb,23) & 0x07); > data_start = 24; > break; > > case 10: > > /* Message assembler message with user 10 includes dest. > link selector and message count. */ > > proto_tree_add_uint(tipc_tree, hf_tipc_destlinks, tvb, 16, 4, > tvb_get_ntohl(tvb,16)); > proto_tree_add_uint(tipc_tree, hf_tipc_msgcountasm, tvb, 20, 4, > tvb_get_ntohl(tvb,20)); > data_start = 24; > break; > > default: > > /* If no valid user can be found, the rest of the packet is > interpreted as data, since it's impossible to interpret > any more. */ > > data_start = 16; > break; > } > > /* The rest of the packet is data */ > data_length = tvb_get_ntohs(tvb, 6) - data_start; > temp[0] = '\0'; > sprintf(temp, "Data (%d bytes)", data_length); > proto_tree_add_text(tree, tvb, data_start, data_length, temp, NULL); > > } > > > /* Documentation for version 1 of the protocol: LMC/JO-01:006 */ > > if(version == 1) { > > /* All packets have the same fields in the first 3 words. > These contains version, user, header size, message size, > acknowledged link level sequence number, link level > sequence number and previous processor. */ > > proto_tree_add_uint(tipc_tree, hf_tipc_ver, tvb, 0, 1, > version); > proto_tree_add_string(tipc_tree, hf_tipc_user, tvb, 0, 1, > user_list_v1[ipc_user]); > proto_tree_add_uint(tipc_tree, hf_tipc_hdrsize, tvb, 0, 2, > hdr_size); > proto_tree_add_uint(tipc_tree, hf_tipc_msgsize, tvb, 1, 3, > msg_size); > proto_tree_add_uint(tipc_tree, hf_tipc_ackllseqno, tvb, 4, 2, > tvb_get_ntohs(tvb, 4)); > proto_tree_add_uint(tipc_tree, hf_tipc_llseqno, tvb, 6, 2, > tvb_get_ntohs(tvb, 6)); > temp[0] = '\0'; > sprintf(temp, "%d.%d.%d", tvb_get_guint8(tvb, 8), > tvb_get_ntohs(tvb, 9) >> 4, > tvb_get_ntohs(tvb, 10) & 0x0fff); > proto_tree_add_string(tipc_tree, hf_tipc_prevproc, tvb, 8, 4, > temp); > data_start = 12; > > /* If there is a data packet the user is 0,1,2 or 3. This also tells > the importance of the data packet. There are three different sizes > of headers for data packets: 20 bytes, 32 bytes and 40 bytes. All > of them contains originating port and destination port. */ > > if(ipc_user <= 3) { > > proto_tree_add_string(tipc_tree, hf_tipc_imp, tvb, 0, 1, > imp_list[ipc_user]); > proto_tree_add_uint(tipc_tree, hf_tipc_originport, tvb, 12, 4, > tvb_get_ntohl(tvb,12)); > proto_tree_add_uint(tipc_tree, hf_tipc_destport, tvb, 16, 4, > tvb_get_ntohl(tvb,16)); > proto_tree_add_string(tipc_tree, >hf_tipc_mtype, tvb, 20, 1, > >mtype_list_v1 [mtype][ipc_user]); > data_start = 20; > > if(hdr_size > 20) { > > /* Data packet of header size 32 and 40 contains message type, > error code, reroute counter, activity identity, originating > processor and destination processor. */ > > proto_tree_add_string(tipc_tree, hf_tipc_err, tvb, 20, 1, > err_list_v1 [tvb_get_guint8(tvb, 20) & 0x0f]); > proto_tree_add_uint(tipc_tree, hf_tipc_rr, tvb, 21, 1, > (tvb_get_guint8(tvb, 21) & 0xf0) >> 4); > proto_tree_add_uint(tipc_tree, hf_tipc_actid, tvb, 21, 3, > (tvb_get_guint8(tvb, 21) & 0x0f) * 65536 + > tvb_get_ntohs(tvb, 22)); > temp[0] = '\0'; > sprintf(temp, "%d.%d.%d", tvb_get_guint8(tvb, 24), > tvb_get_ntohs(tvb, 25) >> 4, > tvb_get_ntohs(tvb, 26) & 0x0fff); > proto_tree_add_string(tipc_tree, hf_tipc_originproc, tvb, 24, 4, > temp); > temp[0] = '\0'; > sprintf(temp, "%d.%d.%d", tvb_get_guint8(tvb, 28), > tvb_get_ntohs(tvb, 29) >> 4, > tvb_get_ntohs(tvb, 30) & 0x0fff); > proto_tree_add_string(tipc_tree, hf_tipc_destproc, tvb, 28, 4, > temp); > data_start = 32; > > if(hdr_size > 32) { > > /* Data packet of header size 40 contains port name type/ > connection level sequence number and port name instance. */ > > proto_tree_add_uint(tipc_tree, hf_tipc_portnametype, tvb, 32, 4, > tvb_get_ntohl(tvb,32)); > proto_tree_add_uint(tipc_tree, hf_tipc_portnameinst, tvb, 36, 4, > tvb_get_ntohl(tvb,36)); > data_start = 40; > > } > > } > > } > > /* For internal protocols in TIPC word 3-6 have the same fields, >althought > which fields that are used depends on which user, and sometimes which > message type, that is in the packet. These fields contain importance, > link selector, message count, probe, bearer id, remote address, >message > type, sequence gap and next sent packet. */ > > else if(ipc_user > 7 && ipc_user < 16) { > > if(ipc_user == 14) > proto_tree_add_string(tipc_tree, hf_tipc_imp, tvb, 12, 1, > imp_list[(tvb_get_guint8(tvb,12) & 0x18) >> 3]); > if(ipc_user == 9 || ipc_user == 13 || ipc_user == 14) > proto_tree_add_uint(tipc_tree, hf_tipc_linksel, tvb, 12, 1, > tvb_get_guint8(tvb,12) & 0x07); > if(ipc_user == 13 || ipc_user == 15) > proto_tree_add_uint(tipc_tree, hf_tipc_msgcount, tvb, 13, 2, > tvb_get_ntohs(tvb,13)); > if(ipc_user == 11 && mtype == 12) > proto_tree_add_uint(tipc_tree, hf_tipc_probe, tvb, 15, 1, > (tvb_get_guint8(tvb,15) & 0x40) >> 6); > if(ipc_user == 11 || ipc_user == 13) > proto_tree_add_uint(tipc_tree, hf_tipc_bearerid, tvb, 15, 1, > (tvb_get_guint8(tvb,15) & 0x38) >> 3); > if(ipc_user == 8) > proto_tree_add_uint(tipc_tree, hf_tipc_remoteadr, tvb, 16, 4, > tvb_get_ntohl(tvb,16)); > if(ipc_user == 9){ > unsigned int i = 40; > proto_tree_add_uint(tipc_tree, hf_tipc_pub, tvb, 44, >4,(msg_size-28)/25); > for (;i < msg_size;i+=20) > { > proto_tree_add_uint(tipc_tree, hf_tipc_nametype, tvb, i, 4, > tvb_get_ntohl(tvb,i)); > proto_tree_add_uint(tipc_tree, hf_tipc_nameidlow, tvb, i+4, 4, > tvb_get_ntohl(tvb,i+4)); > proto_tree_add_uint(tipc_tree, hf_tipc_nameidupp, tvb, i+8, 4, > tvb_get_ntohl(tvb,i+8)); > proto_tree_add_uint(tipc_tree, hf_tipc_portref, tvb, i+12, 4, > tvb_get_ntohl(tvb,i+12)); > proto_tree_add_uint(tipc_tree, hf_tipc_key, tvb, i+16, 4, > tvb_get_ntohl(tvb,i+16)); > } > } > if(ipc_user != 15 && ipc_user != 12) > proto_tree_add_string(tipc_tree, hf_tipc_mtype, tvb, 20, 1, > mtype_list_v1 [mtype][ipc_user]); > if(ipc_user == 11 && mtype == 12) > proto_tree_add_uint(tipc_tree, hf_tipc_seqgap, tvb, 20, 2, > tvb_get_ntohs(tvb,20) & 0x0fff); > if(ipc_user == 11){ > proto_tree_add_uint(tipc_tree, hf_tipc_nextsentpack, tvb, 22, 2, > tvb_get_ntohs(tvb,22)); > if(msg_size == 48) // Compatibility. > { > unsigned int i = 0; > char netwid[2] = >{((tvb_get_ntohs(tvb,12)&0xe000)>>13)+'A',0}; > proto_tree_add_string(tipc_tree, hf_tipc_netwid, tvb, 12, 1,netwid); > if (mtype != 12) // RESET or >ACTIVATE msg > { > proto_tree_add_uint(tipc_tree, >hf_tipc_linkprio, tvb, 24, 4, > (tvb_get_ntohl(tvb,24)&0x000f8000)>>15); > proto_tree_add_uint(tipc_tree, >hf_tipc_linktolerance, tvb, 24, 4, > (tvb_get_ntohl(tvb,24)&0x00007fff)); > memset(temp,0,sizeof(temp)); > for (;i<=20;i++) { > temp[i] = >tvb_get_guint8(tvb,28+i); > } > proto_tree_add_string(tipc_tree, hf_tipc_ifname, tvb, 28, 1,temp); > } > } > } > data_start = 28; > } > > /* The rest of the packet is data */ > data_length = msg_size - data_start; > temp[0] = '\0'; > sprintf(temp, "Data (%d bytes)", data_length); > proto_tree_add_text(tree, tvb, data_start, data_length, temp, NULL); > > } > } > >} > > > >/* Code that dissects packets of ethernet type 0x0808, which are used > as Ethernet alive messages. */ > >static void >dissect_tipc_cfg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) >{ > proto_item *ti; > proto_tree *tipc_tree; > char msg_type[30]; > > /* Maps message type numbers to explaining strings */ > switch(tvb_get_ntohl(tvb,0)) { > case 226398408: strcpy(msg_type, "Configuration, Broadcast Link >Request"); break; > case 382530916: strcpy(msg_type, "Configuration, Unicast Link Request"); >break; > default: strcpy(msg_type, "Not defined"); break; > } > > /* Make entry in Protocol column on summary display */ > if (check_col(pinfo->cinfo, COL_PROTOCOL)) > col_set_str(pinfo->cinfo, COL_PROTOCOL, "TIPC"); > > /* Make entry in Info column on summary display */ > if (check_col(pinfo->cinfo, COL_INFO)) { > col_clear(pinfo->cinfo, COL_INFO); > col_add_str(pinfo->cinfo, COL_INFO, msg_type); > } > > /* If "tree" is NULL, not necessary to generate protocol tree items. */ > if (tree) { > > /* create display subtree for the protocol */ > ti = proto_tree_add_item(tree, proto_tipc, tvb, 0, 24, FALSE); > tipc_tree = proto_item_add_subtree(ti, ett_tipc); > > /* This is where the creation of the protocol tree starts. The > specification of the IPC protocol version 0 can be found in > the document UAB/F-00:101, PA5. To be able to understand the > code, this document is probably necessary. > > This protocol look similar in version 1. > > An ethernet alive message contains message type, zone, subnet, > processor, system generation id and bearer name no. */ > > proto_tree_add_string(tipc_tree, hf_tipc_cfgtype, tvb, 0, 4, > msg_type); > proto_tree_add_uint(tipc_tree, hf_tipc_cfgzone, tvb, 4, 4, > tvb_get_ntohl(tvb,4)); > proto_tree_add_uint(tipc_tree, hf_tipc_cfgsubnet, tvb, 8, 4, > tvb_get_ntohl(tvb,8)); > proto_tree_add_uint(tipc_tree, hf_tipc_cfgproc, tvb, 12, 4, > tvb_get_ntohl(tvb,12)); > /* Obsolete: > proto_tree_add_uint(tipc_tree, hf_tipc_cfgsysgenid, tvb, 16, 4, > tvb_get_ntohl(tvb,16)); > proto_tree_add_uint(tipc_tree, hf_tipc_cfgbearnn, tvb, 20, 4, > tvb_get_ntohl(tvb,20)); > */ > > } > >} > > >/* Register TIPC with Ethereal */ >void >proto_register_tipc(void) >{ > > static hf_register_info hf[] = { > > { &hf_tipc_ver, > { "Version", "tipc.ver", > FT_UINT8, BASE_DEC, NULL, 0x0, > "TIPC protocol version", HFILL } > }, > > { &hf_tipc_rr, > { "Reroute counter", "tipc.rr", > FT_UINT8, BASE_DEC, NULL, 0x0, > "Reroute counter for NAS", HFILL } > }, > > { &hf_tipc_imp, > { "Importance", "tipc.ump", > FT_STRING, BASE_DEC, NULL, 0x0, > "Importance of data message", HFILL } > }, > > { &hf_tipc_user, > { "TIPC user", "tipc.user", > FT_STRING, BASE_DEC, NULL, 0x0, > "TIPC user", HFILL } > }, > > { &hf_tipc_err, > { "Error code", "tipc.err", > FT_STRING, BASE_DEC, NULL, 0x0, > "Error code for data", HFILL } > }, > > { &hf_tipc_mtype, > { "Message type", "tipc.mtype", > FT_STRING, BASE_DEC, NULL, 0x0, > "Message type", HFILL } > }, > > { &hf_tipc_octetcount, > { "Octet count", "tipc.octetcount", > FT_UINT16, BASE_DEC, NULL, 0x0, > "Number of bytes in message, including the header", HFILL } > }, > > { &hf_tipc_ack, > { "Acknowledged", "tipc.ack", > FT_UINT16, BASE_DEC, NULL, 0x0, > "The value of seq. no. for most recently accepted message", HFILL } > }, > > { &hf_tipc_seqno, > { "Sequence number", "tipc.seqno", > FT_UINT16, BASE_DEC, NULL, 0x0, > "The sequence number of the message", HFILL } > }, > > { &hf_tipc_originproc, > { "Sending processor", "tipc.originproc", > FT_STRING, BASE_DEC, NULL, 0x0, > "Processor ID of the processor on sending link", HFILL } > }, > > { &hf_tipc_originport, > { "Originating port", "tipc.originport", > FT_UINT32, BASE_DEC, NULL, 0x0, > "Port number of the port that is the origin of the message", HFILL } > }, > > { &hf_tipc_destport, > { "Destination port", "tipc.destport", > FT_UINT32, BASE_DEC, NULL, 0x0, > "Port number for the destination port at the receiving link end", HFILL >} > }, > > { &hf_tipc_sourceproc, > { "Source processor", "tipc.sourceproc", > FT_STRING, BASE_DEC, NULL, 0x0, > "Processor ID of the first orgin processor", HFILL } > }, > > { &hf_tipc_nametype, > { "Name Type", "tipc.nametype", > FT_UINT32, BASE_DEC, NULL, 0x0, > "Destination port name type", HFILL } > }, > > { &hf_tipc_nameid, > { "Name instance", "tipc.nameid", > FT_UINT32, BASE_DEC, NULL, 0x0, > "Destination port name instance", HFILL } > }, > > { &hf_tipc_destlinks, > { "Destination link selector","tipc.destlinks", > FT_UINT32, BASE_DEC, NULL, 0x0, > "Destination link selector", HFILL } > }, > > { &hf_tipc_nameidlow, > { "Name instance lower","tipc.nameidlow", > FT_UINT32, BASE_DEC, NULL, 0x0, > "Destination port name sequence, lower limit", HFILL } > }, > > { &hf_tipc_nameidupp, > { "Name instance upper","tipc.nameidupp", > FT_UINT32, BASE_DEC, NULL, 0x0, > "Destination port name sequence, upper limit", HFILL } > }, > > { &hf_tipc_key, > { "Key","tipc.key", > FT_UINT32, BASE_DEC, NULL, 0x0, > "Publication identifier", HFILL } > }, > > { &hf_tipc_portref, > { "Port number", "tipc.portref", > FT_UINT32, BASE_DEC, NULL, 0x0, > "Ephemeral port representing this publication", HFILL } > }, > > { &hf_tipc_pub, > { "Publications", "tipc.pub", > FT_UINT32, BASE_DEC, NULL, 0x0, > "Publications in this message", HFILL } > }, > > { &hf_tipc_nextsent, > { "Next message", "tipc.nextsent", > FT_UINT32, BASE_DEC, NULL, 0x0, > "Next message to be sent that is not a link protocol message", HFILL } > }, > > { &hf_tipc_gap, > { "Need transmission", "tipc.gap", > FT_UINT32, BASE_DEC, NULL, 0x0, > "Number of non-link protocol messages that needs retransmission", HFILL >} > }, > > { &hf_tipc_bearerid, > { "Bearer", "tipc.bearerid", > FT_UINT8, BASE_DEC, NULL, 0x0, > "Uniquely identifies bearer", HFILL } > }, > > { &hf_tipc_msgcount, > { "Message count", "tipc.msgcount", > FT_UINT16, BASE_DEC, NULL, 0x0, > "Message count", HFILL } > }, > > { &hf_tipc_ols, > { "Origin link selector","tipc.ols", > FT_UINT8, BASE_DEC, NULL, 0x0, > "Original link selector", HFILL } > }, > > { &hf_tipc_msgcountasm, > { "Message count", "tipc.msgcountasm", > FT_UINT32, BASE_DEC, NULL, 0x0, > "Number of piggybacked messages", HFILL } > }, > > { &hf_tipc_cfgtype, > { "Message type", "tipc.alitype", > FT_STRING, BASE_DEC, NULL, 0x0, > "Message type", HFILL } > }, > > { &hf_tipc_cfgzone, > { "Zone", "tipc.alizone", > FT_UINT32, BASE_DEC, NULL, 0x0, > "Zone", HFILL } > }, > > { &hf_tipc_cfgsubnet, > { "Subnet", "tipc.alisubnet", > FT_UINT32, BASE_DEC, NULL, 0x0, > "Subnet", HFILL } > }, > > { &hf_tipc_cfgproc, > { "Processor", "tipc.aliproc", > FT_UINT32, BASE_DEC, NULL, 0x0, > "Processor", HFILL } > }, > > { &hf_tipc_cfgsysgenid, > { "System generation","tipc.alisysgenid", > FT_UINT32, BASE_DEC, NULL, 0x0, > "System generation identification", HFILL } > }, > > { &hf_tipc_cfgbearnn, > { "Bearer name","tipc.alibearnn", > FT_UINT32, BASE_DEC, NULL, 0x0, > "Bearers coordinate name", HFILL } > }, > > { &hf_tipc_hdrsize, > { "Header size","tipc.hdrsize", > FT_UINT8, BASE_DEC, NULL, 0x0, > "Size of the header", HFILL } > }, > > { &hf_tipc_msgsize, > { "Message size","tipc.msgsize", > FT_UINT32, BASE_DEC, NULL, 0x0, > "Size of the message", HFILL } > }, > > { &hf_tipc_ackllseqno, > { "Ack link level seqno","tipc.ackllseqno", > FT_UINT16, BASE_DEC, NULL, 0x0, > "Acknowledgement sent by piggy back", HFILL } > }, > > { &hf_tipc_llseqno, > { "Link level seqno","tipc.llseqno", > FT_UINT16, BASE_DEC, NULL, 0x0, > "Sequence number to keep track of message flow", HFILL } > }, > > { &hf_tipc_prevproc, > { "Previous processor", "tipc.prevproc", > FT_STRING, BASE_DEC, NULL, 0x0, > "Processor ID of the last processor visited", HFILL } > }, > > { &hf_tipc_actid, > { "Activity identity", "tipc.actid", > FT_UINT32, BASE_DEC, NULL, 0x0, > "Activity identity", HFILL } > }, > > { &hf_tipc_destproc, > { "Destination processor", "tipc.destproc", > FT_STRING, BASE_DEC, NULL, 0x0, > "Final destination processor for a message", HFILL } > }, > > { &hf_tipc_portnametype, > { "Port name type", "tipc.portnametype", > FT_UINT32, BASE_DEC, NULL, 0x0, > "If no port name message, this is the connection sequence number", HFILL >} > }, > > { &hf_tipc_portnameinst, > { "Port name instance", "tipc.portnameinst", > FT_UINT32, BASE_DEC, NULL, 0x0, > "Port name instance", HFILL } > }, > > { &hf_tipc_linksel, > { "Link selector", "tipc.linksel", > FT_UINT8, BASE_DEC, NULL, 0x0, > "Link selector", HFILL } > }, > > { &hf_tipc_probe, > { "Probe", "tipc.probe", > FT_UINT8, BASE_DEC, NULL, 0x0, > "Instructs the receiving link end to immediatly respond", HFILL } > }, > > { &hf_tipc_remoteadr, > { "Next message", "tipc.remoteadr", > FT_UINT32, BASE_DEC, NULL, 0x0, > "Remote address", HFILL } > }, > > { &hf_tipc_seqgap, > { "Sequence gap", "tipc.seqgap", > FT_UINT16, BASE_DEC, NULL, 0x0, > "Size of gap detected in the senders received packet sequence", HFILL } > }, > > { &hf_tipc_nextsentpack, > { "Next sent packet", "tipc.nextsentpack", > FT_UINT16, BASE_DEC, NULL, 0x0, > "Current state of send queue", HFILL } > }, > { &hf_tipc_netwid, > { "Network", "tipc.netwid", > FT_STRING, BASE_DEC, NULL, 0x0, > "Name of logical network comprising this link", HFILL } > }, > { &hf_tipc_linkprio, > { "Link priority", "tipc.linkprio", > FT_UINT16, BASE_DEC, NULL, 0x0, > "Priority of this link", HFILL } > }, > { &hf_tipc_linktolerance, > { "Link tolerance", "tipc.linktolerance", > FT_UINT16, BASE_DEC, NULL, 0x0, > "Milliseconds of non-contact before link is declared faulty", HFILL } > }, > > { &hf_tipc_ifname, > { "Interface name", "tipc.ifname", > FT_STRING, BASE_DEC, NULL, 0x0, > "Sender's ethernet interface this associated with this network", HFILL } > }, > > }; > >/* Setup protocol subtree array */ > static gint *ett[] = { > &ett_tipc, > }; > >/* Register the protocol name and description */ > proto_tipc = proto_register_protocol("TelORB Inter Process Communication", > "TIPC", "tipc"); > >/* Required function calls to register the header fields and subtrees used >*/ > proto_register_field_array(proto_tipc, hf, array_length(hf)); > proto_register_subtree_array(ett, array_length(ett)); > >} > > >/* Register the connection between ethertype and TIPC. The identification > number for TIPC packets in Ethernet is 0x0807 and 0x0808. These are > defined in etypes.h */ >void >proto_reg_handoff_tipc(void) >{ > dissector_handle_t tipc_handle, tipc_cfg_handle; > > tipc_handle = create_dissector_handle(dissect_tipc, proto_tipc); > tipc_cfg_handle = create_dissector_handle(dissect_tipc_cfg, proto_tipc); > dissector_add("ethertype", ETHERTYPE_TIPC, tipc_handle); > dissector_add("ethertype", ETHERTYPE_TIPC_CFG, tipc_cfg_handle); >} > > >/* To make this dissector work, some modifications have to be done to > other source files. > > In etypes.h, add > > #ifndef ETHERTYPE_TIPC > #define ETHERTYPE_TIPC 0x0807 > #endif > > #ifndef ETHERTYPE_TIPC_CFG > #define ETHERTYPE_TIPC_CFG 0x0808 > #endif > > that tells ethereal which port numbers that are associated with TIPC. > > In packet-ethertype.c, add > > {ETHERTYPE_TIPC, "TIPC"}, > > to the array named value_string etype_vals[]. This tells Ethereal the > name of the protocol. > > Also the filename packet-tipc.c should be added to the DISSECTOR_SOURCE > macro in 'Makefile.am' and 'Makefile.nmake'. > >*/ > _________________________________________________________________ MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus |