<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=384858&amp;view=findpost&amp;p=3393989</guid>
        <pubDate>Tue, 31 Dec 2013 09:02:05 +0000</pubDate>
        <title>Создаю агент расширения snmp, служба snmp не передаёт в мою dll snmp-команду get</title>
        <link>https://forum.sources.ru/index.php?showtopic=384858&amp;view=findpost&amp;p=3393989</link>
        <description><![CDATA[VLeshka: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=384858&view=findpost&p=3393983'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>leo &#064; <time class="tag-quote__quoted-time" datetime="2013-12-31T12:48:21+04:00">31.12.13, 08:48</time></span><div class='quote '>Ну сам подумай - если одно &quot;доходит&quot;, а другое нет, то либо константа SNMP_PDU_GET неверно объявлена, либо этот запрос действительно не посылается</div></div><br>
Насчёт правильности константы - заместо неё поставлял целые числа.<br>
Но даже если вдруг константа не подпадает ни под одно &quot;известное&quot; (не находящееся в списке выбора case) мне значение, то срабатывает блок else, выводящий сообщение о неизвестном значении константы.<br>
Запрос посылается, т.к. это видно снифером SmartSniff - он ясно показывает, что пакет команды Get доходит до windows-службы snmp нормально.<br>
P.S. антивирусников, брандмауэров нет.]]></description>
        <author>VLeshka</author>
        <category>Delphi: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=384858&amp;view=findpost&amp;p=3393983</guid>
        <pubDate>Tue, 31 Dec 2013 08:48:21 +0000</pubDate>
        <title>Создаю агент расширения snmp, служба snmp не передаёт в мою dll snmp-команду get</title>
        <link>https://forum.sources.ru/index.php?showtopic=384858&amp;view=findpost&amp;p=3393983</link>
        <description><![CDATA[leo: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=384858&view=findpost&p=3392521'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>VLeshka &#064; <time class="tag-quote__quoted-time" datetime="2013-12-27T07:34:38+00:00">27.12.13, 07:34</time></span><div class='quote '>//работаем; команды типа GETNEXT доходят<br>
//команды типа GET не доходят</div></div><br>
Ну сам подумай - если одно &quot;доходит&quot;, а другое нет, то либо константа SNMP_PDU_GET неверно объявлена, либо этот запрос действительно не посылается]]></description>
        <author>leo</author>
        <category>Delphi: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=384858&amp;view=findpost&amp;p=3392521</guid>
        <pubDate>Fri, 27 Dec 2013 07:34:38 +0000</pubDate>
        <title>Создаю агент расширения snmp, служба snmp не передаёт в мою dll snmp-команду get</title>
        <link>https://forum.sources.ru/index.php?showtopic=384858&amp;view=findpost&amp;p=3392521</link>
        <description><![CDATA[VLeshka: <strong class='tag-b'>raxp</strong><br>
<em class='tag-i'>...и где можно увидеть, что вы это делаете?</em><br>
[извините, не заметил что вы тут ответили]<br>
<br>
Экспортирую:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">exports</div><div class="code_line">&nbsp;&nbsp;Init &nbsp; name &#39;SnmpExtensionInit&#39;,</div><div class="code_line">&nbsp;&nbsp;Query name &#39;SnmpExtensionQuery&#39;;</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br>
<br>
Дальше сама функция, обрабатывающая запросы:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">//BOOL SNMP_FUNC_TYPE SnmpExtensionQuery( &nbsp; &nbsp;BYTE bPduType,</div><div class="code_line">// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SnmpVarBindList *pVarBindList,</div><div class="code_line">// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;AsnInteger32 *pErrorStatus,</div><div class="code_line">// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;AsnInteger32 *pErrorIndex)</div><div class="code_line">function Query(bPduType:Byte;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pVarBindList:PSnmpVarBindList;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pErrorStatus:PAsnInteger32;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pErrorIndex:PAsnInteger32):boolean; &nbsp; export; &nbsp; stdcall;</div></ol></div></div></div></div><br>
Дальше - тело функции:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">function Query(bPduType:Byte;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pVarBindList:PSnmpVarBindList;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pErrorStatus:PAsnInteger32;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pErrorIndex:PAsnInteger32):boolean; &nbsp;export; &nbsp; stdcall;</div><div class="code_line">begin</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;pErrorIndex^ := 0;</div><div class="code_line">&nbsp;pErrorStatus^ := SNMP_ERRORSTATUS_NOERROR;</div><div class="code_line">&nbsp;case bPduType of</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SNMP_PDU_GETNEXT:</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//работаем; команды типа GETNEXT доходят</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Assist.LogMessageAdd(&#39;GETNEXT OK&#39;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SNMP_PDU_GET:</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//команды типа GET не доходят</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Assist.LogMessageAdd(&#39;GET OK&#39;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else //case bPduType of</div><div class="code_line">&nbsp;begin</div><div class="code_line">&nbsp;Assist.LogMessageAdd(&#39;Неизвестное значение bPduType: &#39; + IntToStr(bPduType));</div><div class="code_line">&nbsp;//ErrorStatus := SNMP_ERRORSTATUS_NOACCESS;</div><div class="code_line">&nbsp;//errorIndex := 1;</div><div class="code_line">&nbsp;end;</div></ol></div></div></div></div>]]></description>
        <author>VLeshka</author>
        <category>Delphi: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=384858&amp;view=findpost&amp;p=3385613</guid>
        <pubDate>Wed, 11 Dec 2013 10:59:27 +0000</pubDate>
        <title>Создаю агент расширения snmp, служба snmp не передаёт в мою dll snmp-команду get</title>
        <link>https://forum.sources.ru/index.php?showtopic=384858&amp;view=findpost&amp;p=3385613</link>
        <description><![CDATA[raxp: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>Но дольше в функцию SnmpExtensionQuery моей dll-ки ничего не передаётся.</div></div>...и где можно увидеть, что вы это делаете?]]></description>
        <author>raxp</author>
        <category>Delphi: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=384858&amp;view=findpost&amp;p=3385423</guid>
        <pubDate>Wed, 11 Dec 2013 06:53:41 +0000</pubDate>
        <title>Создаю агент расширения snmp, служба snmp не передаёт в мою dll snmp-команду get</title>
        <link>https://forum.sources.ru/index.php?showtopic=384858&amp;view=findpost&amp;p=3385423</link>
        <description><![CDATA[VLeshka: Создаю агент расширения snmp ( <a class='tag-url' href='http://habrahabr.ru/post/147365/' target='_blank'>http://habrahabr.ru/post/147365/</a> ).<br>
<br>
Моей dll-кой нормально принимается snmp-запросы только типа GetNext. Snmp-запросы типа Get не принимаются.<br>
<br>
Снифер SmartSniff показывает, что пакет команды Get доходит до windows-службы snmp нормально. Но дольше в функцию SnmpExtensionQuery моей dll-ки ничего не передаётся.<br>
<br>
С командой GetNext, windows-служба snmp вызывает SnmpExtensionQuery в моей dll-ке нормально.<br>
<br>
Код проекта:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">library ProjectSnmpDll;</div><div class="code_line">&nbsp;</div><div class="code_line">uses</div><div class="code_line">&nbsp;&nbsp;Forms,</div><div class="code_line">&nbsp;&nbsp;MainUnit in &#39;MainUnit.pas&#39;,</div><div class="code_line">&nbsp;&nbsp;Assistent in &#39;Assistent.pas&#39;,</div><div class="code_line">&nbsp;&nbsp;Snmp in &#39;Snmp.pas&#39;,</div><div class="code_line">&nbsp;&nbsp;Mgmtapi in &#39;Mgmtapi.pas&#39;;</div><div class="code_line">&nbsp;</div><div class="code_line">{$R *.res}</div><div class="code_line">&nbsp;</div><div class="code_line">exports</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;Init &nbsp; name &#39;SnmpExtensionInit&#39;,</div><div class="code_line">&nbsp;&nbsp;Query name &#39;SnmpExtensionQuery&#39;;</div><div class="code_line">&nbsp;</div><div class="code_line">end.</div></ol></div></div></div></div><br>
<br>
Код объявления функции Query:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">function Query(bPduType:Byte;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pVarBindList:PSnmpVarBindList;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pErrorStatus:PAsnInteger32;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pErrorIndex:PAsnInteger32):boolean; &nbsp;export; &nbsp; stdcall;</div></ol></div></div></div></div><br>
<br>
В чём я не прав?]]></description>
        <author>VLeshka</author>
        <category>Delphi: Сетевое программирование</category>
      </item>
	
      </channel>
      </rss>
	