📄 c-sub_agents5.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><link rel="STYLESHEET" type="text/css" href="wrs.css"><title> SNMP Distributed Agents </title></head><body bgcolor="FFFFFF"><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a></a><a href="c-sub_agents.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-sub_agents4.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="x-mibcomp.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p><font face="Helvetica, sans-serif" class="sans"><h3 class="H2"><i><a name="89441">7.5 Registering a WindNet SNMP Subagent</a></i></h3></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="89442"> </a>For an example of how you would write code that registered a subagent with the master agent, see <b class="file">target/src/snmpv1/agent/taskRoutine.c</b>. This code implements a simple subagent that manages a task table. To initialize this subagent, you would call <b class="routine"><i class="routine">taskObjReg</i></b><b>( )</b>. Internally, this function calls <b class="routine"><i class="routine">snmpSaInit</i></b><b>( )</b> to setup the IPC mechanism that the master agent can use to send messages to this subagent. This function also specifies <b class="routine"><i class="routine">taskRegComp</i></b><b>( )</b> as the registration completion routine.</p><dd><p class="Body"><a name="88856"> </a>After setting up the IPC mechanism, <b class="routine"><i class="routine">taskObjReg</i></b><b>( )</b>sets up a varbind list describing the task table and uses <b class="routine"><i class="routine">hdrBlkCreate</i></b><b>( )</b> to send a message to the master agent that registers the task table variables. In response to the registration request, the master agent puts a message on the subagents message queue. To process the message, the subagent calls its registration completion routine, <b class="routine"><i class="routine">taskRegComp</i></b><b>( )</b>. If the registration request was successful, <b class="routine"><i class="routine">taskRegComp</i></b><b>( )</b> extracts a group ID from the completion message and uses it to register task-specific instances for each variable in the task variable. </p></dl></dl><a name="foot"><hr></a><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a></a><a href="c-sub_agents.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-sub_agents4.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="x-mibcomp.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p></body></html><!---by WRS Documentation (), Wind River Systems, Inc. conversion tool: Quadralay WebWorks Publisher 4.0.11 template: CSS Template, Jan 1998 - Jefro --->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -