Announce.cc

Go to the documentation of this file.
00001 /*
00002  *    Copyright 2006 Baylor University
00003  * 
00004  *    Licensed under the Apache License, Version 2.0 (the "License");
00005  *    you may not use this file except in compliance with the License.
00006  *    You may obtain a copy of the License at
00007  * 
00008  *        http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  *    Unless required by applicable law or agreed to in writing, software
00011  *    distributed under the License is distributed on an "AS IS" BASIS,
00012  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  *    See the License for the specific language governing permissions and
00014  *    limitations under the License.
00015  */
00016 
00017 #include <config.h>
00018 
00019 #include "IPAnnounce.h"
00020 #include "BluetoothAnnounce.h"
00021 #include "Announce.h"
00022 
00023 namespace dtn {
00024 
00025 Announce* 
00026 Announce::create_announce(const std::string& name, ConvergenceLayer* cl,
00027                           int argc, const char* argv[])
00028 {
00029     ASSERT(cl!=NULL);
00030     (void)name;
00031     (void)cl;
00032     (void)argc;
00033     (void)argv;
00034     Announce* announce = NULL;
00035     if ((strncmp(cl->name(),"tcp",3) == 0)  ||
00036         (strncmp(cl->name(),"udp",3) == 0))
00037     {
00038         announce = new IPAnnounce();
00039     }
00040 #ifdef OASYS_BLUETOOTH_ENABLED
00041     else
00042     if (strncmp(cl->name(),"bt",2) == 0)
00043     {
00044         announce = new BluetoothAnnounce();
00045     }
00046 #endif
00047     else
00048     {
00049         //no announce implemented for CL type
00050         return NULL;
00051     }
00052     
00053     if (announce->configure(name,cl,argc-1,argv+1))
00054     {
00055         return announce;
00056     }
00057 
00058     delete announce;
00059     return NULL;
00060 } 
00061 
00062 } // dtn

Generated on Sat Sep 8 08:43:23 2007 for DTN Reference Implementation by  doxygen 1.5.3