开发者

Over-the-Air / Over-the-Wire automated Software Update (hot-code-loading) strategy

开发者 https://www.devze.com 2023-03-18 09:06 出处:网络
Have a Linux system (as part of my project), where I might have to do hot-code-loading, i.e. update parts of the software, over-the-air (s.a. downloading the software over WiFi) or over-the-wire (over

Have a Linux system (as part of my project), where I might have to do hot-code-loading, i.e. update parts of the software, over-the-air (s.a. downloading the software over WiFi) or over-the-wire (over LAN). There are 2 parts of this software, one part written in C++ and another in Erlang. The C++ part talks to some external entities over TCP/IP (a set of 6-7 odd proprietary protocols). The part which I need to mostly do hot-loading of, is the C++ part that talks to those external entities. The C++ part talks to Erlang over ports (under development currently), but I would like to change that to NIFs (sometime in future).

Can someone suggest some strategies for hot-code-loading of C++ functionality. I am aware of Erlang's ability to do, but my understanding is that the functionality doesn't extend over to the part written in C++.

Also, I need to ensure that the C++ module containing proprietary protocol implementation, is from "valid source". What might be the right strategy for that ?

I guess, my requirements are not uncommon, so if such modules, frameworks, libraries exist, would be happy to be po开发者_如何学编程inted to those.


Don't know about any existing libraries for this. Code loading in C/C++ is in most cases done using dynamic libraries which you can load from code using dlopen. Then you can find addresses of symbols using dlsym. Notice that C++ does name mangling which can make it hard to find symbols. Often best to create normal functions wrapped in extern "C" that create objects for you which you can then use just as any other object.

If you want to be certain the code is valid you probably should look into public/private key cryptography. You sign the code with the private key (basically you create an encrypted hash of your binary) and the software loading the code checks the signature using the public key.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号