Wireshark-dev: [Wireshark-dev] [PATCH] New plugin for Homeplug
From: Sebastien Tandel <sebastien@xxxxxxxxx>
Date: Mon, 04 Dec 2006 23:05:43 +0100
Hi, Here is a patch for the plugin supporting the dissection of the intellon homeplug powerline protocol based on INT51X1 specification. Sebastien Tandel
diff --unidirectional-new-file -r -u -x'*entries' svn-copy/configure.in wireshark/configure.in --- svn-copy/configure.in 2006-12-04 22:06:59.000000000 +0100 +++ wireshark/configure.in 2006-11-28 20:51:16.000000000 +0100 @@ -1382,6 +1382,7 @@ plugins/giop/makefile plugins/gryphon/makefile plugins/h223/makefile + plugins/homeplug/makefile plugins/irda/makefile plugins/lwres/makefile plugins/mate/makefile diff --unidirectional-new-file -r -u -x'*entries' svn-copy/epan/makefile.am wireshark/epan/makefile.am --- svn-copy/epan/makefile.am 2006-12-04 22:06:20.000000000 +0100 +++ wireshark/epan/makefile.am 2006-12-04 21:40:18.000000000 +0100 @@ -166,6 +166,7 @@ ../plugins/giop/packet-cosnaming.c \ ../plugins/giop/packet-coseventcomm.c \ ../plugins/gryphon/packet-gryphon.c \ + ../plugins/homeplug/packet-homeplug.c \ ../plugins/irda/packet-irda.c \ ../plugins/lwres/packet-lwres.c \ ../plugins/megaco/packet-megaco.c \ diff --unidirectional-new-file -r -u -x'*entries' svn-copy/makefile.am wireshark/makefile.am --- svn-copy/makefile.am 2006-12-04 22:06:59.000000000 +0100 +++ wireshark/makefile.am 2006-11-28 20:27:12.000000000 +0100 @@ -200,6 +200,7 @@ plugins/giop/cosnaming.la \ plugins/giop/coseventcomm.la \ plugins/gryphon/gryphon.la \ + plugins/homeplug/homeplug.la \ plugins/irda/irda.la \ plugins/lwres/lwres.la \ plugins/mate/mate.la \ @@ -232,6 +233,7 @@ "-dlopen" plugins/giop/coseventcomm.la \ "-dlopen" plugins/gryphon/gryphon.la \ "-dlopen" plugins/h223/h223.la \ + "-dlopen" plugins/homeplug/homeplug.la \ "-dlopen" plugins/irda/irda.la \ "-dlopen" plugins/lwres/lwres.la \ "-dlopen" plugins/mate/mate.la \ diff --unidirectional-new-file -r -u -x'*entries' svn-copy/makefile.nmake wireshark/makefile.nmake --- svn-copy/makefile.nmake 2006-12-04 22:06:59.000000000 +0100 +++ wireshark/makefile.nmake 2006-12-04 21:40:18.000000000 +0100 @@ -765,6 +765,7 @@ xcopy ".\plugins\giop\tango.dll" $(install_dir)\plugins\$(version) /d xcopy ".\plugins\gryphon\gryphon.dll" $(install_dir)\plugins\$(version) /d xcopy ".\plugins\h223\h223.dll" $(install_dir)\plugins\$(version) /d + xcopy ".\plugins\homeplug\homeplug.dll" $(install_dir)\plugins\$(version) /d xcopy ".\plugins\irda\irda.dll" $(install_dir)\plugins\$(version) /d xcopy ".\plugins\lwres\lwres.dll" $(install_dir)\plugins\$(version) /d xcopy ".\plugins\mate\mate.dll" $(install_dir)\plugins\$(version) /d diff --unidirectional-new-file -r -u -x'*entries' svn-copy/plugins/homeplug/authors wireshark/plugins/homeplug/authors --- svn-copy/plugins/homeplug/authors 1970-01-01 01:00:00.000000000 +0100 +++ wireshark/plugins/homeplug/authors 2006-11-28 20:03:43.000000000 +0100 @@ -0,0 +1,2 @@ +sebastien tandel (sebastien@xxxxxxxxx) + diff --unidirectional-new-file -r -u -x'*entries' svn-copy/plugins/homeplug/copying wireshark/plugins/homeplug/copying --- svn-copy/plugins/homeplug/copying 1970-01-01 01:00:00.000000000 +0100 +++ wireshark/plugins/homeplug/copying 2006-11-28 20:03:43.000000000 +0100 @@ -0,0 +1,280 @@ + gnu general public license + version 2, june 1991 + + copyright (c) 1989, 1991 free software foundation, inc. + 59 temple place, suite 330, boston, ma 02111-1307 usa + everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + preamble + + the licenses for most software are designed to take away your +freedom to share and change it. by contrast, the gnu general public +license is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. this +general public license applies to most of the free software +foundation's software and to any other program whose authors commit to +using it. (some other free software foundation software is covered by +the gnu library general public license instead.) you can apply it to +your programs, too. + + when we speak of free software, we are referring to freedom, not +price. our general public licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + to protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +these restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + for example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. you must make sure that they, too, receive or can get the +source code. and you must show them these terms so they know their +rights. + + we protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. if the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + finally, any free program is threatened constantly by software +patents. we wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. to prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + the precise terms and conditions for copying, distribution and +modification follow. + + gnu general public license + terms and conditions for copying, distribution and modification + + 0. this license applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this general public license. the "program", below, +refers to any such program or work, and a "work based on the program" +means either the program or any derivative work under copyright law: +that is to say, a work containing the program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (hereinafter, translation is included without limitation in +the term "modification".) each licensee is addressed as "you". + +activities other than copying, distribution and modification are not +covered by this license; they are outside its scope. the act of +running the program is not restricted, and the output from the program +is covered only if its contents constitute a work based on the +program (independent of having been made by running the program). +whether that is true depends on what the program does. + + 1. you may copy and distribute verbatim copies of the program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this license and to the absence of any warranty; +and give any other recipients of the program a copy of this license +along with the program. + +you may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. you may modify your copy or copies of the program or any portion +of it, thus forming a work based on the program, and copy and +distribute such modifications or work under the terms of section 1 +above, provided that you also meet all of these conditions: + + a) you must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) you must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this license. + + c) if the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + license. (exception: if the program itself is interactive but + does not normally print such an announcement, your work based on + the program is not required to print an announcement.) + +these requirements apply to the modified work as a whole. if +identifiable sections of that work are not derived from the program, +and can be reasonably considered independent and separate works in +themselves, then this license, and its terms, do not apply to those +sections when you distribute them as separate works. but when you +distribute the same sections as part of a whole which is a work based +on the program, the distribution of the whole must be on the terms of +this license, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the program. + +in addition, mere aggregation of another work not based on the program +with the program (or with a work based on the program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this license. + + 3. you may copy and distribute the program (or a work based on it, +under section 2) in object code or executable form under the terms of +sections 1 and 2 above provided that you also do one of the following: + + a) accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) accompany it with the information you received as to the offer + to distribute corresponding source code. (this alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with subsection b above.) + +the source code for a work means the preferred form of the work for +making modifications to it. for an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. however, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +if distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. you may not copy, modify, sublicense, or distribute the program +except as expressly provided under this license. any attempt +otherwise to copy, modify, sublicense or distribute the program is +void, and will automatically terminate your rights under this license. +however, parties who have received copies, or rights, from you under +this license will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. you are not required to accept this license, since you have not +signed it. however, nothing else grants you permission to modify or +distribute the program or its derivative works. these actions are +prohibited by law if you do not accept this license. therefore, by +modifying or distributing the program (or any work based on the +program), you indicate your acceptance of this license to do so, and +all its terms and conditions for copying, distributing or modifying +the program or works based on it. + + 6. each time you redistribute the program (or any work based on the +program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the program subject to +these terms and conditions. you may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +you are not responsible for enforcing compliance by third parties to +this license. + + 7. if, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this license, they do not +excuse you from the conditions of this license. if you cannot +distribute so as to satisfy simultaneously your obligations under this +license and any other pertinent obligations, then as a consequence you +may not distribute the program at all. for example, if a patent +license would not permit royalty-free redistribution of the program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this license would be to +refrain entirely from distribution of the program. + +if any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +it is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +this section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this license. + + 8. if the distribution and/or use of the program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the program under this license +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. in such case, this license incorporates +the limitation as if written in the body of this license. + + 9. the free software foundation may publish revised and/or new versions +of the general public license from time to time. such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +each version is given a distinguishing version number. if the program +specifies a version number of this license which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the free +software foundation. if the program does not specify a version number of +this license, you may choose any version ever published by the free software +foundation. + + 10. if you wish to incorporate parts of the program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. for software which is copyrighted by the free +software foundation, write to the free software foundation; we sometimes +make exceptions for this. our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + no warranty + + 11. because the program is licensed free of charge, there is no warranty +for the program, to the extent permitted by applicable law. except when +otherwise stated in writing the copyright holders and/or other parties +provide the program "as is" without warranty of any kind, either expressed +or implied, including, but not limited to, the implied warranties of +merchantability and fitness for a particular purpose. the entire risk as +to the quality and performance of the program is with you. should the +program prove defective, you assume the cost of all necessary servicing, +repair or correction. + + 12. in no event unless required by applicable law or agreed to in writing +will any copyright holder, or any other party who may modify and/or +redistribute the program as permitted above, be liable to you for damages, +including any general, special, incidental or consequential damages arising +out of the use or inability to use the program (including but not limited +to loss of data or data being rendered inaccurate or losses sustained by +you or third parties or a failure of the program to operate with any other +programs), even if such holder or other party has been advised of the +possibility of such damages. + + end of terms and conditions diff --unidirectional-new-file -r -u -x'*entries' svn-copy/plugins/homeplug/makefile.am wireshark/plugins/homeplug/makefile.am --- svn-copy/plugins/homeplug/makefile.am 1970-01-01 01:00:00.000000000 +0100 +++ wireshark/plugins/homeplug/makefile.am 2006-12-04 20:19:09.000000000 +0100 @@ -0,0 +1,116 @@ +# makefile.am +# automake file for homeplug plugin +# +# $id: makefile.am 18312 2006-06-02 06:53:30z standel $ +# +# wireshark - network traffic analyzer +# by gerald combs <gerald@xxxxxxxxxxxxx> +# 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. +# + +includes = -i$(top_srcdir) -i$(includedir) + +include makefile.common + +plugindir = @plugindir@ + +plugin_ltlibraries = homeplug.la +homeplug_la_sources = \ + plugin.c \ + moduleinfo.h \ + $(dissector_src) \ + $(dissector_includes) +homeplug_la_ldflags = -module -avoid-version +homeplug_la_libadd = @plugin_libs@ + +libs = + +# +# build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# we do this by scanning sources. if that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# formatting conventions: the name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# dissector_src is assumed to have all the files that need to be scanned. +# +# for some unknown reason, having a big "for" loop in the makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# therefore, we have a script to generate the plugin.c file. +# the shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on windows. therefore, +# if python is present (as indicated by python being defined), we run +# a faster python script to do that work instead. +# +# the first argument is the directory in which the source files live. +# the second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# all subsequent arguments are the files to scan. +# +plugin.c: $(dissector_src) $(top_srcdir)/tools/make-dissector-reg \ + $(top_srcdir)/tools/make-dissector-reg.py + @if test -n $(python); then \ + echo making plugin.c with python ; \ + $(python) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \ + plugin $(dissector_src) ; \ + else \ + echo making plugin.c with shell script ; \ + $(top_srcdir)/tools/make-dissector-reg $(srcdir) \ + $(plugin_src) plugin $(dissector_src) ; \ + fi + + +# +# currently plugin.c can be included in the distribution because +# we always build all protocol dissectors. we used to have to check +# whether or not to build the snmp dissector. if we again need to +# variably build something, making plugin.c non-portable, uncomment +# the dist-hook line below. +# +# oh, yuk. we don't want to include "plugin.c" in the distribution, as +# its contents depend on the configuration, and therefore we want it +# to be built when the first "make" is done; however, automake insists +# on putting *all* source into the distribution. +# +# we work around this by having a "dist-hook" rule that deletes +# "plugin.c", so that "dist" won't pick it up. +# +#dist-hook: +# @rm -f $(distdir)/plugin.c + +cleanfiles = \ + homeplug \ + *~ + +maintainercleanfiles = \ + makefile.in \ + plugin.c + +extra_dist = \ + makefile.common \ + makefile.nmake diff --unidirectional-new-file -r -u -x'*entries' svn-copy/plugins/homeplug/makefile.common wireshark/plugins/homeplug/makefile.common --- svn-copy/plugins/homeplug/makefile.common 1970-01-01 01:00:00.000000000 +0100 +++ wireshark/plugins/homeplug/makefile.common 2006-11-28 20:41:55.000000000 +0100 @@ -0,0 +1,32 @@ +# makefile.common for homeplug plugin +# contains the stuff from makefile.am and makefile.nmake that is +# a) common to both files and +# b) portable between both files +# +# $id: makefile.common 18197 2006-05-21 05:12:17z standel $ +# +# wireshark - network traffic analyzer +# by gerald combs <gerald@xxxxxxxxxxxxx> +# 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. + +# the name of the plugin +plugin_name = homeplug + +# the dissector sources (without any helpers) +dissector_src = \ + packet-homeplug.c + diff --unidirectional-new-file -r -u -x'*entries' svn-copy/plugins/homeplug/makefile.nmake wireshark/plugins/homeplug/makefile.nmake --- svn-copy/plugins/homeplug/makefile.nmake 1970-01-01 01:00:00.000000000 +0100 +++ wireshark/plugins/homeplug/makefile.nmake 2006-11-28 20:41:13.000000000 +0100 @@ -0,0 +1,79 @@ +# makefile.nmake +# nmake file for homeplug plugin +# +# $id: makefile.nmake 19730 2006-10-29 17:19:52z standel $ +# + +include ..\..\config.nmake + +############### no need to modify below this line ######### + +include makefile.common + +cflags=/dhave_config_h /i../.. /i../../wiretap $(glib_cflags) \ + /i$(pcap_dir)\include -d_u_="" $(local_cflags) + +ldflags = /nologo /incremental:no /machine:i386 $(local_ldflags) + +!ifdef enable_libwireshark +link_plugin_with=..\..\epan\libwireshark.lib +cflags=/dhave_win32_libwireshark_lib /d_need_var_import_ $(cflags) + +dissector_objects = $(dissector_src:.c=.obj) + +objects=$(dissector_objects) plugin.obj + +artnet.dll artnet.exp artnet.lib : $(objects) $(link_plugin_with) + link -dll /out:homeplug.dll $(ldflags) $(objects) $(link_plugin_with) \ + $(glib_libs) + +# +# build plugin.c, which contains the plugin version[] string, a +# function plugin_register() that calls the register routines for all +# protocols, and a function plugin_reg_handoff() that calls the handoff +# registration routines for all protocols. +# +# we do this by scanning sources. if that turns out to be too slow, +# maybe we could just require every .o file to have an register routine +# of a given name (packet-aarp.o -> proto_register_aarp, etc.). +# +# formatting conventions: the name of the proto_register_* routines an +# proto_reg_handoff_* routines must start in column zero, or must be +# preceded only by "void " starting in column zero, and must not be +# inside #if. +# +# dissector_src is assumed to have all the files that need to be scanned. +# +# for some unknown reason, having a big "for" loop in the makefile +# to scan all the files doesn't work with some "make"s; they seem to +# pass only the first few names in the list to the shell, for some +# reason. +# +# therefore, we have a script to generate the plugin.c file. +# the shell script runs slowly, as multiple greps and seds are run +# for each input file; this is especially slow on windows. therefore, +# if python is present (as indicated by python being defined), we run +# a faster python script to do that work instead. +# +# the first argument is the directory in which the source files live. +# the second argument is "plugin", to indicate that we should build +# a plugin.c file for a plugin. +# all subsequent arguments are the files to scan. +# +plugin.c: $(dissector_src) +!ifdef python + @echo making plugin.c (using python) + @$(python) "../../tools/make-dissector-reg.py" . plugin $(dissector_src) +!else + @echo making plugin.c (using sh) + @$(sh) ../../tools/make-dissector-reg . plugin $(dissector_src) +!endif + +!endif + +clean: + rm -f $(objects) homeplug.dll homeplug.exp homeplug.lib *.pdb + +distclean: clean + +maintainer-clean: distclean diff --unidirectional-new-file -r -u -x'*entries' svn-copy/plugins/homeplug/moduleinfo.h wireshark/plugins/homeplug/moduleinfo.h --- svn-copy/plugins/homeplug/moduleinfo.h 1970-01-01 01:00:00.000000000 +0100 +++ wireshark/plugins/homeplug/moduleinfo.h 2006-11-28 20:38:52.000000000 +0100 @@ -0,0 +1,16 @@ +/* included *after* config.h, in order to re-define these macros */ + +#ifdef package +#undef package +#endif + +/* name of package */ +#define package "homeplug" + +#ifdef version +#undef version +#endif + +/* version number of package */ +#define version "0.0.1" + diff --unidirectional-new-file -r -u -x'*entries' svn-copy/plugins/homeplug/packet-homeplug.c wireshark/plugins/homeplug/packet-homeplug.c --- svn-copy/plugins/homeplug/packet-homeplug.c 1970-01-01 01:00:00.000000000 +0100 +++ wireshark/plugins/homeplug/packet-homeplug.c 2006-12-04 21:38:18.000000000 +0100 @@ -0,0 +1,760 @@ +// ================================================================== +// @(#)packet-homeplug.c +// +// @author bruno quoitin (bqu@xxxxxxxxxxxxxx), +// sebastien tandel (sta@xxxxxxxxxxxxxx) +// @date 09/09/2005 +// @lastdate 14/09/2005 +// +// 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. +// +// 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 "moduleinfo.h" + +#include <gmodule.h> +#include <epan/packet.h> +#include <epan/prefs.h> + +#define ethertype_homeplug 0x887b /* ieee assigned ethertype */ + + +/* metype values */ +#define homeplug_mme_rce 0x00 +#define homeplug_mme_cer 0x01 +#define homeplug_mme_rps 0x07 +#define homeplug_mme_psr 0x08 +#define homeplug_mme_ns 0x1a + +/* bit mask operation */ +#define homeplug_mctrl_rsvd 0x80 +#define homeplug_mctrl_ne 0x7f + +#define homeplug_mehdr_mev 0xe0 +#define homeplug_mehdr_metype 0x1f + +#define homeplug_ns_ac 0x80 +#define homeplug_ns_icid 0x7f + +#define homeplug_rce_cev 0xf0 +#define homeplug_rce_rsvd 0x0f + +#define homeplug_cer_cerv 0xf0 +#define homeplug_cer_rsvd 0x0fe0 +#define homeplug_cer_rxtmi 0x1f +#define homeplug_cer_rate 0x80 +#define homeplug_cer_bp 0x40 +#define homeplug_cer_vt11 0x0f +#define homeplug_cer_rsvd2 0x80 +#define homeplug_cer_nbdas 0x7f + + +/* length of network statistics response defines whether it is the basic or the + * extended response */ +#define homeplug_ns_basic_len 187 +#define homeplug_ns_ext_len 199 + +/* forward reference */ +void proto_reg_handoff_homeplug(); + +/*#ifndef enable_static +g_module_export const gchar version[]= version; +#endif*/ + +static int proto_homeplug= -1; +static dissector_handle_t homeplug_handle; + +static int hf_homeplug_mctrl = -1; + static int hf_homeplug_mctrl_reserved = -1; + static int hf_homeplug_mctrl_ne = -1; +static int hf_homeplug_mehdr = -1; + static int hf_homeplug_mehdr_mev = -1; + static int hf_homeplug_mehdr_metype = -1; +static int hf_homeplug_melen = -1; +static int hf_homeplug_mme = -1; + /* request channel estimation */ + static int hf_homeplug_rce = -1; + static int hf_homeplug_rce_cev = -1; + static int hf_homeplug_rce_rsvd = -1; + /* channel estimation response */ + static int hf_homeplug_cer = -1; + static int hf_homeplug_cer_cerv = -1; + static int hf_homeplug_cer_rsvd1 = -1; + static int hf_homeplug_cer_rxtmi = -1; + static int hf_homeplug_cer_vt = -1; + static int hf_homeplug_cer_rate = -1; + static int hf_homeplug_cer_bp = -1; + static int hf_homeplug_cer_mod = -1; + static int hf_homeplug_cer_vt11 = -1; + static int hf_homeplug_cer_rsvd2 = -1; + static int hf_homeplug_cer_nbdas = -1; + static int hf_homeplug_cer_bda = -1; + /* request parameters and statistics */ + static int hf_homeplug_rps = -1; + /* parameters and statistics response */ + static int hf_homeplug_psr = -1; + static int hf_homeplug_psr_txack = -1; + static int hf_homeplug_psr_txnack = -1; + static int hf_homeplug_psr_txfail = -1; + static int hf_homeplug_psr_txcloss = -1; + static int hf_homeplug_psr_txcoll = -1; + static int hf_homeplug_psr_txca3lat = -1; + static int hf_homeplug_psr_txca2lat = -1; + static int hf_homeplug_psr_txca1lat = -1; + static int hf_homeplug_psr_txca0lat = -1; + static int hf_homeplug_psr_rxbp40 = -1; + /* network statistics */ + /* basic */ + static int hf_homeplug_ns = -1; + static int hf_homeplug_ns_netw_ctrl_ac = -1; + static int hf_homeplug_ns_netw_ctrl_icid= -1; + static int hf_homeplug_ns_netw_ctrl_icid_rsvd= -1; + static int hf_homeplug_ns_bytes40_robo = -1; + static int hf_homeplug_ns_fails_robo = -1; + static int hf_homeplug_ns_drops_robo = -1; + static int hf_homeplug_ns_netw_da = -1; + static int hf_homeplug_ns_bytes40 = -1; + static int hf_homeplug_ns_fails = -1; + static int hf_homeplug_ns_drops = -1; + /* array of 15 elements */ +// static int hf_homeplug_ns_bytes40_1 = -1; +// static int hf_homeplug_ns_bytes40_1 + /* extended */ + /* array of 6 elements */ +// static int hf_homeplug_ns_tx_bfr_0_state = -1; + +static gint ett_homeplug = -1; +static gint ett_homeplug_mctrl = -1; +static gint ett_homeplug_mehdr = -1; +static gint ett_homeplug_mme = -1; +static gint ett_homeplug_rce = -1; +static gint ett_homeplug_cer = -1; +static gint ett_homeplug_rps = -1; +static gint ett_homeplug_psr = -1; +static gint ett_homeplug_ns = -1; +static gint ett_homeplug_tone = -1; + +static guint8 homeplug_ne = 0; +static guint8 homeplug_melen = 0; +static guint8 homeplug_metype = 0; + +static guint32 homeplug_offset = 0; + +/* ic_id values */ +#define homeplug_ns_icid5130a1 0x00 +#define homeplug_ns_icid51x1usb 0x01 +#define homeplug_ns_icid51x1phy 0x02 +#define homeplug_ns_icid51x1host 0x03 +#define homeplug_ns_icid5130a2 0x04 +#define homeplug_ns_icid_rsvd1 0x05 +#define homeplug_ns_icid_rsvd2 0x06 +#define homeplug_ns_icid_rsvd3 0x07 +/* icid bit mask */ +#define homeplug_ns_icid_mask 0x07 +#define homeplug_ns_icid_rsvd_mask 0x78 +/* string values in function of ic_id values */ +static const value_string homeplug_ns_icid_vals[] = { + { homeplug_ns_icid5130a1, "int5130a1" }, + { homeplug_ns_icid51x1usb, "int51x1 (usb option)" }, + { homeplug_ns_icid51x1phy, "int51x1 (phy option)" }, + { homeplug_ns_icid51x1host, "int51x1 (host/dte option)" }, + { homeplug_ns_icid5130a2, "int5130a2" }, + { homeplug_ns_icid_rsvd1, "reserved"}, + { homeplug_ns_icid_rsvd2, "reserved"}, + { homeplug_ns_icid_rsvd3, "reserved"}, + { 0, null } +}; + +/* modulation method bit mask */ +#define homeplug_cer_mod_mask 0x30 +/* modulation method values */ +#define homeplug_cer_mod_robo 0x00 +#define homeplug_cer_mod_dbpsk 0x01 +#define homeplug_cer_mod_dqpsk 0x02 +#define homeplug_cer_mod_rsvd 0x03 +/* string values in function of modulation method values */ +static const value_string homeplug_cer_mod_vals[] = { + { homeplug_cer_mod_robo, "robo modulation"}, + { homeplug_cer_mod_dbpsk, "dbpsk modulation"}, + { homeplug_cer_mod_dqpsk, "dqpsk modulation"}, + { homeplug_cer_mod_rsvd, "reserved"}, + { 0, null} +}; + + +void +proto_register_homeplug(void) +{ + module_t * homeplug_module; + + static hf_register_info hf[] = { + /* mac control field */ + { &hf_homeplug_mctrl, + { "mac control field", "homeplug.mctrl", + ft_uint8, base_dec, null, 0x0, "", hfill } + }, + + { &hf_homeplug_mctrl_reserved, + { "reserved", "homeplug.mctrl.rsvd", + ft_none, base_dec, null, homeplug_mctrl_rsvd, "", hfill } + }, + + { &hf_homeplug_mctrl_ne, + { "number of mac data entries", "homeplug.mctrl.ne", + ft_uint8, base_dec, null, homeplug_mctrl_ne, "", hfill } + }, + + /* mac entry header */ + { &hf_homeplug_mehdr, + { "mac management entry header", "homeplug.mehdr", + ft_none, base_dec, null, 0x0, "", hfill } + }, + + { &hf_homeplug_mehdr_mev, + { "mac entry version", "homeplug.mehdr.mev", + ft_uint8, base_dec, null, homeplug_mehdr_mev, "", hfill } + }, + + { &hf_homeplug_mehdr_metype, + { "mac entry type", "homeplug.mehdr.metype", + ft_uint8, base_hex, null, homeplug_mehdr_metype, "", hfill } + }, + + /* mac entry len */ + { &hf_homeplug_melen, + { "mac management entry length", "homeplug.melen", + ft_uint8, base_dec, null, 0x0, "", hfill } + }, + + /* mac management entry */ + { &hf_homeplug_mme, + { "mac management entry data", "homeplug.mmentry", + ft_uint8, base_dec, null, 0x0, "", hfill } + }, + + /* request channel estimation */ + { &hf_homeplug_rce, + { "request channel estimation", "homeplug.rce", + ft_none, base_dec, null, 0x0, "", hfill } + }, + + { &hf_homeplug_rce_cev, + { "channel estimation version", "homeplug.rce.cev", + ft_uint8, base_dec, null, homeplug_rce_cev, "", hfill } + }, + + { &hf_homeplug_rce_rsvd, + { "reserved", "homeplug.rce.rsvd", + ft_none, base_dec, null, homeplug_rce_rsvd, "", hfill } + }, + + /* channel estimation response */ + { &hf_homeplug_cer, + { "channel estimation response", "homeplug.cer", + ft_none, base_dec, null, 0x0, "", hfill } + }, + + { &hf_homeplug_cer_cerv, + { "channel estimation response version", "homeplug.cer.cerv", + ft_uint8, base_dec, null, homeplug_cer_cerv, "", hfill } + }, + + { &hf_homeplug_cer_rsvd1, + { "reserved", "homeplug.cer.rsvd1", + ft_none, base_dec, null, homeplug_cer_rsvd, "", hfill } + }, + + { &hf_homeplug_cer_rxtmi, + { "receive tone map index", "homeplug.cer.rxtmi", + ft_uint8, base_dec, null, homeplug_cer_rxtmi, "", hfill } + }, + + /* todo must append vt[79-0] */ + + { &hf_homeplug_cer_vt, + {"valid tone flags", "homeplug.cer.vt", + ft_uint8, base_hex, null, 0x0, "", hfill } + }, + + { &hf_homeplug_cer_rate, + { "fec rate", "homeplug.cer.rate", + ft_uint8, base_dec, null, homeplug_cer_rate, "", hfill } + }, + + { &hf_homeplug_cer_bp, + { "bridge proxy", "homeplug.cer.bp", + ft_uint8, base_dec, null, homeplug_cer_bp, "", hfill } + }, + + { &hf_homeplug_cer_mod, + { "modulation method", "homeplug.cer.mod", + ft_uint8, base_dec, vals(&homeplug_cer_mod_vals), homeplug_cer_mod_mask, "", hfill } + }, + + { &hf_homeplug_cer_vt11, + { "valid tone flags [83-80]", "homeplug.cer.vt11", + ft_uint8, base_dec, null, homeplug_cer_vt11, "", hfill } + }, + + { &hf_homeplug_cer_rsvd2, + { "reserved", "homeplug.cer.rsvd2", + ft_uint8, base_dec, null, homeplug_cer_rsvd2, "", hfill } + }, + + { &hf_homeplug_cer_nbdas, + { "number bridged destination addresses", "homeplug.cer.nbdas", + ft_uint8, base_dec, null, homeplug_cer_nbdas, "", hfill } + }, + + { &hf_homeplug_cer_bda, + { "bridged destination address", "homeplug.cer.bda", + ft_ether, base_hex, null, 0x0, "", hfill } + }, + + /* request parameters and statistics */ + { &hf_homeplug_rps, + { "request parameters and statistics", "homeplug.rps", + ft_none, base_dec, null, 0x0, "", hfill } + }, + + /* parameters and statistics response */ + { &hf_homeplug_psr, + { "parameters and statistics response", "homeplug.psr", + ft_none, base_dec, null, 0x0, "", hfill } + }, + + { &hf_homeplug_psr_txack, + { "transmit ack counter", "homeplug.psr.txack", + ft_uint16, base_dec, null, 0x0, "", hfill } + }, + + { &hf_homeplug_psr_txnack, + { "transmit nack counter", "homeplug.psr.txnack", + ft_uint16, base_dec, null, 0x0, "", hfill } + }, + + { &hf_homeplug_psr_txfail, + { "transmit fail counter", "homeplug.psr.txfail", + ft_uint16, base_dec, null, 0x0, "", hfill } + }, + + { &hf_homeplug_psr_txcloss, + { "transmit contention loss counter", "homeplug.psr.txcloss", + ft_uint16, base_dec, null, 0x0, "", hfill } + }, + + { &hf_homeplug_psr_txcoll, + { "transmit collision counter", "homeplug.psr.txcoll", + ft_uint16, base_dec, null, 0x0, "", hfill } + }, + + { &hf_homeplug_psr_txca3lat, + { "transmit ca3 latency counter", "homeplug.psr.txca3lat", + ft_uint16, base_dec, null, 0x0, "", hfill } + }, + + { &hf_homeplug_psr_txca2lat, + { "transmit ca2 latency counter", "homeplug.psr.txca2lat", + ft_uint16, base_dec, null, 0x0, "", hfill } + }, + { &hf_homeplug_psr_txca1lat, + { "transmit ca1 latency counter", "homeplug.psr.txca1lat", + ft_uint16, base_dec, null, 0x0, "", hfill } + }, + { &hf_homeplug_psr_txca0lat, + { "transmit ca0 latency counter", "homeplug.psr.txca0lat", + ft_uint16, base_dec, null, 0x0, "", hfill } + }, + + { &hf_homeplug_psr_rxbp40, + { "receive cumulative bytes per 40-symbol", "homeplug.psr.rxbp40", + ft_uint32, base_dec, null, 0x0, "", hfill } + }, + + /* network statistics basic */ + { &hf_homeplug_ns, + { "network statistics basic", "homeplug.ns", + ft_none, base_dec, null, 0x0, "", hfill } + }, + + { &hf_homeplug_ns_netw_ctrl_ac, + { "action control", "homeplug.ns.ac", + ft_boolean, base_dec, null, homeplug_ns_ac, "", hfill } + }, + + { &hf_homeplug_ns_netw_ctrl_icid, + { "ic_id", "homeplug.ns.icid", + ft_uint8, base_hex, vals(&homeplug_ns_icid_vals), homeplug_ns_icid_mask, "", hfill } + }, + + { &hf_homeplug_ns_netw_ctrl_icid_rsvd, + { "ic_id reserved", "homeplug.ns.icid", + ft_none, base_dec, null, 0x0, "", hfill } + }, + + { &hf_homeplug_ns_bytes40_robo, + { "bytes in 40 symbols in robo", "homeplug.ns.bytes40_robo", + ft_uint16, base_dec, null, 0x0, "", hfill } + }, + + { &hf_homeplug_ns_fails_robo, + { "fails received in robo", "homeplug.ns.fails_robo", + ft_uint16, base_dec, null, 0x0, "", hfill } + }, + + { &hf_homeplug_ns_drops_robo, + { "frame drops in robo", "homeplug.ns.drops_robo", + ft_uint16, base_dec, null, 0x0, "", hfill } + }, + + /* todo netw_da1 ... */ + { &hf_homeplug_ns_netw_da, + { "address of network da", "homeplug.ns.netw_da", + ft_ether, base_hex, null, 0x0, "", hfill } + }, + + { &hf_homeplug_ns_bytes40, + { "bytes in 40 symbols", "homeplug.ns.bytes40", + ft_uint16, base_dec, null, 0x0, "", hfill } + }, + + { &hf_homeplug_ns_fails, + { "fails received", "homeplug.ns.fails", + ft_uint16, base_dec, null, 0x0, "", hfill } + }, + + { &hf_homeplug_ns_drops, + { "frame drops", "homeplug.ns.drops", + ft_uint16, base_dec, null, 0x0, "", hfill } + } + + /* todo network statistics extended */ + }; + + /* setup protocol subtree array */ + static gint *ett[] = { + &ett_homeplug, + &ett_homeplug_mctrl, + &ett_homeplug_mehdr, + &ett_homeplug_rce, + &ett_homeplug_cer, + &ett_homeplug_rps, + &ett_homeplug_psr, + &ett_homeplug_ns, + &ett_homeplug_tone, + }; + + if (proto_homeplug == -1) { + proto_homeplug= proto_register_protocol( + "homeplug protocol", /* name */ + "homeplug", /* short name */ + "homeplug" /* abbrev */ + ); + proto_register_field_array(proto_homeplug, + hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + } + homeplug_module= prefs_register_protocol(proto_homeplug, + proto_reg_handoff_homeplug); +} + +/* dissection of mctrl */ +static void dissect_homeplug_mctrl(tvbuff_t * tvb, proto_tree * tree) +{ + proto_item * it = null; + proto_tree * additional_tree = null; + + it = proto_tree_add_item(tree, hf_homeplug_mctrl, tvb, 0, 1, false); + additional_tree = proto_item_add_subtree(it, ett_homeplug_mctrl); + proto_tree_add_item(additional_tree, hf_homeplug_mctrl_reserved, tvb, 0, 1, false); + proto_tree_add_item(additional_tree, hf_homeplug_mctrl_ne, tvb, 0, 1, false); + + homeplug_ne = tvb_get_guint8(tvb, 0) & homeplug_mctrl_ne; + + homeplug_offset += 1; + +} + +/* dissection of mehdr */ +static void dissect_homeplug_mehdr(tvbuff_t * tvb, proto_tree * tree) +{ + proto_item * it = null; + proto_tree * additional_tree = null; + + it = proto_tree_add_item (tree, hf_homeplug_mehdr, tvb, homeplug_offset, 1, false); + additional_tree = proto_item_add_subtree(it, ett_homeplug_mehdr); + proto_tree_add_item(additional_tree, hf_homeplug_mehdr_mev, tvb, homeplug_offset, 1, false); + proto_tree_add_item(additional_tree, hf_homeplug_mehdr_metype, tvb, homeplug_offset, 1, false); + + homeplug_metype = tvb_get_guint8(tvb, homeplug_offset) & homeplug_mehdr_metype; + + homeplug_offset += 1; +} + +/* dissection of melen */ +static void dissect_homeplug_melen(tvbuff_t * tvb, proto_tree * tree) +{ + proto_tree_add_item(tree, hf_homeplug_melen, tvb, homeplug_offset, 1, false); + + homeplug_melen = tvb_get_guint8(tvb, homeplug_offset); + + homeplug_offset += 1; +} + +/* dissection of request channel estimation mme */ +static void dissect_homeplug_rce(tvbuff_t * tvb, proto_tree * tree) +{ + proto_item * it = null; + proto_tree * additional_tree= null; + + it = proto_tree_add_item(tree, hf_homeplug_rce, tvb, homeplug_offset, homeplug_melen, false); + additional_tree = proto_item_add_subtree(it , ett_homeplug_rce); + proto_tree_add_item(additional_tree, hf_homeplug_rce_cev, tvb, homeplug_offset, 1, false); + proto_tree_add_item(additional_tree, hf_homeplug_rce_rsvd, tvb, homeplug_offset, 1, false); + + homeplug_offset += 1; +} + +/* dissection of channel estimation response mme */ +static void dissect_homeplug_cer(tvbuff_t * tvb, proto_tree * tree) +{ + proto_item * it = null; + proto_tree * additional_tree = null; + guint8 itone = 0; + guint8 bp = 0; + guint8 inbda = 0; + + it = proto_tree_add_item(tree, hf_homeplug_cer, tvb, homeplug_offset, homeplug_melen, false); + additional_tree = proto_item_add_subtree(it, ett_homeplug_cer); + proto_tree_add_item(additional_tree, hf_homeplug_cer_cerv, tvb, homeplug_offset, 1, false); + proto_tree_add_item(additional_tree, hf_homeplug_cer_rsvd1, tvb, homeplug_offset, 2, false); + homeplug_offset += 1; + proto_tree_add_item(additional_tree, hf_homeplug_cer_rxtmi, tvb, homeplug_offset, 1, false); + homeplug_offset += 1; + while (itone < 10) { + proto_tree_add_item(additional_tree, hf_homeplug_cer_vt, tvb, homeplug_offset, 1, false); + homeplug_offset += 1; + itone ++; + } + proto_tree_add_item(additional_tree, hf_homeplug_cer_rate, tvb, homeplug_offset, 1, false); + proto_tree_add_item(additional_tree, hf_homeplug_cer_bp, tvb, homeplug_offset, 1, false); + bp = tvb_get_guint8(tvb, homeplug_offset) & homeplug_cer_bp; + proto_tree_add_item(additional_tree, hf_homeplug_cer_mod, tvb, homeplug_offset, 1, false); + proto_tree_add_item(additional_tree, hf_homeplug_cer_vt11, tvb, homeplug_offset, 1, false); + homeplug_offset += 1; + proto_tree_add_item(additional_tree, hf_homeplug_cer_rsvd2, tvb, homeplug_offset, 1, false); + if (bp) { + proto_tree_add_item(additional_tree, hf_homeplug_cer_nbdas, tvb, homeplug_offset, 1, false); + inbda = tvb_get_guint8(tvb, homeplug_offset) & homeplug_cer_nbdas; + homeplug_offset += 1; + /* todo : check on inbda! int51x1 up to 16 dba. but up to 32 for int51x1 (host/dte) */ + while (inbda > 0) { + proto_tree_add_item(additional_tree, hf_homeplug_cer_bda, tvb, homeplug_offset, 6, false); + homeplug_offset += 6; + inbda--; + } + } +} + +/* dissection of request parameters and statistics mme */ +static void dissect_homeplug_rps(tvbuff_t * tvb, proto_tree * tree) +{ + proto_tree_add_item(tree, hf_homeplug_rps, tvb, homeplug_offset, homeplug_melen, false); +} + +/* dissection of parameters and statistics response mme */ +static void dissect_homeplug_psr(tvbuff_t * tvb, proto_tree * tree) +{ + proto_item * it = null; + proto_tree * additional_tree=null; + + it = proto_tree_add_item(tree, hf_homeplug_psr, tvb, homeplug_offset, homeplug_melen, false); + additional_tree = proto_item_add_subtree(it, ett_homeplug_psr); + proto_tree_add_item(additional_tree, hf_homeplug_psr_txack, tvb, homeplug_offset, 2, false); + homeplug_offset += 2; + proto_tree_add_item(additional_tree, hf_homeplug_psr_txnack, tvb, homeplug_offset, 2, false); + homeplug_offset += 2; + proto_tree_add_item(additional_tree, hf_homeplug_psr_txfail, tvb, homeplug_offset, 2, false); + homeplug_offset += 2; + proto_tree_add_item(additional_tree, hf_homeplug_psr_txcloss, tvb, homeplug_offset, 2, false); + homeplug_offset += 2; + proto_tree_add_item(additional_tree, hf_homeplug_psr_txcoll, tvb, homeplug_offset, 2, false); + homeplug_offset += 2; + proto_tree_add_item(additional_tree, hf_homeplug_psr_txca3lat, tvb, homeplug_offset, 2, false); + homeplug_offset += 2; + proto_tree_add_item(additional_tree, hf_homeplug_psr_txca2lat, tvb, homeplug_offset, 2, false); + homeplug_offset += 2; + proto_tree_add_item(additional_tree, hf_homeplug_psr_txca1lat, tvb, homeplug_offset, 2, false); + homeplug_offset += 2; + proto_tree_add_item(additional_tree, hf_homeplug_psr_txca0lat, tvb, homeplug_offset, 2, false); + homeplug_offset += 2; + proto_tree_add_item(additional_tree, hf_homeplug_psr_rxbp40, tvb, homeplug_offset, 4, false); + homeplug_offset += 4; +} + +/* dissection of the network statistic mme */ +static void dissect_homeplug_ns(tvbuff_t * tvb, proto_tree * tree) +{ + proto_item * it = null; + proto_tree * additional_tree=null, * tree_tone = null; + guint8 homeplug_ns_icid_rsvd = 0; + guint8 itone = 0; + + /* todo : test length of the mme : differentiation of ns basic and extended */ + it = proto_tree_add_item(tree, hf_homeplug_ns, tvb, homeplug_offset, homeplug_melen, false); + additional_tree = proto_item_add_subtree(it, ett_homeplug_ns); + proto_tree_add_item(additional_tree, hf_homeplug_ns_netw_ctrl_ac, tvb, homeplug_offset, 1, false); + homeplug_ns_icid_rsvd = tvb_get_guint8(tvb, homeplug_offset) & homeplug_ns_icid_rsvd_mask; + if (homeplug_ns_icid_rsvd) + proto_tree_add_item(additional_tree, hf_homeplug_ns_netw_ctrl_icid_rsvd, tvb, homeplug_offset, 1, false); + else + proto_tree_add_item(additional_tree, hf_homeplug_ns_netw_ctrl_icid, tvb, homeplug_offset, 1, false); + homeplug_offset += 1; + /* todo : represents mhz by bytes40/42 */ + proto_tree_add_item(additional_tree, hf_homeplug_ns_bytes40_robo, tvb, homeplug_offset, 2, true); + homeplug_offset += 2; + proto_tree_add_item(additional_tree, hf_homeplug_ns_fails_robo, tvb, homeplug_offset, 2, false); + homeplug_offset += 2; + proto_tree_add_item(additional_tree, hf_homeplug_ns_drops_robo, tvb, homeplug_offset, 2, false); + homeplug_offset += 2; + while (itone < 15) { + it = proto_tree_add_text(additional_tree, tvb, homeplug_offset, 12, "tone map #%d", itone+1); + tree_tone = proto_item_add_subtree(it, ett_homeplug_tone); + /* todo : check if the (da == 01:00:00:00:00:00). it tell us that following data are not valid. */ + proto_tree_add_item(tree_tone, hf_homeplug_ns_netw_da, tvb, homeplug_offset, 6, false); + homeplug_offset += 6; + /* todo : represents mhz by bytes40/42 */ + proto_tree_add_item(tree_tone, hf_homeplug_ns_bytes40, tvb, homeplug_offset, 2, true); + homeplug_offset += 2; + proto_tree_add_item(tree_tone, hf_homeplug_ns_fails, tvb, homeplug_offset, 2, true); + homeplug_offset += 2; + proto_tree_add_item(tree_tone, hf_homeplug_ns_drops, tvb, homeplug_offset, 2, true); + homeplug_offset += 2; + + itone++; + } +} + +static void dissect_homeplug_mme(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + + switch(homeplug_metype) { + case homeplug_mme_rce: + if (check_col(pinfo->cinfo, col_info)) { + col_clear(pinfo->cinfo, col_info); + col_set_str(pinfo->cinfo, col_info, "request channel estimation"); + } + dissect_homeplug_rce(tvb, tree); + break; + case homeplug_mme_cer: + if (check_col(pinfo->cinfo, col_info)) { + col_clear(pinfo->cinfo, col_info); + col_set_str(pinfo->cinfo, col_info, "channel estimation response"); + } + dissect_homeplug_cer(tvb, tree); + break; + case homeplug_mme_rps: + if (check_col(pinfo->cinfo, col_info)) { + col_clear(pinfo->cinfo, col_info); + col_set_str(pinfo->cinfo, col_info, "request parameters and statistics"); + } + dissect_homeplug_rps(tvb, tree); + break; + case homeplug_mme_psr: + if (check_col(pinfo->cinfo, col_info)) { + col_clear(pinfo->cinfo, col_info); + col_set_str(pinfo->cinfo, col_info, "parameters and statistics response"); + } + dissect_homeplug_psr(tvb, tree); + break; + case homeplug_mme_ns: + if (check_col(pinfo->cinfo, col_info)) { + col_clear(pinfo->cinfo, col_info); + col_set_str(pinfo->cinfo, col_info, "network statistics"); + } + dissect_homeplug_ns(tvb, tree); + break; + } +} + +static void +dissect_homeplug(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) +{ + proto_item * it= null; + proto_tree * homeplug_tree= null; + + if (check_col(pinfo->cinfo, col_protocol)) + col_set_str(pinfo->cinfo, col_protocol, "homeplug"); + /* clear out stuff in the info column */ + if (check_col(pinfo->cinfo, col_info)) { + col_clear(pinfo->cinfo, col_info); + col_set_str(pinfo->cinfo, col_info, "mac management"); + } + + if (tree) { + homeplug_offset = 0; + it= proto_tree_add_item(tree, proto_homeplug, tvb, homeplug_offset, -1, false); + homeplug_tree = proto_item_add_subtree(it, ett_homeplug); + + dissect_homeplug_mctrl(tvb, homeplug_tree); + //proto_item * it = null; + //proto_tree * additional_tree = null; + + /* homeplug_ne indicates the number of mme entries. this field is fetched + * from mctrl. */ + while (homeplug_ne > 0) { + dissect_homeplug_mehdr(tvb, homeplug_tree); + + dissect_homeplug_melen(tvb, homeplug_tree); + + dissect_homeplug_mme(tvb, pinfo, homeplug_tree); + + homeplug_ne--; + } + } +} + +void +proto_reg_handoff_homeplug(void) +{ + static int initialized= false; + + if (!initialized) { + homeplug_handle= create_dissector_handle(dissect_homeplug, proto_homeplug); + dissector_add("ethertype", ethertype_homeplug, homeplug_handle); + initialized= true; + } +} + + +/*#ifndef enable_static +g_module_export void +plugin_register(void) +{ + if (proto_homeplug == -1) { + proto_register_homeplug(); + + } +} + +g_module_export void +plugin_reg_handoff(void) { + proto_reg_handoff_homeplug(); +} +#endif*/ + diff --unidirectional-new-file -r -u -x'*entries' svn-copy/plugins/homeplug/readme wireshark/plugins/homeplug/readme --- svn-copy/plugins/homeplug/readme 1970-01-01 01:00:00.000000000 +0100 +++ wireshark/plugins/homeplug/readme 2006-11-28 20:03:43.000000000 +0100 @@ -0,0 +1,14 @@ +homeplug plugin currently dissects : + mctrl + mehdr + melen + + mme : + request channel estimation (0x00) (not tested!) + channel estimation response (0x01) (not tested!) + request parameters and statistics (0x07) + parameters and statistics response (0x08) + network statistics basic (0x1a) + + partial support for : + network statistics extended (ox1a) diff --unidirectional-new-file -r -u -x'*entries' svn-copy/plugins/homeplug/readme.developper wireshark/plugins/homeplug/readme.developper --- svn-copy/plugins/homeplug/readme.developper 1970-01-01 01:00:00.000000000 +0100 +++ wireshark/plugins/homeplug/readme.developper 2006-12-04 22:00:45.000000000 +0100 @@ -0,0 +1,28 @@ +readme.developper (bqu@xxxxxxxxxxxxxx, sta@xxxxxxxxxxxxxx) +================= + +you will need to update the following files in order to compile the +homeplug plugin: + + configure.in + makefile.am + plugins/makefile.am + plugins/makefile.nmake + epan/makefile.am + +the homeplug plugin should come with the following files: + + plugins/homeplug/authors + plugins/homeplug/copying + plugins/homeplug/changelog + plugins/homeplug/makefile.am + plugins/homeplug/makefile.common + plugins/homeplug/makefile.nmake + plugins/homeplug/moduleinfo.h + plugins/homeplug/packet-homeplug.c + diff --unidirectional-new-file -r -u -x'*entries' svn-copy/plugins/makefile.am wireshark/plugins/makefile.am --- svn-copy/plugins/makefile.am 2006-12-04 22:01:23.000000000 +0100 +++ wireshark/plugins/makefile.am 2006-11-28 20:03:56.000000000 +0100 @@ -31,6 +31,7 @@ giop \ gryphon \ h223 \ + homeplug \ irda \ lwres \ mate \ diff --unidirectional-new-file -r -u -x'*entries' svn-copy/plugins/makefile.nmake wireshark/plugins/makefile.nmake --- svn-copy/plugins/makefile.nmake 2006-12-04 22:01:23.000000000 +0100 +++ wireshark/plugins/makefile.nmake 2006-11-28 20:22:12.000000000 +0100 @@ -17,6 +17,7 @@ giop \ gryphon \ h223 \ + homeplug \ irda \ lwres \ mate \ @@ -81,6 +82,11 @@ $(make) /$(makeflags) -f makefile.nmake cd .. +homeplug:: + cd homeplug + $(make) /$(makeflags) -f makefile.nmake + cd .. + irda:: cd irda $(make) /$(makeflags) -f makefile.nmake @@ -179,6 +185,9 @@ cd h223 $(make) /$(makeflags) -f makefile.nmake clean cd .. + cd homeplug + $(make) /$(makeflags) -f makefile.nmake clean + cd .. cd irda $(make) /$(makeflags) -f makefile.nmake clean cd .. @@ -251,6 +260,9 @@ cd h223 $(make) /$(makeflags) -f makefile.nmake distclean cd .. + cd homeplug + $(make) /$(makeflags) -f makefile.nmake distclean + cd .. cd irda $(make) /$(makeflags) -f makefile.nmake distclean cd .. @@ -323,6 +335,9 @@ cd h223 $(make) /$(makeflags) -f makefile.nmake maintainer-clean cd .. + cd homeplug + $(make) /$(makeflags) -f makefile.nmake maintainer-clean + cd .. cd irda $(make) /$(makeflags) -f makefile.nmake maintainer-clean cd .. @@ -382,6 +397,7 @@ xcopy giop\*.dll $(version) /d xcopy gryphon\*.dll $(version) /d xcopy h223\*.dll $(version) /d + xcopy homeplug\*.dll $(version) /d xcopy irda\*.dll $(version) /d xcopy lwres\*.dll $(version) /d xcopy mate\*.dll $(version) /d
- Follow-Ups:
- Re: [Wireshark-dev] [PATCH] New plugin for Homeplug
- From: Jaap Keuter
- Re: [Wireshark-dev] [PATCH] New plugin for Homeplug
- Prev by Date: Re: [Wireshark-dev] Byte order, hf_register_info and value displayed
- Next by Date: Re: [Wireshark-dev] [PATCH] New plugin for Homeplug
- Previous by thread: Re: [Wireshark-dev] Byte order, hf_register_info and value displayed
- Next by thread: Re: [Wireshark-dev] [PATCH] New plugin for Homeplug
- Index(es):