I am very good at criticizing things, and after 7 years of being involved in Open Source I have seen many areas of improvement. Of course, the important thing is not to criticize, but to offer solution, and even pursue them.
One of the first serious development I did was on Gaim’s MSN plugin. A very rewarding experience, but the frustration with Gaim’s internal API made me left the project. So I wanted to create an MSN library, this time Done Right™, which in overall meant totally asynchronous.
I started it in C.
Then I realized there was no good enough networking library for me, not really asynchronous. I did an extensive search for GLib based approach and there were not many options: the only viable ones where GNet and flow. I tried to get involved in flow but in the end development staggered.
So I decided to simply use plain old poll. This is how a sample test client looks like:
connection = my_core_new_connection (core);
connection->read_operation = read_operation;
my_core_connect (connection, "localhost", 80);
my_connection_send (connection, "GET /index.html HTTP/1.1\nHost: localhost\n\n", 42);
That’s all I wanted, I don’t have to wait for the server the be ready and then send the data, the library queues the write command, and issues it when the the server is ready. When there’s data ready to be read the library calls the read_operation callback. I just need to call my_core_poll continuously; I did it so I could easily integrate it into other main loops as GLib’s.
I called this library libdsocket, I still have to choose a good name and release it I guess. Anyway I had one piece.
Then came another issue: proxies. Again, there’s no good proxy library.
There are a lot of integrated solutions like libcurl, but that’s not what I wanted. I wanted something isolated, like my socket library. I decided to skip the step of creating such a library, but it turns out that now there’s a neat library to parse PAC (Proxy Auto Configuration) files: pactester. That’s one step in the right direction.
So, finally I did it, well, at leat the first step: libgmsn.
I didn’t really use my sockets library, but something similar. It uses GObject, libxml for SOAP stuff (authentication) and OpenSSL.
It’s a great proof of concept, but it even has my username and password hardcoded (testing account).
But then again, I’m not so sure anymore C is the right thing for something so complicated as the MSN protocol.
Then I found about Pymsn. They are a crew of very cool guys, I tried to contribute but then I found out I don’t like Python that much.
I hanged out in #c a long while, hearing about a lot of programming languages other than C. There is people with a lot of knowledge there, I learned a lot.
I finally decided to try Ruby, and I fell in love.
Implementing the authentication for MSNP15 (not an easy task) and address book handling was a bliss, a total bliss. I have to clean my code a bit, and then I’ll post it somewhere. Maybe once I get my Ruby code for MSN in a good shape and with a design that I really like I’ll decide to port it to C, but I have so few time that I doubt I’ll ever do it.
So, going back to the subject, I think Linux really needs the following:
- A good isolated, asynchronous and simple networking library in C
- A good isolated, simple proxy library in C
- A good AIO kernel API
Mental note: remember Sammy Jankins and post your code.
Update: Thing, it was thing, not ring.