mirror of
https://github.com/lsalzman/enet
synced 2024-11-21 06:25:59 -07:00
added ENET_SOCKOPT_TTL
This commit is contained in:
parent
311360dbdd
commit
4e69c700d6
3 changed files with 21 additions and 1 deletions
|
@ -62,7 +62,8 @@ typedef enum _ENetSocketOption
|
|||
ENET_SOCKOPT_RCVTIMEO = 6,
|
||||
ENET_SOCKOPT_SNDTIMEO = 7,
|
||||
ENET_SOCKOPT_ERROR = 8,
|
||||
ENET_SOCKOPT_NODELAY = 9
|
||||
ENET_SOCKOPT_NODELAY = 9,
|
||||
ENET_SOCKOPT_TTL = 10
|
||||
} ENetSocketOption;
|
||||
|
||||
typedef enum _ENetSocketShutdown
|
||||
|
|
9
unix.c
9
unix.c
|
@ -348,6 +348,10 @@ enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value)
|
|||
result = setsockopt (socket, IPPROTO_TCP, TCP_NODELAY, (char *) & value, sizeof (int));
|
||||
break;
|
||||
|
||||
case ENET_SOCKOPT_TTL:
|
||||
result = setsockopt (socket, IPPROTO_IP, IP_TTL, (char *) & value, sizeof (int));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -366,6 +370,11 @@ enet_socket_get_option (ENetSocket socket, ENetSocketOption option, int * value)
|
|||
result = getsockopt (socket, SOL_SOCKET, SO_ERROR, value, & len);
|
||||
break;
|
||||
|
||||
case ENET_SOCKOPT_TTL:
|
||||
len = sizeof (int);
|
||||
result = getsockopt (socket, IPPROTO_IP, IP_TTL, (char *) value, & len);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
10
win32.c
10
win32.c
|
@ -8,6 +8,7 @@
|
|||
#include "enet/enet.h"
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
#include <ws2ipdef.h>
|
||||
|
||||
static enet_uint32 timeBase = 0;
|
||||
|
||||
|
@ -231,6 +232,10 @@ enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value)
|
|||
result = setsockopt (socket, IPPROTO_TCP, TCP_NODELAY, (char *) & value, sizeof (int));
|
||||
break;
|
||||
|
||||
case ENET_SOCKOPT_TTL:
|
||||
result = setsockopt (socket, IPPROTO_IP, IP_TTL, (char *) & value, sizeof (int));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -248,6 +253,11 @@ enet_socket_get_option (ENetSocket socket, ENetSocketOption option, int * value)
|
|||
result = getsockopt (socket, SOL_SOCKET, SO_ERROR, (char *) value, & len);
|
||||
break;
|
||||
|
||||
case ENET_SOCKOPT_TTL:
|
||||
len = sizeof(int);
|
||||
result = getsockopt (socket, IPPROTO_IP, IP_TTL, (char *) value, & len);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue