Skip to content

Commit

Permalink
cjd's editor window is only 100 characters wide :)
Browse files Browse the repository at this point in the history
  • Loading branch information
Caleb James DeLisle committed May 23, 2012
1 parent 49a5d9c commit 6b7f576
Show file tree
Hide file tree
Showing 28 changed files with 156 additions and 71 deletions.
4 changes: 3 additions & 1 deletion admin/AdminClient.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ static void doCall(Dict* message, struct Result* res, bool getCookie)
if (!getCookie) { if (!getCookie) {
calculateAuth(message, res->ctx->password, cookie, res->alloc); calculateAuth(message, res->ctx->password, cookie, res->alloc);


writer = ArrayWriter_new(res->public.messageBytes, AdminClient_MAX_MESSAGE_SIZE, res->alloc); writer = ArrayWriter_new(res->public.messageBytes,
AdminClient_MAX_MESSAGE_SIZE,
res->alloc);
if (StandardBencSerializer_get()->serializeDictionary(writer, message)) { if (StandardBencSerializer_get()->serializeDictionary(writer, message)) {
res->public.err = AdminClient_Error_SERIALIZATION_FAILED; res->public.err = AdminClient_Error_SERIALIZATION_FAILED;
return; return;
Expand Down
6 changes: 4 additions & 2 deletions admin/AuthorizedPasswords.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ static void add(Dict* args, void* vcontext, String* txid)
if (!(passwd && authType)) { if (!(passwd && authType)) {
sendResponse(String_CONST("Must specify authType, and password."), context->admin, txid); sendResponse(String_CONST("Must specify authType, and password."), context->admin, txid);
} else if (*authType < 1 || *authType > 255) { } else if (*authType < 1 || *authType > 255) {
sendResponse(String_CONST("Auth must be between 1 and 255 inclusive."), context->admin, txid); sendResponse(String_CONST("Auth must be between 1 and 255 inclusive."),
context->admin, txid);
} else { } else {
struct User* u = context->allocator->malloc(sizeof(struct User), context->allocator); struct User* u = context->allocator->malloc(sizeof(struct User), context->allocator);
// At some point this will be implemented... // At some point this will be implemented...
Expand All @@ -65,7 +66,8 @@ static void add(Dict* args, void* vcontext, String* txid)
txid); txid);
break; break;
case CryptoAuth_addUser_OUT_OF_SPACE: case CryptoAuth_addUser_OUT_OF_SPACE:
sendResponse(String_CONST("Out of memory to store password."), context->admin, txid); sendResponse(String_CONST("Out of memory to store password."),
context->admin, txid);
break; break;
case CryptoAuth_addUser_DUPLICATE: case CryptoAuth_addUser_DUPLICATE:
sendResponse(String_CONST("Password already added."), context->admin, txid); sendResponse(String_CONST("Password already added."), context->admin, txid);
Expand Down
3 changes: 2 additions & 1 deletion benc/Dict.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ Dict* Dict_new(const struct Allocator* allocator)
* only add a pointer to it in the dictionary. * only add a pointer to it in the dictionary.
* If dictionary is NULL then a new dictionary will be created and returned. * If dictionary is NULL then a new dictionary will be created and returned.
* *
* @param dictionary this must be a bencoded dictionary or NULL, if NULL then a new dictionary is made. * @param dictionary this must be a bencoded dictionary or NULL, if NULL then a new dictionary
is made.
* @param key the reference key to use for putting the entry in the dictionary. * @param key the reference key to use for putting the entry in the dictionary.
* @param value the value to insert with the key. * @param value the value to insert with the key.
* @param allocator the means to get memory for storing the dictionary entry wrapper. * @param allocator the means to get memory for storing the dictionary entry wrapper.
Expand Down
3 changes: 2 additions & 1 deletion benc/serialization/BencSerializer.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ struct BencSerializer
* dictionary and will leave the read pointer on the first character AFTER * dictionary and will leave the read pointer on the first character AFTER
* the 'e' which ends the dictionary. * the 'e' which ends the dictionary.
* @param allocator a Allocator which will be used to store data. * @param allocator a Allocator which will be used to store data.
* @param output a dictionary pointer which will be set to the output. Dict* out = NULL; is enough. * @param output a dictionary pointer which will be set to the output. Dict* out = NULL;
is enough.
* @return 0 if everything goes well -2 if -1 returned by read indicating an array underflow, * @return 0 if everything goes well -2 if -1 returned by read indicating an array underflow,
* -3 if content unparsable. * -3 if content unparsable.
*/ */
Expand Down
6 changes: 4 additions & 2 deletions benc/serialization/json/JsonBencSerializer.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ static inline int parseComment(const struct Reader* reader)
case '/':; case '/':;
return readUntil('\n', reader); return readUntil('\n', reader);
default: default:
printf("Warning: expected a comment starting with \"//\" or \"/*\", instead found \"/%c\"\n",chars[1]); printf("Warning: expected a comment starting with \"//\" or \"/*\", "
"instead found \"/%c\"\n",chars[1]);
return UNPARSABLE; return UNPARSABLE;
} }
} }
Expand Down Expand Up @@ -509,7 +510,8 @@ static int32_t parseGeneric(const struct Reader* reader,
break; break;


default: default:
printf("While looking for something to parse: expected one of 0 1 2 3 4 5 6 7 8 9 [ { \", found '%c'\n", firstChar); printf("While looking for something to parse: "
"expected one of 0 1 2 3 4 5 6 7 8 9 [ { \", found '%c'\n", firstChar);
return UNPARSABLE; return UNPARSABLE;
} }


Expand Down
2 changes: 1 addition & 1 deletion cjdroute.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ static int genconf()
" ],\n" " ],\n"
"\n" "\n"
" // Settings for administering and extracting information from your router.\n" " // Settings for administering and extracting information from your router.\n"
" // This interface provides API functions which can be called through a TCP socket.\n" " // This interface provides functions which can be called through a TCP socket.\n"
" \"admin\":\n" " \"admin\":\n"
" {\n" " {\n"
" // Port to bind the admin RPC server to.\n" " // Port to bind the admin RPC server to.\n"
Expand Down
5 changes: 4 additions & 1 deletion crypto/test/CryptoAuth_unit_test.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ struct CryptoAuth_Wrapper* setUp(uint8_t* myPrivateKey,
}); });


struct CryptoAuth_Wrapper* wrapper = struct CryptoAuth_Wrapper* wrapper =
allocator->clone(sizeof(struct CryptoAuth_Wrapper), allocator, &(struct CryptoAuth_Wrapper) { allocator->clone(sizeof(struct CryptoAuth_Wrapper),
allocator,
&(struct CryptoAuth_Wrapper)
{
.context = ca, .context = ca,
.wrappedInterface = iface .wrappedInterface = iface
}); });
Expand Down
5 changes: 3 additions & 2 deletions dht/Address.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ static inline bool Address_isSameIp(const struct Address* addr,
return memcmp(addr->key, addr2->key, Address_KEY_SIZE) == 0; return memcmp(addr->key, addr2->key, Address_KEY_SIZE) == 0;
} }


static inline bool Address_equalsSearchTarget(struct Address* addr, static inline bool Address_equalsSearchTarget(
const uint8_t searchTarget[Address_SEARCH_TARGET_SIZE]) struct Address* addr,
const uint8_t searchTarget[Address_SEARCH_TARGET_SIZE])
{ {
Address_getPrefix(addr); Address_getPrefix(addr);
return memcmp(addr->ip6.bytes, searchTarget, Address_SEARCH_TARGET_SIZE); return memcmp(addr->ip6.bytes, searchTarget, Address_SEARCH_TARGET_SIZE);
Expand Down
3 changes: 2 additions & 1 deletion dht/AddressMapper.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
* When an item is used, it is relocated to the head. Searching from the * When an item is used, it is relocated to the head. Searching from the
* head therefore means items will be checked in most-recently-used order. * head therefore means items will be checked in most-recently-used order.
* *
* When inserting a new item, the item to replace - the least-recently-used item - is simply the tail. * When inserting a new item,
* the item to replace - the least-recently-used item - is simply the tail.
* Then the tail is set to be the head, because it is the most recently used item. * Then the tail is set to be the head, because it is the most recently used item.
*/ */


Expand Down
5 changes: 4 additions & 1 deletion dht/ReplyModule.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ static int handleIncoming(struct DHTMessage* message, void* vcontext)
struct DHTModuleRegistry* registry = (struct DHTModuleRegistry*) vcontext; struct DHTModuleRegistry* registry = (struct DHTModuleRegistry*) vcontext;


struct DHTMessage* reply = struct DHTMessage* reply =
message->allocator->clone(sizeof(struct DHTMessage), message->allocator, &(struct DHTMessage) { message->allocator->clone(sizeof(struct DHTMessage),
message->allocator,
&(struct DHTMessage)
{
.replyTo = message, .replyTo = message,
.address = message->address, .address = message->address,
.allocator = message->allocator .allocator = message->allocator
Expand Down
13 changes: 7 additions & 6 deletions dht/dhtcore/NodeCollector.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -57,15 +57,16 @@ struct NodeCollector


/** /**
* Create a new NodeCollector. * Create a new NodeCollector.
* This will create a collector which sifts through nodes and finds the best nodes to serve a request. * This will create a collector which sifts through nodes and finds the best nodes to serve a
* Nodes which have the lowest distance:reach ratio will be collected. * request. Nodes which have the lowest distance:reach ratio will be collected.
* *
* @param targetAddress the address we are searching for. * @param targetAddress the address we are searching for.
* @param capacity the number of nodes to collect, if less than this number are added, some of the nodes * @param capacity the number of nodes to collect, if less than this number are added, some of
* will remain NULL pointers. * the nodes will remain NULL pointers.
* @param thisNodeAddress this node's address. * @param thisNodeAddress this node's address.
* @param allowNodesFartherThanUs if true then return nodes which are farther than the target then we are. * @param allowNodesFartherThanUs if true then return nodes which are farther than the target
* this is required for searches but unallowable for answering queries. * then we are. this is required for searches but unallowable
* for answering queries.
* @param logger * @param logger
* @param allocator the means of getting memory to store the collector. * @param allocator the means of getting memory to store the collector.
* @return a new collector. * @return a new collector.
Expand Down
5 changes: 3 additions & 2 deletions dht/dhtcore/NodeStore.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ struct NodeList* NodeStore_getNodesByAddr(struct Address* address,
* @param requestorsAddress if not NULL no responses will be returned which are * @param requestorsAddress if not NULL no responses will be returned which are
* closer to this node in physical space. * closer to this node in physical space.
* @param count the number of nodes to return. * @param count the number of nodes to return.
* @param allowNodesFartherThanUs if true then return nodes which are farther than the target then we are. * @param allowNodesFartherThanUs if true then return nodes which are farther than the target
* this is required for searches but unallowable for answering queries. * then we are. this is required for searches but unallowable
* for answering queries.
* @param allocator the memory allocator to use for getting the memory to store the output. * @param allocator the memory allocator to use for getting the memory to store the output.
*/ */
struct NodeList* NodeStore_getClosestNodes(struct NodeStore* store, struct NodeList* NodeStore_getClosestNodes(struct NodeStore* store,
Expand Down
4 changes: 3 additions & 1 deletion dht/dhtcore/test/SearchStore_test.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ int main()
srand(time(NULL)); srand(time(NULL));
char buffer[1024]; char buffer[1024];
struct Allocator* allocator = BufferAllocator_new(buffer, 1024); struct Allocator* allocator = BufferAllocator_new(buffer, 1024);
struct SearchNodeIndex index = {rand() % SearchStore_MAX_SEARCHES, rand() % SearchStore_SEARCH_NODES}; struct SearchNodeIndex index = {
rand() % SearchStore_MAX_SEARCHES, rand() % SearchStore_SEARCH_NODES
};
String* str = tidForSearchNodeIndex(&index, allocator); String* str = tidForSearchNodeIndex(&index, allocator);
struct SearchNodeIndex index2 = searchNodeIndexForTid(str); struct SearchNodeIndex index2 = searchNodeIndexForTid(str);
if (index.search - index2.search + index.node - index2.node) { if (index.search - index2.search + index.node - index2.node) {
Expand Down
21 changes: 12 additions & 9 deletions dht/dhtcore/test/TestFramework.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -26,21 +26,23 @@ __attribute__((unused));
static void TestFramework_registerBouncerModule(struct DHTModuleRegistry* registry, static void TestFramework_registerBouncerModule(struct DHTModuleRegistry* registry,
const struct Allocator* allocator) const struct Allocator* allocator)
{ {
struct DHTModule* module = allocator->clone(sizeof(struct DHTModule), allocator, &(struct DHTModule) { struct DHTModule* module =
.context = registry, allocator->clone(sizeof(struct DHTModule), allocator, &(struct DHTModule) {
.handleIncoming = bounceMessage .context = registry,
}); .handleIncoming = bounceMessage
});
DHTModules_register(module, registry); DHTModules_register(module, registry);
} }


static void TestFramework_registerOutputCatcher(struct DHTMessage** messagePointer, static void TestFramework_registerOutputCatcher(struct DHTMessage** messagePointer,
struct DHTModuleRegistry* registry, struct DHTModuleRegistry* registry,
const struct Allocator* allocator) const struct Allocator* allocator)
{ {
struct DHTModule* module = allocator->clone(sizeof(struct DHTModule), allocator, &(struct DHTModule) { struct DHTModule* module =
.context = messagePointer, allocator->clone(sizeof(struct DHTModule), allocator, &(struct DHTModule) {
.handleOutgoing = catchOutgoing .context = messagePointer,
}); .handleOutgoing = catchOutgoing
});
DHTModules_register(module, registry); DHTModules_register(module, registry);
} }


Expand All @@ -49,7 +51,8 @@ static void TestFramework_registerOutputCatcher(struct DHTMessage** messagePoint
static int bounceMessage(struct DHTMessage* message, void* vcontext) static int bounceMessage(struct DHTMessage* message, void* vcontext)
{ {
struct DHTModuleRegistry* registry = (struct DHTModuleRegistry*) vcontext; struct DHTModuleRegistry* registry = (struct DHTModuleRegistry*) vcontext;
struct DHTMessage* reply = message->allocator->malloc(sizeof(struct DHTMessage), message->allocator); struct DHTMessage* reply =
message->allocator->malloc(sizeof(struct DHTMessage), message->allocator);
reply->replyTo = message; reply->replyTo = message;
reply->allocator = message->allocator; reply->allocator = message->allocator;
reply->asDict = Dict_new(reply->allocator); reply->asDict = Dict_new(reply->allocator);
Expand Down
3 changes: 2 additions & 1 deletion interface/TUNInterface.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ static int openTunnel(const char* interfaceName, char assignedInterfaceName[IFNA


if (sscanf(interfaceName, "utun%i", &parsedUnit) != 1 || parsedUnit < 0) { if (sscanf(interfaceName, "utun%i", &parsedUnit) != 1 || parsedUnit < 0) {
fprintf(stderr, "Invalid utun device %s. " fprintf(stderr, "Invalid utun device %s. "
"Remove this configuration parameter to use automatic assignment.\n", interfaceName); "Remove this configuration parameter to use automatic assignment.\n",
interfaceName);
return -1; return -1;
} }


Expand Down
11 changes: 8 additions & 3 deletions interface/UDPInterface.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ int UDPInterface_beginConnection(const char* address,


uint8_t key[InterfaceController_KEY_SIZE]; uint8_t key[InterfaceController_KEY_SIZE];
keyForSockaddr(key, (struct sockaddr_in*) &addr, udpif); keyForSockaddr(key, (struct sockaddr_in*) &addr, udpif);
return InterfaceController_insertEndpoint(key, cryptoKey, password, &udpif->interface, udpif->ic); return
InterfaceController_insertEndpoint(key, cryptoKey, password, &udpif->interface, udpif->ic);
} }


static void beginConnectionAdmin(Dict* args, void* vcontext, String* txid) static void beginConnectionAdmin(Dict* args, void* vcontext, String* txid)
Expand Down Expand Up @@ -318,7 +319,10 @@ struct UDPInterface* UDPInterface_new(struct event_base* base,
struct sockaddr_storage addr; struct sockaddr_storage addr;
if (bindAddr != NULL) { if (bindAddr != NULL) {
context->addrLen = sizeof(struct sockaddr_storage); context->addrLen = sizeof(struct sockaddr_storage);
if (0 != evutil_parse_sockaddr_port(bindAddr, (struct sockaddr*) &addr, (int*) &context->addrLen)) { if (0 != evutil_parse_sockaddr_port(bindAddr,
(struct sockaddr*) &addr,
(int*) &context->addrLen))
{
exHandler->exception(__FILE__ " UDPInterface_new() Failed to parse address.", exHandler->exception(__FILE__ " UDPInterface_new() Failed to parse address.",
-1, exHandler); -1, exHandler);
return NULL; return NULL;
Expand Down Expand Up @@ -349,7 +353,8 @@ struct UDPInterface* UDPInterface_new(struct event_base* base,


context->socket = socket(addrFam, SOCK_DGRAM, 0); context->socket = socket(addrFam, SOCK_DGRAM, 0);
if (context->socket == -1) { if (context->socket == -1) {
exHandler->exception(__FILE__ " UDPInterface_new() call to socket() failed.", -3, exHandler); exHandler->exception(__FILE__ " UDPInterface_new() call to socket() failed.",
-3, exHandler);
return NULL; return NULL;
} }


Expand Down
6 changes: 4 additions & 2 deletions interface/test/InterfaceController_test.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -128,9 +128,11 @@ static int reconnectionNewEndpointTest(struct InterfaceController* ifController,
Hex_decode((uint8_t*) &label_be, 8, hexBuffer, 16); Hex_decode((uint8_t*) &label_be, 8, hexBuffer, 16);
uint64_t rev_label = Bits_bitReverse64(Endian_bigEndianToHost64(label_be)); uint64_t rev_label = Bits_bitReverse64(Endian_bigEndianToHost64(label_be));
// check label is decoded to 0 // check label is decoded to 0
Assert_always(0 == NumberCompress_getDecompressed(rev_label, NumberCompress_bitsUsedForLabel(rev_label))); Assert_always(0 == NumberCompress_getDecompressed(rev_label,
NumberCompress_bitsUsedForLabel(rev_label)));
// check no other bits are set // check no other bits are set
Assert_always(rev_label == NumberCompress_getCompressed(0, NumberCompress_bitsUsedForLabel(rev_label))); uint64_t out = NumberCompress_getCompressed(0, NumberCompress_bitsUsedForLabel(rev_label));
Assert_always(rev_label == out);
return 0; return 0;
} }


Expand Down
6 changes: 4 additions & 2 deletions memory/Allocator.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ struct Allocator
* @param numberOfBytes how much memory to allocate. * @param numberOfBytes how much memory to allocate.
* @param thisAllocator the memory allocator. * @param thisAllocator the memory allocator.
* @param toClone a pointer to something which will be cloned into the newly allocated memory, * @param toClone a pointer to something which will be cloned into the newly allocated memory,
* if this is NULL or is not as large as numberOfBytes, undefined behavior will result. * if this is NULL or is not as large as numberOfBytes, undefined behavior will
* result.
* @return a pointer to the newly allocated memory. * @return a pointer to the newly allocated memory.
*/ */
void* (* const clone)(size_t numberOfBytes, void* (* const clone)(size_t numberOfBytes,
Expand All @@ -108,7 +109,8 @@ struct Allocator
* The allocation will be aligned on the size of a pointer, if you need further alignment then * The allocation will be aligned on the size of a pointer, if you need further alignment then
* you must handle it manually. * you must handle it manually.
* *
* @param originalAllocation a pointer to the original memory allocation which is to be reallocated. * @param originalAllocation a pointer to the original memory allocation which is to be
* reallocated.
* @param numberOfBytes how much memory to allocate. * @param numberOfBytes how much memory to allocate.
* @param thisAllocator the memory allocator. * @param thisAllocator the memory allocator.
* @return a pointer to the newly allocated memory. * @return a pointer to the newly allocated memory.
Expand Down
14 changes: 9 additions & 5 deletions memory/BufferAllocator.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ static void* allocatorClone(size_t length, const struct Allocator* allocator, co
} }


/** @see Allocator->realloc() */ /** @see Allocator->realloc() */
static void* allocatorRealloc(const void* original, size_t length, const struct Allocator* allocator) static void* allocatorRealloc(const void* original,
size_t length,
const struct Allocator* allocator)
{ {
if (original == NULL) { if (original == NULL) {
return allocatorMalloc(length, allocator); return allocatorMalloc(length, allocator);
Expand All @@ -109,10 +111,12 @@ static void* allocatorRealloc(const void* original, size_t length, const struct
struct BufferAllocator_context* context = struct BufferAllocator_context* context =
(struct BufferAllocator_context*) allocator->context; (struct BufferAllocator_context*) allocator->context;
char* pointer = context->pointer; char* pointer = context->pointer;
size_t amountToClone = size_t amountToClone = (length < (size_t)(pointer - (char*)original))
length < (size_t)(pointer - (char*)original) ? length : (size_t)(pointer - (char*)original); ? length
: (size_t)(pointer - (char*)original);


// The likelyhood of nothing having been allocated since is almost 0 so we will always create a new // The likelyhood of nothing having been allocated since is
// almost 0 so we will always create a new
// allocation and copy into it. // allocation and copy into it.
void* newAlloc = allocator->malloc(length, allocator); void* newAlloc = allocator->malloc(length, allocator);
Bits_memcpy(newAlloc, original, amountToClone); Bits_memcpy(newAlloc, original, amountToClone);
Expand Down Expand Up @@ -231,7 +235,7 @@ struct Allocator* BufferAllocator_new(void* buffer, size_t length)
}; };


/* Get the pointer to the context where it's written in the buffer. */ /* Get the pointer to the context where it's written in the buffer. */
struct BufferAllocator_context* contextPtr = (struct BufferAllocator_context*) allocator.context; struct BufferAllocator_context* contextPtr = allocator.context;


/* have to advance the pointer so as not to clobber the context. */ /* have to advance the pointer so as not to clobber the context. */
contextPtr->pointer += sizeof(struct BufferAllocator_context); contextPtr->pointer += sizeof(struct BufferAllocator_context);
Expand Down
9 changes: 6 additions & 3 deletions net/Ducttape.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ static inline bool isRouterTraffic(struct Message* message, struct Headers_IP6He
struct Headers_UDPHeader* uh = (struct Headers_UDPHeader*) message->bytes; struct Headers_UDPHeader* uh = (struct Headers_UDPHeader*) message->bytes;
return message->length >= Headers_UDPHeader_SIZE return message->length >= Headers_UDPHeader_SIZE
&& uh->sourceAndDestPorts == 0 && uh->sourceAndDestPorts == 0
&& (int) Endian_bigEndianToHost16(uh->length_be) == message->length - Headers_UDPHeader_SIZE; && (int) Endian_bigEndianToHost16(uh->length_be) ==
(message->length - Headers_UDPHeader_SIZE);
} }


/** /**
Expand Down Expand Up @@ -638,7 +639,8 @@ static uint8_t incomingFromSwitch(struct Message* message, struct Interface* swi
} else { } else {
#ifdef Log_DEBUG #ifdef Log_DEBUG
uint8_t switchAddr[20]; uint8_t switchAddr[20];
AddrTools_printPath(switchAddr, Endian_bigEndianToHost64(switchHeader->label_be)); AddrTools_printPath(switchAddr,
Endian_bigEndianToHost64(switchHeader->label_be));
Log_debug1(context->logger, Log_debug1(context->logger,
"Dropped traffic packet from unknown node. (%s)\n", "Dropped traffic packet from unknown node. (%s)\n",
&switchAddr); &switchAddr);
Expand Down Expand Up @@ -689,7 +691,8 @@ struct Ducttape* Ducttape_register(Dict* config,
context->forwardTo = NULL; context->forwardTo = NULL;
AddressMapper_init(&context->addrMap); AddressMapper_init(&context->addrMap);


struct CryptoAuth* cryptoAuth = CryptoAuth_new(config, allocator, privateKey, eventBase, logger); struct CryptoAuth* cryptoAuth =
CryptoAuth_new(config, allocator, privateKey, eventBase, logger);
CryptoAuth_getPublicKey(context->myAddr.key, cryptoAuth); CryptoAuth_getPublicKey(context->myAddr.key, cryptoAuth);
Address_getPrefix(&context->myAddr); Address_getPrefix(&context->myAddr);


Expand Down
5 changes: 5 additions & 0 deletions scripts/checkfiles.pl
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ sub error {
} }


$lineInfo = "$fileName:$lineNum"; $lineInfo = "$fileName:$lineNum";

if (length($line) > 100) {
error("cjd's editor window is only 100 characters wide");
}

if ($fileName =~ /\.h$/) { if ($fileName =~ /\.h$/) {


my $n = $name; my $n = $name;
Expand Down
Loading

0 comments on commit 6b7f576

Please sign in to comment.