summaryrefslogtreecommitdiff
authormjm <mjm>2003-02-27 19:32:08 (UTC)
committer mjm <mjm>2003-02-27 19:32:08 (UTC)
commit18c19111466e43e91678c5a1fa50f2f561ca3257 (patch) (unidiff)
tree9f76492a3e0351a5914ada95c68fed169f3a6a29
parentfca225e970ebb629c4ac79020248a860a651bd85 (diff)
downloadopie-18c19111466e43e91678c5a1fa50f2f561ca3257.zip
opie-18c19111466e43e91678c5a1fa50f2f561ca3257.tar.gz
opie-18c19111466e43e91678c5a1fa50f2f561ca3257.tar.bz2
fixed typo
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc
index dcdc16b..6c3846f 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc
+++ b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc
@@ -69,113 +69,113 @@ int send_ok(const char *guihost, int guiport, int code)
69 69
70 return ((!wl_send(guihost, guiport, buffer)) ? 0 : 1); 70 return ((!wl_send(guihost, guiport, buffer)) ? 0 : 1);
71} 71}
72 72
73/* Send fail message */ 73/* Send fail message */
74int send_fail(const char *guihost, int guiport, 74int send_fail(const char *guihost, int guiport,
75 int code, const char *errstr) 75 int code, const char *errstr)
76{ 76{
77 unsigned int len = 0; 77 unsigned int len = 0;
78 char buffer[128], temp[5]; 78 char buffer[128], temp[5];
79 79
80 memset(buffer, 0, sizeof(buffer)); 80 memset(buffer, 0, sizeof(buffer));
81 81
82 memset(temp, 0, sizeof(temp)); 82 memset(temp, 0, sizeof(temp));
83 snprintf(temp, sizeof(temp) - 1, "%.2d", CMD_FAIL); 83 snprintf(temp, sizeof(temp) - 1, "%.2d", CMD_FAIL);
84 memcpy(buffer, temp, 2); 84 memcpy(buffer, temp, 2);
85 len += 2; 85 len += 2;
86 86
87 memset(temp, 0, sizeof(temp)); 87 memset(temp, 0, sizeof(temp));
88 snprintf(temp, sizeof(temp) - 1, "%.2d", code); 88 snprintf(temp, sizeof(temp) - 1, "%.2d", code);
89 len += add_field(buffer + len, temp, 2); 89 len += add_field(buffer + len, temp, 2);
90 90
91 len += add_field(buffer + len, errstr, strlen(errstr)); 91 len += add_field(buffer + len, errstr, strlen(errstr));
92 92
93 /* Send prepared buffer to UI */ 93 /* Send prepared buffer to UI */
94#ifdef DEBUG 94#ifdef DEBUG
95 wl_loginfo("Send CMD_FAIL to UI: '%s'", buffer); 95 wl_loginfo("Send CMD_FAIL to UI: '%s'", buffer);
96#endif 96#endif
97 97
98 return ((!wl_send(guihost, guiport, buffer)) ? 0 : 1); 98 return ((!wl_send(guihost, guiport, buffer)) ? 0 : 1);
99} 99}
100 100
101int get_ok(const char *buffer) 101int get_ok(const char *buffer)
102{ 102{
103 char temp[5]; 103 char temp[5];
104 unsigned int len = 0; 104 unsigned int len = 0;
105 105
106 /* packet type already determined, skip check */ 106 /* packet type already determined, skip check */
107 len += 2; 107 len += 2;
108 108
109 /* what is ok for? */ 109 /* what is ok for? */
110 memset(temp, 0, sizeof(temp)); 110 memset(temp, 0, sizeof(temp));
111 len += get_field(buffer + len, temp, sizeof(temp)); 111 len += get_field(buffer + len, temp, sizeof(temp));
112 112
113 return atoi(temp); 113 return atoi(temp);
114} 114}
115 115
116/* put failmessage into buffer */ 116/* put failmessage into buffer */
117int get_fail(char *out, const char *buffer, size_t len) 117int get_fail(char *out, const char *buffer, size_t bufflen)
118{ 118{
119 char temp[5]; 119 char temp[5];
120 int error=0; 120 int error=0;
121 unsigned int len = 0; 121 unsigned int len = 0;
122 122
123 /* packet type already determined, skip check */ 123 /* packet type already determined, skip check */
124 len += 2; 124 len += 2;
125 125
126 /* what is fail for? */ 126 /* what is fail for? */
127 memset(temp, 0, sizeof(temp)); 127 memset(temp, 0, sizeof(temp));
128 len += get_field(buffer + len, temp, sizeof(temp)); 128 len += get_field(buffer + len, temp, sizeof(temp));
129 error=atoi(temp); 129 error=atoi(temp);
130 130
131 /* get errorstring and fill into buffer */ 131 /* get errorstring and fill into buffer */
132 memset(out, 0, len); 132 memset(out, 0, bufflen);
133 len += get_field(buffer + len, out, len - 1); 133 len += get_field(buffer + len, out, bufflen - 1);
134 134
135 return error; 135 return error;
136} 136}
137 137
138 138
139/* Send found network to UI */ 139/* Send found network to UI */
140int send_network_found (const char *guihost, int guiport, void *structure) 140int send_network_found (const char *guihost, int guiport, void *structure)
141{ 141{
142 wl_network_t *ptr; 142 wl_network_t *ptr;
143 char buffer[2048], temp[5]; 143 char buffer[2048], temp[5];
144 unsigned int len = 0; 144 unsigned int len = 0;
145 145
146 ptr = (wl_network_t *)structure; 146 ptr = (wl_network_t *)structure;
147 147
148 memset(buffer,0,sizeof(buffer)); 148 memset(buffer,0,sizeof(buffer));
149 /* Type = Found new net (without length field) */ 149 /* Type = Found new net (without length field) */
150 memset(temp, 0, sizeof(temp)); 150 memset(temp, 0, sizeof(temp));
151 snprintf(temp, sizeof(temp) - 1, "%.2d", WL_NETFOUND); 151 snprintf(temp, sizeof(temp) - 1, "%.2d", WL_NETFOUND);
152 memcpy(buffer, temp, 2); 152 memcpy(buffer, temp, 2);
153 len += 2; 153 len += 2;
154 154
155 /* Set Net-type */ 155 /* Set Net-type */
156 memset(temp, 0, sizeof(temp)); 156 memset(temp, 0, sizeof(temp));
157 snprintf(temp, sizeof(temp) - 1, "%d", ptr->net_type); 157 snprintf(temp, sizeof(temp) - 1, "%d", ptr->net_type);
158 len += add_field(buffer + len, temp, 1); 158 len += add_field(buffer + len, temp, 1);
159 159
160 /* Set channel */ 160 /* Set channel */
161 memset(temp, 0, sizeof(temp)); 161 memset(temp, 0, sizeof(temp));
162 snprintf(temp, sizeof(temp) - 1, "%.2d", ptr->channel); 162 snprintf(temp, sizeof(temp) - 1, "%.2d", ptr->channel);
163 len += add_field(buffer + len, temp, 2); 163 len += add_field(buffer + len, temp, 2);
164 164
165 /* Set WEP y/n */ 165 /* Set WEP y/n */
166 memset(temp, 0, sizeof(temp)); 166 memset(temp, 0, sizeof(temp));
167 snprintf(temp, sizeof(temp) - 1, "%d", ptr->wep); 167 snprintf(temp, sizeof(temp) - 1, "%d", ptr->wep);
168 len += add_field(buffer + len, temp, 1); 168 len += add_field(buffer + len, temp, 1);
169 169
170 /* Set Mac */ 170 /* Set Mac */
171 len += add_field(buffer + len, ptr->mac, 17); 171 len += add_field(buffer + len, ptr->mac, 17);
172 172
173 /* Set ssid */ 173 /* Set ssid */
174 if(len + ptr->ssid_len < sizeof(buffer) - 1) 174 if(len + ptr->ssid_len < sizeof(buffer) - 1)
175 len += add_field(buffer + len, ptr->bssid, ptr->ssid_len); 175 len += add_field(buffer + len, ptr->bssid, ptr->ssid_len);
176 else 176 else
177 len += add_field(buffer + len, ptr->bssid, sizeof(buffer) - len - 1); 177 len += add_field(buffer + len, ptr->bssid, sizeof(buffer) - len - 1);
178 178
179 /* Send prepared buffer to UI */ 179 /* Send prepared buffer to UI */
180#ifdef DEBUG 180#ifdef DEBUG
181 wl_loginfo("Sending network to UI: '%s'", buffer); 181 wl_loginfo("Sending network to UI: '%s'", buffer);