亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? test_auth.cc

?? RIP 協(xié)議實(shí)現(xiàn)
?? CC
字號(hào):
// -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-// Copyright (c) 2001-2008 XORP, Inc.//// Permission is hereby granted, free of charge, to any person obtaining a// copy of this software and associated documentation files (the "Software")// to deal in the Software without restriction, subject to the conditions// listed in the XORP LICENSE file. These conditions include: you must// preserve this copyright notice, and you cannot mention the copyright// holders in advertising related to the Software without their permission.// The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This// notice is a summary of the XORP LICENSE file; the license in that file is// legally binding.#ident "$XORP: xorp/rip/test_auth.cc,v 1.29 2008/07/23 05:11:36 pavlin Exp $"#include "rip_module.h"#include "libxorp/xorp.h"#include "libxorp/xlog.h"#include "libxorp/c_format.hh"#include "libxorp/eventloop.hh"#include "libxorp/utils.hh"#include "auth.hh"#include "test_utils.hh"#ifdef HAVE_GETOPT_H#include <getopt.h>#endif/////////////////////////////////////////////////////////////////////////////////// Constants//static const char *program_name         = "test_auth";static const char *program_description  = "Test RIP authentication operations";static const char *program_version_id   = "0.1";static const char *program_date         = "April, 2003";static const char *program_copyright    = "See file LICENSE";static const char *program_return_value = "0 on success, 1 if test error, 2 if internal error";// ----------------------------------------------------------------------------// Utility functions/** * Build an authenticated RIP packet. * * @param pkt vector to hold raw packet. * @param ah authentication handler to be used. * @param n number of route entries to place in packet. * * @return 0 on success, 1 on failure. */static intbuild_auth_packet(vector<uint8_t>& pkt, AuthHandlerBase& ah, uint32_t n){    vector<uint8_t> trailer;    pkt.resize(RipPacketHeader::size() +	       (n + ah.head_entries()) * PacketRouteEntry<IPv4>::size());    RipPacketHeaderWriter rph(&pkt[0]);    rph.initialize(RipPacketHeader::REQUEST, 2);    for (uint32_t i = 0; i < n; i++) {	uint32_t offset = RipPacketHeader::size() +	    (i + ah.head_entries()) * PacketRouteEntry<IPv4>::size();	PacketRouteEntryWriter<IPv4> p(&pkt[0] + offset);	p.initialize(0, IPv4Net("10.0.0.0/8"), IPv4("172.11.100.1"), 3);    }    RipPacket<IPv4> rip_packet(IPv4::ZERO(), RIP_PORT, n + ah.head_entries());    rip_packet.data() = pkt;    size_t n_routes = 0;    list<RipPacket<IPv4>*> auth_packets;    if ((ah.authenticate_outbound(rip_packet, auth_packets, n_routes) != true)	|| (n_routes != n)) {	verbose_log("Unexpected outbound authentication failure: %s\n",		    ah.error().c_str());	return 1;    }    //    // XXX: there should be only one copy of the authenticated packet,    // and we don't care about it.    //    XLOG_ASSERT(auth_packets.size() == 1);    delete_pointers_list(auth_packets);    // Copy the modified data back to the original packet    pkt = rip_packet.data();    return 0;}/** * Check an authenticated RIP packet. * * @param pkt raw packet to be checked. * @param ah authentication handler to be used to check packet. * @param n number of entries expected in packet. * @param expect_fail expect failure flag. * * @return 0 on success, 1 on failure. */static intcheck_auth_packet(const vector<uint8_t>& pkt,		  AuthHandlerBase&	 ah,		  uint32_t		 n,		  bool			 expect_fail = false){    const uint8_t* entries_ptr = NULL;    uint32_t n_entries = 0;    if (ah.authenticate_inbound(&pkt[0], pkt.size(), entries_ptr, n_entries,				IPv4::ZERO(), false)	== false) {	if (expect_fail == false) {	    verbose_log("Unexpected failure (actual entries %u, "			"expected %u) - %s\n",			XORP_UINT_CAST(n_entries), XORP_UINT_CAST(n),			ah.error().c_str());	    return 1;	}	return 0;    }    if (n == 0) {	if (entries_ptr != NULL) {	    verbose_log("Got an address for start of entries when no entries "			"present in a packet.\n");	    return 1;	}	return 0;    }    const uint8_t* exp0 = (&pkt[0] + RipPacketHeader::size());    exp0 += PacketRouteEntry<IPv4>::size() * ah.head_entries();    if (entries_ptr != exp0) {	verbose_log("First entry in packet does not correspond with expected "		    "position\n");	return 1;    }    return 0;}/** * Dump a packet. */void dump_binary_data(const vector<uint8_t>& data){    static const uint32_t BPL = 8;	// Bytes Per Line    vector<uint8_t>::size_type i = 0;    while (i != data.size()) {	fprintf(stdout, "%08x ", XORP_UINT_CAST(i));	string hex;	string asc;	int r = (data.size() - i) > BPL ? BPL : data.size() - i;	while (r != 0) {	    if ((i & 7) == 4)		hex += " ";	    hex += c_format("%02x", data[i]);	    asc += (xorp_isprint(data[i])) ? char(data[i]) : '.';	    i++;	    r--;	}	hex += string(BPL, ' ');	hex = string(hex, 0, 2 * BPL + 1);	fprintf(stdout, "%s %s\n", hex.c_str(), asc.c_str());    }}/** * A MD5 rip packet captured on the wire. */uint8_t rip_packet[] = { 0x2,   0x2,   0x0,   0x0,  0xff,  0xff,   0x0,   0x3,  0x0,  0xf4,   0x1,  0x14,   0x0,   0x0,   0x1,  0x13,  0x0,   0x0,   0x0,   0x0,   0x0,   0x0,   0x0,   0x0,  0x0,   0x2,   0x0,   0x0,  0xc0,  0x96,  0xba,   0x0, 0xff,  0xff,  0xff,   0x0,   0x0,   0x0,   0x0,   0x0,  0x0,   0x0,   0x0,   0xc,   0x0,   0x2,   0x0,   0x0, 0xc0,  0x96,  0xbb,  0xe0,  0xff,  0xff,  0xff,  0xfc,  0x0,   0x0,   0x0,   0x0,   0x0,   0x0,   0x0,   0xc,  0x0,   0x2,   0x0,   0x0,  0xc0,  0x96,  0xbb,  0xf0, 0xff,  0xff,  0xff,  0xf8,   0x0,   0x0,   0x0,   0x0,  0x0,   0x0,   0x0,   0xc,   0x0,   0x2,   0x0,   0x0, 0xc0,  0x96,  0xbb,  0xf8,  0xff,  0xff,  0xff,  0xf8,  0x0,   0x0,   0x0,   0x0,   0x0,   0x0,   0x0,   0xb,  0x0,   0x2,   0x0,   0x0,  0xc0,  0xa8,   0x3,   0x0, 0xff,  0xff,  0xff,   0x0,   0x0,   0x0,   0x0,   0x0,  0x0,   0x0,   0x0,   0xc,   0x0,   0x2,   0x0,   0x0, 0xc0,  0xa8,   0x4,   0x0,  0xff,  0xff,  0xff,   0x0,  0x0,   0x0,   0x0,   0x0,   0x0,   0x0,   0x0,   0xc,  0x0,   0x2,   0x0,   0x0,  0xc0,  0xa8,  0xfe,   0x1, 0xff,  0xff,  0xff,  0xff,   0x0,   0x0,   0x0,   0x0,  0x0,   0x0,   0x0,   0xc,   0x0,   0x2,   0x0,   0x0, 0xc0,  0xa8,  0xfe,   0x2,  0xff,  0xff,  0xff,  0xff,  0x0,   0x0,   0x0,   0x0,   0x0,   0x0,   0x0,   0xc,  0x0,   0x2,   0x0,   0x0,  0xc0,  0xa8,  0xfe,   0x3, 0xff,  0xff,  0xff,  0xff,   0x0,   0x0,   0x0,   0x0,  0x0,   0x0,   0x0,   0xb,   0x0,   0x2,   0x0,   0x0, 0xc0,  0xa8,  0xfe,   0x4,  0xff,  0xff,  0xff,  0xff,  0x0,   0x0,   0x0,   0x0,   0x0,   0x0,   0x0,   0xc,  0x0,   0x2,   0x0,   0x0,  0xc0,  0xa8,  0xfe,   0x5, 0xff,  0xff,  0xff,  0xff,   0x0,   0x0,   0x0,   0x0,  0x0,   0x0,   0x0,   0xd,  0xff,  0xff,   0x0,   0x1, 0x2d,  0xaa,  0xa4,  0xba,  0x2e,  0xfd,  0x5c,   0xb, 0x25,  0x44,  0xb5,  0x98,  0xcd,  0x5f,  0x24,  0xab, };/** * Check MD5 authentication against a saved packet. */inlineintcheck_saved_md5(){    EventLoop e;    MD5AuthHandler mah(e);    string dummy_error_msg;    mah.add_key(1, "bgp@icsi", TimeVal::ZERO(), TimeVal::MAXIMUM(),		dummy_error_msg);    vector<uint8_t> pkt;    for (uint32_t i = 0; i < sizeof(rip_packet); i++)	pkt.push_back(rip_packet[i]);    uint32_t n = 11;    if (check_auth_packet(pkt, mah, n, false)) {	verbose_log("Failed MD5 authentication with %u entries\n",		    XORP_UINT_CAST(n));	dump_binary_data(pkt);	return 1;    }    return 0;}//----------------------------------------------------------------------------// The teststatic inttest_main(){    string dummy_error_msg;    // Static sizing tests    static_assert(RipPacketHeader::SIZE == 4);    static_assert(PacketRouteEntry<IPv4>::SIZE == 20);    static_assert(RipPacketHeader::SIZE == RIPv2_MIN_PACKET_BYTES);    static_assert(RipPacketHeader::SIZE + PacketRouteEntry<IPv4>::SIZE		  == RIPv2_MIN_AUTH_PACKET_BYTES);    static_assert(PacketRouteEntry<IPv4>::SIZE		  == PlaintextPacketRouteEntry4::SIZE);    static_assert(PacketRouteEntry<IPv4>::SIZE == MD5PacketRouteEntry4::SIZE);    static_assert(MD5PacketTrailer::SIZE == 20);    static_assert(PacketRouteEntry<IPv4>::SIZE		  == PacketRouteEntry<IPv6>::SIZE);    vector<uint8_t> pkt;    //    // Null Authentication Handler test    //    NullAuthHandler nah;    for (uint32_t n = 0; n < nah.max_routing_entries(); n++) {	if (build_auth_packet(pkt, nah, n)) {	    verbose_log("Failed to build null authentication scheme packet "			"with %u entries.\n", XORP_UINT_CAST(n));	    return 1;	}	if (check_auth_packet(pkt, nah, n, false)) {	    verbose_log("Failed null authentication with %u entries\n",			XORP_UINT_CAST(n));	    return 1;	}	// Add some extra data to break packet size.	pkt.push_back(uint8_t(0));	if (check_auth_packet(pkt, nah, n, true)) {	    verbose_log("Null authentication passed broken packet "			"with %u entries\n", XORP_UINT_CAST(n));	    return 1;	}    }    //    // Plaintext Authentication Handler test    //    // Plaintext test three run throughs one without password, one    // with password less than 16 characters, one with password > 16    // characters    //    PlaintextAuthHandler pah;    for (uint32_t i = 0; i < 3; i++) {	for (uint32_t n = 0; n < pah.max_routing_entries(); n++) {	    if (build_auth_packet(pkt, pah, n)) {		verbose_log("Failed to build plaintext authentication scheme "			    "packet with %u entries.\n", XORP_UINT_CAST(n));		return 1;	    }	    if (check_auth_packet(pkt, pah, n, false)) {		verbose_log("Failed plaintext authentication with "			    "%u entries\n", XORP_UINT_CAST(n));		return 1;	    }	    // Add some extra data to break packet size.	    pkt.push_back(uint8_t(0));	    if (check_auth_packet(pkt, pah, n, true)) {		verbose_log("Plaintext authentication passed broken packet "			    "with %u entries\n", XORP_UINT_CAST(n));		return 1;	    }	    if (n == 3 && verbose()) {		verbose_log("Example Plaintext password packet.\n");		dump_binary_data(pkt);	    }	}	pah.set_key(pah.key() + string("A password"));    }    //    xlog_enable(XLOG_LEVEL_INFO);    //    // MD5 Authentication Handler tests    //    if (0 != check_saved_md5()) 	return 1;    EventLoop e;    MD5AuthHandler mah(e);    mah.add_key(1, "Hello World!", TimeVal::ZERO(), TimeVal::MAXIMUM(),		dummy_error_msg);    for (uint32_t n = 0; n < mah.max_routing_entries(); n++) {	if (build_auth_packet(pkt, mah, n)) {	    verbose_log("Failed to build MD5 authentication scheme packet "			"with %u entries.\n", XORP_UINT_CAST(n));	    return 1;	}	if (check_auth_packet(pkt, mah, n, false)) {	    verbose_log("Failed MD5 authentication with %u entries\n",			XORP_UINT_CAST(n));	    dump_binary_data(pkt);	    return 1;	}	// Add some extra data to break packet size.	pkt.push_back(uint8_t(0));	if (check_auth_packet(pkt, mah, n, true)) {	    verbose_log("MD5 authentication passed broken packet "			"with %u entries\n", XORP_UINT_CAST(n));	    dump_binary_data(pkt);	    return 1;	}	// Build other packets of same size and corrupt bytes in order	// nb we have to build another packet otherwise we always fail	// the sequence number test.	for (vector<uint8_t>::size_type c = 0; c != pkt.size(); c++) {	    if (build_auth_packet(pkt, mah, n)) {		verbose_log("Failed to build MD5 authentication scheme packet "			    "with %u entries.\n", XORP_UINT_CAST(n));		dump_binary_data(pkt);		return 1;	    }	    vector<uint8_t> bad_pkt(pkt);	    bad_pkt[c] = bad_pkt[c] ^ 0x01;	    if (check_auth_packet(bad_pkt, mah, n, true)) {		verbose_log("MD5 authentication passed corruption in byte "			    "%u with in packet %u entries\n",			    XORP_UINT_CAST(c),			    XORP_UINT_CAST(n));		dump_binary_data(bad_pkt);		return 1;	    }	}    }    //    // Check removing the 1 MD5 key we have on ring works    //    mah.remove_key(1, dummy_error_msg);    if (! mah.empty()) {	verbose_log("Key removal failed\n");	return 1;    }    //    // Add a selection of keys and check they timeout correctly    //    TimeVal now;    e.current_time(now);    uint32_t i;    for (i = 0; i < 5; i++) {	mah.add_key(i, "testing123", now, now + TimeVal(i, 0),		    dummy_error_msg);    }    mah.add_key(i, "testing123", now, TimeVal::MAXIMUM(), dummy_error_msg);    bool stop_eventloop = false;    XorpTimer to = e.set_flag_after(TimeVal(i, 0), &stop_eventloop);    while (stop_eventloop == false) {	e.run();    }    if (mah.valid_key_chain().size() != 1) {	verbose_log("Bogus key count: expected 1 key left, have %u\n",		    XORP_UINT_CAST(mah.valid_key_chain().size()));	return 1;    }    return 0;}/** * Print program info to output stream. * * @param stream the output stream the print the program info to. */static voidprint_program_info(FILE *stream){    fprintf(stream, "Name:          %s\n", program_name);    fprintf(stream, "Description:   %s\n", program_description);    fprintf(stream, "Version:       %s\n", program_version_id);    fprintf(stream, "Date:          %s\n", program_date);    fprintf(stream, "Copyright:     %s\n", program_copyright);    fprintf(stream, "Return:        %s\n", program_return_value);}/** * Print program usage information to the stderr. * * @param progname the name of the program. */static voidusage(const char* progname){    print_program_info(stderr);    fprintf(stderr, "usage: %s [-v] [-h]\n", progname);    fprintf(stderr, "       -h          : usage (this message)\n");    fprintf(stderr, "       -v          : verbose output\n");}intmain(int argc, char* const argv[]){    //    // Initialize and start xlog    //    xlog_init(argv[0], NULL);    xlog_set_verbose(XLOG_VERBOSE_LOW);         // Least verbose messages    // XXX: verbosity of the error messages temporary increased    xlog_level_set_verbose(XLOG_LEVEL_ERROR, XLOG_VERBOSE_HIGH);    xlog_add_default_output();    xlog_start();    int ch;    while ((ch = getopt(argc, argv, "hv")) != -1) {        switch (ch) {        case 'v':            set_verbose(true);            break;        case 'h':        case '?':        default:            usage(argv[0]);            xlog_stop();            xlog_exit();            if (ch == 'h')                return (0);            else                return (1);        }    }    argc -= optind;    argv += optind;    int rval = 0;    XorpUnexpectedHandler x(xorp_unexpected_handler);    try {	rval = test_main();    } catch (...) {        // Internal error        xorp_print_standard_exceptions();        rval = 2;    }    //    // Gracefully stop and exit xlog    //    xlog_stop();    xlog_exit();    verbose_log("Exit status %d\n", rval);    return rval;}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美裸体一区二区三区| 色偷偷久久人人79超碰人人澡| 中文字幕av资源一区| 色香色香欲天天天影视综合网| 爽爽淫人综合网网站 | 26uuu国产在线精品一区二区| 成人激情小说网站| 久久99国产精品麻豆| 亚洲激情综合网| 国产欧美日韩久久| 日韩午夜激情av| 欧美午夜在线一二页| 成人综合在线观看| 久久99精品久久久| 午夜精品久久久久影视| 亚洲四区在线观看| 国产欧美日韩在线| 日韩欧美久久久| 91精品在线一区二区| 在线视频你懂得一区二区三区| 国产91高潮流白浆在线麻豆| 奇米影视7777精品一区二区| 亚洲免费视频中文字幕| 国产精品美女久久久久久久久| 精品欧美一区二区三区精品久久| 欧美日韩久久久久久| 在线观看网站黄不卡| 91免费观看在线| 99久久99久久精品免费看蜜桃| 国产成人精品一区二区三区网站观看| 玖玖九九国产精品| 日本亚洲最大的色成网站www| 亚洲国产精品久久久久婷婷884 | 日韩精品乱码免费| 亚洲国产乱码最新视频| 一区二区三区毛片| 一区二区三区欧美亚洲| 一区二区三区在线观看视频| 亚洲色图欧美激情| 亚洲精品日韩综合观看成人91| 亚洲免费成人av| 亚洲激情av在线| 亚洲一二三四在线| 午夜欧美一区二区三区在线播放| 亚洲小少妇裸体bbw| 亚洲va欧美va人人爽| 亚洲午夜激情网页| 日韩经典中文字幕一区| 欧美aaa在线| 久久激情五月激情| 国产一区二区三区四| 国产福利一区在线| 成人污视频在线观看| 91在线精品一区二区三区| 色婷婷精品久久二区二区蜜臀av | 亚洲日本在线视频观看| 亚洲色图另类专区| 亚洲 欧美综合在线网络| 免费高清成人在线| 国产在线播放一区三区四| 国产成人综合网站| www.欧美日韩国产在线| 色天天综合久久久久综合片| 欧美日韩一区精品| 日韩一级完整毛片| 国产日韩欧美不卡| 一区二区三区在线观看视频| 日韩**一区毛片| 国产美女一区二区三区| 99国产精品国产精品久久| 欧美午夜宅男影院| 久久无码av三级| 中文字幕中文在线不卡住| 亚洲第一精品在线| 黄页视频在线91| 99精品热视频| 日韩精品一区二区三区视频| 国产色一区二区| 亚洲亚洲人成综合网络| 国产毛片精品视频| 色偷偷一区二区三区| 欧美不卡在线视频| 亚洲欧美国产毛片在线| 麻豆专区一区二区三区四区五区| 国产黄色精品网站| 欧美日高清视频| 中文字幕不卡的av| 美日韩黄色大片| 91麻豆精品一区二区三区| 日韩欧美国产系列| 亚洲精品菠萝久久久久久久| 黑人巨大精品欧美一区| 色av成人天堂桃色av| 欧美电影免费观看完整版| 亚洲欧美福利一区二区| 久久97超碰国产精品超碰| 色猫猫国产区一区二在线视频| 精品99一区二区三区| 一区二区成人在线| 国产91在线看| 日韩一卡二卡三卡四卡| 一区二区三区四区在线免费观看| 国产一区二区看久久| 欧美一区二区三区视频在线 | 一区在线播放视频| 久久99在线观看| 精品视频全国免费看| 国产精品国产三级国产| 国产一区二区h| 日韩视频一区在线观看| 亚洲高清免费在线| 91网站最新网址| 国产视频不卡一区| 国精产品一区一区三区mba桃花| 欧美日韩免费在线视频| 成人欧美一区二区三区在线播放| 国产一区二区免费看| 日韩精品一区在线| 亚洲444eee在线观看| 色天天综合色天天久久| 日韩理论片中文av| 成人av资源在线观看| 国产午夜精品久久久久久免费视| 日韩电影在线观看网站| 欧美在线观看视频在线| 亚洲精品五月天| 99国内精品久久| 欧美激情中文字幕一区二区| 国产乱子伦视频一区二区三区| 欧美一级夜夜爽| 午夜欧美视频在线观看| 欧美久久久久免费| 午夜激情久久久| 欧美美女直播网站| 性感美女极品91精品| 欧美精品第1页| 日本在线观看不卡视频| 日韩欧美中文一区| 精品写真视频在线观看| 精品福利av导航| 国产精品性做久久久久久| 久久久久成人黄色影片| 福利视频网站一区二区三区| 国产日韩精品一区二区浪潮av| 国产精品自拍一区| 中文字幕av资源一区| 99久久久久免费精品国产| 亚洲欧美二区三区| 欧美日韩国产小视频在线观看| 五月天激情综合网| 日韩精品中文字幕在线一区| 国产一区二区三区久久久| 国产欧美日韩视频一区二区| 不卡区在线中文字幕| 亚洲女与黑人做爰| 欧美三级韩国三级日本三斤| 日精品一区二区三区| 337p日本欧洲亚洲大胆精品| 福利一区二区在线| 亚洲制服丝袜av| 日韩一级免费观看| 国产高清成人在线| 亚洲精品国产第一综合99久久| 欧美午夜电影在线播放| 奇米色777欧美一区二区| 久久婷婷国产综合国色天香| 99免费精品在线| 午夜电影一区二区三区| 欧美精品一区二| 91黄色免费网站| 日本欧美久久久久免费播放网| 久久人人爽人人爽| 色国产综合视频| 精品一区二区免费在线观看| 国产精品每日更新在线播放网址| 欧美性一区二区| 韩国精品免费视频| 亚洲人成网站色在线观看| 在线不卡a资源高清| 高清beeg欧美| 亚洲国产视频一区二区| 精品国产乱码久久久久久老虎| 播五月开心婷婷综合| 免费观看成人鲁鲁鲁鲁鲁视频| 国产精品欧美一区喷水| 欧美一级二级三级蜜桃| eeuss鲁片一区二区三区| 婷婷丁香激情综合| 国产精品第一页第二页第三页| 欧美日韩午夜在线| 丁香婷婷综合网| 青青草国产精品97视觉盛宴| 日韩伦理免费电影| 2020国产精品自拍| 欧美色手机在线观看| 高清不卡一二三区| 免费看欧美女人艹b| 亚洲免费资源在线播放| 久久久99精品免费观看| 777欧美精品|