注释添加.

This commit is contained in:
Saturneic 2018-08-22 23:19:08 +08:00
parent 8dd9e19477
commit 56d58cb046

View File

@ -16,6 +16,13 @@
#include <arpa/inet.h> #include <arpa/inet.h>
*/ */
/************************************************
*
************************************************/
#define VOID 0 #define VOID 0
#define INT 1 #define INT 1
#define DOUBLE 2 #define DOUBLE 2
@ -35,6 +42,14 @@
#define HOLE 16 #define HOLE 16
#define ULLINT 17 #define ULLINT 17
/************************************************
*
************************************************/
#define DEEPC 1 #define DEEPC 1
#define DEEPB 2 #define DEEPB 2
#define DEEPA 3 #define DEEPA 3
@ -55,19 +70,40 @@
#define INDEX_CHANGE_MAX 500 #define INDEX_CHANGE_MAX 500
#define INDEX_DISTANCE_MAX 120 #define INDEX_DISTANCE_MAX 120
#define STD_TEXT_LEN 4 #define STD_TEXT_LEN 4
#define HIGH 0x3 #define HIGH 0x3
#define STANDARD 0x2 #define STANDARD 0x2
#define LOW 0x1 #define LOW 0x1
/************************************************
*
************************************************/
#define ABS(x) ((x>0)?(x):(-x)) #define ABS(x) ((x>0)?(x):(-x))
/************************************************
*
************************************************/
/*
*MD5的管理及操作的结构
*/
typedef struct md5_ctx{ typedef struct md5_ctx{
unsigned int count[2]; unsigned int count[2];
unsigned int state[4]; unsigned int state[4];
unsigned char buffer[64]; unsigned char buffer[64];
}MD5_CTX; }MD5_CTX;
/*
*SID的初始值管理及操作的结构
*/
struct sid_raw{ struct sid_raw{
unsigned int type; unsigned int type;
unsigned int *value;//4 unsigned int *value;//4
@ -75,29 +111,41 @@ struct sid_raw{
unsigned int *value_deepest;//32 unsigned int *value_deepest;//32
}; };
/*
*SID的管理及操作的结构
*/
typedef struct s_id{ typedef struct s_id{
struct sid_raw *sr; struct sid_raw *sr;//指向SID初始值
unsigned int deep; unsigned int deep;//SID初始值的复杂度
MD5_CTX *md5; MD5_CTX *md5;//指向MD5结构
unsigned char *decrypt_hex; unsigned char *decrypt_hex;//指向MD5的Hex信息
char *decrypt_str; char *decrypt_str;//指向MD5的Hex信息转化成的字符串
}SID; }SID;
/*
*
*/
typedef struct Node{ typedef struct Node{
unsigned long long f_number; unsigned long long f_number;//长链表模式下,分派的数组节点编号
unsigned int type; unsigned int type;//类型
void *value; void *value;//值指针
struct Node *next; struct Node *next;//指向下一个节点
struct Node *last; struct Node *last;//指向上一个节点
SID *s_id; SID *s_id;
} Node; } Node;
/*
*
*/
typedef struct simple_Node{ typedef struct simple_Node{
void *value; void *value;//值指针
struct simple_Node *next; struct simple_Node *next;//指向下一个节点
}s_Node; }s_Node;
/*
*
*/
struct lst_std_id{ struct lst_std_id{
unsigned long long start_idx; unsigned long long start_idx;
unsigned long long end_idx; unsigned long long end_idx;
@ -106,132 +154,187 @@ struct lst_std_id{
struct list_quick; struct list_quick;
/*
*
*/
typedef struct List{ typedef struct List{
Node *head; Node *head;//指向第一个节点
Node *tail; Node *tail;//指向最后一个节点
s_Node *s_head; s_Node *s_head;//指向第一个单向节点
s_Node *s_tail; s_Node *s_tail;//指向最后一个单向节点
/*如果长链表模式开启则指向对应的长链表模式的管理结构,如果未开启则为NULL*/
struct list_quick *p_lq; struct list_quick *p_lq;
unsigned long long length; unsigned long long length;//链表的长度
SID *s_id; SID *s_id;
} List; } List;
/*
*
*/
struct index_change{ struct index_change{
unsigned long long c_index; unsigned long long c_index;//偏移量,有正负之分
int f_count; int f_count;//偏移量所对应的数组对的节点
}; };
/*
*
*/
struct list_quick{ struct list_quick{
Node **fn_node; Node **fn_node;//指向链表各个节点的映射数组
_Bool if_sort; unsigned long long fn_len;//映射数组的总长度
unsigned int idxc_count; unsigned long long rlst_len;//在映射数组实际被占用的长度
unsigned long long fn_len; _Bool if_sort;//链表是否有序
struct index_change *idxc_lst[INDEX_CHANGE_MAX]; unsigned int idxc_count;//链的删减增的操作次数
unsigned long long rlst_len; struct index_change *idxc_lst[INDEX_CHANGE_MAX];//储存链表的删减增操作的记录
FILE *fp; FILE *fp;//链表缓存文件
List *stdid_lst; List *stdid_lst;
}; };
/*
*
*/
typedef struct Info{ typedef struct Info{
char head[64]; char head[64];//信息头
char body[256]; char body[256];//信息内容
}Info; }Info;
/*
*
*/
typedef struct Error{ typedef struct Error{
unsigned int type; unsigned int type;//错误类型号
int priority; int priority;//优先级
time_t time; time_t time;//错误产生的时间
Info info; Info info;//信息指针
}Error; }Error;
/*
*
*/
typedef struct Notice{ typedef struct Notice{
unsigned int type; unsigned int type;//警告类型号
time_t time; time_t time;//警告产生的时间
Info info; Info info;//信息指针
}Notice; }Notice;
/*
*
*/
typedef struct Log{ typedef struct Log{
FILE *fp; FILE *fp;//日志文件的指针
int if_enable; int if_enable;//日志文件是否启用
unsigned long int id; unsigned long int id;//日志文件的ID
}Log; }Log;
/*
*
*/
typedef struct stack_node{ typedef struct stack_node{
unsigned int type; unsigned int type;//栈节点的类型
void *value; void *value;//值指针
struct stack_node *next; struct stack_node *next;//下一个栈节点
SID *s_id; SID *s_id;//栈节点的ID
} SNode; } SNode;
/*
*
*/
typedef struct stack{ typedef struct stack{
unsigned long long length; unsigned long long length;//栈的长度
SNode *top; SNode *top;//指向栈顶的栈节点
SID *s_id; SID *s_id;//栈的ID
} Stack; } Stack;
/*
*
*/
typedef struct tree_node typedef struct tree_node
{ {
SID *s_id; SID *s_id;//超级树节点的ID
List *home; List *home;//超级树节点的子节点列表
struct tree_node *father; struct tree_node *father;//超级树节点的父节点
Node *room; Node *room;//超级树节点的父节点的子节点列表
unsigned long long child_num; unsigned long long child_num;//超级树节点的子节点数量
unsigned int type; unsigned int type;//超级树节点的类型
void *value; void *value;//值指针
}TNode; }TNode;
/*
*
*/
typedef struct simple_tree_node{ typedef struct simple_tree_node{
void *value; void *value;//值指针
struct simple_tree_node *childs[2]; struct simple_tree_node *childs[2];//子节点
}s_TNode; }s_TNode;
/*
*
*/
typedef struct tree typedef struct tree
{ {
SID *s_id; SID *s_id;//超级树的SID
TNode *root; TNode *root;//超级树根节点
s_TNode *s_root; s_TNode *s_root;//二叉树的根节点
}Tree; }Tree;
/*
*
*/
typedef struct file_head{ typedef struct file_head{
char head_test[18]; char head_test[18];//数据文件头部的验证信息
unsigned long long data_num; unsigned long long data_num;//数据文件中的标准数据结构的数目
}F_HEAD; }F_HEAD;
/*
*
*/
typedef struct data_file{ typedef struct data_file{
FILE *fp; FILE *fp;//数据文件
F_HEAD *pf_head; F_HEAD *pf_head;//数据文件头
List *pf_stdlst; List *pf_stdlst;//数据文件的标志数据结构的储存链表
}D_FILE; }D_FILE;
/*
*
*/
typedef struct standard_data_blocks{ typedef struct standard_data_blocks{
unsigned int type; unsigned int type;//数据块的类型
unsigned long long location; unsigned long long location;//数据块在数据文件中的定位
char *sid; char *sid;//数据块的ID
_Bool if_data; _Bool if_data;//数据块是否赋值
unsigned int blocks_num; unsigned int blocks_num;//数据块字节大小
char *buff; char *buff;//指向数据块储存值内存空间的指针
}STD_BLOCKS; }STD_BLOCKS;
/*
*
*/
typedef struct standard_data_connection{ typedef struct standard_data_connection{
unsigned long long location; unsigned long long location;//数据块链接关系结构在文件中的定位
char *f_sid; char *f_sid;//前一个数据块的ID
char *s_sid; char *s_sid;//后一个数据块的ID
}STD_CTN; }STD_CTN;
/*
*
*/
typedef struct standard_data_head{ typedef struct standard_data_head{
unsigned long long data_blk_num; unsigned long long data_blk_num;//数据块的数目
unsigned long long data_ctn_num; unsigned long long data_ctn_num;//数据块链接关系结构的数目
}STD_HEAD; }STD_HEAD;
/*
*
*/
typedef struct standard_data{ typedef struct standard_data{
SID *s_id; SID *s_id;//标准数据结构的ID
int read_data; int read_data;//标准数据结构是否已经读取完整
unsigned int type; unsigned int type;//标准数据结构所对应的类型
unsigned long long size; unsigned long long size;//标准数据结构在数据文件中的大小
unsigned long long location; unsigned long long location;//标准数据结构的头在数据文件中的定位
_Bool lock; _Bool lock;//标准数据文件是否被锁住
List *pd_blocklst; List *pd_blocklst;//数据块储存链表
List *pd_ctnlst; List *pd_ctnlst;//数据块连接关系结构的储存链表
}STD_DATA; }STD_DATA;
#endif /* type_h */ #endif /* type_h */