Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ATM_Addr.h

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

Generated on Mon Jun 16 11:19:08 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002