ATM_Addr.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //==========================================================================
00004 /**
00005  *  @file    ATM_Addr.h
00006  *
00007  *  ATM_Addr.h,v 4.22 2006/04/27 11:17:55 jwillemsen Exp
00008  *
00009  *  @author Joe Hoffert <joeh@cs.wustl.edu>
00010  */
00011 //==========================================================================
00012 
00013 #ifndef ACE_ATM_ADDR_H
00014 #define ACE_ATM_ADDR_H
00015 #include /**/ "ace/pre.h"
00016 
00017 #include "ace/config-all.h"
00018 
00019 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00020 # pragma once
00021 #endif /* ACE_LACKS_PRAGMA_ONCE */
00022 
00023 #if defined (ACE_HAS_ATM)
00024 
00025 #include "ace/ACE_export.h"
00026 #include "ace/Addr.h"
00027 
00028 #if defined (ACE_HAS_FORE_ATM_XTI)
00029 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00030 typedef ATMSAPAddress ATM_Addr;
00031 ACE_END_VERSIONED_NAMESPACE_DECL
00032 #elif defined (ACE_HAS_FORE_ATM_WS2)
00033 #define FORE_NAME_SPACE NS_ALL
00034 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00035 typedef struct sockaddr_atm ATM_Addr;
00036 ACE_END_VERSIONED_NAMESPACE_DECL
00037 #elif defined (ACE_HAS_LINUX_ATM)
00038 
00039 #include /**/ "atm.h"
00040 
00041 // Open versioned namespace, if enabled by the user.
00042 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00043 
00044 //pbrandao:as Linux has this 2 structs separeted we "link it" here
00045 typedef struct _linux_atm_addr
00046 {
00047   struct sockaddr_atmsvc sockaddratmsvc;
00048   struct atm_sap atmsap;
00049 } ATM_Addr;
00050 #else
00051 typedef int ATM_Addr;
00052 #endif /* ACE_HAS_FORE_ATM_XTI/ACE_HAS_FORE_ATM_WS2/ACE_HAS_LINUX_ATM */
00053 
00054 /**
00055  * @class ACE_ATM_Addr
00056  *
00057  * @brief Defines the ATM domain address family address format.
00058  */
00059 class ACE_Export ACE_ATM_Addr : public ACE_Addr
00060 {
00061 public:
00062   // Constants used for ATM options
00063   static const long LINE_RATE;
00064   static const int OPT_FLAGS_CPID;
00065   static const int OPT_FLAGS_PMP;
00066   static const int DEFAULT_SELECTOR;
00067 
00068   // = Initialization methods.
00069   /// Default constructor.
00070   ACE_ATM_Addr (u_char selector = DEFAULT_SELECTOR);
00071 
00072   /// Copy constructor.
00073   ACE_ATM_Addr (const ACE_ATM_Addr &,
00074                 u_char selector = DEFAULT_SELECTOR);
00075 
00076   /**
00077    * Creates an ACE_ATM_Addr from an ATMSAPAddress structure. This
00078    * is vendor specific (FORE systems). May need to change when other
00079    * vendors are supported.
00080    */
00081   ACE_ATM_Addr (const ATM_Addr *,
00082                 u_char selector = DEFAULT_SELECTOR);
00083 
00084   /**
00085    * Initializes an ACE_ATM_Addr from the <sap> which can be
00086    * "atm-address" (e.g.,
00087    * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") or "hostname"
00088    * (e.g., "frisbee.cs.wustl.edu").
00089    */
00090   ACE_ATM_Addr (const ACE_TCHAR sap[],
00091                 u_char selector = DEFAULT_SELECTOR);
00092 
00093   /// Default dtor.
00094   ~ACE_ATM_Addr (void);
00095 
00096   // = Initialization methods (useful after object construction).
00097   /// Default initialization for non-address values (e.g.,
00098   /// t_atm_sap_addr.SVE_tag_addr, t_atm_sap_addr.SVE_tag_selector)
00099   void init (u_char selector = DEFAULT_SELECTOR);
00100 
00101   /// Initializes from another ACE_ATM_Addr.
00102   int set (const ACE_ATM_Addr &,
00103            u_char selector = DEFAULT_SELECTOR);
00104 
00105   /**
00106    * Initializes an ACE_ATM_Addr from an ATMSAPAddress/sockaddr_atm
00107    * structure. This is vendor specific (FORE systems). May need to
00108    * change when other vendors are supported.
00109    */
00110   int set (const ATM_Addr *,
00111            u_char selector = DEFAULT_SELECTOR);
00112 
00113   /**
00114    * Initializes an ACE_ATM_Addr from the <sap> which can be
00115    * "atm-address" (e.g.,
00116    * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") or "hostname"
00117    * (e.g., "frisbee.cs.wustl.edu").
00118    */
00119   int set (const ACE_TCHAR sap[],
00120            u_char selector = DEFAULT_SELECTOR);
00121 
00122   /**
00123    * Initializes an ACE_ATM_Addr from the <sap> which can be
00124    * "atm-address" (e.g.,
00125    * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") or "hostname"
00126    * (e.g., "frisbee.cs.wustl.edu").
00127    */
00128   virtual int string_to_addr (const ACE_TCHAR sap[]);
00129 
00130   /**
00131    * Return the character representation of the ATM address (e.g.,
00132    * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00") storing it in
00133    * the <addr> (which is assumed to be <addrlen> bytes long). This
00134    * version is reentrant.  Returns -1 if the <addrlen> of the <addr>
00135    * is too small, else 0.
00136    */
00137   virtual int addr_to_string (ACE_TCHAR addr[],
00138                               size_t addrlen) const;
00139 
00140   /**
00141    * Return the character representation of the ATM address (e.g.,
00142    * "47.0005.80.ffe100.0000.f20f.2200.0020480694f9.00"). Returns -1
00143    * if the <size> of the <buffer> is too small, else 0.(This version
00144    * is non-reentrant since it returns a pointer to a static data
00145    * area.)
00146    */
00147   const ACE_TCHAR *addr_to_string (void) const;
00148 
00149   /// Return a pointer to the underlying network address.
00150   virtual void *get_addr (void) const;
00151 
00152   /// Set a pointer to the address.
00153   virtual void set_addr (void *, int);
00154 
00155   /// Return the selector for network address.
00156   u_char get_selector (void) const;
00157 
00158   /// Set the selector for the network address.
00159   void set_selector (u_char selector);
00160 
00161   /**
00162    * Compare two addresses for equality.  The addresses are considered
00163    * equal if they contain the same ATM address.  Q: Is there any
00164    * other check for equality needed for ATM?
00165    */
00166   bool operator == (const ACE_ATM_Addr &SAP) const;
00167 
00168   /// Compare two addresses for inequality.
00169   bool operator != (const ACE_ATM_Addr &SAP) const;
00170 
00171   /// Dump the state of an object.
00172   void dump (void) const;
00173 
00174   /// Declare the dynamic allocation hooks.
00175   ACE_ALLOC_HOOK_DECLARE;
00176 
00177 //   char *construct_options (ACE_HANDLE fd,
00178 //                            int qos_kb,
00179 //                            int flags,
00180 //                            long *optsize);
00181 //   // Construct options for ATM connections
00182 
00183 private:
00184   ATM_Addr atm_addr_;
00185 };
00186 
00187 // Close versioned namespace, if enabled by the user.
00188 ACE_END_VERSIONED_NAMESPACE_DECL
00189 
00190 
00191 #if defined (__ACE_INLINE__)
00192 #include "ace/ATM_Addr.inl"
00193 #endif /* __ACE_INLINE__ */
00194 
00195 #endif /* ACE_HAS_ATM */
00196 #include /**/ "ace/post.h"
00197 #endif /* ACE_ATM_ADDR_H */

Generated on Thu Nov 9 09:41:46 2006 for ACE by doxygen 1.3.6