forked from zhaarey/wrapper
-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathmain.cpp
More file actions
28 lines (23 loc) · 653 Bytes
/
main.cpp
File metadata and controls
28 lines (23 loc) · 653 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
#include <cstdio>
#include <exception>
#include <functional>
extern "C" void handle(int fd);
extern "C" uint8_t handle_cpp(int fd) {
try {
handle(fd);
return 1;
} catch (const std::exception &e) {
fprintf(stderr, "[!] catched an exception: %s\n", e.what());
return 0;
}
}
static void endLeaseCb(int const &c) {
fprintf(stderr, "[.] end lease code %d\n", c);
exit(1);
}
static void pbErrCb(void *) {
fprintf(stderr, "[.] playback error\n");
exit(1);
}
extern "C" std::function<void (int const&)> endLeaseCallback(endLeaseCb);
extern "C" std::function<void (void *)> pbErrCallback(pbErrCb);