| 1 | /**************************************************************************** |
|---|
| 2 | |
|---|
| 3 | Copyright 2007 Virginia Polytechnic Institute and State University |
|---|
| 4 | |
|---|
| 5 | This file is part of the OSSIE Packetizer. |
|---|
| 6 | |
|---|
| 7 | OSSIE Packetizer is free software; you can redistribute it and/or modify |
|---|
| 8 | it under the terms of the GNU General Public License as published by |
|---|
| 9 | the Free Software Foundation; either version 2 of the License, or |
|---|
| 10 | (at your option) any later version. |
|---|
| 11 | |
|---|
| 12 | OSSIE Packetizer is distributed in the hope that it will be useful, |
|---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | GNU General Public License for more details. |
|---|
| 16 | |
|---|
| 17 | You should have received a copy of the GNU General Public License |
|---|
| 18 | along with OSSIE Packetizer; if not, write to the Free Software |
|---|
| 19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 20 | |
|---|
| 21 | ****************************************************************************/ |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | #ifndef PACKETIZERDSP_IMPL_H |
|---|
| 25 | #define PACKETIZERDSP_IMPL_H |
|---|
| 26 | |
|---|
| 27 | #include <stdlib.h> |
|---|
| 28 | #include "PNCodes.h" |
|---|
| 29 | #include "sigproc/SigProc.h" |
|---|
| 30 | |
|---|
| 31 | #define PN_SYNC_CODE_LENGTH 63 |
|---|
| 32 | #define PN_CONTROL_CODE_LENGTH 7 |
|---|
| 33 | #define NUM_CONTROL_CODES 7 |
|---|
| 34 | |
|---|
| 35 | /// Forward error correction scheme |
|---|
| 36 | enum FECScheme { |
|---|
| 37 | REPEAT_1, ///< Repeat code, rate 1/3 |
|---|
| 38 | RS_1, ///< Reed solomon, rate... |
|---|
| 39 | CONV_1 ///< Convolutional, rate..., K=... |
|---|
| 40 | }; |
|---|
| 41 | |
|---|
| 42 | /// Interleaving scheme |
|---|
| 43 | enum InterleavingScheme { |
|---|
| 44 | INT_1, ///< Interleaving depth... |
|---|
| 45 | INT_2 ///< Interleaving depth... |
|---|
| 46 | }; |
|---|
| 47 | |
|---|
| 48 | /// Cyclic redundancy check scheme |
|---|
| 49 | enum CRCScheme { |
|---|
| 50 | CRC_1, |
|---|
| 51 | CRC_2 |
|---|
| 52 | }; |
|---|
| 53 | |
|---|
| 54 | /// Packet type |
|---|
| 55 | enum PacketType { |
|---|
| 56 | LOW_LATENCY, ///< |
|---|
| 57 | RELIABLE_DATA ///< |
|---|
| 58 | }; |
|---|
| 59 | |
|---|
| 60 | /** \brief |
|---|
| 61 | * |
|---|
| 62 | */ |
|---|
| 63 | class PacketizerDSP |
|---|
| 64 | { |
|---|
| 65 | public: |
|---|
| 66 | /// Initializing constructor |
|---|
| 67 | PacketizerDSP(); |
|---|
| 68 | |
|---|
| 69 | /// Destructor |
|---|
| 70 | ~PacketizerDSP(); |
|---|
| 71 | |
|---|
| 72 | protected: |
|---|
| 73 | // Physical layer definitions |
|---|
| 74 | char * pnSyncCode; ///< packet synchronization code |
|---|
| 75 | char * pn_eom_code; ///< packet eom sync code |
|---|
| 76 | |
|---|
| 77 | // Media Access Control layer definitions |
|---|
| 78 | FECScheme fec_inner; |
|---|
| 79 | FECScheme fec_outer; |
|---|
| 80 | InterleavingScheme interleaving; |
|---|
| 81 | CRCScheme crc; |
|---|
| 82 | |
|---|
| 83 | // Network layer definitions |
|---|
| 84 | unsigned long src_id; ///< source identifier |
|---|
| 85 | unsigned long dst_id; ///< destination identifier |
|---|
| 86 | |
|---|
| 87 | // Transport layer definitions |
|---|
| 88 | PacketType packet_type; ///< packet type identifier |
|---|
| 89 | unsigned long packet_id; ///< packet identifier |
|---|
| 90 | unsigned long port_id; ///< port identifier |
|---|
| 91 | |
|---|
| 92 | // Application layer definitions |
|---|
| 93 | // ... |
|---|
| 94 | |
|---|
| 95 | /// Array of control code pointers |
|---|
| 96 | char ** controlBlock; |
|---|
| 97 | |
|---|
| 98 | /// Sets pointers in controlBlock to appropriate control codes |
|---|
| 99 | void ConfigureControl( unsigned char id ); |
|---|
| 100 | |
|---|
| 101 | /// Correlate buffer with code |
|---|
| 102 | int CorrelateSequence( char * _code, unsigned int _N ); |
|---|
| 103 | |
|---|
| 104 | SigProc::CircularBuffer <char> b; ///< circular input/output buffer |
|---|
| 105 | int rxy; ///< cross-correlator output |
|---|
| 106 | |
|---|
| 107 | private: |
|---|
| 108 | /// Disallow copy constructor |
|---|
| 109 | PacketizerDSP(PacketizerDSP&); |
|---|
| 110 | |
|---|
| 111 | }; |
|---|
| 112 | |
|---|
| 113 | #endif |
|---|
| 114 | |
|---|