rbs-relaxed 3.9.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (484) hide show
  1. checksums.yaml +7 -0
  2. data/.github/dependabot.yml +22 -0
  3. data/.github/workflows/comments.yml +35 -0
  4. data/.github/workflows/dependabot.yml +30 -0
  5. data/.github/workflows/ruby.yml +82 -0
  6. data/.github/workflows/typecheck.yml +38 -0
  7. data/.github/workflows/windows.yml +43 -0
  8. data/.gitignore +23 -0
  9. data/.rubocop.yml +68 -0
  10. data/BSDL +22 -0
  11. data/CHANGELOG.md +1868 -0
  12. data/COPYING +56 -0
  13. data/README.md +203 -0
  14. data/Rakefile +417 -0
  15. data/Steepfile +44 -0
  16. data/config.yml +313 -0
  17. data/core/array.rbs +4062 -0
  18. data/core/basic_object.rbs +375 -0
  19. data/core/binding.rbs +150 -0
  20. data/core/builtin.rbs +277 -0
  21. data/core/class.rbs +220 -0
  22. data/core/comparable.rbs +171 -0
  23. data/core/complex.rbs +786 -0
  24. data/core/constants.rbs +96 -0
  25. data/core/data.rbs +415 -0
  26. data/core/dir.rbs +981 -0
  27. data/core/encoding.rbs +1371 -0
  28. data/core/enumerable.rbs +2405 -0
  29. data/core/enumerator/product.rbs +92 -0
  30. data/core/enumerator.rbs +630 -0
  31. data/core/env.rbs +6 -0
  32. data/core/errno.rbs +673 -0
  33. data/core/errors.rbs +760 -0
  34. data/core/exception.rbs +485 -0
  35. data/core/false_class.rbs +82 -0
  36. data/core/fiber.rbs +550 -0
  37. data/core/fiber_error.rbs +11 -0
  38. data/core/file.rbs +2936 -0
  39. data/core/file_test.rbs +331 -0
  40. data/core/float.rbs +1151 -0
  41. data/core/gc.rbs +644 -0
  42. data/core/global_variables.rbs +184 -0
  43. data/core/hash.rbs +1861 -0
  44. data/core/integer.rbs +1413 -0
  45. data/core/io/buffer.rbs +984 -0
  46. data/core/io/wait.rbs +70 -0
  47. data/core/io.rbs +3406 -0
  48. data/core/kernel.rbs +3096 -0
  49. data/core/marshal.rbs +207 -0
  50. data/core/match_data.rbs +635 -0
  51. data/core/math.rbs +729 -0
  52. data/core/method.rbs +386 -0
  53. data/core/module.rbs +1704 -0
  54. data/core/nil_class.rbs +209 -0
  55. data/core/numeric.rbs +818 -0
  56. data/core/object.rbs +110 -0
  57. data/core/object_space/weak_key_map.rbs +166 -0
  58. data/core/object_space.rbs +190 -0
  59. data/core/proc.rbs +868 -0
  60. data/core/process.rbs +2296 -0
  61. data/core/ractor.rbs +1068 -0
  62. data/core/random.rbs +237 -0
  63. data/core/range.rbs +1107 -0
  64. data/core/rational.rbs +531 -0
  65. data/core/rb_config.rbs +88 -0
  66. data/core/rbs/unnamed/argf.rbs +1229 -0
  67. data/core/rbs/unnamed/env_class.rbs +1209 -0
  68. data/core/rbs/unnamed/random.rbs +293 -0
  69. data/core/refinement.rbs +59 -0
  70. data/core/regexp.rbs +1930 -0
  71. data/core/ruby_vm.rbs +765 -0
  72. data/core/rubygems/basic_specification.rbs +6 -0
  73. data/core/rubygems/config_file.rbs +38 -0
  74. data/core/rubygems/dependency_installer.rbs +6 -0
  75. data/core/rubygems/errors.rbs +176 -0
  76. data/core/rubygems/installer.rbs +15 -0
  77. data/core/rubygems/path_support.rbs +6 -0
  78. data/core/rubygems/platform.rbs +7 -0
  79. data/core/rubygems/request_set.rbs +49 -0
  80. data/core/rubygems/requirement.rbs +148 -0
  81. data/core/rubygems/rubygems.rbs +1171 -0
  82. data/core/rubygems/source_list.rbs +15 -0
  83. data/core/rubygems/specification.rbs +23 -0
  84. data/core/rubygems/stream_ui.rbs +5 -0
  85. data/core/rubygems/uninstaller.rbs +10 -0
  86. data/core/rubygems/version.rbs +294 -0
  87. data/core/set.rbs +621 -0
  88. data/core/signal.rbs +100 -0
  89. data/core/string.rbs +3583 -0
  90. data/core/struct.rbs +667 -0
  91. data/core/symbol.rbs +475 -0
  92. data/core/thread.rbs +1765 -0
  93. data/core/thread_group.rbs +79 -0
  94. data/core/time.rbs +1762 -0
  95. data/core/trace_point.rbs +477 -0
  96. data/core/true_class.rbs +98 -0
  97. data/core/unbound_method.rbs +329 -0
  98. data/core/warning.rbs +87 -0
  99. data/docs/CONTRIBUTING.md +106 -0
  100. data/docs/architecture.md +110 -0
  101. data/docs/collection.md +192 -0
  102. data/docs/data_and_struct.md +86 -0
  103. data/docs/gem.md +57 -0
  104. data/docs/rbs_by_example.md +309 -0
  105. data/docs/repo.md +125 -0
  106. data/docs/sigs.md +167 -0
  107. data/docs/stdlib.md +147 -0
  108. data/docs/syntax.md +910 -0
  109. data/docs/tools.md +17 -0
  110. data/exe/rbs +7 -0
  111. data/ext/rbs_extension/extconf.rb +15 -0
  112. data/ext/rbs_extension/lexer.c +2728 -0
  113. data/ext/rbs_extension/lexer.h +179 -0
  114. data/ext/rbs_extension/lexer.re +147 -0
  115. data/ext/rbs_extension/lexstate.c +175 -0
  116. data/ext/rbs_extension/location.c +325 -0
  117. data/ext/rbs_extension/location.h +85 -0
  118. data/ext/rbs_extension/main.c +33 -0
  119. data/ext/rbs_extension/parser.c +2973 -0
  120. data/ext/rbs_extension/parser.h +18 -0
  121. data/ext/rbs_extension/parserstate.c +397 -0
  122. data/ext/rbs_extension/parserstate.h +163 -0
  123. data/ext/rbs_extension/rbs_extension.h +31 -0
  124. data/ext/rbs_extension/unescape.c +32 -0
  125. data/goodcheck.yml +91 -0
  126. data/include/rbs/constants.h +82 -0
  127. data/include/rbs/ruby_objs.h +72 -0
  128. data/include/rbs/util/rbs_constant_pool.h +219 -0
  129. data/include/rbs.h +7 -0
  130. data/lib/rbs/ancestor_graph.rb +92 -0
  131. data/lib/rbs/annotate/annotations.rb +199 -0
  132. data/lib/rbs/annotate/formatter.rb +92 -0
  133. data/lib/rbs/annotate/rdoc_annotator.rb +400 -0
  134. data/lib/rbs/annotate/rdoc_source.rb +131 -0
  135. data/lib/rbs/annotate.rb +8 -0
  136. data/lib/rbs/ast/annotation.rb +29 -0
  137. data/lib/rbs/ast/comment.rb +29 -0
  138. data/lib/rbs/ast/declarations.rb +467 -0
  139. data/lib/rbs/ast/directives.rb +49 -0
  140. data/lib/rbs/ast/members.rb +451 -0
  141. data/lib/rbs/ast/type_param.rb +225 -0
  142. data/lib/rbs/ast/visitor.rb +137 -0
  143. data/lib/rbs/buffer.rb +67 -0
  144. data/lib/rbs/builtin_names.rb +58 -0
  145. data/lib/rbs/cli/colored_io.rb +48 -0
  146. data/lib/rbs/cli/diff.rb +83 -0
  147. data/lib/rbs/cli/validate.rb +357 -0
  148. data/lib/rbs/cli.rb +1223 -0
  149. data/lib/rbs/collection/cleaner.rb +38 -0
  150. data/lib/rbs/collection/config/lockfile.rb +92 -0
  151. data/lib/rbs/collection/config/lockfile_generator.rb +218 -0
  152. data/lib/rbs/collection/config.rb +81 -0
  153. data/lib/rbs/collection/installer.rb +32 -0
  154. data/lib/rbs/collection/sources/base.rb +14 -0
  155. data/lib/rbs/collection/sources/git.rb +258 -0
  156. data/lib/rbs/collection/sources/local.rb +81 -0
  157. data/lib/rbs/collection/sources/rubygems.rb +48 -0
  158. data/lib/rbs/collection/sources/stdlib.rb +50 -0
  159. data/lib/rbs/collection/sources.rb +38 -0
  160. data/lib/rbs/collection.rb +16 -0
  161. data/lib/rbs/constant.rb +28 -0
  162. data/lib/rbs/definition.rb +401 -0
  163. data/lib/rbs/definition_builder/ancestor_builder.rb +620 -0
  164. data/lib/rbs/definition_builder/method_builder.rb +254 -0
  165. data/lib/rbs/definition_builder.rb +845 -0
  166. data/lib/rbs/diff.rb +125 -0
  167. data/lib/rbs/environment/use_map.rb +77 -0
  168. data/lib/rbs/environment.rb +829 -0
  169. data/lib/rbs/environment_loader.rb +173 -0
  170. data/lib/rbs/environment_walker.rb +155 -0
  171. data/lib/rbs/errors.rb +645 -0
  172. data/lib/rbs/factory.rb +18 -0
  173. data/lib/rbs/file_finder.rb +28 -0
  174. data/lib/rbs/location_aux.rb +138 -0
  175. data/lib/rbs/locator.rb +243 -0
  176. data/lib/rbs/method_type.rb +143 -0
  177. data/lib/rbs/namespace.rb +125 -0
  178. data/lib/rbs/parser/lex_result.rb +15 -0
  179. data/lib/rbs/parser/token.rb +23 -0
  180. data/lib/rbs/parser_aux.rb +114 -0
  181. data/lib/rbs/prototype/helpers.rb +140 -0
  182. data/lib/rbs/prototype/node_usage.rb +99 -0
  183. data/lib/rbs/prototype/rb.rb +840 -0
  184. data/lib/rbs/prototype/rbi.rb +641 -0
  185. data/lib/rbs/prototype/runtime/helpers.rb +59 -0
  186. data/lib/rbs/prototype/runtime/reflection.rb +19 -0
  187. data/lib/rbs/prototype/runtime/value_object_generator.rb +279 -0
  188. data/lib/rbs/prototype/runtime.rb +667 -0
  189. data/lib/rbs/repository.rb +127 -0
  190. data/lib/rbs/resolver/constant_resolver.rb +219 -0
  191. data/lib/rbs/resolver/type_name_resolver.rb +91 -0
  192. data/lib/rbs/sorter.rb +198 -0
  193. data/lib/rbs/substitution.rb +83 -0
  194. data/lib/rbs/subtractor.rb +201 -0
  195. data/lib/rbs/test/errors.rb +80 -0
  196. data/lib/rbs/test/guaranteed.rb +30 -0
  197. data/lib/rbs/test/hook.rb +212 -0
  198. data/lib/rbs/test/observer.rb +19 -0
  199. data/lib/rbs/test/setup.rb +84 -0
  200. data/lib/rbs/test/setup_helper.rb +50 -0
  201. data/lib/rbs/test/tester.rb +167 -0
  202. data/lib/rbs/test/type_check.rb +435 -0
  203. data/lib/rbs/test.rb +112 -0
  204. data/lib/rbs/type_alias_dependency.rb +100 -0
  205. data/lib/rbs/type_alias_regularity.rb +126 -0
  206. data/lib/rbs/type_name.rb +109 -0
  207. data/lib/rbs/types.rb +1596 -0
  208. data/lib/rbs/unit_test/convertibles.rb +176 -0
  209. data/lib/rbs/unit_test/spy.rb +138 -0
  210. data/lib/rbs/unit_test/type_assertions.rb +347 -0
  211. data/lib/rbs/unit_test/with_aliases.rb +143 -0
  212. data/lib/rbs/unit_test.rb +6 -0
  213. data/lib/rbs/validator.rb +186 -0
  214. data/lib/rbs/variance_calculator.rb +189 -0
  215. data/lib/rbs/vendorer.rb +71 -0
  216. data/lib/rbs/version.rb +5 -0
  217. data/lib/rbs/writer.rb +424 -0
  218. data/lib/rbs.rb +94 -0
  219. data/lib/rdoc/discover.rb +20 -0
  220. data/lib/rdoc_plugin/parser.rb +163 -0
  221. data/rbs-relaxed.gemspec +48 -0
  222. data/schema/annotation.json +14 -0
  223. data/schema/comment.json +26 -0
  224. data/schema/decls.json +326 -0
  225. data/schema/function.json +87 -0
  226. data/schema/location.json +56 -0
  227. data/schema/members.json +266 -0
  228. data/schema/methodType.json +50 -0
  229. data/schema/typeParam.json +36 -0
  230. data/schema/types.json +317 -0
  231. data/sig/ancestor_builder.rbs +163 -0
  232. data/sig/ancestor_graph.rbs +60 -0
  233. data/sig/annotate/annotations.rbs +102 -0
  234. data/sig/annotate/formatter.rbs +24 -0
  235. data/sig/annotate/rdoc_annotater.rbs +82 -0
  236. data/sig/annotate/rdoc_source.rbs +30 -0
  237. data/sig/annotation.rbs +27 -0
  238. data/sig/buffer.rbs +32 -0
  239. data/sig/builtin_names.rbs +44 -0
  240. data/sig/cli/colored_io.rbs +15 -0
  241. data/sig/cli/diff.rbs +21 -0
  242. data/sig/cli/validate.rbs +43 -0
  243. data/sig/cli.rbs +87 -0
  244. data/sig/collection/cleaner.rbs +13 -0
  245. data/sig/collection/config/lockfile.rbs +74 -0
  246. data/sig/collection/config/lockfile_generator.rbs +66 -0
  247. data/sig/collection/config.rbs +46 -0
  248. data/sig/collection/installer.rbs +17 -0
  249. data/sig/collection/sources.rbs +214 -0
  250. data/sig/collection.rbs +4 -0
  251. data/sig/comment.rbs +26 -0
  252. data/sig/constant.rbs +21 -0
  253. data/sig/declarations.rbs +267 -0
  254. data/sig/definition.rbs +173 -0
  255. data/sig/definition_builder.rbs +165 -0
  256. data/sig/diff.rbs +28 -0
  257. data/sig/directives.rbs +77 -0
  258. data/sig/environment.rbs +279 -0
  259. data/sig/environment_loader.rbs +111 -0
  260. data/sig/environment_walker.rbs +65 -0
  261. data/sig/errors.rbs +405 -0
  262. data/sig/factory.rbs +5 -0
  263. data/sig/file_finder.rbs +28 -0
  264. data/sig/location.rbs +110 -0
  265. data/sig/locator.rbs +58 -0
  266. data/sig/manifest.yaml +7 -0
  267. data/sig/members.rbs +258 -0
  268. data/sig/method_builder.rbs +84 -0
  269. data/sig/method_types.rbs +58 -0
  270. data/sig/namespace.rbs +146 -0
  271. data/sig/parser.rbs +100 -0
  272. data/sig/prototype/helpers.rbs +27 -0
  273. data/sig/prototype/node_usage.rbs +20 -0
  274. data/sig/prototype/rb.rbs +96 -0
  275. data/sig/prototype/rbi.rbs +75 -0
  276. data/sig/prototype/runtime.rbs +182 -0
  277. data/sig/rbs.rbs +21 -0
  278. data/sig/rdoc/rbs.rbs +67 -0
  279. data/sig/repository.rbs +85 -0
  280. data/sig/resolver/constant_resolver.rbs +92 -0
  281. data/sig/resolver/context.rbs +34 -0
  282. data/sig/resolver/type_name_resolver.rbs +35 -0
  283. data/sig/shims/bundler.rbs +38 -0
  284. data/sig/shims/enumerable.rbs +5 -0
  285. data/sig/shims/rubygems.rbs +19 -0
  286. data/sig/sorter.rbs +41 -0
  287. data/sig/substitution.rbs +48 -0
  288. data/sig/subtractor.rbs +37 -0
  289. data/sig/test/errors.rbs +52 -0
  290. data/sig/test/guranteed.rbs +9 -0
  291. data/sig/test/type_check.rbs +19 -0
  292. data/sig/test.rbs +82 -0
  293. data/sig/type_alias_dependency.rbs +53 -0
  294. data/sig/type_alias_regularity.rbs +98 -0
  295. data/sig/type_param.rbs +110 -0
  296. data/sig/typename.rbs +79 -0
  297. data/sig/types.rbs +579 -0
  298. data/sig/unit_test/convertibles.rbs +154 -0
  299. data/sig/unit_test/spy.rbs +30 -0
  300. data/sig/unit_test/type_assertions.rbs +196 -0
  301. data/sig/unit_test/with_aliases.rbs +136 -0
  302. data/sig/use_map.rbs +35 -0
  303. data/sig/util.rbs +9 -0
  304. data/sig/validator.rbs +63 -0
  305. data/sig/variance_calculator.rbs +87 -0
  306. data/sig/vendorer.rbs +51 -0
  307. data/sig/version.rbs +3 -0
  308. data/sig/visitor.rbs +47 -0
  309. data/sig/writer.rbs +127 -0
  310. data/src/constants.c +153 -0
  311. data/src/ruby_objs.c +795 -0
  312. data/src/util/rbs_constant_pool.c +342 -0
  313. data/stdlib/abbrev/0/abbrev.rbs +66 -0
  314. data/stdlib/abbrev/0/array.rbs +26 -0
  315. data/stdlib/base64/0/base64.rbs +355 -0
  316. data/stdlib/benchmark/0/benchmark.rbs +452 -0
  317. data/stdlib/bigdecimal/0/big_decimal.rbs +1629 -0
  318. data/stdlib/bigdecimal-math/0/big_math.rbs +119 -0
  319. data/stdlib/bigdecimal-math/0/manifest.yaml +2 -0
  320. data/stdlib/cgi/0/core.rbs +1285 -0
  321. data/stdlib/cgi/0/manifest.yaml +3 -0
  322. data/stdlib/coverage/0/coverage.rbs +263 -0
  323. data/stdlib/csv/0/csv.rbs +3776 -0
  324. data/stdlib/csv/0/manifest.yaml +3 -0
  325. data/stdlib/date/0/date.rbs +1585 -0
  326. data/stdlib/date/0/date_time.rbs +616 -0
  327. data/stdlib/date/0/time.rbs +26 -0
  328. data/stdlib/dbm/0/dbm.rbs +421 -0
  329. data/stdlib/delegate/0/delegator.rbs +184 -0
  330. data/stdlib/delegate/0/kernel.rbs +47 -0
  331. data/stdlib/delegate/0/simple_delegator.rbs +96 -0
  332. data/stdlib/did_you_mean/0/did_you_mean.rbs +343 -0
  333. data/stdlib/digest/0/digest.rbs +577 -0
  334. data/stdlib/erb/0/erb.rbs +532 -0
  335. data/stdlib/etc/0/etc.rbs +865 -0
  336. data/stdlib/fileutils/0/fileutils.rbs +1734 -0
  337. data/stdlib/find/0/find.rbs +49 -0
  338. data/stdlib/forwardable/0/forwardable.rbs +268 -0
  339. data/stdlib/io-console/0/io-console.rbs +414 -0
  340. data/stdlib/ipaddr/0/ipaddr.rbs +428 -0
  341. data/stdlib/json/0/json.rbs +1916 -0
  342. data/stdlib/kconv/0/kconv.rbs +166 -0
  343. data/stdlib/logger/0/formatter.rbs +45 -0
  344. data/stdlib/logger/0/log_device.rbs +100 -0
  345. data/stdlib/logger/0/logger.rbs +796 -0
  346. data/stdlib/logger/0/manifest.yaml +2 -0
  347. data/stdlib/logger/0/period.rbs +17 -0
  348. data/stdlib/logger/0/severity.rbs +34 -0
  349. data/stdlib/minitest/0/kernel.rbs +42 -0
  350. data/stdlib/minitest/0/minitest/abstract_reporter.rbs +52 -0
  351. data/stdlib/minitest/0/minitest/assertion.rbs +17 -0
  352. data/stdlib/minitest/0/minitest/assertions.rbs +590 -0
  353. data/stdlib/minitest/0/minitest/backtrace_filter.rbs +23 -0
  354. data/stdlib/minitest/0/minitest/bench_spec.rbs +102 -0
  355. data/stdlib/minitest/0/minitest/benchmark.rbs +259 -0
  356. data/stdlib/minitest/0/minitest/composite_reporter.rbs +25 -0
  357. data/stdlib/minitest/0/minitest/compress.rbs +13 -0
  358. data/stdlib/minitest/0/minitest/error_on_warning.rbs +3 -0
  359. data/stdlib/minitest/0/minitest/expectation.rbs +2 -0
  360. data/stdlib/minitest/0/minitest/expectations.rbs +21 -0
  361. data/stdlib/minitest/0/minitest/guard.rbs +64 -0
  362. data/stdlib/minitest/0/minitest/mock.rbs +64 -0
  363. data/stdlib/minitest/0/minitest/parallel/executor.rbs +46 -0
  364. data/stdlib/minitest/0/minitest/parallel/test/class_methods.rbs +5 -0
  365. data/stdlib/minitest/0/minitest/parallel/test.rbs +3 -0
  366. data/stdlib/minitest/0/minitest/parallel.rbs +2 -0
  367. data/stdlib/minitest/0/minitest/pride_io.rbs +62 -0
  368. data/stdlib/minitest/0/minitest/pride_lol.rbs +19 -0
  369. data/stdlib/minitest/0/minitest/progress_reporter.rbs +11 -0
  370. data/stdlib/minitest/0/minitest/reportable.rbs +53 -0
  371. data/stdlib/minitest/0/minitest/reporter.rbs +5 -0
  372. data/stdlib/minitest/0/minitest/result.rbs +28 -0
  373. data/stdlib/minitest/0/minitest/runnable.rbs +163 -0
  374. data/stdlib/minitest/0/minitest/skip.rbs +6 -0
  375. data/stdlib/minitest/0/minitest/spec/dsl/instance_methods.rbs +48 -0
  376. data/stdlib/minitest/0/minitest/spec/dsl.rbs +129 -0
  377. data/stdlib/minitest/0/minitest/spec.rbs +11 -0
  378. data/stdlib/minitest/0/minitest/statistics_reporter.rbs +81 -0
  379. data/stdlib/minitest/0/minitest/summary_reporter.rbs +18 -0
  380. data/stdlib/minitest/0/minitest/test/lifecycle_hooks.rbs +92 -0
  381. data/stdlib/minitest/0/minitest/test.rbs +69 -0
  382. data/stdlib/minitest/0/minitest/unexpected_error.rbs +12 -0
  383. data/stdlib/minitest/0/minitest/unexpected_warning.rbs +6 -0
  384. data/stdlib/minitest/0/minitest/unit/test_case.rbs +3 -0
  385. data/stdlib/minitest/0/minitest/unit.rbs +4 -0
  386. data/stdlib/minitest/0/minitest.rbs +115 -0
  387. data/stdlib/monitor/0/monitor.rbs +363 -0
  388. data/stdlib/mutex_m/0/mutex_m.rbs +104 -0
  389. data/stdlib/net-http/0/manifest.yaml +3 -0
  390. data/stdlib/net-http/0/net-http.rbs +5552 -0
  391. data/stdlib/net-protocol/0/manifest.yaml +2 -0
  392. data/stdlib/net-protocol/0/net-protocol.rbs +56 -0
  393. data/stdlib/net-smtp/0/manifest.yaml +2 -0
  394. data/stdlib/net-smtp/0/net-smtp.rbs +55 -0
  395. data/stdlib/nkf/0/nkf.rbs +402 -0
  396. data/stdlib/objspace/0/objspace.rbs +487 -0
  397. data/stdlib/observable/0/observable.rbs +217 -0
  398. data/stdlib/open-uri/0/manifest.yaml +4 -0
  399. data/stdlib/open-uri/0/open-uri.rbs +393 -0
  400. data/stdlib/open3/0/open3.rbs +147 -0
  401. data/stdlib/openssl/0/manifest.yaml +3 -0
  402. data/stdlib/openssl/0/openssl.rbs +12113 -0
  403. data/stdlib/optparse/0/optparse.rbs +1725 -0
  404. data/stdlib/pathname/0/pathname.rbs +1406 -0
  405. data/stdlib/pp/0/manifest.yaml +2 -0
  406. data/stdlib/pp/0/pp.rbs +300 -0
  407. data/stdlib/prettyprint/0/prettyprint.rbs +383 -0
  408. data/stdlib/pstore/0/pstore.rbs +603 -0
  409. data/stdlib/psych/0/core_ext.rbs +12 -0
  410. data/stdlib/psych/0/dbm.rbs +237 -0
  411. data/stdlib/psych/0/manifest.yaml +3 -0
  412. data/stdlib/psych/0/psych.rbs +402 -0
  413. data/stdlib/psych/0/store.rbs +59 -0
  414. data/stdlib/pty/0/pty.rbs +237 -0
  415. data/stdlib/rdoc/0/code_object.rbs +51 -0
  416. data/stdlib/rdoc/0/comment.rbs +59 -0
  417. data/stdlib/rdoc/0/context.rbs +153 -0
  418. data/stdlib/rdoc/0/markup.rbs +117 -0
  419. data/stdlib/rdoc/0/parser.rbs +56 -0
  420. data/stdlib/rdoc/0/rdoc.rbs +391 -0
  421. data/stdlib/rdoc/0/ri.rbs +17 -0
  422. data/stdlib/rdoc/0/store.rbs +48 -0
  423. data/stdlib/rdoc/0/top_level.rbs +97 -0
  424. data/stdlib/resolv/0/manifest.yaml +3 -0
  425. data/stdlib/resolv/0/resolv.rbs +1830 -0
  426. data/stdlib/ripper/0/ripper.rbs +1648 -0
  427. data/stdlib/securerandom/0/securerandom.rbs +62 -0
  428. data/stdlib/shellwords/0/shellwords.rbs +229 -0
  429. data/stdlib/singleton/0/singleton.rbs +131 -0
  430. data/stdlib/socket/0/addrinfo.rbs +666 -0
  431. data/stdlib/socket/0/basic_socket.rbs +590 -0
  432. data/stdlib/socket/0/constants.rbs +2295 -0
  433. data/stdlib/socket/0/ip_socket.rbs +92 -0
  434. data/stdlib/socket/0/socket.rbs +4157 -0
  435. data/stdlib/socket/0/socket_error.rbs +5 -0
  436. data/stdlib/socket/0/tcp_server.rbs +192 -0
  437. data/stdlib/socket/0/tcp_socket.rbs +79 -0
  438. data/stdlib/socket/0/udp_socket.rbs +133 -0
  439. data/stdlib/socket/0/unix_server.rbs +169 -0
  440. data/stdlib/socket/0/unix_socket.rbs +172 -0
  441. data/stdlib/stringio/0/stringio.rbs +567 -0
  442. data/stdlib/strscan/0/string_scanner.rbs +1627 -0
  443. data/stdlib/tempfile/0/tempfile.rbs +479 -0
  444. data/stdlib/time/0/time.rbs +432 -0
  445. data/stdlib/timeout/0/timeout.rbs +81 -0
  446. data/stdlib/tmpdir/0/tmpdir.rbs +69 -0
  447. data/stdlib/tsort/0/cyclic.rbs +5 -0
  448. data/stdlib/tsort/0/interfaces.rbs +20 -0
  449. data/stdlib/tsort/0/tsort.rbs +409 -0
  450. data/stdlib/uri/0/common.rbs +582 -0
  451. data/stdlib/uri/0/file.rbs +118 -0
  452. data/stdlib/uri/0/ftp.rbs +13 -0
  453. data/stdlib/uri/0/generic.rbs +1108 -0
  454. data/stdlib/uri/0/http.rbs +104 -0
  455. data/stdlib/uri/0/https.rbs +14 -0
  456. data/stdlib/uri/0/ldap.rbs +230 -0
  457. data/stdlib/uri/0/ldaps.rbs +14 -0
  458. data/stdlib/uri/0/mailto.rbs +92 -0
  459. data/stdlib/uri/0/rfc2396_parser.rbs +189 -0
  460. data/stdlib/uri/0/rfc3986_parser.rbs +2 -0
  461. data/stdlib/uri/0/ws.rbs +13 -0
  462. data/stdlib/uri/0/wss.rbs +9 -0
  463. data/stdlib/yaml/0/manifest.yaml +2 -0
  464. data/stdlib/yaml/0/yaml.rbs +1 -0
  465. data/stdlib/zlib/0/buf_error.rbs +10 -0
  466. data/stdlib/zlib/0/data_error.rbs +10 -0
  467. data/stdlib/zlib/0/deflate.rbs +210 -0
  468. data/stdlib/zlib/0/error.rbs +20 -0
  469. data/stdlib/zlib/0/gzip_file/crc_error.rbs +12 -0
  470. data/stdlib/zlib/0/gzip_file/error.rbs +23 -0
  471. data/stdlib/zlib/0/gzip_file/length_error.rbs +12 -0
  472. data/stdlib/zlib/0/gzip_file/no_footer.rbs +11 -0
  473. data/stdlib/zlib/0/gzip_file.rbs +156 -0
  474. data/stdlib/zlib/0/gzip_reader.rbs +293 -0
  475. data/stdlib/zlib/0/gzip_writer.rbs +166 -0
  476. data/stdlib/zlib/0/inflate.rbs +180 -0
  477. data/stdlib/zlib/0/mem_error.rbs +10 -0
  478. data/stdlib/zlib/0/need_dict.rbs +13 -0
  479. data/stdlib/zlib/0/stream_end.rbs +11 -0
  480. data/stdlib/zlib/0/stream_error.rbs +11 -0
  481. data/stdlib/zlib/0/version_error.rbs +11 -0
  482. data/stdlib/zlib/0/zlib.rbs +449 -0
  483. data/stdlib/zlib/0/zstream.rbs +200 -0
  484. metadata +532 -0
@@ -0,0 +1,4157 @@
1
+ # <!-- rdoc-file=ext/socket/socket.c -->
2
+ # Class `Socket` provides access to the underlying operating system socket
3
+ # implementations. It can be used to provide more operating system specific
4
+ # functionality than the protocol-specific socket classes.
5
+ #
6
+ # The constants defined under Socket::Constants are also defined under Socket.
7
+ # For example, Socket::AF_INET is usable as well as Socket::Constants::AF_INET.
8
+ # See Socket::Constants for the list of constants.
9
+ #
10
+ # ### What's a socket?
11
+ #
12
+ # Sockets are endpoints of a bidirectional communication channel. Sockets can
13
+ # communicate within a process, between processes on the same machine or between
14
+ # different machines. There are many types of socket: TCPSocket, UDPSocket or
15
+ # UNIXSocket for example.
16
+ #
17
+ # Sockets have their own vocabulary:
18
+ #
19
+ # **domain:** The family of protocols:
20
+ # * Socket::PF_INET
21
+ # * Socket::PF_INET6
22
+ # * Socket::PF_UNIX
23
+ # * etc.
24
+ #
25
+ # **type:** The type of communications between the two endpoints, typically
26
+ # * Socket::SOCK_STREAM
27
+ # * Socket::SOCK_DGRAM.
28
+ #
29
+ # **protocol:** Typically *zero*. This may be used to identify a variant of a
30
+ # protocol.
31
+ #
32
+ # **hostname:** The identifier of a network interface:
33
+ # * a string (hostname, IPv4 or IPv6 address or `broadcast` which specifies a
34
+ # broadcast address)
35
+ # * a zero-length string which specifies INADDR_ANY
36
+ # * an integer (interpreted as binary address in host byte order).
37
+ #
38
+ # ### Quick start
39
+ #
40
+ # Many of the classes, such as TCPSocket, UDPSocket or UNIXSocket, ease the use
41
+ # of sockets comparatively to the equivalent C programming interface.
42
+ #
43
+ # Let's create an internet socket using the IPv4 protocol in a C-like manner:
44
+ #
45
+ # require 'socket'
46
+ #
47
+ # s = Socket.new Socket::AF_INET, Socket::SOCK_STREAM
48
+ # s.connect Socket.pack_sockaddr_in(80, 'example.com')
49
+ #
50
+ # You could also use the TCPSocket class:
51
+ #
52
+ # s = TCPSocket.new 'example.com', 80
53
+ #
54
+ # A simple server might look like this:
55
+ #
56
+ # require 'socket'
57
+ #
58
+ # server = TCPServer.new 2000 # Server bound to port 2000
59
+ #
60
+ # loop do
61
+ # client = server.accept # Wait for a client to connect
62
+ # client.puts "Hello !"
63
+ # client.puts "Time is #{Time.now}"
64
+ # client.close
65
+ # end
66
+ #
67
+ # A simple client may look like this:
68
+ #
69
+ # require 'socket'
70
+ #
71
+ # s = TCPSocket.new 'localhost', 2000
72
+ #
73
+ # while line = s.gets # Read lines from socket
74
+ # puts line # and print them
75
+ # end
76
+ #
77
+ # s.close # close socket when done
78
+ #
79
+ # ### Exception Handling
80
+ #
81
+ # Ruby's Socket implementation raises exceptions based on the error generated by
82
+ # the system dependent implementation. This is why the methods are documented
83
+ # in a way that isolate Unix-based system exceptions from Windows based
84
+ # exceptions. If more information on a particular exception is needed, please
85
+ # refer to the Unix manual pages or the Windows WinSock reference.
86
+ #
87
+ # ### Convenience methods
88
+ #
89
+ # Although the general way to create socket is Socket.new, there are several
90
+ # methods of socket creation for most cases.
91
+ #
92
+ # TCP client socket
93
+ # : Socket.tcp, TCPSocket.open
94
+ #
95
+ # TCP server socket
96
+ # : Socket.tcp_server_loop, TCPServer.open
97
+ #
98
+ # UNIX client socket
99
+ # : Socket.unix, UNIXSocket.open
100
+ #
101
+ # UNIX server socket
102
+ # : Socket.unix_server_loop, UNIXServer.open
103
+ #
104
+ #
105
+ # ### Documentation by
106
+ #
107
+ # * Zach Dennis
108
+ # * Sam Roberts
109
+ # * *Programming Ruby* from The Pragmatic Bookshelf.
110
+ #
111
+ # Much material in this documentation is taken with permission from *Programming
112
+ # Ruby* from The Pragmatic Bookshelf.
113
+ #
114
+ class Socket < BasicSocket
115
+ # <!--
116
+ # rdoc-file=ext/socket/lib/socket.rb
117
+ # - accept_loop(*sockets) { |socket, client_addrinfo| ... }
118
+ # -->
119
+ # yield socket and client address for each a connection accepted via given
120
+ # sockets.
121
+ #
122
+ # The arguments are a list of sockets. The individual argument should be a
123
+ # socket or an array of sockets.
124
+ #
125
+ # This method yields the block sequentially. It means that the next connection
126
+ # is not accepted until the block returns. So concurrent mechanism, thread for
127
+ # example, should be used to service multiple clients at a time.
128
+ #
129
+ def self.accept_loop: (*_ToIO sockets) { (Socket) -> void } -> void
130
+
131
+ # <!--
132
+ # rdoc-file=ext/socket/socket.c
133
+ # - Socket.getaddrinfo(nodename, servname[, family[, socktype[, protocol[, flags[, reverse_lookup]]]]]) => array
134
+ # -->
135
+ # Obtains address information for *nodename*:*servname*.
136
+ #
137
+ # Note that Addrinfo.getaddrinfo provides the same functionality in an object
138
+ # oriented style.
139
+ #
140
+ # *family* should be an address family such as: :INET, :INET6, etc.
141
+ #
142
+ # *socktype* should be a socket type such as: :STREAM, :DGRAM, :RAW, etc.
143
+ #
144
+ # *protocol* should be a protocol defined in the family, and defaults to 0 for
145
+ # the family.
146
+ #
147
+ # *flags* should be bitwise OR of Socket::AI_* constants.
148
+ #
149
+ # Socket.getaddrinfo("www.ruby-lang.org", "http", nil, :STREAM)
150
+ # #=> [["AF_INET", 80, "carbon.ruby-lang.org", "221.186.184.68", 2, 1, 6]] # PF_INET/SOCK_STREAM/IPPROTO_TCP
151
+ #
152
+ # Socket.getaddrinfo("localhost", nil)
153
+ # #=> [["AF_INET", 0, "localhost", "127.0.0.1", 2, 1, 6], # PF_INET/SOCK_STREAM/IPPROTO_TCP
154
+ # # ["AF_INET", 0, "localhost", "127.0.0.1", 2, 2, 17], # PF_INET/SOCK_DGRAM/IPPROTO_UDP
155
+ # # ["AF_INET", 0, "localhost", "127.0.0.1", 2, 3, 0]] # PF_INET/SOCK_RAW/IPPROTO_IP
156
+ #
157
+ # *reverse_lookup* directs the form of the third element, and has to be one of
158
+ # below. If *reverse_lookup* is omitted, the default value is `nil`.
159
+ #
160
+ # +true+, +:hostname+: hostname is obtained from numeric address using reverse lookup, which may take a time.
161
+ # +false+, +:numeric+: hostname is the same as numeric address.
162
+ # +nil+: obey to the current +do_not_reverse_lookup+ flag.
163
+ #
164
+ # If Addrinfo object is preferred, use Addrinfo.getaddrinfo.
165
+ #
166
+ def self.getaddrinfo: (String peer, String | Integer | nil protocol, ?Integer | Symbol | nil family, ?Integer | Symbol | nil socktype, ?Integer | Symbol | nil protocol, ?Integer | nil flags) -> [ String, Integer, String, String, Integer, Integer, Integer ]
167
+ | (String? peer, String | Integer protocol, ?Integer | Symbol | nil family, ?Integer | Symbol | nil socktype, ?Integer | Symbol | nil protocol, ?Integer | nil flags) -> [ String, Integer, String, String, Integer, Integer, Integer ]
168
+
169
+ # <!--
170
+ # rdoc-file=ext/socket/socket.c
171
+ # - Socket.gethostbyaddr(address_string [, address_family]) => hostent
172
+ # -->
173
+ # Use Addrinfo#getnameinfo instead. This method is deprecated for the following
174
+ # reasons:
175
+ #
176
+ # * Uncommon address representation: 4/16-bytes binary string to represent
177
+ # IPv4/IPv6 address.
178
+ # * gethostbyaddr() may take a long time and it may block other threads. (GVL
179
+ # cannot be released since gethostbyname() is not thread safe.)
180
+ # * This method uses gethostbyname() function already removed from POSIX.
181
+ #
182
+ # This method obtains the host information for *address*.
183
+ #
184
+ # p Socket.gethostbyaddr([221,186,184,68].pack("CCCC"))
185
+ # #=> ["carbon.ruby-lang.org", [], 2, "\xDD\xBA\xB8D"]
186
+ #
187
+ # p Socket.gethostbyaddr([127,0,0,1].pack("CCCC"))
188
+ # ["localhost", [], 2, "\x7F\x00\x00\x01"]
189
+ # p Socket.gethostbyaddr(([0]*15+[1]).pack("C"*16))
190
+ # #=> ["localhost", ["ip6-localhost", "ip6-loopback"], 10,
191
+ # "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01"]
192
+ #
193
+ def self.gethostbyaddr: (String ip) -> [ String, Array[String], Integer, String ]
194
+
195
+ # <!--
196
+ # rdoc-file=ext/socket/socket.c
197
+ # - Socket.gethostbyname(hostname) => [official_hostname, alias_hostnames, address_family, *address_list]
198
+ # -->
199
+ # Use Addrinfo.getaddrinfo instead. This method is deprecated for the following
200
+ # reasons:
201
+ #
202
+ # * The 3rd element of the result is the address family of the first address.
203
+ # The address families of the rest of the addresses are not returned.
204
+ # * Uncommon address representation: 4/16-bytes binary string to represent
205
+ # IPv4/IPv6 address.
206
+ # * gethostbyname() may take a long time and it may block other threads. (GVL
207
+ # cannot be released since gethostbyname() is not thread safe.)
208
+ # * This method uses gethostbyname() function already removed from POSIX.
209
+ #
210
+ # This method obtains the host information for *hostname*.
211
+ #
212
+ # p Socket.gethostbyname("hal") #=> ["localhost", ["hal"], 2, "\x7F\x00\x00\x01"]
213
+ #
214
+ def self.gethostbyname: (String name) -> [ String, Array[String], Integer, String ]
215
+
216
+ # <!--
217
+ # rdoc-file=ext/socket/socket.c
218
+ # - Socket.gethostname => hostname
219
+ # -->
220
+ # Returns the hostname.
221
+ #
222
+ # p Socket.gethostname #=> "hal"
223
+ #
224
+ # Note that it is not guaranteed to be able to convert to IP address using
225
+ # gethostbyname, getaddrinfo, etc. If you need local IP address, use
226
+ # Socket.ip_address_list.
227
+ #
228
+ def self.gethostname: () -> String
229
+
230
+ # <!--
231
+ # rdoc-file=ext/socket/ifaddr.c
232
+ # - Socket.getifaddrs => [ifaddr1, ...]
233
+ # -->
234
+ # Returns an array of interface addresses. An element of the array is an
235
+ # instance of Socket::Ifaddr.
236
+ #
237
+ # This method can be used to find multicast-enabled interfaces:
238
+ #
239
+ # pp Socket.getifaddrs.reject {|ifaddr|
240
+ # !ifaddr.addr.ip? || (ifaddr.flags & Socket::IFF_MULTICAST == 0)
241
+ # }.map {|ifaddr| [ifaddr.name, ifaddr.ifindex, ifaddr.addr] }
242
+ # #=> [["eth0", 2, #<Addrinfo: 221.186.184.67>],
243
+ # # ["eth0", 2, #<Addrinfo: fe80::216:3eff:fe95:88bb%eth0>]]
244
+ #
245
+ # Example result on GNU/Linux:
246
+ # pp Socket.getifaddrs
247
+ # #=> [#<Socket::Ifaddr lo UP,LOOPBACK,RUNNING,0x10000 PACKET[protocol=0 lo hatype=772 HOST hwaddr=00:00:00:00:00:00]>,
248
+ # # #<Socket::Ifaddr eth0 UP,BROADCAST,RUNNING,MULTICAST,0x10000 PACKET[protocol=0 eth0 hatype=1 HOST hwaddr=00:16:3e:95:88:bb] broadcast=PACKET[protocol=0 eth0 hatype=1 HOST hwaddr=ff:ff:ff:ff:ff:ff]>,
249
+ # # #<Socket::Ifaddr sit0 NOARP PACKET[protocol=0 sit0 hatype=776 HOST hwaddr=00:00:00:00]>,
250
+ # # #<Socket::Ifaddr lo UP,LOOPBACK,RUNNING,0x10000 127.0.0.1 netmask=255.0.0.0>,
251
+ # # #<Socket::Ifaddr eth0 UP,BROADCAST,RUNNING,MULTICAST,0x10000 221.186.184.67 netmask=255.255.255.240 broadcast=221.186.184.79>,
252
+ # # #<Socket::Ifaddr lo UP,LOOPBACK,RUNNING,0x10000 ::1 netmask=ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff>,
253
+ # # #<Socket::Ifaddr eth0 UP,BROADCAST,RUNNING,MULTICAST,0x10000 fe80::216:3eff:fe95:88bb%eth0 netmask=ffff:ffff:ffff:ffff::>]
254
+ #
255
+ # Example result on FreeBSD:
256
+ # pp Socket.getifaddrs
257
+ # #=> [#<Socket::Ifaddr usbus0 UP,0x10000 LINK[usbus0]>,
258
+ # # #<Socket::Ifaddr re0 UP,BROADCAST,RUNNING,MULTICAST,0x800 LINK[re0 3a:d0:40:9a:fe:e8]>,
259
+ # # #<Socket::Ifaddr re0 UP,BROADCAST,RUNNING,MULTICAST,0x800 10.250.10.18 netmask=255.255.255.? (7 bytes for 16 bytes sockaddr_in) broadcast=10.250.10.255>,
260
+ # # #<Socket::Ifaddr re0 UP,BROADCAST,RUNNING,MULTICAST,0x800 fe80:2::38d0:40ff:fe9a:fee8 netmask=ffff:ffff:ffff:ffff::>,
261
+ # # #<Socket::Ifaddr re0 UP,BROADCAST,RUNNING,MULTICAST,0x800 2001:2e8:408:10::12 netmask=UNSPEC>,
262
+ # # #<Socket::Ifaddr plip0 POINTOPOINT,MULTICAST,0x800 LINK[plip0]>,
263
+ # # #<Socket::Ifaddr lo0 UP,LOOPBACK,RUNNING,MULTICAST LINK[lo0]>,
264
+ # # #<Socket::Ifaddr lo0 UP,LOOPBACK,RUNNING,MULTICAST ::1 netmask=ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff>,
265
+ # # #<Socket::Ifaddr lo0 UP,LOOPBACK,RUNNING,MULTICAST fe80:4::1 netmask=ffff:ffff:ffff:ffff::>,
266
+ # # #<Socket::Ifaddr lo0 UP,LOOPBACK,RUNNING,MULTICAST 127.0.0.1 netmask=255.?.?.? (5 bytes for 16 bytes sockaddr_in)>]
267
+ #
268
+ def self.getifaddrs: () -> Array[Socket::Ifaddr]
269
+
270
+ # <!--
271
+ # rdoc-file=ext/socket/socket.c
272
+ # - Socket.getnameinfo(sockaddr [, flags]) => [hostname, servicename]
273
+ # -->
274
+ # Obtains name information for *sockaddr*.
275
+ #
276
+ # *sockaddr* should be one of follows.
277
+ # * packed sockaddr string such as Socket.sockaddr_in(80, "127.0.0.1")
278
+ # * 3-elements array such as ["AF_INET", 80, "127.0.0.1"]
279
+ # * 4-elements array such as ["AF_INET", 80, ignored, "127.0.0.1"]
280
+ #
281
+ # *flags* should be bitwise OR of Socket::NI_* constants.
282
+ #
283
+ # Note: The last form is compatible with IPSocket#addr and IPSocket#peeraddr.
284
+ #
285
+ # Socket.getnameinfo(Socket.sockaddr_in(80, "127.0.0.1")) #=> ["localhost", "www"]
286
+ # Socket.getnameinfo(["AF_INET", 80, "127.0.0.1"]) #=> ["localhost", "www"]
287
+ # Socket.getnameinfo(["AF_INET", 80, "localhost", "127.0.0.1"]) #=> ["localhost", "www"]
288
+ #
289
+ # If Addrinfo object is preferred, use Addrinfo#getnameinfo.
290
+ #
291
+ def self.getnameinfo: ([ String, Integer, String ]) -> Array[String]
292
+ | ([ String, Integer, String, String ]) -> Array[String]
293
+ | (String sockaddr) -> Array[String]
294
+
295
+ # <!--
296
+ # rdoc-file=ext/socket/socket.c
297
+ # - Socket.getservbyname(service_name) => port_number
298
+ # - Socket.getservbyname(service_name, protocol_name) => port_number
299
+ # -->
300
+ # Obtains the port number for *service_name*.
301
+ #
302
+ # If *protocol_name* is not given, "tcp" is assumed.
303
+ #
304
+ # Socket.getservbyname("smtp") #=> 25
305
+ # Socket.getservbyname("shell") #=> 514
306
+ # Socket.getservbyname("syslog", "udp") #=> 514
307
+ #
308
+ def self.getservbyname: (String service_proto) -> Integer
309
+ | (String service_proto, String layer4_proto) -> Integer
310
+
311
+ # <!--
312
+ # rdoc-file=ext/socket/socket.c
313
+ # - Socket.getservbyport(port [, protocol_name]) => service
314
+ # -->
315
+ # Obtains the port number for *port*.
316
+ #
317
+ # If *protocol_name* is not given, "tcp" is assumed.
318
+ #
319
+ # Socket.getservbyport(80) #=> "www"
320
+ # Socket.getservbyport(514, "tcp") #=> "shell"
321
+ # Socket.getservbyport(514, "udp") #=> "syslog"
322
+ #
323
+ def self.getservbyport: (Integer service_port) -> String
324
+ | (Integer service_port, String layer4_proto) -> String
325
+
326
+ # <!--
327
+ # rdoc-file=ext/socket/socket.c
328
+ # - Socket.ip_address_list => array
329
+ # -->
330
+ # Returns local IP addresses as an array.
331
+ #
332
+ # The array contains Addrinfo objects.
333
+ #
334
+ # pp Socket.ip_address_list
335
+ # #=> [#<Addrinfo: 127.0.0.1>,
336
+ # #<Addrinfo: 192.168.0.128>,
337
+ # #<Addrinfo: ::1>,
338
+ # ...]
339
+ #
340
+ def self.ip_address_list: () -> Array[Addrinfo]
341
+
342
+ # <!--
343
+ # rdoc-file=ext/socket/socket.c
344
+ # - Socket.sockaddr_in(port, host) => sockaddr
345
+ # - Socket.pack_sockaddr_in(port, host) => sockaddr
346
+ # -->
347
+ # Packs *port* and *host* as an AF_INET/AF_INET6 sockaddr string.
348
+ #
349
+ # Socket.sockaddr_in(80, "127.0.0.1")
350
+ # #=> "\x02\x00\x00P\x7F\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00"
351
+ #
352
+ # Socket.sockaddr_in(80, "::1")
353
+ # #=> "\n\x00\x00P\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00"
354
+ #
355
+ def self.pack_sockaddr_in: (Integer port, String ip) -> String
356
+
357
+ # <!--
358
+ # rdoc-file=ext/socket/socket.c
359
+ # - Socket.sockaddr_un(path) => sockaddr
360
+ # - Socket.pack_sockaddr_un(path) => sockaddr
361
+ # -->
362
+ # Packs *path* as an AF_UNIX sockaddr string.
363
+ #
364
+ # Socket.sockaddr_un("/tmp/sock") #=> "\x01\x00/tmp/sock\x00\x00..."
365
+ #
366
+ def self.pack_sockaddr_un: (String sockpath) -> String
367
+
368
+ # <!--
369
+ # rdoc-file=ext/socket/socket.c
370
+ # - Socket.pair(domain, type, protocol) => [socket1, socket2]
371
+ # - Socket.socketpair(domain, type, protocol) => [socket1, socket2]
372
+ # -->
373
+ # Creates a pair of sockets connected each other.
374
+ #
375
+ # *domain* should be a communications domain such as: :INET, :INET6, :UNIX, etc.
376
+ #
377
+ # *socktype* should be a socket type such as: :STREAM, :DGRAM, :RAW, etc.
378
+ #
379
+ # *protocol* should be a protocol defined in the domain, defaults to 0 for the
380
+ # domain.
381
+ #
382
+ # s1, s2 = Socket.pair(:UNIX, :STREAM, 0)
383
+ # s1.send "a", 0
384
+ # s1.send "b", 0
385
+ # s1.close
386
+ # p s2.recv(10) #=> "ab"
387
+ # p s2.recv(10) #=> ""
388
+ # p s2.recv(10) #=> ""
389
+ #
390
+ # s1, s2 = Socket.pair(:UNIX, :DGRAM, 0)
391
+ # s1.send "a", 0
392
+ # s1.send "b", 0
393
+ # p s2.recv(10) #=> "a"
394
+ # p s2.recv(10) #=> "b"
395
+ #
396
+ def self.pair: (Symbol sockdomain, Symbol socktype, Integer protocol) -> [ instance, instance ]
397
+
398
+ # <!--
399
+ # rdoc-file=ext/socket/socket.c
400
+ # - Socket.sockaddr_in(port, host) => sockaddr
401
+ # - Socket.pack_sockaddr_in(port, host) => sockaddr
402
+ # -->
403
+ # Packs *port* and *host* as an AF_INET/AF_INET6 sockaddr string.
404
+ #
405
+ # Socket.sockaddr_in(80, "127.0.0.1")
406
+ # #=> "\x02\x00\x00P\x7F\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00"
407
+ #
408
+ # Socket.sockaddr_in(80, "::1")
409
+ # #=> "\n\x00\x00P\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00"
410
+ #
411
+ def self.sockaddr_in: (Integer port, String ip) -> String
412
+
413
+ # <!--
414
+ # rdoc-file=ext/socket/socket.c
415
+ # - Socket.sockaddr_un(path) => sockaddr
416
+ # - Socket.pack_sockaddr_un(path) => sockaddr
417
+ # -->
418
+ # Packs *path* as an AF_UNIX sockaddr string.
419
+ #
420
+ # Socket.sockaddr_un("/tmp/sock") #=> "\x01\x00/tmp/sock\x00\x00..."
421
+ #
422
+ def self.sockaddr_un: (String sockpath) -> String
423
+
424
+ # <!--
425
+ # rdoc-file=ext/socket/socket.c
426
+ # - Socket.pair(domain, type, protocol) => [socket1, socket2]
427
+ # - Socket.socketpair(domain, type, protocol) => [socket1, socket2]
428
+ # -->
429
+ # Creates a pair of sockets connected each other.
430
+ #
431
+ # *domain* should be a communications domain such as: :INET, :INET6, :UNIX, etc.
432
+ #
433
+ # *socktype* should be a socket type such as: :STREAM, :DGRAM, :RAW, etc.
434
+ #
435
+ # *protocol* should be a protocol defined in the domain, defaults to 0 for the
436
+ # domain.
437
+ #
438
+ # s1, s2 = Socket.pair(:UNIX, :STREAM, 0)
439
+ # s1.send "a", 0
440
+ # s1.send "b", 0
441
+ # s1.close
442
+ # p s2.recv(10) #=> "ab"
443
+ # p s2.recv(10) #=> ""
444
+ # p s2.recv(10) #=> ""
445
+ #
446
+ # s1, s2 = Socket.pair(:UNIX, :DGRAM, 0)
447
+ # s1.send "a", 0
448
+ # s1.send "b", 0
449
+ # p s2.recv(10) #=> "a"
450
+ # p s2.recv(10) #=> "b"
451
+ #
452
+ def self.socketpair: (Symbol sockdomain, Symbol socktype, Integer protocol) -> [ instance, instance ]
453
+
454
+ # <!--
455
+ # rdoc-file=ext/socket/lib/socket.rb
456
+ # - Socket.tcp(host, port, local_host=nil, local_port=nil, [opts]) {|socket| ... }
457
+ # - Socket.tcp(host, port, local_host=nil, local_port=nil, [opts])
458
+ # -->
459
+ # creates a new socket object connected to host:port using TCP/IP.
460
+ #
461
+ # Starting from Ruby 3.4, this method operates according to the Happy Eyeballs
462
+ # Version 2 ([RFC 8305](https://datatracker.ietf.org/doc/html/rfc8305))
463
+ # algorithm by default.
464
+ #
465
+ # For details on Happy Eyeballs Version 2, see
466
+ # [Socket.tcp_fast_fallback=](rdoc-ref:Socket.tcp_fast_fallback=).
467
+ #
468
+ # To make it behave the same as in Ruby 3.3 and earlier, explicitly specify the
469
+ # option fast_fallback:false. Or, setting Socket.tcp_fast_fallback=false will
470
+ # disable Happy Eyeballs Version 2 not only for this method but for all Socket
471
+ # globally.
472
+ #
473
+ # If local_host:local_port is given, the socket is bound to it.
474
+ #
475
+ # The optional last argument *opts* is options represented by a hash. *opts* may
476
+ # have following options:
477
+ #
478
+ # :resolv_timeout
479
+ # : Specifies the timeout in seconds from when the hostname resolution starts.
480
+ #
481
+ # :connect_timeout
482
+ # : This method sequentially attempts connecting to all candidate destination
483
+ # addresses.
484
+ # The `connect_timeout` specifies the timeout in seconds from the start of
485
+ # the connection attempt to the last candidate.
486
+ # By default, all connection attempts continue until the timeout occurs.
487
+ # When `fast_fallback:false` is explicitly specified,
488
+ # a timeout is set for each connection attempt and any connection attempt
489
+ # that exceeds its timeout will be canceled.
490
+ #
491
+ # :fast_fallback
492
+ # : Enables the Happy Eyeballs Version 2 algorithm (enabled by default).
493
+ #
494
+ #
495
+ # If a block is given, the block is called with the socket. The value of the
496
+ # block is returned. The socket is closed when this method returns.
497
+ #
498
+ # If no block is given, the socket is returned.
499
+ #
500
+ # Socket.tcp("www.ruby-lang.org", 80) {|sock|
501
+ # sock.print "GET / HTTP/1.0\r\nHost: www.ruby-lang.org\r\n\r\n"
502
+ # sock.close_write
503
+ # puts sock.read
504
+ # }
505
+ #
506
+ def self.tcp: (String host, Integer port, ?String local_host, ?Integer local_port, ?resolv_timeout: Time::_Timeout, ?connect_timeout: Time::_Timeout) -> instance
507
+ | (String host, Integer port, ?String local_host, ?Integer local_port, ?resolv_timeout: Time::_Timeout, ?connect_timeout: Time::_Timeout) { (instance) -> void } -> void
508
+
509
+ # <!--
510
+ # rdoc-file=ext/socket/lib/socket.rb
511
+ # - tcp_server_loop(host=nil, port) { |socket, client_addrinfo| ... }
512
+ # -->
513
+ # creates a TCP/IP server on *port* and calls the block for each connection
514
+ # accepted. The block is called with a socket and a client_address as an
515
+ # Addrinfo object.
516
+ #
517
+ # If *host* is specified, it is used with *port* to determine the server
518
+ # addresses.
519
+ #
520
+ # The socket is **not** closed when the block returns. So application should
521
+ # close it explicitly.
522
+ #
523
+ # This method calls the block sequentially. It means that the next connection is
524
+ # not accepted until the block returns. So concurrent mechanism, thread for
525
+ # example, should be used to service multiple clients at a time.
526
+ #
527
+ # Note that Addrinfo.getaddrinfo is used to determine the server socket
528
+ # addresses. When Addrinfo.getaddrinfo returns two or more addresses, IPv4 and
529
+ # IPv6 address for example, all of them are used. Socket.tcp_server_loop
530
+ # succeeds if one socket can be used at least.
531
+ #
532
+ # # Sequential echo server.
533
+ # # It services only one client at a time.
534
+ # Socket.tcp_server_loop(16807) {|sock, client_addrinfo|
535
+ # begin
536
+ # IO.copy_stream(sock, sock)
537
+ # ensure
538
+ # sock.close
539
+ # end
540
+ # }
541
+ #
542
+ # # Threaded echo server
543
+ # # It services multiple clients at a time.
544
+ # # Note that it may accept connections too much.
545
+ # Socket.tcp_server_loop(16807) {|sock, client_addrinfo|
546
+ # Thread.new {
547
+ # begin
548
+ # IO.copy_stream(sock, sock)
549
+ # ensure
550
+ # sock.close
551
+ # end
552
+ # }
553
+ # }
554
+ #
555
+ def self.tcp_server_loop: (?String host, Integer port) { (instance, Addrinfo) -> void } -> void
556
+
557
+ # <!--
558
+ # rdoc-file=ext/socket/lib/socket.rb
559
+ # - tcp_server_sockets(host=nil, port) { |sockets| ... }
560
+ # -->
561
+ # creates TCP/IP server sockets for *host* and *port*. *host* is optional.
562
+ #
563
+ # If no block given, it returns an array of listening sockets.
564
+ #
565
+ # If a block is given, the block is called with the sockets. The value of the
566
+ # block is returned. The socket is closed when this method returns.
567
+ #
568
+ # If *port* is 0, actual port number is chosen dynamically. However all sockets
569
+ # in the result has same port number.
570
+ #
571
+ # # tcp_server_sockets returns two sockets.
572
+ # sockets = Socket.tcp_server_sockets(1296)
573
+ # p sockets #=> [#<Socket:fd 3>, #<Socket:fd 4>]
574
+ #
575
+ # # The sockets contains IPv6 and IPv4 sockets.
576
+ # sockets.each {|s| p s.local_address }
577
+ # #=> #<Addrinfo: [::]:1296 TCP>
578
+ # # #<Addrinfo: 0.0.0.0:1296 TCP>
579
+ #
580
+ # # IPv6 and IPv4 socket has same port number, 53114, even if it is chosen dynamically.
581
+ # sockets = Socket.tcp_server_sockets(0)
582
+ # sockets.each {|s| p s.local_address }
583
+ # #=> #<Addrinfo: [::]:53114 TCP>
584
+ # # #<Addrinfo: 0.0.0.0:53114 TCP>
585
+ #
586
+ # # The block is called with the sockets.
587
+ # Socket.tcp_server_sockets(0) {|sockets|
588
+ # p sockets #=> [#<Socket:fd 3>, #<Socket:fd 4>]
589
+ # }
590
+ #
591
+ def self.tcp_server_sockets: (?String host, Integer port) -> Array[TCPServer]
592
+ | (?String host, Integer port) { (Array[TCPServer]) -> void } -> void
593
+
594
+ # <!--
595
+ # rdoc-file=ext/socket/lib/socket.rb
596
+ # - Socket.udp_server_loop(port) {|msg, msg_src| ... }
597
+ # - Socket.udp_server_loop(host, port) {|msg, msg_src| ... }
598
+ # -->
599
+ # creates a UDP/IP server on *port* and calls the block for each message
600
+ # arrived. The block is called with the message and its source information.
601
+ #
602
+ # This method allocates sockets internally using *port*. If *host* is specified,
603
+ # it is used conjunction with *port* to determine the server addresses.
604
+ #
605
+ # The *msg* is a string.
606
+ #
607
+ # The *msg_src* is a Socket::UDPSource object. It is used for reply.
608
+ #
609
+ # # UDP/IP echo server.
610
+ # Socket.udp_server_loop(9261) {|msg, msg_src|
611
+ # msg_src.reply msg
612
+ # }
613
+ #
614
+ def self.udp_server_loop: (?String host, Integer port) { (String, Socket::UDPSource) -> void } -> void
615
+
616
+ # <!--
617
+ # rdoc-file=ext/socket/lib/socket.rb
618
+ # - Socket.udp_server_loop_on(sockets) {|msg, msg_src| ... }
619
+ # -->
620
+ # Run UDP/IP server loop on the given sockets.
621
+ #
622
+ # The return value of Socket.udp_server_sockets is appropriate for the argument.
623
+ #
624
+ # It calls the block for each message received.
625
+ #
626
+ def self.udp_server_loop_on: (UDPSocket sockets) { (String, Socket::UDPSource) -> void } -> void
627
+
628
+ # <!--
629
+ # rdoc-file=ext/socket/lib/socket.rb
630
+ # - Socket.udp_server_recv(sockets) {|msg, msg_src| ... }
631
+ # -->
632
+ # Receive UDP/IP packets from the given *sockets*. For each packet received, the
633
+ # block is called.
634
+ #
635
+ # The block receives *msg* and *msg_src*. *msg* is a string which is the payload
636
+ # of the received packet. *msg_src* is a Socket::UDPSource object which is used
637
+ # for reply.
638
+ #
639
+ # Socket.udp_server_loop can be implemented using this method as follows.
640
+ #
641
+ # udp_server_sockets(host, port) {|sockets|
642
+ # loop {
643
+ # readable, _, _ = IO.select(sockets)
644
+ # udp_server_recv(readable) {|msg, msg_src| ... }
645
+ # }
646
+ # }
647
+ #
648
+ def self.udp_server_recv: (Array[UDPSocket] sockets) { (String, Socket::UDPSource) -> void } -> void
649
+
650
+ # <!--
651
+ # rdoc-file=ext/socket/lib/socket.rb
652
+ # - Socket.udp_server_sockets([host, ] port)
653
+ # -->
654
+ # Creates UDP/IP sockets for a UDP server.
655
+ #
656
+ # If no block given, it returns an array of sockets.
657
+ #
658
+ # If a block is given, the block is called with the sockets. The value of the
659
+ # block is returned. The sockets are closed when this method returns.
660
+ #
661
+ # If *port* is zero, some port is chosen. But the chosen port is used for the
662
+ # all sockets.
663
+ #
664
+ # # UDP/IP echo server
665
+ # Socket.udp_server_sockets(0) {|sockets|
666
+ # p sockets.first.local_address.ip_port #=> 32963
667
+ # Socket.udp_server_loop_on(sockets) {|msg, msg_src|
668
+ # msg_src.reply msg
669
+ # }
670
+ # }
671
+ #
672
+ def self.udp_server_sockets: (?String host, Integer port) { (UDPSocket) -> void } -> void
673
+
674
+ # <!--
675
+ # rdoc-file=ext/socket/lib/socket.rb
676
+ # - unix(path) { |socket| ... }
677
+ # -->
678
+ # creates a new socket connected to path using UNIX socket socket.
679
+ #
680
+ # If a block is given, the block is called with the socket. The value of the
681
+ # block is returned. The socket is closed when this method returns.
682
+ #
683
+ # If no block is given, the socket is returned.
684
+ #
685
+ # # talk to /tmp/sock socket.
686
+ # Socket.unix("/tmp/sock") {|sock|
687
+ # t = Thread.new { IO.copy_stream(sock, STDOUT) }
688
+ # IO.copy_stream(STDIN, sock)
689
+ # t.join
690
+ # }
691
+ #
692
+ def self.unix: (String path) -> UNIXSocket
693
+ | (String path) { (UNIXSocket) -> void } -> void
694
+
695
+ # <!--
696
+ # rdoc-file=ext/socket/lib/socket.rb
697
+ # - unix_server_loop(path) { |socket, client_addrinfo| ... }
698
+ # -->
699
+ # creates a UNIX socket server on *path*. It calls the block for each socket
700
+ # accepted.
701
+ #
702
+ # If *host* is specified, it is used with *port* to determine the server ports.
703
+ #
704
+ # The socket is **not** closed when the block returns. So application should
705
+ # close it.
706
+ #
707
+ # This method deletes the socket file pointed by *path* at first if the file is
708
+ # a socket file and it is owned by the user of the application. This is safe
709
+ # only if the directory of *path* is not changed by a malicious user. So don't
710
+ # use /tmp/malicious-users-directory/socket. Note that /tmp/socket and
711
+ # /tmp/your-private-directory/socket is safe assuming that /tmp has sticky bit.
712
+ #
713
+ # # Sequential echo server.
714
+ # # It services only one client at a time.
715
+ # Socket.unix_server_loop("/tmp/sock") {|sock, client_addrinfo|
716
+ # begin
717
+ # IO.copy_stream(sock, sock)
718
+ # ensure
719
+ # sock.close
720
+ # end
721
+ # }
722
+ #
723
+ def self.unix_server_loop: (String path) { (UNIXSocket, Addrinfo) -> void } -> void
724
+
725
+ # <!--
726
+ # rdoc-file=ext/socket/lib/socket.rb
727
+ # - unix_server_socket(path) { |s| ... }
728
+ # -->
729
+ # creates a UNIX server socket on *path*
730
+ #
731
+ # If no block given, it returns a listening socket.
732
+ #
733
+ # If a block is given, it is called with the socket and the block value is
734
+ # returned. When the block exits, the socket is closed and the socket file is
735
+ # removed.
736
+ #
737
+ # socket = Socket.unix_server_socket("/tmp/s")
738
+ # p socket #=> #<Socket:fd 3>
739
+ # p socket.local_address #=> #<Addrinfo: /tmp/s SOCK_STREAM>
740
+ #
741
+ # Socket.unix_server_socket("/tmp/sock") {|s|
742
+ # p s #=> #<Socket:fd 3>
743
+ # p s.local_address #=> # #<Addrinfo: /tmp/sock SOCK_STREAM>
744
+ # }
745
+ #
746
+ def self.unix_server_socket: (String path) -> Socket
747
+ | (String path) { (Socket) -> void } -> void
748
+
749
+ # <!--
750
+ # rdoc-file=ext/socket/socket.c
751
+ # - Socket.unpack_sockaddr_in(sockaddr) => [port, ip_address]
752
+ # -->
753
+ # Unpacks *sockaddr* into port and ip_address.
754
+ #
755
+ # *sockaddr* should be a string or an addrinfo for AF_INET/AF_INET6.
756
+ #
757
+ # sockaddr = Socket.sockaddr_in(80, "127.0.0.1")
758
+ # p sockaddr #=> "\x02\x00\x00P\x7F\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00"
759
+ # p Socket.unpack_sockaddr_in(sockaddr) #=> [80, "127.0.0.1"]
760
+ #
761
+ def self.unpack_sockaddr_in: (String | Addrinfo sockaddr) -> [ Integer, String ]
762
+
763
+ # <!--
764
+ # rdoc-file=ext/socket/socket.c
765
+ # - Socket.unpack_sockaddr_un(sockaddr) => path
766
+ # -->
767
+ # Unpacks *sockaddr* into path.
768
+ #
769
+ # *sockaddr* should be a string or an addrinfo for AF_UNIX.
770
+ #
771
+ # sockaddr = Socket.sockaddr_un("/tmp/sock")
772
+ # p Socket.unpack_sockaddr_un(sockaddr) #=> "/tmp/sock"
773
+ #
774
+ def self.unpack_sockaddr_un: (String path) -> String
775
+
776
+ # <!--
777
+ # rdoc-file=ext/socket/socket.c
778
+ # - socket.accept => [client_socket, client_addrinfo]
779
+ # -->
780
+ # Accepts a next connection. Returns a new Socket object and Addrinfo object.
781
+ #
782
+ # serv = Socket.new(:INET, :STREAM, 0)
783
+ # serv.listen(5)
784
+ # c = Socket.new(:INET, :STREAM, 0)
785
+ # c.connect(serv.connect_address)
786
+ # p serv.accept #=> [#<Socket:fd 6>, #<Addrinfo: 127.0.0.1:48555 TCP>]
787
+ #
788
+ def accept: () -> [ Socket, Addrinfo ]
789
+
790
+ # <!--
791
+ # rdoc-file=ext/socket/lib/socket.rb
792
+ # - socket.accept_nonblock([options]) => [client_socket, client_addrinfo]
793
+ # -->
794
+ # Accepts an incoming connection using accept(2) after O_NONBLOCK is set for the
795
+ # underlying file descriptor. It returns an array containing the accepted socket
796
+ # for the incoming connection, *client_socket*, and an Addrinfo,
797
+ # *client_addrinfo*.
798
+ #
799
+ # ### Example
800
+ # # In one script, start this first
801
+ # require 'socket'
802
+ # include Socket::Constants
803
+ # socket = Socket.new(AF_INET, SOCK_STREAM, 0)
804
+ # sockaddr = Socket.sockaddr_in(2200, 'localhost')
805
+ # socket.bind(sockaddr)
806
+ # socket.listen(5)
807
+ # begin # emulate blocking accept
808
+ # client_socket, client_addrinfo = socket.accept_nonblock
809
+ # rescue IO::WaitReadable, Errno::EINTR
810
+ # IO.select([socket])
811
+ # retry
812
+ # end
813
+ # puts "The client said, '#{client_socket.readline.chomp}'"
814
+ # client_socket.puts "Hello from script one!"
815
+ # socket.close
816
+ #
817
+ # # In another script, start this second
818
+ # require 'socket'
819
+ # include Socket::Constants
820
+ # socket = Socket.new(AF_INET, SOCK_STREAM, 0)
821
+ # sockaddr = Socket.sockaddr_in(2200, 'localhost')
822
+ # socket.connect(sockaddr)
823
+ # socket.puts "Hello from script 2."
824
+ # puts "The server said, '#{socket.readline.chomp}'"
825
+ # socket.close
826
+ #
827
+ # Refer to Socket#accept for the exceptions that may be thrown if the call to
828
+ # *accept_nonblock* fails.
829
+ #
830
+ # Socket#accept_nonblock may raise any error corresponding to accept(2) failure,
831
+ # including Errno::EWOULDBLOCK.
832
+ #
833
+ # If the exception is Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::ECONNABORTED or
834
+ # Errno::EPROTO, it is extended by IO::WaitReadable. So IO::WaitReadable can be
835
+ # used to rescue the exceptions for retrying accept_nonblock.
836
+ #
837
+ # By specifying a keyword argument *exception* to `false`, you can indicate that
838
+ # accept_nonblock should not raise an IO::WaitReadable exception, but return the
839
+ # symbol `:wait_readable` instead.
840
+ #
841
+ # ### See
842
+ # * Socket#accept
843
+ #
844
+ def accept_nonblock: (?exception: boolish) -> ([ Socket, Addrinfo ] | :wait_readable)
845
+
846
+ # <!--
847
+ # rdoc-file=ext/socket/socket.c
848
+ # - socket.bind(local_sockaddr) => 0
849
+ # -->
850
+ # Binds to the given local address.
851
+ #
852
+ # ### Parameter
853
+ # * `local_sockaddr` - the `struct` sockaddr contained in a string or an
854
+ # Addrinfo object
855
+ #
856
+ # ### Example
857
+ # require 'socket'
858
+ #
859
+ # # use Addrinfo
860
+ # socket = Socket.new(:INET, :STREAM, 0)
861
+ # socket.bind(Addrinfo.tcp("127.0.0.1", 2222))
862
+ # p socket.local_address #=> #<Addrinfo: 127.0.0.1:2222 TCP>
863
+ #
864
+ # # use struct sockaddr
865
+ # include Socket::Constants
866
+ # socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
867
+ # sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
868
+ # socket.bind( sockaddr )
869
+ #
870
+ # ### Unix-based Exceptions
871
+ # On unix-based based systems the following system exceptions may be raised if
872
+ # the call to *bind* fails:
873
+ # * Errno::EACCES - the specified *sockaddr* is protected and the current user
874
+ # does not have permission to bind to it
875
+ # * Errno::EADDRINUSE - the specified *sockaddr* is already in use
876
+ # * Errno::EADDRNOTAVAIL - the specified *sockaddr* is not available from the
877
+ # local machine
878
+ # * Errno::EAFNOSUPPORT - the specified *sockaddr* is not a valid address for
879
+ # the family of the calling `socket`
880
+ # * Errno::EBADF - the *sockaddr* specified is not a valid file descriptor
881
+ # * Errno::EFAULT - the *sockaddr* argument cannot be accessed
882
+ # * Errno::EINVAL - the `socket` is already bound to an address, and the
883
+ # protocol does not support binding to the new *sockaddr* or the `socket`
884
+ # has been shut down.
885
+ # * Errno::EINVAL - the address length is not a valid length for the address
886
+ # family
887
+ # * Errno::ENAMETOOLONG - the pathname resolved had a length which exceeded
888
+ # PATH_MAX
889
+ # * Errno::ENOBUFS - no buffer space is available
890
+ # * Errno::ENOSR - there were insufficient STREAMS resources available to
891
+ # complete the operation
892
+ # * Errno::ENOTSOCK - the `socket` does not refer to a socket
893
+ # * Errno::EOPNOTSUPP - the socket type of the `socket` does not support
894
+ # binding to an address
895
+ #
896
+ # On unix-based based systems if the address family of the calling `socket` is
897
+ # Socket::AF_UNIX the follow exceptions may be raised if the call to *bind*
898
+ # fails:
899
+ # * Errno::EACCES - search permission is denied for a component of the prefix
900
+ # path or write access to the `socket` is denied
901
+ # * Errno::EDESTADDRREQ - the *sockaddr* argument is a null pointer
902
+ # * Errno::EISDIR - same as Errno::EDESTADDRREQ
903
+ # * Errno::EIO - an i/o error occurred
904
+ # * Errno::ELOOP - too many symbolic links were encountered in translating the
905
+ # pathname in *sockaddr*
906
+ # * Errno::ENAMETOOLLONG - a component of a pathname exceeded NAME_MAX
907
+ # characters, or an entire pathname exceeded PATH_MAX characters
908
+ # * Errno::ENOENT - a component of the pathname does not name an existing file
909
+ # or the pathname is an empty string
910
+ # * Errno::ENOTDIR - a component of the path prefix of the pathname in
911
+ # *sockaddr* is not a directory
912
+ # * Errno::EROFS - the name would reside on a read only filesystem
913
+ #
914
+ # ### Windows Exceptions
915
+ # On Windows systems the following system exceptions may be raised if the call
916
+ # to *bind* fails:
917
+ # * Errno::ENETDOWN-- the network is down
918
+ # * Errno::EACCES - the attempt to connect the datagram socket to the
919
+ # broadcast address failed
920
+ # * Errno::EADDRINUSE - the socket's local address is already in use
921
+ # * Errno::EADDRNOTAVAIL - the specified address is not a valid address for
922
+ # this computer
923
+ # * Errno::EFAULT - the socket's internal address or address length parameter
924
+ # is too small or is not a valid part of the user space addressed
925
+ # * Errno::EINVAL - the `socket` is already bound to an address
926
+ # * Errno::ENOBUFS - no buffer space is available
927
+ # * Errno::ENOTSOCK - the `socket` argument does not refer to a socket
928
+ #
929
+ # ### See
930
+ # * bind manual pages on unix-based systems
931
+ # * bind function in Microsoft's Winsock functions reference
932
+ #
933
+ def bind: (String | Addrinfo local_sockaddr) -> void
934
+
935
+ # <!--
936
+ # rdoc-file=ext/socket/socket.c
937
+ # - socket.connect(remote_sockaddr) => 0
938
+ # -->
939
+ # Requests a connection to be made on the given `remote_sockaddr`. Returns 0 if
940
+ # successful, otherwise an exception is raised.
941
+ #
942
+ # ### Parameter
943
+ # * `remote_sockaddr` - the `struct` sockaddr contained in a string or
944
+ # Addrinfo object
945
+ #
946
+ # ### Example:
947
+ # # Pull down Google's web page
948
+ # require 'socket'
949
+ # include Socket::Constants
950
+ # socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
951
+ # sockaddr = Socket.pack_sockaddr_in( 80, 'www.google.com' )
952
+ # socket.connect( sockaddr )
953
+ # socket.write( "GET / HTTP/1.0\r\n\r\n" )
954
+ # results = socket.read
955
+ #
956
+ # ### Unix-based Exceptions
957
+ # On unix-based systems the following system exceptions may be raised if the
958
+ # call to *connect* fails:
959
+ # * Errno::EACCES - search permission is denied for a component of the prefix
960
+ # path or write access to the `socket` is denied
961
+ # * Errno::EADDRINUSE - the *sockaddr* is already in use
962
+ # * Errno::EADDRNOTAVAIL - the specified *sockaddr* is not available from the
963
+ # local machine
964
+ # * Errno::EAFNOSUPPORT - the specified *sockaddr* is not a valid address for
965
+ # the address family of the specified `socket`
966
+ # * Errno::EALREADY - a connection is already in progress for the specified
967
+ # socket
968
+ # * Errno::EBADF - the `socket` is not a valid file descriptor
969
+ # * Errno::ECONNREFUSED - the target *sockaddr* was not listening for
970
+ # connections refused the connection request
971
+ # * Errno::ECONNRESET - the remote host reset the connection request
972
+ # * Errno::EFAULT - the *sockaddr* cannot be accessed
973
+ # * Errno::EHOSTUNREACH - the destination host cannot be reached (probably
974
+ # because the host is down or a remote router cannot reach it)
975
+ # * Errno::EINPROGRESS - the O_NONBLOCK is set for the `socket` and the
976
+ # connection cannot be immediately established; the connection will be
977
+ # established asynchronously
978
+ # * Errno::EINTR - the attempt to establish the connection was interrupted by
979
+ # delivery of a signal that was caught; the connection will be established
980
+ # asynchronously
981
+ # * Errno::EISCONN - the specified `socket` is already connected
982
+ # * Errno::EINVAL - the address length used for the *sockaddr* is not a valid
983
+ # length for the address family or there is an invalid family in *sockaddr*
984
+ # * Errno::ENAMETOOLONG - the pathname resolved had a length which exceeded
985
+ # PATH_MAX
986
+ # * Errno::ENETDOWN - the local interface used to reach the destination is
987
+ # down
988
+ # * Errno::ENETUNREACH - no route to the network is present
989
+ # * Errno::ENOBUFS - no buffer space is available
990
+ # * Errno::ENOSR - there were insufficient STREAMS resources available to
991
+ # complete the operation
992
+ # * Errno::ENOTSOCK - the `socket` argument does not refer to a socket
993
+ # * Errno::EOPNOTSUPP - the calling `socket` is listening and cannot be
994
+ # connected
995
+ # * Errno::EPROTOTYPE - the *sockaddr* has a different type than the socket
996
+ # bound to the specified peer address
997
+ # * Errno::ETIMEDOUT - the attempt to connect timed out before a connection
998
+ # was made.
999
+ #
1000
+ # On unix-based systems if the address family of the calling `socket` is AF_UNIX
1001
+ # the follow exceptions may be raised if the call to *connect* fails:
1002
+ # * Errno::EIO - an i/o error occurred while reading from or writing to the
1003
+ # file system
1004
+ # * Errno::ELOOP - too many symbolic links were encountered in translating the
1005
+ # pathname in *sockaddr*
1006
+ # * Errno::ENAMETOOLLONG - a component of a pathname exceeded NAME_MAX
1007
+ # characters, or an entire pathname exceeded PATH_MAX characters
1008
+ # * Errno::ENOENT - a component of the pathname does not name an existing file
1009
+ # or the pathname is an empty string
1010
+ # * Errno::ENOTDIR - a component of the path prefix of the pathname in
1011
+ # *sockaddr* is not a directory
1012
+ #
1013
+ # ### Windows Exceptions
1014
+ # On Windows systems the following system exceptions may be raised if the call
1015
+ # to *connect* fails:
1016
+ # * Errno::ENETDOWN - the network is down
1017
+ # * Errno::EADDRINUSE - the socket's local address is already in use
1018
+ # * Errno::EINTR - the socket was cancelled
1019
+ # * Errno::EINPROGRESS - a blocking socket is in progress or the service
1020
+ # provider is still processing a callback function. Or a nonblocking connect
1021
+ # call is in progress on the `socket`.
1022
+ # * Errno::EALREADY - see Errno::EINVAL
1023
+ # * Errno::EADDRNOTAVAIL - the remote address is not a valid address, such as
1024
+ # ADDR_ANY TODO check ADDRANY TO INADDR_ANY
1025
+ # * Errno::EAFNOSUPPORT - addresses in the specified family cannot be used
1026
+ # with with this `socket`
1027
+ # * Errno::ECONNREFUSED - the target *sockaddr* was not listening for
1028
+ # connections refused the connection request
1029
+ # * Errno::EFAULT - the socket's internal address or address length parameter
1030
+ # is too small or is not a valid part of the user space address
1031
+ # * Errno::EINVAL - the `socket` is a listening socket
1032
+ # * Errno::EISCONN - the `socket` is already connected
1033
+ # * Errno::ENETUNREACH - the network cannot be reached from this host at this
1034
+ # time
1035
+ # * Errno::EHOSTUNREACH - no route to the network is present
1036
+ # * Errno::ENOBUFS - no buffer space is available
1037
+ # * Errno::ENOTSOCK - the `socket` argument does not refer to a socket
1038
+ # * Errno::ETIMEDOUT - the attempt to connect timed out before a connection
1039
+ # was made.
1040
+ # * Errno::EWOULDBLOCK - the socket is marked as nonblocking and the
1041
+ # connection cannot be completed immediately
1042
+ # * Errno::EACCES - the attempt to connect the datagram socket to the
1043
+ # broadcast address failed
1044
+ #
1045
+ # ### See
1046
+ # * connect manual pages on unix-based systems
1047
+ # * connect function in Microsoft's Winsock functions reference
1048
+ #
1049
+ def connect: (String | Addrinfo remote_sockaddr) -> Integer
1050
+
1051
+ # <!--
1052
+ # rdoc-file=ext/socket/lib/socket.rb
1053
+ # - socket.connect_nonblock(remote_sockaddr, [options]) => 0
1054
+ # -->
1055
+ # Requests a connection to be made on the given `remote_sockaddr` after
1056
+ # O_NONBLOCK is set for the underlying file descriptor. Returns 0 if successful,
1057
+ # otherwise an exception is raised.
1058
+ #
1059
+ # ### Parameter
1060
+ # * `remote_sockaddr` - the `struct` sockaddr contained in a string or
1061
+ # Addrinfo object
1062
+ #
1063
+ # ### Example:
1064
+ # # Pull down Google's web page
1065
+ # require 'socket'
1066
+ # include Socket::Constants
1067
+ # socket = Socket.new(AF_INET, SOCK_STREAM, 0)
1068
+ # sockaddr = Socket.sockaddr_in(80, 'www.google.com')
1069
+ # begin # emulate blocking connect
1070
+ # socket.connect_nonblock(sockaddr)
1071
+ # rescue IO::WaitWritable
1072
+ # IO.select(nil, [socket]) # wait 3-way handshake completion
1073
+ # begin
1074
+ # socket.connect_nonblock(sockaddr) # check connection failure
1075
+ # rescue Errno::EISCONN
1076
+ # end
1077
+ # end
1078
+ # socket.write("GET / HTTP/1.0\r\n\r\n")
1079
+ # results = socket.read
1080
+ #
1081
+ # Refer to Socket#connect for the exceptions that may be thrown if the call to
1082
+ # *connect_nonblock* fails.
1083
+ #
1084
+ # Socket#connect_nonblock may raise any error corresponding to connect(2)
1085
+ # failure, including Errno::EINPROGRESS.
1086
+ #
1087
+ # If the exception is Errno::EINPROGRESS, it is extended by IO::WaitWritable. So
1088
+ # IO::WaitWritable can be used to rescue the exceptions for retrying
1089
+ # connect_nonblock.
1090
+ #
1091
+ # By specifying a keyword argument *exception* to `false`, you can indicate that
1092
+ # connect_nonblock should not raise an IO::WaitWritable exception, but return
1093
+ # the symbol `:wait_writable` instead.
1094
+ #
1095
+ # ### See
1096
+ # * Socket#connect
1097
+ #
1098
+ def connect_nonblock: (untyped addr, ?exception: untyped) -> (Integer | :wait_writable)
1099
+
1100
+ # <!--
1101
+ # rdoc-file=ext/socket/lib/socket.rb
1102
+ # - ipv6only!()
1103
+ # -->
1104
+ # enable the socket option IPV6_V6ONLY if IPV6_V6ONLY is available.
1105
+ #
1106
+ def ipv6only!: () -> void
1107
+
1108
+ # <!--
1109
+ # rdoc-file=ext/socket/socket.c
1110
+ # - socket.listen( int ) => 0
1111
+ # -->
1112
+ # Listens for connections, using the specified `int` as the backlog. A call to
1113
+ # *listen* only applies if the `socket` is of type SOCK_STREAM or
1114
+ # SOCK_SEQPACKET.
1115
+ #
1116
+ # ### Parameter
1117
+ # * `backlog` - the maximum length of the queue for pending connections.
1118
+ #
1119
+ # ### Example 1
1120
+ # require 'socket'
1121
+ # include Socket::Constants
1122
+ # socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
1123
+ # sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
1124
+ # socket.bind( sockaddr )
1125
+ # socket.listen( 5 )
1126
+ #
1127
+ # ### Example 2 (listening on an arbitrary port, unix-based systems only):
1128
+ # require 'socket'
1129
+ # include Socket::Constants
1130
+ # socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
1131
+ # socket.listen( 1 )
1132
+ #
1133
+ # ### Unix-based Exceptions
1134
+ # On unix based systems the above will work because a new `sockaddr` struct is
1135
+ # created on the address ADDR_ANY, for an arbitrary port number as handed off by
1136
+ # the kernel. It will not work on Windows, because Windows requires that the
1137
+ # `socket` is bound by calling *bind* before it can *listen*.
1138
+ #
1139
+ # If the *backlog* amount exceeds the implementation-dependent maximum queue
1140
+ # length, the implementation's maximum queue length will be used.
1141
+ #
1142
+ # On unix-based based systems the following system exceptions may be raised if
1143
+ # the call to *listen* fails:
1144
+ # * Errno::EBADF - the *socket* argument is not a valid file descriptor
1145
+ # * Errno::EDESTADDRREQ - the *socket* is not bound to a local address, and
1146
+ # the protocol does not support listening on an unbound socket
1147
+ # * Errno::EINVAL - the *socket* is already connected
1148
+ # * Errno::ENOTSOCK - the *socket* argument does not refer to a socket
1149
+ # * Errno::EOPNOTSUPP - the *socket* protocol does not support listen
1150
+ # * Errno::EACCES - the calling process does not have appropriate privileges
1151
+ # * Errno::EINVAL - the *socket* has been shut down
1152
+ # * Errno::ENOBUFS - insufficient resources are available in the system to
1153
+ # complete the call
1154
+ #
1155
+ # ### Windows Exceptions
1156
+ # On Windows systems the following system exceptions may be raised if the call
1157
+ # to *listen* fails:
1158
+ # * Errno::ENETDOWN - the network is down
1159
+ # * Errno::EADDRINUSE - the socket's local address is already in use. This
1160
+ # usually occurs during the execution of *bind* but could be delayed if the
1161
+ # call to *bind* was to a partially wildcard address (involving ADDR_ANY)
1162
+ # and if a specific address needs to be committed at the time of the call to
1163
+ # *listen*
1164
+ # * Errno::EINPROGRESS - a Windows Sockets 1.1 call is in progress or the
1165
+ # service provider is still processing a callback function
1166
+ # * Errno::EINVAL - the `socket` has not been bound with a call to *bind*.
1167
+ # * Errno::EISCONN - the `socket` is already connected
1168
+ # * Errno::EMFILE - no more socket descriptors are available
1169
+ # * Errno::ENOBUFS - no buffer space is available
1170
+ # * Errno::ENOTSOC - `socket` is not a socket
1171
+ # * Errno::EOPNOTSUPP - the referenced `socket` is not a type that supports
1172
+ # the *listen* method
1173
+ #
1174
+ # ### See
1175
+ # * listen manual pages on unix-based systems
1176
+ # * listen function in Microsoft's Winsock functions reference
1177
+ #
1178
+ def listen: (Integer backlog_len) -> void
1179
+
1180
+ # <!--
1181
+ # rdoc-file=ext/socket/socket.c
1182
+ # - socket.recvfrom(maxlen) => [mesg, sender_addrinfo]
1183
+ # - socket.recvfrom(maxlen, flags) => [mesg, sender_addrinfo]
1184
+ # -->
1185
+ # Receives up to *maxlen* bytes from `socket`. *flags* is zero or more of the
1186
+ # `MSG_` options. The first element of the results, *mesg*, is the data
1187
+ # received. The second element, *sender_addrinfo*, contains protocol-specific
1188
+ # address information of the sender.
1189
+ #
1190
+ # ### Parameters
1191
+ # * `maxlen` - the maximum number of bytes to receive from the socket
1192
+ # * `flags` - zero or more of the `MSG_` options
1193
+ #
1194
+ # ### Example
1195
+ # # In one file, start this first
1196
+ # require 'socket'
1197
+ # include Socket::Constants
1198
+ # socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
1199
+ # sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
1200
+ # socket.bind( sockaddr )
1201
+ # socket.listen( 5 )
1202
+ # client, client_addrinfo = socket.accept
1203
+ # data = client.recvfrom( 20 )[0].chomp
1204
+ # puts "I only received 20 bytes '#{data}'"
1205
+ # sleep 1
1206
+ # socket.close
1207
+ #
1208
+ # # In another file, start this second
1209
+ # require 'socket'
1210
+ # include Socket::Constants
1211
+ # socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
1212
+ # sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
1213
+ # socket.connect( sockaddr )
1214
+ # socket.puts "Watch this get cut short!"
1215
+ # socket.close
1216
+ #
1217
+ # ### Unix-based Exceptions
1218
+ # On unix-based based systems the following system exceptions may be raised if
1219
+ # the call to *recvfrom* fails:
1220
+ # * Errno::EAGAIN - the `socket` file descriptor is marked as O_NONBLOCK and
1221
+ # no data is waiting to be received; or MSG_OOB is set and no out-of-band
1222
+ # data is available and either the `socket` file descriptor is marked as
1223
+ # O_NONBLOCK or the `socket` does not support blocking to wait for
1224
+ # out-of-band-data
1225
+ # * Errno::EWOULDBLOCK - see Errno::EAGAIN
1226
+ # * Errno::EBADF - the `socket` is not a valid file descriptor
1227
+ # * Errno::ECONNRESET - a connection was forcibly closed by a peer
1228
+ # * Errno::EFAULT - the socket's internal buffer, address or address length
1229
+ # cannot be accessed or written
1230
+ # * Errno::EINTR - a signal interrupted *recvfrom* before any data was
1231
+ # available
1232
+ # * Errno::EINVAL - the MSG_OOB flag is set and no out-of-band data is
1233
+ # available
1234
+ # * Errno::EIO - an i/o error occurred while reading from or writing to the
1235
+ # filesystem
1236
+ # * Errno::ENOBUFS - insufficient resources were available in the system to
1237
+ # perform the operation
1238
+ # * Errno::ENOMEM - insufficient memory was available to fulfill the request
1239
+ # * Errno::ENOSR - there were insufficient STREAMS resources available to
1240
+ # complete the operation
1241
+ # * Errno::ENOTCONN - a receive is attempted on a connection-mode socket that
1242
+ # is not connected
1243
+ # * Errno::ENOTSOCK - the `socket` does not refer to a socket
1244
+ # * Errno::EOPNOTSUPP - the specified flags are not supported for this socket
1245
+ # type
1246
+ # * Errno::ETIMEDOUT - the connection timed out during connection
1247
+ # establishment or due to a transmission timeout on an active connection
1248
+ #
1249
+ # ### Windows Exceptions
1250
+ # On Windows systems the following system exceptions may be raised if the call
1251
+ # to *recvfrom* fails:
1252
+ # * Errno::ENETDOWN - the network is down
1253
+ # * Errno::EFAULT - the internal buffer and from parameters on `socket` are
1254
+ # not part of the user address space, or the internal fromlen parameter is
1255
+ # too small to accommodate the peer address
1256
+ # * Errno::EINTR - the (blocking) call was cancelled by an internal call to
1257
+ # the WinSock function WSACancelBlockingCall
1258
+ # * Errno::EINPROGRESS - a blocking Windows Sockets 1.1 call is in progress or
1259
+ # the service provider is still processing a callback function
1260
+ # * Errno::EINVAL - `socket` has not been bound with a call to *bind*, or an
1261
+ # unknown flag was specified, or MSG_OOB was specified for a socket with
1262
+ # SO_OOBINLINE enabled, or (for byte stream-style sockets only) the internal
1263
+ # len parameter on `socket` was zero or negative
1264
+ # * Errno::EISCONN - `socket` is already connected. The call to *recvfrom* is
1265
+ # not permitted with a connected socket on a socket that is connection
1266
+ # oriented or connectionless.
1267
+ # * Errno::ENETRESET - the connection has been broken due to the keep-alive
1268
+ # activity detecting a failure while the operation was in progress.
1269
+ # * Errno::EOPNOTSUPP - MSG_OOB was specified, but `socket` is not
1270
+ # stream-style such as type SOCK_STREAM. OOB data is not supported in the
1271
+ # communication domain associated with `socket`, or `socket` is
1272
+ # unidirectional and supports only send operations
1273
+ # * Errno::ESHUTDOWN - `socket` has been shutdown. It is not possible to call
1274
+ # *recvfrom* on a socket after *shutdown* has been invoked.
1275
+ # * Errno::EWOULDBLOCK - `socket` is marked as nonblocking and a call to
1276
+ # *recvfrom* would block.
1277
+ # * Errno::EMSGSIZE - the message was too large to fit into the specified
1278
+ # buffer and was truncated.
1279
+ # * Errno::ETIMEDOUT - the connection has been dropped, because of a network
1280
+ # failure or because the system on the other end went down without notice
1281
+ # * Errno::ECONNRESET - the virtual circuit was reset by the remote side
1282
+ # executing a hard or abortive close. The application should close the
1283
+ # socket; it is no longer usable. On a UDP-datagram socket this error
1284
+ # indicates a previous send operation resulted in an ICMP Port Unreachable
1285
+ # message.
1286
+ #
1287
+ def recvfrom: (Integer maxlen, ?Integer flags) -> [ String, Addrinfo ]
1288
+
1289
+ # <!--
1290
+ # rdoc-file=ext/socket/lib/socket.rb
1291
+ # - socket.recvfrom_nonblock(maxlen[, flags[, outbuf[, opts]]]) => [mesg, sender_addrinfo]
1292
+ # -->
1293
+ # Receives up to *maxlen* bytes from `socket` using recvfrom(2) after O_NONBLOCK
1294
+ # is set for the underlying file descriptor. *flags* is zero or more of the
1295
+ # `MSG_` options. The first element of the results, *mesg*, is the data
1296
+ # received. The second element, *sender_addrinfo*, contains protocol-specific
1297
+ # address information of the sender.
1298
+ #
1299
+ # When recvfrom(2) returns 0, Socket#recv_nonblock returns nil. In most cases it
1300
+ # means the connection was closed, but for UDP connections it may mean an empty
1301
+ # packet was received, as the underlying API makes it impossible to distinguish
1302
+ # these two cases.
1303
+ #
1304
+ # ### Parameters
1305
+ # * `maxlen` - the maximum number of bytes to receive from the socket
1306
+ # * `flags` - zero or more of the `MSG_` options
1307
+ # * `outbuf` - destination String buffer
1308
+ # * `opts` - keyword hash, supporting `exception: false`
1309
+ #
1310
+ # ### Example
1311
+ # # In one file, start this first
1312
+ # require 'socket'
1313
+ # include Socket::Constants
1314
+ # socket = Socket.new(AF_INET, SOCK_STREAM, 0)
1315
+ # sockaddr = Socket.sockaddr_in(2200, 'localhost')
1316
+ # socket.bind(sockaddr)
1317
+ # socket.listen(5)
1318
+ # client, client_addrinfo = socket.accept
1319
+ # begin # emulate blocking recvfrom
1320
+ # pair = client.recvfrom_nonblock(20)
1321
+ # rescue IO::WaitReadable
1322
+ # IO.select([client])
1323
+ # retry
1324
+ # end
1325
+ # data = pair[0].chomp
1326
+ # puts "I only received 20 bytes '#{data}'"
1327
+ # sleep 1
1328
+ # socket.close
1329
+ #
1330
+ # # In another file, start this second
1331
+ # require 'socket'
1332
+ # include Socket::Constants
1333
+ # socket = Socket.new(AF_INET, SOCK_STREAM, 0)
1334
+ # sockaddr = Socket.sockaddr_in(2200, 'localhost')
1335
+ # socket.connect(sockaddr)
1336
+ # socket.puts "Watch this get cut short!"
1337
+ # socket.close
1338
+ #
1339
+ # Refer to Socket#recvfrom for the exceptions that may be thrown if the call to
1340
+ # *recvfrom_nonblock* fails.
1341
+ #
1342
+ # Socket#recvfrom_nonblock may raise any error corresponding to recvfrom(2)
1343
+ # failure, including Errno::EWOULDBLOCK.
1344
+ #
1345
+ # If the exception is Errno::EWOULDBLOCK or Errno::EAGAIN, it is extended by
1346
+ # IO::WaitReadable. So IO::WaitReadable can be used to rescue the exceptions for
1347
+ # retrying recvfrom_nonblock.
1348
+ #
1349
+ # By specifying a keyword argument *exception* to `false`, you can indicate that
1350
+ # recvfrom_nonblock should not raise an IO::WaitReadable exception, but return
1351
+ # the symbol `:wait_readable` instead.
1352
+ #
1353
+ # ### See
1354
+ # * Socket#recvfrom
1355
+ #
1356
+ def recvfrom_nonblock: (Integer maxlen, ?Integer flags, ?untyped outbuf, ?exception: boolish) -> ([ String, Addrinfo ] | :wait_readable)
1357
+
1358
+ # <!--
1359
+ # rdoc-file=ext/socket/socket.c
1360
+ # - socket.sysaccept => [client_socket_fd, client_addrinfo]
1361
+ # -->
1362
+ # Accepts an incoming connection returning an array containing the (integer)
1363
+ # file descriptor for the incoming connection, *client_socket_fd*, and an
1364
+ # Addrinfo, *client_addrinfo*.
1365
+ #
1366
+ # ### Example
1367
+ # # In one script, start this first
1368
+ # require 'socket'
1369
+ # include Socket::Constants
1370
+ # socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
1371
+ # sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
1372
+ # socket.bind( sockaddr )
1373
+ # socket.listen( 5 )
1374
+ # client_fd, client_addrinfo = socket.sysaccept
1375
+ # client_socket = Socket.for_fd( client_fd )
1376
+ # puts "The client said, '#{client_socket.readline.chomp}'"
1377
+ # client_socket.puts "Hello from script one!"
1378
+ # socket.close
1379
+ #
1380
+ # # In another script, start this second
1381
+ # require 'socket'
1382
+ # include Socket::Constants
1383
+ # socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
1384
+ # sockaddr = Socket.pack_sockaddr_in( 2200, 'localhost' )
1385
+ # socket.connect( sockaddr )
1386
+ # socket.puts "Hello from script 2."
1387
+ # puts "The server said, '#{socket.readline.chomp}'"
1388
+ # socket.close
1389
+ #
1390
+ # Refer to Socket#accept for the exceptions that may be thrown if the call to
1391
+ # *sysaccept* fails.
1392
+ #
1393
+ # ### See
1394
+ # * Socket#accept
1395
+ #
1396
+ def sysaccept: () -> [ Integer, Addrinfo ]
1397
+
1398
+ private
1399
+
1400
+ def __accept_nonblock: (untyped) -> untyped
1401
+
1402
+ def __connect_nonblock: (untyped, untyped) -> untyped
1403
+
1404
+ def __recvfrom_nonblock: (untyped, untyped, untyped, untyped) -> untyped
1405
+
1406
+ # <!--
1407
+ # rdoc-file=ext/socket/socket.c
1408
+ # - Socket.new(domain, socktype [, protocol]) => socket
1409
+ # -->
1410
+ # Creates a new socket object.
1411
+ #
1412
+ # *domain* should be a communications domain such as: :INET, :INET6, :UNIX, etc.
1413
+ #
1414
+ # *socktype* should be a socket type such as: :STREAM, :DGRAM, :RAW, etc.
1415
+ #
1416
+ # *protocol* is optional and should be a protocol defined in the domain. If
1417
+ # protocol is not given, 0 is used internally.
1418
+ #
1419
+ # Socket.new(:INET, :STREAM) # TCP socket
1420
+ # Socket.new(:INET, :DGRAM) # UDP socket
1421
+ # Socket.new(:UNIX, :STREAM) # UNIX stream socket
1422
+ # Socket.new(:UNIX, :DGRAM) # UNIX datagram socket
1423
+ #
1424
+ def initialize: (Symbol | Integer domain, Symbol | Integer socktype, ?Integer protocol) -> untyped
1425
+ end
1426
+
1427
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1428
+ # Interface to kernel crypto API
1429
+ #
1430
+ Socket::AF_ALG: Integer
1431
+
1432
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1433
+ # AppleTalk protocol
1434
+ #
1435
+ Socket::AF_APPLETALK: Integer
1436
+
1437
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1438
+ # Asynchronous Transfer Mode
1439
+ #
1440
+ Socket::AF_ATM: Integer
1441
+
1442
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1443
+ # AX.25 protocol
1444
+ #
1445
+ Socket::AF_AX25: Integer
1446
+
1447
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1448
+ # Bluetooth low-level socket protocol
1449
+ #
1450
+ Socket::AF_BLUETOOTH: Integer
1451
+
1452
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1453
+ # Controller Area Network automotive bus protocol
1454
+ #
1455
+ Socket::AF_CAN: Integer
1456
+
1457
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1458
+ # CCITT (now ITU-T) protocols
1459
+ #
1460
+ Socket::AF_CCITT: Integer
1461
+
1462
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1463
+ # MIT CHAOS protocols
1464
+ #
1465
+ Socket::AF_CHAOS: Integer
1466
+
1467
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1468
+ # Computer Network Technology
1469
+ #
1470
+ Socket::AF_CNT: Integer
1471
+
1472
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1473
+ # Connection-oriented IP
1474
+ #
1475
+ Socket::AF_COIP: Integer
1476
+
1477
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1478
+ # Datakit protocol
1479
+ #
1480
+ Socket::AF_DATAKIT: Integer
1481
+
1482
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1483
+ # DECnet protocol
1484
+ #
1485
+ Socket::AF_DEC: Integer
1486
+
1487
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1488
+ # DECnet protocol
1489
+ #
1490
+ Socket::AF_DECnet: Integer
1491
+
1492
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1493
+ # DEC Direct Data Link Interface protocol
1494
+ #
1495
+ Socket::AF_DLI: Integer
1496
+
1497
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1498
+ # CCITT (ITU-T) E.164 recommendation
1499
+ #
1500
+ Socket::AF_E164: Integer
1501
+
1502
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1503
+ # European Computer Manufacturers protocols
1504
+ #
1505
+ Socket::AF_ECMA: Integer
1506
+
1507
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1508
+ # NSC Hyperchannel protocol
1509
+ #
1510
+ Socket::AF_HYLINK: Integer
1511
+
1512
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1513
+ # InfiniBand native addressing
1514
+ #
1515
+ Socket::AF_IB: Integer
1516
+
1517
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1518
+ # ARPANET IMP protocol
1519
+ #
1520
+ Socket::AF_IMPLINK: Integer
1521
+
1522
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1523
+ # IPv4 protocol
1524
+ #
1525
+ Socket::AF_INET: Integer
1526
+
1527
+ # <!-- rdoc-file=lib/ipaddr.rb -->
1528
+ # IPv6 protocol family
1529
+ #
1530
+ Socket::AF_INET6: Integer
1531
+
1532
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1533
+ # IPX protocol
1534
+ #
1535
+ Socket::AF_IPX: Integer
1536
+
1537
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1538
+ # Integrated Services Digital Network
1539
+ #
1540
+ Socket::AF_ISDN: Integer
1541
+
1542
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1543
+ # ISO Open Systems Interconnection protocols
1544
+ #
1545
+ Socket::AF_ISO: Integer
1546
+
1547
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1548
+ # KCM (kernel connection multiplexor) interface
1549
+ #
1550
+ Socket::AF_KCM: Integer
1551
+
1552
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1553
+ # Key management protocol, originally developed for usage with IPsec
1554
+ #
1555
+ Socket::AF_KEY: Integer
1556
+
1557
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1558
+ # Local Area Transport protocol
1559
+ #
1560
+ Socket::AF_LAT: Integer
1561
+
1562
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1563
+ # Link layer interface
1564
+ #
1565
+ Socket::AF_LINK: Integer
1566
+
1567
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1568
+ # Logical link control (IEEE 802.2 LLC) protocol
1569
+ #
1570
+ Socket::AF_LLC: Integer
1571
+
1572
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1573
+ # Host-internal protocols
1574
+ #
1575
+ Socket::AF_LOCAL: Integer
1576
+
1577
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1578
+ # Maximum address family for this platform
1579
+ #
1580
+ Socket::AF_MAX: Integer
1581
+
1582
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1583
+ # Multiprotocol Label Switching
1584
+ #
1585
+ Socket::AF_MPLS: Integer
1586
+
1587
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1588
+ # Native ATM access
1589
+ #
1590
+ Socket::AF_NATM: Integer
1591
+
1592
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1593
+ # Network driver raw access
1594
+ #
1595
+ Socket::AF_NDRV: Integer
1596
+
1597
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1598
+ # NetBIOS
1599
+ #
1600
+ Socket::AF_NETBIOS: Integer
1601
+
1602
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1603
+ # Netgraph sockets
1604
+ #
1605
+ Socket::AF_NETGRAPH: Integer
1606
+
1607
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1608
+ # Kernel user interface device
1609
+ #
1610
+ Socket::AF_NETLINK: Integer
1611
+
1612
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1613
+ # XEROX NS protocols
1614
+ #
1615
+ Socket::AF_NS: Integer
1616
+
1617
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1618
+ # ISO Open Systems Interconnection protocols
1619
+ #
1620
+ Socket::AF_OSI: Integer
1621
+
1622
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1623
+ # Direct link-layer access
1624
+ #
1625
+ Socket::AF_PACKET: Integer
1626
+
1627
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1628
+ # Point-to-Point Protocol
1629
+ #
1630
+ Socket::AF_PPP: Integer
1631
+
1632
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1633
+ # Generic PPP transport layer, for setting up L2 tunnels (L2TP and PPPoE)
1634
+ #
1635
+ Socket::AF_PPPOX: Integer
1636
+
1637
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1638
+ # PARC Universal Packet protocol
1639
+ #
1640
+ Socket::AF_PUP: Integer
1641
+
1642
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1643
+ # Reliable Datagram Sockets (RDS) protocol
1644
+ #
1645
+ Socket::AF_RDS: Integer
1646
+
1647
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1648
+ # Internal routing protocol
1649
+ #
1650
+ Socket::AF_ROUTE: Integer
1651
+
1652
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1653
+ # Simple Internet Protocol
1654
+ #
1655
+ Socket::AF_SIP: Integer
1656
+
1657
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1658
+ # IBM SNA protocol
1659
+ #
1660
+ Socket::AF_SNA: Integer
1661
+ Socket::AF_SYSTEM: Integer
1662
+
1663
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1664
+ # TIPC, "cluster domain sockets" protocol
1665
+ #
1666
+ Socket::AF_TIPC: Integer
1667
+
1668
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1669
+ # UNIX sockets
1670
+ #
1671
+ Socket::AF_UNIX: Integer
1672
+
1673
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1674
+ # Unspecified protocol, any supported address family
1675
+ #
1676
+ Socket::AF_UNSPEC: Integer
1677
+
1678
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1679
+ # VSOCK (originally "VMWare VSockets") protocol for hypervisor-guest
1680
+ # communication
1681
+ #
1682
+ Socket::AF_VSOCK: Integer
1683
+
1684
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1685
+ # XDP (express data path) interface
1686
+ #
1687
+ Socket::AF_XDP: Integer
1688
+
1689
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1690
+ # Accept only if any address is assigned
1691
+ #
1692
+ Socket::AI_ADDRCONFIG: Integer
1693
+
1694
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1695
+ # Allow all addresses
1696
+ #
1697
+ Socket::AI_ALL: Integer
1698
+
1699
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1700
+ # Fill in the canonical name
1701
+ #
1702
+ Socket::AI_CANONNAME: Integer
1703
+
1704
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1705
+ # Default flags for getaddrinfo
1706
+ #
1707
+ Socket::AI_DEFAULT: Integer
1708
+
1709
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1710
+ # Valid flag mask for getaddrinfo (not for application use)
1711
+ #
1712
+ Socket::AI_MASK: Integer
1713
+
1714
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1715
+ # Prevent host name resolution
1716
+ #
1717
+ Socket::AI_NUMERICHOST: Integer
1718
+
1719
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1720
+ # Prevent service name resolution
1721
+ #
1722
+ Socket::AI_NUMERICSERV: Integer
1723
+
1724
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1725
+ # Get address to use with bind()
1726
+ #
1727
+ Socket::AI_PASSIVE: Integer
1728
+
1729
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1730
+ # Accept IPv4-mapped IPv6 addresses
1731
+ #
1732
+ Socket::AI_V4MAPPED: Integer
1733
+
1734
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1735
+ # Accept IPv4 mapped addresses if the kernel supports it
1736
+ #
1737
+ Socket::AI_V4MAPPED_CFG: Integer
1738
+
1739
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1740
+ # Address family for hostname not supported
1741
+ #
1742
+ Socket::EAI_ADDRFAMILY: Integer
1743
+
1744
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1745
+ # Temporary failure in name resolution
1746
+ #
1747
+ Socket::EAI_AGAIN: Integer
1748
+
1749
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1750
+ # Invalid flags
1751
+ #
1752
+ Socket::EAI_BADFLAGS: Integer
1753
+
1754
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1755
+ # Invalid value for hints
1756
+ #
1757
+ Socket::EAI_BADHINTS: Integer
1758
+
1759
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1760
+ # Non-recoverable failure in name resolution
1761
+ #
1762
+ Socket::EAI_FAIL: Integer
1763
+
1764
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1765
+ # Address family not supported
1766
+ #
1767
+ Socket::EAI_FAMILY: Integer
1768
+
1769
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1770
+ # Maximum error code from getaddrinfo
1771
+ #
1772
+ Socket::EAI_MAX: Integer
1773
+
1774
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1775
+ # Memory allocation failure
1776
+ #
1777
+ Socket::EAI_MEMORY: Integer
1778
+
1779
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1780
+ # No address associated with hostname
1781
+ #
1782
+ Socket::EAI_NODATA: Integer
1783
+
1784
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1785
+ # Hostname nor servname, or not known
1786
+ #
1787
+ Socket::EAI_NONAME: Integer
1788
+
1789
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1790
+ # Argument buffer overflow
1791
+ #
1792
+ Socket::EAI_OVERFLOW: Integer
1793
+
1794
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1795
+ # Resolved protocol is unknown
1796
+ #
1797
+ Socket::EAI_PROTOCOL: Integer
1798
+
1799
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1800
+ # Servname not supported for socket type
1801
+ #
1802
+ Socket::EAI_SERVICE: Integer
1803
+
1804
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1805
+ # Socket type not supported
1806
+ #
1807
+ Socket::EAI_SOCKTYPE: Integer
1808
+
1809
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1810
+ # System error returned in errno
1811
+ #
1812
+ Socket::EAI_SYSTEM: Integer
1813
+
1814
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1815
+ # 802.1Q VLAN device
1816
+ #
1817
+ Socket::IFF_802_1Q_VLAN: Integer
1818
+
1819
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1820
+ # receive all multicast packets
1821
+ #
1822
+ Socket::IFF_ALLMULTI: Integer
1823
+
1824
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1825
+ # use alternate physical connection
1826
+ #
1827
+ Socket::IFF_ALTPHYS: Integer
1828
+
1829
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1830
+ # auto media select active
1831
+ #
1832
+ Socket::IFF_AUTOMEDIA: Integer
1833
+
1834
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1835
+ # bonding master or slave
1836
+ #
1837
+ Socket::IFF_BONDING: Integer
1838
+
1839
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1840
+ # device used as bridge port
1841
+ #
1842
+ Socket::IFF_BRIDGE_PORT: Integer
1843
+
1844
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1845
+ # broadcast address valid
1846
+ #
1847
+ Socket::IFF_BROADCAST: Integer
1848
+
1849
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1850
+ # flags not changeable
1851
+ #
1852
+ Socket::IFF_CANTCHANGE: Integer
1853
+
1854
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1855
+ # unconfigurable using ioctl(2)
1856
+ #
1857
+ Socket::IFF_CANTCONFIG: Integer
1858
+
1859
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1860
+ # turn on debugging
1861
+ #
1862
+ Socket::IFF_DEBUG: Integer
1863
+
1864
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1865
+ # disable netpoll at run-time
1866
+ #
1867
+ Socket::IFF_DISABLE_NETPOLL: Integer
1868
+
1869
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1870
+ # disallow bridging this ether dev
1871
+ #
1872
+ Socket::IFF_DONT_BRIDGE: Integer
1873
+
1874
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1875
+ # driver signals dormant
1876
+ #
1877
+ Socket::IFF_DORMANT: Integer
1878
+
1879
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1880
+ # tx hardware queue is full
1881
+ #
1882
+ Socket::IFF_DRV_OACTIVE: Integer
1883
+
1884
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1885
+ # resources allocated
1886
+ #
1887
+ Socket::IFF_DRV_RUNNING: Integer
1888
+
1889
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1890
+ # interface is winding down
1891
+ #
1892
+ Socket::IFF_DYING: Integer
1893
+
1894
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1895
+ # dialup device with changing addresses
1896
+ #
1897
+ Socket::IFF_DYNAMIC: Integer
1898
+
1899
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1900
+ # ethernet bridging device
1901
+ #
1902
+ Socket::IFF_EBRIDGE: Integer
1903
+
1904
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1905
+ # echo sent packets
1906
+ #
1907
+ Socket::IFF_ECHO: Integer
1908
+
1909
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1910
+ # ISATAP interface (RFC4214)
1911
+ #
1912
+ Socket::IFF_ISATAP: Integer
1913
+
1914
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1915
+ # per link layer defined bit 0
1916
+ #
1917
+ Socket::IFF_LINK0: Integer
1918
+
1919
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1920
+ # per link layer defined bit 1
1921
+ #
1922
+ Socket::IFF_LINK1: Integer
1923
+
1924
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1925
+ # per link layer defined bit 2
1926
+ #
1927
+ Socket::IFF_LINK2: Integer
1928
+
1929
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1930
+ # hardware address change when it's running
1931
+ #
1932
+ Socket::IFF_LIVE_ADDR_CHANGE: Integer
1933
+
1934
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1935
+ # loopback net
1936
+ #
1937
+ Socket::IFF_LOOPBACK: Integer
1938
+
1939
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1940
+ # driver signals L1 up
1941
+ #
1942
+ Socket::IFF_LOWER_UP: Integer
1943
+
1944
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1945
+ # device used as macvlan port
1946
+ #
1947
+ Socket::IFF_MACVLAN_PORT: Integer
1948
+
1949
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1950
+ # master of a load balancer
1951
+ #
1952
+ Socket::IFF_MASTER: Integer
1953
+
1954
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1955
+ # bonding master, 802.3ad.
1956
+ #
1957
+ Socket::IFF_MASTER_8023AD: Integer
1958
+
1959
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1960
+ # bonding master, balance-alb.
1961
+ #
1962
+ Socket::IFF_MASTER_ALB: Integer
1963
+
1964
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1965
+ # bonding master, ARP mon in use
1966
+ #
1967
+ Socket::IFF_MASTER_ARPMON: Integer
1968
+
1969
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1970
+ # user-requested monitor mode
1971
+ #
1972
+ Socket::IFF_MONITOR: Integer
1973
+
1974
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1975
+ # supports multicast
1976
+ #
1977
+ Socket::IFF_MULTICAST: Integer
1978
+
1979
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1980
+ # no address resolution protocol
1981
+ #
1982
+ Socket::IFF_NOARP: Integer
1983
+
1984
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1985
+ # avoid use of trailers
1986
+ #
1987
+ Socket::IFF_NOTRAILERS: Integer
1988
+
1989
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1990
+ # transmission in progress
1991
+ #
1992
+ Socket::IFF_OACTIVE: Integer
1993
+
1994
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
1995
+ # device used as Open vSwitch datapath port
1996
+ #
1997
+ Socket::IFF_OVS_DATAPATH: Integer
1998
+
1999
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2000
+ # point-to-point link
2001
+ #
2002
+ Socket::IFF_POINTOPOINT: Integer
2003
+
2004
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2005
+ # can set media type
2006
+ #
2007
+ Socket::IFF_PORTSEL: Integer
2008
+
2009
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2010
+ # user-requested promisc mode
2011
+ #
2012
+ Socket::IFF_PPROMISC: Integer
2013
+
2014
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2015
+ # receive all packets
2016
+ #
2017
+ Socket::IFF_PROMISC: Integer
2018
+
2019
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2020
+ # interface is being renamed
2021
+ #
2022
+ Socket::IFF_RENAMING: Integer
2023
+
2024
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2025
+ # routing entry installed
2026
+ #
2027
+ Socket::IFF_ROUTE: Integer
2028
+
2029
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2030
+ # resources allocated
2031
+ #
2032
+ Socket::IFF_RUNNING: Integer
2033
+
2034
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2035
+ # can't hear own transmissions
2036
+ #
2037
+ Socket::IFF_SIMPLEX: Integer
2038
+
2039
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2040
+ # slave of a load balancer
2041
+ #
2042
+ Socket::IFF_SLAVE: Integer
2043
+
2044
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2045
+ # bonding slave not the curr. active
2046
+ #
2047
+ Socket::IFF_SLAVE_INACTIVE: Integer
2048
+
2049
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2050
+ # need ARPs for validation
2051
+ #
2052
+ Socket::IFF_SLAVE_NEEDARP: Integer
2053
+
2054
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2055
+ # interface manages own routes
2056
+ #
2057
+ Socket::IFF_SMART: Integer
2058
+
2059
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2060
+ # static ARP
2061
+ #
2062
+ Socket::IFF_STATICARP: Integer
2063
+
2064
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2065
+ # sending custom FCS
2066
+ #
2067
+ Socket::IFF_SUPP_NOFCS: Integer
2068
+
2069
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2070
+ # used as team port
2071
+ #
2072
+ Socket::IFF_TEAM_PORT: Integer
2073
+
2074
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2075
+ # sharing skbs on transmit
2076
+ #
2077
+ Socket::IFF_TX_SKB_SHARING: Integer
2078
+
2079
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2080
+ # unicast filtering
2081
+ #
2082
+ Socket::IFF_UNICAST_FLT: Integer
2083
+
2084
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2085
+ # interface is up
2086
+ #
2087
+ Socket::IFF_UP: Integer
2088
+
2089
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2090
+ # volatile flags
2091
+ #
2092
+ Socket::IFF_VOLATILE: Integer
2093
+
2094
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2095
+ # WAN HDLC device
2096
+ #
2097
+ Socket::IFF_WAN_HDLC: Integer
2098
+
2099
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2100
+ # dev_hard_start_xmit() is allowed to release skb->dst
2101
+ #
2102
+ Socket::IFF_XMIT_DST_RELEASE: Integer
2103
+
2104
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2105
+ # Maximum interface name size
2106
+ #
2107
+ Socket::IFNAMSIZ: Integer
2108
+
2109
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2110
+ # Maximum interface name size
2111
+ #
2112
+ Socket::IF_NAMESIZE: Integer
2113
+
2114
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2115
+ # Multicast group for all systems on this subset
2116
+ #
2117
+ Socket::INADDR_ALLHOSTS_GROUP: Integer
2118
+
2119
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2120
+ # A socket bound to INADDR_ANY receives packets from all interfaces and sends
2121
+ # from the default IP address
2122
+ #
2123
+ Socket::INADDR_ANY: Integer
2124
+
2125
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2126
+ # The network broadcast address
2127
+ #
2128
+ Socket::INADDR_BROADCAST: Integer
2129
+
2130
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2131
+ # The loopback address
2132
+ #
2133
+ Socket::INADDR_LOOPBACK: Integer
2134
+
2135
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2136
+ # The last local network multicast group
2137
+ #
2138
+ Socket::INADDR_MAX_LOCAL_GROUP: Integer
2139
+
2140
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2141
+ # A bitmask for matching no valid IP address
2142
+ #
2143
+ Socket::INADDR_NONE: Integer
2144
+
2145
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2146
+ # The reserved multicast group
2147
+ #
2148
+ Socket::INADDR_UNSPEC_GROUP: Integer
2149
+
2150
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2151
+ # Maximum length of an IPv6 address string
2152
+ #
2153
+ Socket::INET6_ADDRSTRLEN: Integer
2154
+
2155
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2156
+ # Maximum length of an IPv4 address string
2157
+ #
2158
+ Socket::INET_ADDRSTRLEN: Integer
2159
+
2160
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2161
+ # Default minimum address for bind or connect
2162
+ #
2163
+ Socket::IPPORT_RESERVED: Integer
2164
+
2165
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2166
+ # Default maximum address for bind or connect
2167
+ #
2168
+ Socket::IPPORT_USERRESERVED: Integer
2169
+
2170
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2171
+ # IP6 auth header
2172
+ #
2173
+ Socket::IPPROTO_AH: Integer
2174
+ Socket::IPPROTO_BIP: Integer
2175
+
2176
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2177
+ # IP6 destination option
2178
+ #
2179
+ Socket::IPPROTO_DSTOPTS: Integer
2180
+
2181
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2182
+ # Exterior Gateway Protocol
2183
+ #
2184
+ Socket::IPPROTO_EGP: Integer
2185
+
2186
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2187
+ # ISO cnlp
2188
+ #
2189
+ Socket::IPPROTO_EON: Integer
2190
+
2191
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2192
+ # IP6 Encapsulated Security Payload
2193
+ #
2194
+ Socket::IPPROTO_ESP: Integer
2195
+
2196
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2197
+ # IP6 fragmentation header
2198
+ #
2199
+ Socket::IPPROTO_FRAGMENT: Integer
2200
+
2201
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2202
+ # Gateway to Gateway Protocol
2203
+ #
2204
+ Socket::IPPROTO_GGP: Integer
2205
+
2206
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2207
+ # "hello" routing protocol
2208
+ #
2209
+ Socket::IPPROTO_HELLO: Integer
2210
+
2211
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2212
+ # IP6 hop-by-hop options
2213
+ #
2214
+ Socket::IPPROTO_HOPOPTS: Integer
2215
+
2216
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2217
+ # Control message protocol
2218
+ #
2219
+ Socket::IPPROTO_ICMP: Integer
2220
+
2221
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2222
+ # ICMP6
2223
+ #
2224
+ Socket::IPPROTO_ICMPV6: Integer
2225
+
2226
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2227
+ # XNS IDP
2228
+ #
2229
+ Socket::IPPROTO_IDP: Integer
2230
+
2231
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2232
+ # Group Management Protocol
2233
+ #
2234
+ Socket::IPPROTO_IGMP: Integer
2235
+
2236
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2237
+ # Dummy protocol for IP
2238
+ #
2239
+ Socket::IPPROTO_IP: Integer
2240
+
2241
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2242
+ # IP6 header
2243
+ #
2244
+ Socket::IPPROTO_IPV6: Integer
2245
+
2246
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2247
+ # Maximum IPPROTO constant
2248
+ #
2249
+ Socket::IPPROTO_MAX: Integer
2250
+
2251
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2252
+ # Sun net disk protocol
2253
+ #
2254
+ Socket::IPPROTO_ND: Integer
2255
+
2256
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2257
+ # IP6 no next header
2258
+ #
2259
+ Socket::IPPROTO_NONE: Integer
2260
+
2261
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2262
+ # PARC Universal Packet protocol
2263
+ #
2264
+ Socket::IPPROTO_PUP: Integer
2265
+
2266
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2267
+ # Raw IP packet
2268
+ #
2269
+ Socket::IPPROTO_RAW: Integer
2270
+
2271
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2272
+ # IP6 routing header
2273
+ #
2274
+ Socket::IPPROTO_ROUTING: Integer
2275
+
2276
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2277
+ # TCP
2278
+ #
2279
+ Socket::IPPROTO_TCP: Integer
2280
+
2281
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2282
+ # ISO transport protocol class 4
2283
+ #
2284
+ Socket::IPPROTO_TP: Integer
2285
+
2286
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2287
+ # UDP
2288
+ #
2289
+ Socket::IPPROTO_UDP: Integer
2290
+
2291
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2292
+ # Xpress Transport Protocol
2293
+ #
2294
+ Socket::IPPROTO_XTP: Integer
2295
+
2296
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2297
+ # Checksum offset for raw sockets
2298
+ #
2299
+ Socket::IPV6_CHECKSUM: Integer
2300
+
2301
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2302
+ # Don't fragment packets
2303
+ #
2304
+ Socket::IPV6_DONTFRAG: Integer
2305
+
2306
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2307
+ # Destination option
2308
+ #
2309
+ Socket::IPV6_DSTOPTS: Integer
2310
+
2311
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2312
+ # Hop limit
2313
+ #
2314
+ Socket::IPV6_HOPLIMIT: Integer
2315
+
2316
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2317
+ # Hop-by-hop option
2318
+ #
2319
+ Socket::IPV6_HOPOPTS: Integer
2320
+
2321
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2322
+ # Join a group membership
2323
+ #
2324
+ Socket::IPV6_JOIN_GROUP: Integer
2325
+
2326
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2327
+ # Leave a group membership
2328
+ #
2329
+ Socket::IPV6_LEAVE_GROUP: Integer
2330
+
2331
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2332
+ # IP6 multicast hops
2333
+ #
2334
+ Socket::IPV6_MULTICAST_HOPS: Integer
2335
+
2336
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2337
+ # IP6 multicast interface
2338
+ #
2339
+ Socket::IPV6_MULTICAST_IF: Integer
2340
+
2341
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2342
+ # IP6 multicast loopback
2343
+ #
2344
+ Socket::IPV6_MULTICAST_LOOP: Integer
2345
+
2346
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2347
+ # Next hop address
2348
+ #
2349
+ Socket::IPV6_NEXTHOP: Integer
2350
+
2351
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2352
+ # Retrieve current path MTU
2353
+ #
2354
+ Socket::IPV6_PATHMTU: Integer
2355
+
2356
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2357
+ # Receive packet information with datagram
2358
+ #
2359
+ Socket::IPV6_PKTINFO: Integer
2360
+
2361
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2362
+ # Receive all IP6 options for response
2363
+ #
2364
+ Socket::IPV6_RECVDSTOPTS: Integer
2365
+
2366
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2367
+ # Receive hop limit with datagram
2368
+ #
2369
+ Socket::IPV6_RECVHOPLIMIT: Integer
2370
+
2371
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2372
+ # Receive hop-by-hop options
2373
+ #
2374
+ Socket::IPV6_RECVHOPOPTS: Integer
2375
+
2376
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2377
+ # Receive current path MTU with datagram
2378
+ #
2379
+ Socket::IPV6_RECVPATHMTU: Integer
2380
+
2381
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2382
+ # Receive destination IP address and incoming interface
2383
+ #
2384
+ Socket::IPV6_RECVPKTINFO: Integer
2385
+
2386
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2387
+ # Receive routing header
2388
+ #
2389
+ Socket::IPV6_RECVRTHDR: Integer
2390
+
2391
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2392
+ # Receive traffic class
2393
+ #
2394
+ Socket::IPV6_RECVTCLASS: Integer
2395
+
2396
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2397
+ # Allows removal of sticky routing headers
2398
+ #
2399
+ Socket::IPV6_RTHDR: Integer
2400
+
2401
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2402
+ # Allows removal of sticky destination options header
2403
+ #
2404
+ Socket::IPV6_RTHDRDSTOPTS: Integer
2405
+
2406
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2407
+ # Routing header type 0
2408
+ #
2409
+ Socket::IPV6_RTHDR_TYPE_0: Integer
2410
+
2411
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2412
+ # Specify the traffic class
2413
+ #
2414
+ Socket::IPV6_TCLASS: Integer
2415
+
2416
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2417
+ # IP6 unicast hops
2418
+ #
2419
+ Socket::IPV6_UNICAST_HOPS: Integer
2420
+
2421
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2422
+ # Use the minimum MTU size
2423
+ #
2424
+ Socket::IPV6_USE_MIN_MTU: Integer
2425
+
2426
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2427
+ # Only bind IPv6 with a wildcard bind
2428
+ #
2429
+ Socket::IPV6_V6ONLY: Integer
2430
+ Socket::IPX_TYPE: Integer
2431
+
2432
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2433
+ # Add a multicast group membership
2434
+ #
2435
+ Socket::IP_ADD_MEMBERSHIP: Integer
2436
+
2437
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2438
+ # Add a multicast group membership
2439
+ #
2440
+ Socket::IP_ADD_SOURCE_MEMBERSHIP: Integer
2441
+
2442
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2443
+ # Block IPv4 multicast packets with a give source address
2444
+ #
2445
+ Socket::IP_BLOCK_SOURCE: Integer
2446
+
2447
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2448
+ # Default multicast loopback
2449
+ #
2450
+ Socket::IP_DEFAULT_MULTICAST_LOOP: Integer
2451
+
2452
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2453
+ # Default multicast TTL
2454
+ #
2455
+ Socket::IP_DEFAULT_MULTICAST_TTL: Integer
2456
+
2457
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2458
+ # Don't fragment packets
2459
+ #
2460
+ Socket::IP_DONTFRAG: Integer
2461
+
2462
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2463
+ # Drop a multicast group membership
2464
+ #
2465
+ Socket::IP_DROP_MEMBERSHIP: Integer
2466
+
2467
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2468
+ # Drop a multicast group membership
2469
+ #
2470
+ Socket::IP_DROP_SOURCE_MEMBERSHIP: Integer
2471
+
2472
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2473
+ # Allow binding to nonexistent IP addresses
2474
+ #
2475
+ Socket::IP_FREEBIND: Integer
2476
+
2477
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2478
+ # Header is included with data
2479
+ #
2480
+ Socket::IP_HDRINCL: Integer
2481
+
2482
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2483
+ # IPsec security policy
2484
+ #
2485
+ Socket::IP_IPSEC_POLICY: Integer
2486
+
2487
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2488
+ # Maximum number multicast groups a socket can join
2489
+ #
2490
+ Socket::IP_MAX_MEMBERSHIPS: Integer
2491
+
2492
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2493
+ # Minimum TTL allowed for received packets
2494
+ #
2495
+ Socket::IP_MINTTL: Integer
2496
+
2497
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2498
+ # Multicast source filtering
2499
+ #
2500
+ Socket::IP_MSFILTER: Integer
2501
+
2502
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2503
+ # The Maximum Transmission Unit of the socket
2504
+ #
2505
+ Socket::IP_MTU: Integer
2506
+
2507
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2508
+ # Path MTU discovery
2509
+ #
2510
+ Socket::IP_MTU_DISCOVER: Integer
2511
+
2512
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2513
+ # IP multicast interface
2514
+ #
2515
+ Socket::IP_MULTICAST_IF: Integer
2516
+
2517
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2518
+ # IP multicast loopback
2519
+ #
2520
+ Socket::IP_MULTICAST_LOOP: Integer
2521
+
2522
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2523
+ # IP multicast TTL
2524
+ #
2525
+ Socket::IP_MULTICAST_TTL: Integer
2526
+
2527
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2528
+ # Force outgoing broadcast datagrams to have the undirected broadcast address
2529
+ #
2530
+ Socket::IP_ONESBCAST: Integer
2531
+
2532
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2533
+ # IP options to be included in packets
2534
+ #
2535
+ Socket::IP_OPTIONS: Integer
2536
+
2537
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2538
+ # Retrieve security context with datagram
2539
+ #
2540
+ Socket::IP_PASSSEC: Integer
2541
+
2542
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2543
+ # Receive packet information with datagrams
2544
+ #
2545
+ Socket::IP_PKTINFO: Integer
2546
+
2547
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2548
+ # Receive packet options with datagrams
2549
+ #
2550
+ Socket::IP_PKTOPTIONS: Integer
2551
+
2552
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2553
+ # Always send DF frames
2554
+ #
2555
+ Socket::IP_PMTUDISC_DO: Integer
2556
+
2557
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2558
+ # Never send DF frames
2559
+ #
2560
+ Socket::IP_PMTUDISC_DONT: Integer
2561
+
2562
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2563
+ # Use per-route hints
2564
+ #
2565
+ Socket::IP_PMTUDISC_WANT: Integer
2566
+
2567
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2568
+ # Set the port range for sockets with unspecified port numbers
2569
+ #
2570
+ Socket::IP_PORTRANGE: Integer
2571
+
2572
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2573
+ # Receive IP destination address with datagram
2574
+ #
2575
+ Socket::IP_RECVDSTADDR: Integer
2576
+
2577
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2578
+ # Enable extended reliable error message passing
2579
+ #
2580
+ Socket::IP_RECVERR: Integer
2581
+
2582
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2583
+ # Receive interface information with datagrams
2584
+ #
2585
+ Socket::IP_RECVIF: Integer
2586
+
2587
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2588
+ # Receive all IP options with datagram
2589
+ #
2590
+ Socket::IP_RECVOPTS: Integer
2591
+
2592
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2593
+ # Receive all IP options for response
2594
+ #
2595
+ Socket::IP_RECVRETOPTS: Integer
2596
+
2597
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2598
+ # Receive link-layer address with datagrams
2599
+ #
2600
+ Socket::IP_RECVSLLA: Integer
2601
+
2602
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2603
+ # Receive TOS with incoming packets
2604
+ #
2605
+ Socket::IP_RECVTOS: Integer
2606
+
2607
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2608
+ # Receive IP TTL with datagrams
2609
+ #
2610
+ Socket::IP_RECVTTL: Integer
2611
+
2612
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2613
+ # IP options to be included in datagrams
2614
+ #
2615
+ Socket::IP_RETOPTS: Integer
2616
+
2617
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2618
+ # Notify transit routers to more closely examine the contents of an IP packet
2619
+ #
2620
+ Socket::IP_ROUTER_ALERT: Integer
2621
+
2622
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2623
+ # Source address for outgoing UDP datagrams
2624
+ #
2625
+ Socket::IP_SENDSRCADDR: Integer
2626
+
2627
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2628
+ # IP type-of-service
2629
+ #
2630
+ Socket::IP_TOS: Integer
2631
+
2632
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2633
+ # Transparent proxy
2634
+ #
2635
+ Socket::IP_TRANSPARENT: Integer
2636
+
2637
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2638
+ # IP time-to-live
2639
+ #
2640
+ Socket::IP_TTL: Integer
2641
+
2642
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2643
+ # Unblock IPv4 multicast packets with a give source address
2644
+ #
2645
+ Socket::IP_UNBLOCK_SOURCE: Integer
2646
+ Socket::IP_XFRM_POLICY: Integer
2647
+
2648
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2649
+ # Connect blocks until accepted
2650
+ #
2651
+ Socket::LOCAL_CONNWAIT: Integer
2652
+
2653
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2654
+ # Pass credentials to receiver
2655
+ #
2656
+ Socket::LOCAL_CREDS: Integer
2657
+
2658
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2659
+ # Retrieve peer credentials
2660
+ #
2661
+ Socket::LOCAL_PEERCRED: Integer
2662
+
2663
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2664
+ # Block multicast packets from this source
2665
+ #
2666
+ Socket::MCAST_BLOCK_SOURCE: Integer
2667
+
2668
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2669
+ # Exclusive multicast source filter
2670
+ #
2671
+ Socket::MCAST_EXCLUDE: Integer
2672
+
2673
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2674
+ # Inclusive multicast source filter
2675
+ #
2676
+ Socket::MCAST_INCLUDE: Integer
2677
+
2678
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2679
+ # Join a multicast group
2680
+ #
2681
+ Socket::MCAST_JOIN_GROUP: Integer
2682
+
2683
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2684
+ # Join a multicast source group
2685
+ #
2686
+ Socket::MCAST_JOIN_SOURCE_GROUP: Integer
2687
+
2688
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2689
+ # Leave a multicast group
2690
+ #
2691
+ Socket::MCAST_LEAVE_GROUP: Integer
2692
+
2693
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2694
+ # Leave a multicast source group
2695
+ #
2696
+ Socket::MCAST_LEAVE_SOURCE_GROUP: Integer
2697
+
2698
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2699
+ # Multicast source filtering
2700
+ #
2701
+ Socket::MCAST_MSFILTER: Integer
2702
+
2703
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2704
+ # Unblock multicast packets from this source
2705
+ #
2706
+ Socket::MCAST_UNBLOCK_SOURCE: Integer
2707
+
2708
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2709
+ # End of record
2710
+ #
2711
+ Socket::MSG_COMPAT: Integer
2712
+
2713
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2714
+ # Confirm path validity
2715
+ #
2716
+ Socket::MSG_CONFIRM: Integer
2717
+
2718
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2719
+ # Control data lost before delivery
2720
+ #
2721
+ Socket::MSG_CTRUNC: Integer
2722
+
2723
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2724
+ # Send without using the routing tables
2725
+ #
2726
+ Socket::MSG_DONTROUTE: Integer
2727
+
2728
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2729
+ # This message should be non-blocking
2730
+ #
2731
+ Socket::MSG_DONTWAIT: Integer
2732
+
2733
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2734
+ # Data completes connection
2735
+ #
2736
+ Socket::MSG_EOF: Integer
2737
+
2738
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2739
+ # Data completes record
2740
+ #
2741
+ Socket::MSG_EOR: Integer
2742
+
2743
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2744
+ # Fetch message from error queue
2745
+ #
2746
+ Socket::MSG_ERRQUEUE: Integer
2747
+
2748
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2749
+ # Reduce step of the handshake process
2750
+ #
2751
+ Socket::MSG_FASTOPEN: Integer
2752
+ Socket::MSG_FIN: Integer
2753
+
2754
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2755
+ # Start of a hold sequence. Dumps to so_temp
2756
+ #
2757
+ Socket::MSG_FLUSH: Integer
2758
+
2759
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2760
+ # Data ready to be read
2761
+ #
2762
+ Socket::MSG_HAVEMORE: Integer
2763
+
2764
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2765
+ # Hold fragment in so_temp
2766
+ #
2767
+ Socket::MSG_HOLD: Integer
2768
+
2769
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2770
+ # Sender will send more
2771
+ #
2772
+ Socket::MSG_MORE: Integer
2773
+
2774
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2775
+ # Do not generate SIGPIPE
2776
+ #
2777
+ Socket::MSG_NOSIGNAL: Integer
2778
+
2779
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2780
+ # Process out-of-band data
2781
+ #
2782
+ Socket::MSG_OOB: Integer
2783
+
2784
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2785
+ # Peek at incoming message
2786
+ #
2787
+ Socket::MSG_PEEK: Integer
2788
+
2789
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2790
+ # Wait for full request
2791
+ #
2792
+ Socket::MSG_PROXY: Integer
2793
+
2794
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2795
+ # Data remains in the current packet
2796
+ #
2797
+ Socket::MSG_RCVMORE: Integer
2798
+ Socket::MSG_RST: Integer
2799
+
2800
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2801
+ # Send the packet in so_temp
2802
+ #
2803
+ Socket::MSG_SEND: Integer
2804
+ Socket::MSG_SYN: Integer
2805
+
2806
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2807
+ # Data discarded before delivery
2808
+ #
2809
+ Socket::MSG_TRUNC: Integer
2810
+
2811
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2812
+ # Wait for full request or error
2813
+ #
2814
+ Socket::MSG_WAITALL: Integer
2815
+
2816
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2817
+ # The service specified is a datagram service (looks up UDP ports)
2818
+ #
2819
+ Socket::NI_DGRAM: Integer
2820
+
2821
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2822
+ # Maximum length of a hostname
2823
+ #
2824
+ Socket::NI_MAXHOST: Integer
2825
+
2826
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2827
+ # Maximum length of a service name
2828
+ #
2829
+ Socket::NI_MAXSERV: Integer
2830
+
2831
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2832
+ # A name is required
2833
+ #
2834
+ Socket::NI_NAMEREQD: Integer
2835
+
2836
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2837
+ # An FQDN is not required for local hosts, return only the local part
2838
+ #
2839
+ Socket::NI_NOFQDN: Integer
2840
+
2841
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2842
+ # Return a numeric address
2843
+ #
2844
+ Socket::NI_NUMERICHOST: Integer
2845
+
2846
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2847
+ # Return the service name as a digit string
2848
+ #
2849
+ Socket::NI_NUMERICSERV: Integer
2850
+
2851
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2852
+ # Interface to kernel crypto API
2853
+ #
2854
+ Socket::PF_ALG: Integer
2855
+
2856
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2857
+ # AppleTalk protocol
2858
+ #
2859
+ Socket::PF_APPLETALK: Integer
2860
+
2861
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2862
+ # Asynchronous Transfer Mode
2863
+ #
2864
+ Socket::PF_ATM: Integer
2865
+
2866
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2867
+ # AX.25 protocol
2868
+ #
2869
+ Socket::PF_AX25: Integer
2870
+
2871
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2872
+ # Bluetooth low-level socket protocol
2873
+ #
2874
+ Socket::PF_BLUETOOTH: Integer
2875
+
2876
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2877
+ # Controller Area Network automotive bus protocol
2878
+ #
2879
+ Socket::PF_CAN: Integer
2880
+
2881
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2882
+ # CCITT (now ITU-T) protocols
2883
+ #
2884
+ Socket::PF_CCITT: Integer
2885
+
2886
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2887
+ # MIT CHAOS protocols
2888
+ #
2889
+ Socket::PF_CHAOS: Integer
2890
+
2891
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2892
+ # Computer Network Technology
2893
+ #
2894
+ Socket::PF_CNT: Integer
2895
+
2896
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2897
+ # Connection-oriented IP
2898
+ #
2899
+ Socket::PF_COIP: Integer
2900
+
2901
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2902
+ # Datakit protocol
2903
+ #
2904
+ Socket::PF_DATAKIT: Integer
2905
+
2906
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2907
+ # DECnet protocol
2908
+ #
2909
+ Socket::PF_DEC: Integer
2910
+
2911
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2912
+ # DECnet protocol
2913
+ #
2914
+ Socket::PF_DECnet: Integer
2915
+
2916
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2917
+ # DEC Direct Data Link Interface protocol
2918
+ #
2919
+ Socket::PF_DLI: Integer
2920
+
2921
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2922
+ # European Computer Manufacturers protocols
2923
+ #
2924
+ Socket::PF_ECMA: Integer
2925
+
2926
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2927
+ # NSC Hyperchannel protocol
2928
+ #
2929
+ Socket::PF_HYLINK: Integer
2930
+
2931
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2932
+ # InfiniBand native addressing
2933
+ #
2934
+ Socket::PF_IB: Integer
2935
+
2936
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2937
+ # ARPANET IMP protocol
2938
+ #
2939
+ Socket::PF_IMPLINK: Integer
2940
+
2941
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2942
+ # IPv4 protocol
2943
+ #
2944
+ Socket::PF_INET: Integer
2945
+
2946
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2947
+ # IPv6 protocol
2948
+ #
2949
+ Socket::PF_INET6: Integer
2950
+
2951
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2952
+ # IPX protocol
2953
+ #
2954
+ Socket::PF_IPX: Integer
2955
+
2956
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2957
+ # Integrated Services Digital Network
2958
+ #
2959
+ Socket::PF_ISDN: Integer
2960
+
2961
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2962
+ # ISO Open Systems Interconnection protocols
2963
+ #
2964
+ Socket::PF_ISO: Integer
2965
+
2966
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2967
+ # KCM (kernel connection multiplexor) interface
2968
+ #
2969
+ Socket::PF_KCM: Integer
2970
+
2971
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2972
+ # Key management protocol, originally developed for usage with IPsec
2973
+ #
2974
+ Socket::PF_KEY: Integer
2975
+
2976
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2977
+ # Local Area Transport protocol
2978
+ #
2979
+ Socket::PF_LAT: Integer
2980
+
2981
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2982
+ # Link layer interface
2983
+ #
2984
+ Socket::PF_LINK: Integer
2985
+
2986
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2987
+ # Logical link control (IEEE 802.2 LLC) protocol
2988
+ #
2989
+ Socket::PF_LLC: Integer
2990
+
2991
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2992
+ # Host-internal protocols
2993
+ #
2994
+ Socket::PF_LOCAL: Integer
2995
+
2996
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
2997
+ # Maximum address family for this platform
2998
+ #
2999
+ Socket::PF_MAX: Integer
3000
+
3001
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3002
+ # Multiprotocol Label Switching
3003
+ #
3004
+ Socket::PF_MPLS: Integer
3005
+
3006
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3007
+ # Native ATM access
3008
+ #
3009
+ Socket::PF_NATM: Integer
3010
+
3011
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3012
+ # Network driver raw access
3013
+ #
3014
+ Socket::PF_NDRV: Integer
3015
+
3016
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3017
+ # NetBIOS
3018
+ #
3019
+ Socket::PF_NETBIOS: Integer
3020
+
3021
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3022
+ # Netgraph sockets
3023
+ #
3024
+ Socket::PF_NETGRAPH: Integer
3025
+
3026
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3027
+ # Kernel user interface device
3028
+ #
3029
+ Socket::PF_NETLINK: Integer
3030
+
3031
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3032
+ # XEROX NS protocols
3033
+ #
3034
+ Socket::PF_NS: Integer
3035
+
3036
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3037
+ # ISO Open Systems Interconnection protocols
3038
+ #
3039
+ Socket::PF_OSI: Integer
3040
+
3041
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3042
+ # Direct link-layer access
3043
+ #
3044
+ Socket::PF_PACKET: Integer
3045
+ Socket::PF_PIP: Integer
3046
+
3047
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3048
+ # Point-to-Point Protocol
3049
+ #
3050
+ Socket::PF_PPP: Integer
3051
+
3052
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3053
+ # Generic PPP transport layer, for setting up L2 tunnels (L2TP and PPPoE)
3054
+ #
3055
+ Socket::PF_PPPOX: Integer
3056
+
3057
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3058
+ # PARC Universal Packet protocol
3059
+ #
3060
+ Socket::PF_PUP: Integer
3061
+
3062
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3063
+ # Reliable Datagram Sockets (RDS) protocol
3064
+ #
3065
+ Socket::PF_RDS: Integer
3066
+
3067
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3068
+ # Internal routing protocol
3069
+ #
3070
+ Socket::PF_ROUTE: Integer
3071
+ Socket::PF_RTIP: Integer
3072
+
3073
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3074
+ # Simple Internet Protocol
3075
+ #
3076
+ Socket::PF_SIP: Integer
3077
+
3078
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3079
+ # IBM SNA protocol
3080
+ #
3081
+ Socket::PF_SNA: Integer
3082
+ Socket::PF_SYSTEM: Integer
3083
+
3084
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3085
+ # TIPC, "cluster domain sockets" protocol
3086
+ #
3087
+ Socket::PF_TIPC: Integer
3088
+
3089
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3090
+ # UNIX sockets
3091
+ #
3092
+ Socket::PF_UNIX: Integer
3093
+
3094
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3095
+ # Unspecified protocol, any supported address family
3096
+ #
3097
+ Socket::PF_UNSPEC: Integer
3098
+
3099
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3100
+ # VSOCK (originally "VMWare VSockets") protocol for hypervisor-guest
3101
+ # communication
3102
+ #
3103
+ Socket::PF_VSOCK: Integer
3104
+
3105
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3106
+ # XDP (express data path) interface
3107
+ #
3108
+ Socket::PF_XDP: Integer
3109
+
3110
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3111
+ # eXpress Transfer Protocol
3112
+ #
3113
+ Socket::PF_XTP: Integer
3114
+
3115
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3116
+ # Timestamp (bintime)
3117
+ #
3118
+ Socket::SCM_BINTIME: Integer
3119
+
3120
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3121
+ # The sender's credentials
3122
+ #
3123
+ Socket::SCM_CREDENTIALS: Integer
3124
+
3125
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3126
+ # Process credentials
3127
+ #
3128
+ Socket::SCM_CREDS: Integer
3129
+
3130
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3131
+ # Access rights
3132
+ #
3133
+ Socket::SCM_RIGHTS: Integer
3134
+
3135
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3136
+ # Timestamp (timeval)
3137
+ #
3138
+ Socket::SCM_TIMESTAMP: Integer
3139
+
3140
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3141
+ # Timestamp (timespec list) (Linux 2.6.30)
3142
+ #
3143
+ Socket::SCM_TIMESTAMPING: Integer
3144
+
3145
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3146
+ # Timespec (timespec)
3147
+ #
3148
+ Socket::SCM_TIMESTAMPNS: Integer
3149
+
3150
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3151
+ # User credentials
3152
+ #
3153
+ Socket::SCM_UCRED: Integer
3154
+
3155
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3156
+ # Wifi status (Linux 3.3)
3157
+ #
3158
+ Socket::SCM_WIFI_STATUS: Integer
3159
+
3160
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3161
+ # Shut down the reading side of the socket
3162
+ #
3163
+ Socket::SHUT_RD: Integer
3164
+
3165
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3166
+ # Shut down the both sides of the socket
3167
+ #
3168
+ Socket::SHUT_RDWR: Integer
3169
+
3170
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3171
+ # Shut down the writing side of the socket
3172
+ #
3173
+ Socket::SHUT_WR: Integer
3174
+
3175
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3176
+ # Set the close-on-exec (FD_CLOEXEC) flag on the new file descriptor.
3177
+ #
3178
+ Socket::SOCK_CLOEXEC: Integer
3179
+
3180
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3181
+ # A datagram socket provides connectionless, unreliable messaging
3182
+ #
3183
+ Socket::SOCK_DGRAM: Integer
3184
+
3185
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3186
+ # Set the O_NONBLOCK file status flag on the open file description (see open(2))
3187
+ # referred to by the new file descriptor.
3188
+ #
3189
+ Socket::SOCK_NONBLOCK: Integer
3190
+
3191
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3192
+ # Device-level packet access
3193
+ #
3194
+ Socket::SOCK_PACKET: Integer
3195
+
3196
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3197
+ # A raw socket provides low-level access for direct access or implementing
3198
+ # network protocols
3199
+ #
3200
+ Socket::SOCK_RAW: Integer
3201
+
3202
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3203
+ # A reliable datagram socket provides reliable delivery of messages
3204
+ #
3205
+ Socket::SOCK_RDM: Integer
3206
+
3207
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3208
+ # A sequential packet socket provides sequenced, reliable two-way connection for
3209
+ # datagrams
3210
+ #
3211
+ Socket::SOCK_SEQPACKET: Integer
3212
+
3213
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3214
+ # A stream socket provides a sequenced, reliable two-way connection for a byte
3215
+ # stream
3216
+ #
3217
+ Socket::SOCK_STREAM: Integer
3218
+
3219
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3220
+ # AppleTalk socket options
3221
+ #
3222
+ Socket::SOL_ATALK: Integer
3223
+
3224
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3225
+ # AX.25 socket options
3226
+ #
3227
+ Socket::SOL_AX25: Integer
3228
+
3229
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3230
+ # IP socket options
3231
+ #
3232
+ Socket::SOL_IP: Integer
3233
+
3234
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3235
+ # IPX socket options
3236
+ #
3237
+ Socket::SOL_IPX: Integer
3238
+
3239
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3240
+ # Socket-level options
3241
+ #
3242
+ Socket::SOL_SOCKET: Integer
3243
+
3244
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3245
+ # TCP socket options
3246
+ #
3247
+ Socket::SOL_TCP: Integer
3248
+
3249
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3250
+ # UDP socket options
3251
+ #
3252
+ Socket::SOL_UDP: Integer
3253
+
3254
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3255
+ # Maximum connection requests that may be queued for a socket
3256
+ #
3257
+ Socket::SOMAXCONN: Integer
3258
+
3259
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3260
+ # Background socket priority
3261
+ #
3262
+ Socket::SOPRI_BACKGROUND: Integer
3263
+
3264
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3265
+ # Interactive socket priority
3266
+ #
3267
+ Socket::SOPRI_INTERACTIVE: Integer
3268
+
3269
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3270
+ # Normal socket priority
3271
+ #
3272
+ Socket::SOPRI_NORMAL: Integer
3273
+
3274
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3275
+ # Socket has had listen() called on it
3276
+ #
3277
+ Socket::SO_ACCEPTCONN: Integer
3278
+
3279
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3280
+ # There is an accept filter
3281
+ #
3282
+ Socket::SO_ACCEPTFILTER: Integer
3283
+
3284
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3285
+ # Bypass zone boundaries
3286
+ #
3287
+ Socket::SO_ALLZONES: Integer
3288
+
3289
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3290
+ # Attach an accept filter
3291
+ #
3292
+ Socket::SO_ATTACH_FILTER: Integer
3293
+
3294
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3295
+ # Only send packets from the given interface
3296
+ #
3297
+ Socket::SO_BINDTODEVICE: Integer
3298
+
3299
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3300
+ # Receive timestamp with datagrams (bintime)
3301
+ #
3302
+ Socket::SO_BINTIME: Integer
3303
+
3304
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3305
+ # Query supported BPF extensions (Linux 3.14)
3306
+ #
3307
+ Socket::SO_BPF_EXTENSIONS: Integer
3308
+
3309
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3310
+ # Permit sending of broadcast messages
3311
+ #
3312
+ Socket::SO_BROADCAST: Integer
3313
+
3314
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3315
+ # Set the threshold in microseconds for low latency polling (Linux 3.11)
3316
+ #
3317
+ Socket::SO_BUSY_POLL: Integer
3318
+
3319
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3320
+ # Debug info recording
3321
+ #
3322
+ Socket::SO_DEBUG: Integer
3323
+
3324
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3325
+ # Detach an accept filter
3326
+ #
3327
+ Socket::SO_DETACH_FILTER: Integer
3328
+
3329
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3330
+ # Domain given for socket() (Linux 2.6.32)
3331
+ #
3332
+ Socket::SO_DOMAIN: Integer
3333
+
3334
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3335
+ # Use interface addresses
3336
+ #
3337
+ Socket::SO_DONTROUTE: Integer
3338
+
3339
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3340
+ # Retain unread data
3341
+ #
3342
+ Socket::SO_DONTTRUNC: Integer
3343
+
3344
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3345
+ # Get and clear the error status
3346
+ #
3347
+ Socket::SO_ERROR: Integer
3348
+
3349
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3350
+ # Obtain filter set by SO_ATTACH_FILTER (Linux 3.8)
3351
+ #
3352
+ Socket::SO_GET_FILTER: Integer
3353
+
3354
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3355
+ # Receive the cpu attached to the socket (Linux 3.19)
3356
+ #
3357
+ Socket::SO_INCOMING_CPU: Integer
3358
+
3359
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3360
+ # Receive the napi ID attached to a RX queue (Linux 4.12)
3361
+ #
3362
+ Socket::SO_INCOMING_NAPI_ID: Integer
3363
+
3364
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3365
+ # Keep connections alive
3366
+ #
3367
+ Socket::SO_KEEPALIVE: Integer
3368
+
3369
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3370
+ # Linger on close if data is present
3371
+ #
3372
+ Socket::SO_LINGER: Integer
3373
+
3374
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3375
+ # Lock the filter attached to a socket (Linux 3.9)
3376
+ #
3377
+ Socket::SO_LOCK_FILTER: Integer
3378
+
3379
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3380
+ # Mandatory Access Control exemption for unlabeled peers
3381
+ #
3382
+ Socket::SO_MAC_EXEMPT: Integer
3383
+
3384
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3385
+ # Set the mark for mark-based routing (Linux 2.6.25)
3386
+ #
3387
+ Socket::SO_MARK: Integer
3388
+
3389
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3390
+ # Cap the rate computed by transport layer. [bytes per second] (Linux 3.13)
3391
+ #
3392
+ Socket::SO_MAX_PACING_RATE: Integer
3393
+
3394
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3395
+ # Install socket-level Network Kernel Extension
3396
+ #
3397
+ Socket::SO_NKE: Integer
3398
+
3399
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3400
+ # Set netns of a socket (Linux 3.4)
3401
+ #
3402
+ Socket::SO_NOFCS: Integer
3403
+
3404
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3405
+ # Don't SIGPIPE on EPIPE
3406
+ #
3407
+ Socket::SO_NOSIGPIPE: Integer
3408
+
3409
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3410
+ # Disable checksums
3411
+ #
3412
+ Socket::SO_NO_CHECK: Integer
3413
+
3414
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3415
+ # Get first packet byte count
3416
+ #
3417
+ Socket::SO_NREAD: Integer
3418
+
3419
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3420
+ # Leave received out-of-band data in-line
3421
+ #
3422
+ Socket::SO_OOBINLINE: Integer
3423
+
3424
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3425
+ # Receive SCM_CREDENTIALS messages
3426
+ #
3427
+ Socket::SO_PASSCRED: Integer
3428
+
3429
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3430
+ # Toggle security context passing (Linux 2.6.18)
3431
+ #
3432
+ Socket::SO_PASSSEC: Integer
3433
+
3434
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3435
+ # Set the peek offset (Linux 3.4)
3436
+ #
3437
+ Socket::SO_PEEK_OFF: Integer
3438
+
3439
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3440
+ # The credentials of the foreign process connected to this socket
3441
+ #
3442
+ Socket::SO_PEERCRED: Integer
3443
+
3444
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3445
+ # Name of the connecting user
3446
+ #
3447
+ Socket::SO_PEERNAME: Integer
3448
+
3449
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3450
+ # Obtain the security credentials (Linux 2.6.2)
3451
+ #
3452
+ Socket::SO_PEERSEC: Integer
3453
+
3454
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3455
+ # The protocol-defined priority for all packets on this socket
3456
+ #
3457
+ Socket::SO_PRIORITY: Integer
3458
+
3459
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3460
+ # Protocol given for socket() (Linux 2.6.32)
3461
+ #
3462
+ Socket::SO_PROTOCOL: Integer
3463
+
3464
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3465
+ # Receive buffer size
3466
+ #
3467
+ Socket::SO_RCVBUF: Integer
3468
+
3469
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3470
+ # Receive buffer size without rmem_max limit (Linux 2.6.14)
3471
+ #
3472
+ Socket::SO_RCVBUFFORCE: Integer
3473
+
3474
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3475
+ # Receive low-water mark
3476
+ #
3477
+ Socket::SO_RCVLOWAT: Integer
3478
+
3479
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3480
+ # Receive timeout
3481
+ #
3482
+ Socket::SO_RCVTIMEO: Integer
3483
+
3484
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3485
+ # Receive user credentials with datagram
3486
+ #
3487
+ Socket::SO_RECVUCRED: Integer
3488
+
3489
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3490
+ # Allow local address reuse
3491
+ #
3492
+ Socket::SO_REUSEADDR: Integer
3493
+
3494
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3495
+ # Allow local address and port reuse
3496
+ #
3497
+ Socket::SO_REUSEPORT: Integer
3498
+
3499
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3500
+ # Set the routing table for this socket (OpenBSD)
3501
+ #
3502
+ Socket::SO_RTABLE: Integer
3503
+
3504
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3505
+ # Toggle cmsg for number of packets dropped (Linux 2.6.33)
3506
+ #
3507
+ Socket::SO_RXQ_OVFL: Integer
3508
+ Socket::SO_SECURITY_AUTHENTICATION: Integer
3509
+ Socket::SO_SECURITY_ENCRYPTION_NETWORK: Integer
3510
+ Socket::SO_SECURITY_ENCRYPTION_TRANSPORT: Integer
3511
+
3512
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3513
+ # Make select() detect socket error queue with errorfds (Linux 3.10)
3514
+ #
3515
+ Socket::SO_SELECT_ERR_QUEUE: Integer
3516
+
3517
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3518
+ # Set the associated routing table for the socket (FreeBSD)
3519
+ #
3520
+ Socket::SO_SETFIB: Integer
3521
+
3522
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3523
+ # Send buffer size
3524
+ #
3525
+ Socket::SO_SNDBUF: Integer
3526
+
3527
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3528
+ # Send buffer size without wmem_max limit (Linux 2.6.14)
3529
+ #
3530
+ Socket::SO_SNDBUFFORCE: Integer
3531
+
3532
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3533
+ # Send low-water mark
3534
+ #
3535
+ Socket::SO_SNDLOWAT: Integer
3536
+
3537
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3538
+ # Send timeout
3539
+ #
3540
+ Socket::SO_SNDTIMEO: Integer
3541
+
3542
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3543
+ # Receive timestamp with datagrams (timeval)
3544
+ #
3545
+ Socket::SO_TIMESTAMP: Integer
3546
+
3547
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3548
+ # Time stamping of incoming and outgoing packets (Linux 2.6.30)
3549
+ #
3550
+ Socket::SO_TIMESTAMPING: Integer
3551
+
3552
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3553
+ # Receive nanosecond timestamp with datagrams (timespec)
3554
+ #
3555
+ Socket::SO_TIMESTAMPNS: Integer
3556
+
3557
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3558
+ # Get the socket type
3559
+ #
3560
+ Socket::SO_TYPE: Integer
3561
+
3562
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3563
+ # Bypass hardware when possible
3564
+ #
3565
+ Socket::SO_USELOOPBACK: Integer
3566
+
3567
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3568
+ # Setting an identifier for ipfw purpose mainly
3569
+ #
3570
+ Socket::SO_USER_COOKIE: Integer
3571
+
3572
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3573
+ # Give a hint when more data is ready
3574
+ #
3575
+ Socket::SO_WANTMORE: Integer
3576
+
3577
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3578
+ # OOB data is wanted in MSG_FLAG on receive
3579
+ #
3580
+ Socket::SO_WANTOOBFLAG: Integer
3581
+
3582
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3583
+ # Toggle cmsg for wifi status (Linux 3.3)
3584
+ #
3585
+ Socket::SO_WIFI_STATUS: Integer
3586
+
3587
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3588
+ # Retrieve information about this socket (macOS)
3589
+ #
3590
+ Socket::TCP_CONNECTION_INFO: Integer
3591
+
3592
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3593
+ # TCP congestion control algorithm (Linux 2.6.13, glibc 2.6)
3594
+ #
3595
+ Socket::TCP_CONGESTION: Integer
3596
+
3597
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3598
+ # TCP Cookie Transactions (Linux 2.6.33, glibc 2.18)
3599
+ #
3600
+ Socket::TCP_COOKIE_TRANSACTIONS: Integer
3601
+
3602
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3603
+ # Don't send partial frames (Linux 2.2, glibc 2.2)
3604
+ #
3605
+ Socket::TCP_CORK: Integer
3606
+
3607
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3608
+ # Don't notify a listening socket until data is ready (Linux 2.4, glibc 2.2)
3609
+ #
3610
+ Socket::TCP_DEFER_ACCEPT: Integer
3611
+
3612
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3613
+ # Reduce step of the handshake process (Linux 3.7, glibc 2.18)
3614
+ #
3615
+ Socket::TCP_FASTOPEN: Integer
3616
+
3617
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3618
+ # Retrieve information about this socket (Linux 2.4, glibc 2.2)
3619
+ #
3620
+ Socket::TCP_INFO: Integer
3621
+
3622
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3623
+ # Idle time before keepalive probes are sent (macOS)
3624
+ #
3625
+ Socket::TCP_KEEPALIVE: Integer
3626
+
3627
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3628
+ # Maximum number of keepalive probes allowed before dropping a connection (Linux
3629
+ # 2.4, glibc 2.2)
3630
+ #
3631
+ Socket::TCP_KEEPCNT: Integer
3632
+
3633
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3634
+ # Idle time before keepalive probes are sent (Linux 2.4, glibc 2.2)
3635
+ #
3636
+ Socket::TCP_KEEPIDLE: Integer
3637
+
3638
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3639
+ # Time between keepalive probes (Linux 2.4, glibc 2.2)
3640
+ #
3641
+ Socket::TCP_KEEPINTVL: Integer
3642
+
3643
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3644
+ # Lifetime of orphaned FIN_WAIT2 sockets (Linux 2.4, glibc 2.2)
3645
+ #
3646
+ Socket::TCP_LINGER2: Integer
3647
+
3648
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3649
+ # Set maximum segment size
3650
+ #
3651
+ Socket::TCP_MAXSEG: Integer
3652
+
3653
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3654
+ # Use MD5 digests (RFC2385, Linux 2.6.20, glibc 2.7)
3655
+ #
3656
+ Socket::TCP_MD5SIG: Integer
3657
+
3658
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3659
+ # Don't delay sending to coalesce packets
3660
+ #
3661
+ Socket::TCP_NODELAY: Integer
3662
+
3663
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3664
+ # Don't use TCP options
3665
+ #
3666
+ Socket::TCP_NOOPT: Integer
3667
+
3668
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3669
+ # Don't push the last block of write
3670
+ #
3671
+ Socket::TCP_NOPUSH: Integer
3672
+
3673
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3674
+ # Sequence of a queue for repair mode (Linux 3.5, glibc 2.18)
3675
+ #
3676
+ Socket::TCP_QUEUE_SEQ: Integer
3677
+
3678
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3679
+ # Enable quickack mode (Linux 2.4.4, glibc 2.3)
3680
+ #
3681
+ Socket::TCP_QUICKACK: Integer
3682
+
3683
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3684
+ # Repair mode (Linux 3.5, glibc 2.18)
3685
+ #
3686
+ Socket::TCP_REPAIR: Integer
3687
+
3688
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3689
+ # Options for repair mode (Linux 3.5, glibc 2.18)
3690
+ #
3691
+ Socket::TCP_REPAIR_OPTIONS: Integer
3692
+
3693
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3694
+ # Queue for repair mode (Linux 3.5, glibc 2.18)
3695
+ #
3696
+ Socket::TCP_REPAIR_QUEUE: Integer
3697
+
3698
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3699
+ # Number of SYN retransmits before a connection is dropped (Linux 2.4, glibc
3700
+ # 2.2)
3701
+ #
3702
+ Socket::TCP_SYNCNT: Integer
3703
+
3704
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3705
+ # Duplicated acknowledgments handling for thin-streams (Linux 2.6.34, glibc
3706
+ # 2.18)
3707
+ #
3708
+ Socket::TCP_THIN_DUPACK: Integer
3709
+
3710
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3711
+ # Linear timeouts for thin-streams (Linux 2.6.34, glibc 2.18)
3712
+ #
3713
+ Socket::TCP_THIN_LINEAR_TIMEOUTS: Integer
3714
+
3715
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3716
+ # TCP timestamp (Linux 3.9, glibc 2.18)
3717
+ #
3718
+ Socket::TCP_TIMESTAMP: Integer
3719
+
3720
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3721
+ # Max timeout before a TCP connection is aborted (Linux 2.6.37, glibc 2.18)
3722
+ #
3723
+ Socket::TCP_USER_TIMEOUT: Integer
3724
+
3725
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3726
+ # Clamp the size of the advertised window (Linux 2.4, glibc 2.2)
3727
+ #
3728
+ Socket::TCP_WINDOW_CLAMP: Integer
3729
+
3730
+ # <!-- rdoc-file=ext/socket/constdefs.c -->
3731
+ # Don't send partial frames (Linux 2.5.44, glibc 2.11)
3732
+ #
3733
+ Socket::UDP_CORK: Integer
3734
+
3735
+ # <!-- rdoc-file=ext/socket/ifaddr.c -->
3736
+ # Socket::Ifaddr represents a result of getifaddrs() function.
3737
+ #
3738
+ class Socket::Ifaddr
3739
+ # <!--
3740
+ # rdoc-file=ext/socket/ifaddr.c
3741
+ # - ifaddr.addr => addrinfo
3742
+ # -->
3743
+ # Returns the address of *ifaddr*. nil is returned if address is not available
3744
+ # in *ifaddr*.
3745
+ #
3746
+ def addr: () -> Addrinfo?
3747
+
3748
+ # <!--
3749
+ # rdoc-file=ext/socket/ifaddr.c
3750
+ # - ifaddr.broadaddr => addrinfo
3751
+ # -->
3752
+ # Returns the broadcast address of *ifaddr*. nil is returned if the flags
3753
+ # doesn't have IFF_BROADCAST.
3754
+ #
3755
+ def broadaddr: () -> Addrinfo?
3756
+
3757
+ # <!--
3758
+ # rdoc-file=ext/socket/ifaddr.c
3759
+ # - ifaddr.dstaddr => addrinfo
3760
+ # -->
3761
+ # Returns the destination address of *ifaddr*. nil is returned if the flags
3762
+ # doesn't have IFF_POINTOPOINT.
3763
+ #
3764
+ def dstaddr: () -> Addrinfo?
3765
+
3766
+ # <!--
3767
+ # rdoc-file=ext/socket/ifaddr.c
3768
+ # - ifaddr.flags => integer
3769
+ # -->
3770
+ # Returns the flags of *ifaddr*.
3771
+ #
3772
+ def flags: () -> Integer
3773
+
3774
+ # <!--
3775
+ # rdoc-file=ext/socket/ifaddr.c
3776
+ # - ifaddr.ifindex => integer
3777
+ # -->
3778
+ # Returns the interface index of *ifaddr*.
3779
+ #
3780
+ def ifindex: () -> Integer
3781
+
3782
+ # <!--
3783
+ # rdoc-file=ext/socket/ifaddr.c
3784
+ # - ifaddr.inspect => string
3785
+ # -->
3786
+ # Returns a string to show contents of *ifaddr*.
3787
+ #
3788
+ def inspect: () -> String
3789
+
3790
+ # <!--
3791
+ # rdoc-file=ext/socket/ifaddr.c
3792
+ # - ifaddr.name => string
3793
+ # -->
3794
+ # Returns the interface name of *ifaddr*.
3795
+ #
3796
+ def name: () -> String
3797
+
3798
+ # <!--
3799
+ # rdoc-file=ext/socket/ifaddr.c
3800
+ # - ifaddr.netmask => addrinfo
3801
+ # -->
3802
+ # Returns the netmask address of *ifaddr*. nil is returned if netmask is not
3803
+ # available in *ifaddr*.
3804
+ #
3805
+ def netmask: () -> Addrinfo?
3806
+ end
3807
+
3808
+ # <!-- rdoc-file=ext/socket/lib/socket.rb -->
3809
+ # UDP/IP address information used by Socket.udp_server_loop.
3810
+ #
3811
+ class Socket::UDPSource
3812
+ def inspect: () -> String
3813
+
3814
+ # <!-- rdoc-file=ext/socket/lib/socket.rb -->
3815
+ # Local address
3816
+ #
3817
+ def local_address: () -> Addrinfo
3818
+
3819
+ # <!-- rdoc-file=ext/socket/lib/socket.rb -->
3820
+ # Address of the source
3821
+ #
3822
+ def remote_address: () -> Addrinfo
3823
+
3824
+ # <!--
3825
+ # rdoc-file=ext/socket/lib/socket.rb
3826
+ # - reply(msg)
3827
+ # -->
3828
+ # Sends the String `msg` to the source
3829
+ #
3830
+ def reply: (String msg) -> void
3831
+
3832
+ private
3833
+
3834
+ # <!--
3835
+ # rdoc-file=ext/socket/lib/socket.rb
3836
+ # - new(remote_address, local_address, &reply_proc)
3837
+ # -->
3838
+ # `remote_address` is an Addrinfo object.
3839
+ #
3840
+ # `local_address` is an Addrinfo object.
3841
+ #
3842
+ # `reply_proc` is a Proc used to send reply back to the source.
3843
+ #
3844
+ def initialize: (Addrinfo remote_address, Addrinfo local_address) { (String) -> void } -> void
3845
+ end
3846
+
3847
+ # <!-- rdoc-file=ext/socket/ancdata.c -->
3848
+ # Socket::AncillaryData represents the ancillary data (control information) used
3849
+ # by sendmsg and recvmsg system call. It contains socket #family, control
3850
+ # message (cmsg) #level, cmsg #type and cmsg #data.
3851
+ #
3852
+ class Socket::AncillaryData
3853
+ # <!--
3854
+ # rdoc-file=ext/socket/ancdata.c
3855
+ # - Socket::AncillaryData.int(family, cmsg_level, cmsg_type, integer) => ancillarydata
3856
+ # -->
3857
+ # Creates a new Socket::AncillaryData object which contains a int as data.
3858
+ #
3859
+ # The size and endian is dependent on the host.
3860
+ #
3861
+ # require 'socket'
3862
+ #
3863
+ # p Socket::AncillaryData.int(:UNIX, :SOCKET, :RIGHTS, STDERR.fileno)
3864
+ # #=> #<Socket::AncillaryData: UNIX SOCKET RIGHTS 2>
3865
+ #
3866
+ def self.int: (Symbol, Symbol, Symbol, Symbol) -> instance
3867
+
3868
+ # <!--
3869
+ # rdoc-file=ext/socket/ancdata.c
3870
+ # - Socket::AncillaryData.ip_pktinfo(addr, ifindex) => ancdata
3871
+ # - Socket::AncillaryData.ip_pktinfo(addr, ifindex, spec_dst) => ancdata
3872
+ # -->
3873
+ # Returns new ancillary data for IP_PKTINFO.
3874
+ #
3875
+ # If spec_dst is not given, addr is used.
3876
+ #
3877
+ # IP_PKTINFO is not standard.
3878
+ #
3879
+ # Supported platform: GNU/Linux
3880
+ #
3881
+ # addr = Addrinfo.ip("127.0.0.1")
3882
+ # ifindex = 0
3883
+ # spec_dst = Addrinfo.ip("127.0.0.1")
3884
+ # p Socket::AncillaryData.ip_pktinfo(addr, ifindex, spec_dst)
3885
+ # #=> #<Socket::AncillaryData: INET IP PKTINFO 127.0.0.1 ifindex:0 spec_dst:127.0.0.1>
3886
+ #
3887
+ def self.ip_pktinfo: (Addrinfo addr, Integer ifindex, ?Addrinfo spec_dst) -> instance
3888
+
3889
+ # <!--
3890
+ # rdoc-file=ext/socket/ancdata.c
3891
+ # - Socket::AncillaryData.ipv6_pktinfo(addr, ifindex) => ancdata
3892
+ # -->
3893
+ # Returns new ancillary data for IPV6_PKTINFO.
3894
+ #
3895
+ # IPV6_PKTINFO is defined by RFC 3542.
3896
+ #
3897
+ # addr = Addrinfo.ip("::1")
3898
+ # ifindex = 0
3899
+ # p Socket::AncillaryData.ipv6_pktinfo(addr, ifindex)
3900
+ # #=> #<Socket::AncillaryData: INET6 IPV6 PKTINFO ::1 ifindex:0>
3901
+ #
3902
+ def self.ipv6_pktinfo: (Addrinfo addr, Integer ifindex) -> instance
3903
+
3904
+ # <!--
3905
+ # rdoc-file=ext/socket/ancdata.c
3906
+ # - Socket::AncillaryData.unix_rights(io1, io2, ...) => ancillarydata
3907
+ # -->
3908
+ # Creates a new Socket::AncillaryData object which contains file descriptors as
3909
+ # data.
3910
+ #
3911
+ # p Socket::AncillaryData.unix_rights(STDERR)
3912
+ # #=> #<Socket::AncillaryData: UNIX SOCKET RIGHTS 2>
3913
+ #
3914
+ def self.unix_rights: (IO fd) -> instance
3915
+
3916
+ # <!--
3917
+ # rdoc-file=ext/socket/ancdata.c
3918
+ # - ancillarydata.cmsg_is?(level, type) => true or false
3919
+ # -->
3920
+ # tests the level and type of *ancillarydata*.
3921
+ #
3922
+ # ancdata = Socket::AncillaryData.new(:INET6, :IPV6, :PKTINFO, "")
3923
+ # ancdata.cmsg_is?(Socket::IPPROTO_IPV6, Socket::IPV6_PKTINFO) #=> true
3924
+ # ancdata.cmsg_is?(:IPV6, :PKTINFO) #=> true
3925
+ # ancdata.cmsg_is?(:IP, :PKTINFO) #=> false
3926
+ # ancdata.cmsg_is?(:SOCKET, :RIGHTS) #=> false
3927
+ #
3928
+ def cmsg_is?: (Integer level, Integer ancillary_type) -> bool
3929
+
3930
+ # <!--
3931
+ # rdoc-file=ext/socket/ancdata.c
3932
+ # - ancillarydata.data => string
3933
+ # -->
3934
+ # returns the cmsg data as a string.
3935
+ #
3936
+ # p Socket::AncillaryData.new(:INET6, :IPV6, :PKTINFO, "").data
3937
+ # #=> ""
3938
+ #
3939
+ def data: () -> String
3940
+
3941
+ # <!--
3942
+ # rdoc-file=ext/socket/ancdata.c
3943
+ # - ancillarydata.family => integer
3944
+ # -->
3945
+ # returns the socket family as an integer.
3946
+ #
3947
+ # p Socket::AncillaryData.new(:INET6, :IPV6, :PKTINFO, "").family
3948
+ # #=> 10
3949
+ #
3950
+ def family: () -> Integer
3951
+
3952
+ # <!--
3953
+ # rdoc-file=ext/socket/ancdata.c
3954
+ # - ancillarydata.inspect => string
3955
+ # -->
3956
+ # returns a string which shows ancillarydata in human-readable form.
3957
+ #
3958
+ # p Socket::AncillaryData.new(:INET6, :IPV6, :PKTINFO, "").inspect
3959
+ # #=> "#<Socket::AncillaryData: INET6 IPV6 PKTINFO \"\">"
3960
+ #
3961
+ def inspect: () -> String
3962
+
3963
+ # <!--
3964
+ # rdoc-file=ext/socket/ancdata.c
3965
+ # - ancillarydata.int => integer
3966
+ # -->
3967
+ # Returns the data in *ancillarydata* as an int.
3968
+ #
3969
+ # The size and endian is dependent on the host.
3970
+ #
3971
+ # ancdata = Socket::AncillaryData.int(:UNIX, :SOCKET, :RIGHTS, STDERR.fileno)
3972
+ # p ancdata.int #=> 2
3973
+ #
3974
+ def int: () -> Integer
3975
+
3976
+ # <!--
3977
+ # rdoc-file=ext/socket/ancdata.c
3978
+ # - ancdata.ip_pktinfo => [addr, ifindex, spec_dst]
3979
+ # -->
3980
+ # Extracts addr, ifindex and spec_dst from IP_PKTINFO ancillary data.
3981
+ #
3982
+ # IP_PKTINFO is not standard.
3983
+ #
3984
+ # Supported platform: GNU/Linux
3985
+ #
3986
+ # addr = Addrinfo.ip("127.0.0.1")
3987
+ # ifindex = 0
3988
+ # spec_dest = Addrinfo.ip("127.0.0.1")
3989
+ # ancdata = Socket::AncillaryData.ip_pktinfo(addr, ifindex, spec_dest)
3990
+ # p ancdata.ip_pktinfo
3991
+ # #=> [#<Addrinfo: 127.0.0.1>, 0, #<Addrinfo: 127.0.0.1>]
3992
+ #
3993
+ def ip_pktinfo: () -> [ Addrinfo, Integer, Addrinfo ]
3994
+
3995
+ # <!--
3996
+ # rdoc-file=ext/socket/ancdata.c
3997
+ # - ancdata.ipv6_pktinfo => [addr, ifindex]
3998
+ # -->
3999
+ # Extracts addr and ifindex from IPV6_PKTINFO ancillary data.
4000
+ #
4001
+ # IPV6_PKTINFO is defined by RFC 3542.
4002
+ #
4003
+ # addr = Addrinfo.ip("::1")
4004
+ # ifindex = 0
4005
+ # ancdata = Socket::AncillaryData.ipv6_pktinfo(addr, ifindex)
4006
+ # p ancdata.ipv6_pktinfo #=> [#<Addrinfo: ::1>, 0]
4007
+ #
4008
+ def ipv6_pktinfo: () -> [ Addrinfo, Integer ]
4009
+
4010
+ # <!--
4011
+ # rdoc-file=ext/socket/ancdata.c
4012
+ # - ancdata.ipv6_pktinfo_addr => addr
4013
+ # -->
4014
+ # Extracts addr from IPV6_PKTINFO ancillary data.
4015
+ #
4016
+ # IPV6_PKTINFO is defined by RFC 3542.
4017
+ #
4018
+ # addr = Addrinfo.ip("::1")
4019
+ # ifindex = 0
4020
+ # ancdata = Socket::AncillaryData.ipv6_pktinfo(addr, ifindex)
4021
+ # p ancdata.ipv6_pktinfo_addr #=> #<Addrinfo: ::1>
4022
+ #
4023
+ def ipv6_pktinfo_addr: () -> Addrinfo
4024
+
4025
+ # <!--
4026
+ # rdoc-file=ext/socket/ancdata.c
4027
+ # - ancdata.ipv6_pktinfo_ifindex => addr
4028
+ # -->
4029
+ # Extracts ifindex from IPV6_PKTINFO ancillary data.
4030
+ #
4031
+ # IPV6_PKTINFO is defined by RFC 3542.
4032
+ #
4033
+ # addr = Addrinfo.ip("::1")
4034
+ # ifindex = 0
4035
+ # ancdata = Socket::AncillaryData.ipv6_pktinfo(addr, ifindex)
4036
+ # p ancdata.ipv6_pktinfo_ifindex #=> 0
4037
+ #
4038
+ def ipv6_pktinfo_ifindex: () -> Integer
4039
+
4040
+ # <!--
4041
+ # rdoc-file=ext/socket/ancdata.c
4042
+ # - ancillarydata.level => integer
4043
+ # -->
4044
+ # returns the cmsg level as an integer.
4045
+ #
4046
+ # p Socket::AncillaryData.new(:INET6, :IPV6, :PKTINFO, "").level
4047
+ # #=> 41
4048
+ #
4049
+ def level: () -> Integer
4050
+
4051
+ # <!--
4052
+ # rdoc-file=ext/socket/ancdata.c
4053
+ # - ancillarydata.timestamp => time
4054
+ # -->
4055
+ # returns the timestamp as a time object.
4056
+ #
4057
+ # *ancillarydata* should be one of following type:
4058
+ # * SOL_SOCKET/SCM_TIMESTAMP (microsecond) GNU/Linux, FreeBSD, NetBSD,
4059
+ # OpenBSD, Solaris, MacOS X
4060
+ # * SOL_SOCKET/SCM_TIMESTAMPNS (nanosecond) GNU/Linux
4061
+ # * SOL_SOCKET/SCM_BINTIME (2**(-64) second) FreeBSD
4062
+ #
4063
+ # Addrinfo.udp("127.0.0.1", 0).bind {|s1|
4064
+ # Addrinfo.udp("127.0.0.1", 0).bind {|s2|
4065
+ # s1.setsockopt(:SOCKET, :TIMESTAMP, true)
4066
+ # s2.send "a", 0, s1.local_address
4067
+ # ctl = s1.recvmsg.last
4068
+ # p ctl #=> #<Socket::AncillaryData: INET SOCKET TIMESTAMP 2009-02-24 17:35:46.775581>
4069
+ # t = ctl.timestamp
4070
+ # p t #=> 2009-02-24 17:35:46 +0900
4071
+ # p t.usec #=> 775581
4072
+ # p t.nsec #=> 775581000
4073
+ # }
4074
+ #
4075
+ # }
4076
+ #
4077
+ def timestamp: () -> Time
4078
+
4079
+ # <!--
4080
+ # rdoc-file=ext/socket/ancdata.c
4081
+ # - ancillarydata.type => integer
4082
+ # -->
4083
+ # returns the cmsg type as an integer.
4084
+ #
4085
+ # p Socket::AncillaryData.new(:INET6, :IPV6, :PKTINFO, "").type
4086
+ # #=> 2
4087
+ #
4088
+ def type: () -> Integer
4089
+
4090
+ # <!--
4091
+ # rdoc-file=ext/socket/ancdata.c
4092
+ # - ancillarydata.unix_rights => array-of-IOs or nil
4093
+ # -->
4094
+ # returns the array of IO objects for SCM_RIGHTS control message in UNIX domain
4095
+ # socket.
4096
+ #
4097
+ # The class of the IO objects in the array is IO or Socket.
4098
+ #
4099
+ # The array is attached to *ancillarydata* when it is instantiated. For example,
4100
+ # BasicSocket#recvmsg attach the array when receives a SCM_RIGHTS control
4101
+ # message and :scm_rights=>true option is given.
4102
+ #
4103
+ # # recvmsg needs :scm_rights=>true for unix_rights
4104
+ # s1, s2 = UNIXSocket.pair
4105
+ # p s1 #=> #<UNIXSocket:fd 3>
4106
+ # s1.sendmsg "stdin and a socket", 0, nil, Socket::AncillaryData.unix_rights(STDIN, s1)
4107
+ # _, _, _, ctl = s2.recvmsg(:scm_rights=>true)
4108
+ # p ctl #=> #<Socket::AncillaryData: UNIX SOCKET RIGHTS 6 7>
4109
+ # p ctl.unix_rights #=> [#<IO:fd 6>, #<Socket:fd 7>]
4110
+ # p File.identical?(STDIN, ctl.unix_rights[0]) #=> true
4111
+ # p File.identical?(s1, ctl.unix_rights[1]) #=> true
4112
+ #
4113
+ # # If :scm_rights=>true is not given, unix_rights returns nil
4114
+ # s1, s2 = UNIXSocket.pair
4115
+ # s1.sendmsg "stdin and a socket", 0, nil, Socket::AncillaryData.unix_rights(STDIN, s1)
4116
+ # _, _, _, ctl = s2.recvmsg
4117
+ # p ctl #=> #<Socket::AncillaryData: UNIX SOCKET RIGHTS 6 7>
4118
+ # p ctl.unix_rights #=> nil
4119
+ #
4120
+ def unix_rights: () -> Array[IO]?
4121
+
4122
+ private
4123
+
4124
+ # <!--
4125
+ # rdoc-file=ext/socket/ancdata.c
4126
+ # - Socket::AncillaryData.new(family, cmsg_level, cmsg_type, cmsg_data) -> ancillarydata
4127
+ # -->
4128
+ # *family* should be an integer, a string or a symbol.
4129
+ # * Socket::AF_INET, "AF_INET", "INET", :AF_INET, :INET
4130
+ # * Socket::AF_UNIX, "AF_UNIX", "UNIX", :AF_UNIX, :UNIX
4131
+ # * etc.
4132
+ #
4133
+ # *cmsg_level* should be an integer, a string or a symbol.
4134
+ # * Socket::SOL_SOCKET, "SOL_SOCKET", "SOCKET", :SOL_SOCKET and :SOCKET
4135
+ # * Socket::IPPROTO_IP, "IP" and :IP
4136
+ # * Socket::IPPROTO_IPV6, "IPV6" and :IPV6
4137
+ # * Socket::IPPROTO_TCP, "TCP" and :TCP
4138
+ # * etc.
4139
+ #
4140
+ # *cmsg_type* should be an integer, a string or a symbol. If a string/symbol is
4141
+ # specified, it is interpreted depend on *cmsg_level*.
4142
+ # * Socket::SCM_RIGHTS, "SCM_RIGHTS", "RIGHTS", :SCM_RIGHTS, :RIGHTS for
4143
+ # SOL_SOCKET
4144
+ # * Socket::IP_RECVTTL, "RECVTTL" and :RECVTTL for IPPROTO_IP
4145
+ # * Socket::IPV6_PKTINFO, "PKTINFO" and :PKTINFO for IPPROTO_IPV6
4146
+ # * etc.
4147
+ #
4148
+ # *cmsg_data* should be a string.
4149
+ #
4150
+ # p Socket::AncillaryData.new(:INET, :TCP, :NODELAY, "")
4151
+ # #=> #<Socket::AncillaryData: INET TCP NODELAY "">
4152
+ #
4153
+ # p Socket::AncillaryData.new(:INET6, :IPV6, :PKTINFO, "")
4154
+ # #=> #<Socket::AncillaryData: INET6 IPV6 PKTINFO "">
4155
+ #
4156
+ def initialize: (interned | Integer family, interned | Integer cmsg_level, interned | Integer cmsg_data, String cmsg_data) -> untyped
4157
+ end