1 #include "ace/ATM_QoS.h"
3 #if defined (ACE_HAS_ATM)
5 #if !defined (__ACE_INLINE__)
6 #include "ace/ATM_QoS.inl"
7 #endif /* __ACE_INLINE__ */
9 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
11 #if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2)
12 #define BHLI_MAGIC "FORE_ATM"
13 // This is line rate in cells/s for an OC-3 MM interface.
14 const long ACE_ATM_QoS::LINE_RATE
= 353207;
15 const int ACE_ATM_QoS::OPT_FLAGS_CPID
= 0x1;
16 const int ACE_ATM_QoS::OPT_FLAGS_PMP
= 0x2;
17 const int ACE_ATM_QoS::DEFAULT_SELECTOR
= 0x99;
18 const int ACE_ATM_QoS::DEFAULT_PKT_SIZE
= 8192;
19 #elif defined (ACE_HAS_LINUX_ATM)
21 //pbrandao:for now stick with current definitions
22 //pbrandao:see if later need to change
23 const long ACE_ATM_QoS::LINE_RATE
= 353207;
24 const int ACE_ATM_QoS::OPT_FLAGS_CPID
= 0x1;
25 const int ACE_ATM_QoS::OPT_FLAGS_PMP
= 0x2;
26 const int ACE_ATM_QoS::DEFAULT_SELECTOR
= 0x99;
27 const int ACE_ATM_QoS::DEFAULT_PKT_SIZE
= 8192;
29 const long ACE_ATM_QoS::LINE_RATE
= 0L;
30 const int ACE_ATM_QoS::OPT_FLAGS_CPID
= 0;
31 const int ACE_ATM_QoS::OPT_FLAGS_PMP
= 0;
32 const int ACE_ATM_QoS::DEFAULT_SELECTOR
= 0x0;
33 const int ACE_ATM_QoS::DEFAULT_PKT_SIZE
= 0;
34 #endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */
36 ACE_ALLOC_HOOK_DEFINE(ACE_ATM_QoS
)
38 ACE_ATM_QoS::ACE_ATM_QoS (int pktSize
)
40 ACE_TRACE ("ACE_ATM_QoS::ACE_ATM_QoS");
41 #if defined (ACE_HAS_LINUX_ATM)
42 ACE_OS::memset(&qos_
, 0, sizeof(qos_
));
43 qos_
.aal
= ATM_PROTOCOL_DEFAULT
;
44 qos_
.rxtp
.traffic_class
= ATM_ANYCLASS
;
45 qos_
.rxtp
.max_sdu
= pktSize
;
46 qos_
.txtp
.traffic_class
= ATM_ANYCLASS
;
47 qos_
.txtp
.max_sdu
= pktSize
;
49 ACE_UNUSED_ARG (pktSize
);
50 #endif /* ACE_HAS_LINUX_ATM */
53 ACE_ATM_QoS::ACE_ATM_QoS(int rate
,
56 ACE_TRACE( "ACE_ATM_QoS::ACE_ATM_QoS" );
57 #if defined (ACE_HAS_FORE_ATM_WS2)
58 AAL_PARAMETERS_IE ie_aalparams
;
59 ATM_TRAFFIC_DESCRIPTOR_IE ie_td
;
60 ATM_BROADBAND_BEARER_CAPABILITY_IE ie_bbc
;
61 ATM_QOS_CLASS_IE ie_qos
;
65 // Setting up cbr parameters ...
66 ie_aalparams
.AALType
= AALTYPE_5
;
67 ie_aalparams
.AALSpecificParameters
.AAL5Parameters
.ForwardMaxCPCSSDUSize
68 = pktSize
; // was 1516;
69 ie_aalparams
.AALSpecificParameters
.AAL5Parameters
.BackwardMaxCPCSSDUSize
70 = pktSize
; // was 1516;
71 ie_aalparams
.AALSpecificParameters
.AAL5Parameters
.Mode
= AAL5_MODE_MESSAGE
;
72 ie_aalparams
.AALSpecificParameters
.AAL5Parameters
.SSCSType
= AAL5_SSCS_NULL
;
74 size
= sizeof(Q2931_IE_TYPE
) + sizeof(ULONG
) + sizeof(AAL_PARAMETERS_IE
);
76 ie_td
.Forward
.PeakCellRate_CLP0
= SAP_FIELD_ABSENT
;
77 ie_td
.Forward
.PeakCellRate_CLP01
= rate
;
78 ie_td
.Forward
.SustainableCellRate_CLP0
= SAP_FIELD_ABSENT
;
79 ie_td
.Forward
.SustainableCellRate_CLP01
= SAP_FIELD_ABSENT
;
80 ie_td
.Forward
.MaxBurstSize_CLP0
= SAP_FIELD_ABSENT
;
81 ie_td
.Forward
.MaxBurstSize_CLP01
= SAP_FIELD_ABSENT
;
82 ie_td
.Forward
.Tagging
= SAP_FIELD_ABSENT
;
84 ie_td
.Backward
.PeakCellRate_CLP0
= SAP_FIELD_ABSENT
;
85 ie_td
.Backward
.PeakCellRate_CLP01
= rate
;
86 ie_td
.Backward
.SustainableCellRate_CLP0
= SAP_FIELD_ABSENT
;
87 ie_td
.Backward
.SustainableCellRate_CLP01
= SAP_FIELD_ABSENT
;
88 ie_td
.Backward
.MaxBurstSize_CLP0
= SAP_FIELD_ABSENT
;
89 ie_td
.Backward
.MaxBurstSize_CLP01
= SAP_FIELD_ABSENT
;
90 ie_td
.Backward
.Tagging
= SAP_FIELD_ABSENT
;
92 ie_td
.BestEffort
= 0; // Note: this must be set to zero for CBR.
94 size
+= sizeof( Q2931_IE_TYPE
)
96 + sizeof( ATM_TRAFFIC_DESCRIPTOR_IE
);
98 ie_bbc
.BearerClass
= BCOB_X
;
99 ie_bbc
.TrafficType
= TT_CBR
;
100 ie_bbc
.TimingRequirements
= TR_END_TO_END
;
101 ie_bbc
.ClippingSusceptability
= CLIP_NOT
;
102 ie_bbc
.UserPlaneConnectionConfig
= UP_P2P
;
104 size
+= sizeof( Q2931_IE_TYPE
)
106 + sizeof( ATM_BROADBAND_BEARER_CAPABILITY_IE
);
108 ie_qos
.QOSClassForward
= QOS_CLASS1
;
109 ie_qos
.QOSClassBackward
= QOS_CLASS1
; // This may not be really used
110 // since we do only simplex data xfer.
112 size
+= sizeof(Q2931_IE_TYPE
) + sizeof(ULONG
) + sizeof(ATM_QOS_CLASS_IE
);
114 qos_
.ProviderSpecific
.buf
= (char *) ACE_OS::malloc(size
);
115 if (qos_
.ProviderSpecific
.buf
== 0) {
116 ACELIB_ERROR((LM_ERROR
,
117 ACE_TEXT ("ACE_ATM_QoS::ACE_ATM_QoS: Unable to allocate %d bytes for qos_.ProviderSpecific.buf\n"),
121 qos_
.ProviderSpecific
.len
= size
;
122 ACE_OS::memset(qos_
.ProviderSpecific
.buf
, 0, size
);
124 ie_ptr
= (Q2931_IE
*) qos_
.ProviderSpecific
.buf
;
125 ie_ptr
->IEType
= IE_AALParameters
;
126 ie_ptr
->IELength
= sizeof( Q2931_IE_TYPE
)
128 + sizeof( AAL_PARAMETERS_IE
);
129 ACE_OS::memcpy(ie_ptr
->IE
, &ie_aalparams
, sizeof(AAL_PARAMETERS_IE
));
131 ie_ptr
= (Q2931_IE
*) ((char *)ie_ptr
+ ie_ptr
->IELength
);
132 ie_ptr
->IEType
= IE_TrafficDescriptor
;
133 ie_ptr
->IELength
= sizeof( Q2931_IE_TYPE
)
135 + sizeof( ATM_TRAFFIC_DESCRIPTOR_IE
);
136 ACE_OS::memcpy(ie_ptr
->IE
, &ie_td
, sizeof(ATM_TRAFFIC_DESCRIPTOR_IE
));
138 ie_ptr
= (Q2931_IE
*) ((char *)ie_ptr
+ ie_ptr
->IELength
);
139 ie_ptr
->IEType
= IE_BroadbandBearerCapability
;
140 ie_ptr
->IELength
= sizeof( Q2931_IE_TYPE
)
142 + sizeof( ATM_BROADBAND_BEARER_CAPABILITY_IE
);
143 ACE_OS::memcpy(ie_ptr
->IE
,
145 sizeof(ATM_BROADBAND_BEARER_CAPABILITY_IE
));
147 ie_ptr
= (Q2931_IE
*) ((char *)ie_ptr
+ ie_ptr
->IELength
);
148 ie_ptr
->IEType
= IE_QOSClass
;
149 ie_ptr
->IELength
= sizeof( Q2931_IE_TYPE
)
151 + sizeof( ATM_QOS_CLASS_IE
);
152 ACE_OS::memcpy(ie_ptr
->IE
, &ie_qos
, sizeof(ATM_QOS_CLASS_IE
));
154 // qos_.SendingFlowspec.TokenRate = 0xffffffff;
155 // qos_.SendingFlowspec.TokenBucketSize = 0xffffffff;
156 // qos_.SendingFlowspec.PeakBandwidth = 0xffffffff;
157 // qos_.SendingFlowspec.Latency = 0xffffffff;
158 // qos_.SendingFlowspec.DelayVariation = 0xffffffff;
159 // qos_.SendingFlowspec.ServiceType = SERVICETYPE_BESTEFFORT;
160 // This will most probably be ignored by the service provider.
161 // qos_.SendingFlowspec.MaxSduSize = 0xffffffff;
162 // qos_.SendingFlowspec.MinimumPolicedSize = 0xffffffff;
164 // qos_.ReceivingFlowspec.TokenRate = 0xffffffff;
165 // qos_.ReceivingFlowspec.TokenBucketSize = 0xffffffff;
166 // qos_.ReceivingFlowspec.PeakBandwidth = 0xffffffff;
167 // qos_.ReceivingFlowspec.Latency = 0xffffffff;
168 // qos_.ReceivingFlowspec.DelayVariation = 0xffffffff;
169 // qos_.ReceivingFlowspec.ServiceType = SERVICETYPE_BESTEFFORT;
170 // This will most probably be ignored by the service provider.
171 // qos_.ReceivingFlowspec.MaxSduSize = 0xffffffff;
172 // qos_.ReceivingFlowspec.MinimumPolicedSize = 0;
174 ACE_Flow_Spec
send_fspec( 0xffffffff,
179 SERVICETYPE_BESTEFFORT
,
180 // This will most probably ignored by SP.
184 ACE_DEFAULT_THREAD_PRIORITY
),
185 recv_fspec( 0xffffffff,
190 SERVICETYPE_BESTEFFORT
,
191 // This will most probably ignored by SP.
195 ACE_DEFAULT_THREAD_PRIORITY
);
197 qos_
.sending_flowspec (send_fspec
);
198 qos_
.receiving_flowspec (recv_fspec
);
199 #elif defined (ACE_HAS_FORE_ATM_XTI)
200 ACE_UNUSED_ARG (rate
);
201 ACE_UNUSED_ARG (pktSize
);
202 #elif defined (ACE_HAS_LINUX_ATM)
203 ACE_OS::memset(&qos_
,
206 qos_
.aal
= ATM_PROTOCOL_DEFAULT
;
207 qos_
.rxtp
.max_sdu
= pktSize
;
210 qos_
.rxtp
.pcr
= rate
;
211 qos_
.rxtp
.traffic_class
= ATM_CBR
;
212 qos_
.txtp
.traffic_class
= ATM_CBR
;
213 qos_
.txtp
.pcr
= rate
;
216 qos_
.rxtp
.traffic_class
= ATM_UBR
;
217 qos_
.txtp
.traffic_class
= ATM_UBR
;
220 qos_
.txtp
.max_sdu
= pktSize
;
222 ACE_UNUSED_ARG (rate
);
223 #endif /* ACE_HAS_FORE_ATM_WS2 || ACE_HAS_FORE_ATM_XTI || ACE_HAS_LINUX_ATM */
227 ACE_ATM_QoS::set_cbr_rate (int rate
,
230 ACE_TRACE ("ACE_ATM_QoS::set_cbr_rate");
231 #if defined (ACE_HAS_FORE_ATM_WS2)
233 AAL_PARAMETERS_IE ie_aalparams;
234 ATM_TRAFFIC_DESCRIPTOR_IE ie_td;
235 ATM_BROADBAND_BEARER_CAPABILITY_IE ie_bbc;
236 ATM_QOS_CLASS_IE ie_qos;
241 ACE_OS::printf( "ATM_QoS(set_cbr_rate): set rate to %d c/s\n", rate
);
243 // Setting up cbr parameters ...
245 FORE has changed this - we no longer specify QoS this way
246 ie_aalparams.AALType = AALTYPE_5;
247 ie_aalparams.AALSpecificParameters.AAL5Parameters.ForwardMaxCPCSSDUSize
248 = pktSize; // was 1516;
249 ie_aalparams.AALSpecificParameters.AAL5Parameters.BackwardMaxCPCSSDUSize
250 = pktSize; // was 1516;
251 ie_aalparams.AALSpecificParameters.AAL5Parameters.Mode = AAL5_MODE_MESSAGE;
252 ie_aalparams.AALSpecificParameters.AAL5Parameters.SSCSType = AAL5_SSCS_NULL;
254 size = sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(AAL_PARAMETERS_IE);
256 ie_td.Forward.PeakCellRate_CLP0 = SAP_FIELD_ABSENT;
257 ie_td.Forward.PeakCellRate_CLP01 = rate;
258 ie_td.Forward.SustainableCellRate_CLP0 = SAP_FIELD_ABSENT;
259 ie_td.Forward.SustainableCellRate_CLP01 = SAP_FIELD_ABSENT;
260 ie_td.Forward.MaxBurstSize_CLP0 = SAP_FIELD_ABSENT;
261 ie_td.Forward.MaxBurstSize_CLP01 = SAP_FIELD_ABSENT;
262 ie_td.Forward.Tagging = SAP_FIELD_ABSENT;
264 ie_td.Backward.PeakCellRate_CLP0 = SAP_FIELD_ABSENT;
265 ie_td.Backward.PeakCellRate_CLP01 = rate;
266 ie_td.Backward.SustainableCellRate_CLP0 = SAP_FIELD_ABSENT;
267 ie_td.Backward.SustainableCellRate_CLP01 = SAP_FIELD_ABSENT;
268 ie_td.Backward.MaxBurstSize_CLP0 = SAP_FIELD_ABSENT;
269 ie_td.Backward.MaxBurstSize_CLP01 = SAP_FIELD_ABSENT;
270 ie_td.Backward.Tagging = SAP_FIELD_ABSENT;
272 ie_td.BestEffort = 0; // Note: this must be set to zero for CBR.
274 size += sizeof( Q2931_IE_TYPE ) +
276 sizeof( ATM_TRAFFIC_DESCRIPTOR_IE );
278 ie_bbc.BearerClass = BCOB_X;
279 ie_bbc.TrafficType = TT_CBR;
280 ie_bbc.TimingRequirements = TR_END_TO_END;
281 ie_bbc.ClippingSusceptability = CLIP_NOT;
282 ie_bbc.UserPlaneConnectionConfig = UP_P2P;
284 size += sizeof(Q2931_IE_TYPE) +
286 sizeof(ATM_BROADBAND_BEARER_CAPABILITY_IE);
288 ie_qos.QOSClassForward = QOS_CLASS1;
289 ie_qos.QOSClassBackward = QOS_CLASS1; // This may not be really used
290 // since we only simplex data xfer.
292 size += sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(ATM_QOS_CLASS_IE);
294 qos_.ProviderSpecific.buf = (char *) ACE_OS::malloc(size);
295 if (qos_.ProviderSpecific.buf == 0) {
296 ACELIB_ERROR((LM_ERROR,
297 ACE_TEXT ("ACE_ATM_QoS::ACE_ATM_QoS: Unable to allocate %d bytes for qos_.ProviderSpecific.buf\n"),
301 qos_.ProviderSpecific.len = size;
302 ACE_OS::memset(qos_.ProviderSpecific.buf, 0, size);
304 ie_ptr = (Q2931_IE *) qos_.ProviderSpecific.buf;
305 ie_ptr->IEType = IE_AALParameters;
306 ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) +
308 sizeof( AAL_PARAMETERS_IE );
309 ACE_OS::memcpy(ie_ptr->IE, &ie_aalparams, sizeof(AAL_PARAMETERS_IE));
311 ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength);
312 ie_ptr->IEType = IE_TrafficDescriptor;
313 ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) +
315 sizeof( ATM_TRAFFIC_DESCRIPTOR_IE );
316 ACE_OS::memcpy(ie_ptr->IE, &ie_td, sizeof(ATM_TRAFFIC_DESCRIPTOR_IE));
318 ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength);
319 ie_ptr->IEType = IE_BroadbandBearerCapability;
320 ie_ptr->IELength = sizeof( Q2931_IE_TYPE ) +
322 sizeof( ATM_BROADBAND_BEARER_CAPABILITY_IE );
323 ACE_OS::memcpy( ie_ptr->IE,
325 sizeof( ATM_BROADBAND_BEARER_CAPABILITY_IE ));
327 ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength);
328 ie_ptr->IEType = IE_QOSClass;
329 ie_ptr->IELength = sizeof(Q2931_IE_TYPE) + sizeof(ULONG) +
330 sizeof(ATM_QOS_CLASS_IE);
331 ACE_OS::memcpy(ie_ptr->IE, &ie_qos, sizeof(ATM_QOS_CLASS_IE));
334 const int BYTES_PER_ATM_CELL
= 53;
335 ACE_OS::memset(&qos_
, 0, sizeof(ATM_QoS
));
336 // Setting the token rate sets the minimum rate. 3 Mbits/sec seems too high.
337 // Certainly for Vaudeville audio, we only need about 1000 c/s which is
338 // 424000 bits/sec which is 53000 bytes/sec.
339 //qos_.SendingFlowspec.TokenRate = 3*(1024*128); // 3Mbits/sec
340 qos_
.SendingFlowspec
.TokenRate
= 53000; // 1000 cells/sec
341 qos_
.SendingFlowspec
.TokenBucketSize
= 32*1024; // our block size
342 //ourQos.SendingFlowspec.PeakBandwidth = ourQos.SendingFlowspec.TokenRate;
343 qos_
.SendingFlowspec
.ServiceType
= SERVICETYPE_GUARANTEED
;
344 // Peak bandwidth is in bytes/sec. The rate is specified in cells/sec so
345 // we need to convert from cells/sec to bytes/sec (i.e., multiply by 53).
346 qos_
.SendingFlowspec
.PeakBandwidth
= rate
* BYTES_PER_ATM_CELL
;
347 qos_
.SendingFlowspec
.Latency
= -1; // we don't care too much
348 qos_
.SendingFlowspec
.DelayVariation
= -1; // we don't care too much
349 // no provider-specific data allowed on ATM
350 qos_
.ProviderSpecific
.buf
=0;
351 qos_
.ProviderSpecific
.len
=0;
352 // unidirectional P2MP; we don't need to setup the Receiving flowspec
354 //qos_.SendingFlowspec.TokenRate = 0xffffffff;
355 //qos_.SendingFlowspec.TokenBucketSize = 0xffffffff;
356 //qos_.SendingFlowspec.PeakBandwidth = 0xffffffff;
357 //qos_.SendingFlowspec.Latency = 0xffffffff;
358 //qos_.SendingFlowspec.DelayVariation = 0xffffffff;
359 //qos_.SendingFlowspec.ServiceType = SERVICETYPE_BESTEFFORT;
360 // This will most probably be ignored by the service provider.
361 //qos_.SendingFlowspec.MaxSduSize = 0xffffffff;
362 //qos_.SendingFlowspec.MinimumPolicedSize = 0xffffffff;
364 //qos_.ReceivingFlowspec.TokenRate = 0xffffffff;
365 //qos_.ReceivingFlowspec.TokenBucketSize = 0xffffffff;
366 //qos_.ReceivingFlowspec.PeakBandwidth = 0xffffffff;
367 //qos_.ReceivingFlowspec.Latency = 0xffffffff;
368 //qos_.ReceivingFlowspec.DelayVariation = 0xffffffff;
369 //qos_.ReceivingFlowspec.ServiceType = SERVICETYPE_BESTEFFORT;
370 // This will most probably be ignored by the service provider.
371 //qos_.ReceivingFlowspec.MaxSduSize = 0xffffffff;
372 //qos_.ReceivingFlowspec.MinimumPolicedSize = 0;
375 ACE_Flow_Spec send_fspec( 0xffffffff,
380 SERVICETYPE_BESTEFFORT,
381 // This will most probably ignored by SP.
385 ACE_DEFAULT_THREAD_PRIORITY ),
386 recv_fspec( 0xffffffff,
391 SERVICETYPE_BESTEFFORT,
392 // This will most probably ignored by SP.
396 ACE_DEFAULT_THREAD_PRIORITY );
398 qos_.sending_flowspec( send_fspec );
399 qos_.receiving_flowspec( recv_fspec );
401 #elif defined (ACE_HAS_FORE_ATM_XTI)
402 ACE_UNUSED_ARG (rate
);
403 ACE_UNUSED_ARG (pktSize
);
404 #elif defined (ACE_HAS_LINUX_ATM)
405 ACE_UNUSED_ARG (pktSize
);
407 qos_
.rxtp
.traffic_class
= ATM_CBR
;
408 qos_
.rxtp
.pcr
= rate
;
409 qos_
.txtp
.traffic_class
= ATM_CBR
;
410 qos_
.txtp
.pcr
= rate
;
412 ACE_UNUSED_ARG (rate
);
413 #endif /* ACE_HAS_FORE_ATM_WS2 || ACE_HAS_FORE_ATM_XTI || ACE_HAS_LINUX_ATM */
417 ACE_ATM_QoS::set_rate (ACE_HANDLE fd
,
421 ACE_TRACE ("ACE_ATM_QoS::set_rate");
422 #if defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM)
423 set_cbr_rate( rate
);
425 ACE_UNUSED_ARG( fd
);
426 ACE_UNUSED_ARG( flags
);
427 #elif defined (ACE_HAS_FORE_ATM_XTI)
429 qos_
.buf
= construct_options(fd
,
435 ACE_UNUSED_ARG (rate
);
436 #endif /* ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM || ACE_HAS_FORE_ATM_XTI */
440 ACE_ATM_QoS::construct_options (ACE_HANDLE fd
,
445 #if defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM)
447 ACE_UNUSED_ARG (rate
);
448 ACE_UNUSED_ARG (flags
);
449 ACE_UNUSED_ARG (len
);
451 #elif defined (ACE_HAS_FORE_ATM_XTI)
452 struct t_opthdr
*popt
;
457 if (ACE_OS::t_getinfo (fd
, &info
) == -1)
459 ACE_OS::t_error ("t_getinfo");
463 buf
= (char *) ACE_OS::malloc (info
.options
);
466 ACELIB_ERROR_RETURN ((LM_ERROR
,
467 ACE_TEXT ("Unable to allocate %d bytes for options\n"),
471 popt
= (struct t_opthdr
*) buf
;
473 if (flags
& OPT_FLAGS_CPID
)
475 // This constructs the T_ATM_ORIG_ADDR option, which is used to
476 // signal the UNI 3.1 Calling Party ID Information Element.
477 t_atm_addr
*source_addr
;
479 popt
->len
= sizeof (struct t_opthdr
) + sizeof (t_atm_addr
);
480 popt
->level
= T_ATM_SIGNALING
;
481 popt
->name
= T_ATM_ORIG_ADDR
;
485 (t_atm_addr
*)((char *) popt
+ sizeof (struct t_opthdr
));
487 source_addr
->address_format
= T_ATM_ENDSYS_ADDR
;
488 source_addr
->address_length
= ATMNSAP_ADDR_LEN
;
490 ATMSAPAddress local_addr
;
491 struct t_bind boundaddr
;
493 boundaddr
.addr
.maxlen
= sizeof(local_addr
);
494 boundaddr
.addr
.buf
= (char *) &local_addr
;
496 //if (ACE_OS::t_getprotaddr(fd, &boundaddr, 0) < 0) {
497 if (ACE_OS::t_getname(fd
,
501 ACE_OS::t_error("t_getname (local_address)");
502 ACELIB_ERROR ((LM_ERROR
,
503 ACE_TEXT ("Can't get local address!\n")));
508 ACE_OS::memcpy(source_addr
->address
,
509 local_addr
.sap
.t_atm_sap_addr
.address
,
512 popt
= T_OPT_NEXTHDR (buf
, info
.options
, popt
);
515 // This constructs all options necessary (bearer cap., QoS, and
516 // Traffic Descriptor) to signal for a CBR connection with the
517 // specified QoS in kbit/sec., and/or specify a PMP connection.
519 // For FORE 200e cards, the adapter shapes traffic to CBR with rate
520 // equal to PCR CLP=0+1 (traffic.forward.PCR_all_traffic)
522 qos_cells
= (rate
* 1000) / (48*8);
524 if ((qos_cells
> 0 && qos_cells
< LINE_RATE
)
525 || (ACE_BIT_ENABLED (flags
, OPT_FLAGS_PMP
)))
527 struct t_atm_bearer
*bearer
;
528 struct t_atm_traffic
*traffic
;
530 // T_ATM_BEARER_CAP: Broadband bearer capability
531 popt
->len
= sizeof (struct t_opthdr
) + sizeof (struct t_atm_bearer
);
532 popt
->level
= T_ATM_SIGNALING
;
533 popt
->name
= T_ATM_BEARER_CAP
;
536 bearer
= (struct t_atm_bearer
*)((char *) popt
+
537 sizeof (struct t_opthdr
));
538 bearer
->bearer_class
= T_ATM_CLASS_X
;
542 bearer
->traffic_type
= T_ATM_CBR
;
543 bearer
->timing_requirements
= T_ATM_END_TO_END
;
547 bearer
->traffic_type
= 0; // UBR
548 bearer
->timing_requirements
= 0;
550 bearer
->clipping_susceptibility
= T_ATM_NULL
;
552 if (ACE_BIT_ENABLED (flags
, OPT_FLAGS_PMP
))
553 bearer
->connection_configuration
= T_ATM_1_TO_MANY
;
555 bearer
->connection_configuration
= T_ATM_1_TO_1
;
557 popt
= T_OPT_NEXTHDR (buf
, info
.options
, popt
);
559 // T_ATM_TRAFFIC: traffic descriptor
560 popt
->len
= sizeof (struct t_opthdr
) + sizeof (struct t_atm_traffic
);
561 popt
->level
= T_ATM_SIGNALING
;
562 popt
->name
= T_ATM_TRAFFIC
;
565 traffic
= (struct t_atm_traffic
*)((char *) popt
+
566 sizeof (struct t_opthdr
));
568 traffic
->forward
.PCR_high_priority
= T_ATM_ABSENT
;
569 traffic
->forward
.PCR_all_traffic
= qos_cells
? qos_cells
: LINE_RATE
;
570 traffic
->forward
.SCR_high_priority
= T_ATM_ABSENT
;
571 traffic
->forward
.SCR_all_traffic
= T_ATM_ABSENT
;
572 traffic
->forward
.MBS_high_priority
= T_ATM_ABSENT
;
573 traffic
->forward
.MBS_all_traffic
= T_ATM_ABSENT
;
574 traffic
->forward
.tagging
= T_NO
;
576 traffic
->backward
.PCR_high_priority
= T_ATM_ABSENT
;
577 traffic
->backward
.PCR_all_traffic
=
578 (ACE_BIT_ENABLED (flags
, OPT_FLAGS_PMP
))
579 ? 0 : qos_cells
? qos_cells
: LINE_RATE
;
580 traffic
->backward
.SCR_high_priority
= T_ATM_ABSENT
;
581 traffic
->backward
.SCR_all_traffic
= T_ATM_ABSENT
;
582 traffic
->backward
.MBS_high_priority
= T_ATM_ABSENT
;
583 traffic
->backward
.MBS_all_traffic
= T_ATM_ABSENT
;
584 traffic
->backward
.tagging
= T_NO
;
586 traffic
->best_effort
= qos_cells
? T_NO
: T_YES
;
588 popt
= T_OPT_NEXTHDR (buf
,
593 if (qos_cells
> 0 && qos_cells
< LINE_RATE
)
595 struct t_atm_qos
*qos
;
597 // T_ATM_QOS: Quality of Service
598 popt
->len
= sizeof (struct t_opthdr
) + sizeof (struct t_atm_qos
);
599 popt
->level
= T_ATM_SIGNALING
;
600 popt
->name
= T_ATM_QOS
;
603 qos
= (struct t_atm_qos
*)((char *) popt
+ sizeof (struct t_opthdr
));
604 qos
->coding_standard
= T_ATM_ITU_CODING
;
605 qos
->forward
.qos_class
= T_ATM_QOS_CLASS_1
;
606 qos
->backward
.qos_class
= T_ATM_QOS_CLASS_1
;
608 popt
= T_OPT_NEXTHDR (buf
, info
.options
, popt
);
611 // Return actual size of options and option buffer to user.
612 *len
= (char *) popt
- buf
;
617 ACE_UNUSED_ARG (rate
);
618 ACE_UNUSED_ARG (flag
);
619 ACE_UNUSED_ARG (len
);
621 #endif /* ACE_HAS_FORE_ATM_WS2 */
624 ACE_END_VERSIONED_NAMESPACE_DECL
626 #endif /* ACE_HAS_ATM */