快速开发路由协议原型的环境
我正在研究路由协议。目前,我正在对一种新协议进行用 Python 编写的模拟。下一步是构建一个真正的原型,它可以真正运行在基于 Linux 的操作系统之上(作为路由守护进程,例如 ospfd)。
什么是适合快速构建路由协议原型的编程环境/语言?有人有构建分布式协议原型的经验吗?
我想尽可能关注高级协议逻辑,而不是低级机器相关指令。我愿意学习新的语言(例如 Erlang 或 Haskell),以防它们更适合这样的任务。或者,我已经阅读了 Python 中可用的扭曲框架(这可能允许重用一些代码),但我不清楚这是否只对我编写基于客户端/服务器的协议有帮助。
有谁知道(分布式)协议实现的优雅教程或示例实现?
I am doing research on routing protocols. Currently I perform simulations written in Python of a new protocol. The next step would be to build a real prototype which can really run on top of a Linux-based operating system (as a routing daemon such as ospfd).
What would be a well-suited programming environment/language to quickly build a prototype of a routing protocol? Anyone having experience with building distributed protocol prototypes?
I would like to focus as much as possible on high-level protocol logic instead of on low-level machine-related instructions. I am willing to learn new languages (such as Erlang or Haskell), in case they are better adapted for such a task. Alternatively, I have read about the twisted framework available in Python (which would probably allow to re-use some code), but it is unclear to me if this only would help me in case I write client/server-based protocols.
Does anyone know about an elegant tutorial or example implementation of a (distributed) protocol implementation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您主要对协议如何与其自身交互感兴趣,并且不想考虑实现细节(例如数据包是什么样子),那么您可能会对 Erlang 感到非常幸运。通过(真实或虚构的)网络发送任意消息是该语言的基本特征。因此,如果您真的只想在信息级别工作,它会得到很好的支持。
我对 Erlang 的想法会让你得到一些对生产来说更没用的东西,但可能比 Scapy 花费的时间要少得多。
由于节点可以是具有 IP 地址的主机,并且消息可以包含几乎任何内容,因此使用 Erlang 模拟协议将非常简单。如果您有兴趣,这将帮助您开始学习该语言。
If you're primarily interested in how your protocol will interact with itself, and don't want to think about implementation details like what packets look like, you might have great luck with Erlang. Sending arbitrary messages across a (real or imaginary) network is an essential feature of the language. So if you really only want to work at the information level, it's got good support for it.
What I have in mind with Erlang would get you something even less useful for production, but probably in considerably less time than Scapy.
Since nodes can be hosts with IP addresses and messages can contain pretty much anything, simulating a protocol with Erlang would be pretty simple. This will get you started learning the language, if you're interested.
Scapy 将是一个很好的工具。您可以在较高级别创建数据包,并且它对添加协议有很好的支持。您不会想将它用作生产实现,但它会成为一个很棒的原型平台。
它是用 Python 编写的,这是值得的。
Scapy would be a good tool for this. You can create packets at a high level and it's got good support for adding protocols. You wouldn't want to use it as a production implementation, but it'd make a great prototyping platform.
It's written in Python, for what that's worth.
Erlang 非常适合没有具体实现的逻辑原型,也非常适合实现现实世界中能够实现的协议。
你不需要任何其他框架,只需要Erlang和它自带的OTP就足够了。
即使您必须深入到数据包级别,Erlang 也可以帮助您使用其二进制模式,这些模式非常适合处理协议数据包。
即使你想要高性能,你也可以将最关键的时间转移到 Erlang 中所谓的“端口”中,用 C 或其他低级语言实现它。
Erlang is very well suited for just a logical prototype without concrete implementation as well as implementing real world capable implementations of the protocols.
You don't need any other framework, just Erlang and OTP which comes with it is enough.
Even if you have to work down to packet level Erlang helps you with its binary patterns which are gread for working with protocol packets.
Even if you want high performance you can move the most time critical stuff into whats called "Ports" in Erlang implementing it in C or another low level language.