created bt_comm directory for test framework (client, server)
authorAdriana Draghici <adriana008@gmail.com>
Tue, 26 Jan 2010 09:34:23 +0000 (11:34 +0200)
committerAdriana Draghici <adriana008@gmail.com>
Tue, 26 Jan 2010 09:34:40 +0000 (11:34 +0200)
bt_comm/PROTOCOL [new file with mode: 0644]
bt_comm/Util.py [new file with mode: 0644]
bt_comm/server/Client.py [moved from server/Client.py with 100% similarity]
bt_comm/server/PROTOCOL [new file with mode: 0644]
bt_comm/server/Server.py [moved from server/Server.py with 78% similarity]
bt_comm/server/Util.py [new file with mode: 0644]
bt_comm/server/daemon.py [moved from server/daemon.py with 100% similarity]
server/Util.py [deleted file]

diff --git a/bt_comm/PROTOCOL b/bt_comm/PROTOCOL
new file mode 100644 (file)
index 0000000..cc11eb8
--- /dev/null
@@ -0,0 +1,16 @@
+
+Comunicare Client <-> Server
+
+1. Step 1
+  - informatiile legate de clienti
+  - msg 1: tipul mesajului: CONFIG_MSG (definit in Util.py)
+  - msg 2: lista de dictionare cu datele din clients.xml
+       exp: [{CLIENT:"tribler", FILE:"Tribler/Tools/cmdline.py",
+               RUN_TYPE:"script",
+               INTERPRETER:"python", PREFIX:"PYTHONPATH=.",SUFFIX:"",
+               UP_LIMIT_OPTION:"",DL_LIMIT_OPTION:"", PORT_OPTION:"-p",
+               LOG_DIR_OPTION:"-l",DL_DIR_OPTION:"-d"}]        
+
+2. Mesaje START
+
+.....
diff --git a/bt_comm/Util.py b/bt_comm/Util.py
new file mode 100644 (file)
index 0000000..c844044
--- /dev/null
@@ -0,0 +1,23 @@
+
+#!/usr/bin/env python
+
+""" Message types: client -> server """
+
+CONFIG_MSG = "0";
+START_MSG = "1";
+STOP_MSG = "2";
+STATUS_MSG = "3";
+
+
+# xml tags from clients.xml
+CLIENT = "client"
+FILE = "file"
+RUN_TYPE = "run type"
+INTERPRETER = "interpreter"
+PREFIX = "prefix"
+SUFFIX = "suffix"
+UP_LIMIT_OPTION = "upload_limit_option"
+DL_LIMIT_OPTION = "download_limit_option"
+PORT_OPTION = "port_option"
+LOG_DIR_OPTION = "logging_dir_option"
+DL_DIR_OPTION = "download_dir_option"
similarity index 100%
rename from server/Client.py
rename to bt_comm/server/Client.py
diff --git a/bt_comm/server/PROTOCOL b/bt_comm/server/PROTOCOL
new file mode 100644 (file)
index 0000000..cc11eb8
--- /dev/null
@@ -0,0 +1,16 @@
+
+Comunicare Client <-> Server
+
+1. Step 1
+  - informatiile legate de clienti
+  - msg 1: tipul mesajului: CONFIG_MSG (definit in Util.py)
+  - msg 2: lista de dictionare cu datele din clients.xml
+       exp: [{CLIENT:"tribler", FILE:"Tribler/Tools/cmdline.py",
+               RUN_TYPE:"script",
+               INTERPRETER:"python", PREFIX:"PYTHONPATH=.",SUFFIX:"",
+               UP_LIMIT_OPTION:"",DL_LIMIT_OPTION:"", PORT_OPTION:"-p",
+               LOG_DIR_OPTION:"-l",DL_DIR_OPTION:"-d"}]        
+
+2. Mesaje START
+
+.....
similarity index 78%
rename from server/Server.py
rename to bt_comm/server/Server.py
index b1a1f70..f7348da 100644 (file)
@@ -18,6 +18,8 @@ WAITING_START_DATA = 3
 WAITING_STOP_DATA = 4
 WAITING_STATUS_DATA = 5
 
+clients_data = []
+
 
 def recv_pickled_data(clientsock):
 #      while chunk:            
@@ -36,8 +38,7 @@ def doServer():
 
        while(1):
                (clientsock, address) = serversocket.accept();
-               
-               """ draft
+               """ DRAFT
                if clientsock not in states:
                        states[clientsock] = WAITING_MSG_TYPE;
                
@@ -48,28 +49,35 @@ def doServer():
                                states[clientsock] = WAITING_CONFIG_DATA;
                                
                        else if msg == Util.START_MSG:
-                               states[clientsock] = WAITING_CONFIG_DATA;
+                               states[clientsock] = WAITING_START_DATA;
 
                        else if msg == Util.STOP_MSG:
-                               states[clientsock] = WAITING_CONFIG_DATA;
+                               states[clientsock] = WAITING_STOP_DATA;
 
                        else if msg == Util.STATUS_MSG:
-                               states[clientsock] = WAITING_CONFIG_DATA;
+                               states[clientsock] = WAITING_STATUS_DATA;
                        
                        else 
                                clientsock.send("error: wrong message type " + msg)
                
                else: 
                        if states[clientsock] == WAITING_CONFIG_DATA:
-                               config = recv_pickled_data(clientsock)
+                               config_data = recv_pickled_data(clientsock)
                        
+                       if states[clientsock] == WAITING_START_DATA:
+                               config = recv_pickled_data(clientsock)
 
+                       if states[clientsock] == WAITING_STOP_DATA:
+                               config = recv_pickled_data(clientsock)
+                       
+                       if states[clientsock] == WAITING_STATUS_DATA:
+                               config = recv_pickled_data(clientsock)
+                       
                        states[clientsock] = WAITING_MSG_TYPE
                """
 
-
-               #clientsock.recv(BUFFER_SIZE)
-               recv_pickled_data(clientsock)
+               # clientsock.recv(BUFFER_SIZE)
+               # recv_pickled_data(clientsock)
                clientsock.send("ACK")
 
        clientsock.close()      
diff --git a/bt_comm/server/Util.py b/bt_comm/server/Util.py
new file mode 100644 (file)
index 0000000..c844044
--- /dev/null
@@ -0,0 +1,23 @@
+
+#!/usr/bin/env python
+
+""" Message types: client -> server """
+
+CONFIG_MSG = "0";
+START_MSG = "1";
+STOP_MSG = "2";
+STATUS_MSG = "3";
+
+
+# xml tags from clients.xml
+CLIENT = "client"
+FILE = "file"
+RUN_TYPE = "run type"
+INTERPRETER = "interpreter"
+PREFIX = "prefix"
+SUFFIX = "suffix"
+UP_LIMIT_OPTION = "upload_limit_option"
+DL_LIMIT_OPTION = "download_limit_option"
+PORT_OPTION = "port_option"
+LOG_DIR_OPTION = "logging_dir_option"
+DL_DIR_OPTION = "download_dir_option"
similarity index 100%
rename from server/daemon.py
rename to bt_comm/server/daemon.py
diff --git a/server/Util.py b/server/Util.py
deleted file mode 100644 (file)
index 289e417..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-
-#!/usr/bin/env python
-
-""" Message types: client -> server """
-
-CONFIGURE_MSG = "0";
-START_MSG = "1";
-STOP_MSG = "2";
-STATUS_MSG = "3";
-
-
-