00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 #ifndef ACE_MEM_ADDR_H
00015 #define ACE_MEM_ADDR_H
00016 #include  "ace/pre.h"
00017 
00018 #include  "ace/ACE_export.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif 
00023 
00024 #if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
00025 
00026 #include "ace/INET_Addr.h"
00027 
00028 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 class ACE_Export ACE_MEM_Addr : public ACE_Addr
00037 {
00038 public:
00039   
00040 
00041   ACE_MEM_Addr (void);
00042 
00043 
00044   ACE_MEM_Addr (const ACE_MEM_Addr &);
00045 
00046 
00047   ACE_MEM_Addr (u_short port_number);
00048 
00049 
00050   explicit ACE_MEM_Addr (const ACE_TCHAR port_name[]);
00051 
00052 
00053   ~ACE_MEM_Addr (void);
00054 
00055   
00056 
00057 
00058   int initialize_local (u_short port);
00059 
00060 
00061   int same_host (const ACE_INET_Addr& sap);
00062 
00063   
00064 
00065 
00066 
00067 
00068 
00069 
00070 
00071   int set (u_short port_number, int encode = 1);
00072 
00073 
00074 
00075   int set (const ACE_TCHAR port_name[]);
00076 
00077 
00078   virtual void *get_addr (void) const;
00079 
00080 
00081   virtual void set_addr (void *, int len);
00082 
00083 
00084 
00085   virtual int addr_to_string (ACE_TCHAR buffer[],
00086                               size_t size,
00087                               int ipaddr_format = 1) const;
00088 
00089 
00090   virtual int string_to_addr (const ACE_TCHAR address[]);
00091 
00092 
00093   void set_port_number (u_short,
00094                         int encode = 1);
00095 
00096 
00097   u_short get_port_number (void) const;
00098 
00099 
00100   int get_host_name (ACE_TCHAR hostname[],
00101                      size_t hostnamelen) const;
00102 
00103 
00104 
00105 
00106 
00107 
00108   const char *get_host_name (void) const;
00109 
00110 
00111   const char *get_host_addr (void) const;
00112 
00113 
00114 
00115   ACE_UINT32 get_ip_address (void) const;
00116 
00117   const ACE_INET_Addr &get_remote_addr (void) const;
00118   const ACE_INET_Addr &get_local_addr (void) const;
00119 
00120 
00121 
00122   bool operator == (const ACE_MEM_Addr &SAP) const;
00123   bool operator == (const ACE_INET_Addr &SAP) const;
00124 
00125 
00126   bool operator != (const ACE_MEM_Addr &SAP) const;
00127   bool operator != (const ACE_INET_Addr &SAP) const;
00128 
00129 
00130   virtual u_long hash (void) const;
00131 
00132 
00133   void dump (void) const;
00134 
00135 
00136   ACE_ALLOC_HOOK_DECLARE;
00137 
00138 private:
00139 
00140   ACE_INET_Addr external_;
00141 
00142 
00143   ACE_INET_Addr internal_;
00144 };
00145 
00146 ACE_END_VERSIONED_NAMESPACE_DECL
00147 
00148 #if defined (__ACE_INLINE__)
00149 #include "ace/MEM_Addr.inl"
00150 #endif 
00151 
00152 #endif 
00153 
00154 #include  "ace/post.h"
00155 #endif