int main() { struct Allocator* alloc = MallocAllocator_new(1<<20); struct TestFramework* tf = TestFramework_setUp("\xad\x7e\xa3\x26\xaa\x01\x94\x0a\x25\xbc\x9e\x01\x26\x22\xdb\x69" "\x4f\xd9\xb4\x17\x7c\xf3\xf8\x91\x16\xf3\xcf\xe8\x5c\x80\xe1\x4a", alloc, NULL, NULL, NULL); CryptoAuth_addUser(String_CONST("passwd"), 1, String_CONST("TEST"), tf->cryptoAuth); struct Message* message; struct Interface iface = { .sendMessage = messageFromInterface, .senderContext = &message, .allocator = alloc }; SwitchCore_setRouterInterface(&iface, tf->switchCore); //////////////////////// int ret = reconnectionNewEndpointTest(tf->ifController, tf->publicKey, &message, alloc, tf->eventBase, tf->logger, &iface, tf->rand); Allocator_free(alloc); return ret; }
int main() { struct Allocator* alloc = MallocAllocator_new(1<<20); struct Writer* logwriter = FileWriter_new(stdout, alloc); struct Log* logger = &(struct Log) { .writer = logwriter }; struct event_base* eventBase = event_base_new(); struct CryptoAuth* ca = CryptoAuth_new(NULL, alloc, NULL, eventBase, logger); uint8_t publicKey[32]; CryptoAuth_getPublicKey(publicKey, ca); CryptoAuth_addUser(String_CONST("passwd"), 1, (void*)0x01, ca); struct SwitchCore* switchCore = SwitchCore_new(logger, alloc); struct Message* message; struct Interface iface = { .sendMessage = messageFromInterface, .senderContext = &message, .allocator = alloc }; SwitchCore_setRouterInterface(&iface, switchCore); // These are unused. struct DHTModuleRegistry* registry = DHTModuleRegistry_new(alloc); struct RouterModule* rm = RouterModule_register(registry, alloc, publicKey, eventBase, logger, NULL); struct InterfaceController* ifController = DefaultInterfaceController_new(ca, switchCore, rm, logger, eventBase, NULL, alloc); //////////////////////// return reconnectionNewEndpointTest(ifController, publicKey, &message, alloc, eventBase, logger, &iface); }