-
Notifications
You must be signed in to change notification settings - Fork 0
/
interface.py
48 lines (43 loc) · 986 Bytes
/
interface.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
class Connection(object):
def __init__(self,fd):
self.running = True
self.fd = fd
self.command_list = {"LIST":self.command_LIST,
"SIZE":self.command_SIZE,
"STORE":self.command_STORE,
"RETR":self.command_RETR,
"BYE":self.command_BYE
}
def command_LIST(self):
pass
def command_SIZE(self):
pass
def command_BYE(self):
pass
def command_STORE(self):
pass
def command_RETR(self):
pass
def sendmessage(self):
pass
def recv(self):
pass
def start(self):
pass
class Client(object):
def __init__(self):
super(Client, self).__init__()
self.command_list = {"STORE":self.handle_STORE,"RETR":self.handle_RETR}
def start(self):
pass
def recv(self):
pass
def parse_command(self,input_line):
if input_line:
input_line = [item.strip() for item in input_line.split()]
cmd,args = input_line[0],input_line[1:] if len(input_line) > 1 else []
return cmd,args
def handle_STORE(self):
pass
def handle_RETR(self):
pass