00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifdef HAVE_CONFIG_H
00018 # include <dtn-config.h>
00019 #endif
00020
00021 #include "IPAnnounce.h"
00022 #include "BluetoothAnnounce.h"
00023 #include "Announce.h"
00024
00025 namespace dtn {
00026
00027 Announce*
00028 Announce::create_announce(const std::string& name, ConvergenceLayer* cl,
00029 int argc, const char* argv[])
00030 {
00031 ASSERT(cl!=NULL);
00032 (void)name;
00033 (void)cl;
00034 (void)argc;
00035 (void)argv;
00036 Announce* announce = NULL;
00037 if ((strncmp(cl->name(),"tcp",3) == 0) ||
00038 (strncmp(cl->name(),"udp",3) == 0))
00039 {
00040 announce = new IPAnnounce();
00041 }
00042 #ifdef OASYS_BLUETOOTH_ENABLED
00043 else
00044 if (strncmp(cl->name(),"bt",2) == 0)
00045 {
00046 announce = new BluetoothAnnounce();
00047 }
00048 #endif
00049 else
00050 {
00051
00052 return NULL;
00053 }
00054
00055 if (announce->configure(name,cl,argc-1,argv+1))
00056 {
00057 return announce;
00058 }
00059
00060 delete announce;
00061 return NULL;
00062 }
00063
00064 }