New Network backend mechanism
By Arnaud Dupuis on Tuesday 27 November 2007, 21:32 - slack-get - Permalink
Today I implemented the new slackget10::Network mechanism I wanted to. What is
it you ask ?
Clearly something which will help everything to be super-easy to improve. As you may know (or not) the slackget10::Network Perl Module has been completely redesigned and will be largely recoded.
The changes are quite important and the API is completely new. It's now a front end module (like slackget10::Network::Connection is) and it aim at providing a unified interface for all kind of "protocol" implementation.
The idea is to answer the question : "what are you doing with an incoming network packet ?". The answer is simple : you decode it, you interpret it, you build the answer and you encode the answer before sending it.
Clearly something which will help everything to be super-easy to improve. As you may know (or not) the slackget10::Network Perl Module has been completely redesigned and will be largely recoded.
The changes are quite important and the API is completely new. It's now a front end module (like slackget10::Network::Connection is) and it aim at providing a unified interface for all kind of "protocol" implementation.
The idea is to answer the question : "what are you doing with an incoming network packet ?". The answer is simple : you decode it, you interpret it, you build the answer and you encode the answer before sending it.
Hi,
Today I implemented the new slackget10::Network mechanism I wanted to. What is it you ask ?
Clearly something which will help everything to be super-easy to improve. As you may know (or not) the slackget10::Network Perl Module has been completely redesigned and will be largely recoded.
The changes are quite important and the API is completely new. It's now a front end module (like slackget10::Network::Connection is) and it aim at providing a unified interface for all kind of "protocol" implementation.
The idea is to answer the question : "what are you doing with an incoming network packet ?". The answer is simple : you decode it, you interpret it, you build the answer and you encode the answer before sending it.
Very well ! the new API behave exactly like that and you can test it with the last SVN revision of slack-get trunk (83) and the following code :
And to actually do the encoding and decoding part it rely on slackget10::Network::Backend::* class.
I already coded the slackget10::Network::Backend::XML backend and do not plan on coding other backends until I have decided how to implements secure connections.
I will work on tutorials/howto which will describes how to code network backends and add the support for new protocol for the slackget10::Network::Connection class.
See ya !
Arnaud Dupuis
Today I implemented the new slackget10::Network mechanism I wanted to. What is it you ask ?
Clearly something which will help everything to be super-easy to improve. As you may know (or not) the slackget10::Network Perl Module has been completely redesigned and will be largely recoded.
The changes are quite important and the API is completely new. It's now a front end module (like slackget10::Network::Connection is) and it aim at providing a unified interface for all kind of "protocol" implementation.
The idea is to answer the question : "what are you doing with an incoming network packet ?". The answer is simple : you decode it, you interpret it, you build the answer and you encode the answer before sending it.
Very well ! the new API behave exactly like that and you can test it with the last SVN revision of slack-get trunk (83) and the following code :
#!/usr/bin/perlI think it's quite a natural of of doing things. Of course, the sg10::Network class provide the interpret() method !
usestrict;
usewarnings;
useslackget10::Network;
my$net = new slackget10::Network ;
my$message = $net->decode('<?xml version="1.0" ?>'.
'<SlackGetProtocol version="1.0">'.
' <Enveloppe>'.
' <Action id="123456">get_connection_id</Action>'.
' </Enveloppe>'.
'</SlackGetProtocol>');
print$net->encode($message), "\n";
And to actually do the encoding and decoding part it rely on slackget10::Network::Backend::* class.
I already coded the slackget10::Network::Backend::XML backend and do not plan on coding other backends until I have decided how to implements secure connections.
I will work on tutorials/howto which will describes how to code network backends and add the support for new protocol for the slackget10::Network::Connection class.
See ya !
Arnaud Dupuis