DTNServer.h

Go to the documentation of this file.
00001 /*
00002  *    Copyright 2004-2006 Intel Corporation
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 #ifndef _DTNSERVER_H_
00018 #define _DTNSERVER_H_
00019 
00020 #include <oasys/debug/Logger.h>
00021 #include <oasys/thread/Atomic.h>
00022 #include <oasys/storage/DurableStore.h>
00023 
00024 namespace dtn {
00025 
00026 class APIServer;
00027 class DTNStorageConfig;
00028 
00032 class DTNServer : public oasys::Logger {
00033 public:
00034     DTNServer(const char* logpath,
00035               DTNStorageConfig* storage_config);
00036     ~DTNServer();
00037     
00038     DTNStorageConfig* storage_config() { return storage_config_; }
00039 
00045     void init();
00046 
00048     bool init_datastore();
00049 
00051     void close_datastore();
00052     
00054     void start();
00055 
00057     bool parse_conf_file(std::string& conf_file,
00058                          bool         conf_file_set);
00059 
00061     void shutdown();
00062 
00064     typedef void (*ShutdownProc) (void* args);
00065 
00067     void set_app_shutdown(ShutdownProc proc, void* data);
00068 
00069 private:
00070     bool init_;
00071     oasys::atomic_t in_shutdown_;
00072 
00073     DTNStorageConfig*     storage_config_;
00074     oasys::DurableStore*  store_;
00075     APIServer*            api_server_;
00076 
00077     bool init_dir(const char* dirname);
00078     bool tidy_dir(const char* dirname);
00079     bool validate_dir(const char* dirname);    
00080 
00084     void init_commands();
00085     
00089     void init_components();
00090 };
00091 
00092 } // namespace dtn
00093 
00094 #endif /* _DTNSERVER_H_ */

Generated on Thu Jun 7 12:54:27 2007 for DTN Reference Implementation by  doxygen 1.5.1