common.h
上传用户:bilang918
上传日期:2010-03-24
资源大小:558k
文件大小:3k
- #ifndef _COMMON_H
#define _COMMON_H
#endif
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
#include <math.h>
#include <signal.h>
#include <unistd.h>
#include <setjmp.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/sem.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#define MALOG "memory.log"
#define C1LOG "c1.log"
#define C2LOG "c2.log"
#define DBLOG "db.log"
#define LOGFILE "/usr/grs/sm.log"
#define MAGFILE "/usr/grs/c7db.mag"
#define LOGNAME "SM"
#define MAXSLOT 102400
#define MAXLINE 1024
#define MAXMS 99999999
#define MAXMSCOMP 6000000
//#define MAXMS 9999
#define MAXMSINDEX 1024
#define PERMS 0777
struct SHMBUF{
char imsi[18];
char msisdn[18];
char callingaddr[20];
char calledaddr[20];
};
struct shmem{
long rp;
long wp;
struct SHMBUF buffer[MAXSLOT];
};
struct ha{
int status;
};
struct ne{
- char CITY[20];
char NE[50];
- char NECLASS[10];
- char TYPE[10];
- char NAME[100];
- }*nePtr;
//struct ele,struct variant is for function split()
struct ele{
int length;
char var[200];
};
struct variant{
int eleno;
struct ele element[50];
};
struct mscomp{
int msisdn;
time_t lasttime1;
time_t lasttime2;
time_t lasttime3;
time_t lasttime4;
time_t lasttime5;
long vlr_h1;
long vlr_h2;
long vlr_h3;
long vlr_h4;
long vlr_h5;
long hlr_h1;
long hlr_h2;
long hlr_h3;
long hlr_h4;
long hlr_h5;
long vlr_b1;
long vlr_b2;
long vlr_b3;
long vlr_b4;
long vlr_b5;
long hlr_b1;
long hlr_b2;
long hlr_b3;
long hlr_b4;
long hlr_b5;
char state1;
char state2;
char state3;
char state4;
char state5;
int counter1;
int counter2;
int counter3;
int counter4;
int counter5;
char update_f1; //option flag 'I'->insert,'U'->update,'D'->delete 0->no effect
char update_f2; //option flag 'I'->insert,'U'->update,'D'->delete 0->no effect
char update_f3; //option flag 'I'->insert,'U'->update,'D'->delete 0->no effect
char update_f4; //option flag 'I'->insert,'U'->update,'D'->delete 0->no effect
char update_f5; //option flag 'I'->insert,'U'->update,'D'->delete 0->no effect
struct mscomp *next;
};
struct msptr{
struct mscomp *mscomp_ptr;
};
struct msexchange{
int option; // data operation: 1 represent select , 2 represent update , 3 represent insert , 4 represent delete
int token; // 0 represent seize token , 1 represent release token
int direction; // I/O direction: 0 represent IN , 1 represent OUT
char msisdn[20];
time_t lasttime;
long vlr_h;
long hlr_h;
long vlr_b;
long hlr_b;
char state;
int counter;
int status; //return status: 0 represent fali , 1 represent no record , 2 represent successful
};
struct msindex{
struct mscomp *mscomp_ptr[MAXSLOT];
long rp;
long wp;
};