Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 87b89b73c41f4440bb86afd421c7548f > files > 125

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: Queueing Classes</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><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="summary">
<a href="#groups">Modules</a>  </div>
  <div class="headertitle">
<h1>Queueing Classes</h1>  </div>
<div class="ingroups"><a class="el" href="group__tc.html">Traffic Control</a></div></div>
<div class="contents">
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="groups"></a>
Modules</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__class__api.html">Class Modules</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__class__obj.html">Class Object</a></td></tr>
<tr><td colspan="2"><h2><a name="member-group"></a>
Addition/Modification</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct nl_msg *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__class.html#gaee9fa72dc9c7b63c65f0c05126a71a2e">rtnl_class_build_add_request</a> (struct rtnl_class *class, int flags)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Build a netlink message to add a new class.  <a href="#gaee9fa72dc9c7b63c65f0c05126a71a2e"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__class.html#ga914ad78482317e0ca71f8d2c3194405e">rtnl_class_add</a> (struct nl_handle *handle, struct rtnl_class *class, int flags)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a new class.  <a href="#ga914ad78482317e0ca71f8d2c3194405e"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="member-group"></a>
Cache Management</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct nl_cache *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__class.html#ga790189e50d3eb1799bdbcd79bbbf8b85">rtnl_class_alloc_cache</a> (struct nl_handle *handle, int ifindex)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Build a class cache including all classes attached to the specified interface.  <a href="#ga790189e50d3eb1799bdbcd79bbbf8b85"></a><br/></td></tr>
</table>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="gaee9fa72dc9c7b63c65f0c05126a71a2e"></a><!-- doxytag: member="class.c::rtnl_class_build_add_request" ref="gaee9fa72dc9c7b63c65f0c05126a71a2e" args="(struct rtnl_class *class, int flags)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct nl_msg* rtnl_class_build_add_request </td>
          <td>(</td>
          <td class="paramtype">struct rtnl_class *&#160;</td>
          <td class="paramname"><em>class</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>flags</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [read]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">class</td><td>class to add </td></tr>
    <tr><td class="paramname">flags</td><td>additional netlink message flags</td></tr>
  </table>
  </dd>
</dl>
<p>Builds a new netlink message requesting an addition of a class. The netlink message header isn't fully equipped with all relevant fields and must be sent out via <a class="el" href="group__nl.html#ga01a2aad82350f867e704d5c696438b60" title="Send netlink message and check &amp; extend header values as needed.">nl_send_auto_complete()</a> or supplemented as needed.</p>
<p>Common message flags</p>
<ul>
<li>NLM_F_REPLACE - replace possibly existing classes</li>
</ul>
<dl class="return"><dt><b>Returns:</b></dt><dd>New netlink message </dd></dl>

<p>Definition at line <a class="el" href="class_8c_source.html#l00128">128</a> of file <a class="el" href="class_8c_source.html">class.c</a>.</p>

<p>References <a class="el" href="netlink-kernel_8h_source.html#l00134">NLM_F_CREATE</a>.</p>

<p>Referenced by <a class="el" href="class_8c_source.html#l00148">rtnl_class_add()</a>.</p>
<div class="fragment"><pre class="fragment">{
        <span class="keywordflow">return</span> class_build(<span class="keyword">class</span>, RTM_NEWTCLASS, <a class="code" href="group__msg.html#ga20a00ae52e4c150f54649d7346d23a7a" title="Create config object if it doesn&amp;#39;t already exist.">NLM_F_CREATE</a> | flags);
}
</pre></div>
</div>
</div>
<a class="anchor" id="ga914ad78482317e0ca71f8d2c3194405e"></a><!-- doxytag: member="class.c::rtnl_class_add" ref="ga914ad78482317e0ca71f8d2c3194405e" args="(struct nl_handle *handle, struct rtnl_class *class, int flags)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int rtnl_class_add </td>
          <td>(</td>
          <td class="paramtype">struct nl_handle *&#160;</td>
          <td class="paramname"><em>handle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct rtnl_class *&#160;</td>
          <td class="paramname"><em>class</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>flags</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">handle</td><td>netlink handle </td></tr>
    <tr><td class="paramname">class</td><td>class to delete </td></tr>
    <tr><td class="paramname">flags</td><td>additional netlink message flags</td></tr>
  </table>
  </dd>
</dl>
<p>Builds a netlink message by calling <a class="el" href="group__qdisc.html#ga863dae227b2c7cb28475f10b2934e114" title="Build a netlink message to add a new qdisc.">rtnl_qdisc_build_add_request()</a>, sends the request to the kernel and waits for the next ACK to be received and thus blocks until the request has been processed.</p>
<p>Common message flags</p>
<ul>
<li>NLM_F_REPLACE - replace possibly existing classes</li>
</ul>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on success or a negative error code </dd></dl>

<p>Definition at line <a class="el" href="class_8c_source.html#l00148">148</a> of file <a class="el" href="class_8c_source.html">class.c</a>.</p>

<p>References <a class="el" href="nl_8c_source.html#l00373">nl_send_auto_complete()</a>, <a class="el" href="nl_8c_source.html#l00800">nl_wait_for_ack()</a>, <a class="el" href="msg_8c_source.html#l00656">nlmsg_free()</a>, and <a class="el" href="class_8c_source.html#l00128">rtnl_class_build_add_request()</a>.</p>
<div class="fragment"><pre class="fragment">{
        <span class="keyword">struct </span>nl_msg *msg;
        <span class="keywordtype">int</span> err;

        msg = <a class="code" href="group__class.html#gaee9fa72dc9c7b63c65f0c05126a71a2e" title="Build a netlink message to add a new class.">rtnl_class_build_add_request</a>(<span class="keyword">class</span>, flags);
        <span class="keywordflow">if</span> (!msg)
                <span class="keywordflow">return</span> nl_errno(ENOMEM);

        err = <a class="code" href="group__nl.html#ga01a2aad82350f867e704d5c696438b60" title="Send netlink message and check &amp;amp; extend header values as needed.">nl_send_auto_complete</a>(handle, msg);
        <span class="keywordflow">if</span> (err &lt; 0)
                <span class="keywordflow">return</span> err;

        <a class="code" href="group__msg.html#ga138ba9bee70553f9fbe7143deacad48c" title="Free a netlink message.">nlmsg_free</a>(msg);
        <span class="keywordflow">return</span> <a class="code" href="group__nl.html#gaa65fec588e0a0a2de1881fb8366ccd79" title="Wait for ACK.">nl_wait_for_ack</a>(handle);
}
</pre></div>
</div>
</div>
<a class="anchor" id="ga790189e50d3eb1799bdbcd79bbbf8b85"></a><!-- doxytag: member="class.c::rtnl_class_alloc_cache" ref="ga790189e50d3eb1799bdbcd79bbbf8b85" args="(struct nl_handle *handle, int ifindex)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct nl_cache* rtnl_class_alloc_cache </td>
          <td>(</td>
          <td class="paramtype">struct nl_handle *&#160;</td>
          <td class="paramname"><em>handle</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>ifindex</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [read]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">handle</td><td>netlink handle </td></tr>
    <tr><td class="paramname">ifindex</td><td>interface index of the link the classes are attached to.</td></tr>
  </table>
  </dd>
</dl>
<p>Allocates a new cache, initializes it properly and updates it to include all classes attached to the specified interface.</p>
<dl class="return"><dt><b>Returns:</b></dt><dd>The cache or NULL if an error has occured. </dd></dl>

<p>Definition at line <a class="el" href="class_8c_source.html#l00184">184</a> of file <a class="el" href="class_8c_source.html">class.c</a>.</p>

<p>References <a class="el" href="cache_8c_source.html#l00173">nl_cache_alloc()</a>, <a class="el" href="cache_8c_source.html#l00265">nl_cache_free()</a>, and <a class="el" href="cache_8c_source.html#l00662">nl_cache_refill()</a>.</p>
<div class="fragment"><pre class="fragment">{
        <span class="keyword">struct </span>nl_cache * cache;
        
        cache = <a class="code" href="group__cache.html#ga9520ae0f2158db3c081f34c851d92252" title="Allocate an empty cache.">nl_cache_alloc</a>(&amp;<a class="code" href="structrtnl__class__ops.html" title="Class operations.">rtnl_class_ops</a>);
        <span class="keywordflow">if</span> (!cache)
                <span class="keywordflow">return</span> NULL;

        cache-&gt;c_iarg1 = ifindex;
        
        <span class="keywordflow">if</span> (handle &amp;&amp; <a class="code" href="group__cache.html#gaf5bd584017847e6ef69ec36739a6aaf0" title="(Re)fill a cache with the contents in the kernel.">nl_cache_refill</a>(handle, cache) &lt; 0) {
                <a class="code" href="group__cache.html#ga530c896db26d72001d011114b1e6cfaa" title="Free a cache.">nl_cache_free</a>(cache);
                <span class="keywordflow">return</span> NULL;
        }

        <span class="keywordflow">return</span> cache;
}
</pre></div>
</div>
</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>