blob: 5a3bf81a7a8afc4de6e9fd8cf0e0e0b75c7f9ead [file] [log] [blame]
henrike@webrtc.orgf0488722014-05-13 18:00:261/*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Steve Anton10542f22019-01-11 17:11:0011#ifndef RTC_BASE_SOCKET_ADDRESS_PAIR_H_
12#define RTC_BASE_SOCKET_ADDRESS_PAIR_H_
henrike@webrtc.orgf0488722014-05-13 18:00:2613
Yves Gerey988cc082018-10-23 10:03:0114#include <stddef.h>
15
Steve Anton10542f22019-01-11 17:11:0016#include "rtc_base/socket_address.h"
henrike@webrtc.orgf0488722014-05-13 18:00:2617
Evan Shrubsole4887bc32025-03-10 09:36:0518namespace webrtc {
henrike@webrtc.orgf0488722014-05-13 18:00:2619
Henrik Kjellanderec78f1c2017-06-29 05:52:5020// Records a pair (source,destination) of socket addresses. The two addresses
21// identify a connection between two machines. (For UDP, this "connection" is
22// not maintained explicitly in a socket.)
23class SocketAddressPair {
Yves Gerey665174f2018-06-19 13:03:0524 public:
Henrik Kjellanderec78f1c2017-06-29 05:52:5025 SocketAddressPair() {}
Evan Shrubsole64b076f42025-03-12 12:56:2826 SocketAddressPair(const SocketAddress& srs, const SocketAddress& dest);
Henrik Kjellanderec78f1c2017-06-29 05:52:5027
Evan Shrubsole64b076f42025-03-12 12:56:2828 const SocketAddress& source() const { return src_; }
29 const SocketAddress& destination() const { return dest_; }
Henrik Kjellanderec78f1c2017-06-29 05:52:5030
Yves Gerey665174f2018-06-19 13:03:0531 bool operator==(const SocketAddressPair& r) const;
32 bool operator<(const SocketAddressPair& r) const;
Henrik Kjellanderec78f1c2017-06-29 05:52:5033
34 size_t Hash() const;
35
Yves Gerey665174f2018-06-19 13:03:0536 private:
Evan Shrubsole64b076f42025-03-12 12:56:2837 SocketAddress src_;
38 SocketAddress dest_;
Henrik Kjellanderec78f1c2017-06-29 05:52:5039};
40
Evan Shrubsole4887bc32025-03-10 09:36:0541} // namespace webrtc
42
43// Re-export symbols from the webrtc namespace for backwards compatibility.
44// TODO(bugs.webrtc.org/4222596): Remove once all references are updated.
45namespace rtc {
46using ::webrtc::SocketAddressPair;
Yves Gerey665174f2018-06-19 13:03:0547} // namespace rtc
Henrik Kjellanderec78f1c2017-06-29 05:52:5048
Steve Anton10542f22019-01-11 17:11:0049#endif // RTC_BASE_SOCKET_ADDRESS_PAIR_H_