Peer table (work in progress).
[trust_router.git] / include / trp_ptable.h
1 #ifndef _TRP_PTABLE_H_
2 #define _TRP_PTABLE_H_
3
4 #include <talloc.h>
5
6 #include <trust_router/tr_name.h>
7 #include <trp_internal.h>
8
9 typedef struct trp_peer TRP_PEER;
10 struct trp_peer {
11   TR_NAME *gssname;
12   unsigned int linkcost;
13   TRP_PEER *next; /* for making a linked list */
14 };
15
16 typedef struct trp_ptable {
17   TRP_PEER *head; /* head of a peer table list */
18 } TRP_PTABLE;
19
20 TRP_PTABLE *trp_ptable_new(TALLOC_CTX *memctx);
21 void trp_ptable_free(TRP_PTABLE *ptbl);
22 TRP_RC trp_ptable_add(TRP_PTABLE *ptbl, TRP_PEER *newpeer);
23 TRP_RC trp_ptable_remove(TRP_PTABLE *ptbl, TRP_PEER *peer);
24
25 TRP_PEER *trp_peer_new(TALLOC_CTX *memctx);
26 void trp_peer_free(TRP_PEER *peer);
27
28 #endif /* _TRP_PTABLE_H_ */