-
Notifications
You must be signed in to change notification settings - Fork 1
/
other_module.cc
50 lines (38 loc) · 1.12 KB
/
other_module.cc
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
40
41
42
43
44
45
46
47
48
49
50
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <iostream>
#include "Minet.h"
int main(int argc, char *argv[])
{
MinetHandle mux;
MinetInit(MINET_OTHER_MODULE);
mux=MinetIsModuleInConfig(MINET_ETHERNET_MUX) ? MinetConnect(MINET_ETHERNET_MUX) : MINET_NOHANDLE;
if (mux==MINET_NOHANDLE && MinetIsModuleInConfig(MINET_ETHERNET_MUX)) {
MinetSendToMonitor(MinetMonitoringEvent("Can't connect to ethermux"));
return -1;
}
cerr << "other_module: handling non-IP, non-ARP traffic\n";
MinetSendToMonitor(MinetMonitoringEvent("other_module: handling non-IP, non-ARP traffic"));
MinetEvent event;
while (MinetGetNextEvent(event)==0) {
if (event.eventtype!=MinetEvent::Dataflow
|| event.direction!=MinetEvent::IN) {
MinetSendToMonitor(MinetMonitoringEvent("Unknown event ignored."));
} else {
if (event.handle==mux) {
RawEthernetPacket raw;
MinetReceive(mux,raw);
cerr << raw << endl;
}
}
}
return 0;
}