1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,31 @@ |
1 |
+#include <stdio.h> |
|
2 |
+#include <string.h> |
|
3 |
+#include <unistd.h> |
|
4 |
+#include <sys/types.h> |
|
5 |
+#include <sys/socket.h> |
|
6 |
+#include <sys/ioctl.h> |
|
7 |
+#include <linux/if.h> |
|
8 |
+#include <linux/if_packet.h> |
|
9 |
+#include <linux/if_ether.h> |
|
10 |
+#include <netinet/in.h> |
|
11 |
+#include <arpa/inet.h> |
|
12 |
+ |
|
13 |
+#ifndef __linux__ |
|
14 |
+ #pragma pack(push, 1) |
|
15 |
+#endif |
|
16 |
+struct ether_header |
|
17 |
+{ |
|
18 |
+ uint8_t ether_dhost[6]; /* destination eth addr */ |
|
19 |
+ uint8_t ether_shost[6]; /* source ether addr */ |
|
20 |
+ uint16_t ether_type; /* packet type ID field */ |
|
21 |
+} |
|
22 |
+#ifndef __linux__ |
|
23 |
+ ; |
|
24 |
+ #pragma pack(pop) |
|
25 |
+#else |
|
26 |
+__attribute__ ((__packed__)); |
|
27 |
+#endif |
|
28 |
+ |
|
29 |
+int send_wol(const char *interface, unsigned char *buf, int len); |
|
30 |
+void make_wol_packet(char *buf, const char *dstmac); |
|
31 |
+void make_ether_packet(char *buf, const char *dstmac); |