source: trunk/src/ws2_32/socketodin.cpp@ 7023

Last change on this file since 7023 was 7023, checked in by sandervl, 24 years ago

getsockopt update

File size: 3.1 KB
Line 
1/* $Id: socketodin.cpp,v 1.2 2001-10-11 19:24:38 sandervl Exp $ */
2
3#include <odin.h>
4#include <winsock2.h>
5#include <ws2tcpip.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//******************************************************************************
Note: See TracBrowser for help on using the repository browser.