]>
Commit | Line | Data |
---|---|---|
bac41a7b A |
1 | /* |
2 | * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved. | |
3 | * | |
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 | |
8 | * using this file. | |
9 | * | |
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. | |
16 | */ | |
17 | ||
18 | ||
19 | // | |
20 | // chooser - Protocol repository and Transfer maker for network protocols | |
21 | // | |
22 | #ifndef _H_CHOOSER | |
23 | #define _H_CHOOSER | |
24 | ||
25 | #include <Security/netmanager.h> | |
26 | #include <Security/protocol.h> | |
27 | #include <set> | |
28 | #include <map> | |
29 | ||
30 | ||
31 | using namespace IPPlusPlus; | |
32 | ||
33 | namespace Security { | |
34 | namespace Network { | |
35 | ||
36 | ||
37 | class Protocol; | |
38 | class Transfer; | |
39 | class Connection; | |
40 | ||
41 | ||
42 | // | |
43 | // | |
44 | class Chooser { | |
45 | typedef Protocol::Operation Operation; | |
46 | public: | |
47 | Chooser(Manager &mgr); | |
48 | virtual ~Chooser(); | |
49 | ||
50 | Manager &manager; | |
51 | ||
52 | public: | |
53 | // add and remove direct protocols | |
54 | void add(Protocol *protocol); | |
55 | void remove(Protocol *protocol); | |
56 | Protocol &protocolFor(const char *protoName) const; // find protocol by URL scheme | |
57 | ||
58 | public: | |
59 | // override this method to implement protocol choosing | |
60 | virtual Protocol &protocolFor(const HostTarget &target) const; | |
61 | ||
62 | public: | |
63 | Transfer *makeTransfer(const Target &target, Operation operation); | |
64 | ||
65 | private: | |
66 | typedef map<string, Protocol *> ProtoMap; | |
67 | ProtoMap mCoreProtocols; // map of registered protocols | |
68 | }; | |
69 | ||
70 | ||
71 | } // end namespace Network | |
72 | } // end namespace Security | |
73 | ||
74 | ||
df0e469f | 75 | #endif /* _H_CHOOSER */ |