00001 #ifndef HLBR_NUM_LIST_H
00002 #define HLBR_NUM_LIST_H
00003
00004 #include "../config.h"
00005
00006
00007
00008
00009
00010
00011
00012
00013 #define LIST_TYPE_NORMAL 1
00014 #define LIST_TYPE_TIME 2
00015 #define LIST_TYPE_AGE 3
00016 #define LIST_TYPE_PAIRED 4
00017
00018 #define LIST_INITIAL_SIZE 10
00019 #define LIST_GROW_SIZE 50
00020
00021 struct num_list;
00022 struct paired_list;
00023
00024 typedef struct num_alias_item{
00025 char Alias[512];
00026 unsigned int Num;
00027 } NumAlias;
00028
00029 typedef struct num_list_item{
00030 struct num_list* SubList;
00031 unsigned int Lower;
00032 unsigned int Upper;
00033 int Time;
00034 } NumItem;
00035
00036 typedef struct num_list{
00037 char ListType;
00038 int Timeout;
00039 NumItem** Items;
00040 int NumEntries;
00041 int AllocCount;
00042 } NumList;
00043
00044 NumList* InitNumList(int ListType);
00045 void DestroyNumList(NumList* n);
00046 int ClearNumList(NumList* n);
00047 int AddRange(NumList* n, unsigned int Lower, unsigned int Upper);
00048 int AddRangeTime(NumList* n, unsigned int Lower, unsigned int Upper, int Time);
00049 int AddSubList(NumList* n, NumList* SubList);
00050 int IsInList(NumList* n, unsigned int Number);
00051 int IsInListTime(NumList* n, unsigned int Number, int Now);
00052 int AddRangesString(NumList* n, char* Ranges, NumAlias* Aliases, int NumAliases);
00053 int AddIPRanges(NumList* n, char* Ranges);
00054 int RemoveFromList(NumList* n, unsigned int Number);
00055 int NumListCompare(NumList* n1, NumList* n2);
00056
00057 #endif