00001 #ifndef LOWPANCONVERGENCELAYER_H_ 00002 #define LOWPANCONVERGENCELAYER_H_ 00003 00004 #include "Component.h" 00005 #include "net/ConvergenceLayer.h" 00006 #include "ibrcommon/Exceptions.h" 00007 #include "net/DiscoveryServiceProvider.h" 00008 #include "ibrcommon/net/NetInterface.h" 00009 #include "ibrcommon/net/lowpansocket.h" 00010 00011 using namespace dtn::data; 00012 00013 namespace dtn 00014 { 00015 namespace net 00016 { 00020 class LOWPANConvergenceLayer : public ConvergenceLayer, public dtn::daemon::IndependentComponent, public DiscoveryServiceProvider 00021 { 00022 public: 00023 LOWPANConvergenceLayer(ibrcommon::NetInterface net, int panid, bool broadcast = false, unsigned int mtu = 127); 00024 00025 virtual ~LOWPANConvergenceLayer(); 00026 00027 virtual void update(std::string &name, std::string &data); 00028 virtual bool onInterface(const ibrcommon::NetInterface &net) const; 00029 00030 dtn::core::Node::Protocol getDiscoveryProtocol() const; 00031 00032 void queue(const dtn::core::Node &n, const ConvergenceLayer::Job &job); 00033 00034 LOWPANConvergenceLayer& operator>>(dtn::data::Bundle&); 00035 00039 virtual const std::string getName() const; 00040 00041 protected: 00042 virtual void componentUp(); 00043 virtual void componentRun(); 00044 virtual void componentDown(); 00045 bool __cancellation(); 00046 00047 private: 00048 ibrcommon::lowpansocket *_socket; 00049 00050 ibrcommon::NetInterface _net; 00051 int _panid; 00052 int m_socket; 00053 00054 static const int DEFAULT_PANID; 00055 00056 unsigned int m_maxmsgsize; 00057 00058 ibrcommon::Mutex m_writelock; 00059 ibrcommon::Mutex m_readlock; 00060 00061 bool _running; 00062 }; 00063 } 00064 } 00065 #endif /*LOWPANCONVERGENCELAYER_H_*/
1.7.1