diff options
author | ruibiao <ruibiao@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-06-16 20:59:59 +0000 |
---|---|---|
committer | ruibiao <ruibiao@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-06-16 20:59:59 +0000 |
commit | b8ab7a04f984ed8fb9e04e6f6b485d58d16513b1 (patch) | |
tree | bded5ec0246310f18b9161dd8f24172918845ed9 /ace | |
parent | 957c3e7aee2fb9cd4f9bbdcee9a97f6ae8232281 (diff) | |
download | ATCD-b8ab7a04f984ed8fb9e04e6f6b485d58d16513b1.tar.gz |
Add ACE_QoS class for ATM. Changes ATM_Addr class to add support for WinSock2 platforms.
Diffstat (limited to 'ace')
-rw-r--r-- | ace/ATM_Addr.cpp | 142 | ||||
-rw-r--r-- | ace/ATM_Addr.h | 11 | ||||
-rw-r--r-- | ace/ATM_Addr.i | 8 | ||||
-rw-r--r-- | ace/QoS.cpp | 130 | ||||
-rw-r--r-- | ace/QoS.h | 70 |
5 files changed, 332 insertions, 29 deletions
diff --git a/ace/ATM_Addr.cpp b/ace/ATM_Addr.cpp index dbd94db1acb..8486cf8c29a 100644 --- a/ace/ATM_Addr.cpp +++ b/ace/ATM_Addr.cpp @@ -13,7 +13,7 @@ ACE_RCSID(ace, ATM_Addr, "$Id$") ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Addr) -#if defined (ACE_HAS_FORE_ATM_XTI) +#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) #define BHLI_MAGIC "FORE_ATM" // This is line rate in cells/s for an OC-3 MM interface. const long ACE_ATM_Addr::LINE_RATE = 353207; @@ -25,16 +25,16 @@ const long ACE_ATM_Addr::LINE_RATE = 0L; const int ACE_ATM_Addr::OPT_FLAGS_CPID = 0; const int ACE_ATM_Addr::OPT_FLAGS_PMP = 0; const int ACE_ATM_Addr::DEFAULT_SELECTOR = 0x0; -#endif /* ACE_HAS_FORE_ATM_XTI */ +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */ // Default constructor ACE_ATM_Addr::ACE_ATM_Addr (unsigned char selector) -#if defined (ACE_HAS_FORE_ATM_XTI) +#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) : ACE_Addr (AF_ATM, #else : ACE_Addr (AF_UNSPEC, -#endif /* ACE_HAS_FORE_ATM_XTI */ +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */ sizeof this->atm_addr_) { // ACE_TRACE ("ACE_ATM_Addr::ACE_ATM_Addr"); @@ -48,11 +48,11 @@ ACE_ATM_Addr::ACE_ATM_Addr (unsigned char selector) ACE_ATM_Addr::ACE_ATM_Addr (const ACE_ATM_Addr &sap, unsigned char selector) -#if defined (ACE_HAS_FORE_ATM_XTI) +#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) : ACE_Addr (AF_ATM, #else : ACE_Addr (AF_UNSPEC, -#endif /* ACE_HAS_FORE_ATM_XTI */ +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */ sizeof this->atm_addr_) { ACE_TRACE ("ACE_ATM_Addr::ACE_ATM_Addr"); @@ -61,11 +61,11 @@ ACE_ATM_Addr::ACE_ATM_Addr (const ACE_ATM_Addr &sap, ACE_ATM_Addr::ACE_ATM_Addr (const ATMSAPAddress *sap, unsigned char selector) -#if defined (ACE_HAS_FORE_ATM_XTI) +#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) : ACE_Addr (AF_ATM, #else : ACE_Addr (AF_UNSPEC, -#endif /* ACE_HAS_FORE_ATM_XTI */ +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */ sizeof this->atm_addr_) { ACE_TRACE ("ACE_ATM_Addr::ACE_ATM_Addr"); @@ -74,11 +74,11 @@ ACE_ATM_Addr::ACE_ATM_Addr (const ATMSAPAddress *sap, ACE_ATM_Addr::ACE_ATM_Addr (const ASYS_TCHAR sap[], unsigned char selector) -#if defined (ACE_HAS_FORE_ATM_XTI) +#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) : ACE_Addr (AF_ATM, #else : ACE_Addr (AF_UNSPEC, -#endif /* ACE_HAS_FORE_ATM_XTI */ +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */ sizeof this->atm_addr_) { ACE_TRACE ("ACE_ATM_Addr::ACE_ATM_Addr"); @@ -113,9 +113,24 @@ ACE_ATM_Addr::init (unsigned char selector) ACE_OS::memcpy (atm_addr_.sap.t_atm_sap_appl.ID.user_defined_ID, BHLI_MAGIC, sizeof atm_addr_.sap.t_atm_sap_appl.ID); +#elif defined (ACE_HAS_FORE_ATM_WS2) + atm_addr_.satm_number.Addr[ ATM_ADDR_SIZE - 1 ] = ( char )selector; + atm_addr_.satm_family = AF_ATM; + atm_addr_.satm_number.AddressType = ATM_NSAP; + atm_addr_.satm_number.NumofDigits = ATM_ADDR_SIZE; + atm_addr_.satm_blli.Layer2Protocol = SAP_FIELD_ABSENT; + atm_addr_.satm_blli.Layer3Protocol = SAP_FIELD_ABSENT; + atm_addr_.satm_bhli.HighLayerInfoType = SAP_FIELD_ABSENT; + + // N2K the correspondence (Ruibiao) + //atm_addr_.sap.t_atm_sap_appl.SVE_tag = (int8_t) T_ATM_PRESENT; + //atm_addr_.sap.t_atm_sap_appl.ID_type = (u_int8_t) T_ATM_USER_APP_ID; + //ACE_OS::memcpy (atm_addr_.sap.t_atm_sap_appl.ID.user_defined_ID, + // BHLI_MAGIC, + // sizeof atm_addr_.sap.t_atm_sap_appl.ID); #else ACE_UNUSED_ARG (selector); -#endif /* ACE_HAS_FORE_ATM_XTI */ +#endif /* ACE_HAS_FORE_ATM_XTI && ACE_HAS_FORE_ATM_WS2 */ } int @@ -129,9 +144,9 @@ ACE_ATM_Addr::set (const ACE_ATM_Addr &sap, this->ACE_Addr::base_set (sap.get_type (), sap.get_size ()); -#if defined (ACE_HAS_FORE_ATM_XTI) +#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) ACE_ASSERT (sap.get_type () == AF_ATM); -#endif /* ACE_HAS_FORE_ATM_XTI */ +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */ (void) ACE_OS::memcpy ((void *) &this->atm_addr_, (void *) &sap.atm_addr_, @@ -147,11 +162,11 @@ ACE_ATM_Addr::set (const ATMSAPAddress *sap, this->init (selector); -#if defined (ACE_HAS_FORE_ATM_XTI) +#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) this->ACE_Addr::base_set (AF_ATM, #else this->ACE_Addr::base_set (AF_UNSPEC, -#endif /* ACE_HAS_FORE_ATM_XTI */ +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */ sizeof (*sap)); (void) ACE_OS::memcpy ((void *) &this->atm_addr_, @@ -182,11 +197,11 @@ ACE_ATM_Addr::string_to_addr (const ASYS_TCHAR sap[]) { ACE_TRACE ("ACE_ATM_Addr::string_to_addr"); -#if defined (ACE_HAS_FORE_ATM_XTI) +#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) this->ACE_Addr::base_set (AF_ATM, #else this->ACE_Addr::base_set (AF_UNSPEC, -#endif /* ACE_HAS_FORE_ATM_XTI */ +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */ sizeof this->atm_addr_); #if defined (ACE_HAS_FORE_ATM_XTI) struct hostent *entry; @@ -211,17 +226,61 @@ ACE_ATM_Addr::string_to_addr (const ASYS_TCHAR sap[]) ATMNSAP_ADDR_LEN); } else +#elif defined (ACE_HAS_FORE_ATM_WS2) + // WinSock2 part (Ruibiao) + DWORD dwValue; + HANDLE hLookup; + WSAQUERYSETW qsRestrictions; + CSADDR_INFO csaBuffer; + WCHAR tmpWStr[100]; + + MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, sap, -1, tmpWStr, 100); + + csaBuffer.LocalAddr.iSockaddrLength = sizeof (struct sockaddr_atm); + csaBuffer.LocalAddr.lpSockaddr = (struct sockaddr *)atm_addr_; + csaBuffer.RemoteAddr.iSockaddrLength = sizeof (struct sockaddr_atm); + csaBuffer.RemoteAddr.lpSockaddr = (struct sockaddr *) atm_addr; + + qsRestrictions.dwSize = sizeof (WSAQUERYSETW); + qsRestrictions.lpszServiceInstanceName = NULL; + qsRestrictions.lpServiceClassId = &FORE_NAME_CLASS; + qsRestrictions.lpVersion = NULL; + qsRestrictions.lpszComment = NULL; + qsRestrictions.dwNameSpace = FORE_NAME_SPACE; + qsRestrictions.lpNSProviderId = NULL; + qsRestrictions.lpszContext = L""; + qsRestrictions.dwNumberOfProtocols = 0; + qsRestrictions.lpafpProtocols = NULL; + qsRestrictions.lpszQueryString = tmpWStr; + qsRestrictions.dwNumberOfCsAddrs = 1; + qsRestrictions.lpcsaBuffer = &csaBuffer; + qsRestrictions.lpBlob = NULL; //&blob; + + if (WSALookupServiceBeginW(&qsRestrictions, LUP_RETURN_ALL, &hLookup) == SOCKET_ERROR) { + ACE_OS::printf("Error: WSALookupServiceBeginW failed! %d\n",WSAGetLastError()); + return -1; + } + + dwValue = sizeof (WSAQUERYSETW); + + if (WSALookupServiceNextW ( hLookup, 0, &dwValue, &qsRestrictions) == SOCKET_ERROR) { + ACE_OS::printf ("Error: WSALookupServiceNextW failed! %d\n", WSAGetLastError()); + return -1; + } + + if (WSALookupServiceEnd (hLookup) == SOCKET_ERROR) { + ACE_OS::printf("Error : WSALookupServiceEnd failed! %d \n", WSAGetLastError()); #else ACE_UNUSED_ARG (sap); -#endif /* ACE_HAS_FORE_ATM_XTI */ +#endif /* ACE_HAS_FORE_ATM_XTI && ACE_HAS_FORE_ATM_WS2 */ { errno = EINVAL; return -1; } -#if defined (ACE_HAS_FORE_ATM_XTI) +#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) return 0; -#endif /* ACE_HAS_FORE_ATM_XTI */ +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 */ } // Transform the current address into string format. @@ -251,11 +310,25 @@ ACE_ATM_Addr::addr_to_string (ASYS_TCHAR addr[], ACE_OS::strcpy(addr, buffer); return 0; +#elif defined (ACE_HAS_FORE_ATM_WS2) + //WinSock2 part + ASYS_TCHAR buffer[MAXNAMELEN + 1]; + int i; + + if ( addrlen < ATM_ADDR_SIZE + 1 ) + return -1; + + for ( i = 0; i < ATM_ADDR_SIZE; i++ ) + ACE_OS::sprintf( buffer, ASYS_TEXT( "%02x." ), atm_addr_.satm_number.Addr[ i ]); + buffer[ ATM_ADDR_SIZE ] = '\0'; + ACE_OS::strcpy( addr, buffer ); + + return 0; #else ACE_UNUSED_ARG (addr); ACE_UNUSED_ARG (addrlen); return -1; -#endif /* ACE_HAS_FORE_ATM_XTI */ +#endif /* ACE_HAS_FORE_ATM_XTI && ACE_HAS_FORE_ATM_WS2 */ } const ASYS_TCHAR * @@ -275,11 +348,11 @@ ACE_ATM_Addr::set_addr (void *addr, int len) { ACE_TRACE ("ACE_ATM_Addr::set_addr"); -#if defined (ACE_HAS_FORE_ATM_XTI) +#if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) this->ACE_Addr::base_set (AF_ATM, #else this->ACE_Addr::base_set (AF_UNSPEC, -#endif /* ACE_HAS_FORE_ATM_XTI */ +#endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_WS2 */ len); ACE_OS::memcpy ((void *) &this->atm_addr_, (void *) addr, len); @@ -305,9 +378,11 @@ ACE_ATM_Addr::operator == (const ACE_ATM_Addr &sap) const &sap.atm_addr_, #if defined (ACE_HAS_FORE_ATM_XTI) sizeof (struct ATMSAPAddress)) == 0; +#elif defined (ACE_HAS_FORE_ATM_WS2) + sizeof( struct sockaddr_atm )) == 0; #else sizeof (ATMSAPAddress)) == 0; -#endif /* ACE_HAS_FORE_ATM_XTI */ +#endif /* ACE_HAS_FORE_ATM_XTI && ACE_HAS_FORE_ATM_WS2 */ } void @@ -356,11 +431,22 @@ ACE_ATM_Addr::get_local_address (ACE_HANDLE fd, local_addr.sap.t_atm_sap_addr.address, ATMNSAP_ADDR_LEN); return 0; +#elif defined (ACE_HAS_FORE_ATM_WS2) + // WinSock2 part + // No need to make inctl call, just return the address stored + ACE_UNUSED_ARG( fd ); + + ASYS_TCHAR local_addr[ ATM_ADDR_SIZE + 1 ]; + + this -> addr_to_string( &local_addr, ATM_ADDR_SIZE + 1 ); + ACE_OS::memcpy(addr, &local_addr, ATM_ADDR_SIZE); + + return 0; #else ACE_UNUSED_ARG (fd); ACE_UNUSED_ARG (addr); return -1; -#endif /* ACE_HAS_FORE_ATM_XTI */ +#endif /* ACE_HAS_FORE_ATM_XTI && ACE_HAS_FORE_ATM_WS2 */ } char * @@ -517,11 +603,15 @@ ACE_ATM_Addr::construct_options(ACE_HANDLE fd, *optsize = (char *) popt - buf; return buf; +#elif defined (ACE_HAS_FORE_ATM_WS2) + // WinSock Part + // Unlike XTI, WinSock does QoS with a QoS class passed into + // connect call, so it may be better to do this in XXX_Connector #else ACE_UNUSED_ARG (fd); ACE_UNUSED_ARG (qos_kb); ACE_UNUSED_ARG (flags); ACE_UNUSED_ARG (optsize); return 0; -#endif /* ACE_HAS_FORE_ATM_XTI */ +#endif /* ACE_HAS_FORE_ATM_XTI && ACE_HAS_FORE_ATM_WS2 */ } diff --git a/ace/ATM_Addr.h b/ace/ATM_Addr.h index 2f644c3bb95..c1631cd1c37 100644 --- a/ace/ATM_Addr.h +++ b/ace/ATM_Addr.h @@ -27,7 +27,12 @@ #if !defined (ACE_HAS_FORE_ATM_XTI) typedef int ATMSAPAddress; -#endif /* ACE_HAS_FORE_ATM_XTI */ +#elif defined (ACE_HAS_FORE_ATM_WS2) +#include <winsock2.h> +#include <ws2atm.h> + +typedef ATM_ADDRESS ATMSAPAddress; +#endif /* ACE_HAS_FORE_ATM_XTI && ACE_HAS_FORE_ATM_WS2 */ class ACE_Export ACE_ATM_Addr : public ACE_Addr { @@ -145,12 +150,16 @@ protected: // Get the local ATM address. private: +#if defined (ACE_HAS_FORE_ATM_XTI) ATMSAPAddress atm_addr_; // Underlying representation - this may be very // vendor-implementation specific. Other vendors (besides FORE) may // name and define this structure differently. We can work around // that problem when we run into other vendors supporting XTI on top // of ATM. Is this class specific to XTI? Not sure. +#elif defined (ACE_HAS_FORE_ATM_WS2) + struct sockaddr_atm atm_addr_; +#endif // ACE_HAS_FORE_ATM_XTI && ACE_HAS_FORE_ATM_WS2 }; #if defined (__ACE_INLINE__) diff --git a/ace/ATM_Addr.i b/ace/ATM_Addr.i index 0fb582ae719..bb0a215ddc6 100644 --- a/ace/ATM_Addr.i +++ b/ace/ATM_Addr.i @@ -24,9 +24,11 @@ ACE_ATM_Addr::get_selector (void) const ACE_TRACE ("ACE_ATM_Addr::get_selector"); #if defined (ACE_HAS_FORE_ATM_XTI) return atm_addr_.sap.t_atm_sap_addr.address[ATMNSAP_ADDR_LEN - 1]; +#elif defined (ACE_HAS_FORE_ATM_WS2) + return atm_addr_.satm_number.Addr[ ATM_ADDR_SIZE - 1 ]; #else return 0; -#endif /* ACE_HAS_FORE_ATM_XTI */ +#endif /* ACE_HAS_FORE_ATM_XTI && ACE_HAS_FORE_ATM_WS2 */ } ACE_INLINE void @@ -35,7 +37,9 @@ ACE_ATM_Addr::set_selector (unsigned char selector) ACE_TRACE ("ACE_ATM_Addr::set_selector"); #if defined (ACE_HAS_FORE_ATM_XTI) atm_addr_.sap.t_atm_sap_addr.address[ATMNSAP_ADDR_LEN - 1] = selector; +#elif defined (ACE_FORE_ATM_WS2) + atm_addr_.satm_number.Addr[ ATM_ADDR_SIZE - 1 ] = selector; #else ACE_UNUSED_ARG (selector); -#endif /* ACE_HAS_FORE_ATM_XTI */ +#endif /* ACE_HAS_FORE_ATM_XTI && ACE_HAS_FORE_ATM_WS2 */ } diff --git a/ace/QoS.cpp b/ace/QoS.cpp new file mode 100644 index 00000000000..620a58c436f --- /dev/null +++ b/ace/QoS.cpp @@ -0,0 +1,130 @@ +// $Id$ + +#define ACE_BUILD_DLL + +#include "ace/ACE_QoS.h" + +ACE_RCSID( ace, "$Id$" ) + +ACE_ALLOC_HOOK_DEFINE( ACE_QoS ) + +class Ace_Export ACE_QoS +{ + // = TITLE + // Define the basic QoS parameters + +public: + // = Initializattion and termination methods. + // Default + ACE_QoS::ACE_QoS( void ) + { + ACE_TRACE( "ACE_QoS::ACE_QoS" ); + } + + // set CBR rate + int ACE_QoS::set_cbr_rate( int rate ) + { + ACE_TRACE( "ACE_QoS::set_cbr_rate" ); + +#if defined (ACE_HAS_FORE_ATM_WS2) + AAL_PARAMETERS_IE ie_aalparams; + ATM_TRAFFIC_DESCRIPTOR_IE ie_td; + ATM_BROADBAND_BEARER_CAPBILITY_IE ie_bbc; + ATM_QOS_CLASS_IE ie_qos; + Q2931_IE *ie_ptr; + int size; + + ie_aalparams.AALType = AALTYPE_5; + ie_aalparams.AALSpecificParameters.AAL5Parameters.ForwardMaxCPCSSDUSize = 1516; + ie_aalparams.AALSpecificParameters.AAL5Parameters.BackwardMaxCPCSSDUSize = 1516; + ie_aalparams.AALSpecificParameters.AAL5Parameters.Mode = AAL5_MODE_MESSAGE; + ie_aalparams.AALSpecificParameters.AAL5Parameters.SSCSType = AAL5_SSCS_NULL; + + size = sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(AAL_PARAMETERS_IE); + + ie_td.Forward.PeakCellRate_CLP0 = SAP_FIELD_ABSENT; + ie_td.Forward.PeakCellRate_CLP01 = cellRate; + ie_td.Forward.SustainableCellRate_CLP0 = SAP_FIELD_ABSENT; + ie_td.Forward.SustainableCellRate_CLP01 = SAP_FIELD_ABSENT; + ie_td.Forward.MaxBurstSize_CLP0 = SAP_FIELD_ABSENT; + ie_td.Forward.MaxBurstSize_CLP01 = SAP_FIELD_ABSENT; + ie_td.Forward.Tagging = SAP_FIELD_ABSENT; + + ie_td.Backward.PeakCellRate_CLP0 = SAP_FIELD_ABSENT; + ie_td.Backward.PeakCellRate_CLP01 = cellRate; + ie_td.Backward.SustainableCellRate_CLP0 = SAP_FIELD_ABSENT; + ie_td.Backward.SustainableCellRate_CLP01 = SAP_FIELD_ABSENT; + ie_td.Backward.MaxBurstSize_CLP0 = SAP_FIELD_ABSENT; + ie_td.Backward.MaxBurstSize_CLP01 = SAP_FIELD_ABSENT; + ie_td.Backward.Tagging = SAP_FIELD_ABSENT; + + ie_td.BestEffort = 0; // Note: this must be set to zero for CBR + + size += sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(ATM_TRAFFIC_DESCRIPTOR_IE); + + ie_bbc.BearerClass = BCOB_X; + ie_bbc.TrafficType = TT_CBR; + ie_bbc.TimingRequirements = TR_END_TO_END; + ie_bbc.ClippingSusceptability = CLIP_NOT; + ie_bbc.UserPlaneConnectionConfig = UP_P2P; + + size += sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + + sizeof(ATM_BROADBAND_BEARER_CAPABILITY_IE); + + ie_qos.QOSClassForward = QOS_CLASS1; + ie_qos.QOSClassBackward = QOS_CLASS1; + + size += sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(ATM_QOS_CLASS_IE); + + qos_.ProviderSpecific.buf = (char *) malloc(size); + qos_.ProviderSpecific.len = size; + memset(qos_.ProviderSpecific.buf, 0, size); + + ie_ptr = (Q2931_IE *) qos_.ProviderSpecific.buf; + ie_ptr->IEType = IE_AALParameters; + ie_ptr->IELength = sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + + sizeof(AAL_PARAMETERS_IE); + memcpy(ie_ptr->IE, &ie_aalparams, sizeof(AAL_PARAMETERS_IE)); + + ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength); + ie_ptr->IEType = IE_TrafficDescriptor; + ie_ptr->IELength = sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(ATM_TRAFFIC_DESCRIPTOR_IE); + memcpy(ie_ptr->IE, &ie_td, sizeof(ATM_TRAFFIC_DESCRIPTOR_IE)); + + ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength); + ie_ptr->IEType = IE_BroadbandBearerCapability; + ie_ptr->IELength = sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(ATM_BROADBAND_BEARER_CAPABILITY_IE); + memcpy(ie_ptr->IE, &ie_bbc, sizeof(ATM_BROADBAND_BEARER_CAPABILITY_IE)); + + ie_ptr = (Q2931_IE *) ((char *)ie_ptr + ie_ptr->IELength); + ie_ptr->IEType = IE_QOSClass; + ie_ptr->IELength = sizeof(Q2931_IE_TYPE) + sizeof(ULONG) + sizeof(ATM_QOS_CLASS_IE); + memcpy(ie_ptr->IE, &ie_qos, sizeof(ATM_QOS_CLASS_IE)); + + qos_.SendingFlowspec.TokenRate = -1; + qos_.SendingFlowspec.TokenBucketSize = -1; + qos_.SendingFlowspec.PeakBandwidth = -1; + qos_.SendingFlowspec.Latency = -1; + qos_.SendingFlowspec.DelayVariation = -1; + qos_.SendingFlowspec.LevelOfGuarantee = BestEffortService ; + // will most probably be ignored by the service provider + qos_.SendingFlowspec.CostOfCall = 0; + + qos_.ReceivingFlowspec.TokenRate = -1; + qos_.ReceivingFlowspec.TokenBucketSize = -1; + qos_.ReceivingFlowspec.PeakBandwidth = -1; + qos_.ReceivingFlowspec.Latency = -1; + qos_.ReceivingFlowspec.DelayVariation = -1; + qos_.ReceivingFlowspec.LevelOfGuarantee = BestEffortService; + // will most probably be ignored by the service provider + qos_.ReceivingFlowspec.CostOfCall = 0; +#elif defined (ACE_HAS_FORE_ATM_XTI) + // XTI part +#endif // ACE_HAS_FORE_ATM_WS2 && ACE_HAS_FORE_ATM_XTI + } + + QOS ACE_QoS::get_qos( void ) + { + return qos_; + } +} diff --git a/ace/QoS.h b/ace/QoS.h new file mode 100644 index 00000000000..17292afd502 --- /dev/null +++ b/ace/QoS.h @@ -0,0 +1,70 @@ +// $Id$ + +// QoS class definition (refer to WinSock2 QoS) + +#ifndef QOS_H +#define QOS_H + +#include + +#if !defined(ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +class Ace_Export ACE_QoS +{ + // = TITLE + // Define the basic QoS parameters + +public: + // = Initializattion and termination methods. + ACE_QoS( void ); + // Default + + ~ACE_QoS( void ); + // Default dtor + + // set CBR rate + int set_cbr_rate( int ); + + // get QoS struct + QOS get_qos( void ); + +private: +#if defined (ACE_HAS_FORE_ATM_WS2) + // just map to WS2 GQOS struct + QOS qos_; +#elif defined (ACE_HAS_FOR_ATM_XTI) +typedef enum { + BEST_EFFORT, + CONTROLLED_LOAD, + GUARANTEED +} SERVICETYPE; + +typedef struct _flowspec { + int TokeRate; + int TokenBucketSize; + int PeakBandwidth; + int Latency; + int DelayVariation; + SERVICETYPE ServiceType; + int MaxSduSize; + int MinimumPolicedSize; +} FLOWSPEC; + +typedef struct _BUF { + ulong len; + char *buf; +} BUF; + +typedef struct _QualityOfService { + FLOWSPEC SendingFlowspec; + FLOWSPEC ReceivingFlowspec; + BUF ProviderSpecific; +} QOS; + + QOS qos_; +#endif // ACE_HAS_FORE_ATM_WS2 && ACE_HAS_FOREATM_XTI +} + +#endif /* QOS_H */ |