Index: src/xplra/DataRefTask.cc
===================================================================
--- src/xplra/DataRefTask.cc	(revision 3)
+++ src/xplra/DataRefTask.cc	(revision 3)
@@ -0,0 +1,61 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "DataRefTask.h"
+
+#include "xplcommon/Util.h"
+
+//------------------------------------------------------------------------------
+
+using xplra::DataRefTask;
+
+using xplcommon::Util;
+
+//------------------------------------------------------------------------------
+
+void DataRefTask::perform()
+{
+    if (dataRef==0) {
+        // Util::debug("DataRefTask::perform: name='%s'\n", name.c_str());
+        dataRef = XPLMFindDataRef(name.c_str());
+        // Util::debug("DataRefTask::perform: dataRef=%p\n", dataRef);
+    }
+    if (dataRef!=0) {
+        process();
+    }
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplra/DataRefTask.h
===================================================================
--- src/xplra/DataRefTask.h	(revision 3)
+++ src/xplra/DataRefTask.h	(revision 3)
@@ -0,0 +1,153 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_DATAREFTASK_H
+#define XPLRA_DATAREFTASK_H
+//------------------------------------------------------------------------------
+
+#include "Task.h"
+
+#include <XPLMDataAccess.h>
+
+#include <string>
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * A task that works with some dataref. This base class
+ * performs the mapping from dataref name to dataref value. The actual
+ * operation is performed by the subclasses.
+ */
+class DataRefTask : public Task
+{
+private:
+    /**
+     * The name of the dataref.
+     */
+    std::string name;
+
+    /**
+     * The dataref.
+     */
+    XPLMDataRef dataRef;
+
+protected:
+    /**
+     * Construct the dataref task for the dataref with the given name.
+     */
+    DataRefTask(const std::string& name);
+
+    /**
+     * Construct the dataref task for the given dataref.
+     */
+    DataRefTask(XPLMDataRef dataRef);
+
+    /**
+     * Determine if the task is valid, which is so, if the dataref is
+     * not 0.
+     */
+    bool isValid() const;
+
+    /**
+     * Get the name of the dataref.
+     */
+    const std::string& getName() const;
+
+    /**
+     * Get the dataref.
+     */
+    XPLMDataRef getDataRef() const;
+
+    /**
+     * Perform the task. If the dataref is not valid yet, it will be
+     * queried. If the query is successful, the process() function is
+     * called.
+     */
+    virtual void perform();
+
+    /**
+     * Process the dataref. When this function is called, the dataref
+     * is valid.
+     */
+    virtual void process() = 0;
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline DataRefTask::DataRefTask(const std::string& name) :
+    name(name),
+    dataRef(0)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline DataRefTask::DataRefTask(XPLMDataRef dataRef) :
+    dataRef(dataRef)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline bool DataRefTask::isValid() const
+{
+    return dataRef!=0;
+}
+
+//------------------------------------------------------------------------------
+
+inline const std::string& DataRefTask::getName() const
+{
+    return name;
+}
+
+//------------------------------------------------------------------------------
+
+inline XPLMDataRef DataRefTask::getDataRef() const
+{
+    return dataRef;
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_DATAREFTASK_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplra/GetDataRefTask.cc
===================================================================
--- src/xplra/GetDataRefTask.cc	(revision 3)
+++ src/xplra/GetDataRefTask.cc	(revision 3)
@@ -0,0 +1,107 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "GetDataRefTask.h"
+
+#include "xplcommon/Util.h"
+
+//------------------------------------------------------------------------------
+
+using xplra::GetByteArrayDataRefTask;
+
+using xplcommon::Util;
+
+using std::string;
+
+//------------------------------------------------------------------------------
+
+GetByteArrayDataRefTask::GetByteArrayDataRefTask(const std::string& name,
+                                                 int maxBytes, int offset) :
+    DataRefTask(name),
+    maxBytes(maxBytes),
+    offset(offset),
+    data((maxBytes>0) ? new unsigned char[maxBytes] : 0),
+    length(-1)
+{
+}
+
+//------------------------------------------------------------------------------
+
+GetByteArrayDataRefTask::GetByteArrayDataRefTask(XPLMDataRef dataRef,
+                                                 int maxBytes, int offset) :
+    DataRefTask(dataRef),
+    maxBytes(maxBytes),
+    offset(offset),
+    data((maxBytes>0) ? new unsigned char[maxBytes] : 0),
+    length(-1)
+{
+}
+
+//------------------------------------------------------------------------------
+
+GetByteArrayDataRefTask::~GetByteArrayDataRefTask()
+{
+    delete [] data;
+}
+
+//------------------------------------------------------------------------------
+
+void GetByteArrayDataRefTask::process()
+{
+    if (maxBytes<0) {
+        maxBytes = XPLMGetDatab(getDataRef(), 0, 0, 0);
+
+        if (maxBytes>0) {
+            maxBytes -= offset;
+        }
+
+        if (maxBytes>0) {
+            data = new unsigned char[maxBytes];
+        } else {
+            maxBytes = 0;
+        }
+    }
+
+    Util::debug("GetByteArrayDataRefTask::process: dataRef=%p, maxBytes=%d, data=%p, offset\n",
+                getDataRef(), maxBytes, data, offset);
+    if (maxBytes>0) {
+        length = XPLMGetDatab(getDataRef(), data, offset, maxBytes);
+    } else {
+        length = -1;
+    }
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplra/GetDataRefTask.h
===================================================================
--- src/xplra/GetDataRefTask.h	(revision 3)
+++ src/xplra/GetDataRefTask.h	(revision 3)
@@ -0,0 +1,140 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_GETDATAREFTASK_H
+#define XPLRA_GETDATAREFTASK_H
+//------------------------------------------------------------------------------
+
+#include "DataRefTask.h"
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * A dataref task which retrieves the value of a byte array.
+ */
+class GetByteArrayDataRefTask : public DataRefTask
+{
+private:
+    /**
+     * The maximal number of bytes accepted.
+     */
+    int maxBytes;
+
+    /**
+     * The offset within the dataref's value to start querying from.
+     */
+    int offset;
+
+    /**
+     * The array to store the data in.
+     */
+    unsigned char* data;
+
+    /**
+     * The actual length of the data retrieved.
+     */
+    int length;
+
+public:
+    /**
+     * Construct the task for the dataref with the given name.
+     *
+     * @param maxBytes the maximal number of bytes to retrieve. If <0,
+     * the function will perform an extra query to retrieve the size
+     * of the dataref's data, which it will store in the task, so
+     * later on it can be reused.
+     */
+    GetByteArrayDataRefTask(const std::string& name,
+                            int maxBytes = -1, int offset = 0);
+
+    /**
+     * Construct the task for the given dataref
+     *
+     * @param maxBytes the maximal number of bytes to retrieve. If <0,
+     * the function will perform an extra query to retrieve the size
+     * of the dataref's data, which it will store in the task, so
+     * later on it can be reused.
+     */
+    GetByteArrayDataRefTask(XPLMDataRef dataRef,
+                            int maxBytes = -1, int offset = 0);
+
+
+    /**
+     * Destroy the task object.
+     */
+    virtual ~GetByteArrayDataRefTask();
+
+    /**
+     * Get the data.
+     */
+    const unsigned char* getData() const;
+
+    /**
+     * Get the length of the data.
+     */
+    int getLength() const;
+
+protected:
+    /**
+     * Process the dataref by querying its value.
+     */
+    virtual void process();
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline const unsigned char* GetByteArrayDataRefTask::getData() const
+{
+    return data;
+}
+
+//------------------------------------------------------------------------------
+
+inline int GetByteArrayDataRefTask::getLength() const
+{
+    return length;
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_GETDATAREFTASK_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplra/ListenThread.cc
===================================================================
--- src/xplra/ListenThread.cc	(revision 2)
+++ src/xplra/ListenThread.cc	(revision 3)
@@ -55,5 +55,6 @@
     while(!quitEvent.check() && !quitEvent.failed() && !acceptor.failed()) {
         if (acceptor.accept()) {
-            ServerThread* serverThread = new ServerThread(acceptor);
+            ServerThread* serverThread = new ServerThread(requestQueue,
+                                                          acceptor);
             serverThread->start();
         }
Index: src/xplra/Makefile.am
===================================================================
--- src/xplra/Makefile.am	(revision 2)
+++ src/xplra/Makefile.am	(revision 3)
@@ -24,8 +24,11 @@
 
 libxplra_la_SOURCES= \
-	plugin.cc	\
-	ListenThread.cc	\
-	RequestQueue.cc	\
-	ServerThread.cc
+	plugin.cc		\
+	ListenThread.cc		\
+	RequestQueue.cc		\
+	ServerThread.cc		\
+	TaskRequest.cc		\
+	DataRefTask.cc		\
+	GetDataRefTask.cc
 
 libxplra_la_LIBADD=$(LIBXPLCOMMON_LIBS)
@@ -35,3 +38,7 @@
 	Request.h		\
 	RequestQueue.h		\
-	ServerThread.h
+	ServerThread.h		\
+	Task.h			\
+	TaskRequest.h		\
+	DataRefTask.h		\
+	GetDataRefTask.h
Index: src/xplra/ServerThread.cc
===================================================================
--- src/xplra/ServerThread.cc	(revision 2)
+++ src/xplra/ServerThread.cc	(revision 3)
@@ -31,4 +31,12 @@
 #include "ServerThread.h"
 
+#include "RequestQueue.h"
+#include "GetDataRefTask.h"
+#include "TaskRequest.h"
+
+#include <xplcommon/Util.h>
+
+#include <cstdio>
+
 //------------------------------------------------------------------------------
 
@@ -37,4 +45,7 @@
 using xplcommon::LocalAcceptor;
 using xplcommon::Mutex;
+using xplcommon::Util;
+
+using std::string;
 
 //------------------------------------------------------------------------------
@@ -57,6 +68,7 @@
 //------------------------------------------------------------------------------
 
-ServerThread::ServerThread(LocalAcceptor& acceptor) :
+ServerThread::ServerThread(RequestQueue& requestQueue, LocalAcceptor& acceptor) :
     Thread(true),
+    requestQueue(requestQueue),
     bufferedStream(acceptor.getSocket(&waiter)),
     stream(*bufferedStream)
@@ -89,6 +101,50 @@
 void ServerThread::run()
 {
-    stream.write("Hello, world!", 13);
-    stream.flush();
+    Util::debug("hu.varadiistvan.xplra.ServerThread[%p]::run\n", this);
+    while(stream) {
+        uint8_t command = stream.readU8();
+        if (!stream) continue;
+
+        // Util::debug("hu.varadiistvan.xplra.ServerThread[%p]::run: command=0x%02x\n",
+        //             this, command);
+
+        if (command==CMD_GET_SINGLE) {
+            string name = stream.readString();
+            uint8_t type = stream.readU8();
+            if (!stream) continue;
+            // Util::debug("hu.varadiistvan.xplra.ServerThread[%p]::run: name='%s', type=0x%02x\n",
+            //             this, name.c_str(), type);
+            if (type==TYPE_BYTE_ARRAY) {
+                int length = stream.readS32();
+                if (!stream) continue;
+
+                // Util::debug("hu.varadiistvan.xplra.ServerThread[%p]::run: length=%lu\n",
+                //             this, static_cast<unsigned long>(length));
+
+                GetByteArrayDataRefTask* task =
+                    new GetByteArrayDataRefTask(name, length);
+                TaskRequest request(task);
+
+                if (requestQueue.execute(&request)) {
+                    // Util::debug("hu.varadiistvan.xplra.ServerThread[%p]::run: request executed\n");
+                    stream.writeU8(RESULT_OK);
+                    int length = task->getLength();
+                    stream.writeS32(length);
+                    if (length>0) {
+                        stream.write(task->getData(), length);
+                    }
+                } else {
+                    break;
+                }
+            } else {
+                stream.writeU8(RESULT_OTHER_ERROR);
+            }
+        } else {
+            stream.writeU8(RESULT_INVALID_COMMAND);
+        }
+        stream.flush();
+    }
+
+    Util::debug("hu.varadiistvan.xplra.ServerThread[%p]::run: quitting\n", this);
 }
 
Index: src/xplra/ServerThread.h
===================================================================
--- src/xplra/ServerThread.h	(revision 2)
+++ src/xplra/ServerThread.h	(revision 3)
@@ -37,5 +37,5 @@
 #include <xplcommon/Waiter.h>
 #include <xplcommon/BufferedStream.h>
-#include <xplcommon/BlockingStream.h>
+#include <xplcommon/DataStream.h>
 #include <xplcommon/LocalAcceptor.h>
 
@@ -48,4 +48,8 @@
 //------------------------------------------------------------------------------
 
+class RequestQueue;
+
+//------------------------------------------------------------------------------
+
 /**
  * A thread serving a client.
@@ -53,4 +57,65 @@
 class ServerThread : public xplcommon::Thread
 {
+public:
+    /**
+     * Command: get the value of a single dataref.
+     */
+    static const uint8_t CMD_GET_SINGLE = 0x01;
+
+    /**
+     * Data type: int
+     */
+    static const uint8_t TYPE_INT = 0x01;
+
+    /**
+     * Data type: float
+     */
+    static const uint8_t TYPE_FLOAT = 0x02;
+
+    /**
+     * Data type: double
+     */
+    static const uint8_t TYPE_DOUBLE = 0x03;
+
+    /**
+     * Data type: float array
+     */
+    static const uint8_t TYPE_FLOAT_ARRAY = 0x11;
+
+    /**
+     * Data type: int array
+     */
+    static const uint8_t TYPE_INT_ARRAY = 0x12;
+
+    /**
+     * Data type: byte array
+     */
+    static const uint8_t TYPE_BYTE_ARRAY = 0x13;
+
+    /**
+     * Result code: no error, everything is OK.
+     */
+    static const uint8_t RESULT_OK = 0x00;
+
+    /**
+     * Result code: invalid command
+     */
+    static const uint8_t RESULT_INVALID_COMMAND = 0x01;
+
+    /**
+     * Result code: unknown dataref
+     */
+    static const uint8_t RESULT_UNKNOWN_DATAREF = 0x02;
+
+    /**
+     * Result code: invalid type
+     */
+    static const uint8_t RESULT_INVALID_TYPE = 0x03;
+
+    /**
+     * Result code: other error
+     */
+    static const uint8_t RESULT_OTHER_ERROR = 0xff;
+
 private:
     /**
@@ -77,4 +142,9 @@
 private:
     /**
+     * The request queue to use.
+     */
+    RequestQueue& requestQueue;
+
+    /**
      * Our waiter.
      */
@@ -87,7 +157,7 @@
 
     /**
-     * The blocking stream being used for communication.
+     * The data stream being used for communication.
      */
-    xplcommon::BlockingStream stream;
+    xplcommon::DataStream stream;
 
 public:
@@ -96,5 +166,6 @@
      * given acceptor.
      */
-    ServerThread(xplcommon::LocalAcceptor& acceptor);
+    ServerThread(RequestQueue& requestQueue,
+                 xplcommon::LocalAcceptor& acceptor);
 
     /**
Index: src/xplra/Task.h
===================================================================
--- src/xplra/Task.h	(revision 3)
+++ src/xplra/Task.h	(revision 3)
@@ -0,0 +1,75 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_TASK_H
+#define XPLRA_TASK_H
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * A task is like a request, but it cannot be executed directly by the
+ * flight loop callback. Instead, it defines some simple task, of
+ * which potentially many can be added to a single request.
+ */
+class Task
+{
+public:
+    /**
+     * Virtual destructor.
+     */
+    virtual ~Task();
+
+    /**
+     * Perform the task
+     */
+    virtual void perform() = 0;
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline Task::~Task()
+{
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_TASK_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplra/TaskRequest.cc
===================================================================
--- src/xplra/TaskRequest.cc	(revision 3)
+++ src/xplra/TaskRequest.cc	(revision 3)
@@ -0,0 +1,50 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "TaskRequest.h"
+
+//------------------------------------------------------------------------------
+
+using xplra::TaskRequest;
+
+//------------------------------------------------------------------------------
+
+void TaskRequest::execute()
+{
+    task->perform();
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplra/TaskRequest.h
===================================================================
--- src/xplra/TaskRequest.h	(revision 3)
+++ src/xplra/TaskRequest.h	(revision 3)
@@ -0,0 +1,101 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef XPLRA_TASKREQUEST_H
+#define XPLRA_TASKREQUEST_H
+//------------------------------------------------------------------------------
+
+#include "Request.h"
+
+#include "Task.h"
+
+//------------------------------------------------------------------------------
+
+namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * A request the performs a task.
+ */
+class TaskRequest : public Request
+{
+private:
+    /**
+     * The task belonging to the request. It is owned by the request,
+     * i.e. deleted when the request is deleted.
+     */
+    Task* task;
+
+public:
+    /**
+     * Construct the request for the given task. The task will become
+     * owned by the request, so it will be deleted when the task is
+     * deleted.
+     */
+    TaskRequest(Task* task);
+
+    /**
+     * Destroy the task request.
+     */
+    virtual ~TaskRequest();
+
+    /**
+     * Execute the request by performing the task.
+     */
+    virtual void execute();
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline TaskRequest::TaskRequest(Task* task) :
+    task(task)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline TaskRequest::~TaskRequest()
+{
+    delete task;
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplra */
+
+//------------------------------------------------------------------------------
+#endif // XPLRA_TASKREQUEST_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
