[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r185 - in GNUnet/src: applications/dht/tools applications/f
From: |
grothoff |
Subject: |
[GNUnet-SVN] r185 - in GNUnet/src: applications/dht/tools applications/fs/module include server util |
Date: |
Sat, 5 Feb 2005 06:31:22 -0800 (PST) |
Author: grothoff
Date: 2005-02-05 06:31:21 -0800 (Sat, 05 Feb 2005)
New Revision: 185
Modified:
GNUnet/src/applications/dht/tools/dht_api.c
GNUnet/src/applications/fs/module/fs.c
GNUnet/src/include/fs.h
GNUnet/src/include/gnunet_dht.h
GNUnet/src/include/gnunet_util.h
GNUnet/src/server/gnunet-transport-check.c
GNUnet/src/util/tcpiotest.c
Log:
simplifications -- removing unnecessary types
Modified: GNUnet/src/applications/dht/tools/dht_api.c
===================================================================
--- GNUnet/src/applications/dht/tools/dht_api.c 2005-02-05 14:19:08 UTC (rev
184)
+++ GNUnet/src/applications/dht/tools/dht_api.c 2005-02-05 14:31:21 UTC (rev
185)
@@ -698,7 +698,7 @@
req->key = *key;
req->priority = htonl(prio);
req->timeout = htonll(timeout);
- memcpy(&((DHT_CS_REQUEST_PUT_GENERIC*)req)->value[0],
+ memcpy(&req[1],
&value[1],
ntohl(value->size) - sizeof(DataContainer));
ret = SYSERR;
Modified: GNUnet/src/applications/fs/module/fs.c
===================================================================
--- GNUnet/src/applications/fs/module/fs.c 2005-02-05 14:19:08 UTC (rev
184)
+++ GNUnet/src/applications/fs/module/fs.c 2005-02-05 14:31:21 UTC (rev
185)
@@ -376,7 +376,7 @@
ntohl(ri->anonymityLevel),
&ri->fileId,
ntohs(ri->header.size) - sizeof(RequestIndex),
- &((RequestIndex_GENERIC*)ri)->data[0]);
+ &ri[1]);
LOG(LOG_DEBUG,
"Sending confirmation of index request to client\n");
return coreAPI->sendValueToClient(sock,
Modified: GNUnet/src/include/fs.h
===================================================================
--- GNUnet/src/include/fs.h 2005-02-05 14:19:08 UTC (rev 184)
+++ GNUnet/src/include/fs.h 2005-02-05 14:31:21 UTC (rev 185)
@@ -66,12 +66,6 @@
} RequestSearch;
-typedef struct {
- RequestSearch rs;
- char data[1];
-} RequestSearch_GENERIC;
-
-
/**
* Server to client: content (in response to a RequestSearch). The
* header is followed by variable size data (the data portion
@@ -88,12 +82,7 @@
} ReplyContent;
-typedef struct {
- ReplyContent rc;
- char data[1];
-} ReplyContent_GENERIC;
-
/**
* Client to server: insert content.
* This struct is followed by a variable
@@ -121,12 +110,6 @@
} RequestInsert;
-typedef struct {
- RequestInsert ri;
- char data[1];
-} RequestInsert_GENERIC;
-
-
/**
* Client to server: index content (for on-demand
* encoding). This struct is followed by a variable
@@ -167,12 +150,6 @@
} RequestIndex;
-typedef struct {
- RequestIndex ri;
- char data[1];
-} RequestIndex_GENERIC;
-
-
/**
* Client to server: delete content. This struct is followed by a
* variable number of bytes of the content that is to be deleted.
@@ -182,12 +159,7 @@
} RequestDelete;
-typedef struct {
- RequestDelete rd;
- char data[1];
-} RequestDelete_GENERIC;
-
/**
* Client to server: unindex file.
*/
Modified: GNUnet/src/include/gnunet_dht.h
===================================================================
--- GNUnet/src/include/gnunet_dht.h 2005-02-05 14:19:08 UTC (rev 184)
+++ GNUnet/src/include/gnunet_dht.h 2005-02-05 14:31:21 UTC (rev 185)
@@ -99,18 +99,6 @@
} DHT_CS_REQUEST_PUT;
/**
- * TCP communication: put <key,value>-mapping to table.
- * Reply is an ACK.
- */
-typedef struct {
-
- DHT_CS_REQUEST_PUT dht_cs_request_put;
-
- char value[1];
-
-} DHT_CS_REQUEST_PUT_GENERIC;
-
-/**
* TCP communication: get <key,value>-mappings
* for given key. Reply is a DHT_CS_REPLY_RESULTS message.
*/
@@ -147,18 +135,6 @@
} DHT_CS_REQUEST_REMOVE;
/**
- * remove value. Reply is just an ACK.
- */
-typedef struct {
-
- DHT_CS_REQUEST_REMOVE dht_cs_request_remove;
-
- char value[1];
-
-} DHT_CS_REQUEST_REMOVE_GENERIC;
-
-
-/**
* gnunetd to client: iterate over all values. Reply is
* a DHT_CS_REPLY_RESULTS message.
*/
Modified: GNUnet/src/include/gnunet_util.h
===================================================================
--- GNUnet/src/include/gnunet_util.h 2005-02-05 14:19:08 UTC (rev 184)
+++ GNUnet/src/include/gnunet_util.h 2005-02-05 14:31:21 UTC (rev 185)
@@ -201,24 +201,6 @@
} CS_HEADER;
/**
- * Generic version of CS_HEADER with field for accessing end of struct (use the
- * other version for allocation).
- */
-typedef struct {
- /**
- * actual header
- */
- CS_HEADER cs_header;
-
- /**
- * This is followed by a type specific data block, consisting
- * of size bytes.
- */
- char data[1];
-
-} CS_HEADER_GENERIC;
-
-/**
* CS communication: simple return value
*/
typedef struct {
@@ -248,21 +230,6 @@
unsigned short type;
} p2p_HEADER;
-
-/**
- * Generic version of p2p_HEADER with field for accessing end of struct (use
- * the other version for allocation).
- */
-typedef struct {
- p2p_HEADER p2p_header;
-
- /**
- * this is followed by a type specific data block,
- * consisting of size bytes.
- */
- char data[1];
-} p2p_HEADER_GENERIC;
-
typedef void (*NotifyConfigurationUpdateCallback)();
/**
Modified: GNUnet/src/server/gnunet-transport-check.c
===================================================================
--- GNUnet/src/server/gnunet-transport-check.c 2005-02-05 14:19:08 UTC (rev
184)
+++ GNUnet/src/server/gnunet-transport-check.c 2005-02-05 14:31:21 UTC (rev
185)
@@ -73,7 +73,7 @@
if ( (ntohs(msg->size) ==
sizeof(p2p_HEADER) + expectedSize) &&
(0 == memcmp(expectedValue,
- &((p2p_HEADER_GENERIC*)msg)->data[0],
+ &msg[1],
expectedSize)) )
ok = YES;
SEMAPHORE_UP(sem);
@@ -129,7 +129,7 @@
noise = MALLOC(expectedSize + sizeof(p2p_HEADER));
noise->type = htons(p2p_PROTO_NOISE);
noise->size = htons(expectedSize + sizeof(p2p_HEADER));
- memcpy(&((p2p_HEADER_GENERIC*)noise)->data[0],
+ memcpy(&noise[1],
expectedValue,
expectedSize);
while (repeat > 0) {
Modified: GNUnet/src/util/tcpiotest.c
===================================================================
--- GNUnet/src/util/tcpiotest.c 2005-02-05 14:19:08 UTC (rev 184)
+++ GNUnet/src/util/tcpiotest.c 2005-02-05 14:31:21 UTC (rev 185)
@@ -122,8 +122,8 @@
static int testTransmission(GNUNET_TCP_SOCKET * a,
GNUNET_TCP_SOCKET * b) {
- CS_HEADER_GENERIC * hdr;
- CS_HEADER_GENERIC * buf;
+ CS_HEADER * hdr;
+ CS_HEADER * buf;
int i;
int j;
@@ -131,15 +131,15 @@
for (i=0;i<1024-sizeof(CS_HEADER);i+=7) {
fprintf(stderr, ".");
for (j=0;j<i;j++)
- hdr->data[j] = (char)i+j;
- hdr->cs_header.size = htons(i+sizeof(CS_HEADER));
- hdr->cs_header.type = 0;
- if (OK != writeToSocket(a, &hdr->cs_header)) {
+ ((char*)&hdr[1])[j] = (char)i+j;
+ hdr->size = htons(i+sizeof(CS_HEADER));
+ hdr->type = 0;
+ if (OK != writeToSocket(a, hdr)) {
FREE(hdr);
return 1;
}
buf = NULL;
- if (OK != readFromSocket(b, (CS_HEADER**)&buf)) {
+ if (OK != readFromSocket(b, &buf)) {
FREE(hdr);
return 2;
}
@@ -163,7 +163,7 @@
hdr = MALLOC(1024);
for (i=0;i<1024-sizeof(CS_HEADER);i+=11)
- ((CS_HEADER_GENERIC*)hdr)->data[i] = (char)i;
+ ((char*)&hdr[1])[i] = (char)i;
hdr->size = htons(64+sizeof(CS_HEADER));
hdr->type = 0;
while (OK == writeToSocketNonBlocking(a,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r185 - in GNUnet/src: applications/dht/tools applications/fs/module include server util,
grothoff <=