Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ENET_SOCKOPT_TOS for IP_TOS (Type of Service) #265

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/enet/enet.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ typedef enum _ENetSocketOption
ENET_SOCKOPT_SNDTIMEO = 7,
ENET_SOCKOPT_ERROR = 8,
ENET_SOCKOPT_NODELAY = 9,
ENET_SOCKOPT_TTL = 10
ENET_SOCKOPT_TTL = 10,
ENET_SOCKOPT_TOS = 11
} ENetSocketOption;

typedef enum _ENetSocketShutdown
Expand Down
9 changes: 9 additions & 0 deletions unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@ enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value)
result = setsockopt (socket, IPPROTO_IP, IP_TTL, (char *) & value, sizeof (int));
break;

case ENET_SOCKOPT_TOS:
result = setsockopt (socket, IPPROTO_IP, IP_TOS, (char *) & value, sizeof (int));
break;

default:
break;
}
Expand All @@ -375,6 +379,11 @@ enet_socket_get_option (ENetSocket socket, ENetSocketOption option, int * value)
result = getsockopt (socket, IPPROTO_IP, IP_TTL, (char *) value, & len);
break;

case ENET_SOCKOPT_TOS:
len = sizeof (int);
result = getsockopt (socket, IPPROTO_IP, IP_TOS, (char *) value, & len);
break;

default:
break;
}
Expand Down
9 changes: 9 additions & 0 deletions win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value)
result = setsockopt (socket, IPPROTO_IP, IP_TTL, (char *) & value, sizeof (int));
break;

case ENET_SOCKOPT_TOS:
result = setsockopt (socket, IPPROTO_IP, IP_TOS, (char *) & value, sizeof (int));
break;

default:
break;
}
Expand All @@ -258,6 +262,11 @@ enet_socket_get_option (ENetSocket socket, ENetSocketOption option, int * value)
result = getsockopt (socket, IPPROTO_IP, IP_TTL, (char *) value, & len);
break;

case ENET_SOCKOPT_TOS:
len = sizeof(int);
result = getsockopt (socket, IPPROTO_IP, IP_TOS, (char *) value, & len);
break;

default:
break;
}
Expand Down