?? myshm.h
字號(hào):
/* include globals */#ifndef _MYSHM_H_#define _MYSHM_H_ 0#include "SysHeaders.h"#define MAXVAL 10 #define MAXVALLOC 10#define MOVERFLOWVAL 10#define MAXNTHREADS 20#define MAXSIZE 210
#define CCHAR 0
#define BCDCHAR 1#define TRUE 1#define FALSE 0#define LEN_DWXX sizeof( DWXX )#define LEN_P_DWXX sizeof( DWXX *)#define LEN_LOCINFO sizeof( LOCINFO )#define LEN_P_LOCINFO sizeof( LOCINFO *)#define LEN_TXINDEX sizeof( TXINDEX )#define LEN_COMMINFO sizeof( COMMINFO )#define LEN_P_COMMINFO sizeof( COMMINFO *)#define LEN_ICXX sizeof( ICXX )#define LEN_ICINFO sizeof( ICINFO )#define LEN_BBXX sizeof( BBXX )#define LEN_BBINFO sizeof( BBINFO )#define LEN_FKXX sizeof( FKXX )#define LEN_FKINFO sizeof( FKINFO )#define LEN_P_FKINFO sizeof( FKINFO *)#define LEN_SYSARG sizeof( SYSARGUMENTS )/* Definition of fixed length to
each type of sending message. */
#define LEN_OF_DWSQ 22
#define LEN_OF_TXSQ 18
#define LEN_OF_CKSC 12
#define LEN_OF_ICJC 12
#define LEN_OF_XTZJ 13
#define LEN_OF_SJSC 13
#define LEN_OF_BBDQ 11
#define ALTIMETRYMODE_CHOOSEN 0
#define ALTIMETRYMODE_NONE 1
#define ALTIMETRYMODE_FIRMODE 2
#define ALTIMETRYMODE_SECMODE 3
#define HEIGHTINDICTATION_NORMAL 0
#define HEIGHTINDICTATION_UPPERAIR 1/* Definition of data source type */typedef enum{ INBOX, OUTBOX }SOURCETYPE;/* Definition of message type */typedef enum { TYPE_OF_DWXX,TYPE_OF_TXXX,TYPE_OF_ICXX,TYPE_OF_ZJXX,TYPE_OF_SJXX,TYPE_OF_BBXX,TYPE_OF_FKXX }MESGTYPE;/* Definition of sort type */typedef enum{ SORT_BY_ADDRESS,SORT_BY_TIMEASC,SORT_BY_TIMEDES,SORT_BY_SOURCE}SORTTYPE;/* Definition of filter type */typedef enum{ BY_LOCADDRSS, BY_LOCTIME, BY_BOTH, BY_NEWEST3, BY_AUTOFBACK }FILTER;/* Definition of delete mode */typedef enum{ SINGLEMODE, MUTIPLEMODE }DELETEMODE;/* Definition of temp store mode */typedef enum{ CREAT, QUERY }TMPSTOREMODE;typedef enum{ WIN_LOCOPEN, WIN_LOCCLOSE, WIN_REPORTOPEN, WIN_REPORTCLOSE,WIN_NEWMESGOPEN,WIN_NEWMESGCLOSE, LOCSTART, LOCSTOP }FLAG;FLAG win_locOpen,win_reportOpen,startLocFlag,win_newMesgOpen;typedef enum{ SINGLE, MUTIPLE, EMERGENCY }LOCTYPE;typedef enum{ UNREAD, DW, TX_INDEX,TX_IDXOUT, TX_MAIN,TX_MNOut, FK, OVERFLOWED}COUNTERTYPE;typedef struct{ int hour; int min; int sec; int mday; int mon; int year;}Time;//struct defition for latitude and longtitudetypedef struct {int du;int fen;int miao;float pMiao; }JINWEI;/**************************** Definition of struct in the shared memory *************************//* Definition for message of location */
typedef struct
{ long srcID; /* Definition for the source sender's ID */ long desID; /* Definition for the destination receiver's ID */ int year; int mon; int day;
int hour; /* Definition for the time of locating */
int minute;
int second;
float perSecond; /* each value equals to 100 persent of second */ JINWEI longitude; /* Definition for data of longititude */ JINWEI latitude; /* Definition for data of latitude */
unsigned char normalSign;
long height; /* Definition for data of height */
unsigned char abnormalSign;
int abnormalHeigtht; /**************Maybe it is useless to liwencheng ***********************/
int locatType; /* Definition for type of locating information */
int isSecretKey;
int precision;
int isEmergenLoc;
int mutipleKey;
int heightType;
long queryAddr;
}DWXX;DWXX *report_Dwxx;
/* Definition for message of communication */
typedef struct
{
int hour;
int minute;
long srcID;
long contentLen;
unsigned char CRC_Sign;
unsigned char chType;
unsigned char commType;
unsigned char isSecretKey;
unsigned char message[210];
}TXXX;
TXXX *overFlowMesg;
/* Definition for information of IC card */
typedef struct
{ long srcID;
int frame;
int userCharacter;
int commRank;
int encryptSign;
long broadcastID;
long underlingNum;
long servFrequency;
}ICXX;
/* Definition for SelfChecking */
typedef struct
{ long srcID;
float elecQuantity;
unsigned char icStat;
unsigned char hardWareStat;
unsigned char enterStat;
unsigned char fstPowerStat;
unsigned char secPowerStat;
unsigned char thrPowerStat;
unsigned char forPowerStat;
unsigned char fifPowerStat;
unsigned char sixPowerStat;
}ZJXX;
/* Definition for BD time */
typedef struct
{ Time sj; long srcID;
}SJXX;
/*Definition for information of current version */
typedef struct
{ long srcID;
char verInfor[210];
}BBXX;
/*Definition for information of feedback */
typedef struct
{ long srcID;
unsigned char FeedBackSign;
unsigned char AdditionalINfor[4];
}FKXX;
/* Definition for structs in the shared memory */typedef struct{ int nready; int nthreads; /* count of current total threads */ MESGTYPE currentMesg; DWXX dwxx;
TXXX txxx; ICXX icxx;
ZJXX zjxx;
SJXX sjxx;
BBXX bbxx;
FKXX fkxx; pthread_mutex_t curMesg_mutex; pthread_mutex_t nready_mutex; pthread_cond_t cond; }MYSHM;/* end globals */typedef struct { DWXX *dwxx;
TXXX *txxx; ICXX *icxx;
ZJXX *zjxx;
SJXX *sjxx;
BBXX *bbxx;
FKXX *fkxx; MYSHM *myshmPtr; MESGTYPE currentMesg;}NEWDATA;/****************************End Definition of struct in the shared memory ***********************//**************************** Definition of struct for Data manipulation**************************/typedef struct{ //For DWXX pthread_mutex_t DW_FLOCK; pthread_mutex_t DWtmp1_FLOCK; pthread_mutex_t DWtmp2_FLOCK; //For TXXX pthread_mutex_t TXINDEX_FLOCK; pthread_mutex_t TXtmp1_FLOCK; pthread_mutex_t TXtmp2_FLOCK; //For ICXX pthread_mutex_t IC_FLOCK; pthread_mutex_t ICtmp1_FLOCK; pthread_mutex_t ICtmp2_FLOCK; //For BBXX pthread_mutex_t BB_FLOCK; pthread_mutex_t BBtmp1_FLOCK; pthread_mutex_t BBtmp2_FLOCK; //For FKXX pthread_mutex_t FK_FLOCK; pthread_mutex_t FKtmp1_FLOCK; pthread_mutex_t FKtmp2_FLOCK;}FILELOCK;FILELOCK fLock;//The struct TXXX stored in file F_TXINDEXtypedef struct{ int mainIndex; //mainIndex marks the index of the message block which //length larges than 20 bytes stored in file F_TXMAIN int hour;
int minute;
long srcID;
long contentLen; int lockSymbol; //未讀圖片0,鎖定圖片1,已讀2(空?qǐng)D片)
unsigned char CRC_Sign;
unsigned char chType;
unsigned char commType;
unsigned char isSecretKey;
unsigned char message[20]; }TXINDEX; typedef struct{ int index; DWXX dwxx;}LOCINFO;//The struct TXXX stored in memory typedef struct{ int index; //start from 1 TXINDEX txIndex; char locUserName[30]; //User}COMMINFO;COMMINFO sendedItem;typedef struct{ ICXX icxx;}ICINFO;typedef struct{ BBXX bbxx;}BBINFO;typedef struct{ int index; FKXX fkxx;}FKINFO;typedef struct{ int countOfUnread; int countDWXX; int countFKXX; int countTXIDXOut; int countTXMNOut; int countTXMAIN; int countTXINDEX; int overflowBit; int nothing;}SYSARGUMENTS;SYSARGUMENTS sysArg;typedef struct { int countOfMesg; int countOfUnread; LOCINFO *tmpLocInfo; LOCINFO *locInfo; LOCINFO **pLocInfo; COMMINFO *tmpCommInfo; COMMINFO *commInfo; COMMINFO **pCommInfo; COMMINFO *commInfoOut; COMMINFO **pCommInfoOut; ICINFO *tmpICInfo; ICINFO *icInfo; BBINFO *tmpBBInfo; BBINFO *bbInfo; FKINFO *tmpFkInfo; FKINFO *fkInfo; unsigned char Message[210];
}LOADEDMESG;LOADEDMESG loadedMesg;typedef struct { DWXX dwxx; TXINDEX txIndex; ICXX icxx;
ZJXX zjxx;
SJXX sjxx;
BBXX bbxx;
FKXX fkxx;}NEWMESG;NEWMESG newMesg;typedef struct { DWXX dwxx; int flag; int usable;}NEWLOC;NEWLOC newLoc,*repLoc;typedef struct { LOCTYPE locType;}LOCARG;LOCARG *locArg;typedef struct{ long srcID; Time sTime; /* Start time of search */ Time eTime; /* End time of search */}QueryFilter;QueryFilter queFilter;/****************************End Definition of struct for Data manipulation***********************//***************Definition of struct for Sending data func****************************************/
typedef struct
{
int altimetryMode;
int heightType;
int loc_AltitudeSign;
int temperatureValSign;
char *locAltitude;
char *antAltitude;
char *airPressure;
char *temperature;
char *commFrequency;
}DWSQ;DWSQ *dwsq;
typedef struct
{
int codeType;
char isAnswer;
char *desID;
unsigned char *content;
}TXSQ;TXSQ *txsq;
typedef struct
{
int fixedLen;
char *baudRate;
}CKSC;CKSC *cksc;
typedef struct
{
unsigned char frame;
}ICJC;
ICJC *icjc;
typedef struct
{
char *commFrequency;
}XTZJ;XTZJ *xtzj;
typedef struct
{
char *commFrequency;
}SJSC;SJSC *sjsc;
/***************End Define of struct for Sending data func************************************//***************Definition of argument struct for Sending data func*******************************/typedef struct{ char *cmd; char *srcID; DWSQ *dwsq; TXSQ *txsq; CKSC *cksc; ICJC *icjc; XTZJ *xtzj; SJSC *sjsc; int length; int fixedLen;}SENDARG;SENDARG sendArg; /* Global pointer */char *G_locAltitude;
char *G_antAltitude ;
char *G_airPressure ;
char *G_temperature ;
char *G_commFrequency;char *G_srcID;char *G_desID;
unsigned char *G_content;char *G_baudRate;/***************End Define of argument struct for Sending data************************************//* Definition of system counters and their mutex locks */int overflowBit; //symbol of TXXX's overflowing statusint countOfUnread; //Counter of unread messageint countNewMesg;int overFlowStarter;//Start Position of overflowingint cntOverFlow; //Counter of OverFlowed new messagesint numOverFlow; //Controller of the situation of overflowingint countDWXX;int tmpDWXX1; //Counter of DWXX in the temp file 1int tmpDWXX2; //Counter of DWXX in the temp file 2 int tmpICXX1; //Counter of ICXX in the temp file 1int tmpICXX2; //Counter of ICXX in the temp file 2int tmpBBXX1; //Counter of BBXX in the temp file 1int tmpBBXX2; //Counter of BBXX in the temp file 2int countFKXX;int tmpFKXX1; //Counter of FKXX in the temp file 1int tmpFKXX2; //Counter of FKXX in the temp file 2int countTXIDXOut; //Counter of sended TXXX in file TXINDEX_OUT.datint countTXMNOut; int countTXMAIN;int countTXINDEX;int tmpTXXX1; //Counter of TXXX in the temp file 1int tmpTXXX2; //Counter of TXXX in the temp file 2 int fRecords; //Counter of founded message numberint tidCount; //Counter of threads numberpthread_mutex_t overflowBit_Mutex;pthread_mutex_t numOverFlow_Mutex;pthread_mutex_t cntOverFlow_Mutex;pthread_mutex_t nStaCount_Mutex;pthread_mutex_t countUnRead_Mutex;pthread_mutex_t countNewMesg_Mutex;pthread_mutex_t countDW_Mutex;pthread_mutex_t countFK_Mutex;pthread_mutex_t countTXINDEX_Mutex;pthread_mutex_t countTXMAIN_Mutex;#endif
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -