ZE-Standard-Libraries/type/type.h

236 lines
4.1 KiB
C
Raw Normal View History

2018-07-23 04:59:16 +00:00
#ifndef type_h
#define type_h
2018-08-03 10:32:20 +00:00
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
2018-08-07 04:10:55 +00:00
#include <unistd.h>
2018-08-07 04:55:59 +00:00
#include <inttypes.h>
2018-08-17 08:58:15 +00:00
#include <stdarg.h>
2018-08-03 10:32:20 +00:00
2018-08-07 09:43:42 +00:00
/*
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
*/
2018-07-23 04:59:16 +00:00
#define VOID 0
#define INT 1
#define DOUBLE 2
#define STRING 3
#define POINTER 4
#define LIST 5
2018-07-25 14:10:09 +00:00
#define STACK 6
#define TREE 7
2018-07-30 09:45:33 +00:00
#define LIST_NODE 8
#define TREE_NODE 9
#define STACK_NODE 10
2018-08-03 10:58:49 +00:00
#define T_SID 11
2018-08-07 04:10:55 +00:00
#define UINT 12
#define STANDARD_DATA 13
#define DATA_FILE 14
2018-08-07 09:43:42 +00:00
#define MESSAGE 15
2018-08-17 08:58:15 +00:00
#define HOLE 16
#define ULLINT 17
2018-07-23 04:59:16 +00:00
2018-07-30 09:45:33 +00:00
#define DEEPC 1
#define DEEPB 2
#define DEEPA 3
2018-08-03 10:32:20 +00:00
#define TYPE_LEN 5
2018-07-30 09:45:33 +00:00
#define DEEPC_LEN 4
#define DEEPB_LEN 8
#define DEEPA_LEN 32
#define DATA_BIT 5
2018-08-07 04:10:55 +00:00
#define DEEP_LEN 25
#define DEEPER_LEN 65
#define DEEPEST_LEN 225
2018-08-21 08:26:31 +00:00
#define SID_LEN 33
2018-08-07 04:10:55 +00:00
#define FILE_TSET_LEN 18
#define HEAD_TEST_LEN 9
2018-08-21 08:26:31 +00:00
#define INFO_TEST_LEN 8
2018-08-17 08:58:15 +00:00
#define ENABLE_LIST_QUICK 1500
#define FN_NODE_SPARE 12
#define INDEX_CHANGE_MAX 500
#define INDEX_DISTANCE_MAX 120
2018-08-21 08:26:31 +00:00
#define STD_TEXT_LEN 4
2018-07-23 04:59:16 +00:00
2018-08-03 10:32:20 +00:00
#define HIGH 0x3
#define STANDARD 0x2
#define LOW 0x1
2018-08-17 08:58:15 +00:00
#define ABS(x) (x>0)?(x):(-x)
2018-08-14 15:59:55 +00:00
typedef struct md5_ctx{
unsigned int count[2];
unsigned int state[4];
unsigned char buffer[64];
}MD5_CTX;
struct sid_raw{
2018-08-03 10:32:20 +00:00
unsigned int type;
unsigned int *value;//4
unsigned int *value_deeper;//8
unsigned int *value_deepest;//32
2018-08-14 15:59:55 +00:00
};
typedef struct s_id{
struct sid_raw *sr;
2018-08-03 10:32:20 +00:00
unsigned int deep;
2018-08-14 15:59:55 +00:00
MD5_CTX *md5;
2018-08-21 08:26:31 +00:00
unsigned char *decrypt_hex;
2018-08-14 15:59:55 +00:00
char *decrypt_str;
2018-08-03 10:32:20 +00:00
}SID;
typedef struct Node{
2018-08-14 15:59:55 +00:00
unsigned long long f_number;
2018-08-03 10:32:20 +00:00
unsigned int type;
2018-08-14 15:59:55 +00:00
void *value;
2018-08-03 10:32:20 +00:00
struct Node *next;
struct Node *last;
2018-08-14 15:59:55 +00:00
SID *s_id;
2018-08-03 10:32:20 +00:00
} Node;
2018-08-14 15:59:55 +00:00
typedef struct simple_Node{
void *value;
struct simple_Node *next;
}s_Node;
struct lst_std_id{
unsigned long long start_idx;
unsigned long long end_idx;
SID *sid;
};
struct list_quick;
2018-08-03 10:32:20 +00:00
typedef struct List{
Node *head;
Node *tail;
2018-08-14 15:59:55 +00:00
s_Node *s_head;
s_Node *s_tail;
struct list_quick *p_lq;
2018-08-03 10:32:20 +00:00
unsigned long long length;
2018-08-14 15:59:55 +00:00
SID *s_id;
2018-08-03 10:32:20 +00:00
} List;
2018-08-17 08:58:15 +00:00
struct index_change{
unsigned long long c_index;
int f_count;
};
2018-08-14 15:59:55 +00:00
struct list_quick{
Node **fn_node;
2018-08-17 08:58:15 +00:00
_Bool if_sort;
unsigned int idxc_count;
struct index_change *idxc_lst[INDEX_CHANGE_MAX];
2018-08-14 15:59:55 +00:00
unsigned long long rlst_len;
FILE *fp;
List *stdid_lst;
};
2018-08-03 10:32:20 +00:00
typedef struct Info{
char head[64];
char body[256];
}Info;
typedef struct Error{
unsigned int type;
int priority;
time_t time;
2018-08-14 15:59:55 +00:00
Info info;
2018-08-03 10:32:20 +00:00
}Error;
typedef struct Notice{
unsigned int type;
time_t time;
2018-08-14 15:59:55 +00:00
Info info;
2018-08-03 10:32:20 +00:00
}Notice;
typedef struct Log{
FILE *fp;
int if_enable;
unsigned long int id;
}Log;
2018-08-07 04:10:55 +00:00
typedef struct stack_node{
unsigned int type;
void *value;
struct stack_node *next;
2018-08-14 15:59:55 +00:00
SID *s_id;
2018-08-07 04:10:55 +00:00
} SNode;
typedef struct stack{
unsigned long long length;
SNode *top;
2018-08-14 15:59:55 +00:00
SID *s_id;
2018-08-07 04:10:55 +00:00
} Stack;
2018-08-03 10:32:20 +00:00
typedef struct tree_node
{
SID *s_id;
List *home;
struct tree_node *father;
Node *room;
unsigned long long child_num;
unsigned int type;
void *value;
}TNode;
2018-08-14 15:59:55 +00:00
typedef struct simple_tree_node{
void *value;
struct simple_tree_node *childs[2];
}s_TNode;
2018-08-03 10:32:20 +00:00
typedef struct tree
{
SID *s_id;
TNode *root;
2018-08-14 15:59:55 +00:00
s_TNode *s_root;
2018-08-03 10:32:20 +00:00
}Tree;
2018-08-07 04:55:59 +00:00
typedef struct file_head{
char head_test[18];
unsigned long long data_num;
}F_HEAD;
typedef struct data_file{
FILE *fp;
F_HEAD *pf_head;
List *pf_stdlst;
}D_FILE;
typedef struct standard_data_blocks{
unsigned int type;
2018-08-21 08:26:31 +00:00
unsigned long long location;
2018-08-07 04:55:59 +00:00
char *sid;
_Bool if_data;
unsigned int blocks_num;
char *buff;
}STD_BLOCKS;
typedef struct standard_data_connection{
2018-08-21 08:26:31 +00:00
unsigned long long location;
2018-08-07 04:55:59 +00:00
char *f_sid;
char *s_sid;
}STD_CTN;
typedef struct standard_data_head{
unsigned long long data_blk_num;
unsigned long long data_ctn_num;
}STD_HEAD;
typedef struct standard_data{
SID *s_id;
unsigned int type;
2018-08-21 08:26:31 +00:00
unsigned long long size;
unsigned long long location;
2018-08-07 04:55:59 +00:00
_Bool lock;
List *pd_blocklst;
List *pd_ctnlst;
}STD_DATA;
2018-08-03 10:32:20 +00:00
2018-07-23 04:59:16 +00:00
#endif /* type_h */