Skip to content

Commit 6de4f69

Browse files
committed
CONTRIB: modsecurity: import the minimal number of includes
Just like mod_defender, modsecurity depends on a few haproxy includes and it shouldn't since it's expected to be agnostic to the version. This imports the strictly minimum number of includes required to build it. These have been manually stripped from their exported functions prototypes and their unneeded dependencies.
1 parent c0e65da commit 6de4f69

File tree

13 files changed

+3112
-0
lines changed

13 files changed

+3112
-0
lines changed

include/haproxy/api-t.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* include/haproxy/api-t.h
3+
* This provides definitions for all common types or type modifiers used
4+
* everywhere in the code, and suitable for use in structure fields.
5+
*
6+
* Copyright (C) 2020 Willy Tarreau - w@1wt.eu
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining
9+
* a copy of this software and associated documentation files (the
10+
* "Software"), to deal in the Software without restriction, including
11+
* without limitation the rights to use, copy, modify, merge, publish,
12+
* distribute, sublicense, and/or sell copies of the Software, and to
13+
* permit persons to whom the Software is furnished to do so, subject to
14+
* the following conditions:
15+
*
16+
* The above copyright notice and this permission notice shall be
17+
* included in all copies or substantial portions of the Software.
18+
*
19+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
21+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26+
* OTHER DEALINGS IN THE SOFTWARE.
27+
*/
28+
29+
#ifndef _HAPROXY_TYPES_H
30+
#define _HAPROXY_TYPES_H
31+
32+
#include <inttypes.h>
33+
#include <stddef.h>
34+
35+
#include <haproxy/compat.h>
36+
#include <haproxy/compiler.h>
37+
#include <haproxy/list-t.h>
38+
39+
#endif /* _HAPROXY_TYPES_H */

include/haproxy/api.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* include/haproxy/api.h
3+
*
4+
* Include wrapper that assembles all includes required by every haproxy file.
5+
* Please do not add direct definitions into this file.
6+
*
7+
* Copyright (C) 2020 Willy Tarreau - w@1wt.eu
8+
*
9+
* Permission is hereby granted, free of charge, to any person obtaining
10+
* a copy of this software and associated documentation files (the
11+
* "Software"), to deal in the Software without restriction, including
12+
* without limitation the rights to use, copy, modify, merge, publish,
13+
* distribute, sublicense, and/or sell copies of the Software, and to
14+
* permit persons to whom the Software is furnished to do so, subject to
15+
* the following conditions:
16+
*
17+
* The above copyright notice and this permission notice shall be
18+
* included in all copies or substantial portions of the Software.
19+
*
20+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27+
* OTHER DEALINGS IN THE SOFTWARE.
28+
*/
29+
30+
#ifndef _HAPROXY_BASE_H
31+
#define _HAPROXY_BASE_H
32+
33+
#include <haproxy/api-t.h>
34+
35+
#endif

include/haproxy/buf-t.h

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* include/haproxy/buf-t.h
3+
* Simple buffer handling - types definitions.
4+
*
5+
* Copyright (C) 2000-2020 Willy Tarreau - w@1wt.eu
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining
8+
* a copy of this software and associated documentation files (the
9+
* "Software"), to deal in the Software without restriction, including
10+
* without limitation the rights to use, copy, modify, merge, publish,
11+
* distribute, sublicense, and/or sell copies of the Software, and to
12+
* permit persons to whom the Software is furnished to do so, subject to
13+
* the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be
16+
* included in all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25+
* OTHER DEALINGS IN THE SOFTWARE.
26+
*/
27+
28+
#ifndef _HAPROXY_BUF_T_H
29+
#define _HAPROXY_BUF_T_H
30+
31+
#include <haproxy/api-t.h>
32+
33+
/* Structure defining a buffer's head */
34+
struct buffer {
35+
size_t size; /* buffer size in bytes */
36+
char *area; /* points to <size> bytes */
37+
size_t data; /* amount of data after head including wrapping */
38+
size_t head; /* start offset of remaining data relative to area */
39+
};
40+
41+
/* A buffer may be in 3 different states :
42+
* - unallocated : size == 0, area == 0 (b_is_null() is true)
43+
* - waiting : size == 0, area != 0 (b_is_null() is true)
44+
* - allocated : size > 0, area > 0 (b_is_null() is false)
45+
*/
46+
47+
/* initializers for certain buffer states. It is important that the NULL buffer
48+
* remains the one with all fields initialized to zero so that a calloc() or a
49+
* memset() on a struct automatically sets a NULL buffer.
50+
*/
51+
#define BUF_NULL ((struct buffer){ })
52+
#define BUF_WANTED ((struct buffer){ .area = (char *)1 })
53+
#define BUF_RING ((struct buffer){ .area = (char *)2 })
54+
55+
#endif /* _HAPROXY_BUF_T_H */
56+
57+
/*
58+
* Local variables:
59+
* c-indent-level: 8
60+
* c-basic-offset: 8
61+
* End:
62+
*/

0 commit comments

Comments
 (0)