Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Address.h

Go to the documentation of this file.
00001 /*
00002   Address - address of a remote for socket communication
00003 
00004   Module:    $RCSfile: Address.h,v $
00005   Date:      $Date: 2002/01/16 13:08:14 $
00006   Version:   $Revision: 1.16 $
00007   ID:        $Id: Address.h,v 1.16 2002/01/16 13:08:14 zoran Exp $
00008   Authors:   Zoran Constantinescu <zoranc@acm.org>
00009 */
00010 
00011 
00012 #ifndef _Address_h_
00013 #define _Address_h_
00014 
00015 #include "defs.h"
00016 #include "Object.h"
00017 
00018 
00019 class COM_API Address : public Object {
00020  public:
00021   uint host;
00022   uint port;
00023   static uint thishost;  // real address of locahost
00024 
00025  public:
00026   Address ();
00027   Address (uint host, int port);
00028   Address (const char *host, int port);
00029   Address (const Address &other);
00030   Address (const char *ip_with_port);
00031   ~Address (); 
00032 
00033   //returns new Address object containing the full IP address of the local host
00034   static Address *getAddress(int port = 0);
00035 
00036   //initializes variable thishost - must be called before Address is used
00037   static void init_thishost();
00038 
00039   void setHost (uint host);
00040   int  setHost (const char *host);
00041   void setPort (int port);
00042 
00043   uint getHost () const;
00044   uint getHost (char *host) const;
00045   int  getPort () const;
00046 
00047   //sets the Address using string host_name:port
00048   void setIP(const char *ip_with_port);
00049 
00050   //returns full address in the format host_name:port in the argument
00051   void getIP(char *ip_with_port) const;
00052 
00053   //returns 1 if other is the same address, otherwise returns 0
00054   int equals (Address &other);
00055   int equals (uint host, uint port);
00056   int operator== (Address &other);
00057   int operator!= (Address &other);
00058 
00059   Address& operator= (const Address &other);
00060 };
00061 
00062 #endif  // _Address_h_
00063 

Generated on Mon Nov 25 12:46:27 2002 for qadpz by doxygen1.2.18