| Index: net/udp/udp_socket_win.cc
|
| diff --git a/net/udp/udp_socket_win.cc b/net/udp/udp_socket_win.cc
|
| index 1f0c337fd4a609fcb783bb0382345a88ab4ecd34..430346cc90e380eb2ab1dc22267b3e9c8fdac27e 100644
|
| --- a/net/udp/udp_socket_win.cc
|
| +++ b/net/udp/udp_socket_win.cc
|
| @@ -752,4 +752,83 @@ int UDPSocketWin::SetMulticastLoopbackMode(bool loopback) {
|
| return OK;
|
| }
|
|
|
| +// setsockopt IP_TOS doesn't work on XP and newer. This code
|
| +// attempts to map DSCP to the GQoS api, which will then
|
| +// of course map it back to DSCP. Unfortunately, this does not
|
| +// give as fine-grained control of the DSCP value as
|
| +// setsockopt does.
|
| +int UDPSocketWin::SetDiffServCodePoint(DiffServCodePoint dscp) {
|
| + QOS qos;
|
| + switch (dscp) {
|
| + case DSCP_NO_CHANGE:
|
| + return OK;
|
| +
|
| + default:
|
| + case DSCP_CS0:
|
| + case DSCP_CS1:
|
| + case DSCP_AF11:
|
| + case DSCP_AF12:
|
| + case DSCP_AF13:
|
| + qos.SendingFlowspec.ServiceType = SERVICETYPE_BESTEFFORT;
|
| + qos.ReceivingFlowspec.ServiceType = SERVICETYPE_BESTEFFORT;
|
| + break;
|
| +
|
| + case DSCP_CS2:
|
| + case DSCP_AF21:
|
| + case DSCP_AF22:
|
| + case DSCP_AF23:
|
| + qos.SendingFlowspec.ServiceType = SERVICETYPE_CONTROLLEDLOAD;
|
| + qos.ReceivingFlowspec.ServiceType = SERVICETYPE_CONTROLLEDLOAD;
|
| + break;
|
| +
|
| + case DSCP_CS3:
|
| + case DSCP_AF31:
|
| + case DSCP_AF32:
|
| + case DSCP_AF33:
|
| + case DSCP_CS4:
|
| + case DSCP_AF41:
|
| + case DSCP_AF42:
|
| + case DSCP_AF43:
|
| + case DSCP_CS5:
|
| + case DSCP_EF:
|
| + case DSCP_CS6:
|
| + qos.SendingFlowspec.ServiceType = SERVICETYPE_GUARANTEED;
|
| + qos.ReceivingFlowspec.ServiceType = SERVICETYPE_GUARANTEED;
|
| + break;
|
| +
|
| + case DSCP_CS7:
|
| + qos.SendingFlowspec.ServiceType = SERVICETYPE_NETWORK_CONTROL;
|
| + qos.ReceivingFlowspec.ServiceType = SERVICETYPE_NETWORK_CONTROL;
|
| + break;
|
| + }
|
| +
|
| + qos.ReceivingFlowspec.TokenRate = 100000000;
|
| + qos.ReceivingFlowspec.TokenBucketSize = QOS_NOT_SPECIFIED;
|
| + qos.ReceivingFlowspec.PeakBandwidth = QOS_NOT_SPECIFIED;
|
| + qos.ReceivingFlowspec.Latency = QOS_NOT_SPECIFIED;
|
| + qos.ReceivingFlowspec.DelayVariation = QOS_NOT_SPECIFIED;
|
| + qos.ReceivingFlowspec.MinimumPolicedSize = QOS_NOT_SPECIFIED;
|
| + qos.ReceivingFlowspec.MaxSduSize = QOS_NOT_SPECIFIED;
|
| +
|
| + // We don't actually know what bandwidth we will be
|
| + // using, try something really high.
|
| + qos.SendingFlowspec.TokenRate = 100000000;
|
| + qos.SendingFlowspec.TokenBucketSize = 100000000;
|
| + qos.SendingFlowspec.PeakBandwidth = 100000000;
|
| + qos.SendingFlowspec.Latency = QOS_NOT_SPECIFIED;
|
| + qos.SendingFlowspec.DelayVariation = QOS_NOT_SPECIFIED;
|
| + qos.SendingFlowspec.MinimumPolicedSize = QOS_NOT_SPECIFIED;
|
| + qos.SendingFlowspec.MaxSduSize = QOS_NOT_SPECIFIED;
|
| +
|
| + qos.ProviderSpecific.len = 0;
|
| + qos.ProviderSpecific.buf = NULL;
|
| + DWORD bytes_returned;
|
| + if (WSAIoctl(socket_, SIO_SET_QOS,
|
| + &qos, sizeof(QOS), NULL, 0,
|
| + &bytes_returned, NULL, NULL)) {
|
| + return MapSystemError(WSAGetLastError());
|
| + }
|
| + return OK;
|
| +}
|
| +
|
| } // namespace net
|
|
|