PageRenderTime 30ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/dep/acelite/ace/ATM_Params.h

https://github.com/Bootz/Singularity
C Header | 214 lines | 102 code | 51 blank | 61 comment | 0 complexity | 4ce62d1f015736ac69dda19bc1e6e5b8 MD5 | raw file
  1. // -*- C++ -*-
  2. //==========================================================================
  3. /**
  4. * @file ATM_Params.h
  5. *
  6. * $Id: ATM_Params.h 80826 2008-03-04 14:51:23Z wotte $
  7. *
  8. * @author Joe Hoffert <joeh@cs.wustl.edu>
  9. */
  10. //==========================================================================
  11. #ifndef ACE_ATM_PARAMS_H
  12. #define ACE_ATM_PARAMS_H
  13. #include /**/ "ace/pre.h"
  14. #include /**/ "ace/config-all.h"
  15. #if !defined (ACE_LACKS_PRAGMA_ONCE)
  16. # pragma once
  17. #endif /* ACE_LACKS_PRAGMA_ONCE */
  18. #if defined (ACE_HAS_ATM)
  19. #include /**/ "ace/ACE_export.h"
  20. #if defined (ACE_HAS_FORE_ATM_XTI)
  21. #include "ace/TLI.h"
  22. #define ATM_PROTOCOL_DEFAULT 0
  23. typedef struct t_info Param_Info;
  24. typedef struct netbuf Param_Udata;
  25. #elif defined (ACE_HAS_FORE_ATM_WS2)
  26. #include "ace/SOCK.h"
  27. #define ATM_PROTOCOL_DEFAULT ATMPROTO_AAL5
  28. #define ACE_XTI_ATM_DEVICE ""
  29. typedef int Param_Info;
  30. typedef int Param_Udata;
  31. #elif defined (ACE_HAS_LINUX_ATM)
  32. #include /**/ "atm.h"
  33. #define AF_ATM PF_ATMSVC
  34. #define ACE_XTI_ATM_DEVICE ""
  35. #define ATM_PROTOCOL_DEFAULT ATM_AAL5
  36. typedef int Param_Info;
  37. typedef int Param_Udata;
  38. #else
  39. #define ACE_XTI_ATM_DEVICE ""
  40. typedef int Param_Info;
  41. typedef int Param_Udata;
  42. #endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
  43. ACE_BEGIN_VERSIONED_NAMESPACE_DECL
  44. /**
  45. * @class ACE_ATM_Params
  46. *
  47. * @brief Wrapper class that simplifies the information passed to the ATM
  48. * enabled ACE_ATM_Connector class.
  49. */
  50. class ACE_Export ACE_ATM_Params
  51. {
  52. public:
  53. /**
  54. * Initialize the data members. This class combines options from
  55. * ACE_SOCK_Connector (@a protocol_family, @a protocol, <type>,
  56. * @a protocol_info, <group>, and @a flags) and
  57. * ACE_TLI_Connector (<device>, <info>, <rw_flag>, <oflag>, and <udata>)
  58. * so that either mechanism can be used transparently for ATM.
  59. */
  60. ACE_ATM_Params (int rw_flag = 1,
  61. const char device[] = ACE_XTI_ATM_DEVICE,
  62. Param_Info *info = 0,
  63. Param_Udata *udata = 0,
  64. int oflag = O_RDWR,
  65. int protocol_family = AF_ATM,
  66. int protocol = ATM_PROTOCOL_DEFAULT,
  67. int type =
  68. #if defined (ACE_HAS_LINUX_ATM)
  69. SOCK_DGRAM,
  70. #else
  71. SOCK_RAW,
  72. #endif /* ACE_HAS_LINUX_ATM */
  73. ACE_Protocol_Info *protocol_info = 0,
  74. ACE_SOCK_GROUP g = 0,
  75. u_long flags
  76. = ACE_FLAG_MULTIPOINT_C_ROOT
  77. | ACE_FLAG_MULTIPOINT_D_ROOT, // connector by default
  78. int reuse_addr = 0);
  79. /// Destructor.
  80. ~ACE_ATM_Params ();
  81. /// Get protocol family.
  82. int get_protocol_family (void) const;
  83. /// Set protocol family.
  84. void set_protocol_family (int);
  85. /// Get protocol.
  86. int get_protocol (void) const;
  87. /// Set protocol.
  88. void set_protocol (int);
  89. /// Get type.
  90. int get_type (void) const;
  91. /// Set type.
  92. void set_type (int);
  93. /// Get protocol info.
  94. ACE_Protocol_Info *get_protocol_info( void );
  95. /// Set protocol info.
  96. void set_protocol_info( ACE_Protocol_Info *);
  97. /// Get socket group.
  98. ACE_SOCK_GROUP get_sock_group( void );
  99. /// Set socket group.
  100. void set_sock_group( ACE_SOCK_GROUP );
  101. /// Get socket flags.
  102. u_long get_flags( void );
  103. /// Set socket flags.
  104. void set_flags( u_long );
  105. /// Get reuse_addr flag.
  106. int get_reuse_addr (void) const;
  107. /// Set reuse_addr flag.
  108. void set_reuse_addr (int);
  109. /// Get device.
  110. const char* get_device (void) const;
  111. /// Get info.
  112. Param_Info* get_info (void) const;
  113. /// Set info.
  114. void set_info (Param_Info *);
  115. /// Get r/w flag.
  116. int get_rw_flag (void) const;
  117. /// Set r/w flag.
  118. void set_rw_flag (int);
  119. /// Get user data.
  120. Param_Udata* get_user_data (void) const;
  121. /// Set user data.
  122. void set_user_data (Param_Udata*);
  123. /// Get open flag.
  124. int get_oflag (void) const;
  125. /// Set open flag.
  126. void set_oflag (int);
  127. /// Dump the state of an object.
  128. void dump (void) const;
  129. /// Declare the dynamic allocation hooks.
  130. ACE_ALLOC_HOOK_DECLARE;
  131. private:
  132. /// Protocol family for sockets connections.
  133. int protocol_family_;
  134. /// Protocol for sockets connections.
  135. int protocol_;
  136. /// Type for opening sockets.
  137. int type_;
  138. /// Information about the protocol.
  139. ACE_Protocol_Info *protocol_info_;
  140. /// Socket group used (for sockets only).
  141. ACE_SOCK_GROUP group_;
  142. /// Flags for sockets (for sockets only).
  143. u_long flags_;
  144. /// Flag for reusing address for opening sockets.
  145. int reuse_addr_;
  146. /// Device name for XTI/ATM connections.
  147. const char *device_;
  148. /// Info for XTI/ATM connections.
  149. Param_Info *info_;
  150. /// R/W flag for XTI/ATM connections.
  151. int rw_flag_;
  152. /// User data for XTI/ATM connections.
  153. Param_Udata *udata_;
  154. /// Open flag for XTI/ATM connections.
  155. int oflag_;
  156. };
  157. ACE_END_VERSIONED_NAMESPACE_DECL
  158. #if defined (__ACE_INLINE__)
  159. #include "ace/ATM_Params.inl"
  160. #endif /* __ACE_INLINE__ */
  161. #endif /* ACE_HAS_ATM */
  162. #include /**/ "ace/post.h"
  163. #endif /* ACE_ATM_PARAMS_H */