summaryrefslogtreecommitdiff
path: root/ace/OS_NS_stropts.h
blob: c37dd25d13cf8a2cb46d7ce9e3588fe5e19b45ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// -*- C++ -*-

//=============================================================================
/**
 *  @file   OS_NS_stropts.h
 *
 *  $Id$
 *
 *  @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
 *  @author Jesper S. M|ller<stophph@diku.dk>
 *  @author and a cast of thousands...
 *
 *  Originally in OS.h.
 */
//=============================================================================

#ifndef ACE_OS_NS_STROPTS_H
# define ACE_OS_NS_STROPTS_H

# include /**/ "ace/pre.h"

# include "ace/config-all.h"

# if !defined (ACE_LACKS_PRAGMA_ONCE)
#  pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */

#include "ace/OS_Export.h"
#include "ace/os_include/os_stropts.h"
#include "ace/os_include/os_stdio.h"

#if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
typedef WSAPROTOCOL_INFO ACE_Protocol_Info;

// Callback function that's used by the QoS-enabled <ACE_OS::ioctl>
// method.
typedef LPWSAOVERLAPPED_COMPLETION_ROUTINE ACE_OVERLAPPED_COMPLETION_FUNC;
typedef GROUP ACE_SOCK_GROUP;
#else  /*  (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) */
struct ACE_Protocol_Info
{
  u_long dwServiceFlags1;
  int iAddressFamily;
  int iProtocol;
  char szProtocol[255+1];
};

// Callback function that's used by the QoS-enabled <ACE_OS::ioctl>
// method.
typedef void (*ACE_OVERLAPPED_COMPLETION_FUNC) (u_long error,
                                                u_long bytes_transferred,
                                                ACE_OVERLAPPED *overlapped,
                                                u_long flags);
typedef u_long ACE_SOCK_GROUP;

#endif /* (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) */

// @todo: move this to it's own file... dhinton
/**
 * @class ACE_Str_Buf
 *
 * @brief Simple wrapper for STREAM pipes strbuf.
 */
class ACE_OS_Export ACE_Str_Buf : public strbuf
{
public:
  // = Initialization method
  /// Constructor.
  ACE_Str_Buf (void *b = 0, int l = 0, int max = 0);

  /// Constructor.
  ACE_Str_Buf (strbuf &);
};

class ACE_QoS;

namespace ACE_OS {

  int getmsg (ACE_HANDLE handle,
              struct strbuf *ctl,
              struct strbuf
              *data, int *flags);
  int getpmsg (ACE_HANDLE handle,
               struct strbuf *ctl,
               struct strbuf
               *data,
               int *band,
               int *flags);

  int fattach (int handle,
               const char *path);
  int fdetach (const char *file);

  /// UNIX-style <ioctl>.
  int ioctl (ACE_HANDLE handle,
             int cmd,
             void * = 0);

#if !defined (ACE_HAS_WINCE)
  /// QoS-enabled <ioctl>.
  int ioctl (ACE_HANDLE socket,
             u_long io_control_code,
             void *in_buffer_p,
             u_long in_buffer,
             void *out_buffer_p,
             u_long out_buffer,
             u_long *bytes_returned,
             ACE_OVERLAPPED *overlapped,
             ACE_OVERLAPPED_COMPLETION_FUNC func);

  /// QoS-enabled <ioctl> when the I/O control code is either
  /// SIO_SET_QOS or SIO_GET_QOS.
  int ioctl (ACE_HANDLE socket,
             u_long io_control_code,
             ACE_QoS &ace_qos,
             u_long *bytes_returned,
             void *buffer_p = 0,
             u_long buffer = 0,
             ACE_OVERLAPPED *overlapped = 0,
             ACE_OVERLAPPED_COMPLETION_FUNC func = 0);
#endif  // ACE_HAS_WINCE

  int isastream (ACE_HANDLE handle);

  int putmsg (ACE_HANDLE handle,
              const struct strbuf *ctl,
              const struct strbuf *data,
              int flags);
  int putpmsg (ACE_HANDLE handle,
               const struct strbuf *ctl,
               const struct strbuf *data,
               int band,
               int flags);

} /* namespace ACE_OS */

# if defined (ACE_HAS_INLINED_OSCALLS)
#   if defined (ACE_INLINE)
#     undef ACE_INLINE
#   endif /* ACE_INLINE */
#   define ACE_INLINE inline
#   include "ace/OS_NS_stropts.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */

# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_STROPTS_H */