]>
git.saurik.com Git - apple/security.git/blob - cdsa/cdsa_utilities/hosts.h
2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
20 // hosts - value-semantics host identifier class
22 // @@@ use vector instead of set to preserve resolver-generated order?
23 // @@@ preliminary implementation: at the very least, there'll be more subclasses (deferred, etc.)
29 #include <Security/refcount.h>
34 namespace IPPlusPlus
{
42 Host(const char *form
);
45 // equality is defined strongly: same host specification
46 bool operator == (const Host
&other
) const;
47 bool operator != (const Host
&other
) const { return !(*this == other
); }
48 bool operator < (const Host
&other
) const; // for STL sorting
50 // inclusion (<=) is defined semi-weakly: greater subsumes smaller, same access specs
51 bool operator <= (const Host
&other
) const;
52 bool operator >= (const Host
&other
) const { return other
<= *this; }
54 string
name() const { return mSpec
->name(); }
55 set
<IPAddress
> addresses() const { return mSpec
->addresses(); }
58 class Spec
: public RefCount
{
62 virtual set
<IPAddress
> addresses() const = 0;
63 virtual string
name() const = 0;
69 RefPointer
<Spec
> mSpec
;
72 } // end namespace IPPlusPlus
73 } // end namespace Security