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 | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/proto.cc b/noncore/net/wellenreiter/libwellenreiter/source/proto.cc index 305f401..2ec23f4 100644 --- a/noncore/net/wellenreiter/libwellenreiter/source/proto.cc +++ b/noncore/net/wellenreiter/libwellenreiter/source/proto.cc | |||
@@ -11,99 +11,98 @@ | |||
11 | int send_network_found (const char *guihost, int guiport, void *structure) | 11 | int send_network_found (const char *guihost, int guiport, void *structure) |
12 | { | 12 | { |
13 | wl_network_t *ptr; | 13 | wl_network_t *ptr; |
14 | char buffer[2048]; | 14 | char buffer[2048]; |
15 | char temp[5]; | 15 | char temp[5]; |
16 | 16 | ||
17 | ptr = (wl_network_t *)structure; | 17 | ptr = (wl_network_t *)structure; |
18 | 18 | ||
19 | memset(buffer, 0, 2048); | 19 | memset(buffer, 0, 2048); |
20 | 20 | ||
21 | /* Type = Found new net */ | 21 | /* Type = Found new net */ |
22 | memcpy(buffer, "01", 2); | 22 | memcpy(buffer, "01", 2); |
23 | 23 | ||
24 | /* Set Net-type */ | 24 | /* Set Net-type */ |
25 | memset(temp, 0, sizeof(temp)); | 25 | memset(temp, 0, sizeof(temp)); |
26 | snprintf(temp, 2, "%d", ptr->net_type); | 26 | snprintf(temp, 2, "%d", ptr->net_type); |
27 | memcpy(buffer + 2, temp, 1); | 27 | memcpy(buffer + 2, temp, 1); |
28 | 28 | ||
29 | /* Set channel */ | 29 | /* Set channel */ |
30 | memset(temp, 0, sizeof(temp)); | 30 | memset(temp, 0, sizeof(temp)); |
31 | 31 | ||
32 | if(ptr->channel < 10) | 32 | if(ptr->channel < 10) |
33 | snprintf(temp, 3, "0%d", ptr->channel); | 33 | snprintf(temp, 3, "0%d", ptr->channel); |
34 | else | 34 | else |
35 | snprintf(temp, 3, "%d", ptr->channel); | 35 | snprintf(temp, 3, "%d", ptr->channel); |
36 | 36 | ||
37 | memcpy(buffer + 3, temp, 2); | 37 | memcpy(buffer + 3, temp, 2); |
38 | 38 | ||
39 | /* Set WEP y/n */ | 39 | /* Set WEP y/n */ |
40 | memset(temp, 0, sizeof(temp)); | 40 | memset(temp, 0, sizeof(temp)); |
41 | snprintf(temp, 2, "%d", ptr->wep); | 41 | snprintf(temp, 2, "%d", ptr->wep); |
42 | memcpy(buffer + 5, temp, 1); | 42 | memcpy(buffer + 5, temp, 1); |
43 | 43 | ||
44 | /* Set MAC address */ | 44 | /* Set MAC address */ |
45 | memcpy(buffer + 6, ptr->mac, 17); | 45 | memcpy(buffer + 6, ptr->mac, 17); |
46 | 46 | ||
47 | /* Set lenght of ssid */ | 47 | /* Set lenght of ssid */ |
48 | memset(temp, 0, sizeof(temp)); | 48 | memset(temp, 0, sizeof(temp)); |
49 | 49 | ||
50 | if(ptr->ssid_len > 99) | 50 | if(ptr->ssid_len > 99) |
51 | snprintf(temp, 4, "%d", ptr->ssid_len); | 51 | snprintf(temp, 4, "%d", ptr->ssid_len); |
52 | else if(ptr->ssid_len < 10) | 52 | else if(ptr->ssid_len < 10) |
53 | snprintf(temp, 4, "00%d", ptr->ssid_len); | 53 | snprintf(temp, 4, "00%d", ptr->ssid_len); |
54 | else | 54 | else |
55 | snprintf(temp, 4, "0%d", ptr->ssid_len); | 55 | snprintf(temp, 4, "0%d", ptr->ssid_len); |
56 | 56 | ||
57 | memcpy(buffer + 23, temp, 3); | 57 | memcpy(buffer + 23, temp, 3); |
58 | 58 | ||
59 | fprintf( stderr, "Temp is %s\n", temp ); | ||
60 | fprintf( stderr, "ssid_len is %d\n", ptr->ssid_len ); | ||
61 | |||
62 | /* Set ssid */ | 59 | /* Set ssid */ |
63 | memcpy(buffer + 26, ptr->bssid, ptr->ssid_len); | 60 | memcpy(buffer + 26, ptr->bssid, ptr->ssid_len); |
64 | 61 | ||
65 | fprintf( stderr, "Buffer is %s\n", buffer ); | ||
66 | |||
67 | /* Send prepared buffer to GUI */ | 62 | /* Send prepared buffer to GUI */ |
63 | #ifdef DEBUG | ||
64 | wl_loginfo("Sending network to GUI: '%s'", buffer); | ||
65 | #endif | ||
66 | |||
68 | sendcomm(guihost, guiport, buffer); | 67 | sendcomm(guihost, guiport, buffer); |
69 | 68 | ||
70 | return 1; | 69 | return 1; |
71 | } | 70 | } |
72 | 71 | ||
73 | /* Fill buffer into structur */ | 72 | /* Fill buffer into structur */ |
74 | int get_network_found (void *structure, const char *buffer) | 73 | int get_network_found (void *structure, const char *buffer) |
75 | { | 74 | { |
76 | wl_network_t *ptr; | 75 | wl_network_t *ptr; |
77 | char temp[512]; | 76 | char temp[512]; |
78 | 77 | ||
79 | ptr = (wl_network_t *)structure; | 78 | ptr = (wl_network_t *)structure; |
80 | 79 | ||
81 | /* Get net type */ | 80 | /* Get net type */ |
82 | memset(temp, 0, sizeof(temp)); | 81 | memset(temp, 0, sizeof(temp)); |
83 | memcpy(temp, buffer + 2, 1); | 82 | memcpy(temp, buffer + 2, 1); |
84 | ptr->net_type = atoi(temp); | 83 | ptr->net_type = atoi(temp); |
85 | 84 | ||
86 | /* Get channel */ | 85 | /* Get channel */ |
87 | memset(temp, 0, sizeof(temp)); | 86 | memset(temp, 0, sizeof(temp)); |
88 | memcpy(temp, buffer + 3, 2); | 87 | memcpy(temp, buffer + 3, 2); |
89 | ptr->channel = atoi(temp); | 88 | ptr->channel = atoi(temp); |
90 | 89 | ||
91 | /* Set WEP y/n */ | 90 | /* Set WEP y/n */ |
92 | memset(temp, 0, sizeof(temp)); | 91 | memset(temp, 0, sizeof(temp)); |
93 | memcpy(temp, buffer + 5, 1); | 92 | memcpy(temp, buffer + 5, 1); |
94 | ptr->wep = atoi(temp); | 93 | ptr->wep = atoi(temp); |
95 | 94 | ||
96 | /* Set MAC address */ | 95 | /* Set MAC address */ |
97 | memcpy(ptr->mac, buffer + 6, 17); | 96 | memcpy(ptr->mac, buffer + 6, 17); |
98 | ptr->mac[17]='\0'; | 97 | ptr->mac[17]='\0'; |
99 | 98 | ||
100 | /* Set lenght of ssid */ | 99 | /* Set lenght of ssid */ |
101 | memset(temp, 0, sizeof(temp)); | 100 | memset(temp, 0, sizeof(temp)); |
102 | memcpy(temp, buffer + 23, 3); | 101 | memcpy(temp, buffer + 23, 3); |
103 | ptr->ssid_len = atoi(temp); | 102 | ptr->ssid_len = atoi(temp); |
104 | 103 | ||
105 | /* Set ssid */ | 104 | /* Set ssid */ |
106 | memcpy(ptr->bssid, buffer + 26, ptr->ssid_len + 1); | 105 | memcpy(ptr->bssid, buffer + 26, ptr->ssid_len + 1); |
107 | 106 | ||
108 | return 1; | 107 | return 1; |
109 | } | 108 | } |