aboutsummaryrefslogtreecommitdiffstats
path: root/vbench/src/vbench/http/server_spec.h
blob: 1a4fed51c120e441712d48e7e9845293e05a23f4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.


#pragma once

#include <vbench/core/string.h>

namespace vbench {

/**
 * Simple wrapper specifying the host and port of a server. This will
 * typically be a HTTP server.
 **/
struct ServerSpec
{
    string host;
    int    port;

    ServerSpec() : host(), port(0) {}
    ServerSpec(const string &h, int p) : host(h), port(p) {}
    bool operator==(const ServerSpec &rhs) const {
        return (port == rhs.port && host == rhs.host);
    }
    bool operator<(const ServerSpec &rhs) const {
        if (port == rhs.port) {
            return (host < rhs.host);
        }
        return (port < rhs.port);
    }
};

} // namespace vbench