kb_dc_fileproc.h
上传用户:fy98168
上传日期:2015-06-26
资源大小:13771k
文件大小:2k
- #ifndef KB_DC_FILEPROC_H
- #define KB_DC_FILEPROC_H
- #include "kb_dc_osp.h"
- #define KB_DCFILE_NAME_MAX_LEN 60
- #define KB_DCFILE_MODULE_MAX_NUM 100
- #define FILLED 0x01
- #define EMPTY 0x00
- // 存放dii结构等数据
- typedef struct{
- unsigned short pid;
- unsigned char *diiSection;
- int blockSize;
- int numberOfModules; // mudule number
- }DCDIR,*pDCDIR;
- typedef struct{
- BOOL valid;
- unsigned short modID;
- unsigned int moduleSize;
- unsigned char moduleVersion;
- unsigned char fileName[KB_DCFILE_NAME_MAX_LEN];
- }DCModuleInfoArray;
- typedef struct{
- unsigned short modNum;
- DCModuleInfoArray *modInf;
- }DCMODULEINFO;
- typedef struct
- {
- int blockCount;
- unsigned char *blockStat; /*:0 empty, 1 filled*/
- }DCBLOCKBUFSTATUS;
- typedef struct
- {
- int modcount; /* module 个数*/
- DCBLOCKBUFSTATUS *modStat;
- }DCMODBUFSTATUS;
- // 单个文件(module)结构
- typedef struct
- {
- long position;
- int fileLength;
- unsigned char fileName[KB_DCFILE_NAME_MAX_LEN];
- unsigned char *section;
- DCMODBUFSTATUS BufStatus; /*用来标识每个block是否添满*/
- }DCFILE,*pDCFILE;
- // 存放配置文件收取结构
- typedef struct{
- int espid;
- pDCDIR cfg_dir;
- pDCFILE cfg_file;
- }DC_CFGFILE,*pDC_CFGFILE;
- // function defination
- extern unsigned short Get_firstModID_ByName(char *name);
- extern unsigned int DclsEof(DCFILE *file);
- extern void DcCloseFile(DCFILE *file);
- extern void DcCloseDirectory(DCDIR *dir);
- extern long DcReadFile(void *buf,int len,DCFILE *file);
- extern DCFILE* DcOpenFile(DCDIR* dir,const char* fileName);
- extern DCDIR* OpenDirectory(unsigned char *pData,int len);
- extern void InitFileStruct(DCFILE *file);
- extern int InitFileModuleInfo(unsigned short modCount);
- extern void FreeModuleInfo(void);
- extern unsigned int DCGetModSizeByIdSec(int index);
- extern unsigned int DCGetModSizeByModuleId(int modId);
- extern void FreeDCDIR(void);
- extern void FreeDCFILE(void);
- extern void FreeOneDCFILE(DCFILE *pfile);
- extern int DCGetModNumByFile(DCFILE *file);
- extern unsigned char kb_dc_GetCurCfgVer(void);
- extern BOOL kb_dc_CfgVerCheck(unsigned char *cfg_name, unsigned char type);
- extern unsigned char * kb_dc_GetCurCfgName(void);
- extern int kb_dc_SaveServCfgVersion( char *cfg_name);
- extern void kb_dc_SaveCurCfgName(unsigned char *name);
- extern void kb_dc_moduleInfo_Test(void);
- extern void kb_dc_CfgVerSaveTest(void);
- extern int kb_dc_bufferStatusBuild(DCFILE *pfile, int blocksCnt);
- extern unsigned char kb_dc_moduleIsEnd(DCFILE*pfile, unsigned short index);
- #endif