rbs 4.1.0.pre.2-java

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