Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update for opendnp3 version 3.1.0 #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thewetzel
Copy link

This compiles and runs for me against the release branch of opendnp3, but I made some changes I'm not totally pleased with.

  1. It looks like the old openpal/container/Buffer.h used to allocate its own storage and the new opendnp3/util/Buffer.h does not, so I replaced m_buffer in HexData.h with a std::array of fixed length 4096. This is probably not the most correct, but it was the shortest path I found to getting it working.
  2. LogMacros.h is no longer installed with opendnp3, so the FORMAT_HEX_BLOCK macro no longer displays the original hex of the message to be decoded.
  3. CMakeLists.txt in this project isn't very accommodating of having the opendnp3 library installed in non-standard directories. I don't know how to make it better.

@emgre
Copy link
Member

emgre commented Dec 16, 2020

  1. openpal/container/Buffer.h is now ser4cpp/container/Buffer.h. This introduces another dependency (although it is already a private dependency of OpenDNP3), so sticking to a fixed-size array might be ok.
  2. FORMAT_HEX_BLOCK is still in OpenDNP3, but it's private. But the hex output isn't printed by the log system?
    https://github.com/dnp3/opendnp3/blob/097b6ddcb012a54c9e8e10db03fec98ddc898341/cpp/lib/src/logging/LogMacros.h#L69-L73
  3. We should probably use the FetchContent system of CMake to get OpenDNP3, similar to what we did here: https://github.com/dnp3/opendnp3/blob/release/deps/ser4cpp.cmake

@thewetzel
Copy link
Author

  1. So if dnp3cgi wants to make use of private headers from opendnp3, should dnp3cgi be included in opendnp3/cpp/examples with an optional CMAKE flag, like -DDNP3_CGI=ON?
  2. It doesn't appear so. In DecoderImpl.cpp, the DecodeTPDU and DecodeAPDU functions have a FORMAT_HEX_BLOCK macro, but DecodeLPDU does not.
  3. But I already built and installed opendnp3, I just installed it to a non-standard place. Is there something like pkg-config for cmake? It seems like we should be able to put find_package(opendnp3) in the CMakeLists.txt file and add -DCMAKE_PREFIX_PATH=/home/myuser/local to the cmake command and it should work, but it doesn't.

@jadamcrain
Copy link
Member

jadamcrain commented Dec 16, 2020

I'm of the opinion that making this work with the latest version of opendnp3 is not worth it. I don't believe any new parsing functionality was added from OpenDNP3 2.1 -> current. No parsing bugs fixed, etc.

@thewetzel what's your end goal here? Do you want to have something local that you can run or do you just want this hosted again?

@thewetzel
Copy link
Author

@jadamcrain Sorry, I didn't see your edit until now. My end goal is the latter. When I needed a decoder (either when Wireshark choked on some huge DNP3 response, or when I was trying to decode some serial DNP3), it was very convenient. I briefly put my "fixed" dnp3cgi on a webserver on a VPS, but I've since left the VPS world, and only have a Raspberry Pi hosting a small webserver now. I have a feeling that crosscompiling OpenDNP3 and dnp3cgi is going to require more effort than I'm willing to put in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants