| Current File : //usr/share/doc/net-snmp/html/watcher_8c_source.html |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>net-snmp: watcher.c Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">net-snmp
 <span id="projectnumber">5.4.1</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.7.6.1 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="headertitle">
<div class="title">watcher.c</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include <net-snmp/net-snmp-config.h></span>
<a name="l00002"></a>00002
<a name="l00003"></a>00003 <span class="preprocessor">#include <stdlib.h></span>
<a name="l00004"></a>00004 <span class="preprocessor">#if HAVE_STRING_H</span>
<a name="l00005"></a>00005 <span class="preprocessor"></span><span class="preprocessor">#include <string.h></span>
<a name="l00006"></a>00006 <span class="preprocessor">#else</span>
<a name="l00007"></a>00007 <span class="preprocessor"></span><span class="preprocessor">#include <strings.h></span>
<a name="l00008"></a>00008 <span class="preprocessor">#endif</span>
<a name="l00009"></a>00009 <span class="preprocessor"></span>
<a name="l00010"></a>00010 <span class="preprocessor">#include <net-snmp/net-snmp-includes.h></span>
<a name="l00011"></a>00011 <span class="preprocessor">#include <net-snmp/agent/net-snmp-agent-includes.h></span>
<a name="l00012"></a>00012
<a name="l00013"></a>00013 <span class="preprocessor">#include <net-snmp/agent/watcher.h></span>
<a name="l00014"></a>00014 <span class="preprocessor">#include <net-snmp/agent/instance.h></span>
<a name="l00015"></a>00015 <span class="preprocessor">#include <net-snmp/agent/scalar.h></span>
<a name="l00016"></a>00016
<a name="l00022"></a>00022 <a class="code" href="structnetsnmp__mib__handler__s.html" title="the mib handler structure to be registered">netsnmp_mib_handler</a> *
<a name="l00023"></a>00023 netsnmp_get_watcher_handler(<span class="keywordtype">void</span>)
<a name="l00024"></a>00024 {
<a name="l00025"></a>00025 <a class="code" href="structnetsnmp__mib__handler__s.html" title="the mib handler structure to be registered">netsnmp_mib_handler</a> *ret = NULL;
<a name="l00026"></a>00026
<a name="l00027"></a>00027 ret = <a class="code" href="group__handler.html#ga169c1653d481ed3d7df0c1795d99ca0c" title="creates a netsnmp_mib_handler structure given a name and a access method.">netsnmp_create_handler</a>(<span class="stringliteral">"watcher"</span>,
<a name="l00028"></a>00028 netsnmp_watcher_helper_handler);
<a name="l00029"></a>00029 <span class="keywordflow">if</span> (ret) {
<a name="l00030"></a>00030 ret-><a class="code" href="structnetsnmp__mib__handler__s.html#a320fa53cc0c6edac56c54d6dcf17dfe9" title="for agent_handler's internal use">flags</a> |= MIB_HANDLER_AUTO_NEXT;
<a name="l00031"></a>00031 }
<a name="l00032"></a>00032 <span class="keywordflow">return</span> ret;
<a name="l00033"></a>00033 }
<a name="l00034"></a>00034
<a name="l00035"></a>00035 <a class="code" href="structnetsnmp__watcher__info__s.html">netsnmp_watcher_info</a> *
<a name="l00036"></a>00036 netsnmp_create_watcher_info(<span class="keywordtype">void</span> *data, <span class="keywordtype">size_t</span> size, u_char type, <span class="keywordtype">int</span> flags)
<a name="l00037"></a>00037 {
<a name="l00038"></a>00038 <a class="code" href="structnetsnmp__watcher__info__s.html">netsnmp_watcher_info</a> *winfo = <a class="code" href="group__util.html#ga9cd013bb193de5048149afeb9d94e424" title="Mallocs memory of sizeof(t), zeros it and returns a pointer to it.">SNMP_MALLOC_TYPEDEF</a>(<a class="code" href="structnetsnmp__watcher__info__s.html">netsnmp_watcher_info</a>);
<a name="l00039"></a>00039
<a name="l00040"></a>00040 winfo->data = data;
<a name="l00041"></a>00041 winfo->data_size = size;
<a name="l00042"></a>00042 winfo->max_size = size; <span class="comment">/* Probably wrong for non-fixed size data */</span>
<a name="l00043"></a>00043 winfo->type = type;
<a name="l00044"></a>00044 <span class="keywordflow">if</span> (flags)
<a name="l00045"></a>00045 winfo->flags = flags;
<a name="l00046"></a>00046 <span class="keywordflow">else</span>
<a name="l00047"></a>00047 winfo->flags = WATCHER_FIXED_SIZE;
<a name="l00048"></a>00048
<a name="l00049"></a>00049 <span class="keywordflow">return</span> winfo;
<a name="l00050"></a>00050 }
<a name="l00051"></a>00051
<a name="l00052"></a>00052 <span class="keywordtype">int</span>
<a name="l00053"></a>00053 netsnmp_register_watched_instance(<a class="code" href="structnetsnmp__handler__registration__s.html" title="Root registration info.">netsnmp_handler_registration</a> *reginfo,
<a name="l00054"></a>00054 <a class="code" href="structnetsnmp__watcher__info__s.html">netsnmp_watcher_info</a> *watchinfo)
<a name="l00055"></a>00055 {
<a name="l00056"></a>00056 <a class="code" href="structnetsnmp__mib__handler__s.html" title="the mib handler structure to be registered">netsnmp_mib_handler</a> *whandler;
<a name="l00057"></a>00057
<a name="l00058"></a>00058 whandler = netsnmp_get_watcher_handler();
<a name="l00059"></a>00059 whandler-><a class="code" href="structnetsnmp__mib__handler__s.html#a74067d02cea4a059cd0fce7790b77b18" title="for handler's internal use">myvoid</a> = (<span class="keywordtype">void</span> *)watchinfo;
<a name="l00060"></a>00060
<a name="l00061"></a>00061 <a class="code" href="group__handler.html#ga6649d75b3eaf98d70704754d3d8235f3" title="inject a new handler into the calling chain of the handlers definedy by the netsnmp_handler_registrat...">netsnmp_inject_handler</a>(reginfo, whandler);
<a name="l00062"></a>00062 <span class="keywordflow">return</span> <a class="code" href="group__instance.html#ga9f743af6acf477e9030b789dadb63f5c" title="This function registers an instance helper handler, which is a way of registering an exact OID such t...">netsnmp_register_instance</a>(reginfo);
<a name="l00063"></a>00063 }
<a name="l00064"></a>00064
<a name="l00065"></a>00065 <span class="keywordtype">int</span>
<a name="l00066"></a>00066 netsnmp_register_watched_scalar(<a class="code" href="structnetsnmp__handler__registration__s.html" title="Root registration info.">netsnmp_handler_registration</a> *reginfo,
<a name="l00067"></a>00067 <a class="code" href="structnetsnmp__watcher__info__s.html">netsnmp_watcher_info</a> *watchinfo)
<a name="l00068"></a>00068 {
<a name="l00069"></a>00069 <a class="code" href="structnetsnmp__mib__handler__s.html" title="the mib handler structure to be registered">netsnmp_mib_handler</a> *whandler;
<a name="l00070"></a>00070
<a name="l00071"></a>00071 whandler = netsnmp_get_watcher_handler();
<a name="l00072"></a>00072 whandler-><a class="code" href="structnetsnmp__mib__handler__s.html#a74067d02cea4a059cd0fce7790b77b18" title="for handler's internal use">myvoid</a> = (<span class="keywordtype">void</span> *)watchinfo;
<a name="l00073"></a>00073
<a name="l00074"></a>00074 <a class="code" href="group__handler.html#ga6649d75b3eaf98d70704754d3d8235f3" title="inject a new handler into the calling chain of the handlers definedy by the netsnmp_handler_registrat...">netsnmp_inject_handler</a>(reginfo, whandler);
<a name="l00075"></a>00075 <span class="keywordflow">return</span> <a class="code" href="group__scalar.html#ga6704e7c5174af3bd65042b61afeaa02f" title="This function registers a scalar helper handler.">netsnmp_register_scalar</a>(reginfo);
<a name="l00076"></a>00076 }
<a name="l00077"></a>00077
<a name="l00078"></a>00078
<a name="l00079"></a>00079
<a name="l00080"></a>00080 <span class="keywordtype">int</span>
<a name="l00081"></a>00081 netsnmp_watcher_helper_handler(<a class="code" href="structnetsnmp__mib__handler__s.html" title="the mib handler structure to be registered">netsnmp_mib_handler</a> *handler,
<a name="l00082"></a>00082 <a class="code" href="structnetsnmp__handler__registration__s.html" title="Root registration info.">netsnmp_handler_registration</a> *reginfo,
<a name="l00083"></a>00083 <a class="code" href="structnetsnmp__agent__request__info__s.html" title="The agent transaction request structure.">netsnmp_agent_request_info</a> *reqinfo,
<a name="l00084"></a>00084 <a class="code" href="structnetsnmp__request__info__s.html" title="The netsnmp request info structure.">netsnmp_request_info</a> *requests)
<a name="l00085"></a>00085 {
<a name="l00086"></a>00086 <a class="code" href="structnetsnmp__watcher__info__s.html">netsnmp_watcher_info</a> *winfo = (<a class="code" href="structnetsnmp__watcher__info__s.html">netsnmp_watcher_info</a> *) handler-><a class="code" href="structnetsnmp__mib__handler__s.html#a74067d02cea4a059cd0fce7790b77b18" title="for handler's internal use">myvoid</a>;
<a name="l00087"></a>00087 u_char *old_data;
<a name="l00088"></a>00088 <span class="keywordtype">int</span> cmp;
<a name="l00089"></a>00089
<a name="l00090"></a>00090 DEBUGMSGTL((<span class="stringliteral">"helper:watcher"</span>, <span class="stringliteral">"Got request: %d\n"</span>, reqinfo->mode));
<a name="l00091"></a>00091 cmp = <a class="code" href="group__library.html#gab5b48a42c19a801547e025ed40b4561e" title="lexicographical compare two object identifiers.">snmp_oid_compare</a>(requests-><a class="code" href="structnetsnmp__request__info__s.html#a455d87f6b7178fe19ea564c60c0ccb6f" title="variable bindings">requestvb</a>-><a class="code" href="structvariable__list.html#a7b5bdda01921550d24ea53033ce76146" title="Object identifier of variable.">name</a>,
<a name="l00092"></a>00092 requests-><a class="code" href="structnetsnmp__request__info__s.html#a455d87f6b7178fe19ea564c60c0ccb6f" title="variable bindings">requestvb</a>-><a class="code" href="structvariable__list.html#a089e5b1a422bf8e693510ff5408a57a7" title="number of subid's in name">name_length</a>,
<a name="l00093"></a>00093 reginfo-><a class="code" href="structnetsnmp__handler__registration__s.html#a264722b6b9385237fbcb5f8bc144d470" title="where are we registered at?">rootoid</a>, reginfo->rootoid_len);
<a name="l00094"></a>00094
<a name="l00095"></a>00095 DEBUGMSGTL(( <span class="stringliteral">"helper:watcher"</span>, <span class="stringliteral">" oid:"</span>, cmp));
<a name="l00096"></a>00096 DEBUGMSGOID((<span class="stringliteral">"helper:watcher"</span>, requests-><a class="code" href="structnetsnmp__request__info__s.html#a455d87f6b7178fe19ea564c60c0ccb6f" title="variable bindings">requestvb</a>-><a class="code" href="structvariable__list.html#a7b5bdda01921550d24ea53033ce76146" title="Object identifier of variable.">name</a>,
<a name="l00097"></a>00097 requests-><a class="code" href="structnetsnmp__request__info__s.html#a455d87f6b7178fe19ea564c60c0ccb6f" title="variable bindings">requestvb</a>-><a class="code" href="structvariable__list.html#a089e5b1a422bf8e693510ff5408a57a7" title="number of subid's in name">name_length</a>));
<a name="l00098"></a>00098 DEBUGMSG(( <span class="stringliteral">"helper:watcher"</span>, <span class="stringliteral">"\n"</span>));
<a name="l00099"></a>00099
<a name="l00100"></a>00100
<a name="l00101"></a>00101
<a name="l00102"></a>00102 <span class="keywordflow">switch</span> (reqinfo->mode) {
<a name="l00103"></a>00103 <span class="comment">/*</span>
<a name="l00104"></a>00104 <span class="comment"> * data requests </span>
<a name="l00105"></a>00105 <span class="comment"> */</span>
<a name="l00106"></a>00106 <span class="keywordflow">case</span> MODE_GET:
<a name="l00107"></a>00107 <a class="code" href="group__snmp__client.html#ga63bee067f8a29d6454d96630e5e225a7" title="snmp_set_var_typed_value is used to set data into the netsnmp_variable_list structure.">snmp_set_var_typed_value</a>(requests-><a class="code" href="structnetsnmp__request__info__s.html#a455d87f6b7178fe19ea564c60c0ccb6f" title="variable bindings">requestvb</a>,
<a name="l00108"></a>00108 winfo->type,
<a name="l00109"></a>00109 winfo->data,
<a name="l00110"></a>00110 winfo->data_size);
<a name="l00111"></a>00111 <span class="keywordflow">break</span>;
<a name="l00112"></a>00112
<a name="l00113"></a>00113 <span class="comment">/*</span>
<a name="l00114"></a>00114 <span class="comment"> * SET requests. Should only get here if registered RWRITE </span>
<a name="l00115"></a>00115 <span class="comment"> */</span>
<a name="l00116"></a>00116 <span class="keywordflow">case</span> MODE_SET_RESERVE1:
<a name="l00117"></a>00117 <span class="keywordflow">if</span> (requests-><a class="code" href="structnetsnmp__request__info__s.html#a455d87f6b7178fe19ea564c60c0ccb6f" title="variable bindings">requestvb</a>-><a class="code" href="structvariable__list.html#a8bd719974b3554116631ea80dc88b6aa" title="ASN type of variable.">type</a> != winfo->type)
<a name="l00118"></a>00118 <a class="code" href="group__snmp__agent.html#gac0668f1fd9036ebc88a734d9d4a6a59b" title="set error for a request">netsnmp_set_request_error</a>(reqinfo, requests,
<a name="l00119"></a>00119 SNMP_ERR_WRONGTYPE);
<a name="l00120"></a>00120
<a name="l00121"></a>00121 <span class="keywordflow">if</span> (((winfo->flags & WATCHER_MAX_SIZE) &&
<a name="l00122"></a>00122 requests-><a class="code" href="structnetsnmp__request__info__s.html#a455d87f6b7178fe19ea564c60c0ccb6f" title="variable bindings">requestvb</a>-><a class="code" href="structvariable__list.html#a17aaa6b445178fc39aba69642247d3e9" title="the length of the value to be copied into buf">val_len</a> > winfo->max_size) ||
<a name="l00123"></a>00123 ((winfo->flags & WATCHER_FIXED_SIZE) &&
<a name="l00124"></a>00124 requests-><a class="code" href="structnetsnmp__request__info__s.html#a455d87f6b7178fe19ea564c60c0ccb6f" title="variable bindings">requestvb</a>-><a class="code" href="structvariable__list.html#a17aaa6b445178fc39aba69642247d3e9" title="the length of the value to be copied into buf">val_len</a> != winfo->data_size))
<a name="l00125"></a>00125 <a class="code" href="group__snmp__agent.html#gac0668f1fd9036ebc88a734d9d4a6a59b" title="set error for a request">netsnmp_set_request_error</a>(reqinfo, requests,
<a name="l00126"></a>00126 SNMP_ERR_WRONGLENGTH);
<a name="l00127"></a>00127 <span class="keywordflow">break</span>;
<a name="l00128"></a>00128
<a name="l00129"></a>00129 <span class="keywordflow">case</span> MODE_SET_RESERVE2:
<a name="l00130"></a>00130 <span class="comment">/*</span>
<a name="l00131"></a>00131 <span class="comment"> * store old info for undo later </span>
<a name="l00132"></a>00132 <span class="comment"> */</span>
<a name="l00133"></a>00133 <a class="code" href="group__util.html#ga623784b8aac0469fcd84e24ccdeda0bd" title="Duplicates a memory block.">memdup</a>(&old_data, (u_char *) winfo->data, winfo->data_size);
<a name="l00134"></a>00134 <span class="keywordflow">if</span> (old_data == NULL) {
<a name="l00135"></a>00135 <a class="code" href="group__snmp__agent.html#gac0668f1fd9036ebc88a734d9d4a6a59b" title="set error for a request">netsnmp_set_request_error</a>(reqinfo, requests,
<a name="l00136"></a>00136 SNMP_ERR_RESOURCEUNAVAILABLE);
<a name="l00137"></a>00137 <span class="keywordflow">return</span> SNMP_ERR_NOERROR;
<a name="l00138"></a>00138 }
<a name="l00139"></a>00139 <a class="code" href="group__handler.html#ga4ae3a042dd44f903a42314910aa7e396" title="add data to a request that can be extracted later by submodules">netsnmp_request_add_list_data</a>(requests,
<a name="l00140"></a>00140 <a class="code" href="group__data__list.html#ga3dc286b678474c6adb610460ea71b03e" title="adds creates a data_list node given a name, data and a free function ptr.">netsnmp_create_data_list</a>
<a name="l00141"></a>00141 (<span class="stringliteral">"watcher"</span>, old_data, free));
<a name="l00142"></a>00142 <span class="keywordflow">break</span>;
<a name="l00143"></a>00143
<a name="l00144"></a>00144 <span class="keywordflow">case</span> MODE_SET_FREE:
<a name="l00145"></a>00145 <span class="comment">/*</span>
<a name="l00146"></a>00146 <span class="comment"> * nothing to do </span>
<a name="l00147"></a>00147 <span class="comment"> */</span>
<a name="l00148"></a>00148 <span class="keywordflow">break</span>;
<a name="l00149"></a>00149
<a name="l00150"></a>00150 <span class="keywordflow">case</span> MODE_SET_ACTION:
<a name="l00151"></a>00151 <span class="comment">/*</span>
<a name="l00152"></a>00152 <span class="comment"> * update current </span>
<a name="l00153"></a>00153 <span class="comment"> */</span>
<a name="l00154"></a>00154 memcpy(winfo->data, (<span class="keywordtype">void</span> *)requests-><a class="code" href="structnetsnmp__request__info__s.html#a455d87f6b7178fe19ea564c60c0ccb6f" title="variable bindings">requestvb</a>-><a class="code" href="structvariable__list.html#a6ed7c00d712b83c174823b1cff6e9e29" title="value of variable">val</a>.string,
<a name="l00155"></a>00155 requests-><a class="code" href="structnetsnmp__request__info__s.html#a455d87f6b7178fe19ea564c60c0ccb6f" title="variable bindings">requestvb</a>-><a class="code" href="structvariable__list.html#a17aaa6b445178fc39aba69642247d3e9" title="the length of the value to be copied into buf">val_len</a>);
<a name="l00156"></a>00156 <span class="keywordflow">break</span>;
<a name="l00157"></a>00157
<a name="l00158"></a>00158 <span class="keywordflow">case</span> MODE_SET_UNDO:
<a name="l00159"></a>00159 memcpy(winfo->data,
<a name="l00160"></a>00160 <a class="code" href="group__handler.html#ga7e710ceaced994ee73e3a2601a4bd7c9" title="extract data from a request that was added previously by a parent module">netsnmp_request_get_list_data</a>(requests, <span class="stringliteral">"watcher"</span>),
<a name="l00161"></a>00161 winfo->data_size);
<a name="l00162"></a>00162 <span class="keywordflow">break</span>;
<a name="l00163"></a>00163
<a name="l00164"></a>00164 <span class="keywordflow">case</span> MODE_SET_COMMIT:
<a name="l00165"></a>00165 winfo->data_size = requests-><a class="code" href="structnetsnmp__request__info__s.html#a455d87f6b7178fe19ea564c60c0ccb6f" title="variable bindings">requestvb</a>-><a class="code" href="structvariable__list.html#a17aaa6b445178fc39aba69642247d3e9" title="the length of the value to be copied into buf">val_len</a>;
<a name="l00166"></a>00166 <span class="keywordflow">break</span>;
<a name="l00167"></a>00167
<a name="l00168"></a>00168 }
<a name="l00169"></a>00169
<a name="l00170"></a>00170 <span class="comment">/* next handler called automatically - 'AUTO_NEXT' */</span>
<a name="l00171"></a>00171 <span class="keywordflow">return</span> SNMP_ERR_NOERROR;
<a name="l00172"></a>00172 }
<a name="l00173"></a>00173
<a name="l00174"></a>00174
<a name="l00175"></a>00175 <span class="comment">/***************************</span>
<a name="l00176"></a>00176 <span class="comment"> *</span>
<a name="l00177"></a>00177 <span class="comment"> * A specialised form of the above, reporting</span>
<a name="l00178"></a>00178 <span class="comment"> * the sysUpTime indicated by a given timestamp</span>
<a name="l00179"></a>00179 <span class="comment"> *</span>
<a name="l00180"></a>00180 <span class="comment"> ***************************/</span>
<a name="l00181"></a>00181
<a name="l00182"></a>00182 <a class="code" href="structnetsnmp__mib__handler__s.html" title="the mib handler structure to be registered">netsnmp_mib_handler</a> *
<a name="l00183"></a>00183 netsnmp_get_watched_timestamp_handler(<span class="keywordtype">void</span>)
<a name="l00184"></a>00184 {
<a name="l00185"></a>00185 <a class="code" href="structnetsnmp__mib__handler__s.html" title="the mib handler structure to be registered">netsnmp_mib_handler</a> *ret = NULL;
<a name="l00186"></a>00186
<a name="l00187"></a>00187 ret = <a class="code" href="group__handler.html#ga169c1653d481ed3d7df0c1795d99ca0c" title="creates a netsnmp_mib_handler structure given a name and a access method.">netsnmp_create_handler</a>(<span class="stringliteral">"watcher"</span>,
<a name="l00188"></a>00188 netsnmp_watched_timestamp_handler);
<a name="l00189"></a>00189 <span class="keywordflow">if</span> (ret) {
<a name="l00190"></a>00190 ret-><a class="code" href="structnetsnmp__mib__handler__s.html#a320fa53cc0c6edac56c54d6dcf17dfe9" title="for agent_handler's internal use">flags</a> |= MIB_HANDLER_AUTO_NEXT;
<a name="l00191"></a>00191 }
<a name="l00192"></a>00192 <span class="keywordflow">return</span> ret;
<a name="l00193"></a>00193 }
<a name="l00194"></a>00194
<a name="l00195"></a>00195 <span class="keywordtype">int</span>
<a name="l00196"></a>00196 netsnmp_watched_timestamp_register(<a class="code" href="structnetsnmp__mib__handler__s.html" title="the mib handler structure to be registered">netsnmp_mib_handler</a> *whandler,
<a name="l00197"></a>00197 <a class="code" href="structnetsnmp__handler__registration__s.html" title="Root registration info.">netsnmp_handler_registration</a> *reginfo,
<a name="l00198"></a>00198 marker_t timestamp)
<a name="l00199"></a>00199 {
<a name="l00200"></a>00200 whandler-><a class="code" href="structnetsnmp__mib__handler__s.html#a74067d02cea4a059cd0fce7790b77b18" title="for handler's internal use">myvoid</a> = (<span class="keywordtype">void</span> *)timestamp;
<a name="l00201"></a>00201 <a class="code" href="group__handler.html#ga6649d75b3eaf98d70704754d3d8235f3" title="inject a new handler into the calling chain of the handlers definedy by the netsnmp_handler_registrat...">netsnmp_inject_handler</a>(reginfo, whandler);
<a name="l00202"></a>00202 <span class="keywordflow">return</span> <a class="code" href="group__scalar.html#ga6704e7c5174af3bd65042b61afeaa02f" title="This function registers a scalar helper handler.">netsnmp_register_scalar</a>(reginfo); <span class="comment">/* XXX - or instance? */</span>
<a name="l00203"></a>00203 }
<a name="l00204"></a>00204
<a name="l00205"></a>00205 <span class="keywordtype">int</span>
<a name="l00206"></a>00206 netsnmp_register_watched_timestamp(<a class="code" href="structnetsnmp__handler__registration__s.html" title="Root registration info.">netsnmp_handler_registration</a> *reginfo,
<a name="l00207"></a>00207 marker_t timestamp)
<a name="l00208"></a>00208 {
<a name="l00209"></a>00209 <a class="code" href="structnetsnmp__mib__handler__s.html" title="the mib handler structure to be registered">netsnmp_mib_handler</a> *whandler;
<a name="l00210"></a>00210
<a name="l00211"></a>00211 whandler = netsnmp_get_watched_timestamp_handler();
<a name="l00212"></a>00212
<a name="l00213"></a>00213 <span class="keywordflow">return</span> netsnmp_watched_timestamp_register(whandler, reginfo, timestamp);
<a name="l00214"></a>00214 }
<a name="l00215"></a>00215
<a name="l00216"></a>00216
<a name="l00217"></a>00217 <span class="keywordtype">int</span>
<a name="l00218"></a>00218 netsnmp_watched_timestamp_handler(<a class="code" href="structnetsnmp__mib__handler__s.html" title="the mib handler structure to be registered">netsnmp_mib_handler</a> *handler,
<a name="l00219"></a>00219 <a class="code" href="structnetsnmp__handler__registration__s.html" title="Root registration info.">netsnmp_handler_registration</a> *reginfo,
<a name="l00220"></a>00220 <a class="code" href="structnetsnmp__agent__request__info__s.html" title="The agent transaction request structure.">netsnmp_agent_request_info</a> *reqinfo,
<a name="l00221"></a>00221 <a class="code" href="structnetsnmp__request__info__s.html" title="The netsnmp request info structure.">netsnmp_request_info</a> *requests)
<a name="l00222"></a>00222 {
<a name="l00223"></a>00223 marker_t timestamp = (marker_t) handler-><a class="code" href="structnetsnmp__mib__handler__s.html#a74067d02cea4a059cd0fce7790b77b18" title="for handler's internal use">myvoid</a>;
<a name="l00224"></a>00224 <span class="keywordtype">long</span> uptime;
<a name="l00225"></a>00225 <span class="keywordtype">int</span> cmp;
<a name="l00226"></a>00226
<a name="l00227"></a>00227 DEBUGMSGTL((<span class="stringliteral">"helper:watcher:timestamp"</span>,
<a name="l00228"></a>00228 <span class="stringliteral">"Got request: %d\n"</span>, reqinfo->mode));
<a name="l00229"></a>00229 cmp = <a class="code" href="group__library.html#gab5b48a42c19a801547e025ed40b4561e" title="lexicographical compare two object identifiers.">snmp_oid_compare</a>(requests-><a class="code" href="structnetsnmp__request__info__s.html#a455d87f6b7178fe19ea564c60c0ccb6f" title="variable bindings">requestvb</a>-><a class="code" href="structvariable__list.html#a7b5bdda01921550d24ea53033ce76146" title="Object identifier of variable.">name</a>,
<a name="l00230"></a>00230 requests-><a class="code" href="structnetsnmp__request__info__s.html#a455d87f6b7178fe19ea564c60c0ccb6f" title="variable bindings">requestvb</a>-><a class="code" href="structvariable__list.html#a089e5b1a422bf8e693510ff5408a57a7" title="number of subid's in name">name_length</a>,
<a name="l00231"></a>00231 reginfo-><a class="code" href="structnetsnmp__handler__registration__s.html#a264722b6b9385237fbcb5f8bc144d470" title="where are we registered at?">rootoid</a>, reginfo->rootoid_len);
<a name="l00232"></a>00232
<a name="l00233"></a>00233 DEBUGMSGTL(( <span class="stringliteral">"helper:watcher:timestamp"</span>, <span class="stringliteral">" oid:"</span>, cmp));
<a name="l00234"></a>00234 DEBUGMSGOID((<span class="stringliteral">"helper:watcher:timestamp"</span>, requests-><a class="code" href="structnetsnmp__request__info__s.html#a455d87f6b7178fe19ea564c60c0ccb6f" title="variable bindings">requestvb</a>-><a class="code" href="structvariable__list.html#a7b5bdda01921550d24ea53033ce76146" title="Object identifier of variable.">name</a>,
<a name="l00235"></a>00235 requests-><a class="code" href="structnetsnmp__request__info__s.html#a455d87f6b7178fe19ea564c60c0ccb6f" title="variable bindings">requestvb</a>-><a class="code" href="structvariable__list.html#a089e5b1a422bf8e693510ff5408a57a7" title="number of subid's in name">name_length</a>));
<a name="l00236"></a>00236 DEBUGMSG(( <span class="stringliteral">"helper:watcher:timestamp"</span>, <span class="stringliteral">"\n"</span>));
<a name="l00237"></a>00237
<a name="l00238"></a>00238
<a name="l00239"></a>00239
<a name="l00240"></a>00240 <span class="keywordflow">switch</span> (reqinfo->mode) {
<a name="l00241"></a>00241 <span class="comment">/*</span>
<a name="l00242"></a>00242 <span class="comment"> * data requests </span>
<a name="l00243"></a>00243 <span class="comment"> */</span>
<a name="l00244"></a>00244 <span class="keywordflow">case</span> MODE_GET:
<a name="l00245"></a>00245 <span class="keywordflow">if</span> (handler-><a class="code" href="structnetsnmp__mib__handler__s.html#a320fa53cc0c6edac56c54d6dcf17dfe9" title="for agent_handler's internal use">flags</a> & NETSNMP_WATCHER_DIRECT)
<a name="l00246"></a>00246 uptime = * (<span class="keywordtype">long</span>*)timestamp;
<a name="l00247"></a>00247 <span class="keywordflow">else</span>
<a name="l00248"></a>00248 uptime = netsnmp_marker_uptime( timestamp );
<a name="l00249"></a>00249 <a class="code" href="group__snmp__client.html#ga63bee067f8a29d6454d96630e5e225a7" title="snmp_set_var_typed_value is used to set data into the netsnmp_variable_list structure.">snmp_set_var_typed_value</a>(requests-><a class="code" href="structnetsnmp__request__info__s.html#a455d87f6b7178fe19ea564c60c0ccb6f" title="variable bindings">requestvb</a>,
<a name="l00250"></a>00250 ASN_TIMETICKS,
<a name="l00251"></a>00251 (u_char *) &uptime,
<a name="l00252"></a>00252 <span class="keyword">sizeof</span>(uptime));
<a name="l00253"></a>00253 <span class="keywordflow">break</span>;
<a name="l00254"></a>00254
<a name="l00255"></a>00255 <span class="comment">/*</span>
<a name="l00256"></a>00256 <span class="comment"> * Timestamps are inherently Read-Only,</span>
<a name="l00257"></a>00257 <span class="comment"> * so don't need to support SET requests.</span>
<a name="l00258"></a>00258 <span class="comment"> */</span>
<a name="l00259"></a>00259 <span class="keywordflow">case</span> MODE_SET_RESERVE1:
<a name="l00260"></a>00260 <a class="code" href="group__snmp__agent.html#gac0668f1fd9036ebc88a734d9d4a6a59b" title="set error for a request">netsnmp_set_request_error</a>(reqinfo, requests,
<a name="l00261"></a>00261 SNMP_ERR_NOTWRITABLE);
<a name="l00262"></a>00262 <span class="keywordflow">return</span> SNMP_ERR_NOTWRITABLE;
<a name="l00263"></a>00263 }
<a name="l00264"></a>00264
<a name="l00265"></a>00265 <span class="comment">/* next handler called automatically - 'AUTO_NEXT' */</span>
<a name="l00266"></a>00266 <span class="keywordflow">return</span> SNMP_ERR_NOERROR;
<a name="l00267"></a>00267 }
<a name="l00268"></a>00268
<a name="l00269"></a>00269 <span class="comment">/***************************</span>
<a name="l00270"></a>00270 <span class="comment"> *</span>
<a name="l00271"></a>00271 <span class="comment"> * Another specialised form of the above,</span>
<a name="l00272"></a>00272 <span class="comment"> * implementing a 'TestAndIncr' spinlock</span>
<a name="l00273"></a>00273 <span class="comment"> *</span>
<a name="l00274"></a>00274 <span class="comment"> ***************************/</span>
<a name="l00275"></a>00275
<a name="l00276"></a>00276 <a class="code" href="structnetsnmp__mib__handler__s.html" title="the mib handler structure to be registered">netsnmp_mib_handler</a> *
<a name="l00277"></a>00277 netsnmp_get_watched_spinlock_handler(<span class="keywordtype">void</span>)
<a name="l00278"></a>00278 {
<a name="l00279"></a>00279 <a class="code" href="structnetsnmp__mib__handler__s.html" title="the mib handler structure to be registered">netsnmp_mib_handler</a> *ret = NULL;
<a name="l00280"></a>00280
<a name="l00281"></a>00281 ret = <a class="code" href="group__handler.html#ga169c1653d481ed3d7df0c1795d99ca0c" title="creates a netsnmp_mib_handler structure given a name and a access method.">netsnmp_create_handler</a>(<span class="stringliteral">"watcher"</span>,
<a name="l00282"></a>00282 netsnmp_watched_spinlock_handler);
<a name="l00283"></a>00283 <span class="keywordflow">if</span> (ret) {
<a name="l00284"></a>00284 ret-><a class="code" href="structnetsnmp__mib__handler__s.html#a320fa53cc0c6edac56c54d6dcf17dfe9" title="for agent_handler's internal use">flags</a> |= MIB_HANDLER_AUTO_NEXT;
<a name="l00285"></a>00285 }
<a name="l00286"></a>00286 <span class="keywordflow">return</span> ret;
<a name="l00287"></a>00287 }
<a name="l00288"></a>00288
<a name="l00289"></a>00289 <span class="keywordtype">int</span>
<a name="l00290"></a>00290 netsnmp_register_watched_spinlock(<a class="code" href="structnetsnmp__handler__registration__s.html" title="Root registration info.">netsnmp_handler_registration</a> *reginfo,
<a name="l00291"></a>00291 <span class="keywordtype">int</span> *spinlock)
<a name="l00292"></a>00292 {
<a name="l00293"></a>00293 <a class="code" href="structnetsnmp__mib__handler__s.html" title="the mib handler structure to be registered">netsnmp_mib_handler</a> *whandler;
<a name="l00294"></a>00294 <a class="code" href="structnetsnmp__watcher__info__s.html">netsnmp_watcher_info</a> *winfo;
<a name="l00295"></a>00295
<a name="l00296"></a>00296 whandler = netsnmp_get_watched_spinlock_handler();
<a name="l00297"></a>00297 whandler-><a class="code" href="structnetsnmp__mib__handler__s.html#a74067d02cea4a059cd0fce7790b77b18" title="for handler's internal use">myvoid</a> = (<span class="keywordtype">void</span> *)spinlock;
<a name="l00298"></a>00298 winfo = netsnmp_create_watcher_info((<span class="keywordtype">void</span> *)spinlock,
<a name="l00299"></a>00299 <span class="keyword">sizeof</span>(<span class="keywordtype">int</span>), ASN_INTEGER, WATCHER_FIXED_SIZE);
<a name="l00300"></a>00300 <a class="code" href="group__handler.html#ga6649d75b3eaf98d70704754d3d8235f3" title="inject a new handler into the calling chain of the handlers definedy by the netsnmp_handler_registrat...">netsnmp_inject_handler</a>(reginfo, whandler);
<a name="l00301"></a>00301 <span class="keywordflow">return</span> netsnmp_register_watched_scalar(reginfo, winfo);
<a name="l00302"></a>00302 }
<a name="l00303"></a>00303
<a name="l00304"></a>00304
<a name="l00305"></a>00305 <span class="keywordtype">int</span>
<a name="l00306"></a>00306 netsnmp_watched_spinlock_handler(<a class="code" href="structnetsnmp__mib__handler__s.html" title="the mib handler structure to be registered">netsnmp_mib_handler</a> *handler,
<a name="l00307"></a>00307 <a class="code" href="structnetsnmp__handler__registration__s.html" title="Root registration info.">netsnmp_handler_registration</a> *reginfo,
<a name="l00308"></a>00308 <a class="code" href="structnetsnmp__agent__request__info__s.html" title="The agent transaction request structure.">netsnmp_agent_request_info</a> *reqinfo,
<a name="l00309"></a>00309 <a class="code" href="structnetsnmp__request__info__s.html" title="The netsnmp request info structure.">netsnmp_request_info</a> *requests)
<a name="l00310"></a>00310 {
<a name="l00311"></a>00311 <span class="keywordtype">int</span> *spinlock = (<span class="keywordtype">int</span> *) handler-><a class="code" href="structnetsnmp__mib__handler__s.html#a74067d02cea4a059cd0fce7790b77b18" title="for handler's internal use">myvoid</a>;
<a name="l00312"></a>00312 <a class="code" href="structnetsnmp__request__info__s.html" title="The netsnmp request info structure.">netsnmp_request_info</a> *request;
<a name="l00313"></a>00313 <span class="keywordtype">int</span> cmp;
<a name="l00314"></a>00314
<a name="l00315"></a>00315 DEBUGMSGTL((<span class="stringliteral">"helper:watcher:spinlock"</span>,
<a name="l00316"></a>00316 <span class="stringliteral">"Got request: %d\n"</span>, reqinfo->mode));
<a name="l00317"></a>00317 cmp = <a class="code" href="group__library.html#gab5b48a42c19a801547e025ed40b4561e" title="lexicographical compare two object identifiers.">snmp_oid_compare</a>(requests-><a class="code" href="structnetsnmp__request__info__s.html#a455d87f6b7178fe19ea564c60c0ccb6f" title="variable bindings">requestvb</a>-><a class="code" href="structvariable__list.html#a7b5bdda01921550d24ea53033ce76146" title="Object identifier of variable.">name</a>,
<a name="l00318"></a>00318 requests-><a class="code" href="structnetsnmp__request__info__s.html#a455d87f6b7178fe19ea564c60c0ccb6f" title="variable bindings">requestvb</a>-><a class="code" href="structvariable__list.html#a089e5b1a422bf8e693510ff5408a57a7" title="number of subid's in name">name_length</a>,
<a name="l00319"></a>00319 reginfo-><a class="code" href="structnetsnmp__handler__registration__s.html#a264722b6b9385237fbcb5f8bc144d470" title="where are we registered at?">rootoid</a>, reginfo->rootoid_len);
<a name="l00320"></a>00320
<a name="l00321"></a>00321 DEBUGMSGTL(( <span class="stringliteral">"helper:watcher:spinlock"</span>, <span class="stringliteral">" oid:"</span>, cmp));
<a name="l00322"></a>00322 DEBUGMSGOID((<span class="stringliteral">"helper:watcher:spinlock"</span>, requests-><a class="code" href="structnetsnmp__request__info__s.html#a455d87f6b7178fe19ea564c60c0ccb6f" title="variable bindings">requestvb</a>-><a class="code" href="structvariable__list.html#a7b5bdda01921550d24ea53033ce76146" title="Object identifier of variable.">name</a>,
<a name="l00323"></a>00323 requests-><a class="code" href="structnetsnmp__request__info__s.html#a455d87f6b7178fe19ea564c60c0ccb6f" title="variable bindings">requestvb</a>-><a class="code" href="structvariable__list.html#a089e5b1a422bf8e693510ff5408a57a7" title="number of subid's in name">name_length</a>));
<a name="l00324"></a>00324 DEBUGMSG(( <span class="stringliteral">"helper:watcher:spinlock"</span>, <span class="stringliteral">"\n"</span>));
<a name="l00325"></a>00325
<a name="l00326"></a>00326
<a name="l00327"></a>00327
<a name="l00328"></a>00328 <span class="keywordflow">switch</span> (reqinfo->mode) {
<a name="l00329"></a>00329 <span class="comment">/*</span>
<a name="l00330"></a>00330 <span class="comment"> * Ensure the assigned value matches the current one</span>
<a name="l00331"></a>00331 <span class="comment"> */</span>
<a name="l00332"></a>00332 <span class="keywordflow">case</span> MODE_SET_RESERVE1:
<a name="l00333"></a>00333 <span class="keywordflow">for</span> (request=requests; request; request=request->next) {
<a name="l00334"></a>00334 <span class="keywordflow">if</span> (*request->requestvb->val.integer != *spinlock) {
<a name="l00335"></a>00335 <a class="code" href="group__snmp__agent.html#gac0668f1fd9036ebc88a734d9d4a6a59b" title="set error for a request">netsnmp_set_request_error</a>(reqinfo, requests, SNMP_ERR_WRONGVALUE);
<a name="l00336"></a>00336 <span class="keywordflow">return</span> SNMP_ERR_WRONGVALUE;
<a name="l00337"></a>00337
<a name="l00338"></a>00338 }
<a name="l00339"></a>00339 }
<a name="l00340"></a>00340 <span class="keywordflow">break</span>;
<a name="l00341"></a>00341
<a name="l00342"></a>00342 <span class="comment">/*</span>
<a name="l00343"></a>00343 <span class="comment"> * Everything else worked, so increment the spinlock</span>
<a name="l00344"></a>00344 <span class="comment"> */</span>
<a name="l00345"></a>00345 <span class="keywordflow">case</span> MODE_SET_COMMIT:
<a name="l00346"></a>00346 (*spinlock)++;
<a name="l00347"></a>00347 <span class="keywordflow">break</span>;
<a name="l00348"></a>00348 }
<a name="l00349"></a>00349
<a name="l00350"></a>00350 <span class="comment">/* next handler called automatically - 'AUTO_NEXT' */</span>
<a name="l00351"></a>00351 <span class="keywordflow">return</span> SNMP_ERR_NOERROR;
<a name="l00352"></a>00352 }
<a name="l00353"></a>00353
<a name="l00354"></a>00354 <span class="comment">/***************************</span>
<a name="l00355"></a>00355 <span class="comment"> *</span>
<a name="l00356"></a>00356 <span class="comment"> * Convenience registration routines - modelled on</span>
<a name="l00357"></a>00357 <span class="comment"> * the equivalent netsnmp_register_*_instance() calls</span>
<a name="l00358"></a>00358 <span class="comment"> *</span>
<a name="l00359"></a>00359 <span class="comment"> ***************************/</span>
<a name="l00360"></a>00360
<a name="l00361"></a>00361 <span class="keywordtype">int</span>
<a name="l00362"></a>00362 netsnmp_register_ulong_scalar(<span class="keyword">const</span> <span class="keywordtype">char</span> *name,
<a name="l00363"></a>00363 oid * reg_oid, <span class="keywordtype">size_t</span> reg_oid_len,
<a name="l00364"></a>00364 u_long * it,
<a name="l00365"></a>00365 Netsnmp_Node_Handler * subhandler)
<a name="l00366"></a>00366 {
<a name="l00367"></a>00367 <span class="keywordflow">return</span> netsnmp_register_watched_scalar(
<a name="l00368"></a>00368 netsnmp_create_handler_registration(
<a name="l00369"></a>00369 name, subhandler,
<a name="l00370"></a>00370 reg_oid, reg_oid_len,
<a name="l00371"></a>00371 HANDLER_CAN_RWRITE ),
<a name="l00372"></a>00372 netsnmp_create_watcher_info(
<a name="l00373"></a>00373 (<span class="keywordtype">void</span> *)it, <span class="keyword">sizeof</span>( u_long ),
<a name="l00374"></a>00374 ASN_UNSIGNED, WATCHER_FIXED_SIZE ));
<a name="l00375"></a>00375 }
<a name="l00376"></a>00376
<a name="l00377"></a>00377 <span class="keywordtype">int</span>
<a name="l00378"></a>00378 netsnmp_register_read_only_ulong_scalar(<span class="keyword">const</span> <span class="keywordtype">char</span> *name,
<a name="l00379"></a>00379 oid * reg_oid, <span class="keywordtype">size_t</span> reg_oid_len,
<a name="l00380"></a>00380 u_long * it,
<a name="l00381"></a>00381 Netsnmp_Node_Handler * subhandler)
<a name="l00382"></a>00382 {
<a name="l00383"></a>00383 <span class="keywordflow">return</span> netsnmp_register_watched_scalar(
<a name="l00384"></a>00384 netsnmp_create_handler_registration(
<a name="l00385"></a>00385 name, subhandler,
<a name="l00386"></a>00386 reg_oid, reg_oid_len,
<a name="l00387"></a>00387 HANDLER_CAN_RONLY ),
<a name="l00388"></a>00388 netsnmp_create_watcher_info(
<a name="l00389"></a>00389 (<span class="keywordtype">void</span> *)it, <span class="keyword">sizeof</span>( u_long ),
<a name="l00390"></a>00390 ASN_UNSIGNED, WATCHER_FIXED_SIZE ));
<a name="l00391"></a>00391 }
<a name="l00392"></a>00392
<a name="l00393"></a>00393 <span class="keywordtype">int</span>
<a name="l00394"></a>00394 netsnmp_register_long_scalar(<span class="keyword">const</span> <span class="keywordtype">char</span> *name,
<a name="l00395"></a>00395 oid * reg_oid, <span class="keywordtype">size_t</span> reg_oid_len,
<a name="l00396"></a>00396 <span class="keywordtype">long</span> * it,
<a name="l00397"></a>00397 Netsnmp_Node_Handler * subhandler)
<a name="l00398"></a>00398 {
<a name="l00399"></a>00399 <span class="keywordflow">return</span> netsnmp_register_watched_scalar(
<a name="l00400"></a>00400 netsnmp_create_handler_registration(
<a name="l00401"></a>00401 name, subhandler,
<a name="l00402"></a>00402 reg_oid, reg_oid_len,
<a name="l00403"></a>00403 HANDLER_CAN_RWRITE ),
<a name="l00404"></a>00404 netsnmp_create_watcher_info(
<a name="l00405"></a>00405 (<span class="keywordtype">void</span> *)it, <span class="keyword">sizeof</span>( <span class="keywordtype">long</span> ),
<a name="l00406"></a>00406 ASN_INTEGER, WATCHER_FIXED_SIZE ));
<a name="l00407"></a>00407 }
<a name="l00408"></a>00408
<a name="l00409"></a>00409 <span class="keywordtype">int</span>
<a name="l00410"></a>00410 netsnmp_register_read_only_long_scalar(<span class="keyword">const</span> <span class="keywordtype">char</span> *name,
<a name="l00411"></a>00411 oid * reg_oid, <span class="keywordtype">size_t</span> reg_oid_len,
<a name="l00412"></a>00412 <span class="keywordtype">long</span> * it,
<a name="l00413"></a>00413 Netsnmp_Node_Handler * subhandler)
<a name="l00414"></a>00414 {
<a name="l00415"></a>00415 <span class="keywordflow">return</span> netsnmp_register_watched_scalar(
<a name="l00416"></a>00416 netsnmp_create_handler_registration(
<a name="l00417"></a>00417 name, subhandler,
<a name="l00418"></a>00418 reg_oid, reg_oid_len,
<a name="l00419"></a>00419 HANDLER_CAN_RONLY ),
<a name="l00420"></a>00420 netsnmp_create_watcher_info(
<a name="l00421"></a>00421 (<span class="keywordtype">void</span> *)it, <span class="keyword">sizeof</span>( <span class="keywordtype">long</span> ),
<a name="l00422"></a>00422 ASN_INTEGER, WATCHER_FIXED_SIZE ));
<a name="l00423"></a>00423 }
<a name="l00424"></a>00424
<a name="l00425"></a>00425
<a name="l00426"></a>00426 <span class="keywordtype">int</span>
<a name="l00427"></a>00427 netsnmp_register_int_scalar(<span class="keyword">const</span> <span class="keywordtype">char</span> *name,
<a name="l00428"></a>00428 oid * reg_oid, <span class="keywordtype">size_t</span> reg_oid_len,
<a name="l00429"></a>00429 <span class="keywordtype">int</span> * it,
<a name="l00430"></a>00430 Netsnmp_Node_Handler * subhandler)
<a name="l00431"></a>00431 {
<a name="l00432"></a>00432 <span class="keywordflow">return</span> netsnmp_register_watched_scalar(
<a name="l00433"></a>00433 netsnmp_create_handler_registration(
<a name="l00434"></a>00434 name, subhandler,
<a name="l00435"></a>00435 reg_oid, reg_oid_len,
<a name="l00436"></a>00436 HANDLER_CAN_RWRITE ),
<a name="l00437"></a>00437 netsnmp_create_watcher_info(
<a name="l00438"></a>00438 (<span class="keywordtype">void</span> *)it, <span class="keyword">sizeof</span>( <span class="keywordtype">int</span> ),
<a name="l00439"></a>00439 ASN_INTEGER, WATCHER_FIXED_SIZE ));
<a name="l00440"></a>00440 }
<a name="l00441"></a>00441
<a name="l00442"></a>00442 <span class="keywordtype">int</span>
<a name="l00443"></a>00443 netsnmp_register_read_only_int_scalar(<span class="keyword">const</span> <span class="keywordtype">char</span> *name,
<a name="l00444"></a>00444 oid * reg_oid, <span class="keywordtype">size_t</span> reg_oid_len,
<a name="l00445"></a>00445 <span class="keywordtype">int</span> * it,
<a name="l00446"></a>00446 Netsnmp_Node_Handler * subhandler)
<a name="l00447"></a>00447 {
<a name="l00448"></a>00448 <span class="keywordflow">return</span> netsnmp_register_watched_scalar(
<a name="l00449"></a>00449 netsnmp_create_handler_registration(
<a name="l00450"></a>00450 name, subhandler,
<a name="l00451"></a>00451 reg_oid, reg_oid_len,
<a name="l00452"></a>00452 HANDLER_CAN_RONLY ),
<a name="l00453"></a>00453 netsnmp_create_watcher_info(
<a name="l00454"></a>00454 (<span class="keywordtype">void</span> *)it, <span class="keyword">sizeof</span>( <span class="keywordtype">int</span> ),
<a name="l00455"></a>00455 ASN_INTEGER, WATCHER_FIXED_SIZE ));
<a name="l00456"></a>00456 }
<a name="l00457"></a>00457
<a name="l00458"></a>00458
<a name="l00459"></a>00459 <span class="keywordtype">int</span>
<a name="l00460"></a>00460 netsnmp_register_read_only_counter32_scalar(<span class="keyword">const</span> <span class="keywordtype">char</span> *name,
<a name="l00461"></a>00461 oid * reg_oid, <span class="keywordtype">size_t</span> reg_oid_len,
<a name="l00462"></a>00462 u_long * it,
<a name="l00463"></a>00463 Netsnmp_Node_Handler * subhandler)
<a name="l00464"></a>00464 {
<a name="l00465"></a>00465 <span class="keywordflow">return</span> netsnmp_register_watched_scalar(
<a name="l00466"></a>00466 netsnmp_create_handler_registration(
<a name="l00467"></a>00467 name, subhandler,
<a name="l00468"></a>00468 reg_oid, reg_oid_len,
<a name="l00469"></a>00469 HANDLER_CAN_RONLY ),
<a name="l00470"></a>00470 netsnmp_create_watcher_info(
<a name="l00471"></a>00471 (<span class="keywordtype">void</span> *)it, <span class="keyword">sizeof</span>( u_long ),
<a name="l00472"></a>00472 ASN_COUNTER, WATCHER_FIXED_SIZE ));
<a name="l00473"></a>00473 }
</pre></div></div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
</body>
</html>