initial commit
[rofl0r-KOL.git] / KOLIndy / myindy / IdIntercept.pas
bloba440e3611476fd8c5e2f03b45e14ab5c5a7e4345
1 // 25-nov-2002
2 unit IdIntercept;
4 interface
6 uses KOL { ,
7 Classes } ,
8 IdBaseComponent, IdSocketHandle;
10 type
11 PIdConnectionIntercept=^TIdConnectionIntercept;
12 PIdServerIntercept=^TIdServerIntercept;
13 TIdConnectionIntercept = object(TIdBaseComponent)
14 protected
15 FBinding: PIdSocketHandle;//TIdSocketHandle;
16 FOnConnect: TOnEvent;//TNotifyEvent;
17 FRecvHandling: Boolean;
18 FSendHandling: Boolean;
19 FIsClient: Boolean;
20 public
21 procedure Connect(ABinding: PIdSocketHandle{TIdSocketHandle}); virtual;
22 procedure DataReceived(var ABuffer; const AByteCount: integer); virtual;
23 procedure DataSent(var ABuffer; const AByteCount: integer); virtual;
24 procedure Disconnect; virtual;
25 function Recv(var ABuf; ALen: Integer): Integer; virtual;
26 function Send(var ABuf; ALen: Integer): Integer; virtual;
28 property Binding: PIdSocketHandle{TIdSocketHandle} read FBinding;
29 property IsClient: Boolean read FIsClient;
30 property RecvHandling: boolean read FRecvHandling;
31 property SendHandling: boolean read FSendHandling;
32 { published }
33 property OnConnect: TOnEvent{TNotifyEvent} read FOnConnect write FOnConnect;
34 end;
35 //PIdConnectionIntercept=^TIdConnectionIntercept;
37 TIdServerIntercept = object(TIdBaseComponent)
38 public
39 procedure _Init; virtual; abstract;
40 function Accept(ABinding: PIdSocketHandle{TIdSocketHandle}): PIdConnectionIntercept{TIdConnectionIntercept}; virtual;
41 abstract;
42 end;
43 //PdConnectionIntercept=^IdConnectionIntercept;
44 //PIdServerIntercept^=TIdServerIntercept;
46 function NewIdConnectionIntercept:PIdConnectionIntercept;
47 function NewIdServerIntercept:PIdServerIntercept;
49 implementation
51 function NewIdConnectionIntercept:PIdConnectionIntercept;
52 begin
53 New( Result, Create );
54 end;
56 function NewIdServerIntercept:PIdServerIntercept;
57 begin
58 New( Result, Create );
59 end;
61 procedure TIdConnectionIntercept.Disconnect;
62 begin
63 FBinding := nil;
64 end;
66 procedure TIdConnectionIntercept.DataReceived(var ABuffer; const AByteCount:
67 integer);
68 begin
69 end;
71 function TIdConnectionIntercept.Recv(var ABuf; ALen: Integer): Integer;
72 begin
73 result := 0;
74 end;
76 function TIdConnectionIntercept.Send(var ABuf; ALen: Integer): Integer;
77 begin
78 result := 0;
79 end;
81 procedure TIdConnectionIntercept.DataSent(var ABuffer; const AByteCount:
82 integer);
83 begin
84 end;
86 procedure TIdConnectionIntercept.Connect(ABinding: PIdSocketHandle{TIdSocketHandle});
87 begin
88 FBinding := ABinding;
89 if assigned(FOnConnect) then
90 begin
91 FOnConnect(@Self);
92 end;
93 end;
95 end.