3 * Copyright (c) 2007 - 2011, Blue Static <http://www.bluestatic.org>
5 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
6 * General Public License as published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
10 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along with this program; if not,
14 * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
17 #import <Cocoa/Cocoa.h>
19 #import "ProtocolClient.h"
21 @protocol NetworkConnectionDelegate
;
22 @
class LoggingController
;
24 // This class is the lowest level component to the network. It deals with all
25 // the intricacies of network and stream programming. Almost all the work this
26 // class does is on a background thread, which is created when the connection is
27 // asked to connect and shutdown when asked to close.
28 @interface NetworkConnection
: ProtocolClient
<ProtocolClientDelegate
>
30 // The port to connect on.
33 ProtocolClient
* _ideClient
;
35 // If the connection to the debugger engine is currently active.
38 // The delegate. All methods are executed on the main thread.
39 NSObject
<NetworkConnectionDelegate
>* delegate_
;
42 @
property (readonly
) NSUInteger port
;
43 @
property (readonly
) BOOL connected
;
44 @
property (assign
) id
<NetworkConnectionDelegate
> delegate
;
46 - (id
)initWithPort
:(NSUInteger
)aPort
;
51 - (NSString
*)escapedURIPath
:(NSString
*)path
;
55 // Delegate ////////////////////////////////////////////////////////////////////
57 @protocol NetworkConnectionDelegate
<NSObject
>
61 - (void)connectionDidAccept
:(NetworkConnection
*)cx
;
62 - (void)connectionDidClose
:(NetworkConnection
*)cx
;
64 - (void)handleInitialResponse
:(NSXMLDocument
*)response
;
66 - (void)handleResponse
:(NSXMLDocument
*)response
;
68 - (void)errorEncountered
:(NSString
*)error
;