-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.h
39 lines (34 loc) · 1.12 KB
/
main.h
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
36
37
38
39
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <time.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>
#include <openssl/err.h>
#import <objc/runtime.h>
#import <objc/message.h>
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import "KeyManager.h"
#define MAX_BACKOFF 256 // Maximum backoff time in seconds
// Global variables
char *serverIP;
char *serverPortStr;
NSString *privateKeyPath = @"/Library/PreferenceBundles/SkyglowNotificationsDaemonSettings.bundle/Keys/private_key.pem";
BOOL *isReachableWithoutRequiredConnection = NULL;
// Functions
int connectToServer(const char *serverIP, int port);
NSData *tlsDecrypt(NSData *inputData, NSString *privateKeyPath);
@interface NotificationDaemon : NSObject {
SCNetworkReachabilityRef _reachabilityRef;
}
- (void)startMonitoringNetworkReachability;
- (void)exponentialBackoffConnect;
- (void)scheduleLocalNotificationWithDecryptedMessage:(NSString *)decryptedMessage;
- (void)exponentialBackoffConnect;
@end