00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _SIM_CONTACT_H_
00018 #define _SIM_CONTACT_H_
00019
00020
00021 #include <oasys/debug/DebugUtils.h>
00022 #include <oasys/debug/Log.h>
00023
00024
00025 #include "Node.h"
00026 #include "Processable.h"
00027 #include "SimEvent.h"
00028 #include "Message.h"
00029
00030 namespace dtnsim {
00031
00032
00033 class Event;
00034 class Event_chew_fin;
00035
00039 class SimContact : public oasys::Logger, public Processable {
00040
00041 public:
00042
00043 static const bool ALLOW_FRAGMENTATION = false;
00044 static const bool DISALLOW_FRACTIONAL_TRANSFERS = true;
00045
00046 SimContact (int id, Node* src, Node* dst, double bw,
00047 double latency, bool isup, int up, int down);
00048
00049
00050
00051 bool is_open() ;
00052
00053
00054
00055
00056
00057 void chew_message(Message* msg) ;
00058
00059 Node* src() { return src_; }
00060 Node* dst() { return dst_; }
00061 int id() { return id_; }
00062
00063 private:
00064
00065 int id_;
00066 Node* src_ ;
00067 Node* dst_ ;
00068 double latency_;
00069 double bw_;
00070
00071
00072
00073 int up_;
00074 int down_;
00075
00076 typedef enum {
00077 OPEN = 1,
00078 BUSY = 2,
00079 CLOSE = 3
00080 } state_t;
00081
00082 state_t state_;
00083
00084 Event_chew_fin* chewing_event_ ;
00085 Event* future_updown_event_;
00086
00087 void open_contact(bool b) ;
00088 void close_contact(bool b) ;
00089 void process(Event* e) ;
00090 void chewing_complete(double size, Message* msg) ;
00091 };
00092 }
00093
00094 #endif