-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathKMSConnection.h
86 lines (52 loc) · 1.86 KB
/
KMSConnection.h
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//
// Created by Sam Deane on 06/11/2012.
// Copyright 2012 Karelia Software. All rights reserved.
//
#import <Foundation/Foundation.h>
@class KMSServer;
@class KMSResponder;
/**
Object which uses the supplied KMSResponder to respond to incoming data on a given socket.
*/
@interface KMSConnection : NSObject<NSStreamDelegate>
/**
Return a new connection on a given socket.
@param socket The system socket to respond on.
@param responder A KMSResponder object which is responsible for receiving input and responding to it.
@param server The server which received the original connection.
@return A new connection.
*/
+ (KMSConnection*)connectionWithSocket:(int)socket responder:(KMSResponder*)responder server:(KMSServer*)server;
/**
Return a new connection on a given socket.
@param socket The system socket to respond on.
@param responder A KMSResponder object which is responsible for receiving input and responding to it.
@param server The server which received the original connection.
@return A new connection.
*/
- (id)initWithSocket:(int)socket responder:(KMSResponder*)responder server:(KMSServer*)server;
/**
Open the connection.
Called by the server once it's added the connection to it's list.
*/
- (void)open;
/**
Close the connection.
Generally only called by the KMSCloseCommand.
*/
- (void)close;
/**
Disconnect the streams we're managing.
*/
- (void)cancel;
/**
Append some data to the connection's output buffer.
The connection will attempt to send the contents of the buffer immediately,
but won't necessarily manage to send it all at once. The rest will be send automatically
when the connection is ready for it.
Commands (such as KMSSendDataCommand or KMSSendStringCommand) use this
to queue up their output.
@param output The data to append to the output buffer.
*/
- (void)appendOutput:(NSData*)output;
@end