-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclient.c
executable file
·57 lines (48 loc) · 1.62 KB
/
client.c
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
51
52
53
54
55
56
57
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/netdevice.h>
#include <linux/init.h>
#include <linux/etherdevice.h>
#include <linux/if_ether.h>
#include <linux/pkt_sched.h>
#include <linux/kthread.h>
#include <asm/errno.h>
#include <linux/fs.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <asm/uaccess.h>
extern int dht_insert(uint8_t app, void* key, uint8_t key_size, void* data, uint8_t data_size);
extern int dht_remove(uint8_t app, void* key, uint8_t key_size);
extern int dht_retrive(uint8_t app, void* key, uint8_t key_size, void* data);
int __init init_module(){
char data[256];
char key[256];
#define _ARP_ 10
#define _RARP_ 20
strcpy(key, "192.168.0.153");
strcpy(data, "00:aa:bb:dd:ee:ff");
dht_insert(_ARP_, key, strlen(key), data, strlen(data));
strcpy(key, "192.168.0.1");
strcpy(data, "ee:ff:aa:dd:33:22");
dht_insert(_ARP_, key, strlen(key), data, strlen(data));
strcpy(key, "192.168.0.254");
strcpy(data, "aa:bb:cc:cc:bb:aa");
dht_insert(_ARP_, key, strlen(key), data, strlen(data));
strcpy(data, "192.168.0.153\0");
strcpy(key, "00:aa:bb:dd:ee:ff\0");
dht_insert(_RARP_, key, strlen(key), data, strlen(data));
strcpy(data, "192.168.0.1\0");
strcpy(key, "ee:ff:aa:dd:33:22\0");
dht_insert(_RARP_, key, strlen(key), data, strlen(data));
strcpy(data, "192.168.0.254");
strcpy(key, "aa:bb:cc:cc:bb:aa");
dht_insert(_RARP_, key, strlen(key), data, strlen(data));
strcpy(key, "192.168.0.153");
strcpy(data, "");
dht_retrive(_ARP_, key, strlen(key), data);
printk("Got data %s for key %s\n", data, key);
return 0;
}
void cleanup_module(){
}