source: launchers/macosx/RouterTask.h @ f76874a

Last change on this file since f76874a was f76874a, checked in by meeh <meeh@…>, 2 years ago

Adding XCode workspace & Xcode project, and some files missing from last commit.

Please note that Xcode project embedds the packing script (meaning it runs "ant" - zip files, and moves it to bundle)

  • Property mode set to 100644
File size: 1.8 KB
Line 
1#pragma once
2
3#include <dispatch/dispatch.h>
4#include <memory.h>
5#include <string.h>
6
7#include <Cocoa/Cocoa.h>
8#import <AppKit/AppKit.h>
9
10#ifdef __cplusplus
11#include "include/subprocess.hpp"
12
13using namespace subprocess;
14class JavaRunner;
15
16typedef std::function<void(void)> fp_t;
17typedef std::function<void(JavaRunner *ptr)> fp_proc_t;
18
19
20
21/**
22 *
23 * class JavaRunner
24 *
25 **/
26class JavaRunner
27{
28public:
29  // copy fn
30  JavaRunner(std::string& javaBin, std::string& arguments, std::string& i2pBaseDir, const fp_proc_t& executingFn, const fp_t& cb);
31  ~JavaRunner() = default;
32 
33  static const std::vector<NSString*> defaultStartupFlags;
34  static const std::vector<std::string> defaultFlagsForExtractorJob;
35 
36  void requestRouterShutdown();
37 
38  std::future<int> execute();
39  std::shared_ptr<subprocess::Popen> javaProcess;
40  std::string javaBinaryPath;
41  std::string javaRouterArgs;
42  std::string execLine;
43  std::string _i2pBaseDir;
44private:
45  const fp_proc_t& executingFn;
46  const fp_t& exitCallbackFn;
47};
48
49#endif
50
51
52@class RTaskOptions;
53@interface RTaskOptions : NSObject
54@property (strong) NSString* binPath;
55@property (strong) NSArray<NSString *>* arguments;
56@property (strong) NSString* i2pBaseDir;
57@end
58
59@class I2PRouterTask;
60@interface I2PRouterTask : NSObject
61@property (strong) NSTask* routerTask;
62@property (strong) NSUserDefaults *userPreferences;
63@property (strong) NSFileHandle *readLogHandle;
64@property (strong) NSMutableData *totalLogData;
65@property (strong) NSPipe *processPipe;
66@property (strong) NSFileHandle *input;
67@property (atomic) BOOL isRouterRunning;
68@property (atomic) BOOL userRequestedRestart;
69- (instancetype) initWithOptions : (RTaskOptions*) options;
70- (int) execute;
71- (void) requestShutdown;
72- (void) requestRestart;
73- (BOOL) isRunning;
74- (int) getPID;
75- (void)routerStdoutData:(NSNotification *)notification;
76@end
77
78
79
80
81
82
Note: See TracBrowser for help on using the repository browser.