File: ip_tproxy.h

package info (click to toggle)
haproxy 1.5.8-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 7,732 kB
  • sloc: ansic: 62,860; xml: 1,754; python: 925; makefile: 551; perl: 550; sh: 491
file content (77 lines) | stat: -rw-r--r-- 1,596 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
 * Transparent proxy support for Linux/iptables
 *
 * Copyright (c) 2002-2004 BalaBit IT Ltd.
 * Author: Balzs Scheidler
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 */

#ifndef _IP_TPROXY_H
#define _IP_TPROXY_H

#ifdef __KERNEL__
#include <linux/types.h>
#include <linux/in.h>
#else
#include <netinet/in.h>
#ifndef IP_RECVORIGADDRS
#define IP_RECVORIGADDRS	11273
#define IP_ORIGADDRS	IP_RECVORIGADDRS
struct in_origaddrs {
        struct in_addr ioa_srcaddr;
        struct in_addr ioa_dstaddr;
        unsigned short int ioa_srcport;
        unsigned short int ioa_dstport;
};
#endif
#endif

/* 
 * used in setsockopt(SOL_IP, IP_TPROXY) should not collide 
 * with values in <linux/in.h> 
 */

#define IP_TPROXY	   11274

/* tproxy operations */
enum {
	TPROXY_VERSION = 0,
	TPROXY_ASSIGN,
	TPROXY_UNASSIGN,
	TPROXY_QUERY,
	TPROXY_FLAGS,
	TPROXY_ALLOC,
	TPROXY_CONNECT
};

/* bitfields in IP_TPROXY_FLAGS */
#define ITP_CONNECT     0x00000001
#define ITP_LISTEN      0x00000002
#define ITP_ESTABLISHED 0x00000004

#define ITP_ONCE        0x00010000
#define ITP_MARK        0x00020000
#define ITP_APPLIED     0x00040000
#define ITP_UNIDIR      0x00080000

struct in_tproxy_addr{
	struct in_addr	faddr;
	u_int16_t	fport;
};

struct in_tproxy {
	/* fixed part, should not change between versions */
	u_int32_t op;
	/* extensible part */
	union _in_args {
		u_int32_t		version;
		struct in_tproxy_addr	addr;
		u_int32_t		flags;
	} v;
};

#endif