Kea  1.9.9-git
http_types.h
Go to the documentation of this file.
1 // Copyright (C) 2016-2017 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #ifndef HTTP_TYPES_H
8 #define HTTP_TYPES_H
9 
10 namespace isc {
11 namespace http {
12 
14 struct HttpVersion {
15  unsigned major_;
16  unsigned minor_;
17 
22  explicit HttpVersion(const unsigned major, const unsigned minor)
23  : major_(major), minor_(minor) {
24  }
25 
29  bool operator<(const HttpVersion& rhs) const {
30  return ((major_ < rhs.major_) ||
31  ((major_ == rhs.major_) && (minor_ < rhs.minor_)));
32  }
33 
37  bool operator==(const HttpVersion& rhs) const {
38  return ((major_ == rhs.major_) && (minor_ == rhs.minor_));
39  }
40 
44  bool operator!=(const HttpVersion& rhs) const {
45  return (!operator==(rhs));
46  }
47 
50 
51 
53  static const HttpVersion& HTTP_10() {
54  static HttpVersion ver(1, 0);
55  return (ver);
56  };
57 
59  static const HttpVersion& HTTP_11() {
60  static HttpVersion ver(1, 1);
61  return (ver);
62  }
63 
65  static const HttpVersion& HTTP_20() {
66  static HttpVersion ver(2, 0);
67  return (ver);
68  }
69 
71 };
72 
73 } // end of namespace isc::http
74 } // end of namespace isc
75 
76 #endif
HttpVersion(const unsigned major, const unsigned minor)
Constructor.
Definition: http_types.h:22
HTTP protocol version.
Definition: http_types.h:14
unsigned major_
Major HTTP version.
Definition: http_types.h:15
static const HttpVersion & HTTP_11()
HTTP version 1.1.
Definition: http_types.h:59
bool operator!=(const HttpVersion &rhs) const
Operator not equal.
Definition: http_types.h:44
bool operator==(const HttpVersion &rhs) const
Operator equal.
Definition: http_types.h:37
Defines the logger used by the top-level component of kea-dhcp-ddns.
static const HttpVersion & HTTP_20()
HTTP version 2.0.
Definition: http_types.h:65
static const HttpVersion & HTTP_10()
HTTP version 1.0.
Definition: http_types.h:53
bool operator<(const HttpVersion &rhs) const
Operator less.
Definition: http_types.h:29
unsigned minor_
Minor HTTP version.
Definition: http_types.h:16