wvdbusserver: implement NameHasOwner request.
[wvstreams.git] / include / wvipaliaser.h
blob93222483340250503ccf562850ee86d199d36ffd
1 /* -*- Mode: C++ -*-
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
5 */
6 #ifndef __WVIPALIASER_H
7 #define __WVIPALIASER_H
9 #include "wvinterface.h"
10 #include "wvaddr.h"
12 /**
13 * WvIPAliaser handles IP aliasing in the Linux kernel. Multiple instances
14 * of the object can be created, and they will share aliases between them.
15 * Aliased addresses are only removed when all WvIPAliaser objects using
16 * that address give it up. (ie. the object is destroyed, or the Aliaser
17 * is reconfigured without including that address)
19 class WvIPAliaser
21 struct Alias
23 int index, link_count;
24 WvIPAddr ip;
26 Alias(const WvIPAddr &_ip);
27 ~Alias();
30 DeclareWvList(Alias);
32 static AliasList all_aliases;
33 AliasList aliases;
34 WvInterfaceDict interfaces;
36 WvIPAliaser::Alias *ipsearch(WvIPAliaser::AliasList &l,
37 const WvIPAddr &ip);
39 public:
40 WvIPAliaser();
41 ~WvIPAliaser();
43 void dump();
45 /**
46 * you must call start_edit() once, then add() any number of times, then
47 * done_edit() once, to change your aliases. The addresses add()ed
48 * during the session become the _only_ ones that are aliases by this
49 * WvIPAliaser instance.
51 * Why bother? This way, WvIPAliaser can see all the desired aliases
52 * when they are being changed, and only delete previously-added ones
53 * if they are no longer used. This is important, since if eg. Fast
54 * Forward has an open connection through 1.2.3.4, and we want to add
55 * 1.2.3.5 and delete 1.2.3.3, Fast Forward need not remember that it
56 * was using 1.2.3.3 but 1.2.3.4 does not get deleted, even temporarily.
58 * If that was too confusing, just remember: call these functions in
59 * the order they appear below, always.
61 * If add() returns true, then an interface was just created. If it returns
62 * false, then that call made no changes.
64 * If done_edit() returns true, then one or more interfaces were just
65 * destroyed. If it returns false, then that call made no changes.
67 void start_edit();
68 bool add(const WvIPAddr &ip);
69 bool done_edit();
73 #endif // __WVIPALIASER_H