summaryrefslogtreecommitdiff
path: root/examples/QOS/QosEvent.h
blob: 822ebef01a15d4f1fddc13259edfcf2a96998ce1 (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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
/* -*- C++ -*- */
//$Id$
// ============================================================================
//
// = LIBRARY
//    ACE_wrappers/examples/QOS
//
// = FILENAME
//    QosEvent.h
//
// = AUTHOR
//    Vishal Kachroo <vishal@cs.wustl.edu>
//
// ============================================================================

#ifndef QOSEVENT_H
#define QOSEVENT_H

// @@ Vishal, we should probably most this stuff to OS.h at some point
// so that it'll be available to all applications that use the ACE QoS
// wrappers.

// I agree. However, if the user chooses to use other options than used
// in this test application she might have to declare other such stuff.
// I would suggest keeping these defines to the test program until we find
// a more portable way of handling this. This would mean having these defines 
// in the user applications which is not neat but it will avoid cluttering 
// OS.h with incomplete QoS related defines.
  
#if !(defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0))

#define XP1_QOS_SUPPORTED        0x00002000
#define XP1_SUPPORT_MULTIPOINT   0x00000400

#define TRUE  1
#define FALSE 0

#define WSABASEERR              10000
#define WSAENOBUFS              (WSABASEERR+55)

#define FROM_PROTOCOL_INFO (-1)

#define WSA_FLAG_OVERLAPPED           0x01
#define WSA_FLAG_MULTIPOINT_C_ROOT    0x02
#define WSA_FLAG_MULTIPOINT_C_LEAF    0x04
#define WSA_FLAG_MULTIPOINT_D_ROOT    0x08
#define WSA_FLAG_MULTIPOINT_D_LEAF    0x10

#define QOS_NOT_SPECIFIED     0xFFFFFFFF

#endif /* ACE_HAS_WINSOCK2 */


#define MY_DEFPORT (5001)

// Application-specific define - there is NO specific invalid send
// priority.  This value is simply used to indicate whether or not to
// even set priority.
#define INVALID_SEND_PRIORITY 255

// Application-specific define - there is no "default" QOS template in
// GQoS, only for this particular application does "default" have
// meaning.
#define QOS_DEFAULTNAME "default"       

// Use an arbitrary multicast group if none is specified on the
// command line
#define DEFAULT_MULTICASTGROUP "234.5.6.7"

typedef struct _SP_OPTIONS
{
  int iProtocol;             
  // protocol to use

  int bQos;                  
  // enable QOS

  int bMulticast;            
  // enable multicasting
} SP_OPTIONS;

typedef enum 
{
  QOS_IOCTL_SET_DURING,       
  // do not use ioctl to set Qos

  QOS_IOCTL_SET_BEFORE,       
  // set qos with ioctl before connection/accept

  QOS_IOCTL_SET_AFTER,        
  // set qos with ioctl after connection/accept

  QOS_IOCTL_SET_QOS           
  // set qos in receiver during FD_QOS, note that qos must be set
  // prior to wsaeventselect in order to ever receive fd_qos
} QOS_IOCTL_SET;


typedef struct _QOS_OPTIONS
{
  int    bReceiver;          
  // act as receiver if TRUE

  int    bWaitToSend;        
  // sender must wait for RESV before sending

  int    bConfirmResv;       
  // have receiver request RESV confirmation

  int    bQueryBufferSize;   
  // have WSAioctl return size of buffer needed when using SIO_GET_QOS
  // (behaviour not avail on Win98).

  int    bMustSetQosInAccept;
  // Will be set for Win98 only.  Win98 currently needs valid qos
  // structure to be set in wsaaccept condition func in lpSQos is
  // valid

  int    bDisableSignalling; 
  // If TRUE do not emit RSVP signalling, just use traffic control

  int    bAlternateQos;      
  // Alternate between enabling and disabling QOS on a socket every N
  // sends

  unsigned int   SendPriority;       
  // create QOS_OBJECT_PRIORITY structure, and set valid priority 0-7

  int    bSetDestaddr;       
  // TRUE if unconnected UDP and QOS is used (not multicast)

  int    bProviderSpecific;  
  // TRUE if a provider-specific object must be set

  int    bFineGrainErrorAvail;   
  // TRUE if Win2000beta3 availability of fine grain errors on SIO_SET_QOS

  int    bQosabilityIoctls;   
  // TRUE if Win2000beta3 qosablity ioctls 

  int    bFixTemplate;       
  // TRUE if Win98 to divide ToeknRate and PeakBandwidth by 8 when
  // using WSAGetQOSByName

  QOS_IOCTL_SET  qosIoctlSet;  
  // when to set QOS

  char    szTemplate[64];     
  // qos template
} QOS_OPTIONS;

extern ACE_Flow_Spec default_notraffic;
extern ACE_Flow_Spec default_g711;

typedef struct _OPTIONS
{
  char            szHostname[64];
  unsigned short  port;
  int             nRepeat;
  char            fillchar;
  int             nBufSize;
  char *          buf;
  u_long          dwSleep;
  u_long          dwTotalClients;
  QOS_OPTIONS     qosOptions;
  SP_OPTIONS      spOptions;
} OPTIONS;

#ifdef QOSEVENT_MAIN

OPTIONS default_options = 
{
  "localhost",
  MY_DEFPORT,
  1,
  'c',
  4096,
  NULL,
  0,
  0,
  {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, INVALID_SEND_PRIORITY, 
   TRUE, TRUE, TRUE, TRUE, FALSE, QOS_IOCTL_SET_BEFORE, QOS_DEFAULTNAME},
  {IPPROTO_TCP, FALSE, FALSE}
};

ACE_Flow_Spec default_notraffic (QOS_NOT_SPECIFIED,
                                 QOS_NOT_SPECIFIED,
                                 QOS_NOT_SPECIFIED,
                                 QOS_NOT_SPECIFIED,
                                 QOS_NOT_SPECIFIED,
                                 SERVICETYPE_NOTRAFFIC,
                                 QOS_NOT_SPECIFIED,
                                 QOS_NOT_SPECIFIED,
                                 25,
                                 1);
    
ACE_Flow_Spec default_g711 (9200,
                            708,
                            18400,
                            0,
                            0,
                            SERVICETYPE_CONTROLLEDLOAD,
                            368,
                            368,
                            25,
                            1);


SOCKADDR_IN g_destaddr;

#else

extern FLOWSPEC default_notraffic;
extern FLOWSPEC default_g711;
extern SOCKADDR_IN g_destaddr;
    
#endif /* QOSEVENT_MAIN */

extern int FindServiceProvider (int iProtocol,
                                int bQos,
                                int bMulticast,
                                ACE_Protocol_Info *pProtocolInfo);

#endif /* QOSEVENT_H */