<!DOCTYPE html>
<html lang='en'>
<head>
<title>ipsec.h « ipsec « vnet « src - vpp - Vector Packet Processing</title>
<meta name='generator' content='cgit '/>
<meta name='robots' content='noindex, nofollow'/>
<link rel='stylesheet' type='text/css' href='/cgit-data/cgit.css'/>
<link rel='shortcut icon' href='/favicon.ico'/>
<link rel='alternate' title='Atom feed' href='http://git.fd.io/vpp/atom/src/vnet/ipsec/ipsec.h?h=v1.0.0' type='application/atom+xml'/>
<link rel='vcs-git' href='https://git.fd.io/vpp' title='vpp Git repository'/>
</head>
<body>
<div id="lfcollabprojects-header">
  <div class="gray-diagonal">
    <div class="header-inner">
      <a
        id="lfcollabprojects-logo"
        href="http://collabprojects.linuxfoundation.org"
        >Linux Foundation Collaborative Projects</a
      >
    </div>
  </div>
</div>
<div id='cgit'><table id='header'>
<tr>
<td class='logo' rowspan='2'><a href='/'><img src='/cgit-data/cgit.png' alt='cgit logo'/></a></td>
<td class='main'><a href='/'>index</a> : <a title='vpp' href='/vpp/'>vpp</a></td><td class='form'><form method='get'>
<input type='hidden' name='id' value='097fa66b986f06281f603767d321ab13ab6c88c3'/><select name='h' onchange='this.form.submit();'>
<option value='master'>master</option>
<option value='stable/1606'>stable/1606</option>
<option value='stable/1609'>stable/1609</option>
<option value='stable/1701'>stable/1701</option>
<option value='stable/1704'>stable/1704</option>
<option value='stable/1707'>stable/1707</option>
<option value='stable/1710'>stable/1710</option>
<option value='stable/1801'>stable/1801</option>
<option value='stable/1804'>stable/1804</option>
<option value='stable/1807'>stable/1807</option>
<option value='stable/1810'>stable/1810</option>
<option value='stable/1901'>stable/1901</option>
<option value='stable/1904'>stable/1904</option>
<option value='stable/1908'>stable/1908</option>
<option value='stable/2001'>stable/2001</option>
<option value='stable/2005'>stable/2005</option>
<option value='stable/2009'>stable/2009</option>
<option value='stable/2101'>stable/2101</option>
<option value='stable/2106'>stable/2106</option>
<option value='stable/2110'>stable/2110</option>
<option value='stable/2202'>stable/2202</option>
<option value='stable/2206'>stable/2206</option>
<option value='stable/2210'>stable/2210</option>
<option value='stable/2302'>stable/2302</option>
<option value='stable/2306'>stable/2306</option>
<option value='stable/2310'>stable/2310</option>
<option value='stable/2402'>stable/2402</option>
<option value='stable/2406'>stable/2406</option>
<option value='stable/2410'>stable/2410</option>
<option value='stable/2502'>stable/2502</option>
<option value='stable/test'>stable/test</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>Vector Packet Processing</td><td class='sub right'>Grokmirror user</td></tr></table>
<table class='tabs'><tr><td>
<a href='/vpp/about/?h=v1.0.0'>about</a><a href='/vpp/?h=v1.0.0'>summary</a><a href='/vpp/refs/?h=v1.0.0&amp;id=097fa66b986f06281f603767d321ab13ab6c88c3'>refs</a><a href='/vpp/log/src/vnet/ipsec/ipsec.h?h=v1.0.0'>log</a><a class='active' href='/vpp/tree/src/vnet/ipsec/ipsec.h?h=v1.0.0&amp;id=097fa66b986f06281f603767d321ab13ab6c88c3'>tree</a><a href='/vpp/commit/src/vnet/ipsec/ipsec.h?h=v1.0.0&amp;id=097fa66b986f06281f603767d321ab13ab6c88c3'>commit</a><a href='/vpp/diff/src/vnet/ipsec/ipsec.h?h=v1.0.0&amp;id=097fa66b986f06281f603767d321ab13ab6c88c3'>diff</a><a href='/vpp/stats/src/vnet/ipsec/ipsec.h?h=v1.0.0'>stats</a></td><td class='form'><form class='right' method='get' action='/vpp/log/src/vnet/ipsec/ipsec.h'>
<input type='hidden' name='h' value='v1.0.0'/><input type='hidden' name='id' value='097fa66b986f06281f603767d321ab13ab6c88c3'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/vpp/tree/?h=v1.0.0&amp;id=097fa66b986f06281f603767d321ab13ab6c88c3'>root</a>/<a href='/vpp/tree/src?h=v1.0.0&amp;id=097fa66b986f06281f603767d321ab13ab6c88c3'>src</a>/<a href='/vpp/tree/src/vnet?h=v1.0.0&amp;id=097fa66b986f06281f603767d321ab13ab6c88c3'>vnet</a>/<a href='/vpp/tree/src/vnet/ipsec?h=v1.0.0&amp;id=097fa66b986f06281f603767d321ab13ab6c88c3'>ipsec</a>/<a href='/vpp/tree/src/vnet/ipsec/ipsec.h?h=v1.0.0&amp;id=097fa66b986f06281f603767d321ab13ab6c88c3'>ipsec.h</a></div><div class='content'>blob: 45576b3c779a83b8c988b2b09405ac6e1305cf82 (<a href='/vpp/plain/src/vnet/ipsec/ipsec.h?h=v1.0.0&amp;id=097fa66b986f06281f603767d321ab13ab6c88c3'>plain</a>)
<table summary='blob content' class='blob'>
<tr><td class='linenumbers'><pre><a id='n1' href='#n1'>1</a>
<a id='n2' href='#n2'>2</a>
<a id='n3' href='#n3'>3</a>
<a id='n4' href='#n4'>4</a>
<a id='n5' href='#n5'>5</a>
<a id='n6' href='#n6'>6</a>
<a id='n7' href='#n7'>7</a>
<a id='n8' href='#n8'>8</a>
<a id='n9' href='#n9'>9</a>
<a id='n10' href='#n10'>10</a>
<a id='n11' href='#n11'>11</a>
<a id='n12' href='#n12'>12</a>
<a id='n13' href='#n13'>13</a>
<a id='n14' href='#n14'>14</a>
<a id='n15' href='#n15'>15</a>
<a id='n16' href='#n16'>16</a>
<a id='n17' href='#n17'>17</a>
<a id='n18' href='#n18'>18</a>
<a id='n19' href='#n19'>19</a>
<a id='n20' href='#n20'>20</a>
<a id='n21' href='#n21'>21</a>
<a id='n22' href='#n22'>22</a>
<style>.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */</style><div class="highlight"><pre><span></span><span class="cm">/*</span>
<span class="cm"> * Copyright (c) 2015 Cisco and/or its affiliates.</span>
<span class="cm"> * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span>
<span class="cm"> * you may not use this file except in compliance with the License.</span>
<span class="cm"> * You may obtain a copy of the License at:</span>
<span class="cm"> *</span>
<span class="cm"> *     http://www.apache.org/licenses/LICENSE-2.0</span>
<span class="cm"> *</span>
<span class="cm"> * Unless required by applicable law or agreed to in writing, software</span>
<span class="cm"> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span>
<span class="cm"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<span class="cm"> * See the License for the specific language governing permissions and</span>
<span class="cm"> * limitations under the License.</span>
<span class="cm"> */</span>
<span class="n">sr_error</span> <span class="p">(</span><span class="kr">NONE</span><span class="p">,</span> <span class="s">&quot;no error&quot;</span><span class="p">)</span>
<span class="n">sr_error</span> <span class="p">(</span><span class="n">BAD_ROUTING_HEADER_TYPE</span><span class="p">,</span> <span class="s">&quot;bad routing header type (not 4)&quot;</span><span class="p">)</span>
<span class="n">sr_error</span> <span class="p">(</span><span class="n">NO_MORE_SEGMENTS</span><span class="p">,</span> <span class="s">&quot;out of SR segment drops&quot;</span><span class="p">)</span>
<span class="n">sr_error</span> <span class="p">(</span><span class="n">PKTS_PROCESSED</span><span class="p">,</span> <span class="s">&quot;SR packets processed&quot;</span><span class="p">)</span>
<span class="n">sr_error</span> <span class="p">(</span><span class="n">APP_CALLBACK</span><span class="p">,</span> <span class="s">&quot;SR application callback errors&quot;</span><span class="p">)</span>
<span class="n">sr_error</span> <span class="p">(</span><span class="n">HMAC_INVALID</span><span class="p">,</span> <span class="s">&quot;SR packets with invalid HMAC signatures&quot;</span><span class="p">)</span>
</pre></div>
</code></pre></td></tr></table>
</div> <!-- class=content -->
<div id="lfcollabprojects-footer">
  <div class="gray-diagonal">
    <div class="footer-inner">
      <p>
        &copy; 2016 <a href="https://www.fd.io/">FD.io</a> a Linux Foundation
        Collaborative Project. All Rights Reserved.
      </p>
      <p>
        Linux Foundation is a registered trademark of The Linux Foundation.
        Linux is a registered
        <a
          href="http://www.linuxfoundation.org/programs/legal/trademark"
          title="Linux Mark Institute"
          >trademark</a
        >
        of Linus Torvalds.
      </p>
      <p>
        Please see our
        <a href="http://www.linuxfoundation.org/privacy">privacy policy</a> and
        <a href="http://www.linuxfoundation.org/terms">terms of use</a>
      </p>
    </div>
  </div>
</div>
</div> <!-- id=cgit -->
</body>
</html>
e */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */</style><div class="highlight"><pre><span></span><span class="cm">/*</span>
<span class="cm"> * Copyright (c) 2015 Cisco and/or its affiliates.</span>
<span class="cm"> * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span>
<span class="cm"> * you may not use this file except in compliance with the License.</span>
<span class="cm"> * You may obtain a copy of the License at:</span>
<span class="cm"> *</span>
<span class="cm"> *     http://www.apache.org/licenses/LICENSE-2.0</span>
<span class="cm"> *</span>
<span class="cm"> * Unless required by applicable law or agreed to in writing, software</span>
<span class="cm"> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span>
<span class="cm"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<span class="cm"> * See the License for the specific language governing permissions and</span>
<span class="cm"> * limitations under the License.</span>
<span class="cm"> */</span>
<span class="cp">#ifndef __IPSEC_H__</span>
<span class="cp">#define __IPSEC_H__</span>

<span class="cp">#include</span> <span class="cpf">&lt;vnet/ip/ip.h&gt;</span><span class="cp"></span>
<span class="cp">#include</span> <span class="cpf">&lt;vnet/crypto/crypto.h&gt;</span><span class="cp"></span>
<span class="cp">#include</span> <span class="cpf">&lt;vnet/feature/feature.h&gt;</span><span class="cp"></span>

<span class="cp">#include</span> <span class="cpf">&lt;vppinfra/types.h&gt;</span><span class="cp"></span>
<span class="cp">#include</span> <span class="cpf">&lt;vppinfra/cache.h&gt;</span><span class="cp"></span>

<span class="cp">#include</span> <span class="cpf">&lt;vnet/ipsec/ipsec_spd.h&gt;</span><span class="cp"></span>
<span class="cp">#include</span> <span class="cpf">&lt;vnet/ipsec/ipsec_spd_policy.h&gt;</span><span class="cp"></span>
<span class="cp">#include</span> <span class="cpf">&lt;vnet/ipsec/ipsec_sa.h&gt;</span><span class="cp"></span>
<span class="cp">#include</span> <span class="cpf">&lt;vnet/ipsec/ipsec_if.h&gt;</span><span class="cp"></span>

<span class="k">typedef</span> <span class="n">clib_error_t</span> <span class="o">*</span><span class="p">(</span><span class="o">*</span><span class="n">add_del_sa_sess_cb_t</span><span class="p">)</span> <span class="p">(</span><span class="n">u32</span> <span class="n">sa_index</span><span class="p">,</span> <span class="n">u8</span> <span class="n">is_add</span><span class="p">);</span>
<span class="k">typedef</span> <span class="n">clib_error_t</span> <span class="o">*</span><span class="p">(</span><span class="o">*</span><span class="n">check_support_cb_t</span><span class="p">)</span> <span class="p">(</span><span class="n">ipsec_sa_t</span> <span class="o">*</span> <span class="n">sa</span><span class="p">);</span>

<span class="k">typedef</span> <span class="k">struct</span>
<span class="p">{</span>
  <span class="n">u8</span> <span class="o">*</span><span class="n">name</span><span class="p">;</span>
  <span class="cm">/* add/del callback */</span>
  <span class="n">add_del_sa_sess_cb_t</span> <span class="n">add_del_sa_sess_cb</span><span class="p">;</span>
  <span class="cm">/* check support function */</span>
  <span class="n">check_support_cb_t</span> <span class="n">check_support_cb</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">ah4_encrypt_node_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">ah4_decrypt_node_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">ah4_encrypt_next_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">ah4_decrypt_next_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">ah6_encrypt_node_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">ah6_decrypt_node_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">ah6_encrypt_next_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">ah6_decrypt_next_index</span><span class="p">;</span>
<span class="p">}</span> <span class="n">ipsec_ah_backend_t</span><span class="p">;</span>

<span class="k">typedef</span> <span class="k">struct</span>
<span class="p">{</span>
  <span class="n">u8</span> <span class="o">*</span><span class="n">name</span><span class="p">;</span>
  <span class="cm">/* add/del callback */</span>
  <span class="n">add_del_sa_sess_cb_t</span> <span class="n">add_del_sa_sess_cb</span><span class="p">;</span>
  <span class="cm">/* check support function */</span>
  <span class="n">check_support_cb_t</span> <span class="n">check_support_cb</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">esp4_encrypt_node_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">esp4_decrypt_node_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">esp4_encrypt_next_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">esp4_decrypt_next_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">esp6_encrypt_node_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">esp6_decrypt_node_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">esp6_encrypt_next_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">esp6_decrypt_next_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">esp4_encrypt_tun_feature_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">esp6_encrypt_tun_feature_index</span><span class="p">;</span>
<span class="p">}</span> <span class="n">ipsec_esp_backend_t</span><span class="p">;</span>

<span class="k">typedef</span> <span class="k">struct</span>
<span class="p">{</span>
  <span class="n">vnet_crypto_op_id_t</span> <span class="n">enc_op_id</span><span class="p">;</span>
  <span class="n">vnet_crypto_op_id_t</span> <span class="n">dec_op_id</span><span class="p">;</span>
  <span class="n">vnet_crypto_alg_t</span> <span class="n">alg</span><span class="p">;</span>
  <span class="n">u8</span> <span class="n">iv_size</span><span class="p">;</span>
  <span class="n">u8</span> <span class="n">block_size</span><span class="p">;</span>
  <span class="n">u8</span> <span class="n">icv_size</span><span class="p">;</span>
<span class="p">}</span> <span class="n">ipsec_main_crypto_alg_t</span><span class="p">;</span>

<span class="k">typedef</span> <span class="k">struct</span>
<span class="p">{</span>
  <span class="n">vnet_crypto_op_id_t</span> <span class="n">op_id</span><span class="p">;</span>
  <span class="n">vnet_crypto_alg_t</span> <span class="n">alg</span><span class="p">;</span>
  <span class="n">u8</span> <span class="n">icv_size</span><span class="p">;</span>
<span class="p">}</span> <span class="n">ipsec_main_integ_alg_t</span><span class="p">;</span>

<span class="k">typedef</span> <span class="k">struct</span>
<span class="p">{</span>
  <span class="n">vnet_crypto_op_t</span> <span class="o">*</span><span class="n">crypto_ops</span><span class="p">;</span>
  <span class="n">vnet_crypto_op_t</span> <span class="o">*</span><span class="n">integ_ops</span><span class="p">;</span>
<span class="p">}</span> <span class="n">ipsec_per_thread_data_t</span><span class="p">;</span>

<span class="k">typedef</span> <span class="k">struct</span>
<span class="p">{</span>
  <span class="cm">/* pool of tunnel instances */</span>
  <span class="n">ipsec_spd_t</span> <span class="o">*</span><span class="n">spds</span><span class="p">;</span>
  <span class="cm">/* Pool of security associations */</span>
  <span class="n">ipsec_sa_t</span> <span class="o">*</span><span class="n">sad</span><span class="p">;</span>
  <span class="cm">/* pool of policies */</span>
  <span class="n">ipsec_policy_t</span> <span class="o">*</span><span class="n">policies</span><span class="p">;</span>

  <span class="cm">/* pool of tunnel interfaces */</span>
  <span class="n">ipsec_tunnel_if_t</span> <span class="o">*</span><span class="n">tunnel_interfaces</span><span class="p">;</span>

  <span class="n">uword</span> <span class="o">*</span><span class="n">tunnel_index_by_key</span><span class="p">;</span>

  <span class="cm">/* convenience */</span>
  <span class="n">vlib_main_t</span> <span class="o">*</span><span class="n">vlib_main</span><span class="p">;</span>
  <span class="n">vnet_main_t</span> <span class="o">*</span><span class="n">vnet_main</span><span class="p">;</span>

  <span class="cm">/* hashes */</span>
  <span class="n">uword</span> <span class="o">*</span><span class="n">spd_index_by_spd_id</span><span class="p">;</span>
  <span class="n">uword</span> <span class="o">*</span><span class="n">spd_index_by_sw_if_index</span><span class="p">;</span>
  <span class="n">uword</span> <span class="o">*</span><span class="n">sa_index_by_sa_id</span><span class="p">;</span>
  <span class="n">uword</span> <span class="o">*</span><span class="n">ipsec4_if_pool_index_by_key</span><span class="p">;</span>
  <span class="n">uword</span> <span class="o">*</span><span class="n">ipsec6_if_pool_index_by_key</span><span class="p">;</span>
  <span class="n">uword</span> <span class="o">*</span><span class="n">ipsec_if_real_dev_by_show_dev</span><span class="p">;</span>
  <span class="n">uword</span> <span class="o">*</span><span class="n">ipsec_if_by_sw_if_index</span><span class="p">;</span>

  <span class="cm">/* node indices */</span>
  <span class="n">u32</span> <span class="n">error_drop_node_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">esp4_encrypt_node_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">esp4_decrypt_node_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">ah4_encrypt_node_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">ah4_decrypt_node_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">esp6_encrypt_node_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">esp6_decrypt_node_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">ah6_encrypt_node_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">ah6_decrypt_node_index</span><span class="p">;</span>
  <span class="cm">/* next node indices */</span>
  <span class="n">u32</span> <span class="n">esp4_encrypt_next_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">esp4_decrypt_next_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">ah4_encrypt_next_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">ah4_decrypt_next_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">esp6_encrypt_next_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">esp6_decrypt_next_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">ah6_encrypt_next_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">ah6_decrypt_next_index</span><span class="p">;</span>

  <span class="cm">/* tun encrypt arcs and feature nodes */</span>
  <span class="n">u32</span> <span class="n">esp4_encrypt_tun_feature_index</span><span class="p">;</span>
  <span class="n">u32</span> <span class="n">esp6_encrypt_tun_feature_index</span><span class="p">;</span>

  <span class="cm">/* pool of ah backends */</span>
  <span class="n">ipsec_ah_backend_t</span> <span class="o">*</span><span class="n">ah_backends</span><span class="p">;</span>
  <span class="cm">/* pool of esp backends */</span>
  <span class="n">ipsec_esp_backend_t</span> <span class="o">*</span><span class="n">esp_backends</span><span class="p">;</span>
  <span class="cm">/* index of current ah backend */</span>
  <span class="n">u32</span> <span class="n">ah_current_backend</span><span class="p">;</span>
  <span class="cm">/* index of current esp backend */</span>
  <span class="n">u32</span> <span class="n">esp_current_backend</span><span class="p">;</span>
  <span class="cm">/* index of default ah backend */</span>
  <span class="n">u32</span> <span class="n">ah_default_backend</span><span class="p">;</span>
  <span class="cm">/* index of default esp backend */</span>
  <span class="n">u32</span> <span class="n">esp_default_backend</span><span class="p">;</span>

  <span class="cm">/* crypto alg data */</span>
  <span class="n">ipsec_main_crypto_alg_t</span> <span class="o">*</span><span class="n">crypto_algs</span><span class="p">;</span>

  <span class="cm">/* crypto integ data */</span>
  <span class="n">ipsec_main_integ_alg_t</span> <span class="o">*</span><span class="n">integ_algs</span><span class="p">;</span>

  <span class="cm">/* per-thread data */</span>
  <span class="n">ipsec_per_thread_data_t</span> <span class="o">*</span><span class="n">ptd</span><span class="p">;</span>
<span class="p">}</span> <span class="n">ipsec_main_t</span><span class="p">;</span>

<span class="k">typedef</span> <span class="k">enum</span> <span class="n">ipsec_format_flags_t_</span>
<span class="p">{</span>
  <span class="n">IPSEC_FORMAT_BRIEF</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span>
  <span class="n">IPSEC_FORMAT_DETAIL</span> <span class="o">=</span> <span class="p">(</span><span class="mi">1</span> <span class="o">&lt;&lt;</span> <span class="mi">0</span><span class="p">),</span>
<span class="p">}</span> <span class="n">ipsec_format_flags_t</span><span class="p">;</span>

<span class="k">extern</span> <span class="n">ipsec_main_t</span> <span class="n">ipsec_main</span><span class="p">;</span>

<span class="n">clib_error_t</span> <span class="o">*</span><span class="nf">ipsec_add_del_sa_sess_cb</span> <span class="p">(</span><span class="n">ipsec_main_t</span> <span class="o">*</span> <span class="n">im</span><span class="p">,</span> <span class="n">u32</span> <span class="n">sa_index</span><span class="p">,</span>
					<span class="n">u8</span> <span class="n">is_add</span><span class="p">);</span>

<span class="n">clib_error_t</span> <span class="o">*</span><span class="nf">ipsec_check_support_cb</span> <span class="p">(</span><span class="n">ipsec_main_t</span> <span class="o">*</span> <span class="n">im</span><span class="p">,</span> <span class="n">ipsec_sa_t</span> <span class="o">*</span> <span class="n">sa</span><span class="p">);</span>

<span class="k">extern</span> <span class="n">vlib_node_registration_t</span> <span class="n">esp4_encrypt_node</span><span class="p">;</span>
<span class="k">extern</span> <span class="n">vlib_node_registration_t</span> <span class="n">esp4_decrypt_node</span><span class="p">;</span>
<span class="k">extern</span> <span class="n">vlib_node_registration_t</span> <span class="n">ah4_encrypt_node</span><span class="p">;</span>
<span class="k">extern</span> <span class="n">vlib_node_registration_t</span> <span class="n">ah4_decrypt_node</span><span class="p">;</span>
<span class="k">extern</span> <span class="n">vlib_node_registration_t</span> <span class="n">esp6_encrypt_node</span><span class="p">;</span>
<span class="k">extern</span> <span class="n">vlib_node_registration_t</span> <span class="n">esp6_decrypt_node</span><span class="p">;</span>
<span class="k">extern</span> <span class="n">vlib_node_registration_t</span> <span class="n">ah6_encrypt_node</span><span class="p">;</span>
<span class="k">extern</span> <span class="n">vlib_node_registration_t</span> <span class="n">ah6_decrypt_node</span><span class="p">;</span>
<span class="k">extern</span> <span class="n">vlib_node_registration_t</span> <span class="n">ipsec4_if_input_node</span><span class="p">;</span>
<span class="k">extern</span> <span class="n">vlib_node_registration_t</span> <span class="n">ipsec6_if_input_node</span><span class="p">;</span>

<span class="cm">/*</span>
<span class="cm"> * functions</span>
<span class="cm"> */</span>
<span class="n">u8</span> <span class="o">*</span><span class="nf">format_ipsec_replay_window</span> <span class="p">(</span><span class="n">u8</span> <span class="o">*</span> <span class="n">s</span><span class="p">,</span> <span class="kt">va_list</span> <span class="o">*</span> <span class="n">args</span><span class="p">);</span>

<span class="cm">/*</span>
<span class="cm"> *  inline functions</span>
<span class="cm"> */</span>

<span class="n">static_always_inline</span> <span class="n">u32</span>
<span class="nf">get_next_output_feature_node_index</span> <span class="p">(</span><span class="n">vlib_buffer_t</span> <span class="o">*</span> <span class="n">b</span><span class="p">,</span>
				    <span class="n">vlib_node_runtime_t</span> <span class="o">*</span> <span class="n">nr</span><span class="p">)</span>
<span class="p">{</span>
  <span class="n">u32</span> <span class="n">next</span><span class="p">;</span>
  <span class="n">vlib_main_t</span> <span class="o">*</span><span class="n">vm</span> <span class="o">=</span> <span class="n">vlib_get_main</span> <span class="p">();</span>
  <span class="n">vlib_node_t</span> <span class="o">*</span><span class="n">node</span> <span class="o">=</span> <span class="n">vlib_get_node</span> <span class="p">(</span><span class="n">vm</span><span class="p">,</span> <span class="n">nr</span><span class="o">-&gt;</span><span class="n">node_index</span><span class="p">);</span>

  <span class="n">vnet_feature_next</span> <span class="p">(</span><span class="o">&amp;</span><span class="n">next</span><span class="p">,</span> <span class="n">b</span><span class="p">);</span>
  <span class="k">return</span> <span class="n">node</span><span class="o">-&gt;</span><span class="n">next_nodes</span><span class="p">[</span><span class="n">next</span><span class="p">];</span>
<span class="p">}</span>

<span class="n">u32</span> <span class="nf">ipsec_register_ah_backend</span> <span class="p">(</span><span class="n">vlib_main_t</span> <span class="o">*</span> <span class="n">vm</span><span class="p">,</span> <span class="n">ipsec_main_t</span> <span class="o">*</span> <span class="n">im</span><span class="p">,</span>
			       <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">name</span><span class="p">,</span>
			       <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">ah4_encrypt_node_name</span><span class="p">,</span>
			       <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">ah4_decrypt_node_name</span><span class="p">,</span>
			       <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">ah6_encrypt_node_name</span><span class="p">,</span>
			       <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">ah6_decrypt_node_name</span><span class="p">,</span>
			       <span class="n">check_support_cb_t</span> <span class="n">ah_check_support_cb</span><span class="p">,</span>
			       <span class="n">add_del_sa_sess_cb_t</span> <span class="n">ah_add_del_sa_sess_cb</span><span class="p">);</span>

<span class="n">u32</span> <span class="nf">ipsec_register_esp_backend</span> <span class="p">(</span><span class="n">vlib_main_t</span> <span class="o">*</span> <span class="n">vm</span><span class="p">,</span> <span class="n">ipsec_main_t</span> <span class="o">*</span> <span class="n">im</span><span class="p">,</span>
				<span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">name</span><span class="p">,</span>
				<span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">esp4_encrypt_node_name</span><span class="p">,</span>
				<span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">esp4_encrypt_tun_node_name</span><span class="p">,</span>
				<span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">esp4_decrypt_node_name</span><span class="p">,</span>
				<span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">esp6_encrypt_node_name</span><span class="p">,</span>
				<span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">esp6_encrypt_tun_node_name</span><span class="p">,</span>
				<span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">esp6_decrypt_node_name</span><span class="p">,</span>
				<span class="n">check_support_cb_t</span> <span class="n">esp_check_support_cb</span><span class="p">,</span>
				<span class="n">add_del_sa_sess_cb_t</span> <span class="n">esp_add_del_sa_sess_cb</span><span class="p">);</span>

<span class="kt">int</span> <span class="nf">ipsec_select_ah_backend</span> <span class="p">(</span><span class="n">ipsec_main_t</span> <span class="o">*</span> <span class="n">im</span><span class="p">,</span> <span class="n">u32</span> <span class="n">ah_backend_idx</span><span class="p">);</span>
<span class="kt">int</span> <span class="nf">ipsec_select_esp_backend</span> <span class="p">(</span><span class="n">ipsec_main_t</span> <span class="o">*</span> <span class="n">im</span><span class="p">,</span> <span class="n">u32</span> <span class="n">esp_backend_idx</span><span class="p">);</span>

<span class="n">clib_error_t</span> <span class="o">*</span><span class="nf">ipsec_rsc_in_use</span> <span class="p">(</span><span class="n">ipsec_main_t</span> <span class="o">*</span> <span class="n">im</span><span class="p">);</span>

<span class="n">always_inline</span> <span class="n">ipsec_sa_t</span> <span class="o">*</span>
<span class="nf">ipsec_sa_get</span> <span class="p">(</span><span class="n">u32</span> <span class="n">sa_index</span><span class="p">)</span>
<span class="p">{</span>
  <span class="k">return</span> <span class="p">(</span><span class="n">pool_elt_at_index</span> <span class="p">(</span><span class="n">ipsec_main</span><span class="p">.</span><span class="n">sad</span><span class="p">,</span> <span class="n">sa_index</span><span class="p">));</span>
<span class="p">}</span>

<span class="cp">#endif </span><span class="cm">/* __IPSEC_H__ */</span><span class="cp"></span>

<span class="cm">/*</span>
<span class="cm"> * fd.io coding-style-patch-verification: ON</span>
<span class="cm"> *</span>
<span class="cm"> * Local Variables:</span>
<span class="cm"> * eval: (c-set-style &quot;gnu&quot;)</span>
<span class="cm"> * End:</span>
<span class="cm"> */</span>
</pre></div>
</code></pre></td></tr></table>
</div> <!-- class=content -->
<div id="lfcollabprojects-footer">
  <div class="gray-diagonal">
    <div class="footer-inner">
      <p>
        &copy; 2016 <a href="https://www.fd.io/">FD.io</a> a Linux Foundation
        Collaborative Project. All Rights Reserved.
      </p>
      <p>
        Linux Foundation is a registered trademark of The Linux Foundation.
        Linux is a registered
        <a
          href="http://www.linuxfoundation.org/programs/legal/trademark"
          title="Linux Mark Institute"
          >trademark</a
        >
        of Linus Torvalds.
      </p>
      <p>
        Please see our
        <a href="http://www.linuxfoundation.org/privacy">privacy policy</a> and
        <a href="http://www.linuxfoundation.org/terms">terms of use</a>
      </p>
    </div>
  </div>
</div>
</div> <!-- id=cgit -->
</body>
</html>
