/* * usca.h - Self explanitory * Copyright (C) 1997-2000 SpellCaster Telecommunications Inc. * $Id: usca.h,v 1.4 2004/08/17 17:58:38 bcrl Exp $ * Released under the GNU Public License. See LICENSE file for details. */ #ifndef USCA_H #define USCA_H #include "config.h" #include "kernel.h" #include "debug.h" #define USCA_BLOCKSIZE 128 class dfs_object_t; class CuscArray : public CDebugBase { private: u8 m_buf[USCA_BLOCKSIZE]; public: void Print(); void Put(CuscArray *); void Put(const u8 *, uint); void Put(const char *str, int len) { Put((const u8 *)str, len); } void Put(char *); void Put64(u64); void Put32(u32); void Put16(u16); void Put8(u8); void Chop(uint); void Trim(uint); void Push64(u64); void Push32(u32); void Push16(u16); void Push8(u8); u64 Pull64(); u32 Pull32(); u16 Pull16(); u8 Pull8(); bool operator ==(const u8*); bool operator ==(CuscArray &); void Clear(); void Pull(CuscArray *, uint); int Pull(u8 *, uint); #if 0 operator unsigned char * () { return m_start; }; operator const u16* () { return (u16 *) m_start; }; #endif int Push(CuscArray &); int Push(const char *); int Push(const u8*, uint); int Reserve(size_t); uint GetLength() { return m_length; }; CuscArray(const CuscArray &); CuscArray(u8*, uint); CuscArray(); virtual ~CuscArray(); u8* m_start; void dump_full_state(ctrlfd_t *cfd); CuscArray(dfs_object_t *obj); protected: int ExpandBuffer(size_t); size_t m_size; // Total size of storage block u8* m_end; // Pointer to end of data in block size_t m_length; // Length of data in block (end-start) u8* m_data; // Pointer to the storage block }; #endif // USCA_H