tcell_agent 0.4.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +9 -22
  3. data/bin/tcell_agent +127 -132
  4. data/lib/tcell_agent/agent/event_processor.rb +23 -22
  5. data/lib/tcell_agent/agent/fork_pipe_manager.rb +7 -7
  6. data/lib/tcell_agent/agent/policy_manager.rb +20 -15
  7. data/lib/tcell_agent/agent/policy_types.rb +5 -11
  8. data/lib/tcell_agent/agent/static_agent.rb +5 -1
  9. data/lib/tcell_agent/agent.rb +6 -4
  10. data/lib/tcell_agent/api.rb +7 -9
  11. data/lib/tcell_agent/appsensor/meta_data.rb +11 -4
  12. data/lib/tcell_agent/authlogic.rb +3 -3
  13. data/lib/tcell_agent/cmdi.rb +6 -4
  14. data/lib/tcell_agent/config/unknown_options.rb +3 -1
  15. data/lib/tcell_agent/configuration.rb +47 -49
  16. data/lib/tcell_agent/devise.rb +2 -2
  17. data/lib/tcell_agent/hooks/login_fraud.rb +58 -29
  18. data/lib/tcell_agent/instrumentation.rb +11 -10
  19. data/lib/tcell_agent/logger.rb +2 -2
  20. data/lib/tcell_agent/patches/meta_data.rb +9 -13
  21. data/lib/tcell_agent/patches.rb +7 -10
  22. data/lib/tcell_agent/policies/clickjacking_policy.rb +4 -5
  23. data/lib/tcell_agent/policies/content_security_policy.rb +6 -12
  24. data/lib/tcell_agent/policies/dataloss_policy.rb +2 -2
  25. data/lib/tcell_agent/policies/http_redirect_policy.rb +2 -2
  26. data/lib/tcell_agent/policies/policy.rb +0 -2
  27. data/lib/tcell_agent/policies/rust_policies.rb +90 -0
  28. data/lib/tcell_agent/policies/secure_headers_policy.rb +2 -2
  29. data/lib/tcell_agent/rails/auth/authlogic.rb +42 -24
  30. data/lib/tcell_agent/rails/auth/devise.rb +44 -23
  31. data/lib/tcell_agent/rails/auth/doorkeeper.rb +33 -15
  32. data/lib/tcell_agent/rails/better_ip.rb +1 -1
  33. data/lib/tcell_agent/rails/csrf_exception.rb +2 -2
  34. data/lib/tcell_agent/rails/dlp/process_request.rb +1 -1
  35. data/lib/tcell_agent/rails/dlp.rb +6 -6
  36. data/lib/tcell_agent/rails/dlp_handler.rb +1 -1
  37. data/lib/tcell_agent/rails/js_agent_insert.rb +1 -1
  38. data/lib/tcell_agent/rails/middleware/body_filter_middleware.rb +1 -1
  39. data/lib/tcell_agent/rails/middleware/context_middleware.rb +3 -2
  40. data/lib/tcell_agent/rails/middleware/headers_middleware.rb +10 -9
  41. data/lib/tcell_agent/rails/routes/grape.rb +6 -6
  42. data/lib/tcell_agent/rails/routes.rb +8 -11
  43. data/lib/tcell_agent/rust/libtcellagent-0.11.1.dylib +0 -0
  44. data/lib/tcell_agent/rust/{libtcellagent-0.6.1.so → libtcellagent-0.11.1.so} +0 -0
  45. data/lib/tcell_agent/rust/models.rb +16 -0
  46. data/lib/tcell_agent/rust/tcellagent-0.11.1.dll +0 -0
  47. data/lib/tcell_agent/rust/whisperer.rb +119 -48
  48. data/lib/tcell_agent/sensor_events/appsensor_meta_event.rb +17 -20
  49. data/lib/tcell_agent/sensor_events/command_injection.rb +50 -5
  50. data/lib/tcell_agent/sensor_events/login_fraud.rb +34 -18
  51. data/lib/tcell_agent/sensor_events/patches.rb +21 -0
  52. data/lib/tcell_agent/sensor_events/server_agent.rb +3 -3
  53. data/lib/tcell_agent/sensor_events/util/utils.rb +4 -3
  54. data/lib/tcell_agent/servers/puma.rb +2 -2
  55. data/lib/tcell_agent/servers/unicorn.rb +1 -1
  56. data/lib/tcell_agent/utils/passwords.rb +28 -0
  57. data/lib/tcell_agent/version.rb +1 -1
  58. data/lib/tcell_agent.rb +1 -5
  59. data/spec/apps/rails-3.2/config/tcell_agent.config +15 -0
  60. data/spec/apps/rails-3.2/log/development.log +0 -0
  61. data/spec/apps/rails-3.2/log/test.log +12 -0
  62. data/spec/apps/rails-4.1/log/test.log +0 -0
  63. data/spec/lib/tcell_agent/agent/fork_pipe_manager_spec.rb +46 -45
  64. data/spec/lib/tcell_agent/agent/policy_manager_spec.rb +276 -164
  65. data/spec/lib/tcell_agent/agent/static_agent_spec.rb +44 -47
  66. data/spec/lib/tcell_agent/api/api_spec.rb +16 -16
  67. data/spec/lib/tcell_agent/appsensor/injections_reporter_spec.rb +131 -116
  68. data/spec/lib/tcell_agent/appsensor/meta_data_spec.rb +55 -51
  69. data/spec/lib/tcell_agent/cmdi_spec.rb +413 -436
  70. data/spec/lib/tcell_agent/config/unknown_options_spec.rb +145 -128
  71. data/spec/lib/tcell_agent/configuration_spec.rb +165 -169
  72. data/spec/lib/tcell_agent/hooks/login_fraud_spec.rb +144 -153
  73. data/spec/lib/tcell_agent/instrumentation_spec.rb +84 -85
  74. data/spec/lib/tcell_agent/patches_spec.rb +70 -111
  75. data/spec/lib/tcell_agent/policies/appsensor_policy_spec.rb +313 -244
  76. data/spec/lib/tcell_agent/policies/clickjacking_policy_spec.rb +28 -28
  77. data/spec/lib/tcell_agent/policies/command_injection_policy_spec.rb +643 -513
  78. data/spec/lib/tcell_agent/policies/content_security_policy_spec.rb +55 -102
  79. data/spec/lib/tcell_agent/policies/dataloss_policy_spec.rb +111 -134
  80. data/spec/lib/tcell_agent/policies/http_redirect_policy_spec.rb +141 -146
  81. data/spec/lib/tcell_agent/policies/http_tx_policy_spec.rb +8 -8
  82. data/spec/lib/tcell_agent/policies/login_policy_spec.rb +15 -17
  83. data/spec/lib/tcell_agent/policies/patches_policy_spec.rb +231 -559
  84. data/spec/lib/tcell_agent/policies/secure_headers_policy_spec.rb +27 -27
  85. data/spec/lib/tcell_agent/rails/better_ip_spec.rb +30 -34
  86. data/spec/lib/tcell_agent/rails/logger_spec.rb +50 -49
  87. data/spec/lib/tcell_agent/rails/middleware/appsensor_middleware_spec.rb +182 -199
  88. data/spec/lib/tcell_agent/rails/middleware/dlp_middleware_spec.rb +110 -84
  89. data/spec/lib/tcell_agent/rails/middleware/global_middleware_spec.rb +107 -85
  90. data/spec/lib/tcell_agent/rails/middleware/redirect_middleware_spec.rb +68 -40
  91. data/spec/lib/tcell_agent/rails/middleware/tcell_body_proxy_spec.rb +81 -67
  92. data/spec/lib/tcell_agent/rails/responses_spec.rb +33 -37
  93. data/spec/lib/tcell_agent/rails/routes/grape_spec.rb +116 -121
  94. data/spec/lib/tcell_agent/rails/routes/route_id_spec.rb +25 -28
  95. data/spec/lib/tcell_agent/rails/routes/routes_spec.rb +87 -85
  96. data/spec/lib/tcell_agent/rails_spec.rb +1 -6
  97. data/spec/lib/tcell_agent/rust/models_spec.rb +112 -0
  98. data/spec/lib/tcell_agent/rust/whisperer_spec.rb +502 -179
  99. data/spec/lib/tcell_agent/sensor_events/appsensor_meta_event_spec.rb +44 -33
  100. data/spec/lib/tcell_agent/sensor_events/dlp_spec.rb +4 -4
  101. data/spec/lib/tcell_agent/sensor_events/sessions_metric_spec.rb +183 -169
  102. data/spec/lib/tcell_agent/sensor_events/util/sanitizer_utilities_spec.rb +25 -25
  103. data/spec/lib/tcell_agent/utils/bounded_queue_spec.rb +17 -20
  104. data/spec/lib/tcell_agent/utils/params_spec.rb +28 -28
  105. data/spec/lib/tcell_agent/utils/passwords_spec.rb +143 -0
  106. data/spec/lib/tcell_agent/utils/strings_spec.rb +35 -35
  107. data/spec/lib/tcell_agent_spec.rb +8 -8
  108. data/spec/spec_helper.rb +4 -4
  109. data/spec/support/middleware_helper.rb +10 -10
  110. data/spec/support/static_agent_overrides.rb +16 -12
  111. data/tcell_agent.gemspec +17 -33
  112. metadata +43 -198
  113. data/LICENSE_libinjection +0 -32
  114. data/Readme.txt +0 -7
  115. data/ext/libinjection/extconf.rb +0 -3
  116. data/ext/libinjection/libinjection.h +0 -65
  117. data/ext/libinjection/libinjection_html5.c +0 -847
  118. data/ext/libinjection/libinjection_html5.h +0 -54
  119. data/ext/libinjection/libinjection_sqli.c +0 -2317
  120. data/ext/libinjection/libinjection_sqli.h +0 -295
  121. data/ext/libinjection/libinjection_sqli_data.h +0 -9004
  122. data/ext/libinjection/libinjection_wrap.c +0 -3525
  123. data/ext/libinjection/libinjection_xss.c +0 -531
  124. data/ext/libinjection/libinjection_xss.h +0 -21
  125. data/lib/tcell_agent/appsensor/injections_matcher.rb +0 -155
  126. data/lib/tcell_agent/appsensor/rules/appsensor_rule_manager.rb +0 -49
  127. data/lib/tcell_agent/appsensor/rules/appsensor_rule_set.rb +0 -67
  128. data/lib/tcell_agent/appsensor/rules/baserules.json +0 -467
  129. data/lib/tcell_agent/patches/block_rule.rb +0 -93
  130. data/lib/tcell_agent/patches/sensors_matcher.rb +0 -31
  131. data/lib/tcell_agent/policies/appsensor/cmdi_sensor.rb +0 -23
  132. data/lib/tcell_agent/policies/appsensor/fpt_sensor.rb +0 -23
  133. data/lib/tcell_agent/policies/appsensor/injection_sensor.rb +0 -117
  134. data/lib/tcell_agent/policies/appsensor/nullbyte_sensor.rb +0 -26
  135. data/lib/tcell_agent/policies/appsensor/retr_sensor.rb +0 -22
  136. data/lib/tcell_agent/policies/appsensor/sqli_sensor.rb +0 -34
  137. data/lib/tcell_agent/policies/appsensor/xss_sensor.rb +0 -34
  138. data/lib/tcell_agent/policies/appsensor_policy.rb +0 -49
  139. data/lib/tcell_agent/policies/command_injection_policy.rb +0 -196
  140. data/lib/tcell_agent/policies/honeytokens_policy.rb +0 -69
  141. data/lib/tcell_agent/policies/patches_policy.rb +0 -84
  142. data/lib/tcell_agent/rust/libtcellagent-0.6.1.dylib +0 -0
  143. data/lib/tcell_agent/rust/tcellagent-0.6.1.dll +0 -0
  144. data/spec/apps/rails-3.2/Gemfile +0 -25
  145. data/spec/apps/rails-3.2/Gemfile.lock +0 -126
  146. data/spec/apps/rails-3.2/Rakefile +0 -7
  147. data/spec/apps/rails-3.2/app/assets/images/rails.png +0 -0
  148. data/spec/apps/rails-3.2/app/assets/javascripts/application.js +0 -15
  149. data/spec/apps/rails-3.2/app/assets/stylesheets/application.css +0 -13
  150. data/spec/apps/rails-3.2/app/controllers/application_controller.rb +0 -3
  151. data/spec/apps/rails-3.2/app/controllers/t_cell_app_controller.rb +0 -5
  152. data/spec/apps/rails-3.2/app/helpers/application_helper.rb +0 -2
  153. data/spec/apps/rails-3.2/app/views/layouts/application.html.erb +0 -14
  154. data/spec/apps/rails-3.2/app/views/t_cell_app/index.html.erb +0 -1
  155. data/spec/apps/rails-3.2/config/application.rb +0 -63
  156. data/spec/apps/rails-3.2/config/boot.rb +0 -6
  157. data/spec/apps/rails-3.2/config/environment.rb +0 -5
  158. data/spec/apps/rails-3.2/config/environments/test.rb +0 -37
  159. data/spec/apps/rails-3.2/config/routes.rb +0 -11
  160. data/spec/apps/rails-3.2/config.ru +0 -4
  161. data/spec/apps/rails-4.1/Gemfile +0 -7
  162. data/spec/apps/rails-4.1/Gemfile.lock +0 -114
  163. data/spec/apps/rails-4.1/Rakefile +0 -6
  164. data/spec/apps/rails-4.1/app/assets/javascripts/application.js +0 -16
  165. data/spec/apps/rails-4.1/app/assets/stylesheets/application.css +0 -15
  166. data/spec/apps/rails-4.1/app/controllers/application_controller.rb +0 -5
  167. data/spec/apps/rails-4.1/app/controllers/t_cell_app_controller.rb +0 -5
  168. data/spec/apps/rails-4.1/app/helpers/application_helper.rb +0 -2
  169. data/spec/apps/rails-4.1/app/views/layouts/application.html.erb +0 -14
  170. data/spec/apps/rails-4.1/app/views/t_cell_app/index.html.erb +0 -1
  171. data/spec/apps/rails-4.1/config/application.rb +0 -24
  172. data/spec/apps/rails-4.1/config/boot.rb +0 -4
  173. data/spec/apps/rails-4.1/config/environment.rb +0 -5
  174. data/spec/apps/rails-4.1/config/environments/test.rb +0 -41
  175. data/spec/apps/rails-4.1/config/initializers/assets.rb +0 -8
  176. data/spec/apps/rails-4.1/config/initializers/backtrace_silencers.rb +0 -7
  177. data/spec/apps/rails-4.1/config/initializers/cookies_serializer.rb +0 -3
  178. data/spec/apps/rails-4.1/config/initializers/filter_parameter_logging.rb +0 -4
  179. data/spec/apps/rails-4.1/config/initializers/inflections.rb +0 -16
  180. data/spec/apps/rails-4.1/config/initializers/mime_types.rb +0 -4
  181. data/spec/apps/rails-4.1/config/initializers/session_store.rb +0 -3
  182. data/spec/apps/rails-4.1/config/initializers/wrap_parameters.rb +0 -14
  183. data/spec/apps/rails-4.1/config/locales/en.yml +0 -23
  184. data/spec/apps/rails-4.1/config/routes.rb +0 -12
  185. data/spec/apps/rails-4.1/config/secrets.yml +0 -22
  186. data/spec/apps/rails-4.1/config.ru +0 -4
  187. data/spec/controllers/application_controller.rb +0 -12
  188. data/spec/lib/tcell_agent/appsensor/injections_matcher_spec.rb +0 -522
  189. data/spec/lib/tcell_agent/appsensor/rules/appsensor_rule_manager_spec.rb +0 -23
  190. data/spec/lib/tcell_agent/appsensor/rules/appsensor_rule_set_spec.rb +0 -159
  191. data/spec/lib/tcell_agent/patches/block_rule_spec.rb +0 -458
  192. data/spec/lib/tcell_agent/patches/sensors_matcher_spec.rb +0 -35
  193. data/spec/lib/tcell_agent/policies/appsensor/cmdi_sensor_spec.rb +0 -139
  194. data/spec/lib/tcell_agent/policies/appsensor/fpt_sensor_spec.rb +0 -139
  195. data/spec/lib/tcell_agent/policies/appsensor/nullbyte_sensor_spec.rb +0 -167
  196. data/spec/lib/tcell_agent/policies/appsensor/retr_sensor_spec.rb +0 -139
  197. data/spec/lib/tcell_agent/policies/appsensor/sqli_sensor_spec.rb +0 -246
  198. data/spec/lib/tcell_agent/policies/appsensor/xss_sensor_spec.rb +0 -882
  199. data/spec/lib/tcell_agent/policies/honeytokens_policy_spec.rb +0 -22
@@ -1,3525 +0,0 @@
1
- /* ----------------------------------------------------------------------------
2
- * This file was automatically generated by SWIG (http://www.swig.org).
3
- * Version 3.0.8
4
- *
5
- * This file is not intended to be easily readable and contains a number of
6
- * coding conventions designed to improve portability and efficiency. Do not make
7
- * changes to this file unless you know what you are doing--modify the SWIG
8
- * interface file instead.
9
- * ----------------------------------------------------------------------------- */
10
-
11
-
12
- #ifndef SWIGRUBY
13
- #define SWIGRUBY
14
- #endif
15
-
16
-
17
- /* -----------------------------------------------------------------------------
18
- * This section contains generic SWIG labels for method/variable
19
- * declarations/attributes, and other compiler dependent labels.
20
- * ----------------------------------------------------------------------------- */
21
-
22
- /* template workaround for compilers that cannot correctly implement the C++ standard */
23
- #ifndef SWIGTEMPLATEDISAMBIGUATOR
24
- # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
25
- # define SWIGTEMPLATEDISAMBIGUATOR template
26
- # elif defined(__HP_aCC)
27
- /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
28
- /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
29
- # define SWIGTEMPLATEDISAMBIGUATOR template
30
- # else
31
- # define SWIGTEMPLATEDISAMBIGUATOR
32
- # endif
33
- #endif
34
-
35
- /* inline attribute */
36
- #ifndef SWIGINLINE
37
- # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
38
- # define SWIGINLINE inline
39
- # else
40
- # define SWIGINLINE
41
- # endif
42
- #endif
43
-
44
- /* attribute recognised by some compilers to avoid 'unused' warnings */
45
- #ifndef SWIGUNUSED
46
- # if defined(__GNUC__)
47
- # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
48
- # define SWIGUNUSED __attribute__ ((__unused__))
49
- # else
50
- # define SWIGUNUSED
51
- # endif
52
- # elif defined(__ICC)
53
- # define SWIGUNUSED __attribute__ ((__unused__))
54
- # else
55
- # define SWIGUNUSED
56
- # endif
57
- #endif
58
-
59
- #ifndef SWIG_MSC_UNSUPPRESS_4505
60
- # if defined(_MSC_VER)
61
- # pragma warning(disable : 4505) /* unreferenced local function has been removed */
62
- # endif
63
- #endif
64
-
65
- #ifndef SWIGUNUSEDPARM
66
- # ifdef __cplusplus
67
- # define SWIGUNUSEDPARM(p)
68
- # else
69
- # define SWIGUNUSEDPARM(p) p SWIGUNUSED
70
- # endif
71
- #endif
72
-
73
- /* internal SWIG method */
74
- #ifndef SWIGINTERN
75
- # define SWIGINTERN static SWIGUNUSED
76
- #endif
77
-
78
- /* internal inline SWIG method */
79
- #ifndef SWIGINTERNINLINE
80
- # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
81
- #endif
82
-
83
- /* exporting methods */
84
- #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
85
- # ifndef GCC_HASCLASSVISIBILITY
86
- # define GCC_HASCLASSVISIBILITY
87
- # endif
88
- #endif
89
-
90
- #ifndef SWIGEXPORT
91
- # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
92
- # if defined(STATIC_LINKED)
93
- # define SWIGEXPORT
94
- # else
95
- # define SWIGEXPORT __declspec(dllexport)
96
- # endif
97
- # else
98
- # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
99
- # define SWIGEXPORT __attribute__ ((visibility("default")))
100
- # else
101
- # define SWIGEXPORT
102
- # endif
103
- # endif
104
- #endif
105
-
106
- /* calling conventions for Windows */
107
- #ifndef SWIGSTDCALL
108
- # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
109
- # define SWIGSTDCALL __stdcall
110
- # else
111
- # define SWIGSTDCALL
112
- # endif
113
- #endif
114
-
115
- /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
116
- #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
117
- # define _CRT_SECURE_NO_DEPRECATE
118
- #endif
119
-
120
- /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
121
- #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
122
- # define _SCL_SECURE_NO_DEPRECATE
123
- #endif
124
-
125
- /* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
126
- #if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
127
- # define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
128
- #endif
129
-
130
- /* Intel's compiler complains if a variable which was never initialised is
131
- * cast to void, which is a common idiom which we use to indicate that we
132
- * are aware a variable isn't used. So we just silence that warning.
133
- * See: https://github.com/swig/swig/issues/192 for more discussion.
134
- */
135
- #ifdef __INTEL_COMPILER
136
- # pragma warning disable 592
137
- #endif
138
-
139
- /* -----------------------------------------------------------------------------
140
- * This section contains generic SWIG labels for method/variable
141
- * declarations/attributes, and other compiler dependent labels.
142
- * ----------------------------------------------------------------------------- */
143
-
144
- /* template workaround for compilers that cannot correctly implement the C++ standard */
145
- #ifndef SWIGTEMPLATEDISAMBIGUATOR
146
- # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
147
- # define SWIGTEMPLATEDISAMBIGUATOR template
148
- # elif defined(__HP_aCC)
149
- /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
150
- /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
151
- # define SWIGTEMPLATEDISAMBIGUATOR template
152
- # else
153
- # define SWIGTEMPLATEDISAMBIGUATOR
154
- # endif
155
- #endif
156
-
157
- /* inline attribute */
158
- #ifndef SWIGINLINE
159
- # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
160
- # define SWIGINLINE inline
161
- # else
162
- # define SWIGINLINE
163
- # endif
164
- #endif
165
-
166
- /* attribute recognised by some compilers to avoid 'unused' warnings */
167
- #ifndef SWIGUNUSED
168
- # if defined(__GNUC__)
169
- # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
170
- # define SWIGUNUSED __attribute__ ((__unused__))
171
- # else
172
- # define SWIGUNUSED
173
- # endif
174
- # elif defined(__ICC)
175
- # define SWIGUNUSED __attribute__ ((__unused__))
176
- # else
177
- # define SWIGUNUSED
178
- # endif
179
- #endif
180
-
181
- #ifndef SWIG_MSC_UNSUPPRESS_4505
182
- # if defined(_MSC_VER)
183
- # pragma warning(disable : 4505) /* unreferenced local function has been removed */
184
- # endif
185
- #endif
186
-
187
- #ifndef SWIGUNUSEDPARM
188
- # ifdef __cplusplus
189
- # define SWIGUNUSEDPARM(p)
190
- # else
191
- # define SWIGUNUSEDPARM(p) p SWIGUNUSED
192
- # endif
193
- #endif
194
-
195
- /* internal SWIG method */
196
- #ifndef SWIGINTERN
197
- # define SWIGINTERN static SWIGUNUSED
198
- #endif
199
-
200
- /* internal inline SWIG method */
201
- #ifndef SWIGINTERNINLINE
202
- # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
203
- #endif
204
-
205
- /* exporting methods */
206
- #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
207
- # ifndef GCC_HASCLASSVISIBILITY
208
- # define GCC_HASCLASSVISIBILITY
209
- # endif
210
- #endif
211
-
212
- #ifndef SWIGEXPORT
213
- # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
214
- # if defined(STATIC_LINKED)
215
- # define SWIGEXPORT
216
- # else
217
- # define SWIGEXPORT __declspec(dllexport)
218
- # endif
219
- # else
220
- # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
221
- # define SWIGEXPORT __attribute__ ((visibility("default")))
222
- # else
223
- # define SWIGEXPORT
224
- # endif
225
- # endif
226
- #endif
227
-
228
- /* calling conventions for Windows */
229
- #ifndef SWIGSTDCALL
230
- # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
231
- # define SWIGSTDCALL __stdcall
232
- # else
233
- # define SWIGSTDCALL
234
- # endif
235
- #endif
236
-
237
- /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
238
- #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
239
- # define _CRT_SECURE_NO_DEPRECATE
240
- #endif
241
-
242
- /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
243
- #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
244
- # define _SCL_SECURE_NO_DEPRECATE
245
- #endif
246
-
247
- /* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
248
- #if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
249
- # define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
250
- #endif
251
-
252
- /* Intel's compiler complains if a variable which was never initialised is
253
- * cast to void, which is a common idiom which we use to indicate that we
254
- * are aware a variable isn't used. So we just silence that warning.
255
- * See: https://github.com/swig/swig/issues/192 for more discussion.
256
- */
257
- #ifdef __INTEL_COMPILER
258
- # pragma warning disable 592
259
- #endif
260
-
261
- /* -----------------------------------------------------------------------------
262
- * swigrun.swg
263
- *
264
- * This file contains generic C API SWIG runtime support for pointer
265
- * type checking.
266
- * ----------------------------------------------------------------------------- */
267
-
268
- /* This should only be incremented when either the layout of swig_type_info changes,
269
- or for whatever reason, the runtime changes incompatibly */
270
- #define SWIG_RUNTIME_VERSION "4"
271
-
272
- /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
273
- #ifdef SWIG_TYPE_TABLE
274
- # define SWIG_QUOTE_STRING(x) #x
275
- # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
276
- # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
277
- #else
278
- # define SWIG_TYPE_TABLE_NAME
279
- #endif
280
-
281
- /*
282
- You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
283
- creating a static or dynamic library from the SWIG runtime code.
284
- In 99.9% of the cases, SWIG just needs to declare them as 'static'.
285
-
286
- But only do this if strictly necessary, ie, if you have problems
287
- with your compiler or suchlike.
288
- */
289
-
290
- #ifndef SWIGRUNTIME
291
- # define SWIGRUNTIME SWIGINTERN
292
- #endif
293
-
294
- #ifndef SWIGRUNTIMEINLINE
295
- # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
296
- #endif
297
-
298
- /* Generic buffer size */
299
- #ifndef SWIG_BUFFER_SIZE
300
- # define SWIG_BUFFER_SIZE 1024
301
- #endif
302
-
303
- /* Flags for pointer conversions */
304
- #define SWIG_POINTER_DISOWN 0x1
305
- #define SWIG_CAST_NEW_MEMORY 0x2
306
-
307
- /* Flags for new pointer objects */
308
- #define SWIG_POINTER_OWN 0x1
309
-
310
-
311
- /*
312
- Flags/methods for returning states.
313
-
314
- The SWIG conversion methods, as ConvertPtr, return an integer
315
- that tells if the conversion was successful or not. And if not,
316
- an error code can be returned (see swigerrors.swg for the codes).
317
-
318
- Use the following macros/flags to set or process the returning
319
- states.
320
-
321
- In old versions of SWIG, code such as the following was usually written:
322
-
323
- if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
324
- // success code
325
- } else {
326
- //fail code
327
- }
328
-
329
- Now you can be more explicit:
330
-
331
- int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
332
- if (SWIG_IsOK(res)) {
333
- // success code
334
- } else {
335
- // fail code
336
- }
337
-
338
- which is the same really, but now you can also do
339
-
340
- Type *ptr;
341
- int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
342
- if (SWIG_IsOK(res)) {
343
- // success code
344
- if (SWIG_IsNewObj(res) {
345
- ...
346
- delete *ptr;
347
- } else {
348
- ...
349
- }
350
- } else {
351
- // fail code
352
- }
353
-
354
- I.e., now SWIG_ConvertPtr can return new objects and you can
355
- identify the case and take care of the deallocation. Of course that
356
- also requires SWIG_ConvertPtr to return new result values, such as
357
-
358
- int SWIG_ConvertPtr(obj, ptr,...) {
359
- if (<obj is ok>) {
360
- if (<need new object>) {
361
- *ptr = <ptr to new allocated object>;
362
- return SWIG_NEWOBJ;
363
- } else {
364
- *ptr = <ptr to old object>;
365
- return SWIG_OLDOBJ;
366
- }
367
- } else {
368
- return SWIG_BADOBJ;
369
- }
370
- }
371
-
372
- Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
373
- more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
374
- SWIG errors code.
375
-
376
- Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
377
- allows to return the 'cast rank', for example, if you have this
378
-
379
- int food(double)
380
- int fooi(int);
381
-
382
- and you call
383
-
384
- food(1) // cast rank '1' (1 -> 1.0)
385
- fooi(1) // cast rank '0'
386
-
387
- just use the SWIG_AddCast()/SWIG_CheckState()
388
- */
389
-
390
- #define SWIG_OK (0)
391
- #define SWIG_ERROR (-1)
392
- #define SWIG_IsOK(r) (r >= 0)
393
- #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
394
-
395
- /* The CastRankLimit says how many bits are used for the cast rank */
396
- #define SWIG_CASTRANKLIMIT (1 << 8)
397
- /* The NewMask denotes the object was created (using new/malloc) */
398
- #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
399
- /* The TmpMask is for in/out typemaps that use temporal objects */
400
- #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
401
- /* Simple returning values */
402
- #define SWIG_BADOBJ (SWIG_ERROR)
403
- #define SWIG_OLDOBJ (SWIG_OK)
404
- #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
405
- #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
406
- /* Check, add and del mask methods */
407
- #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
408
- #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
409
- #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
410
- #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
411
- #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
412
- #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
413
-
414
- /* Cast-Rank Mode */
415
- #if defined(SWIG_CASTRANK_MODE)
416
- # ifndef SWIG_TypeRank
417
- # define SWIG_TypeRank unsigned long
418
- # endif
419
- # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
420
- # define SWIG_MAXCASTRANK (2)
421
- # endif
422
- # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
423
- # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
424
- SWIGINTERNINLINE int SWIG_AddCast(int r) {
425
- return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
426
- }
427
- SWIGINTERNINLINE int SWIG_CheckState(int r) {
428
- return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
429
- }
430
- #else /* no cast-rank mode */
431
- # define SWIG_AddCast(r) (r)
432
- # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
433
- #endif
434
-
435
-
436
- #include <string.h>
437
-
438
- #ifdef __cplusplus
439
- extern "C" {
440
- #endif
441
-
442
- typedef void *(*swig_converter_func)(void *, int *);
443
- typedef struct swig_type_info *(*swig_dycast_func)(void **);
444
-
445
- /* Structure to store information on one type */
446
- typedef struct swig_type_info {
447
- const char *name; /* mangled name of this type */
448
- const char *str; /* human readable name of this type */
449
- swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
450
- struct swig_cast_info *cast; /* linked list of types that can cast into this type */
451
- void *clientdata; /* language specific type data */
452
- int owndata; /* flag if the structure owns the clientdata */
453
- } swig_type_info;
454
-
455
- /* Structure to store a type and conversion function used for casting */
456
- typedef struct swig_cast_info {
457
- swig_type_info *type; /* pointer to type that is equivalent to this type */
458
- swig_converter_func converter; /* function to cast the void pointers */
459
- struct swig_cast_info *next; /* pointer to next cast in linked list */
460
- struct swig_cast_info *prev; /* pointer to the previous cast */
461
- } swig_cast_info;
462
-
463
- /* Structure used to store module information
464
- * Each module generates one structure like this, and the runtime collects
465
- * all of these structures and stores them in a circularly linked list.*/
466
- typedef struct swig_module_info {
467
- swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
468
- size_t size; /* Number of types in this module */
469
- struct swig_module_info *next; /* Pointer to next element in circularly linked list */
470
- swig_type_info **type_initial; /* Array of initially generated type structures */
471
- swig_cast_info **cast_initial; /* Array of initially generated casting structures */
472
- void *clientdata; /* Language specific module data */
473
- } swig_module_info;
474
-
475
- /*
476
- Compare two type names skipping the space characters, therefore
477
- "char*" == "char *" and "Class<int>" == "Class<int >", etc.
478
-
479
- Return 0 when the two name types are equivalent, as in
480
- strncmp, but skipping ' '.
481
- */
482
- SWIGRUNTIME int
483
- SWIG_TypeNameComp(const char *f1, const char *l1,
484
- const char *f2, const char *l2) {
485
- for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
486
- while ((*f1 == ' ') && (f1 != l1)) ++f1;
487
- while ((*f2 == ' ') && (f2 != l2)) ++f2;
488
- if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
489
- }
490
- return (int)((l1 - f1) - (l2 - f2));
491
- }
492
-
493
- /*
494
- Check type equivalence in a name list like <name1>|<name2>|...
495
- Return 0 if equal, -1 if nb < tb, 1 if nb > tb
496
- */
497
- SWIGRUNTIME int
498
- SWIG_TypeCmp(const char *nb, const char *tb) {
499
- int equiv = 1;
500
- const char* te = tb + strlen(tb);
501
- const char* ne = nb;
502
- while (equiv != 0 && *ne) {
503
- for (nb = ne; *ne; ++ne) {
504
- if (*ne == '|') break;
505
- }
506
- equiv = SWIG_TypeNameComp(nb, ne, tb, te);
507
- if (*ne) ++ne;
508
- }
509
- return equiv;
510
- }
511
-
512
- /*
513
- Check type equivalence in a name list like <name1>|<name2>|...
514
- Return 0 if not equal, 1 if equal
515
- */
516
- SWIGRUNTIME int
517
- SWIG_TypeEquiv(const char *nb, const char *tb) {
518
- return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
519
- }
520
-
521
- /*
522
- Check the typename
523
- */
524
- SWIGRUNTIME swig_cast_info *
525
- SWIG_TypeCheck(const char *c, swig_type_info *ty) {
526
- if (ty) {
527
- swig_cast_info *iter = ty->cast;
528
- while (iter) {
529
- if (strcmp(iter->type->name, c) == 0) {
530
- if (iter == ty->cast)
531
- return iter;
532
- /* Move iter to the top of the linked list */
533
- iter->prev->next = iter->next;
534
- if (iter->next)
535
- iter->next->prev = iter->prev;
536
- iter->next = ty->cast;
537
- iter->prev = 0;
538
- if (ty->cast) ty->cast->prev = iter;
539
- ty->cast = iter;
540
- return iter;
541
- }
542
- iter = iter->next;
543
- }
544
- }
545
- return 0;
546
- }
547
-
548
- /*
549
- Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
550
- */
551
- SWIGRUNTIME swig_cast_info *
552
- SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
553
- if (ty) {
554
- swig_cast_info *iter = ty->cast;
555
- while (iter) {
556
- if (iter->type == from) {
557
- if (iter == ty->cast)
558
- return iter;
559
- /* Move iter to the top of the linked list */
560
- iter->prev->next = iter->next;
561
- if (iter->next)
562
- iter->next->prev = iter->prev;
563
- iter->next = ty->cast;
564
- iter->prev = 0;
565
- if (ty->cast) ty->cast->prev = iter;
566
- ty->cast = iter;
567
- return iter;
568
- }
569
- iter = iter->next;
570
- }
571
- }
572
- return 0;
573
- }
574
-
575
- /*
576
- Cast a pointer up an inheritance hierarchy
577
- */
578
- SWIGRUNTIMEINLINE void *
579
- SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
580
- return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
581
- }
582
-
583
- /*
584
- Dynamic pointer casting. Down an inheritance hierarchy
585
- */
586
- SWIGRUNTIME swig_type_info *
587
- SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
588
- swig_type_info *lastty = ty;
589
- if (!ty || !ty->dcast) return ty;
590
- while (ty && (ty->dcast)) {
591
- ty = (*ty->dcast)(ptr);
592
- if (ty) lastty = ty;
593
- }
594
- return lastty;
595
- }
596
-
597
- /*
598
- Return the name associated with this type
599
- */
600
- SWIGRUNTIMEINLINE const char *
601
- SWIG_TypeName(const swig_type_info *ty) {
602
- return ty->name;
603
- }
604
-
605
- /*
606
- Return the pretty name associated with this type,
607
- that is an unmangled type name in a form presentable to the user.
608
- */
609
- SWIGRUNTIME const char *
610
- SWIG_TypePrettyName(const swig_type_info *type) {
611
- /* The "str" field contains the equivalent pretty names of the
612
- type, separated by vertical-bar characters. We choose
613
- to print the last name, as it is often (?) the most
614
- specific. */
615
- if (!type) return NULL;
616
- if (type->str != NULL) {
617
- const char *last_name = type->str;
618
- const char *s;
619
- for (s = type->str; *s; s++)
620
- if (*s == '|') last_name = s+1;
621
- return last_name;
622
- }
623
- else
624
- return type->name;
625
- }
626
-
627
- /*
628
- Set the clientdata field for a type
629
- */
630
- SWIGRUNTIME void
631
- SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
632
- swig_cast_info *cast = ti->cast;
633
- /* if (ti->clientdata == clientdata) return; */
634
- ti->clientdata = clientdata;
635
-
636
- while (cast) {
637
- if (!cast->converter) {
638
- swig_type_info *tc = cast->type;
639
- if (!tc->clientdata) {
640
- SWIG_TypeClientData(tc, clientdata);
641
- }
642
- }
643
- cast = cast->next;
644
- }
645
- }
646
- SWIGRUNTIME void
647
- SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
648
- SWIG_TypeClientData(ti, clientdata);
649
- ti->owndata = 1;
650
- }
651
-
652
- /*
653
- Search for a swig_type_info structure only by mangled name
654
- Search is a O(log #types)
655
-
656
- We start searching at module start, and finish searching when start == end.
657
- Note: if start == end at the beginning of the function, we go all the way around
658
- the circular list.
659
- */
660
- SWIGRUNTIME swig_type_info *
661
- SWIG_MangledTypeQueryModule(swig_module_info *start,
662
- swig_module_info *end,
663
- const char *name) {
664
- swig_module_info *iter = start;
665
- do {
666
- if (iter->size) {
667
- size_t l = 0;
668
- size_t r = iter->size - 1;
669
- do {
670
- /* since l+r >= 0, we can (>> 1) instead (/ 2) */
671
- size_t i = (l + r) >> 1;
672
- const char *iname = iter->types[i]->name;
673
- if (iname) {
674
- int compare = strcmp(name, iname);
675
- if (compare == 0) {
676
- return iter->types[i];
677
- } else if (compare < 0) {
678
- if (i) {
679
- r = i - 1;
680
- } else {
681
- break;
682
- }
683
- } else if (compare > 0) {
684
- l = i + 1;
685
- }
686
- } else {
687
- break; /* should never happen */
688
- }
689
- } while (l <= r);
690
- }
691
- iter = iter->next;
692
- } while (iter != end);
693
- return 0;
694
- }
695
-
696
- /*
697
- Search for a swig_type_info structure for either a mangled name or a human readable name.
698
- It first searches the mangled names of the types, which is a O(log #types)
699
- If a type is not found it then searches the human readable names, which is O(#types).
700
-
701
- We start searching at module start, and finish searching when start == end.
702
- Note: if start == end at the beginning of the function, we go all the way around
703
- the circular list.
704
- */
705
- SWIGRUNTIME swig_type_info *
706
- SWIG_TypeQueryModule(swig_module_info *start,
707
- swig_module_info *end,
708
- const char *name) {
709
- /* STEP 1: Search the name field using binary search */
710
- swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
711
- if (ret) {
712
- return ret;
713
- } else {
714
- /* STEP 2: If the type hasn't been found, do a complete search
715
- of the str field (the human readable name) */
716
- swig_module_info *iter = start;
717
- do {
718
- size_t i = 0;
719
- for (; i < iter->size; ++i) {
720
- if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
721
- return iter->types[i];
722
- }
723
- iter = iter->next;
724
- } while (iter != end);
725
- }
726
-
727
- /* neither found a match */
728
- return 0;
729
- }
730
-
731
- /*
732
- Pack binary data into a string
733
- */
734
- SWIGRUNTIME char *
735
- SWIG_PackData(char *c, void *ptr, size_t sz) {
736
- static const char hex[17] = "0123456789abcdef";
737
- const unsigned char *u = (unsigned char *) ptr;
738
- const unsigned char *eu = u + sz;
739
- for (; u != eu; ++u) {
740
- unsigned char uu = *u;
741
- *(c++) = hex[(uu & 0xf0) >> 4];
742
- *(c++) = hex[uu & 0xf];
743
- }
744
- return c;
745
- }
746
-
747
- /*
748
- Unpack binary data from a string
749
- */
750
- SWIGRUNTIME const char *
751
- SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
752
- unsigned char *u = (unsigned char *) ptr;
753
- const unsigned char *eu = u + sz;
754
- for (; u != eu; ++u) {
755
- char d = *(c++);
756
- unsigned char uu;
757
- if ((d >= '0') && (d <= '9'))
758
- uu = ((d - '0') << 4);
759
- else if ((d >= 'a') && (d <= 'f'))
760
- uu = ((d - ('a'-10)) << 4);
761
- else
762
- return (char *) 0;
763
- d = *(c++);
764
- if ((d >= '0') && (d <= '9'))
765
- uu |= (d - '0');
766
- else if ((d >= 'a') && (d <= 'f'))
767
- uu |= (d - ('a'-10));
768
- else
769
- return (char *) 0;
770
- *u = uu;
771
- }
772
- return c;
773
- }
774
-
775
- /*
776
- Pack 'void *' into a string buffer.
777
- */
778
- SWIGRUNTIME char *
779
- SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
780
- char *r = buff;
781
- if ((2*sizeof(void *) + 2) > bsz) return 0;
782
- *(r++) = '_';
783
- r = SWIG_PackData(r,&ptr,sizeof(void *));
784
- if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
785
- strcpy(r,name);
786
- return buff;
787
- }
788
-
789
- SWIGRUNTIME const char *
790
- SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
791
- if (*c != '_') {
792
- if (strcmp(c,"NULL") == 0) {
793
- *ptr = (void *) 0;
794
- return name;
795
- } else {
796
- return 0;
797
- }
798
- }
799
- return SWIG_UnpackData(++c,ptr,sizeof(void *));
800
- }
801
-
802
- SWIGRUNTIME char *
803
- SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
804
- char *r = buff;
805
- size_t lname = (name ? strlen(name) : 0);
806
- if ((2*sz + 2 + lname) > bsz) return 0;
807
- *(r++) = '_';
808
- r = SWIG_PackData(r,ptr,sz);
809
- if (lname) {
810
- strncpy(r,name,lname+1);
811
- } else {
812
- *r = 0;
813
- }
814
- return buff;
815
- }
816
-
817
- SWIGRUNTIME const char *
818
- SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
819
- if (*c != '_') {
820
- if (strcmp(c,"NULL") == 0) {
821
- memset(ptr,0,sz);
822
- return name;
823
- } else {
824
- return 0;
825
- }
826
- }
827
- return SWIG_UnpackData(++c,ptr,sz);
828
- }
829
-
830
- #ifdef __cplusplus
831
- }
832
- #endif
833
-
834
- /* Errors in SWIG */
835
- #define SWIG_UnknownError -1
836
- #define SWIG_IOError -2
837
- #define SWIG_RuntimeError -3
838
- #define SWIG_IndexError -4
839
- #define SWIG_TypeError -5
840
- #define SWIG_DivisionByZero -6
841
- #define SWIG_OverflowError -7
842
- #define SWIG_SyntaxError -8
843
- #define SWIG_ValueError -9
844
- #define SWIG_SystemError -10
845
- #define SWIG_AttributeError -11
846
- #define SWIG_MemoryError -12
847
- #define SWIG_NullReferenceError -13
848
-
849
-
850
-
851
- #include <ruby.h>
852
-
853
- /* Ruby 1.9.1 has a "memoisation optimisation" when compiling with GCC which
854
- * breaks using rb_intern as an lvalue, as SWIG does. We work around this
855
- * issue for now by disabling this.
856
- * https://sourceforge.net/tracker/?func=detail&aid=2859614&group_id=1645&atid=101645
857
- */
858
- #ifdef rb_intern
859
- # undef rb_intern
860
- #endif
861
-
862
- /* Remove global macros defined in Ruby's win32.h */
863
- #ifdef write
864
- # undef write
865
- #endif
866
- #ifdef read
867
- # undef read
868
- #endif
869
- #ifdef bind
870
- # undef bind
871
- #endif
872
- #ifdef close
873
- # undef close
874
- #endif
875
- #ifdef connect
876
- # undef connect
877
- #endif
878
-
879
-
880
- /* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
881
- #ifndef NUM2LL
882
- #define NUM2LL(x) NUM2LONG((x))
883
- #endif
884
- #ifndef LL2NUM
885
- #define LL2NUM(x) INT2NUM((long) (x))
886
- #endif
887
- #ifndef ULL2NUM
888
- #define ULL2NUM(x) UINT2NUM((unsigned long) (x))
889
- #endif
890
-
891
- /* Ruby 1.7 doesn't (yet) define NUM2ULL() */
892
- #ifndef NUM2ULL
893
- #ifdef HAVE_LONG_LONG
894
- #define NUM2ULL(x) rb_num2ull((x))
895
- #else
896
- #define NUM2ULL(x) NUM2ULONG(x)
897
- #endif
898
- #endif
899
-
900
- /* RSTRING_LEN, etc are new in Ruby 1.9, but ->ptr and ->len no longer work */
901
- /* Define these for older versions so we can just write code the new way */
902
- #ifndef RSTRING_LEN
903
- # define RSTRING_LEN(x) RSTRING(x)->len
904
- #endif
905
- #ifndef RSTRING_PTR
906
- # define RSTRING_PTR(x) RSTRING(x)->ptr
907
- #endif
908
- #ifndef RSTRING_END
909
- # define RSTRING_END(x) (RSTRING_PTR(x) + RSTRING_LEN(x))
910
- #endif
911
- #ifndef RARRAY_LEN
912
- # define RARRAY_LEN(x) RARRAY(x)->len
913
- #endif
914
- #ifndef RARRAY_PTR
915
- # define RARRAY_PTR(x) RARRAY(x)->ptr
916
- #endif
917
- #ifndef RFLOAT_VALUE
918
- # define RFLOAT_VALUE(x) RFLOAT(x)->value
919
- #endif
920
- #ifndef DOUBLE2NUM
921
- # define DOUBLE2NUM(x) rb_float_new(x)
922
- #endif
923
- #ifndef RHASH_TBL
924
- # define RHASH_TBL(x) (RHASH(x)->tbl)
925
- #endif
926
- #ifndef RHASH_ITER_LEV
927
- # define RHASH_ITER_LEV(x) (RHASH(x)->iter_lev)
928
- #endif
929
- #ifndef RHASH_IFNONE
930
- # define RHASH_IFNONE(x) (RHASH(x)->ifnone)
931
- #endif
932
- #ifndef RHASH_SIZE
933
- # define RHASH_SIZE(x) (RHASH(x)->tbl->num_entries)
934
- #endif
935
- #ifndef RHASH_EMPTY_P
936
- # define RHASH_EMPTY_P(x) (RHASH_SIZE(x) == 0)
937
- #endif
938
- #ifndef RSTRUCT_LEN
939
- # define RSTRUCT_LEN(x) RSTRUCT(x)->len
940
- #endif
941
- #ifndef RSTRUCT_PTR
942
- # define RSTRUCT_PTR(x) RSTRUCT(x)->ptr
943
- #endif
944
-
945
-
946
-
947
- /*
948
- * Need to be very careful about how these macros are defined, especially
949
- * when compiling C++ code or C code with an ANSI C compiler.
950
- *
951
- * VALUEFUNC(f) is a macro used to typecast a C function that implements
952
- * a Ruby method so that it can be passed as an argument to API functions
953
- * like rb_define_method() and rb_define_singleton_method().
954
- *
955
- * VOIDFUNC(f) is a macro used to typecast a C function that implements
956
- * either the "mark" or "free" stuff for a Ruby Data object, so that it
957
- * can be passed as an argument to API functions like Data_Wrap_Struct()
958
- * and Data_Make_Struct().
959
- */
960
-
961
- #ifdef __cplusplus
962
- # ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
963
- # define PROTECTFUNC(f) ((VALUE (*)()) f)
964
- # define VALUEFUNC(f) ((VALUE (*)()) f)
965
- # define VOIDFUNC(f) ((void (*)()) f)
966
- # else
967
- # ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
968
- # define PROTECTFUNC(f) ((VALUE (*)()) f)
969
- # define VALUEFUNC(f) ((VALUE (*)()) f)
970
- # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
971
- # else /* These definitions should work for Ruby 1.7+ */
972
- # define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
973
- # define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
974
- # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
975
- # endif
976
- # endif
977
- #else
978
- # define VALUEFUNC(f) (f)
979
- # define VOIDFUNC(f) (f)
980
- #endif
981
-
982
- /* Don't use for expressions have side effect */
983
- #ifndef RB_STRING_VALUE
984
- #define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s)))
985
- #endif
986
- #ifndef StringValue
987
- #define StringValue(s) RB_STRING_VALUE(s)
988
- #endif
989
- #ifndef StringValuePtr
990
- #define StringValuePtr(s) RSTRING_PTR(RB_STRING_VALUE(s))
991
- #endif
992
- #ifndef StringValueLen
993
- #define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
994
- #endif
995
- #ifndef SafeStringValue
996
- #define SafeStringValue(v) do {\
997
- StringValue(v);\
998
- rb_check_safe_str(v);\
999
- } while (0)
1000
- #endif
1001
-
1002
- #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
1003
- #define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1)
1004
- #define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new")
1005
- #endif
1006
-
1007
- static VALUE _mSWIG = Qnil;
1008
-
1009
- /* -----------------------------------------------------------------------------
1010
- * error manipulation
1011
- * ----------------------------------------------------------------------------- */
1012
-
1013
-
1014
- /* Define some additional error types */
1015
- #define SWIG_ObjectPreviouslyDeletedError -100
1016
-
1017
-
1018
- /* Define custom exceptions for errors that do not map to existing Ruby
1019
- exceptions. Note this only works for C++ since a global cannot be
1020
- initialized by a function in C. For C, fallback to rb_eRuntimeError.*/
1021
-
1022
- SWIGINTERN VALUE
1023
- getNullReferenceError(void) {
1024
- static int init = 0;
1025
- static VALUE rb_eNullReferenceError ;
1026
- if (!init) {
1027
- init = 1;
1028
- rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError);
1029
- }
1030
- return rb_eNullReferenceError;
1031
- }
1032
-
1033
- SWIGINTERN VALUE
1034
- getObjectPreviouslyDeletedError(void) {
1035
- static int init = 0;
1036
- static VALUE rb_eObjectPreviouslyDeleted ;
1037
- if (!init) {
1038
- init = 1;
1039
- rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError);
1040
- }
1041
- return rb_eObjectPreviouslyDeleted;
1042
- }
1043
-
1044
-
1045
- SWIGINTERN VALUE
1046
- SWIG_Ruby_ErrorType(int SWIG_code) {
1047
- VALUE type;
1048
- switch (SWIG_code) {
1049
- case SWIG_MemoryError:
1050
- type = rb_eNoMemError;
1051
- break;
1052
- case SWIG_IOError:
1053
- type = rb_eIOError;
1054
- break;
1055
- case SWIG_RuntimeError:
1056
- type = rb_eRuntimeError;
1057
- break;
1058
- case SWIG_IndexError:
1059
- type = rb_eIndexError;
1060
- break;
1061
- case SWIG_TypeError:
1062
- type = rb_eTypeError;
1063
- break;
1064
- case SWIG_DivisionByZero:
1065
- type = rb_eZeroDivError;
1066
- break;
1067
- case SWIG_OverflowError:
1068
- type = rb_eRangeError;
1069
- break;
1070
- case SWIG_SyntaxError:
1071
- type = rb_eSyntaxError;
1072
- break;
1073
- case SWIG_ValueError:
1074
- type = rb_eArgError;
1075
- break;
1076
- case SWIG_SystemError:
1077
- type = rb_eFatal;
1078
- break;
1079
- case SWIG_AttributeError:
1080
- type = rb_eRuntimeError;
1081
- break;
1082
- case SWIG_NullReferenceError:
1083
- type = getNullReferenceError();
1084
- break;
1085
- case SWIG_ObjectPreviouslyDeletedError:
1086
- type = getObjectPreviouslyDeletedError();
1087
- break;
1088
- case SWIG_UnknownError:
1089
- type = rb_eRuntimeError;
1090
- break;
1091
- default:
1092
- type = rb_eRuntimeError;
1093
- }
1094
- return type;
1095
- }
1096
-
1097
-
1098
- /* This function is called when a user inputs a wrong argument to
1099
- a method.
1100
- */
1101
- SWIGINTERN
1102
- const char* Ruby_Format_TypeError( const char* msg,
1103
- const char* type,
1104
- const char* name,
1105
- const int argn,
1106
- VALUE input )
1107
- {
1108
- char buf[128];
1109
- VALUE str;
1110
- VALUE asStr;
1111
- if ( msg && *msg )
1112
- {
1113
- str = rb_str_new2(msg);
1114
- }
1115
- else
1116
- {
1117
- str = rb_str_new(NULL, 0);
1118
- }
1119
-
1120
- str = rb_str_cat2( str, "Expected argument " );
1121
- sprintf( buf, "%d of type ", argn-1 );
1122
- str = rb_str_cat2( str, buf );
1123
- str = rb_str_cat2( str, type );
1124
- str = rb_str_cat2( str, ", but got " );
1125
- str = rb_str_cat2( str, rb_obj_classname(input) );
1126
- str = rb_str_cat2( str, " " );
1127
- asStr = rb_inspect(input);
1128
- if ( RSTRING_LEN(asStr) > 30 )
1129
- {
1130
- str = rb_str_cat( str, StringValuePtr(asStr), 30 );
1131
- str = rb_str_cat2( str, "..." );
1132
- }
1133
- else
1134
- {
1135
- str = rb_str_append( str, asStr );
1136
- }
1137
-
1138
- if ( name )
1139
- {
1140
- str = rb_str_cat2( str, "\n\tin SWIG method '" );
1141
- str = rb_str_cat2( str, name );
1142
- str = rb_str_cat2( str, "'" );
1143
- }
1144
-
1145
- return StringValuePtr( str );
1146
- }
1147
-
1148
- /* This function is called when an overloaded method fails */
1149
- SWIGINTERN
1150
- void Ruby_Format_OverloadedError(
1151
- const int argc,
1152
- const int maxargs,
1153
- const char* method,
1154
- const char* prototypes
1155
- )
1156
- {
1157
- const char* msg = "Wrong # of arguments";
1158
- if ( argc <= maxargs ) msg = "Wrong arguments";
1159
- rb_raise(rb_eArgError,"%s for overloaded method '%s'.\n"
1160
- "Possible C/C++ prototypes are:\n%s",
1161
- msg, method, prototypes);
1162
- }
1163
-
1164
- /* -----------------------------------------------------------------------------
1165
- * rubytracking.swg
1166
- *
1167
- * This file contains support for tracking mappings from
1168
- * Ruby objects to C++ objects. This functionality is needed
1169
- * to implement mark functions for Ruby's mark and sweep
1170
- * garbage collector.
1171
- * ----------------------------------------------------------------------------- */
1172
-
1173
- #ifdef __cplusplus
1174
- extern "C" {
1175
- #endif
1176
-
1177
- #if !defined(ST_DATA_T_DEFINED)
1178
- /* Needs to be explicitly included for Ruby 1.8 and earlier */
1179
- #include <st.h>
1180
- #endif
1181
-
1182
- /* Ruby 1.8 actually assumes the first case. */
1183
- #if SIZEOF_VOIDP == SIZEOF_LONG
1184
- # define SWIG2NUM(v) LONG2NUM((unsigned long)v)
1185
- # define NUM2SWIG(x) (unsigned long)NUM2LONG(x)
1186
- #elif SIZEOF_VOIDP == SIZEOF_LONG_LONG
1187
- # define SWIG2NUM(v) LL2NUM((unsigned long long)v)
1188
- # define NUM2SWIG(x) (unsigned long long)NUM2LL(x)
1189
- #else
1190
- # error sizeof(void*) is not the same as long or long long
1191
- #endif
1192
-
1193
- /* Global hash table to store Trackings from C/C++
1194
- structs to Ruby Objects.
1195
- */
1196
- static st_table* swig_ruby_trackings = NULL;
1197
-
1198
- static VALUE swig_ruby_trackings_count(ANYARGS) {
1199
- return SWIG2NUM(swig_ruby_trackings->num_entries);
1200
- }
1201
-
1202
-
1203
- /* Setup a hash table to store Trackings */
1204
- SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
1205
- /* Create a hash table to store Trackings from C++
1206
- objects to Ruby objects. */
1207
-
1208
- /* Try to see if some other .so has already created a
1209
- tracking hash table, which we keep hidden in an instance var
1210
- in the SWIG module.
1211
- This is done to allow multiple DSOs to share the same
1212
- tracking table.
1213
- */
1214
- VALUE trackings_value = Qnil;
1215
- /* change the variable name so that we can mix modules
1216
- compiled with older SWIG's - this used to be called "@__trackings__" */
1217
- ID trackings_id = rb_intern( "@__safetrackings__" );
1218
- VALUE verbose = rb_gv_get("VERBOSE");
1219
- rb_gv_set("VERBOSE", Qfalse);
1220
- trackings_value = rb_ivar_get( _mSWIG, trackings_id );
1221
- rb_gv_set("VERBOSE", verbose);
1222
-
1223
- /* The trick here is that we have to store the hash table
1224
- pointer in a Ruby variable. We do not want Ruby's GC to
1225
- treat this pointer as a Ruby object, so we convert it to
1226
- a Ruby numeric value. */
1227
- if (trackings_value == Qnil) {
1228
- /* No, it hasn't. Create one ourselves */
1229
- swig_ruby_trackings = st_init_numtable();
1230
- rb_ivar_set( _mSWIG, trackings_id, SWIG2NUM(swig_ruby_trackings) );
1231
- } else {
1232
- swig_ruby_trackings = (st_table*)NUM2SWIG(trackings_value);
1233
- }
1234
-
1235
- rb_define_virtual_variable("SWIG_TRACKINGS_COUNT", swig_ruby_trackings_count, NULL);
1236
- }
1237
-
1238
- /* Add a Tracking from a C/C++ struct to a Ruby object */
1239
- SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) {
1240
- /* Store the mapping to the global hash table. */
1241
- st_insert(swig_ruby_trackings, (st_data_t)ptr, object);
1242
- }
1243
-
1244
- /* Get the Ruby object that owns the specified C/C++ struct */
1245
- SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
1246
- /* Now lookup the value stored in the global hash table */
1247
- VALUE value;
1248
-
1249
- if (st_lookup(swig_ruby_trackings, (st_data_t)ptr, &value)) {
1250
- return value;
1251
- } else {
1252
- return Qnil;
1253
- }
1254
- }
1255
-
1256
- /* Remove a Tracking from a C/C++ struct to a Ruby object. It
1257
- is very important to remove objects once they are destroyed
1258
- since the same memory address may be reused later to create
1259
- a new object. */
1260
- SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
1261
- /* Delete the object from the hash table */
1262
- st_delete(swig_ruby_trackings, (st_data_t *)&ptr, NULL);
1263
- }
1264
-
1265
- /* This is a helper method that unlinks a Ruby object from its
1266
- underlying C++ object. This is needed if the lifetime of the
1267
- Ruby object is longer than the C++ object */
1268
- SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
1269
- VALUE object = SWIG_RubyInstanceFor(ptr);
1270
-
1271
- if (object != Qnil) {
1272
- if (TYPE(object) != T_DATA)
1273
- abort();
1274
- DATA_PTR(object) = 0;
1275
- }
1276
- }
1277
-
1278
- /* This is a helper method that iterates over all the trackings
1279
- passing the C++ object pointer and its related Ruby object
1280
- to the passed callback function. */
1281
-
1282
- /* Proxy method to abstract the internal trackings datatype */
1283
- static int swig_ruby_internal_iterate_callback(void* ptr, VALUE obj, void(*meth)(void* ptr, VALUE obj)) {
1284
- (*meth)(ptr, obj);
1285
- return ST_CONTINUE;
1286
- }
1287
-
1288
- SWIGRUNTIME void SWIG_RubyIterateTrackings( void(*meth)(void* ptr, VALUE obj) ) {
1289
- st_foreach(swig_ruby_trackings, (int (*)(ANYARGS))&swig_ruby_internal_iterate_callback, (st_data_t)meth);
1290
- }
1291
-
1292
- #ifdef __cplusplus
1293
- }
1294
- #endif
1295
-
1296
- /* -----------------------------------------------------------------------------
1297
- * Ruby API portion that goes into the runtime
1298
- * ----------------------------------------------------------------------------- */
1299
-
1300
- #ifdef __cplusplus
1301
- extern "C" {
1302
- #endif
1303
-
1304
- SWIGINTERN VALUE
1305
- SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
1306
- if (NIL_P(target)) {
1307
- target = o;
1308
- } else {
1309
- if (TYPE(target) != T_ARRAY) {
1310
- VALUE o2 = target;
1311
- target = rb_ary_new();
1312
- rb_ary_push(target, o2);
1313
- }
1314
- rb_ary_push(target, o);
1315
- }
1316
- return target;
1317
- }
1318
-
1319
- /* For ruby1.8.4 and earlier. */
1320
- #ifndef RUBY_INIT_STACK
1321
- RUBY_EXTERN void Init_stack(VALUE* addr);
1322
- # define RUBY_INIT_STACK \
1323
- VALUE variable_in_this_stack_frame; \
1324
- Init_stack(&variable_in_this_stack_frame);
1325
- #endif
1326
-
1327
-
1328
- #ifdef __cplusplus
1329
- }
1330
- #endif
1331
-
1332
-
1333
- /* -----------------------------------------------------------------------------
1334
- * rubyrun.swg
1335
- *
1336
- * This file contains the runtime support for Ruby modules
1337
- * and includes code for managing global variables and pointer
1338
- * type checking.
1339
- * ----------------------------------------------------------------------------- */
1340
-
1341
- /* For backward compatibility only */
1342
- #define SWIG_POINTER_EXCEPTION 0
1343
-
1344
- /* for raw pointers */
1345
- #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1346
- #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1347
- #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Ruby_NewPointerObj(ptr, type, flags)
1348
- #define SWIG_AcquirePtr(ptr, own) SWIG_Ruby_AcquirePtr(ptr, own)
1349
- #define swig_owntype swig_ruby_owntype
1350
-
1351
- /* for raw packed data */
1352
- #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags)
1353
- #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
1354
-
1355
- /* for class or struct pointers */
1356
- #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
1357
- #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
1358
-
1359
- /* for C or C++ function pointers */
1360
- #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_ConvertPtr(obj, pptr, type, 0)
1361
- #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NewPointerObj(ptr, type, 0)
1362
-
1363
- /* for C++ member pointers, ie, member methods */
1364
- #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty)
1365
- #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
1366
-
1367
-
1368
- /* Runtime API */
1369
-
1370
- #define SWIG_GetModule(clientdata) SWIG_Ruby_GetModule(clientdata)
1371
- #define SWIG_SetModule(clientdata, pointer) SWIG_Ruby_SetModule(pointer)
1372
-
1373
-
1374
- /* Error manipulation */
1375
-
1376
- #define SWIG_ErrorType(code) SWIG_Ruby_ErrorType(code)
1377
- #define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), "%s", msg)
1378
- #define SWIG_fail goto fail
1379
-
1380
-
1381
- /* Ruby-specific SWIG API */
1382
-
1383
- #define SWIG_InitRuntime() SWIG_Ruby_InitRuntime()
1384
- #define SWIG_define_class(ty) SWIG_Ruby_define_class(ty)
1385
- #define SWIG_NewClassInstance(value, ty) SWIG_Ruby_NewClassInstance(value, ty)
1386
- #define SWIG_MangleStr(value) SWIG_Ruby_MangleStr(value)
1387
- #define SWIG_CheckConvert(value, ty) SWIG_Ruby_CheckConvert(value, ty)
1388
-
1389
- #include "assert.h"
1390
-
1391
- /* -----------------------------------------------------------------------------
1392
- * pointers/data manipulation
1393
- * ----------------------------------------------------------------------------- */
1394
-
1395
- #ifdef __cplusplus
1396
- extern "C" {
1397
- #endif
1398
-
1399
- typedef struct {
1400
- VALUE klass;
1401
- VALUE mImpl;
1402
- void (*mark)(void *);
1403
- void (*destroy)(void *);
1404
- int trackObjects;
1405
- } swig_class;
1406
-
1407
-
1408
- /* Global pointer used to keep some internal SWIG stuff */
1409
- static VALUE _cSWIG_Pointer = Qnil;
1410
- static VALUE swig_runtime_data_type_pointer = Qnil;
1411
-
1412
- /* Global IDs used to keep some internal SWIG stuff */
1413
- static ID swig_arity_id = 0;
1414
- static ID swig_call_id = 0;
1415
-
1416
- /*
1417
- If your swig extension is to be run within an embedded ruby and has
1418
- director callbacks, you should set -DRUBY_EMBEDDED during compilation.
1419
- This will reset ruby's stack frame on each entry point from the main
1420
- program the first time a virtual director function is invoked (in a
1421
- non-recursive way).
1422
- If this is not done, you run the risk of Ruby trashing the stack.
1423
- */
1424
-
1425
- #ifdef RUBY_EMBEDDED
1426
-
1427
- # define SWIG_INIT_STACK \
1428
- if ( !swig_virtual_calls ) { RUBY_INIT_STACK } \
1429
- ++swig_virtual_calls;
1430
- # define SWIG_RELEASE_STACK --swig_virtual_calls;
1431
- # define Ruby_DirectorTypeMismatchException(x) \
1432
- rb_raise( rb_eTypeError, "%s", x ); return c_result;
1433
-
1434
- static unsigned int swig_virtual_calls = 0;
1435
-
1436
- #else /* normal non-embedded extension */
1437
-
1438
- # define SWIG_INIT_STACK
1439
- # define SWIG_RELEASE_STACK
1440
- # define Ruby_DirectorTypeMismatchException(x) \
1441
- throw Swig::DirectorTypeMismatchException( x );
1442
-
1443
- #endif /* RUBY_EMBEDDED */
1444
-
1445
-
1446
- SWIGRUNTIME VALUE
1447
- getExceptionClass(void) {
1448
- static int init = 0;
1449
- static VALUE rubyExceptionClass ;
1450
- if (!init) {
1451
- init = 1;
1452
- rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception"));
1453
- }
1454
- return rubyExceptionClass;
1455
- }
1456
-
1457
- /* This code checks to see if the Ruby object being raised as part
1458
- of an exception inherits from the Ruby class Exception. If so,
1459
- the object is simply returned. If not, then a new Ruby exception
1460
- object is created and that will be returned to Ruby.*/
1461
- SWIGRUNTIME VALUE
1462
- SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) {
1463
- VALUE exceptionClass = getExceptionClass();
1464
- if (rb_obj_is_kind_of(obj, exceptionClass)) {
1465
- return obj;
1466
- } else {
1467
- return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj));
1468
- }
1469
- }
1470
-
1471
- /* Initialize Ruby runtime support */
1472
- SWIGRUNTIME void
1473
- SWIG_Ruby_InitRuntime(void)
1474
- {
1475
- if (_mSWIG == Qnil) {
1476
- _mSWIG = rb_define_module("SWIG");
1477
- swig_call_id = rb_intern("call");
1478
- swig_arity_id = rb_intern("arity");
1479
- }
1480
- }
1481
-
1482
- /* Define Ruby class for C type */
1483
- SWIGRUNTIME void
1484
- SWIG_Ruby_define_class(swig_type_info *type)
1485
- {
1486
- char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
1487
- sprintf(klass_name, "TYPE%s", type->name);
1488
- if (NIL_P(_cSWIG_Pointer)) {
1489
- _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
1490
- rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
1491
- }
1492
- rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
1493
- free((void *) klass_name);
1494
- }
1495
-
1496
- /* Create a new pointer object */
1497
- SWIGRUNTIME VALUE
1498
- SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
1499
- {
1500
- int own = flags & SWIG_POINTER_OWN;
1501
- int track;
1502
- char *klass_name;
1503
- swig_class *sklass;
1504
- VALUE klass;
1505
- VALUE obj;
1506
-
1507
- if (!ptr)
1508
- return Qnil;
1509
-
1510
- if (type->clientdata) {
1511
- sklass = (swig_class *) type->clientdata;
1512
-
1513
- /* Are we tracking this class and have we already returned this Ruby object? */
1514
- track = sklass->trackObjects;
1515
- if (track) {
1516
- obj = SWIG_RubyInstanceFor(ptr);
1517
-
1518
- /* Check the object's type and make sure it has the correct type.
1519
- It might not in cases where methods do things like
1520
- downcast methods. */
1521
- if (obj != Qnil) {
1522
- VALUE value = rb_iv_get(obj, "@__swigtype__");
1523
- const char* type_name = RSTRING_PTR(value);
1524
-
1525
- if (strcmp(type->name, type_name) == 0) {
1526
- return obj;
1527
- }
1528
- }
1529
- }
1530
-
1531
- /* Create a new Ruby object */
1532
- obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark),
1533
- ( own ? VOIDFUNC(sklass->destroy) :
1534
- (track ? VOIDFUNC(SWIG_RubyRemoveTracking) : 0 )
1535
- ), ptr);
1536
-
1537
- /* If tracking is on for this class then track this object. */
1538
- if (track) {
1539
- SWIG_RubyAddTracking(ptr, obj);
1540
- }
1541
- } else {
1542
- klass_name = (char *) malloc(4 + strlen(type->name) + 1);
1543
- sprintf(klass_name, "TYPE%s", type->name);
1544
- klass = rb_const_get(_mSWIG, rb_intern(klass_name));
1545
- free((void *) klass_name);
1546
- obj = Data_Wrap_Struct(klass, 0, 0, ptr);
1547
- }
1548
- rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
1549
-
1550
- return obj;
1551
- }
1552
-
1553
- /* Create a new class instance (always owned) */
1554
- SWIGRUNTIME VALUE
1555
- SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type)
1556
- {
1557
- VALUE obj;
1558
- swig_class *sklass = (swig_class *) type->clientdata;
1559
- obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0);
1560
- rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
1561
- return obj;
1562
- }
1563
-
1564
- /* Get type mangle from class name */
1565
- SWIGRUNTIMEINLINE char *
1566
- SWIG_Ruby_MangleStr(VALUE obj)
1567
- {
1568
- VALUE stype = rb_iv_get(obj, "@__swigtype__");
1569
- return StringValuePtr(stype);
1570
- }
1571
-
1572
- /* Acquire a pointer value */
1573
- typedef struct {
1574
- void (*datafree)(void *);
1575
- int own;
1576
- } swig_ruby_owntype;
1577
-
1578
- SWIGRUNTIME swig_ruby_owntype
1579
- SWIG_Ruby_AcquirePtr(VALUE obj, swig_ruby_owntype own) {
1580
- swig_ruby_owntype oldown = {0, 0};
1581
- if (obj) {
1582
- oldown.datafree = RDATA(obj)->dfree;
1583
- RDATA(obj)->dfree = own.datafree;
1584
- }
1585
- return oldown;
1586
- }
1587
-
1588
- /* Convert a pointer value */
1589
- SWIGRUNTIME int
1590
- SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, swig_ruby_owntype *own)
1591
- {
1592
- char *c;
1593
- swig_cast_info *tc;
1594
- void *vptr = 0;
1595
-
1596
- /* Grab the pointer */
1597
- if (NIL_P(obj)) {
1598
- if (ptr)
1599
- *ptr = 0;
1600
- return SWIG_OK;
1601
- } else {
1602
- if (TYPE(obj) != T_DATA) {
1603
- return SWIG_ERROR;
1604
- }
1605
- Data_Get_Struct(obj, void, vptr);
1606
- }
1607
-
1608
- if (own) {
1609
- own->datafree = RDATA(obj)->dfree;
1610
- own->own = 0;
1611
- }
1612
-
1613
- /* Check to see if the input object is giving up ownership
1614
- of the underlying C struct or C++ object. If so then we
1615
- need to reset the destructor since the Ruby object no
1616
- longer owns the underlying C++ object.*/
1617
- if (flags & SWIG_POINTER_DISOWN) {
1618
- /* Is tracking on for this class? */
1619
- int track = 0;
1620
- if (ty && ty->clientdata) {
1621
- swig_class *sklass = (swig_class *) ty->clientdata;
1622
- track = sklass->trackObjects;
1623
- }
1624
-
1625
- if (track) {
1626
- /* We are tracking objects for this class. Thus we change the destructor
1627
- * to SWIG_RubyRemoveTracking. This allows us to
1628
- * remove the mapping from the C++ to Ruby object
1629
- * when the Ruby object is garbage collected. If we don't
1630
- * do this, then it is possible we will return a reference
1631
- * to a Ruby object that no longer exists thereby crashing Ruby. */
1632
- RDATA(obj)->dfree = SWIG_RubyRemoveTracking;
1633
- } else {
1634
- RDATA(obj)->dfree = 0;
1635
- }
1636
- }
1637
-
1638
- /* Do type-checking if type info was provided */
1639
- if (ty) {
1640
- if ((c = SWIG_MangleStr(obj)) == NULL) {
1641
- return SWIG_ERROR;
1642
- }
1643
- tc = SWIG_TypeCheck(c, ty);
1644
- if (!tc) {
1645
- return SWIG_ERROR;
1646
- } else {
1647
- if (vptr == 0) {
1648
- /* The object has already been deleted */
1649
- return SWIG_ObjectPreviouslyDeletedError;
1650
- }
1651
- if (ptr) {
1652
- if (tc->type == ty) {
1653
- *ptr = vptr;
1654
- } else {
1655
- int newmemory = 0;
1656
- *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
1657
- if (newmemory == SWIG_CAST_NEW_MEMORY) {
1658
- assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
1659
- if (own)
1660
- own->own = own->own | SWIG_CAST_NEW_MEMORY;
1661
- }
1662
- }
1663
- }
1664
- }
1665
- } else {
1666
- if (ptr)
1667
- *ptr = vptr;
1668
- }
1669
-
1670
- return SWIG_OK;
1671
- }
1672
-
1673
- /* Check convert */
1674
- SWIGRUNTIMEINLINE int
1675
- SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty)
1676
- {
1677
- char *c = SWIG_MangleStr(obj);
1678
- if (!c) return 0;
1679
- return SWIG_TypeCheck(c,ty) != 0;
1680
- }
1681
-
1682
- SWIGRUNTIME VALUE
1683
- SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
1684
- char result[1024];
1685
- char *r = result;
1686
- if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
1687
- *(r++) = '_';
1688
- r = SWIG_PackData(r, ptr, sz);
1689
- strcpy(r, type->name);
1690
- return rb_str_new2(result);
1691
- }
1692
-
1693
- /* Convert a packed value value */
1694
- SWIGRUNTIME int
1695
- SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
1696
- swig_cast_info *tc;
1697
- const char *c;
1698
-
1699
- if (TYPE(obj) != T_STRING) goto type_error;
1700
- c = StringValuePtr(obj);
1701
- /* Pointer values must start with leading underscore */
1702
- if (*c != '_') goto type_error;
1703
- c++;
1704
- c = SWIG_UnpackData(c, ptr, sz);
1705
- if (ty) {
1706
- tc = SWIG_TypeCheck(c, ty);
1707
- if (!tc) goto type_error;
1708
- }
1709
- return SWIG_OK;
1710
-
1711
- type_error:
1712
- return SWIG_ERROR;
1713
- }
1714
-
1715
- SWIGRUNTIME swig_module_info *
1716
- SWIG_Ruby_GetModule(void *SWIGUNUSEDPARM(clientdata))
1717
- {
1718
- VALUE pointer;
1719
- swig_module_info *ret = 0;
1720
- VALUE verbose = rb_gv_get("VERBOSE");
1721
-
1722
- /* temporarily disable warnings, since the pointer check causes warnings with 'ruby -w' */
1723
- rb_gv_set("VERBOSE", Qfalse);
1724
-
1725
- /* first check if pointer already created */
1726
- pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
1727
- if (pointer != Qnil) {
1728
- Data_Get_Struct(pointer, swig_module_info, ret);
1729
- }
1730
-
1731
- /* reinstate warnings */
1732
- rb_gv_set("VERBOSE", verbose);
1733
- return ret;
1734
- }
1735
-
1736
- SWIGRUNTIME void
1737
- SWIG_Ruby_SetModule(swig_module_info *pointer)
1738
- {
1739
- /* register a new class */
1740
- VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
1741
- /* create and store the structure pointer to a global variable */
1742
- swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer);
1743
- rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
1744
- }
1745
-
1746
- /* This function can be used to check whether a proc or method or similarly
1747
- callable function has been passed. Usually used in a %typecheck, like:
1748
-
1749
- %typecheck(c_callback_t, precedence=SWIG_TYPECHECK_POINTER) {
1750
- $result = SWIG_Ruby_isCallable( $input );
1751
- }
1752
- */
1753
- SWIGINTERN
1754
- int SWIG_Ruby_isCallable( VALUE proc )
1755
- {
1756
- if ( rb_respond_to( proc, swig_call_id ) )
1757
- return 1;
1758
- return 0;
1759
- }
1760
-
1761
- /* This function can be used to check the arity (number of arguments)
1762
- a proc or method can take. Usually used in a %typecheck.
1763
- Valid arities will be that equal to minimal or those < 0
1764
- which indicate a variable number of parameters at the end.
1765
- */
1766
- SWIGINTERN
1767
- int SWIG_Ruby_arity( VALUE proc, int minimal )
1768
- {
1769
- if ( rb_respond_to( proc, swig_arity_id ) )
1770
- {
1771
- VALUE num = rb_funcall( proc, swig_arity_id, 0 );
1772
- int arity = NUM2INT(num);
1773
- if ( arity < 0 && (arity+1) < -minimal ) return 1;
1774
- if ( arity == minimal ) return 1;
1775
- return 1;
1776
- }
1777
- return 0;
1778
- }
1779
-
1780
-
1781
- #ifdef __cplusplus
1782
- }
1783
- #endif
1784
-
1785
-
1786
-
1787
- #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
1788
-
1789
- #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
1790
-
1791
-
1792
-
1793
- /* -------- TYPES TABLE (BEGIN) -------- */
1794
-
1795
- #define SWIGTYPE_p_char swig_types[0]
1796
- #define SWIGTYPE_p_f_p_struct_libinjection_sqli_state_int_p_q_const__char_size_t__char swig_types[1]
1797
- #define SWIGTYPE_p_libinjection_sqli_state swig_types[2]
1798
- #define SWIGTYPE_p_libinjection_sqli_token swig_types[3]
1799
- #define SWIGTYPE_p_void swig_types[4]
1800
- static swig_type_info *swig_types[6];
1801
- static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0};
1802
- #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
1803
- #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
1804
-
1805
- /* -------- TYPES TABLE (END) -------- */
1806
-
1807
- #define SWIG_init Init_libinjection
1808
- #define SWIG_name "Libinjection"
1809
-
1810
- static VALUE mLibinjection;
1811
-
1812
- #define SWIG_RUBY_THREAD_BEGIN_BLOCK
1813
- #define SWIG_RUBY_THREAD_END_BLOCK
1814
-
1815
-
1816
- #define SWIGVERSION 0x030008
1817
- #define SWIG_VERSION SWIGVERSION
1818
-
1819
-
1820
- #define SWIG_as_voidptr(a) (void *)((const void *)(a))
1821
- #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a))
1822
-
1823
-
1824
- #include "libinjection.h"
1825
- #include "libinjection_sqli.h"
1826
- #include <stddef.h>
1827
-
1828
- int is_sqli(const char* s, size_t slen)
1829
- {
1830
- char fingerprint[8];
1831
- int result = libinjection_sqli(s, slen, fingerprint);
1832
- /*rb_warn("%s", &fingerprint[0]);*/
1833
- return result;
1834
- }
1835
-
1836
-
1837
- #ifdef __cplusplus
1838
- extern "C" {
1839
- #endif
1840
-
1841
- /* Ruby 1.9 changed the file name of this header */
1842
- #ifdef HAVE_RUBY_IO_H
1843
- #include "ruby/io.h"
1844
- #else
1845
- #include "rubyio.h"
1846
- #endif
1847
-
1848
- #ifdef __cplusplus
1849
- }
1850
- #endif
1851
-
1852
-
1853
- #ifdef __cplusplus
1854
- extern "C" {
1855
- #endif
1856
- #ifdef HAVE_SYS_TIME_H
1857
- # include <sys/time.h>
1858
- struct timeval rb_time_timeval(VALUE);
1859
- #endif
1860
- #ifdef __cplusplus
1861
- }
1862
- #endif
1863
-
1864
-
1865
- SWIGINTERN swig_type_info*
1866
- SWIG_pchar_descriptor(void)
1867
- {
1868
- static int init = 0;
1869
- static swig_type_info* info = 0;
1870
- if (!init) {
1871
- info = SWIG_TypeQuery("_p_char");
1872
- init = 1;
1873
- }
1874
- return info;
1875
- }
1876
-
1877
-
1878
- SWIGINTERNINLINE VALUE
1879
- SWIG_FromCharPtrAndSize(const char* carray, size_t size)
1880
- {
1881
- if (carray) {
1882
- if (size > LONG_MAX) {
1883
- swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
1884
- return pchar_descriptor ?
1885
- SWIG_NewPointerObj((char *)(carray), pchar_descriptor, 0) : Qnil;
1886
- } else {
1887
- return rb_str_new(carray, (long)(size));
1888
- }
1889
- } else {
1890
- return Qnil;
1891
- }
1892
- }
1893
-
1894
-
1895
- SWIGINTERNINLINE VALUE
1896
- SWIG_FromCharPtr(const char *cptr)
1897
- {
1898
- return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
1899
- }
1900
-
1901
-
1902
- SWIGINTERN int
1903
- SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
1904
- {
1905
- if (TYPE(obj) == T_STRING) {
1906
- char *cstr = StringValuePtr(obj);
1907
- size_t size = RSTRING_LEN(obj) + 1;
1908
- if (cptr) {
1909
- if (alloc) {
1910
- if (*alloc == SWIG_NEWOBJ) {
1911
- *cptr = (char *)memcpy((char *)malloc((size)*sizeof(char)), cstr, sizeof(char)*(size));
1912
- } else {
1913
- *cptr = cstr;
1914
- *alloc = SWIG_OLDOBJ;
1915
- }
1916
- }
1917
- }
1918
- if (psize) *psize = size;
1919
- return SWIG_OK;
1920
- } else {
1921
- swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
1922
- if (pchar_descriptor) {
1923
- void* vptr = 0;
1924
- if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
1925
- if (cptr) *cptr = (char *)vptr;
1926
- if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0;
1927
- if (alloc) *alloc = SWIG_OLDOBJ;
1928
- return SWIG_OK;
1929
- }
1930
- }
1931
- }
1932
- return SWIG_TypeError;
1933
- }
1934
-
1935
-
1936
-
1937
-
1938
-
1939
- SWIGINTERN VALUE
1940
- SWIG_ruby_failed(void)
1941
- {
1942
- return Qnil;
1943
- }
1944
-
1945
-
1946
- /*@SWIG:/usr/local/Cellar/swig/3.0.8/share/swig/3.0.8/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
1947
- SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args)
1948
- {
1949
- VALUE obj = args[0];
1950
- VALUE type = TYPE(obj);
1951
- unsigned long *res = (unsigned long *)(args[1]);
1952
- *res = type == T_FIXNUM ? NUM2ULONG(obj) : rb_big2ulong(obj);
1953
- return obj;
1954
- }
1955
- /*@SWIG@*/
1956
-
1957
- SWIGINTERN int
1958
- SWIG_AsVal_unsigned_SS_long (VALUE obj, unsigned long *val)
1959
- {
1960
- VALUE type = TYPE(obj);
1961
- if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
1962
- unsigned long v;
1963
- VALUE a[2];
1964
- a[0] = obj;
1965
- a[1] = (VALUE)(&v);
1966
- if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
1967
- if (val) *val = v;
1968
- return SWIG_OK;
1969
- }
1970
- }
1971
- return SWIG_TypeError;
1972
- }
1973
-
1974
-
1975
- SWIGINTERNINLINE int
1976
- SWIG_AsVal_size_t (VALUE obj, size_t *val)
1977
- {
1978
- unsigned long v;
1979
- int res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0);
1980
- if (SWIG_IsOK(res) && val) *val = (size_t)(v);
1981
- return res;
1982
- }
1983
-
1984
-
1985
- #include <limits.h>
1986
- #if !defined(SWIG_NO_LLONG_MAX)
1987
- # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
1988
- # define LLONG_MAX __LONG_LONG_MAX__
1989
- # define LLONG_MIN (-LLONG_MAX - 1LL)
1990
- # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
1991
- # endif
1992
- #endif
1993
-
1994
-
1995
- #define SWIG_From_long LONG2NUM
1996
-
1997
-
1998
- SWIGINTERNINLINE VALUE
1999
- SWIG_From_int (int value)
2000
- {
2001
- return SWIG_From_long (value);
2002
- }
2003
-
2004
-
2005
- SWIGINTERNINLINE VALUE
2006
- SWIG_From_char (char c)
2007
- {
2008
- return SWIG_FromCharPtrAndSize(&c,1);
2009
- }
2010
-
2011
-
2012
- SWIGINTERNINLINE VALUE
2013
- SWIG_From_unsigned_SS_long (unsigned long value)
2014
- {
2015
- return ULONG2NUM(value);
2016
- }
2017
-
2018
-
2019
- SWIGINTERNINLINE VALUE
2020
- SWIG_From_size_t (size_t value)
2021
- {
2022
- return SWIG_From_unsigned_SS_long ((unsigned long)(value));
2023
- }
2024
-
2025
-
2026
- size_t
2027
- SWIG_strnlen(const char* s, size_t maxlen)
2028
- {
2029
- const char *p;
2030
- for (p = s; maxlen-- && *p; p++)
2031
- ;
2032
- return p - s;
2033
- }
2034
-
2035
-
2036
- /*@SWIG:/usr/local/Cellar/swig/3.0.8/share/swig/3.0.8/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
2037
- SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
2038
- {
2039
- VALUE obj = args[0];
2040
- VALUE type = TYPE(obj);
2041
- long *res = (long *)(args[1]);
2042
- *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj);
2043
- return obj;
2044
- }
2045
- /*@SWIG@*/
2046
-
2047
- SWIGINTERN int
2048
- SWIG_AsVal_long (VALUE obj, long* val)
2049
- {
2050
- VALUE type = TYPE(obj);
2051
- if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
2052
- long v;
2053
- VALUE a[2];
2054
- a[0] = obj;
2055
- a[1] = (VALUE)(&v);
2056
- if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
2057
- if (val) *val = v;
2058
- return SWIG_OK;
2059
- }
2060
- }
2061
- return SWIG_TypeError;
2062
- }
2063
-
2064
-
2065
- SWIGINTERN int
2066
- SWIG_AsVal_int (VALUE obj, int *val)
2067
- {
2068
- long v;
2069
- int res = SWIG_AsVal_long (obj, &v);
2070
- if (SWIG_IsOK(res)) {
2071
- if ((v < INT_MIN || v > INT_MAX)) {
2072
- return SWIG_OverflowError;
2073
- } else {
2074
- if (val) *val = (int)(v);
2075
- }
2076
- }
2077
- return res;
2078
- }
2079
-
2080
- SWIGINTERN VALUE
2081
- _wrap_version(int argc, VALUE *argv, VALUE self) {
2082
- char *result = 0 ;
2083
- VALUE vresult = Qnil;
2084
-
2085
- if ((argc < 0) || (argc > 0)) {
2086
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2087
- }
2088
- result = (char *)libinjection_version();
2089
- vresult = SWIG_FromCharPtr((const char *)result);
2090
- return vresult;
2091
- fail:
2092
- return Qnil;
2093
- }
2094
-
2095
-
2096
- SWIGINTERN VALUE
2097
- _wrap_sqli(int argc, VALUE *argv, VALUE self) {
2098
- char *arg1 = (char *) 0 ;
2099
- size_t arg2 ;
2100
- char *arg3 ;
2101
- int res1 ;
2102
- char *buf1 = 0 ;
2103
- size_t size1 = 0 ;
2104
- int alloc1 = 0 ;
2105
- int res3 ;
2106
- char *buf3 = 0 ;
2107
- int alloc3 = 0 ;
2108
- int result;
2109
- VALUE vresult = Qnil;
2110
-
2111
- if ((argc < 2) || (argc > 2)) {
2112
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2113
- }
2114
- res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, &size1, &alloc1);
2115
- if (!SWIG_IsOK(res1)) {
2116
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","libinjection_sqli", 1, argv[0] ));
2117
- }
2118
- arg1 = (char *)(buf1);
2119
- arg2 = (size_t)(size1 - 1);
2120
- res3 = SWIG_AsCharPtrAndSize(argv[1], &buf3, NULL, &alloc3);
2121
- if (!SWIG_IsOK(res3)) {
2122
- SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char []","libinjection_sqli", 3, argv[1] ));
2123
- }
2124
- arg3 = (char *)(buf3);
2125
- result = (int)libinjection_sqli((char const *)arg1,arg2,arg3);
2126
- vresult = SWIG_From_int((int)(result));
2127
- if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2128
- if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
2129
- return vresult;
2130
- fail:
2131
- if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2132
- if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
2133
- return Qnil;
2134
- }
2135
-
2136
-
2137
- SWIGINTERN VALUE
2138
- _wrap_is_xss(int argc, VALUE *argv, VALUE self) {
2139
- char *arg1 = (char *) 0 ;
2140
- size_t arg2 ;
2141
- int res1 ;
2142
- char *buf1 = 0 ;
2143
- size_t size1 = 0 ;
2144
- int alloc1 = 0 ;
2145
- int result;
2146
- VALUE vresult = Qnil;
2147
-
2148
- if ((argc < 1) || (argc > 1)) {
2149
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2150
- }
2151
- res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, &size1, &alloc1);
2152
- if (!SWIG_IsOK(res1)) {
2153
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","libinjection_xss", 1, argv[0] ));
2154
- }
2155
- arg1 = (char *)(buf1);
2156
- arg2 = (size_t)(size1 - 1);
2157
- result = (int)libinjection_xss((char const *)arg1,arg2);
2158
- vresult = SWIG_From_int((int)(result));
2159
- if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2160
- return vresult;
2161
- fail:
2162
- if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2163
- return Qnil;
2164
- }
2165
-
2166
-
2167
- static swig_class SwigClassSqli_token;
2168
-
2169
- SWIGINTERN VALUE
2170
- _wrap_sqli_token_type_get(int argc, VALUE *argv, VALUE self) {
2171
- struct libinjection_sqli_token *arg1 = (struct libinjection_sqli_token *) 0 ;
2172
- void *argp1 = 0 ;
2173
- int res1 = 0 ;
2174
- char result;
2175
- VALUE vresult = Qnil;
2176
-
2177
- if ((argc < 0) || (argc > 0)) {
2178
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2179
- }
2180
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_libinjection_sqli_token, 0 | 0 );
2181
- if (!SWIG_IsOK(res1)) {
2182
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_token *","type", 1, self ));
2183
- }
2184
- arg1 = (struct libinjection_sqli_token *)(argp1);
2185
- result = (char) ((arg1)->type);
2186
- vresult = SWIG_From_char((char)(result));
2187
- return vresult;
2188
- fail:
2189
- return Qnil;
2190
- }
2191
-
2192
-
2193
- SWIGINTERN VALUE
2194
- _wrap_sqli_token_str_open_get(int argc, VALUE *argv, VALUE self) {
2195
- struct libinjection_sqli_token *arg1 = (struct libinjection_sqli_token *) 0 ;
2196
- void *argp1 = 0 ;
2197
- int res1 = 0 ;
2198
- char result;
2199
- VALUE vresult = Qnil;
2200
-
2201
- if ((argc < 0) || (argc > 0)) {
2202
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2203
- }
2204
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_libinjection_sqli_token, 0 | 0 );
2205
- if (!SWIG_IsOK(res1)) {
2206
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_token *","str_open", 1, self ));
2207
- }
2208
- arg1 = (struct libinjection_sqli_token *)(argp1);
2209
- result = (char) ((arg1)->str_open);
2210
- vresult = SWIG_From_char((char)(result));
2211
- return vresult;
2212
- fail:
2213
- return Qnil;
2214
- }
2215
-
2216
-
2217
- SWIGINTERN VALUE
2218
- _wrap_sqli_token_str_close_get(int argc, VALUE *argv, VALUE self) {
2219
- struct libinjection_sqli_token *arg1 = (struct libinjection_sqli_token *) 0 ;
2220
- void *argp1 = 0 ;
2221
- int res1 = 0 ;
2222
- char result;
2223
- VALUE vresult = Qnil;
2224
-
2225
- if ((argc < 0) || (argc > 0)) {
2226
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2227
- }
2228
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_libinjection_sqli_token, 0 | 0 );
2229
- if (!SWIG_IsOK(res1)) {
2230
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_token *","str_close", 1, self ));
2231
- }
2232
- arg1 = (struct libinjection_sqli_token *)(argp1);
2233
- result = (char) ((arg1)->str_close);
2234
- vresult = SWIG_From_char((char)(result));
2235
- return vresult;
2236
- fail:
2237
- return Qnil;
2238
- }
2239
-
2240
-
2241
- SWIGINTERN VALUE
2242
- _wrap_sqli_token_pos_get(int argc, VALUE *argv, VALUE self) {
2243
- struct libinjection_sqli_token *arg1 = (struct libinjection_sqli_token *) 0 ;
2244
- void *argp1 = 0 ;
2245
- int res1 = 0 ;
2246
- size_t result;
2247
- VALUE vresult = Qnil;
2248
-
2249
- if ((argc < 0) || (argc > 0)) {
2250
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2251
- }
2252
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_libinjection_sqli_token, 0 | 0 );
2253
- if (!SWIG_IsOK(res1)) {
2254
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_token *","pos", 1, self ));
2255
- }
2256
- arg1 = (struct libinjection_sqli_token *)(argp1);
2257
- result = ((arg1)->pos);
2258
- vresult = SWIG_From_size_t((size_t)(result));
2259
- return vresult;
2260
- fail:
2261
- return Qnil;
2262
- }
2263
-
2264
-
2265
- SWIGINTERN VALUE
2266
- _wrap_sqli_token_len_get(int argc, VALUE *argv, VALUE self) {
2267
- struct libinjection_sqli_token *arg1 = (struct libinjection_sqli_token *) 0 ;
2268
- void *argp1 = 0 ;
2269
- int res1 = 0 ;
2270
- size_t result;
2271
- VALUE vresult = Qnil;
2272
-
2273
- if ((argc < 0) || (argc > 0)) {
2274
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2275
- }
2276
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_libinjection_sqli_token, 0 | 0 );
2277
- if (!SWIG_IsOK(res1)) {
2278
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_token *","len", 1, self ));
2279
- }
2280
- arg1 = (struct libinjection_sqli_token *)(argp1);
2281
- result = ((arg1)->len);
2282
- vresult = SWIG_From_size_t((size_t)(result));
2283
- return vresult;
2284
- fail:
2285
- return Qnil;
2286
- }
2287
-
2288
-
2289
- SWIGINTERN VALUE
2290
- _wrap_sqli_token_count_get(int argc, VALUE *argv, VALUE self) {
2291
- struct libinjection_sqli_token *arg1 = (struct libinjection_sqli_token *) 0 ;
2292
- void *argp1 = 0 ;
2293
- int res1 = 0 ;
2294
- int result;
2295
- VALUE vresult = Qnil;
2296
-
2297
- if ((argc < 0) || (argc > 0)) {
2298
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2299
- }
2300
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_libinjection_sqli_token, 0 | 0 );
2301
- if (!SWIG_IsOK(res1)) {
2302
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_token *","count", 1, self ));
2303
- }
2304
- arg1 = (struct libinjection_sqli_token *)(argp1);
2305
- result = (int) ((arg1)->count);
2306
- vresult = SWIG_From_int((int)(result));
2307
- return vresult;
2308
- fail:
2309
- return Qnil;
2310
- }
2311
-
2312
-
2313
- SWIGINTERN VALUE
2314
- _wrap_sqli_token_val_get(int argc, VALUE *argv, VALUE self) {
2315
- struct libinjection_sqli_token *arg1 = (struct libinjection_sqli_token *) 0 ;
2316
- void *argp1 = 0 ;
2317
- int res1 = 0 ;
2318
- char *result = 0 ;
2319
- VALUE vresult = Qnil;
2320
-
2321
- if ((argc < 0) || (argc > 0)) {
2322
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2323
- }
2324
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_libinjection_sqli_token, 0 | 0 );
2325
- if (!SWIG_IsOK(res1)) {
2326
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_token *","val", 1, self ));
2327
- }
2328
- arg1 = (struct libinjection_sqli_token *)(argp1);
2329
- result = (char *)(char *) ((arg1)->val);
2330
- {
2331
- size_t size = SWIG_strnlen(result, 32);
2332
-
2333
-
2334
-
2335
- vresult = SWIG_FromCharPtrAndSize(result, size);
2336
- }
2337
- return vresult;
2338
- fail:
2339
- return Qnil;
2340
- }
2341
-
2342
-
2343
- #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
2344
- SWIGINTERN VALUE
2345
- _wrap_sqli_token_allocate(VALUE self) {
2346
- #else
2347
- SWIGINTERN VALUE
2348
- _wrap_sqli_token_allocate(int argc, VALUE *argv, VALUE self) {
2349
- #endif
2350
-
2351
-
2352
- VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_libinjection_sqli_token);
2353
- #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
2354
- rb_obj_call_init(vresult, argc, argv);
2355
- #endif
2356
- return vresult;
2357
- }
2358
-
2359
-
2360
- SWIGINTERN VALUE
2361
- _wrap_new_sqli_token(int argc, VALUE *argv, VALUE self) {
2362
- struct libinjection_sqli_token *result = 0 ;
2363
-
2364
- if ((argc < 0) || (argc > 0)) {
2365
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2366
- }
2367
- result = (struct libinjection_sqli_token *)calloc(1, sizeof(struct libinjection_sqli_token));
2368
- DATA_PTR(self) = result;
2369
- return self;
2370
- fail:
2371
- return Qnil;
2372
- }
2373
-
2374
-
2375
- SWIGINTERN void
2376
- free_libinjection_sqli_token(void *self) {
2377
- struct libinjection_sqli_token *arg1 = (struct libinjection_sqli_token *)self;
2378
- free((char *) arg1);
2379
- }
2380
-
2381
- static swig_class SwigClassSqli_state;
2382
-
2383
- SWIGINTERN VALUE
2384
- _wrap_sqli_state_s_get(int argc, VALUE *argv, VALUE self) {
2385
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
2386
- void *argp1 = 0 ;
2387
- int res1 = 0 ;
2388
- char *result = 0 ;
2389
- VALUE vresult = Qnil;
2390
-
2391
- if ((argc < 0) || (argc > 0)) {
2392
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2393
- }
2394
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
2395
- if (!SWIG_IsOK(res1)) {
2396
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","s", 1, self ));
2397
- }
2398
- arg1 = (struct libinjection_sqli_state *)(argp1);
2399
- result = (char *) ((arg1)->s);
2400
- vresult = SWIG_FromCharPtr((const char *)result);
2401
- return vresult;
2402
- fail:
2403
- return Qnil;
2404
- }
2405
-
2406
-
2407
- SWIGINTERN VALUE
2408
- _wrap_sqli_state_slen_get(int argc, VALUE *argv, VALUE self) {
2409
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
2410
- void *argp1 = 0 ;
2411
- int res1 = 0 ;
2412
- size_t result;
2413
- VALUE vresult = Qnil;
2414
-
2415
- if ((argc < 0) || (argc > 0)) {
2416
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2417
- }
2418
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
2419
- if (!SWIG_IsOK(res1)) {
2420
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","slen", 1, self ));
2421
- }
2422
- arg1 = (struct libinjection_sqli_state *)(argp1);
2423
- result = ((arg1)->slen);
2424
- vresult = SWIG_From_size_t((size_t)(result));
2425
- return vresult;
2426
- fail:
2427
- return Qnil;
2428
- }
2429
-
2430
-
2431
- SWIGINTERN VALUE
2432
- _wrap_sqli_state_lookup_get(int argc, VALUE *argv, VALUE self) {
2433
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
2434
- void *argp1 = 0 ;
2435
- int res1 = 0 ;
2436
- ptr_lookup_fn result;
2437
- VALUE vresult = Qnil;
2438
-
2439
- if ((argc < 0) || (argc > 0)) {
2440
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2441
- }
2442
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
2443
- if (!SWIG_IsOK(res1)) {
2444
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","lookup", 1, self ));
2445
- }
2446
- arg1 = (struct libinjection_sqli_state *)(argp1);
2447
- result = (ptr_lookup_fn) ((arg1)->lookup);
2448
- vresult = SWIG_NewFunctionPtrObj((void *)(result), SWIGTYPE_p_f_p_struct_libinjection_sqli_state_int_p_q_const__char_size_t__char);
2449
- return vresult;
2450
- fail:
2451
- return Qnil;
2452
- }
2453
-
2454
-
2455
- SWIGINTERN VALUE
2456
- _wrap_sqli_state_userdata_get(int argc, VALUE *argv, VALUE self) {
2457
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
2458
- void *argp1 = 0 ;
2459
- int res1 = 0 ;
2460
- void *result = 0 ;
2461
- VALUE vresult = Qnil;
2462
-
2463
- if ((argc < 0) || (argc > 0)) {
2464
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2465
- }
2466
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
2467
- if (!SWIG_IsOK(res1)) {
2468
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","userdata", 1, self ));
2469
- }
2470
- arg1 = (struct libinjection_sqli_state *)(argp1);
2471
- result = (void *) ((arg1)->userdata);
2472
- vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
2473
- return vresult;
2474
- fail:
2475
- return Qnil;
2476
- }
2477
-
2478
-
2479
- SWIGINTERN VALUE
2480
- _wrap_sqli_state_flags_get(int argc, VALUE *argv, VALUE self) {
2481
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
2482
- void *argp1 = 0 ;
2483
- int res1 = 0 ;
2484
- int result;
2485
- VALUE vresult = Qnil;
2486
-
2487
- if ((argc < 0) || (argc > 0)) {
2488
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2489
- }
2490
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
2491
- if (!SWIG_IsOK(res1)) {
2492
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","flags", 1, self ));
2493
- }
2494
- arg1 = (struct libinjection_sqli_state *)(argp1);
2495
- result = (int) ((arg1)->flags);
2496
- vresult = SWIG_From_int((int)(result));
2497
- return vresult;
2498
- fail:
2499
- return Qnil;
2500
- }
2501
-
2502
-
2503
- SWIGINTERN VALUE
2504
- _wrap_sqli_state_pos_get(int argc, VALUE *argv, VALUE self) {
2505
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
2506
- void *argp1 = 0 ;
2507
- int res1 = 0 ;
2508
- size_t result;
2509
- VALUE vresult = Qnil;
2510
-
2511
- if ((argc < 0) || (argc > 0)) {
2512
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2513
- }
2514
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
2515
- if (!SWIG_IsOK(res1)) {
2516
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","pos", 1, self ));
2517
- }
2518
- arg1 = (struct libinjection_sqli_state *)(argp1);
2519
- result = ((arg1)->pos);
2520
- vresult = SWIG_From_size_t((size_t)(result));
2521
- return vresult;
2522
- fail:
2523
- return Qnil;
2524
- }
2525
-
2526
-
2527
- SWIGINTERN VALUE
2528
- _wrap_sqli_state_current_get(int argc, VALUE *argv, VALUE self) {
2529
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
2530
- void *argp1 = 0 ;
2531
- int res1 = 0 ;
2532
- struct libinjection_sqli_token *result = 0 ;
2533
- VALUE vresult = Qnil;
2534
-
2535
- if ((argc < 0) || (argc > 0)) {
2536
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2537
- }
2538
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
2539
- if (!SWIG_IsOK(res1)) {
2540
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","current", 1, self ));
2541
- }
2542
- arg1 = (struct libinjection_sqli_state *)(argp1);
2543
- result = (struct libinjection_sqli_token *) ((arg1)->current);
2544
- vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_libinjection_sqli_token, 0 | 0 );
2545
- return vresult;
2546
- fail:
2547
- return Qnil;
2548
- }
2549
-
2550
-
2551
- SWIGINTERN VALUE
2552
- _wrap_sqli_state_fingerprint_get(int argc, VALUE *argv, VALUE self) {
2553
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
2554
- void *argp1 = 0 ;
2555
- int res1 = 0 ;
2556
- char *result = 0 ;
2557
- VALUE vresult = Qnil;
2558
-
2559
- if ((argc < 0) || (argc > 0)) {
2560
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2561
- }
2562
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
2563
- if (!SWIG_IsOK(res1)) {
2564
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","fingerprint", 1, self ));
2565
- }
2566
- arg1 = (struct libinjection_sqli_state *)(argp1);
2567
- result = (char *)(char *) ((arg1)->fingerprint);
2568
- {
2569
- size_t size = SWIG_strnlen(result, 8);
2570
-
2571
-
2572
-
2573
- vresult = SWIG_FromCharPtrAndSize(result, size);
2574
- }
2575
- return vresult;
2576
- fail:
2577
- return Qnil;
2578
- }
2579
-
2580
-
2581
- SWIGINTERN VALUE
2582
- _wrap_sqli_state_reason_get(int argc, VALUE *argv, VALUE self) {
2583
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
2584
- void *argp1 = 0 ;
2585
- int res1 = 0 ;
2586
- int result;
2587
- VALUE vresult = Qnil;
2588
-
2589
- if ((argc < 0) || (argc > 0)) {
2590
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2591
- }
2592
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
2593
- if (!SWIG_IsOK(res1)) {
2594
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","reason", 1, self ));
2595
- }
2596
- arg1 = (struct libinjection_sqli_state *)(argp1);
2597
- result = (int) ((arg1)->reason);
2598
- vresult = SWIG_From_int((int)(result));
2599
- return vresult;
2600
- fail:
2601
- return Qnil;
2602
- }
2603
-
2604
-
2605
- SWIGINTERN VALUE
2606
- _wrap_sqli_state_stats_comment_ddw_get(int argc, VALUE *argv, VALUE self) {
2607
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
2608
- void *argp1 = 0 ;
2609
- int res1 = 0 ;
2610
- int result;
2611
- VALUE vresult = Qnil;
2612
-
2613
- if ((argc < 0) || (argc > 0)) {
2614
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2615
- }
2616
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
2617
- if (!SWIG_IsOK(res1)) {
2618
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","stats_comment_ddw", 1, self ));
2619
- }
2620
- arg1 = (struct libinjection_sqli_state *)(argp1);
2621
- result = (int) ((arg1)->stats_comment_ddw);
2622
- vresult = SWIG_From_int((int)(result));
2623
- return vresult;
2624
- fail:
2625
- return Qnil;
2626
- }
2627
-
2628
-
2629
- SWIGINTERN VALUE
2630
- _wrap_sqli_state_stats_comment_ddx_get(int argc, VALUE *argv, VALUE self) {
2631
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
2632
- void *argp1 = 0 ;
2633
- int res1 = 0 ;
2634
- int result;
2635
- VALUE vresult = Qnil;
2636
-
2637
- if ((argc < 0) || (argc > 0)) {
2638
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2639
- }
2640
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
2641
- if (!SWIG_IsOK(res1)) {
2642
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","stats_comment_ddx", 1, self ));
2643
- }
2644
- arg1 = (struct libinjection_sqli_state *)(argp1);
2645
- result = (int) ((arg1)->stats_comment_ddx);
2646
- vresult = SWIG_From_int((int)(result));
2647
- return vresult;
2648
- fail:
2649
- return Qnil;
2650
- }
2651
-
2652
-
2653
- SWIGINTERN VALUE
2654
- _wrap_sqli_state_stats_comment_c_get(int argc, VALUE *argv, VALUE self) {
2655
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
2656
- void *argp1 = 0 ;
2657
- int res1 = 0 ;
2658
- int result;
2659
- VALUE vresult = Qnil;
2660
-
2661
- if ((argc < 0) || (argc > 0)) {
2662
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2663
- }
2664
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
2665
- if (!SWIG_IsOK(res1)) {
2666
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","stats_comment_c", 1, self ));
2667
- }
2668
- arg1 = (struct libinjection_sqli_state *)(argp1);
2669
- result = (int) ((arg1)->stats_comment_c);
2670
- vresult = SWIG_From_int((int)(result));
2671
- return vresult;
2672
- fail:
2673
- return Qnil;
2674
- }
2675
-
2676
-
2677
- SWIGINTERN VALUE
2678
- _wrap_sqli_state_stats_comment_hash_get(int argc, VALUE *argv, VALUE self) {
2679
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
2680
- void *argp1 = 0 ;
2681
- int res1 = 0 ;
2682
- int result;
2683
- VALUE vresult = Qnil;
2684
-
2685
- if ((argc < 0) || (argc > 0)) {
2686
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2687
- }
2688
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
2689
- if (!SWIG_IsOK(res1)) {
2690
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","stats_comment_hash", 1, self ));
2691
- }
2692
- arg1 = (struct libinjection_sqli_state *)(argp1);
2693
- result = (int) ((arg1)->stats_comment_hash);
2694
- vresult = SWIG_From_int((int)(result));
2695
- return vresult;
2696
- fail:
2697
- return Qnil;
2698
- }
2699
-
2700
-
2701
- SWIGINTERN VALUE
2702
- _wrap_sqli_state_stats_folds_get(int argc, VALUE *argv, VALUE self) {
2703
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
2704
- void *argp1 = 0 ;
2705
- int res1 = 0 ;
2706
- int result;
2707
- VALUE vresult = Qnil;
2708
-
2709
- if ((argc < 0) || (argc > 0)) {
2710
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2711
- }
2712
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
2713
- if (!SWIG_IsOK(res1)) {
2714
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","stats_folds", 1, self ));
2715
- }
2716
- arg1 = (struct libinjection_sqli_state *)(argp1);
2717
- result = (int) ((arg1)->stats_folds);
2718
- vresult = SWIG_From_int((int)(result));
2719
- return vresult;
2720
- fail:
2721
- return Qnil;
2722
- }
2723
-
2724
-
2725
- SWIGINTERN VALUE
2726
- _wrap_sqli_state_stats_tokens_get(int argc, VALUE *argv, VALUE self) {
2727
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
2728
- void *argp1 = 0 ;
2729
- int res1 = 0 ;
2730
- int result;
2731
- VALUE vresult = Qnil;
2732
-
2733
- if ((argc < 0) || (argc > 0)) {
2734
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2735
- }
2736
- res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
2737
- if (!SWIG_IsOK(res1)) {
2738
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","stats_tokens", 1, self ));
2739
- }
2740
- arg1 = (struct libinjection_sqli_state *)(argp1);
2741
- result = (int) ((arg1)->stats_tokens);
2742
- vresult = SWIG_From_int((int)(result));
2743
- return vresult;
2744
- fail:
2745
- return Qnil;
2746
- }
2747
-
2748
-
2749
- #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
2750
- SWIGINTERN VALUE
2751
- _wrap_sqli_state_allocate(VALUE self) {
2752
- #else
2753
- SWIGINTERN VALUE
2754
- _wrap_sqli_state_allocate(int argc, VALUE *argv, VALUE self) {
2755
- #endif
2756
-
2757
-
2758
- VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_libinjection_sqli_state);
2759
- #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
2760
- rb_obj_call_init(vresult, argc, argv);
2761
- #endif
2762
- return vresult;
2763
- }
2764
-
2765
-
2766
- SWIGINTERN VALUE
2767
- _wrap_new_sqli_state(int argc, VALUE *argv, VALUE self) {
2768
- struct libinjection_sqli_state *result = 0 ;
2769
-
2770
- if ((argc < 0) || (argc > 0)) {
2771
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2772
- }
2773
- result = (struct libinjection_sqli_state *)calloc(1, sizeof(struct libinjection_sqli_state));
2774
- DATA_PTR(self) = result;
2775
- return self;
2776
- fail:
2777
- return Qnil;
2778
- }
2779
-
2780
-
2781
- SWIGINTERN void
2782
- free_libinjection_sqli_state(void *self) {
2783
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *)self;
2784
- free((char *) arg1);
2785
- }
2786
-
2787
- SWIGINTERN VALUE
2788
- _wrap_sqli_get_token(int argc, VALUE *argv, VALUE self) {
2789
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
2790
- int arg2 ;
2791
- void *argp1 = 0 ;
2792
- int res1 = 0 ;
2793
- int val2 ;
2794
- int ecode2 = 0 ;
2795
- struct libinjection_sqli_token *result = 0 ;
2796
- VALUE vresult = Qnil;
2797
-
2798
- if ((argc < 2) || (argc > 2)) {
2799
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2800
- }
2801
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
2802
- if (!SWIG_IsOK(res1)) {
2803
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","libinjection_sqli_get_token", 1, argv[0] ));
2804
- }
2805
- arg1 = (struct libinjection_sqli_state *)(argp1);
2806
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
2807
- if (!SWIG_IsOK(ecode2)) {
2808
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","libinjection_sqli_get_token", 2, argv[1] ));
2809
- }
2810
- arg2 = (int)(val2);
2811
- result = (struct libinjection_sqli_token *)libinjection_sqli_get_token(arg1,arg2);
2812
- vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_libinjection_sqli_token, 0 | 0 );
2813
- return vresult;
2814
- fail:
2815
- return Qnil;
2816
- }
2817
-
2818
-
2819
- SWIGINTERN VALUE
2820
- _wrap_sqli_init(int argc, VALUE *argv, VALUE self) {
2821
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
2822
- char *arg2 = (char *) 0 ;
2823
- size_t arg3 ;
2824
- int arg4 ;
2825
- void *argp1 = 0 ;
2826
- int res1 = 0 ;
2827
- int res2 ;
2828
- char *buf2 = 0 ;
2829
- size_t size2 = 0 ;
2830
- int alloc2 = 0 ;
2831
- int val4 ;
2832
- int ecode4 = 0 ;
2833
-
2834
- if ((argc < 3) || (argc > 3)) {
2835
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
2836
- }
2837
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
2838
- if (!SWIG_IsOK(res1)) {
2839
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","libinjection_sqli_init", 1, argv[0] ));
2840
- }
2841
- arg1 = (struct libinjection_sqli_state *)(argp1);
2842
- res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, &size2, &alloc2);
2843
- if (!SWIG_IsOK(res2)) {
2844
- SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","libinjection_sqli_init", 2, argv[1] ));
2845
- }
2846
- arg2 = (char *)(buf2);
2847
- arg3 = (size_t)(size2 - 1);
2848
- ecode4 = SWIG_AsVal_int(argv[2], &val4);
2849
- if (!SWIG_IsOK(ecode4)) {
2850
- SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "int","libinjection_sqli_init", 4, argv[2] ));
2851
- }
2852
- arg4 = (int)(val4);
2853
- libinjection_sqli_init(arg1,(char const *)arg2,arg3,arg4);
2854
- if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
2855
- return Qnil;
2856
- fail:
2857
- if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
2858
- return Qnil;
2859
- }
2860
-
2861
-
2862
- SWIGINTERN VALUE
2863
- _wrap_is_sqli_state(int argc, VALUE *argv, VALUE self) {
2864
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
2865
- void *argp1 = 0 ;
2866
- int res1 = 0 ;
2867
- int result;
2868
- VALUE vresult = Qnil;
2869
-
2870
- if ((argc < 1) || (argc > 1)) {
2871
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2872
- }
2873
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
2874
- if (!SWIG_IsOK(res1)) {
2875
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","libinjection_is_sqli", 1, argv[0] ));
2876
- }
2877
- arg1 = (struct libinjection_sqli_state *)(argp1);
2878
- result = (int)libinjection_is_sqli(arg1);
2879
- vresult = SWIG_From_int((int)(result));
2880
- return vresult;
2881
- fail:
2882
- return Qnil;
2883
- }
2884
-
2885
-
2886
- SWIGINTERN VALUE
2887
- _wrap_sqli_callback(int argc, VALUE *argv, VALUE self) {
2888
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
2889
- ptr_lookup_fn arg2 = (ptr_lookup_fn) 0 ;
2890
- void *arg3 = (void *) 0 ;
2891
- void *argp1 = 0 ;
2892
- int res1 = 0 ;
2893
- int res3 ;
2894
-
2895
- if ((argc < 3) || (argc > 3)) {
2896
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
2897
- }
2898
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
2899
- if (!SWIG_IsOK(res1)) {
2900
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","libinjection_sqli_callback", 1, argv[0] ));
2901
- }
2902
- arg1 = (struct libinjection_sqli_state *)(argp1);
2903
- {
2904
- int res = SWIG_ConvertFunctionPtr(argv[1], (void**)(&arg2), SWIGTYPE_p_f_p_struct_libinjection_sqli_state_int_p_q_const__char_size_t__char);
2905
- if (!SWIG_IsOK(res)) {
2906
- SWIG_exception_fail(SWIG_ArgError(res), Ruby_Format_TypeError( "", "ptr_lookup_fn","libinjection_sqli_callback", 2, argv[1] ));
2907
- }
2908
- }
2909
- res3 = SWIG_ConvertPtr(argv[2],SWIG_as_voidptrptr(&arg3), 0, 0);
2910
- if (!SWIG_IsOK(res3)) {
2911
- SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "void *","libinjection_sqli_callback", 3, argv[2] ));
2912
- }
2913
- libinjection_sqli_callback(arg1,arg2,arg3);
2914
- return Qnil;
2915
- fail:
2916
- return Qnil;
2917
- }
2918
-
2919
-
2920
- SWIGINTERN VALUE
2921
- _wrap_sqli_reset(int argc, VALUE *argv, VALUE self) {
2922
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
2923
- int arg2 ;
2924
- void *argp1 = 0 ;
2925
- int res1 = 0 ;
2926
- int val2 ;
2927
- int ecode2 = 0 ;
2928
-
2929
- if ((argc < 2) || (argc > 2)) {
2930
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2931
- }
2932
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
2933
- if (!SWIG_IsOK(res1)) {
2934
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","libinjection_sqli_reset", 1, argv[0] ));
2935
- }
2936
- arg1 = (struct libinjection_sqli_state *)(argp1);
2937
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
2938
- if (!SWIG_IsOK(ecode2)) {
2939
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","libinjection_sqli_reset", 2, argv[1] ));
2940
- }
2941
- arg2 = (int)(val2);
2942
- libinjection_sqli_reset(arg1,arg2);
2943
- return Qnil;
2944
- fail:
2945
- return Qnil;
2946
- }
2947
-
2948
-
2949
- SWIGINTERN VALUE
2950
- _wrap_sqli_fingerprint(int argc, VALUE *argv, VALUE self) {
2951
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
2952
- int arg2 ;
2953
- void *argp1 = 0 ;
2954
- int res1 = 0 ;
2955
- int val2 ;
2956
- int ecode2 = 0 ;
2957
- char *result = 0 ;
2958
- VALUE vresult = Qnil;
2959
-
2960
- if ((argc < 2) || (argc > 2)) {
2961
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2962
- }
2963
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
2964
- if (!SWIG_IsOK(res1)) {
2965
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","libinjection_sqli_fingerprint", 1, argv[0] ));
2966
- }
2967
- arg1 = (struct libinjection_sqli_state *)(argp1);
2968
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
2969
- if (!SWIG_IsOK(ecode2)) {
2970
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","libinjection_sqli_fingerprint", 2, argv[1] ));
2971
- }
2972
- arg2 = (int)(val2);
2973
- result = (char *)libinjection_sqli_fingerprint(arg1,arg2);
2974
- vresult = SWIG_FromCharPtr((const char *)result);
2975
- return vresult;
2976
- fail:
2977
- return Qnil;
2978
- }
2979
-
2980
-
2981
- SWIGINTERN VALUE
2982
- _wrap_sqli_lookup_word(int argc, VALUE *argv, VALUE self) {
2983
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
2984
- int arg2 ;
2985
- char *arg3 = (char *) 0 ;
2986
- size_t arg4 ;
2987
- void *argp1 = 0 ;
2988
- int res1 = 0 ;
2989
- int val2 ;
2990
- int ecode2 = 0 ;
2991
- int res3 ;
2992
- char *buf3 = 0 ;
2993
- size_t size3 = 0 ;
2994
- int alloc3 = 0 ;
2995
- char result;
2996
- VALUE vresult = Qnil;
2997
-
2998
- if ((argc < 3) || (argc > 3)) {
2999
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
3000
- }
3001
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
3002
- if (!SWIG_IsOK(res1)) {
3003
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","libinjection_sqli_lookup_word", 1, argv[0] ));
3004
- }
3005
- arg1 = (struct libinjection_sqli_state *)(argp1);
3006
- ecode2 = SWIG_AsVal_int(argv[1], &val2);
3007
- if (!SWIG_IsOK(ecode2)) {
3008
- SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","libinjection_sqli_lookup_word", 2, argv[1] ));
3009
- }
3010
- arg2 = (int)(val2);
3011
- res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, &size3, &alloc3);
3012
- if (!SWIG_IsOK(res3)) {
3013
- SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","libinjection_sqli_lookup_word", 3, argv[2] ));
3014
- }
3015
- arg3 = (char *)(buf3);
3016
- arg4 = (size_t)(size3 - 1);
3017
- result = (char)libinjection_sqli_lookup_word(arg1,arg2,(char const *)arg3,arg4);
3018
- vresult = SWIG_From_char((char)(result));
3019
- if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
3020
- return vresult;
3021
- fail:
3022
- if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
3023
- return Qnil;
3024
- }
3025
-
3026
-
3027
- SWIGINTERN VALUE
3028
- _wrap_sqli_tokenize(int argc, VALUE *argv, VALUE self) {
3029
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
3030
- void *argp1 = 0 ;
3031
- int res1 = 0 ;
3032
- int result;
3033
- VALUE vresult = Qnil;
3034
-
3035
- if ((argc < 1) || (argc > 1)) {
3036
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3037
- }
3038
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
3039
- if (!SWIG_IsOK(res1)) {
3040
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","libinjection_sqli_tokenize", 1, argv[0] ));
3041
- }
3042
- arg1 = (struct libinjection_sqli_state *)(argp1);
3043
- result = (int)libinjection_sqli_tokenize(arg1);
3044
- vresult = SWIG_From_int((int)(result));
3045
- return vresult;
3046
- fail:
3047
- return Qnil;
3048
- }
3049
-
3050
-
3051
- SWIGINTERN VALUE
3052
- _wrap_sqli_fold(int argc, VALUE *argv, VALUE self) {
3053
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
3054
- void *argp1 = 0 ;
3055
- int res1 = 0 ;
3056
- int result;
3057
- VALUE vresult = Qnil;
3058
-
3059
- if ((argc < 1) || (argc > 1)) {
3060
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3061
- }
3062
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
3063
- if (!SWIG_IsOK(res1)) {
3064
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","libinjection_sqli_fold", 1, argv[0] ));
3065
- }
3066
- arg1 = (struct libinjection_sqli_state *)(argp1);
3067
- result = (int)libinjection_sqli_fold(arg1);
3068
- vresult = SWIG_From_int((int)(result));
3069
- return vresult;
3070
- fail:
3071
- return Qnil;
3072
- }
3073
-
3074
-
3075
- SWIGINTERN VALUE
3076
- _wrap_sqli_check_fingerprint(int argc, VALUE *argv, VALUE self) {
3077
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
3078
- void *argp1 = 0 ;
3079
- int res1 = 0 ;
3080
- int result;
3081
- VALUE vresult = Qnil;
3082
-
3083
- if ((argc < 1) || (argc > 1)) {
3084
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3085
- }
3086
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
3087
- if (!SWIG_IsOK(res1)) {
3088
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","libinjection_sqli_check_fingerprint", 1, argv[0] ));
3089
- }
3090
- arg1 = (struct libinjection_sqli_state *)(argp1);
3091
- result = (int)libinjection_sqli_check_fingerprint(arg1);
3092
- vresult = SWIG_From_int((int)(result));
3093
- return vresult;
3094
- fail:
3095
- return Qnil;
3096
- }
3097
-
3098
-
3099
- SWIGINTERN VALUE
3100
- _wrap_sqli_blacklist(int argc, VALUE *argv, VALUE self) {
3101
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
3102
- void *argp1 = 0 ;
3103
- int res1 = 0 ;
3104
- int result;
3105
- VALUE vresult = Qnil;
3106
-
3107
- if ((argc < 1) || (argc > 1)) {
3108
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3109
- }
3110
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
3111
- if (!SWIG_IsOK(res1)) {
3112
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","libinjection_sqli_blacklist", 1, argv[0] ));
3113
- }
3114
- arg1 = (struct libinjection_sqli_state *)(argp1);
3115
- result = (int)libinjection_sqli_blacklist(arg1);
3116
- vresult = SWIG_From_int((int)(result));
3117
- return vresult;
3118
- fail:
3119
- return Qnil;
3120
- }
3121
-
3122
-
3123
- SWIGINTERN VALUE
3124
- _wrap_sqli_not_whitelist(int argc, VALUE *argv, VALUE self) {
3125
- struct libinjection_sqli_state *arg1 = (struct libinjection_sqli_state *) 0 ;
3126
- void *argp1 = 0 ;
3127
- int res1 = 0 ;
3128
- int result;
3129
- VALUE vresult = Qnil;
3130
-
3131
- if ((argc < 1) || (argc > 1)) {
3132
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3133
- }
3134
- res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_libinjection_sqli_state, 0 | 0 );
3135
- if (!SWIG_IsOK(res1)) {
3136
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct libinjection_sqli_state *","libinjection_sqli_not_whitelist", 1, argv[0] ));
3137
- }
3138
- arg1 = (struct libinjection_sqli_state *)(argp1);
3139
- result = (int)libinjection_sqli_not_whitelist(arg1);
3140
- vresult = SWIG_From_int((int)(result));
3141
- return vresult;
3142
- fail:
3143
- return Qnil;
3144
- }
3145
-
3146
-
3147
- SWIGINTERN VALUE
3148
- _wrap_is_sqli(int argc, VALUE *argv, VALUE self) {
3149
- char *arg1 = (char *) 0 ;
3150
- size_t arg2 ;
3151
- int res1 ;
3152
- char *buf1 = 0 ;
3153
- size_t size1 = 0 ;
3154
- int alloc1 = 0 ;
3155
- int result;
3156
- VALUE vresult = Qnil;
3157
-
3158
- if ((argc < 1) || (argc > 1)) {
3159
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3160
- }
3161
- res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, &size1, &alloc1);
3162
- if (!SWIG_IsOK(res1)) {
3163
- SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","is_sqli", 1, argv[0] ));
3164
- }
3165
- arg1 = (char *)(buf1);
3166
- arg2 = (size_t)(size1 - 1);
3167
- result = (int)is_sqli((char const *)arg1,arg2);
3168
- vresult = SWIG_From_int((int)(result));
3169
- if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3170
- return vresult;
3171
- fail:
3172
- if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3173
- return Qnil;
3174
- }
3175
-
3176
-
3177
-
3178
- /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
3179
-
3180
- static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
3181
- static swig_type_info _swigt__p_f_p_struct_libinjection_sqli_state_int_p_q_const__char_size_t__char = {"_p_f_p_struct_libinjection_sqli_state_int_p_q_const__char_size_t__char", "ptr_lookup_fn|char (*)(struct libinjection_sqli_state *,int,char const *,size_t)", 0, 0, (void*)0, 0};
3182
- static swig_type_info _swigt__p_libinjection_sqli_state = {"_p_libinjection_sqli_state", "sfilter *|struct libinjection_sqli_state *|libinjection_sqli_state *", 0, 0, (void*)0, 0};
3183
- static swig_type_info _swigt__p_libinjection_sqli_token = {"_p_libinjection_sqli_token", "stoken_t *|struct libinjection_sqli_token *|libinjection_sqli_token *", 0, 0, (void*)0, 0};
3184
- static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
3185
-
3186
- static swig_type_info *swig_type_initial[] = {
3187
- &_swigt__p_char,
3188
- &_swigt__p_f_p_struct_libinjection_sqli_state_int_p_q_const__char_size_t__char,
3189
- &_swigt__p_libinjection_sqli_state,
3190
- &_swigt__p_libinjection_sqli_token,
3191
- &_swigt__p_void,
3192
- };
3193
-
3194
- static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
3195
- static swig_cast_info _swigc__p_f_p_struct_libinjection_sqli_state_int_p_q_const__char_size_t__char[] = { {&_swigt__p_f_p_struct_libinjection_sqli_state_int_p_q_const__char_size_t__char, 0, 0, 0},{0, 0, 0, 0}};
3196
- static swig_cast_info _swigc__p_libinjection_sqli_state[] = { {&_swigt__p_libinjection_sqli_state, 0, 0, 0},{0, 0, 0, 0}};
3197
- static swig_cast_info _swigc__p_libinjection_sqli_token[] = { {&_swigt__p_libinjection_sqli_token, 0, 0, 0},{0, 0, 0, 0}};
3198
- static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
3199
-
3200
- static swig_cast_info *swig_cast_initial[] = {
3201
- _swigc__p_char,
3202
- _swigc__p_f_p_struct_libinjection_sqli_state_int_p_q_const__char_size_t__char,
3203
- _swigc__p_libinjection_sqli_state,
3204
- _swigc__p_libinjection_sqli_token,
3205
- _swigc__p_void,
3206
- };
3207
-
3208
-
3209
- /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
3210
-
3211
- /* -----------------------------------------------------------------------------
3212
- * Type initialization:
3213
- * This problem is tough by the requirement that no dynamic
3214
- * memory is used. Also, since swig_type_info structures store pointers to
3215
- * swig_cast_info structures and swig_cast_info structures store pointers back
3216
- * to swig_type_info structures, we need some lookup code at initialization.
3217
- * The idea is that swig generates all the structures that are needed.
3218
- * The runtime then collects these partially filled structures.
3219
- * The SWIG_InitializeModule function takes these initial arrays out of
3220
- * swig_module, and does all the lookup, filling in the swig_module.types
3221
- * array with the correct data and linking the correct swig_cast_info
3222
- * structures together.
3223
- *
3224
- * The generated swig_type_info structures are assigned statically to an initial
3225
- * array. We just loop through that array, and handle each type individually.
3226
- * First we lookup if this type has been already loaded, and if so, use the
3227
- * loaded structure instead of the generated one. Then we have to fill in the
3228
- * cast linked list. The cast data is initially stored in something like a
3229
- * two-dimensional array. Each row corresponds to a type (there are the same
3230
- * number of rows as there are in the swig_type_initial array). Each entry in
3231
- * a column is one of the swig_cast_info structures for that type.
3232
- * The cast_initial array is actually an array of arrays, because each row has
3233
- * a variable number of columns. So to actually build the cast linked list,
3234
- * we find the array of casts associated with the type, and loop through it
3235
- * adding the casts to the list. The one last trick we need to do is making
3236
- * sure the type pointer in the swig_cast_info struct is correct.
3237
- *
3238
- * First off, we lookup the cast->type name to see if it is already loaded.
3239
- * There are three cases to handle:
3240
- * 1) If the cast->type has already been loaded AND the type we are adding
3241
- * casting info to has not been loaded (it is in this module), THEN we
3242
- * replace the cast->type pointer with the type pointer that has already
3243
- * been loaded.
3244
- * 2) If BOTH types (the one we are adding casting info to, and the
3245
- * cast->type) are loaded, THEN the cast info has already been loaded by
3246
- * the previous module so we just ignore it.
3247
- * 3) Finally, if cast->type has not already been loaded, then we add that
3248
- * swig_cast_info to the linked list (because the cast->type) pointer will
3249
- * be correct.
3250
- * ----------------------------------------------------------------------------- */
3251
-
3252
- #ifdef __cplusplus
3253
- extern "C" {
3254
- #if 0
3255
- } /* c-mode */
3256
- #endif
3257
- #endif
3258
-
3259
- #if 0
3260
- #define SWIGRUNTIME_DEBUG
3261
- #endif
3262
-
3263
-
3264
- SWIGRUNTIME void
3265
- SWIG_InitializeModule(void *clientdata) {
3266
- size_t i;
3267
- swig_module_info *module_head, *iter;
3268
- int init;
3269
-
3270
- /* check to see if the circular list has been setup, if not, set it up */
3271
- if (swig_module.next==0) {
3272
- /* Initialize the swig_module */
3273
- swig_module.type_initial = swig_type_initial;
3274
- swig_module.cast_initial = swig_cast_initial;
3275
- swig_module.next = &swig_module;
3276
- init = 1;
3277
- } else {
3278
- init = 0;
3279
- }
3280
-
3281
- /* Try and load any already created modules */
3282
- module_head = SWIG_GetModule(clientdata);
3283
- if (!module_head) {
3284
- /* This is the first module loaded for this interpreter */
3285
- /* so set the swig module into the interpreter */
3286
- SWIG_SetModule(clientdata, &swig_module);
3287
- } else {
3288
- /* the interpreter has loaded a SWIG module, but has it loaded this one? */
3289
- iter=module_head;
3290
- do {
3291
- if (iter==&swig_module) {
3292
- /* Our module is already in the list, so there's nothing more to do. */
3293
- return;
3294
- }
3295
- iter=iter->next;
3296
- } while (iter!= module_head);
3297
-
3298
- /* otherwise we must add our module into the list */
3299
- swig_module.next = module_head->next;
3300
- module_head->next = &swig_module;
3301
- }
3302
-
3303
- /* When multiple interpreters are used, a module could have already been initialized in
3304
- a different interpreter, but not yet have a pointer in this interpreter.
3305
- In this case, we do not want to continue adding types... everything should be
3306
- set up already */
3307
- if (init == 0) return;
3308
-
3309
- /* Now work on filling in swig_module.types */
3310
- #ifdef SWIGRUNTIME_DEBUG
3311
- printf("SWIG_InitializeModule: size %d\n", swig_module.size);
3312
- #endif
3313
- for (i = 0; i < swig_module.size; ++i) {
3314
- swig_type_info *type = 0;
3315
- swig_type_info *ret;
3316
- swig_cast_info *cast;
3317
-
3318
- #ifdef SWIGRUNTIME_DEBUG
3319
- printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
3320
- #endif
3321
-
3322
- /* if there is another module already loaded */
3323
- if (swig_module.next != &swig_module) {
3324
- type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
3325
- }
3326
- if (type) {
3327
- /* Overwrite clientdata field */
3328
- #ifdef SWIGRUNTIME_DEBUG
3329
- printf("SWIG_InitializeModule: found type %s\n", type->name);
3330
- #endif
3331
- if (swig_module.type_initial[i]->clientdata) {
3332
- type->clientdata = swig_module.type_initial[i]->clientdata;
3333
- #ifdef SWIGRUNTIME_DEBUG
3334
- printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
3335
- #endif
3336
- }
3337
- } else {
3338
- type = swig_module.type_initial[i];
3339
- }
3340
-
3341
- /* Insert casting types */
3342
- cast = swig_module.cast_initial[i];
3343
- while (cast->type) {
3344
-
3345
- /* Don't need to add information already in the list */
3346
- ret = 0;
3347
- #ifdef SWIGRUNTIME_DEBUG
3348
- printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
3349
- #endif
3350
- if (swig_module.next != &swig_module) {
3351
- ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
3352
- #ifdef SWIGRUNTIME_DEBUG
3353
- if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
3354
- #endif
3355
- }
3356
- if (ret) {
3357
- if (type == swig_module.type_initial[i]) {
3358
- #ifdef SWIGRUNTIME_DEBUG
3359
- printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
3360
- #endif
3361
- cast->type = ret;
3362
- ret = 0;
3363
- } else {
3364
- /* Check for casting already in the list */
3365
- swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
3366
- #ifdef SWIGRUNTIME_DEBUG
3367
- if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
3368
- #endif
3369
- if (!ocast) ret = 0;
3370
- }
3371
- }
3372
-
3373
- if (!ret) {
3374
- #ifdef SWIGRUNTIME_DEBUG
3375
- printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
3376
- #endif
3377
- if (type->cast) {
3378
- type->cast->prev = cast;
3379
- cast->next = type->cast;
3380
- }
3381
- type->cast = cast;
3382
- }
3383
- cast++;
3384
- }
3385
- /* Set entry in modules->types array equal to the type */
3386
- swig_module.types[i] = type;
3387
- }
3388
- swig_module.types[i] = 0;
3389
-
3390
- #ifdef SWIGRUNTIME_DEBUG
3391
- printf("**** SWIG_InitializeModule: Cast List ******\n");
3392
- for (i = 0; i < swig_module.size; ++i) {
3393
- int j = 0;
3394
- swig_cast_info *cast = swig_module.cast_initial[i];
3395
- printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
3396
- while (cast->type) {
3397
- printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
3398
- cast++;
3399
- ++j;
3400
- }
3401
- printf("---- Total casts: %d\n",j);
3402
- }
3403
- printf("**** SWIG_InitializeModule: Cast List ******\n");
3404
- #endif
3405
- }
3406
-
3407
- /* This function will propagate the clientdata field of type to
3408
- * any new swig_type_info structures that have been added into the list
3409
- * of equivalent types. It is like calling
3410
- * SWIG_TypeClientData(type, clientdata) a second time.
3411
- */
3412
- SWIGRUNTIME void
3413
- SWIG_PropagateClientData(void) {
3414
- size_t i;
3415
- swig_cast_info *equiv;
3416
- static int init_run = 0;
3417
-
3418
- if (init_run) return;
3419
- init_run = 1;
3420
-
3421
- for (i = 0; i < swig_module.size; i++) {
3422
- if (swig_module.types[i]->clientdata) {
3423
- equiv = swig_module.types[i]->cast;
3424
- while (equiv) {
3425
- if (!equiv->converter) {
3426
- if (equiv->type && !equiv->type->clientdata)
3427
- SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
3428
- }
3429
- equiv = equiv->next;
3430
- }
3431
- }
3432
- }
3433
- }
3434
-
3435
- #ifdef __cplusplus
3436
- #if 0
3437
- { /* c-mode */
3438
- #endif
3439
- }
3440
- #endif
3441
-
3442
- /*
3443
-
3444
- */
3445
- #ifdef __cplusplus
3446
- extern "C"
3447
- #endif
3448
- SWIGEXPORT void Init_libinjection(void) {
3449
- size_t i;
3450
-
3451
- SWIG_InitRuntime();
3452
- mLibinjection = rb_define_module("Libinjection");
3453
-
3454
- SWIG_InitializeModule(0);
3455
- for (i = 0; i < swig_module.size; i++) {
3456
- SWIG_define_class(swig_module.types[i]);
3457
- }
3458
-
3459
- SWIG_RubyInitializeTrackings();
3460
- rb_define_module_function(mLibinjection, "version", _wrap_version, -1);
3461
- rb_define_module_function(mLibinjection, "sqli", _wrap_sqli, -1);
3462
- rb_define_module_function(mLibinjection, "is_xss", _wrap_is_xss, -1);
3463
- rb_define_const(mLibinjection, "FLAG_NONE", SWIG_From_int((int)(FLAG_NONE)));
3464
- rb_define_const(mLibinjection, "FLAG_QUOTE_NONE", SWIG_From_int((int)(FLAG_QUOTE_NONE)));
3465
- rb_define_const(mLibinjection, "FLAG_QUOTE_SINGLE", SWIG_From_int((int)(FLAG_QUOTE_SINGLE)));
3466
- rb_define_const(mLibinjection, "FLAG_QUOTE_DOUBLE", SWIG_From_int((int)(FLAG_QUOTE_DOUBLE)));
3467
- rb_define_const(mLibinjection, "FLAG_SQL_ANSI", SWIG_From_int((int)(FLAG_SQL_ANSI)));
3468
- rb_define_const(mLibinjection, "FLAG_SQL_MYSQL", SWIG_From_int((int)(FLAG_SQL_MYSQL)));
3469
- rb_define_const(mLibinjection, "LOOKUP_WORD", SWIG_From_int((int)(LOOKUP_WORD)));
3470
- rb_define_const(mLibinjection, "LOOKUP_TYPE", SWIG_From_int((int)(LOOKUP_TYPE)));
3471
- rb_define_const(mLibinjection, "LOOKUP_OPERATOR", SWIG_From_int((int)(LOOKUP_OPERATOR)));
3472
- rb_define_const(mLibinjection, "LOOKUP_FINGERPRINT", SWIG_From_int((int)(LOOKUP_FINGERPRINT)));
3473
-
3474
- SwigClassSqli_token.klass = rb_define_class_under(mLibinjection, "Sqli_token", rb_cObject);
3475
- SWIG_TypeClientData(SWIGTYPE_p_libinjection_sqli_token, (void *) &SwigClassSqli_token);
3476
- rb_define_alloc_func(SwigClassSqli_token.klass, _wrap_sqli_token_allocate);
3477
- rb_define_method(SwigClassSqli_token.klass, "initialize", _wrap_new_sqli_token, -1);
3478
- rb_define_method(SwigClassSqli_token.klass, "type", _wrap_sqli_token_type_get, -1);
3479
- rb_define_method(SwigClassSqli_token.klass, "str_open", _wrap_sqli_token_str_open_get, -1);
3480
- rb_define_method(SwigClassSqli_token.klass, "str_close", _wrap_sqli_token_str_close_get, -1);
3481
- rb_define_method(SwigClassSqli_token.klass, "pos", _wrap_sqli_token_pos_get, -1);
3482
- rb_define_method(SwigClassSqli_token.klass, "len", _wrap_sqli_token_len_get, -1);
3483
- rb_define_method(SwigClassSqli_token.klass, "count", _wrap_sqli_token_count_get, -1);
3484
- rb_define_method(SwigClassSqli_token.klass, "val", _wrap_sqli_token_val_get, -1);
3485
- SwigClassSqli_token.mark = 0;
3486
- SwigClassSqli_token.destroy = (void (*)(void *)) free_libinjection_sqli_token;
3487
- SwigClassSqli_token.trackObjects = 0;
3488
-
3489
- SwigClassSqli_state.klass = rb_define_class_under(mLibinjection, "Sqli_state", rb_cObject);
3490
- SWIG_TypeClientData(SWIGTYPE_p_libinjection_sqli_state, (void *) &SwigClassSqli_state);
3491
- rb_define_alloc_func(SwigClassSqli_state.klass, _wrap_sqli_state_allocate);
3492
- rb_define_method(SwigClassSqli_state.klass, "initialize", _wrap_new_sqli_state, -1);
3493
- rb_define_method(SwigClassSqli_state.klass, "s", _wrap_sqli_state_s_get, -1);
3494
- rb_define_method(SwigClassSqli_state.klass, "slen", _wrap_sqli_state_slen_get, -1);
3495
- rb_define_method(SwigClassSqli_state.klass, "lookup", _wrap_sqli_state_lookup_get, -1);
3496
- rb_define_method(SwigClassSqli_state.klass, "userdata", _wrap_sqli_state_userdata_get, -1);
3497
- rb_define_method(SwigClassSqli_state.klass, "flags", _wrap_sqli_state_flags_get, -1);
3498
- rb_define_method(SwigClassSqli_state.klass, "pos", _wrap_sqli_state_pos_get, -1);
3499
- rb_define_method(SwigClassSqli_state.klass, "current", _wrap_sqli_state_current_get, -1);
3500
- rb_define_method(SwigClassSqli_state.klass, "fingerprint", _wrap_sqli_state_fingerprint_get, -1);
3501
- rb_define_method(SwigClassSqli_state.klass, "reason", _wrap_sqli_state_reason_get, -1);
3502
- rb_define_method(SwigClassSqli_state.klass, "stats_comment_ddw", _wrap_sqli_state_stats_comment_ddw_get, -1);
3503
- rb_define_method(SwigClassSqli_state.klass, "stats_comment_ddx", _wrap_sqli_state_stats_comment_ddx_get, -1);
3504
- rb_define_method(SwigClassSqli_state.klass, "stats_comment_c", _wrap_sqli_state_stats_comment_c_get, -1);
3505
- rb_define_method(SwigClassSqli_state.klass, "stats_comment_hash", _wrap_sqli_state_stats_comment_hash_get, -1);
3506
- rb_define_method(SwigClassSqli_state.klass, "stats_folds", _wrap_sqli_state_stats_folds_get, -1);
3507
- rb_define_method(SwigClassSqli_state.klass, "stats_tokens", _wrap_sqli_state_stats_tokens_get, -1);
3508
- SwigClassSqli_state.mark = 0;
3509
- SwigClassSqli_state.destroy = (void (*)(void *)) free_libinjection_sqli_state;
3510
- SwigClassSqli_state.trackObjects = 0;
3511
- rb_define_module_function(mLibinjection, "sqli_get_token", _wrap_sqli_get_token, -1);
3512
- rb_define_module_function(mLibinjection, "sqli_init", _wrap_sqli_init, -1);
3513
- rb_define_module_function(mLibinjection, "is_sqli_state", _wrap_is_sqli_state, -1);
3514
- rb_define_module_function(mLibinjection, "sqli_callback", _wrap_sqli_callback, -1);
3515
- rb_define_module_function(mLibinjection, "sqli_reset", _wrap_sqli_reset, -1);
3516
- rb_define_module_function(mLibinjection, "sqli_fingerprint", _wrap_sqli_fingerprint, -1);
3517
- rb_define_module_function(mLibinjection, "sqli_lookup_word", _wrap_sqli_lookup_word, -1);
3518
- rb_define_module_function(mLibinjection, "sqli_tokenize", _wrap_sqli_tokenize, -1);
3519
- rb_define_module_function(mLibinjection, "sqli_fold", _wrap_sqli_fold, -1);
3520
- rb_define_module_function(mLibinjection, "sqli_check_fingerprint", _wrap_sqli_check_fingerprint, -1);
3521
- rb_define_module_function(mLibinjection, "sqli_blacklist", _wrap_sqli_blacklist, -1);
3522
- rb_define_module_function(mLibinjection, "sqli_not_whitelist", _wrap_sqli_not_whitelist, -1);
3523
- rb_define_module_function(mLibinjection, "is_sqli", _wrap_is_sqli, -1);
3524
- }
3525
-