xref: /reactos/dll/win32/ws2_32/src/qos.c (revision 3e1f4074)
1 /*
2  * COPYRIGHT:   See COPYING in the top level directory
3  * PROJECT:     ReactOS WinSock 2 API
4  * FILE:        dll/win32/ws2_32/src/qos.c
5  * PURPOSE:     QoS Support
6  * PROGRAMMER:  Alex Ionescu (alex@relsoft.net)
7  */
8 
9 /* INCLUDES ******************************************************************/
10 
11 #include <ws2_32.h>
12 
13 #define NDEBUG
14 #include <debug.h>
15 
16 /* FUNCTIONS *****************************************************************/
17 
18 /*
19  * @implemented
20  */
21 BOOL
22 WSAAPI
23 WSAGetQOSByName(IN SOCKET s,
24                 IN OUT LPWSABUF lpQOSName,
25                 OUT LPQOS lpQOS)
26 {
27     PWSSOCKET Socket;
28     INT Status;
29     INT ErrorCode;
30     DPRINT("WSAGetQOSByName: %lx, %p\n", s, lpQOSName);
31 
32     /* Check for WSAStartup */
33     if ((ErrorCode = WsQuickProlog()) == ERROR_SUCCESS)
34     {
35         /* Get the Socket Context */
36         if ((Socket = WsSockGetSocket(s)))
37         {
38             /* Make the call */
39             Status = Socket->Provider->Service.lpWSPGetQOSByName(s,
40                                                                  lpQOSName,
41                                                                  lpQOS,
42                                                                  &ErrorCode);
43 
44             /* Deference the Socket Context */
45             WsSockDereference(Socket);
46 
47             /* Return Provider Value */
48             if (Status == ERROR_SUCCESS) return Status;
49 
50             /* If everything seemed fine, then the WSP call failed itself */
51             if (ErrorCode == NO_ERROR) ErrorCode = WSASYSCALLFAILURE;
52         }
53         else
54         {
55             /* No Socket Context Found */
56             ErrorCode = WSAENOTSOCK;
57         }
58     }
59 
60     /* Return with an Error */
61     SetLastError(ErrorCode);
62     return FALSE;
63 }
64