2018-07-13 06:30:16 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <dispatch/dispatch.h>
|
2018-09-18 15:39:32 +00:00
|
|
|
#include <memory.h>
|
2018-07-13 06:30:16 +00:00
|
|
|
|
|
|
|
#include <Cocoa/Cocoa.h>
|
|
|
|
#import <AppKit/AppKit.h>
|
|
|
|
|
2018-09-18 15:39:32 +00:00
|
|
|
#ifdef __cplusplus
|
2018-09-20 03:20:39 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
2018-07-13 06:30:16 +00:00
|
|
|
|
2018-09-20 02:38:44 +00:00
|
|
|
const std::vector<NSString*> defaultStartupFlags {
|
|
|
|
@"-Xmx512M",
|
|
|
|
@"-Xms128m",
|
|
|
|
@"-Djava.awt.headless=true",
|
|
|
|
@"-Dwrapper.logfile=/tmp/router.log",
|
|
|
|
@"-Dwrapper.logfile.loglevel=DEBUG",
|
|
|
|
@"-Dwrapper.java.pidfile=/tmp/routerjvm.pid",
|
|
|
|
@"-Dwrapper.console.loglevel=DEBUG"
|
|
|
|
};
|
|
|
|
|
|
|
|
const std::vector<std::string> defaultFlagsForExtractorJob {
|
|
|
|
"-Xmx512M",
|
|
|
|
"-Xms128m",
|
|
|
|
"-Djava.awt.headless=true"
|
|
|
|
};
|
2018-07-24 16:26:40 +00:00
|
|
|
|
2018-09-18 15:39:32 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
@class RTaskOptions;
|
|
|
|
@interface RTaskOptions : NSObject
|
|
|
|
@property (strong) NSString* binPath;
|
|
|
|
@property (strong) NSArray<NSString *>* arguments;
|
|
|
|
@property (strong) NSString* i2pBaseDir;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@class I2PRouterTask;
|
|
|
|
@interface I2PRouterTask : NSObject
|
|
|
|
@property (strong) NSTask* routerTask;
|
|
|
|
@property (strong) NSUserDefaults *userPreferences;
|
|
|
|
@property (strong) NSFileHandle *readLogHandle;
|
|
|
|
@property (strong) NSMutableData *totalLogData;
|
|
|
|
@property (strong) NSPipe *processPipe;
|
|
|
|
@property (strong) NSFileHandle *input;
|
|
|
|
@property (atomic) BOOL isRouterRunning;
|
|
|
|
@property (atomic) BOOL userRequestedRestart;
|
|
|
|
- (instancetype) initWithOptions : (RTaskOptions*) options;
|
|
|
|
- (int) execute;
|
|
|
|
- (void) requestShutdown;
|
|
|
|
- (void) requestRestart;
|
|
|
|
- (BOOL) isRunning;
|
|
|
|
- (int) getPID;
|
|
|
|
- (void)routerStdoutData:(NSNotification *)notification;
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-13 06:30:16 +00:00
|
|
|
|