#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "HTTPServer.h"
#import "HTTPConnection.h"
#import "HTTPResponse.h"
#import "TuneParser.h"

@interface WebServerController : UIViewController
{
  IBOutlet UILabel *urlLabel;
	IBOutlet UIActivityIndicatorView *activityIndicator;
	IBOutlet UILabel *activityLabel;
  
  BOOL isServing;

	HTTPServer *httpServer;
}

- (IBAction)stopWebServer:(id)sender;

- (IBAction) onStart:(id)sender;
- (IBAction) onStop:(id)sender;

- (void)startServer;
- (void)stopServer;
- (void)startedReceiving:(id)sender;
- (void)stoppedReceiving:(id)sender;

@end

@interface TunebookHTTPConnection : HTTPConnection <TuneParserDelegate>
{
	int dataStartIndex;
	NSMutableArray* multipartData;
	BOOL postHeaderOK;
  TuneParser *parser;
  int numTunes;
}

- (BOOL)supportsPOST:(NSString *)path withSize:(UInt64)contentLength;

- (void) parsedTune:(TuneParser *)parser tune:(Tune *)tune;

@end
