|
1 /* |
|
2 * Copyright 2006 Baylor University |
|
3 * |
|
4 * Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 * you may not use this file except in compliance with the License. |
|
6 * You may obtain a copy of the License at |
|
7 * |
|
8 * http://www.apache.org/licenses/LICENSE-2.0 |
|
9 * |
|
10 * Unless required by applicable law or agreed to in writing, software |
|
11 * distributed under the License is distributed on an "AS IS" BASIS, |
|
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 * See the License for the specific language governing permissions and |
|
14 * limitations under the License. |
|
15 */ |
|
16 |
|
17 #ifdef HAVE_CONFIG_H |
|
18 # include <dtn-config.h> |
|
19 #endif |
|
20 |
|
21 #include "IPAnnounce.h" |
|
22 #include "BluetoothAnnounce.h" |
|
23 #include "Announce.h" |
|
24 |
|
25 namespace dtn { |
|
26 |
|
27 Announce* |
|
28 Announce::create_announce(const std::string& name, ConvergenceLayer* cl, |
|
29 int argc, const char* argv[]) |
|
30 { |
|
31 ASSERT(cl!=NULL); |
|
32 (void)name; |
|
33 (void)cl; |
|
34 (void)argc; |
|
35 (void)argv; |
|
36 Announce* announce = NULL; |
|
37 if ((strncmp(cl->name(),"tcp",3) == 0) || |
|
38 (strncmp(cl->name(),"udp",3) == 0)) |
|
39 { |
|
40 announce = new IPAnnounce(); |
|
41 } |
|
42 #ifdef OASYS_BLUETOOTH_ENABLED |
|
43 else |
|
44 if (strncmp(cl->name(),"bt",2) == 0) |
|
45 { |
|
46 announce = new BluetoothAnnounce(); |
|
47 } |
|
48 #endif |
|
49 else |
|
50 { |
|
51 //no announce implemented for CL type |
|
52 return NULL; |
|
53 } |
|
54 |
|
55 if (announce->configure(name,cl,argc-1,argv+1)) |
|
56 { |
|
57 return announce; |
|
58 } |
|
59 |
|
60 delete announce; |
|
61 return NULL; |
|
62 } |
|
63 |
|
64 } // dtn |