Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 87b89b73c41f4440bb86afd421c7548f > files > 178

libnl-devel-1.1-14.fc14.x86_64.rpm

<!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"/>
<title>libnl: Main Page</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.3 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">libnl&#160;<span id="projectnumber">1.1</span></div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li class="current"><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<h1>libnl Documentation</h1>  </div>
</div>
<div class="contents">
<div class="textblock"><h2><a class="anchor" id="remarks"></a>
Remarks</h2>
<h3><a class="anchor" id="cache_alloc"></a>
Allocation of Caches</h3>
<p>Almost all subsystem provide a function to allocate a new cache of some form. The function usually looks like this: </p>
<div class="fragment"><pre class="fragment"> <span class="keyword">struct </span>nl_cache *&lt;<span class="keywordtype">object</span> name&gt;_alloc_cache(<span class="keyword">struct</span> nl_handle *handle)
</pre></div><p>These functions allocate a new cache for the own object type, initializes it properly and updates it to represent the current state of their master, e.g. a link cache would include all links currently configured in the kernel.</p>
<p>Some of the allocation functions may take additional arguments to further specify what will be part of the cache.</p>
<p>All such functions return a newly allocated cache or NULL in case of an error.</p>
<h3><a class="anchor" id="addr"></a>
Setting of Addresses</h3>
<div class="fragment"><pre class="fragment"> int &lt;object name&gt;_set_addr(<span class="keyword">struct</span> nl_object *, <span class="keyword">struct</span> nl_addr *)
</pre></div><p>All attribute functions avaiable for assigning addresses to objects take a struct nl_addr argument. The provided address object is validated against the address family of the object if known already. The assignment fails if the address families mismatch. In case the address family has not been specified yet, the address family of the new address is elected to be the new requirement.</p>
<p>The function will acquire a new reference on the address object before assignment, the caller is NOT responsible for this.</p>
<p>All functions return 0 on success or a negative error code.</p>
<h3><a class="anchor" id="flags"></a>
Flags to Character StringTranslations</h3>
<p>All functions converting a set of flags to a character string follow the same principles, therefore, the following information applies to all functions convertings flags to a character string and vice versa.</p>
<h4><a class="anchor" id="flags2str"></a>
Flags to Character String</h4>
<div class="fragment"><pre class="fragment"> <span class="keywordtype">char</span> *&lt;<span class="keywordtype">object</span> name&gt;_flags2str(<span class="keywordtype">int</span> flags, <span class="keywordtype">char</span> *buf, <span class="keywordtype">size_t</span> len)
</pre></div> <dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">flags</td><td>Flags. </td></tr>
    <tr><td class="paramname">buf</td><td>Destination buffer. </td></tr>
    <tr><td class="paramname">len</td><td>Buffer length.</td></tr>
  </table>
  </dd>
</dl>
<p>Converts the specified flags to a character string separated by commas and stores it in the specified destination buffer.</p>
<dl class="return"><dt><b>Returns:</b></dt><dd>The destination buffer</dd></dl>
<h4><a class="anchor" id="str2flags"></a>
Character String to Flags</h4>
<div class="fragment"><pre class="fragment"> int &lt;object name&gt;_str2flags(<span class="keyword">const</span> <span class="keywordtype">char</span> *name)
</pre></div> <dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">name</td><td>Name of flag.</td></tr>
  </table>
  </dd>
</dl>
<p>Converts the provided character string specifying a flag to the corresponding numeric value.</p>
<dl class="return"><dt><b>Returns:</b></dt><dd>Link flag or a negative value if none was found.</dd></dl>
<h4><a class="anchor" id="type2str"></a>
Type to Character String</h4>
<div class="fragment"><pre class="fragment"> <span class="keywordtype">char</span> *&lt;<span class="keywordtype">object</span> name&gt;_&lt;type&gt;2str(<span class="keywordtype">int</span> type, <span class="keywordtype">char</span> *buf, <span class="keywordtype">size_t</span> len)
</pre></div> <dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">type</td><td>Type as numeric value </td></tr>
    <tr><td class="paramname">buf</td><td>Destination buffer. </td></tr>
    <tr><td class="paramname">len</td><td>Buffer length.</td></tr>
  </table>
  </dd>
</dl>
<p>Converts an identifier (type) to a character string and stores it in the specified destination buffer.</p>
<dl class="return"><dt><b>Returns:</b></dt><dd>The destination buffer or the type encoded in hexidecimal form if the identifier is unknown.</dd></dl>
<h4><a class="anchor" id="str2type"></a>
Character String to Type</h4>
<div class="fragment"><pre class="fragment"> int &lt;object name&gt;_str2&lt;type&gt;(<span class="keyword">const</span> <span class="keywordtype">char</span> *name)
</pre></div> <dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">name</td><td>Name of identifier (type).</td></tr>
  </table>
  </dd>
</dl>
<p>Converts the provided character string specifying a identifier to the corresponding numeric value.</p>
<dl class="return"><dt><b>Returns:</b></dt><dd>Identifier as numeric value or a negative value if none was found. </dd></dl>
</div></div>
<hr class="footer"/><address class="footer"><small>Generated on Mon Mar 21 2011 for libnl by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address>
</body>
</html>