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 _GLUE_NODE_H_ 00018 #define _GLUE_NODE_H_ 00019 00020 /* 00021 * Node which interfaces to DTN2 and Simulator. 00022 * This node is responsible for forwarding/converting events 00023 * from Simulator to DTN2 and vice-versa. 00024 * It acts as BundleDaemon. On receiving bundles/contact dynamics 00025 * etc... it informs the BundleRouter and executes the returned 00026 * list of action. The actual forwarding of a Bundle using the 00027 * Simulator is done at the SimulatorConvergence layer. 00028 */ 00029 00030 00031 #include "Node.h" 00032 #include "routing/BundleRouter.h" 00033 #include "FloodConsumer.h" 00034 00035 namespace dtnsim { 00036 00037 class GlueNode : public Node { 00038 00039 public: 00040 00041 00042 GlueNode(int id, const char* logpath); 00046 virtual void process(Event *e); 00047 virtual void chewing_complete(SimContact* c, double size, Message* msg); 00048 virtual void open_contact(SimContact* c); 00049 virtual void close_contact(SimContact* c); 00050 virtual void message_received(Message* msg); 00051 00052 virtual void create_consumer(); 00053 00054 private: 00055 00060 virtual void forward(Message* msg); 00061 00065 void execute_router_action(BundleAction* action); 00066 00070 void forward_event(BundleEvent* event) ; 00071 00072 BundleRouter* router_; 00073 FloodConsumer * consumer_; 00074 }; 00075 00076 } // namespace dtnsim 00077 00078 #endif /* _GLUE_NODE_H_ */