Skip to content

nets-cs-pub-ro/mptcp-smkex

Repository files navigation

Fork of the MPTCP-capable Linux kernel with subflow events for poll.

Example

Demo code using this kernel: https://github.com/scrye/smc.

API Description

Applications can set a threshold number of subflows, and block in poll while waiting for those subflows to be fully established.

Set the threshold for number of established subflows:

int threshold = 2;
setsockopt(sockfd, IPPROTO_TCP, MPTCP_SET_SUB_EST_THRESHOLD, &threshold, size);

Get the threshold for number of established subflows:

int threshold;
getsockopt(sockfd, IPPROTO_TCP, MPTCP_GET_SUB_EST_THRESHOLD, &threshold, &size);

Get the number of established subflows:

int established;
getsockopt(sockfd, IPPROTO_TCP, MPTCP_GET_SUB_EST_COUNT, &established, &size);

After setting a threshold, poll can also wait until the threshold number of subflows is established:

struct pollfd fds[1];
memset(fds, 0, sizeof(struct pollfd));
fds[0].fd = sockfd;
fds[0].events |= POLLCONN;
poll(fds, 1, -1);