Register an "osinl" dissector table for ISO/IEC TR 9577 NLPID values,
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 17 Apr 2000 01:36:31 +0000 (01:36 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 17 Apr 2000 01:36:31 +0000 (01:36 +0000)
and have dissectors for protocols that run at the OSI network layer
register themselves with it using "dissector_add()".

Make various dissectors static if they can be, and remove from header
files declarations of those dissectors.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@1873 f5534014-38df-0310-8fa8-9805f1628bb7

packet-clnp.c
packet-clnp.h
packet-esis.c
packet-esis.h
packet-isis.c
packet-isis.h
packet-osi.c

index a28cce5ece3c2e894a9374c913ca8414250c6b29..c8a54ad083ab3ce7df7569cd9307a147cdb6e032 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-clnp.c
  * Routines for ISO/OSI network and transport protocol packet disassembly
  *
- * $Id: packet-clnp.c,v 1.2 2000/04/16 09:10:53 deniel Exp $
+ * $Id: packet-clnp.c,v 1.3 2000/04/17 01:36:29 guy Exp $
  * Laurent Deniel <deniel@worldnet.fr>
  * Ralf Schneider <Ralf.Schneider@t-online.de>
  *
@@ -1478,7 +1478,7 @@ void dissect_cotp(const u_char *pd, int offset, frame_data *fd,
  *  CLNP part / main entry point 
 */
 
-void dissect_clnp(const u_char *pd, int offset, frame_data *fd,
+static void dissect_clnp(const u_char *pd, int offset, frame_data *fd,
                  proto_tree *tree) 
 {
 
@@ -1768,3 +1768,10 @@ void proto_register_cotp(void)
  /*       proto_register_field_array(proto_cotp, hf, array_length(hf));*/
        proto_register_subtree_array(ett, array_length(ett));
 }
+
+void
+proto_reg_handoff_clnp(void)
+{
+       dissector_add("osinl", NLPID_ISO8473_CLNP, dissect_clnp);
+       dissector_add("osinl", NLPID_NULL, dissect_clnp);       /* Inactive subset */
+}
index 9d76fd0ff31b73b7ab7ae559d2402d227aa45d69..9adfe8aca2ecdd9e4649400bf8c79fb28aca0d0f 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-clnp.h
  * Defines and such for CLNP (and COTP) protocol decode.
  *
- * $Id: packet-clnp.h,v 1.1 2000/04/15 22:11:08 guy Exp $
+ * $Id: packet-clnp.h,v 1.2 2000/04/17 01:36:30 guy Exp $
  * Ralf Schneider <Ralf.Schneider@t-online.de>
  *
  * Ethereal - Network traffic analyzer
@@ -33,8 +33,6 @@
  * published API functions
  */
 
-extern
-void dissect_clnp( const u_char *, int, frame_data *, proto_tree * );
 extern
 void dissect_cotp(const u_char *, int, frame_data *, proto_tree *);
 
index 81869907145c03d67b7cbd164c71bac5b5c79104..52ff9d9c0ec992a1a3d35fe72daf0994d410b33e 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for ISO/OSI End System to Intermediate System  
  * Routeing Exchange Protocol ISO 9542.
  *
- * $Id: packet-esis.c,v 1.1 2000/04/15 22:11:08 guy Exp $
+ * $Id: packet-esis.c,v 1.2 2000/04/17 01:36:30 guy Exp $
  * Ralf Schneider <Ralf.Schneider@t-online.de>
  *
  * Ethereal - Network traffic analyzer
@@ -289,7 +289,7 @@ esis_dissect_redirect_pdu( u_char len, const u_char *pd, int offset,
  * Output:
  *   void, but we will add to the proto_tree if it is not NULL.
  */
-void
+static void
 dissect_esis(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
    char       *pdu_type_string        = NULL;
    char       *pdu_type_format_string = "PDU Type      : %s (R:%s%s%s)";   
@@ -436,3 +436,9 @@ proto_register_esis(void) {
   proto_register_field_array(proto_esis, hf, array_length(hf));
   proto_register_subtree_array(ett, array_length(ett));
 };
+
+void
+proto_reg_handoff_esis(void)
+{
+  dissector_add("osinl", NLPID_ISO9542_ESIS, dissect_esis);
+}
index c6e49b24a74682b492fd78282f4d7e87e4f84d21..cc145b7d7bb0167388685f12d1348f0c5e3f938a 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-esis.h
  * Defines and such for ESIS protocol decode.
  *
- * $Id: packet-esis.h,v 1.1 2000/04/15 22:11:09 guy Exp $
+ * $Id: packet-esis.h,v 1.2 2000/04/17 01:36:30 guy Exp $
  * Ralf Schneider <Ralf.Schneider@t-online.de>
  *
  * Ethereal - Network traffic analyzer
@@ -60,9 +60,6 @@ typedef struct {
 /*
  * published API functions
  */ 
-extern void dissect_esis(const u_char *pd, int offset, frame_data *fd, 
-                         proto_tree *tree);
-extern void proto_register_esis(void);
 extern void esis_dissect_unknown(int offset,guint length, proto_tree *tree,
                                  frame_data *fd, char *fmat, ...);
 
index ef764fbeb297e36ba78291a03bce18e94863c783..81fd5b80ac348edf3b0114669f035f52bd327bba 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for ISO/OSI network and transport protocol packet disassembly, core
  * bits.
  *
- * $Id: packet-isis.c,v 1.7 2000/04/15 22:11:11 guy Exp $
+ * $Id: packet-isis.c,v 1.8 2000/04/17 01:36:31 guy Exp $
  * Stuart Stanley <stuarts@mxmail.net>
  *
  * Ethereal - Network traffic analyzer
@@ -131,7 +131,7 @@ isis_dissect_unknown(int offset,guint length,proto_tree *tree,frame_data *fd,
  * Output:
  *     void, but we will add to the proto_tree if it is not NULL.
  */
-void
+static void
 dissect_isis(const u_char *pd, int offset, frame_data *fd, 
                proto_tree *tree) {
        isis_hdr_t *ihdr;
@@ -309,3 +309,9 @@ proto_register_isis(void) {
     proto_register_field_array(proto_isis, hf, array_length(hf));
     proto_register_subtree_array(ett, array_length(ett));
 }
+
+void
+proto_reg_handoff_isis(void)
+{
+    dissector_add("osinl", NLPID_ISO10589_ISIS, dissect_isis);
+}
index 1c49542a9cacff6d8a8f3bb87ffe4eed59dd86e0..34ec6a0f23eda7ba181a3425e4ff832f94aa845a 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-isis.h
  * Defines and such for core isis protcol decode.
  *
- * $Id: packet-isis.h,v 1.3 2000/04/15 22:11:11 guy Exp $
+ * $Id: packet-isis.h,v 1.4 2000/04/17 01:36:31 guy Exp $
  * Stuart Stanley <stuarts@mxmail.net>
  *
  * Ethereal - Network traffic analyzer
@@ -77,9 +77,6 @@ typedef struct {
  */
 
 extern char *isis_address_to_string ( const u_char *pd, int offset, int len );
-extern void dissect_isis( const u_char *pd, int offset, frame_data *fd,
-                          proto_tree *tree);
-extern void proto_register_isis(void);
 extern void isis_dissect_unknown( int offset, guint length, proto_tree *tree,
                                   frame_data *fd, char *fmat, ...);
 
index 29c55544f372f52b00d1ea2063e8362bffea87bc..3bca500086001b60774c83a1fddcd5c9abb857f3 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for ISO/OSI network and transport protocol packet disassembly
  * Main entrance point and common functions
  *
- * $Id: packet-osi.c,v 1.32 2000/04/17 00:32:41 guy Exp $
+ * $Id: packet-osi.c,v 1.33 2000/04/17 01:36:31 guy Exp $
  * Laurent Deniel <deniel@worldnet.fr>
  * Ralf Schneider <Ralf.Schneider@t-online.de>
  *
@@ -219,29 +219,25 @@ const value_string nlpid_vals[] = {
        { 0,                     NULL },
 };
 
+static dissector_table_t subdissector_table;
+
 void dissect_osi(const u_char *pd, int offset, frame_data *fd, 
                 proto_tree *tree) 
 {
+  /* do lookup with the subdissector table */
+  if (dissector_try_port(subdissector_table, pd[offset], pd, offset, fd, tree))
+      return;
+
   switch (pd[offset]) {
 
     /* ESIS (X.25) is not currently decoded */
 
-    case NLPID_ISO8473_CLNP:
-    case NLPID_NULL:   /* "Inactive Subset" of ISO 8473 CLNP */
-      dissect_clnp(pd, offset, fd, tree);
-      break;
-    case NLPID_ISO9542_ESIS:
-      dissect_esis(pd, offset, fd, tree);
-      break;
     case NLPID_ISO9542X25_ESIS:
       if (check_col(fd, COL_PROTOCOL)) {
        col_add_str(fd, COL_PROTOCOL, "ESIS (X.25)");
       }
       dissect_data(pd, offset, fd, tree);
       break;
-    case NLPID_ISO10589_ISIS:
-      dissect_isis(pd, offset, fd, tree);
-      break;
     case NLPID_ISO10747_IDRP:
       if (check_col(fd, COL_PROTOCOL)) {
         col_add_str(fd, COL_PROTOCOL, "IDRP");
@@ -260,6 +256,15 @@ void dissect_osi(const u_char *pd, int offset, frame_data *fd,
   }
 } /* dissect_osi */
 
+void
+proto_register_osi(void)
+{
+       /* There's no "OSI" protocol *per se*, but we do register a
+          dissector table so various protocols running at the
+          network layer can register themselves. */
+       subdissector_table = register_dissector_table("osinl");
+}
+
 void
 proto_reg_handoff_osi(void)
 {