void RocketMenuPlugin::ActivateNextOption(Rocket::Core::Element *menu_item) { OptionsData *data = GetOptionsData(menu_item); if (data != NULL) { Rocket::Core::ElementList::iterator next = data->current+1; if (next == data->options.end()) { next = data->options.begin(); } ActivateOption(data, next); } }
void test_CryptoNAKPacketReject(void) { // Activate authentication option ActivateOption("-a", "123"); TEST_ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION)); int pkt_len = LEN_PKT_NOMAC + 4; // + 4 byte MAC = Crypto-NAK TEST_ASSERT_EQUAL(SERVER_AUTH_FAIL, process_pkt(&testpkt, &testsock, pkt_len, MODE_SERVER, &testspkt, "UnitTest")); }
void test_UnauthenticatedPacketReject(void) { //sntptest(); // Activate authentication option ActivateOption("-a", "123"); TEST_ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION)); int pkt_len = LEN_PKT_NOMAC; // We demand authentication, but no MAC header is present. TEST_ASSERT_EQUAL(SERVER_AUTH_FAIL, process_pkt(&testpkt, &testsock, pkt_len, MODE_SERVER, &testspkt, "UnitTest")); }
void RocketMenuPlugin::ActivateOption(Rocket::Core::Element *menu_item, const Rocket::Core::String& option_id, bool notify_delegate) { OptionsData *data = GetOptionsData(menu_item); if (data != NULL) { Rocket::Core::ElementList::iterator next = data->options.end(); for (Rocket::Core::ElementList::iterator i = data->options.begin(); i != data->options.end(); i++) { if ((*i)->GetId() == option_id) { next = i; break; } } if (next != data->options.end()) { ActivateOption(data, next, notify_delegate); } } }
void PrepareAuthenticationTest(int key_id, int key_len, const char* type, const void* key_seq) { char str[25]; sprintf(str, "%d", key_id); ActivateOption("-a", str); key_cnt = 1; key_ptr = malloc(sizeof(struct key)); key_ptr->next = NULL; key_ptr->key_id = key_id; key_ptr->key_len = key_len; memcpy(key_ptr->type, "MD5", 3); TEST_ASSERT_TRUE(key_len < sizeof(key_ptr->key_seq)); memcpy(key_ptr->key_seq, key_seq, key_ptr->key_len); restoreKeyDb = true; }