⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 coderbitbuffer.h

📁 基于h323协议的软phone
💻 H
字号:
/***********************************************************************
        Copyright (c) 2002 RADVISION Ltd.
************************************************************************
NOTICE:
This document contains information that is confidential and proprietary
to RADVISION Ltd.. No part of this document may be reproduced in any
form whatsoever without written prior approval by RADVISION Ltd..

RADVISION Ltd. reserve the right to revise this publication and make
changes without obligation to notify any person of such revisions or
changes.
***********************************************************************/

#ifndef _RV_CODER_BIT_BUFFER_H
#define _RV_CODER_BIT_BUFFER_H

#include "rvtypes.h"
#include "rverror.h"

#ifdef __cplusplus
extern "C" {
#endif


RV_DECLARE_HANDLE(HBB); /* handler */

typedef struct
{
    unsigned int    maxOctets;
    RvUint32        bitsInUse;
    RvBool          isAligned;
    RvUint8*        octets; /* buffer */
    RvBool          isOverflowOfBuffer;
} bbStruct;




/* returns number of bytes needed to contain the bitLength */
unsigned int bbSetByte(IN RvUint32 bitLength);

int bbGetAllocationSize(int maxOctets);

HBB bbConstructFrom(IN int maxOctets, /* size of buffer in octetes */
            IN char *buffer,
            IN int bufferSize);

int bbSetOctets(IN  HBB bbH,
        IN  int maxOctets, /* size of buffer in octets */
        IN  RvInt32 bitsInUse, /* number of bits already in use */
        IN  RvUint8 *octetBuffer); /* octet memory */

int bbDestruct(HBB bbH);

/* set buffer to zeros */
int bbClear(HBB bbH);

/* returns pointer to the octet array */
RvUint8 *bbOctets(HBB bbH);

/* RV_TRUE if buffer is aligned */
RvBool bbIsAligned(HBB bbH);

/* return number of alignment bits (modulu 8) */
int bbAlignBits(HBB bbH,
        IN RvInt32 location);

/* set buffer alignment */
int bbSetAligned(HBB bbH);
int bbSetUnaligned(HBB bbH);

RvInt32 bbFreeBits      (HBB bbH);
int bbFreeBytes     (HBB bbH);
RvUint32 bbBitsInUse     (HBB bbH);
unsigned bbBytesInUse    (HBB bbH);


/* concatate src to buffer */
int bbAddTail(HBB bbH,
          IN RvUint8 *src,
          IN RvUint32 srcBitsLength,
          IN RvBool isAligned); /* true if src is aligned */

int bbAddTailFrom(HBB bbH,
          IN  RvUint8 *src,
          IN  RvUint32 srcFrom, /* offset for beginning of data in src, in bits */
          IN  RvUint32 srcBitsLength,
          IN  RvBool isAligned); /* true if src is aligned */


/* move bits within buffer
   bitLength bits starting at fromOffset shall be moved to position starting at toOffset */
int bbMove(HBB bbH,
       IN  RvUint32 fromOffset,
       IN  RvUint32 bitLength,
       IN  RvUint32 toOffset);

/* Desc: Set bits within buffer. */
int bbSet(HBB bbH,
      IN  RvUint32 fromOffset,
      IN  RvUint32 bitLength,
      IN  RvUint8 *src);



int bbDelTail(HBB bbH,
          IN RvUint32 numOfBits); /* to delete from tail of buffer */

int bbDelHead(HBB bbH,
          IN RvUint32 numOfBits); /* to delete from HEAD of buffer */


#ifdef __cplusplus
}
#endif


#endif  /* _RV_CODER_BIT_BUFFER_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -