summaryrefslogtreecommitdiff
authormjm <mjm>2002-12-28 15:28:49 (UTC)
committer mjm <mjm>2002-12-28 15:28:49 (UTC)
commit94ac3da47b0b36316cff680d319dab23c9339308 (patch) (side-by-side diff)
tree5161a4da84fb05c53fd5225be5674ab75087ff3f
parent0ab4ac99bead80d8af18988045748fd2b3dd3a15 (diff)
downloadopie-94ac3da47b0b36316cff680d319dab23c9339308.zip
opie-94ac3da47b0b36316cff680d319dab23c9339308.tar.gz
opie-94ac3da47b0b36316cff680d319dab23c9339308.tar.bz2
cleanup
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc46
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh2
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc6
3 files changed, 23 insertions, 31 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc
index 5317f52..ae6d406 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc
+++ b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.cc
@@ -44,9 +44,6 @@ int send_network_found (const char *guihost, int guiport, void *structure)
{
wl_network_t *ptr;
- char buffer[2048];
- char temp[128];
- int retval=0, len=0;
-
- memset(temp, 0, sizeof(temp));
+ char buffer[2048], temp[5];
+ int len = 0;
ptr = (wl_network_t *)structure;
@@ -61,25 +58,24 @@ int send_network_found (const char *guihost, int guiport, void *structure)
memset(temp, 0, sizeof(temp));
snprintf(temp, sizeof(temp), "%d", ptr->net_type);
- retval = add_field(buffer + len, temp, 1);
- len += retval;
+ len += add_field(buffer + len, temp, 1);
/* Set channel */
memset(temp, 0, sizeof(temp));
snprintf(temp, sizeof(temp), "%.2d", ptr->channel);
- retval = add_field(buffer + len, temp, 2);
- len += retval;
+ len += add_field(buffer + len, temp, 2);
/* Set WEP y/n */
memset(temp, 0, sizeof(temp));
snprintf(temp, sizeof(temp), "%d", ptr->wep);
- retval = add_field(buffer + len, temp, 1);
- len += retval;
+ len += add_field(buffer + len, temp, 1);
/* Set Mac */
- retval = add_field(buffer + len, ptr->mac, 17);
- len += retval;
+ len += add_field(buffer + len, ptr->mac, 17);
/* Set ssid */
- retval = add_field(buffer + len, ptr->bssid, ptr->ssid_len);
+ if(len + ptr->ssid_len < sizeof(buffer) - 1)
+ len += add_field(buffer + len, ptr->bssid, ptr->ssid_len);
+ else
+ len += add_field(buffer + len, ptr->bssid, sizeof(buffer) - len - 1);
/* Send prepared buffer to UI */
@@ -95,36 +91,32 @@ int get_network_found (void *structure, const char *buffer)
{
wl_network_t *ptr;
- char temp[512];
- int retval=0, len=0;
+ char temp[5];
+ int len = 0;
ptr = (wl_network_t *)structure;
- /* packet type already determined */
+ /* packet type already determined, skip check */
len += 2;
- /* Get net type */
+ /* Get net type (accesspoint || ad-hoc || ...) */
memset(temp, 0, sizeof(temp));
- retval = get_field(buffer + len, temp);
- len += retval;
+ len += get_field(buffer + len, temp);
ptr->net_type = atoi(temp);
/* Get channel */
memset(temp, 0, sizeof(temp));
- retval = get_field(buffer + len, temp);
- len += retval;
+ len += get_field(buffer + len, temp);
ptr->channel = atoi(temp);
/* Set WEP y/n */
memset(temp, 0, sizeof(temp));
- retval = get_field(buffer + len, temp);
- len += retval;
+ len += get_field(buffer + len, temp);
ptr->wep = atoi(temp);
/* Set MAC address */
- retval = get_field(buffer + len, ptr->mac);
- len += retval;
+ len += get_field(buffer + len, ptr->mac);
/* Set BSSID */
- retval = get_field(buffer + len, ptr->bssid);
+ len += get_field(buffer + len, ptr->bssid);
return 1;
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh
index f755589..a196091 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh
+++ b/noncore/net/wellenreiter/libwellenreiter/source/wl_proto.hh
@@ -23,5 +23,5 @@ typedef struct {
int wep; /* 1 = WEP enabled ; 0 = disabled */
char mac[64]; /* MAC address of Accesspoint */
- char bssid[128]; /* BSSID of Accesspoint */
+ char bssid[128]; /* BSSID of Net */
} wl_network_t;
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc b/noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc
index 4942fba..db6b7b8 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc
+++ b/noncore/net/wellenreiter/libwellenreiter/source/wl_sock.cc
@@ -14,5 +14,5 @@ int wl_setupsock(const char *host, int port)
int sock;
- if((sock=socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+ if((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
{
wl_logerr("Cannot set up socket: %s", strerror(errno));
@@ -54,5 +54,5 @@ int wl_send(const char *host, int port, const char *string, ...)
/* Setup socket */
- if((sock=socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+ if((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
{
wl_logerr("Cannot set up socket: %s", strerror(errno));
@@ -77,5 +77,5 @@ int wl_recv(int *sock, char *out, int maxlen)
{
struct sockaddr_in *cliaddr;
- socklen_t len=sizeof(struct sockaddr);
+ socklen_t len = sizeof(struct sockaddr);
char retval[3];