Fix handling of html inside text messages in server. Add some protocol documentation.

This commit is contained in:
Maurizio Porrato 2010-08-25 21:33:57 +02:00
parent 5f63670043
commit b8414dc391
2 changed files with 56 additions and 2 deletions

View File

@ -2,7 +2,7 @@ The FreeRadioNetwork protocol
=============================
This document describes the results of reverse-engeneering the official
set of [FreeRadioNetwork](http//freeradionetwork.eu) programs through
set of [FreeRadioNetwork](http://freeradionetwork.eu) programs through
network traffic sniffing and software decompilation.
@ -113,6 +113,56 @@ Padding to five digits we would get `03046`, so D=0, E=3, F=0, G=4, H=6
so the auth code wold be `40063`.
### Keepalive ###
After the communication between client and server has been established,
server starts sending keepalive messages to the client at a rate of two
messages per second.
The keepalive message, as any other server to client message must be
acknowledged by the client.
Server to client:
* chr(0): keepalive message identifier
Client to server:
* P\r\n
### Sending audio signal ###
Sending audio signal from client to server is a two-step procedure:
client must request permission to trasmit to the server and then, if
server acknowledges, client can start transmitting audio data.
Client to server:
* TX0\r\n
Server to client:
* chr(1)+chr(hh)+chr(ll): transmission acknowledged (hh*256+ll is the
client index in client list)
Client to server:
* TX1\r\n followed by 325 bytes: data following the first line
contains 10 GSM 6.10 frames (representing 20mS of audio signal each one)
encoded with WAV#49 variant.
Client to server:
* RX0\r\n: clients stops transmitting audio.
### Receiving audio signal ###
Server to client:
* chr(2)+chr(hh)+chr(ll) followed by 325 bytes: data following the first
3 bytes contains 10 GSM 6.10 frames (representing 20mS of audio signal
each one) encoded with WAV#49 variant. hh*256+ll represents the index in
the client list of the client sending audio.

View File

@ -32,7 +32,11 @@ class SimpleXMLParser(HTMLParser):
self.next_field = tag
self.next_data = ''
else:
self.next_data += "<%s>" % tag
if attrs:
a = ' '+' '.join(['%s="%s"' % (k,v) for k,v in attrs])
else:
a = ''
self.next_data += "<%s%s>" % (tag,a)
def handle_data(self, data):
if self.next_field is not None: