Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

Iface.h

Go to the documentation of this file.
00001 /*
00002  * Dibbler - a portable DHCPv6
00003  *
00004  * authors: Tomasz Mrugalski <thomson@klub.com.pl>
00005  *          Marek Senderski <msend@o2.pl>
00006  *
00007  * released under GNU GPL v2 or later licence
00008  *
00009  * $Id: Iface.h,v 1.12 2005/04/29 00:08:20 thomson Exp $
00010  *
00011  * $Log: Iface.h,v $
00012  * Revision 1.12  2005/04/29 00:08:20  thomson
00013  * *** empty log message ***
00014  *
00015  * Revision 1.11  2005/01/23 23:17:53  thomson
00016  * Relay/global address support related improvements.
00017  *
00018  * Revision 1.10  2005/01/13 22:45:55  thomson
00019  * Relays implemented.
00020  *
00021  * Revision 1.9  2005/01/11 22:53:35  thomson
00022  * Relay skeleton implemented.
00023  *
00024  * Revision 1.8  2005/01/03 21:53:41  thomson
00025  * const modifier added.
00026  *
00027  * Revision 1.7  2004/12/27 20:48:22  thomson
00028  * Problem with absent link local addresses fixed (bugs #90, #91)
00029  *
00030  * Revision 1.6  2004/11/01 23:31:25  thomson
00031  * New options,option handling mechanism and option renewal implemented.
00032  *
00033  * Revision 1.5  2004/10/25 20:45:53  thomson
00034  * Option support, parsers rewritten. ClntIfaceMgr now handles options.
00035  *
00036  */
00037 
00038 #ifndef IFACEIFACE_H
00039 #define IFACEIFACE_H
00040 
00041 #include "Portable.h"
00042 #include "SmartPtr.h"
00043 #include "Container.h"
00044 #include "SocketIPv6.h"
00045 #include "IPv6Addr.h"
00046 
00047 /*
00048  * represents network interface 
00049  */
00050 class TIfaceIface{
00051  public:
00052     friend ostream & operator <<(ostream & strum, TIfaceIface &x);
00053 
00054     TIfaceIface(const char * name, int id, unsigned int flags, char* mac, 
00055                 int maclen, char* llAddr, int llAddrCnt, char * globalAddr, int globalCnt, int hwType);
00056     char * getName();
00057     int getID();
00058     string getFullName();
00059 
00060     // ---flags related---
00061     unsigned int getFlags();
00062     bool flagUp();
00063     bool flagRunning();
00064     bool flagMulticast();
00065     bool flagLoopback();
00066 
00067     // ---layer-2 related---
00068     int   getMacLen();
00069     char* getMac();
00070     int   getHardwareType();
00071     char* firstLLAddress();
00072     char* getLLAddress();
00073     int   countLLAddress();
00074 
00075     SmartPtr<TIPv6Addr> getGlobalAddr();
00076 
00077     // ---address related---
00078     bool addAddr(SmartPtr<TIPv6Addr> addr, long pref, long valid);
00079     bool delAddr(SmartPtr<TIPv6Addr> addr);
00080     bool updateAddr(SmartPtr<TIPv6Addr> addr, long pref, long valid);
00081     
00082     // ---socket related---
00083     bool addSocket(SmartPtr<TIPv6Addr> addr,int port, bool ifaceonly, bool reuse);
00084     bool addSocket(int port, bool ifaceonly, bool reuse); 
00085     bool delSocket(int id);
00086     void firstSocket();
00087     SmartPtr <TIfaceSocket> getSocketByFD(int fd);
00088     SmartPtr <TIfaceSocket> getSocket();
00089     SmartPtr<TIfaceSocket> getSocketByAddr(SmartPtr<TIPv6Addr> addr);
00090     int countSocket();
00091 
00092     ~TIfaceIface();
00093 
00094  protected:
00095     // ---interface data---
00096     char Name[MAX_IFNAME_LENGTH];
00097     int ID;
00098     unsigned int Flags;
00099     char* Mac;
00100     int Maclen;
00101     char* LLAddr;
00102     int LLAddrCnt;
00103     char * GlobalAddr;
00104     int GlobalAddrCnt;
00105     
00106     int HWType;
00107 
00108     // sockets
00109     TContainer< SmartPtr<TIfaceSocket> > SocketsLst;
00110     char*   PresLLAddr;
00111 };
00112 
00113 #endif
00114 

Generated on Sun Aug 7 22:47:14 2005 for Dibbler - a portable DHCPv6 by  doxygen 1.3.9.1