Sophie

Sophie

distrib > Fedora > 14 > i386 > media > os > by-pkgid > e04c30fdccbd194f92dd8f835139c4e8 > files > 33

openhpi-subagent-2.3.4-13.fc14.i686.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Getting values</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="NetSNMP subagent development manual"
HREF="book1.html"><LINK
REL="UP"
TITLE="C code"
HREF="c299.html"><LINK
REL="PREVIOUS"
TITLE="Creating and Writing (SNMP SET or user) to rows (and columns)"
HREF="x406.html"><LINK
REL="NEXT"
TITLE="Appendix"
HREF="c641.html"><link rel="stylesheet" href="/openhpi.css" type="text/css">
</head
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><div id="banner"><div><h1>The OpenHPI Project</h1><small>Open Hardware Platform Interface</small></div></div><table><tr>
<!--#include virtual="/sidebar.html" -->
<td id="maincolumn"><div class="mainsegment">
<DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>NetSNMP subagent development manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x406.html"
ACCESSKEY="P"
>&#60;&#60;&#60; Previous</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>C code</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="c641.html"
ACCESSKEY="N"
>Next &#62;&#62;&#62;</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="GETTING_VALUES"
>Getting values</A
></H1
><P
>	The mechanism by which the NetSNMP library retrieves the correct
	row is by calling the function defined in the callback mechanism.
	Please refer to <A
HREF="c299.html#REGISTER_GET_OPERATION"
>the Section called <I
>Register the GET operation</I
></A
> for more details.
	</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>   cb.get_value = netSnmpIETFWGTable_get_value;</PRE
></TD
></TR
></TABLE
><P
>	The <I
CLASS="EMPHASIS"
>netSnmpIETFWGTable_get_value</I
> is similar to
	the ACTION, RESERVE1, and RESERVE2 routines by the mechanism of 
	looping through the 
	requests for columns and performing some operation on the correct column.
	In this case, instead of checking the value, or writing, it 
	is setting a pointer to the appropiate data and the data's length (in bytes).
	</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>  switch(table_info-&#62;colnum) {

        case COLUMN_NSIETFWGNAME:
            /** OCTETSTR = ASN_OCTET_STR */
            snmp_set_var_typed_value(var, ASN_OCTET_STR,
                         (char*)&#38; context-&#62;nsIETFWGName,
                         context-&#62;nsIETFWGName_len );
        break;
	...</PRE
></TD
></TR
></TABLE
><DIV
CLASS="NOTE"
><P
></P
><TABLE
CLASS="NOTE"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="./stylesheet-images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>	If one of your columnar nodes is of type <I
CLASS="EMPHASIS"
>write-only</I
>. 
	Then just return NULL for that specified column.	
	</P
></TD
></TR
></TABLE
></DIV
><P
>	The <I
CLASS="EMPHASIS"
>snmp_set_var_typed_value</I
> function sets the
	correct type of the data, a pointer to the location of the data,
	and the length of the data in bytes. There is no need for host to network
	byte swapping - the NetSNMP library performs these functions internally if needed.
	</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x406.html"
ACCESSKEY="P"
>&#60;&#60;&#60; Previous</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="book1.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="c641.html"
ACCESSKEY="N"
>Next &#62;&#62;&#62;</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Creating and Writing (SNMP SET or user) to rows (and columns)</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="c299.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Appendix</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>