<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Custom Protocol Analyzer: Initialize variables at every session start]]></title><description><![CDATA[<p dir="auto">I am writing a custom protocol analyzer. But I could not find a way to do initialization when a new session is started. I have static variables which keep values all the time, but I don't know how to initialize those variables when new session is started.</p>
<p dir="auto">It would be great if someone could help me.</p>
<p dir="auto">Best Regards,<br />
Shun</p>
]]></description><link>http://64.23.185.212/forum/topic/308/custom-protocol-analyzer-initialize-variables-at-every-session-start</link><generator>RSS for Node</generator><lastBuildDate>Tue, 06 Oct 2026 18:56:17 GMT</lastBuildDate><atom:link href="http://64.23.185.212/forum/topic/308.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 07 Jun 2024 14:27:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Custom Protocol Analyzer: Initialize variables at every session start on Wed, 12 Jun 2024 06:30:37 GMT]]></title><description><![CDATA[<p dir="auto">Glad to hear it helped! Let me know if you have more questions regarding this protocol analyzer of yours. Which protocol is that, by the way?</p>
]]></description><link>http://64.23.185.212/forum/post/669</link><guid isPermaLink="true">http://64.23.185.212/forum/post/669</guid><dc:creator><![CDATA[Vladimir]]></dc:creator><pubDate>Wed, 12 Jun 2024 06:30:37 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Protocol Analyzer: Initialize variables at every session start on Mon, 10 Jun 2024 11:17:24 GMT]]></title><description><![CDATA[<p dir="auto">Hi Vladimir,</p>
<p dir="auto">thank you very much for your quick reply. It was exactly what I needed, and I was able to solve my issue. I'm implementing this protocol analyzer for the first time while figuring out how it works. Definitely some refactoring is necessary afterwards. Thanks for your help.</p>
]]></description><link>http://64.23.185.212/forum/post/667</link><guid isPermaLink="true">http://64.23.185.212/forum/post/667</guid><dc:creator><![CDATA[schunsky]]></dc:creator><pubDate>Mon, 10 Jun 2024 11:17:24 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Protocol Analyzer: Initialize variables at every session start on Sat, 08 Jun 2024 07:00:14 GMT]]></title><description><![CDATA[<p dir="auto">Hi Shun,</p>
<p dir="auto">I'd say it's a better practice to keep state variables as member fields of your parser class rather using globals. But it's not written in stone, of course.</p>
<p dir="auto">To reset state vairables/fields on every session start, process <code>log.StdRecordCode.SessionStart</code> in your <code>log.Converter.convert(...)</code>  routine and do initialization from there. Also, you want to override <code>log.Converter.reset()</code> and do initialization here, too (<code>reset()</code> will get called when a user force-clears the log, rebuilds the log by adding a filter, etc).</p>
<p dir="auto">You can check the official Modbus Analyzer for reference (there are two versions now, a new one based on dynamic layouts and the legacy once).</p>
<p dir="auto">Also, there're new tutorials on writing protocol analyzers and packet templates using dynamic layouts, check it out:</p>
<p dir="auto"><a href="https://ioninja.com/doc/developer-manual/tutorial-plugin-analyzer.html" rel="nofollow ugc">https://ioninja.com/doc/developer-manual/tutorial-plugin-analyzer.html</a><br />
<a href="https://ioninja.com/doc/developer-manual/tutorial-ias-packet-dylayout.html" rel="nofollow ugc">https://ioninja.com/doc/developer-manual/tutorial-ias-packet-dylayout.html</a></p>
]]></description><link>http://64.23.185.212/forum/post/664</link><guid isPermaLink="true">http://64.23.185.212/forum/post/664</guid><dc:creator><![CDATA[Vladimir]]></dc:creator><pubDate>Sat, 08 Jun 2024 07:00:14 GMT</pubDate></item></channel></rss>