sim/SimConvergenceLayer.h
changeset 0 2b3e5ec03512
equal deleted inserted replaced
-1:000000000000 0:2b3e5ec03512
       
     1 /*
       
     2  *    Copyright 2004-2006 Intel Corporation
       
     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 #ifndef _SIM_CONVERGENCE_LAYER_H_
       
    18 #define _SIM_CONVERGENCE_LAYER_H_
       
    19 
       
    20 
       
    21 #include "conv_layers/ConvergenceLayer.h"
       
    22 
       
    23 using namespace dtn;
       
    24 
       
    25 namespace dtnsim {
       
    26 
       
    27 struct ConnState;
       
    28 class Node;
       
    29 
       
    30 /**
       
    31  * Simulator implementation of the Convergence Layer API.
       
    32  */
       
    33 class SimConvergenceLayer : public ConvergenceLayer {
       
    34     
       
    35 public:
       
    36     /**
       
    37      * Singleton initializer.
       
    38      */
       
    39     static void init()
       
    40     {
       
    41         instance_ = new SimConvergenceLayer();
       
    42     }
       
    43 
       
    44     /**
       
    45      * Singleton accessor
       
    46      */
       
    47     static SimConvergenceLayer* instance() { return instance_; }
       
    48 
       
    49     /**
       
    50      * Constructor.
       
    51      */
       
    52     SimConvergenceLayer();
       
    53 
       
    54     /// @{
       
    55     /// Virtual from ConvergenceLayer
       
    56     bool init_link(const LinkRef& link, int argc, const char* argv[]);
       
    57     void delete_link(const LinkRef& link);
       
    58     bool open_contact(const ContactRef& contact);
       
    59     void bundle_queued(const LinkRef& link, const BundleRef& bundle);
       
    60     /// @}
       
    61 
       
    62     void update_connectivity(Node* n1, Node* n2, const ConnState& cs);
       
    63     
       
    64 protected:
       
    65     void start_bundle(const LinkRef& link, const BundleRef& bundle);
       
    66     
       
    67     static SimConvergenceLayer* instance_;
       
    68 };
       
    69 
       
    70 } // namespace dtnsim
       
    71 
       
    72 #endif /* _SIM_CONVERGENCE_LAYER_H_ */