yoursunny / esp8266ndn Goto Github PK
View Code? Open in Web Editor NEWNDN Arduino library for ESP8266 and more
Home Page: https://esp8266ndn.ndn.today
License: ISC License
NDN Arduino library for ESP8266 and more
Home Page: https://esp8266ndn.ndn.today
License: ISC License
I am very interested to run the NDN on ESP32 and have seen that you already have implemented it.
After cloning the "NDNph" and the esp8266ndn examples form GIT flowing the steps here "https://github.com/yoursunny/esp8266ndn", I am now trying to run your code but I have some issues regarding the installation the esp8266ndn on my board. I would like to use the ESP32 Dev board.
The project example "PingClient" from yoursunny/esp8266ndn/\examples does not find the library with the name "esp8266ndn". I am getting the error "PingClient:8:24: fatal error:
esp8266ndn.h: No such file or directory".
Can you please help my with this error? Is there something which I should do before I start the installation?
Best wishes
Mohamed
Hello,
I was wondering if it's possible that this esp8266ndn library also forwards Interest / Data packets?
Take a look at my setup:
.
The first one is my current setup. All sensors are connected to a NFD instance in a star topology. This way all sensors can communicate with each other.
But is it possible the get the second setup, where only one sensor is connected to the NFD instance and the other sensors use (in this case Sensor 3) as a gateway?
If that's possible how would I configure my ESP32 firmware (using esp8266ndn) to do so?
Hello, there is a possible bug that the signed interests generated by the esp8266ndn library have an incorrect TLV encoding.
Two of the strange things about the TLV I found were this:
The exact error output from PyNDN2 was this:
Traceback (most recent call last):
File "test_sign_verify_interest_hmac.py", line 114, in <module>
main()
File "test_sign_verify_interest_hmac.py", line 93, in main
if KeyChain.verifyInterestWithHmacWithSha256(interest, key):
File "build/bdist.linux-armv7l/egg/pyndn/security/key_chain.py", line 1364, in verifyInterestWithHmacWithSha256
File "build/bdist.linux-armv7l/egg/pyndn/encoding/tlv_0_2_wire_format.py", line 505, in decodeSignatureInfoAndValue
RuntimeError: Did not get the expected TLV type
Below I have pasted an interest TLV that verifies correctly with PyNDN2, and the interest TLV generated by the esp8266ndn library that failed to verify because of a TLV unexpected type error.
This interest verifies correctly with PyNDN2:
TlvInterest = Blob(bytearray([
0x05, 0x47, # NDN Interest
0x07, 0x3f, # Name
0x08, 0x03, 0x6e, 0x64, 0x6e, # "ndn"
0x08, 0x03, 0x61, 0x62, 0x63, # "abc"
0x08, 0x0f, # NameComponent
0x16, 0x0d, # SignatureInfo
0x1b, 0x01, 0x04, # SignatureType = SignatureHmacWithSha256
0x1c, 0x08, # KeyLocator
0x07, 0x06, # Name
0x08, 0x04, 0x6b, 0x65, 0x79, 0x31, # "key1"
0x08, 0x22, # NameComponent
0x17, 0x20, # SignatureValue
0x61, 0xe0, 0x60, 0x58, 0x1e, 0x2b, 0x75, 0x43, 0xf8, 0x8f,
0xad, 0xa9, 0xdf, 0xa7, 0x6e, 0x43, 0x98, 0x5c, 0xc7, 0x3c,
0x9b, 0x50, 0xf9, 0x8e, 0xc2, 0x3f, 0xd1, 0x70, 0x79, 0x4d,
0xf1, 0xe8,
0x0a, 0x04, 0xd1, 0x3c, 0x4b, 0x2f # Nonce
]))
This interest (generated by esp8266ndn library) does not verify correctly with PyNDN2:
TlvInterest = Blob(bytearray([
0x05, 0x89, # NDN Interest 2
0x07, 0x7D, # Name 2
0x08, 0x0A, 0x63, 0x6F, 0x6E, 0x74, 0x72, 0x6F, 0x6C, 0x6C, 0x65, 0x72, # "controller" 12
0x08, 0x08, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, # "register" 10
0x08, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x60, 0x67, 0xFF, 0x3F, 0x78, 0x56, 0xAD, 0xBA, # "192.168.4.20" 14
0x08, 0x0A, 0x45, 0x53, 0x50, 0x33, 0x32, 0x49, 0x44, 0x30, 0x30, 0x31, # "ESP32ID001" 12
0x08, 0x29, # NameComponent 2
0x16, 0x27, # SignatureInfo 2
0x1B, 0x01, 0x04, # SignatureType = SignatureHmacWithSha256 3
0x1C, 0x22, # KeyLocator 2
0x1D, 0x20, # KeyDigest 2
0x63, 0x0D, 0xCD, 0x29, 0x66, 0xC4, 0x33, 0x66, 0x91, 0x12, # 10
0x54, 0x48, 0xBB, 0xB2, 0x5B, 0x4F, 0xF4, 0x12, 0xA4, 0x9C, # 10
0x73, 0x2D, 0xB2, 0xC8, 0xAB, 0xC1, 0xB8, 0x58, 0x1B, 0xD7, # 10
0x10, 0xDD, # 2
0x08, 0x20, # Generic name component 2
0x77, 0x7D, 0x34, 0xE8, 0xA5, 0x8F, 0x58, 0xB6, 0xBB, 0x9B, # 10
0x7D, 0x30, 0x2A, 0x36, 0x45, 0xBE, 0x82, 0xCF, 0xAC, 0x5E, # 10
0x83, 0x1A, 0x47, 0x1A, 0x93, 0xA4, 0x57, 0xC5, 0xCD, 0x19, # 10
0x9B, 0xB6, 0x09, 0x02, 0x12, 0x00 # 6
0x0A, 0x04, 0xD1, 0x4E, 0x3D, 0xE5 # Nonce 6
]))
Hello,
I am really interested in your NDN libraries and tried to get one of your examples to work on my ESP-WROOM-32 but unfortunately I get compiler errors.
I have done the following things (on my Windows machine):
<User>/Documents/Arduino/libraries
But when I now run this simple program
#include <esp8266ndn.h>
void setup() {
}
void loop() {
}
I get the following exception
In file included from c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/ndnph/port/ec/mbed.hpp:4,
from c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/ndnph/port/ec/port.hpp:8,
from c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/NDNph.h:4,
from c:\Users\myuser\Documents\Arduino\libraries\esp8266ndn\src/port/port.hpp:28,
from c:\Users\myuser\Documents\Arduino\libraries\esp8266ndn\src/esp8266ndn.h:11,
from C:\Users\myuser\Downloads\arduino_sketch\arduino_sketch.ino:1:
c:\users\myuser\documents\arduino\libraries\ndnph\src\ndnph\port\mbed-common.hpp: In constructor 'ndnph::mbedtls::Sha256::Sha256()':
c:\users\myuser\documents\arduino\libraries\ndnph\src\ndnph\port\mbed-common.hpp:37:12: error: 'mbedtls_sha256_starts_ret' was not declared in this scope; did you mean 'mbedtls_sha256_starts'?
37 | m_ok = mbedtls_sha256_starts_ret(&m_ctx, 0) == 0;
| ^~~~~~~~~~~~~~~~~~~~~~~~~
| mbedtls_sha256_starts
c:\users\myuser\documents\arduino\libraries\ndnph\src\ndnph\port\mbed-common.hpp: In member function 'void ndnph::mbedtls::Sha256::update(const uint8_t*, size_t)':
c:\users\myuser\documents\arduino\libraries\ndnph\src\ndnph\port\mbed-common.hpp:47:20: error: 'mbedtls_sha256_update_ret' was not declared in this scope; did you mean 'mbedtls_sha256_update'?
47 | m_ok = m_ok && mbedtls_sha256_update_ret(&m_ctx, chunk, size) == 0;
| ^~~~~~~~~~~~~~~~~~~~~~~~~
| mbedtls_sha256_update
c:\users\myuser\documents\arduino\libraries\ndnph\src\ndnph\port\mbed-common.hpp: In member function 'bool ndnph::mbedtls::Sha256::final(uint8_t*)':
c:\users\myuser\documents\arduino\libraries\ndnph\src\ndnph\port\mbed-common.hpp:52:20: error: 'mbedtls_sha256_finish_ret' was not declared in this scope; did you mean 'mbedtls_sha256_finish'?
52 | m_ok = m_ok && mbedtls_sha256_finish_ret(&m_ctx, digest) == 0;
| ^~~~~~~~~~~~~~~~~~~~~~~~~
| mbedtls_sha256_finish
c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/ndnph/port/ec/mbed.hpp: In constructor 'ndnph::port_ec_mbed::EcKeyBase::EcKeyBase()':
c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/ndnph/port/ec/mbed.hpp:40:37: error: 'mbedtls_ecp_keypair' {aka 'struct mbedtls_ecp_keypair'} has no member named 'grp'
40 | mbedtls_ecp_group_copy(&keypair.grp, mbedtls::P256::group());
| ^~~
c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/ndnph/port/ec/mbed.hpp: In member function 'bool ndnph::port_ec_mbed::EcPvt::import(const uint8_t*)':
c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/ndnph/port/ec/mbed.hpp:61:51: error: 'mbedtls_ecp_keypair' {aka 'struct mbedtls_ecp_keypair'} has no member named 'd'
61 | return mbedtls_mpi_read_binary(&this->keypair.d, bits, mbedtls::P256::PvtLen::value) == 0 &&
| ^
c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/ndnph/port/ec/mbed.hpp:62:53: error: 'mbedtls_ecp_keypair' {aka 'struct mbedtls_ecp_keypair'} has no member named 'grp'
62 | mbedtls_ecp_check_privkey(&this->keypair.grp, &this->keypair.d) == 0;
| ^~~
c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/ndnph/port/ec/mbed.hpp:62:73: error: 'mbedtls_ecp_keypair' {aka 'struct mbedtls_ecp_keypair'} has no member named 'd'
62 | mbedtls_ecp_check_privkey(&this->keypair.grp, &this->keypair.d) == 0;
| ^
c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/ndnph/port/ec/mbed.hpp: In member function 'ssize_t ndnph::port_ec_mbed::EcPvt::sign(const uint8_t*, uint8_t*) const':
c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/ndnph/port/ec/mbed.hpp:75:42: error: invalid conversion from 'size_t*' {aka 'unsigned int*'} to 'size_t' {aka 'unsigned int'} [-fpermissive]
75 | &sigLen, nullptr, nullptr) == 0
| ^~~~~~~
| |
| size_t* {aka unsigned int*}
c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/ndnph/port/ec/mbed.hpp:74:41: error: too few arguments to function 'int mbedtls_ecdsa_write_signature(mbedtls_ecdsa_context*, mbedtls_md_type_t, const unsigned char*, size_t, unsigned char*, size_t, size_t*, int (*)(void*, unsigned char*, size_t), void*)'
74 | return mbedtls_ecdsa_write_signature(ctx, MBEDTLS_MD_SHA256, digest, NDNPH_SHA256_LEN, sig,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
75 | &sigLen, nullptr, nullptr) == 0
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/ndnph/port/ec/mbed.hpp:5:
C:\Users\myuser\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.1-6b1f40b9bf/esp32/include/mbedtls/mbedtls/include/mbedtls/ecdsa.h:483:5: note: declared here
483 | int mbedtls_ecdsa_write_signature(mbedtls_ecdsa_context *ctx,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/ndnph/port/ec/mbed.hpp: In member function 'bool ndnph::port_ec_mbed::EcPub::import(const uint8_t*)':
c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/ndnph/port/ec/mbed.hpp:86:57: error: 'mbedtls_ecp_keypair' {aka 'struct mbedtls_ecp_keypair'} has no member named 'grp'
86 | return mbedtls_ecp_point_read_binary(&this->keypair.grp, &this->keypair.Q, bits,
| ^~~
c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/ndnph/port/ec/mbed.hpp:86:77: error: 'mbedtls_ecp_keypair' {aka 'struct mbedtls_ecp_keypair'} has no member named 'Q'
86 | return mbedtls_ecp_point_read_binary(&this->keypair.grp, &this->keypair.Q, bits,
| ^
c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/ndnph/port/ec/mbed.hpp:88:52: error: 'mbedtls_ecp_keypair' {aka 'struct mbedtls_ecp_keypair'} has no member named 'grp'
88 | mbedtls_ecp_check_pubkey(&this->keypair.grp, &this->keypair.Q) == 0;
| ^~~
c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/ndnph/port/ec/mbed.hpp:88:72: error: 'mbedtls_ecp_keypair' {aka 'struct mbedtls_ecp_keypair'} has no member named 'Q'
88 | mbedtls_ecp_check_pubkey(&this->keypair.grp, &this->keypair.Q) == 0;
| ^
c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/ndnph/port/ec/mbed.hpp: In member function 'bool ndnph::port_ec_mbed::EcKeyGen::generate(uint8_t*, uint8_t*)':
c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/ndnph/port/ec/mbed.hpp:109:51: error: 'mbedtls_ecp_keypair' {aka 'struct mbedtls_ecp_keypair'} has no member named 'grp'
109 | return mbedtls_ecp_gen_keypair(&this->keypair.grp, &this->keypair.d, &this->keypair.Q,
| ^~~
c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/ndnph/port/ec/mbed.hpp:109:71: error: 'mbedtls_ecp_keypair' {aka 'struct mbedtls_ecp_keypair'} has no member named 'd'
109 | return mbedtls_ecp_gen_keypair(&this->keypair.grp, &this->keypair.d, &this->keypair.Q,
| ^
c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/ndnph/port/ec/mbed.hpp:109:89: error: 'mbedtls_ecp_keypair' {aka 'struct mbedtls_ecp_keypair'} has no member named 'Q'
109 | return mbedtls_ecp_gen_keypair(&this->keypair.grp, &this->keypair.d, &this->keypair.Q,
| ^
c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/ndnph/port/ec/mbed.hpp:111:52: error: 'mbedtls_ecp_keypair' {aka 'struct mbedtls_ecp_keypair'} has no member named 'd'
111 | mbedtls_mpi_write_binary(&this->keypair.d, pvtBits, mbedtls::P256::PvtLen::value) == 0 &&
| ^
c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/ndnph/port/ec/mbed.hpp:112:58: error: 'mbedtls_ecp_keypair' {aka 'struct mbedtls_ecp_keypair'} has no member named 'grp'
112 | mbedtls_ecp_point_write_binary(&this->keypair.grp, &this->keypair.Q,
| ^~~
c:\Users\myuser\Documents\Arduino\libraries\NDNph\src/ndnph/port/ec/mbed.hpp:112:78: error: 'mbedtls_ecp_keypair' {aka 'struct mbedtls_ecp_keypair'} has no member named 'Q'
112 | mbedtls_ecp_point_write_binary(&this->keypair.grp, &this->keypair.Q,
| ^
In file included from c:\Users\myuser\Documents\Arduino\libraries\esp8266ndn\src/esp8266ndn.h:18:
c:\Users\myuser\Documents\Arduino\libraries\esp8266ndn\src/transport/ble-server-transport.hpp: In member function 'String esp8266ndn::BleServerTransport::getAddr() const':
c:\Users\myuser\Documents\Arduino\libraries\esp8266ndn\src/transport/ble-server-transport.hpp:78:56: error: 'class String' has no member named 'data'
78 | return String(::BLEDevice::getAddress().toString().data()) + " (addr-type=public)";
| ^~~~
c:\Users\myuser\Documents\Arduino\libraries\esp8266ndn\src/transport/ble-server-transport.hpp: In member function 'virtual void esp8266ndn::BleServerTransport::CsCallbacks::onWrite(BLECharacteristic*)':
c:\Users\myuser\Documents\Arduino\libraries\esp8266ndn\src/transport/ble-server-transport.hpp:117:40: error: conversion from 'String' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
117 | std::string value = chr->getValue();
| ~~~~~~~~~~~~~^~
exit status 1
Compilation error: exit status 1
which is weired as the file does in fact exist.
But when I try to compile this program (I just import the file which couldn't be found in the previous step)
#include <ndnph/port/ec/mbed.hpp>
void setup() {
}
void loop() {
}
I get a file not found exception
C:\Users\myuser\Downloads\arduino_sketch\arduino_sketch.ino:1:10: fatal error: ndnph/port/ec/mbed.hpp: No such file or directory
1 | #include <ndnph/port/ec/mbed.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Compilation error: ndnph/port/ec/mbed.hpp: No such file or directory
It would be awesome if you could help me.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.