Mercurial > projects > dreactor
comparison dreactor/protocol/IProvider.d @ 13:8c9b1276f623 default tip
bug fixes
author | rick@minifunk |
---|---|
date | Sat, 20 Sep 2008 18:33:11 -0400 |
parents | d6a3cfe7c3de |
children |
comparison
equal
deleted
inserted
replaced
12:d6a3cfe7c3de | 13:8c9b1276f623 |
---|---|
1 module dreactor.protocol.IProvider; | 1 module dreactor.protocol.IProvider; |
2 | 2 |
3 class Message | 3 import tango.io.selector.model.ISelector; |
4 import tango.io.device.Conduit; | |
5 | |
6 struct Message | |
4 { | 7 { |
5 public | 8 public |
9 | |
6 int type; | 10 int type; |
7 int info; | 11 int info; |
8 Object payload; | 12 void* payload; |
9 this (Object buf, int t, int e) | 13 int from; |
14 bool valid; | |
15 | |
16 static Message opCall(void* buf, int t, int e, int f = 0) | |
10 { | 17 { |
11 type = t; | 18 Message m; |
12 info = e; | 19 m.type = t; |
13 payload = buf; | 20 m.info = e; |
21 m.from = f; | |
22 m.payload = buf; | |
23 m.valid = true; | |
24 return m; | |
14 } | 25 } |
15 } | 26 } |
16 | 27 |
17 interface IProvider | 28 interface IProvider |
18 { | 29 { |
19 Message handleRead(Conduit c); | 30 Message handleRead(); |
20 Message handleWrite(Conduit c); | 31 Message handleWrite(); |
21 Message handleError(Conduit c); | 32 Message handleError(); |
22 Message handleConnect(Conduit c); | 33 Message handleConnect(); |
23 Message handleDisconnect(Conduit c); | 34 Message handleDisconnect(); |
24 abstract void send(char []); | 35 void send(char []); |
25 | 36 void setRegisterFunc(bool delegate (Event)); |
26 Conduit getConduit(); | 37 Conduit getConduit(); |
27 int getEvents(); | 38 Event getEvents(); |
28 void setEvents(); | 39 void setEvents(Event e); |
29 } | 40 } |