diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-07-27 08:28:59 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-07-27 08:28:59 +0000 |
commit | 64653fc0a7a092c8edff5c7c5bb770f0ae4bca61 (patch) | |
tree | 24629d3708344c3ed7beb5bdd4e246aa8d654ffb /src | |
parent | adc9d89e46ab3f331fbba30298b2c569a5de14e4 (diff) | |
download | gnunet-64653fc0a7a092c8edff5c7c5bb770f0ae4bca61.tar.gz gnunet-64653fc0a7a092c8edff5c7c5bb770f0ae4bca61.zip |
init to zero
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/Makefile.am | 7 | ||||
-rw-r--r-- | src/transport/gnunet-transport-wlan-helper.h | 2 | ||||
-rw-r--r-- | src/transport/test_plugin_transport_wlan_dummy.c | 46 | ||||
-rw-r--r-- | src/transport/wlan/helper_common.c | 1 |
4 files changed, 26 insertions, 30 deletions
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index 608c41505..864dd8231 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am | |||
@@ -62,8 +62,6 @@ UNIX_QUOTA_TEST = test_quota_compliance_unix \ | |||
62 | test_quota_compliance_unix_asymmetric_recv_constant | 62 | test_quota_compliance_unix_asymmetric_recv_constant |
63 | endif | 63 | endif |
64 | 64 | ||
65 | #noinst_PROGRAMS = ${check_PROGRAMS} | ||
66 | |||
67 | lib_LTLIBRARIES = \ | 65 | lib_LTLIBRARIES = \ |
68 | libgnunettransport.la | 66 | libgnunettransport.la |
69 | 67 | ||
@@ -85,7 +83,10 @@ bin_PROGRAMS = \ | |||
85 | gnunet-transport \ | 83 | gnunet-transport \ |
86 | $(WLAN_BIN) \ | 84 | $(WLAN_BIN) \ |
87 | gnunet-service-transport \ | 85 | gnunet-service-transport \ |
88 | gnunet-transport-list-connections \ | 86 | gnunet-transport-list-connections |
87 | |||
88 | #noinst_PROGRAMS = ${check_PROGRAMS} | ||
89 | noinst_PROGRAMS = \ | ||
89 | $(WLAN_BIN_DUMMY) | 90 | $(WLAN_BIN_DUMMY) |
90 | 91 | ||
91 | bin_SCRIPTS = \ | 92 | bin_SCRIPTS = \ |
diff --git a/src/transport/gnunet-transport-wlan-helper.h b/src/transport/gnunet-transport-wlan-helper.h index fb347b8c0..9cdff24e2 100644 --- a/src/transport/gnunet-transport-wlan-helper.h +++ b/src/transport/gnunet-transport-wlan-helper.h | |||
@@ -67,7 +67,7 @@ struct sendbuf | |||
67 | { | 67 | { |
68 | unsigned int pos; | 68 | unsigned int pos; |
69 | unsigned int size; | 69 | unsigned int size; |
70 | unsigned char buf[MAXLINE * 2]; | 70 | char buf[MAXLINE * 2]; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | 73 | ||
diff --git a/src/transport/test_plugin_transport_wlan_dummy.c b/src/transport/test_plugin_transport_wlan_dummy.c index 71fcd29cf..173d22bba 100644 --- a/src/transport/test_plugin_transport_wlan_dummy.c +++ b/src/transport/test_plugin_transport_wlan_dummy.c | |||
@@ -52,7 +52,7 @@ | |||
52 | #include "wlan/loopback_helper.h" | 52 | #include "wlan/loopback_helper.h" |
53 | #include "wlan/helper_common.h" | 53 | #include "wlan/helper_common.h" |
54 | 54 | ||
55 | int first; | 55 | static int first; |
56 | 56 | ||
57 | static void | 57 | static void |
58 | sigfunc(int sig) | 58 | sigfunc(int sig) |
@@ -63,17 +63,15 @@ sigfunc(int sig) | |||
63 | } | 63 | } |
64 | 64 | ||
65 | static void | 65 | static void |
66 | stdin_send(void *cls, void *client, const struct GNUNET_MessageHeader *hdr) | 66 | stdin_send(void *cls, void *client, |
67 | const struct GNUNET_MessageHeader *hdr) | ||
67 | { | 68 | { |
68 | struct sendbuf *write_pout = cls; | 69 | struct sendbuf *write_pout = cls; |
69 | int sendsize; | 70 | int sendsize; |
70 | struct GNUNET_MessageHeader newheader; | 71 | struct GNUNET_MessageHeader newheader; |
71 | unsigned char * from_data; | 72 | char * to_data; |
72 | unsigned char * to_data; | 73 | char * to_radiotap; |
73 | //unsigned char * from_radiotap; | 74 | char * to_start; |
74 | unsigned char * to_radiotap; | ||
75 | //unsigned char * from_start; | ||
76 | unsigned char * to_start; | ||
77 | 75 | ||
78 | sendsize = ntohs(hdr->size) - sizeof(struct Radiotap_Send) | 76 | sendsize = ntohs(hdr->size) - sizeof(struct Radiotap_Send) |
79 | + sizeof(struct Radiotap_rx); | 77 | + sizeof(struct Radiotap_rx); |
@@ -93,21 +91,18 @@ stdin_send(void *cls, void *client, const struct GNUNET_MessageHeader *hdr) | |||
93 | newheader.type = htons(GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA); | 91 | newheader.type = htons(GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA); |
94 | 92 | ||
95 | to_start = write_pout->buf + write_pout->size; | 93 | to_start = write_pout->buf + write_pout->size; |
96 | to_radiotap = to_start + sizeof(struct GNUNET_MessageHeader); | ||
97 | to_data = to_radiotap + sizeof(struct Radiotap_rx); | ||
98 | |||
99 | from_data = ((unsigned char *) hdr) + sizeof(struct Radiotap_Send) | ||
100 | + sizeof(struct GNUNET_MessageHeader); | ||
101 | |||
102 | memcpy(to_start, &newheader, sizeof(struct GNUNET_MessageHeader)); | 94 | memcpy(to_start, &newheader, sizeof(struct GNUNET_MessageHeader)); |
103 | write_pout->size += sizeof(struct GNUNET_MessageHeader); | 95 | write_pout->size += sizeof(struct GNUNET_MessageHeader); |
104 | 96 | ||
97 | to_radiotap = to_start + sizeof(struct GNUNET_MessageHeader); | ||
98 | memset(to_radiotap, 0, sizeof (struct Radiotap_rx)); | ||
105 | write_pout->size += sizeof(struct Radiotap_rx); | 99 | write_pout->size += sizeof(struct Radiotap_rx); |
106 | 100 | ||
107 | memcpy(to_data, from_data, ntohs(hdr->size) - sizeof(struct Radiotap_Send) | 101 | to_data = to_radiotap + sizeof(struct Radiotap_rx); |
108 | - sizeof(struct GNUNET_MessageHeader)); | 102 | memcpy(to_data, |
109 | write_pout->size += ntohs(hdr->size) - sizeof(struct Radiotap_Send) | 103 | ((char *) hdr) + sizeof(struct Radiotap_Send) + sizeof(struct GNUNET_MessageHeader), |
110 | - sizeof(struct GNUNET_MessageHeader); | 104 | ntohs(hdr->size) - sizeof(struct Radiotap_Send) - sizeof(struct GNUNET_MessageHeader)); |
105 | write_pout->size += ntohs(hdr->size) - sizeof(struct Radiotap_Send) - sizeof(struct GNUNET_MessageHeader); | ||
111 | } | 106 | } |
112 | 107 | ||
113 | static void | 108 | static void |
@@ -283,7 +278,7 @@ testmode(int argc, char *argv[]) | |||
283 | macaddr.mac[4] = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_STRONG, 256); | 278 | macaddr.mac[4] = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_STRONG, 256); |
284 | macaddr.mac[5] = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_NONCE, 256); | 279 | macaddr.mac[5] = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_NONCE, 256); |
285 | 280 | ||
286 | write_std.size = send_mac_to_plugin((char *) write_std.buf, macaddr.mac); | 281 | write_std.size = send_mac_to_plugin(write_std.buf, macaddr.mac); |
287 | 282 | ||
288 | while (0 == closeprog) | 283 | while (0 == closeprog) |
289 | { | 284 | { |
@@ -335,9 +330,9 @@ testmode(int argc, char *argv[]) | |||
335 | 330 | ||
336 | if (FD_ISSET(STDOUT_FILENO, &wfds)) | 331 | if (FD_ISSET(STDOUT_FILENO, &wfds)) |
337 | { | 332 | { |
338 | ret = write(STDOUT_FILENO, write_std.buf + write_std.pos, | 333 | ret = write(STDOUT_FILENO, |
339 | write_std.size - write_std.pos); | 334 | write_std.buf + write_std.pos, |
340 | 335 | write_std.size - write_std.pos); | |
341 | if (0 > ret) | 336 | if (0 > ret) |
342 | { | 337 | { |
343 | closeprog = 1; | 338 | closeprog = 1; |
@@ -358,9 +353,10 @@ testmode(int argc, char *argv[]) | |||
358 | 353 | ||
359 | if (FD_ISSET(fdpout, &wfds)) | 354 | if (FD_ISSET(fdpout, &wfds)) |
360 | { | 355 | { |
361 | ret = write(fdpout, write_pout.buf + write_pout.pos, write_pout.size | 356 | ret = write(fdpout, |
362 | - write_pout.pos); | 357 | write_pout.buf + write_pout.pos, |
363 | 358 | write_pout.size - write_pout.pos); | |
359 | |||
364 | if (0 > ret) | 360 | if (0 > ret) |
365 | { | 361 | { |
366 | closeprog = 1; | 362 | closeprog = 1; |
diff --git a/src/transport/wlan/helper_common.c b/src/transport/wlan/helper_common.c index ebbe44be7..24782ed11 100644 --- a/src/transport/wlan/helper_common.c +++ b/src/transport/wlan/helper_common.c | |||
@@ -33,7 +33,6 @@ | |||
33 | * @param mac pointer to the mac address | 33 | * @param mac pointer to the mac address |
34 | * @return number of bytes written | 34 | * @return number of bytes written |
35 | */ | 35 | */ |
36 | |||
37 | int | 36 | int |
38 | send_mac_to_plugin(char * buffer, uint8_t * mac) | 37 | send_mac_to_plugin(char * buffer, uint8_t * mac) |
39 | { | 38 | { |