11391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen/*
21391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen * libjingle
31391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen * Copyright 2004--2005, Google Inc.
41391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen *
51391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen * Redistribution and use in source and binary forms, with or without
61391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen * modification, are permitted provided that the following conditions are met:
71391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen *
81391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen *  1. Redistributions of source code must retain the above copyright notice,
91391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen *     this list of conditions and the following disclaimer.
101391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen *  2. Redistributions in binary form must reproduce the above copyright notice,
111391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen *     this list of conditions and the following disclaimer in the documentation
121391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen *     and/or other materials provided with the distribution.
131391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen *  3. The name of the author may not be used to endorse or promote products
141391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen *     derived from this software without specific prior written permission.
151391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen *
161391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
171391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
181391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
191391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
201391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
211391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
221391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
231391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
241391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
251391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
261391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen */
271391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen
281391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen#ifndef TALK_BASE_SOCKETADDRESSPAIR_H__
291391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen#define TALK_BASE_SOCKETADDRESSPAIR_H__
301391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen
311391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen#include "talk/base/socketaddress.h"
321391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen
331391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsennamespace talk_base {
341391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen
351391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen// Records a pair (source,destination) of socket addresses.  The two addresses
361391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen// identify a connection between two machines.  (For UDP, this "connection" is
371391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen// not maintained explicitly in a socket.)
381391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsenclass SocketAddressPair {
391391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsenpublic:
401391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen  SocketAddressPair() {}
411391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen  SocketAddressPair(const SocketAddress& srs, const SocketAddress& dest);
421391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen
431391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen  const SocketAddress& source() const { return src_; }
441391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen  const SocketAddress& destination() const { return dest_; }
451391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen
461391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen  bool operator ==(const SocketAddressPair& r) const;
471391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen  bool operator <(const SocketAddressPair& r) const;
481391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen
491391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen  size_t Hash() const;
501391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen
511391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsenprivate:
521391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen  SocketAddress src_;
531391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen  SocketAddress dest_;
541391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen};
551391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen
561391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen} // namespace talk_base
571391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen
581391b24619d56bae6ce14bb54ed0fb16a945e853Kristian Monsen#endif // TALK_BASE_SOCKETADDRESSPAIR_H__
59