Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

wvipaliaser.h

Go to the documentation of this file.
00001 /* -*- Mode: C++ -*- 00002 * Worldvisions Weaver Software: 00003 * Copyright (C) 1997-2002 Net Integration Technologies, Inc. 00004 * 00005 */ 00006 #ifndef __WVIPALIASER_H 00007 #define __WVIPALIASER_H 00008 00009 #include "wvinterface.h" 00010 #include "wvaddr.h" 00011 00012 /** 00013 * WvIPAliaser handles IP aliasing in the Linux kernel. Multiple instances 00014 * of the object can be created, and they will share aliases between them. 00015 * Aliased addresses are only removed when all WvIPAliaser objects using 00016 * that address give it up. (ie. the object is destroyed, or the Aliaser 00017 * is reconfigured without including that address) 00018 */ 00019 class WvIPAliaser 00020 { 00021 struct Alias 00022 { 00023 int index, link_count; 00024 WvIPAddr ip; 00025 00026 Alias(const WvIPAddr &_ip); 00027 ~Alias(); 00028 }; 00029 00030 DeclareWvList(Alias); 00031 00032 static AliasList all_aliases; 00033 AliasList aliases; 00034 WvInterfaceDict interfaces; 00035 00036 WvIPAliaser::Alias *ipsearch(WvIPAliaser::AliasList &l, 00037 const WvIPAddr &ip); 00038 00039 public: 00040 WvIPAliaser(); 00041 ~WvIPAliaser(); 00042 00043 void dump(); 00044 00045 /** 00046 * you must call start_edit() once, then add() any number of times, then 00047 * done_edit() once, to change your aliases. The addresses add()ed 00048 * during the session become the _only_ ones that are aliases by this 00049 * WvIPAliaser instance. 00050 * 00051 * Why bother? This way, WvIPAliaser can see all the desired aliases 00052 * when they are being changed, and only delete previously-added ones 00053 * if they are no longer used. This is important, since if eg. Fast 00054 * Forward has an open connection through 1.2.3.4, and we want to add 00055 * 1.2.3.5 and delete 1.2.3.3, Fast Forward need not remember that it 00056 * was using 1.2.3.3 but 1.2.3.4 does not get deleted, even temporarily. 00057 * 00058 * If that was too confusing, just remember: call these functions in 00059 * the order they appear below, always. 00060 */ 00061 void start_edit(); 00062 void add(const WvIPAddr &ip); 00063 void done_edit(); 00064 }; 00065 00066 00067 #endif // __WVIPALIASER_H

Generated on Tue Oct 5 01:09:20 2004 for WvStreams by doxygen 1.3.7