author | mjm <mjm> | 2002-12-27 16:35:28 (UTC) |
---|---|---|
committer | mjm <mjm> | 2002-12-27 16:35:28 (UTC) |
commit | 3cb928900ffb1d2799bd7e8e1871aaf8d89b56cf (patch) (unidiff) | |
tree | 180016a8feae9e40c3e6b8be62b518bdf8ef18fc /noncore/net/wellenreiter/libwellenreiter/source/proto.cc | |
parent | e6aaae74f39e3aed4dc3c186c56f92cef8c7da09 (diff) | |
download | opie-3cb928900ffb1d2799bd7e8e1871aaf8d89b56cf.zip opie-3cb928900ffb1d2799bd7e8e1871aaf8d89b56cf.tar.gz opie-3cb928900ffb1d2799bd7e8e1871aaf8d89b56cf.tar.bz2 |
cleanup, new protocol, renaming of some functions, GUI has to update!
Diffstat (limited to 'noncore/net/wellenreiter/libwellenreiter/source/proto.cc') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/libwellenreiter/source/proto.cc | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/proto.cc b/noncore/net/wellenreiter/libwellenreiter/source/proto.cc deleted file mode 100644 index a1228e4..0000000 --- a/noncore/net/wellenreiter/libwellenreiter/source/proto.cc +++ b/dev/null | |||
@@ -1,109 +0,0 @@ | |||
1 | /* | ||
2 | * Communication protocol | ||
3 | * | ||
4 | * $Id$ | ||
5 | */ | ||
6 | |||
7 | #include "proto.hh" | ||
8 | #include "sock.hh" | ||
9 | #include "log.hh" | ||
10 | |||
11 | /* Send found network to GUI */ | ||
12 | int send_network_found (const char *guihost, int guiport, void *structure) | ||
13 | { | ||
14 | wl_network_t *ptr; | ||
15 | char buffer[2048]; | ||
16 | char temp[5]; | ||
17 | |||
18 | ptr = (wl_network_t *)structure; | ||
19 | |||
20 | memset(buffer, 0, 2048); | ||
21 | |||
22 | /* Type = Found new net */ | ||
23 | memcpy(buffer, "01", 2); | ||
24 | |||
25 | /* Set Net-type */ | ||
26 | memset(temp, 0, sizeof(temp)); | ||
27 | snprintf(temp, 2, "%d", ptr->net_type); | ||
28 | memcpy(buffer + 2, temp, 1); | ||
29 | |||
30 | /* Set channel */ | ||
31 | memset(temp, 0, sizeof(temp)); | ||
32 | |||
33 | if(ptr->channel < 10) | ||
34 | snprintf(temp, 3, "0%d", ptr->channel); | ||
35 | else | ||
36 | snprintf(temp, 3, "%d", ptr->channel); | ||
37 | |||
38 | memcpy(buffer + 3, temp, 2); | ||
39 | |||
40 | /* Set WEP y/n */ | ||
41 | memset(temp, 0, sizeof(temp)); | ||
42 | snprintf(temp, 2, "%d", ptr->wep); | ||
43 | memcpy(buffer + 5, temp, 1); | ||
44 | |||
45 | /* Set MAC address */ | ||
46 | memcpy(buffer + 6, ptr->mac, 17); | ||
47 | |||
48 | /* Set lenght of ssid */ | ||
49 | memset(temp, 0, sizeof(temp)); | ||
50 | |||
51 | if(ptr->ssid_len > 99) | ||
52 | snprintf(temp, 4, "%d", ptr->ssid_len); | ||
53 | else if(ptr->ssid_len < 10) | ||
54 | snprintf(temp, 4, "00%d", ptr->ssid_len); | ||
55 | else | ||
56 | snprintf(temp, 4, "0%d", ptr->ssid_len); | ||
57 | |||
58 | memcpy(buffer + 23, temp, 3); | ||
59 | |||
60 | /* Set ssid */ | ||
61 | memcpy(buffer + 26, ptr->bssid, ptr->ssid_len); | ||
62 | |||
63 | /* Send prepared buffer to GUI */ | ||
64 | #ifdef DEBUG | ||
65 | wl_loginfo("Sending network to GUI: '%s'", buffer); | ||
66 | #endif | ||
67 | |||
68 | sendcomm(guihost, guiport, buffer); | ||
69 | |||
70 | return 1; | ||
71 | } | ||
72 | |||
73 | /* Fill buffer into structur */ | ||
74 | int get_network_found (void *structure, const char *buffer) | ||
75 | { | ||
76 | wl_network_t *ptr; | ||
77 | char temp[512]; | ||
78 | |||
79 | ptr = (wl_network_t *)structure; | ||
80 | |||
81 | /* Get net type */ | ||
82 | memset(temp, 0, sizeof(temp)); | ||
83 | memcpy(temp, buffer + 2, 1); | ||
84 | ptr->net_type = atoi(temp); | ||
85 | |||
86 | /* Get channel */ | ||
87 | memset(temp, 0, sizeof(temp)); | ||
88 | memcpy(temp, buffer + 3, 2); | ||
89 | ptr->channel = atoi(temp); | ||
90 | |||
91 | /* Set WEP y/n */ | ||
92 | memset(temp, 0, sizeof(temp)); | ||
93 | memcpy(temp, buffer + 5, 1); | ||
94 | ptr->wep = atoi(temp); | ||
95 | |||
96 | /* Set MAC address */ | ||
97 | memcpy(ptr->mac, buffer + 6, 17); | ||
98 | ptr->mac[17]='\0'; | ||
99 | |||
100 | /* Set lenght of ssid */ | ||
101 | memset(temp, 0, sizeof(temp)); | ||
102 | memcpy(temp, buffer + 23, 3); | ||
103 | ptr->ssid_len = atoi(temp); | ||
104 | |||
105 | /* Set ssid */ | ||
106 | memcpy(ptr->bssid, buffer + 26, ptr->ssid_len + 1); | ||
107 | |||
108 | return 1; | ||
109 | } | ||