-
Notifications
You must be signed in to change notification settings - Fork 0
/
tester3.c
92 lines (64 loc) · 2.16 KB
/
tester3.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#include "./testing.c"
int testConnection(void){
if( init_listener() !=0) return 0;
if(get_basic_info() != 0) return 0;
if(connect_me() != 0) return 0;
test2();
while(1){
int pos = receive_it();
if(pos <0) return 0;
if(pos > 0){
if(isMessage(message)){
switch(getType(message)){
case PUBLISH:
printf("\n \n \n");
show_time();
printf("MESSAGE ALP Publish Message SOURCE IP: %s \n",ip_address);
analyseReceivedPublishBySubscriber(message);
break;
default:
break;
}
}
}
}
}
int main(void){
createListNodes();
addWord("kategorie",0);
addWord("mieszkanie",512);
addWord("salon",513);
addWord("okno1",514);
addWord("kuchenka",515);
addWord("lampa",516);
addWord("sypialnia",517);
addWord("osoby",518);
addWord("Antek",519);
addWord("Kajtek",520);
addWord("roleta",521);
mainTree = emptyBranch(32767);
addNodePath("/mieszkanie/salon=0");
addNodePath("/mieszkanie/salon/okno1=0");
addNodePath("/mieszkanie/salon/okno1/roleta+0");
addNodePath("/mieszkanie/salon/kuchenka=0");
addNodePath("/mieszkanie/salon/lampa+0");
addNodePath("/mieszkanie/sypialnia=0");
addNodePath("/mieszkanie/sypialnia/lampa+0");
addNodePath("/osoby/Antek=0");
addNodePath("/osoby/Antek=0");
addNodePath("/osoby/Antek/roleta+0");
addNodePath("/osoby/Antek/lampa+0");
addNodePath("/osoby/Kajtek=0");
addNodePath("/osoby/Kajtek/lampa+0");
printf("================================================ \n");
printf(" Main Tree: \n");
printf("------------------------------------------------ \n");
printBranch(mainTree,0);
printf("\n Init subscriber ... \n");
testConnection();
killServicesList(serviceSet);
killSubscriberList();
killNodesList();
killSelectedItems();
killDict();
}