q922.h
Go to the documentation of this file.
/*
* q922.h
*
* Q.922 PDU implementation for the OpenH323 Project.
*
* Copyright (c) 2006 Network for Educational Technology, ETH Zurich.
* Written by Hannes Friederich.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* Contributor(s): ______________________________________.
*
* $Revision: 21346 $
* $Author: hfriederich $
* $Date: 2008-10-15 17:21:15 -0500 (Wed, 15 Oct 2008) $
*/
#ifndef OPAL_H224_Q922_H
#define OPAL_H224_Q922_H
#ifdef P_USE_PRAGMA
#pragma interface
#endif
#ifndef _PTLIB_H
#include <ptlib.h>
#endif
#include <opal/buildopts.h>
#define Q922_HEADER_SIZE 3
class Q922_Frame : public PBYTEArray
{
PCLASSINFO(Q922_Frame, PBYTEArray);
public:
Q922_Frame(PINDEX informationFieldSize = 260);
~Q922_Frame();
BYTE GetHighOrderAddressOctet() const { return theArray[0]; }
BYTE GetLowOrderAddressOctet() const { return theArray[1]; }
void SetHighOrderAddressOctet(BYTE octet) { theArray[0] = octet; }
void SetLowOrderAddressOctet(BYTE octet) { theArray[1] = octet; }
BYTE GetControlFieldOctet() const { return theArray[2]; }
void SetControlFieldOctet(BYTE octet) { theArray[2] = octet; }
BYTE *GetInformationFieldPtr() const { return (BYTE *)(theArray + Q922_HEADER_SIZE); }
PINDEX GetInformationFieldSize() const { return informationFieldSize; }
void SetInformationFieldSize(PINDEX size);
PBoolean DecodeAnnexQ(const BYTE *buffer, PINDEX size);
PINDEX GetAnnexQEncodedSize() const;
PBoolean EncodeAnnexQ(BYTE *buffer, PINDEX & size) const;
PBoolean DecodeHDLC(const BYTE *data, PINDEX size);
PINDEX GetHDLCEncodedSize() const;
PBoolean EncodeHDLC(BYTE *buffer, PINDEX & size) const;
PBoolean EncodeHDLC(BYTE *buffer, PINDEX & size, BYTE & bitPosition) const;
protected:
PINDEX informationFieldSize;
private:
// for HDLC mode
inline PBoolean FindFlagEnd(const BYTE *buffer, PINDEX bufferSize, PINDEX & octetIndex, BYTE & bitIndex);
inline BYTE DecodeOctet(const BYTE *buffer, BYTE *destination, PINDEX & octetIndex, BYTE & bitIndex, BYTE & onesCounter);
inline BYTE DecodeBit(const BYTE *buffer, PINDEX & octetIndex, BYTE & bitIndex);
inline void EncodeOctet(BYTE octet, BYTE *buffer, PINDEX & octetIndex, BYTE & bitIndex, BYTE & onesCounter) const;
inline void EncodeOctetNoEscape(BYTE octet, BYTE *buffer, PINDEX & octetIndex, BYTE & bitIndex) const;
inline void EncodeBit(BYTE bit, BYTE *buffer, PINDEX & octetIndex, BYTE & bitIndex) const;
inline WORD CalculateFCS(const BYTE*data, PINDEX length) const;
};
#endif // OPAL_H224_Q922_H
Q922_Frame::GetInformationFieldPtr
BYTE * GetInformationFieldPtr() const
Definition: q922.h:58
Q922_Frame::informationFieldSize
PINDEX informationFieldSize
Definition: q922.h:103
buildopts.h
Q922_Frame
Definition: q922.h:41
Q922_Frame::GetHDLCEncodedSize
PINDEX GetHDLCEncodedSize() const
Q922_Frame::~Q922_Frame
~Q922_Frame()
Q922_Frame::SetInformationFieldSize
void SetInformationFieldSize(PINDEX size)
Q922_Frame::SetLowOrderAddressOctet
void SetLowOrderAddressOctet(BYTE octet)
Definition: q922.h:53
Q922_Frame::EncodeAnnexQ
PBoolean EncodeAnnexQ(BYTE *buffer, PINDEX &size) const
Q922_Frame::SetHighOrderAddressOctet
void SetHighOrderAddressOctet(BYTE octet)
Definition: q922.h:52
Q922_Frame::DecodeAnnexQ
PBoolean DecodeAnnexQ(const BYTE *buffer, PINDEX size)
Q922_HEADER_SIZE
#define Q922_HEADER_SIZE
Definition: q922.h:39
Q922_Frame::SetControlFieldOctet
void SetControlFieldOctet(BYTE octet)
Definition: q922.h:56
Q922_Frame::Q922_Frame
Q922_Frame(PINDEX informationFieldSize=260)
Q922_Frame::DecodeHDLC
PBoolean DecodeHDLC(const BYTE *data, PINDEX size)
Q922_Frame::GetLowOrderAddressOctet
BYTE GetLowOrderAddressOctet() const
Definition: q922.h:51
Q922_Frame::GetInformationFieldSize
PINDEX GetInformationFieldSize() const
Definition: q922.h:60
Q922_Frame::GetControlFieldOctet
BYTE GetControlFieldOctet() const
Definition: q922.h:55
Q922_Frame::GetAnnexQEncodedSize
PINDEX GetAnnexQEncodedSize() const
Q922_Frame::GetHighOrderAddressOctet
BYTE GetHighOrderAddressOctet() const
Definition: q922.h:50
Q922_Frame::EncodeHDLC
PBoolean EncodeHDLC(BYTE *buffer, PINDEX &size) const