#include <sys/types.h>
#include <sys/socket.h>
#include <linux/udp.h>
#include <linux/tcp.h>
#include <linux/in.h>

#include "corking.h"
#include "die.h"

void set_udp_cork(int fd)
{
	int ret, state = 1;

	ret = setsockopt(fd, IPPROTO_UDP, UDP_CORK, &state, sizeof(state));
	if (unlikely(ret))
		panic("Cannot cork UDP socket!\n");
}

void set_udp_uncork(int fd)
{
	int ret, state = 0;

	ret = setsockopt(fd, IPPROTO_UDP, UDP_CORK, &state, sizeof(state));
	if (unlikely(ret))
		panic("Cannot uncork UDP socket!\n");
}

void set_tcp_cork(int fd)
{
	int ret, state = 1;

	ret = setsockopt(fd, IPPROTO_TCP, TCP_CORK, &state, sizeof(state));
	if (unlikely(ret))
		panic("Cannot cork TCP socket!\n");
}

void set_tcp_uncork(int fd)
{
	int ret, state = 0;

	ret = setsockopt(fd, IPPROTO_TCP, TCP_CORK, &state, sizeof(state));
	if (unlikely(ret))
		panic("Cannot uncork TCP socket!\n");
}

void set_sock_cork(int fd, bool is_udp)
{
	if (is_udp)
		set_udp_cork(fd);
	else
		set_tcp_cork(fd);
}

void set_sock_uncork(int fd, bool is_udp)
{
	if (is_udp)
		set_udp_uncork(fd);
	else
		set_tcp_uncork(fd);
}
>
<option value='nds-private-remove'>nds-private-remove</option>
<option value='packet-loop-back'>packet-loop-back</option>
<option value='packet-rx-pump-back'>packet-rx-pump-back</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>net-next plumbings</td><td class='sub right'>Tobias Klauser</td></tr></table>
<table class='tabs'><tr><td>
<a href='/cgit.cgi/linux/net-next.git/'>summary</a><a href='/cgit.cgi/linux/net-next.git/refs/?id=5e2ed1329ee074229d5a2f4389035be818120980'>refs</a><a class='active' href='/cgit.cgi/linux/net-next.git/log/drivers/usb/wusbcore'>log</a><a href='/cgit.cgi/linux/net-next.git/tree/drivers/usb/wusbcore?id=5e2ed1329ee074229d5a2f4389035be818120980'>tree</a><a href='/cgit.cgi/linux/net-next.git/commit/drivers/usb/wusbcore?id=5e2ed1329ee074229d5a2f4389035be818120980'>commit</a><a href='/cgit.cgi/linux/net-next.git/diff/drivers/usb/wusbcore?id=5e2ed1329ee074229d5a2f4389035be818120980'>diff</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/linux/net-next.git/log/drivers/usb/wusbcore'>
<input type='hidden' name='id' value='5e2ed1329ee074229d5a2f4389035be818120980'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/log/?id=5e2ed1329ee074229d5a2f4389035be818120980'>root</a>/<a href='/cgit.cgi/linux/net-next.git/log/drivers?id=5e2ed1329ee074229d5a2f4389035be818120980'>drivers</a>/<a href='/cgit.cgi/linux/net-next.git/log/drivers/usb?id=5e2ed1329ee074229d5a2f4389035be818120980'>usb</a>/<a href='/cgit.cgi/linux/net-next.git/log/drivers/usb/wusbcore?id=5e2ed1329ee074229d5a2f4389035be818120980'>wusbcore</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th class='left'>Age</th><th class='left'>Commit message (<a href='/cgit.cgi/linux/net-next.git/log/drivers/usb/wusbcore?id=5e2ed1329ee074229d5a2f4389035be818120980&amp;showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr>