IBR-DTN  1.0.0
HTTPConvergenceLayer.h
Go to the documentation of this file.
1 
31 #ifndef HTTPCONVERGENCELAYER_H_
32 #define HTTPCONVERGENCELAYER_H_
33 
34 #include "Component.h"
35 
36 #include "core/BundleCore.h"
37 #include "core/BundleEvent.h"
38 
39 #include <ibrdtn/data/Serializer.h>
40 
41 #include "net/ConvergenceLayer.h"
43 
44 #include <ibrcommon/data/BLOB.h>
45 #include <ibrcommon/data/iobuffer.h>
46 
47 #include <ibrcommon/net/vinterface.h>
48 #include <ibrcommon/net/vaddress.h>
49 #include <ibrcommon/thread/MutexLock.h>
50 #include <ibrcommon/thread/Mutex.h>
51 #include <ibrcommon/thread/Thread.h>
52 #include <ibrcommon/Exceptions.h>
53 #include <ibrcommon/Logger.h>
54 
55 #include <curl/curl.h>
56 #include <curl/easy.h>
57 
58 
59 #include <iostream>
60 
61 namespace dtn
62 {
63  namespace net
64  {
66  {
67  public:
68  HTTPConvergenceLayer(const std::string &server);
69  virtual ~HTTPConvergenceLayer();
70 
72 
76  void queue(const dtn::core::Node &n, const dtn::net::BundleTransfer &job);
77 
81  virtual const std::string getName() const;
82 
83 
84  protected:
85  virtual void componentUp() throw ();
86  virtual void componentRun() throw ();
87  virtual void componentDown() throw ();
88  void __cancellation() throw ();
89 
90  private:
94  const std::string _server;
95 
97  ibrcommon::Mutex _push_iob_mutex;
99  ibrcommon::iobuffer *_push_iob;
101  bool _running;
102  };
103 
104  class DownloadThread : public ibrcommon::JoinableThread
105  {
106  public:
107 
108  DownloadThread(ibrcommon::iobuffer &buf);
109  virtual ~DownloadThread();
110 
111  protected:
112  void run() throw ();
113  void __cancellation() throw ();
114 
115  private:
117  std::istream _stream;
118  };
119 
120  }
121 }
122 
123 #endif /* HTTPCONVERGENCELAYER_H_ */
HTTPConvergenceLayer(const std::string &server)
dtn::core::Node::Protocol getDiscoveryProtocol() const
void queue(const dtn::core::Node &n, const dtn::net::BundleTransfer &job)
virtual const std::string getName() const
DownloadThread(ibrcommon::iobuffer &buf)