source: trunk/src/ws2_32/socketodin.cpp

Last change on this file was 21456, checked in by dmik, 15 years ago

WinSock2: IPPROTO_IP option constants have different values than in Winsock1.1 (closes ticket:10).

File size: 3.5 KB
Line 
1/* $Id: socketodin.cpp,v 1.3 2002-07-03 09:47:37 sandervl Exp $ */
2
3#include "odin.h"
4#include "winsock2.h"
5#include "ws2defs.h"
6#include "debugtools.h"
7#include "misc.h"
8
9ODINDEBUGCHANNEL(WS2_32-SOCKETODIN)
10
11//******************************************************************************
12//******************************************************************************
13ODINFUNCTION5(int,WS2setsockopt,
14 SOCKET,s,
15 int,level,
16 int,optname,
17 const char *,optval,
18 int,optlen)
19{
20 int ret;
21
22 if(level == IPPROTO_IP) {
23 switch(optname) {
24 case IP_OPTIONS_WS2: /* set/get IP options */
25 case IP_HDRINCL_WS2: /* header is included with data */
26 case IP_TOS_WS2: /* IP type of service and preced*/
27 case IP_TTL_WS2: /* IP time to live */
28 case IP_MULTICAST_IF_WS2: /* set/get IP multicast i/f */
29 case IP_MULTICAST_TTL_WS2: /* set/get IP multicast ttl */
30 case IP_MULTICAST_LOOP_WS2: /* set/get IP multicast loopback */
31 case IP_ADD_MEMBERSHIP_WS2: /* add an IP group membership */
32 case IP_DROP_MEMBERSHIP_WS2: /* drop an IP group membership */
33 case IP_DONTFRAGMENT_WS2: /* don't fragment IP datagrams */
34 optname = WS2_IPPROTO_OPT(optname);
35 break;
36
37 default:
38 dprintf(("setsockopt: IPPROTO_IP, unknown option %x", optname));
39 WSASetLastError(WSAENOPROTOOPT);
40 return SOCKET_ERROR;
41 }
42 }
43 ret = setsockopt(s, level, optname, (char *)optval, optlen);
44 return ret;
45}
46//******************************************************************************
47//******************************************************************************
48ODINFUNCTION5(int,WS2getsockopt,
49 SOCKET, s,
50 int, level,
51 int, optname,
52 char *, optval,
53 int *,optlen)
54{
55 int ret;
56
57 if(level == IPPROTO_IP) {
58 switch(optname) {
59 case IP_OPTIONS_WS2: /* set/get IP options */
60 case IP_HDRINCL_WS2: /* header is included with data */
61 case IP_TOS_WS2: /* IP type of service and preced*/
62 case IP_TTL_WS2: /* IP time to live */
63 case IP_MULTICAST_IF_WS2: /* set/get IP multicast i/f */
64 case IP_MULTICAST_TTL_WS2: /* set/get IP multicast ttl */
65 case IP_MULTICAST_LOOP_WS2: /* set/get IP multicast loopback */
66 case IP_ADD_MEMBERSHIP_WS2: /* add an IP group membership */
67 case IP_DROP_MEMBERSHIP_WS2: /* drop an IP group membership */
68 case IP_DONTFRAGMENT_WS2: /* don't fragment IP datagrams */
69 optname = WS2_IPPROTO_OPT(optname);
70 break;
71
72 default:
73 dprintf(("getsockopt: IPPROTO_IP, unknown option %x", optname));
74 WSASetLastError(WSAENOPROTOOPT);
75 return SOCKET_ERROR;
76 }
77 }
78 ret = getsockopt(s, level, optname, (char *)optval, optlen);
79 return ret;
80}
81//******************************************************************************
82//******************************************************************************
83int WIN32API WSASendDisconnect(SOCKET s, LPWSABUF lpOutboundDisconnectData)
84{
85 dprintf(("WSASendDisconnect %x %x STUB", s, lpOutboundDisconnectData));
86 WSASetLastError(NO_ERROR);
87 return NO_ERROR;
88}
89//******************************************************************************
90//******************************************************************************
Note: See TracBrowser for help on using the repository browser.