netchecker_profile.h 2.16 KB
//
//  netchecker_profile.h
//
//  Created by cairui01 on 18/11/9.
//  Copyright (c) 2018年 baidu. All rights reserved.
//
#ifndef SDT_SRC_NETCHECKER_PROFILE_H_
#define SDT_SRC_NETCHECKER_PROFILE_H_

#include <string>
#include <vector>
#include <map>
#include <stdint.h>

#include "sdt.h"

namespace apirequest {
namespace sdt  {

struct CheckResultProfile {

	CheckResultProfile() {
		Reset();
	}

	void Reset() {
		netcheck_type = -1;

		error_code = 1;

		ip.clear();
        port = 0;
		conntime = 0;
		rtt = 0;

        total_jumps = 0;
		url.clear();

		checkcount = 0;
		loss_rate = -1;
        res.clear();

		domain_name.clear();
		local_dns.clear();
        ipList.clear();
        ipv6List.clear();
        
        socket_error_no = 0;
        local_dns_server.clear();
	}

	int netcheck_type;	//ping dns tcp http tracert

    int error_code;

    std::string domain; //ping
    std::string ip;     //ping tcp http tracert
    unsigned int port;  //tcp http
    uint64_t conntime;
    uint64_t rtt;		//tcp http rtt, dns resolve time
    std::string rtt_str;	//ping
    
    int total_jumps; //tracert

    std::string url;

    unsigned int checkcount;	//ping
    double       loss_rate;		//ping
    std::string res;            //ping tracert result

    std::string  domain_name;	//dns host
    std::string  local_dns;		//dns
    std::vector<std::string>  ipList;   //dns
    std::vector<std::string>  ipv6List;     // dns ipv6
    
    int          socket_error_no;         //  socket errno
    std::vector<std::string>  local_dns_server; //  dns servers
};

struct CheckRequestProfile {

	CheckRequestProfile() {
		Reset();
	}

	void Reset() {
		shortlink_items.clear();

		checkresult_profiles.clear();

		check_status = kCheckContinue;

		timeout = 0;
	}

	CheckIPPorts shortlink_items;

	CheckStatus check_status;

	uint32_t timeout;
    
    uint32_t maxjumps;

	std::vector<CheckResultProfile> checkresult_profiles;
    
    bool enable_dns_query_failover; //  是否开启DNS Query容错机制(包括过滤无效DNS Server ip和多IP重试)
    
    std::string dns_server_ip;  //  指定探测DNS服务器IP
    
    std::string interface_name; //  绑定探测网卡

};

}}
#endif