From John Bradshaw:
[metze/wireshark/wip.git] / docbook / wsluarm.xml
index 3db2b9cc9cc8a24b5e685157d4eeeec8ad76e881..2c33d5a7d1f2a65a7a407e163d70dbd601de1dbb 100644 (file)
@@ -3,36 +3,40 @@
   <title>Lua Support in Wireshark</title>
   <section id="wsluarm_intro">
        <title>Introduction</title>
-    <para>
-      Wireshark has an embedded Lua interpreter. Lua is a powerful light-weight
+       <para>
+         Wireshark has an embedded Lua interpreter. Lua is a powerful light-weight
          programming language designed for extending applications. Lua is designed
          and implemented by a team at PUC-Rio, the Pontifical Catholic University
          of Rio de Janeiro in Brazil. Lua was born and raised at Tecgraf, the
-         Computer Graphics Technology Group of PUC-Rio, and is now housed at Lua.org.
+         Computer Graphics Technology Group of PUC-Rio, and is now housed at
+         <ulink url="http://www.lua.org">Lua.org</ulink>.
          Both Tecgraf and Lua.org are laboratories of the Department of Computer Science.
        </para>
        <para>
-          In Wireshark Lua can be used to write dissectors and taps. 
+          In Wireshark Lua can be used to write dissectors and taps.
        </para>
        <para>
          Wireshark's Lua interpreter starts by loading <command>init.lua</command> that
          is located in the global configuration directory of Wireshark.
-         Lua is disabled by default by setting the variable <command>disable_lua</command>
-         to true in <command>init.lua</command>. To enable lua the line that sets that variable
-         must be removed or commented out.
+         Lua is enabled by default.  To disable Lua the line variable <command>disable_lua</command>
+         should be set to <command>true</command> in <command>init.lua</command>.
        </para>
        <para>
-         After loading <command>init.lua</command> from the data directory if lua is enabled
+         After loading <command>init.lua</command> from the data directory if Lua is enabled
          Wireshark will try to load a file named <command>init.lua</command> in the user's
          directory.
        </para>
+       <para>
+         Wireshark will also load all files with <command>.lua</command> suffix from both the
+         global and the personal plugins directory.
+       </para>
        <para>
          The command line option <command>-X lua_script:&lt;file.lua&gt;</command> can be used to
-         load lua scripts as well.       
+         load Lua scripts as well.
        </para>
        <para>
-         The Lua code will be executed once after all the protocols have being initialized and before reading
-         any file.
+         The Lua code will be executed once after all the protocol dissectors have being initialized
+         and before reading any file.
        </para>
   </section>
   <section id="wslua_dissector_example">
@@ -55,7 +59,7 @@ do
         local f_dir = ProtoField.uint8("multi.direction","Direction",base.DEC,{ [1] = "incoming", [0] = "outgoing"})
         local f_text = ProtoField.string("multi.text","Text")
 
-       p_multi.fields = { f_proto, f_dir, f_text }
+        p_multi.fields = { f_proto, f_dir, f_text }
 
         local data_dis = Dissector.get("data")
 
@@ -72,7 +76,7 @@ do
                 [11] = DissectorTable.get("ip.proto"):get_dissector(132), -- sctp
         }
 
-        function p_multi.dissector(buf,pkt,root) 
+        function p_multi.dissector(buf,pkt,root)
 
                 local t = root:add(p_multi,buf(0,2))
                 t:add(f_proto,buf(0,1))
@@ -89,7 +93,7 @@ do
                         -- pkt.cols.info:set(buf(2,buf:len() - 3):string())
                 else
                         data_dis:call(buf(2):tvb(),pkt,root)
-                end 
+                end
 
         end
 
@@ -100,7 +104,7 @@ do
         wtap_encap_table:add(wtap.USER12,p_multi)
         udp_encap_table:add(7555,p_multi)
 end
-       </programlisting>
+    </programlisting>
   </section>
   <section id="wslua_tap_example">
   <title>Example of Listener written in Lua</title>
@@ -112,18 +116,18 @@ do
        local function menuable_tap()
                -- Declare the window we will use
                local tw = TextWindow.new("Address Counter")
-               
+
                -- This will contain a hash of counters of appearances of a certain address
                local ips = {}
-               
+
                -- this is our tap
                local tap = Listener.new();
 
                function remove()
-                       -- this way we remove the listener than otherwise will remain running indifinitelly
+                       -- this way we remove the listener than otherwise will remain running indefinitely
                        tap:remove();
                end
-               
+
                -- we tell the window to call the remove() function when closed
                tw:set_atclose(remove)
 
@@ -152,25 +156,25 @@ do
                end
        end
 
-       -- using this function we register our fuction
+       -- using this function we register our function
        -- to be called when the user selects the Tools->Test->Packets menu
        register_menu("Test/Packets", menuable_tap, MENU_TOOLS)
 end
-       </programlisting>
+    </programlisting>
   </section>
   <section id="wsluarm_modules">
   <title>Wireshark's Lua API Reference Manual</title>
-    <para>
-      This Part of the User Guide describes the Wireshark specific functions in the embedded Lua.
+       <para>
+         This Part of the User Guide describes the Wireshark specific functions in the embedded Lua.
        </para>
-    &WsLuaDumper;
-    &WsLuaField;
-    &WsLuaGui;
+  </section>
+       &WsLuaDumper;
+       &WsLuaField;
+       &WsLuaGui;
        &WsLuaListener;
        &WsLuaPinfo;
        &WsLuaProto;
        &WsLuaTree;
        &WsLuaTvb;
        &WsLuaUtility;
-  </section>
 </chapter>