Browse Source

Add parrot masking feature in remote manager connector. Add some protocol documentation.

Maurizio Porrato 8 years ago
parent
commit
bd3197dc56
2 changed files with 65 additions and 10 deletions
  1. 53
    7
      docs/protocols.markdown
  2. 12
    3
      frn/manager/remote.py

+ 53
- 7
docs/protocols.markdown View File

@@ -123,11 +123,11 @@ acknowledged by the client.
123 123
 
124 124
 Server to client:
125 125
 
126
-* chr(0): keepalive message identifier
126
+* `chr(0)`: keepalive message identifier
127 127
 
128 128
 Client to server:
129 129
 
130
-* P\r\n
130
+* `P\r\n`
131 131
 
132 132
 
133 133
 ### Sending audio signal ###
@@ -138,31 +138,77 @@ server acknowledges, client can start transmitting audio data.
138 138
 
139 139
 Client to server:
140 140
 
141
-* TX0\r\n
141
+* `TX0\r\n`
142 142
 
143 143
 Server to client:
144 144
 
145
-* chr(1)+chr(hh)+chr(ll): transmission acknowledged (hh*256+ll is the
145
+* `chr(1)chr(hh)chr(ll)`: transmission acknowledged (hh*256+ll is the
146 146
 client index in client list)
147 147
 
148 148
 Client to server:
149 149
 
150
-* TX1\r\n followed by 325 bytes: data following the first line
150
+* `TX1\r\n` followed by 325 bytes: data following the first line
151 151
 contains 10 GSM 6.10 frames (representing 20mS of audio signal each one)
152 152
 encoded with WAV#49 variant.
153 153
 
154 154
 Client to server:
155 155
 
156
-* RX0\r\n: clients stops transmitting audio.
156
+* `RX0\r\n`: client stops transmitting audio.
157 157
 
158 158
 
159 159
 ### Receiving audio signal ###
160 160
 
161 161
 Server to client:
162 162
 
163
-* chr(2)+chr(hh)+chr(ll) followed by 325 bytes: data following the first
163
+* `chr(2)chr(hh)chr(ll)` followed by 325 bytes: data following the first
164 164
 3 bytes contains 10 GSM 6.10 frames (representing 20mS of audio signal
165 165
 each one) encoded with WAV#49 variant. hh*256+ll represents the index in
166 166
 the client list of the client sending audio.
167 167
 
168 168
 
169
+### Sending text messages ###
170
+
171
+Client to server:
172
+
173
+* `TM:<ID>clientId</ID><MS>Message body</MS>\r\n`: Sends "Message body"
174
+to client having id "clientId". If clientId is an empty string,
175
+message is sent to all clients on the same network, including the
176
+message sender.
177
+
178
+
179
+### Receiving text messages ###
180
+
181
+Server to client:
182
+
183
+* `chr(4)` followed by 3-lines message: incoming message first line
184
+contains the sender ID, second line the message body, third line the
185
+message type: "A" for network messages or "P" for messages directed to a
186
+single client.
187
+
188
+
189
+### Receiving client list ###
190
+
191
+Server to client:
192
+
193
+* `chr(3)` followed by a multiline message: each line contains a client
194
+description in an XML-like format containing the following fields:
195
+
196
+ * **S**: Client status: 0=Available, 1=Not available, 2=Absent
197
+ * **M**: Client mute status: 0=Not muted, 1=Muted
198
+ * **NN**: Same as in authetication procedure
199
+ * **CT**: Same as in authetication procedure
200
+ * **BC**: Same as in authetication procedure
201
+ * **ON**: Same as in authetication procedure
202
+ * **ID**: Client ID (assigned to the client by the system manager
203
+through the server during the authentication phase)
204
+ * **DS**: Same as in authetication procedure
205
+
206
+
207
+### Receiving network list ###
208
+
209
+Server to client:
210
+
211
+* `chr(5)` followed by a multiline message: each line contains the name
212
+of a network.
213
+
214
+

+ 12
- 3
frn/manager/remote.py View File

@@ -40,10 +40,11 @@ class RemoteManager(object):
40 40
 
41 41
     implements(IManager)
42 42
 
43
-    def __init__(self, reactor, server='frn.no-ip.info', port=10025):
43
+    def __init__(self, reactor, server='frn.no-ip.info', port=10025, maskParrot=True):
44 44
         self.reactor = reactor
45 45
         self.server = server
46 46
         self.port = port
47
+        self.maskParrot = maskParrot
47 48
         self.factory = None
48 49
 
49 50
     def doConnect(self):
@@ -59,10 +60,18 @@ class RemoteManager(object):
59 60
             return self.factory.client.sendServerLogout(user)
60 61
 
61 62
     def clientLogin(self, user):
62
-        return self.factory.client.sendClientLogin(user)
63
+        if self.maskParrot and user.BC == 'Parrot':
64
+            u = user.copy(BC='PC Only')
65
+        else:
66
+            u = user.copy()
67
+        return self.factory.client.sendClientLogin(u)
63 68
 
64 69
     def clientLogout(self, user):
65
-        return self.factory.client.sendClientLogout(user)
70
+        if self.maskParrot and user.BC == 'Parrot':
71
+            u = user.copy(BC='PC Only')
72
+        else:
73
+            u = user.copy()
74
+        return self.factory.client.sendClientLogout(u)
66 75
 
67 76
     def getClientList(self):
68 77
         return self.factory.client.getClientList()

Loading…
Cancel
Save