<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Chengyu,<div class=""><br class=""></div><div class="">I assumed there is a documentation for this method, but the commit that adds it is not yet merged.  Here is the description we will have soon:</div><div class=""><br class=""></div><div class=""><div class="">  /**</div><div class="">   * @brief Construct the rule</div><div class="">   * @param packetRegex regular expression to match the packet name that is qualified for the</div><div class="">   *                    the rule (e.g., `^(<.*>)$`)</div><div class="">   * @param signerRegex regular expression to match the the KeyLocator of the packet (e.g.,</div><div class="">   *                    `^(<.*>)<KEY>(<.*>)<ID-CERT><>$`)</div><div class="">   * @param comparator Defines the way expanded signer's name is matched against expanded</div><div class="">   *                   packet's name.  Possible values are:</div><div class="">   *                     - "is-prefix-of"</div><div class="">   *                     - "is-strict-prefix-of"</div><div class="">   *                     - "equal"</div><div class="">   * @param packetExpand Expansion rule for packet's name (e.g., `\1`)</div><div class="">   * @param signerExpand Expansion rule for signer's name (e.g., `\1\2`)</div><div class="">   * @param isPositive flag denoting whether the rule is positive or negative</div><div class="">   *</div><div class="">   * @note A packet complies with the rule only if both \p packetRegex matches the packet name</div><div class="">   *       and \p signerRegex matches the KeyLocator name</div><div class="">   */</div><div class=""><br class=""></div><div class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">On Feb 27, 2015, at 7:59 PM, Chengyu Fan <<a href="mailto:chengy.fan@gmail.com" class="">chengy.fan@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Could you tell me how the SecRuleRelative Rule works? <div class=""><br class=""></div><div class="">Specifically, what's the meaning of each parameter? What conditions the rule will test to make a incoming data satisfy the rule?</div><div class=""><div class=""><table class="" style="margin:0px 0px 0px 6px;padding:0px;font-family:'Lucida Grande',Verdana,Geneva,Arial,sans-serif;font-size:13px;line-height:1.3;border:0px;font-weight:bold"><tbody style="margin:0px;padding:0px" class=""><tr style="margin:0px;padding:0px" class=""><td class="" style="margin-left:6px;padding:0px;font-size:14px;direction:ltr;vertical-align:bottom"><a class="" href="http://named-data.net/doc/ndn-cxx/0.2.0/doxygen/d6/de6/classndn_1_1SecRuleRelative.html#ae75d154107abd094ad47b9195aa3f896" style="color:rgb(39,149,182);margin:0px;padding:0px;line-height:inherit">ndn::SecRuleRelative::SecRuleRelative</a></td><td style="padding:0px;font-size:14px;direction:ltr;vertical-align:bottom" class="">(</td><td class="" style="padding:0px;font-size:14px;direction:ltr;white-space:nowrap;vertical-align:bottom">const std::string & </td><td class="" style="padding:0px;font-size:14px;direction:ltr;color:rgb(96,32,32);white-space:nowrap;vertical-align:bottom"><span style="margin:0px;padding:0px;line-height:inherit;border:none" class="">dataRegex</span>,</td></tr><tr style="margin:0px;padding:0px" class=""><td class="" style="padding:0px;font-size:14px;direction:ltr;text-align:right;vertical-align:bottom"></td><td style="padding:0px;font-size:14px;direction:ltr;vertical-align:bottom" class=""></td><td class="" style="padding:0px;font-size:14px;direction:ltr;white-space:nowrap;vertical-align:bottom">const std::string & </td><td class="" style="padding:0px;font-size:14px;direction:ltr;color:rgb(96,32,32);white-space:nowrap;vertical-align:bottom"><span style="margin:0px;padding:0px;line-height:inherit;border:none" class="">signerRegex</span>,</td></tr><tr style="margin:0px;padding:0px" class=""><td class="" style="padding:0px;font-size:14px;direction:ltr;text-align:right;vertical-align:bottom"></td><td style="padding:0px;font-size:14px;direction:ltr;vertical-align:bottom" class=""></td><td class="" style="padding:0px;font-size:14px;direction:ltr;white-space:nowrap;vertical-align:bottom">const std::string & </td><td class="" style="padding:0px;font-size:14px;direction:ltr;color:rgb(96,32,32);white-space:nowrap;vertical-align:bottom"><span style="margin:0px;padding:0px;line-height:inherit;border:none" class="">op</span>,</td></tr><tr style="margin:0px;padding:0px" class=""><td class="" style="padding:0px;font-size:14px;direction:ltr;text-align:right;vertical-align:bottom"></td><td style="padding:0px;font-size:14px;direction:ltr;vertical-align:bottom" class=""></td><td class="" style="padding:0px;font-size:14px;direction:ltr;white-space:nowrap;vertical-align:bottom">const std::string & </td><td class="" style="padding:0px;font-size:14px;direction:ltr;color:rgb(96,32,32);white-space:nowrap;vertical-align:bottom"><span style="margin:0px;padding:0px;line-height:inherit;border:none" class="">dataExpand</span>,</td></tr><tr style="margin:0px;padding:0px" class=""><td class="" style="padding:0px;font-size:14px;direction:ltr;text-align:right;vertical-align:bottom"></td><td style="padding:0px;font-size:14px;direction:ltr;vertical-align:bottom" class=""></td><td class="" style="padding:0px;font-size:14px;direction:ltr;white-space:nowrap;vertical-align:bottom">const std::string & </td><td class="" style="padding:0px;font-size:14px;direction:ltr;color:rgb(96,32,32);white-space:nowrap;vertical-align:bottom"><span style="margin:0px;padding:0px;line-height:inherit;border:none" class="">signerExpand</span>,</td></tr><tr style="margin:0px;padding:0px" class=""><td class="" style="padding:0px;font-size:14px;direction:ltr;text-align:right;vertical-align:bottom"></td><td style="padding:0px;font-size:14px;direction:ltr;vertical-align:bottom" class=""></td><td class="" style="padding:0px;font-size:14px;direction:ltr;white-space:nowrap;vertical-align:bottom">bool </td><td class="" style="padding:0px;font-size:14px;direction:ltr;color:rgb(96,32,32);white-space:nowrap;vertical-align:bottom"><span style="margin:0px;padding:0px;line-height:inherit;border:none" class="">isPositive</span> </td></tr><tr style="margin:0px;padding:0px" class=""><td style="font-family:'Lucida Grande',Verdana,Geneva,Arial,sans-serif;padding:0px;font-size:14px;direction:ltr;vertical-align:bottom;color:rgb(50,50,50);background-color:rgb(232,232,232)" class=""></td><td style="font-family:'Lucida Grande',Verdana,Geneva,Arial,sans-serif;padding:0px;font-size:14px;direction:ltr;vertical-align:bottom;color:rgb(50,50,50);background-color:rgb(232,232,232)" class="">)</td></tr></tbody></table></div><div class=""><br class=""></div><div class=""><br class=""></div></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Fri, Feb 27, 2015 at 1:59 PM, Alex Afanasyev <span dir="ltr" class=""><<a href="mailto:alexander.afanasyev@ucla.edu" target="_blank" class="">alexander.afanasyev@ucla.edu</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><div class="h5"><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Feb 27, 2015, at 12:10 PM, Chengyu Fan <<a href="mailto:chengy.fan@gmail.com" target="_blank" class="">chengy.fan@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class=""><div class="">Hi,</div><div class=""><br class=""></div><div class="">I'm trying to use the validator-regex to validate the incoming data, but I stuck at how to add the SecRuleRelative Rule.</div><div class=""><br class=""></div>Can somebody tell me some clues?<div class=""><br class=""><div class="">Specifically, I find the example in SecurityLibrary(<a href="http://redmine.named-data.net/projects/ndn-cxx/wiki/SecurityLibrary" target="_blank" class="">http://redmine.named-data.net/projects/ndn-cxx/wiki/SecurityLibrary</a>), but I don't understand the RuleRelative rule below ...</div><div class=""><pre style="padding:6px 10px;border-radius:3px;margin-right:1em;margin-left:1.6em;border:1px solid rgb(226,226,226);width:auto;color:rgb(72,72,72);font-size:12px;background-color:rgb(250,250,250)" class=""><code class="">SecRuleRelative rule(<span class=""><span style="color:rgb(68,102,170)" class="">"</span><span style="color:rgb(68,102,170)" class="">^(<>*)$</span><span style="color:rgb(68,102,170)" class="">"</span></span>, <span class=""><span style="color:rgb(68,102,170)" class="">"</span><span style="color:rgb(68,102,170)" class="">^([^<KEY>]*)<KEY>(<>*)<ksk-.*><ID-CERT>$</span><span style="color:rgb(68,102,170)" class="">"</span></span>, 
                     <span class=""><span style="color:rgb(68,102,170)" class="">"</span><span style="color:rgb(68,102,170)" class="">></span><span style="color:rgb(68,102,170)" class="">"</span></span>, <span class=""><span style="color:rgb(68,102,170)" class="">"</span><span style="color:rgb(68,102,170)" class="">\\</span><span style="color:rgb(68,102,170)" class="">1</span><span style="color:rgb(68,102,170)" class="">"</span></span>, <span class=""><span style="color:rgb(68,102,170)" class="">"</span><span style="color:rgb(68,102,170)" class="">\\</span><span style="color:rgb(68,102,170)" class="">1</span><span style="color:rgb(68,102,170)" class="">\\</span><span style="color:rgb(68,102,170)" class="">2</span><span style="color:rgb(68,102,170)" class="">"</span></span>, <span style="color:rgb(0,102,153)" class="">true</span>);
</code>
</pre><div class="">What's the meaning of <span style="color:rgb(72,72,72);font-size:12px;background-color:rgb(250,250,250)" class=""><span style="color:rgb(68,102,170)" class="">"</span><span style="color:rgb(68,102,170)" class="">></span><span style="color:rgb(68,102,170)" class="">"</span></span><span style="color:rgb(72,72,72);font-size:12px;background-color:rgb(250,250,250)" class="">, </span><span style="color:rgb(72,72,72);font-size:12px;background-color:rgb(250,250,250)" class=""><span style="color:rgb(68,102,170)" class="">"</span><span style="color:rgb(68,102,170)" class="">\\</span><span style="color:rgb(68,102,170)" class="">1</span><span style="color:rgb(68,102,170)" class="">"</span></span><span style="color:rgb(72,72,72);font-size:12px;background-color:rgb(250,250,250)" class="">, </span><span style="color:rgb(72,72,72);font-size:12px;background-color:rgb(250,250,250)" class=""><span style="color:rgb(68,102,170)" class="">"</span><span style="color:rgb(68,102,170)" class="">\\</span><span style="color:rgb(68,102,170)" class="">1</span><span style="color:rgb(68,102,170)" class="">\\</span><span style="color:rgb(68,102,170)" class="">2</span><span style="color:rgb(68,102,170)" class="">" </span></span>? Can someone give me an example?</div></div></div></div></div></blockquote><br class=""></div></div></div><div class="">This is just a regular expression rules.  <a class="">\\1</a> (\1, it’s just \ needs to be escaped in c++) refer to th first group of the regular expression, <a class="">\\2</a> refer to the second group, etc.</div><div class=""><br class=""></div><div class="">There are many documentation sources about regexps, e.g., <a href="http://www.boost.org/doc/libs/1_57_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html" target="_blank" class="">http://www.boost.org/doc/libs/1_57_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html</a>.</div><div class=""><br class=""></div><div class="">The only difference in our regular expressions is the fact that it is defined over name components, not just strings.  There is a documentation for this at <a href="http://named-data.net/doc/ndn-cxx/current/tutorials/utils-ndn-regex.html" target="_blank" class="">http://named-data.net/doc/ndn-cxx/current/tutorials/utils-ndn-regex.html</a></div><div class=""><br class=""></div><div class="">—</div><span class="HOEnZb"><font color="#888888" class=""><div class="">Alex</div><div class=""><br class=""></div><br class=""></font></span></div></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div class="gmail_signature"><div dir="ltr" class=""><div class="">Thanks,</div><div class=""><br class=""></div>Chengyu</div></div>
</div>
</div></blockquote></div><br class=""></div></body></html>