-
Notifications
You must be signed in to change notification settings - Fork 1
/
tldlist.h
67 lines (55 loc) · 1.81 KB
/
tldlist.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef _TLDLIST_H_INCLUDED_
#define _TLDLIST_H_INCLUDED_
#include "date.h"
typedef struct tldlist TLDList;
typedef struct tldnode TLDNode;
typedef struct tlditerator TLDIterator;
/*
* tldlist_create generates a list structure for storing counts against
* top level domains (TLDs)
*
* creates a TLDList that is constrained to the `begin' and `end' Date's
* returns a pointer to the list if successful, NULL if not
*/
TLDList *tldlist_create(Date *begin, Date *end);
/*
* tldlist_destroy destroys the list structure in `tld'
*
* all heap allocated storage associated with the list is returned to the heap
*/
void tldlist_destroy(TLDList *tld);
/*
* tldlist_add adds the TLD contained in `hostname' to the tldlist if
* `d' falls in the begin and end dates associated with the list;
* returns 1 if the entry was counted, 0 if not
*/
int tldlist_add(TLDList *tld, char *hostname, Date *d);
/*
* tldlist_count returns the number of successful tldlist_add() calls since
* the creation of the TLDList
*/
long tldlist_count(TLDList *tld);
/*
* tldlist_iter_create creates an iterator over the TLDList; returns a pointer
* to the iterator if successful, NULL if not
*/
TLDIterator *tldlist_iter_create(TLDList *tld);
/*
* tldlist_iter_next returns the next element in the list; returns a pointer
* to the TLDNode if successful, NULL if no more elements to return
*/
TLDNode *tldlist_iter_next(TLDIterator *iter);
/*
* tldlist_iter_destroy destroys the iterator specified by `iter'
*/
void tldlist_iter_destroy(TLDIterator *iter);
/*
* tldnode_tldname returns the tld associated with the TLDNode
*/
char *tldnode_tldname(TLDNode *node);
/*
* tldnode_count returns the number of times that a log entry for the
* corresponding tld was added to the list
*/
long tldnode_count(TLDNode *node);
#endif /* _TLDLIST_H_INCLUDED_ */