[haiku-commits] r35403 - in haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination: . algorithms interfaces services

  • From: coling@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 4 Feb 2010 09:21:45 +0100 (CET)

Author: colin
Date: 2010-02-04 09:21:45 +0100 (Thu, 04 Feb 2010)
New Revision: 35403
Changeset: http://dev.haiku-os.org/changeset/35403/haiku

Added:
   
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/algorithms/
   
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/algorithms/Jamfile
   
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/algorithms/NullCipherAlgorithm.cpp
   
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/algorithms/NullCipherAlgorithm.h
   
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/interfaces/
   
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/interfaces/CipherAlgorithm.h
   
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/interfaces/Jamfile
   
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/services/EncryptService.cpp
   
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/services/EncryptService.h
Modified:
   
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/Jamfile
   
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/services/FragmentateService.cpp
   
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/services/FragmentateService.h
   
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/services/Jamfile
Log:
* Introduced encryption framework, to allow changing the encryption algorithm
  dynamically.
* Implemented the dummy encryption algorithm class NullCipherAlgorithm, for
  unencrypted transmissions.
* Implemented encryption service by using the encryption framework.


Modified: 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/Jamfile
===================================================================
--- 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/Jamfile
        2010-02-04 01:37:21 UTC (rev 35402)
+++ 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/Jamfile
        2010-02-04 08:21:45 UTC (rev 35403)
@@ -6,7 +6,10 @@
 KernelMergeObject mpdu_coordination.o :
        Roster.cpp
        : :
+       mpdu_coordination_algorithms.o
        mpdu_coordination_services.o
        ;
 
-HaikuSubInclude services ;
\ No newline at end of file
+HaikuSubInclude algorithms ;
+HaikuSubInclude interfaces ;
+HaikuSubInclude services ;

Added: 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/algorithms/Jamfile
===================================================================
--- 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/algorithms/Jamfile
                             (rev 0)
+++ 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/algorithms/Jamfile
     2010-02-04 08:21:45 UTC (rev 35403)
@@ -0,0 +1,8 @@
+SubDir HAIKU_TOP src add-ons kernel network devices ieee80211 stack
+       mpdu_coordination algorithms ;
+
+UseHeaders [ FDirName $(SUBDIR) .. .. ] : true ;
+
+KernelMergeObject mpdu_coordination_algorithms.o :
+       NullCipherAlgorithm.cpp
+       ;

Added: 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/algorithms/NullCipherAlgorithm.cpp
===================================================================
--- 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/algorithms/NullCipherAlgorithm.cpp
                             (rev 0)
+++ 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/algorithms/NullCipherAlgorithm.cpp
     2010-02-04 08:21:45 UTC (rev 35403)
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2010 Haiku Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *             Colin Günther, coling@xxxxxx
+ */
+
+
+/*!    Implementation of a dummy cipher algorithm for circumstances, where 
neither
+       encryption nor decryption is needed.
+ */
+
+
+#include <mpdu_coordination/algorithms/NullCipherAlgorithm.h>
+
+
+using namespace Ieee80211::MpduCoordination;
+
+
+// #pragma mark - CipherAlgorithm interface
+
+
+/*!    Doesn't decrypt anything.
+       But it checks whether the passed frame pointer is NULL.
+
+       \param frame isn't changed in anyway by this method.
+       \return B_OK It is safe to use the frame.
+       \return B_BAD_VALUE It isn't safe to use the frame, due to being a NULL
+               pointer.
+ */
+status_t
+NullCipherAlgorithm::Decrypt(Frame* frame)
+{
+       if (frame == NULL)
+               return B_BAD_VALUE;
+       return B_OK;
+}
+
+
+/*!    Doesn't encrypt anything.
+       But it checks whether the passed frame pointer is NULL.
+
+       \param frame isn't changed in anyway by this method.
+       \return B_OK It is safe to use the frame.
+       \return B_BAD_VALUE It isn't safe to use the frame, due to being a NULL
+               pointer.
+ */
+status_t
+NullCipherAlgorithm::Encrypt(Frame* frame)
+{
+       if (frame == NULL)
+               return B_BAD_VALUE;
+       return B_OK;
+}


Property changes on: 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/algorithms/NullCipherAlgorithm.cpp
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/algorithms/NullCipherAlgorithm.h
===================================================================
--- 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/algorithms/NullCipherAlgorithm.h
                               (rev 0)
+++ 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/algorithms/NullCipherAlgorithm.h
       2010-02-04 08:21:45 UTC (rev 35403)
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2010 Haiku Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef IEEE80211_NULLCIPHERALGORITHM_H_
+#define IEEE80211_NULLCIPHERALGORITHM_H_
+
+
+#include <mpdu_coordination/interfaces/CipherAlgorithm.h>
+
+
+namespace Ieee80211 {
+namespace MpduCoordination {
+
+class NullCipherAlgorithm : public CipherAlgorithm {
+public:
+       virtual status_t        Decrypt(Frame*);
+       virtual status_t        Encrypt(Frame*);
+};
+
+}      /* namespace MpduCoordination */
+}      /* namespace Ieee80211 */
+
+#endif /* IEEE80211_NULLCIPHERALGORITHM_H_ */


Property changes on: 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/algorithms/NullCipherAlgorithm.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/interfaces/CipherAlgorithm.h
===================================================================
--- 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/interfaces/CipherAlgorithm.h
                           (rev 0)
+++ 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/interfaces/CipherAlgorithm.h
   2010-02-04 08:21:45 UTC (rev 35403)
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2010 Haiku Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef IEEE80211_CIPHER_ALGORITHM_H_
+#define IEEE80211_CIPHER_ALGORITHM_H_
+
+
+#include <SupportDefs.h>
+
+#include <interfaces/Frame.h>
+
+
+namespace Ieee80211 {
+namespace MpduCoordination {
+
+class CipherAlgorithm {
+public:
+       virtual status_t        Decrypt(Frame*) = 0;
+       virtual status_t        Encrypt(Frame*) = 0;
+};
+
+}      /* namespace MpduCoordination */
+}      /* namespace Ieee80211 */
+
+#endif /* IEEE80211_CIPHER_ALGORITHM_H_ */


Property changes on: 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/interfaces/CipherAlgorithm.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/interfaces/Jamfile
===================================================================
--- 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/interfaces/Jamfile
                             (rev 0)
+++ 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/interfaces/Jamfile
     2010-02-04 08:21:45 UTC (rev 35403)
@@ -0,0 +1,4 @@
+SubDir HAIKU_TOP src add-ons kernel network devices ieee80211 stack
+       mpdu_coordination interfaces;
+
+UseHeaders [ FDirName $(SUBDIR) .. .. ] : true ;

Added: 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/services/EncryptService.cpp
===================================================================
--- 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/services/EncryptService.cpp
                            (rev 0)
+++ 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/services/EncryptService.cpp
    2010-02-04 08:21:45 UTC (rev 35403)
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2010 Haiku Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *             Colin Günther, coling@xxxxxx
+ */
+
+
+/*!    Implementation of the frame encryption service.
+       This service encrypts MAC Protocol Data Units, by using the cipher 
algorithm
+       currently in use by this service.
+ */
+
+
+#include <mpdu_coordination/services/EncryptService.h>
+
+
+using namespace Ieee80211;
+using namespace Ieee80211::MpduCoordination;
+
+
+// #pragma mark - service interface implementation
+
+
+status_t
+EncryptService::Process(Frame* frame)
+{
+       return fProcessQueue.Enqueue(frame);
+}
+
+
+status_t
+EncryptService::_Run()
+{
+       Frame* frame = NULL;
+       status_t status = B_OK;
+
+       do {
+               status = fProcessQueue.Dequeue(&frame);
+               if (status != B_OK)
+                       break;
+
+               status = fCipherAlgorithm->Encrypt(frame);
+       } while (status == B_OK);
+
+       return status;
+}


Property changes on: 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/services/EncryptService.cpp
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/services/EncryptService.h
===================================================================
--- 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/services/EncryptService.h
                              (rev 0)
+++ 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/services/EncryptService.h
      2010-02-04 08:21:45 UTC (rev 35403)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2010 Haiku Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *             Colin Günther, coling@xxxxxx
+ */
+
+
+#include <SupportDefs.h>
+
+#include <interfaces/Frame.h>
+#include <interfaces/Service.h>
+#include <mpdu_coordination/interfaces/CipherAlgorithm.h>
+#include <utilities/Queue.h>
+
+
+namespace Ieee80211 {
+namespace MpduCoordination {
+class EncryptService;
+}      /* namespace MpduCoordination */
+
+
+class MpduCoordination::EncryptService : public Service<Frame> {
+public:
+       virtual status_t        Process(Frame*);
+
+private:
+       virtual status_t        _Run();
+
+private:
+       CipherAlgorithm*        fCipherAlgorithm;
+       Queue<Frame>            fProcessQueue;
+};
+
+}      /* namespace Ieee80211 */


Property changes on: 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/services/EncryptService.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/services/FragmentateService.cpp
===================================================================
--- 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/services/FragmentateService.cpp
        2010-02-04 01:37:21 UTC (rev 35402)
+++ 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/services/FragmentateService.cpp
        2010-02-04 08:21:45 UTC (rev 35403)
@@ -12,8 +12,8 @@
        Protocol Data Units (MMPDUs) into smaller units called MAC Protocol Data
        Units (MPDU).
 
-       \sa IEEE Standard 802.11-2007,  section 9.4 "Fragmentation".
-       \sa IEEE Standard 802.11-2007   Annex C.3 "State machines for MAC STAs",
+       \sa IEEE Standard 802.11-2007, section 9.4 "Fragmentation".
+       \sa IEEE Standard 802.11-2007, Annex C.3 "State machines for MAC STAs",
                page 845.
  */
 
@@ -80,5 +80,5 @@
 status_t
 FragmentateService::_FragmentAndHandOverFragments(Frame* frame)
 {
-       return B_OK;
+       return fEncryptService.Process(frame);
 }

Modified: 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/services/FragmentateService.h
===================================================================
--- 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/services/FragmentateService.h
  2010-02-04 01:37:21 UTC (rev 35402)
+++ 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/services/FragmentateService.h
  2010-02-04 08:21:45 UTC (rev 35403)
@@ -10,6 +10,7 @@
 
 #include <interfaces/Frame.h>
 #include <interfaces/Service.h>
+#include <mpdu_coordination/services/EncryptService.h>
 #include <utilities/Queue.h>
 
 
@@ -21,14 +22,15 @@
 
 class MpduCoordination::FragmentateService : public Service<Frame> {
 public:
-       virtual status_t        Process(Frame*);
+       virtual status_t                Process(Frame*);
 
 private:
-       virtual status_t        _Run();
+       virtual status_t                _Run();
 
-                       status_t        _FragmentAndHandOverFragments(Frame*);
+                       status_t                
_FragmentAndHandOverFragments(Frame*);
 
-       Queue<Frame>            fProcessQueue;
+                       EncryptService  fEncryptService;
+                       Queue<Frame>    fProcessQueue;
 };
 
 }      /* namespace Ieee80211 */

Modified: 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/services/Jamfile
===================================================================
--- 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/services/Jamfile
       2010-02-04 01:37:21 UTC (rev 35402)
+++ 
haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination/services/Jamfile
       2010-02-04 08:21:45 UTC (rev 35403)
@@ -4,5 +4,6 @@
 UseHeaders [ FDirName $(SUBDIR) .. .. ] : true ;
 
 KernelMergeObject mpdu_coordination_services.o :
+       EncryptService.cpp
        FragmentateService.cpp
        ;


Other related posts:

  • » [haiku-commits] r35403 - in haiku/branches/developer/colin/wireless/src/add-ons/kernel/network/devices/ieee80211/stack/mpdu_coordination: . algorithms interfaces services - coling