Contact.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 _CONTACT_H_
00018 #define _CONTACT_H_
00019 
00020 #include <oasys/debug/DebugUtils.h>
00021 #include <oasys/debug/Formatter.h>
00022 #include <oasys/serialize/Serialize.h>
00023 #include <oasys/util/Ref.h>
00024 #include <oasys/util/RefCountedObject.h>
00025 
00026 namespace dtn {
00027 
00028 class Bundle;
00029 class BundleList;
00030 class ConvergenceLayer;
00031 class CLInfo;
00032 class Link;
00033 
00049 class Contact : public oasys::RefCountedObject,
00050                 public oasys::Logger,
00051                 public oasys::SerializableObject
00052 {
00053 public:
00057     Contact(Link* link);
00058 
00059 private:
00064     virtual ~Contact();
00065     friend class oasys::RefCountedObject;
00066 
00067 public:
00071     void set_cl_info(CLInfo* cl_info)
00072     {
00073         ASSERT((cl_info_ == NULL && cl_info != NULL) ||
00074                (cl_info_ != NULL && cl_info == NULL));
00075         
00076         cl_info_ = cl_info;
00077     }
00078     
00082     CLInfo* cl_info() { return cl_info_; }
00083     
00087     Link* link() { return link_; }
00088 
00092     int format(char* buf, size_t sz) const;
00093 
00097     virtual void serialize( oasys::SerializeAction *a );
00098 
00100     struct timeval start_time_;
00101 
00103     u_int32_t duration_ms_;
00104 
00106     u_int32_t bps_;
00107     
00109     u_int32_t latency_ms_;
00110 
00111 protected:
00112     Link* link_ ;       
00113 
00114     
00115     CLInfo* cl_info_;   
00116 };
00117 
00121 typedef oasys::Ref<Contact> ContactRef;
00122 
00123 } // namespace dtn
00124 
00125 #endif /* _CONTACT_H_ */

Generated on Sat Sep 8 08:43:26 2007 for DTN Reference Implementation by  doxygen 1.5.3