IBR-DTNSuite 0.6

daemon/src/net/LOWPANConvergenceLayer.h

Go to the documentation of this file.
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/vinterface.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::vinterface net, int panid, bool broadcast = false, unsigned int mtu = 127);
00024 
00025                         virtual ~LOWPANConvergenceLayer();
00026 
00030                         void update(const ibrcommon::vinterface &iface, std::string &name, std::string &data) throw(dtn::net::DiscoveryServiceProvider::NoServiceHereException);
00031 
00032                         dtn::core::Node::Protocol getDiscoveryProtocol() const;
00033 
00034                         void queue(const dtn::core::Node &n, const ConvergenceLayer::Job &job);
00035 
00036                         LOWPANConvergenceLayer& operator>>(dtn::data::Bundle&);
00037 
00041                         virtual const std::string getName() const;
00042 
00043                 protected:
00044                         virtual void componentUp();
00045                         virtual void componentRun();
00046                         virtual void componentDown();
00047                         bool __cancellation();
00048 
00049                 private:
00050                         ibrcommon::lowpansocket *_socket;
00051 
00052                         ibrcommon::vinterface _net;
00053                         int _panid;
00054                         int m_socket;
00055 
00056                         static const int DEFAULT_PANID;
00057 
00058                         unsigned int m_maxmsgsize;
00059 
00060                         ibrcommon::Mutex m_writelock;
00061                         ibrcommon::Mutex m_readlock;
00062 
00063                         bool _running;
00064                 };
00065         }
00066 }
00067 #endif /*LOWPANCONVERGENCELAYER_H_*/