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

SocketIPv6.h

Go to the documentation of this file.
00001 class TIfaceSocket;
00002 #ifndef IFACESOCKETIPV6_H
00003 #define IFACESOCKETIPV6_H
00004 
00005 /*
00006  * IfaceSocketIPv6 - represents network socket 
00007  * @date 2003-10-26
00008  * @author Tomasz Mrugalski <admin@klub.com.pl>
00009  * @licence GNU GPL v2 or later
00010  */
00011 
00012 #include <iostream>
00013 #include <string>
00014 
00015 #include "Portable.h"
00016 #include "DHCPConst.h"
00017 #include "IPv6Addr.h"
00018 #include "SmartPtr.h"
00019 using namespace std;
00020 
00021 /*
00022  * repesents network socket
00023  */
00024 class TIfaceSocket {
00025     friend ostream& operator<<(ostream& strum, TIfaceSocket &x);
00026  public:
00027     TIfaceSocket(char * iface,int ifaceid, int port, 
00028                      SmartPtr<TIPv6Addr> addr, bool ifaceonly, bool reuse);
00029     TIfaceSocket(char * iface,int ifaceid, int port,
00030                      bool ifaceonly, bool reuse);
00031    
00032     // ---transmission---
00033     int send(char * buf,int len, SmartPtr<TIPv6Addr> addr,int port);
00034     int recv(char * buf,SmartPtr<TIPv6Addr> addr);
00035     
00036     // ---get info---
00037     int getFD();
00038     int getPort();
00039     int getIfaceID();
00040     SmartPtr<TIPv6Addr> getAddr();
00041     enum EState getStatus();
00042 
00043     // ---select() stuff---
00044     // FileDescriptors Set, for use with select()
00045     // (it's really messed up. fd_set is some really weird macro used
00046     //  with POSIX select() function. )
00047     static fd_set * getFDS();
00048 
00049     ~TIfaceSocket();
00050  private:
00051     // adds socket to this interface
00052     int createSocket(char * iface, int ifaceid, SmartPtr<TIPv6Addr> addr, 
00053                      int port, bool ifaceonly, bool reuse);
00054 
00055     // FileDescriptor
00056     int FD;
00057 
00058     // bounded port
00059     int Port;
00060 
00061     // socket status
00062     enum EState Status;
00063 
00064     // error 
00065     string Error;
00066 
00067     // interface name, on which this socket has been created
00068     char Iface[MAX_IFNAME_LENGTH];
00069 
00070     // interface ID, on which this socket has been created
00071     int  IfaceID;
00072 
00073     // bounded address 
00074     SmartPtr<TIPv6Addr> Addr;
00075 
00076     // true = bounded to this interface only
00077     bool IfaceOnly;
00078 
00079     // true = bounded to multicast socket
00080     bool Multicast;
00081 
00082     // Static element. Class needs to know, when first object is
00083     // created. It call some weird macro to zero fd_set 
00084     static int Count;
00085 };
00086 
00087 
00088 #endif
00089 
00090 

Generated on Mon Dec 27 21:55:22 2004 for Dibbler - a portable DHCPv6 by  doxygen 1.3.9.1