~ubuntu-branches/debian/sid/trinity/sid

« back to all changes in this revision

Viewing changes to net/proto-tcp.c

  • Committer: Package Import Robot
  • Author(s): gustavo panizzo
  • Date: 2014-01-17 21:10:15 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20140117211015-k2qbnpu0osa5mlil
Tags: 1.3-1
* New upstream version 1.3.
* Removed wrong dependency on linux-headers. (Closes: #733771).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdlib.h>
 
2
#include <linux/tcp.h>
 
3
#include "net.h"
 
4
#include "maps.h"       // page_rand
 
5
#include "compat.h"
 
6
#include "utils.h"      // ARRAY_SIZE
 
7
 
 
8
#define SOL_TCP 6
 
9
 
 
10
#define NR_SOL_TCP_OPTS ARRAY_SIZE(tcp_opts)
 
11
static const unsigned int tcp_opts[] = { TCP_NODELAY, TCP_MAXSEG, TCP_CORK, TCP_KEEPIDLE,
 
12
        TCP_KEEPINTVL, TCP_KEEPCNT, TCP_SYNCNT, TCP_LINGER2,
 
13
        TCP_DEFER_ACCEPT, TCP_WINDOW_CLAMP, TCP_INFO, TCP_QUICKACK,
 
14
        TCP_CONGESTION, TCP_MD5SIG, TCP_COOKIE_TRANSACTIONS, TCP_THIN_LINEAR_TIMEOUTS,
 
15
        TCP_THIN_DUPACK, TCP_USER_TIMEOUT, TCP_REPAIR, TCP_REPAIR_QUEUE,
 
16
        TCP_QUEUE_SEQ, TCP_REPAIR_OPTIONS, TCP_FASTOPEN};
 
17
 
 
18
void tcp_setsockopt(struct sockopt *so)
 
19
{
 
20
        unsigned char val;
 
21
 
 
22
        so->level = SOL_TCP;
 
23
 
 
24
        val = rand() % NR_SOL_TCP_OPTS;
 
25
        so->optname = tcp_opts[val];
 
26
}