grpc 1.2.5 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grpc might be problematic. Click here for more details.

Files changed (327) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +1434 -399
  3. data/etc/roots.pem +34 -150
  4. data/include/grpc/grpc.h +71 -0
  5. data/include/grpc/impl/codegen/atm.h +5 -0
  6. data/include/grpc/impl/codegen/atm_gcc_atomic.h +6 -0
  7. data/include/grpc/impl/codegen/atm_gcc_sync.h +2 -0
  8. data/include/grpc/impl/codegen/atm_windows.h +11 -0
  9. data/include/grpc/impl/codegen/grpc_types.h +54 -13
  10. data/include/grpc/impl/codegen/port_platform.h +15 -1
  11. data/include/grpc/support/alloc.h +2 -1
  12. data/include/grpc/support/sync.h +4 -0
  13. data/include/grpc/support/tls.h +1 -1
  14. data/src/core/ext/census/gen/trace_context.pb.h +1 -1
  15. data/src/core/ext/census/grpc_filter.c +14 -10
  16. data/src/core/ext/census/grpc_plugin.c +3 -1
  17. data/src/core/ext/census/trace_label.h +1 -1
  18. data/src/core/ext/census/trace_propagation.h +1 -1
  19. data/src/core/ext/census/trace_status.h +1 -1
  20. data/src/core/ext/census/trace_string.h +1 -1
  21. data/src/core/ext/census/tracing.h +1 -1
  22. data/src/core/ext/{client_channel → filters/client_channel}/channel_connectivity.c +56 -27
  23. data/src/core/ext/{client_channel → filters/client_channel}/client_channel.c +407 -202
  24. data/src/core/ext/{client_channel → filters/client_channel}/client_channel.h +10 -6
  25. data/src/core/ext/{client_channel → filters/client_channel}/client_channel_factory.c +1 -1
  26. data/src/core/ext/{client_channel → filters/client_channel}/client_channel_factory.h +4 -4
  27. data/src/core/ext/{client_channel → filters/client_channel}/client_channel_plugin.c +12 -7
  28. data/src/core/ext/{client_channel → filters/client_channel}/connector.c +1 -1
  29. data/src/core/ext/{client_channel → filters/client_channel}/connector.h +3 -5
  30. data/src/core/ext/{client_channel → filters/client_channel}/http_connect_handshaker.c +6 -6
  31. data/src/core/ext/{client_channel → filters/client_channel}/http_connect_handshaker.h +3 -3
  32. data/src/core/ext/{client_channel → filters/client_channel}/http_proxy.c +4 -4
  33. data/src/core/ext/{client_channel → filters/client_channel}/http_proxy.h +3 -3
  34. data/src/core/ext/{client_channel → filters/client_channel}/lb_policy.c +1 -1
  35. data/src/core/ext/{client_channel → filters/client_channel}/lb_policy.h +4 -4
  36. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb.c +22 -20
  37. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb.h +4 -4
  38. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb_channel.h +5 -4
  39. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb_channel_secure.c +2 -2
  40. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/load_balancer_api.c +1 -1
  41. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/load_balancer_api.h +6 -5
  42. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +1 -1
  43. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +0 -0
  44. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/pick_first/pick_first.c +20 -15
  45. data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/round_robin/round_robin.c +21 -16
  46. data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_factory.c +1 -1
  47. data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_factory.h +5 -5
  48. data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_registry.c +1 -1
  49. data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_registry.h +4 -4
  50. data/src/core/ext/{client_channel → filters/client_channel}/parse_address.c +1 -1
  51. data/src/core/ext/{client_channel → filters/client_channel}/parse_address.h +4 -4
  52. data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper.c +1 -1
  53. data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper.h +3 -3
  54. data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper_registry.c +10 -4
  55. data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper_registry.h +4 -4
  56. data/src/core/ext/{client_channel → filters/client_channel}/resolver.c +1 -1
  57. data/src/core/ext/{client_channel → filters/client_channel}/resolver.h +4 -4
  58. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +350 -0
  59. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +66 -0
  60. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c +319 -0
  61. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +289 -0
  62. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +64 -0
  63. data/src/core/ext/{resolver → filters/client_channel/resolver}/dns/native/dns_resolver.c +21 -5
  64. data/src/core/ext/{resolver → filters/client_channel/resolver}/sockaddr/sockaddr_resolver.c +3 -3
  65. data/src/core/ext/{client_channel → filters/client_channel}/resolver_factory.c +1 -1
  66. data/src/core/ext/{client_channel → filters/client_channel}/resolver_factory.h +6 -6
  67. data/src/core/ext/{client_channel → filters/client_channel}/resolver_registry.c +1 -2
  68. data/src/core/ext/{client_channel → filters/client_channel}/resolver_registry.h +4 -4
  69. data/src/core/ext/filters/client_channel/retry_throttle.c +210 -0
  70. data/src/core/ext/filters/client_channel/retry_throttle.h +65 -0
  71. data/src/core/ext/{client_channel → filters/client_channel}/subchannel.c +49 -43
  72. data/src/core/ext/{client_channel → filters/client_channel}/subchannel.h +21 -7
  73. data/src/core/ext/{client_channel → filters/client_channel}/subchannel_index.c +1 -1
  74. data/src/core/ext/{client_channel → filters/client_channel}/subchannel_index.h +5 -5
  75. data/src/core/ext/{client_channel → filters/client_channel}/uri_parser.c +1 -1
  76. data/src/core/ext/{client_channel → filters/client_channel}/uri_parser.h +3 -3
  77. data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting.c +4 -2
  78. data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting.h +3 -3
  79. data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting_filter.c +17 -14
  80. data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting_filter.h +4 -4
  81. data/src/core/ext/filters/max_age/max_age_filter.c +439 -0
  82. data/src/core/ext/filters/max_age/max_age_filter.h +39 -0
  83. data/src/core/ext/transport/chttp2/client/chttp2_connector.c +6 -41
  84. data/src/core/ext/transport/chttp2/client/chttp2_connector.h +1 -1
  85. data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +2 -2
  86. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c +3 -3
  87. data/src/core/ext/transport/chttp2/server/chttp2_server.c +2 -2
  88. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +2 -5
  89. data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c +2 -2
  90. data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +449 -204
  91. data/src/core/ext/transport/chttp2/transport/frame_data.c +10 -7
  92. data/src/core/ext/transport/chttp2/transport/frame_goaway.c +3 -2
  93. data/src/core/ext/transport/chttp2/transport/frame_ping.c +37 -7
  94. data/src/core/ext/transport/chttp2/transport/frame_ping.h +3 -0
  95. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +4 -3
  96. data/src/core/ext/transport/chttp2/transport/frame_settings.c +18 -38
  97. data/src/core/ext/transport/chttp2/transport/frame_settings.h +1 -29
  98. data/src/core/ext/transport/chttp2/transport/frame_window_update.c +2 -2
  99. data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +64 -37
  100. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +11 -4
  101. data/src/core/ext/transport/chttp2/transport/hpack_parser.c +60 -39
  102. data/src/core/ext/transport/chttp2/transport/hpack_table.c +2 -2
  103. data/src/core/ext/transport/chttp2/transport/http2_settings.c +75 -0
  104. data/src/core/ext/transport/chttp2/transport/http2_settings.h +74 -0
  105. data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +22 -43
  106. data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +8 -10
  107. data/src/core/ext/transport/chttp2/transport/internal.h +24 -2
  108. data/src/core/ext/transport/chttp2/transport/parsing.c +33 -15
  109. data/src/core/ext/transport/chttp2/transport/writing.c +56 -10
  110. data/src/core/lib/channel/channel_args.c +7 -0
  111. data/src/core/lib/channel/channel_args.h +2 -0
  112. data/src/core/lib/channel/channel_stack.c +20 -27
  113. data/src/core/lib/channel/channel_stack.h +18 -16
  114. data/src/core/lib/channel/compress_filter.c +20 -18
  115. data/src/core/lib/channel/connected_channel.c +9 -8
  116. data/src/core/lib/channel/deadline_filter.c +28 -24
  117. data/src/core/lib/channel/deadline_filter.h +3 -3
  118. data/src/core/lib/channel/handshaker.c +3 -2
  119. data/src/core/lib/channel/http_client_filter.c +119 -61
  120. data/src/core/lib/channel/http_server_filter.c +124 -69
  121. data/src/core/lib/channel/message_size_filter.c +23 -19
  122. data/src/core/lib/http/httpcli.c +8 -6
  123. data/src/core/lib/http/httpcli_security_connector.c +5 -5
  124. data/src/core/lib/http/parser.c +57 -31
  125. data/src/core/lib/iomgr/closure.c +15 -0
  126. data/src/core/lib/iomgr/closure.h +4 -0
  127. data/src/core/lib/iomgr/combiner.c +8 -0
  128. data/src/core/lib/iomgr/endpoint_pair.h +2 -3
  129. data/src/core/lib/iomgr/endpoint_pair_posix.c +10 -7
  130. data/src/core/lib/iomgr/endpoint_pair_uv.c +2 -3
  131. data/src/core/lib/iomgr/endpoint_pair_windows.c +9 -6
  132. data/src/core/lib/iomgr/error.c +360 -177
  133. data/src/core/lib/iomgr/error.h +31 -33
  134. data/src/core/lib/iomgr/error_internal.h +30 -9
  135. data/src/core/lib/iomgr/ev_epoll_linux.c +25 -239
  136. data/src/core/lib/iomgr/ev_poll_posix.c +11 -7
  137. data/src/core/lib/iomgr/ev_posix.c +6 -0
  138. data/src/core/lib/iomgr/ev_posix.h +3 -0
  139. data/src/core/lib/iomgr/exec_ctx.c +6 -0
  140. data/src/core/lib/iomgr/executor.c +8 -2
  141. data/src/core/lib/iomgr/load_file.c +6 -3
  142. data/src/core/lib/iomgr/lockfree_event.c +238 -0
  143. data/src/core/{ext/client_channel/initial_connect_string.h → lib/iomgr/lockfree_event.h} +17 -13
  144. data/src/core/lib/iomgr/pollset.h +4 -0
  145. data/src/core/lib/iomgr/pollset_windows.c +2 -2
  146. data/src/core/lib/iomgr/port.h +9 -0
  147. data/src/core/lib/iomgr/resolve_address_posix.c +15 -9
  148. data/src/core/lib/iomgr/resolve_address_uv.c +8 -6
  149. data/src/core/lib/iomgr/resolve_address_windows.c +2 -2
  150. data/src/core/lib/iomgr/resource_quota.c +19 -4
  151. data/src/core/lib/iomgr/resource_quota.h +2 -0
  152. data/src/core/lib/iomgr/sockaddr_utils.c +3 -1
  153. data/src/core/lib/iomgr/socket_factory_posix.c +110 -0
  154. data/src/core/lib/iomgr/socket_factory_posix.h +90 -0
  155. data/src/core/lib/iomgr/socket_utils_common_posix.c +25 -9
  156. data/src/core/lib/iomgr/socket_utils_posix.h +7 -0
  157. data/src/core/lib/iomgr/tcp_client.h +0 -4
  158. data/src/core/lib/iomgr/tcp_client_posix.c +15 -31
  159. data/src/core/lib/iomgr/tcp_client_uv.c +10 -6
  160. data/src/core/lib/iomgr/tcp_client_windows.c +9 -19
  161. data/src/core/lib/iomgr/tcp_posix.c +111 -22
  162. data/src/core/lib/iomgr/tcp_posix.h +3 -4
  163. data/src/core/lib/iomgr/tcp_server_posix.c +39 -417
  164. data/src/core/lib/iomgr/tcp_server_utils_posix.h +135 -0
  165. data/src/core/lib/iomgr/tcp_server_utils_posix_common.c +221 -0
  166. data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.c +196 -0
  167. data/src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.c +49 -0
  168. data/src/core/lib/iomgr/tcp_server_uv.c +43 -16
  169. data/src/core/lib/iomgr/tcp_server_windows.c +10 -22
  170. data/src/core/lib/iomgr/tcp_uv.c +16 -13
  171. data/src/core/lib/iomgr/tcp_windows.c +24 -12
  172. data/src/core/lib/iomgr/tcp_windows.h +2 -2
  173. data/src/core/lib/iomgr/timer.h +3 -0
  174. data/src/core/lib/iomgr/timer_generic.c +257 -72
  175. data/src/core/lib/iomgr/timer_generic.h +1 -1
  176. data/src/core/lib/iomgr/timer_heap.c +8 -8
  177. data/src/core/lib/iomgr/udp_server.c +54 -24
  178. data/src/core/lib/iomgr/udp_server.h +7 -7
  179. data/src/core/lib/iomgr/unix_sockets_posix.c +1 -1
  180. data/src/core/lib/iomgr/unix_sockets_posix_noop.c +2 -1
  181. data/src/core/lib/iomgr/wakeup_fd_posix.h +1 -1
  182. data/src/core/lib/profiling/basic_timers.c +1 -1
  183. data/src/core/lib/security/credentials/credentials.h +1 -1
  184. data/src/core/lib/security/credentials/google_default/google_default_credentials.c +10 -9
  185. data/src/core/lib/security/credentials/jwt/json_token.c +1 -1
  186. data/src/core/lib/security/credentials/jwt/jwt_verifier.c +2 -2
  187. data/src/core/lib/security/transport/client_auth_filter.c +33 -26
  188. data/src/core/lib/security/transport/secure_endpoint.c +8 -5
  189. data/src/core/lib/security/transport/security_connector.c +37 -37
  190. data/src/core/lib/security/transport/security_connector.h +1 -1
  191. data/src/core/lib/security/transport/security_handshaker.c +15 -12
  192. data/src/core/lib/security/transport/server_auth_filter.c +20 -18
  193. data/src/core/lib/security/transport/tsi_error.c +5 -3
  194. data/src/core/lib/security/transport/tsi_error.h +1 -1
  195. data/src/core/lib/{security/util → slice}/b64.c +21 -6
  196. data/src/core/lib/{security/util → slice}/b64.h +16 -4
  197. data/src/core/lib/slice/slice.c +4 -2
  198. data/src/core/lib/slice/slice_buffer.c +16 -14
  199. data/src/core/lib/support/arena.c +98 -0
  200. data/src/core/{ext/client_channel/initial_connect_string.c → lib/support/arena.h} +17 -15
  201. data/src/core/{ext/client_channel/default_initial_connect_string.c → lib/support/atm.c} +14 -5
  202. data/src/core/lib/support/cpu_linux.c +5 -0
  203. data/src/core/lib/support/sync.c +4 -0
  204. data/src/core/lib/support/time.c +4 -10
  205. data/src/core/lib/support/wrap_memcpy.c +3 -1
  206. data/src/core/lib/surface/call.c +252 -221
  207. data/src/core/lib/surface/channel.c +72 -21
  208. data/src/core/lib/surface/channel.h +8 -0
  209. data/src/core/lib/surface/completion_queue.c +2 -3
  210. data/src/core/lib/surface/completion_queue_factory.c +77 -0
  211. data/src/core/lib/surface/completion_queue_factory.h +51 -0
  212. data/src/core/lib/surface/init_secure.c +3 -1
  213. data/src/core/lib/surface/lame_client.c +18 -14
  214. data/src/core/lib/surface/server.c +43 -41
  215. data/src/core/lib/surface/validate_metadata.c +8 -4
  216. data/src/core/lib/surface/version.c +2 -2
  217. data/src/core/lib/transport/bdp_estimator.h +1 -1
  218. data/src/core/lib/transport/connectivity_state.c +2 -1
  219. data/src/core/lib/transport/error_utils.c +17 -17
  220. data/src/core/lib/transport/error_utils.h +1 -1
  221. data/src/core/lib/transport/metadata_batch.c +6 -7
  222. data/src/core/lib/transport/pid_controller.c +1 -0
  223. data/src/core/lib/transport/service_config.c +12 -0
  224. data/src/core/lib/transport/service_config.h +6 -0
  225. data/src/core/lib/transport/transport.c +29 -17
  226. data/src/core/lib/transport/transport.h +85 -42
  227. data/src/core/lib/transport/transport_impl.h +5 -3
  228. data/src/core/lib/transport/transport_op_string.c +20 -14
  229. data/src/core/plugin_registry/grpc_plugin_registry.c +8 -0
  230. data/src/core/{lib/tsi → tsi}/fake_transport_security.c +2 -2
  231. data/src/core/{lib/tsi → tsi}/fake_transport_security.h +4 -4
  232. data/src/core/{lib/tsi → tsi}/ssl_transport_security.c +40 -79
  233. data/src/core/{lib/tsi → tsi}/ssl_transport_security.h +44 -21
  234. data/src/core/{lib/tsi → tsi}/ssl_types.h +3 -3
  235. data/src/core/{lib/tsi → tsi}/transport_security.c +2 -2
  236. data/src/core/{lib/tsi → tsi}/transport_security.h +4 -4
  237. data/src/core/{lib/tsi → tsi}/transport_security_interface.h +3 -3
  238. data/src/ruby/ext/grpc/extconf.rb +1 -0
  239. data/src/ruby/ext/grpc/rb_call_credentials.c +2 -2
  240. data/src/ruby/ext/grpc/rb_channel.c +520 -93
  241. data/src/ruby/ext/grpc/rb_channel.h +2 -0
  242. data/src/ruby/ext/grpc/rb_channel_credentials.c +3 -0
  243. data/src/ruby/ext/grpc/rb_compression_options.c +5 -2
  244. data/src/ruby/ext/grpc/rb_event_thread.c +6 -6
  245. data/src/ruby/ext/grpc/rb_grpc.c +29 -7
  246. data/src/ruby/ext/grpc/rb_grpc.h +2 -0
  247. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +10 -0
  248. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +15 -0
  249. data/src/ruby/ext/grpc/rb_server.c +5 -3
  250. data/src/ruby/lib/grpc/version.rb +1 -1
  251. data/src/ruby/spec/channel_connection_spec.rb +173 -0
  252. data/src/ruby/spec/channel_spec.rb +29 -0
  253. data/src/ruby/spec/generic/rpc_server_pool_spec.rb +27 -17
  254. data/third_party/cares/ares_build.h +264 -0
  255. data/third_party/cares/cares/ares.h +636 -0
  256. data/third_party/cares/cares/ares__close_sockets.c +61 -0
  257. data/third_party/cares/cares/ares__get_hostent.c +261 -0
  258. data/third_party/cares/cares/ares__read_line.c +73 -0
  259. data/third_party/cares/cares/ares__timeval.c +111 -0
  260. data/third_party/cares/cares/ares_cancel.c +63 -0
  261. data/third_party/cares/cares/ares_create_query.c +202 -0
  262. data/third_party/cares/cares/ares_data.c +221 -0
  263. data/third_party/cares/cares/ares_data.h +72 -0
  264. data/third_party/cares/cares/ares_destroy.c +108 -0
  265. data/third_party/cares/cares/ares_dns.h +103 -0
  266. data/third_party/cares/cares/ares_expand_name.c +205 -0
  267. data/third_party/cares/cares/ares_expand_string.c +70 -0
  268. data/third_party/cares/cares/ares_fds.c +59 -0
  269. data/third_party/cares/cares/ares_free_hostent.c +41 -0
  270. data/third_party/cares/cares/ares_free_string.c +25 -0
  271. data/third_party/cares/cares/ares_getenv.c +30 -0
  272. data/third_party/cares/cares/ares_getenv.h +26 -0
  273. data/third_party/cares/cares/ares_gethostbyaddr.c +294 -0
  274. data/third_party/cares/cares/ares_gethostbyname.c +518 -0
  275. data/third_party/cares/cares/ares_getnameinfo.c +422 -0
  276. data/third_party/cares/cares/ares_getopt.c +122 -0
  277. data/third_party/cares/cares/ares_getopt.h +53 -0
  278. data/third_party/cares/cares/ares_getsock.c +66 -0
  279. data/third_party/cares/cares/ares_inet_net_pton.h +25 -0
  280. data/third_party/cares/cares/ares_init.c +2146 -0
  281. data/third_party/cares/cares/ares_iphlpapi.h +221 -0
  282. data/third_party/cares/cares/ares_ipv6.h +78 -0
  283. data/third_party/cares/cares/ares_library_init.c +167 -0
  284. data/third_party/cares/cares/ares_library_init.h +42 -0
  285. data/third_party/cares/cares/ares_llist.c +63 -0
  286. data/third_party/cares/cares/ares_llist.h +39 -0
  287. data/third_party/cares/cares/ares_mkquery.c +24 -0
  288. data/third_party/cares/cares/ares_nowarn.c +260 -0
  289. data/third_party/cares/cares/ares_nowarn.h +61 -0
  290. data/third_party/cares/cares/ares_options.c +402 -0
  291. data/third_party/cares/cares/ares_parse_a_reply.c +264 -0
  292. data/third_party/cares/cares/ares_parse_aaaa_reply.c +264 -0
  293. data/third_party/cares/cares/ares_parse_mx_reply.c +170 -0
  294. data/third_party/cares/cares/ares_parse_naptr_reply.c +188 -0
  295. data/third_party/cares/cares/ares_parse_ns_reply.c +183 -0
  296. data/third_party/cares/cares/ares_parse_ptr_reply.c +219 -0
  297. data/third_party/cares/cares/ares_parse_soa_reply.c +133 -0
  298. data/third_party/cares/cares/ares_parse_srv_reply.c +179 -0
  299. data/third_party/cares/cares/ares_parse_txt_reply.c +220 -0
  300. data/third_party/cares/cares/ares_platform.c +11035 -0
  301. data/third_party/cares/cares/ares_platform.h +43 -0
  302. data/third_party/cares/cares/ares_private.h +363 -0
  303. data/third_party/cares/cares/ares_process.c +1359 -0
  304. data/third_party/cares/cares/ares_query.c +186 -0
  305. data/third_party/cares/cares/ares_rules.h +125 -0
  306. data/third_party/cares/cares/ares_search.c +316 -0
  307. data/third_party/cares/cares/ares_send.c +131 -0
  308. data/third_party/cares/cares/ares_setup.h +217 -0
  309. data/third_party/cares/cares/ares_strcasecmp.c +66 -0
  310. data/third_party/cares/cares/ares_strcasecmp.h +30 -0
  311. data/third_party/cares/cares/ares_strdup.c +49 -0
  312. data/third_party/cares/cares/ares_strdup.h +24 -0
  313. data/third_party/cares/cares/ares_strerror.c +56 -0
  314. data/third_party/cares/cares/ares_timeout.c +88 -0
  315. data/third_party/cares/cares/ares_version.c +11 -0
  316. data/third_party/cares/cares/ares_version.h +24 -0
  317. data/third_party/cares/cares/ares_writev.c +79 -0
  318. data/third_party/cares/cares/bitncmp.c +59 -0
  319. data/third_party/cares/cares/bitncmp.h +26 -0
  320. data/third_party/cares/cares/config-win32.h +377 -0
  321. data/third_party/cares/cares/inet_net_pton.c +450 -0
  322. data/third_party/cares/cares/inet_ntop.c +208 -0
  323. data/third_party/cares/cares/setup_once.h +554 -0
  324. data/third_party/cares/cares/windows_port.c +22 -0
  325. data/third_party/cares/config_darwin/ares_config.h +523 -0
  326. data/third_party/cares/config_linux/ares_config.h +524 -0
  327. metadata +164 -68
@@ -0,0 +1,422 @@
1
+
2
+ /* Copyright 2005 by Dominick Meglio
3
+ *
4
+ * Permission to use, copy, modify, and distribute this
5
+ * software and its documentation for any purpose and without
6
+ * fee is hereby granted, provided that the above copyright
7
+ * notice appear in all copies and that both that copyright
8
+ * notice and this permission notice appear in supporting
9
+ * documentation, and that the name of M.I.T. not be used in
10
+ * advertising or publicity pertaining to distribution of the
11
+ * software without specific, written prior permission.
12
+ * M.I.T. makes no representations about the suitability of
13
+ * this software for any purpose. It is provided "as is"
14
+ * without express or implied warranty.
15
+ */
16
+ #include "ares_setup.h"
17
+
18
+ #ifdef HAVE_GETSERVBYPORT_R
19
+ # if !defined(GETSERVBYPORT_R_ARGS) || \
20
+ (GETSERVBYPORT_R_ARGS < 4) || (GETSERVBYPORT_R_ARGS > 6)
21
+ # error "you MUST specifiy a valid number of arguments for getservbyport_r"
22
+ # endif
23
+ #endif
24
+
25
+ #ifdef HAVE_NETINET_IN_H
26
+ # include <netinet/in.h>
27
+ #endif
28
+ #ifdef HAVE_NETDB_H
29
+ # include <netdb.h>
30
+ #endif
31
+ #ifdef HAVE_ARPA_INET_H
32
+ # include <arpa/inet.h>
33
+ #endif
34
+ #ifdef HAVE_ARPA_NAMESER_H
35
+ # include <arpa/nameser.h>
36
+ #else
37
+ # include "nameser.h"
38
+ #endif
39
+ #ifdef HAVE_ARPA_NAMESER_COMPAT_H
40
+ # include <arpa/nameser_compat.h>
41
+ #endif
42
+
43
+ #ifdef HAVE_NET_IF_H
44
+ #include <net/if.h>
45
+ #endif
46
+
47
+ #include "ares.h"
48
+ #include "ares_ipv6.h"
49
+ #include "ares_nowarn.h"
50
+ #include "ares_private.h"
51
+
52
+ struct nameinfo_query {
53
+ ares_nameinfo_callback callback;
54
+ void *arg;
55
+ union {
56
+ struct sockaddr_in addr4;
57
+ struct sockaddr_in6 addr6;
58
+ } addr;
59
+ int family;
60
+ int flags;
61
+ int timeouts;
62
+ };
63
+
64
+ #ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
65
+ #define IPBUFSIZ \
66
+ (sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255") + IF_NAMESIZE)
67
+ #else
68
+ #define IPBUFSIZ \
69
+ (sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"))
70
+ #endif
71
+
72
+ static void nameinfo_callback(void *arg, int status, int timeouts,
73
+ struct hostent *host);
74
+ static char *lookup_service(unsigned short port, int flags,
75
+ char *buf, size_t buflen);
76
+ #ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
77
+ static void append_scopeid(struct sockaddr_in6 *addr6, unsigned int scopeid,
78
+ char *buf, size_t buflen);
79
+ #endif
80
+ STATIC_TESTABLE char *ares_striendstr(const char *s1, const char *s2);
81
+
82
+ void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa,
83
+ ares_socklen_t salen,
84
+ int flags, ares_nameinfo_callback callback, void *arg)
85
+ {
86
+ struct sockaddr_in *addr = NULL;
87
+ struct sockaddr_in6 *addr6 = NULL;
88
+ struct nameinfo_query *niquery;
89
+ unsigned int port = 0;
90
+
91
+ /* Validate socket address family and length */
92
+ if ((sa->sa_family == AF_INET) &&
93
+ (salen == sizeof(struct sockaddr_in)))
94
+ {
95
+ addr = (struct sockaddr_in *)sa;
96
+ port = addr->sin_port;
97
+ }
98
+ else if ((sa->sa_family == AF_INET6) &&
99
+ (salen == sizeof(struct sockaddr_in6)))
100
+ {
101
+ addr6 = (struct sockaddr_in6 *)sa;
102
+ port = addr6->sin6_port;
103
+ }
104
+ else
105
+ {
106
+ callback(arg, ARES_ENOTIMP, 0, NULL, NULL);
107
+ return;
108
+ }
109
+
110
+ /* If neither, assume they want a host */
111
+ if (!(flags & ARES_NI_LOOKUPSERVICE) && !(flags & ARES_NI_LOOKUPHOST))
112
+ flags |= ARES_NI_LOOKUPHOST;
113
+
114
+ /* All they want is a service, no need for DNS */
115
+ if ((flags & ARES_NI_LOOKUPSERVICE) && !(flags & ARES_NI_LOOKUPHOST))
116
+ {
117
+ char buf[33], *service;
118
+
119
+ service = lookup_service((unsigned short)(port & 0xffff),
120
+ flags, buf, sizeof(buf));
121
+ callback(arg, ARES_SUCCESS, 0, NULL, service);
122
+ return;
123
+ }
124
+
125
+ /* They want a host lookup */
126
+ if ((flags & ARES_NI_LOOKUPHOST))
127
+ {
128
+ /* A numeric host can be handled without DNS */
129
+ if ((flags & ARES_NI_NUMERICHOST))
130
+ {
131
+ char ipbuf[IPBUFSIZ];
132
+ char srvbuf[33];
133
+ char *service = NULL;
134
+ ipbuf[0] = 0;
135
+
136
+ /* Specifying not to lookup a host, but then saying a host
137
+ * is required has to be illegal.
138
+ */
139
+ if (flags & ARES_NI_NAMEREQD)
140
+ {
141
+ callback(arg, ARES_EBADFLAGS, 0, NULL, NULL);
142
+ return;
143
+ }
144
+ if (salen == sizeof(struct sockaddr_in6))
145
+ {
146
+ ares_inet_ntop(AF_INET6, &addr6->sin6_addr, ipbuf, IPBUFSIZ);
147
+ /* If the system supports scope IDs, use it */
148
+ #ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
149
+ append_scopeid(addr6, flags, ipbuf, sizeof(ipbuf));
150
+ #endif
151
+ }
152
+ else
153
+ {
154
+ ares_inet_ntop(AF_INET, &addr->sin_addr, ipbuf, IPBUFSIZ);
155
+ }
156
+ /* They also want a service */
157
+ if (flags & ARES_NI_LOOKUPSERVICE)
158
+ service = lookup_service((unsigned short)(port & 0xffff),
159
+ flags, srvbuf, sizeof(srvbuf));
160
+ callback(arg, ARES_SUCCESS, 0, ipbuf, service);
161
+ return;
162
+ }
163
+ /* This is where a DNS lookup becomes necessary */
164
+ else
165
+ {
166
+ niquery = ares_malloc(sizeof(struct nameinfo_query));
167
+ if (!niquery)
168
+ {
169
+ callback(arg, ARES_ENOMEM, 0, NULL, NULL);
170
+ return;
171
+ }
172
+ niquery->callback = callback;
173
+ niquery->arg = arg;
174
+ niquery->flags = flags;
175
+ niquery->timeouts = 0;
176
+ if (sa->sa_family == AF_INET)
177
+ {
178
+ niquery->family = AF_INET;
179
+ memcpy(&niquery->addr.addr4, addr, sizeof(niquery->addr.addr4));
180
+ ares_gethostbyaddr(channel, &addr->sin_addr,
181
+ sizeof(struct in_addr), AF_INET,
182
+ nameinfo_callback, niquery);
183
+ }
184
+ else
185
+ {
186
+ niquery->family = AF_INET6;
187
+ memcpy(&niquery->addr.addr6, addr6, sizeof(niquery->addr.addr6));
188
+ ares_gethostbyaddr(channel, &addr6->sin6_addr,
189
+ sizeof(struct ares_in6_addr), AF_INET6,
190
+ nameinfo_callback, niquery);
191
+ }
192
+ }
193
+ }
194
+ }
195
+
196
+ static void nameinfo_callback(void *arg, int status, int timeouts,
197
+ struct hostent *host)
198
+ {
199
+ struct nameinfo_query *niquery = (struct nameinfo_query *) arg;
200
+ char srvbuf[33];
201
+ char *service = NULL;
202
+
203
+ niquery->timeouts += timeouts;
204
+ if (status == ARES_SUCCESS)
205
+ {
206
+ /* They want a service too */
207
+ if (niquery->flags & ARES_NI_LOOKUPSERVICE)
208
+ {
209
+ if (niquery->family == AF_INET)
210
+ service = lookup_service(niquery->addr.addr4.sin_port,
211
+ niquery->flags, srvbuf, sizeof(srvbuf));
212
+ else
213
+ service = lookup_service(niquery->addr.addr6.sin6_port,
214
+ niquery->flags, srvbuf, sizeof(srvbuf));
215
+ }
216
+ /* NOFQDN means we have to strip off the domain name portion. We do
217
+ this by determining our own domain name, then searching the string
218
+ for this domain name and removing it.
219
+ */
220
+ #ifdef HAVE_GETHOSTNAME
221
+ if (niquery->flags & ARES_NI_NOFQDN)
222
+ {
223
+ char buf[255];
224
+ char *domain;
225
+ gethostname(buf, 255);
226
+ if ((domain = strchr(buf, '.')) != NULL)
227
+ {
228
+ char *end = ares_striendstr(host->h_name, domain);
229
+ if (end)
230
+ *end = 0;
231
+ }
232
+ }
233
+ #endif
234
+ niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts,
235
+ (char *)(host->h_name),
236
+ service);
237
+ ares_free(niquery);
238
+ return;
239
+ }
240
+ /* We couldn't find the host, but it's OK, we can use the IP */
241
+ else if (status == ARES_ENOTFOUND && !(niquery->flags & ARES_NI_NAMEREQD))
242
+ {
243
+ char ipbuf[IPBUFSIZ];
244
+ if (niquery->family == AF_INET)
245
+ ares_inet_ntop(AF_INET, &niquery->addr.addr4.sin_addr, ipbuf,
246
+ IPBUFSIZ);
247
+ else
248
+ {
249
+ ares_inet_ntop(AF_INET6, &niquery->addr.addr6.sin6_addr, ipbuf,
250
+ IPBUFSIZ);
251
+ #ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
252
+ append_scopeid(&niquery->addr.addr6, niquery->flags, ipbuf,
253
+ sizeof(ipbuf));
254
+ #endif
255
+ }
256
+ /* They want a service too */
257
+ if (niquery->flags & ARES_NI_LOOKUPSERVICE)
258
+ {
259
+ if (niquery->family == AF_INET)
260
+ service = lookup_service(niquery->addr.addr4.sin_port,
261
+ niquery->flags, srvbuf, sizeof(srvbuf));
262
+ else
263
+ service = lookup_service(niquery->addr.addr6.sin6_port,
264
+ niquery->flags, srvbuf, sizeof(srvbuf));
265
+ }
266
+ niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts, ipbuf,
267
+ service);
268
+ ares_free(niquery);
269
+ return;
270
+ }
271
+ niquery->callback(niquery->arg, status, niquery->timeouts, NULL, NULL);
272
+ ares_free(niquery);
273
+ }
274
+
275
+ static char *lookup_service(unsigned short port, int flags,
276
+ char *buf, size_t buflen)
277
+ {
278
+ const char *proto;
279
+ struct servent *sep;
280
+ #ifdef HAVE_GETSERVBYPORT_R
281
+ struct servent se;
282
+ #endif
283
+ char tmpbuf[4096];
284
+ char *name;
285
+ size_t name_len;
286
+
287
+ if (port)
288
+ {
289
+ if (flags & ARES_NI_NUMERICSERV)
290
+ sep = NULL;
291
+ else
292
+ {
293
+ if (flags & ARES_NI_UDP)
294
+ proto = "udp";
295
+ else if (flags & ARES_NI_SCTP)
296
+ proto = "sctp";
297
+ else if (flags & ARES_NI_DCCP)
298
+ proto = "dccp";
299
+ else
300
+ proto = "tcp";
301
+ #ifdef HAVE_GETSERVBYPORT_R
302
+ memset(&se, 0, sizeof(se));
303
+ sep = &se;
304
+ memset(tmpbuf, 0, sizeof(tmpbuf));
305
+ #if GETSERVBYPORT_R_ARGS == 6
306
+ if (getservbyport_r(port, proto, &se, (void *)tmpbuf,
307
+ sizeof(tmpbuf), &sep) != 0)
308
+ sep = NULL; /* LCOV_EXCL_LINE: buffer large so this never fails */
309
+ #elif GETSERVBYPORT_R_ARGS == 5
310
+ sep = getservbyport_r(port, proto, &se, (void *)tmpbuf,
311
+ sizeof(tmpbuf));
312
+ #elif GETSERVBYPORT_R_ARGS == 4
313
+ if (getservbyport_r(port, proto, &se, (void *)tmpbuf) != 0)
314
+ sep = NULL;
315
+ #else
316
+ /* Lets just hope the OS uses TLS! */
317
+ sep = getservbyport(port, proto);
318
+ #endif
319
+ #else
320
+ /* Lets just hope the OS uses TLS! */
321
+ #if (defined(NETWARE) && !defined(__NOVELL_LIBC__))
322
+ sep = getservbyport(port, (char*)proto);
323
+ #else
324
+ sep = getservbyport(port, proto);
325
+ #endif
326
+ #endif
327
+ }
328
+ if (sep && sep->s_name)
329
+ {
330
+ /* get service name */
331
+ name = sep->s_name;
332
+ }
333
+ else
334
+ {
335
+ /* get port as a string */
336
+ sprintf(tmpbuf, "%u", (unsigned int)ntohs(port));
337
+ name = tmpbuf;
338
+ }
339
+ name_len = strlen(name);
340
+ if (name_len < buflen)
341
+ /* return it if buffer big enough */
342
+ memcpy(buf, name, name_len + 1);
343
+ else
344
+ /* avoid reusing previous one */
345
+ buf[0] = '\0'; /* LCOV_EXCL_LINE: no real service names are too big */
346
+ return buf;
347
+ }
348
+ buf[0] = '\0';
349
+ return NULL;
350
+ }
351
+
352
+ #ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
353
+ static void append_scopeid(struct sockaddr_in6 *addr6, unsigned int flags,
354
+ char *buf, size_t buflen)
355
+ {
356
+ #ifdef HAVE_IF_INDEXTONAME
357
+ int is_ll, is_mcll;
358
+ #endif
359
+ static const char fmt_u[] = "%u";
360
+ static const char fmt_lu[] = "%lu";
361
+ char tmpbuf[IF_NAMESIZE + 2];
362
+ size_t bufl;
363
+ const char *fmt = (sizeof(addr6->sin6_scope_id) > sizeof(unsigned int))?
364
+ fmt_lu:fmt_u;
365
+
366
+ tmpbuf[0] = '%';
367
+
368
+ #ifdef HAVE_IF_INDEXTONAME
369
+ is_ll = IN6_IS_ADDR_LINKLOCAL(&addr6->sin6_addr);
370
+ is_mcll = IN6_IS_ADDR_MC_LINKLOCAL(&addr6->sin6_addr);
371
+ if ((flags & ARES_NI_NUMERICSCOPE) ||
372
+ (!is_ll && !is_mcll))
373
+ {
374
+ sprintf(&tmpbuf[1], fmt, addr6->sin6_scope_id);
375
+ }
376
+ else
377
+ {
378
+ if (if_indextoname(addr6->sin6_scope_id, &tmpbuf[1]) == NULL)
379
+ sprintf(&tmpbuf[1], fmt, addr6->sin6_scope_id);
380
+ }
381
+ #else
382
+ sprintf(&tmpbuf[1], fmt, addr6->sin6_scope_id);
383
+ (void) flags;
384
+ #endif
385
+ tmpbuf[IF_NAMESIZE + 1] = '\0';
386
+ bufl = strlen(buf);
387
+
388
+ if(bufl + strlen(tmpbuf) < buflen)
389
+ /* only append the scopeid string if it fits in the target buffer */
390
+ strcpy(&buf[bufl], tmpbuf);
391
+ }
392
+ #endif
393
+
394
+ /* Determines if s1 ends with the string in s2 (case-insensitive) */
395
+ STATIC_TESTABLE char *ares_striendstr(const char *s1, const char *s2)
396
+ {
397
+ const char *c1, *c2, *c1_begin;
398
+ int lo1, lo2;
399
+ size_t s1_len = strlen(s1), s2_len = strlen(s2);
400
+
401
+ /* If the substr is longer than the full str, it can't match */
402
+ if (s2_len > s1_len)
403
+ return NULL;
404
+
405
+ /* Jump to the end of s1 minus the length of s2 */
406
+ c1_begin = s1+s1_len-s2_len;
407
+ c1 = (const char *)c1_begin;
408
+ c2 = s2;
409
+ while (c2 < s2+s2_len)
410
+ {
411
+ lo1 = TOLOWER(*c1);
412
+ lo2 = TOLOWER(*c2);
413
+ if (lo1 != lo2)
414
+ return NULL;
415
+ else
416
+ {
417
+ c1++;
418
+ c2++;
419
+ }
420
+ }
421
+ return (char *)c1_begin;
422
+ }
@@ -0,0 +1,122 @@
1
+ /*
2
+ * Original file name getopt.c Initial import into the c-ares source tree
3
+ * on 2007-04-11. Lifted from version 5.2 of the 'Open Mash' project with
4
+ * the modified BSD license, BSD license without the advertising clause.
5
+ *
6
+ */
7
+
8
+ /*
9
+ * getopt.c --
10
+ *
11
+ * Standard UNIX getopt function. Code is from BSD.
12
+ *
13
+ * Copyright (c) 1987-2001 The Regents of the University of California.
14
+ * All rights reserved.
15
+ *
16
+ * Redistribution and use in source and binary forms, with or without
17
+ * modification, are permitted provided that the following conditions are met:
18
+ *
19
+ * A. Redistributions of source code must retain the above copyright notice,
20
+ * this list of conditions and the following disclaimer.
21
+ * B. Redistributions in binary form must reproduce the above copyright notice,
22
+ * this list of conditions and the following disclaimer in the documentation
23
+ * and/or other materials provided with the distribution.
24
+ * C. Neither the names of the copyright holders nor the names of its
25
+ * contributors may be used to endorse or promote products derived from this
26
+ * software without specific prior written permission.
27
+ *
28
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
29
+ * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
30
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
32
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38
+ * POSSIBILITY OF SUCH DAMAGE.
39
+ */
40
+
41
+ /* #if !defined(lint)
42
+ * static char sccsid[] = "@(#)getopt.c 8.2 (Berkeley) 4/2/94";
43
+ * #endif
44
+ */
45
+
46
+ #include <stdio.h>
47
+ #include <stdlib.h>
48
+ #include <string.h>
49
+ #include "ares_getopt.h"
50
+
51
+ int opterr = 1, /* if error message should be printed */
52
+ optind = 1; /* index into parent argv vector */
53
+ int optopt = 0; /* character checked for validity */
54
+ static int optreset; /* reset getopt */
55
+ char *optarg; /* argument associated with option */
56
+
57
+ #define BADCH (int)'?'
58
+ #define BADARG (int)':'
59
+ #define EMSG (char *)""
60
+
61
+ /*
62
+ * ares_getopt --
63
+ * Parse argc/argv argument vector.
64
+ */
65
+ int
66
+ ares_getopt(int nargc, char * const nargv[], const char *ostr)
67
+ {
68
+ static char *place = EMSG; /* option letter processing */
69
+ char *oli; /* option letter list index */
70
+
71
+ if (optreset || !*place) { /* update scanning pointer */
72
+ optreset = 0;
73
+ if (optind >= nargc || *(place = nargv[optind]) != '-') {
74
+ place = EMSG;
75
+ return (EOF);
76
+ }
77
+ if (place[1] && *++place == '-') { /* found "--" */
78
+ ++optind;
79
+ place = EMSG;
80
+ return (EOF);
81
+ }
82
+ } /* option letter okay? */
83
+ if ((optopt = (int)*place++) == (int)':' ||
84
+ (oli = strchr(ostr, optopt)) == NULL) {
85
+ /*
86
+ * if the user didn't specify '-' as an option,
87
+ * assume it means EOF.
88
+ */
89
+ if (optopt == (int)'-')
90
+ return (EOF);
91
+ if (!*place)
92
+ ++optind;
93
+ if (opterr && *ostr != ':')
94
+ (void)fprintf(stderr,
95
+ "%s: illegal option -- %c\n", __FILE__, optopt);
96
+ return (BADCH);
97
+ }
98
+ if (*++oli != ':') { /* don't need argument */
99
+ optarg = NULL;
100
+ if (!*place)
101
+ ++optind;
102
+ }
103
+ else { /* need an argument */
104
+ if (*place) /* no white space */
105
+ optarg = place;
106
+ else if (nargc <= ++optind) { /* no arg */
107
+ place = EMSG;
108
+ if (*ostr == ':')
109
+ return (BADARG);
110
+ if (opterr)
111
+ (void)fprintf(stderr,
112
+ "%s: option requires an argument -- %c\n",
113
+ __FILE__, optopt);
114
+ return (BADCH);
115
+ }
116
+ else /* white space */
117
+ optarg = nargv[optind];
118
+ place = EMSG;
119
+ ++optind;
120
+ }
121
+ return (optopt); /* dump back option letter */
122
+ }