UCLA-IRL / NAC-ABE

Attribute-based Access Control over Named Data Networking
GNU General Public License v3.0
14 stars 11 forks source link

m_face.registerPrefix function #6

Closed kangkang333 closed 2 years ago

kangkang333 commented 2 years ago

I could run tests in NAC-ABE successfully, but I found that the "attribute-authority.t.cpp" file relies on the "DummyClientFace", the "m_face.registerPrefix" bind failed in the "attribute-authority.cpp" file, I want to know how could registerPrefix works, thanks~~

tylerliu commented 2 years ago

Looks like version issue. Should work under ndn-cxx 0.7.1. Will update this library to match current stable version.

tylerliu commented 2 years ago

Hi, I have tried running unit tests on nan-cxx 0.7.1, 0.8.0 and master version on Ubuntu 20.04, and have used both cmake and waf builds. All of them are working. Would you mind providing further details? Thanks.

kangkang333 commented 2 years ago

Thank you for your reply! I could also run all unit tests successfully, but I set a breakpoint in the attribute-authority.cpp file, I found the sentence "auto prefixId = m_face.register(...)" switch to the sentence "bind(&CpAttributeAuthority::onRegisterFailed, this, _2)". I have installed ndn-cxx 0.7.1, but I haven't installed NFD, I want to know if I miss some dependencies. Thank you~

tylerliu commented 2 years ago

For this line, registerPrefix() function will call the fourth parameter in the event of NDN prefix registration failure. I the code file you are looking at, the function being passed in as the fourth parameter is bind(&CpAttributeAuthority::onRegisterFailed, this, _2). This is a function call of bind(), which returns a function that is being passed into registerPrefix(). Therefore, the bind() function is being executed before any call to registerPrefix(), but there is no actual register fail occurred yet.

To help verifying this, you can try to put the breakpoint instead at CpAttributeAuthority::onRegisterFailed, because this is the actual function that is executed in a registration failure. Alternatively, you can convert the bind() into a C++ lambda and try again.

Thanks for trying out and debugging the code.