3

Recently I became interested in DIAMETER protocol defined by [RFC 6733][1]. Since I am learning Python, I thought that it might be interesting to see if I could use any DIAMETER Python library. I did find [one][2], but it appears to be no longer maintained. So I got the highly ambitious idea of trying to build one, at least something that is skeletal, that could be extended to have richer DIAMETER signaling capabilities.

Since I had also come across twisted matrix a while back, I tried to check it's documentation to see if has support for all types of transport that DIAMETER protocol could be supported on, but apart from TCP, UDP (and also TLS), I din't find mention of rest, i.e.

  • SCTP/IP
  • SCTP/UDP
  • DTLS/SCTP

So was wondering if there is any other library that could be used, or should I expect to have to hand-roll this ? Extending twisted, is beyond me at this step. [1]: https://www.rfc-editor.org/rfc/rfc6733 [2]: http://i1.dk/PythonDiameter/

Community
  • 1
  • 1
bdutta74
  • 2,798
  • 3
  • 31
  • 54

2 Answers2

2

I don't know it this one is still supported (last update in december 2014) http://sourceforge.net/projects/pyprotosim/

It does radius, diameter, dhcp, ldap, EAP calculations

You haven't chosen the easiest protocol. A lot of providers have their own AVPs, and sometimes they even use standard numbers for theirs.

You can also write your own lib to parse DIAMETER, it's not that hard, you just need time (a lot) and good documentation (or experts). If the one I did had not been developed during my work, I could have shared it, but I can't.

Morb
  • 534
  • 3
  • 14
  • Maybe it doesn't answer what you ask. I developped some protocol parsers because I couldn't find suitable libs, I think you can do the same if you know python enough. – Morb Apr 20 '15 at 11:55
  • Thanks @Morb. I know DIAMETER a bit. Will check out pyprotosim, since it does sound promising and close to what I was hoping to achieve as a first step (but clearly, a very ambitious first step). – bdutta74 Apr 20 '15 at 12:04
1

If you were going to roll your own, you can do this with Twisted by using the IFileDescriptor (and related) interface(s). Make an SCTP socket, wrap an IFileDescriptor around it that returns its fileno, then implement IReadDescriptor.doRead to call sctp_sendmsg and IWriteDescriptor.doWrite to call sctp_recvmsg. Now you have an SCTP transport. You can implement it to call methods on whatever SCTP protocol interface that is appropriate to the protocol. I don't know enough about SCTP to say what methods that protocol interface should have, unfortunately.

Glyph
  • 31,152
  • 11
  • 87
  • 129
  • Thanks @Glyph. I am slowly gravitating towards Twisted, in spite of my initial fear of it being too steep a learning curve - but if that is one of the ideal ways of doing it, I might go down that path. – bdutta74 Apr 22 '15 at 04:33
  • 1
    Twisted's learning curve is really not all that steep. The issue is that it's easy to become distracted, and start implementing an IMAP server backend while you're trying to figure it out. Just focus on the layers of Twisted you need for your application rather than trying to learn the whole thing, and you should be fine. – Glyph Apr 24 '15 at 04:18