Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Ethereal-dev: [Ethereal-dev] New dissector: STANAG 5066

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "M.P. Andriesse" <menno.andriesse@xxxxxxxxxxxxx>
Date: Fri, 14 Oct 2005 14:50:43 +0200
Oops...

Actually attaching the file does work better...

--
Menno Andriesse

Nato C3 Agency
CIS Division,
Transmission & Network Services
Resource Centre

P.O. Box 174
2501 CD The Hague
The Netherlands
Tel: +31 (0)70 374 3449
Fax: +31 (0)70 374 3049

mailto:Menno.Andriesse@xxxxxxxxxxxxx

Index: configure.in
===================================================================
--- configure.in	(revision 16219)
+++ configure.in	(working copy)
@@ -1251,6 +1251,7 @@
   plugins/rlm/Makefile
   plugins/rtnet/Makefile
   plugins/rudp/Makefile
+  plugins/s5066/Makefile
   plugins/stats_tree/Makefile
   plugins/v5ua/Makefile
   tools/Makefile
Index: Makefile.am
===================================================================
--- Makefile.am	(revision 16219)
+++ Makefile.am	(working copy)
@@ -198,6 +198,7 @@
 	plugins/rlm/rlm.la \
 	plugins/rtnet/rtnet.la \
 	plugins/rudp/rudp.la \
+	plugins/s5066/s5066.la \
 	plugins/v5ua/v5ua.la
 
 if ENABLE_STATIC
@@ -227,6 +228,7 @@
 	"-dlopen" plugins/rlm/rlm.la \
 	"-dlopen" plugins/rtnet/rtnet.la \
 	"-dlopen" plugins/rudp/rudp.la \
+	"-dlopen" plugins/s5066/s5066.la \
 	"-dlopen" plugins/v5ua/v5ua.la
 
 endif		# ENABLE_STATIC

Property changes on: plugins/s5066
___________________________________________________________________
Name: svn:ignore
   + .deps
.libs
Makefile
Makefile.in
config.cache
config.h
config.h.in
config.log
config.status
configure
stamp-h
*.obj
*.dll
*.exp
*.lib
*.pdb
tags
TAGS



Index: plugins/s5066/AUTHORS
===================================================================
--- plugins/s5066/AUTHORS	(revision 0)
+++ plugins/s5066/AUTHORS	(revision 0)
@@ -0,0 +1,3 @@
+Author:
+Menno Andriesse <s5066 [AT] nc3a.nato.int>
+
Index: plugins/s5066/Makefile.nmake
===================================================================
--- plugins/s5066/Makefile.nmake	(revision 0)
+++ plugins/s5066/Makefile.nmake	(revision 0)
@@ -0,0 +1,31 @@
+#
+# $Id: $
+#
+
+include ..\..\config.nmake
+
+############### no need to modify below this line #########
+
+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_LIBETHEREAL
+LINK_PLUGIN_WITH=..\..\epan\libethereal.lib
+CFLAGS=/DHAVE_WIN32_LIBETHEREAL_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS)
+
+OBJECTS=packet-s5066.obj 
+
+s5066.dll s5066.exp s5066.lib : $(OBJECTS) $(LINK_PLUGIN_WITH)
+	link -dll /out:s5066.dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
+	$(GLIB_LIBS)
+
+!ENDIF
+
+clean:
+	rm -f $(OBJECTS) s5066.dll s5066.exp s5066.lib *.pdb
+
+distclean: clean
+
+maintainer-clean: distclean
Index: plugins/s5066/moduleinfo.h
===================================================================
--- plugins/s5066/moduleinfo.h	(revision 0)
+++ plugins/s5066/moduleinfo.h	(revision 0)
@@ -0,0 +1,17 @@
+/* Included *after* config.h, in order to re-define these macros */
+
+#ifdef PACKAGE
+#undef PACKAGE
+#endif
+
+/* Name of package */
+#define PACKAGE "s5066"
+
+
+#ifdef VERSION
+#undef VERSION
+#endif
+
+/* Version number of package */
+#define VERSION "0.2.0"
+
Index: plugins/s5066/ChangeLog
===================================================================
Index: plugins/s5066/COPYING
===================================================================
--- plugins/s5066/COPYING	(revision 0)
+++ plugins/s5066/COPYING	(revision 0)
@@ -0,0 +1,340 @@
+		    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
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
Index: plugins/s5066/Makefile.am
===================================================================
--- plugins/s5066/Makefile.am	(revision 0)
+++ plugins/s5066/Makefile.am	(revision 0)
@@ -0,0 +1,48 @@
+# Makefile.am
+# Automake file for Ethereal/S5066
+#
+# $Id: $
+#
+# Ethereal - Network traffic analyzer
+# By Gerald Combs <gerald@xxxxxxxxxxxx>
+# 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)
+
+plugindir = @plugindir@
+
+plugin_LTLIBRARIES = s5066.la
+s5066_la_SOURCES = packet-s5066.c moduleinfo.h
+s5066_la_LDFLAGS = -module -avoid-version
+s5066_la_LIBADD = @PLUGIN_LIBS@
+
+# Libs must be cleared, or else libtool won't create a shared module.
+# If your module needs to be linked against any particular libraries,
+# add them here.
+LIBS =
+
+CLEANFILES = \
+        s5066 \
+        *~
+
+MAINTAINERCLEANFILES = \
+        Makefile.in
+
+EXTRA_DIST = \
+        Makefile.nmake
+
Index: plugins/s5066/packet-s5066.c
===================================================================
--- plugins/s5066/packet-s5066.c	(revision 0)
+++ plugins/s5066/packet-s5066.c	(revision 0)
@@ -0,0 +1,1277 @@
+/* packet-s5066.c
+ * Routines for STANAG 5066 SIS layer packet disassembly
+ *
+ * $Id: $
+ *
+ * Copyright (c) 2005 by Menno Andriesse <s5066 [AT] nc3a.nato.int>
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxxxxxx>
+ * Copyright 1999 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 <gmodule.h>
+#include <epan/packet.h>
+#include <epan/prefs.h>
+#include <epan/dissectors/packet-tcp.h> /* For tcp_dissect_pdus() */
+
+/* Forward reference */
+/* Register functions */
+void proto_register_s5066(void);
+void proto_reg_handoff_s5066(void);
+/* Main dissectors */
+static void dissect_s5066_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+static guint get_s5066_pdu_len(tvbuff_t *tvb, int offset);
+static void dissect_s5066_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+/* Service type and address dissectors */
+static guint dissect_s5066_servicetype(tvbuff_t *tvb, guint offset, proto_tree *tree);
+static guint dissect_s5066_address(tvbuff_t *tvb, guint offset, proto_tree *tree, gint source);
+/* S-Primitive dissectors */
+static guint dissect_s5066_01(tvbuff_t *tvb, guint offset, proto_tree *tree);
+/* static guint dissect_s5066_02(tvbuff_t *tvb, guint offset, proto_tree *tree); */
+static guint dissect_s5066_03(tvbuff_t *tvb, guint offset, proto_tree *tree);
+static guint dissect_s5066_04(tvbuff_t *tvb, guint offset, proto_tree *tree);
+static guint dissect_s5066_05(tvbuff_t *tvb, guint offset, proto_tree *tree);
+static guint dissect_s5066_06(tvbuff_t *tvb, guint offset, proto_tree *tree);
+static guint dissect_s5066_07(tvbuff_t *tvb, guint offset, proto_tree *tree);
+static guint dissect_s5066_08(tvbuff_t *tvb, guint offset, proto_tree *tree);
+static guint dissect_s5066_09(tvbuff_t *tvb, guint offset, proto_tree *tree);
+static guint dissect_s5066_10(tvbuff_t *tvb, guint offset, proto_tree *tree);
+static guint dissect_s5066_11(tvbuff_t *tvb, guint offset, proto_tree *tree);
+static guint dissect_s5066_12(tvbuff_t *tvb, guint offset, proto_tree *tree);
+static guint dissect_s5066_13(tvbuff_t *tvb, guint offset, proto_tree *tree);
+static guint dissect_s5066_14(tvbuff_t *tvb, guint offset, proto_tree *tree);
+/* static guint dissect_s5066_15(tvbuff_t *tvb, guint offset, proto_tree *tree); */
+/* static guint dissect_s5066_16(tvbuff_t *tvb, guint offset, proto_tree *tree); */
+/* static guint dissect_s5066_17(tvbuff_t *tvb, guint offset, proto_tree *tree); */
+static guint dissect_s5066_18(tvbuff_t *tvb, guint offset, proto_tree *tree, guint pdu_size);
+static guint dissect_s5066_19(tvbuff_t *tvb, guint offset, proto_tree *tree, guint pdu_size);
+static guint dissect_s5066_20(tvbuff_t *tvb, guint offset, proto_tree *tree);
+static guint dissect_s5066_21(tvbuff_t *tvb, guint offset, proto_tree *tree, guint pdu_size);
+static guint dissect_s5066_22(tvbuff_t *tvb, guint offset, proto_tree *tree);
+static guint dissect_s5066_23(tvbuff_t *tvb, guint offset, proto_tree *tree);
+static guint dissect_s5066_24(tvbuff_t *tvb, guint offset, proto_tree *tree);
+static guint dissect_s5066_25(tvbuff_t *tvb, guint offset, proto_tree *tree, guint pdu_size);
+static guint dissect_s5066_26(tvbuff_t *tvb, guint offset, proto_tree *tree);
+static guint dissect_s5066_27(tvbuff_t *tvb, guint offset, proto_tree *tree);
+
+/* Define version if we are not building ethereal statically */
+#include "moduleinfo.h"
+#ifndef ENABLE_STATIC
+G_MODULE_EXPORT const gchar version[] = VERSION;
+#endif
+
+static gint proto_s5066 = -1;
+static dissector_handle_t s5066_tcp_handle;
+static dissector_handle_t data_handle;
+
+/* Enable desegmentation of S5066 over TCP */
+static gboolean s5066_desegment = FALSE;
+/* Dissect old 'edition 1' of STANAG 5066 (It lacks the 'version' field.) */
+static gboolean s5066_edition_one = FALSE;
+/* This port is registered with IANA */
+static gint global_s5066_port = 5066; 
+/* Size of header outside 'size' field */
+static gint s5066_header_size = 5;
+/* Offset of 'size' field */
+static gint s5066_size_offset = 3;
+
+/* Sync should be 0x90EB */
+static gint hf_s5066_sync_word = -1;
+/* Version should be 0x00 */
+static gint hf_s5066_version = -1;
+/* Total size of the PDU, excluding this size and previous fields */
+/* So total size is this + 5 bytes (s5066_header_size) */
+static gint hf_s5066_size = -1;
+/* Th type of PDU */
+static gint hf_s5066_type = -1;
+static const value_string s5066_pdu_type[] = {
+	{ 1, "S_BIND_REQUEST"},
+	{ 2, "S_UNBIND_REQUEST"},
+	{ 3, "S_BIND_ACCEPTED"},
+	{ 4, "S_BIND_REJECTED"},
+	{ 5, "S_UNBIND_INDICATION"},
+	{ 6, "S_HARD_LINK_ESTABLISH"},
+	{ 7, "S_HARD_LINK_TERMINATE"},
+	{ 8, "S_HARD_LINK_ESTABLISHED"},
+	{ 9, "S_HARD_LINK_REJECTED"},
+	{10, "S_HARD_LINK_TERMINATED"},
+	{11, "S_HARD_LINK_INDICATION"},
+	{12, "S_HARD_LINK_ACCEPT"},
+	{13, "S_HARD_LINK_REJECT"},
+	{14, "S_SUBNET_AVAILABILITY"},
+	{15, "S_DATAFLOW_ON"},
+	{16, "S_DATAFLOW_OFF"},
+	{17, "S_KEEP_ALIVE"},
+	{18, "S_MANAGEMENT_MESSAGE_REQUEST"},
+	{19, "S_MANAGEMENT_MESSAGE_INDICATION"},
+	{20, "S_UNIDATA_REQUEST"},
+	{21, "S_UNIDATA_INDICATION"},
+	{22, "S_UNIDATA_REQUEST_CONFIRM"},
+	{23, "S_UNIDATA_REQUEST_REJECTED"},
+	{24, "S_EXPEDITED_UNIDATA_REQUEST"},
+	{25, "S_EXPEDITED_UNIDATA_INDICATION"},
+	{26, "S_EXPEDITED_UNIDATA_REQUEST_CONFIRM"},
+	{27, "S_EXPEDITED_UNIDATA_REQUEST_REJECTED"},
+	{ 0, NULL },
+};
+
+/* STANAG 5066 Address */
+/* Size is defined in nibbles (4 bits) */
+static gint hf_s5066_ad_size = -1;
+/* Group flag: 0 = false, 1 = true */ 
+static gint hf_s5066_ad_group = -1; 
+/* The remainder of the 4 bytes form the address */
+static gint hf_s5066_ad_address = -1; 
+
+/* Service type */
+/* Transmission mode: */
+static gint hf_s5066_st_txmode = -1; 
+static const value_string s5066_st_txmode[] = {
+	{ 0, "Ignore service type field"},
+	{ 1, "ARQ"},
+	{ 2, "Non-ARQ (Broacast)"},
+	{ 3, "Other non-ARQ types"},
+	{ 4, "Other non-ARQ types"},
+	{ 5, "Other non-ARQ types"},
+	{ 6, "Other non-ARQ types"},
+	{ 7, "Other non-ARQ types"},
+	{ 8, "Other non-ARQ types"},
+	{ 9, "Other non-ARQ types"},
+	{10, "Other non-ARQ types"},
+	{11, "Other non-ARQ types"},
+	{12, "Other non-ARQ types"},
+	{13, "Other non-ARQ types"},
+	{14, "Other non-ARQ types"},
+	{15, "Other non-ARQ types"},
+	{ 0, NULL },
+};
+/* Delivery confirmation: */
+static gint hf_s5066_st_delivery_confirmation = -1; 
+static const value_string s5066_st_delivery_confirmation[] = {
+	{ 0, "No confirmation"},
+	{ 1, "Node delivery confirmation"},
+	{ 2, "Client delivery confirmation"},
+	{ 3, "-- Not defined --"},
+	{ 0, NULL },
+};
+/* Delivery order: */
+static gint hf_s5066_st_delivery_order = -1; 
+static const value_string s5066_st_delivery_order[] = {
+	{ 0, "In-order delivery"},
+	{ 1, "As-they-arrive"},
+	{ 0, NULL },
+};
+/* Extended field present: (Never in the current version.) */
+static gint hf_s5066_st_extended = -1; 
+static const value_string s5066_st_extended[] = {
+	{ 0, "No extended field"},
+	{ 1, "Extended field follows"},
+	{ 0, NULL },
+};
+/* Number of retransmissions when in Non-ARQ: */
+static gint hf_s5066_st_retries = -1; 
+
+/* Type  1: S_BIND_REQUEST */
+static gint hf_s5066_01_sapid = -1;
+static gint hf_s5066_01_rank = -1;
+static gint hf_s5066_01_unused = -1;
+
+/* Type  2: S_UNBIND_REQUEST */
+/*   --- no subfields ---   */
+
+/* Type  3: S_BIND_ACCEPTED */
+static gint hf_s5066_03_sapid = -1;
+static gint hf_s5066_03_unused = -1;
+static gint hf_s5066_03_mtu = -1;
+
+/* Type  4: S_BIND_REJECTED */
+static gint hf_s5066_04_reason = -1;
+static const value_string s5066_04_reason[] = {
+	{ 0, "Unknown reason"},
+	{ 1, "Not enough resources"},
+	{ 2, "Invalid Sap ID"},
+	{ 3, "Sap ID already allocated"},
+	{ 4, "ARQ mode unsupportable during broadcast session"},
+	{ 0, NULL },
+};
+
+/* Type  5: S_UNBIND_INDICATION */
+static gint hf_s5066_05_reason = -1;
+static const value_string s5066_05_reason[] = {
+	{ 0, "Unknown reason"},
+	{ 1, "Connection pre-empted by higher ranking client"},
+	{ 2, "Inactivity (failure to respond to 'Keep-alive')"},
+	{ 3, "Too many invalid primitives"},
+	{ 4, "Too many expedited data request primitives"},
+	{ 5, "ARQ mode unsupportable during broadcast session"},
+	{ 0, NULL },
+};
+
+/* Hard links: hardlinktype value string array. */
+static const value_string s5066_hard_link_type[] = {
+	{ 0, "Link reservation"},
+	{ 1, "Partial Bandwidth reservation"},
+	{ 2, "Full Bandwidth reservation"},
+	{ 3, "--- undefined ---"},
+	{ 0, NULL },
+};
+
+/* Type  6: S_HARD_LINK_ESTABLISH */
+static gint hf_s5066_06_link_type = -1;
+static gint hf_s5066_06_link_priority = -1;
+static gint hf_s5066_06_sapid = -1;
+
+/* Type  7: S_HARD_LINK_TERMINATE */
+/* Only  remote node address */
+
+/* Type  8: S_HARD_LINK_ESTABLISHED */
+static gint hf_s5066_08_remote_status = -1;
+static const value_string s5066_08_remote_status[] = {
+	{ 0, "ERROR"},
+	{ 1, "OK"},
+	{ 0, NULL },
+};
+static gint hf_s5066_08_link_type = -1;
+static gint hf_s5066_08_link_priority = -1;
+static gint hf_s5066_08_sapid = -1;
+
+/* Type  9: S_HARD_LINK_REJECTED */
+static gint hf_s5066_09_reason = -1;
+static const value_string s5066_09_reason[] = {
+	{ 0, "--- undefined ---"},
+	{ 1, "Remote node busy"},
+	{ 2, "Higher priority link exists"},
+	{ 3, "Remote node not responding"},
+	{ 4, "Destination Sap ID not bound"},
+	{ 5, "Requested Type-0 link exists"},
+	{ 0, NULL },
+};
+static gint hf_s5066_09_link_type = -1;
+static gint hf_s5066_09_link_priority = -1;
+static gint hf_s5066_09_sapid = -1;
+
+/* Type 10: S_HARD_LINK_TERMINATED */
+static gint hf_s5066_10_reason = -1;
+static const value_string s5066_10_reason[] = {
+	{ 0, "--- undefined ---"},
+	{ 1, "Link terminated by remote node"},
+	{ 2, "Higher priority link requested"},
+	{ 3, "Remote node not responding"},
+	{ 4, "Destination Sap ID not bound"},
+	{ 5, "Physical link broken"},
+	{ 0, NULL },
+};
+static gint hf_s5066_10_link_type = -1;
+static gint hf_s5066_10_link_priority = -1;
+static gint hf_s5066_10_sapid = -1;
+
+/* Type 11: S_HARD_LINK_INDICATION */
+static gint hf_s5066_11_remote_status = -1;
+static const value_string s5066_11_remote_status[] = {
+	{ 0, "ERROR"},
+	{ 1, "OK"},
+	{ 0, NULL },
+};
+static gint hf_s5066_11_link_type = -1;
+static gint hf_s5066_11_link_priority = -1;
+static gint hf_s5066_11_sapid = -1;
+
+/* Type 12: S_HARD_LINK_ACCEPT */
+static gint hf_s5066_12_link_type = -1;
+static gint hf_s5066_12_link_priority = -1;
+static gint hf_s5066_12_sapid = -1;
+
+/* Type 13: S_HARD_LINK_REJECT */
+static gint hf_s5066_13_reason = -1;
+static const value_string s5066_13_reason[] = {
+	{ 0, "--- undefined ---"},
+	{ 0, NULL },
+};
+static gint hf_s5066_13_link_type = -1;
+static gint hf_s5066_13_link_priority = -1;
+static gint hf_s5066_13_sapid = -1;
+
+/* Type 14: S_SUBNET_AVAILABILITY */
+static gint hf_s5066_14_status= -1;
+static const value_string s5066_14_status[] = {
+	{ 0, "Off"},
+	{ 1, "On"},
+	{ 2, "Receive only"},
+	{ 3, "Half-duplex"},
+	{ 4, "Full-duplex"},
+	{ 0, NULL },
+};
+static gint hf_s5066_14_reason= -1;
+static const value_string s5066_14_reason[] = {
+	{ 0, "Unknown reason"},
+	{ 1, "Local node in EMCON"},
+	{ 2, "Higher priority link requested"},
+	{ 0, NULL },
+};
+
+/* Type 15: S_DATAFLOW_ON */
+/*   --- no subfields ---   */
+
+/* Type 16: S_DATAFLOW_OFF */
+/*   --- no subfields ---   */
+
+/* Type 17: S_KEEP_ALIVE */
+/*   --- no subfields ---   */
+
+/* Type 18: S_MANAGEMENT_MESSAGE_REQUEST */
+static gint hf_s5066_18_type = -1;
+static gint hf_s5066_18_body = -1; 
+
+/* Type 19: S_MANAGEMENT_MESSAGE_INDICATION */
+static gint hf_s5066_19_type = -1;
+static gint hf_s5066_19_body = -1;
+
+/* Type 20: S_UNIDATA_REQUEST */
+static gint hf_s5066_20_priority = -1;
+static gint hf_s5066_20_sapid = -1;
+static gint hf_s5066_20_ttl = -1;
+static gint hf_s5066_20_size = -1;
+
+/* Type 21: S_UNIDATA_INDICATION */
+/* TODO: handle RockwellCollins (v2.1 and earlier) 4-byte offset. */
+/* TODO: handle NON-ARQ With Errors case. */
+static gint hf_s5066_21_priority = -1;
+static gint hf_s5066_21_dest_sapid = -1;
+static gint hf_s5066_21_tx_mode = -1;
+static gint hf_s5066_21_src_sapid = -1;
+static gint hf_s5066_21_size = -1;
+static gint hf_s5066_21_err_blocks = -1;
+static gint hf_s5066_21_nrx_blocks = -1; 
+
+
+/* Type 22: S_UNIDATA_REQUEST_CONFIRM */
+static gint hf_s5066_22_unused = -1;
+static gint hf_s5066_22_sapid = -1;
+static gint hf_s5066_22_size = -1;
+
+/* Type 23: S_UNIDATA_REQUEST_REJECTED */
+static gint hf_s5066_23_reason = -1;
+static const value_string s5066_23_reason[] = {
+	{ 0, "Unknown reason"},
+	{ 1, "Time-To-Live expired"},
+	{ 2, "Destination SapID not bound"},
+	{ 3, "Destination node not responding"},
+	{ 4, "U_PDU larger than MTU"},
+	{ 5, "Transmission Mode not specified"},
+	{ 0, NULL },
+};
+static gint hf_s5066_23_sapid = -1;
+static gint hf_s5066_23_size = -1;
+
+/* Type 24: S_EXPEDITED_UNIDATA_REQUEST */
+static gint hf_s5066_24_unused = -1;
+static gint hf_s5066_24_sapid = -1;
+static gint hf_s5066_24_ttl = -1;
+static gint hf_s5066_24_size = -1;
+
+/* Type 25: S_EXPEDITED_UNIDATA_INDICATION */
+/* TODO: handle RockwellCollins (v2.1 and earlier) 4-byte offset. */
+/* TODO: handle NON-ARQ With Errors case. */
+static gint hf_s5066_25_unused = -1;
+static gint hf_s5066_25_dest_sapid = -1;
+static gint hf_s5066_25_tx_mode = -1;
+static gint hf_s5066_25_src_sapid = -1;
+static gint hf_s5066_25_size = -1;
+static gint hf_s5066_25_err_blocks = -1;
+static gint hf_s5066_25_nrx_blocks = -1; 
+
+/* Type 26: S_EXPEDITED_UNIDATA_REQUEST_CONFIRM */
+static gint hf_s5066_26_unused = -1;
+static gint hf_s5066_26_sapid = -1;
+static gint hf_s5066_26_size = -1;
+
+/* Type 27: S_EXPEDITED_UNIDATA_REQUEST_REJECTED */
+static gint hf_s5066_27_reason = -1;
+static const value_string s5066_27_reason[] = {
+	{ 0, "Unknown reason"},
+	{ 1, "Time-To-Live expired"},
+	{ 2, "Destination SapID not bound"},
+	{ 3, "Destination node not responding"},
+	{ 4, "U_PDU larger than MTU"},
+	{ 5, "Transmission Mode not specified"},
+	{ 0, NULL },
+};
+static gint hf_s5066_27_sapid = -1;
+static gint hf_s5066_27_size = -1;
+
+
+static gint ett_s5066 = -1;
+static gint ett_s5066_pdu = -1;
+static gint ett_s5066_servicetype = -1;
+static gint ett_s5066_address = -1;
+
+#ifndef ENABLE_STATIC
+G_MODULE_EXPORT void
+plugin_register(void)
+{
+	/* Register the protocol, protocol fields, and subtrees */
+	if (proto_s5066 == -1) { /* Execute protocol init only once  */
+		proto_register_s5066();
+	}
+}
+
+G_MODULE_EXPORT void
+plugin_reg_handoff(void)
+{
+	proto_reg_handoff_s5066();
+}
+#endif
+
+void
+proto_register_s5066(void)
+{
+	static hf_register_info hf[] = {
+		{ &hf_s5066_sync_word,
+			{ "Sync preample", "s5066.sync", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL }
+		},
+		{ &hf_s5066_version,
+			{ "S5066 version", "s5066.version", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL }
+		},
+		{ &hf_s5066_size,
+			{ "S_Primitive size", "s5066.size", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }
+		},
+		{ &hf_s5066_type,
+			{ "PDU Type", "s5066.type", FT_UINT8, BASE_DEC, VALS(s5066_pdu_type), 0x0, "", HFILL }
+		},
+		/* STANAG 5066 Address */
+		{ &hf_s5066_ad_size,
+			{ "Address size (1/2 Bytes)", "s5066.address.size", FT_UINT8, BASE_HEX, NULL, 0xE0, "", HFILL }
+		},
+		{ &hf_s5066_ad_group,
+			{ "Group address", "s5066.address.group", FT_UINT8, BASE_HEX, NULL, 0x10, "", HFILL }
+		},
+		{ &hf_s5066_ad_address,
+			{ "Address", "s5066.address.address", FT_IPv4, BASE_NONE, NULL, 0x1FFFFFFF, "", HFILL }
+		},
+		/* Service type */
+		{ &hf_s5066_st_txmode,
+			{ "Transmission mode", "s5066.st.txmode", FT_UINT8, BASE_HEX, VALS(s5066_st_txmode), 0xF0, "", HFILL }
+		},
+		{ &hf_s5066_st_delivery_confirmation,
+			{ "Delivery confirmation", "s5066.st.confirm", FT_UINT8, BASE_HEX, VALS(s5066_st_delivery_confirmation),  0x0C, "", HFILL }
+		},
+		{ &hf_s5066_st_delivery_order,
+			{ "Delivery order", "s5066.st.order", FT_UINT8, BASE_HEX, VALS(s5066_st_delivery_order), 0x02, "", HFILL }
+		},
+		{ &hf_s5066_st_extended,
+			{ "Extended field", "s5066.st.extended", FT_UINT8, BASE_HEX, VALS(s5066_st_extended), 0x01, "", HFILL }
+		},
+		{ &hf_s5066_st_retries,
+			{ "Minimum number of retransmissions", "s5066.st.retries", FT_UINT8, BASE_DEC, NULL, 0xF0, "", HFILL }
+		},
+		/* PDU Type 01: S_BIND_REQUEST */
+		{ &hf_s5066_01_sapid,
+			{ "Sap ID", "s5066.01.sapid", FT_UINT8, BASE_DEC, NULL, 0xF0, "", HFILL }
+		},
+		{ &hf_s5066_01_rank,
+			{ "Rank", "s5066.01.rank", FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL }
+		},
+		{ &hf_s5066_01_unused,
+			{ "(Unused)", "s5066.01.unused", FT_UINT8, BASE_HEX, NULL, 0x0F, "", HFILL }
+		},
+		/* PDU Type 02: S_UNBIND_REQUEST */
+		/*     --- no subfields ---     */
+		/* PDU Type 03: S_BIND_ACCEPTED */
+		{ &hf_s5066_03_sapid,
+			{ "Sap ID", "s5066.03.sapid", FT_UINT8, BASE_DEC, NULL, 0xF0, "", HFILL }
+		},
+		{ &hf_s5066_03_unused,
+			{ "(Unused)", "s5066.03.unused", FT_UINT8, BASE_HEX, NULL, 0x0F, "", HFILL }
+		},
+		{ &hf_s5066_03_mtu,
+			{ "MTU", "s5066.03.mtu", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }
+		},
+		/* PDU Type 04: S_BIND_REJECTED */
+		{ &hf_s5066_04_reason,
+			{ "Reason", "s5066.04.reason", FT_UINT8, BASE_DEC, VALS(s5066_04_reason), 0x0, "", HFILL }
+		},
+		/* PDU Type 05: S_UNBIND_INDICATION */
+		{ &hf_s5066_05_reason,
+			{ "Reason", "s5066.05.reason", FT_UINT8, BASE_DEC, VALS(s5066_05_reason), 0x0, "", HFILL }
+		},
+		/* Type  6: S_HARD_LINK_ESTABLISH */
+		{ &hf_s5066_06_link_type,
+			{ "Hardlink type", "s5066.06.type", FT_UINT8, BASE_DEC, VALS(s5066_hard_link_type), 0xC0, "", HFILL }
+		},
+		{ &hf_s5066_06_link_priority,
+			{ "Priority", "s5066.06.priority", FT_UINT8, BASE_DEC, NULL, 0x30, "", HFILL }
+		},
+		{ &hf_s5066_06_sapid,
+			{ "Remote Sap ID", "s5066.06.sapid", FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL }
+		},
+		/* Type  7: S_HARD_LINK_TERMINATE */
+		/* --- Only remote node address --- */
+		/* Type  8: S_HARD_LINK_ESTABLISHED */
+		{ &hf_s5066_08_remote_status,
+			{ "Remote node status", "s5066.08.status", FT_UINT8, BASE_DEC, VALS(s5066_08_remote_status), 0x0, "", HFILL }
+		},
+		{ &hf_s5066_08_link_type,
+			{ "Hardlink type", "s5066.08.type", FT_UINT8, BASE_DEC, VALS(s5066_hard_link_type), 0xC0, "", HFILL }
+		},
+		{ &hf_s5066_08_link_priority,
+			{ "Priority", "s5066.08.priority", FT_UINT8, BASE_DEC, NULL, 0x30, "", HFILL }
+		},
+		{ &hf_s5066_08_sapid,
+			{ "Remote Sap ID", "s5066.08.sapid", FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL }
+		},
+		/* Type  9: S_HARD_LINK_REJECTED */
+		{ &hf_s5066_09_reason,
+			{ "Reason", "s5066.09.reason", FT_UINT8, BASE_DEC, VALS(s5066_09_reason), 0x0, "", HFILL }
+		},
+		{ &hf_s5066_09_link_type,
+			{ "Hardlink type", "s5066.09.type", FT_UINT8, BASE_DEC, VALS(s5066_hard_link_type), 0xC0, "", HFILL }
+		},
+		{ &hf_s5066_09_link_priority,
+			{ "Priority", "s5066.09.priority", FT_UINT8, BASE_DEC, NULL, 0x30, "", HFILL }
+		},
+		{ &hf_s5066_09_sapid,
+			{ "Remote Sap ID", "s5066.09.sapid", FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL }
+		},
+		/* Type 10: S_HARD_LINK_TERMINATED */
+		{ &hf_s5066_10_reason,
+			{ "Reason", "s5066.10.reason", FT_UINT8, BASE_DEC, VALS(s5066_10_reason), 0x0, "", HFILL }
+		},
+		{ &hf_s5066_10_link_type,
+			{ "Hardlink type", "s5066.10.type", FT_UINT8, BASE_DEC, VALS(s5066_hard_link_type), 0xC0, "", HFILL }
+		},
+		{ &hf_s5066_10_link_priority,
+			{ "Priority", "s5066.10.priority", FT_UINT8, BASE_DEC, NULL, 0x30, "", HFILL }
+		},
+		{ &hf_s5066_10_sapid,
+			{ "Remote Sap ID", "s5066.10.sapid", FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL }
+		},
+		/* Type 11: S_HARD_LINK_INDICATION */
+		{ &hf_s5066_11_remote_status,
+			{ "Remote node status", "s5066.11.status", FT_UINT8, BASE_DEC, VALS(s5066_11_remote_status), 0x0, "", HFILL }
+		},
+		{ &hf_s5066_11_link_type,
+			{ "Hardlink type", "s5066.11.type", FT_UINT8, BASE_DEC, VALS(s5066_hard_link_type), 0xC0, "", HFILL }
+		},
+		{ &hf_s5066_11_link_priority,
+			{ "Priority", "s5066.11.priority", FT_UINT8, BASE_DEC, NULL, 0x30, "", HFILL }
+		},
+		{ &hf_s5066_11_sapid,
+			{ "Remote Sap ID", "s5066.11.sapid", FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL }
+		},
+		/* Type 12: S_HARD_LINK_ACCEPT */
+		{ &hf_s5066_12_link_type,
+			{ "Hardlink type", "s5066.12.type", FT_UINT8, BASE_DEC, VALS(s5066_hard_link_type), 0xC0, "", HFILL }
+		},
+		{ &hf_s5066_12_link_priority,
+			{ "Priority", "s5066.12.priority", FT_UINT8, BASE_DEC, NULL, 0x30, "", HFILL }
+		},
+		{ &hf_s5066_12_sapid,
+			{ "Remote Sap ID", "s5066.12.sapid", FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL }
+		},
+		/* Type 13: S_HARD_LINK_REJECT */
+		{ &hf_s5066_13_reason,
+			{ "Reason", "s5066.13.reason", FT_UINT8, BASE_DEC, VALS(s5066_13_reason), 0x0, "", HFILL }
+		},
+		{ &hf_s5066_13_link_type,
+			{ "Hardlink type", "s5066.13.type", FT_UINT8, BASE_DEC, VALS(s5066_hard_link_type), 0xC0, "", HFILL }
+		},
+		{ &hf_s5066_13_link_priority,
+			{ "Priority", "s5066.13.priority", FT_UINT8, BASE_DEC, NULL, 0x30, "", HFILL }
+		},
+		{ &hf_s5066_13_sapid,
+			{ "Remote Sap ID", "s5066.13.sapid", FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL }
+		},
+		/* Type 14: S_SUBNET_AVAILABILITY */
+		{ &hf_s5066_14_status,
+			{ "Status", "s5066.14.status", FT_UINT8, BASE_DEC, VALS(s5066_14_status), 0x0, "", HFILL }
+		},
+		{ &hf_s5066_14_reason,
+			{ "Reason", "s5066.14.reason", FT_UINT8, BASE_DEC, VALS(s5066_14_reason), 0x0, "", HFILL }
+		},
+		/* Type 15: S_DATAFLOW_ON */
+		/*   --- no subfields ---   */
+		/* Type 16: S_DATAFLOW_OFF */
+		/*   --- no subfields ---   */
+		/* Type 17: S_KEEP_ALIVE */
+		/*   --- no subfields ---   */
+		/* Type 18: S_MANAGEMENT_MESSAGE_REQUEST */
+		{ &hf_s5066_18_type,
+			{ "Message Type", "s5066.18.type", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL }
+		},
+		{ &hf_s5066_18_body,
+			{ "Message Body", "s5066.18.body", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }
+		},
+		/* Type 19: S_MANAGEMENT_MESSAGE_INDICATION */
+		{ &hf_s5066_19_type,
+			{ "Message Type", "s5066.19.type", FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL }
+		},
+		{ &hf_s5066_19_body,
+			{ "Message Body", "s5066.19.body", FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }
+		},
+		/* Type 20: S_UNIDATA_REQUEST */
+		{ &hf_s5066_20_priority,
+			{ "Priority", "s5066.20.priority", FT_UINT8, BASE_DEC, NULL, 0xF0, "", HFILL }
+		},
+		{ &hf_s5066_20_sapid,
+			{ "Destination Sap ID", "s5066.20.sapid", FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL }
+		},
+		{ &hf_s5066_20_ttl,
+			{ "Time-To-Live (x2 seconds)", "s5066.20.ttl", FT_UINT24, BASE_DEC, NULL, 0x0FFFFF, "", HFILL }
+		},
+		{ &hf_s5066_20_size,
+			{ "U_PDU Size", "s5066.20.size", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }
+		},
+		/* Type 21: S_UNIDATA_INDICATION */
+		{ &hf_s5066_21_priority,
+			{ "Priority", "s5066.21.priority", FT_UINT8, BASE_DEC, NULL, 0xF0, "", HFILL }
+		},
+		{ &hf_s5066_21_dest_sapid,
+			{ "Destination Sap ID", "s5066.21.dest_sapid", FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL }
+		},
+		{ &hf_s5066_21_tx_mode,
+			{ "Transmission Mode", "s5066.21.txmode", FT_UINT8, BASE_HEX, VALS(s5066_st_txmode), 0xF0, "", HFILL }
+		},
+		{ &hf_s5066_21_src_sapid,
+			{ "Source Sap ID", "s5066.21.src_sapid", FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL }
+		},
+		{ &hf_s5066_21_size,
+			{ "U_PDU Size", "s5066.21.size", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }
+		},
+		{ &hf_s5066_21_err_blocks,
+			{ "Number of errored blocks", "s5066.21.err_blocks", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }
+		},
+		{ &hf_s5066_21_nrx_blocks,
+			{ "Number of non-received blocks", "s5066.21.nrx_blocks", FT_UINT16, BASE_DEC, NULL, 0x0F, "", HFILL }
+		},
+		/* Type 22: S_UNIDATA_REQUEST_CONFIRM */
+		{ &hf_s5066_22_unused,
+			{ "(Unused)", "s5066.22.unused", FT_UINT8, BASE_DEC, NULL, 0xF0, "", HFILL }
+		},
+		{ &hf_s5066_22_sapid,
+			{ "Destination Sap ID", "s5066.22.sapid", FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL }
+		},
+		{ &hf_s5066_22_size,
+			{ "U_PDU Size", "s5066.22.size", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }
+		},
+		/* Type 23: S_UNIDATA_REQUEST_REJECTED */
+		{ &hf_s5066_23_reason,
+			{ "Reason", "s5066.23.reason", FT_UINT8, BASE_DEC, VALS(s5066_23_reason), 0xF0, "", HFILL }
+		},
+		{ &hf_s5066_23_sapid,
+			{ "Destination Sap ID", "s5066.23.sapid", FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL }
+		},
+		{ &hf_s5066_23_size,
+			{ "U_PDU Size", "s5066.23.size", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }
+		},
+		/* Type 24: S_EXPEDITED_UNIDATA_REQUEST */
+		{ &hf_s5066_24_unused,
+			{ "(Unused)", "s5066.24.unused", FT_UINT8, BASE_DEC, NULL, 0xF0, "", HFILL }
+		},
+		{ &hf_s5066_24_sapid,
+			{ "Destination Sap ID", "s5066.24.sapid", FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL }
+		},
+		{ &hf_s5066_24_ttl,
+			{ "Time-To-Live (x2 seconds)", "s5066.24.ttl", FT_UINT24, BASE_DEC, NULL, 0x0FFFFF, "", HFILL }
+		},
+		{ &hf_s5066_24_size,
+			{ "U_PDU Size", "s5066.24.size", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }
+		},
+		/* Type 25: S_EXPEDITED_UNIDATA_INDICATION */
+		{ &hf_s5066_25_unused,
+			{ "(Unused)", "s5066.25.unused", FT_UINT8, BASE_DEC, NULL, 0xF0, "", HFILL }
+		},
+		{ &hf_s5066_25_dest_sapid, 
+			{ "Destination Sap ID", "s5066.25.dest_sapid", FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL }
+		},
+		{ &hf_s5066_25_tx_mode,
+			{ "Transmission Mode", "s5066.25.txmode", FT_UINT8, BASE_HEX, VALS(s5066_st_txmode), 0xF0, "", HFILL }
+		},
+		{ &hf_s5066_25_src_sapid,
+			{ "Source Sap ID", "s5066.25.src_sapid", FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL }
+		},
+		{ &hf_s5066_25_size,
+			{ "U_PDU Size", "s5066.25.size", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }
+		},
+		{ &hf_s5066_25_err_blocks,
+			{ "Number of errored blocks", "s5066.25.err_blocks", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }
+		},
+		{ &hf_s5066_25_nrx_blocks,
+			{ "Number of non-received blocks", "s5066.25.nrx_blocks", FT_UINT16, BASE_DEC, NULL, 0x0F, "", HFILL }
+		},
+		/* Type 26: S_EXPEDITED_UNIDATA_REQUEST_CONFIRM */
+		{ &hf_s5066_26_unused,
+			{ "(Unused)", "s5066.26.unused", FT_UINT8, BASE_DEC, NULL, 0xF0, "", HFILL }
+		},
+		{ &hf_s5066_26_sapid,
+			{ "Destination Sap ID", "s5066.26.sapid", FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL }
+		},
+		{ &hf_s5066_26_size,
+			{ "U_PDU Size", "s5066.26.size", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }
+		},
+		/* Type 27: S_UNIDATA_REQUEST_REJECTED */
+		{ &hf_s5066_27_reason,
+			{ "Reason", "s5066.27.reason", FT_UINT8, BASE_DEC, VALS(s5066_27_reason), 0xF0, "", HFILL }
+		},
+		{ &hf_s5066_27_sapid,
+			{ "Destination Sap ID", "s5066.27.sapid", FT_UINT8, BASE_DEC, NULL, 0x0F, "", HFILL }
+		},
+		{ &hf_s5066_27_size,
+			{ "U_PDU Size", "s5066.27.size", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }
+		},
+
+	};
+
+	/* Setup protocol subtree array */
+	static gint *ett[] = {
+		&ett_s5066,
+		&ett_s5066_pdu,
+		&ett_s5066_servicetype,
+		&ett_s5066_address,
+	};
+
+	module_t *s5066_module;
+
+	if (proto_s5066 == -1) {
+		proto_s5066 = proto_register_protocol (
+			"STANAG 5066 (SIS layer)",	/* name */
+			"STANAG 5066",			/* short name*/
+			"s5066"				/* abbrev */
+		);
+		proto_register_field_array(proto_s5066, hf, array_length(hf));	
+		proto_register_subtree_array(ett, array_length(ett));
+	}
+
+	s5066_module = prefs_register_protocol(proto_s5066, proto_reg_handoff_s5066);
+	prefs_register_bool_preference(s5066_module, "desegment_pdus",
+		"Reassemble S5066 PDUs spanning multiple TCP segments",
+		"Whether the S5066 dissector should dissect according to edition 1 of STANAG 5066."
+		" The default is to use editon 1.2 which is the more common one.",
+		&s5066_edition_one);
+	prefs_register_bool_preference(s5066_module, "edition_one",
+		"Dissect edition 1.0 of STANAG 5066",
+		"Whether the S5066 dissector should dissect editon 1 of the STANAG."
+		" This editon was never formally approved and is very rare. The common edition is editon 1.2.",
+		&s5066_edition_one);
+
+}
+
+void
+proto_reg_handoff_s5066(void)
+{
+	static gint Initialized = FALSE;
+
+	if (!Initialized) {
+		s5066_tcp_handle = create_dissector_handle(dissect_s5066_tcp, proto_s5066);
+		dissector_add("tcp.port", global_s5066_port, s5066_tcp_handle);
+
+		data_handle = find_dissector("data");
+		Initialized = TRUE;
+	}
+	if (!s5066_edition_one) {
+		s5066_header_size = 5;
+		s5066_size_offset = 3;
+	} else {
+		s5066_header_size = 4;
+		s5066_size_offset = 2;
+	}
+}
+
+static guint 
+dissect_s5066_address(tvbuff_t *tvb, guint offset, proto_tree *tree, gint source)
+{
+        proto_item *ti = NULL;
+        proto_tree *s5066_tree_address = NULL;
+	guint32 address;
+
+        if (source) {
+		ti = proto_tree_add_text(tree, tvb, offset, 4, "Source Address");
+	}
+	else {
+		ti = proto_tree_add_text(tree, tvb, offset, 4, "Destination Address");
+	}
+        s5066_tree_address = proto_item_add_subtree(ti, ett_s5066_address);
+	proto_tree_add_item(s5066_tree_address, hf_s5066_ad_size, tvb, offset, 1, FALSE);
+	proto_tree_add_item(s5066_tree_address, hf_s5066_ad_group, tvb, offset, 1, FALSE);
+	address = tvb_get_ntohl(tvb, offset);
+	address = address & 0x1FFFFFFF;
+	proto_tree_add_ipv4(s5066_tree_address, hf_s5066_ad_address, tvb, offset, 4, g_htonl(address));
+
+	return offset += 4;
+}
+
+static guint 
+dissect_s5066_servicetype(tvbuff_t *tvb, guint offset, proto_tree *tree)
+{
+        proto_item *ti = NULL;
+        proto_tree *s5066_tree_servicetype = NULL;
+
+        ti = proto_tree_add_text(tree, tvb, offset, 2, "Service type");
+        s5066_tree_servicetype = proto_item_add_subtree(ti, ett_s5066_servicetype);
+
+	proto_tree_add_item(s5066_tree_servicetype, hf_s5066_st_txmode, tvb, offset, 1, FALSE);
+	proto_tree_add_item(s5066_tree_servicetype, hf_s5066_st_delivery_confirmation, tvb, offset, 1, FALSE);
+	proto_tree_add_item(s5066_tree_servicetype, hf_s5066_st_delivery_order, tvb, offset, 1, FALSE);
+	proto_tree_add_item(s5066_tree_servicetype, hf_s5066_st_extended, tvb, offset, 1, FALSE); offset++;
+	proto_tree_add_item(s5066_tree_servicetype, hf_s5066_st_retries, tvb, offset, 1, FALSE);
+
+	return offset;
+}
+
+/* S_BIND_REQUEST */
+static guint 
+dissect_s5066_01(tvbuff_t *tvb, guint offset, proto_tree *tree)
+{
+	proto_tree_add_item(tree, hf_s5066_01_sapid, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_01_rank, tvb, offset, 1, FALSE); offset++;
+
+	offset = dissect_s5066_servicetype(tvb, offset, tree);
+
+	proto_tree_add_item(tree, hf_s5066_01_unused, tvb, offset, 1, FALSE); offset++;
+	return offset;
+}
+
+/* S_UNBIND_REQUEST */
+/* Commented out: does nothing and causes <variable not used> messages.
+static guint 
+dissect_s5066_02(tvbuff_t *tvb, guint offset, proto_tree *tree)
+{
+	return offset;
+}
+*/
+
+/* S_BIND_ACCEPTED */
+static guint 
+dissect_s5066_03(tvbuff_t *tvb, guint offset, proto_tree *tree)
+{
+	proto_tree_add_item(tree, hf_s5066_03_sapid, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_03_unused, tvb, offset, 1, FALSE); offset++;
+	proto_tree_add_item(tree, hf_s5066_03_mtu, tvb, offset, 2, FALSE); offset +=2;
+	return offset;
+}
+
+/* S_BIND_REJECTED */
+static guint 
+dissect_s5066_04(tvbuff_t *tvb, guint offset, proto_tree *tree)
+{
+	proto_tree_add_item(tree, hf_s5066_04_reason, tvb, offset, 1, FALSE); offset++;
+	return offset;
+}
+
+/* S_UNBIND_INDICATION */
+static guint 
+dissect_s5066_05(tvbuff_t *tvb, guint offset, proto_tree *tree)
+{
+	proto_tree_add_item(tree, hf_s5066_05_reason, tvb, offset, 1, FALSE); offset++;
+	return offset;
+}
+
+/* S_HARD_LINK_ESTABLISH */
+static guint 
+dissect_s5066_06(tvbuff_t *tvb, guint offset, proto_tree *tree)
+{
+	proto_tree_add_item(tree, hf_s5066_06_link_type, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_06_link_priority, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_06_sapid, tvb, offset, 1, FALSE); offset++;
+	offset = dissect_s5066_address(tvb, offset, tree, FALSE);
+	return offset;
+}
+
+/* S_HARD_LINK_TERMINATE */
+static guint 
+dissect_s5066_07(tvbuff_t *tvb, guint offset, proto_tree *tree)
+{
+	offset = dissect_s5066_address(tvb, offset, tree, FALSE);
+	return offset;
+}
+
+/* S_HARD_LINK_ESTABLISHED */
+static guint 
+dissect_s5066_08(tvbuff_t *tvb, guint offset, proto_tree *tree)
+{
+	proto_tree_add_item(tree, hf_s5066_08_remote_status, tvb, offset, 1, FALSE); offset++;
+	proto_tree_add_item(tree, hf_s5066_08_link_type, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_08_link_priority, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_08_sapid, tvb, offset, 1, FALSE); offset++;
+	offset = dissect_s5066_address(tvb, offset, tree, FALSE);
+	return offset;
+}
+
+/* S_HARD_LINK_REJECTED */
+static guint 
+dissect_s5066_09(tvbuff_t *tvb, guint offset, proto_tree *tree)
+{
+	proto_tree_add_item(tree, hf_s5066_09_reason, tvb, offset, 1, FALSE); offset++;
+	proto_tree_add_item(tree, hf_s5066_09_link_type, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_09_link_priority, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_09_sapid, tvb, offset, 1, FALSE); offset++;
+	offset = dissect_s5066_address(tvb, offset, tree, FALSE);
+	return offset;
+}
+
+/* S_HARD_LINK_TERMINATED */
+static guint 
+dissect_s5066_10(tvbuff_t *tvb, guint offset, proto_tree *tree)
+{
+	proto_tree_add_item(tree, hf_s5066_10_reason, tvb, offset, 1, FALSE); offset++;
+	proto_tree_add_item(tree, hf_s5066_10_link_type, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_10_link_priority, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_10_sapid, tvb, offset, 1, FALSE); offset++;
+	offset = dissect_s5066_address(tvb, offset, tree, FALSE);
+	return offset;
+}
+
+/* S_HARD_LINK_INDICATION */
+static guint 
+dissect_s5066_11(tvbuff_t *tvb, guint offset, proto_tree *tree)
+{
+	proto_tree_add_item(tree, hf_s5066_11_remote_status, tvb, offset, 1, FALSE); offset++;
+	proto_tree_add_item(tree, hf_s5066_11_link_type, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_11_link_priority, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_11_sapid, tvb, offset, 1, FALSE); offset++;
+	offset = dissect_s5066_address(tvb, offset, tree, FALSE);
+	return offset;
+}
+
+/* S_HARD_LINK_ACCEPT */
+static guint 
+dissect_s5066_12(tvbuff_t *tvb, guint offset, proto_tree *tree)
+{
+	proto_tree_add_item(tree, hf_s5066_12_link_type, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_12_link_priority, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_12_sapid, tvb, offset, 1, FALSE); offset++;
+	offset = dissect_s5066_address(tvb, offset, tree, FALSE);
+	return offset;
+}
+
+/* S_HARD_LINK_REJECT */
+static guint 
+dissect_s5066_13(tvbuff_t *tvb, guint offset, proto_tree *tree)
+{
+	proto_tree_add_item(tree, hf_s5066_13_reason, tvb, offset, 1, FALSE); offset++;
+	proto_tree_add_item(tree, hf_s5066_13_link_type, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_13_link_priority, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_13_sapid, tvb, offset, 1, FALSE); offset++;
+	offset = dissect_s5066_address(tvb, offset, tree, FALSE);
+	return offset;
+}
+
+/* S_SUBNET_AVAILABILITY */
+static guint 
+dissect_s5066_14(tvbuff_t *tvb, guint offset, proto_tree *tree)
+{
+	proto_tree_add_item(tree, hf_s5066_14_status, tvb, offset, 1, FALSE); offset++;
+	proto_tree_add_item(tree, hf_s5066_14_reason, tvb, offset, 1, FALSE); offset++;
+	return offset;
+}
+
+/* Following three commented out: do nothing and cause <variable not used> messages. */
+/* S_DATA_FLOW_ON */
+/*
+static guint 
+dissect_s5066_15(tvbuff_t *tvb, guint offset, proto_tree *tree)
+{
+	return offset;
+}
+*/
+
+/* S_DATA_FLOW_OFF */
+/*
+static guint 
+dissect_s5066_16(tvbuff_t *tvb, guint offset, proto_tree *tree)
+{
+	return offset;
+}
+*/
+
+/* S_KEEP_ALIVE */
+/*
+static guint 
+dissect_s5066_17(tvbuff_t *tvb, guint offset, proto_tree *tree)
+{
+	return offset;
+}
+*/
+
+/* S_MANAGEMENT_MESSAGE_REQUEST */
+static guint 
+dissect_s5066_18(tvbuff_t *tvb, guint offset, proto_tree *tree, guint pdu_size)
+{
+	guint body_size = 0;
+	proto_tree_add_item(tree, hf_s5066_18_type, tvb, offset, 1, FALSE); offset++;
+	body_size = pdu_size - offset;
+	proto_tree_add_bytes(tree, hf_s5066_18_body, tvb, offset, body_size, FALSE); offset += body_size; 
+	return offset;
+}
+
+/* S_MANAGEMENT_MESSAGE_INDICATION */
+static guint 
+dissect_s5066_19(tvbuff_t *tvb, guint offset, proto_tree *tree, guint pdu_size)
+{
+	guint body_size = 0;
+	proto_tree_add_item(tree, hf_s5066_19_type, tvb, offset, 1, FALSE); offset++;
+	body_size = pdu_size - offset;
+	proto_tree_add_bytes(tree, hf_s5066_19_body, tvb, offset, body_size, FALSE); offset += body_size;
+	return offset;
+}
+
+/* S_UNIDATA_REQUEST */
+static guint 
+dissect_s5066_20(tvbuff_t *tvb, guint offset, proto_tree *tree)
+{
+	proto_tree_add_item(tree, hf_s5066_20_priority, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_20_sapid, tvb, offset, 1, FALSE); offset++;
+	offset = dissect_s5066_address(tvb, offset, tree, FALSE);
+	offset = dissect_s5066_servicetype(tvb, offset, tree);
+	proto_tree_add_item(tree, hf_s5066_20_ttl, tvb, offset, 3, FALSE); offset += 3;
+	proto_tree_add_item(tree, hf_s5066_20_size, tvb, offset, 2, FALSE); offset += 2;
+
+	return offset;
+}
+
+/* S_UNIDATA_INDICATION */
+static guint 
+dissect_s5066_21(tvbuff_t *tvb, guint offset, proto_tree *tree, guint pdu_size)
+{
+	proto_item *ti = NULL;
+	guint d_pdu_size = 0;
+	proto_tree_add_item(tree, hf_s5066_21_priority, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_21_dest_sapid, tvb, offset, 1, FALSE); offset++;
+	offset = dissect_s5066_address(tvb, offset, tree, FALSE);
+	proto_tree_add_item(tree, hf_s5066_21_tx_mode, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_21_src_sapid, tvb, offset, 1, FALSE); offset++;
+	offset = dissect_s5066_address(tvb, offset, tree, TRUE);
+
+	d_pdu_size = tvb_get_ntohs(tvb, offset);
+	proto_tree_add_item(tree, hf_s5066_21_size, tvb, offset, 2, FALSE); offset += 2;
+
+	/* Handle RockwellCollins (<= v2.1) 4-byte offset */
+	if ( (pdu_size - offset) == (d_pdu_size + 4) ) {
+		ti = proto_tree_add_item(tree, hf_s5066_21_err_blocks, tvb, offset, 2, FALSE); offset += 2;
+		proto_item_append_text(ti, ", (Field should not be present. Rockwell Collins v2.1 or earlier.) ");
+		ti = proto_tree_add_item(tree, hf_s5066_21_nrx_blocks, tvb, offset, 2, FALSE); offset += 2;
+		proto_item_append_text(ti, ", (Field should not be present. Rockwell Collins v2.1 or earlier.) ");
+	}
+	/* Handle Non-ARQ with errors */
+	if ( FALSE ) {
+		proto_tree_add_item(tree, hf_s5066_21_err_blocks, tvb, offset, 2, FALSE); offset += 2;
+		proto_tree_add_item(tree, hf_s5066_21_nrx_blocks, tvb, offset, 2, FALSE); offset += 2;
+	}
+	return offset;
+}
+
+/* S_UNIDATA_REQUEST_CONFIRM */
+static guint 
+dissect_s5066_22(tvbuff_t *tvb, guint offset, proto_tree *tree)
+{
+	proto_tree_add_item(tree, hf_s5066_22_unused, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_22_sapid, tvb, offset, 1, FALSE); offset++;
+	offset = dissect_s5066_address(tvb, offset, tree, FALSE);
+	proto_tree_add_item(tree, hf_s5066_22_size, tvb, offset, 2, FALSE); offset += 2;
+
+	return offset;
+}
+
+/* S_UNIDATA_REQUEST_REJECTED */
+static guint 
+dissect_s5066_23(tvbuff_t *tvb, guint offset, proto_tree *tree)
+{
+	proto_tree_add_item(tree, hf_s5066_23_reason, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_23_sapid, tvb, offset, 1, FALSE); offset++;
+	offset = dissect_s5066_address(tvb, offset, tree, FALSE);
+	proto_tree_add_item(tree, hf_s5066_23_size, tvb, offset, 2, FALSE); offset += 2;
+
+	return offset;
+}
+
+/* S_EXPEDITED_UNIDATA_REQUEST */
+static guint 
+dissect_s5066_24(tvbuff_t *tvb, guint offset, proto_tree *tree)
+{
+	proto_tree_add_item(tree, hf_s5066_24_unused, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_24_sapid, tvb, offset, 1, FALSE); offset++;
+	offset = dissect_s5066_address(tvb, offset, tree, FALSE);
+	offset = dissect_s5066_servicetype(tvb, offset, tree);
+	proto_tree_add_item(tree, hf_s5066_24_ttl, tvb, offset, 3, FALSE); offset += 3;
+	proto_tree_add_item(tree, hf_s5066_24_size, tvb, offset, 2, FALSE); offset += 2;
+
+	return offset;
+}
+
+/* S_EXPEDITED_UNIDATA_INDICATION */
+static guint 
+dissect_s5066_25(tvbuff_t *tvb, guint offset, proto_tree *tree, guint pdu_size)
+{
+	proto_item *ti = NULL;
+	guint d_pdu_size = 0;
+
+	proto_tree_add_item(tree, hf_s5066_25_unused, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_25_dest_sapid, tvb, offset, 1, FALSE); offset++;
+	offset = dissect_s5066_address(tvb, offset, tree, FALSE);
+	proto_tree_add_item(tree, hf_s5066_25_tx_mode, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_25_src_sapid, tvb, offset, 1, FALSE); offset++;
+	offset = dissect_s5066_address(tvb, offset, tree, TRUE);
+	proto_tree_add_item(tree, hf_s5066_25_size, tvb, offset, 2, FALSE); offset += 2;
+
+	d_pdu_size = tvb_get_ntohs(tvb, offset);
+	proto_tree_add_item(tree, hf_s5066_21_size, tvb, offset, 2, FALSE); offset += 2;
+
+	/* Handle RockwellCollins (<= v2.1) 4-byte offset */
+	if ( (pdu_size - offset) == d_pdu_size + 4 ) {
+		ti = proto_tree_add_item(tree, hf_s5066_25_err_blocks, tvb, offset, 2, FALSE); offset += 2;
+		proto_item_append_text(ti, ", (Field should not be present. Rockwell Collins v2.1 or earlier.) ");
+		ti = proto_tree_add_item(tree, hf_s5066_25_nrx_blocks, tvb, offset, 2, FALSE); offset += 2;
+		proto_item_append_text(ti, ", (Field should not be present. Rockwell Collins v2.1 or earlier.) ");
+	}
+	/* Handle Non-ARQ with errors */
+	if ( FALSE ) {
+		proto_tree_add_item(tree, hf_s5066_25_err_blocks, tvb, offset, 2, FALSE); offset += 2;
+		proto_tree_add_item(tree, hf_s5066_25_nrx_blocks, tvb, offset, 2, FALSE); offset += 2;
+	}
+	return offset;
+}
+
+/* S_EXPEDITED_UNIDATA_REQUEST_CONFIRM */
+static guint 
+dissect_s5066_26(tvbuff_t *tvb, guint offset, proto_tree *tree)
+{
+	proto_tree_add_item(tree, hf_s5066_26_unused, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_26_sapid, tvb, offset, 1, FALSE); offset++;
+	offset = dissect_s5066_address(tvb, offset, tree, FALSE);
+	proto_tree_add_item(tree, hf_s5066_26_size, tvb, offset, 2, FALSE); offset += 2;
+
+	return offset;
+}
+
+/* S_EXPEDITED_UNIDATA_REQUEST_REJECTED */
+static guint 
+dissect_s5066_27(tvbuff_t *tvb, guint offset, proto_tree *tree)
+{
+	proto_tree_add_item(tree, hf_s5066_27_reason, tvb, offset, 1, FALSE);
+	proto_tree_add_item(tree, hf_s5066_27_sapid, tvb, offset, 1, FALSE); offset++;
+	offset = dissect_s5066_address(tvb, offset, tree, FALSE);
+	proto_tree_add_item(tree, hf_s5066_27_size, tvb, offset, 2, FALSE); offset += 2;
+
+	return offset;
+}
+
+static guint
+get_s5066_pdu_len(tvbuff_t *tvb, int offset)
+{
+  guint16 plen;
+
+  /* Get the length of the S5066 PDU. */
+  plen = tvb_get_ntohs(tvb, offset + s5066_size_offset);
+
+  /* That length doesn't include the sync, version and length fields; add that in. */
+  return plen + s5066_header_size;
+}
+
+static void
+dissect_s5066_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+	tcp_dissect_pdus(tvb, pinfo, tree, s5066_desegment, s5066_header_size, get_s5066_pdu_len, dissect_s5066_common);
+}
+
+static void
+dissect_s5066_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+	guint offset = 0;
+	guint pdu_size = 0;
+	proto_item *ti_s5066 = NULL;
+	proto_item *ti_pdu = NULL;
+	tvbuff_t *next_tvb;
+	gint available_length, reported_length;
+
+	/* Determine PDU type to display in INFO column */
+	guint8 pdu_type = tvb_get_guint8(tvb, s5066_header_size);
+
+	if (check_col(pinfo->cinfo, COL_PROTOCOL)) {
+		col_set_str(pinfo->cinfo, COL_PROTOCOL, "S5066");
+	}
+	/* Clear out stuff in the info column, the add PDU type */
+	if (check_col(pinfo->cinfo, COL_INFO)) {
+		col_clear(pinfo->cinfo, COL_INFO); 
+	}
+	if (check_col(pinfo->cinfo, COL_INFO)) {
+		col_add_fstr(pinfo->cinfo, COL_INFO, "PDU type %s", val_to_str(pdu_type, s5066_pdu_type, "Unknown (0x%02x)"));
+	}
+
+	if (tree) { /* We are being asked for details */
+		proto_tree *s5066_tree = NULL;
+		proto_tree *s5066_tree_pdu = NULL;
+
+		pdu_size = tvb_get_ntohs(tvb, s5066_size_offset) + s5066_header_size;
+
+		ti_s5066 = proto_tree_add_item(tree, proto_s5066, tvb, 0, -1, FALSE);
+		proto_item_append_text(ti_s5066, ", PDU type %s", val_to_str(pdu_type, s5066_pdu_type, "Unknown (0x%02x)"));
+		s5066_tree = proto_item_add_subtree(ti_s5066, ett_s5066);
+		proto_tree_add_item(s5066_tree, hf_s5066_sync_word, tvb, offset, 2, FALSE); offset +=2;
+		if (!s5066_edition_one) {
+			proto_tree_add_item(s5066_tree, hf_s5066_version,   tvb, offset, 1, FALSE); offset++;
+		}
+		proto_tree_add_item(s5066_tree, hf_s5066_size,      tvb, offset, 2, FALSE); offset +=2;
+		ti_pdu = proto_tree_add_item(s5066_tree, hf_s5066_type, tvb, offset, 1, FALSE); offset++;
+		s5066_tree_pdu = proto_item_add_subtree(ti_pdu, ett_s5066_pdu);
+		switch (pdu_type) {
+		case  1: offset = dissect_s5066_01(tvb, offset, s5066_tree_pdu); break;
+		/* case  2: offset = dissect_s5066_02(tvb, offset, s5066_tree_pdu); break; */
+		case  3: offset = dissect_s5066_03(tvb, offset, s5066_tree_pdu); break;
+		case  4: offset = dissect_s5066_04(tvb, offset, s5066_tree_pdu); break;
+		case  5: offset = dissect_s5066_05(tvb, offset, s5066_tree_pdu); break;
+		case  6: offset = dissect_s5066_06(tvb, offset, s5066_tree_pdu); break;
+		case  7: offset = dissect_s5066_07(tvb, offset, s5066_tree_pdu); break;
+		case  8: offset = dissect_s5066_08(tvb, offset, s5066_tree_pdu); break;
+		case  9: offset = dissect_s5066_09(tvb, offset, s5066_tree_pdu); break;
+		case 10: offset = dissect_s5066_10(tvb, offset, s5066_tree_pdu); break;
+		case 11: offset = dissect_s5066_11(tvb, offset, s5066_tree_pdu); break;
+		case 12: offset = dissect_s5066_12(tvb, offset, s5066_tree_pdu); break;
+		case 13: offset = dissect_s5066_13(tvb, offset, s5066_tree_pdu); break;
+		case 14: offset = dissect_s5066_14(tvb, offset, s5066_tree_pdu); break;
+		/* case 15: offset = dissect_s5066_15(tvb, offset, s5066_tree_pdu); break; */
+		/* case 16: offset = dissect_s5066_16(tvb, offset, s5066_tree_pdu); break; */
+		/* case 17: offset = dissect_s5066_17(tvb, offset, s5066_tree_pdu); break; */
+		case 18: offset = dissect_s5066_18(tvb, offset, s5066_tree_pdu, pdu_size); break;
+		case 19: offset = dissect_s5066_19(tvb, offset, s5066_tree_pdu, pdu_size); break;
+		case 20: offset = dissect_s5066_20(tvb, offset, s5066_tree_pdu); break;
+		case 21: offset = dissect_s5066_21(tvb, offset, s5066_tree_pdu, pdu_size); break;
+		case 22: offset = dissect_s5066_22(tvb, offset, s5066_tree_pdu); break;
+		case 23: offset = dissect_s5066_23(tvb, offset, s5066_tree_pdu); break;
+		case 24: offset = dissect_s5066_24(tvb, offset, s5066_tree_pdu); break;
+		case 25: offset = dissect_s5066_25(tvb, offset, s5066_tree_pdu, pdu_size); break;
+		case 26: offset = dissect_s5066_26(tvb, offset, s5066_tree_pdu); break;
+		case 27: offset = dissect_s5066_27(tvb, offset, s5066_tree_pdu); break;
+		}
+	}
+	proto_item_set_len(ti_s5066, offset);
+	/* proto_item_set_len(ti_pdu, offset - s5066_header_size); */
+
+	/* Call sub dissector(s) */
+	reported_length = pdu_size - offset;
+	available_length = tvb_length(tvb) - offset;
+
+	next_tvb = tvb_new_subset(tvb, offset, MIN(available_length, reported_length), reported_length);
+	call_dissector(data_handle, next_tvb, pinfo, tree); 
+	
+	return;
+}
+
+
Index: plugins/Makefile.nmake
===================================================================
--- plugins/Makefile.nmake	(revision 16219)
+++ plugins/Makefile.nmake	(working copy)
@@ -29,6 +29,7 @@
 	rlm \
 	rtnet \
 	rudp \
+	s5066 \
 	stats_tree \
 	v5ua
 
@@ -142,6 +143,11 @@
 	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
 	cd ..
 
+s5066:: 
+	cd s5066
+	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
+	cd ..
+
 stats_tree:: 
 	cd stats_tree
 	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
@@ -198,6 +204,8 @@
 	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
 	cd ../rudp
 	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
+	cd ../s5066
+	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
 	cd ../stats_tree
 	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
 	cd ../v5ua
@@ -249,6 +257,8 @@
 	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
 	cd ../rudp
 	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
+	cd ../s5066
+	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
 	cd ../stats_tree
 	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
 	cd ../v5ua
@@ -298,6 +308,8 @@
 	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
 	cd ../rudp
 	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
+	cd ../s5066
+	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
 	cd ../stats_tree
 	$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
 	cd ../v5ua
@@ -335,6 +347,7 @@
 	xcopy rlm\*.dll $(VERSION) /d
 	xcopy rtnet\*.dll $(VERSION) /d
 	xcopy rudp\*.dll $(VERSION) /d
+	xcopy s5066\*.dll $(VERSION) /d
 	xcopy stats_tree\*.dll $(VERSION) /d
 	xcopy v5ua\*.dll $(VERSION) /d
 !ENDIF
Index: plugins/Makefile.am
===================================================================
--- plugins/Makefile.am	(revision 16219)
+++ plugins/Makefile.am	(working copy)
@@ -44,6 +44,7 @@
 	rlm \
 	rtnet \
 	rudp \
+	s5066 \
 	stats_tree \
 	v5ua