sim/TrAgent.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 _TR_AGENT_H
       
    18 #define _TR_AGENT_H
       
    19 
       
    20 #include <oasys/debug/DebugUtils.h>
       
    21 #include <oasys/debug/Log.h>
       
    22 #include <oasys/thread/Timer.h>
       
    23 
       
    24 #include "SimEvent.h"
       
    25 #include "SimEventHandler.h"
       
    26 #include "naming/EndpointID.h"
       
    27 
       
    28 namespace dtnsim {
       
    29 class Node;
       
    30 
       
    31 class TrAgent : public oasys::Timer, public oasys::Logger {
       
    32 public:
       
    33     static TrAgent* init(const EndpointID& src, const EndpointID& dst,
       
    34                          int argc, const char** argv);
       
    35 
       
    36     virtual ~TrAgent() {}
       
    37 
       
    38     void timeout(const struct timeval& now);
       
    39 
       
    40 private:
       
    41     TrAgent(const EndpointID& src, const EndpointID& dst);
       
    42     
       
    43     void send_bundle();
       
    44 
       
    45     EndpointID src_;    ///< source eid
       
    46     EndpointID dst_;    ///< destination eid
       
    47     u_int64_t size_;    ///< size of each message
       
    48     u_int expiration_;  ///< expiration time for each bundle
       
    49     u_int reps_;        ///< total number of reps/batches
       
    50     u_int batch_;       ///< no of messages in each batch
       
    51     double interval_;   ///< time gap between two batches
       
    52 };
       
    53 
       
    54 } // namespace dtnsim
       
    55 
       
    56 #endif /* _TR_AGENT_H */