We don't use OpenBTS bit vectors in PCU anymore. All OpenBTS bit vectors are replaced by Osmocom bit vectors.

zecke/hacks/quick-exit
Ivan Kluchnikov 11 years ago
parent 962f97b21c
commit 835f91e8f8
  1. 90
      RLCMACTest.cpp
  2. 184
      csn1.cpp
  3. 8
      csn1.h
  4. 411
      gprs_rlcmac.cpp
  5. 8
      gprs_rlcmac.h
  6. 142
      gsm_rlcmac.cpp
  7. 12
      gsm_rlcmac.h
  8. 27
      pcu_l1_if.cpp
  9. 4
      pcu_l1_if.h

@ -22,6 +22,7 @@
//#include <BitVector.h>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include "csn1.h"
#include "gsm_rlcmac.h"
using namespace std;
@ -76,39 +77,52 @@ void printSizeofRLCMAC()
void testRlcMacDownlink()
{
BitVector resultVector(23*8);
resultVector.unhex("2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b");
struct bitvec *resultVector = bitvec_alloc(23);
bitvec_unhex(resultVector, "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b");
std::string testData[] = {
"4e082500e3f1a81d080820800b2b2b2b2b2b2b2b2b2b2b", // Packet Downlink Assignment
"48282407a6a074227201000b2b2b2b2b2b2b2b2b2b2b2b", // Packet Uplink Assignment
"47240c00400000000000000079eb2ac9402b2b2b2b2b2b", // Packet Uplink Ack Nack
"47283c367513ba333004242b2b2b2b2b2b2b2b2b2b2b2b" // Packet Uplink Assignment
"4913e00850884013a8048b2b2b2b2b2b2b2b2b2b2b2b2b"
"412430007fffffffffffffffefd19c7ba12b2b2b2b2b2b"
"41942b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b"
};
int testDataSize = sizeof(testData)/sizeof(testData[0]);
BitVector vector[testDataSize];
unsigned char origin[23];
unsigned char result[23];
cout << " DOWNLINK " << endl;
for (int i = 0; i < testDataSize; i++)
{
vector[i].resize(23*8);
vector[i].unhex(testData[i].c_str());
bitvec *vector = bitvec_alloc(23);
bitvec_unhex(vector, testData[i].c_str());
cout << "vector1 = ";
for (int i = 0; i < 23; i++)
{
cout << hex << (unsigned)*(vector->data + i);
}
cout << endl;
RlcMacDownlink_t * data = (RlcMacDownlink_t *)malloc(sizeof(RlcMacDownlink_t));
cout << "=========Start DECODE===========" << endl;
decode_gsm_rlcmac_downlink(&vector[i], data);
decode_gsm_rlcmac_downlink(vector, data);
cout << "+++++++++Finish DECODE++++++++++" << endl;
cout << "=========Start ENCODE=============" << endl;
encode_gsm_rlcmac_downlink(&resultVector, data);
encode_gsm_rlcmac_downlink(resultVector, data);
cout << "+++++++++Finish ENCODE+++++++++++" << endl;
cout << "vector1 = " << vector[i] << endl;
cout << "vector2 = " << resultVector << endl;
vector[i].pack(origin);
resultVector.pack(result);
if (memcmp(origin, result, 23) == 0)
cout << "vector1 = ";
for (int i = 0; i < 23; i++)
{
cout << (unsigned)*(vector->data + i);
}
cout << endl;
cout << "vector2 = ";
for (int i = 0; i < 23; i++)
{
cout << (unsigned)*(resultVector->data + i);
}
cout << endl;
if (memcmp(vector->data, resultVector->data, 23) == 0)
{
cout << "vector1 == vector2 : TRUE" << endl;
}
@ -116,7 +130,8 @@ void testRlcMacDownlink()
{
cout << "vector1 == vector2 : FALSE" << endl;
}
resultVector.unhex("2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b");
bitvec_unhex(resultVector, "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b");
bitvec_free(vector);
free(data);
}
}
@ -124,38 +139,50 @@ void testRlcMacDownlink()
void testRlcMacUplink()
{
BitVector resultVector(23*8);
resultVector.unhex("2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b");
struct bitvec *resultVector = bitvec_alloc(23);
bitvec_unhex(resultVector, "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b");
std::string testData[] = {
"400e1e61d11f2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b", // Packet Uplink Dummy Control Block
"400b8020000000000000002480e00b2b2b2b2b2b2b2b2b", // Packet Downlink Ack/Nack
"4016713dc094270ca2ae57ef909006aa0fc0001f80222b" // Packet Resource Request
"400a9020000000000000003010012a0800132b2b2b2b2b"
};
int testDataSize = sizeof(testData)/sizeof(testData[0]);
BitVector vector[testDataSize];
unsigned char origin[23];
unsigned char result[23];
cout << " UPLINK " << endl;
for (int i = 0; i < testDataSize; i++)
{
vector[i].resize(23*8);
vector[i].unhex(testData[i].c_str());
bitvec *vector = bitvec_alloc(23);
bitvec_unhex(vector, testData[i].c_str());
cout << "vector1 = ";
for (int i = 0; i < 23; i++)
{
cout << hex << (unsigned)*(vector->data + i);
}
cout << endl;
RlcMacUplink_t * data = (RlcMacUplink_t *)malloc(sizeof(RlcMacUplink_t));
cout << "=========Start DECODE===========" << endl;
decode_gsm_rlcmac_uplink(&vector[i], data);
decode_gsm_rlcmac_uplink(vector, data);
cout << "+++++++++Finish DECODE++++++++++" << endl;
cout << "=========Start ENCODE=============" << endl;
encode_gsm_rlcmac_uplink(&resultVector, data);
encode_gsm_rlcmac_uplink(resultVector, data);
cout << "+++++++++Finish ENCODE+++++++++++" << endl;
cout << "vector1 = " << vector[i] << endl;
cout << "vector2 = " << resultVector << endl;
vector[i].pack(origin);
resultVector.pack(result);
if (memcmp(origin, result, 23) == 0)
cout << "vector1 = ";
for (int i = 0; i < 23; i++)
{
cout << (unsigned)*(vector->data + i);
}
cout << endl;
cout << "vector2 = ";
for (int i = 0; i < 23; i++)
{
cout << (unsigned)*(resultVector->data + i);
}
cout << endl;
if (memcmp(vector->data, resultVector->data, 23) == 0)
{
cout << "vector1 == vector2 : TRUE" << endl;
}
@ -163,7 +190,8 @@ void testRlcMacUplink()
{
cout << "vector1 == vector2 : FALSE" << endl;
}
resultVector.unhex("2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b");
bitvec_unhex(resultVector, "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b");
bitvec_free(vector);
free(data);
}
}

@ -30,6 +30,8 @@
#include <iostream>
#include <cstdlib>
#include <assert.h>
#include <string.h>
#include "csn1.h"
@ -50,7 +52,7 @@ static const unsigned char ixBitsTab[] = {0, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4,
/* Returns no_of_bits (up to 8) masked with 0x2B */
static guint8
get_masked_bits8( BitVector *vector, size_t& readIndex, gint bit_offset, const gint no_of_bits)
get_masked_bits8( bitvec *vector, size_t& readIndex, gint bit_offset, const gint no_of_bits)
{
static const guint8 maskBits[] = {0x00, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF};
//gint byte_offset = bit_offset >> 3; /* divide by 8 */
@ -60,15 +62,15 @@ get_masked_bits8( BitVector *vector, size_t& readIndex, gint bit_offset, const
readIndex -= relative_bit_offset;
if (bit_shift >= 0)
{
result = (0x2B ^ ((guint8)vector->readField(readIndex, 8))) >> bit_shift;
result = (0x2B ^ ((guint8)bitvec_read_field(vector, readIndex, 8))) >> bit_shift;
readIndex-= bit_shift;
result &= maskBits[no_of_bits];
}
else
{
guint8 hight_part = (0x2B ^ ((guint8)vector->readField(readIndex, 8))) & maskBits[8 - relative_bit_offset];
guint8 hight_part = (0x2B ^ ((guint8)bitvec_read_field(vector, readIndex, 8))) & maskBits[8 - relative_bit_offset];
hight_part = (guint8) (hight_part << (-bit_shift));
result = (0x2B ^ ((guint8)vector->readField(readIndex, 8))) >> (8 + bit_shift);
result = (0x2B ^ ((guint8)bitvec_read_field(vector, readIndex, 8))) >> (8 + bit_shift);
readIndex = readIndex - (8 - (-bit_shift));
result |= hight_part;
}
@ -164,9 +166,9 @@ static const char* CSN_DESCR_type[]=
*/
static gboolean
existNextElement(BitVector *vector, size_t& readIndex, guint8 Tag)
existNextElement(bitvec *vector, size_t& readIndex, guint8 Tag)
{
guint8 res = vector->readField(readIndex, 1);
guint8 res = bitvec_read_field(vector, readIndex, 1);
//LOG(INFO) << "EXIST TAG = " << (unsigned)res;
if (Tag == STANDARD_TAG)
{
@ -177,7 +179,7 @@ existNextElement(BitVector *vector, size_t& readIndex, guint8 Tag)
gint16
csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, size_t& readIndex, void* data)
csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector, size_t& readIndex, void* data)
{
gint remaining_bits_len = ar->remaining_bits_len;
gint bit_offset = ar->bit_offset;
@ -201,7 +203,7 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
if (remaining_bits_len > 0)
{
pui8 = pui8DATA(data, pDescr->offset);
*pui8 = vector->readField(readIndex, 1);
*pui8 = bitvec_read_field(vector, readIndex, 1);
LOG(INFO) << pDescr->sz << " = " <<(unsigned)*pui8 << "\n";
/* end add the bit value to protocol tree */
}
@ -230,21 +232,21 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
{
if (no_of_bits <= 8)
{
guint8 ui8 = vector->readField(readIndex, no_of_bits);
guint8 ui8 = bitvec_read_field(vector, readIndex, no_of_bits);
pui8 = pui8DATA(data, pDescr->offset);
*pui8 = ui8;
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n";
}
else if (no_of_bits <= 16)
{
guint16 ui16 = vector->readField(readIndex, no_of_bits);
guint16 ui16 = bitvec_read_field(vector, readIndex, no_of_bits);
pui16 = pui16DATA(data, pDescr->offset);
*pui16 = ui16;
LOG(INFO) << pDescr->sz << " = " << *pui16 << "\n";;
}
else if (no_of_bits <= 32)
{
guint32 ui32 = vector->readField(readIndex, no_of_bits);
guint32 ui32 = bitvec_read_field(vector, readIndex, no_of_bits);
pui32 = pui32DATA(data, pDescr->offset);
*pui32 = ui32;
LOG(INFO) << pDescr->sz << " = " << *pui32 << "\n";
@ -273,21 +275,21 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
{
if (no_of_bits <= 8)
{
guint8 ui8 = vector->readField(readIndex, no_of_bits);
guint8 ui8 = bitvec_read_field(vector, readIndex, no_of_bits);
pui8 = pui8DATA(data, pDescr->offset);
*pui8 = ui8 + (guint8)pDescr->descr.value;
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n";
}
else if (no_of_bits <= 16)
{
guint16 ui16 = vector->readField(readIndex, no_of_bits);
guint16 ui16 = bitvec_read_field(vector, readIndex, no_of_bits);
pui16 = pui16DATA(data, pDescr->offset);
*pui16 = ui16 + (guint16)pDescr->descr.value;
LOG(INFO) << pDescr->sz << " = " << *pui16 << "\n";;
}
else if (no_of_bits <= 32)
{
guint32 ui32 = vector->readField(readIndex, no_of_bits);
guint32 ui32 = bitvec_read_field(vector, readIndex, no_of_bits);
pui32 = pui32DATA(data, pDescr->offset);
*pui32 = ui32 + (guint16)pDescr->descr.value;
LOG(INFO) << pDescr->sz << " = " << *pui32 << "\n";
@ -356,7 +358,7 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
pui8 = pui8DATA(data, pDescr->offset);
do
{
*pui8 = vector->readField(readIndex, no_of_bits);
*pui8 = bitvec_read_field(vector, readIndex, no_of_bits);
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n";
pui8++;
bit_offset += no_of_bits;
@ -439,7 +441,7 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
{
for(unsigned ib = 0; ib < 4; ib++)
{
guint8 ui8 = vector->readField(readIndex, 8);
guint8 ui8 = bitvec_read_field(vector, readIndex, 8);
pui8 = pui8DATA(data, pDescr->offset+ib);
*pui8 = ui8;
LOG(INFO) << pDescr->sz <<"[" << ib << "]= " << (unsigned)*pui8 << "\n";
@ -449,7 +451,7 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
{
for(unsigned ib = 0; ib < 8; ib++)
{
guint8 ui8 = vector->readField(readIndex, 8);
guint8 ui8 = bitvec_read_field(vector, readIndex, 8);
pui8 = pui8DATA(data, pDescr->offset+ib);
*pui8 = ui8;
LOG(INFO) << pDescr->sz <<"[" << ib << "]= " << (unsigned)*pui8 << "\n";
@ -502,7 +504,7 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
while (count > 0)
{
guint8 no_of_bits = pChoice->bits;
guint8 value = vector->readField(readIndex, no_of_bits);
guint8 value = bitvec_read_field(vector, readIndex, no_of_bits);
if (value == pChoice->value)
{
CSN_DESCR descr[2];
@ -549,7 +551,7 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
csnStream_t arT = *ar;
gint16 Status = -1;
LOG(INFO) << pDescr->sz << " length = " << vector->readField(readIndex, 7) << "\n";
LOG(INFO) << pDescr->sz << " length = " << bitvec_read_field(vector, readIndex, 7) << "\n";
arT.direction = 1;
bit_offset += 7;
remaining_bits_len -= 7;
@ -600,7 +602,7 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
}
else
{
index |= vector->readField(readIndex, 1);
index |= bitvec_read_field(vector, readIndex, 1);
}
remaining_bits_len--;
bit_offset++;
@ -623,7 +625,7 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
{
pui8 = pui8DATA(data, pDescr->offset);
*pui8 = 0x00;
if (vector->readField(readIndex, 1) > 0)
if (bitvec_read_field(vector, readIndex, 1) > 0)
{
*pui8 = 0x01;
}
@ -649,21 +651,21 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
if (no_of_bits <= 8)
{
guint8 ui8 = vector->readField(readIndex, no_of_bits);
guint8 ui8 = bitvec_read_field(vector, readIndex, no_of_bits);
pui8 = pui8DATA(data, pDescr->offset);
*pui8 = ui8;
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n";
}
else if (no_of_bits <= 16)
{
guint16 ui16 = vector->readField(readIndex, no_of_bits);
guint16 ui16 = bitvec_read_field(vector, readIndex, no_of_bits);
pui16 = pui16DATA(data, pDescr->offset);
*pui16 = ui16;
LOG(INFO) << pDescr->sz << " = " << *pui16 << "\n";
}
else if (no_of_bits <= 32)
{
guint32 ui32 = vector->readField(readIndex, no_of_bits);
guint32 ui32 = bitvec_read_field(vector, readIndex, no_of_bits);
pui32 = pui32DATA(data, pDescr->offset);
*pui32 = ui32;
LOG(INFO) << pDescr->sz << " = " << *pui32 << "\n";
@ -691,21 +693,21 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
{
if (no_of_bits <= 8)
{
guint8 ui8 = vector->readField(readIndex, no_of_bits);
guint8 ui8 = bitvec_read_field(vector, readIndex, no_of_bits);
pui8 = pui8DATA(data, pDescr->offset);
*pui8 = ui8 + (guint8)pDescr->descr.value;
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n";
}
else if (no_of_bits <= 16)
{
guint16 ui16 = vector->readField(readIndex, no_of_bits);
guint16 ui16 = bitvec_read_field(vector, readIndex, no_of_bits);
pui16 = pui16DATA(data, pDescr->offset);
*pui16 = ui16 + (guint16)pDescr->descr.value;
LOG(INFO) << pDescr->sz << " = " << *pui16 << "\n";
}
else if (no_of_bits <= 32)
{
guint32 ui32 = vector->readField(readIndex, no_of_bits);
guint32 ui32 = bitvec_read_field(vector, readIndex, no_of_bits);
pui32 = pui32DATA(data, pDescr->offset);
*pui32 = ui32 + (guint16)pDescr->descr.value;
LOG(INFO) << pDescr->sz << " = " << *pui32 << "\n";
@ -772,7 +774,7 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
while (nCount > 0)
{
*pui8 = vector->readField(readIndex, no_of_bits);
*pui8 = bitvec_read_field(vector, readIndex, no_of_bits);
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n";
pui8++;
bit_offset += no_of_bits;
@ -785,7 +787,7 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
while (nCount > 0)
{
*pui16 = vector->readField(readIndex, no_of_bits);
*pui16 = bitvec_read_field(vector, readIndex, no_of_bits);
LOG(INFO) << pDescr->sz << " = " << *pui16 << "\n";
pui16++;
bit_offset += no_of_bits;
@ -861,14 +863,14 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
if (no_of_bits <= 32)
{
guint32 ui32 = vector->readField(readIndex, no_of_bits);
guint32 ui32 = bitvec_read_field(vector, readIndex, no_of_bits);
pui32 = pui32DATA(data, pDescr->offset);
*pui32 = ui32;
LOG(INFO) << pDescr->sz << " = " << *pui32 << "\n";
}
else if (no_of_bits <= 64)
{
guint64 ui64 = vector->readField(readIndex, no_of_bits);
guint64 ui64 = bitvec_read_field(vector, readIndex, no_of_bits);
pui64 = pui64DATA(data, pDescr->offset);
*pui64 = ui64;
LOG(INFO) << pDescr->sz << " = " << *pui64 << "\n";
@ -933,7 +935,7 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
}
else
{
fExist = vector->readField(readIndex, 1);
fExist = bitvec_read_field(vector, readIndex, 1);
}
*pui8 = fExist;
@ -978,7 +980,7 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
/* the "regular" M_NEXT_EXIST description element */
fExist = 0x00;
if (vector->readField(readIndex, 1))
if (bitvec_read_field(vector, readIndex, 1))
{
fExist = 0x01;
}
@ -1071,7 +1073,7 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
if (nB1 > 0)
{ /* take care of the first byte - it will be right aligned */
*pui8 = vector->readField(readIndex, nB1);
*pui8 = bitvec_read_field(vector, readIndex, nB1);
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n" ;
pui8++;
no_of_bits -= nB1;
@ -1081,7 +1083,7 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
/* remaining no_of_bits is a multiple of 8 or 0 */
while (no_of_bits > 0)
{
*pui8 = vector->readField(readIndex, 8);
*pui8 = bitvec_read_field(vector, readIndex, 8);
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n" ;
pui8++;
no_of_bits -= 8;
@ -1126,14 +1128,14 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
while (no_of_bits > 0)
{
*pui8 = vector->readField(readIndex, 8);
*pui8 = bitvec_read_field(vector, readIndex, 8);
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n" ;
pui8++;
no_of_bits -= 8;
}
if (nB1 > 0)
{
*pui8 = vector->readField(readIndex, nB1);
*pui8 = bitvec_read_field(vector, readIndex, nB1);
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n" ;
pui8++;
no_of_bits -= nB1;
@ -1172,7 +1174,7 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
while (count > 0)
{
readIndex -= 8;
*pui8 = vector->readField(readIndex, 8);
*pui8 = bitvec_read_field(vector, readIndex, 8);
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n";
pui8++;
bit_offset += 8;
@ -1205,7 +1207,7 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
remaining_bits_len--;
/* extract and store no_of_bits long element from bitstream */
*pui8 = vector->readField(readIndex, no_of_bits);
*pui8 = bitvec_read_field(vector, readIndex, no_of_bits);
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n";
pui8++;
remaining_bits_len -= no_of_bits;
@ -1219,7 +1221,7 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
bit_offset += no_of_bits;
}
LOG(INFO) << pDescr->sz << " = " << vector->readField(readIndex, 1) << "\n";
LOG(INFO) << pDescr->sz << " = " << bitvec_read_field(vector, readIndex, 1) << "\n";
/* existNextElement() returned FALSE, 1 bit consumed */
bit_offset++;
@ -1271,7 +1273,7 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
}
}
LOG(INFO) << pDescr->sz << " = " << vector->readField(readIndex, 1) << "\n";
LOG(INFO) << pDescr->sz << " = " << bitvec_read_field(vector, readIndex, 1) << "\n";
/* existNextElement() returned FALSE, 1 bit consumed */
bit_offset++;
@ -1352,7 +1354,7 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
if (no_of_bits <= 32)
{
ui32 = vector->readField(readIndex, no_of_bits);
ui32 = bitvec_read_field(vector, readIndex, no_of_bits);
}
else
{
@ -1404,7 +1406,7 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, si
gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, size_t& writeIndex, void* data)
gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector, size_t& writeIndex, void* data)
{
gint remaining_bits_len = ar->remaining_bits_len;
gint bit_offset = ar->bit_offset;
@ -1429,7 +1431,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
if (remaining_bits_len > 0)
{
pui8 = pui8DATA(data, pDescr->offset);
vector->writeField(writeIndex, *pui8, 1);
bitvec_write_field(vector, writeIndex, *pui8, 1);
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n";
/* end add the bit value to protocol tree */
}
@ -1459,19 +1461,19 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
if (no_of_bits <= 8)
{
pui8 = pui8DATA(data, pDescr->offset);
vector->writeField(writeIndex, *pui8, no_of_bits);
bitvec_write_field(vector, writeIndex, *pui8, no_of_bits);
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n";
}
else if (no_of_bits <= 16)
{
pui16 = pui16DATA(data, pDescr->offset);
vector->writeField(writeIndex, *pui16, no_of_bits);
bitvec_write_field(vector, writeIndex, *pui16, no_of_bits);
LOG(INFO) << pDescr->sz << " = " << *pui16 << "\n";
}
else if (no_of_bits <= 32)
{
pui32 = pui32DATA(data, pDescr->offset);
vector->writeField(writeIndex, *pui32, no_of_bits);
bitvec_write_field(vector, writeIndex, *pui32, no_of_bits);
LOG(INFO) << pDescr->sz << " = " << *pui32 << "\n";
}
else
@ -1499,19 +1501,19 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
if (no_of_bits <= 8)
{
pui8 = pui8DATA(data, pDescr->offset);
vector->writeField(writeIndex, *pui8 - (guint8)pDescr->descr.value, no_of_bits);
bitvec_write_field(vector, writeIndex, *pui8 - (guint8)pDescr->descr.value, no_of_bits);
LOG(INFO) << pDescr->sz << " = " << (unsigned)(*pui8 - (guint8)pDescr->descr.value) << "\n";
}
else if (no_of_bits <= 16)
{
pui16 = pui16DATA(data, pDescr->offset);
vector->writeField(writeIndex, *pui16 - (guint16)pDescr->descr.value, no_of_bits);
bitvec_write_field(vector, writeIndex, *pui16 - (guint16)pDescr->descr.value, no_of_bits);
LOG(INFO) << pDescr->sz << " = " << *pui16 - (guint16)pDescr->descr.value << "\n";
}
else if (no_of_bits <= 32)
{
pui32 = pui32DATA(data, pDescr->offset);
vector->writeField(writeIndex, *pui32 - (guint16)pDescr->descr.value, no_of_bits);
bitvec_write_field(vector, writeIndex, *pui32 - (guint16)pDescr->descr.value, no_of_bits);
LOG(INFO) << pDescr->sz << " = " << *pui32 - (guint16)pDescr->descr.value << "\n";
}
else
@ -1540,12 +1542,12 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
if (no_of_bits <= 8)
{
pui8 = pui8DATA(data, pDescr->offset);
vector->writeField(writeIndex, *pui8, no_of_bits);
bitvec_write_field(vector, writeIndex, *pui8, no_of_bits);
// TODO : Change get_masked_bits8()
writeIndex -= no_of_bits;
guint8 ui8 = get_masked_bits8(vector, writeIndex, bit_offset, no_of_bits);
writeIndex -= no_of_bits;
vector->writeField(writeIndex, ui8, no_of_bits);
bitvec_write_field(vector, writeIndex, ui8, no_of_bits);
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n";
}
@ -1583,7 +1585,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
pui8 = pui8DATA(data, pDescr->offset);
do
{
vector->writeField(writeIndex, *pui8, no_of_bits);
bitvec_write_field(vector, writeIndex, *pui8, no_of_bits);
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n";
pui8++;
bit_offset += no_of_bits;
@ -1668,7 +1670,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
for(unsigned ib = 0; ib < 4; ib++)
{
pui8 = pui8DATA(data, pDescr->offset+ib);
vector->writeField(writeIndex, *pui8, 8);
bitvec_write_field(vector, writeIndex, *pui8, 8);
LOG(INFO) << pDescr->sz <<"[" << ib << "]= " << (unsigned)*pui8 << "\n";
}
}
@ -1677,7 +1679,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
for(unsigned ib = 0; ib < 8; ib++)
{
pui8 = pui8DATA(data, pDescr->offset+ib);
vector->writeField(writeIndex, *pui8, 8);
bitvec_write_field(vector, writeIndex, *pui8, 8);
LOG(INFO) << pDescr->sz <<"[" << ib << "]= " << (unsigned)*pui8 << "\n";
}
}
@ -1732,7 +1734,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
guint8 no_of_bits = pChoice->bits;
guint8 value = pChoice->value;
LOG(INFO) << pChoice->descr.sz << " = " << (unsigned)value << "\n";
vector->writeField(writeIndex, value, no_of_bits);
bitvec_write_field(vector, writeIndex, value, no_of_bits);
CSN_DESCR descr[2];
gint16 Status;
@ -1777,7 +1779,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
csnStreamInit(&arT, bit_offset, remaining_bits_len);
Status = serialize(&arT, vector, writeIndex, pvDATA(data, pDescr->offset));
vector->writeField(lengthIndex, writeIndex-lengthIndex-7, 7);
bitvec_write_field(vector, lengthIndex, writeIndex-lengthIndex-7, 7);
LOG(INFO) << pDescr->sz << " length = " << writeIndex-lengthIndex << "\n";
if (Status >= 0)
@ -1816,7 +1818,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
/* Assign UnionType */
pui8 = pui8DATA(data, pDescr->offset);
//read index from data and write to vector
vector->writeField(writeIndex, *pui8, Bits);
bitvec_write_field(vector, writeIndex, *pui8, Bits);
//decode index
writeIndex -= Bits;
@ -1831,7 +1833,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
}
else
{
index |= vector->readField(writeIndex, 1);
index |= bitvec_read_field(vector, writeIndex, 1);
}
remaining_bits_len--;
@ -1840,7 +1842,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
}
writeIndex -= Bits;
vector->writeField(writeIndex, index, Bits);
bitvec_write_field(vector, writeIndex, index, Bits);
/* script index to continue on, limited in case we do not have a power of 2 */
@ -1853,7 +1855,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
case CSN_BIT:
{
pui8 = pui8DATA(data, pDescr->offset);
vector->writeField(writeIndex, *pui8, 1);
bitvec_write_field(vector, writeIndex, *pui8, 1);
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n";
remaining_bits_len -= 1;
bit_offset++;
@ -1877,19 +1879,19 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
if (no_of_bits <= 8)
{
pui8 = pui8DATA(data, pDescr->offset);
vector->writeField(writeIndex, *pui8, no_of_bits);
bitvec_write_field(vector, writeIndex, *pui8, no_of_bits);
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n";
}
else if (no_of_bits <= 16)
{
pui16 = pui16DATA(data, pDescr->offset);
vector->writeField(writeIndex, *pui16, no_of_bits);
bitvec_write_field(vector, writeIndex, *pui16, no_of_bits);
LOG(INFO) << pDescr->sz << " = " << *pui16 << "\n";
}
else if (no_of_bits <= 32)
{
pui32 = pui32DATA(data, pDescr->offset);
vector->writeField(writeIndex, *pui32, no_of_bits);
bitvec_write_field(vector, writeIndex, *pui32, no_of_bits);
LOG(INFO) << pDescr->sz << " = " << *pui32 << "\n";
}
else
@ -1916,19 +1918,19 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
if (no_of_bits <= 8)
{
pui8 = pui8DATA(data, pDescr->offset);
vector->writeField(writeIndex, *pui8 - (guint8)pDescr->descr.value, no_of_bits);
bitvec_write_field(vector, writeIndex, *pui8 - (guint8)pDescr->descr.value, no_of_bits);
LOG(INFO) << pDescr->sz << " = " << (unsigned)(*pui8 - (guint8)pDescr->descr.value) << "\n";
}
else if (no_of_bits <= 16)
{
pui16 = pui16DATA(data, pDescr->offset);
vector->writeField(writeIndex, *pui16 - (guint16)pDescr->descr.value, no_of_bits);
bitvec_write_field(vector, writeIndex, *pui16 - (guint16)pDescr->descr.value, no_of_bits);
LOG(INFO) << pDescr->sz << " = " << *pui16 - (guint16)pDescr->descr.value << "\n";
}
else if (no_of_bits <= 32)
{
pui32 = pui32DATA(data, pDescr->offset);
vector->writeField(writeIndex, *pui32 - (guint16)pDescr->descr.value, no_of_bits);
bitvec_write_field(vector, writeIndex, *pui32 - (guint16)pDescr->descr.value, no_of_bits);
LOG(INFO) << pDescr->sz << " = " << *pui32 - (guint16)pDescr->descr.value << "\n";
}
else
@ -1957,12 +1959,12 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
if (no_of_bits <= 8)
{
pui8 = pui8DATA(data, pDescr->offset);
vector->writeField(writeIndex, *pui8, no_of_bits);
bitvec_write_field(vector, writeIndex, *pui8, no_of_bits);
// TODO : Change get_masked_bits8()
writeIndex -= no_of_bits;
guint8 ui8 = get_masked_bits8(vector, writeIndex, bit_offset, no_of_bits);
writeIndex -= no_of_bits;
vector->writeField(writeIndex, ui8, no_of_bits);
bitvec_write_field(vector, writeIndex, ui8, no_of_bits);
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n";
}
@ -2000,7 +2002,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
pui8 = pui8DATA(data, pDescr->offset);
do
{
vector->writeField(writeIndex, *pui8, no_of_bits);
bitvec_write_field(vector, writeIndex, *pui8, no_of_bits);
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n";
pui8++;
bit_offset += no_of_bits;
@ -2082,13 +2084,13 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
if (no_of_bits <= 32)
{
pui32 = pui32DATA(data, pDescr->offset);
vector->writeField(writeIndex, *pui32, no_of_bits);
bitvec_write_field(vector, writeIndex, *pui32, no_of_bits);
LOG(INFO) << pDescr->sz << " = " << *pui32 << "\n";
}
else if (no_of_bits <= 64)
{
pui64 = pui64DATA(data, pDescr->offset);
vector->writeField(writeIndex, *pui64, no_of_bits);
bitvec_write_field(vector, writeIndex, *pui64, no_of_bits);
LOG(INFO) << pDescr->sz << " = " << *pui64 << "\n";
}
else
@ -2146,7 +2148,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
unsigned exist = 0;
pui8 = pui8DATA(data, pDescr->offset);
exist = *pui8;
vector->writeField(writeIndex, *pui8, 1);
bitvec_write_field(vector, writeIndex, *pui8, 1);
writeIndex--;
if (CSN_EXIST_LH == pDescr->type)
{
@ -2154,10 +2156,10 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
}
else
{
fExist = vector->readField(writeIndex, 1);
fExist = bitvec_read_field(vector, writeIndex, 1);
}
writeIndex--;
vector->writeField(writeIndex, fExist, 1);
bitvec_write_field(vector, writeIndex, fExist, 1);
LOG(INFO) << pDescr->sz << " = " << (unsigned)fExist << "\n";
pDescr++;
remaining_bits_len -= 1;
@ -2193,7 +2195,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
break;
}
vector->writeField(writeIndex, *pui8, 1);
bitvec_write_field(vector, writeIndex, *pui8, 1);
fExist = *pui8;
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n";
remaining_bits_len -= 1;
@ -2233,11 +2235,11 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
}
/* the "regular" M_NEXT_EXIST_LH description element */
vector->writeField(writeIndex, *pui8, 1);
bitvec_write_field(vector, writeIndex, *pui8, 1);
writeIndex--;
fExist = get_masked_bits8(vector,writeIndex, bit_offset, 1);
writeIndex--;
vector->writeField(writeIndex, fExist, 1);
bitvec_write_field(vector, writeIndex, fExist, 1);
pui8++;
remaining_bits_len -= 1;
@ -2286,7 +2288,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
if (nB1 > 0)
{ /* take care of the first byte - it will be right aligned */
vector->writeField(writeIndex, *pui8, nB1);
bitvec_write_field(vector, writeIndex, *pui8, nB1);
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n" ;
pui8++;
no_of_bits -= nB1;
@ -2296,7 +2298,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
/* remaining no_of_bits is a multiple of 8 or 0 */
while (no_of_bits > 0)
{
vector->writeField(writeIndex, *pui8, 8);
bitvec_write_field(vector, writeIndex, *pui8, 8);
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n" ;
pui8++;
no_of_bits -= 8;
@ -2342,14 +2344,14 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
while (no_of_bits > 0)
{
vector->writeField(writeIndex, *pui8, 8);
bitvec_write_field(vector, writeIndex, *pui8, 8);
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n" ;
pui8++;
no_of_bits -= 8;
}
if (nB1 > 0)
{
vector->writeField(writeIndex, *pui8, nB1);
bitvec_write_field(vector, writeIndex, *pui8, nB1);
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n" ;
pui8++;
no_of_bits -= nB1;
@ -2388,7 +2390,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
while (count > 0)
{
vector->writeField(writeIndex, *pui8, 8);
bitvec_write_field(vector, writeIndex, *pui8, 8);
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n" ;
pui8++;
bit_offset += 8;
@ -2415,13 +2417,13 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
ElementCount = *pui8DATA(data, (gint16)pDescr->descr.value);
while (ElementCount > 0)
{ /* tag control shows existence of next list elements */
vector->writeField(writeIndex, Tag, 1);
bitvec_write_field(vector, writeIndex, Tag, 1);
LOG(INFO) << pDescr->sz << " = " << (unsigned)Tag << "\n" ;
bit_offset++;
remaining_bits_len--;
/* extract and store no_of_bits long element from bitstream */
vector->writeField(writeIndex, *pui8, no_of_bits);
bitvec_write_field(vector, writeIndex, *pui8, no_of_bits);
LOG(INFO) << pDescr->sz << " = " << (unsigned)*pui8 << "\n" ;
pui8++;
remaining_bits_len -= no_of_bits;
@ -2435,7 +2437,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
bit_offset += no_of_bits;
}
vector->writeField(writeIndex, !Tag, 1);
bitvec_write_field(vector, writeIndex, !Tag, 1);
LOG(INFO) << pDescr->sz << " = " << (unsigned)(!Tag) << "\n" ;
bit_offset++;
@ -2456,7 +2458,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
while (ElementCount > 0)
{ /* tag control shows existence of next list elements */
vector->writeField(writeIndex, Tag, 1);
bitvec_write_field(vector, writeIndex, Tag, 1);
LOG(INFO) << pDescr->sz << " = " << (unsigned)Tag << "\n" ;
bit_offset++;
@ -2487,7 +2489,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
}
}
vector->writeField(writeIndex, !Tag, 1);
bitvec_write_field(vector, writeIndex, !Tag, 1);
LOG(INFO) << pDescr->sz << " = " << (unsigned)(!Tag) << "\n" ;
bit_offset++;
@ -2525,7 +2527,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
{ /* get data element */
if (ElementCount != ElementNum)
{
vector->writeField(writeIndex, Tag, 1);
bitvec_write_field(vector, writeIndex, Tag, 1);
LOG(INFO) << pDescr->sz << " = " << (unsigned)Tag << "\n" ;
bit_offset++;
remaining_bits_len--;
@ -2552,7 +2554,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
}
}
vector->writeField(writeIndex, !Tag, 1);
bitvec_write_field(vector, writeIndex, !Tag, 1);
bit_offset++;
Tag = STANDARD_TAG; /* in case it was set to "reversed" */
pDescr++;
@ -2562,7 +2564,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vec
case CSN_FIXED:
{ /* Verify the fixed bits */
guint8 no_of_bits = (guint8) pDescr->i;
vector->writeField(writeIndex, pDescr->offset, no_of_bits);
bitvec_write_field(vector, writeIndex, pDescr->offset, no_of_bits);
LOG(INFO) << pDescr->sz<< " = " << pDescr->offset << "\n";
remaining_bits_len -= no_of_bits;
bit_offset += no_of_bits;

@ -25,7 +25,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <BitVector.h>
#include <bitvector.h>
#include <iostream>
#include <cstdlib>
#ifndef _PACKET_CSN1_H_
@ -82,7 +82,7 @@ typedef struct
gint direction; /* 0 - decode; 1 - encode */
} csnStream_t;
typedef gint16 (*StreamSerializeFcn_t)(csnStream_t* ar, BitVector *vector, size_t& readIndex, void* data);
typedef gint16 (*StreamSerializeFcn_t)(csnStream_t* ar, bitvec *vector, size_t& readIndex, void* data);
typedef enum
{
CSN_END = 0,
@ -223,9 +223,9 @@ void csnStreamInit(csnStream_t* ar,gint BitOffset,gint BitCount);
* RETURNS: int Number of bits left to be unpacked. Negative Error code if failed to unpack all bits
******************************************************************************/
gint16 csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, size_t& readIndex, void* data);
gint16 csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector, size_t& readIndex, void* data);
gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, BitVector *vector, size_t& readIndex, void* data);
gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector, size_t& readIndex, void* data);
/* CSN struct macro's */
#define CSN_DESCR_BEGIN(_STRUCT)\

@ -152,189 +152,189 @@ static void tbf_gsm_timer_start(struct gprs_rlcmac_tbf *tbf, unsigned int fT,
osmo_gsm_timer_schedule(&tbf->gsm_timer, frames);
}
void write_packet_downlink_assignment(BitVector * dest, uint8_t tfi, uint32_t tlli)
void write_packet_downlink_assignment(bitvec * dest, uint8_t tfi, uint32_t tlli)
{
// TODO We should use our implementation of encode RLC/MAC Control messages.
unsigned wp = 0;
dest->writeField(wp,0x1,2); // Payload Type
dest->writeField(wp,0x0,2); // Uplink block with TDMA framenumber
dest->writeField(wp,0x1,1); // Suppl/Polling Bit
dest->writeField(wp,0x1,3); // Uplink state flag
dest->writeField(wp,0x2,6); // MESSAGE TYPE
dest->writeField(wp,0x0,2); // Page Mode
dest->writeField(wp,0x0,1); // switch PERSIST_LEVEL: off
dest->writeField(wp,0x2,2); // switch TLLI : on
dest->writeField(wp,tlli,32); // TLLI
dest->writeField(wp,0x0,1); // Message escape
dest->writeField(wp,0x0,2); // Medium Access Method: Dynamic Allocation
dest->writeField(wp,0x0,1); // RLC acknowledged mode
dest->writeField(wp,0x0,1); // the network establishes no new downlink TBF for the mobile station
dest->writeField(wp,0x1,8); // timeslot 7
dest->writeField(wp,0x1,8); // TIMING_ADVANCE_INDEX
dest->writeField(wp,0x0,1); // switch TIMING_ADVANCE_VALUE = off
dest->writeField(wp,0x1,1); // switch TIMING_ADVANCE_INDEX = on
dest->writeField(wp,0xC,4); // TIMING_ADVANCE_INDEX
dest->writeField(wp,0x7,3); // TIMING_ADVANCE_TIMESLOT_NUMBER
dest->writeField(wp,0x0,1); // switch POWER CONTROL = off
dest->writeField(wp,0x1,1); // Frequency Parameters information elements = present
dest->writeField(wp,0x2,3); // Training Sequence Code (TSC) = 2
dest->writeField(wp,0x1,2); // Indirect encoding struct = present
dest->writeField(wp,0x0,6); // MAIO
dest->writeField(wp,0xE,4); // MA_Number
dest->writeField(wp,0x8,4); // CHANGE_MARK_1 CHANGE_MARK_2
dest->writeField(wp,0x1,1); // switch TFI : on
dest->writeField(wp,tfi,5);// TFI
dest->writeField(wp,0x1,1); // Power Control Parameters IE = present
dest->writeField(wp,0x0,4); // ALPHA power control parameter
dest->writeField(wp,0x0,1); // switch GAMMA_TN0 = off
dest->writeField(wp,0x0,1); // switch GAMMA_TN1 = off
dest->writeField(wp,0x0,1); // switch GAMMA_TN2 = off
dest->writeField(wp,0x0,1); // switch GAMMA_TN3 = off
dest->writeField(wp,0x0,1); // switch GAMMA_TN4 = off
dest->writeField(wp,0x0,1); // switch GAMMA_TN5 = off
dest->writeField(wp,0x0,1); // switch GAMMA_TN6 = off
dest->writeField(wp,0x1,1); // switch GAMMA_TN7 = on
dest->writeField(wp,0x0,5); // GAMMA_TN7
dest->writeField(wp,0x0,1); // TBF Starting TIME IE not present
dest->writeField(wp,0x0,1); // Measurement Mapping struct not present
bitvec_write_field(dest, wp,0x1,2); // Payload Type
bitvec_write_field(dest, wp,0x0,2); // Uplink block with TDMA framenumber
bitvec_write_field(dest, wp,0x1,1); // Suppl/Polling Bit
bitvec_write_field(dest, wp,0x1,3); // Uplink state flag
bitvec_write_field(dest, wp,0x2,6); // MESSAGE TYPE
bitvec_write_field(dest, wp,0x0,2); // Page Mode
bitvec_write_field(dest, wp,0x0,1); // switch PERSIST_LEVEL: off
bitvec_write_field(dest, wp,0x2,2); // switch TLLI : on
bitvec_write_field(dest, wp,tlli,32); // TLLI
bitvec_write_field(dest, wp,0x0,1); // Message escape
bitvec_write_field(dest, wp,0x0,2); // Medium Access Method: Dynamic Allocation
bitvec_write_field(dest, wp,0x0,1); // RLC acknowledged mode
bitvec_write_field(dest, wp,0x0,1); // the network establishes no new downlink TBF for the mobile station
bitvec_write_field(dest, wp,0x1,8); // timeslot 7
bitvec_write_field(dest, wp,0x1,8); // TIMING_ADVANCE_INDEX
bitvec_write_field(dest, wp,0x0,1); // switch TIMING_ADVANCE_VALUE = off
bitvec_write_field(dest, wp,0x1,1); // switch TIMING_ADVANCE_INDEX = on
bitvec_write_field(dest, wp,0xC,4); // TIMING_ADVANCE_INDEX
bitvec_write_field(dest, wp,0x7,3); // TIMING_ADVANCE_TIMESLOT_NUMBER
bitvec_write_field(dest, wp,0x0,1); // switch POWER CONTROL = off
bitvec_write_field(dest, wp,0x1,1); // Frequency Parameters information elements = present
bitvec_write_field(dest, wp,0x2,3); // Training Sequence Code (TSC) = 2
bitvec_write_field(dest, wp,0x1,2); // Indirect encoding struct = present
bitvec_write_field(dest, wp,0x0,6); // MAIO
bitvec_write_field(dest, wp,0xE,4); // MA_Number
bitvec_write_field(dest, wp,0x8,4); // CHANGE_MARK_1 CHANGE_MARK_2
bitvec_write_field(dest, wp,0x1,1); // switch TFI : on
bitvec_write_field(dest, wp,tfi,5);// TFI
bitvec_write_field(dest, wp,0x1,1); // Power Control Parameters IE = present
bitvec_write_field(dest, wp,0x0,4); // ALPHA power control parameter
bitvec_write_field(dest, wp,0x0,1); // switch GAMMA_TN0 = off
bitvec_write_field(dest, wp,0x0,1); // switch GAMMA_TN1 = off
bitvec_write_field(dest, wp,0x0,1); // switch GAMMA_TN2 = off
bitvec_write_field(dest, wp,0x0,1); // switch GAMMA_TN3 = off
bitvec_write_field(dest, wp,0x0,1); // switch GAMMA_TN4 = off
bitvec_write_field(dest, wp,0x0,1); // switch GAMMA_TN5 = off
bitvec_write_field(dest, wp,0x0,1); // switch GAMMA_TN6 = off
bitvec_write_field(dest, wp,0x1,1); // switch GAMMA_TN7 = on
bitvec_write_field(dest, wp,0x0,5); // GAMMA_TN7
bitvec_write_field(dest, wp,0x0,1); // TBF Starting TIME IE not present
bitvec_write_field(dest, wp,0x0,1); // Measurement Mapping struct not present
}