Skip to content
Browse files

Standardize on Wxyz_pvt.h as a private header for defining structures…

… and things which are internal and expected to change more often.
  • Loading branch information...
1 parent a78fa0b commit 05efff8de6aa8cb6c772867c7f14626aca81d580 Caleb James DeLisle committed May 31, 2012
View
19 crypto/CryptoAuth.c
@@ -12,21 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "crypto_box_curve25519xsalsa20poly1305.h"
-#include "crypto_core_hsalsa20.h"
-#include "crypto_hash_sha256.h"
-#include "crypto_scalarmult_curve25519.h"
-#include "crypto_stream_salsa20.h"
-#include "crypto_stream_xsalsa20.h"
-
#include "crypto/Crypto.h"
-#include "crypto/CryptoAuth.h"
-#include "crypto/CryptoAuth_struct.h"
+#include "crypto/CryptoAuth_pvt.h"
#include "crypto/ReplayProtector.h"
#include "interface/Interface.h"
#include "benc/Object.h"
#include "util/Log.h"
#include "memory/Allocator.h"
+#include "util/Assert.h"
#include "util/Bits.h"
#include "util/Endian.h"
#include "util/Hex.h"
@@ -35,10 +28,16 @@
#include "wire/Headers.h"
#include "wire/Message.h"
+#include "crypto_box_curve25519xsalsa20poly1305.h"
+#include "crypto_core_hsalsa20.h"
+#include "crypto_hash_sha256.h"
+#include "crypto_scalarmult_curve25519.h"
+#include "crypto_stream_salsa20.h"
+#include "crypto_stream_xsalsa20.h"
+
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
-#include "util/Assert.h"
#include <event2/event.h>
#ifdef WIN32
View
3 crypto/CryptoAuth.h
@@ -27,6 +27,9 @@
struct CryptoAuth;
+/** The internal interface wrapper struct. */
+struct CryptoAuth_Wrapper;
+
/**
* Associate a password:authtype pair with a user object.
* Calling CryptoAuth_getUser() on any interface which has established a connection with
View
6 crypto/CryptoAuth_struct.h → crypto/CryptoAuth_pvt.h
@@ -12,9 +12,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef CryptoAuth_struct_H
-#define CryptoAuth_struct_H
-
+#ifndef CryptoAuth_pvt_H
+#define CryptoAuth_pvt_H
+#include "crypto/CryptoAuth.h"
#include "crypto/ReplayProtector.h"
#include "interface/Interface.h"
#include "benc/Object.h"
View
3 crypto/test/CryptoAuth_unit_test.c
@@ -12,9 +12,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "crypto/CryptoAuth_struct.h"
#include "crypto/Crypto.h"
-#include "crypto/CryptoAuth.h"
+#include "crypto/CryptoAuth_pvt.h"
#include "crypto/test/Exports.h"
#include "io/FileWriter.h"
#include "memory/BufferAllocator.h"
View
2 crypto/test/Exports.h
@@ -17,7 +17,7 @@
#include <stdint.h>
-#include "crypto/CryptoAuth_struct.h"
+#include "crypto/CryptoAuth.h"
#include "wire/Message.h"
void Exports_encryptRndNonce(uint8_t nonce[24], struct Message* msg, uint8_t secret[32]);
View
6 dht/dhtcore/Janitor.c
@@ -18,10 +18,8 @@
#include "dht/dhtcore/Node.h"
#include "dht/dhtcore/NodeList.h"
#include "dht/dhtcore/NodeHeader.h"
-#include "dht/dhtcore/NodeStore.h"
-#include "dht/dhtcore/NodeStore_struct.h"
-#include "dht/dhtcore/RouterModule.h"
-#include "dht/dhtcore/RouterModule_struct.h"
+#include "dht/dhtcore/NodeStore_pvt.h"
+#include "dht/dhtcore/RouterModule_pvt.h"
#include "benc/Object.h"
#include "memory/Allocator.h"
#include "memory/BufferAllocator.h"
View
5 dht/dhtcore/NodeStore.c
@@ -24,16 +24,15 @@
#include "dht/dhtcore/LinkStateNodeCollector.h"
#include "dht/dhtcore/Node.h"
#include "dht/dhtcore/NodeHeader.h"
-#include "dht/dhtcore/NodeStore.h"
-#include "dht/dhtcore/NodeStore_struct.h"
+#include "dht/dhtcore/NodeStore_pvt.h"
#include "dht/dhtcore/NodeCollector.h"
#include "dht/dhtcore/NodeList.h"
+#include "util/Assert.h"
#include "util/Bits.h"
#include "util/Log.h"
#include "switch/NumberCompress.h"
#include "switch/LabelSplicer.h"
-#include "util/Assert.h"
#include <stdbool.h>
#include <stdio.h>
#include <inttypes.h>
View
4 dht/dhtcore/NodeStore_struct.h → dht/dhtcore/NodeStore_pvt.h
@@ -12,8 +12,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef NodeStore_struct_H
-#define NodeStore_struct_H
+#ifndef NodeStore_pvt_H
+#define NodeStore_pvt_H
#include "dht/dhtcore/NodeStore.h"
#include "util/Log.h"
View
3 dht/dhtcore/RouterModule.c
@@ -16,8 +16,7 @@
#include "benc/Object.h"
#include "dht/Address.h"
#include "dht/dhtcore/Janitor.h"
-#include "dht/dhtcore/RouterModule.h"
-#include "dht/dhtcore/RouterModule_struct.h"
+#include "dht/dhtcore/RouterModule_pvt.h"
#include "dht/dhtcore/Node.h"
#include "dht/dhtcore/NodeList.h"
#include "dht/dhtcore/NodeStore.h"
View
4 dht/dhtcore/RouterModule_struct.h → dht/dhtcore/RouterModule_pvt.h
@@ -12,8 +12,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef RouterModule_struct_H
-#define RouterModule_struct_H
+#ifndef RouterModule_pvt_H
+#define RouterModule_pvt_H
/**
* Internal structures which are needed for testing but should not be exposed to the outside world.
View
248 dht/dhtcore/test/RouterModule_test_disabled.c
@@ -1,248 +0,0 @@
-/* vim: set expandtab ts=4 sw=4: */
-/*
- * You may redistribute this program and/or modify it under the terms of
- * the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include <stdbool.h>
-#include "util/Assert.h"
-#include <string.h>
-#include <stdio.h>
-#include <event2/event.h>
-
-#include "dht/DHTModules.h"
-#include "dht/SerializationModule.h"
-#include "dht/ReplyModule.h"
-#include "dht/dhtcore/Node.h"
-#include "dht/dhtcore/NodeStore.h"
-#include "dht/dhtcore/RouterModule.h"
-#include "dht/dhtcore/RouterModule_struct.h"
-#include "dht/dhtcore/test/TestFramework.h"
-#include "memory/Allocator.h"
-#include "memory/BufferAllocator.h"
-#include "util/Bits.h"
-
-#define MY_ADDRESS "hgzyxwvutsrqponmlkji 3"
-// This key converts to address: fc39:c3ba:c711:00aa:666d:90b0:1ab6:e8c3
-// this is the most significant byte ^^
-// Which puts it in the center of our set of addresses.
-
-void testQuery(struct DHTMessage** outMessagePtr,
- struct DHTModuleRegistry* registry,
- struct Allocator* allocator)
-{
- *outMessagePtr = NULL;
- // on the wire xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
- // d1:q2:fn 3:tar16: < ipv6 address > 4:txid2: aae
- const char* requestMessage =
- "d"
- "1:q" "2:fn"
- "3:tar" "16:" "\xfc\x01\x01\x01\x01\x01\x01\x01\x21\x01\x01\x01\x01\x01\x01\x01"
- "4:txid" "2:aa"
- "e";
-
- struct Address addr;
- memset(&addr, 0, sizeof(struct Address));
- Bits_memcpyConst(&addr.key, "ponmlkjihgzyxwvutsrq \0", 32);
- Bits_memcpyConst(&addr.networkAddress_be, " 00011 ", 8);
- struct DHTMessage message =
- {
- .length = strlen(requestMessage),
- .address = &addr,
- .allocator = allocator,
- };
- Bits_memcpyConst(message.bytes, requestMessage, message.length);
-
- DHTModules_handleIncoming(&message, registry);
-
- struct DHTMessage* outMessage = *outMessagePtr;
- Assert_always(outMessage != NULL);
- Assert_always(outMessage->replyTo != NULL);
-
- // Another hack because the output contains nulls, see: #define ADD_NODE()
- for (int i = 0; i < outMessage->length; i++) {
- if (outMessage->bytes[i] == '\0') {
- outMessage->bytes[i] = ' ';
- }
- }
- outMessage->bytes[outMessage->length] = '\0';
-
- printf("\n\n%s\n%d\n", outMessage->bytes, (int) outMessage->length);
-
- // on the wire xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
- // d1:n280: < content - multiple of forty bytes long > 3:txid2: aae
- const char* expectedResponse =
- "d"
- "1:n" "280:"
- "cdefghijklmnopqrstuv 00009 "
- "qponmlkjihgzyxwvutsr 00001 "
- "fghijklmnopqrstuvwxy 00006 "
- "lkjihgzyxwvutsrqponm 00005 "
- "onmlkjihgzyxwvutsrqp 00003 "
- "bcdefghijklmnopqrstu 00002 "
- "mlkjihgzyxwvutsrqpon 00004 "
- "4:txid" "2:aa"
- "e";
-
- Assert_always(outMessage->length == strlen(expectedResponse));
- Assert_always(memcmp(outMessage->bytes, expectedResponse, strlen(expectedResponse)) == 0);
-}
-
-bool testSearch_callback(void* context, struct DHTMessage* message)
-{
- *((struct DHTMessage**) context) = message;
- return true;
-}
-
-void testSearch(struct DHTMessage** outMessagePtr,
- struct RouterModule* routerModule,
- struct DHTModuleRegistry* registry,
- struct Allocator* allocator)
-{
- *outMessagePtr = NULL;
-
- #define REQUEST_HASH "\xfc\x01\x01\x01\x01\x01\x01\x01\x21\x01\x01\x01\x01\x01\x01\x01"
-
- struct DHTMessage* callbackMessage = NULL;
-
- RouterModule_beginSearch((uint8_t*) REQUEST_HASH,
- testSearch_callback,
- &callbackMessage,
- routerModule);
-
- struct DHTMessage* outMessage = *outMessagePtr;
- Assert_always(outMessage != NULL);
-
- // Need to be able to work around the fact that the string contains nulls.
- #define EXPECTED_OUTPUT(tid) \
- "d" \
- "1:q" "2:fn" \
- "3:tar" "16:" REQUEST_HASH \
- "4:txid" "2:" tid \
- "e"
-
- for (uint32_t i = 0; i < (uint32_t) outMessage->length; i++) {
- //printf("%.2X", (unsigned int) outMessage->bytes[i] & 0xFF);
- }
- //printf("\n%s\n", outMessage->bytes);
- //printf("\n%s\n", outMessage->peerAddress);
-
- Assert_always(outMessage->length == strlen(EXPECTED_OUTPUT("xx")));
- Assert_always(memcmp(outMessage->bytes, EXPECTED_OUTPUT("8\x00"), outMessage->length) == 0);
- //Assert_always(strcmp(outMessage->address->networkAddress, " 00014 ") == 0);
- // In a normal DHT, 00014 is the closest node, however, 00011 has sent us a message in
- // testQuery() and thus his reach is 1 and he beats all other nodes which are 0-reach.
- // Search queries are allowed to select nodes which are further from the target than us.
- Assert_always(strcmp((char*) &outMessage->address->networkAddress_be, " 00011 ") == 0);
-
- #undef EXPECTED_OUTPUT
-
- #define CRAFTED_REPLY(tid) \
- "d" \
- "1:n" "200:" \
- "97bkjs8qpd5hc1mubj3qbfyqzmzxp3rg" " 00017 " \
- "by1szn122nqk1vncjtm612444rlh6ztr" " 00018 " \
- "u42wbyr0wznhkbqr1r7u627dwsvb8853" " 00019 " \
- "97bkjs8qpd5hc1mubj3qbfyqzmzxp3rg" " 00020 " \
- "2lr8w01hhrxqng8mm8nf3nlwh5nyxzyl" " 00021 " \
- "4:txid" "2:" tid \
- "e"
-
- struct Address address = {
- .key = "ponmlkjihgzyxwvutsrq \0"
- };
- Bits_memcpyConst(&address.networkAddress_be, " 00011 ", 8);
-
- struct DHTMessage message =
- {
- .length = strlen(CRAFTED_REPLY("xx")),
- .allocator = allocator,
- .address = &address
- };
- Bits_memcpyConst(message.bytes, CRAFTED_REPLY("8\x00"), message.length);
- // Bits_memcpyConst(message.peerAddress, peerAddress, 18);
-
- *outMessagePtr = NULL;
-
- DHTModules_handleIncoming(&message, registry);
-
- // Make sure the callback was called.
- Assert_always(callbackMessage != NULL);
-
- // Make sure the node was promoted for it's fine service :P
- struct Address addr;
- Bits_memcpyConst(&addr, 0, sizeof(struct Address));
- Bits_memcpyConst(&addr.key, "ponmlkjihgzyxwvutsrq \0", 32);
- struct Node* node1 =
- NodeStore_getNode(routerModule->nodeStore, &addr);
- //printf("node reach = %d", node1->reach);
- Assert_always(node1->reach == 1601894175);
-
- /* outMessage = *outMessagePtr;
- Assert_always(outMessage != NULL);
-
- Assert_always(strcmp("000022", outMessage->peerAddress) == 0);*/
-}
-
-int main()
-{
- char buffer[1<<20];
- struct Allocator* allocator = BufferAllocator_new(buffer, 1<<20);
- struct DHTModuleRegistry* registry = DHTModules_new(allocator);
-
- ReplyModule_register(registry, allocator);
- struct RouterModule* routerModule =
- RouterModule_register(registry, allocator, (uint8_t*) MY_ADDRESS, event_base_new(), NULL);
-
- SerializationModule_register(registry, allocator);
-
- struct DHTMessage* outMessage;
- // dummy "network module" which just catches outgoing messages and makes them available.
- TestFramework_registerOutputCatcher(&outMessage, registry, allocator);
-
- struct Address addr;
-
- // damn this \0, was a mistake but to fix it would break all of the hashes :(
- #define ADD_NODE(address, netAddr) \
- memset(&addr, 0, sizeof(struct Address)); \
- Bits_memcpyConst(&addr.networkAddress_be, netAddr " ", 8); \
- Bits_memcpyConst(&addr.key, (uint8_t*) address " \0", 32); \
- RouterModule_addNode(&addr, routerModule)
-
-// most significant byte --vv
- ADD_NODE("qponmlkjihgzyxwvutsr", " 00001"); // fce8:573b:d230:ca3b 1c4e:f9d6 0632:9445
- ADD_NODE("bcdefghijklmnopqrstu", " 00002"); // fc65:9f4c:c061:84f9 2018:6e31 de3d:3bcf
- ADD_NODE("onmlkjihgzyxwvutsrqp", " 00003"); // fcbe:26ce:5c7a:9a0f 205b:358c b8f8:08bb
-// search target --> fc01:0101:0101:0101 2101:0101 0101:0101
- ADD_NODE("mlkjihgzyxwvutsrqpon", " 00004"); // fc08:d8e6:e000:c95c 2192:d676 94f9:63a7
- ADD_NODE("lkjihgzyxwvutsrqponm", " 00005"); // fc7c:6c8d:e5ee:cf99 2f16:06c7 95ca:0c0b
- ADD_NODE("fghijklmnopqrstuvwxy", " 00006"); // fcac:3963:cbd1:6390 3e83:be89 a23f:ce66
- ADD_NODE("jihgzyxwvutsrqponmlk", " 00007"); // fc2e:3a5e:5e47:9769 4964:8f7f 3894:8c07
- ADD_NODE("kjihgzyxwvutsrqponml", " 00008"); // fc37:10aa:39ed:12bf 4a70:1507 dbe9:a054
- ADD_NODE("cdefghijklmnopqrstuv", " 00009"); // fcaa:113e:88da:d432 65f0:1c14 38d9:b656
-// this node --> fc39:c3ba:c711:00aa 666d:90b0 1ab6:e8c3
- ADD_NODE("rqponmlkjihgzyxwvuts", " 00010"); // fc43:41e7:2adc:d13b 78ce:1959 e4cc:c76e
- ADD_NODE("ponmlkjihgzyxwvutsrq", " 00011"); // fc83:2ab3:b65b:9ad1 7e7b:f61f e0fa:cb40
- ADD_NODE("efghijklmnopqrstuvwx", " 00012"); // fc08:0ba6:a8e2:7731 9dae:f9fd e502:767c
- ADD_NODE("abcdefghijklmnopqrst", " 00013"); // fc81:cab3:eda0:61aa 9fff:bdde 0168:f0dd
- ADD_NODE("ihgzyxwvutsrqponmlkj", " 00014"); // fc49:8fc7:7e43:981a bac1:0b5d 77fb:8818
- ADD_NODE("nmlkjihgzyxwvutsrqpo", " 00015"); // fc69:61a1:2bec:1444 bb9e:47d1 f8b3:a6a0
- ADD_NODE("defghijklmnopqrstuvw", " 00016"); // fc40:1d18:89a6:9a7e c8af:20fd 5c9f:8140
- ADD_NODE("ghijklmnopqrstuvwxyz", " 00017"); // fc74:0f2e:d77a:e5e7 cf4e:8fe9 7791:98e1
-
-
- #undef ADD_NODE
-
- testQuery(&outMessage, registry, allocator);
- testSearch(&outMessage, routerModule, registry, allocator);
-
- return 0;
-}
View
3 dht/dhtcore/test/TestFramework.h
@@ -12,6 +12,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifndef TestFramework_H
+#define TestFramework_H
+
#include "memory/Allocator.h"
#include "dht/DHTModules.h"
#include "dht/CJDHTConstants.h"
View
3 interface/TUNConfigurator.c
@@ -14,8 +14,7 @@
*/
#include "interface/Interface.h"
#include "interface/TUNConfigurator.h"
-#include "interface/TUNInterface.h"
-#include "interface/TUNInterface_struct.h"
+#include "interface/TUNInterface_pvt.h"
#include "util/AddrTools.h"
#include <stdio.h>
View
2 interface/TUNInterface.c
@@ -14,7 +14,7 @@
*/
#include "interface/Interface.h"
#include "interface/TUNInterface.h"
-#include "interface/TUNInterface_struct.h"
+#include "interface/TUNInterface_pvt.h"
#include "benc/String.h"
#include "util/Endian.h"
View
4 interface/TUNInterface_struct.h → interface/TUNInterface_pvt.h
@@ -12,8 +12,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef TUNInterface_struct_H
-#define TUNInterface_struct_H
+#ifndef TUNInterface_pvt_H
+#define TUNInterface_pvt_H
#include "interface/Interface.h"
#include "benc/String.h"
View
3 interface/W32TUNInterface.c
@@ -13,8 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "interface/Interface.h"
-#include "interface/TUNInterface.h"
-#include "interface/TUNInterface_struct.h"
+#include "interface/TUNInterface_pvt.h"
#include "benc/String.h"
#include "util/Endian.h"
View
2 net/DefaultInterfaceController.c
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "crypto/CryptoAuth_struct.h"
+#include "crypto/CryptoAuth_pvt.h"
#include "net/DefaultInterfaceController.h"
#include "interface/InterfaceMap.h"
#include "memory/Allocator.h"
View
3 net/Ducttape.c
@@ -27,8 +27,7 @@
#include "util/Log.h"
#include "memory/Allocator.h"
#include "memory/BufferAllocator.h"
-#include "net/Ducttape.h"
-#include "net/Ducttape_struct.h"
+#include "net/Ducttape_pvt.h"
#include "switch/SwitchCore.h"
#include "util/Bits.h"
#include "util/checksum/Checksum.h"
View
4 net/Ducttape_struct.h → net/Ducttape_pvt.h
@@ -12,8 +12,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef Ducttape_struct_H
-#define Ducttape_struct_H
+#ifndef Ducttape_pvt_H
+#define Ducttape_pvt_H
#include "dht/Address.h"
#include "dht/AddressMapper.h"
View
1 net/SwitchPinger.h
@@ -12,7 +12,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
#ifndef SwitchPinger_H
#define SwitchPinger_H
View
5 net/SwitchPinger_admin.h
@@ -12,6 +12,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifndef SwitchPinger_admin_H
+#define SwitchPinger_admin_H
+
#include "admin/Admin.h"
#include "benc/String.h"
#include "benc/Dict.h"
@@ -23,3 +26,5 @@
void SwitchPinger_admin_register(struct SwitchPinger* sp,
struct Admin* admin,
struct Allocator* alloc);
+
+#endif
View
18 scripts/checkfiles.pl
@@ -49,20 +49,28 @@ sub error {
$fileName =~ /^.*\/(.*)\..*$/ or die;
my $name = $1;
open FILE, "$fileName" or die $!;
- my $lineNum = 1;
+ my $lineNum = 0;
my $parenthCount = 0;
my $functionParenthCount = 0;
my $expectBracket = 0;
foreach my $line (split("\n", <FILE>)) {
$lineNum++;
- $lineInfo = "$fileName:" . ($lineNum - 1);
+ $lineInfo = "$fileName:" . ($lineNum);
- if ($lineNum < scalar(@headerArray)) {
- my $expectedLine = $headerArray[$lineNum - 2];
+ if ($lineNum < scalar(@headerArray) + 1) {
+ my $expectedLine = $headerArray[$lineNum - 1];
if (index($line, $expectedLine) == -1) {
error("missing header\n$expectedLine\n$line");
}
+ } elsif ($fileName =~ /\.h$/ && $lineNum < scalar(@headerArray) + 2) {
+ if ($line !~ /^#ifndef ${name}_H$/) {
+ error("expected #ifndef ${name}_H found ${line}");
+ }
+ } elsif ($fileName =~ /\.h$/ && $lineNum < scalar(@headerArray) + 3) {
+ if ($line !~ /^#define ${name}_H$/) {
+ error("expected #define ${name}_H found ${line}");
+ }
}
$ignore = ($line =~ /CHECKFILES_IGNORE/);
@@ -112,7 +120,7 @@ sub error {
my $n = $name;
# If the name is CryptoAuth_struct.h, it's ok to make a structure called CryptoAuth
- if ($name =~ /^(.*)_struct$/) {
+ if ($name =~ /^(.*)_pvt$/) {
$n = $1;
}
View
5 test/TestFramework.h
@@ -12,6 +12,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifndef TestFramework_H
+#define TestFramework_H
+
#include "net/Ducttape.h"
struct Ducttape* TestFramework_setUp();
+
+#endif
View
3 test/cjdroute_routerPing_test.c
@@ -14,8 +14,7 @@
*/
#include "memory/MallocAllocator.h"
#include "memory/Allocator.h"
-#include "net/Ducttape.h"
-#include "net/Ducttape_struct.h"
+#include "net/Ducttape_pvt.h"
#include "util/Base32.h"
#include "util/checksum/Checksum.h"
View
13 util/Assert.h
@@ -12,12 +12,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifdef Assert_H
- // This is needed every time the file is pulled in to prevent struct name collisions.
- #define Assert_COUNTER2 Assert_COUNTER
- #undef Assert_COUNTER
- #define Assert_COUNTER Assert_GLUE(Assert_COUNTER2, x)
-#else
+#ifndef Assert_H
#define Assert_H
#include "util/Log.h"
@@ -56,5 +51,9 @@ static inline void Assert_internal(const char* expr, int isTrue, const char* fil
// Turn off assertions when the code is more stable.
#define Assert_true(expr) Assert_always(expr)
-
+#else /* #ifdef Assert_H */
+ // This is needed every time the file is pulled in to prevent struct name collisions.
+ #define Assert_COUNTER2 Assert_COUNTER
+ #undef Assert_COUNTER
+ #define Assert_COUNTER Assert_GLUE(Assert_COUNTER2, x)
#endif

0 comments on commit 05efff8

Please sign in to comment.
Something went wrong with that request. Please try again.