author | mickeyl <mickeyl> | 2002-12-04 21:23:17 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2002-12-04 21:23:17 (UTC) |
commit | eadf7c4aed6ff281f418a7a3b315fd59f001617a (patch) (unidiff) | |
tree | a46170b6634f542d595a104062fd0a9dcd76be6f | |
parent | e5d01d8c3cf1d606e53684b6eccaf3ceaf6dea0b (diff) | |
download | opie-eadf7c4aed6ff281f418a7a3b315fd59f001617a.zip opie-eadf7c4aed6ff281f418a7a3b315fd59f001617a.tar.gz opie-eadf7c4aed6ff281f418a7a3b315fd59f001617a.tar.bz2 |
more debugging info for our debugging session...
-rw-r--r-- | noncore/net/wellenreiter/libwellenreiter/source/proto.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/proto.cc b/noncore/net/wellenreiter/libwellenreiter/source/proto.cc index 359bdb5..305f401 100644 --- a/noncore/net/wellenreiter/libwellenreiter/source/proto.cc +++ b/noncore/net/wellenreiter/libwellenreiter/source/proto.cc | |||
@@ -1,104 +1,109 @@ | |||
1 | /* | 1 | /* |
2 | * Communication protocol | 2 | * Communication protocol |
3 | * | 3 | * |
4 | * $Id$ | 4 | * $Id$ |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include "proto.hh" | 7 | #include "proto.hh" |
8 | #include "sock.hh" | 8 | #include "sock.hh" |
9 | 9 | ||
10 | /* Send found network to GUI */ | 10 | /* Send found network to GUI */ |
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[4]; | 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 | |||
59 | /* Set ssid */ | 62 | /* Set ssid */ |
60 | memcpy(buffer + 26, ptr->bssid, ptr->ssid_len); | 63 | memcpy(buffer + 26, ptr->bssid, ptr->ssid_len); |
61 | 64 | ||
65 | fprintf( stderr, "Buffer is %s\n", buffer ); | ||
66 | |||
62 | /* Send prepared buffer to GUI */ | 67 | /* Send prepared buffer to GUI */ |
63 | sendcomm(guihost, guiport, buffer); | 68 | sendcomm(guihost, guiport, buffer); |
64 | 69 | ||
65 | return 1; | 70 | return 1; |
66 | } | 71 | } |
67 | 72 | ||
68 | /* Fill buffer into structur */ | 73 | /* Fill buffer into structur */ |
69 | int get_network_found (void *structure, const char *buffer) | 74 | int get_network_found (void *structure, const char *buffer) |
70 | { | 75 | { |
71 | wl_network_t *ptr; | 76 | wl_network_t *ptr; |
72 | char temp[512]; | 77 | char temp[512]; |
73 | 78 | ||
74 | ptr = (wl_network_t *)structure; | 79 | ptr = (wl_network_t *)structure; |
75 | 80 | ||
76 | /* Get net type */ | 81 | /* Get net type */ |
77 | memset(temp, 0, sizeof(temp)); | 82 | memset(temp, 0, sizeof(temp)); |
78 | memcpy(temp, buffer + 2, 1); | 83 | memcpy(temp, buffer + 2, 1); |
79 | ptr->net_type = atoi(temp); | 84 | ptr->net_type = atoi(temp); |
80 | 85 | ||
81 | /* Get channel */ | 86 | /* Get channel */ |
82 | memset(temp, 0, sizeof(temp)); | 87 | memset(temp, 0, sizeof(temp)); |
83 | memcpy(temp, buffer + 3, 2); | 88 | memcpy(temp, buffer + 3, 2); |
84 | ptr->channel = atoi(temp); | 89 | ptr->channel = atoi(temp); |
85 | 90 | ||
86 | /* Set WEP y/n */ | 91 | /* Set WEP y/n */ |
87 | memset(temp, 0, sizeof(temp)); | 92 | memset(temp, 0, sizeof(temp)); |
88 | memcpy(temp, buffer + 5, 1); | 93 | memcpy(temp, buffer + 5, 1); |
89 | ptr->wep = atoi(temp); | 94 | ptr->wep = atoi(temp); |
90 | 95 | ||
91 | /* Set MAC address */ | 96 | /* Set MAC address */ |
92 | memcpy(ptr->mac, buffer + 6, 17); | 97 | memcpy(ptr->mac, buffer + 6, 17); |
93 | ptr->mac[17]='\0'; | 98 | ptr->mac[17]='\0'; |
94 | 99 | ||
95 | /* Set lenght of ssid */ | 100 | /* Set lenght of ssid */ |
96 | memset(temp, 0, sizeof(temp)); | 101 | memset(temp, 0, sizeof(temp)); |
97 | memcpy(temp, buffer + 23, 3); | 102 | memcpy(temp, buffer + 23, 3); |
98 | ptr->ssid_len = atoi(temp); | 103 | ptr->ssid_len = atoi(temp); |
99 | 104 | ||
100 | /* Set ssid */ | 105 | /* Set ssid */ |
101 | memcpy(ptr->bssid, buffer + 26, ptr->ssid_len + 1); | 106 | memcpy(ptr->bssid, buffer + 26, ptr->ssid_len + 1); |
102 | 107 | ||
103 | return 1; | 108 | return 1; |
104 | } | 109 | } |