forked from mikeash/MAAsyncIO
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMAAsyncHTTPServer.h
More file actions
35 lines (27 loc) · 1008 Bytes
/
MAAsyncHTTPServer.h
File metadata and controls
35 lines (27 loc) · 1008 Bytes
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
//
// MAAsyncHTTPServer.h
// MAAsyncIO
//
// Created by Michael Ash on 12/9/10.
// Copyright 2010 Michael Ash. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "MAHTTPRequest.h"
#import "MAAsyncWriter.h"
@class MAAsyncSocketListener;
extern NSString *const defaultRequestRoute;
extern char *const defaultHTTPHeaderBodySeparator;
typedef void (^MAAsyncHTTPRequestHandler)(MAHTTPRequest *request, MAAsyncWriter *writer);
@interface MAAsyncHTTPServer : NSObject
{
MAAsyncSocketListener *_listener;
NSMutableArray *_routes;
dispatch_queue_t _routesQueue;
}
- (id)initWithPort: (int)port error: (NSError **)error;
- (void)registerDefaultRouteHandler: (MAAsyncHTTPRequestHandler)block;
- (void)registerRoute: (NSString *)route method: (MAHTTPMethod)method handler: (MAAsyncHTTPRequestHandler)block;
- (void)unregisterRoute: (NSString *)route method: (MAHTTPMethod)method;
- (MAAsyncHTTPRequestHandler)registeredRoute:(NSString *)route method: (MAHTTPMethod)method;
- (int)port;
@end