From 25e8060c89575c5b2d2cad179ceff91591066e7e Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Fri, 19 Jan 2018 16:51:48 -0600 Subject: [PATCH 01/20] Add functions to the Pony runtime for setsockopt(2) and getsockopt(2). Constants for the `level` and `option_name` arguments to these syscalls (2nd and 3rd args, respectively) can be accessed via functions in the new primitive class `SockOpt`. NOTE: The usual (?) hack of using `apply()` to return these constant values isn't used here. I'm not sure which commonly-used (or rarely-used!) constants for these syscalls that I've omitted. There are about 149 `level` constants and about 88 `option_name` constants that I scraped out of `/usr/include` header files for Linux, MacOS, and FreeBSD. I don't have a Windows development environment available, but it'd be nifty to include any missing Windows constants also. Also: Add pony_os_rcvbuf() and pony_os_sndbuf() More verbose get/setsockopt for under_pressure example --- examples/under_pressure/main.pony | 25 + packages/net/ossocket.pony | 68 + packages/net/ossockopt.pony | 1322 ++++++++++ packages/net/tcp_connection.pony | 13 +- packages/net/udp_socket.pony | 6 +- src/libponyrt/lang/socket.c | 3864 ++++++++++++++++++++++++++++- 6 files changed, 5292 insertions(+), 6 deletions(-) create mode 100644 packages/net/ossocket.pony create mode 100644 packages/net/ossockopt.pony diff --git a/examples/under_pressure/main.pony b/examples/under_pressure/main.pony index ce702dedb5..afa465547f 100644 --- a/examples/under_pressure/main.pony +++ b/examples/under_pressure/main.pony @@ -68,6 +68,31 @@ class SlowDown is TCPConnectionNotify _auth = auth _out = out + fun ref connected(conn: TCPConnection ref) => + let bufsiz: I32 = 4455 + var res: I32 + let fd: U32 = conn.get_fd() + + @printf[I32]("getsockopt so_error = %d\n".cstring(), OSSocket.get_so_error(fd)) + @printf[I32]("getsockopt get_tcp_nodelay = %d\n".cstring(), OSSocket.get_tcp_nodelay(fd)) + res = OSSocket.set_tcp_nodelay(fd, true) + @printf[I32]("getsockopt set_tcp_nodelay(fd, true) = %d\n".cstring(), res) + @printf[I32]("getsockopt get_tcp_nodelay = %d\n".cstring(), OSSocket.get_tcp_nodelay(fd)) + + res = OSSocket.set_tcp_nodelay(fd, false) + @printf[I32]("getsockopt get_tcp_nodelay (after set_tcp_nodelay) = %d\n".cstring(), OSSocket.get_tcp_nodelay(fd)) + conn.set_nodelay(true) + @printf[I32]("getsockopt get_tcp_nodelay (after conn.set_nodelay(true)) = %d\n".cstring(), OSSocket.get_tcp_nodelay(fd)) + + @printf[I32]("getsockopt rcvbuf = %d\n".cstring(), OSSocket.get_so_rcvbuf(fd)) + @printf[I32]("getsockopt sndbuf = %d\n".cstring(), OSSocket.get_so_sndbuf(fd)) + res = OSSocket.set_so_rcvbuf(fd, 4455) + @printf[I32]("setsockopt rcvbuf %d return was %d\n".cstring(), bufsiz, res) + res = OSSocket.set_so_sndbuf(fd, 4455) + @printf[I32]("setsockopt sndbuf %d return was %d\n".cstring(), bufsiz, res) + @printf[I32]("getsockopt rcvbuf = %d\n".cstring(), OSSocket.get_so_rcvbuf(fd)) + @printf[I32]("getsockopt sndbuf = %d\n".cstring(), OSSocket.get_so_sndbuf(fd)) + fun ref throttled(connection: TCPConnection ref) => _out.print("Experiencing backpressure!") Backpressure(_auth) diff --git a/packages/net/ossocket.pony b/packages/net/ossocket.pony new file mode 100644 index 0000000000..495d71d4cd --- /dev/null +++ b/packages/net/ossocket.pony @@ -0,0 +1,68 @@ + +primitive OSSocket + """ + TODO + """ + + fun option_size_changed_error(): I32 => + """ + Error return value when the `getsockopt(2)` system call was + given an `option_size` of `N` bytes, but the `option_size` value + after a successful system call is `M` bytes instead + (i.e., `N != M`). + """ + -500 + + fun get_so_error(fd: U32): I32 => + _get_so(fd, OSSockOpt.sol_socket(), OSSockOpt.so_error()) + + fun get_so_rcvbuf(fd: U32): I32 => + _get_so(fd, OSSockOpt.sol_socket(), OSSockOpt.so_rcvbuf()) + + fun get_so_sndbuf(fd: U32): I32 => + _get_so(fd, OSSockOpt.sol_socket(), OSSockOpt.so_sndbuf()) + + fun get_tcp_nodelay(fd: U32): I32 => + _get_so(fd, OSSockOpt.sol_socket(), OSSockOpt.tcp_nodelay()) + + fun set_so_broadcast(fd: U32, state: Bool): I32 => + _set_so(fd, OSSockOpt.sol_socket(), OSSockOpt.so_broadcast(), + if state then 1 else 0 end) + + fun set_ip_multicast_loop(fd: U32, loopback: Bool): I32 => + _set_so(fd, OSSockOpt.sol_socket(), OSSockOpt.ip_multicast_loop(), + if loopback then 1 else 0 end) + + fun set_ip_multicast_ttl(fd: U32, ttl: U8): I32 => + _set_so(fd, OSSockOpt.sol_socket(), OSSockOpt.ip_multicast_ttl(), ttl.i32()) + + fun set_so_rcvbuf(fd: U32, bufsize: I32): I32 => + _set_so(fd, OSSockOpt.sol_socket(), OSSockOpt.so_rcvbuf(), bufsize) + + fun set_so_sndbuf(fd: U32, bufsize: I32): I32 => + _set_so(fd, OSSockOpt.sol_socket(), OSSockOpt.so_sndbuf(), bufsize) + + fun set_tcp_nodelay(fd: U32, state: Bool): I32 => + _set_so(fd, OSSockOpt.sol_socket(), OSSockOpt.tcp_nodelay(), + if state then 1 else 0 end) + + + fun _get_so(fd: U32, level: I32, option_name: I32): I32 => + var option: I32 = -1 + var option_size: I32 = 4 + + let res: I32 = @pony_os_getsockopt[I32](fd, level, option_name, + addressof option, addressof option_size) + if res == 0 then + if option_size == 4 then + option + else + option_size_changed_error() + end + else + res + end + + fun _set_so(fd: U32, level: I32, option_name: I32, option': I32): I32 => + var option: I32 = option' + @pony_os_setsockopt[I32](fd, level, option_name, addressof option, I32(4)) diff --git a/packages/net/ossockopt.pony b/packages/net/ossockopt.pony new file mode 100644 index 0000000000..d8261f8f62 --- /dev/null +++ b/packages/net/ossockopt.pony @@ -0,0 +1,1322 @@ +use @pony_os_sockopt_level[I32](option: I32) +use @pony_os_sockopt_option[I32](option: I32) + +primitive OSSockOpt + """ + Convenience functions to fetch the option level and option + name constants (arguments #2 and #3) for the + `getsockopt(2)` and `setsockopt(2)` operating system calls. + + The values of the option level and option name constants are + typically C preprocessor macros, e.g., `#define SOMETHING 42`. + These macro names are upper case and may contain multiple + consecutive underscore characters (though this is rare, for + example, `IP_NAT__XXX`). The function names in this primitive + are derived by the C macro name and then: + + * converted to lower case + * any double underscore (`__`) is converted to a + single underscore (`_`). + + These constants are _not_ stable between Pony releases. + Values returned by this function may be held by long-lived variables + by the calling process: values cannot change while the process runs. + Programmers must not cache any of these values for purposes of + sharing them for use by any other Pony program (for example, + sharing via serialization & deserialization or via direct + shared memory). + + Many functions may return `-1`, which means that the constant's + value could not be determined at the Pony runtime library compile + time. One cause may be that the option truly isn't available, + for example, the option level constant `IPPROTO_3PC` is available + on MacOS 10.x but not on Linux 4.4. Another cause may be the + Pony runtime library's compilation did not include the correct + header file(s) for the target OS platform. + + A third cause of error is due to the regular expression-based + approach used to harvest desirable constants. It is not fool-proof. + The regexp used is too broad and finds some macros that are not + supposed to be used with `getsockopt(2)` and `setsockopt(2)`. + Please consult your platform's documentation to verify the names + of the option level and option name macros. + + The following code fragments are equivalent: set the socket + receive buffer size for the file descriptor `fd` to `4455`. + + ```c + /* In C */ + int option_value = 4455; + setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &option_value, 4); + + /* In Pony */ + var option: I32 = 4455; + @pony_os_setsockopt[I32](fd, OSSockOpt.sol_socket(), OSSockOpt.so_rcvbuf(), + addressof option, I32(4)) + ``` + """ + + /* Constants are from + * macOS Sierra 10.12.6 + * Ubuntu Linux Xenial/16.04 LTS + kernel 4.4.0-109-generic + * FreeBSD 11.1-RELEASE + * Windows Winsock function reference for getsockopt & setsockopt: + * https://msdn.microsoft.com/en-us/library/windows/desktop/ms738544(v=vs.85).aspx + * https://msdn.microsoft.com/en-us/library/windows/desktop/ms740476(v=vs.85).aspx + + * Harvested by recipe given in socket.c + */ + + /* + * Levels formatted in Pony by: + * egrep '^(IP[A-Z0-6]*PROTO_|NSPROTO_|SOL_)' ~/sum-of-all-constants.txt | egrep -v '\(' | sort -u | egrep -v '^$' | sed 's/__/_/g' | awk 'BEGIN { count=4000; } { printf(" fun %s():I32 => @pony_os_sockopt_level(I32(%d))\n", tolower($1), count++); }' + */ + + // levels + fun ipproto_3pc():I32 => @pony_os_sockopt_level(I32(4000)) + fun ipproto_adfs():I32 => @pony_os_sockopt_level(I32(4001)) + fun ipproto_ah():I32 => @pony_os_sockopt_level(I32(4002)) + fun ipproto_ahip():I32 => @pony_os_sockopt_level(I32(4003)) + fun ipproto_apes():I32 => @pony_os_sockopt_level(I32(4004)) + fun ipproto_argus():I32 => @pony_os_sockopt_level(I32(4005)) + fun ipproto_ax25():I32 => @pony_os_sockopt_level(I32(4006)) + fun ipproto_beetph():I32 => @pony_os_sockopt_level(I32(4007)) + fun ipproto_bha():I32 => @pony_os_sockopt_level(I32(4008)) + fun ipproto_blt():I32 => @pony_os_sockopt_level(I32(4009)) + fun ipproto_brsatmon():I32 => @pony_os_sockopt_level(I32(4010)) + fun ipproto_carp():I32 => @pony_os_sockopt_level(I32(4011)) + fun ipproto_cftp():I32 => @pony_os_sockopt_level(I32(4012)) + fun ipproto_chaos():I32 => @pony_os_sockopt_level(I32(4013)) + fun ipproto_cmtp():I32 => @pony_os_sockopt_level(I32(4014)) + fun ipproto_comp():I32 => @pony_os_sockopt_level(I32(4015)) + fun ipproto_cphb():I32 => @pony_os_sockopt_level(I32(4016)) + fun ipproto_cpnx():I32 => @pony_os_sockopt_level(I32(4017)) + fun ipproto_dccp():I32 => @pony_os_sockopt_level(I32(4018)) + fun ipproto_ddp():I32 => @pony_os_sockopt_level(I32(4019)) + fun ipproto_dgp():I32 => @pony_os_sockopt_level(I32(4020)) + fun ipproto_divert():I32 => @pony_os_sockopt_level(I32(4021)) + fun ipproto_done():I32 => @pony_os_sockopt_level(I32(4022)) + fun ipproto_dstopts():I32 => @pony_os_sockopt_level(I32(4023)) + fun ipproto_egp():I32 => @pony_os_sockopt_level(I32(4024)) + fun ipproto_emcon():I32 => @pony_os_sockopt_level(I32(4025)) + fun ipproto_encap():I32 => @pony_os_sockopt_level(I32(4026)) + fun ipproto_eon():I32 => @pony_os_sockopt_level(I32(4027)) + fun ipproto_esp():I32 => @pony_os_sockopt_level(I32(4028)) + fun ipproto_etherip():I32 => @pony_os_sockopt_level(I32(4029)) + fun ipproto_fragment():I32 => @pony_os_sockopt_level(I32(4030)) + fun ipproto_ggp():I32 => @pony_os_sockopt_level(I32(4031)) + fun ipproto_gmtp():I32 => @pony_os_sockopt_level(I32(4032)) + fun ipproto_gre():I32 => @pony_os_sockopt_level(I32(4033)) + fun ipproto_hello():I32 => @pony_os_sockopt_level(I32(4034)) + fun ipproto_hip():I32 => @pony_os_sockopt_level(I32(4035)) + fun ipproto_hmp():I32 => @pony_os_sockopt_level(I32(4036)) + fun ipproto_hopopts():I32 => @pony_os_sockopt_level(I32(4037)) + fun ipproto_icmp():I32 => @pony_os_sockopt_level(I32(4038)) + fun ipproto_icmpv6():I32 => @pony_os_sockopt_level(I32(4039)) + fun ipproto_idp():I32 => @pony_os_sockopt_level(I32(4040)) + fun ipproto_idpr():I32 => @pony_os_sockopt_level(I32(4041)) + fun ipproto_idrp():I32 => @pony_os_sockopt_level(I32(4042)) + fun ipproto_igmp():I32 => @pony_os_sockopt_level(I32(4043)) + fun ipproto_igp():I32 => @pony_os_sockopt_level(I32(4044)) + fun ipproto_igrp():I32 => @pony_os_sockopt_level(I32(4045)) + fun ipproto_il():I32 => @pony_os_sockopt_level(I32(4046)) + fun ipproto_inlsp():I32 => @pony_os_sockopt_level(I32(4047)) + fun ipproto_inp():I32 => @pony_os_sockopt_level(I32(4048)) + fun ipproto_ip():I32 => @pony_os_sockopt_level(I32(4049)) + fun ipproto_ipcomp():I32 => @pony_os_sockopt_level(I32(4050)) + fun ipproto_ipcv():I32 => @pony_os_sockopt_level(I32(4051)) + fun ipproto_ipeip():I32 => @pony_os_sockopt_level(I32(4052)) + fun ipproto_ipip():I32 => @pony_os_sockopt_level(I32(4053)) + fun ipproto_ippc():I32 => @pony_os_sockopt_level(I32(4054)) + fun ipproto_ipv4():I32 => @pony_os_sockopt_level(I32(4055)) + fun ipproto_ipv6():I32 => @pony_os_sockopt_level(I32(4056)) + fun ipproto_irtp():I32 => @pony_os_sockopt_level(I32(4057)) + fun ipproto_kryptolan():I32 => @pony_os_sockopt_level(I32(4058)) + fun ipproto_larp():I32 => @pony_os_sockopt_level(I32(4059)) + fun ipproto_leaf1():I32 => @pony_os_sockopt_level(I32(4060)) + fun ipproto_leaf2():I32 => @pony_os_sockopt_level(I32(4061)) + fun ipproto_max():I32 => @pony_os_sockopt_level(I32(4062)) + fun ipproto_maxid():I32 => @pony_os_sockopt_level(I32(4063)) + fun ipproto_meas():I32 => @pony_os_sockopt_level(I32(4064)) + fun ipproto_mh():I32 => @pony_os_sockopt_level(I32(4065)) + fun ipproto_mhrp():I32 => @pony_os_sockopt_level(I32(4066)) + fun ipproto_micp():I32 => @pony_os_sockopt_level(I32(4067)) + fun ipproto_mobile():I32 => @pony_os_sockopt_level(I32(4068)) + fun ipproto_mpls():I32 => @pony_os_sockopt_level(I32(4069)) + fun ipproto_mtp():I32 => @pony_os_sockopt_level(I32(4070)) + fun ipproto_mux():I32 => @pony_os_sockopt_level(I32(4071)) + fun ipproto_nd():I32 => @pony_os_sockopt_level(I32(4072)) + fun ipproto_nhrp():I32 => @pony_os_sockopt_level(I32(4073)) + fun ipproto_none():I32 => @pony_os_sockopt_level(I32(4074)) + fun ipproto_nsp():I32 => @pony_os_sockopt_level(I32(4075)) + fun ipproto_nvpii():I32 => @pony_os_sockopt_level(I32(4076)) + fun ipproto_old_divert():I32 => @pony_os_sockopt_level(I32(4077)) + fun ipproto_ospfigp():I32 => @pony_os_sockopt_level(I32(4078)) + fun ipproto_pfsync():I32 => @pony_os_sockopt_level(I32(4079)) + fun ipproto_pgm():I32 => @pony_os_sockopt_level(I32(4080)) + fun ipproto_pigp():I32 => @pony_os_sockopt_level(I32(4081)) + fun ipproto_pim():I32 => @pony_os_sockopt_level(I32(4082)) + fun ipproto_prm():I32 => @pony_os_sockopt_level(I32(4083)) + fun ipproto_pup():I32 => @pony_os_sockopt_level(I32(4084)) + fun ipproto_pvp():I32 => @pony_os_sockopt_level(I32(4085)) + fun ipproto_raw():I32 => @pony_os_sockopt_level(I32(4086)) + fun ipproto_rccmon():I32 => @pony_os_sockopt_level(I32(4087)) + fun ipproto_rdp():I32 => @pony_os_sockopt_level(I32(4088)) + fun ipproto_reserved_253():I32 => @pony_os_sockopt_level(I32(4089)) + fun ipproto_reserved_254():I32 => @pony_os_sockopt_level(I32(4090)) + fun ipproto_routing():I32 => @pony_os_sockopt_level(I32(4091)) + fun ipproto_rsvp():I32 => @pony_os_sockopt_level(I32(4092)) + fun ipproto_rvd():I32 => @pony_os_sockopt_level(I32(4093)) + fun ipproto_satexpak():I32 => @pony_os_sockopt_level(I32(4094)) + fun ipproto_satmon():I32 => @pony_os_sockopt_level(I32(4095)) + fun ipproto_sccsp():I32 => @pony_os_sockopt_level(I32(4096)) + fun ipproto_sctp():I32 => @pony_os_sockopt_level(I32(4097)) + fun ipproto_sdrp():I32 => @pony_os_sockopt_level(I32(4098)) + fun ipproto_send():I32 => @pony_os_sockopt_level(I32(4099)) + fun ipproto_sep():I32 => @pony_os_sockopt_level(I32(4100)) + fun ipproto_shim6():I32 => @pony_os_sockopt_level(I32(4101)) + fun ipproto_skip():I32 => @pony_os_sockopt_level(I32(4102)) + fun ipproto_spacer():I32 => @pony_os_sockopt_level(I32(4103)) + fun ipproto_srpc():I32 => @pony_os_sockopt_level(I32(4104)) + fun ipproto_st():I32 => @pony_os_sockopt_level(I32(4105)) + fun ipproto_svmtp():I32 => @pony_os_sockopt_level(I32(4106)) + fun ipproto_swipe():I32 => @pony_os_sockopt_level(I32(4107)) + fun ipproto_tcf():I32 => @pony_os_sockopt_level(I32(4108)) + fun ipproto_tcp():I32 => @pony_os_sockopt_level(I32(4109)) + fun ipproto_tlsp():I32 => @pony_os_sockopt_level(I32(4110)) + fun ipproto_tp():I32 => @pony_os_sockopt_level(I32(4111)) + fun ipproto_tpxx():I32 => @pony_os_sockopt_level(I32(4112)) + fun ipproto_trunk1():I32 => @pony_os_sockopt_level(I32(4113)) + fun ipproto_trunk2():I32 => @pony_os_sockopt_level(I32(4114)) + fun ipproto_ttp():I32 => @pony_os_sockopt_level(I32(4115)) + fun ipproto_udp():I32 => @pony_os_sockopt_level(I32(4116)) + fun ipproto_udplite():I32 => @pony_os_sockopt_level(I32(4117)) + fun ipproto_vines():I32 => @pony_os_sockopt_level(I32(4118)) + fun ipproto_visa():I32 => @pony_os_sockopt_level(I32(4119)) + fun ipproto_vmtp():I32 => @pony_os_sockopt_level(I32(4120)) + fun ipproto_wbexpak():I32 => @pony_os_sockopt_level(I32(4121)) + fun ipproto_wbmon():I32 => @pony_os_sockopt_level(I32(4122)) + fun ipproto_wsn():I32 => @pony_os_sockopt_level(I32(4123)) + fun ipproto_xnet():I32 => @pony_os_sockopt_level(I32(4124)) + fun ipproto_xtp():I32 => @pony_os_sockopt_level(I32(4125)) + fun sol_atalk():I32 => @pony_os_sockopt_level(I32(4126)) + fun sol_ax25():I32 => @pony_os_sockopt_level(I32(4127)) + fun sol_hci_raw():I32 => @pony_os_sockopt_level(I32(4128)) + fun sol_ipx():I32 => @pony_os_sockopt_level(I32(4129)) + fun sol_l2cap():I32 => @pony_os_sockopt_level(I32(4130)) + fun sol_local():I32 => @pony_os_sockopt_level(I32(4131)) + fun sol_ndrvproto():I32 => @pony_os_sockopt_level(I32(4132)) + fun sol_netrom():I32 => @pony_os_sockopt_level(I32(4133)) + fun sol_rds():I32 => @pony_os_sockopt_level(I32(4134)) + fun sol_rfcomm():I32 => @pony_os_sockopt_level(I32(4135)) + fun sol_rose():I32 => @pony_os_sockopt_level(I32(4136)) + fun sol_sco():I32 => @pony_os_sockopt_level(I32(4137)) + fun sol_socket():I32 => @pony_os_sockopt_level(I32(4138)) + fun sol_tipc():I32 => @pony_os_sockopt_level(I32(4139)) + fun sol_udp():I32 => @pony_os_sockopt_level(I32(4140)) + + /* + * + * Options formatted in Pony by: + * egrep -v '^(IP[A-Z0-6]*PROTO_|NSPROTO_|SOL_)' ~/sum-of-all-constants.txt | egrep -v '\(' | sort -u | egrep -v '^$' | sed 's/__/_/g' | awk 'BEGIN { count=0; } { printf(" fun %s():I32 => @pony_os_sockopt_option(I32(%d))\n", tolower($1), count++); }' + */ + + // options + fun af_coip():I32 => @pony_os_sockopt_option(I32(0)) + fun af_inet():I32 => @pony_os_sockopt_option(I32(1)) + fun af_inet6():I32 => @pony_os_sockopt_option(I32(2)) + fun bluetooth_proto_sco():I32 => @pony_os_sockopt_option(I32(3)) + fun dccp_nr_pkt_types():I32 => @pony_os_sockopt_option(I32(4)) + fun dccp_service_list_max_len():I32 => @pony_os_sockopt_option(I32(5)) + fun dccp_single_opt_maxlen():I32 => @pony_os_sockopt_option(I32(6)) + fun dccp_sockopt_available_ccids():I32 => @pony_os_sockopt_option(I32(7)) + fun dccp_sockopt_ccid():I32 => @pony_os_sockopt_option(I32(8)) + fun dccp_sockopt_ccid_rx_info():I32 => @pony_os_sockopt_option(I32(9)) + fun dccp_sockopt_ccid_tx_info():I32 => @pony_os_sockopt_option(I32(10)) + fun dccp_sockopt_change_l():I32 => @pony_os_sockopt_option(I32(11)) + fun dccp_sockopt_change_r():I32 => @pony_os_sockopt_option(I32(12)) + fun dccp_sockopt_get_cur_mps():I32 => @pony_os_sockopt_option(I32(13)) + fun dccp_sockopt_packet_size():I32 => @pony_os_sockopt_option(I32(14)) + fun dccp_sockopt_qpolicy_id():I32 => @pony_os_sockopt_option(I32(15)) + fun dccp_sockopt_qpolicy_txqlen():I32 => @pony_os_sockopt_option(I32(16)) + fun dccp_sockopt_recv_cscov():I32 => @pony_os_sockopt_option(I32(17)) + fun dccp_sockopt_rx_ccid():I32 => @pony_os_sockopt_option(I32(18)) + fun dccp_sockopt_send_cscov():I32 => @pony_os_sockopt_option(I32(19)) + fun dccp_sockopt_server_timewait():I32 => @pony_os_sockopt_option(I32(20)) + fun dccp_sockopt_service():I32 => @pony_os_sockopt_option(I32(21)) + fun dccp_sockopt_tx_ccid():I32 => @pony_os_sockopt_option(I32(22)) + fun dso_acceptmode():I32 => @pony_os_sockopt_option(I32(23)) + fun dso_conaccept():I32 => @pony_os_sockopt_option(I32(24)) + fun dso_conaccess():I32 => @pony_os_sockopt_option(I32(25)) + fun dso_condata():I32 => @pony_os_sockopt_option(I32(26)) + fun dso_conreject():I32 => @pony_os_sockopt_option(I32(27)) + fun dso_cork():I32 => @pony_os_sockopt_option(I32(28)) + fun dso_disdata():I32 => @pony_os_sockopt_option(I32(29)) + fun dso_info():I32 => @pony_os_sockopt_option(I32(30)) + fun dso_linkinfo():I32 => @pony_os_sockopt_option(I32(31)) + fun dso_max():I32 => @pony_os_sockopt_option(I32(32)) + fun dso_maxwindow():I32 => @pony_os_sockopt_option(I32(33)) + fun dso_nodelay():I32 => @pony_os_sockopt_option(I32(34)) + fun dso_seqpacket():I32 => @pony_os_sockopt_option(I32(35)) + fun dso_services():I32 => @pony_os_sockopt_option(I32(36)) + fun dso_stream():I32 => @pony_os_sockopt_option(I32(37)) + fun icmp_address():I32 => @pony_os_sockopt_option(I32(38)) + fun icmp_addressreply():I32 => @pony_os_sockopt_option(I32(39)) + fun icmp_dest_unreach():I32 => @pony_os_sockopt_option(I32(40)) + fun icmp_echo():I32 => @pony_os_sockopt_option(I32(41)) + fun icmp_echoreply():I32 => @pony_os_sockopt_option(I32(42)) + fun icmp_exc_fragtime():I32 => @pony_os_sockopt_option(I32(43)) + fun icmp_exc_ttl():I32 => @pony_os_sockopt_option(I32(44)) + fun icmp_filter():I32 => @pony_os_sockopt_option(I32(45)) + fun icmp_frag_needed():I32 => @pony_os_sockopt_option(I32(46)) + fun icmp_host_ano():I32 => @pony_os_sockopt_option(I32(47)) + fun icmp_host_isolated():I32 => @pony_os_sockopt_option(I32(48)) + fun icmp_host_unknown():I32 => @pony_os_sockopt_option(I32(49)) + fun icmp_host_unreach():I32 => @pony_os_sockopt_option(I32(50)) + fun icmp_host_unr_tos():I32 => @pony_os_sockopt_option(I32(51)) + fun icmp_info_reply():I32 => @pony_os_sockopt_option(I32(52)) + fun icmp_info_request():I32 => @pony_os_sockopt_option(I32(53)) + fun icmp_net_ano():I32 => @pony_os_sockopt_option(I32(54)) + fun icmp_net_unknown():I32 => @pony_os_sockopt_option(I32(55)) + fun icmp_net_unreach():I32 => @pony_os_sockopt_option(I32(56)) + fun icmp_net_unr_tos():I32 => @pony_os_sockopt_option(I32(57)) + fun icmp_parameterprob():I32 => @pony_os_sockopt_option(I32(58)) + fun icmp_pkt_filtered():I32 => @pony_os_sockopt_option(I32(59)) + fun icmp_port_unreach():I32 => @pony_os_sockopt_option(I32(60)) + fun icmp_prec_cutoff():I32 => @pony_os_sockopt_option(I32(61)) + fun icmp_prec_violation():I32 => @pony_os_sockopt_option(I32(62)) + fun icmp_prot_unreach():I32 => @pony_os_sockopt_option(I32(63)) + fun icmp_redirect():I32 => @pony_os_sockopt_option(I32(64)) + fun icmp_redir_host():I32 => @pony_os_sockopt_option(I32(65)) + fun icmp_redir_hosttos():I32 => @pony_os_sockopt_option(I32(66)) + fun icmp_redir_net():I32 => @pony_os_sockopt_option(I32(67)) + fun icmp_redir_nettos():I32 => @pony_os_sockopt_option(I32(68)) + fun icmp_source_quench():I32 => @pony_os_sockopt_option(I32(69)) + fun icmp_sr_failed():I32 => @pony_os_sockopt_option(I32(70)) + fun icmp_timestamp():I32 => @pony_os_sockopt_option(I32(71)) + fun icmp_timestampreply():I32 => @pony_os_sockopt_option(I32(72)) + fun icmp_time_exceeded():I32 => @pony_os_sockopt_option(I32(73)) + fun ipctl_acceptsourceroute():I32 => @pony_os_sockopt_option(I32(74)) + fun ipctl_defmtu():I32 => @pony_os_sockopt_option(I32(75)) + fun ipctl_defttl():I32 => @pony_os_sockopt_option(I32(76)) + fun ipctl_directedbroadcast():I32 => @pony_os_sockopt_option(I32(77)) + fun ipctl_fastforwarding():I32 => @pony_os_sockopt_option(I32(78)) + fun ipctl_forwarding():I32 => @pony_os_sockopt_option(I32(79)) + fun ipctl_gif_ttl():I32 => @pony_os_sockopt_option(I32(80)) + fun ipctl_intrdqdrops():I32 => @pony_os_sockopt_option(I32(81)) + fun ipctl_intrdqmaxlen():I32 => @pony_os_sockopt_option(I32(82)) + fun ipctl_intrqdrops():I32 => @pony_os_sockopt_option(I32(83)) + fun ipctl_intrqmaxlen():I32 => @pony_os_sockopt_option(I32(84)) + fun ipctl_keepfaith():I32 => @pony_os_sockopt_option(I32(85)) + fun ipctl_maxid():I32 => @pony_os_sockopt_option(I32(86)) + fun ipctl_rtexpire():I32 => @pony_os_sockopt_option(I32(87)) + fun ipctl_rtmaxcache():I32 => @pony_os_sockopt_option(I32(88)) + fun ipctl_rtminexpire():I32 => @pony_os_sockopt_option(I32(89)) + fun ipctl_sendredirects():I32 => @pony_os_sockopt_option(I32(90)) + fun ipctl_sourceroute():I32 => @pony_os_sockopt_option(I32(91)) + fun ipctl_stats():I32 => @pony_os_sockopt_option(I32(92)) + fun ipport_ephemeralfirst():I32 => @pony_os_sockopt_option(I32(93)) + fun ipport_ephemerallast():I32 => @pony_os_sockopt_option(I32(94)) + fun ipport_hifirstauto():I32 => @pony_os_sockopt_option(I32(95)) + fun ipport_hilastauto():I32 => @pony_os_sockopt_option(I32(96)) + fun ipport_max():I32 => @pony_os_sockopt_option(I32(97)) + fun ipport_reserved():I32 => @pony_os_sockopt_option(I32(98)) + fun ipport_reservedstart():I32 => @pony_os_sockopt_option(I32(99)) + fun ipport_userreserved():I32 => @pony_os_sockopt_option(I32(100)) + fun ipv6_2292dstopts():I32 => @pony_os_sockopt_option(I32(101)) + fun ipv6_2292hoplimit():I32 => @pony_os_sockopt_option(I32(102)) + fun ipv6_2292hopopts():I32 => @pony_os_sockopt_option(I32(103)) + fun ipv6_2292pktinfo():I32 => @pony_os_sockopt_option(I32(104)) + fun ipv6_2292pktoptions():I32 => @pony_os_sockopt_option(I32(105)) + fun ipv6_2292rthdr():I32 => @pony_os_sockopt_option(I32(106)) + fun ipv6_addrform():I32 => @pony_os_sockopt_option(I32(107)) + fun ipv6_addr_preferences():I32 => @pony_os_sockopt_option(I32(108)) + fun ipv6_add_membership():I32 => @pony_os_sockopt_option(I32(109)) + fun ipv6_authhdr():I32 => @pony_os_sockopt_option(I32(110)) + fun ipv6_autoflowlabel():I32 => @pony_os_sockopt_option(I32(111)) + fun ipv6_checksum():I32 => @pony_os_sockopt_option(I32(112)) + fun ipv6_dontfrag():I32 => @pony_os_sockopt_option(I32(113)) + fun ipv6_drop_membership():I32 => @pony_os_sockopt_option(I32(114)) + fun ipv6_dstopts():I32 => @pony_os_sockopt_option(I32(115)) + fun ipv6_flowinfo():I32 => @pony_os_sockopt_option(I32(116)) + fun ipv6_flowinfo_flowlabel():I32 => @pony_os_sockopt_option(I32(117)) + fun ipv6_flowinfo_priority():I32 => @pony_os_sockopt_option(I32(118)) + fun ipv6_flowinfo_send():I32 => @pony_os_sockopt_option(I32(119)) + fun ipv6_flowlabel_mgr():I32 => @pony_os_sockopt_option(I32(120)) + fun ipv6_fl_a_get():I32 => @pony_os_sockopt_option(I32(121)) + fun ipv6_fl_a_put():I32 => @pony_os_sockopt_option(I32(122)) + fun ipv6_fl_a_renew():I32 => @pony_os_sockopt_option(I32(123)) + fun ipv6_fl_f_create():I32 => @pony_os_sockopt_option(I32(124)) + fun ipv6_fl_f_excl():I32 => @pony_os_sockopt_option(I32(125)) + fun ipv6_fl_f_reflect():I32 => @pony_os_sockopt_option(I32(126)) + fun ipv6_fl_f_remote():I32 => @pony_os_sockopt_option(I32(127)) + fun ipv6_fl_s_any():I32 => @pony_os_sockopt_option(I32(128)) + fun ipv6_fl_s_excl():I32 => @pony_os_sockopt_option(I32(129)) + fun ipv6_fl_s_none():I32 => @pony_os_sockopt_option(I32(130)) + fun ipv6_fl_s_process():I32 => @pony_os_sockopt_option(I32(131)) + fun ipv6_fl_s_user():I32 => @pony_os_sockopt_option(I32(132)) + fun ipv6_hoplimit():I32 => @pony_os_sockopt_option(I32(133)) + fun ipv6_hopopts():I32 => @pony_os_sockopt_option(I32(134)) + fun ipv6_ipsec_policy():I32 => @pony_os_sockopt_option(I32(135)) + fun ipv6_join_anycast():I32 => @pony_os_sockopt_option(I32(136)) + fun ipv6_leave_anycast():I32 => @pony_os_sockopt_option(I32(137)) + fun ipv6_minhopcount():I32 => @pony_os_sockopt_option(I32(138)) + fun ipv6_mtu():I32 => @pony_os_sockopt_option(I32(139)) + fun ipv6_mtu_discover():I32 => @pony_os_sockopt_option(I32(140)) + fun ipv6_multicast_hops():I32 => @pony_os_sockopt_option(I32(141)) + fun ipv6_multicast_if():I32 => @pony_os_sockopt_option(I32(142)) + fun ipv6_multicast_loop():I32 => @pony_os_sockopt_option(I32(143)) + fun ipv6_nexthop():I32 => @pony_os_sockopt_option(I32(144)) + fun ipv6_origdstaddr():I32 => @pony_os_sockopt_option(I32(145)) + fun ipv6_pathmtu():I32 => @pony_os_sockopt_option(I32(146)) + fun ipv6_pktinfo():I32 => @pony_os_sockopt_option(I32(147)) + fun ipv6_pmtudisc_do():I32 => @pony_os_sockopt_option(I32(148)) + fun ipv6_pmtudisc_dont():I32 => @pony_os_sockopt_option(I32(149)) + fun ipv6_pmtudisc_interface():I32 => @pony_os_sockopt_option(I32(150)) + fun ipv6_pmtudisc_omit():I32 => @pony_os_sockopt_option(I32(151)) + fun ipv6_pmtudisc_probe():I32 => @pony_os_sockopt_option(I32(152)) + fun ipv6_pmtudisc_want():I32 => @pony_os_sockopt_option(I32(153)) + fun ipv6_prefer_src_cga():I32 => @pony_os_sockopt_option(I32(154)) + fun ipv6_prefer_src_coa():I32 => @pony_os_sockopt_option(I32(155)) + fun ipv6_prefer_src_home():I32 => @pony_os_sockopt_option(I32(156)) + fun ipv6_prefer_src_noncga():I32 => @pony_os_sockopt_option(I32(157)) + fun ipv6_prefer_src_public():I32 => @pony_os_sockopt_option(I32(158)) + fun ipv6_prefer_src_pubtmp_default():I32 => @pony_os_sockopt_option(I32(159)) + fun ipv6_prefer_src_tmp():I32 => @pony_os_sockopt_option(I32(160)) + fun ipv6_priority_10():I32 => @pony_os_sockopt_option(I32(161)) + fun ipv6_priority_11():I32 => @pony_os_sockopt_option(I32(162)) + fun ipv6_priority_12():I32 => @pony_os_sockopt_option(I32(163)) + fun ipv6_priority_13():I32 => @pony_os_sockopt_option(I32(164)) + fun ipv6_priority_14():I32 => @pony_os_sockopt_option(I32(165)) + fun ipv6_priority_15():I32 => @pony_os_sockopt_option(I32(166)) + fun ipv6_priority_8():I32 => @pony_os_sockopt_option(I32(167)) + fun ipv6_priority_9():I32 => @pony_os_sockopt_option(I32(168)) + fun ipv6_priority_bulk():I32 => @pony_os_sockopt_option(I32(169)) + fun ipv6_priority_control():I32 => @pony_os_sockopt_option(I32(170)) + fun ipv6_priority_filler():I32 => @pony_os_sockopt_option(I32(171)) + fun ipv6_priority_interactive():I32 => @pony_os_sockopt_option(I32(172)) + fun ipv6_priority_reserved1():I32 => @pony_os_sockopt_option(I32(173)) + fun ipv6_priority_reserved2():I32 => @pony_os_sockopt_option(I32(174)) + fun ipv6_priority_unattended():I32 => @pony_os_sockopt_option(I32(175)) + fun ipv6_priority_uncharacterized():I32 => @pony_os_sockopt_option(I32(176)) + fun ipv6_recvdstopts():I32 => @pony_os_sockopt_option(I32(177)) + fun ipv6_recverr():I32 => @pony_os_sockopt_option(I32(178)) + fun ipv6_recvhoplimit():I32 => @pony_os_sockopt_option(I32(179)) + fun ipv6_recvhopopts():I32 => @pony_os_sockopt_option(I32(180)) + fun ipv6_recvorigdstaddr():I32 => @pony_os_sockopt_option(I32(181)) + fun ipv6_recvpathmtu():I32 => @pony_os_sockopt_option(I32(182)) + fun ipv6_recvpktinfo():I32 => @pony_os_sockopt_option(I32(183)) + fun ipv6_recvrthdr():I32 => @pony_os_sockopt_option(I32(184)) + fun ipv6_recvtclass():I32 => @pony_os_sockopt_option(I32(185)) + fun ipv6_router_alert():I32 => @pony_os_sockopt_option(I32(186)) + fun ipv6_rthdr():I32 => @pony_os_sockopt_option(I32(187)) + fun ipv6_rthdrdstopts():I32 => @pony_os_sockopt_option(I32(188)) + fun ipv6_tclass():I32 => @pony_os_sockopt_option(I32(189)) + fun ipv6_tlv_hao():I32 => @pony_os_sockopt_option(I32(190)) + fun ipv6_tlv_jumbo():I32 => @pony_os_sockopt_option(I32(191)) + fun ipv6_tlv_pad1():I32 => @pony_os_sockopt_option(I32(192)) + fun ipv6_tlv_padn():I32 => @pony_os_sockopt_option(I32(193)) + fun ipv6_tlv_routeralert():I32 => @pony_os_sockopt_option(I32(194)) + fun ipv6_transparent():I32 => @pony_os_sockopt_option(I32(195)) + fun ipv6_unicast_hops():I32 => @pony_os_sockopt_option(I32(196)) + fun ipv6_unicast_if():I32 => @pony_os_sockopt_option(I32(197)) + fun ipv6_use_min_mtu():I32 => @pony_os_sockopt_option(I32(198)) + fun ipv6_v6only():I32 => @pony_os_sockopt_option(I32(199)) + fun ipv6_xfrm_policy():I32 => @pony_os_sockopt_option(I32(200)) + fun ipx_address():I32 => @pony_os_sockopt_option(I32(201)) + fun ipx_address_notify():I32 => @pony_os_sockopt_option(I32(202)) + fun ipx_crtitf():I32 => @pony_os_sockopt_option(I32(203)) + fun ipx_dltitf():I32 => @pony_os_sockopt_option(I32(204)) + fun ipx_dstype():I32 => @pony_os_sockopt_option(I32(205)) + fun ipx_extended_address():I32 => @pony_os_sockopt_option(I32(206)) + fun ipx_filterptype():I32 => @pony_os_sockopt_option(I32(207)) + fun ipx_frame_8022():I32 => @pony_os_sockopt_option(I32(208)) + fun ipx_frame_8023():I32 => @pony_os_sockopt_option(I32(209)) + fun ipx_frame_etherii():I32 => @pony_os_sockopt_option(I32(210)) + fun ipx_frame_none():I32 => @pony_os_sockopt_option(I32(211)) + fun ipx_frame_snap():I32 => @pony_os_sockopt_option(I32(212)) + fun ipx_frame_tr_8022():I32 => @pony_os_sockopt_option(I32(213)) + fun ipx_getnetinfo():I32 => @pony_os_sockopt_option(I32(214)) + fun ipx_getnetinfo_norip():I32 => @pony_os_sockopt_option(I32(215)) + fun ipx_immediatespxack():I32 => @pony_os_sockopt_option(I32(216)) + fun ipx_internal():I32 => @pony_os_sockopt_option(I32(217)) + fun ipx_maxsize():I32 => @pony_os_sockopt_option(I32(218)) + fun ipx_max_adapter_num():I32 => @pony_os_sockopt_option(I32(219)) + fun ipx_mtu():I32 => @pony_os_sockopt_option(I32(220)) + fun ipx_node_len():I32 => @pony_os_sockopt_option(I32(221)) + fun ipx_primary():I32 => @pony_os_sockopt_option(I32(222)) + fun ipx_ptype():I32 => @pony_os_sockopt_option(I32(223)) + fun ipx_receive_broadcast():I32 => @pony_os_sockopt_option(I32(224)) + fun ipx_recvhdr():I32 => @pony_os_sockopt_option(I32(225)) + fun ipx_reripnetnumber():I32 => @pony_os_sockopt_option(I32(226)) + fun ipx_route_no_router():I32 => @pony_os_sockopt_option(I32(227)) + fun ipx_rt_8022():I32 => @pony_os_sockopt_option(I32(228)) + fun ipx_rt_bluebook():I32 => @pony_os_sockopt_option(I32(229)) + fun ipx_rt_routed():I32 => @pony_os_sockopt_option(I32(230)) + fun ipx_rt_snap():I32 => @pony_os_sockopt_option(I32(231)) + fun ipx_special_none():I32 => @pony_os_sockopt_option(I32(232)) + fun ipx_spxgetconnectionstatus():I32 => @pony_os_sockopt_option(I32(233)) + fun ipx_stopfilterptype():I32 => @pony_os_sockopt_option(I32(234)) + fun ipx_type():I32 => @pony_os_sockopt_option(I32(235)) + fun ip_add_membership():I32 => @pony_os_sockopt_option(I32(236)) + fun ip_add_source_membership():I32 => @pony_os_sockopt_option(I32(237)) + fun ip_bindany():I32 => @pony_os_sockopt_option(I32(238)) + fun ip_bindmulti():I32 => @pony_os_sockopt_option(I32(239)) + fun ip_bind_address_no_port():I32 => @pony_os_sockopt_option(I32(240)) + fun ip_block_source():I32 => @pony_os_sockopt_option(I32(241)) + fun ip_bound_if():I32 => @pony_os_sockopt_option(I32(242)) + fun ip_checksum():I32 => @pony_os_sockopt_option(I32(243)) + fun ip_default_multicast_loop():I32 => @pony_os_sockopt_option(I32(244)) + fun ip_default_multicast_ttl():I32 => @pony_os_sockopt_option(I32(245)) + fun ip_dontfrag():I32 => @pony_os_sockopt_option(I32(246)) + fun ip_drop_membership():I32 => @pony_os_sockopt_option(I32(247)) + fun ip_drop_source_membership():I32 => @pony_os_sockopt_option(I32(248)) + fun ip_dummynet3():I32 => @pony_os_sockopt_option(I32(249)) + fun ip_dummynet_configure():I32 => @pony_os_sockopt_option(I32(250)) + fun ip_dummynet_del():I32 => @pony_os_sockopt_option(I32(251)) + fun ip_dummynet_flush():I32 => @pony_os_sockopt_option(I32(252)) + fun ip_dummynet_get():I32 => @pony_os_sockopt_option(I32(253)) + fun ip_faith():I32 => @pony_os_sockopt_option(I32(254)) + fun ip_flowid():I32 => @pony_os_sockopt_option(I32(255)) + fun ip_flowtype():I32 => @pony_os_sockopt_option(I32(256)) + fun ip_freebind():I32 => @pony_os_sockopt_option(I32(257)) + fun ip_fw3():I32 => @pony_os_sockopt_option(I32(258)) + fun ip_fw_add():I32 => @pony_os_sockopt_option(I32(259)) + fun ip_fw_del():I32 => @pony_os_sockopt_option(I32(260)) + fun ip_fw_flush():I32 => @pony_os_sockopt_option(I32(261)) + fun ip_fw_get():I32 => @pony_os_sockopt_option(I32(262)) + fun ip_fw_nat_cfg():I32 => @pony_os_sockopt_option(I32(263)) + fun ip_fw_nat_del():I32 => @pony_os_sockopt_option(I32(264)) + fun ip_fw_nat_get_config():I32 => @pony_os_sockopt_option(I32(265)) + fun ip_fw_nat_get_log():I32 => @pony_os_sockopt_option(I32(266)) + fun ip_fw_resetlog():I32 => @pony_os_sockopt_option(I32(267)) + fun ip_fw_table_add():I32 => @pony_os_sockopt_option(I32(268)) + fun ip_fw_table_del():I32 => @pony_os_sockopt_option(I32(269)) + fun ip_fw_table_flush():I32 => @pony_os_sockopt_option(I32(270)) + fun ip_fw_table_getsize():I32 => @pony_os_sockopt_option(I32(271)) + fun ip_fw_table_list():I32 => @pony_os_sockopt_option(I32(272)) + fun ip_fw_zero():I32 => @pony_os_sockopt_option(I32(273)) + fun ip_hdrincl():I32 => @pony_os_sockopt_option(I32(274)) + fun ip_ipsec_policy():I32 => @pony_os_sockopt_option(I32(275)) + fun ip_max_group_src_filter():I32 => @pony_os_sockopt_option(I32(276)) + fun ip_max_memberships():I32 => @pony_os_sockopt_option(I32(277)) + fun ip_max_sock_mute_filter():I32 => @pony_os_sockopt_option(I32(278)) + fun ip_max_sock_src_filter():I32 => @pony_os_sockopt_option(I32(279)) + fun ip_max_source_filter():I32 => @pony_os_sockopt_option(I32(280)) + fun ip_minttl():I32 => @pony_os_sockopt_option(I32(281)) + fun ip_min_memberships():I32 => @pony_os_sockopt_option(I32(282)) + fun ip_msfilter():I32 => @pony_os_sockopt_option(I32(283)) + fun ip_mtu():I32 => @pony_os_sockopt_option(I32(284)) + fun ip_mtu_discover():I32 => @pony_os_sockopt_option(I32(285)) + fun ip_multicast_all():I32 => @pony_os_sockopt_option(I32(286)) + fun ip_multicast_if():I32 => @pony_os_sockopt_option(I32(287)) + fun ip_multicast_ifindex():I32 => @pony_os_sockopt_option(I32(288)) + fun ip_multicast_loop():I32 => @pony_os_sockopt_option(I32(289)) + fun ip_multicast_ttl():I32 => @pony_os_sockopt_option(I32(290)) + fun ip_multicast_vif():I32 => @pony_os_sockopt_option(I32(291)) + fun ip_nat_xxx():I32 => @pony_os_sockopt_option(I32(292)) + fun ip_nodefrag():I32 => @pony_os_sockopt_option(I32(293)) + fun ip_old_fw_add():I32 => @pony_os_sockopt_option(I32(294)) + fun ip_old_fw_del():I32 => @pony_os_sockopt_option(I32(295)) + fun ip_old_fw_flush():I32 => @pony_os_sockopt_option(I32(296)) + fun ip_old_fw_get():I32 => @pony_os_sockopt_option(I32(297)) + fun ip_old_fw_resetlog():I32 => @pony_os_sockopt_option(I32(298)) + fun ip_old_fw_zero():I32 => @pony_os_sockopt_option(I32(299)) + fun ip_onesbcast():I32 => @pony_os_sockopt_option(I32(300)) + fun ip_options():I32 => @pony_os_sockopt_option(I32(301)) + fun ip_origdstaddr():I32 => @pony_os_sockopt_option(I32(302)) + fun ip_passsec():I32 => @pony_os_sockopt_option(I32(303)) + fun ip_pktinfo():I32 => @pony_os_sockopt_option(I32(304)) + fun ip_pktoptions():I32 => @pony_os_sockopt_option(I32(305)) + fun ip_pmtudisc_do():I32 => @pony_os_sockopt_option(I32(306)) + fun ip_pmtudisc_dont():I32 => @pony_os_sockopt_option(I32(307)) + fun ip_pmtudisc_interface():I32 => @pony_os_sockopt_option(I32(308)) + fun ip_pmtudisc_omit():I32 => @pony_os_sockopt_option(I32(309)) + fun ip_pmtudisc_probe():I32 => @pony_os_sockopt_option(I32(310)) + fun ip_pmtudisc_want():I32 => @pony_os_sockopt_option(I32(311)) + fun ip_portrange():I32 => @pony_os_sockopt_option(I32(312)) + fun ip_portrange_default():I32 => @pony_os_sockopt_option(I32(313)) + fun ip_portrange_high():I32 => @pony_os_sockopt_option(I32(314)) + fun ip_portrange_low():I32 => @pony_os_sockopt_option(I32(315)) + fun ip_recvdstaddr():I32 => @pony_os_sockopt_option(I32(316)) + fun ip_recverr():I32 => @pony_os_sockopt_option(I32(317)) + fun ip_recvflowid():I32 => @pony_os_sockopt_option(I32(318)) + fun ip_recvif():I32 => @pony_os_sockopt_option(I32(319)) + fun ip_recvopts():I32 => @pony_os_sockopt_option(I32(320)) + fun ip_recvorigdstaddr():I32 => @pony_os_sockopt_option(I32(321)) + fun ip_recvpktinfo():I32 => @pony_os_sockopt_option(I32(322)) + fun ip_recvretopts():I32 => @pony_os_sockopt_option(I32(323)) + fun ip_recvrssbucketid():I32 => @pony_os_sockopt_option(I32(324)) + fun ip_recvtos():I32 => @pony_os_sockopt_option(I32(325)) + fun ip_recvttl():I32 => @pony_os_sockopt_option(I32(326)) + fun ip_retopts():I32 => @pony_os_sockopt_option(I32(327)) + fun ip_router_alert():I32 => @pony_os_sockopt_option(I32(328)) + fun ip_rssbucketid():I32 => @pony_os_sockopt_option(I32(329)) + fun ip_rss_listen_bucket():I32 => @pony_os_sockopt_option(I32(330)) + fun ip_rsvp_off():I32 => @pony_os_sockopt_option(I32(331)) + fun ip_rsvp_on():I32 => @pony_os_sockopt_option(I32(332)) + fun ip_rsvp_vif_off():I32 => @pony_os_sockopt_option(I32(333)) + fun ip_rsvp_vif_on():I32 => @pony_os_sockopt_option(I32(334)) + fun ip_sendsrcaddr():I32 => @pony_os_sockopt_option(I32(335)) + fun ip_striphdr():I32 => @pony_os_sockopt_option(I32(336)) + fun ip_tos():I32 => @pony_os_sockopt_option(I32(337)) + fun ip_traffic_mgt_background():I32 => @pony_os_sockopt_option(I32(338)) + fun ip_transparent():I32 => @pony_os_sockopt_option(I32(339)) + fun ip_ttl():I32 => @pony_os_sockopt_option(I32(340)) + fun ip_unblock_source():I32 => @pony_os_sockopt_option(I32(341)) + fun ip_unicast_if():I32 => @pony_os_sockopt_option(I32(342)) + fun ip_xfrm_policy():I32 => @pony_os_sockopt_option(I32(343)) + fun local_connwait():I32 => @pony_os_sockopt_option(I32(344)) + fun local_creds():I32 => @pony_os_sockopt_option(I32(345)) + fun local_peercred():I32 => @pony_os_sockopt_option(I32(346)) + fun local_peerepid():I32 => @pony_os_sockopt_option(I32(347)) + fun local_peereuuid():I32 => @pony_os_sockopt_option(I32(348)) + fun local_peerpid():I32 => @pony_os_sockopt_option(I32(349)) + fun local_peeruuid():I32 => @pony_os_sockopt_option(I32(350)) + fun local_vendor():I32 => @pony_os_sockopt_option(I32(351)) + fun max_tcpoptlen():I32 => @pony_os_sockopt_option(I32(352)) + fun mcast_block_source():I32 => @pony_os_sockopt_option(I32(353)) + fun mcast_exclude():I32 => @pony_os_sockopt_option(I32(354)) + fun mcast_include():I32 => @pony_os_sockopt_option(I32(355)) + fun mcast_join_group():I32 => @pony_os_sockopt_option(I32(356)) + fun mcast_join_source_group():I32 => @pony_os_sockopt_option(I32(357)) + fun mcast_leave_group():I32 => @pony_os_sockopt_option(I32(358)) + fun mcast_leave_source_group():I32 => @pony_os_sockopt_option(I32(359)) + fun mcast_msfilter():I32 => @pony_os_sockopt_option(I32(360)) + fun mcast_unblock_source():I32 => @pony_os_sockopt_option(I32(361)) + fun mcast_undefined():I32 => @pony_os_sockopt_option(I32(362)) + fun mrt_add_bw_upcall():I32 => @pony_os_sockopt_option(I32(363)) + fun mrt_add_mfc():I32 => @pony_os_sockopt_option(I32(364)) + fun mrt_add_vif():I32 => @pony_os_sockopt_option(I32(365)) + fun mrt_api_config():I32 => @pony_os_sockopt_option(I32(366)) + fun mrt_api_flags_all():I32 => @pony_os_sockopt_option(I32(367)) + fun mrt_api_support():I32 => @pony_os_sockopt_option(I32(368)) + fun mrt_assert():I32 => @pony_os_sockopt_option(I32(369)) + fun mrt_del_bw_upcall():I32 => @pony_os_sockopt_option(I32(370)) + fun mrt_del_mfc():I32 => @pony_os_sockopt_option(I32(371)) + fun mrt_del_vif():I32 => @pony_os_sockopt_option(I32(372)) + fun mrt_done():I32 => @pony_os_sockopt_option(I32(373)) + fun mrt_init():I32 => @pony_os_sockopt_option(I32(374)) + fun mrt_mfc_bw_upcall():I32 => @pony_os_sockopt_option(I32(375)) + fun mrt_mfc_flags_all():I32 => @pony_os_sockopt_option(I32(376)) + fun mrt_mfc_flags_border_vif():I32 => @pony_os_sockopt_option(I32(377)) + fun mrt_mfc_flags_disable_wrongvif():I32 => @pony_os_sockopt_option(I32(378)) + fun mrt_mfc_rp():I32 => @pony_os_sockopt_option(I32(379)) + fun mrt_pim():I32 => @pony_os_sockopt_option(I32(380)) + fun mrt_version():I32 => @pony_os_sockopt_option(I32(381)) + fun msg_notification():I32 => @pony_os_sockopt_option(I32(382)) + fun msg_socallbck():I32 => @pony_os_sockopt_option(I32(383)) + fun ndrvproto_ndrv():I32 => @pony_os_sockopt_option(I32(384)) + fun ndrv_addmulticast():I32 => @pony_os_sockopt_option(I32(385)) + fun ndrv_deldmxspec():I32 => @pony_os_sockopt_option(I32(386)) + fun ndrv_delmulticast():I32 => @pony_os_sockopt_option(I32(387)) + fun ndrv_demuxtype_ethertype():I32 => @pony_os_sockopt_option(I32(388)) + fun ndrv_demuxtype_sap():I32 => @pony_os_sockopt_option(I32(389)) + fun ndrv_demuxtype_snap():I32 => @pony_os_sockopt_option(I32(390)) + fun ndrv_dmux_max_descr():I32 => @pony_os_sockopt_option(I32(391)) + fun ndrv_protocol_desc_vers():I32 => @pony_os_sockopt_option(I32(392)) + fun ndrv_setdmxspec():I32 => @pony_os_sockopt_option(I32(393)) + fun netlink_add_membership():I32 => @pony_os_sockopt_option(I32(394)) + fun netlink_audit():I32 => @pony_os_sockopt_option(I32(395)) + fun netlink_broadcast_error():I32 => @pony_os_sockopt_option(I32(396)) + fun netlink_cap_ack():I32 => @pony_os_sockopt_option(I32(397)) + fun netlink_connector():I32 => @pony_os_sockopt_option(I32(398)) + fun netlink_crypto():I32 => @pony_os_sockopt_option(I32(399)) + fun netlink_dnrtmsg():I32 => @pony_os_sockopt_option(I32(400)) + fun netlink_drop_membership():I32 => @pony_os_sockopt_option(I32(401)) + fun netlink_ecryptfs():I32 => @pony_os_sockopt_option(I32(402)) + fun netlink_fib_lookup():I32 => @pony_os_sockopt_option(I32(403)) + fun netlink_firewall():I32 => @pony_os_sockopt_option(I32(404)) + fun netlink_generic():I32 => @pony_os_sockopt_option(I32(405)) + fun netlink_inet_diag():I32 => @pony_os_sockopt_option(I32(406)) + fun netlink_ip6_fw():I32 => @pony_os_sockopt_option(I32(407)) + fun netlink_iscsi():I32 => @pony_os_sockopt_option(I32(408)) + fun netlink_kobject_uevent():I32 => @pony_os_sockopt_option(I32(409)) + fun netlink_listen_all_nsid():I32 => @pony_os_sockopt_option(I32(410)) + fun netlink_list_memberships():I32 => @pony_os_sockopt_option(I32(411)) + fun netlink_netfilter():I32 => @pony_os_sockopt_option(I32(412)) + fun netlink_nflog():I32 => @pony_os_sockopt_option(I32(413)) + fun netlink_no_enobufs():I32 => @pony_os_sockopt_option(I32(414)) + fun netlink_pktinfo():I32 => @pony_os_sockopt_option(I32(415)) + fun netlink_rdma():I32 => @pony_os_sockopt_option(I32(416)) + fun netlink_route():I32 => @pony_os_sockopt_option(I32(417)) + fun netlink_rx_ring():I32 => @pony_os_sockopt_option(I32(418)) + fun netlink_scsitransport():I32 => @pony_os_sockopt_option(I32(419)) + fun netlink_selinux():I32 => @pony_os_sockopt_option(I32(420)) + fun netlink_sock_diag():I32 => @pony_os_sockopt_option(I32(421)) + fun netlink_tx_ring():I32 => @pony_os_sockopt_option(I32(422)) + fun netlink_unused():I32 => @pony_os_sockopt_option(I32(423)) + fun netlink_usersock():I32 => @pony_os_sockopt_option(I32(424)) + fun netlink_xfrm():I32 => @pony_os_sockopt_option(I32(425)) + fun netrom_idle():I32 => @pony_os_sockopt_option(I32(426)) + fun netrom_kill():I32 => @pony_os_sockopt_option(I32(427)) + fun netrom_n2():I32 => @pony_os_sockopt_option(I32(428)) + fun netrom_neigh():I32 => @pony_os_sockopt_option(I32(429)) + fun netrom_node():I32 => @pony_os_sockopt_option(I32(430)) + fun netrom_paclen():I32 => @pony_os_sockopt_option(I32(431)) + fun netrom_t1():I32 => @pony_os_sockopt_option(I32(432)) + fun netrom_t2():I32 => @pony_os_sockopt_option(I32(433)) + fun netrom_t4():I32 => @pony_os_sockopt_option(I32(434)) + fun nrdv_multicast_addrs_per_sock():I32 => @pony_os_sockopt_option(I32(435)) + fun pvd_config():I32 => @pony_os_sockopt_option(I32(436)) + fun rds_cancel_sent_to():I32 => @pony_os_sockopt_option(I32(437)) + fun rds_cmsg_atomic_cswp():I32 => @pony_os_sockopt_option(I32(438)) + fun rds_cmsg_atomic_fadd():I32 => @pony_os_sockopt_option(I32(439)) + fun rds_cmsg_cong_update():I32 => @pony_os_sockopt_option(I32(440)) + fun rds_cmsg_masked_atomic_cswp():I32 => @pony_os_sockopt_option(I32(441)) + fun rds_cmsg_masked_atomic_fadd():I32 => @pony_os_sockopt_option(I32(442)) + fun rds_cmsg_rdma_args():I32 => @pony_os_sockopt_option(I32(443)) + fun rds_cmsg_rdma_dest():I32 => @pony_os_sockopt_option(I32(444)) + fun rds_cmsg_rdma_map():I32 => @pony_os_sockopt_option(I32(445)) + fun rds_cmsg_rdma_status():I32 => @pony_os_sockopt_option(I32(446)) + fun rds_cong_monitor():I32 => @pony_os_sockopt_option(I32(447)) + fun rds_cong_monitor_size():I32 => @pony_os_sockopt_option(I32(448)) + fun rds_free_mr():I32 => @pony_os_sockopt_option(I32(449)) + fun rds_get_mr():I32 => @pony_os_sockopt_option(I32(450)) + fun rds_get_mr_for_dest():I32 => @pony_os_sockopt_option(I32(451)) + fun rds_ib_abi_version():I32 => @pony_os_sockopt_option(I32(452)) + fun rds_ib_gid_len():I32 => @pony_os_sockopt_option(I32(453)) + fun rds_info_connections():I32 => @pony_os_sockopt_option(I32(454)) + fun rds_info_connection_flag_connected():I32 => @pony_os_sockopt_option(I32(455)) + fun rds_info_connection_flag_connecting():I32 => @pony_os_sockopt_option(I32(456)) + fun rds_info_connection_flag_sending():I32 => @pony_os_sockopt_option(I32(457)) + fun rds_info_connection_stats():I32 => @pony_os_sockopt_option(I32(458)) + fun rds_info_counters():I32 => @pony_os_sockopt_option(I32(459)) + fun rds_info_first():I32 => @pony_os_sockopt_option(I32(460)) + fun rds_info_ib_connections():I32 => @pony_os_sockopt_option(I32(461)) + fun rds_info_iwarp_connections():I32 => @pony_os_sockopt_option(I32(462)) + fun rds_info_last():I32 => @pony_os_sockopt_option(I32(463)) + fun rds_info_message_flag_ack():I32 => @pony_os_sockopt_option(I32(464)) + fun rds_info_message_flag_fast_ack():I32 => @pony_os_sockopt_option(I32(465)) + fun rds_info_recv_messages():I32 => @pony_os_sockopt_option(I32(466)) + fun rds_info_retrans_messages():I32 => @pony_os_sockopt_option(I32(467)) + fun rds_info_send_messages():I32 => @pony_os_sockopt_option(I32(468)) + fun rds_info_sockets():I32 => @pony_os_sockopt_option(I32(469)) + fun rds_info_tcp_sockets():I32 => @pony_os_sockopt_option(I32(470)) + fun rds_rdma_canceled():I32 => @pony_os_sockopt_option(I32(471)) + fun rds_rdma_dontwait():I32 => @pony_os_sockopt_option(I32(472)) + fun rds_rdma_dropped():I32 => @pony_os_sockopt_option(I32(473)) + fun rds_rdma_fence():I32 => @pony_os_sockopt_option(I32(474)) + fun rds_rdma_invalidate():I32 => @pony_os_sockopt_option(I32(475)) + fun rds_rdma_notify_me():I32 => @pony_os_sockopt_option(I32(476)) + fun rds_rdma_other_error():I32 => @pony_os_sockopt_option(I32(477)) + fun rds_rdma_readwrite():I32 => @pony_os_sockopt_option(I32(478)) + fun rds_rdma_remote_error():I32 => @pony_os_sockopt_option(I32(479)) + fun rds_rdma_silent():I32 => @pony_os_sockopt_option(I32(480)) + fun rds_rdma_success():I32 => @pony_os_sockopt_option(I32(481)) + fun rds_rdma_use_once():I32 => @pony_os_sockopt_option(I32(482)) + fun rds_recverr():I32 => @pony_os_sockopt_option(I32(483)) + fun rds_trans_count():I32 => @pony_os_sockopt_option(I32(484)) + fun rds_trans_ib():I32 => @pony_os_sockopt_option(I32(485)) + fun rds_trans_iwarp():I32 => @pony_os_sockopt_option(I32(486)) + fun rds_trans_none():I32 => @pony_os_sockopt_option(I32(487)) + fun rds_trans_tcp():I32 => @pony_os_sockopt_option(I32(488)) + fun rose_access_barred():I32 => @pony_os_sockopt_option(I32(489)) + fun rose_defer():I32 => @pony_os_sockopt_option(I32(490)) + fun rose_dte_originated():I32 => @pony_os_sockopt_option(I32(491)) + fun rose_holdback():I32 => @pony_os_sockopt_option(I32(492)) + fun rose_idle():I32 => @pony_os_sockopt_option(I32(493)) + fun rose_invalid_facility():I32 => @pony_os_sockopt_option(I32(494)) + fun rose_local_procedure():I32 => @pony_os_sockopt_option(I32(495)) + fun rose_max_digis():I32 => @pony_os_sockopt_option(I32(496)) + fun rose_mtu():I32 => @pony_os_sockopt_option(I32(497)) + fun rose_network_congestion():I32 => @pony_os_sockopt_option(I32(498)) + fun rose_not_obtainable():I32 => @pony_os_sockopt_option(I32(499)) + fun rose_number_busy():I32 => @pony_os_sockopt_option(I32(500)) + fun rose_out_of_order():I32 => @pony_os_sockopt_option(I32(501)) + fun rose_qbitincl():I32 => @pony_os_sockopt_option(I32(502)) + fun rose_remote_procedure():I32 => @pony_os_sockopt_option(I32(503)) + fun rose_ship_absent():I32 => @pony_os_sockopt_option(I32(504)) + fun rose_t1():I32 => @pony_os_sockopt_option(I32(505)) + fun rose_t2():I32 => @pony_os_sockopt_option(I32(506)) + fun rose_t3():I32 => @pony_os_sockopt_option(I32(507)) + fun scm_hci_raw_direction():I32 => @pony_os_sockopt_option(I32(508)) + fun scm_timestamp():I32 => @pony_os_sockopt_option(I32(509)) + fun scm_timestamping():I32 => @pony_os_sockopt_option(I32(510)) + fun scm_timestampns():I32 => @pony_os_sockopt_option(I32(511)) + fun scm_wifi_status():I32 => @pony_os_sockopt_option(I32(512)) + fun sctp_abort_association():I32 => @pony_os_sockopt_option(I32(513)) + fun sctp_adaptation_layer():I32 => @pony_os_sockopt_option(I32(514)) + fun sctp_adaption_layer():I32 => @pony_os_sockopt_option(I32(515)) + fun sctp_add_streams():I32 => @pony_os_sockopt_option(I32(516)) + fun sctp_add_vrf_id():I32 => @pony_os_sockopt_option(I32(517)) + fun sctp_asconf():I32 => @pony_os_sockopt_option(I32(518)) + fun sctp_asconf_ack():I32 => @pony_os_sockopt_option(I32(519)) + fun sctp_asconf_supported():I32 => @pony_os_sockopt_option(I32(520)) + fun sctp_associnfo():I32 => @pony_os_sockopt_option(I32(521)) + fun sctp_authentication():I32 => @pony_os_sockopt_option(I32(522)) + fun sctp_auth_active_key():I32 => @pony_os_sockopt_option(I32(523)) + fun sctp_auth_chunk():I32 => @pony_os_sockopt_option(I32(524)) + fun sctp_auth_deactivate_key():I32 => @pony_os_sockopt_option(I32(525)) + fun sctp_auth_delete_key():I32 => @pony_os_sockopt_option(I32(526)) + fun sctp_auth_key():I32 => @pony_os_sockopt_option(I32(527)) + fun sctp_auth_supported():I32 => @pony_os_sockopt_option(I32(528)) + fun sctp_autoclose():I32 => @pony_os_sockopt_option(I32(529)) + fun sctp_auto_asconf():I32 => @pony_os_sockopt_option(I32(530)) + fun sctp_badcrc():I32 => @pony_os_sockopt_option(I32(531)) + fun sctp_bindx_add_addr():I32 => @pony_os_sockopt_option(I32(532)) + fun sctp_bindx_rem_addr():I32 => @pony_os_sockopt_option(I32(533)) + fun sctp_blk_logging_enable():I32 => @pony_os_sockopt_option(I32(534)) + fun sctp_bound():I32 => @pony_os_sockopt_option(I32(535)) + fun sctp_cause_cookie_in_shutdown():I32 => @pony_os_sockopt_option(I32(536)) + fun sctp_cause_deleting_last_addr():I32 => @pony_os_sockopt_option(I32(537)) + fun sctp_cause_deleting_src_addr():I32 => @pony_os_sockopt_option(I32(538)) + fun sctp_cause_illegal_asconf_ack():I32 => @pony_os_sockopt_option(I32(539)) + fun sctp_cause_invalid_param():I32 => @pony_os_sockopt_option(I32(540)) + fun sctp_cause_invalid_stream():I32 => @pony_os_sockopt_option(I32(541)) + fun sctp_cause_missing_param():I32 => @pony_os_sockopt_option(I32(542)) + fun sctp_cause_nat_colliding_state():I32 => @pony_os_sockopt_option(I32(543)) + fun sctp_cause_nat_missing_state():I32 => @pony_os_sockopt_option(I32(544)) + fun sctp_cause_no_error():I32 => @pony_os_sockopt_option(I32(545)) + fun sctp_cause_no_user_data():I32 => @pony_os_sockopt_option(I32(546)) + fun sctp_cause_out_of_resc():I32 => @pony_os_sockopt_option(I32(547)) + fun sctp_cause_protocol_violation():I32 => @pony_os_sockopt_option(I32(548)) + fun sctp_cause_request_refused():I32 => @pony_os_sockopt_option(I32(549)) + fun sctp_cause_resource_shortage():I32 => @pony_os_sockopt_option(I32(550)) + fun sctp_cause_restart_w_newaddr():I32 => @pony_os_sockopt_option(I32(551)) + fun sctp_cause_stale_cookie():I32 => @pony_os_sockopt_option(I32(552)) + fun sctp_cause_unrecog_chunk():I32 => @pony_os_sockopt_option(I32(553)) + fun sctp_cause_unrecog_param():I32 => @pony_os_sockopt_option(I32(554)) + fun sctp_cause_unresolvable_addr():I32 => @pony_os_sockopt_option(I32(555)) + fun sctp_cause_unsupported_hmacid():I32 => @pony_os_sockopt_option(I32(556)) + fun sctp_cause_user_initiated_abt():I32 => @pony_os_sockopt_option(I32(557)) + fun sctp_cc_hstcp():I32 => @pony_os_sockopt_option(I32(558)) + fun sctp_cc_htcp():I32 => @pony_os_sockopt_option(I32(559)) + fun sctp_cc_option():I32 => @pony_os_sockopt_option(I32(560)) + fun sctp_cc_opt_rtcc_setmode():I32 => @pony_os_sockopt_option(I32(561)) + fun sctp_cc_opt_steady_step():I32 => @pony_os_sockopt_option(I32(562)) + fun sctp_cc_opt_use_dccc_ecn():I32 => @pony_os_sockopt_option(I32(563)) + fun sctp_cc_rfc2581():I32 => @pony_os_sockopt_option(I32(564)) + fun sctp_cc_rtcc():I32 => @pony_os_sockopt_option(I32(565)) + fun sctp_closed():I32 => @pony_os_sockopt_option(I32(566)) + fun sctp_clr_stat_log():I32 => @pony_os_sockopt_option(I32(567)) + fun sctp_cmt_base():I32 => @pony_os_sockopt_option(I32(568)) + fun sctp_cmt_max():I32 => @pony_os_sockopt_option(I32(569)) + fun sctp_cmt_mptcp():I32 => @pony_os_sockopt_option(I32(570)) + fun sctp_cmt_off():I32 => @pony_os_sockopt_option(I32(571)) + fun sctp_cmt_on_off():I32 => @pony_os_sockopt_option(I32(572)) + fun sctp_cmt_rpv1():I32 => @pony_os_sockopt_option(I32(573)) + fun sctp_cmt_rpv2():I32 => @pony_os_sockopt_option(I32(574)) + fun sctp_cmt_use_dac():I32 => @pony_os_sockopt_option(I32(575)) + fun sctp_connect_x():I32 => @pony_os_sockopt_option(I32(576)) + fun sctp_connect_x_complete():I32 => @pony_os_sockopt_option(I32(577)) + fun sctp_connect_x_delayed():I32 => @pony_os_sockopt_option(I32(578)) + fun sctp_context():I32 => @pony_os_sockopt_option(I32(579)) + fun sctp_cookie_ack():I32 => @pony_os_sockopt_option(I32(580)) + fun sctp_cookie_echo():I32 => @pony_os_sockopt_option(I32(581)) + fun sctp_cookie_echoed():I32 => @pony_os_sockopt_option(I32(582)) + fun sctp_cookie_wait():I32 => @pony_os_sockopt_option(I32(583)) + fun sctp_cwnd_logging_enable():I32 => @pony_os_sockopt_option(I32(584)) + fun sctp_cwnd_monitor_enable():I32 => @pony_os_sockopt_option(I32(585)) + fun sctp_cwr_in_same_window():I32 => @pony_os_sockopt_option(I32(586)) + fun sctp_cwr_reduce_override():I32 => @pony_os_sockopt_option(I32(587)) + fun sctp_data():I32 => @pony_os_sockopt_option(I32(588)) + fun sctp_data_first_frag():I32 => @pony_os_sockopt_option(I32(589)) + fun sctp_data_frag_mask():I32 => @pony_os_sockopt_option(I32(590)) + fun sctp_data_last_frag():I32 => @pony_os_sockopt_option(I32(591)) + fun sctp_data_middle_frag():I32 => @pony_os_sockopt_option(I32(592)) + fun sctp_data_not_frag():I32 => @pony_os_sockopt_option(I32(593)) + fun sctp_data_sack_immediately():I32 => @pony_os_sockopt_option(I32(594)) + fun sctp_data_unordered():I32 => @pony_os_sockopt_option(I32(595)) + fun sctp_default_prinfo():I32 => @pony_os_sockopt_option(I32(596)) + fun sctp_default_send_param():I32 => @pony_os_sockopt_option(I32(597)) + fun sctp_default_sndinfo():I32 => @pony_os_sockopt_option(I32(598)) + fun sctp_delayed_sack():I32 => @pony_os_sockopt_option(I32(599)) + fun sctp_del_vrf_id():I32 => @pony_os_sockopt_option(I32(600)) + fun sctp_disable_fragments():I32 => @pony_os_sockopt_option(I32(601)) + fun sctp_ecn_cwr():I32 => @pony_os_sockopt_option(I32(602)) + fun sctp_ecn_echo():I32 => @pony_os_sockopt_option(I32(603)) + fun sctp_ecn_supported():I32 => @pony_os_sockopt_option(I32(604)) + fun sctp_enable_change_assoc_req():I32 => @pony_os_sockopt_option(I32(605)) + fun sctp_enable_reset_assoc_req():I32 => @pony_os_sockopt_option(I32(606)) + fun sctp_enable_reset_stream_req():I32 => @pony_os_sockopt_option(I32(607)) + fun sctp_enable_stream_reset():I32 => @pony_os_sockopt_option(I32(608)) + fun sctp_enable_value_mask():I32 => @pony_os_sockopt_option(I32(609)) + fun sctp_established():I32 => @pony_os_sockopt_option(I32(610)) + fun sctp_event():I32 => @pony_os_sockopt_option(I32(611)) + fun sctp_events():I32 => @pony_os_sockopt_option(I32(612)) + fun sctp_explicit_eor():I32 => @pony_os_sockopt_option(I32(613)) + fun sctp_flight_logging_enable():I32 => @pony_os_sockopt_option(I32(614)) + fun sctp_forward_cum_tsn():I32 => @pony_os_sockopt_option(I32(615)) + fun sctp_fragment_interleave():I32 => @pony_os_sockopt_option(I32(616)) + fun sctp_frag_level_0():I32 => @pony_os_sockopt_option(I32(617)) + fun sctp_frag_level_1():I32 => @pony_os_sockopt_option(I32(618)) + fun sctp_frag_level_2():I32 => @pony_os_sockopt_option(I32(619)) + fun sctp_from_middle_box():I32 => @pony_os_sockopt_option(I32(620)) + fun sctp_fr_logging_enable():I32 => @pony_os_sockopt_option(I32(621)) + fun sctp_get_addr_len():I32 => @pony_os_sockopt_option(I32(622)) + fun sctp_get_asoc_vrf():I32 => @pony_os_sockopt_option(I32(623)) + fun sctp_get_assoc_id_list():I32 => @pony_os_sockopt_option(I32(624)) + fun sctp_get_assoc_number():I32 => @pony_os_sockopt_option(I32(625)) + fun sctp_get_local_addresses():I32 => @pony_os_sockopt_option(I32(626)) + fun sctp_get_local_addr_size():I32 => @pony_os_sockopt_option(I32(627)) + fun sctp_get_nonce_values():I32 => @pony_os_sockopt_option(I32(628)) + fun sctp_get_packet_log():I32 => @pony_os_sockopt_option(I32(629)) + fun sctp_get_peer_addresses():I32 => @pony_os_sockopt_option(I32(630)) + fun sctp_get_peer_addr_info():I32 => @pony_os_sockopt_option(I32(631)) + fun sctp_get_remote_addr_size():I32 => @pony_os_sockopt_option(I32(632)) + fun sctp_get_sndbuf_use():I32 => @pony_os_sockopt_option(I32(633)) + fun sctp_get_stat_log():I32 => @pony_os_sockopt_option(I32(634)) + fun sctp_get_vrf_ids():I32 => @pony_os_sockopt_option(I32(635)) + fun sctp_had_no_tcb():I32 => @pony_os_sockopt_option(I32(636)) + fun sctp_heartbeat_ack():I32 => @pony_os_sockopt_option(I32(637)) + fun sctp_heartbeat_request():I32 => @pony_os_sockopt_option(I32(638)) + fun sctp_hmac_ident():I32 => @pony_os_sockopt_option(I32(639)) + fun sctp_idata():I32 => @pony_os_sockopt_option(I32(640)) + fun sctp_iforward_cum_tsn():I32 => @pony_os_sockopt_option(I32(641)) + fun sctp_initiation():I32 => @pony_os_sockopt_option(I32(642)) + fun sctp_initiation_ack():I32 => @pony_os_sockopt_option(I32(643)) + fun sctp_initmsg():I32 => @pony_os_sockopt_option(I32(644)) + fun sctp_interleaving_supported():I32 => @pony_os_sockopt_option(I32(645)) + fun sctp_i_want_mapped_v4_addr():I32 => @pony_os_sockopt_option(I32(646)) + fun sctp_last_packet_tracing():I32 => @pony_os_sockopt_option(I32(647)) + fun sctp_listen():I32 => @pony_os_sockopt_option(I32(648)) + fun sctp_local_auth_chunks():I32 => @pony_os_sockopt_option(I32(649)) + fun sctp_lock_logging_enable():I32 => @pony_os_sockopt_option(I32(650)) + fun sctp_log_at_send_2_outq():I32 => @pony_os_sockopt_option(I32(651)) + fun sctp_log_at_send_2_sctp():I32 => @pony_os_sockopt_option(I32(652)) + fun sctp_log_maxburst_enable():I32 => @pony_os_sockopt_option(I32(653)) + fun sctp_log_rwnd_enable():I32 => @pony_os_sockopt_option(I32(654)) + fun sctp_log_sack_arrivals_enable():I32 => @pony_os_sockopt_option(I32(655)) + fun sctp_log_try_advance():I32 => @pony_os_sockopt_option(I32(656)) + fun sctp_ltrace_chunk_enable():I32 => @pony_os_sockopt_option(I32(657)) + fun sctp_ltrace_error_enable():I32 => @pony_os_sockopt_option(I32(658)) + fun sctp_map_logging_enable():I32 => @pony_os_sockopt_option(I32(659)) + fun sctp_maxburst():I32 => @pony_os_sockopt_option(I32(660)) + fun sctp_maxseg():I32 => @pony_os_sockopt_option(I32(661)) + fun sctp_max_burst():I32 => @pony_os_sockopt_option(I32(662)) + fun sctp_max_cookie_life():I32 => @pony_os_sockopt_option(I32(663)) + fun sctp_max_cwnd():I32 => @pony_os_sockopt_option(I32(664)) + fun sctp_max_hb_interval():I32 => @pony_os_sockopt_option(I32(665)) + fun sctp_max_sack_delay():I32 => @pony_os_sockopt_option(I32(666)) + fun sctp_mbcnt_logging_enable():I32 => @pony_os_sockopt_option(I32(667)) + fun sctp_mbuf_logging_enable():I32 => @pony_os_sockopt_option(I32(668)) + fun sctp_mobility_base():I32 => @pony_os_sockopt_option(I32(669)) + fun sctp_mobility_fasthandoff():I32 => @pony_os_sockopt_option(I32(670)) + fun sctp_mobility_prim_deleted():I32 => @pony_os_sockopt_option(I32(671)) + fun sctp_nagle_logging_enable():I32 => @pony_os_sockopt_option(I32(672)) + fun sctp_nodelay():I32 => @pony_os_sockopt_option(I32(673)) + fun sctp_nrsack_supported():I32 => @pony_os_sockopt_option(I32(674)) + fun sctp_nr_selective_ack():I32 => @pony_os_sockopt_option(I32(675)) + fun sctp_operation_error():I32 => @pony_os_sockopt_option(I32(676)) + fun sctp_packed():I32 => @pony_os_sockopt_option(I32(677)) + fun sctp_packet_dropped():I32 => @pony_os_sockopt_option(I32(678)) + fun sctp_packet_log_size():I32 => @pony_os_sockopt_option(I32(679)) + fun sctp_packet_truncated():I32 => @pony_os_sockopt_option(I32(680)) + fun sctp_pad_chunk():I32 => @pony_os_sockopt_option(I32(681)) + fun sctp_partial_delivery_point():I32 => @pony_os_sockopt_option(I32(682)) + fun sctp_pcb_copy_flags():I32 => @pony_os_sockopt_option(I32(683)) + fun sctp_pcb_flags_accepting():I32 => @pony_os_sockopt_option(I32(684)) + fun sctp_pcb_flags_adaptationevnt():I32 => @pony_os_sockopt_option(I32(685)) + fun sctp_pcb_flags_assoc_resetevnt():I32 => @pony_os_sockopt_option(I32(686)) + fun sctp_pcb_flags_authevnt():I32 => @pony_os_sockopt_option(I32(687)) + fun sctp_pcb_flags_autoclose():I32 => @pony_os_sockopt_option(I32(688)) + fun sctp_pcb_flags_auto_asconf():I32 => @pony_os_sockopt_option(I32(689)) + fun sctp_pcb_flags_blocking_io():I32 => @pony_os_sockopt_option(I32(690)) + fun sctp_pcb_flags_boundall():I32 => @pony_os_sockopt_option(I32(691)) + fun sctp_pcb_flags_bound_v6():I32 => @pony_os_sockopt_option(I32(692)) + fun sctp_pcb_flags_close_ip():I32 => @pony_os_sockopt_option(I32(693)) + fun sctp_pcb_flags_connected():I32 => @pony_os_sockopt_option(I32(694)) + fun sctp_pcb_flags_donot_heartbeat():I32 => @pony_os_sockopt_option(I32(695)) + fun sctp_pcb_flags_dont_wake():I32 => @pony_os_sockopt_option(I32(696)) + fun sctp_pcb_flags_do_asconf():I32 => @pony_os_sockopt_option(I32(697)) + fun sctp_pcb_flags_do_not_pmtud():I32 => @pony_os_sockopt_option(I32(698)) + fun sctp_pcb_flags_dryevnt():I32 => @pony_os_sockopt_option(I32(699)) + fun sctp_pcb_flags_explicit_eor():I32 => @pony_os_sockopt_option(I32(700)) + fun sctp_pcb_flags_ext_rcvinfo():I32 => @pony_os_sockopt_option(I32(701)) + fun sctp_pcb_flags_frag_interleave():I32 => @pony_os_sockopt_option(I32(702)) + fun sctp_pcb_flags_interleave_strms():I32 => @pony_os_sockopt_option(I32(703)) + fun sctp_pcb_flags_in_tcppool():I32 => @pony_os_sockopt_option(I32(704)) + fun sctp_pcb_flags_multiple_asconfs():I32 => @pony_os_sockopt_option(I32(705)) + fun sctp_pcb_flags_needs_mapped_v4():I32 => @pony_os_sockopt_option(I32(706)) + fun sctp_pcb_flags_nodelay():I32 => @pony_os_sockopt_option(I32(707)) + fun sctp_pcb_flags_no_fragment():I32 => @pony_os_sockopt_option(I32(708)) + fun sctp_pcb_flags_pdapievnt():I32 => @pony_os_sockopt_option(I32(709)) + fun sctp_pcb_flags_portreuse():I32 => @pony_os_sockopt_option(I32(710)) + fun sctp_pcb_flags_recvassocevnt():I32 => @pony_os_sockopt_option(I32(711)) + fun sctp_pcb_flags_recvdataioevnt():I32 => @pony_os_sockopt_option(I32(712)) + fun sctp_pcb_flags_recvnsendfailevnt():I32 => @pony_os_sockopt_option(I32(713)) + fun sctp_pcb_flags_recvnxtinfo():I32 => @pony_os_sockopt_option(I32(714)) + fun sctp_pcb_flags_recvpaddrevnt():I32 => @pony_os_sockopt_option(I32(715)) + fun sctp_pcb_flags_recvpeererr():I32 => @pony_os_sockopt_option(I32(716)) + fun sctp_pcb_flags_recvrcvinfo():I32 => @pony_os_sockopt_option(I32(717)) + fun sctp_pcb_flags_recvsendfailevnt():I32 => @pony_os_sockopt_option(I32(718)) + fun sctp_pcb_flags_recvshutdownevnt():I32 => @pony_os_sockopt_option(I32(719)) + fun sctp_pcb_flags_socket_allgone():I32 => @pony_os_sockopt_option(I32(720)) + fun sctp_pcb_flags_socket_cant_read():I32 => @pony_os_sockopt_option(I32(721)) + fun sctp_pcb_flags_socket_gone():I32 => @pony_os_sockopt_option(I32(722)) + fun sctp_pcb_flags_stream_changeevnt():I32 => @pony_os_sockopt_option(I32(723)) + fun sctp_pcb_flags_stream_resetevnt():I32 => @pony_os_sockopt_option(I32(724)) + fun sctp_pcb_flags_tcptype():I32 => @pony_os_sockopt_option(I32(725)) + fun sctp_pcb_flags_udptype():I32 => @pony_os_sockopt_option(I32(726)) + fun sctp_pcb_flags_unbound():I32 => @pony_os_sockopt_option(I32(727)) + fun sctp_pcb_flags_wakeinput():I32 => @pony_os_sockopt_option(I32(728)) + fun sctp_pcb_flags_wakeoutput():I32 => @pony_os_sockopt_option(I32(729)) + fun sctp_pcb_flags_was_aborted():I32 => @pony_os_sockopt_option(I32(730)) + fun sctp_pcb_flags_was_connected():I32 => @pony_os_sockopt_option(I32(731)) + fun sctp_pcb_flags_zero_copy_active():I32 => @pony_os_sockopt_option(I32(732)) + fun sctp_pcb_status():I32 => @pony_os_sockopt_option(I32(733)) + fun sctp_peeloff():I32 => @pony_os_sockopt_option(I32(734)) + fun sctp_peer_addr_params():I32 => @pony_os_sockopt_option(I32(735)) + fun sctp_peer_addr_thlds():I32 => @pony_os_sockopt_option(I32(736)) + fun sctp_peer_auth_chunks():I32 => @pony_os_sockopt_option(I32(737)) + fun sctp_pktdrop_supported():I32 => @pony_os_sockopt_option(I32(738)) + fun sctp_pluggable_cc():I32 => @pony_os_sockopt_option(I32(739)) + fun sctp_pluggable_ss():I32 => @pony_os_sockopt_option(I32(740)) + fun sctp_primary_addr():I32 => @pony_os_sockopt_option(I32(741)) + fun sctp_pr_assoc_status():I32 => @pony_os_sockopt_option(I32(742)) + fun sctp_pr_stream_status():I32 => @pony_os_sockopt_option(I32(743)) + fun sctp_pr_supported():I32 => @pony_os_sockopt_option(I32(744)) + fun sctp_reconfig_supported():I32 => @pony_os_sockopt_option(I32(745)) + fun sctp_recvnxtinfo():I32 => @pony_os_sockopt_option(I32(746)) + fun sctp_recvrcvinfo():I32 => @pony_os_sockopt_option(I32(747)) + fun sctp_recv_rwnd_logging_enable():I32 => @pony_os_sockopt_option(I32(748)) + fun sctp_remote_udp_encaps_port():I32 => @pony_os_sockopt_option(I32(749)) + fun sctp_reset_assoc():I32 => @pony_os_sockopt_option(I32(750)) + fun sctp_reset_streams():I32 => @pony_os_sockopt_option(I32(751)) + fun sctp_reuse_port():I32 => @pony_os_sockopt_option(I32(752)) + fun sctp_rtoinfo():I32 => @pony_os_sockopt_option(I32(753)) + fun sctp_rttvar_logging_enable():I32 => @pony_os_sockopt_option(I32(754)) + fun sctp_sack_cmt_dac():I32 => @pony_os_sockopt_option(I32(755)) + fun sctp_sack_logging_enable():I32 => @pony_os_sockopt_option(I32(756)) + fun sctp_sack_nonce_sum():I32 => @pony_os_sockopt_option(I32(757)) + fun sctp_sack_rwnd_logging_enable():I32 => @pony_os_sockopt_option(I32(758)) + fun sctp_sat_network_burst_incr():I32 => @pony_os_sockopt_option(I32(759)) + fun sctp_sat_network_min():I32 => @pony_os_sockopt_option(I32(760)) + fun sctp_sb_logging_enable():I32 => @pony_os_sockopt_option(I32(761)) + fun sctp_selective_ack():I32 => @pony_os_sockopt_option(I32(762)) + fun sctp_set_debug_level():I32 => @pony_os_sockopt_option(I32(763)) + fun sctp_set_dynamic_primary():I32 => @pony_os_sockopt_option(I32(764)) + fun sctp_set_initial_dbg_seq():I32 => @pony_os_sockopt_option(I32(765)) + fun sctp_set_peer_primary_addr():I32 => @pony_os_sockopt_option(I32(766)) + fun sctp_shutdown():I32 => @pony_os_sockopt_option(I32(767)) + fun sctp_shutdown_ack():I32 => @pony_os_sockopt_option(I32(768)) + fun sctp_shutdown_ack_sent():I32 => @pony_os_sockopt_option(I32(769)) + fun sctp_shutdown_complete():I32 => @pony_os_sockopt_option(I32(770)) + fun sctp_shutdown_pending():I32 => @pony_os_sockopt_option(I32(771)) + fun sctp_shutdown_received():I32 => @pony_os_sockopt_option(I32(772)) + fun sctp_shutdown_sent():I32 => @pony_os_sockopt_option(I32(773)) + fun sctp_smallest_pmtu():I32 => @pony_os_sockopt_option(I32(774)) + fun sctp_ss_default():I32 => @pony_os_sockopt_option(I32(775)) + fun sctp_ss_fair_bandwith():I32 => @pony_os_sockopt_option(I32(776)) + fun sctp_ss_first_come():I32 => @pony_os_sockopt_option(I32(777)) + fun sctp_ss_priority():I32 => @pony_os_sockopt_option(I32(778)) + fun sctp_ss_round_robin():I32 => @pony_os_sockopt_option(I32(779)) + fun sctp_ss_round_robin_packet():I32 => @pony_os_sockopt_option(I32(780)) + fun sctp_ss_value():I32 => @pony_os_sockopt_option(I32(781)) + fun sctp_status():I32 => @pony_os_sockopt_option(I32(782)) + fun sctp_stream_reset():I32 => @pony_os_sockopt_option(I32(783)) + fun sctp_stream_reset_incoming():I32 => @pony_os_sockopt_option(I32(784)) + fun sctp_stream_reset_outgoing():I32 => @pony_os_sockopt_option(I32(785)) + fun sctp_str_logging_enable():I32 => @pony_os_sockopt_option(I32(786)) + fun sctp_threshold_logging():I32 => @pony_os_sockopt_option(I32(787)) + fun sctp_timeouts():I32 => @pony_os_sockopt_option(I32(788)) + fun sctp_use_ext_rcvinfo():I32 => @pony_os_sockopt_option(I32(789)) + fun sctp_vrf_id():I32 => @pony_os_sockopt_option(I32(790)) + fun sctp_wake_logging_enable():I32 => @pony_os_sockopt_option(I32(791)) + fun sock_cloexec():I32 => @pony_os_sockopt_option(I32(792)) + fun sock_dgram():I32 => @pony_os_sockopt_option(I32(793)) + fun sock_maxaddrlen():I32 => @pony_os_sockopt_option(I32(794)) + fun sock_nonblock():I32 => @pony_os_sockopt_option(I32(795)) + fun sock_raw():I32 => @pony_os_sockopt_option(I32(796)) + fun sock_rdm():I32 => @pony_os_sockopt_option(I32(797)) + fun sock_seqpacket():I32 => @pony_os_sockopt_option(I32(798)) + fun sock_stream():I32 => @pony_os_sockopt_option(I32(799)) + fun somaxconn():I32 => @pony_os_sockopt_option(I32(800)) + fun sonpx_setoptshut():I32 => @pony_os_sockopt_option(I32(801)) + fun so_acceptconn():I32 => @pony_os_sockopt_option(I32(802)) + fun so_acceptfilter():I32 => @pony_os_sockopt_option(I32(803)) + fun so_atmpvc():I32 => @pony_os_sockopt_option(I32(804)) + fun so_atmqos():I32 => @pony_os_sockopt_option(I32(805)) + fun so_atmsap():I32 => @pony_os_sockopt_option(I32(806)) + fun so_attach_bpf():I32 => @pony_os_sockopt_option(I32(807)) + fun so_attach_filter():I32 => @pony_os_sockopt_option(I32(808)) + fun so_bindtodevice():I32 => @pony_os_sockopt_option(I32(809)) + fun so_bintime():I32 => @pony_os_sockopt_option(I32(810)) + fun so_bpf_extensions():I32 => @pony_os_sockopt_option(I32(811)) + fun so_broadcast():I32 => @pony_os_sockopt_option(I32(812)) + fun so_bsdcompat():I32 => @pony_os_sockopt_option(I32(813)) + fun so_bsp_state():I32 => @pony_os_sockopt_option(I32(814)) + fun so_busy_poll():I32 => @pony_os_sockopt_option(I32(815)) + fun so_conaccess():I32 => @pony_os_sockopt_option(I32(816)) + fun so_condata():I32 => @pony_os_sockopt_option(I32(817)) + fun so_conditional_accept():I32 => @pony_os_sockopt_option(I32(818)) + fun so_connect_time():I32 => @pony_os_sockopt_option(I32(819)) + fun so_debug():I32 => @pony_os_sockopt_option(I32(820)) + fun so_detach_bpf():I32 => @pony_os_sockopt_option(I32(821)) + fun so_detach_filter():I32 => @pony_os_sockopt_option(I32(822)) + fun so_domain():I32 => @pony_os_sockopt_option(I32(823)) + fun so_dontlinger():I32 => @pony_os_sockopt_option(I32(824)) + fun so_dontroute():I32 => @pony_os_sockopt_option(I32(825)) + fun so_donttrunc():I32 => @pony_os_sockopt_option(I32(826)) + fun so_error():I32 => @pony_os_sockopt_option(I32(827)) + fun so_exclusiveaddruse():I32 => @pony_os_sockopt_option(I32(828)) + fun so_get_filter():I32 => @pony_os_sockopt_option(I32(829)) + fun so_group_id():I32 => @pony_os_sockopt_option(I32(830)) + fun so_group_priority():I32 => @pony_os_sockopt_option(I32(831)) + fun so_hci_raw_direction():I32 => @pony_os_sockopt_option(I32(832)) + fun so_hci_raw_filter():I32 => @pony_os_sockopt_option(I32(833)) + fun so_incoming_cpu():I32 => @pony_os_sockopt_option(I32(834)) + fun so_keepalive():I32 => @pony_os_sockopt_option(I32(835)) + fun so_l2cap_encrypted():I32 => @pony_os_sockopt_option(I32(836)) + fun so_l2cap_flush():I32 => @pony_os_sockopt_option(I32(837)) + fun so_l2cap_iflow():I32 => @pony_os_sockopt_option(I32(838)) + fun so_l2cap_imtu():I32 => @pony_os_sockopt_option(I32(839)) + fun so_l2cap_oflow():I32 => @pony_os_sockopt_option(I32(840)) + fun so_l2cap_omtu():I32 => @pony_os_sockopt_option(I32(841)) + fun so_label():I32 => @pony_os_sockopt_option(I32(842)) + fun so_linger():I32 => @pony_os_sockopt_option(I32(843)) + fun so_linger_sec():I32 => @pony_os_sockopt_option(I32(844)) + fun so_linkinfo():I32 => @pony_os_sockopt_option(I32(845)) + fun so_listenincqlen():I32 => @pony_os_sockopt_option(I32(846)) + fun so_listenqlen():I32 => @pony_os_sockopt_option(I32(847)) + fun so_listenqlimit():I32 => @pony_os_sockopt_option(I32(848)) + fun so_lock_filter():I32 => @pony_os_sockopt_option(I32(849)) + fun so_mark():I32 => @pony_os_sockopt_option(I32(850)) + fun so_max_msg_size():I32 => @pony_os_sockopt_option(I32(851)) + fun so_max_pacing_rate():I32 => @pony_os_sockopt_option(I32(852)) + fun so_multipoint():I32 => @pony_os_sockopt_option(I32(853)) + fun so_netsvc_marking_level():I32 => @pony_os_sockopt_option(I32(854)) + fun so_net_service_type():I32 => @pony_os_sockopt_option(I32(855)) + fun so_nke():I32 => @pony_os_sockopt_option(I32(856)) + fun so_noaddrerr():I32 => @pony_os_sockopt_option(I32(857)) + fun so_nofcs():I32 => @pony_os_sockopt_option(I32(858)) + fun so_nosigpipe():I32 => @pony_os_sockopt_option(I32(859)) + fun so_notifyconflict():I32 => @pony_os_sockopt_option(I32(860)) + fun so_no_check():I32 => @pony_os_sockopt_option(I32(861)) + fun so_no_ddp():I32 => @pony_os_sockopt_option(I32(862)) + fun so_no_offload():I32 => @pony_os_sockopt_option(I32(863)) + fun so_np_extensions():I32 => @pony_os_sockopt_option(I32(864)) + fun so_nread():I32 => @pony_os_sockopt_option(I32(865)) + fun so_numrcvpkt():I32 => @pony_os_sockopt_option(I32(866)) + fun so_nwrite():I32 => @pony_os_sockopt_option(I32(867)) + fun so_oobinline():I32 => @pony_os_sockopt_option(I32(868)) + fun so_original_dst():I32 => @pony_os_sockopt_option(I32(869)) + fun so_passcred():I32 => @pony_os_sockopt_option(I32(870)) + fun so_passsec():I32 => @pony_os_sockopt_option(I32(871)) + fun so_peek_off():I32 => @pony_os_sockopt_option(I32(872)) + fun so_peercred():I32 => @pony_os_sockopt_option(I32(873)) + fun so_peerlabel():I32 => @pony_os_sockopt_option(I32(874)) + fun so_peername():I32 => @pony_os_sockopt_option(I32(875)) + fun so_peersec():I32 => @pony_os_sockopt_option(I32(876)) + fun so_port_scalability():I32 => @pony_os_sockopt_option(I32(877)) + fun so_priority():I32 => @pony_os_sockopt_option(I32(878)) + fun so_protocol():I32 => @pony_os_sockopt_option(I32(879)) + fun so_protocol_info():I32 => @pony_os_sockopt_option(I32(880)) + fun so_prototype():I32 => @pony_os_sockopt_option(I32(881)) + fun so_proxyusr():I32 => @pony_os_sockopt_option(I32(882)) + fun so_randomport():I32 => @pony_os_sockopt_option(I32(883)) + fun so_rcvbuf():I32 => @pony_os_sockopt_option(I32(884)) + fun so_rcvbufforce():I32 => @pony_os_sockopt_option(I32(885)) + fun so_rcvlowat():I32 => @pony_os_sockopt_option(I32(886)) + fun so_rcvtimeo():I32 => @pony_os_sockopt_option(I32(887)) + fun so_rds_transport():I32 => @pony_os_sockopt_option(I32(888)) + fun so_reuseaddr():I32 => @pony_os_sockopt_option(I32(889)) + fun so_reuseport():I32 => @pony_os_sockopt_option(I32(890)) + fun so_reuseshareuid():I32 => @pony_os_sockopt_option(I32(891)) + fun so_rfcomm_fc_info():I32 => @pony_os_sockopt_option(I32(892)) + fun so_rfcomm_mtu():I32 => @pony_os_sockopt_option(I32(893)) + fun so_rxq_ovfl():I32 => @pony_os_sockopt_option(I32(894)) + fun so_sco_conninfo():I32 => @pony_os_sockopt_option(I32(895)) + fun so_sco_mtu():I32 => @pony_os_sockopt_option(I32(896)) + fun so_security_authentication():I32 => @pony_os_sockopt_option(I32(897)) + fun so_security_encryption_network():I32 => @pony_os_sockopt_option(I32(898)) + fun so_security_encryption_transport():I32 => @pony_os_sockopt_option(I32(899)) + fun so_select_err_queue():I32 => @pony_os_sockopt_option(I32(900)) + fun so_setclp():I32 => @pony_os_sockopt_option(I32(901)) + fun so_setfib():I32 => @pony_os_sockopt_option(I32(902)) + fun so_sndbuf():I32 => @pony_os_sockopt_option(I32(903)) + fun so_sndbufforce():I32 => @pony_os_sockopt_option(I32(904)) + fun so_sndlowat():I32 => @pony_os_sockopt_option(I32(905)) + fun so_sndtimeo():I32 => @pony_os_sockopt_option(I32(906)) + fun so_timestamp():I32 => @pony_os_sockopt_option(I32(907)) + fun so_timestamping():I32 => @pony_os_sockopt_option(I32(908)) + fun so_timestampns():I32 => @pony_os_sockopt_option(I32(909)) + fun so_timestamp_monotonic():I32 => @pony_os_sockopt_option(I32(910)) + fun so_type():I32 => @pony_os_sockopt_option(I32(911)) + fun so_upcallclosewait():I32 => @pony_os_sockopt_option(I32(912)) + fun so_update_accept_context():I32 => @pony_os_sockopt_option(I32(913)) + fun so_useloopback():I32 => @pony_os_sockopt_option(I32(914)) + fun so_user_cookie():I32 => @pony_os_sockopt_option(I32(915)) + fun so_vendor():I32 => @pony_os_sockopt_option(I32(916)) + fun so_vm_sockets_buffer_max_size():I32 => @pony_os_sockopt_option(I32(917)) + fun so_vm_sockets_buffer_min_size():I32 => @pony_os_sockopt_option(I32(918)) + fun so_vm_sockets_buffer_size():I32 => @pony_os_sockopt_option(I32(919)) + fun so_vm_sockets_connect_timeout():I32 => @pony_os_sockopt_option(I32(920)) + fun so_vm_sockets_nonblock_txrx():I32 => @pony_os_sockopt_option(I32(921)) + fun so_vm_sockets_peer_host_vm_id():I32 => @pony_os_sockopt_option(I32(922)) + fun so_vm_sockets_trusted():I32 => @pony_os_sockopt_option(I32(923)) + fun so_wantmore():I32 => @pony_os_sockopt_option(I32(924)) + fun so_wantoobflag():I32 => @pony_os_sockopt_option(I32(925)) + fun so_wifi_status():I32 => @pony_os_sockopt_option(I32(926)) + fun tcp6_mss():I32 => @pony_os_sockopt_option(I32(927)) + fun tcpci_flag_lossrecovery():I32 => @pony_os_sockopt_option(I32(928)) + fun tcpci_flag_reordering_detected():I32 => @pony_os_sockopt_option(I32(929)) + fun tcpci_opt_ecn():I32 => @pony_os_sockopt_option(I32(930)) + fun tcpci_opt_sack():I32 => @pony_os_sockopt_option(I32(931)) + fun tcpci_opt_timestamps():I32 => @pony_os_sockopt_option(I32(932)) + fun tcpci_opt_wscale():I32 => @pony_os_sockopt_option(I32(933)) + fun tcpf_ca_cwr():I32 => @pony_os_sockopt_option(I32(934)) + fun tcpf_ca_disorder():I32 => @pony_os_sockopt_option(I32(935)) + fun tcpf_ca_loss():I32 => @pony_os_sockopt_option(I32(936)) + fun tcpf_ca_open():I32 => @pony_os_sockopt_option(I32(937)) + fun tcpf_ca_recovery():I32 => @pony_os_sockopt_option(I32(938)) + fun tcpi_opt_ecn():I32 => @pony_os_sockopt_option(I32(939)) + fun tcpi_opt_ecn_seen():I32 => @pony_os_sockopt_option(I32(940)) + fun tcpi_opt_sack():I32 => @pony_os_sockopt_option(I32(941)) + fun tcpi_opt_syn_data():I32 => @pony_os_sockopt_option(I32(942)) + fun tcpi_opt_timestamps():I32 => @pony_os_sockopt_option(I32(943)) + fun tcpi_opt_toe():I32 => @pony_os_sockopt_option(I32(944)) + fun tcpi_opt_wscale():I32 => @pony_os_sockopt_option(I32(945)) + fun tcpolen_cc():I32 => @pony_os_sockopt_option(I32(946)) + fun tcpolen_cc_appa():I32 => @pony_os_sockopt_option(I32(947)) + fun tcpolen_eol():I32 => @pony_os_sockopt_option(I32(948)) + fun tcpolen_fastopen_req():I32 => @pony_os_sockopt_option(I32(949)) + fun tcpolen_fast_open_empty():I32 => @pony_os_sockopt_option(I32(950)) + fun tcpolen_fast_open_max():I32 => @pony_os_sockopt_option(I32(951)) + fun tcpolen_fast_open_min():I32 => @pony_os_sockopt_option(I32(952)) + fun tcpolen_maxseg():I32 => @pony_os_sockopt_option(I32(953)) + fun tcpolen_nop():I32 => @pony_os_sockopt_option(I32(954)) + fun tcpolen_pad():I32 => @pony_os_sockopt_option(I32(955)) + fun tcpolen_sack():I32 => @pony_os_sockopt_option(I32(956)) + fun tcpolen_sackhdr():I32 => @pony_os_sockopt_option(I32(957)) + fun tcpolen_sack_permitted():I32 => @pony_os_sockopt_option(I32(958)) + fun tcpolen_signature():I32 => @pony_os_sockopt_option(I32(959)) + fun tcpolen_timestamp():I32 => @pony_os_sockopt_option(I32(960)) + fun tcpolen_tstamp_appa():I32 => @pony_os_sockopt_option(I32(961)) + fun tcpolen_window():I32 => @pony_os_sockopt_option(I32(962)) + fun tcpopt_cc():I32 => @pony_os_sockopt_option(I32(963)) + fun tcpopt_ccecho():I32 => @pony_os_sockopt_option(I32(964)) + fun tcpopt_ccnew():I32 => @pony_os_sockopt_option(I32(965)) + fun tcpopt_eol():I32 => @pony_os_sockopt_option(I32(966)) + fun tcpopt_fastopen():I32 => @pony_os_sockopt_option(I32(967)) + fun tcpopt_fast_open():I32 => @pony_os_sockopt_option(I32(968)) + fun tcpopt_maxseg():I32 => @pony_os_sockopt_option(I32(969)) + fun tcpopt_multipath():I32 => @pony_os_sockopt_option(I32(970)) + fun tcpopt_nop():I32 => @pony_os_sockopt_option(I32(971)) + fun tcpopt_pad():I32 => @pony_os_sockopt_option(I32(972)) + fun tcpopt_sack():I32 => @pony_os_sockopt_option(I32(973)) + fun tcpopt_sack_hdr():I32 => @pony_os_sockopt_option(I32(974)) + fun tcpopt_sack_permitted():I32 => @pony_os_sockopt_option(I32(975)) + fun tcpopt_sack_permit_hdr():I32 => @pony_os_sockopt_option(I32(976)) + fun tcpopt_signature():I32 => @pony_os_sockopt_option(I32(977)) + fun tcpopt_timestamp():I32 => @pony_os_sockopt_option(I32(978)) + fun tcpopt_tstamp_hdr():I32 => @pony_os_sockopt_option(I32(979)) + fun tcpopt_window():I32 => @pony_os_sockopt_option(I32(980)) + fun tcp_ca_name_max():I32 => @pony_os_sockopt_option(I32(981)) + fun tcp_ccalgoopt():I32 => @pony_os_sockopt_option(I32(982)) + fun tcp_cc_info():I32 => @pony_os_sockopt_option(I32(983)) + fun tcp_congestion():I32 => @pony_os_sockopt_option(I32(984)) + fun tcp_connectiontimeout():I32 => @pony_os_sockopt_option(I32(985)) + fun tcp_connection_info():I32 => @pony_os_sockopt_option(I32(986)) + fun tcp_cookie_in_always():I32 => @pony_os_sockopt_option(I32(987)) + fun tcp_cookie_max():I32 => @pony_os_sockopt_option(I32(988)) + fun tcp_cookie_min():I32 => @pony_os_sockopt_option(I32(989)) + fun tcp_cookie_out_never():I32 => @pony_os_sockopt_option(I32(990)) + fun tcp_cookie_pair_size():I32 => @pony_os_sockopt_option(I32(991)) + fun tcp_cookie_transactions():I32 => @pony_os_sockopt_option(I32(992)) + fun tcp_cork():I32 => @pony_os_sockopt_option(I32(993)) + fun tcp_defer_accept():I32 => @pony_os_sockopt_option(I32(994)) + fun tcp_enable_ecn():I32 => @pony_os_sockopt_option(I32(995)) + fun tcp_fastopen():I32 => @pony_os_sockopt_option(I32(996)) + fun tcp_function_blk():I32 => @pony_os_sockopt_option(I32(997)) + fun tcp_function_name_len_max():I32 => @pony_os_sockopt_option(I32(998)) + fun tcp_info():I32 => @pony_os_sockopt_option(I32(999)) + fun tcp_keepalive():I32 => @pony_os_sockopt_option(I32(1000)) + fun tcp_keepcnt():I32 => @pony_os_sockopt_option(I32(1001)) + fun tcp_keepidle():I32 => @pony_os_sockopt_option(I32(1002)) + fun tcp_keepinit():I32 => @pony_os_sockopt_option(I32(1003)) + fun tcp_keepintvl():I32 => @pony_os_sockopt_option(I32(1004)) + fun tcp_linger2():I32 => @pony_os_sockopt_option(I32(1005)) + fun tcp_maxburst():I32 => @pony_os_sockopt_option(I32(1006)) + fun tcp_maxhlen():I32 => @pony_os_sockopt_option(I32(1007)) + fun tcp_maxolen():I32 => @pony_os_sockopt_option(I32(1008)) + fun tcp_maxseg():I32 => @pony_os_sockopt_option(I32(1009)) + fun tcp_maxwin():I32 => @pony_os_sockopt_option(I32(1010)) + fun tcp_max_sack():I32 => @pony_os_sockopt_option(I32(1011)) + fun tcp_max_winshift():I32 => @pony_os_sockopt_option(I32(1012)) + fun tcp_md5sig():I32 => @pony_os_sockopt_option(I32(1013)) + fun tcp_md5sig_maxkeylen():I32 => @pony_os_sockopt_option(I32(1014)) + fun tcp_minmss():I32 => @pony_os_sockopt_option(I32(1015)) + fun tcp_mss():I32 => @pony_os_sockopt_option(I32(1016)) + fun tcp_mss_default():I32 => @pony_os_sockopt_option(I32(1017)) + fun tcp_mss_desired():I32 => @pony_os_sockopt_option(I32(1018)) + fun tcp_nodelay():I32 => @pony_os_sockopt_option(I32(1019)) + fun tcp_noopt():I32 => @pony_os_sockopt_option(I32(1020)) + fun tcp_nopush():I32 => @pony_os_sockopt_option(I32(1021)) + fun tcp_notsent_lowat():I32 => @pony_os_sockopt_option(I32(1022)) + fun tcp_pcap_in():I32 => @pony_os_sockopt_option(I32(1023)) + fun tcp_pcap_out():I32 => @pony_os_sockopt_option(I32(1024)) + fun tcp_queue_seq():I32 => @pony_os_sockopt_option(I32(1025)) + fun tcp_quickack():I32 => @pony_os_sockopt_option(I32(1026)) + fun tcp_repair():I32 => @pony_os_sockopt_option(I32(1027)) + fun tcp_repair_options():I32 => @pony_os_sockopt_option(I32(1028)) + fun tcp_repair_queue():I32 => @pony_os_sockopt_option(I32(1029)) + fun tcp_rxt_conndroptime():I32 => @pony_os_sockopt_option(I32(1030)) + fun tcp_rxt_findrop():I32 => @pony_os_sockopt_option(I32(1031)) + fun tcp_saved_syn():I32 => @pony_os_sockopt_option(I32(1032)) + fun tcp_save_syn():I32 => @pony_os_sockopt_option(I32(1033)) + fun tcp_sendmoreacks():I32 => @pony_os_sockopt_option(I32(1034)) + fun tcp_syncnt():I32 => @pony_os_sockopt_option(I32(1035)) + fun tcp_s_data_in():I32 => @pony_os_sockopt_option(I32(1036)) + fun tcp_s_data_out():I32 => @pony_os_sockopt_option(I32(1037)) + fun tcp_thin_dupack():I32 => @pony_os_sockopt_option(I32(1038)) + fun tcp_thin_linear_timeouts():I32 => @pony_os_sockopt_option(I32(1039)) + fun tcp_timestamp():I32 => @pony_os_sockopt_option(I32(1040)) + fun tcp_user_timeout():I32 => @pony_os_sockopt_option(I32(1041)) + fun tcp_vendor():I32 => @pony_os_sockopt_option(I32(1042)) + fun tcp_window_clamp():I32 => @pony_os_sockopt_option(I32(1043)) + fun tipc_addr_id():I32 => @pony_os_sockopt_option(I32(1044)) + fun tipc_addr_mcast():I32 => @pony_os_sockopt_option(I32(1045)) + fun tipc_addr_name():I32 => @pony_os_sockopt_option(I32(1046)) + fun tipc_addr_nameseq():I32 => @pony_os_sockopt_option(I32(1047)) + fun tipc_cfg_srv():I32 => @pony_os_sockopt_option(I32(1048)) + fun tipc_cluster_scope():I32 => @pony_os_sockopt_option(I32(1049)) + fun tipc_conn_shutdown():I32 => @pony_os_sockopt_option(I32(1050)) + fun tipc_conn_timeout():I32 => @pony_os_sockopt_option(I32(1051)) + fun tipc_critical_importance():I32 => @pony_os_sockopt_option(I32(1052)) + fun tipc_destname():I32 => @pony_os_sockopt_option(I32(1053)) + fun tipc_dest_droppable():I32 => @pony_os_sockopt_option(I32(1054)) + fun tipc_errinfo():I32 => @pony_os_sockopt_option(I32(1055)) + fun tipc_err_no_name():I32 => @pony_os_sockopt_option(I32(1056)) + fun tipc_err_no_node():I32 => @pony_os_sockopt_option(I32(1057)) + fun tipc_err_no_port():I32 => @pony_os_sockopt_option(I32(1058)) + fun tipc_err_overload():I32 => @pony_os_sockopt_option(I32(1059)) + fun tipc_high_importance():I32 => @pony_os_sockopt_option(I32(1060)) + fun tipc_importance():I32 => @pony_os_sockopt_option(I32(1061)) + fun tipc_link_state():I32 => @pony_os_sockopt_option(I32(1062)) + fun tipc_low_importance():I32 => @pony_os_sockopt_option(I32(1063)) + fun tipc_max_bearer_name():I32 => @pony_os_sockopt_option(I32(1064)) + fun tipc_max_if_name():I32 => @pony_os_sockopt_option(I32(1065)) + fun tipc_max_link_name():I32 => @pony_os_sockopt_option(I32(1066)) + fun tipc_max_media_name():I32 => @pony_os_sockopt_option(I32(1067)) + fun tipc_max_user_msg_size():I32 => @pony_os_sockopt_option(I32(1068)) + fun tipc_medium_importance():I32 => @pony_os_sockopt_option(I32(1069)) + fun tipc_node_recvq_depth():I32 => @pony_os_sockopt_option(I32(1070)) + fun tipc_node_scope():I32 => @pony_os_sockopt_option(I32(1071)) + fun tipc_ok():I32 => @pony_os_sockopt_option(I32(1072)) + fun tipc_published():I32 => @pony_os_sockopt_option(I32(1073)) + fun tipc_reserved_types():I32 => @pony_os_sockopt_option(I32(1074)) + fun tipc_retdata():I32 => @pony_os_sockopt_option(I32(1075)) + fun tipc_sock_recvq_depth():I32 => @pony_os_sockopt_option(I32(1076)) + fun tipc_src_droppable():I32 => @pony_os_sockopt_option(I32(1077)) + fun tipc_subscr_timeout():I32 => @pony_os_sockopt_option(I32(1078)) + fun tipc_sub_cancel():I32 => @pony_os_sockopt_option(I32(1079)) + fun tipc_sub_ports():I32 => @pony_os_sockopt_option(I32(1080)) + fun tipc_sub_service():I32 => @pony_os_sockopt_option(I32(1081)) + fun tipc_top_srv():I32 => @pony_os_sockopt_option(I32(1082)) + fun tipc_wait_forever():I32 => @pony_os_sockopt_option(I32(1083)) + fun tipc_withdrawn():I32 => @pony_os_sockopt_option(I32(1084)) + fun tipc_zone_scope():I32 => @pony_os_sockopt_option(I32(1085)) + fun ttcp_client_snd_wnd():I32 => @pony_os_sockopt_option(I32(1086)) + fun udp_cork():I32 => @pony_os_sockopt_option(I32(1087)) + fun udp_encap():I32 => @pony_os_sockopt_option(I32(1088)) + fun udp_encap_espinudp():I32 => @pony_os_sockopt_option(I32(1089)) + fun udp_encap_espinudp_maxfraglen():I32 => @pony_os_sockopt_option(I32(1090)) + fun udp_encap_espinudp_non_ike():I32 => @pony_os_sockopt_option(I32(1091)) + fun udp_encap_espinudp_port():I32 => @pony_os_sockopt_option(I32(1092)) + fun udp_encap_l2tpinudp():I32 => @pony_os_sockopt_option(I32(1093)) + fun udp_nocksum():I32 => @pony_os_sockopt_option(I32(1094)) + fun udp_no_check6_rx():I32 => @pony_os_sockopt_option(I32(1095)) + fun udp_no_check6_tx():I32 => @pony_os_sockopt_option(I32(1096)) + fun udp_vendor():I32 => @pony_os_sockopt_option(I32(1097)) diff --git a/packages/net/tcp_connection.pony b/packages/net/tcp_connection.pony index c3cd719698..2d0ba20fad 100644 --- a/packages/net/tcp_connection.pony +++ b/packages/net/tcp_connection.pony @@ -432,7 +432,7 @@ actor TCPConnection socket. """ if _connected then - @pony_os_nodelay[None](_fd, state) + OSSocket.set_tcp_nodelay(_fd, state) end fun ref set_keepalive(secs: U32) => @@ -458,7 +458,7 @@ actor TCPConnection if not _connected and not _closed then // We don't have a connection yet. - if @pony_os_connected[Bool](fd) then + if _is_sock_connected(fd) then // The connection was successful, make it ours. _fd = fd _event = event @@ -935,6 +935,12 @@ actor TCPConnection try (_listen as TCPListener)._conn_closed() end + + // Check this when a connection gets its first writeable event. + fun _is_sock_connected(fd: U32): Bool => + OSSocket.get_so_error(fd) == 0 + + fun ref _apply_backpressure() => if not _throttled then _throttled = true @@ -955,3 +961,6 @@ actor TCPConnection _throttled = false _notify.unthrottled(this) end + + fun get_fd(): U32 => + _fd diff --git a/packages/net/udp_socket.pony b/packages/net/udp_socket.pony index 7769c78bfd..00d99ac0ab 100644 --- a/packages/net/udp_socket.pony +++ b/packages/net/udp_socket.pony @@ -175,7 +175,7 @@ actor UDPSocket """ if not _closed then if _ip.ip4() then - @pony_os_broadcast[None](_fd, state) + OSSocket.set_so_broadcast(_fd, state) elseif _ip.ip6() then @pony_os_multicast_join[None](_fd, "FF02::1".cstring(), "".cstring()) end @@ -198,7 +198,7 @@ actor UDPSocket prevents this. """ if not _closed then - @pony_os_multicast_loopback[None](_fd, loopback) + OSSocket.set_ip_multicast_loop(_fd, loopback) end be set_multicast_ttl(ttl: U8) => @@ -206,7 +206,7 @@ actor UDPSocket Set the TTL for multicast sends. Defaults to 1. """ if not _closed then - @pony_os_multicast_ttl[None](_fd, ttl) + OSSocket.set_ip_multicast_ttl(_fd, ttl) end be multicast_join(group: String, to: String = "") => diff --git a/src/libponyrt/lang/socket.c b/src/libponyrt/lang/socket.c index a18acb3cfe..e421dfc04e 100644 --- a/src/libponyrt/lang/socket.c +++ b/src/libponyrt/lang/socket.c @@ -27,6 +27,7 @@ #include #include #include +#include typedef int SOCKET; #endif @@ -34,6 +35,49 @@ typedef int SOCKET; #include #endif +// headers for get/setsockopt constants +#ifdef PLATFORM_IS_MACOSX +#include +#include +#include +#include +#include +#include +#include +#include +#endif +#ifdef PLATFORM_IS_LINUX +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif +#ifdef PLATFORM_IS_BSD +#include +#include +#include +#include +#include +#include +#include +#include +#endif +#ifdef PLATFORM_IS_WINDOWS +// TODO +#endif + PONY_EXTERN_C_BEGIN PONY_API void pony_os_socket_close(int fd); @@ -45,6 +89,22 @@ typedef struct struct sockaddr_storage addr; } ipaddress_t; +static void api_deprecated(char *oldfunc, char *newfunc) +{ +#ifdef TBD_PENDING_FEATURE + static int count = 0; + + if (count++ == 0) + { + printf(stderr, "Use of %s is deprecated, please use %s instead\n", + oldfunc, newfunc); + sleep(1); + } +#endif + (void)oldfunc; // Hush compiler warnings + (void)newfunc; // Hush compiler warnings +} + static socklen_t address_length(ipaddress_t* ipaddr) { switch(ipaddr->addr.ss_family) @@ -729,6 +789,8 @@ PONY_API bool pony_os_connected(int fd) int val = 0; socklen_t len = sizeof(int); + api_deprecated("@pony_os_connected", + "TCPConnection._is_sock_connected or OSSocket.get_so_error"); if(getsockopt((SOCKET)fd, SOL_SOCKET, SO_ERROR, (char*)&val, &len) == -1) return false; @@ -1049,6 +1111,8 @@ PONY_API void pony_os_keepalive(int fd, int secs) PONY_API void pony_os_nodelay(int fd, bool state) { int val = state; + + api_deprecated("pony_os_nodelay", "OSSocket.set_tcp_nodelay"); setsockopt((SOCKET)fd, IPPROTO_TCP, TCP_NODELAY, (const char*)&val, sizeof(int)); } @@ -1147,6 +1211,8 @@ void ponyint_os_sockets_final() PONY_API void pony_os_broadcast(int fd, bool state) { int broadcast = state ? 1 : 0; + + api_deprecated("pony_os_broadcast", "OSSocket.set_so_broadcast"); setsockopt((SOCKET)fd, SOL_SOCKET, SO_BROADCAST, (const char*)&broadcast, sizeof(broadcast)); } @@ -1167,13 +1233,16 @@ PONY_API void pony_os_multicast_interface(int fd, const char* from) PONY_API void pony_os_multicast_loopback(int fd, bool loopback) { uint8_t loop = loopback ? 1 : 0; + + api_deprecated("pony_os_multicast_loopback", "OSSocket.set_ip_multicast_loop"); setsockopt((SOCKET)fd, IPPROTO_IP, IP_MULTICAST_LOOP, (const char*)&loop, sizeof(loop)); } PONY_API void pony_os_multicast_ttl(int fd, uint8_t ttl) { - setsockopt((SOCKET)fd, IPPROTO_IP, IP_MULTICAST_LOOP, (const char*)&ttl, + api_deprecated("pony_os_multicast_loopttl", "OSSocket.set_ip_multicast_ttl"); + setsockopt((SOCKET)fd, IPPROTO_IP, IP_MULTICAST_TTL, (const char*)&ttl, sizeof(ttl)); } @@ -1277,4 +1346,3797 @@ PONY_API void pony_os_multicast_leave(int fd, const char* group, const char* to) multicast_change(fd, group, to, false); } +#ifdef PLATFORM_IS_WINDOWS +PONY_API int pony_os_getsockopt(int fd, int level, int option_name, char *option_value, int *option_len) +#else +PONY_API int pony_os_getsockopt(int fd, int level, int option_name, void *option_value, socklen_t *option_len) +#endif +{ + if (getsockopt(fd, level, option_name, option_value, option_len) == 0) + return 0; + else + return -errno; +} + +#ifdef PLATFORM_IS_WINDOWS +PONY_API int pony_os_setsockopt(int fd, int level, int option_name, const char *option_value, socklen_t option_len) +#else +PONY_API int pony_os_setsockopt(int fd, int level, int option_name, void *option_value, socklen_t option_len) +#endif +{ + if (setsockopt(fd, level, option_name, option_value, option_len) == 0) + return 0; + else + return -errno; +} + +/* Constants are from + * macOS Sierra 10.12.6 + * Ubuntu Linux Xenial/16.04 LTS + kernel 4.4.0-109-generic + * FreeBSD 11.1-RELEASE + * Windows Winsock function reference for getsockopt & setsockopt: + * https://msdn.microsoft.com/en-us/library/windows/desktop/ms738544(v=vs.85).aspx + * https://msdn.microsoft.com/en-us/library/windows/desktop/ms740476(v=vs.85).aspx + * Harvested by (except Windows): + * egrep -s '\b(_AX25|DCCP|DSO|ICMP|IPSEC|IPT|IPX|IP[A-Z0-6]*|LOCAL|MCAST[A-Z0-6]*|MRT|NDRV|NETLINK|NETROM|RDS|ROSE|SCO|SCTP|SO|SOL|TCP[A-Z0-6]*|TIPC|UDP[A-Z0-6]*)' /usr/include/asm-generic/socket.h /usr/include/linux/atm.h /usr/include/linux/dccp.h /usr/include/linux/dn.h /usr/include/linux/icmp.h /usr/include/linux/in.h /usr/include/linux/in6.h /usr/include/linux/netfilter_ipv4.h /usr/include/linux/netlink.h /usr/include/linux/rds.h /usr/include/linux/tcp.h /usr/include/linux/tipc.h /usr/include/linux/udp.h /usr/include/linux/vm_sockets.h /usr/include/net/ndrv.h /usr/include/netatalk/at.h /usr/include/netax25/ax25.h /usr/include/netfilter_ipv4/ip_tables.h /usr/include/netfilter_ipv6/ip6_tables.h /usr/include/netgraph/bluetooth/include/ng_btsocket.h /usr/include/netinet/in.h /usr/include/netinet/ip_mroute.h /usr/include/netinet/sctp.h /usr/include/netinet/tcp.h /usr/include/netinet/udp.h /usr/include/netipx/ipx.h /usr/include/netrom/netrom.h /usr/include/netrose/rose.h /usr/include/sys/socket.h /usr/include/sys/un.h | egrep -v 'bad-macros-filtered-here|SO_CIRANGE' | egrep '#.*define' | awk '{print $2}' | sort -u + * + * These constants are _not_ stable between Pony releases. + * Values returned by this function may be held by long-lived variables + * by the calling process: values cannot change while the process runs. + * Programmers must not cache any of these values for purposes of + * sharing them for use by any other Pony program (for example, + * sharing via serialization & deserialization or via direct + * shared memory). + */ + +PONY_API int pony_os_sockopt_level(int option) +{ + switch (option) + { + /* + * Formatted in C by: + * egrep '^(IP[A-Z0-6]*PROTO_|NSPROTO_|SOL_)' ~/sum-of-all-constants.txt | egrep -v '\(' | sort -u | egrep -v '^$' | awk 'BEGIN { count=4000; } { printf("#ifdef %s\n case %2d: return %s;\n#endif\n", $1, count++, $1); }' + */ +#ifdef IPPROTO_3PC + case 4000: return IPPROTO_3PC; +#endif +#ifdef IPPROTO_ADFS + case 4001: return IPPROTO_ADFS; +#endif +#ifdef IPPROTO_AH + case 4002: return IPPROTO_AH; +#endif +#ifdef IPPROTO_AHIP + case 4003: return IPPROTO_AHIP; +#endif +#ifdef IPPROTO_APES + case 4004: return IPPROTO_APES; +#endif +#ifdef IPPROTO_ARGUS + case 4005: return IPPROTO_ARGUS; +#endif +#ifdef IPPROTO_AX25 + case 4006: return IPPROTO_AX25; +#endif +#ifdef IPPROTO_BEETPH + case 4007: return IPPROTO_BEETPH; +#endif +#ifdef IPPROTO_BHA + case 4008: return IPPROTO_BHA; +#endif +#ifdef IPPROTO_BLT + case 4009: return IPPROTO_BLT; +#endif +#ifdef IPPROTO_BRSATMON + case 4010: return IPPROTO_BRSATMON; +#endif +#ifdef IPPROTO_CARP + case 4011: return IPPROTO_CARP; +#endif +#ifdef IPPROTO_CFTP + case 4012: return IPPROTO_CFTP; +#endif +#ifdef IPPROTO_CHAOS + case 4013: return IPPROTO_CHAOS; +#endif +#ifdef IPPROTO_CMTP + case 4014: return IPPROTO_CMTP; +#endif +#ifdef IPPROTO_COMP + case 4015: return IPPROTO_COMP; +#endif +#ifdef IPPROTO_CPHB + case 4016: return IPPROTO_CPHB; +#endif +#ifdef IPPROTO_CPNX + case 4017: return IPPROTO_CPNX; +#endif +#ifdef IPPROTO_DCCP + case 4018: return IPPROTO_DCCP; +#endif +#ifdef IPPROTO_DDP + case 4019: return IPPROTO_DDP; +#endif +#ifdef IPPROTO_DGP + case 4020: return IPPROTO_DGP; +#endif +#ifdef IPPROTO_DIVERT + case 4021: return IPPROTO_DIVERT; +#endif +#ifdef IPPROTO_DONE + case 4022: return IPPROTO_DONE; +#endif +#ifdef IPPROTO_DSTOPTS + case 4023: return IPPROTO_DSTOPTS; +#endif +#ifdef IPPROTO_EGP + case 4024: return IPPROTO_EGP; +#endif +#ifdef IPPROTO_EMCON + case 4025: return IPPROTO_EMCON; +#endif +#ifdef IPPROTO_ENCAP + case 4026: return IPPROTO_ENCAP; +#endif +#ifdef IPPROTO_EON + case 4027: return IPPROTO_EON; +#endif +#ifdef IPPROTO_ESP + case 4028: return IPPROTO_ESP; +#endif +#ifdef IPPROTO_ETHERIP + case 4029: return IPPROTO_ETHERIP; +#endif +#ifdef IPPROTO_FRAGMENT + case 4030: return IPPROTO_FRAGMENT; +#endif +#ifdef IPPROTO_GGP + case 4031: return IPPROTO_GGP; +#endif +#ifdef IPPROTO_GMTP + case 4032: return IPPROTO_GMTP; +#endif +#ifdef IPPROTO_GRE + case 4033: return IPPROTO_GRE; +#endif +#ifdef IPPROTO_HELLO + case 4034: return IPPROTO_HELLO; +#endif +#ifdef IPPROTO_HIP + case 4035: return IPPROTO_HIP; +#endif +#ifdef IPPROTO_HMP + case 4036: return IPPROTO_HMP; +#endif +#ifdef IPPROTO_HOPOPTS + case 4037: return IPPROTO_HOPOPTS; +#endif +#ifdef IPPROTO_ICMP + case 4038: return IPPROTO_ICMP; +#endif +#ifdef IPPROTO_ICMPV6 + case 4039: return IPPROTO_ICMPV6; +#endif +#ifdef IPPROTO_IDP + case 4040: return IPPROTO_IDP; +#endif +#ifdef IPPROTO_IDPR + case 4041: return IPPROTO_IDPR; +#endif +#ifdef IPPROTO_IDRP + case 4042: return IPPROTO_IDRP; +#endif +#ifdef IPPROTO_IGMP + case 4043: return IPPROTO_IGMP; +#endif +#ifdef IPPROTO_IGP + case 4044: return IPPROTO_IGP; +#endif +#ifdef IPPROTO_IGRP + case 4045: return IPPROTO_IGRP; +#endif +#ifdef IPPROTO_IL + case 4046: return IPPROTO_IL; +#endif +#ifdef IPPROTO_INLSP + case 4047: return IPPROTO_INLSP; +#endif +#ifdef IPPROTO_INP + case 4048: return IPPROTO_INP; +#endif +#ifdef IPPROTO_IP + case 4049: return IPPROTO_IP; +#endif +#ifdef IPPROTO_IPCOMP + case 4050: return IPPROTO_IPCOMP; +#endif +#ifdef IPPROTO_IPCV + case 4051: return IPPROTO_IPCV; +#endif +#ifdef IPPROTO_IPEIP + case 4052: return IPPROTO_IPEIP; +#endif +#ifdef IPPROTO_IPIP + case 4053: return IPPROTO_IPIP; +#endif +#ifdef IPPROTO_IPPC + case 4054: return IPPROTO_IPPC; +#endif +#ifdef IPPROTO_IPV4 + case 4055: return IPPROTO_IPV4; +#endif +#ifdef IPPROTO_IPV6 + case 4056: return IPPROTO_IPV6; +#endif +#ifdef IPPROTO_IRTP + case 4057: return IPPROTO_IRTP; +#endif +#ifdef IPPROTO_KRYPTOLAN + case 4058: return IPPROTO_KRYPTOLAN; +#endif +#ifdef IPPROTO_LARP + case 4059: return IPPROTO_LARP; +#endif +#ifdef IPPROTO_LEAF1 + case 4060: return IPPROTO_LEAF1; +#endif +#ifdef IPPROTO_LEAF2 + case 4061: return IPPROTO_LEAF2; +#endif +#ifdef IPPROTO_MAX + case 4062: return IPPROTO_MAX; +#endif +#ifdef IPPROTO_MAXID + case 4063: return IPPROTO_MAXID; +#endif +#ifdef IPPROTO_MEAS + case 4064: return IPPROTO_MEAS; +#endif +#ifdef IPPROTO_MH + case 4065: return IPPROTO_MH; +#endif +#ifdef IPPROTO_MHRP + case 4066: return IPPROTO_MHRP; +#endif +#ifdef IPPROTO_MICP + case 4067: return IPPROTO_MICP; +#endif +#ifdef IPPROTO_MOBILE + case 4068: return IPPROTO_MOBILE; +#endif +#ifdef IPPROTO_MPLS + case 4069: return IPPROTO_MPLS; +#endif +#ifdef IPPROTO_MTP + case 4070: return IPPROTO_MTP; +#endif +#ifdef IPPROTO_MUX + case 4071: return IPPROTO_MUX; +#endif +#ifdef IPPROTO_ND + case 4072: return IPPROTO_ND; +#endif +#ifdef IPPROTO_NHRP + case 4073: return IPPROTO_NHRP; +#endif +#ifdef IPPROTO_NONE + case 4074: return IPPROTO_NONE; +#endif +#ifdef IPPROTO_NSP + case 4075: return IPPROTO_NSP; +#endif +#ifdef IPPROTO_NVPII + case 4076: return IPPROTO_NVPII; +#endif +#ifdef IPPROTO_OLD_DIVERT + case 4077: return IPPROTO_OLD_DIVERT; +#endif +#ifdef IPPROTO_OSPFIGP + case 4078: return IPPROTO_OSPFIGP; +#endif +#ifdef IPPROTO_PFSYNC + case 4079: return IPPROTO_PFSYNC; +#endif +#ifdef IPPROTO_PGM + case 4080: return IPPROTO_PGM; +#endif +#ifdef IPPROTO_PIGP + case 4081: return IPPROTO_PIGP; +#endif +#ifdef IPPROTO_PIM + case 4082: return IPPROTO_PIM; +#endif +#ifdef IPPROTO_PRM + case 4083: return IPPROTO_PRM; +#endif +#ifdef IPPROTO_PUP + case 4084: return IPPROTO_PUP; +#endif +#ifdef IPPROTO_PVP + case 4085: return IPPROTO_PVP; +#endif +#ifdef IPPROTO_RAW + case 4086: return IPPROTO_RAW; +#endif +#ifdef IPPROTO_RCCMON + case 4087: return IPPROTO_RCCMON; +#endif +#ifdef IPPROTO_RDP + case 4088: return IPPROTO_RDP; +#endif +#ifdef IPPROTO_RESERVED_253 + case 4089: return IPPROTO_RESERVED_253; +#endif +#ifdef IPPROTO_RESERVED_254 + case 4090: return IPPROTO_RESERVED_254; +#endif +#ifdef IPPROTO_ROUTING + case 4091: return IPPROTO_ROUTING; +#endif +#ifdef IPPROTO_RSVP + case 4092: return IPPROTO_RSVP; +#endif +#ifdef IPPROTO_RVD + case 4093: return IPPROTO_RVD; +#endif +#ifdef IPPROTO_SATEXPAK + case 4094: return IPPROTO_SATEXPAK; +#endif +#ifdef IPPROTO_SATMON + case 4095: return IPPROTO_SATMON; +#endif +#ifdef IPPROTO_SCCSP + case 4096: return IPPROTO_SCCSP; +#endif +#ifdef IPPROTO_SCTP + case 4097: return IPPROTO_SCTP; +#endif +#ifdef IPPROTO_SDRP + case 4098: return IPPROTO_SDRP; +#endif +#ifdef IPPROTO_SEND + case 4099: return IPPROTO_SEND; +#endif +#ifdef IPPROTO_SEP + case 4100: return IPPROTO_SEP; +#endif +#ifdef IPPROTO_SHIM6 + case 4101: return IPPROTO_SHIM6; +#endif +#ifdef IPPROTO_SKIP + case 4102: return IPPROTO_SKIP; +#endif +#ifdef IPPROTO_SPACER + case 4103: return IPPROTO_SPACER; +#endif +#ifdef IPPROTO_SRPC + case 4104: return IPPROTO_SRPC; +#endif +#ifdef IPPROTO_ST + case 4105: return IPPROTO_ST; +#endif +#ifdef IPPROTO_SVMTP + case 4106: return IPPROTO_SVMTP; +#endif +#ifdef IPPROTO_SWIPE + case 4107: return IPPROTO_SWIPE; +#endif +#ifdef IPPROTO_TCF + case 4108: return IPPROTO_TCF; +#endif +#ifdef IPPROTO_TCP + case 4109: return IPPROTO_TCP; +#endif +#ifdef IPPROTO_TLSP + case 4110: return IPPROTO_TLSP; +#endif +#ifdef IPPROTO_TP + case 4111: return IPPROTO_TP; +#endif +#ifdef IPPROTO_TPXX + case 4112: return IPPROTO_TPXX; +#endif +#ifdef IPPROTO_TRUNK1 + case 4113: return IPPROTO_TRUNK1; +#endif +#ifdef IPPROTO_TRUNK2 + case 4114: return IPPROTO_TRUNK2; +#endif +#ifdef IPPROTO_TTP + case 4115: return IPPROTO_TTP; +#endif +#ifdef IPPROTO_UDP + case 4116: return IPPROTO_UDP; +#endif +#ifdef IPPROTO_UDPLITE + case 4117: return IPPROTO_UDPLITE; +#endif +#ifdef IPPROTO_VINES + case 4118: return IPPROTO_VINES; +#endif +#ifdef IPPROTO_VISA + case 4119: return IPPROTO_VISA; +#endif +#ifdef IPPROTO_VMTP + case 4120: return IPPROTO_VMTP; +#endif +#ifdef IPPROTO_WBEXPAK + case 4121: return IPPROTO_WBEXPAK; +#endif +#ifdef IPPROTO_WBMON + case 4122: return IPPROTO_WBMON; +#endif +#ifdef IPPROTO_WSN + case 4123: return IPPROTO_WSN; +#endif +#ifdef IPPROTO_XNET + case 4124: return IPPROTO_XNET; +#endif +#ifdef IPPROTO_XTP + case 4125: return IPPROTO_XTP; +#endif +#ifdef SOL_ATALK + case 4126: return SOL_ATALK; +#endif +#ifdef SOL_AX25 + case 4127: return SOL_AX25; +#endif +#ifdef SOL_HCI_RAW + case 4128: return SOL_HCI_RAW; +#endif +#ifdef SOL_IPX + case 4129: return SOL_IPX; +#endif +#ifdef SOL_L2CAP + case 4130: return SOL_L2CAP; +#endif +#ifdef SOL_LOCAL + case 4131: return SOL_LOCAL; +#endif +#ifdef SOL_NDRVPROTO + case 4132: return SOL_NDRVPROTO; +#endif +#ifdef SOL_NETROM + case 4133: return SOL_NETROM; +#endif +#ifdef SOL_RDS + case 4134: return SOL_RDS; +#endif +#ifdef SOL_RFCOMM + case 4135: return SOL_RFCOMM; +#endif +#ifdef SOL_ROSE + case 4136: return SOL_ROSE; +#endif +#ifdef SOL_SCO + case 4137: return SOL_SCO; +#endif +#ifdef SOL_SOCKET + case 4138: return SOL_SOCKET; +#endif +#ifdef SOL_TIPC + case 4139: return SOL_TIPC; +#endif +#ifdef SOL_UDP + case 4140: return SOL_UDP; +#endif + default: return -1; + } +} + +/* + * These constants are _not_ stable between Pony releases. + * Values returned by this function may be held by long-lived variables + * by the calling process: values cannot change while the process runs. + * Programmers must not cache any of these values for purposes of + * sharing them for use by any other Pony program (for example, + * sharing via serialization & deserialization or via direct + * shared memory). + */ + +PONY_API int pony_os_sockopt_option(int option) +{ + switch (option) + { + /* + * Formatted in C by: + * egrep -v '^(IP[A-Z0-6]*PROTO_|NSPROTO_|SOL_)' ~/sum-of-all-constants.txt | egrep -v '\(' | sort -u | egrep -v '^$' | awk '{ printf("#ifdef %s\n case %2d: return %s;\n#endif\n", $1, count++, $1); }' + */ +#ifdef AF_COIP + case 0: return AF_COIP; +#endif +#ifdef AF_INET + case 1: return AF_INET; +#endif +#ifdef AF_INET6 + case 2: return AF_INET6; +#endif +#ifdef BLUETOOTH_PROTO_SCO + case 3: return BLUETOOTH_PROTO_SCO; +#endif +#ifdef DCCP_NR_PKT_TYPES + case 4: return DCCP_NR_PKT_TYPES; +#endif +#ifdef DCCP_SERVICE_LIST_MAX_LEN + case 5: return DCCP_SERVICE_LIST_MAX_LEN; +#endif +#ifdef DCCP_SINGLE_OPT_MAXLEN + case 6: return DCCP_SINGLE_OPT_MAXLEN; +#endif +#ifdef DCCP_SOCKOPT_AVAILABLE_CCIDS + case 7: return DCCP_SOCKOPT_AVAILABLE_CCIDS; +#endif +#ifdef DCCP_SOCKOPT_CCID + case 8: return DCCP_SOCKOPT_CCID; +#endif +#ifdef DCCP_SOCKOPT_CCID_RX_INFO + case 9: return DCCP_SOCKOPT_CCID_RX_INFO; +#endif +#ifdef DCCP_SOCKOPT_CCID_TX_INFO + case 10: return DCCP_SOCKOPT_CCID_TX_INFO; +#endif +#ifdef DCCP_SOCKOPT_CHANGE_L + case 11: return DCCP_SOCKOPT_CHANGE_L; +#endif +#ifdef DCCP_SOCKOPT_CHANGE_R + case 12: return DCCP_SOCKOPT_CHANGE_R; +#endif +#ifdef DCCP_SOCKOPT_GET_CUR_MPS + case 13: return DCCP_SOCKOPT_GET_CUR_MPS; +#endif +#ifdef DCCP_SOCKOPT_PACKET_SIZE + case 14: return DCCP_SOCKOPT_PACKET_SIZE; +#endif +#ifdef DCCP_SOCKOPT_QPOLICY_ID + case 15: return DCCP_SOCKOPT_QPOLICY_ID; +#endif +#ifdef DCCP_SOCKOPT_QPOLICY_TXQLEN + case 16: return DCCP_SOCKOPT_QPOLICY_TXQLEN; +#endif +#ifdef DCCP_SOCKOPT_RECV_CSCOV + case 17: return DCCP_SOCKOPT_RECV_CSCOV; +#endif +#ifdef DCCP_SOCKOPT_RX_CCID + case 18: return DCCP_SOCKOPT_RX_CCID; +#endif +#ifdef DCCP_SOCKOPT_SEND_CSCOV + case 19: return DCCP_SOCKOPT_SEND_CSCOV; +#endif +#ifdef DCCP_SOCKOPT_SERVER_TIMEWAIT + case 20: return DCCP_SOCKOPT_SERVER_TIMEWAIT; +#endif +#ifdef DCCP_SOCKOPT_SERVICE + case 21: return DCCP_SOCKOPT_SERVICE; +#endif +#ifdef DCCP_SOCKOPT_TX_CCID + case 22: return DCCP_SOCKOPT_TX_CCID; +#endif +#ifdef DSO_ACCEPTMODE + case 23: return DSO_ACCEPTMODE; +#endif +#ifdef DSO_CONACCEPT + case 24: return DSO_CONACCEPT; +#endif +#ifdef DSO_CONACCESS + case 25: return DSO_CONACCESS; +#endif +#ifdef DSO_CONDATA + case 26: return DSO_CONDATA; +#endif +#ifdef DSO_CONREJECT + case 27: return DSO_CONREJECT; +#endif +#ifdef DSO_CORK + case 28: return DSO_CORK; +#endif +#ifdef DSO_DISDATA + case 29: return DSO_DISDATA; +#endif +#ifdef DSO_INFO + case 30: return DSO_INFO; +#endif +#ifdef DSO_LINKINFO + case 31: return DSO_LINKINFO; +#endif +#ifdef DSO_MAX + case 32: return DSO_MAX; +#endif +#ifdef DSO_MAXWINDOW + case 33: return DSO_MAXWINDOW; +#endif +#ifdef DSO_NODELAY + case 34: return DSO_NODELAY; +#endif +#ifdef DSO_SEQPACKET + case 35: return DSO_SEQPACKET; +#endif +#ifdef DSO_SERVICES + case 36: return DSO_SERVICES; +#endif +#ifdef DSO_STREAM + case 37: return DSO_STREAM; +#endif +#ifdef ICMP_ADDRESS + case 38: return ICMP_ADDRESS; +#endif +#ifdef ICMP_ADDRESSREPLY + case 39: return ICMP_ADDRESSREPLY; +#endif +#ifdef ICMP_DEST_UNREACH + case 40: return ICMP_DEST_UNREACH; +#endif +#ifdef ICMP_ECHO + case 41: return ICMP_ECHO; +#endif +#ifdef ICMP_ECHOREPLY + case 42: return ICMP_ECHOREPLY; +#endif +#ifdef ICMP_EXC_FRAGTIME + case 43: return ICMP_EXC_FRAGTIME; +#endif +#ifdef ICMP_EXC_TTL + case 44: return ICMP_EXC_TTL; +#endif +#ifdef ICMP_FILTER + case 45: return ICMP_FILTER; +#endif +#ifdef ICMP_FRAG_NEEDED + case 46: return ICMP_FRAG_NEEDED; +#endif +#ifdef ICMP_HOST_ANO + case 47: return ICMP_HOST_ANO; +#endif +#ifdef ICMP_HOST_ISOLATED + case 48: return ICMP_HOST_ISOLATED; +#endif +#ifdef ICMP_HOST_UNKNOWN + case 49: return ICMP_HOST_UNKNOWN; +#endif +#ifdef ICMP_HOST_UNREACH + case 50: return ICMP_HOST_UNREACH; +#endif +#ifdef ICMP_HOST_UNR_TOS + case 51: return ICMP_HOST_UNR_TOS; +#endif +#ifdef ICMP_INFO_REPLY + case 52: return ICMP_INFO_REPLY; +#endif +#ifdef ICMP_INFO_REQUEST + case 53: return ICMP_INFO_REQUEST; +#endif +#ifdef ICMP_NET_ANO + case 54: return ICMP_NET_ANO; +#endif +#ifdef ICMP_NET_UNKNOWN + case 55: return ICMP_NET_UNKNOWN; +#endif +#ifdef ICMP_NET_UNREACH + case 56: return ICMP_NET_UNREACH; +#endif +#ifdef ICMP_NET_UNR_TOS + case 57: return ICMP_NET_UNR_TOS; +#endif +#ifdef ICMP_PARAMETERPROB + case 58: return ICMP_PARAMETERPROB; +#endif +#ifdef ICMP_PKT_FILTERED + case 59: return ICMP_PKT_FILTERED; +#endif +#ifdef ICMP_PORT_UNREACH + case 60: return ICMP_PORT_UNREACH; +#endif +#ifdef ICMP_PREC_CUTOFF + case 61: return ICMP_PREC_CUTOFF; +#endif +#ifdef ICMP_PREC_VIOLATION + case 62: return ICMP_PREC_VIOLATION; +#endif +#ifdef ICMP_PROT_UNREACH + case 63: return ICMP_PROT_UNREACH; +#endif +#ifdef ICMP_REDIRECT + case 64: return ICMP_REDIRECT; +#endif +#ifdef ICMP_REDIR_HOST + case 65: return ICMP_REDIR_HOST; +#endif +#ifdef ICMP_REDIR_HOSTTOS + case 66: return ICMP_REDIR_HOSTTOS; +#endif +#ifdef ICMP_REDIR_NET + case 67: return ICMP_REDIR_NET; +#endif +#ifdef ICMP_REDIR_NETTOS + case 68: return ICMP_REDIR_NETTOS; +#endif +#ifdef ICMP_SOURCE_QUENCH + case 69: return ICMP_SOURCE_QUENCH; +#endif +#ifdef ICMP_SR_FAILED + case 70: return ICMP_SR_FAILED; +#endif +#ifdef ICMP_TIMESTAMP + case 71: return ICMP_TIMESTAMP; +#endif +#ifdef ICMP_TIMESTAMPREPLY + case 72: return ICMP_TIMESTAMPREPLY; +#endif +#ifdef ICMP_TIME_EXCEEDED + case 73: return ICMP_TIME_EXCEEDED; +#endif +#ifdef IPCTL_ACCEPTSOURCEROUTE + case 74: return IPCTL_ACCEPTSOURCEROUTE; +#endif +#ifdef IPCTL_DEFMTU + case 75: return IPCTL_DEFMTU; +#endif +#ifdef IPCTL_DEFTTL + case 76: return IPCTL_DEFTTL; +#endif +#ifdef IPCTL_DIRECTEDBROADCAST + case 77: return IPCTL_DIRECTEDBROADCAST; +#endif +#ifdef IPCTL_FASTFORWARDING + case 78: return IPCTL_FASTFORWARDING; +#endif +#ifdef IPCTL_FORWARDING + case 79: return IPCTL_FORWARDING; +#endif +#ifdef IPCTL_GIF_TTL + case 80: return IPCTL_GIF_TTL; +#endif +#ifdef IPCTL_INTRDQDROPS + case 81: return IPCTL_INTRDQDROPS; +#endif +#ifdef IPCTL_INTRDQMAXLEN + case 82: return IPCTL_INTRDQMAXLEN; +#endif +#ifdef IPCTL_INTRQDROPS + case 83: return IPCTL_INTRQDROPS; +#endif +#ifdef IPCTL_INTRQMAXLEN + case 84: return IPCTL_INTRQMAXLEN; +#endif +#ifdef IPCTL_KEEPFAITH + case 85: return IPCTL_KEEPFAITH; +#endif +#ifdef IPCTL_MAXID + case 86: return IPCTL_MAXID; +#endif +#ifdef IPCTL_RTEXPIRE + case 87: return IPCTL_RTEXPIRE; +#endif +#ifdef IPCTL_RTMAXCACHE + case 88: return IPCTL_RTMAXCACHE; +#endif +#ifdef IPCTL_RTMINEXPIRE + case 89: return IPCTL_RTMINEXPIRE; +#endif +#ifdef IPCTL_SENDREDIRECTS + case 90: return IPCTL_SENDREDIRECTS; +#endif +#ifdef IPCTL_SOURCEROUTE + case 91: return IPCTL_SOURCEROUTE; +#endif +#ifdef IPCTL_STATS + case 92: return IPCTL_STATS; +#endif +#ifdef IPPORT_EPHEMERALFIRST + case 93: return IPPORT_EPHEMERALFIRST; +#endif +#ifdef IPPORT_EPHEMERALLAST + case 94: return IPPORT_EPHEMERALLAST; +#endif +#ifdef IPPORT_HIFIRSTAUTO + case 95: return IPPORT_HIFIRSTAUTO; +#endif +#ifdef IPPORT_HILASTAUTO + case 96: return IPPORT_HILASTAUTO; +#endif +#ifdef IPPORT_MAX + case 97: return IPPORT_MAX; +#endif +#ifdef IPPORT_RESERVED + case 98: return IPPORT_RESERVED; +#endif +#ifdef IPPORT_RESERVEDSTART + case 99: return IPPORT_RESERVEDSTART; +#endif +#ifdef IPPORT_USERRESERVED + case 100: return IPPORT_USERRESERVED; +#endif +#ifdef IPV6_2292DSTOPTS + case 101: return IPV6_2292DSTOPTS; +#endif +#ifdef IPV6_2292HOPLIMIT + case 102: return IPV6_2292HOPLIMIT; +#endif +#ifdef IPV6_2292HOPOPTS + case 103: return IPV6_2292HOPOPTS; +#endif +#ifdef IPV6_2292PKTINFO + case 104: return IPV6_2292PKTINFO; +#endif +#ifdef IPV6_2292PKTOPTIONS + case 105: return IPV6_2292PKTOPTIONS; +#endif +#ifdef IPV6_2292RTHDR + case 106: return IPV6_2292RTHDR; +#endif +#ifdef IPV6_ADDRFORM + case 107: return IPV6_ADDRFORM; +#endif +#ifdef IPV6_ADDR_PREFERENCES + case 108: return IPV6_ADDR_PREFERENCES; +#endif +#ifdef IPV6_ADD_MEMBERSHIP + case 109: return IPV6_ADD_MEMBERSHIP; +#endif +#ifdef IPV6_AUTHHDR + case 110: return IPV6_AUTHHDR; +#endif +#ifdef IPV6_AUTOFLOWLABEL + case 111: return IPV6_AUTOFLOWLABEL; +#endif +#ifdef IPV6_CHECKSUM + case 112: return IPV6_CHECKSUM; +#endif +#ifdef IPV6_DONTFRAG + case 113: return IPV6_DONTFRAG; +#endif +#ifdef IPV6_DROP_MEMBERSHIP + case 114: return IPV6_DROP_MEMBERSHIP; +#endif +#ifdef IPV6_DSTOPTS + case 115: return IPV6_DSTOPTS; +#endif +#ifdef IPV6_FLOWINFO + case 116: return IPV6_FLOWINFO; +#endif +#ifdef IPV6_FLOWINFO_FLOWLABEL + case 117: return IPV6_FLOWINFO_FLOWLABEL; +#endif +#ifdef IPV6_FLOWINFO_PRIORITY + case 118: return IPV6_FLOWINFO_PRIORITY; +#endif +#ifdef IPV6_FLOWINFO_SEND + case 119: return IPV6_FLOWINFO_SEND; +#endif +#ifdef IPV6_FLOWLABEL_MGR + case 120: return IPV6_FLOWLABEL_MGR; +#endif +#ifdef IPV6_FL_A_GET + case 121: return IPV6_FL_A_GET; +#endif +#ifdef IPV6_FL_A_PUT + case 122: return IPV6_FL_A_PUT; +#endif +#ifdef IPV6_FL_A_RENEW + case 123: return IPV6_FL_A_RENEW; +#endif +#ifdef IPV6_FL_F_CREATE + case 124: return IPV6_FL_F_CREATE; +#endif +#ifdef IPV6_FL_F_EXCL + case 125: return IPV6_FL_F_EXCL; +#endif +#ifdef IPV6_FL_F_REFLECT + case 126: return IPV6_FL_F_REFLECT; +#endif +#ifdef IPV6_FL_F_REMOTE + case 127: return IPV6_FL_F_REMOTE; +#endif +#ifdef IPV6_FL_S_ANY + case 128: return IPV6_FL_S_ANY; +#endif +#ifdef IPV6_FL_S_EXCL + case 129: return IPV6_FL_S_EXCL; +#endif +#ifdef IPV6_FL_S_NONE + case 130: return IPV6_FL_S_NONE; +#endif +#ifdef IPV6_FL_S_PROCESS + case 131: return IPV6_FL_S_PROCESS; +#endif +#ifdef IPV6_FL_S_USER + case 132: return IPV6_FL_S_USER; +#endif +#ifdef IPV6_HOPLIMIT + case 133: return IPV6_HOPLIMIT; +#endif +#ifdef IPV6_HOPOPTS + case 134: return IPV6_HOPOPTS; +#endif +#ifdef IPV6_IPSEC_POLICY + case 135: return IPV6_IPSEC_POLICY; +#endif +#ifdef IPV6_JOIN_ANYCAST + case 136: return IPV6_JOIN_ANYCAST; +#endif +#ifdef IPV6_LEAVE_ANYCAST + case 137: return IPV6_LEAVE_ANYCAST; +#endif +#ifdef IPV6_MINHOPCOUNT + case 138: return IPV6_MINHOPCOUNT; +#endif +#ifdef IPV6_MTU + case 139: return IPV6_MTU; +#endif +#ifdef IPV6_MTU_DISCOVER + case 140: return IPV6_MTU_DISCOVER; +#endif +#ifdef IPV6_MULTICAST_HOPS + case 141: return IPV6_MULTICAST_HOPS; +#endif +#ifdef IPV6_MULTICAST_IF + case 142: return IPV6_MULTICAST_IF; +#endif +#ifdef IPV6_MULTICAST_LOOP + case 143: return IPV6_MULTICAST_LOOP; +#endif +#ifdef IPV6_NEXTHOP + case 144: return IPV6_NEXTHOP; +#endif +#ifdef IPV6_ORIGDSTADDR + case 145: return IPV6_ORIGDSTADDR; +#endif +#ifdef IPV6_PATHMTU + case 146: return IPV6_PATHMTU; +#endif +#ifdef IPV6_PKTINFO + case 147: return IPV6_PKTINFO; +#endif +#ifdef IPV6_PMTUDISC_DO + case 148: return IPV6_PMTUDISC_DO; +#endif +#ifdef IPV6_PMTUDISC_DONT + case 149: return IPV6_PMTUDISC_DONT; +#endif +#ifdef IPV6_PMTUDISC_INTERFACE + case 150: return IPV6_PMTUDISC_INTERFACE; +#endif +#ifdef IPV6_PMTUDISC_OMIT + case 151: return IPV6_PMTUDISC_OMIT; +#endif +#ifdef IPV6_PMTUDISC_PROBE + case 152: return IPV6_PMTUDISC_PROBE; +#endif +#ifdef IPV6_PMTUDISC_WANT + case 153: return IPV6_PMTUDISC_WANT; +#endif +#ifdef IPV6_PREFER_SRC_CGA + case 154: return IPV6_PREFER_SRC_CGA; +#endif +#ifdef IPV6_PREFER_SRC_COA + case 155: return IPV6_PREFER_SRC_COA; +#endif +#ifdef IPV6_PREFER_SRC_HOME + case 156: return IPV6_PREFER_SRC_HOME; +#endif +#ifdef IPV6_PREFER_SRC_NONCGA + case 157: return IPV6_PREFER_SRC_NONCGA; +#endif +#ifdef IPV6_PREFER_SRC_PUBLIC + case 158: return IPV6_PREFER_SRC_PUBLIC; +#endif +#ifdef IPV6_PREFER_SRC_PUBTMP_DEFAULT + case 159: return IPV6_PREFER_SRC_PUBTMP_DEFAULT; +#endif +#ifdef IPV6_PREFER_SRC_TMP + case 160: return IPV6_PREFER_SRC_TMP; +#endif +#ifdef IPV6_PRIORITY_10 + case 161: return IPV6_PRIORITY_10; +#endif +#ifdef IPV6_PRIORITY_11 + case 162: return IPV6_PRIORITY_11; +#endif +#ifdef IPV6_PRIORITY_12 + case 163: return IPV6_PRIORITY_12; +#endif +#ifdef IPV6_PRIORITY_13 + case 164: return IPV6_PRIORITY_13; +#endif +#ifdef IPV6_PRIORITY_14 + case 165: return IPV6_PRIORITY_14; +#endif +#ifdef IPV6_PRIORITY_15 + case 166: return IPV6_PRIORITY_15; +#endif +#ifdef IPV6_PRIORITY_8 + case 167: return IPV6_PRIORITY_8; +#endif +#ifdef IPV6_PRIORITY_9 + case 168: return IPV6_PRIORITY_9; +#endif +#ifdef IPV6_PRIORITY_BULK + case 169: return IPV6_PRIORITY_BULK; +#endif +#ifdef IPV6_PRIORITY_CONTROL + case 170: return IPV6_PRIORITY_CONTROL; +#endif +#ifdef IPV6_PRIORITY_FILLER + case 171: return IPV6_PRIORITY_FILLER; +#endif +#ifdef IPV6_PRIORITY_INTERACTIVE + case 172: return IPV6_PRIORITY_INTERACTIVE; +#endif +#ifdef IPV6_PRIORITY_RESERVED1 + case 173: return IPV6_PRIORITY_RESERVED1; +#endif +#ifdef IPV6_PRIORITY_RESERVED2 + case 174: return IPV6_PRIORITY_RESERVED2; +#endif +#ifdef IPV6_PRIORITY_UNATTENDED + case 175: return IPV6_PRIORITY_UNATTENDED; +#endif +#ifdef IPV6_PRIORITY_UNCHARACTERIZED + case 176: return IPV6_PRIORITY_UNCHARACTERIZED; +#endif +#ifdef IPV6_RECVDSTOPTS + case 177: return IPV6_RECVDSTOPTS; +#endif +#ifdef IPV6_RECVERR + case 178: return IPV6_RECVERR; +#endif +#ifdef IPV6_RECVHOPLIMIT + case 179: return IPV6_RECVHOPLIMIT; +#endif +#ifdef IPV6_RECVHOPOPTS + case 180: return IPV6_RECVHOPOPTS; +#endif +#ifdef IPV6_RECVORIGDSTADDR + case 181: return IPV6_RECVORIGDSTADDR; +#endif +#ifdef IPV6_RECVPATHMTU + case 182: return IPV6_RECVPATHMTU; +#endif +#ifdef IPV6_RECVPKTINFO + case 183: return IPV6_RECVPKTINFO; +#endif +#ifdef IPV6_RECVRTHDR + case 184: return IPV6_RECVRTHDR; +#endif +#ifdef IPV6_RECVTCLASS + case 185: return IPV6_RECVTCLASS; +#endif +#ifdef IPV6_ROUTER_ALERT + case 186: return IPV6_ROUTER_ALERT; +#endif +#ifdef IPV6_RTHDR + case 187: return IPV6_RTHDR; +#endif +#ifdef IPV6_RTHDRDSTOPTS + case 188: return IPV6_RTHDRDSTOPTS; +#endif +#ifdef IPV6_TCLASS + case 189: return IPV6_TCLASS; +#endif +#ifdef IPV6_TLV_HAO + case 190: return IPV6_TLV_HAO; +#endif +#ifdef IPV6_TLV_JUMBO + case 191: return IPV6_TLV_JUMBO; +#endif +#ifdef IPV6_TLV_PAD1 + case 192: return IPV6_TLV_PAD1; +#endif +#ifdef IPV6_TLV_PADN + case 193: return IPV6_TLV_PADN; +#endif +#ifdef IPV6_TLV_ROUTERALERT + case 194: return IPV6_TLV_ROUTERALERT; +#endif +#ifdef IPV6_TRANSPARENT + case 195: return IPV6_TRANSPARENT; +#endif +#ifdef IPV6_UNICAST_HOPS + case 196: return IPV6_UNICAST_HOPS; +#endif +#ifdef IPV6_UNICAST_IF + case 197: return IPV6_UNICAST_IF; +#endif +#ifdef IPV6_USE_MIN_MTU + case 198: return IPV6_USE_MIN_MTU; +#endif +#ifdef IPV6_V6ONLY + case 199: return IPV6_V6ONLY; +#endif +#ifdef IPV6_XFRM_POLICY + case 200: return IPV6_XFRM_POLICY; +#endif +#ifdef IPX_ADDRESS + case 201: return IPX_ADDRESS; +#endif +#ifdef IPX_ADDRESS_NOTIFY + case 202: return IPX_ADDRESS_NOTIFY; +#endif +#ifdef IPX_CRTITF + case 203: return IPX_CRTITF; +#endif +#ifdef IPX_DLTITF + case 204: return IPX_DLTITF; +#endif +#ifdef IPX_DSTYPE + case 205: return IPX_DSTYPE; +#endif +#ifdef IPX_EXTENDED_ADDRESS + case 206: return IPX_EXTENDED_ADDRESS; +#endif +#ifdef IPX_FILTERPTYPE + case 207: return IPX_FILTERPTYPE; +#endif +#ifdef IPX_FRAME_8022 + case 208: return IPX_FRAME_8022; +#endif +#ifdef IPX_FRAME_8023 + case 209: return IPX_FRAME_8023; +#endif +#ifdef IPX_FRAME_ETHERII + case 210: return IPX_FRAME_ETHERII; +#endif +#ifdef IPX_FRAME_NONE + case 211: return IPX_FRAME_NONE; +#endif +#ifdef IPX_FRAME_SNAP + case 212: return IPX_FRAME_SNAP; +#endif +#ifdef IPX_FRAME_TR_8022 + case 213: return IPX_FRAME_TR_8022; +#endif +#ifdef IPX_GETNETINFO + case 214: return IPX_GETNETINFO; +#endif +#ifdef IPX_GETNETINFO_NORIP + case 215: return IPX_GETNETINFO_NORIP; +#endif +#ifdef IPX_IMMEDIATESPXACK + case 216: return IPX_IMMEDIATESPXACK; +#endif +#ifdef IPX_INTERNAL + case 217: return IPX_INTERNAL; +#endif +#ifdef IPX_MAXSIZE + case 218: return IPX_MAXSIZE; +#endif +#ifdef IPX_MAX_ADAPTER_NUM + case 219: return IPX_MAX_ADAPTER_NUM; +#endif +#ifdef IPX_MTU + case 220: return IPX_MTU; +#endif +#ifdef IPX_NODE_LEN + case 221: return IPX_NODE_LEN; +#endif +#ifdef IPX_PRIMARY + case 222: return IPX_PRIMARY; +#endif +#ifdef IPX_PTYPE + case 223: return IPX_PTYPE; +#endif +#ifdef IPX_RECEIVE_BROADCAST + case 224: return IPX_RECEIVE_BROADCAST; +#endif +#ifdef IPX_RECVHDR + case 225: return IPX_RECVHDR; +#endif +#ifdef IPX_RERIPNETNUMBER + case 226: return IPX_RERIPNETNUMBER; +#endif +#ifdef IPX_ROUTE_NO_ROUTER + case 227: return IPX_ROUTE_NO_ROUTER; +#endif +#ifdef IPX_RT_8022 + case 228: return IPX_RT_8022; +#endif +#ifdef IPX_RT_BLUEBOOK + case 229: return IPX_RT_BLUEBOOK; +#endif +#ifdef IPX_RT_ROUTED + case 230: return IPX_RT_ROUTED; +#endif +#ifdef IPX_RT_SNAP + case 231: return IPX_RT_SNAP; +#endif +#ifdef IPX_SPECIAL_NONE + case 232: return IPX_SPECIAL_NONE; +#endif +#ifdef IPX_SPXGETCONNECTIONSTATUS + case 233: return IPX_SPXGETCONNECTIONSTATUS; +#endif +#ifdef IPX_STOPFILTERPTYPE + case 234: return IPX_STOPFILTERPTYPE; +#endif +#ifdef IPX_TYPE + case 235: return IPX_TYPE; +#endif +#ifdef IP_ADD_MEMBERSHIP + case 236: return IP_ADD_MEMBERSHIP; +#endif +#ifdef IP_ADD_SOURCE_MEMBERSHIP + case 237: return IP_ADD_SOURCE_MEMBERSHIP; +#endif +#ifdef IP_BINDANY + case 238: return IP_BINDANY; +#endif +#ifdef IP_BINDMULTI + case 239: return IP_BINDMULTI; +#endif +#ifdef IP_BIND_ADDRESS_NO_PORT + case 240: return IP_BIND_ADDRESS_NO_PORT; +#endif +#ifdef IP_BLOCK_SOURCE + case 241: return IP_BLOCK_SOURCE; +#endif +#ifdef IP_BOUND_IF + case 242: return IP_BOUND_IF; +#endif +#ifdef IP_CHECKSUM + case 243: return IP_CHECKSUM; +#endif +#ifdef IP_DEFAULT_MULTICAST_LOOP + case 244: return IP_DEFAULT_MULTICAST_LOOP; +#endif +#ifdef IP_DEFAULT_MULTICAST_TTL + case 245: return IP_DEFAULT_MULTICAST_TTL; +#endif +#ifdef IP_DONTFRAG + case 246: return IP_DONTFRAG; +#endif +#ifdef IP_DROP_MEMBERSHIP + case 247: return IP_DROP_MEMBERSHIP; +#endif +#ifdef IP_DROP_SOURCE_MEMBERSHIP + case 248: return IP_DROP_SOURCE_MEMBERSHIP; +#endif +#ifdef IP_DUMMYNET3 + case 249: return IP_DUMMYNET3; +#endif +#ifdef IP_DUMMYNET_CONFIGURE + case 250: return IP_DUMMYNET_CONFIGURE; +#endif +#ifdef IP_DUMMYNET_DEL + case 251: return IP_DUMMYNET_DEL; +#endif +#ifdef IP_DUMMYNET_FLUSH + case 252: return IP_DUMMYNET_FLUSH; +#endif +#ifdef IP_DUMMYNET_GET + case 253: return IP_DUMMYNET_GET; +#endif +#ifdef IP_FAITH + case 254: return IP_FAITH; +#endif +#ifdef IP_FLOWID + case 255: return IP_FLOWID; +#endif +#ifdef IP_FLOWTYPE + case 256: return IP_FLOWTYPE; +#endif +#ifdef IP_FREEBIND + case 257: return IP_FREEBIND; +#endif +#ifdef IP_FW3 + case 258: return IP_FW3; +#endif +#ifdef IP_FW_ADD + case 259: return IP_FW_ADD; +#endif +#ifdef IP_FW_DEL + case 260: return IP_FW_DEL; +#endif +#ifdef IP_FW_FLUSH + case 261: return IP_FW_FLUSH; +#endif +#ifdef IP_FW_GET + case 262: return IP_FW_GET; +#endif +#ifdef IP_FW_NAT_CFG + case 263: return IP_FW_NAT_CFG; +#endif +#ifdef IP_FW_NAT_DEL + case 264: return IP_FW_NAT_DEL; +#endif +#ifdef IP_FW_NAT_GET_CONFIG + case 265: return IP_FW_NAT_GET_CONFIG; +#endif +#ifdef IP_FW_NAT_GET_LOG + case 266: return IP_FW_NAT_GET_LOG; +#endif +#ifdef IP_FW_RESETLOG + case 267: return IP_FW_RESETLOG; +#endif +#ifdef IP_FW_TABLE_ADD + case 268: return IP_FW_TABLE_ADD; +#endif +#ifdef IP_FW_TABLE_DEL + case 269: return IP_FW_TABLE_DEL; +#endif +#ifdef IP_FW_TABLE_FLUSH + case 270: return IP_FW_TABLE_FLUSH; +#endif +#ifdef IP_FW_TABLE_GETSIZE + case 271: return IP_FW_TABLE_GETSIZE; +#endif +#ifdef IP_FW_TABLE_LIST + case 272: return IP_FW_TABLE_LIST; +#endif +#ifdef IP_FW_ZERO + case 273: return IP_FW_ZERO; +#endif +#ifdef IP_HDRINCL + case 274: return IP_HDRINCL; +#endif +#ifdef IP_IPSEC_POLICY + case 275: return IP_IPSEC_POLICY; +#endif +#ifdef IP_MAX_GROUP_SRC_FILTER + case 276: return IP_MAX_GROUP_SRC_FILTER; +#endif +#ifdef IP_MAX_MEMBERSHIPS + case 277: return IP_MAX_MEMBERSHIPS; +#endif +#ifdef IP_MAX_SOCK_MUTE_FILTER + case 278: return IP_MAX_SOCK_MUTE_FILTER; +#endif +#ifdef IP_MAX_SOCK_SRC_FILTER + case 279: return IP_MAX_SOCK_SRC_FILTER; +#endif +#ifdef IP_MAX_SOURCE_FILTER + case 280: return IP_MAX_SOURCE_FILTER; +#endif +#ifdef IP_MINTTL + case 281: return IP_MINTTL; +#endif +#ifdef IP_MIN_MEMBERSHIPS + case 282: return IP_MIN_MEMBERSHIPS; +#endif +#ifdef IP_MSFILTER + case 283: return IP_MSFILTER; +#endif +#ifdef IP_MTU + case 284: return IP_MTU; +#endif +#ifdef IP_MTU_DISCOVER + case 285: return IP_MTU_DISCOVER; +#endif +#ifdef IP_MULTICAST_ALL + case 286: return IP_MULTICAST_ALL; +#endif +#ifdef IP_MULTICAST_IF + case 287: return IP_MULTICAST_IF; +#endif +#ifdef IP_MULTICAST_IFINDEX + case 288: return IP_MULTICAST_IFINDEX; +#endif +#ifdef IP_MULTICAST_LOOP + case 289: return IP_MULTICAST_LOOP; +#endif +#ifdef IP_MULTICAST_TTL + case 290: return IP_MULTICAST_TTL; +#endif +#ifdef IP_MULTICAST_VIF + case 291: return IP_MULTICAST_VIF; +#endif +#ifdef IP_NAT_XXX + case 292: return IP_NAT_XXX; +#endif +#ifdef IP_NODEFRAG + case 293: return IP_NODEFRAG; +#endif +#ifdef IP_OLD_FW_ADD + case 294: return IP_OLD_FW_ADD; +#endif +#ifdef IP_OLD_FW_DEL + case 295: return IP_OLD_FW_DEL; +#endif +#ifdef IP_OLD_FW_FLUSH + case 296: return IP_OLD_FW_FLUSH; +#endif +#ifdef IP_OLD_FW_GET + case 297: return IP_OLD_FW_GET; +#endif +#ifdef IP_OLD_FW_RESETLOG + case 298: return IP_OLD_FW_RESETLOG; +#endif +#ifdef IP_OLD_FW_ZERO + case 299: return IP_OLD_FW_ZERO; +#endif +#ifdef IP_ONESBCAST + case 300: return IP_ONESBCAST; +#endif +#ifdef IP_OPTIONS + case 301: return IP_OPTIONS; +#endif +#ifdef IP_ORIGDSTADDR + case 302: return IP_ORIGDSTADDR; +#endif +#ifdef IP_PASSSEC + case 303: return IP_PASSSEC; +#endif +#ifdef IP_PKTINFO + case 304: return IP_PKTINFO; +#endif +#ifdef IP_PKTOPTIONS + case 305: return IP_PKTOPTIONS; +#endif +#ifdef IP_PMTUDISC_DO + case 306: return IP_PMTUDISC_DO; +#endif +#ifdef IP_PMTUDISC_DONT + case 307: return IP_PMTUDISC_DONT; +#endif +#ifdef IP_PMTUDISC_INTERFACE + case 308: return IP_PMTUDISC_INTERFACE; +#endif +#ifdef IP_PMTUDISC_OMIT + case 309: return IP_PMTUDISC_OMIT; +#endif +#ifdef IP_PMTUDISC_PROBE + case 310: return IP_PMTUDISC_PROBE; +#endif +#ifdef IP_PMTUDISC_WANT + case 311: return IP_PMTUDISC_WANT; +#endif +#ifdef IP_PORTRANGE + case 312: return IP_PORTRANGE; +#endif +#ifdef IP_PORTRANGE_DEFAULT + case 313: return IP_PORTRANGE_DEFAULT; +#endif +#ifdef IP_PORTRANGE_HIGH + case 314: return IP_PORTRANGE_HIGH; +#endif +#ifdef IP_PORTRANGE_LOW + case 315: return IP_PORTRANGE_LOW; +#endif +#ifdef IP_RECVDSTADDR + case 316: return IP_RECVDSTADDR; +#endif +#ifdef IP_RECVERR + case 317: return IP_RECVERR; +#endif +#ifdef IP_RECVFLOWID + case 318: return IP_RECVFLOWID; +#endif +#ifdef IP_RECVIF + case 319: return IP_RECVIF; +#endif +#ifdef IP_RECVOPTS + case 320: return IP_RECVOPTS; +#endif +#ifdef IP_RECVORIGDSTADDR + case 321: return IP_RECVORIGDSTADDR; +#endif +#ifdef IP_RECVPKTINFO + case 322: return IP_RECVPKTINFO; +#endif +#ifdef IP_RECVRETOPTS + case 323: return IP_RECVRETOPTS; +#endif +#ifdef IP_RECVRSSBUCKETID + case 324: return IP_RECVRSSBUCKETID; +#endif +#ifdef IP_RECVTOS + case 325: return IP_RECVTOS; +#endif +#ifdef IP_RECVTTL + case 326: return IP_RECVTTL; +#endif +#ifdef IP_RETOPTS + case 327: return IP_RETOPTS; +#endif +#ifdef IP_ROUTER_ALERT + case 328: return IP_ROUTER_ALERT; +#endif +#ifdef IP_RSSBUCKETID + case 329: return IP_RSSBUCKETID; +#endif +#ifdef IP_RSS_LISTEN_BUCKET + case 330: return IP_RSS_LISTEN_BUCKET; +#endif +#ifdef IP_RSVP_OFF + case 331: return IP_RSVP_OFF; +#endif +#ifdef IP_RSVP_ON + case 332: return IP_RSVP_ON; +#endif +#ifdef IP_RSVP_VIF_OFF + case 333: return IP_RSVP_VIF_OFF; +#endif +#ifdef IP_RSVP_VIF_ON + case 334: return IP_RSVP_VIF_ON; +#endif +#ifdef IP_SENDSRCADDR + case 335: return IP_SENDSRCADDR; +#endif +#ifdef IP_STRIPHDR + case 336: return IP_STRIPHDR; +#endif +#ifdef IP_TOS + case 337: return IP_TOS; +#endif +#ifdef IP_TRAFFIC_MGT_BACKGROUND + case 338: return IP_TRAFFIC_MGT_BACKGROUND; +#endif +#ifdef IP_TRANSPARENT + case 339: return IP_TRANSPARENT; +#endif +#ifdef IP_TTL + case 340: return IP_TTL; +#endif +#ifdef IP_UNBLOCK_SOURCE + case 341: return IP_UNBLOCK_SOURCE; +#endif +#ifdef IP_UNICAST_IF + case 342: return IP_UNICAST_IF; +#endif +#ifdef IP_XFRM_POLICY + case 343: return IP_XFRM_POLICY; +#endif +#ifdef LOCAL_CONNWAIT + case 344: return LOCAL_CONNWAIT; +#endif +#ifdef LOCAL_CREDS + case 345: return LOCAL_CREDS; +#endif +#ifdef LOCAL_PEERCRED + case 346: return LOCAL_PEERCRED; +#endif +#ifdef LOCAL_PEEREPID + case 347: return LOCAL_PEEREPID; +#endif +#ifdef LOCAL_PEEREUUID + case 348: return LOCAL_PEEREUUID; +#endif +#ifdef LOCAL_PEERPID + case 349: return LOCAL_PEERPID; +#endif +#ifdef LOCAL_PEERUUID + case 350: return LOCAL_PEERUUID; +#endif +#ifdef LOCAL_VENDOR + case 351: return LOCAL_VENDOR; +#endif +#ifdef MAX_TCPOPTLEN + case 352: return MAX_TCPOPTLEN; +#endif +#ifdef MCAST_BLOCK_SOURCE + case 353: return MCAST_BLOCK_SOURCE; +#endif +#ifdef MCAST_EXCLUDE + case 354: return MCAST_EXCLUDE; +#endif +#ifdef MCAST_INCLUDE + case 355: return MCAST_INCLUDE; +#endif +#ifdef MCAST_JOIN_GROUP + case 356: return MCAST_JOIN_GROUP; +#endif +#ifdef MCAST_JOIN_SOURCE_GROUP + case 357: return MCAST_JOIN_SOURCE_GROUP; +#endif +#ifdef MCAST_LEAVE_GROUP + case 358: return MCAST_LEAVE_GROUP; +#endif +#ifdef MCAST_LEAVE_SOURCE_GROUP + case 359: return MCAST_LEAVE_SOURCE_GROUP; +#endif +#ifdef MCAST_MSFILTER + case 360: return MCAST_MSFILTER; +#endif +#ifdef MCAST_UNBLOCK_SOURCE + case 361: return MCAST_UNBLOCK_SOURCE; +#endif +#ifdef MCAST_UNDEFINED + case 362: return MCAST_UNDEFINED; +#endif +#ifdef MRT_ADD_BW_UPCALL + case 363: return MRT_ADD_BW_UPCALL; +#endif +#ifdef MRT_ADD_MFC + case 364: return MRT_ADD_MFC; +#endif +#ifdef MRT_ADD_VIF + case 365: return MRT_ADD_VIF; +#endif +#ifdef MRT_API_CONFIG + case 366: return MRT_API_CONFIG; +#endif +#ifdef MRT_API_FLAGS_ALL + case 367: return MRT_API_FLAGS_ALL; +#endif +#ifdef MRT_API_SUPPORT + case 368: return MRT_API_SUPPORT; +#endif +#ifdef MRT_ASSERT + case 369: return MRT_ASSERT; +#endif +#ifdef MRT_DEL_BW_UPCALL + case 370: return MRT_DEL_BW_UPCALL; +#endif +#ifdef MRT_DEL_MFC + case 371: return MRT_DEL_MFC; +#endif +#ifdef MRT_DEL_VIF + case 372: return MRT_DEL_VIF; +#endif +#ifdef MRT_DONE + case 373: return MRT_DONE; +#endif +#ifdef MRT_INIT + case 374: return MRT_INIT; +#endif +#ifdef MRT_MFC_BW_UPCALL + case 375: return MRT_MFC_BW_UPCALL; +#endif +#ifdef MRT_MFC_FLAGS_ALL + case 376: return MRT_MFC_FLAGS_ALL; +#endif +#ifdef MRT_MFC_FLAGS_BORDER_VIF + case 377: return MRT_MFC_FLAGS_BORDER_VIF; +#endif +#ifdef MRT_MFC_FLAGS_DISABLE_WRONGVIF + case 378: return MRT_MFC_FLAGS_DISABLE_WRONGVIF; +#endif +#ifdef MRT_MFC_RP + case 379: return MRT_MFC_RP; +#endif +#ifdef MRT_PIM + case 380: return MRT_PIM; +#endif +#ifdef MRT_VERSION + case 381: return MRT_VERSION; +#endif +#ifdef MSG_NOTIFICATION + case 382: return MSG_NOTIFICATION; +#endif +#ifdef MSG_SOCALLBCK + case 383: return MSG_SOCALLBCK; +#endif +#ifdef NDRVPROTO_NDRV + case 384: return NDRVPROTO_NDRV; +#endif +#ifdef NDRV_ADDMULTICAST + case 385: return NDRV_ADDMULTICAST; +#endif +#ifdef NDRV_DELDMXSPEC + case 386: return NDRV_DELDMXSPEC; +#endif +#ifdef NDRV_DELMULTICAST + case 387: return NDRV_DELMULTICAST; +#endif +#ifdef NDRV_DEMUXTYPE_ETHERTYPE + case 388: return NDRV_DEMUXTYPE_ETHERTYPE; +#endif +#ifdef NDRV_DEMUXTYPE_SAP + case 389: return NDRV_DEMUXTYPE_SAP; +#endif +#ifdef NDRV_DEMUXTYPE_SNAP + case 390: return NDRV_DEMUXTYPE_SNAP; +#endif +#ifdef NDRV_DMUX_MAX_DESCR + case 391: return NDRV_DMUX_MAX_DESCR; +#endif +#ifdef NDRV_PROTOCOL_DESC_VERS + case 392: return NDRV_PROTOCOL_DESC_VERS; +#endif +#ifdef NDRV_SETDMXSPEC + case 393: return NDRV_SETDMXSPEC; +#endif +#ifdef NETLINK_ADD_MEMBERSHIP + case 394: return NETLINK_ADD_MEMBERSHIP; +#endif +#ifdef NETLINK_AUDIT + case 395: return NETLINK_AUDIT; +#endif +#ifdef NETLINK_BROADCAST_ERROR + case 396: return NETLINK_BROADCAST_ERROR; +#endif +#ifdef NETLINK_CAP_ACK + case 397: return NETLINK_CAP_ACK; +#endif +#ifdef NETLINK_CONNECTOR + case 398: return NETLINK_CONNECTOR; +#endif +#ifdef NETLINK_CRYPTO + case 399: return NETLINK_CRYPTO; +#endif +#ifdef NETLINK_DNRTMSG + case 400: return NETLINK_DNRTMSG; +#endif +#ifdef NETLINK_DROP_MEMBERSHIP + case 401: return NETLINK_DROP_MEMBERSHIP; +#endif +#ifdef NETLINK_ECRYPTFS + case 402: return NETLINK_ECRYPTFS; +#endif +#ifdef NETLINK_FIB_LOOKUP + case 403: return NETLINK_FIB_LOOKUP; +#endif +#ifdef NETLINK_FIREWALL + case 404: return NETLINK_FIREWALL; +#endif +#ifdef NETLINK_GENERIC + case 405: return NETLINK_GENERIC; +#endif +#ifdef NETLINK_INET_DIAG + case 406: return NETLINK_INET_DIAG; +#endif +#ifdef NETLINK_IP6_FW + case 407: return NETLINK_IP6_FW; +#endif +#ifdef NETLINK_ISCSI + case 408: return NETLINK_ISCSI; +#endif +#ifdef NETLINK_KOBJECT_UEVENT + case 409: return NETLINK_KOBJECT_UEVENT; +#endif +#ifdef NETLINK_LISTEN_ALL_NSID + case 410: return NETLINK_LISTEN_ALL_NSID; +#endif +#ifdef NETLINK_LIST_MEMBERSHIPS + case 411: return NETLINK_LIST_MEMBERSHIPS; +#endif +#ifdef NETLINK_NETFILTER + case 412: return NETLINK_NETFILTER; +#endif +#ifdef NETLINK_NFLOG + case 413: return NETLINK_NFLOG; +#endif +#ifdef NETLINK_NO_ENOBUFS + case 414: return NETLINK_NO_ENOBUFS; +#endif +#ifdef NETLINK_PKTINFO + case 415: return NETLINK_PKTINFO; +#endif +#ifdef NETLINK_RDMA + case 416: return NETLINK_RDMA; +#endif +#ifdef NETLINK_ROUTE + case 417: return NETLINK_ROUTE; +#endif +#ifdef NETLINK_RX_RING + case 418: return NETLINK_RX_RING; +#endif +#ifdef NETLINK_SCSITRANSPORT + case 419: return NETLINK_SCSITRANSPORT; +#endif +#ifdef NETLINK_SELINUX + case 420: return NETLINK_SELINUX; +#endif +#ifdef NETLINK_SOCK_DIAG + case 421: return NETLINK_SOCK_DIAG; +#endif +#ifdef NETLINK_TX_RING + case 422: return NETLINK_TX_RING; +#endif +#ifdef NETLINK_UNUSED + case 423: return NETLINK_UNUSED; +#endif +#ifdef NETLINK_USERSOCK + case 424: return NETLINK_USERSOCK; +#endif +#ifdef NETLINK_XFRM + case 425: return NETLINK_XFRM; +#endif +#ifdef NETROM_IDLE + case 426: return NETROM_IDLE; +#endif +#ifdef NETROM_KILL + case 427: return NETROM_KILL; +#endif +#ifdef NETROM_N2 + case 428: return NETROM_N2; +#endif +#ifdef NETROM_NEIGH + case 429: return NETROM_NEIGH; +#endif +#ifdef NETROM_NODE + case 430: return NETROM_NODE; +#endif +#ifdef NETROM_PACLEN + case 431: return NETROM_PACLEN; +#endif +#ifdef NETROM_T1 + case 432: return NETROM_T1; +#endif +#ifdef NETROM_T2 + case 433: return NETROM_T2; +#endif +#ifdef NETROM_T4 + case 434: return NETROM_T4; +#endif +#ifdef NRDV_MULTICAST_ADDRS_PER_SOCK + case 435: return NRDV_MULTICAST_ADDRS_PER_SOCK; +#endif +#ifdef PVD_CONFIG + case 436: return PVD_CONFIG; +#endif +#ifdef RDS_CANCEL_SENT_TO + case 437: return RDS_CANCEL_SENT_TO; +#endif +#ifdef RDS_CMSG_ATOMIC_CSWP + case 438: return RDS_CMSG_ATOMIC_CSWP; +#endif +#ifdef RDS_CMSG_ATOMIC_FADD + case 439: return RDS_CMSG_ATOMIC_FADD; +#endif +#ifdef RDS_CMSG_CONG_UPDATE + case 440: return RDS_CMSG_CONG_UPDATE; +#endif +#ifdef RDS_CMSG_MASKED_ATOMIC_CSWP + case 441: return RDS_CMSG_MASKED_ATOMIC_CSWP; +#endif +#ifdef RDS_CMSG_MASKED_ATOMIC_FADD + case 442: return RDS_CMSG_MASKED_ATOMIC_FADD; +#endif +#ifdef RDS_CMSG_RDMA_ARGS + case 443: return RDS_CMSG_RDMA_ARGS; +#endif +#ifdef RDS_CMSG_RDMA_DEST + case 444: return RDS_CMSG_RDMA_DEST; +#endif +#ifdef RDS_CMSG_RDMA_MAP + case 445: return RDS_CMSG_RDMA_MAP; +#endif +#ifdef RDS_CMSG_RDMA_STATUS + case 446: return RDS_CMSG_RDMA_STATUS; +#endif +#ifdef RDS_CONG_MONITOR + case 447: return RDS_CONG_MONITOR; +#endif +#ifdef RDS_CONG_MONITOR_SIZE + case 448: return RDS_CONG_MONITOR_SIZE; +#endif +#ifdef RDS_FREE_MR + case 449: return RDS_FREE_MR; +#endif +#ifdef RDS_GET_MR + case 450: return RDS_GET_MR; +#endif +#ifdef RDS_GET_MR_FOR_DEST + case 451: return RDS_GET_MR_FOR_DEST; +#endif +#ifdef RDS_IB_ABI_VERSION + case 452: return RDS_IB_ABI_VERSION; +#endif +#ifdef RDS_IB_GID_LEN + case 453: return RDS_IB_GID_LEN; +#endif +#ifdef RDS_INFO_CONNECTIONS + case 454: return RDS_INFO_CONNECTIONS; +#endif +#ifdef RDS_INFO_CONNECTION_FLAG_CONNECTED + case 455: return RDS_INFO_CONNECTION_FLAG_CONNECTED; +#endif +#ifdef RDS_INFO_CONNECTION_FLAG_CONNECTING + case 456: return RDS_INFO_CONNECTION_FLAG_CONNECTING; +#endif +#ifdef RDS_INFO_CONNECTION_FLAG_SENDING + case 457: return RDS_INFO_CONNECTION_FLAG_SENDING; +#endif +#ifdef RDS_INFO_CONNECTION_STATS + case 458: return RDS_INFO_CONNECTION_STATS; +#endif +#ifdef RDS_INFO_COUNTERS + case 459: return RDS_INFO_COUNTERS; +#endif +#ifdef RDS_INFO_FIRST + case 460: return RDS_INFO_FIRST; +#endif +#ifdef RDS_INFO_IB_CONNECTIONS + case 461: return RDS_INFO_IB_CONNECTIONS; +#endif +#ifdef RDS_INFO_IWARP_CONNECTIONS + case 462: return RDS_INFO_IWARP_CONNECTIONS; +#endif +#ifdef RDS_INFO_LAST + case 463: return RDS_INFO_LAST; +#endif +#ifdef RDS_INFO_MESSAGE_FLAG_ACK + case 464: return RDS_INFO_MESSAGE_FLAG_ACK; +#endif +#ifdef RDS_INFO_MESSAGE_FLAG_FAST_ACK + case 465: return RDS_INFO_MESSAGE_FLAG_FAST_ACK; +#endif +#ifdef RDS_INFO_RECV_MESSAGES + case 466: return RDS_INFO_RECV_MESSAGES; +#endif +#ifdef RDS_INFO_RETRANS_MESSAGES + case 467: return RDS_INFO_RETRANS_MESSAGES; +#endif +#ifdef RDS_INFO_SEND_MESSAGES + case 468: return RDS_INFO_SEND_MESSAGES; +#endif +#ifdef RDS_INFO_SOCKETS + case 469: return RDS_INFO_SOCKETS; +#endif +#ifdef RDS_INFO_TCP_SOCKETS + case 470: return RDS_INFO_TCP_SOCKETS; +#endif +#ifdef RDS_RDMA_CANCELED + case 471: return RDS_RDMA_CANCELED; +#endif +#ifdef RDS_RDMA_DONTWAIT + case 472: return RDS_RDMA_DONTWAIT; +#endif +#ifdef RDS_RDMA_DROPPED + case 473: return RDS_RDMA_DROPPED; +#endif +#ifdef RDS_RDMA_FENCE + case 474: return RDS_RDMA_FENCE; +#endif +#ifdef RDS_RDMA_INVALIDATE + case 475: return RDS_RDMA_INVALIDATE; +#endif +#ifdef RDS_RDMA_NOTIFY_ME + case 476: return RDS_RDMA_NOTIFY_ME; +#endif +#ifdef RDS_RDMA_OTHER_ERROR + case 477: return RDS_RDMA_OTHER_ERROR; +#endif +#ifdef RDS_RDMA_READWRITE + case 478: return RDS_RDMA_READWRITE; +#endif +#ifdef RDS_RDMA_REMOTE_ERROR + case 479: return RDS_RDMA_REMOTE_ERROR; +#endif +#ifdef RDS_RDMA_SILENT + case 480: return RDS_RDMA_SILENT; +#endif +#ifdef RDS_RDMA_SUCCESS + case 481: return RDS_RDMA_SUCCESS; +#endif +#ifdef RDS_RDMA_USE_ONCE + case 482: return RDS_RDMA_USE_ONCE; +#endif +#ifdef RDS_RECVERR + case 483: return RDS_RECVERR; +#endif +#ifdef RDS_TRANS_COUNT + case 484: return RDS_TRANS_COUNT; +#endif +#ifdef RDS_TRANS_IB + case 485: return RDS_TRANS_IB; +#endif +#ifdef RDS_TRANS_IWARP + case 486: return RDS_TRANS_IWARP; +#endif +#ifdef RDS_TRANS_NONE + case 487: return RDS_TRANS_NONE; +#endif +#ifdef RDS_TRANS_TCP + case 488: return RDS_TRANS_TCP; +#endif +#ifdef ROSE_ACCESS_BARRED + case 489: return ROSE_ACCESS_BARRED; +#endif +#ifdef ROSE_DEFER + case 490: return ROSE_DEFER; +#endif +#ifdef ROSE_DTE_ORIGINATED + case 491: return ROSE_DTE_ORIGINATED; +#endif +#ifdef ROSE_HOLDBACK + case 492: return ROSE_HOLDBACK; +#endif +#ifdef ROSE_IDLE + case 493: return ROSE_IDLE; +#endif +#ifdef ROSE_INVALID_FACILITY + case 494: return ROSE_INVALID_FACILITY; +#endif +#ifdef ROSE_LOCAL_PROCEDURE + case 495: return ROSE_LOCAL_PROCEDURE; +#endif +#ifdef ROSE_MAX_DIGIS + case 496: return ROSE_MAX_DIGIS; +#endif +#ifdef ROSE_MTU + case 497: return ROSE_MTU; +#endif +#ifdef ROSE_NETWORK_CONGESTION + case 498: return ROSE_NETWORK_CONGESTION; +#endif +#ifdef ROSE_NOT_OBTAINABLE + case 499: return ROSE_NOT_OBTAINABLE; +#endif +#ifdef ROSE_NUMBER_BUSY + case 500: return ROSE_NUMBER_BUSY; +#endif +#ifdef ROSE_OUT_OF_ORDER + case 501: return ROSE_OUT_OF_ORDER; +#endif +#ifdef ROSE_QBITINCL + case 502: return ROSE_QBITINCL; +#endif +#ifdef ROSE_REMOTE_PROCEDURE + case 503: return ROSE_REMOTE_PROCEDURE; +#endif +#ifdef ROSE_SHIP_ABSENT + case 504: return ROSE_SHIP_ABSENT; +#endif +#ifdef ROSE_T1 + case 505: return ROSE_T1; +#endif +#ifdef ROSE_T2 + case 506: return ROSE_T2; +#endif +#ifdef ROSE_T3 + case 507: return ROSE_T3; +#endif +#ifdef SCM_HCI_RAW_DIRECTION + case 508: return SCM_HCI_RAW_DIRECTION; +#endif +#ifdef SCM_TIMESTAMP + case 509: return SCM_TIMESTAMP; +#endif +#ifdef SCM_TIMESTAMPING + case 510: return SCM_TIMESTAMPING; +#endif +#ifdef SCM_TIMESTAMPNS + case 511: return SCM_TIMESTAMPNS; +#endif +#ifdef SCM_WIFI_STATUS + case 512: return SCM_WIFI_STATUS; +#endif +#ifdef SCTP_ABORT_ASSOCIATION + case 513: return SCTP_ABORT_ASSOCIATION; +#endif +#ifdef SCTP_ADAPTATION_LAYER + case 514: return SCTP_ADAPTATION_LAYER; +#endif +#ifdef SCTP_ADAPTION_LAYER + case 515: return SCTP_ADAPTION_LAYER; +#endif +#ifdef SCTP_ADD_STREAMS + case 516: return SCTP_ADD_STREAMS; +#endif +#ifdef SCTP_ADD_VRF_ID + case 517: return SCTP_ADD_VRF_ID; +#endif +#ifdef SCTP_ASCONF + case 518: return SCTP_ASCONF; +#endif +#ifdef SCTP_ASCONF_ACK + case 519: return SCTP_ASCONF_ACK; +#endif +#ifdef SCTP_ASCONF_SUPPORTED + case 520: return SCTP_ASCONF_SUPPORTED; +#endif +#ifdef SCTP_ASSOCINFO + case 521: return SCTP_ASSOCINFO; +#endif +#ifdef SCTP_AUTHENTICATION + case 522: return SCTP_AUTHENTICATION; +#endif +#ifdef SCTP_AUTH_ACTIVE_KEY + case 523: return SCTP_AUTH_ACTIVE_KEY; +#endif +#ifdef SCTP_AUTH_CHUNK + case 524: return SCTP_AUTH_CHUNK; +#endif +#ifdef SCTP_AUTH_DEACTIVATE_KEY + case 525: return SCTP_AUTH_DEACTIVATE_KEY; +#endif +#ifdef SCTP_AUTH_DELETE_KEY + case 526: return SCTP_AUTH_DELETE_KEY; +#endif +#ifdef SCTP_AUTH_KEY + case 527: return SCTP_AUTH_KEY; +#endif +#ifdef SCTP_AUTH_SUPPORTED + case 528: return SCTP_AUTH_SUPPORTED; +#endif +#ifdef SCTP_AUTOCLOSE + case 529: return SCTP_AUTOCLOSE; +#endif +#ifdef SCTP_AUTO_ASCONF + case 530: return SCTP_AUTO_ASCONF; +#endif +#ifdef SCTP_BADCRC + case 531: return SCTP_BADCRC; +#endif +#ifdef SCTP_BINDX_ADD_ADDR + case 532: return SCTP_BINDX_ADD_ADDR; +#endif +#ifdef SCTP_BINDX_REM_ADDR + case 533: return SCTP_BINDX_REM_ADDR; +#endif +#ifdef SCTP_BLK_LOGGING_ENABLE + case 534: return SCTP_BLK_LOGGING_ENABLE; +#endif +#ifdef SCTP_BOUND + case 535: return SCTP_BOUND; +#endif +#ifdef SCTP_CAUSE_COOKIE_IN_SHUTDOWN + case 536: return SCTP_CAUSE_COOKIE_IN_SHUTDOWN; +#endif +#ifdef SCTP_CAUSE_DELETING_LAST_ADDR + case 537: return SCTP_CAUSE_DELETING_LAST_ADDR; +#endif +#ifdef SCTP_CAUSE_DELETING_SRC_ADDR + case 538: return SCTP_CAUSE_DELETING_SRC_ADDR; +#endif +#ifdef SCTP_CAUSE_ILLEGAL_ASCONF_ACK + case 539: return SCTP_CAUSE_ILLEGAL_ASCONF_ACK; +#endif +#ifdef SCTP_CAUSE_INVALID_PARAM + case 540: return SCTP_CAUSE_INVALID_PARAM; +#endif +#ifdef SCTP_CAUSE_INVALID_STREAM + case 541: return SCTP_CAUSE_INVALID_STREAM; +#endif +#ifdef SCTP_CAUSE_MISSING_PARAM + case 542: return SCTP_CAUSE_MISSING_PARAM; +#endif +#ifdef SCTP_CAUSE_NAT_COLLIDING_STATE + case 543: return SCTP_CAUSE_NAT_COLLIDING_STATE; +#endif +#ifdef SCTP_CAUSE_NAT_MISSING_STATE + case 544: return SCTP_CAUSE_NAT_MISSING_STATE; +#endif +#ifdef SCTP_CAUSE_NO_ERROR + case 545: return SCTP_CAUSE_NO_ERROR; +#endif +#ifdef SCTP_CAUSE_NO_USER_DATA + case 546: return SCTP_CAUSE_NO_USER_DATA; +#endif +#ifdef SCTP_CAUSE_OUT_OF_RESC + case 547: return SCTP_CAUSE_OUT_OF_RESC; +#endif +#ifdef SCTP_CAUSE_PROTOCOL_VIOLATION + case 548: return SCTP_CAUSE_PROTOCOL_VIOLATION; +#endif +#ifdef SCTP_CAUSE_REQUEST_REFUSED + case 549: return SCTP_CAUSE_REQUEST_REFUSED; +#endif +#ifdef SCTP_CAUSE_RESOURCE_SHORTAGE + case 550: return SCTP_CAUSE_RESOURCE_SHORTAGE; +#endif +#ifdef SCTP_CAUSE_RESTART_W_NEWADDR + case 551: return SCTP_CAUSE_RESTART_W_NEWADDR; +#endif +#ifdef SCTP_CAUSE_STALE_COOKIE + case 552: return SCTP_CAUSE_STALE_COOKIE; +#endif +#ifdef SCTP_CAUSE_UNRECOG_CHUNK + case 553: return SCTP_CAUSE_UNRECOG_CHUNK; +#endif +#ifdef SCTP_CAUSE_UNRECOG_PARAM + case 554: return SCTP_CAUSE_UNRECOG_PARAM; +#endif +#ifdef SCTP_CAUSE_UNRESOLVABLE_ADDR + case 555: return SCTP_CAUSE_UNRESOLVABLE_ADDR; +#endif +#ifdef SCTP_CAUSE_UNSUPPORTED_HMACID + case 556: return SCTP_CAUSE_UNSUPPORTED_HMACID; +#endif +#ifdef SCTP_CAUSE_USER_INITIATED_ABT + case 557: return SCTP_CAUSE_USER_INITIATED_ABT; +#endif +#ifdef SCTP_CC_HSTCP + case 558: return SCTP_CC_HSTCP; +#endif +#ifdef SCTP_CC_HTCP + case 559: return SCTP_CC_HTCP; +#endif +#ifdef SCTP_CC_OPTION + case 560: return SCTP_CC_OPTION; +#endif +#ifdef SCTP_CC_OPT_RTCC_SETMODE + case 561: return SCTP_CC_OPT_RTCC_SETMODE; +#endif +#ifdef SCTP_CC_OPT_STEADY_STEP + case 562: return SCTP_CC_OPT_STEADY_STEP; +#endif +#ifdef SCTP_CC_OPT_USE_DCCC_ECN + case 563: return SCTP_CC_OPT_USE_DCCC_ECN; +#endif +#ifdef SCTP_CC_RFC2581 + case 564: return SCTP_CC_RFC2581; +#endif +#ifdef SCTP_CC_RTCC + case 565: return SCTP_CC_RTCC; +#endif +#ifdef SCTP_CLOSED + case 566: return SCTP_CLOSED; +#endif +#ifdef SCTP_CLR_STAT_LOG + case 567: return SCTP_CLR_STAT_LOG; +#endif +#ifdef SCTP_CMT_BASE + case 568: return SCTP_CMT_BASE; +#endif +#ifdef SCTP_CMT_MAX + case 569: return SCTP_CMT_MAX; +#endif +#ifdef SCTP_CMT_MPTCP + case 570: return SCTP_CMT_MPTCP; +#endif +#ifdef SCTP_CMT_OFF + case 571: return SCTP_CMT_OFF; +#endif +#ifdef SCTP_CMT_ON_OFF + case 572: return SCTP_CMT_ON_OFF; +#endif +#ifdef SCTP_CMT_RPV1 + case 573: return SCTP_CMT_RPV1; +#endif +#ifdef SCTP_CMT_RPV2 + case 574: return SCTP_CMT_RPV2; +#endif +#ifdef SCTP_CMT_USE_DAC + case 575: return SCTP_CMT_USE_DAC; +#endif +#ifdef SCTP_CONNECT_X + case 576: return SCTP_CONNECT_X; +#endif +#ifdef SCTP_CONNECT_X_COMPLETE + case 577: return SCTP_CONNECT_X_COMPLETE; +#endif +#ifdef SCTP_CONNECT_X_DELAYED + case 578: return SCTP_CONNECT_X_DELAYED; +#endif +#ifdef SCTP_CONTEXT + case 579: return SCTP_CONTEXT; +#endif +#ifdef SCTP_COOKIE_ACK + case 580: return SCTP_COOKIE_ACK; +#endif +#ifdef SCTP_COOKIE_ECHO + case 581: return SCTP_COOKIE_ECHO; +#endif +#ifdef SCTP_COOKIE_ECHOED + case 582: return SCTP_COOKIE_ECHOED; +#endif +#ifdef SCTP_COOKIE_WAIT + case 583: return SCTP_COOKIE_WAIT; +#endif +#ifdef SCTP_CWND_LOGGING_ENABLE + case 584: return SCTP_CWND_LOGGING_ENABLE; +#endif +#ifdef SCTP_CWND_MONITOR_ENABLE + case 585: return SCTP_CWND_MONITOR_ENABLE; +#endif +#ifdef SCTP_CWR_IN_SAME_WINDOW + case 586: return SCTP_CWR_IN_SAME_WINDOW; +#endif +#ifdef SCTP_CWR_REDUCE_OVERRIDE + case 587: return SCTP_CWR_REDUCE_OVERRIDE; +#endif +#ifdef SCTP_DATA + case 588: return SCTP_DATA; +#endif +#ifdef SCTP_DATA_FIRST_FRAG + case 589: return SCTP_DATA_FIRST_FRAG; +#endif +#ifdef SCTP_DATA_FRAG_MASK + case 590: return SCTP_DATA_FRAG_MASK; +#endif +#ifdef SCTP_DATA_LAST_FRAG + case 591: return SCTP_DATA_LAST_FRAG; +#endif +#ifdef SCTP_DATA_MIDDLE_FRAG + case 592: return SCTP_DATA_MIDDLE_FRAG; +#endif +#ifdef SCTP_DATA_NOT_FRAG + case 593: return SCTP_DATA_NOT_FRAG; +#endif +#ifdef SCTP_DATA_SACK_IMMEDIATELY + case 594: return SCTP_DATA_SACK_IMMEDIATELY; +#endif +#ifdef SCTP_DATA_UNORDERED + case 595: return SCTP_DATA_UNORDERED; +#endif +#ifdef SCTP_DEFAULT_PRINFO + case 596: return SCTP_DEFAULT_PRINFO; +#endif +#ifdef SCTP_DEFAULT_SEND_PARAM + case 597: return SCTP_DEFAULT_SEND_PARAM; +#endif +#ifdef SCTP_DEFAULT_SNDINFO + case 598: return SCTP_DEFAULT_SNDINFO; +#endif +#ifdef SCTP_DELAYED_SACK + case 599: return SCTP_DELAYED_SACK; +#endif +#ifdef SCTP_DEL_VRF_ID + case 600: return SCTP_DEL_VRF_ID; +#endif +#ifdef SCTP_DISABLE_FRAGMENTS + case 601: return SCTP_DISABLE_FRAGMENTS; +#endif +#ifdef SCTP_ECN_CWR + case 602: return SCTP_ECN_CWR; +#endif +#ifdef SCTP_ECN_ECHO + case 603: return SCTP_ECN_ECHO; +#endif +#ifdef SCTP_ECN_SUPPORTED + case 604: return SCTP_ECN_SUPPORTED; +#endif +#ifdef SCTP_ENABLE_CHANGE_ASSOC_REQ + case 605: return SCTP_ENABLE_CHANGE_ASSOC_REQ; +#endif +#ifdef SCTP_ENABLE_RESET_ASSOC_REQ + case 606: return SCTP_ENABLE_RESET_ASSOC_REQ; +#endif +#ifdef SCTP_ENABLE_RESET_STREAM_REQ + case 607: return SCTP_ENABLE_RESET_STREAM_REQ; +#endif +#ifdef SCTP_ENABLE_STREAM_RESET + case 608: return SCTP_ENABLE_STREAM_RESET; +#endif +#ifdef SCTP_ENABLE_VALUE_MASK + case 609: return SCTP_ENABLE_VALUE_MASK; +#endif +#ifdef SCTP_ESTABLISHED + case 610: return SCTP_ESTABLISHED; +#endif +#ifdef SCTP_EVENT + case 611: return SCTP_EVENT; +#endif +#ifdef SCTP_EVENTS + case 612: return SCTP_EVENTS; +#endif +#ifdef SCTP_EXPLICIT_EOR + case 613: return SCTP_EXPLICIT_EOR; +#endif +#ifdef SCTP_FLIGHT_LOGGING_ENABLE + case 614: return SCTP_FLIGHT_LOGGING_ENABLE; +#endif +#ifdef SCTP_FORWARD_CUM_TSN + case 615: return SCTP_FORWARD_CUM_TSN; +#endif +#ifdef SCTP_FRAGMENT_INTERLEAVE + case 616: return SCTP_FRAGMENT_INTERLEAVE; +#endif +#ifdef SCTP_FRAG_LEVEL_0 + case 617: return SCTP_FRAG_LEVEL_0; +#endif +#ifdef SCTP_FRAG_LEVEL_1 + case 618: return SCTP_FRAG_LEVEL_1; +#endif +#ifdef SCTP_FRAG_LEVEL_2 + case 619: return SCTP_FRAG_LEVEL_2; +#endif +#ifdef SCTP_FROM_MIDDLE_BOX + case 620: return SCTP_FROM_MIDDLE_BOX; +#endif +#ifdef SCTP_FR_LOGGING_ENABLE + case 621: return SCTP_FR_LOGGING_ENABLE; +#endif +#ifdef SCTP_GET_ADDR_LEN + case 622: return SCTP_GET_ADDR_LEN; +#endif +#ifdef SCTP_GET_ASOC_VRF + case 623: return SCTP_GET_ASOC_VRF; +#endif +#ifdef SCTP_GET_ASSOC_ID_LIST + case 624: return SCTP_GET_ASSOC_ID_LIST; +#endif +#ifdef SCTP_GET_ASSOC_NUMBER + case 625: return SCTP_GET_ASSOC_NUMBER; +#endif +#ifdef SCTP_GET_LOCAL_ADDRESSES + case 626: return SCTP_GET_LOCAL_ADDRESSES; +#endif +#ifdef SCTP_GET_LOCAL_ADDR_SIZE + case 627: return SCTP_GET_LOCAL_ADDR_SIZE; +#endif +#ifdef SCTP_GET_NONCE_VALUES + case 628: return SCTP_GET_NONCE_VALUES; +#endif +#ifdef SCTP_GET_PACKET_LOG + case 629: return SCTP_GET_PACKET_LOG; +#endif +#ifdef SCTP_GET_PEER_ADDRESSES + case 630: return SCTP_GET_PEER_ADDRESSES; +#endif +#ifdef SCTP_GET_PEER_ADDR_INFO + case 631: return SCTP_GET_PEER_ADDR_INFO; +#endif +#ifdef SCTP_GET_REMOTE_ADDR_SIZE + case 632: return SCTP_GET_REMOTE_ADDR_SIZE; +#endif +#ifdef SCTP_GET_SNDBUF_USE + case 633: return SCTP_GET_SNDBUF_USE; +#endif +#ifdef SCTP_GET_STAT_LOG + case 634: return SCTP_GET_STAT_LOG; +#endif +#ifdef SCTP_GET_VRF_IDS + case 635: return SCTP_GET_VRF_IDS; +#endif +#ifdef SCTP_HAD_NO_TCB + case 636: return SCTP_HAD_NO_TCB; +#endif +#ifdef SCTP_HEARTBEAT_ACK + case 637: return SCTP_HEARTBEAT_ACK; +#endif +#ifdef SCTP_HEARTBEAT_REQUEST + case 638: return SCTP_HEARTBEAT_REQUEST; +#endif +#ifdef SCTP_HMAC_IDENT + case 639: return SCTP_HMAC_IDENT; +#endif +#ifdef SCTP_IDATA + case 640: return SCTP_IDATA; +#endif +#ifdef SCTP_IFORWARD_CUM_TSN + case 641: return SCTP_IFORWARD_CUM_TSN; +#endif +#ifdef SCTP_INITIATION + case 642: return SCTP_INITIATION; +#endif +#ifdef SCTP_INITIATION_ACK + case 643: return SCTP_INITIATION_ACK; +#endif +#ifdef SCTP_INITMSG + case 644: return SCTP_INITMSG; +#endif +#ifdef SCTP_INTERLEAVING_SUPPORTED + case 645: return SCTP_INTERLEAVING_SUPPORTED; +#endif +#ifdef SCTP_I_WANT_MAPPED_V4_ADDR + case 646: return SCTP_I_WANT_MAPPED_V4_ADDR; +#endif +#ifdef SCTP_LAST_PACKET_TRACING + case 647: return SCTP_LAST_PACKET_TRACING; +#endif +#ifdef SCTP_LISTEN + case 648: return SCTP_LISTEN; +#endif +#ifdef SCTP_LOCAL_AUTH_CHUNKS + case 649: return SCTP_LOCAL_AUTH_CHUNKS; +#endif +#ifdef SCTP_LOCK_LOGGING_ENABLE + case 650: return SCTP_LOCK_LOGGING_ENABLE; +#endif +#ifdef SCTP_LOG_AT_SEND_2_OUTQ + case 651: return SCTP_LOG_AT_SEND_2_OUTQ; +#endif +#ifdef SCTP_LOG_AT_SEND_2_SCTP + case 652: return SCTP_LOG_AT_SEND_2_SCTP; +#endif +#ifdef SCTP_LOG_MAXBURST_ENABLE + case 653: return SCTP_LOG_MAXBURST_ENABLE; +#endif +#ifdef SCTP_LOG_RWND_ENABLE + case 654: return SCTP_LOG_RWND_ENABLE; +#endif +#ifdef SCTP_LOG_SACK_ARRIVALS_ENABLE + case 655: return SCTP_LOG_SACK_ARRIVALS_ENABLE; +#endif +#ifdef SCTP_LOG_TRY_ADVANCE + case 656: return SCTP_LOG_TRY_ADVANCE; +#endif +#ifdef SCTP_LTRACE_CHUNK_ENABLE + case 657: return SCTP_LTRACE_CHUNK_ENABLE; +#endif +#ifdef SCTP_LTRACE_ERROR_ENABLE + case 658: return SCTP_LTRACE_ERROR_ENABLE; +#endif +#ifdef SCTP_MAP_LOGGING_ENABLE + case 659: return SCTP_MAP_LOGGING_ENABLE; +#endif +#ifdef SCTP_MAXBURST + case 660: return SCTP_MAXBURST; +#endif +#ifdef SCTP_MAXSEG + case 661: return SCTP_MAXSEG; +#endif +#ifdef SCTP_MAX_BURST + case 662: return SCTP_MAX_BURST; +#endif +#ifdef SCTP_MAX_COOKIE_LIFE + case 663: return SCTP_MAX_COOKIE_LIFE; +#endif +#ifdef SCTP_MAX_CWND + case 664: return SCTP_MAX_CWND; +#endif +#ifdef SCTP_MAX_HB_INTERVAL + case 665: return SCTP_MAX_HB_INTERVAL; +#endif +#ifdef SCTP_MAX_SACK_DELAY + case 666: return SCTP_MAX_SACK_DELAY; +#endif +#ifdef SCTP_MBCNT_LOGGING_ENABLE + case 667: return SCTP_MBCNT_LOGGING_ENABLE; +#endif +#ifdef SCTP_MBUF_LOGGING_ENABLE + case 668: return SCTP_MBUF_LOGGING_ENABLE; +#endif +#ifdef SCTP_MOBILITY_BASE + case 669: return SCTP_MOBILITY_BASE; +#endif +#ifdef SCTP_MOBILITY_FASTHANDOFF + case 670: return SCTP_MOBILITY_FASTHANDOFF; +#endif +#ifdef SCTP_MOBILITY_PRIM_DELETED + case 671: return SCTP_MOBILITY_PRIM_DELETED; +#endif +#ifdef SCTP_NAGLE_LOGGING_ENABLE + case 672: return SCTP_NAGLE_LOGGING_ENABLE; +#endif +#ifdef SCTP_NODELAY + case 673: return SCTP_NODELAY; +#endif +#ifdef SCTP_NRSACK_SUPPORTED + case 674: return SCTP_NRSACK_SUPPORTED; +#endif +#ifdef SCTP_NR_SELECTIVE_ACK + case 675: return SCTP_NR_SELECTIVE_ACK; +#endif +#ifdef SCTP_OPERATION_ERROR + case 676: return SCTP_OPERATION_ERROR; +#endif +#ifdef SCTP_PACKED + case 677: return SCTP_PACKED; +#endif +#ifdef SCTP_PACKET_DROPPED + case 678: return SCTP_PACKET_DROPPED; +#endif +#ifdef SCTP_PACKET_LOG_SIZE + case 679: return SCTP_PACKET_LOG_SIZE; +#endif +#ifdef SCTP_PACKET_TRUNCATED + case 680: return SCTP_PACKET_TRUNCATED; +#endif +#ifdef SCTP_PAD_CHUNK + case 681: return SCTP_PAD_CHUNK; +#endif +#ifdef SCTP_PARTIAL_DELIVERY_POINT + case 682: return SCTP_PARTIAL_DELIVERY_POINT; +#endif +#ifdef SCTP_PCB_COPY_FLAGS + case 683: return SCTP_PCB_COPY_FLAGS; +#endif +#ifdef SCTP_PCB_FLAGS_ACCEPTING + case 684: return SCTP_PCB_FLAGS_ACCEPTING; +#endif +#ifdef SCTP_PCB_FLAGS_ADAPTATIONEVNT + case 685: return SCTP_PCB_FLAGS_ADAPTATIONEVNT; +#endif +#ifdef SCTP_PCB_FLAGS_ASSOC_RESETEVNT + case 686: return SCTP_PCB_FLAGS_ASSOC_RESETEVNT; +#endif +#ifdef SCTP_PCB_FLAGS_AUTHEVNT + case 687: return SCTP_PCB_FLAGS_AUTHEVNT; +#endif +#ifdef SCTP_PCB_FLAGS_AUTOCLOSE + case 688: return SCTP_PCB_FLAGS_AUTOCLOSE; +#endif +#ifdef SCTP_PCB_FLAGS_AUTO_ASCONF + case 689: return SCTP_PCB_FLAGS_AUTO_ASCONF; +#endif +#ifdef SCTP_PCB_FLAGS_BLOCKING_IO + case 690: return SCTP_PCB_FLAGS_BLOCKING_IO; +#endif +#ifdef SCTP_PCB_FLAGS_BOUNDALL + case 691: return SCTP_PCB_FLAGS_BOUNDALL; +#endif +#ifdef SCTP_PCB_FLAGS_BOUND_V6 + case 692: return SCTP_PCB_FLAGS_BOUND_V6; +#endif +#ifdef SCTP_PCB_FLAGS_CLOSE_IP + case 693: return SCTP_PCB_FLAGS_CLOSE_IP; +#endif +#ifdef SCTP_PCB_FLAGS_CONNECTED + case 694: return SCTP_PCB_FLAGS_CONNECTED; +#endif +#ifdef SCTP_PCB_FLAGS_DONOT_HEARTBEAT + case 695: return SCTP_PCB_FLAGS_DONOT_HEARTBEAT; +#endif +#ifdef SCTP_PCB_FLAGS_DONT_WAKE + case 696: return SCTP_PCB_FLAGS_DONT_WAKE; +#endif +#ifdef SCTP_PCB_FLAGS_DO_ASCONF + case 697: return SCTP_PCB_FLAGS_DO_ASCONF; +#endif +#ifdef SCTP_PCB_FLAGS_DO_NOT_PMTUD + case 698: return SCTP_PCB_FLAGS_DO_NOT_PMTUD; +#endif +#ifdef SCTP_PCB_FLAGS_DRYEVNT + case 699: return SCTP_PCB_FLAGS_DRYEVNT; +#endif +#ifdef SCTP_PCB_FLAGS_EXPLICIT_EOR + case 700: return SCTP_PCB_FLAGS_EXPLICIT_EOR; +#endif +#ifdef SCTP_PCB_FLAGS_EXT_RCVINFO + case 701: return SCTP_PCB_FLAGS_EXT_RCVINFO; +#endif +#ifdef SCTP_PCB_FLAGS_FRAG_INTERLEAVE + case 702: return SCTP_PCB_FLAGS_FRAG_INTERLEAVE; +#endif +#ifdef SCTP_PCB_FLAGS_INTERLEAVE_STRMS + case 703: return SCTP_PCB_FLAGS_INTERLEAVE_STRMS; +#endif +#ifdef SCTP_PCB_FLAGS_IN_TCPPOOL + case 704: return SCTP_PCB_FLAGS_IN_TCPPOOL; +#endif +#ifdef SCTP_PCB_FLAGS_MULTIPLE_ASCONFS + case 705: return SCTP_PCB_FLAGS_MULTIPLE_ASCONFS; +#endif +#ifdef SCTP_PCB_FLAGS_NEEDS_MAPPED_V4 + case 706: return SCTP_PCB_FLAGS_NEEDS_MAPPED_V4; +#endif +#ifdef SCTP_PCB_FLAGS_NODELAY + case 707: return SCTP_PCB_FLAGS_NODELAY; +#endif +#ifdef SCTP_PCB_FLAGS_NO_FRAGMENT + case 708: return SCTP_PCB_FLAGS_NO_FRAGMENT; +#endif +#ifdef SCTP_PCB_FLAGS_PDAPIEVNT + case 709: return SCTP_PCB_FLAGS_PDAPIEVNT; +#endif +#ifdef SCTP_PCB_FLAGS_PORTREUSE + case 710: return SCTP_PCB_FLAGS_PORTREUSE; +#endif +#ifdef SCTP_PCB_FLAGS_RECVASSOCEVNT + case 711: return SCTP_PCB_FLAGS_RECVASSOCEVNT; +#endif +#ifdef SCTP_PCB_FLAGS_RECVDATAIOEVNT + case 712: return SCTP_PCB_FLAGS_RECVDATAIOEVNT; +#endif +#ifdef SCTP_PCB_FLAGS_RECVNSENDFAILEVNT + case 713: return SCTP_PCB_FLAGS_RECVNSENDFAILEVNT; +#endif +#ifdef SCTP_PCB_FLAGS_RECVNXTINFO + case 714: return SCTP_PCB_FLAGS_RECVNXTINFO; +#endif +#ifdef SCTP_PCB_FLAGS_RECVPADDREVNT + case 715: return SCTP_PCB_FLAGS_RECVPADDREVNT; +#endif +#ifdef SCTP_PCB_FLAGS_RECVPEERERR + case 716: return SCTP_PCB_FLAGS_RECVPEERERR; +#endif +#ifdef SCTP_PCB_FLAGS_RECVRCVINFO + case 717: return SCTP_PCB_FLAGS_RECVRCVINFO; +#endif +#ifdef SCTP_PCB_FLAGS_RECVSENDFAILEVNT + case 718: return SCTP_PCB_FLAGS_RECVSENDFAILEVNT; +#endif +#ifdef SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT + case 719: return SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT; +#endif +#ifdef SCTP_PCB_FLAGS_SOCKET_ALLGONE + case 720: return SCTP_PCB_FLAGS_SOCKET_ALLGONE; +#endif +#ifdef SCTP_PCB_FLAGS_SOCKET_CANT_READ + case 721: return SCTP_PCB_FLAGS_SOCKET_CANT_READ; +#endif +#ifdef SCTP_PCB_FLAGS_SOCKET_GONE + case 722: return SCTP_PCB_FLAGS_SOCKET_GONE; +#endif +#ifdef SCTP_PCB_FLAGS_STREAM_CHANGEEVNT + case 723: return SCTP_PCB_FLAGS_STREAM_CHANGEEVNT; +#endif +#ifdef SCTP_PCB_FLAGS_STREAM_RESETEVNT + case 724: return SCTP_PCB_FLAGS_STREAM_RESETEVNT; +#endif +#ifdef SCTP_PCB_FLAGS_TCPTYPE + case 725: return SCTP_PCB_FLAGS_TCPTYPE; +#endif +#ifdef SCTP_PCB_FLAGS_UDPTYPE + case 726: return SCTP_PCB_FLAGS_UDPTYPE; +#endif +#ifdef SCTP_PCB_FLAGS_UNBOUND + case 727: return SCTP_PCB_FLAGS_UNBOUND; +#endif +#ifdef SCTP_PCB_FLAGS_WAKEINPUT + case 728: return SCTP_PCB_FLAGS_WAKEINPUT; +#endif +#ifdef SCTP_PCB_FLAGS_WAKEOUTPUT + case 729: return SCTP_PCB_FLAGS_WAKEOUTPUT; +#endif +#ifdef SCTP_PCB_FLAGS_WAS_ABORTED + case 730: return SCTP_PCB_FLAGS_WAS_ABORTED; +#endif +#ifdef SCTP_PCB_FLAGS_WAS_CONNECTED + case 731: return SCTP_PCB_FLAGS_WAS_CONNECTED; +#endif +#ifdef SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE + case 732: return SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE; +#endif +#ifdef SCTP_PCB_STATUS + case 733: return SCTP_PCB_STATUS; +#endif +#ifdef SCTP_PEELOFF + case 734: return SCTP_PEELOFF; +#endif +#ifdef SCTP_PEER_ADDR_PARAMS + case 735: return SCTP_PEER_ADDR_PARAMS; +#endif +#ifdef SCTP_PEER_ADDR_THLDS + case 736: return SCTP_PEER_ADDR_THLDS; +#endif +#ifdef SCTP_PEER_AUTH_CHUNKS + case 737: return SCTP_PEER_AUTH_CHUNKS; +#endif +#ifdef SCTP_PKTDROP_SUPPORTED + case 738: return SCTP_PKTDROP_SUPPORTED; +#endif +#ifdef SCTP_PLUGGABLE_CC + case 739: return SCTP_PLUGGABLE_CC; +#endif +#ifdef SCTP_PLUGGABLE_SS + case 740: return SCTP_PLUGGABLE_SS; +#endif +#ifdef SCTP_PRIMARY_ADDR + case 741: return SCTP_PRIMARY_ADDR; +#endif +#ifdef SCTP_PR_ASSOC_STATUS + case 742: return SCTP_PR_ASSOC_STATUS; +#endif +#ifdef SCTP_PR_STREAM_STATUS + case 743: return SCTP_PR_STREAM_STATUS; +#endif +#ifdef SCTP_PR_SUPPORTED + case 744: return SCTP_PR_SUPPORTED; +#endif +#ifdef SCTP_RECONFIG_SUPPORTED + case 745: return SCTP_RECONFIG_SUPPORTED; +#endif +#ifdef SCTP_RECVNXTINFO + case 746: return SCTP_RECVNXTINFO; +#endif +#ifdef SCTP_RECVRCVINFO + case 747: return SCTP_RECVRCVINFO; +#endif +#ifdef SCTP_RECV_RWND_LOGGING_ENABLE + case 748: return SCTP_RECV_RWND_LOGGING_ENABLE; +#endif +#ifdef SCTP_REMOTE_UDP_ENCAPS_PORT + case 749: return SCTP_REMOTE_UDP_ENCAPS_PORT; +#endif +#ifdef SCTP_RESET_ASSOC + case 750: return SCTP_RESET_ASSOC; +#endif +#ifdef SCTP_RESET_STREAMS + case 751: return SCTP_RESET_STREAMS; +#endif +#ifdef SCTP_REUSE_PORT + case 752: return SCTP_REUSE_PORT; +#endif +#ifdef SCTP_RTOINFO + case 753: return SCTP_RTOINFO; +#endif +#ifdef SCTP_RTTVAR_LOGGING_ENABLE + case 754: return SCTP_RTTVAR_LOGGING_ENABLE; +#endif +#ifdef SCTP_SACK_CMT_DAC + case 755: return SCTP_SACK_CMT_DAC; +#endif +#ifdef SCTP_SACK_LOGGING_ENABLE + case 756: return SCTP_SACK_LOGGING_ENABLE; +#endif +#ifdef SCTP_SACK_NONCE_SUM + case 757: return SCTP_SACK_NONCE_SUM; +#endif +#ifdef SCTP_SACK_RWND_LOGGING_ENABLE + case 758: return SCTP_SACK_RWND_LOGGING_ENABLE; +#endif +#ifdef SCTP_SAT_NETWORK_BURST_INCR + case 759: return SCTP_SAT_NETWORK_BURST_INCR; +#endif +#ifdef SCTP_SAT_NETWORK_MIN + case 760: return SCTP_SAT_NETWORK_MIN; +#endif +#ifdef SCTP_SB_LOGGING_ENABLE + case 761: return SCTP_SB_LOGGING_ENABLE; +#endif +#ifdef SCTP_SELECTIVE_ACK + case 762: return SCTP_SELECTIVE_ACK; +#endif +#ifdef SCTP_SET_DEBUG_LEVEL + case 763: return SCTP_SET_DEBUG_LEVEL; +#endif +#ifdef SCTP_SET_DYNAMIC_PRIMARY + case 764: return SCTP_SET_DYNAMIC_PRIMARY; +#endif +#ifdef SCTP_SET_INITIAL_DBG_SEQ + case 765: return SCTP_SET_INITIAL_DBG_SEQ; +#endif +#ifdef SCTP_SET_PEER_PRIMARY_ADDR + case 766: return SCTP_SET_PEER_PRIMARY_ADDR; +#endif +#ifdef SCTP_SHUTDOWN + case 767: return SCTP_SHUTDOWN; +#endif +#ifdef SCTP_SHUTDOWN_ACK + case 768: return SCTP_SHUTDOWN_ACK; +#endif +#ifdef SCTP_SHUTDOWN_ACK_SENT + case 769: return SCTP_SHUTDOWN_ACK_SENT; +#endif +#ifdef SCTP_SHUTDOWN_COMPLETE + case 770: return SCTP_SHUTDOWN_COMPLETE; +#endif +#ifdef SCTP_SHUTDOWN_PENDING + case 771: return SCTP_SHUTDOWN_PENDING; +#endif +#ifdef SCTP_SHUTDOWN_RECEIVED + case 772: return SCTP_SHUTDOWN_RECEIVED; +#endif +#ifdef SCTP_SHUTDOWN_SENT + case 773: return SCTP_SHUTDOWN_SENT; +#endif +#ifdef SCTP_SMALLEST_PMTU + case 774: return SCTP_SMALLEST_PMTU; +#endif +#ifdef SCTP_SS_DEFAULT + case 775: return SCTP_SS_DEFAULT; +#endif +#ifdef SCTP_SS_FAIR_BANDWITH + case 776: return SCTP_SS_FAIR_BANDWITH; +#endif +#ifdef SCTP_SS_FIRST_COME + case 777: return SCTP_SS_FIRST_COME; +#endif +#ifdef SCTP_SS_PRIORITY + case 778: return SCTP_SS_PRIORITY; +#endif +#ifdef SCTP_SS_ROUND_ROBIN + case 779: return SCTP_SS_ROUND_ROBIN; +#endif +#ifdef SCTP_SS_ROUND_ROBIN_PACKET + case 780: return SCTP_SS_ROUND_ROBIN_PACKET; +#endif +#ifdef SCTP_SS_VALUE + case 781: return SCTP_SS_VALUE; +#endif +#ifdef SCTP_STATUS + case 782: return SCTP_STATUS; +#endif +#ifdef SCTP_STREAM_RESET + case 783: return SCTP_STREAM_RESET; +#endif +#ifdef SCTP_STREAM_RESET_INCOMING + case 784: return SCTP_STREAM_RESET_INCOMING; +#endif +#ifdef SCTP_STREAM_RESET_OUTGOING + case 785: return SCTP_STREAM_RESET_OUTGOING; +#endif +#ifdef SCTP_STR_LOGGING_ENABLE + case 786: return SCTP_STR_LOGGING_ENABLE; +#endif +#ifdef SCTP_THRESHOLD_LOGGING + case 787: return SCTP_THRESHOLD_LOGGING; +#endif +#ifdef SCTP_TIMEOUTS + case 788: return SCTP_TIMEOUTS; +#endif +#ifdef SCTP_USE_EXT_RCVINFO + case 789: return SCTP_USE_EXT_RCVINFO; +#endif +#ifdef SCTP_VRF_ID + case 790: return SCTP_VRF_ID; +#endif +#ifdef SCTP_WAKE_LOGGING_ENABLE + case 791: return SCTP_WAKE_LOGGING_ENABLE; +#endif +#ifdef SOCK_CLOEXEC + case 792: return SOCK_CLOEXEC; +#endif +#ifdef SOCK_DGRAM + case 793: return SOCK_DGRAM; +#endif +#ifdef SOCK_MAXADDRLEN + case 794: return SOCK_MAXADDRLEN; +#endif +#ifdef SOCK_NONBLOCK + case 795: return SOCK_NONBLOCK; +#endif +#ifdef SOCK_RAW + case 796: return SOCK_RAW; +#endif +#ifdef SOCK_RDM + case 797: return SOCK_RDM; +#endif +#ifdef SOCK_SEQPACKET + case 798: return SOCK_SEQPACKET; +#endif +#ifdef SOCK_STREAM + case 799: return SOCK_STREAM; +#endif +#ifdef SOMAXCONN + case 800: return SOMAXCONN; +#endif +#ifdef SONPX_SETOPTSHUT + case 801: return SONPX_SETOPTSHUT; +#endif +#ifdef SO_ACCEPTCONN + case 802: return SO_ACCEPTCONN; +#endif +#ifdef SO_ACCEPTFILTER + case 803: return SO_ACCEPTFILTER; +#endif +#ifdef SO_ATMPVC + case 804: return SO_ATMPVC; +#endif +#ifdef SO_ATMQOS + case 805: return SO_ATMQOS; +#endif +#ifdef SO_ATMSAP + case 806: return SO_ATMSAP; +#endif +#ifdef SO_ATTACH_BPF + case 807: return SO_ATTACH_BPF; +#endif +#ifdef SO_ATTACH_FILTER + case 808: return SO_ATTACH_FILTER; +#endif +#ifdef SO_BINDTODEVICE + case 809: return SO_BINDTODEVICE; +#endif +#ifdef SO_BINTIME + case 810: return SO_BINTIME; +#endif +#ifdef SO_BPF_EXTENSIONS + case 811: return SO_BPF_EXTENSIONS; +#endif +#ifdef SO_BROADCAST + case 812: return SO_BROADCAST; +#endif +#ifdef SO_BSDCOMPAT + case 813: return SO_BSDCOMPAT; +#endif +#ifdef SO_BSP_STATE + case 814: return SO_BSP_STATE; +#endif +#ifdef SO_BUSY_POLL + case 815: return SO_BUSY_POLL; +#endif +#ifdef SO_CONACCESS + case 816: return SO_CONACCESS; +#endif +#ifdef SO_CONDATA + case 817: return SO_CONDATA; +#endif +#ifdef SO_CONDITIONAL_ACCEPT + case 818: return SO_CONDITIONAL_ACCEPT; +#endif +#ifdef SO_CONNECT_TIME + case 819: return SO_CONNECT_TIME; +#endif +#ifdef SO_DEBUG + case 820: return SO_DEBUG; +#endif +#ifdef SO_DETACH_BPF + case 821: return SO_DETACH_BPF; +#endif +#ifdef SO_DETACH_FILTER + case 822: return SO_DETACH_FILTER; +#endif +#ifdef SO_DOMAIN + case 823: return SO_DOMAIN; +#endif +#ifdef SO_DONTLINGER + case 824: return SO_DONTLINGER; +#endif +#ifdef SO_DONTROUTE + case 825: return SO_DONTROUTE; +#endif +#ifdef SO_DONTTRUNC + case 826: return SO_DONTTRUNC; +#endif +#ifdef SO_ERROR + case 827: return SO_ERROR; +#endif +#ifdef SO_EXCLUSIVEADDRUSE + case 828: return SO_EXCLUSIVEADDRUSE; +#endif +#ifdef SO_GET_FILTER + case 829: return SO_GET_FILTER; +#endif +#ifdef SO_GROUP_ID + case 830: return SO_GROUP_ID; +#endif +#ifdef SO_GROUP_PRIORITY + case 831: return SO_GROUP_PRIORITY; +#endif +#ifdef SO_HCI_RAW_DIRECTION + case 832: return SO_HCI_RAW_DIRECTION; +#endif +#ifdef SO_HCI_RAW_FILTER + case 833: return SO_HCI_RAW_FILTER; +#endif +#ifdef SO_INCOMING_CPU + case 834: return SO_INCOMING_CPU; +#endif +#ifdef SO_KEEPALIVE + case 835: return SO_KEEPALIVE; +#endif +#ifdef SO_L2CAP_ENCRYPTED + case 836: return SO_L2CAP_ENCRYPTED; +#endif +#ifdef SO_L2CAP_FLUSH + case 837: return SO_L2CAP_FLUSH; +#endif +#ifdef SO_L2CAP_IFLOW + case 838: return SO_L2CAP_IFLOW; +#endif +#ifdef SO_L2CAP_IMTU + case 839: return SO_L2CAP_IMTU; +#endif +#ifdef SO_L2CAP_OFLOW + case 840: return SO_L2CAP_OFLOW; +#endif +#ifdef SO_L2CAP_OMTU + case 841: return SO_L2CAP_OMTU; +#endif +#ifdef SO_LABEL + case 842: return SO_LABEL; +#endif +#ifdef SO_LINGER + case 843: return SO_LINGER; +#endif +#ifdef SO_LINGER_SEC + case 844: return SO_LINGER_SEC; +#endif +#ifdef SO_LINKINFO + case 845: return SO_LINKINFO; +#endif +#ifdef SO_LISTENINCQLEN + case 846: return SO_LISTENINCQLEN; +#endif +#ifdef SO_LISTENQLEN + case 847: return SO_LISTENQLEN; +#endif +#ifdef SO_LISTENQLIMIT + case 848: return SO_LISTENQLIMIT; +#endif +#ifdef SO_LOCK_FILTER + case 849: return SO_LOCK_FILTER; +#endif +#ifdef SO_MARK + case 850: return SO_MARK; +#endif +#ifdef SO_MAX_MSG_SIZE + case 851: return SO_MAX_MSG_SIZE; +#endif +#ifdef SO_MAX_PACING_RATE + case 852: return SO_MAX_PACING_RATE; +#endif +#ifdef SO_MULTIPOINT + case 853: return SO_MULTIPOINT; +#endif +#ifdef SO_NETSVC_MARKING_LEVEL + case 854: return SO_NETSVC_MARKING_LEVEL; +#endif +#ifdef SO_NET_SERVICE_TYPE + case 855: return SO_NET_SERVICE_TYPE; +#endif +#ifdef SO_NKE + case 856: return SO_NKE; +#endif +#ifdef SO_NOADDRERR + case 857: return SO_NOADDRERR; +#endif +#ifdef SO_NOFCS + case 858: return SO_NOFCS; +#endif +#ifdef SO_NOSIGPIPE + case 859: return SO_NOSIGPIPE; +#endif +#ifdef SO_NOTIFYCONFLICT + case 860: return SO_NOTIFYCONFLICT; +#endif +#ifdef SO_NO_CHECK + case 861: return SO_NO_CHECK; +#endif +#ifdef SO_NO_DDP + case 862: return SO_NO_DDP; +#endif +#ifdef SO_NO_OFFLOAD + case 863: return SO_NO_OFFLOAD; +#endif +#ifdef SO_NP_EXTENSIONS + case 864: return SO_NP_EXTENSIONS; +#endif +#ifdef SO_NREAD + case 865: return SO_NREAD; +#endif +#ifdef SO_NUMRCVPKT + case 866: return SO_NUMRCVPKT; +#endif +#ifdef SO_NWRITE + case 867: return SO_NWRITE; +#endif +#ifdef SO_OOBINLINE + case 868: return SO_OOBINLINE; +#endif +#ifdef SO_ORIGINAL_DST + case 869: return SO_ORIGINAL_DST; +#endif +#ifdef SO_PASSCRED + case 870: return SO_PASSCRED; +#endif +#ifdef SO_PASSSEC + case 871: return SO_PASSSEC; +#endif +#ifdef SO_PEEK_OFF + case 872: return SO_PEEK_OFF; +#endif +#ifdef SO_PEERCRED + case 873: return SO_PEERCRED; +#endif +#ifdef SO_PEERLABEL + case 874: return SO_PEERLABEL; +#endif +#ifdef SO_PEERNAME + case 875: return SO_PEERNAME; +#endif +#ifdef SO_PEERSEC + case 876: return SO_PEERSEC; +#endif +#ifdef SO_PORT_SCALABILITY + case 877: return SO_PORT_SCALABILITY; +#endif +#ifdef SO_PRIORITY + case 878: return SO_PRIORITY; +#endif +#ifdef SO_PROTOCOL + case 879: return SO_PROTOCOL; +#endif +#ifdef SO_PROTOCOL_INFO + case 880: return SO_PROTOCOL_INFO; +#endif +#ifdef SO_PROTOTYPE + case 881: return SO_PROTOTYPE; +#endif +#ifdef SO_PROXYUSR + case 882: return SO_PROXYUSR; +#endif +#ifdef SO_RANDOMPORT + case 883: return SO_RANDOMPORT; +#endif +#ifdef SO_RCVBUF + case 884: return SO_RCVBUF; +#endif +#ifdef SO_RCVBUFFORCE + case 885: return SO_RCVBUFFORCE; +#endif +#ifdef SO_RCVLOWAT + case 886: return SO_RCVLOWAT; +#endif +#ifdef SO_RCVTIMEO + case 887: return SO_RCVTIMEO; +#endif +#ifdef SO_RDS_TRANSPORT + case 888: return SO_RDS_TRANSPORT; +#endif +#ifdef SO_REUSEADDR + case 889: return SO_REUSEADDR; +#endif +#ifdef SO_REUSEPORT + case 890: return SO_REUSEPORT; +#endif +#ifdef SO_REUSESHAREUID + case 891: return SO_REUSESHAREUID; +#endif +#ifdef SO_RFCOMM_FC_INFO + case 892: return SO_RFCOMM_FC_INFO; +#endif +#ifdef SO_RFCOMM_MTU + case 893: return SO_RFCOMM_MTU; +#endif +#ifdef SO_RXQ_OVFL + case 894: return SO_RXQ_OVFL; +#endif +#ifdef SO_SCO_CONNINFO + case 895: return SO_SCO_CONNINFO; +#endif +#ifdef SO_SCO_MTU + case 896: return SO_SCO_MTU; +#endif +#ifdef SO_SECURITY_AUTHENTICATION + case 897: return SO_SECURITY_AUTHENTICATION; +#endif +#ifdef SO_SECURITY_ENCRYPTION_NETWORK + case 898: return SO_SECURITY_ENCRYPTION_NETWORK; +#endif +#ifdef SO_SECURITY_ENCRYPTION_TRANSPORT + case 899: return SO_SECURITY_ENCRYPTION_TRANSPORT; +#endif +#ifdef SO_SELECT_ERR_QUEUE + case 900: return SO_SELECT_ERR_QUEUE; +#endif +#ifdef SO_SETCLP + case 901: return SO_SETCLP; +#endif +#ifdef SO_SETFIB + case 902: return SO_SETFIB; +#endif +#ifdef SO_SNDBUF + case 903: return SO_SNDBUF; +#endif +#ifdef SO_SNDBUFFORCE + case 904: return SO_SNDBUFFORCE; +#endif +#ifdef SO_SNDLOWAT + case 905: return SO_SNDLOWAT; +#endif +#ifdef SO_SNDTIMEO + case 906: return SO_SNDTIMEO; +#endif +#ifdef SO_TIMESTAMP + case 907: return SO_TIMESTAMP; +#endif +#ifdef SO_TIMESTAMPING + case 908: return SO_TIMESTAMPING; +#endif +#ifdef SO_TIMESTAMPNS + case 909: return SO_TIMESTAMPNS; +#endif +#ifdef SO_TIMESTAMP_MONOTONIC + case 910: return SO_TIMESTAMP_MONOTONIC; +#endif +#ifdef SO_TYPE + case 911: return SO_TYPE; +#endif +#ifdef SO_UPCALLCLOSEWAIT + case 912: return SO_UPCALLCLOSEWAIT; +#endif +#ifdef SO_UPDATE_ACCEPT_CONTEXT + case 913: return SO_UPDATE_ACCEPT_CONTEXT; +#endif +#ifdef SO_USELOOPBACK + case 914: return SO_USELOOPBACK; +#endif +#ifdef SO_USER_COOKIE + case 915: return SO_USER_COOKIE; +#endif +#ifdef SO_VENDOR + case 916: return SO_VENDOR; +#endif +#ifdef SO_VM_SOCKETS_BUFFER_MAX_SIZE + case 917: return SO_VM_SOCKETS_BUFFER_MAX_SIZE; +#endif +#ifdef SO_VM_SOCKETS_BUFFER_MIN_SIZE + case 918: return SO_VM_SOCKETS_BUFFER_MIN_SIZE; +#endif +#ifdef SO_VM_SOCKETS_BUFFER_SIZE + case 919: return SO_VM_SOCKETS_BUFFER_SIZE; +#endif +#ifdef SO_VM_SOCKETS_CONNECT_TIMEOUT + case 920: return SO_VM_SOCKETS_CONNECT_TIMEOUT; +#endif +#ifdef SO_VM_SOCKETS_NONBLOCK_TXRX + case 921: return SO_VM_SOCKETS_NONBLOCK_TXRX; +#endif +#ifdef SO_VM_SOCKETS_PEER_HOST_VM_ID + case 922: return SO_VM_SOCKETS_PEER_HOST_VM_ID; +#endif +#ifdef SO_VM_SOCKETS_TRUSTED + case 923: return SO_VM_SOCKETS_TRUSTED; +#endif +#ifdef SO_WANTMORE + case 924: return SO_WANTMORE; +#endif +#ifdef SO_WANTOOBFLAG + case 925: return SO_WANTOOBFLAG; +#endif +#ifdef SO_WIFI_STATUS + case 926: return SO_WIFI_STATUS; +#endif +#ifdef TCP6_MSS + case 927: return TCP6_MSS; +#endif +#ifdef TCPCI_FLAG_LOSSRECOVERY + case 928: return TCPCI_FLAG_LOSSRECOVERY; +#endif +#ifdef TCPCI_FLAG_REORDERING_DETECTED + case 929: return TCPCI_FLAG_REORDERING_DETECTED; +#endif +#ifdef TCPCI_OPT_ECN + case 930: return TCPCI_OPT_ECN; +#endif +#ifdef TCPCI_OPT_SACK + case 931: return TCPCI_OPT_SACK; +#endif +#ifdef TCPCI_OPT_TIMESTAMPS + case 932: return TCPCI_OPT_TIMESTAMPS; +#endif +#ifdef TCPCI_OPT_WSCALE + case 933: return TCPCI_OPT_WSCALE; +#endif +#ifdef TCPF_CA_CWR + case 934: return TCPF_CA_CWR; +#endif +#ifdef TCPF_CA_Disorder + case 935: return TCPF_CA_Disorder; +#endif +#ifdef TCPF_CA_Loss + case 936: return TCPF_CA_Loss; +#endif +#ifdef TCPF_CA_Open + case 937: return TCPF_CA_Open; +#endif +#ifdef TCPF_CA_Recovery + case 938: return TCPF_CA_Recovery; +#endif +#ifdef TCPI_OPT_ECN + case 939: return TCPI_OPT_ECN; +#endif +#ifdef TCPI_OPT_ECN_SEEN + case 940: return TCPI_OPT_ECN_SEEN; +#endif +#ifdef TCPI_OPT_SACK + case 941: return TCPI_OPT_SACK; +#endif +#ifdef TCPI_OPT_SYN_DATA + case 942: return TCPI_OPT_SYN_DATA; +#endif +#ifdef TCPI_OPT_TIMESTAMPS + case 943: return TCPI_OPT_TIMESTAMPS; +#endif +#ifdef TCPI_OPT_TOE + case 944: return TCPI_OPT_TOE; +#endif +#ifdef TCPI_OPT_WSCALE + case 945: return TCPI_OPT_WSCALE; +#endif +#ifdef TCPOLEN_CC + case 946: return TCPOLEN_CC; +#endif +#ifdef TCPOLEN_CC_APPA + case 947: return TCPOLEN_CC_APPA; +#endif +#ifdef TCPOLEN_EOL + case 948: return TCPOLEN_EOL; +#endif +#ifdef TCPOLEN_FASTOPEN_REQ + case 949: return TCPOLEN_FASTOPEN_REQ; +#endif +#ifdef TCPOLEN_FAST_OPEN_EMPTY + case 950: return TCPOLEN_FAST_OPEN_EMPTY; +#endif +#ifdef TCPOLEN_FAST_OPEN_MAX + case 951: return TCPOLEN_FAST_OPEN_MAX; +#endif +#ifdef TCPOLEN_FAST_OPEN_MIN + case 952: return TCPOLEN_FAST_OPEN_MIN; +#endif +#ifdef TCPOLEN_MAXSEG + case 953: return TCPOLEN_MAXSEG; +#endif +#ifdef TCPOLEN_NOP + case 954: return TCPOLEN_NOP; +#endif +#ifdef TCPOLEN_PAD + case 955: return TCPOLEN_PAD; +#endif +#ifdef TCPOLEN_SACK + case 956: return TCPOLEN_SACK; +#endif +#ifdef TCPOLEN_SACKHDR + case 957: return TCPOLEN_SACKHDR; +#endif +#ifdef TCPOLEN_SACK_PERMITTED + case 958: return TCPOLEN_SACK_PERMITTED; +#endif +#ifdef TCPOLEN_SIGNATURE + case 959: return TCPOLEN_SIGNATURE; +#endif +#ifdef TCPOLEN_TIMESTAMP + case 960: return TCPOLEN_TIMESTAMP; +#endif +#ifdef TCPOLEN_TSTAMP_APPA + case 961: return TCPOLEN_TSTAMP_APPA; +#endif +#ifdef TCPOLEN_WINDOW + case 962: return TCPOLEN_WINDOW; +#endif +#ifdef TCPOPT_CC + case 963: return TCPOPT_CC; +#endif +#ifdef TCPOPT_CCECHO + case 964: return TCPOPT_CCECHO; +#endif +#ifdef TCPOPT_CCNEW + case 965: return TCPOPT_CCNEW; +#endif +#ifdef TCPOPT_EOL + case 966: return TCPOPT_EOL; +#endif +#ifdef TCPOPT_FASTOPEN + case 967: return TCPOPT_FASTOPEN; +#endif +#ifdef TCPOPT_FAST_OPEN + case 968: return TCPOPT_FAST_OPEN; +#endif +#ifdef TCPOPT_MAXSEG + case 969: return TCPOPT_MAXSEG; +#endif +#ifdef TCPOPT_MULTIPATH + case 970: return TCPOPT_MULTIPATH; +#endif +#ifdef TCPOPT_NOP + case 971: return TCPOPT_NOP; +#endif +#ifdef TCPOPT_PAD + case 972: return TCPOPT_PAD; +#endif +#ifdef TCPOPT_SACK + case 973: return TCPOPT_SACK; +#endif +#ifdef TCPOPT_SACK_HDR + case 974: return TCPOPT_SACK_HDR; +#endif +#ifdef TCPOPT_SACK_PERMITTED + case 975: return TCPOPT_SACK_PERMITTED; +#endif +#ifdef TCPOPT_SACK_PERMIT_HDR + case 976: return TCPOPT_SACK_PERMIT_HDR; +#endif +#ifdef TCPOPT_SIGNATURE + case 977: return TCPOPT_SIGNATURE; +#endif +#ifdef TCPOPT_TIMESTAMP + case 978: return TCPOPT_TIMESTAMP; +#endif +#ifdef TCPOPT_TSTAMP_HDR + case 979: return TCPOPT_TSTAMP_HDR; +#endif +#ifdef TCPOPT_WINDOW + case 980: return TCPOPT_WINDOW; +#endif +#ifdef TCP_CA_NAME_MAX + case 981: return TCP_CA_NAME_MAX; +#endif +#ifdef TCP_CCALGOOPT + case 982: return TCP_CCALGOOPT; +#endif +#ifdef TCP_CC_INFO + case 983: return TCP_CC_INFO; +#endif +#ifdef TCP_CONGESTION + case 984: return TCP_CONGESTION; +#endif +#ifdef TCP_CONNECTIONTIMEOUT + case 985: return TCP_CONNECTIONTIMEOUT; +#endif +#ifdef TCP_CONNECTION_INFO + case 986: return TCP_CONNECTION_INFO; +#endif +#ifdef TCP_COOKIE_IN_ALWAYS + case 987: return TCP_COOKIE_IN_ALWAYS; +#endif +#ifdef TCP_COOKIE_MAX + case 988: return TCP_COOKIE_MAX; +#endif +#ifdef TCP_COOKIE_MIN + case 989: return TCP_COOKIE_MIN; +#endif +#ifdef TCP_COOKIE_OUT_NEVER + case 990: return TCP_COOKIE_OUT_NEVER; +#endif +#ifdef TCP_COOKIE_PAIR_SIZE + case 991: return TCP_COOKIE_PAIR_SIZE; +#endif +#ifdef TCP_COOKIE_TRANSACTIONS + case 992: return TCP_COOKIE_TRANSACTIONS; +#endif +#ifdef TCP_CORK + case 993: return TCP_CORK; +#endif +#ifdef TCP_DEFER_ACCEPT + case 994: return TCP_DEFER_ACCEPT; +#endif +#ifdef TCP_ENABLE_ECN + case 995: return TCP_ENABLE_ECN; +#endif +#ifdef TCP_FASTOPEN + case 996: return TCP_FASTOPEN; +#endif +#ifdef TCP_FUNCTION_BLK + case 997: return TCP_FUNCTION_BLK; +#endif +#ifdef TCP_FUNCTION_NAME_LEN_MAX + case 998: return TCP_FUNCTION_NAME_LEN_MAX; +#endif +#ifdef TCP_INFO + case 999: return TCP_INFO; +#endif +#ifdef TCP_KEEPALIVE + case 1000: return TCP_KEEPALIVE; +#endif +#ifdef TCP_KEEPCNT + case 1001: return TCP_KEEPCNT; +#endif +#ifdef TCP_KEEPIDLE + case 1002: return TCP_KEEPIDLE; +#endif +#ifdef TCP_KEEPINIT + case 1003: return TCP_KEEPINIT; +#endif +#ifdef TCP_KEEPINTVL + case 1004: return TCP_KEEPINTVL; +#endif +#ifdef TCP_LINGER2 + case 1005: return TCP_LINGER2; +#endif +#ifdef TCP_MAXBURST + case 1006: return TCP_MAXBURST; +#endif +#ifdef TCP_MAXHLEN + case 1007: return TCP_MAXHLEN; +#endif +#ifdef TCP_MAXOLEN + case 1008: return TCP_MAXOLEN; +#endif +#ifdef TCP_MAXSEG + case 1009: return TCP_MAXSEG; +#endif +#ifdef TCP_MAXWIN + case 1010: return TCP_MAXWIN; +#endif +#ifdef TCP_MAX_SACK + case 1011: return TCP_MAX_SACK; +#endif +#ifdef TCP_MAX_WINSHIFT + case 1012: return TCP_MAX_WINSHIFT; +#endif +#ifdef TCP_MD5SIG + case 1013: return TCP_MD5SIG; +#endif +#ifdef TCP_MD5SIG_MAXKEYLEN + case 1014: return TCP_MD5SIG_MAXKEYLEN; +#endif +#ifdef TCP_MINMSS + case 1015: return TCP_MINMSS; +#endif +#ifdef TCP_MSS + case 1016: return TCP_MSS; +#endif +#ifdef TCP_MSS_DEFAULT + case 1017: return TCP_MSS_DEFAULT; +#endif +#ifdef TCP_MSS_DESIRED + case 1018: return TCP_MSS_DESIRED; +#endif +#ifdef TCP_NODELAY + case 1019: return TCP_NODELAY; +#endif +#ifdef TCP_NOOPT + case 1020: return TCP_NOOPT; +#endif +#ifdef TCP_NOPUSH + case 1021: return TCP_NOPUSH; +#endif +#ifdef TCP_NOTSENT_LOWAT + case 1022: return TCP_NOTSENT_LOWAT; +#endif +#ifdef TCP_PCAP_IN + case 1023: return TCP_PCAP_IN; +#endif +#ifdef TCP_PCAP_OUT + case 1024: return TCP_PCAP_OUT; +#endif +#ifdef TCP_QUEUE_SEQ + case 1025: return TCP_QUEUE_SEQ; +#endif +#ifdef TCP_QUICKACK + case 1026: return TCP_QUICKACK; +#endif +#ifdef TCP_REPAIR + case 1027: return TCP_REPAIR; +#endif +#ifdef TCP_REPAIR_OPTIONS + case 1028: return TCP_REPAIR_OPTIONS; +#endif +#ifdef TCP_REPAIR_QUEUE + case 1029: return TCP_REPAIR_QUEUE; +#endif +#ifdef TCP_RXT_CONNDROPTIME + case 1030: return TCP_RXT_CONNDROPTIME; +#endif +#ifdef TCP_RXT_FINDROP + case 1031: return TCP_RXT_FINDROP; +#endif +#ifdef TCP_SAVED_SYN + case 1032: return TCP_SAVED_SYN; +#endif +#ifdef TCP_SAVE_SYN + case 1033: return TCP_SAVE_SYN; +#endif +#ifdef TCP_SENDMOREACKS + case 1034: return TCP_SENDMOREACKS; +#endif +#ifdef TCP_SYNCNT + case 1035: return TCP_SYNCNT; +#endif +#ifdef TCP_S_DATA_IN + case 1036: return TCP_S_DATA_IN; +#endif +#ifdef TCP_S_DATA_OUT + case 1037: return TCP_S_DATA_OUT; +#endif +#ifdef TCP_THIN_DUPACK + case 1038: return TCP_THIN_DUPACK; +#endif +#ifdef TCP_THIN_LINEAR_TIMEOUTS + case 1039: return TCP_THIN_LINEAR_TIMEOUTS; +#endif +#ifdef TCP_TIMESTAMP + case 1040: return TCP_TIMESTAMP; +#endif +#ifdef TCP_USER_TIMEOUT + case 1041: return TCP_USER_TIMEOUT; +#endif +#ifdef TCP_VENDOR + case 1042: return TCP_VENDOR; +#endif +#ifdef TCP_WINDOW_CLAMP + case 1043: return TCP_WINDOW_CLAMP; +#endif +#ifdef TIPC_ADDR_ID + case 1044: return TIPC_ADDR_ID; +#endif +#ifdef TIPC_ADDR_MCAST + case 1045: return TIPC_ADDR_MCAST; +#endif +#ifdef TIPC_ADDR_NAME + case 1046: return TIPC_ADDR_NAME; +#endif +#ifdef TIPC_ADDR_NAMESEQ + case 1047: return TIPC_ADDR_NAMESEQ; +#endif +#ifdef TIPC_CFG_SRV + case 1048: return TIPC_CFG_SRV; +#endif +#ifdef TIPC_CLUSTER_SCOPE + case 1049: return TIPC_CLUSTER_SCOPE; +#endif +#ifdef TIPC_CONN_SHUTDOWN + case 1050: return TIPC_CONN_SHUTDOWN; +#endif +#ifdef TIPC_CONN_TIMEOUT + case 1051: return TIPC_CONN_TIMEOUT; +#endif +#ifdef TIPC_CRITICAL_IMPORTANCE + case 1052: return TIPC_CRITICAL_IMPORTANCE; +#endif +#ifdef TIPC_DESTNAME + case 1053: return TIPC_DESTNAME; +#endif +#ifdef TIPC_DEST_DROPPABLE + case 1054: return TIPC_DEST_DROPPABLE; +#endif +#ifdef TIPC_ERRINFO + case 1055: return TIPC_ERRINFO; +#endif +#ifdef TIPC_ERR_NO_NAME + case 1056: return TIPC_ERR_NO_NAME; +#endif +#ifdef TIPC_ERR_NO_NODE + case 1057: return TIPC_ERR_NO_NODE; +#endif +#ifdef TIPC_ERR_NO_PORT + case 1058: return TIPC_ERR_NO_PORT; +#endif +#ifdef TIPC_ERR_OVERLOAD + case 1059: return TIPC_ERR_OVERLOAD; +#endif +#ifdef TIPC_HIGH_IMPORTANCE + case 1060: return TIPC_HIGH_IMPORTANCE; +#endif +#ifdef TIPC_IMPORTANCE + case 1061: return TIPC_IMPORTANCE; +#endif +#ifdef TIPC_LINK_STATE + case 1062: return TIPC_LINK_STATE; +#endif +#ifdef TIPC_LOW_IMPORTANCE + case 1063: return TIPC_LOW_IMPORTANCE; +#endif +#ifdef TIPC_MAX_BEARER_NAME + case 1064: return TIPC_MAX_BEARER_NAME; +#endif +#ifdef TIPC_MAX_IF_NAME + case 1065: return TIPC_MAX_IF_NAME; +#endif +#ifdef TIPC_MAX_LINK_NAME + case 1066: return TIPC_MAX_LINK_NAME; +#endif +#ifdef TIPC_MAX_MEDIA_NAME + case 1067: return TIPC_MAX_MEDIA_NAME; +#endif +#ifdef TIPC_MAX_USER_MSG_SIZE + case 1068: return TIPC_MAX_USER_MSG_SIZE; +#endif +#ifdef TIPC_MEDIUM_IMPORTANCE + case 1069: return TIPC_MEDIUM_IMPORTANCE; +#endif +#ifdef TIPC_NODE_RECVQ_DEPTH + case 1070: return TIPC_NODE_RECVQ_DEPTH; +#endif +#ifdef TIPC_NODE_SCOPE + case 1071: return TIPC_NODE_SCOPE; +#endif +#ifdef TIPC_OK + case 1072: return TIPC_OK; +#endif +#ifdef TIPC_PUBLISHED + case 1073: return TIPC_PUBLISHED; +#endif +#ifdef TIPC_RESERVED_TYPES + case 1074: return TIPC_RESERVED_TYPES; +#endif +#ifdef TIPC_RETDATA + case 1075: return TIPC_RETDATA; +#endif +#ifdef TIPC_SOCK_RECVQ_DEPTH + case 1076: return TIPC_SOCK_RECVQ_DEPTH; +#endif +#ifdef TIPC_SRC_DROPPABLE + case 1077: return TIPC_SRC_DROPPABLE; +#endif +#ifdef TIPC_SUBSCR_TIMEOUT + case 1078: return TIPC_SUBSCR_TIMEOUT; +#endif +#ifdef TIPC_SUB_CANCEL + case 1079: return TIPC_SUB_CANCEL; +#endif +#ifdef TIPC_SUB_PORTS + case 1080: return TIPC_SUB_PORTS; +#endif +#ifdef TIPC_SUB_SERVICE + case 1081: return TIPC_SUB_SERVICE; +#endif +#ifdef TIPC_TOP_SRV + case 1082: return TIPC_TOP_SRV; +#endif +#ifdef TIPC_WAIT_FOREVER + case 1083: return TIPC_WAIT_FOREVER; +#endif +#ifdef TIPC_WITHDRAWN + case 1084: return TIPC_WITHDRAWN; +#endif +#ifdef TIPC_ZONE_SCOPE + case 1085: return TIPC_ZONE_SCOPE; +#endif +#ifdef TTCP_CLIENT_SND_WND + case 1086: return TTCP_CLIENT_SND_WND; +#endif +#ifdef UDP_CORK + case 1087: return UDP_CORK; +#endif +#ifdef UDP_ENCAP + case 1088: return UDP_ENCAP; +#endif +#ifdef UDP_ENCAP_ESPINUDP + case 1089: return UDP_ENCAP_ESPINUDP; +#endif +#ifdef UDP_ENCAP_ESPINUDP_MAXFRAGLEN + case 1090: return UDP_ENCAP_ESPINUDP_MAXFRAGLEN; +#endif +#ifdef UDP_ENCAP_ESPINUDP_NON_IKE + case 1091: return UDP_ENCAP_ESPINUDP_NON_IKE; +#endif +#ifdef UDP_ENCAP_ESPINUDP_PORT + case 1092: return UDP_ENCAP_ESPINUDP_PORT; +#endif +#ifdef UDP_ENCAP_L2TPINUDP + case 1093: return UDP_ENCAP_L2TPINUDP; +#endif +#ifdef UDP_NOCKSUM + case 1094: return UDP_NOCKSUM; +#endif +#ifdef UDP_NO_CHECK6_RX + case 1095: return UDP_NO_CHECK6_RX; +#endif +#ifdef UDP_NO_CHECK6_TX + case 1096: return UDP_NO_CHECK6_TX; +#endif +#ifdef UDP_VENDOR + case 1097: return UDP_VENDOR; +#endif + default: return -1; + } +} PONY_EXTERN_C_END From 4373db72f9fc1081daa80f2e53dae3d9dadef66e Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Tue, 6 Feb 2018 19:50:47 -0600 Subject: [PATCH 02/20] Shape of the new getsockopt & setsockopt API, it works! --- examples/under_pressure/main.pony | 45 ++++++----- packages/net/ossocket.pony | 125 +++++++++++++++++------------- packages/net/tcp_connection.pony | 40 ++++++++-- packages/net/udp_socket.pony | 41 +++++++++- src/libponyrt/lang/socket.c | 4 +- 5 files changed, 170 insertions(+), 85 deletions(-) diff --git a/examples/under_pressure/main.pony b/examples/under_pressure/main.pony index afa465547f..fae80d8e55 100644 --- a/examples/under_pressure/main.pony +++ b/examples/under_pressure/main.pony @@ -69,29 +69,35 @@ class SlowDown is TCPConnectionNotify _out = out fun ref connected(conn: TCPConnection ref) => - let bufsiz: I32 = 4455 - var res: I32 - let fd: U32 = conn.get_fd() + let bufsiz: I32 = 0x012233 - @printf[I32]("getsockopt so_error = %d\n".cstring(), OSSocket.get_so_error(fd)) - @printf[I32]("getsockopt get_tcp_nodelay = %d\n".cstring(), OSSocket.get_tcp_nodelay(fd)) - res = OSSocket.set_tcp_nodelay(fd, true) + @printf[I32]("getsockopt so_error = %d\n".cstring(), conn.get_so_error()._2) + @printf[I32]("getsockopt get_tcp_nodelay = %d\n".cstring(), conn.get_tcp_nodelay()._2) + var res: U32 + res = conn.set_tcp_nodelay(true) @printf[I32]("getsockopt set_tcp_nodelay(fd, true) = %d\n".cstring(), res) - @printf[I32]("getsockopt get_tcp_nodelay = %d\n".cstring(), OSSocket.get_tcp_nodelay(fd)) + @printf[I32]("getsockopt get_tcp_nodelay = %d\n".cstring(), conn.get_tcp_nodelay()._2) - res = OSSocket.set_tcp_nodelay(fd, false) - @printf[I32]("getsockopt get_tcp_nodelay (after set_tcp_nodelay) = %d\n".cstring(), OSSocket.get_tcp_nodelay(fd)) + res = conn.set_tcp_nodelay(false) + @printf[I32]("getsockopt get_tcp_nodelay (after set_tcp_nodelay) = %d\n".cstring(), conn.get_tcp_nodelay()._2) conn.set_nodelay(true) - @printf[I32]("getsockopt get_tcp_nodelay (after conn.set_nodelay(true)) = %d\n".cstring(), OSSocket.get_tcp_nodelay(fd)) - - @printf[I32]("getsockopt rcvbuf = %d\n".cstring(), OSSocket.get_so_rcvbuf(fd)) - @printf[I32]("getsockopt sndbuf = %d\n".cstring(), OSSocket.get_so_sndbuf(fd)) - res = OSSocket.set_so_rcvbuf(fd, 4455) - @printf[I32]("setsockopt rcvbuf %d return was %d\n".cstring(), bufsiz, res) - res = OSSocket.set_so_sndbuf(fd, 4455) - @printf[I32]("setsockopt sndbuf %d return was %d\n".cstring(), bufsiz, res) - @printf[I32]("getsockopt rcvbuf = %d\n".cstring(), OSSocket.get_so_rcvbuf(fd)) - @printf[I32]("getsockopt sndbuf = %d\n".cstring(), OSSocket.get_so_sndbuf(fd)) + @printf[I32]("getsockopt get_tcp_nodelay (after conn.set_nodelay(true)) = %d\n".cstring(), conn.get_tcp_nodelay()._2) + + @printf[I32]("getsockopt rcvbuf = 0x%x\n".cstring(), conn.get_so_rcvbuf()._2) + @printf[I32]("getsockopt sndbuf = 0x%x\n".cstring(), conn.get_so_sndbuf()._2) + res = conn.set_so_rcvbuf(0x012233) + @printf[I32]("setsockopt rcvbuf 0x%x return was %d\n".cstring(), bufsiz, res) + res = conn.setsockopt(OSSockOpt.sol_socket(), OSSockOpt.so_sndbuf(),0x012233) + @printf[I32]("setsockopt sndbuf 0x%x return was %d\n".cstring(), bufsiz, res) + + @printf[I32]("getsockopt rcvbuf = 0x%x\n".cstring(), conn.get_so_rcvbuf()._2) + @printf[I32]("getsockopt old sndbuf = 0x%x\n".cstring(), conn.get_so_sndbuf()._2) + @printf[I32]("getsockopt new sndbuf = 0x%x\n".cstring(), conn.getsockopt(OSSockOpt.sol_socket(), OSSockOpt.so_sndbuf())._2) + var word: Array[U8] ref = [0;0;0;0] + @printf[I32]("getsockopt New sndbuf = 0x%x\n".cstring(), conn.getsockopt(OSSockOpt.sol_socket(), OSSockOpt.so_sndbuf(), word)._2) + try + @printf[I32]("getsockopt New sndbuf = %x %x %x %x\n".cstring(), word(0)?, word(1)?, word(2)?, word(3)?) + end fun ref throttled(connection: TCPConnection ref) => _out.print("Experiencing backpressure!") @@ -102,6 +108,7 @@ class SlowDown is TCPConnectionNotify Backpressure.release(_auth) fun ref connect_failed(conn: TCPConnection ref) => + @printf[I32]("connect_failed\n".cstring()) None class Send is TimerNotify diff --git a/packages/net/ossocket.pony b/packages/net/ossocket.pony index 495d71d4cd..03a279f44b 100644 --- a/packages/net/ossocket.pony +++ b/packages/net/ossocket.pony @@ -1,68 +1,81 @@ -primitive OSSocket +primitive _OSSocket """ TODO """ - fun option_size_changed_error(): I32 => - """ - Error return value when the `getsockopt(2)` system call was - given an `option_size` of `N` bytes, but the `option_size` value - after a successful system call is `M` bytes instead - (i.e., `N != M`). - """ - -500 - - fun get_so_error(fd: U32): I32 => - _get_so(fd, OSSockOpt.sol_socket(), OSSockOpt.so_error()) - - fun get_so_rcvbuf(fd: U32): I32 => - _get_so(fd, OSSockOpt.sol_socket(), OSSockOpt.so_rcvbuf()) - - fun get_so_sndbuf(fd: U32): I32 => - _get_so(fd, OSSockOpt.sol_socket(), OSSockOpt.so_sndbuf()) - - fun get_tcp_nodelay(fd: U32): I32 => - _get_so(fd, OSSockOpt.sol_socket(), OSSockOpt.tcp_nodelay()) - - fun set_so_broadcast(fd: U32, state: Bool): I32 => - _set_so(fd, OSSockOpt.sol_socket(), OSSockOpt.so_broadcast(), - if state then 1 else 0 end) - - fun set_ip_multicast_loop(fd: U32, loopback: Bool): I32 => - _set_so(fd, OSSockOpt.sol_socket(), OSSockOpt.ip_multicast_loop(), - if loopback then 1 else 0 end) - - fun set_ip_multicast_ttl(fd: U32, ttl: U8): I32 => - _set_so(fd, OSSockOpt.sol_socket(), OSSockOpt.ip_multicast_ttl(), ttl.i32()) + fun get_so_error(fd: U32): (U32, U32) => + getsockopt(fd, OSSockOpt.sol_socket(), OSSockOpt.so_error()) + + fun get_so_rcvbuf(fd: U32): (U32, U32) => + getsockopt(fd, OSSockOpt.sol_socket(), OSSockOpt.so_rcvbuf()) + + fun get_so_sndbuf(fd: U32): (U32, U32) => + getsockopt(fd, OSSockOpt.sol_socket(), OSSockOpt.so_sndbuf()) + + fun set_so_rcvbuf(fd: U32, bufsize: I32): U32 => + var word: Array[U8] ref = [ + (bufsize and 0xFF).u8(); ((bufsize >> 8) and 0xFF).u8() + ((bufsize >> 16) and 0xFF).u8(); ((bufsize >> 24) and 0xFF).u8()] //LE + set_so(fd, OSSockOpt.sol_socket(), OSSockOpt.so_rcvbuf(), word) + + fun set_so_sndbuf(fd: U32, bufsize: I32): U32 => + var word: Array[U8] ref = [ + (bufsize and 0xFF).u8(); ((bufsize >> 8) and 0xFF).u8() + ((bufsize >> 16) and 0xFF).u8(); ((bufsize >> 24) and 0xFF).u8()] //LE + set_so(fd, OSSockOpt.sol_socket(), OSSockOpt.so_sndbuf(), word) + + +/**************************************/ + + fun getsockopt(fd: U32, level: I32, option_name: I32, option: (None | Array[U8]) = None): (U32, U32) => + match option + | None => + var word: Array[U8] ref = [0;0;0;0] + (let errno: U32, _) = get_so(fd, level, option_name, word) + if errno == 0 then + try + (errno, _to_u32(word(3)?, word(2)?, word(1)?, word(0)?)) //LE + else + (1, 0) + end + else + (errno, 0) + end + | let oa: Array[U8] => + get_so(fd, level, option_name, oa) + end - fun set_so_rcvbuf(fd: U32, bufsize: I32): I32 => - _set_so(fd, OSSockOpt.sol_socket(), OSSockOpt.so_rcvbuf(), bufsize) + fun setsockopt(fd: U32, level: I32, option_name: I32, option: (I32 | Array[U8])): U32 => + match option + | let opt: I32 => + var word: Array[U8] ref = [ + (opt and 0xFF).u8(); ((opt >> 8) and 0xFF).u8() + ((opt >> 16) and 0xFF).u8(); ((opt >> 24) and 0xFF).u8() + ] //LE + set_so(fd, level, option_name, word) + | let oa: Array[U8] => + set_so(fd, level, option_name, oa) + end - fun set_so_sndbuf(fd: U32, bufsize: I32): I32 => - _set_so(fd, OSSockOpt.sol_socket(), OSSockOpt.so_sndbuf(), bufsize) + fun get_so(fd: U32, level: I32, option_name: I32, option: Array[U8]): (U32, U32) => + var option_size: U32 = option.size().u32() + let result: U32 = @pony_os_getsockopt[U32](fd, level, option_name, + option.cpointer(), addressof option_size) - fun set_tcp_nodelay(fd: U32, state: Bool): I32 => - _set_so(fd, OSSockOpt.sol_socket(), OSSockOpt.tcp_nodelay(), - if state then 1 else 0 end) + if result == 0 then + (result, option_size) + else + (result, U32(0)) + end + fun set_so(fd: U32, level: I32, option_name: I32, option: Array[U8]): U32 => + var option_size: U32 = option.size().u32() - fun _get_so(fd: U32, level: I32, option_name: I32): I32 => - var option: I32 = -1 - var option_size: I32 = 4 + @pony_os_setsockopt[U32](fd, level, option_name, + option.cpointer(), addressof option_size) - let res: I32 = @pony_os_getsockopt[I32](fd, level, option_name, - addressof option, addressof option_size) - if res == 0 then - if option_size == 4 then - option - else - option_size_changed_error() - end - else - res - end + fun _to_u32(a: U8, b: U8, c: U8, d: U8): U32 => + (a.u32() << 24) or (b.u32() << 16) or (c.u32() << 8) or d.u32() - fun _set_so(fd: U32, level: I32, option_name: I32, option': I32): I32 => - var option: I32 = option' - @pony_os_setsockopt[I32](fd, level, option_name, addressof option, I32(4)) +/**************************************/ diff --git a/packages/net/tcp_connection.pony b/packages/net/tcp_connection.pony index 2d0ba20fad..e556950bc8 100644 --- a/packages/net/tcp_connection.pony +++ b/packages/net/tcp_connection.pony @@ -432,7 +432,7 @@ actor TCPConnection socket. """ if _connected then - OSSocket.set_tcp_nodelay(_fd, state) + set_tcp_nodelay(state) end fun ref set_keepalive(secs: U32) => @@ -938,8 +938,8 @@ actor TCPConnection // Check this when a connection gets its first writeable event. fun _is_sock_connected(fd: U32): Bool => - OSSocket.get_so_error(fd) == 0 - + (let errno: U32, let value: U32) = _OSSocket.get_so_error(fd) + (errno == 0) and (value == 0) fun ref _apply_backpressure() => if not _throttled then @@ -962,5 +962,35 @@ actor TCPConnection _notify.unthrottled(this) end - fun get_fd(): U32 => - _fd + /**************************************/ + + fun getsockopt(level: I32, option_name: I32, option: (None | Array[U8]) = None): (U32, U32) => + _OSSocket.getsockopt(_fd, level, option_name, option) + + fun setsockopt(level: I32, option_name: I32, option: (I32 | Array[U8])): U32 => + _OSSocket.setsockopt(_fd, level, option_name, option) + + + fun get_so_error(): (U32, U32) => + _OSSocket.get_so_error(_fd) + + fun get_so_rcvbuf(): (U32, U32) => + _OSSocket.get_so_rcvbuf(_fd) + + fun get_so_sndbuf(): (U32, U32) => + _OSSocket.get_so_sndbuf(_fd) + + fun get_tcp_nodelay(): (U32, U32) => + _OSSocket.getsockopt(_fd, OSSockOpt.sol_socket(), OSSockOpt.tcp_nodelay()) + + + fun set_so_rcvbuf(bufsize: I32): U32 => + _OSSocket.set_so_rcvbuf(_fd, bufsize) + + fun set_so_sndbuf(bufsize: I32): U32 => + _OSSocket.set_so_sndbuf(_fd, bufsize) + + fun set_tcp_nodelay(state: Bool): U32 => + var word: Array[U8] ref = [if state then 1 else 0 end;0;0;0] //LE + _OSSocket.set_so(_fd, OSSockOpt.sol_socket(), OSSockOpt.tcp_nodelay(), word) + diff --git a/packages/net/udp_socket.pony b/packages/net/udp_socket.pony index 00d99ac0ab..784d6dbe9c 100644 --- a/packages/net/udp_socket.pony +++ b/packages/net/udp_socket.pony @@ -175,7 +175,7 @@ actor UDPSocket """ if not _closed then if _ip.ip4() then - OSSocket.set_so_broadcast(_fd, state) + set_so_broadcast(state) elseif _ip.ip6() then @pony_os_multicast_join[None](_fd, "FF02::1".cstring(), "".cstring()) end @@ -198,7 +198,7 @@ actor UDPSocket prevents this. """ if not _closed then - OSSocket.set_ip_multicast_loop(_fd, loopback) + set_ip_multicast_loop(loopback) end be set_multicast_ttl(ttl: U8) => @@ -206,7 +206,7 @@ actor UDPSocket Set the TTL for multicast sends. Defaults to 1. """ if not _closed then - OSSocket.set_ip_multicast_ttl(_fd, ttl) + set_ip_multicast_ttl(ttl) end be multicast_join(group: String, to: String = "") => @@ -406,3 +406,38 @@ actor UDPSocket @pony_os_socket_close[None](_fd) _fd = -1 end + + fun getsockopt(level: I32, option_name: I32, option: (None | Array[U8]) = None): (U32, U32) => + _OSSocket.getsockopt(_fd, level, option_name, option) + + fun setsockopt(level: I32, option_name: I32, option: (I32 | Array[U8])): U32 => + _OSSocket.setsockopt(_fd, level, option_name, option) + + + fun get_so_error(): (U32, U32) => + _OSSocket.get_so_error(_fd) + + fun get_so_rcvbuf(): (U32, U32) => + _OSSocket.get_so_rcvbuf(_fd) + + fun get_so_sndbuf(): (U32, U32) => + _OSSocket.get_so_sndbuf(_fd) + + + fun set_ip_multicast_loop(loopback: Bool): U32 => + var word: Array[U8] ref = [if loopback then 1 else 0 end;0;0;0] //LE + _OSSocket.set_so(_fd, OSSockOpt.sol_socket(), OSSockOpt.ip_multicast_loop(), word) + + fun set_ip_multicast_ttl(ttl: U8): U32 => + var word: Array[U8] ref = [ttl;0;0;0] //LE + _OSSocket.set_so(_fd, OSSockOpt.sol_socket(), OSSockOpt.ip_multicast_ttl(), word) + + fun set_so_broadcast(state: Bool): U32 => + var word: Array[U8] ref = [if state then 1 else 0 end;0;0;0] //LE + _OSSocket.set_so(_fd, OSSockOpt.sol_socket(), OSSockOpt.so_broadcast(), word) + + fun set_so_rcvbuf(bufsize: I32): U32 => + _OSSocket.set_so_rcvbuf(_fd, bufsize) + + fun set_so_sndbuf(bufsize: I32): U32 => + _OSSocket.set_so_sndbuf(_fd, bufsize) diff --git a/src/libponyrt/lang/socket.c b/src/libponyrt/lang/socket.c index e421dfc04e..09e9bf402b 100644 --- a/src/libponyrt/lang/socket.c +++ b/src/libponyrt/lang/socket.c @@ -1355,7 +1355,7 @@ PONY_API int pony_os_getsockopt(int fd, int level, int option_name, void *option if (getsockopt(fd, level, option_name, option_value, option_len) == 0) return 0; else - return -errno; + return errno; } #ifdef PLATFORM_IS_WINDOWS @@ -1367,7 +1367,7 @@ PONY_API int pony_os_setsockopt(int fd, int level, int option_name, void *option if (setsockopt(fd, level, option_name, option_value, option_len) == 0) return 0; else - return -errno; + return errno; } /* Constants are from From d3fa3273e535b3ddf23693c1222e5b5dec0ceda2 Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Wed, 7 Feb 2018 19:03:34 -0600 Subject: [PATCH 03/20] Split get/setsockopt and get/setsockopt_u32. Add docstrings. --- examples/under_pressure/main.pony | 4 +- packages/net/ossocket.pony | 159 +++++++++++++++++++++--------- packages/net/tcp_connection.pony | 83 ++++++++++++++-- packages/net/udp_socket.pony | 90 +++++++++++++++-- src/libponyrt/lang/socket.c | 4 +- 5 files changed, 276 insertions(+), 64 deletions(-) diff --git a/examples/under_pressure/main.pony b/examples/under_pressure/main.pony index fae80d8e55..2d24fb740a 100644 --- a/examples/under_pressure/main.pony +++ b/examples/under_pressure/main.pony @@ -87,12 +87,12 @@ class SlowDown is TCPConnectionNotify @printf[I32]("getsockopt sndbuf = 0x%x\n".cstring(), conn.get_so_sndbuf()._2) res = conn.set_so_rcvbuf(0x012233) @printf[I32]("setsockopt rcvbuf 0x%x return was %d\n".cstring(), bufsiz, res) - res = conn.setsockopt(OSSockOpt.sol_socket(), OSSockOpt.so_sndbuf(),0x012233) + res = conn.setsockopt_u32(OSSockOpt.sol_socket(), OSSockOpt.so_sndbuf(),0x012233) @printf[I32]("setsockopt sndbuf 0x%x return was %d\n".cstring(), bufsiz, res) @printf[I32]("getsockopt rcvbuf = 0x%x\n".cstring(), conn.get_so_rcvbuf()._2) @printf[I32]("getsockopt old sndbuf = 0x%x\n".cstring(), conn.get_so_sndbuf()._2) - @printf[I32]("getsockopt new sndbuf = 0x%x\n".cstring(), conn.getsockopt(OSSockOpt.sol_socket(), OSSockOpt.so_sndbuf())._2) + @printf[I32]("getsockopt new sndbuf = 0x%x\n".cstring(), conn.getsockopt_u32(OSSockOpt.sol_socket(), OSSockOpt.so_sndbuf())._2) var word: Array[U8] ref = [0;0;0;0] @printf[I32]("getsockopt New sndbuf = 0x%x\n".cstring(), conn.getsockopt(OSSockOpt.sol_socket(), OSSockOpt.so_sndbuf(), word)._2) try diff --git a/packages/net/ossocket.pony b/packages/net/ossocket.pony index 03a279f44b..a64b54bbc1 100644 --- a/packages/net/ossocket.pony +++ b/packages/net/ossocket.pony @@ -1,64 +1,126 @@ primitive _OSSocket """ - TODO + Socket type-independent wrapper functions for `getsockopt(2)` and + `setsockopt(2)` system calls for internal `net` package use. """ fun get_so_error(fd: U32): (U32, U32) => - getsockopt(fd, OSSockOpt.sol_socket(), OSSockOpt.so_error()) + """ + Wrapper for the FFI call `getsockopt(fd, SOL_SOCKET, SO_ERROR, ...)` + """ + getsockopt_u32(fd, OSSockOpt.sol_socket(), OSSockOpt.so_error()) fun get_so_rcvbuf(fd: U32): (U32, U32) => - getsockopt(fd, OSSockOpt.sol_socket(), OSSockOpt.so_rcvbuf()) + """ + Wrapper for the FFI call `getsockopt(fd, SOL_SOCKET, SO_RCVBUF, ...)` + """ + getsockopt_u32(fd, OSSockOpt.sol_socket(), OSSockOpt.so_rcvbuf()) fun get_so_sndbuf(fd: U32): (U32, U32) => - getsockopt(fd, OSSockOpt.sol_socket(), OSSockOpt.so_sndbuf()) - - fun set_so_rcvbuf(fd: U32, bufsize: I32): U32 => - var word: Array[U8] ref = [ - (bufsize and 0xFF).u8(); ((bufsize >> 8) and 0xFF).u8() - ((bufsize >> 16) and 0xFF).u8(); ((bufsize >> 24) and 0xFF).u8()] //LE - set_so(fd, OSSockOpt.sol_socket(), OSSockOpt.so_rcvbuf(), word) - - fun set_so_sndbuf(fd: U32, bufsize: I32): U32 => - var word: Array[U8] ref = [ - (bufsize and 0xFF).u8(); ((bufsize >> 8) and 0xFF).u8() - ((bufsize >> 16) and 0xFF).u8(); ((bufsize >> 24) and 0xFF).u8()] //LE - set_so(fd, OSSockOpt.sol_socket(), OSSockOpt.so_sndbuf(), word) - - -/**************************************/ - - fun getsockopt(fd: U32, level: I32, option_name: I32, option: (None | Array[U8]) = None): (U32, U32) => - match option - | None => - var word: Array[U8] ref = [0;0;0;0] - (let errno: U32, _) = get_so(fd, level, option_name, word) - if errno == 0 then - try - (errno, _to_u32(word(3)?, word(2)?, word(1)?, word(0)?)) //LE - else - (1, 0) - end + """ + Wrapper for the FFI call `getsockopt(fd, SOL_SOCKET, SO_SNDBUF, ...)` + """ + getsockopt_u32(fd, OSSockOpt.sol_socket(), OSSockOpt.so_sndbuf()) + + fun set_so_rcvbuf(fd: U32, bufsize: U32): U32 => + """ + Wrapper for the FFI call `setsockopt(fd, SOL_SOCKET, SO_RCVBUF, ...)` + """ + setsockopt_u32(fd, OSSockOpt.sol_socket(), OSSockOpt.so_rcvbuf(), bufsize) + + fun set_so_sndbuf(fd: U32, bufsize: U32): U32 => + """ + Wrapper for the FFI call `setsockopt(fd, SOL_SOCKET, SO_SNDBUF, ...)` + """ + setsockopt_u32(fd, OSSockOpt.sol_socket(), OSSockOpt.so_sndbuf(), bufsize) + + + fun getsockopt(fd: U32, level: I32, option_name: I32, option: Array[U8]): (U32, U32) => + """ + General wrapper for sockets to the `getsockopt(2)` system call. + + In case of system call success, this function returns the 2-tuple: + 1. The integer `0`. + 2. The value of the `*(uint32_t)option_length` argument set by + `getsockopt(2)`. The caller must use this length to properly + interpret the bytes written by the kernel into the `option` + byte array: this length may be smaller than `option`'s + original size. + + In case of system call failure, this function returns the 2-tuple: + 1. The value of `errno`. + 2. An undefined value that must be ignored. + """ + get_so(fd, level, option_name, option) + + fun getsockopt_u32(fd: U32, level: I32, option_name: I32): (U32, U32) => + var word: Array[U8] ref = [0;0;0;0] + """ + Wrapper for sockets to the `getsockopt(2)` system call where + the kernel's returned option value is a C `uint32_t` type / Pony + type `U32`. + + In case of system call success, this function returns the 2-tuple: + 1. The integer `0`. + 2. The `*option_value` returned by the kernel converted to a Pony `U32`. + + In case of system call failure, this function returns the 2-tuple: + 1. The value of `errno`. + 2. An undefined value that must be ignored. + """ + (let errno: U32, _) = get_so(fd, level, option_name, word) + + if errno == 0 then + try + (errno, _to_u32(word(3)?, word(2)?, word(1)?, word(0)?)) //LE else - (errno, 0) + (1, 0) end - | let oa: Array[U8] => - get_so(fd, level, option_name, oa) + else + (errno, 0) end - fun setsockopt(fd: U32, level: I32, option_name: I32, option: (I32 | Array[U8])): U32 => - match option - | let opt: I32 => - var word: Array[U8] ref = [ - (opt and 0xFF).u8(); ((opt >> 8) and 0xFF).u8() - ((opt >> 16) and 0xFF).u8(); ((opt >> 24) and 0xFF).u8() - ] //LE - set_so(fd, level, option_name, word) - | let oa: Array[U8] => - set_so(fd, level, option_name, oa) - end + fun setsockopt(fd: U32, level: I32, option_name: I32, option: Array[U8]): U32 => + """ + General wrapper for sockets to the `setsockopt(2)` system call. + + The caller is responsible for the correct size and byte contents of + the `option` array for the requested `level` and `option_name`, + including using the appropriate CPU endian byte order. + + This function returns `0` on success, else the value of `errno` on + failure. + """ + set_so(fd, level, option_name, option) + + fun setsockopt_u32(fd: U32, level: I32, option_name: I32, option: U32): U32 => + """ + Wrapper for sockets to the `setsockopt(2)` system call where + the kernel expects an option value of a C `uint32_t` type / Pony + type `U32`. + + This function returns `0` on success, else the value of `errno` on + failure. + """ + var word: Array[U8] ref = [ + (option and 0xFF).u8(); ((option >> 8) and 0xFF).u8() + ((option >> 16) and 0xFF).u8(); ((option >> 24) and 0xFF).u8() + ] //LE + set_so(fd, level, option_name, word) fun get_so(fd: U32, level: I32, option_name: I32, option: Array[U8]): (U32, U32) => + """ + Low-level interface to `getsockopt(2)` via `@pony_os_getsockopt[U32]()`. + + In case of system call success, this function returns the 2-tuple: + 1. The integer `0`. + 2. The value of the `*(uint32_t)option_length` argument set by + `getsockopt(2)`. + + In case of system call failure, `errno` is returned in the first + element of the 2-tuple, and the second element's value is junk. + """ var option_size: U32 = option.size().u32() let result: U32 = @pony_os_getsockopt[U32](fd, level, option_name, option.cpointer(), addressof option_size) @@ -71,11 +133,14 @@ primitive _OSSocket fun set_so(fd: U32, level: I32, option_name: I32, option: Array[U8]): U32 => var option_size: U32 = option.size().u32() + """ + Low-level interface to `setsockopt(2)` via `@pony_os_setsockopt[U32]()`. + This function returns `0` on success, else the value of `errno` on + failure. + """ @pony_os_setsockopt[U32](fd, level, option_name, option.cpointer(), addressof option_size) fun _to_u32(a: U8, b: U8, c: U8, d: U8): U32 => (a.u32() << 24) or (b.u32() << 16) or (c.u32() << 8) or d.u32() - -/**************************************/ diff --git a/packages/net/tcp_connection.pony b/packages/net/tcp_connection.pony index e556950bc8..cb10b8af56 100644 --- a/packages/net/tcp_connection.pony +++ b/packages/net/tcp_connection.pony @@ -964,33 +964,104 @@ actor TCPConnection /**************************************/ - fun getsockopt(level: I32, option_name: I32, option: (None | Array[U8]) = None): (U32, U32) => + fun getsockopt(level: I32, option_name: I32, option: Array[U8]): (U32, U32) => + """ + General wrapper for TCP sockets to the `getsockopt(2)` system call. + + In case of system call success, this function returns the 2-tuple: + 1. The integer `0`. + 2. The value of the `*(uint32_t)option_length` argument set by + `getsockopt(2)`. The caller must use this length to properly + interpret the bytes written by the kernel into the `option` + byte array: this length may be smaller than `option`'s + original size. + + In case of system call failure, this function returns the 2-tuple: + 1. The value of `errno`. + 2. An undefined value that must be ignored. + """ _OSSocket.getsockopt(_fd, level, option_name, option) - fun setsockopt(level: I32, option_name: I32, option: (I32 | Array[U8])): U32 => + fun getsockopt_u32(level: I32, option_name: I32): (U32, U32) => + """ + Wrapper for TCP sockets to the `getsockopt(2)` system call where + the kernel's returned option value is a C `uint32_t` type / Pony + type `U32`. + + In case of system call success, this function returns the 2-tuple: + 1. The integer `0`. + 2. The `*option_value` returned by the kernel converted to a Pony `U32`. + + In case of system call failure, this function returns the 2-tuple: + 1. The value of `errno`. + 2. An undefined value that must be ignored. + """ + _OSSocket.getsockopt_u32(_fd, level, option_name) + + fun setsockopt(level: I32, option_name: I32, option: Array[U8]): U32 => + """ + General wrapper for TCP sockets to the `setsockopt(2)` system call. + + The caller is responsible for the correct size and byte contents of + the `option` array for the requested `level` and `option_name`, + including using the appropriate machine endian byte order. + + This function returns `0` on success, else the value of `errno` on + failure. + """ _OSSocket.setsockopt(_fd, level, option_name, option) + fun setsockopt_u32(level: I32, option_name: I32, option: U32): U32 => + """ + General wrapper for TCP sockets to the `setsockopt(2)` system call. + + This function returns `0` on success, else the value of `errno` on + failure. + """ + _OSSocket.setsockopt_u32(_fd, level, option_name, option) + fun get_so_error(): (U32, U32) => + """ + Wrapper for the FFI call `getsockopt(fd, SOL_SOCKET, SO_ERROR, ...)` + """ _OSSocket.get_so_error(_fd) fun get_so_rcvbuf(): (U32, U32) => + """ + Wrapper for the FFI call `getsockopt(fd, SOL_SOCKET, SO_RCVBUF, ...)` + """ _OSSocket.get_so_rcvbuf(_fd) fun get_so_sndbuf(): (U32, U32) => + """ + Wrapper for the FFI call `getsockopt(fd, SOL_SOCKET, SO_SNDBUF, ...)` + """ _OSSocket.get_so_sndbuf(_fd) fun get_tcp_nodelay(): (U32, U32) => - _OSSocket.getsockopt(_fd, OSSockOpt.sol_socket(), OSSockOpt.tcp_nodelay()) + """ + Wrapper for the FFI call `getsockopt(fd, SOL_SOCKET, TCP_NODELAY, ...)` + """ + _OSSocket.getsockopt_u32(_fd, OSSockOpt.sol_socket(), OSSockOpt.tcp_nodelay()) - fun set_so_rcvbuf(bufsize: I32): U32 => + fun set_so_rcvbuf(bufsize: U32): U32 => + """ + Wrapper for the FFI call `setsockopt(fd, SOL_SOCKET, SO_RCVBUF, ...)` + """ _OSSocket.set_so_rcvbuf(_fd, bufsize) - fun set_so_sndbuf(bufsize: I32): U32 => + fun set_so_sndbuf(bufsize: U32): U32 => + """ + Wrapper for the FFI call `setsockopt(fd, SOL_SOCKET, SO_SNDBUF, ...)` + """ _OSSocket.set_so_sndbuf(_fd, bufsize) fun set_tcp_nodelay(state: Bool): U32 => + """ + Wrapper for the FFI call `setsockopt(fd, SOL_SOCKET, TCP_NODELAY, ...)` + """ var word: Array[U8] ref = [if state then 1 else 0 end;0;0;0] //LE - _OSSocket.set_so(_fd, OSSockOpt.sol_socket(), OSSockOpt.tcp_nodelay(), word) + _OSSocket.setsockopt(_fd, OSSockOpt.sol_socket(), OSSockOpt.tcp_nodelay(), word) diff --git a/packages/net/udp_socket.pony b/packages/net/udp_socket.pony index 784d6dbe9c..6b507dad2f 100644 --- a/packages/net/udp_socket.pony +++ b/packages/net/udp_socket.pony @@ -407,37 +407,113 @@ actor UDPSocket _fd = -1 end - fun getsockopt(level: I32, option_name: I32, option: (None | Array[U8]) = None): (U32, U32) => + fun getsockopt(level: I32, option_name: I32, option: Array[U8]): (U32, U32) => + """ + General wrapper for UDP sockets to the `getsockopt(2)` system call. + + In case of system call success, this function returns the 2-tuple: + 1. The integer `0`. + 2. The value of the `*(uint32_t)option_length` argument set by + `getsockopt(2)`. The caller must use this length to properly + interpret the bytes written by the kernel into the `option` + byte array: this length may be smaller than `option`'s + original size. + + In case of system call failure, this function returns the 2-tuple: + 1. The value of `errno`. + 2. An undefined value that must be ignored. + """ _OSSocket.getsockopt(_fd, level, option_name, option) - fun setsockopt(level: I32, option_name: I32, option: (I32 | Array[U8])): U32 => + fun getsockopt_u32(level: I32, option_name: I32): (U32, U32) => + """ + Wrapper for UDP sockets to the `getsockopt(2)` system call where + the kernel's returned option value is a C `uint32_t` type / Pony + type `U32`. + + In case of system call success, this function returns the 2-tuple: + 1. The integer `0`. + 2. The `*option_value` returned by the kernel converted to a Pony `U32`. + + In case of system call failure, this function returns the 2-tuple: + 1. The value of `errno`. + 2. An undefined value that must be ignored. + """ + _OSSocket.getsockopt_u32(_fd, level, option_name) + + fun setsockopt(level: I32, option_name: I32, option: Array[U8]): U32 => + """ + General wrapper for UDP sockets to the `setsockopt(2)` system call. + + The caller is responsible for the correct size and byte contents of + the `option` array for the requested `level` and `option_name`, + including using the appropriate CPU endian byte order. + + This function returns `0` on success, else the value of `errno` on + failure. + """ _OSSocket.setsockopt(_fd, level, option_name, option) + fun setsockopt_u32(level: I32, option_name: I32, option: U32): U32 => + """ + Wrapper for UDP sockets to the `setsockopt(2)` system call where + the kernel expects an option value of a C `uint32_t` type / Pony + type `U32`. + + This function returns `0` on success, else the value of `errno` on + failure. + """ + _OSSocket.setsockopt_u32(_fd, level, option_name, option) + fun get_so_error(): (U32, U32) => + """ + Wrapper for the FFI call `getsockopt(fd, SOL_SOCKET, SO_ERROR, ...)` + """ _OSSocket.get_so_error(_fd) fun get_so_rcvbuf(): (U32, U32) => + """ + Wrapper for the FFI call `getsockopt(fd, SOL_SOCKET, SO_RCVBUF, ...)` + """ _OSSocket.get_so_rcvbuf(_fd) fun get_so_sndbuf(): (U32, U32) => + """ + Wrapper for the FFI call `getsockopt(fd, SOL_SOCKET, SO_SNDBUF, ...)` + """ _OSSocket.get_so_sndbuf(_fd) fun set_ip_multicast_loop(loopback: Bool): U32 => + """ + Wrapper for the FFI call `setsockopt(fd, SOL_SOCKET, IP_MULTICAST_LOOP, ...)` + """ var word: Array[U8] ref = [if loopback then 1 else 0 end;0;0;0] //LE - _OSSocket.set_so(_fd, OSSockOpt.sol_socket(), OSSockOpt.ip_multicast_loop(), word) + _OSSocket.setsockopt(_fd, OSSockOpt.sol_socket(), OSSockOpt.ip_multicast_loop(), word) fun set_ip_multicast_ttl(ttl: U8): U32 => + """ + Wrapper for the FFI call `setsockopt(fd, SOL_SOCKET, IP_MULTICAST_TTL, ...)` + """ var word: Array[U8] ref = [ttl;0;0;0] //LE - _OSSocket.set_so(_fd, OSSockOpt.sol_socket(), OSSockOpt.ip_multicast_ttl(), word) + _OSSocket.setsockopt(_fd, OSSockOpt.sol_socket(), OSSockOpt.ip_multicast_ttl(), word) fun set_so_broadcast(state: Bool): U32 => + """ + Wrapper for the FFI call `setsockopt(fd, SOL_SOCKET, SO_BROADCAST, ...)` + """ var word: Array[U8] ref = [if state then 1 else 0 end;0;0;0] //LE - _OSSocket.set_so(_fd, OSSockOpt.sol_socket(), OSSockOpt.so_broadcast(), word) + _OSSocket.setsockopt(_fd, OSSockOpt.sol_socket(), OSSockOpt.so_broadcast(), word) - fun set_so_rcvbuf(bufsize: I32): U32 => + fun set_so_rcvbuf(bufsize: U32): U32 => + """ + Wrapper for the FFI call `setsockopt(fd, SOL_SOCKET, SO_RCVBUF, ...)` + """ _OSSocket.set_so_rcvbuf(_fd, bufsize) - fun set_so_sndbuf(bufsize: I32): U32 => + fun set_so_sndbuf(bufsize: U32): U32 => + """ + Wrapper for the FFI call `setsockopt(fd, SOL_SOCKET, SO_SNDBUF, ...)` + """ _OSSocket.set_so_sndbuf(_fd, bufsize) diff --git a/src/libponyrt/lang/socket.c b/src/libponyrt/lang/socket.c index 09e9bf402b..ddfb3d3c6a 100644 --- a/src/libponyrt/lang/socket.c +++ b/src/libponyrt/lang/socket.c @@ -1112,7 +1112,7 @@ PONY_API void pony_os_nodelay(int fd, bool state) { int val = state; - api_deprecated("pony_os_nodelay", "OSSocket.set_tcp_nodelay"); + api_deprecated("pony_os_nodelay", "TCPConnection.set_tcp_nodelay"); setsockopt((SOCKET)fd, IPPROTO_TCP, TCP_NODELAY, (const char*)&val, sizeof(int)); } @@ -1212,7 +1212,7 @@ PONY_API void pony_os_broadcast(int fd, bool state) { int broadcast = state ? 1 : 0; - api_deprecated("pony_os_broadcast", "OSSocket.set_so_broadcast"); + api_deprecated("pony_os_broadcast", "UDPSocket.set_so_broadcast"); setsockopt((SOCKET)fd, SOL_SOCKET, SO_BROADCAST, (const char*)&broadcast, sizeof(broadcast)); } From 0171d59f8079eb0c9b0a6bde98882e4afa6d1b0b Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Thu, 8 Feb 2018 16:15:31 -0600 Subject: [PATCH 04/20] WIP: WHA? NODELAY word size = 1, really? --- packages/net/tcp_connection.pony | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/net/tcp_connection.pony b/packages/net/tcp_connection.pony index cb10b8af56..5743db56ca 100644 --- a/packages/net/tcp_connection.pony +++ b/packages/net/tcp_connection.pony @@ -1062,6 +1062,17 @@ actor TCPConnection """ Wrapper for the FFI call `setsockopt(fd, SOL_SOCKET, TCP_NODELAY, ...)` """ - var word: Array[U8] ref = [if state then 1 else 0 end;0;0;0] //LE +/**** + var word: Array[U8] ref = [if state then @printf[I32]("Yo yo, dunno\n".cstring()); U8(1) else U8(0) end;U8(0);U8(0);U8(0)] //LE + ****/ + var word: Array[U8] ref = [ + ifdef littleendian then + if state then @printf[I32]("Yo yo, little\n".cstring()); U8(1) else U8(0) end; U8(0); U8(0); U8(0) + else + U8(0); U8(0); U8(0); if state then U8(1) else U8(0) end + end + ] + @printf[I32]("NODELAY word size = %d\n".cstring(), word.size()) + try @printf[I32]("NODELAY %d %d %d %d\n".cstring(), word(0)?, word(1)?, word(2)?, word(3)?) end _OSSocket.setsockopt(_fd, OSSockOpt.sol_socket(), OSSockOpt.tcp_nodelay(), word) From 3be15d9bf639d3c2c157d18470c2307b24056623 Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Thu, 8 Feb 2018 16:18:54 -0600 Subject: [PATCH 05/20] WIP: OK, NODELAY word size = 4, hooray --- packages/net/tcp_connection.pony | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/packages/net/tcp_connection.pony b/packages/net/tcp_connection.pony index 5743db56ca..c09e4ae307 100644 --- a/packages/net/tcp_connection.pony +++ b/packages/net/tcp_connection.pony @@ -1062,17 +1062,11 @@ actor TCPConnection """ Wrapper for the FFI call `setsockopt(fd, SOL_SOCKET, TCP_NODELAY, ...)` """ -/**** - var word: Array[U8] ref = [if state then @printf[I32]("Yo yo, dunno\n".cstring()); U8(1) else U8(0) end;U8(0);U8(0);U8(0)] //LE - ****/ - var word: Array[U8] ref = [ + var word: Array[U8] ref = ifdef littleendian then - if state then @printf[I32]("Yo yo, little\n".cstring()); U8(1) else U8(0) end; U8(0); U8(0); U8(0) + [ if state then 1 else 0 end; 0; 0; 0 ] else - U8(0); U8(0); U8(0); if state then U8(1) else U8(0) end + [ 0; 0; 0; if state then 1 else 0 end ] end - ] - @printf[I32]("NODELAY word size = %d\n".cstring(), word.size()) - try @printf[I32]("NODELAY %d %d %d %d\n".cstring(), word(0)?, word(1)?, word(2)?, word(3)?) end _OSSocket.setsockopt(_fd, OSSockOpt.sol_socket(), OSSockOpt.tcp_nodelay(), word) From 471ba586cad96ad5e2dd6623f3dfb23d6d6295d3 Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Thu, 8 Feb 2018 16:54:44 -0600 Subject: [PATCH 06/20] Add 'bigendian' and 'littleendian' to platformfuns et al. --- src/libponyc/codegen/genopt.cc | 14 ++++++++++++++ src/libponyc/codegen/genopt.h | 2 ++ src/libponyc/pkg/platformfuns.c | 12 ++++++++++++ src/libponyc/pkg/platformfuns.h | 2 ++ 4 files changed, 30 insertions(+) diff --git a/src/libponyc/codegen/genopt.cc b/src/libponyc/codegen/genopt.cc index 893447c43c..519ffce275 100644 --- a/src/libponyc/codegen/genopt.cc +++ b/src/libponyc/codegen/genopt.cc @@ -1575,3 +1575,17 @@ bool target_is_native128(char* t) return !triple.isArch32Bit() && !triple.isKnownWindowsMSVCEnvironment(); } + +static uint32_t endian_test = 0x44332211; + +bool target_is_bigendian(char* t) +{ + (void)t; + return *(uint8_t *)(&endian_test) == 0x44; +} + +bool target_is_littleendian(char* t) +{ + (void)t; + return *(uint8_t *)(&endian_test) == 0x11; +} diff --git a/src/libponyc/codegen/genopt.h b/src/libponyc/codegen/genopt.h index d084f15d5c..5cce7f9f3d 100644 --- a/src/libponyc/codegen/genopt.h +++ b/src/libponyc/codegen/genopt.h @@ -21,6 +21,8 @@ bool target_is_lp64(char* triple); bool target_is_llp64(char* triple); bool target_is_ilp32(char* triple); bool target_is_native128(char* triple); +bool target_is_bigendian(char* triple); +bool target_is_littleendian(char* triple); PONY_EXTERN_C_END diff --git a/src/libponyc/pkg/platformfuns.c b/src/libponyc/pkg/platformfuns.c index 2be36e8ce3..1c2fecbaa1 100644 --- a/src/libponyc/pkg/platformfuns.c +++ b/src/libponyc/pkg/platformfuns.c @@ -95,5 +95,17 @@ bool os_is_target(const char* attribute, bool release, bool* out_is_target, pass return true; } + if(!strcmp(attribute, OS_BIGENDIAN_NAME)) + { + *out_is_target = target_is_bigendian(options->triple); + return true; + } + + if(!strcmp(attribute, OS_LITTLEENDIAN_NAME)) + { + *out_is_target = target_is_littleendian(options->triple); + return true; + } + return false; } diff --git a/src/libponyc/pkg/platformfuns.h b/src/libponyc/pkg/platformfuns.h index 684ab73c08..66db0b79ad 100644 --- a/src/libponyc/pkg/platformfuns.h +++ b/src/libponyc/pkg/platformfuns.h @@ -21,6 +21,8 @@ PONY_EXTERN_C_BEGIN #define OS_ILP32_NAME "ilp32" #define OS_NATIVE128_NAME "native128" #define OS_DEBUG_NAME "debug" +#define OS_BIGENDIAN_NAME "bigendian" +#define OS_LITTLEENDIAN_NAME "littleendian" /** Report whether the named platform attribute is true * @param out_is true if the specified attribute is set, false otherwise From 6542d32ed6ae8a457299a9d49a93126964b8f69c Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Thu, 8 Feb 2018 16:55:24 -0600 Subject: [PATCH 07/20] Add 'ifdef littleendian' checks where byte twiddling is needed --- examples/under_pressure/main.pony | 5 +++++ packages/net/ossocket.pony | 24 +++++++++++++++++------- packages/net/tcp_connection.pony | 8 ++------ packages/net/udp_socket.pony | 8 +++++--- 4 files changed, 29 insertions(+), 16 deletions(-) diff --git a/examples/under_pressure/main.pony b/examples/under_pressure/main.pony index 2d24fb740a..e0240a8ef3 100644 --- a/examples/under_pressure/main.pony +++ b/examples/under_pressure/main.pony @@ -96,6 +96,11 @@ class SlowDown is TCPConnectionNotify var word: Array[U8] ref = [0;0;0;0] @printf[I32]("getsockopt New sndbuf = 0x%x\n".cstring(), conn.getsockopt(OSSockOpt.sol_socket(), OSSockOpt.so_sndbuf(), word)._2) try + var qq: U8 + @printf[I32]("gotsockopt New sndbuf word top, word.size() = %d\n".cstring(), word.size()) + qq = word(0)? + @printf[I32]("gotsockopt New sndbuf word(0) is %x\n".cstring(), qq) + @printf[I32]("gotsockopt New sndbuf word(0) is %x\n".cstring(), word(0)?) @printf[I32]("getsockopt New sndbuf = %x %x %x %x\n".cstring(), word(0)?, word(1)?, word(2)?, word(3)?) end diff --git a/packages/net/ossocket.pony b/packages/net/ossocket.pony index a64b54bbc1..82602b65f7 100644 --- a/packages/net/ossocket.pony +++ b/packages/net/ossocket.pony @@ -73,7 +73,7 @@ primitive _OSSocket if errno == 0 then try - (errno, _to_u32(word(3)?, word(2)?, word(1)?, word(0)?)) //LE + (errno, bytes4_to_u32(word)?) else (1, 0) end @@ -103,10 +103,7 @@ primitive _OSSocket This function returns `0` on success, else the value of `errno` on failure. """ - var word: Array[U8] ref = [ - (option and 0xFF).u8(); ((option >> 8) and 0xFF).u8() - ((option >> 16) and 0xFF).u8(); ((option >> 24) and 0xFF).u8() - ] //LE + var word: Array[U8] ref = u32_to_bytes4(option) set_so(fd, level, option_name, word) fun get_so(fd: U32, level: I32, option_name: I32, option: Array[U8]): (U32, U32) => @@ -142,5 +139,18 @@ primitive _OSSocket @pony_os_setsockopt[U32](fd, level, option_name, option.cpointer(), addressof option_size) - fun _to_u32(a: U8, b: U8, c: U8, d: U8): U32 => - (a.u32() << 24) or (b.u32() << 16) or (c.u32() << 8) or d.u32() + fun bytes4_to_u32(b: Array[U8]): U32 ? => + ifdef littleendian then + (b(3)?.u32() << 24) or (b(2)?.u32() << 16) or (b(1)?.u32() << 8) or b(0)?.u32() + else + (b(0)?.u32() << 24) or (b(1)?.u32() << 16) or (b(2)?.u32() << 8) or b(3)?.u32() + end + + fun u32_to_bytes4(option: U32): Array[U8] => + ifdef littleendian then + [ (option and 0xFF).u8(); ((option >> 8) and 0xFF).u8() + ((option >> 16) and 0xFF).u8(); ((option >> 24) and 0xFF).u8() ] + else + [ ((option >> 24) and 0xFF).u8(); ((option >> 16) and 0xFF).u8() + ((option >> 8) and 0xFF).u8(); (option and 0xFF).u8() ] + end \ No newline at end of file diff --git a/packages/net/tcp_connection.pony b/packages/net/tcp_connection.pony index c09e4ae307..dfec34cea5 100644 --- a/packages/net/tcp_connection.pony +++ b/packages/net/tcp_connection.pony @@ -1062,11 +1062,7 @@ actor TCPConnection """ Wrapper for the FFI call `setsockopt(fd, SOL_SOCKET, TCP_NODELAY, ...)` """ - var word: Array[U8] ref = - ifdef littleendian then - [ if state then 1 else 0 end; 0; 0; 0 ] - else - [ 0; 0; 0; if state then 1 else 0 end ] - end + var word: Array[U8] ref = + _OSSocket.u32_to_bytes4(if state then 1 else 0 end) _OSSocket.setsockopt(_fd, OSSockOpt.sol_socket(), OSSockOpt.tcp_nodelay(), word) diff --git a/packages/net/udp_socket.pony b/packages/net/udp_socket.pony index 6b507dad2f..48bac2bce4 100644 --- a/packages/net/udp_socket.pony +++ b/packages/net/udp_socket.pony @@ -489,21 +489,23 @@ actor UDPSocket """ Wrapper for the FFI call `setsockopt(fd, SOL_SOCKET, IP_MULTICAST_LOOP, ...)` """ - var word: Array[U8] ref = [if loopback then 1 else 0 end;0;0;0] //LE + var word: Array[U8] ref = + _OSSocket.u32_to_bytes4(if loopback then 1 else 0 end) _OSSocket.setsockopt(_fd, OSSockOpt.sol_socket(), OSSockOpt.ip_multicast_loop(), word) fun set_ip_multicast_ttl(ttl: U8): U32 => """ Wrapper for the FFI call `setsockopt(fd, SOL_SOCKET, IP_MULTICAST_TTL, ...)` """ - var word: Array[U8] ref = [ttl;0;0;0] //LE + var word: Array[U8] ref = _OSSocket.u32_to_bytes4(ttl.u32()) _OSSocket.setsockopt(_fd, OSSockOpt.sol_socket(), OSSockOpt.ip_multicast_ttl(), word) fun set_so_broadcast(state: Bool): U32 => """ Wrapper for the FFI call `setsockopt(fd, SOL_SOCKET, SO_BROADCAST, ...)` """ - var word: Array[U8] ref = [if state then 1 else 0 end;0;0;0] //LE + var word: Array[U8] ref = + _OSSocket.u32_to_bytes4(if state then 1 else 0 end) _OSSocket.setsockopt(_fd, OSSockOpt.sol_socket(), OSSockOpt.so_broadcast(), word) fun set_so_rcvbuf(bufsize: U32): U32 => From d444e3ff05816639cc398d5eca5f351de66aef7f Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Thu, 8 Feb 2018 17:10:25 -0600 Subject: [PATCH 08/20] Clean up get/setsockopt stuff in under_pressure; use larger write size --- examples/under_pressure/main.pony | 53 +++++++++++-------------------- 1 file changed, 18 insertions(+), 35 deletions(-) diff --git a/examples/under_pressure/main.pony b/examples/under_pressure/main.pony index e0240a8ef3..510dcf9210 100644 --- a/examples/under_pressure/main.pony +++ b/examples/under_pressure/main.pony @@ -69,40 +69,23 @@ class SlowDown is TCPConnectionNotify _out = out fun ref connected(conn: TCPConnection ref) => - let bufsiz: I32 = 0x012233 - - @printf[I32]("getsockopt so_error = %d\n".cstring(), conn.get_so_error()._2) - @printf[I32]("getsockopt get_tcp_nodelay = %d\n".cstring(), conn.get_tcp_nodelay()._2) - var res: U32 - res = conn.set_tcp_nodelay(true) - @printf[I32]("getsockopt set_tcp_nodelay(fd, true) = %d\n".cstring(), res) - @printf[I32]("getsockopt get_tcp_nodelay = %d\n".cstring(), conn.get_tcp_nodelay()._2) - - res = conn.set_tcp_nodelay(false) - @printf[I32]("getsockopt get_tcp_nodelay (after set_tcp_nodelay) = %d\n".cstring(), conn.get_tcp_nodelay()._2) - conn.set_nodelay(true) - @printf[I32]("getsockopt get_tcp_nodelay (after conn.set_nodelay(true)) = %d\n".cstring(), conn.get_tcp_nodelay()._2) - - @printf[I32]("getsockopt rcvbuf = 0x%x\n".cstring(), conn.get_so_rcvbuf()._2) - @printf[I32]("getsockopt sndbuf = 0x%x\n".cstring(), conn.get_so_sndbuf()._2) - res = conn.set_so_rcvbuf(0x012233) - @printf[I32]("setsockopt rcvbuf 0x%x return was %d\n".cstring(), bufsiz, res) - res = conn.setsockopt_u32(OSSockOpt.sol_socket(), OSSockOpt.so_sndbuf(),0x012233) - @printf[I32]("setsockopt sndbuf 0x%x return was %d\n".cstring(), bufsiz, res) - - @printf[I32]("getsockopt rcvbuf = 0x%x\n".cstring(), conn.get_so_rcvbuf()._2) - @printf[I32]("getsockopt old sndbuf = 0x%x\n".cstring(), conn.get_so_sndbuf()._2) - @printf[I32]("getsockopt new sndbuf = 0x%x\n".cstring(), conn.getsockopt_u32(OSSockOpt.sol_socket(), OSSockOpt.so_sndbuf())._2) - var word: Array[U8] ref = [0;0;0;0] - @printf[I32]("getsockopt New sndbuf = 0x%x\n".cstring(), conn.getsockopt(OSSockOpt.sol_socket(), OSSockOpt.so_sndbuf(), word)._2) - try - var qq: U8 - @printf[I32]("gotsockopt New sndbuf word top, word.size() = %d\n".cstring(), word.size()) - qq = word(0)? - @printf[I32]("gotsockopt New sndbuf word(0) is %x\n".cstring(), qq) - @printf[I32]("gotsockopt New sndbuf word(0) is %x\n".cstring(), word(0)?) - @printf[I32]("getsockopt New sndbuf = %x %x %x %x\n".cstring(), word(0)?, word(1)?, word(2)?, word(3)?) - end + let bufsiz: U32 = 5000 + + @printf[I32]("Querying and setting socket options:\n".cstring()) + @printf[I32]("\tgetsockopt so_error = %d\n".cstring(), + conn.get_so_error()._2) + @printf[I32]("\tgetsockopt get_tcp_nodelay = %d\n".cstring(), + conn.get_tcp_nodelay()._2) + @printf[I32]("\tgetsockopt set_tcp_nodelay(true) return value = %d\n".cstring(), + conn.set_tcp_nodelay(true)) + @printf[I32]("\tgetsockopt get_tcp_nodelay = %d\n".cstring(), conn.get_tcp_nodelay()._2) + + @printf[I32]("\tgetsockopt rcvbuf = %d\n".cstring(), conn.get_so_rcvbuf()._2) + @printf[I32]("\tgetsockopt sndbuf = %d\n".cstring(), conn.get_so_sndbuf()._2) + @printf[I32]("\tsetsockopt rcvbuf %d return was %d\n".cstring(), bufsiz, + conn.set_so_rcvbuf(bufsiz)) + @printf[I32]("\tsetsockopt sndbuf %d return was %d\n".cstring(), bufsiz, + conn.set_so_rcvbuf(bufsiz)) fun ref throttled(connection: TCPConnection ref) => _out.print("Experiencing backpressure!") @@ -123,7 +106,7 @@ class Send is TimerNotify _sending_actor = sending_actor fun ref apply(timer: Timer, count: U64): Bool => - let data = recover val Array[U8].init(72, 1024) end + let data = recover val Array[U8].init(72, 16384) end _sending_actor.write(data) _sending_actor.write("hi\n") true From fec35770b60fad945505886d1b6f5daec08571d1 Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Thu, 8 Feb 2018 19:53:31 -0600 Subject: [PATCH 09/20] Remove bad use of 'addressof' in last arg to pony_os_setsockopt: OS X doesn't care, Linux sometimes cares --- packages/net/ossocket.pony | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/net/ossocket.pony b/packages/net/ossocket.pony index 82602b65f7..5a345ba267 100644 --- a/packages/net/ossocket.pony +++ b/packages/net/ossocket.pony @@ -137,7 +137,7 @@ primitive _OSSocket failure. """ @pony_os_setsockopt[U32](fd, level, option_name, - option.cpointer(), addressof option_size) + option.cpointer(), option_size) fun bytes4_to_u32(b: Array[U8]): U32 ? => ifdef littleendian then From 003fc061e55d85e4ac516651cf4778f28c4e2aaa Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Fri, 9 Feb 2018 12:41:24 -0600 Subject: [PATCH 10/20] Review: use llvm::Triple::isLittleEndian() method --- src/libponyc/codegen/genopt.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libponyc/codegen/genopt.cc b/src/libponyc/codegen/genopt.cc index 519ffce275..d0e83d9d2d 100644 --- a/src/libponyc/codegen/genopt.cc +++ b/src/libponyc/codegen/genopt.cc @@ -1576,16 +1576,16 @@ bool target_is_native128(char* t) return !triple.isArch32Bit() && !triple.isKnownWindowsMSVCEnvironment(); } -static uint32_t endian_test = 0x44332211; - bool target_is_bigendian(char* t) { - (void)t; - return *(uint8_t *)(&endian_test) == 0x44; + Triple triple = Triple(t); + + return !triple.isLittleEndian(); } bool target_is_littleendian(char* t) { - (void)t; - return *(uint8_t *)(&endian_test) == 0x11; + Triple triple = Triple(t); + + return triple.isLittleEndian(); } From c17741739b8ec0d1ac05eed8923d562259378b70 Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Fri, 9 Feb 2018 12:48:48 -0600 Subject: [PATCH 11/20] Review: semi-mechanically add _endian_flags table & management code to buildflagset.c --- src/libponyc/pkg/buildflagset.c | 69 ++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/src/libponyc/pkg/buildflagset.c b/src/libponyc/pkg/buildflagset.c index 7d313ea4fb..1f386dfeda 100644 --- a/src/libponyc/pkg/buildflagset.c +++ b/src/libponyc/pkg/buildflagset.c @@ -38,10 +38,18 @@ static const char* _size_flags[] = NULL // Terminator. }; +static const char* _endian_flags[] = +{ + OS_BIGENDIAN_NAME, + OS_LITTLEENDIAN_NAME, + "unknown_endian", + NULL // Terminator. +}; + static bool _stringtabed = false; -// Replace all the strings in the _os_flags, _arch_flags and _size_flags +// Replace all the strings in the _{os,arch,size,endian}_flags // arrays with stringtab'ed versions the first time this is called. // This method of initialisation is obviously not at all concurrency safe, but // it works with unit tests trivially. @@ -59,6 +67,9 @@ static void stringtab_mutexgroups() for(size_t i = 0; _size_flags[i] != NULL; i++) _size_flags[i] = stringtab(_size_flags[i]); + for(size_t i = 0; _endian_flags[i] != NULL; i++) + _endian_flags[i] = stringtab(_endian_flags[i]); + _stringtabed = true; } @@ -109,12 +120,14 @@ struct buildflagset_t bool have_os_flags; bool have_arch_flags; bool have_size_flags; + bool have_endian_flags; bool started_enum; bool first_config_ready; flagtab_t* flags; uint32_t enum_os_flags; uint32_t enum_arch_flags; uint32_t enum_size_flags; + uint32_t enum_endian_flags; char* text_buffer; // Buffer for printing config. size_t buffer_size; // Size allocated for text_buffer. }; @@ -128,6 +141,7 @@ buildflagset_t* buildflagset_create() p->have_os_flags = false; p->have_arch_flags = false; p->have_size_flags = false; + p->have_endian_flags = false; p->started_enum = false; p->flags = POOL_ALLOC(flagtab_t); flagtab_init(p->flags, 8); @@ -204,6 +218,23 @@ static ssize_t size_index(const char* flag) } +// Determine the index of the given endian flag, if it is one. +// Returns: index of flag into _endian_flags array, or <0 if not an endian flag. +static ssize_t endian_index(const char* flag) +{ + pony_assert(flag != NULL); + + stringtab_mutexgroups(); + + for(size_t i = 0; _endian_flags[i] != NULL; i++) + if(flag == _endian_flags[i]) // Match found. + return i; + + // Match not found. + return -1; +} + + void buildflagset_add(buildflagset_t* set, const char* flag) { pony_assert(set != NULL); @@ -233,6 +264,13 @@ void buildflagset_add(buildflagset_t* set, const char* flag) return; } + if(endian_index(flag) >= 0) + { + // Endian flag. + set->have_endian_flags = true; + return; + } + // Just a normal flag. flag_t f1 = {flag, false}; size_t index = HASHMAP_UNKNOWN; @@ -283,6 +321,15 @@ double buildflagset_configcount(buildflagset_t* set) r *= count; } + if(set->have_endian_flags) + { + int count = 0; + while(_endian_flags[count] != NULL) + count++; + + r *= count; + } + // Now check normal flags, each doubles number of configs. size_t i = HASHMAP_BEGIN; @@ -305,6 +352,7 @@ void buildflagset_startenum(buildflagset_t* set) set->enum_os_flags = 0; set->enum_arch_flags = 0; set->enum_size_flags = 0; + set->enum_endian_flags = 0; size_t i = HASHMAP_BEGIN; flag_t* flag; @@ -360,6 +408,17 @@ bool buildflagset_next(buildflagset_t* set) set->enum_size_flags = 0; } + if(set->have_endian_flags) + { + // Overflow to the endian flags. + set->enum_endian_flags++; + + if(_endian_flags[set->enum_endian_flags] != NULL) + return true; + + set->enum_endian_flags = 0; + } + // Overflow to the remaining flags. size_t i = HASHMAP_BEGIN; flag_t* flag; @@ -405,6 +464,11 @@ bool buildflagset_get(buildflagset_t* set, const char* flag) if(index >= 0) // Size platform flag. return set->enum_size_flags == (uint32_t)index; + index = endian_index(flag); + + if(index >= 0) // Endian platform flag. + return set->enum_endian_flags == (uint32_t)index; + // Just a normal flag. flag_t f1 = {flag, false}; size_t h_index = HASHMAP_UNKNOWN; @@ -474,6 +538,9 @@ const char* buildflagset_print(buildflagset_t* set) if(set->have_size_flags) print_flag(_size_flags[set->enum_size_flags], true, set, &p); + if(set->have_endian_flags) + print_flag(_endian_flags[set->enum_endian_flags], true, set, &p); + // Next the normal flags, in any order. size_t i = HASHMAP_BEGIN; flag_t* flag; From b2d7443ed69f0dcbeb9d34a0c1d14f84a3475dd7 Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Fri, 9 Feb 2018 13:01:13 -0600 Subject: [PATCH 12/20] Review: semi-mechanically add endian items got Platform and genprim.c --- packages/builtin/platform.pony | 3 +++ src/libponyc/codegen/genprim.c | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/packages/builtin/platform.pony b/packages/builtin/platform.pony index 06144dcfeb..d7c9cd041c 100644 --- a/packages/builtin/platform.pony +++ b/packages/builtin/platform.pony @@ -14,5 +14,8 @@ primitive Platform fun llp64(): Bool => compile_intrinsic fun ilp32(): Bool => compile_intrinsic + fun bigendian(): Bool => compile_intrinsic + fun littleendian(): Bool => compile_intrinsic + fun native128(): Bool => compile_intrinsic fun debug(): Bool => compile_intrinsic diff --git a/src/libponyc/codegen/genprim.c b/src/libponyc/codegen/genprim.c index c94af9d23a..f84ff57e19 100644 --- a/src/libponyc/codegen/genprim.c +++ b/src/libponyc/codegen/genprim.c @@ -1274,6 +1274,28 @@ static void platform_ilp32(compile_t* c, reach_type_t* t, token_id cap) codegen_finishfun(c); } +static void platform_bigendian(compile_t* c, reach_type_t* t, token_id cap) +{ + FIND_METHOD("bigendian", cap); + start_function(c, t, m, c->i1, &c_t->use_type, 1); + + LLVMValueRef result = + LLVMConstInt(c->i1, target_is_bigendian(c->opt->triple), false); + LLVMBuildRet(c->builder, result); + codegen_finishfun(c); +} + +static void platform_littleendian(compile_t* c, reach_type_t* t, token_id cap) +{ + FIND_METHOD("littleendian", cap); + start_function(c, t, m, c->i1, &c_t->use_type, 1); + + LLVMValueRef result = + LLVMConstInt(c->i1, target_is_littleendian(c->opt->triple), false); + LLVMBuildRet(c->builder, result); + codegen_finishfun(c); +} + static void platform_native128(compile_t* c, reach_type_t* t, token_id cap) { FIND_METHOD("native128", cap); @@ -1307,6 +1329,8 @@ void genprim_platform_methods(compile_t* c, reach_type_t* t) BOX_FUNCTION(platform_lp64, t); BOX_FUNCTION(platform_llp64, t); BOX_FUNCTION(platform_ilp32, t); + BOX_FUNCTION(platform_bigendian, t); + BOX_FUNCTION(platform_littleendian, t); BOX_FUNCTION(platform_native128, t); BOX_FUNCTION(platform_debug, t); } From 7235c7b40123b5bc7087aaf74b495a17e7a88b2e Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Tue, 13 Feb 2018 20:33:01 -0600 Subject: [PATCH 13/20] Review: add missing ref cap to get/setsockopt functions in tcp_socket and udp_socket --- packages/net/tcp_connection.pony | 22 +++++++++++----------- packages/net/udp_socket.pony | 24 ++++++++++++------------ 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/packages/net/tcp_connection.pony b/packages/net/tcp_connection.pony index dfec34cea5..c1363c63a4 100644 --- a/packages/net/tcp_connection.pony +++ b/packages/net/tcp_connection.pony @@ -964,7 +964,7 @@ actor TCPConnection /**************************************/ - fun getsockopt(level: I32, option_name: I32, option: Array[U8]): (U32, U32) => + fun ref getsockopt(level: I32, option_name: I32, option: Array[U8]): (U32, U32) => """ General wrapper for TCP sockets to the `getsockopt(2)` system call. @@ -982,7 +982,7 @@ actor TCPConnection """ _OSSocket.getsockopt(_fd, level, option_name, option) - fun getsockopt_u32(level: I32, option_name: I32): (U32, U32) => + fun ref getsockopt_u32(level: I32, option_name: I32): (U32, U32) => """ Wrapper for TCP sockets to the `getsockopt(2)` system call where the kernel's returned option value is a C `uint32_t` type / Pony @@ -998,7 +998,7 @@ actor TCPConnection """ _OSSocket.getsockopt_u32(_fd, level, option_name) - fun setsockopt(level: I32, option_name: I32, option: Array[U8]): U32 => + fun ref setsockopt(level: I32, option_name: I32, option: Array[U8]): U32 => """ General wrapper for TCP sockets to the `setsockopt(2)` system call. @@ -1011,7 +1011,7 @@ actor TCPConnection """ _OSSocket.setsockopt(_fd, level, option_name, option) - fun setsockopt_u32(level: I32, option_name: I32, option: U32): U32 => + fun ref setsockopt_u32(level: I32, option_name: I32, option: U32): U32 => """ General wrapper for TCP sockets to the `setsockopt(2)` system call. @@ -1021,44 +1021,44 @@ actor TCPConnection _OSSocket.setsockopt_u32(_fd, level, option_name, option) - fun get_so_error(): (U32, U32) => + fun ref get_so_error(): (U32, U32) => """ Wrapper for the FFI call `getsockopt(fd, SOL_SOCKET, SO_ERROR, ...)` """ _OSSocket.get_so_error(_fd) - fun get_so_rcvbuf(): (U32, U32) => + fun ref get_so_rcvbuf(): (U32, U32) => """ Wrapper for the FFI call `getsockopt(fd, SOL_SOCKET, SO_RCVBUF, ...)` """ _OSSocket.get_so_rcvbuf(_fd) - fun get_so_sndbuf(): (U32, U32) => + fun ref get_so_sndbuf(): (U32, U32) => """ Wrapper for the FFI call `getsockopt(fd, SOL_SOCKET, SO_SNDBUF, ...)` """ _OSSocket.get_so_sndbuf(_fd) - fun get_tcp_nodelay(): (U32, U32) => + fun ref get_tcp_nodelay(): (U32, U32) => """ Wrapper for the FFI call `getsockopt(fd, SOL_SOCKET, TCP_NODELAY, ...)` """ _OSSocket.getsockopt_u32(_fd, OSSockOpt.sol_socket(), OSSockOpt.tcp_nodelay()) - fun set_so_rcvbuf(bufsize: U32): U32 => + fun ref set_so_rcvbuf(bufsize: U32): U32 => """ Wrapper for the FFI call `setsockopt(fd, SOL_SOCKET, SO_RCVBUF, ...)` """ _OSSocket.set_so_rcvbuf(_fd, bufsize) - fun set_so_sndbuf(bufsize: U32): U32 => + fun ref set_so_sndbuf(bufsize: U32): U32 => """ Wrapper for the FFI call `setsockopt(fd, SOL_SOCKET, SO_SNDBUF, ...)` """ _OSSocket.set_so_sndbuf(_fd, bufsize) - fun set_tcp_nodelay(state: Bool): U32 => + fun ref set_tcp_nodelay(state: Bool): U32 => """ Wrapper for the FFI call `setsockopt(fd, SOL_SOCKET, TCP_NODELAY, ...)` """ diff --git a/packages/net/udp_socket.pony b/packages/net/udp_socket.pony index 48bac2bce4..3f0bf6eef9 100644 --- a/packages/net/udp_socket.pony +++ b/packages/net/udp_socket.pony @@ -407,7 +407,7 @@ actor UDPSocket _fd = -1 end - fun getsockopt(level: I32, option_name: I32, option: Array[U8]): (U32, U32) => + fun ref getsockopt(level: I32, option_name: I32, option: Array[U8]): (U32, U32) => """ General wrapper for UDP sockets to the `getsockopt(2)` system call. @@ -425,7 +425,7 @@ actor UDPSocket """ _OSSocket.getsockopt(_fd, level, option_name, option) - fun getsockopt_u32(level: I32, option_name: I32): (U32, U32) => + fun ref getsockopt_u32(level: I32, option_name: I32): (U32, U32) => """ Wrapper for UDP sockets to the `getsockopt(2)` system call where the kernel's returned option value is a C `uint32_t` type / Pony @@ -441,7 +441,7 @@ actor UDPSocket """ _OSSocket.getsockopt_u32(_fd, level, option_name) - fun setsockopt(level: I32, option_name: I32, option: Array[U8]): U32 => + fun ref setsockopt(level: I32, option_name: I32, option: Array[U8]): U32 => """ General wrapper for UDP sockets to the `setsockopt(2)` system call. @@ -454,7 +454,7 @@ actor UDPSocket """ _OSSocket.setsockopt(_fd, level, option_name, option) - fun setsockopt_u32(level: I32, option_name: I32, option: U32): U32 => + fun ref setsockopt_u32(level: I32, option_name: I32, option: U32): U32 => """ Wrapper for UDP sockets to the `setsockopt(2)` system call where the kernel expects an option value of a C `uint32_t` type / Pony @@ -466,26 +466,26 @@ actor UDPSocket _OSSocket.setsockopt_u32(_fd, level, option_name, option) - fun get_so_error(): (U32, U32) => + fun ref get_so_error(): (U32, U32) => """ Wrapper for the FFI call `getsockopt(fd, SOL_SOCKET, SO_ERROR, ...)` """ _OSSocket.get_so_error(_fd) - fun get_so_rcvbuf(): (U32, U32) => + fun ref get_so_rcvbuf(): (U32, U32) => """ Wrapper for the FFI call `getsockopt(fd, SOL_SOCKET, SO_RCVBUF, ...)` """ _OSSocket.get_so_rcvbuf(_fd) - fun get_so_sndbuf(): (U32, U32) => + fun ref get_so_sndbuf(): (U32, U32) => """ Wrapper for the FFI call `getsockopt(fd, SOL_SOCKET, SO_SNDBUF, ...)` """ _OSSocket.get_so_sndbuf(_fd) - fun set_ip_multicast_loop(loopback: Bool): U32 => + fun ref set_ip_multicast_loop(loopback: Bool): U32 => """ Wrapper for the FFI call `setsockopt(fd, SOL_SOCKET, IP_MULTICAST_LOOP, ...)` """ @@ -493,14 +493,14 @@ actor UDPSocket _OSSocket.u32_to_bytes4(if loopback then 1 else 0 end) _OSSocket.setsockopt(_fd, OSSockOpt.sol_socket(), OSSockOpt.ip_multicast_loop(), word) - fun set_ip_multicast_ttl(ttl: U8): U32 => + fun ref set_ip_multicast_ttl(ttl: U8): U32 => """ Wrapper for the FFI call `setsockopt(fd, SOL_SOCKET, IP_MULTICAST_TTL, ...)` """ var word: Array[U8] ref = _OSSocket.u32_to_bytes4(ttl.u32()) _OSSocket.setsockopt(_fd, OSSockOpt.sol_socket(), OSSockOpt.ip_multicast_ttl(), word) - fun set_so_broadcast(state: Bool): U32 => + fun ref set_so_broadcast(state: Bool): U32 => """ Wrapper for the FFI call `setsockopt(fd, SOL_SOCKET, SO_BROADCAST, ...)` """ @@ -508,13 +508,13 @@ actor UDPSocket _OSSocket.u32_to_bytes4(if state then 1 else 0 end) _OSSocket.setsockopt(_fd, OSSockOpt.sol_socket(), OSSockOpt.so_broadcast(), word) - fun set_so_rcvbuf(bufsize: U32): U32 => + fun ref set_so_rcvbuf(bufsize: U32): U32 => """ Wrapper for the FFI call `setsockopt(fd, SOL_SOCKET, SO_RCVBUF, ...)` """ _OSSocket.set_so_rcvbuf(_fd, bufsize) - fun set_so_sndbuf(bufsize: U32): U32 => + fun ref set_so_sndbuf(bufsize: U32): U32 => """ Wrapper for the FFI call `setsockopt(fd, SOL_SOCKET, SO_SNDBUF, ...)` """ From a0110c94d931e6d3b738c7fefb40fbea82afca9c Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Wed, 28 Feb 2018 16:34:30 -0600 Subject: [PATCH 14/20] Add usage examples for TCP & UDP get/setsockopt functions [skip ci] --- packages/net/tcp_connection.pony | 46 +++++++++++++++++++++++++++++++- packages/net/udp_socket.pony | 42 +++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 1 deletion(-) diff --git a/packages/net/tcp_connection.pony b/packages/net/tcp_connection.pony index c1363c63a4..d101a2504b 100644 --- a/packages/net/tcp_connection.pony +++ b/packages/net/tcp_connection.pony @@ -979,6 +979,28 @@ actor TCPConnection In case of system call failure, this function returns the 2-tuple: 1. The value of `errno`. 2. An undefined value that must be ignored. + + Usage example: + + ```pony + // connected() is a callback function for class TCPConnectionNotify + fun ref connected(conn: TCPConnection ref) => + var gbytes: Array[U8] ref = Array[U8].create().>undefined(4) + + match conn.getsockopt(OSSockOpt.sol_socket(), OSSockOpt.so_rcfbuf(), gbytes) + | (0, let length1: U32) => + try + let gbytes': Array[U8] iso = recover Array[U8].create().>reserve(length1.usize()) end + for v in gbytes.values() do + gbytes'.push(v) + end + let br = Reader.create().>append(consume gbytes') + let buffer_size: U32 = br.u32_le()? + end + | (let errno: U32, _) => + // System call failed + end + ``` """ _OSSocket.getsockopt(_fd, level, option_name, option) @@ -1008,12 +1030,34 @@ actor TCPConnection This function returns `0` on success, else the value of `errno` on failure. + + Usage example: + + ```pony + // connected() is a callback function for class TCPConnectionNotify + fun ref connected(conn: TCPConnection ref) => + let sb = Writer + + sb.u32_le(7744) // Our desired socket buffer size + let sbytes = Array[U8] + for bs in sb.done().values() do + sbytes.append(bs) + end + match conn.setsockopt(OSSockOpt.sol_socket(), OSSockOpt.so_rcvbuf(), sbytes) + | 0 => + // System call was successful + | let errno: U32 => + // System call failed + end + ``` """ _OSSocket.setsockopt(_fd, level, option_name, option) fun ref setsockopt_u32(level: I32, option_name: I32, option: U32): U32 => """ - General wrapper for TCP sockets to the `setsockopt(2)` system call. + General wrapper for TCP sockets to the `setsockopt(2)` system call where + the kernel expects an option value of a C `uint32_t` type / Pony + type `U32`. This function returns `0` on success, else the value of `errno` on failure. diff --git a/packages/net/udp_socket.pony b/packages/net/udp_socket.pony index 3f0bf6eef9..00cb1e62a5 100644 --- a/packages/net/udp_socket.pony +++ b/packages/net/udp_socket.pony @@ -422,6 +422,28 @@ actor UDPSocket In case of system call failure, this function returns the 2-tuple: 1. The value of `errno`. 2. An undefined value that must be ignored. + + Usage example: + + ```pony + // listening() is a callback function for class UDPNotify + fun ref listening(sock: UDPSocket ref) => + var gbytes: Array[U8] ref = Array[U8].create().>undefined(4) + + match sock.getsockopt(OSSockOpt.sol_socket(), OSSockOpt.so_rcfbuf(), gbytes) + | (0, let length1: U32) => + try + let gbytes': Array[U8] iso = recover Array[U8].create().>reserve(length1.usize()) end + for v in gbytes.values() do + gbytes'.push(v) + end + let br = Reader.create().>append(consume gbytes') + let buffer_size: U32 = br.u32_le()? + end + | (let errno: U32, _) => + // System call failed + end + ``` """ _OSSocket.getsockopt(_fd, level, option_name, option) @@ -451,6 +473,26 @@ actor UDPSocket This function returns `0` on success, else the value of `errno` on failure. + + Usage example: + + ```pony + // listening() is a callback function for class UDPNotify + fun ref listening(sock: UDPSocket ref) => + let sb = Writer + + sb.u32_le(7744) // Our desired socket buffer size + let sbytes = Array[U8] + for bs in sb.done().values() do + sbytes.append(bs) + end + match sock.setsockopt(OSSockOpt.sol_socket(), OSSockOpt.so_rcvbuf(), sbytes) + | 0 => + // System call was successful + | let errno: U32 => + // System call failed + end + ``` """ _OSSocket.setsockopt(_fd, level, option_name, option) From c8f3675ffc6f44bf8c21b7b1b8254492d14a3d10 Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Wed, 28 Feb 2018 16:52:28 -0600 Subject: [PATCH 15/20] Expand & fix get/setsockopt docstrings --- packages/net/tcp_connection.pony | 8 ++++++-- packages/net/udp_socket.pony | 12 ++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/net/tcp_connection.pony b/packages/net/tcp_connection.pony index d101a2504b..f5afdd8334 100644 --- a/packages/net/tcp_connection.pony +++ b/packages/net/tcp_connection.pony @@ -968,6 +968,10 @@ actor TCPConnection """ General wrapper for TCP sockets to the `getsockopt(2)` system call. + The caller must provide an array that is pre-allocated to be + at least as large as the largest data structure that the kernel + may return for the requested option. + In case of system call success, this function returns the 2-tuple: 1. The integer `0`. 2. The value of the `*(uint32_t)option_length` argument set by @@ -991,8 +995,8 @@ actor TCPConnection | (0, let length1: U32) => try let gbytes': Array[U8] iso = recover Array[U8].create().>reserve(length1.usize()) end - for v in gbytes.values() do - gbytes'.push(v) + for i in Range[USize](0, length1.usize()) do + gbytes'.push(gbytes(i)?) end let br = Reader.create().>append(consume gbytes') let buffer_size: U32 = br.u32_le()? diff --git a/packages/net/udp_socket.pony b/packages/net/udp_socket.pony index 00cb1e62a5..4976660606 100644 --- a/packages/net/udp_socket.pony +++ b/packages/net/udp_socket.pony @@ -411,6 +411,10 @@ actor UDPSocket """ General wrapper for UDP sockets to the `getsockopt(2)` system call. + The caller must provide an array that is pre-allocated to be + at least as large as the largest data structure that the kernel + may return for the requested option. + In case of system call success, this function returns the 2-tuple: 1. The integer `0`. 2. The value of the `*(uint32_t)option_length` argument set by @@ -431,11 +435,11 @@ actor UDPSocket var gbytes: Array[U8] ref = Array[U8].create().>undefined(4) match sock.getsockopt(OSSockOpt.sol_socket(), OSSockOpt.so_rcfbuf(), gbytes) - | (0, let length1: U32) => + | (0, let length: U32) => try - let gbytes': Array[U8] iso = recover Array[U8].create().>reserve(length1.usize()) end - for v in gbytes.values() do - gbytes'.push(v) + let gbytes': Array[U8] iso = recover Array[U8].create().>reserve(length.usize()) end + for i in Range[USize](0, length1.usize()) do + gbytes'.push(gbytes(i)?) end let br = Reader.create().>append(consume gbytes') let buffer_size: U32 = br.u32_le()? From 95bb8cb589a9273778a3a7bef39f12ed8e45349f Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Wed, 28 Feb 2018 17:30:07 -0600 Subject: [PATCH 16/20] Fix get/setsockopt docstrings --- packages/net/tcp_connection.pony | 6 +++--- packages/net/udp_socket.pony | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/net/tcp_connection.pony b/packages/net/tcp_connection.pony index f5afdd8334..ceedb02ce1 100644 --- a/packages/net/tcp_connection.pony +++ b/packages/net/tcp_connection.pony @@ -992,10 +992,10 @@ actor TCPConnection var gbytes: Array[U8] ref = Array[U8].create().>undefined(4) match conn.getsockopt(OSSockOpt.sol_socket(), OSSockOpt.so_rcfbuf(), gbytes) - | (0, let length1: U32) => + | (0, let length: U32) => try - let gbytes': Array[U8] iso = recover Array[U8].create().>reserve(length1.usize()) end - for i in Range[USize](0, length1.usize()) do + let gbytes': Array[U8] iso = recover Array[U8].create().>reserve(length.usize()) end + for i in Range[USize](0, length.usize()) do gbytes'.push(gbytes(i)?) end let br = Reader.create().>append(consume gbytes') diff --git a/packages/net/udp_socket.pony b/packages/net/udp_socket.pony index 4976660606..2334fda9e7 100644 --- a/packages/net/udp_socket.pony +++ b/packages/net/udp_socket.pony @@ -438,7 +438,7 @@ actor UDPSocket | (0, let length: U32) => try let gbytes': Array[U8] iso = recover Array[U8].create().>reserve(length.usize()) end - for i in Range[USize](0, length1.usize()) do + for i in Range[USize](0, length.usize()) do gbytes'.push(gbytes(i)?) end let br = Reader.create().>append(consume gbytes') From aa2c4ad2171176a166b1eb764379fc6d87f49178 Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Thu, 1 Mar 2018 10:28:02 -0600 Subject: [PATCH 17/20] Fix get/setsockopt docstrings --- packages/net/tcp_connection.pony | 2 +- packages/net/udp_socket.pony | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/net/tcp_connection.pony b/packages/net/tcp_connection.pony index ceedb02ce1..7903810f47 100644 --- a/packages/net/tcp_connection.pony +++ b/packages/net/tcp_connection.pony @@ -991,7 +991,7 @@ actor TCPConnection fun ref connected(conn: TCPConnection ref) => var gbytes: Array[U8] ref = Array[U8].create().>undefined(4) - match conn.getsockopt(OSSockOpt.sol_socket(), OSSockOpt.so_rcfbuf(), gbytes) + match conn.getsockopt(OSSockOpt.sol_socket(), OSSockOpt.so_rcvbuf(), gbytes) | (0, let length: U32) => try let gbytes': Array[U8] iso = recover Array[U8].create().>reserve(length.usize()) end diff --git a/packages/net/udp_socket.pony b/packages/net/udp_socket.pony index 2334fda9e7..3e2a7a336a 100644 --- a/packages/net/udp_socket.pony +++ b/packages/net/udp_socket.pony @@ -434,7 +434,7 @@ actor UDPSocket fun ref listening(sock: UDPSocket ref) => var gbytes: Array[U8] ref = Array[U8].create().>undefined(4) - match sock.getsockopt(OSSockOpt.sol_socket(), OSSockOpt.so_rcfbuf(), gbytes) + match sock.getsockopt(OSSockOpt.sol_socket(), OSSockOpt.so_rcvbuf(), gbytes) | (0, let length: U32) => try let gbytes': Array[U8] iso = recover Array[U8].create().>reserve(length.usize()) end From 219d4c79fc65c5bd95ea499fb088929efdae93ec Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Fri, 2 Mar 2018 14:20:02 -0600 Subject: [PATCH 18/20] Remove the api_deprecated() function introduced earlier in this PR --- src/libponyrt/lang/socket.c | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/src/libponyrt/lang/socket.c b/src/libponyrt/lang/socket.c index ddfb3d3c6a..d15ab279b5 100644 --- a/src/libponyrt/lang/socket.c +++ b/src/libponyrt/lang/socket.c @@ -89,22 +89,6 @@ typedef struct struct sockaddr_storage addr; } ipaddress_t; -static void api_deprecated(char *oldfunc, char *newfunc) -{ -#ifdef TBD_PENDING_FEATURE - static int count = 0; - - if (count++ == 0) - { - printf(stderr, "Use of %s is deprecated, please use %s instead\n", - oldfunc, newfunc); - sleep(1); - } -#endif - (void)oldfunc; // Hush compiler warnings - (void)newfunc; // Hush compiler warnings -} - static socklen_t address_length(ipaddress_t* ipaddr) { switch(ipaddr->addr.ss_family) @@ -784,13 +768,12 @@ PONY_API int pony_os_accept(asio_event_t* ev) } // Check this when a connection gets its first writeable event. +// API deprecated: use TCPConnection._is_sock_connected or UDPSocket.get_so_error PONY_API bool pony_os_connected(int fd) { int val = 0; socklen_t len = sizeof(int); - api_deprecated("@pony_os_connected", - "TCPConnection._is_sock_connected or OSSocket.get_so_error"); if(getsockopt((SOCKET)fd, SOL_SOCKET, SO_ERROR, (char*)&val, &len) == -1) return false; @@ -1108,11 +1091,11 @@ PONY_API void pony_os_keepalive(int fd, int secs) #endif } +// API deprecated: use TCPConnection.set_tcp_nodelay PONY_API void pony_os_nodelay(int fd, bool state) { int val = state; - api_deprecated("pony_os_nodelay", "TCPConnection.set_tcp_nodelay"); setsockopt((SOCKET)fd, IPPROTO_TCP, TCP_NODELAY, (const char*)&val, sizeof(int)); } @@ -1208,11 +1191,11 @@ void ponyint_os_sockets_final() #endif } +// API deprecated: use UDPSocket.set_so_broadcast PONY_API void pony_os_broadcast(int fd, bool state) { int broadcast = state ? 1 : 0; - api_deprecated("pony_os_broadcast", "UDPSocket.set_so_broadcast"); setsockopt((SOCKET)fd, SOL_SOCKET, SO_BROADCAST, (const char*)&broadcast, sizeof(broadcast)); } @@ -1230,18 +1213,18 @@ PONY_API void pony_os_multicast_interface(int fd, const char* from) } } +// API deprecated: use UDPSocket.set_ip_multicast_loop PONY_API void pony_os_multicast_loopback(int fd, bool loopback) { uint8_t loop = loopback ? 1 : 0; - api_deprecated("pony_os_multicast_loopback", "OSSocket.set_ip_multicast_loop"); setsockopt((SOCKET)fd, IPPROTO_IP, IP_MULTICAST_LOOP, (const char*)&loop, sizeof(loop)); } +// API deprecated: use UDPSocket.set_ip_multicast_ttl PONY_API void pony_os_multicast_ttl(int fd, uint8_t ttl) { - api_deprecated("pony_os_multicast_loopttl", "OSSocket.set_ip_multicast_ttl"); setsockopt((SOCKET)fd, IPPROTO_IP, IP_MULTICAST_TTL, (const char*)&ttl, sizeof(ttl)); } From 3602a9fe664d99e044dfc37b90249c2fc6de2773 Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Fri, 2 Mar 2018 15:11:19 -0600 Subject: [PATCH 19/20] Change interface of getsockopt() per Dipin's suggestion --- packages/net/ossocket.pony | 39 ++++++++++++++++++-------------- packages/net/tcp_connection.pony | 29 +++++++++++------------- packages/net/udp_socket.pony | 28 ++++++++++------------- 3 files changed, 47 insertions(+), 49 deletions(-) diff --git a/packages/net/ossocket.pony b/packages/net/ossocket.pony index 5a345ba267..dc4917ec55 100644 --- a/packages/net/ossocket.pony +++ b/packages/net/ossocket.pony @@ -36,26 +36,29 @@ primitive _OSSocket setsockopt_u32(fd, OSSockOpt.sol_socket(), OSSockOpt.so_sndbuf(), bufsize) - fun getsockopt(fd: U32, level: I32, option_name: I32, option: Array[U8]): (U32, U32) => + fun getsockopt(fd: U32, level: I32, option_name: I32, option_max_size: USize): (U32, Array[U8] iso^) => """ General wrapper for sockets to the `getsockopt(2)` system call. + The `option_max_size` argument is the maximum number of bytes that + the caller expects the kernel to return via the system call's + `void *` 4th argument. This function will allocate a Pony + `Array[U8]` array of size `option_max_size` prior to calling + `getsockopt(2)`. + In case of system call success, this function returns the 2-tuple: 1. The integer `0`. - 2. The value of the `*(uint32_t)option_length` argument set by - `getsockopt(2)`. The caller must use this length to properly - interpret the bytes written by the kernel into the `option` - byte array: this length may be smaller than `option`'s - original size. + 2. An `Array[U8]` of data returned by the system call's `void *` + 4th argument. Its size is specified by the kernel via the + system call's `sockopt_len_t *` 5th argument. In case of system call failure, this function returns the 2-tuple: 1. The value of `errno`. 2. An undefined value that must be ignored. """ - get_so(fd, level, option_name, option) + get_so(fd, level, option_name, option_max_size) fun getsockopt_u32(fd: U32, level: I32, option_name: I32): (U32, U32) => - var word: Array[U8] ref = [0;0;0;0] """ Wrapper for sockets to the `getsockopt(2)` system call where the kernel's returned option value is a C `uint32_t` type / Pony @@ -69,11 +72,12 @@ primitive _OSSocket 1. The value of `errno`. 2. An undefined value that must be ignored. """ - (let errno: U32, _) = get_so(fd, level, option_name, word) + (let errno: U32, let buffer: Array[U8] iso) = + get_so(fd, level, option_name, 4) if errno == 0 then try - (errno, bytes4_to_u32(word)?) + (errno, bytes4_to_u32(consume buffer)?) else (1, 0) end @@ -106,27 +110,28 @@ primitive _OSSocket var word: Array[U8] ref = u32_to_bytes4(option) set_so(fd, level, option_name, word) - fun get_so(fd: U32, level: I32, option_name: I32, option: Array[U8]): (U32, U32) => + fun get_so(fd: U32, level: I32, option_name: I32, option_max_size: USize): (U32, Array[U8] iso^) => """ Low-level interface to `getsockopt(2)` via `@pony_os_getsockopt[U32]()`. In case of system call success, this function returns the 2-tuple: 1. The integer `0`. - 2. The value of the `*(uint32_t)option_length` argument set by - `getsockopt(2)`. + 2. An `Array[U8]` of data returned by the system call's `void *` + 4th argument. Its size is specified by the kernel via the + system call's `sockopt_len_t *` 5th argument. In case of system call failure, `errno` is returned in the first element of the 2-tuple, and the second element's value is junk. """ - var option_size: U32 = option.size().u32() + var option: Array[U8] iso = recover option.create().>undefined(option_max_size) end + var option_size: USize = option_max_size let result: U32 = @pony_os_getsockopt[U32](fd, level, option_name, option.cpointer(), addressof option_size) if result == 0 then - (result, option_size) - else - (result, U32(0)) + option.truncate(option_size) end + (result, consume option) fun set_so(fd: U32, level: I32, option_name: I32, option: Array[U8]): U32 => var option_size: U32 = option.size().u32() diff --git a/packages/net/tcp_connection.pony b/packages/net/tcp_connection.pony index 7903810f47..980e22d465 100644 --- a/packages/net/tcp_connection.pony +++ b/packages/net/tcp_connection.pony @@ -964,7 +964,8 @@ actor TCPConnection /**************************************/ - fun ref getsockopt(level: I32, option_name: I32, option: Array[U8]): (U32, U32) => + fun ref getsockopt(level: I32, option_name: I32, option_max_size: USize): + (U32, Array[U8] iso^) => """ General wrapper for TCP sockets to the `getsockopt(2)` system call. @@ -974,11 +975,9 @@ actor TCPConnection In case of system call success, this function returns the 2-tuple: 1. The integer `0`. - 2. The value of the `*(uint32_t)option_length` argument set by - `getsockopt(2)`. The caller must use this length to properly - interpret the bytes written by the kernel into the `option` - byte array: this length may be smaller than `option`'s - original size. + 2. An `Array[U8]` of data returned by the system call's `void *` + 4th argument. Its size is specified by the kernel via the + system call's `sockopt_len_t *` 5th argument. In case of system call failure, this function returns the 2-tuple: 1. The value of `errno`. @@ -989,24 +988,22 @@ actor TCPConnection ```pony // connected() is a callback function for class TCPConnectionNotify fun ref connected(conn: TCPConnection ref) => - var gbytes: Array[U8] ref = Array[U8].create().>undefined(4) - - match conn.getsockopt(OSSockOpt.sol_socket(), OSSockOpt.so_rcvbuf(), gbytes) - | (0, let length: U32) => + match conn.getsockopt(OSSockOpt.sol_socket(), OSSockOpt.so_rcvbuf(), 4) + | (0, let gbytes: Array[U8] iso) => try - let gbytes': Array[U8] iso = recover Array[U8].create().>reserve(length.usize()) end - for i in Range[USize](0, length.usize()) do - gbytes'.push(gbytes(i)?) + let br = Reader.create().>append(consume gbytes) + ifdef littleendian then + let buffer_size = br.u32_le()? + else + let buffer_size = br.u32_be()? end - let br = Reader.create().>append(consume gbytes') - let buffer_size: U32 = br.u32_le()? end | (let errno: U32, _) => // System call failed end ``` """ - _OSSocket.getsockopt(_fd, level, option_name, option) + _OSSocket.getsockopt(_fd, level, option_name, option_max_size) fun ref getsockopt_u32(level: I32, option_name: I32): (U32, U32) => """ diff --git a/packages/net/udp_socket.pony b/packages/net/udp_socket.pony index 3e2a7a336a..e8c108b08e 100644 --- a/packages/net/udp_socket.pony +++ b/packages/net/udp_socket.pony @@ -407,7 +407,7 @@ actor UDPSocket _fd = -1 end - fun ref getsockopt(level: I32, option_name: I32, option: Array[U8]): (U32, U32) => + fun ref getsockopt(level: I32, option_name: I32, option_max_size: USize): (U32, Array[U8] iso^) => """ General wrapper for UDP sockets to the `getsockopt(2)` system call. @@ -417,11 +417,9 @@ actor UDPSocket In case of system call success, this function returns the 2-tuple: 1. The integer `0`. - 2. The value of the `*(uint32_t)option_length` argument set by - `getsockopt(2)`. The caller must use this length to properly - interpret the bytes written by the kernel into the `option` - byte array: this length may be smaller than `option`'s - original size. + 2. An `Array[U8]` of data returned by the system call's `void *` + 4th argument. Its size is specified by the kernel via the + system call's `sockopt_len_t *` 5th argument. In case of system call failure, this function returns the 2-tuple: 1. The value of `errno`. @@ -432,24 +430,22 @@ actor UDPSocket ```pony // listening() is a callback function for class UDPNotify fun ref listening(sock: UDPSocket ref) => - var gbytes: Array[U8] ref = Array[U8].create().>undefined(4) - - match sock.getsockopt(OSSockOpt.sol_socket(), OSSockOpt.so_rcvbuf(), gbytes) - | (0, let length: U32) => + match sock.getsockopt(OSSockOpt.sol_socket(), OSSockOpt.so_rcvbuf(), 4) + | (0, let gbytes: Array[U8] iso) => try - let gbytes': Array[U8] iso = recover Array[U8].create().>reserve(length.usize()) end - for i in Range[USize](0, length.usize()) do - gbytes'.push(gbytes(i)?) + let br = Reader.create().>append(consume gbytes) + ifdef littleendian then + let buffer_size = br.u32_le()? + else + let buffer_size = br.u32_be()? end - let br = Reader.create().>append(consume gbytes') - let buffer_size: U32 = br.u32_le()? end | (let errno: U32, _) => // System call failed end ``` """ - _OSSocket.getsockopt(_fd, level, option_name, option) + _OSSocket.getsockopt(_fd, level, option_name, option_max_size) fun ref getsockopt_u32(level: I32, option_name: I32): (U32, U32) => """ From 8b807e57cdf2bf1914f5e86fc8e2edc36d7352f7 Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Mon, 5 Mar 2018 22:30:14 -0600 Subject: [PATCH 20/20] Last review cleanup items, thanks Dipin --- packages/net/ossocket.pony | 22 ++++++++++++++++------ packages/net/tcp_connection.pony | 2 +- packages/net/udp_socket.pony | 2 +- src/libponyrt/lang/socket.c | 25 ------------------------- 4 files changed, 18 insertions(+), 33 deletions(-) diff --git a/packages/net/ossocket.pony b/packages/net/ossocket.pony index dc4917ec55..47eef0c0f1 100644 --- a/packages/net/ossocket.pony +++ b/packages/net/ossocket.pony @@ -1,3 +1,4 @@ +use @pony_os_errno[I32]() primitive _OSSocket """ @@ -36,7 +37,7 @@ primitive _OSSocket setsockopt_u32(fd, OSSockOpt.sol_socket(), OSSockOpt.so_sndbuf(), bufsize) - fun getsockopt(fd: U32, level: I32, option_name: I32, option_max_size: USize): (U32, Array[U8] iso^) => + fun getsockopt(fd: U32, level: I32, option_name: I32, option_max_size: USize = 4): (U32, Array[U8] iso^) => """ General wrapper for sockets to the `getsockopt(2)` system call. @@ -112,7 +113,7 @@ primitive _OSSocket fun get_so(fd: U32, level: I32, option_name: I32, option_max_size: USize): (U32, Array[U8] iso^) => """ - Low-level interface to `getsockopt(2)` via `@pony_os_getsockopt[U32]()`. + Low-level interface to `getsockopt(2)`. In case of system call success, this function returns the 2-tuple: 1. The integer `0`. @@ -125,25 +126,34 @@ primitive _OSSocket """ var option: Array[U8] iso = recover option.create().>undefined(option_max_size) end var option_size: USize = option_max_size - let result: U32 = @pony_os_getsockopt[U32](fd, level, option_name, + let result: I32 = @getsockopt[I32](fd, level, option_name, option.cpointer(), addressof option_size) if result == 0 then option.truncate(option_size) + (0, consume option) + else + option.truncate(0) + (@pony_os_errno().u32(), consume option) end - (result, consume option) fun set_so(fd: U32, level: I32, option_name: I32, option: Array[U8]): U32 => var option_size: U32 = option.size().u32() """ - Low-level interface to `setsockopt(2)` via `@pony_os_setsockopt[U32]()`. + Low-level interface to `setsockopt(2)`. This function returns `0` on success, else the value of `errno` on failure. """ - @pony_os_setsockopt[U32](fd, level, option_name, + let result: I32 = @setsockopt[I32](fd, level, option_name, option.cpointer(), option_size) + if result == 0 then + 0 + else + @pony_os_errno().u32() + end + fun bytes4_to_u32(b: Array[U8]): U32 ? => ifdef littleendian then (b(3)?.u32() << 24) or (b(2)?.u32() << 16) or (b(1)?.u32() << 8) or b(0)?.u32() diff --git a/packages/net/tcp_connection.pony b/packages/net/tcp_connection.pony index 980e22d465..9fc7deda57 100644 --- a/packages/net/tcp_connection.pony +++ b/packages/net/tcp_connection.pony @@ -964,7 +964,7 @@ actor TCPConnection /**************************************/ - fun ref getsockopt(level: I32, option_name: I32, option_max_size: USize): + fun ref getsockopt(level: I32, option_name: I32, option_max_size: USize = 4): (U32, Array[U8] iso^) => """ General wrapper for TCP sockets to the `getsockopt(2)` system call. diff --git a/packages/net/udp_socket.pony b/packages/net/udp_socket.pony index e8c108b08e..da29bb26ee 100644 --- a/packages/net/udp_socket.pony +++ b/packages/net/udp_socket.pony @@ -407,7 +407,7 @@ actor UDPSocket _fd = -1 end - fun ref getsockopt(level: I32, option_name: I32, option_max_size: USize): (U32, Array[U8] iso^) => + fun ref getsockopt(level: I32, option_name: I32, option_max_size: USize = 4): (U32, Array[U8] iso^) => """ General wrapper for UDP sockets to the `getsockopt(2)` system call. diff --git a/src/libponyrt/lang/socket.c b/src/libponyrt/lang/socket.c index d15ab279b5..be661d5c9f 100644 --- a/src/libponyrt/lang/socket.c +++ b/src/libponyrt/lang/socket.c @@ -27,7 +27,6 @@ #include #include #include -#include typedef int SOCKET; #endif @@ -1329,30 +1328,6 @@ PONY_API void pony_os_multicast_leave(int fd, const char* group, const char* to) multicast_change(fd, group, to, false); } -#ifdef PLATFORM_IS_WINDOWS -PONY_API int pony_os_getsockopt(int fd, int level, int option_name, char *option_value, int *option_len) -#else -PONY_API int pony_os_getsockopt(int fd, int level, int option_name, void *option_value, socklen_t *option_len) -#endif -{ - if (getsockopt(fd, level, option_name, option_value, option_len) == 0) - return 0; - else - return errno; -} - -#ifdef PLATFORM_IS_WINDOWS -PONY_API int pony_os_setsockopt(int fd, int level, int option_name, const char *option_value, socklen_t option_len) -#else -PONY_API int pony_os_setsockopt(int fd, int level, int option_name, void *option_value, socklen_t option_len) -#endif -{ - if (setsockopt(fd, level, option_name, option_value, option_len) == 0) - return 0; - else - return errno; -} - /* Constants are from * macOS Sierra 10.12.6 * Ubuntu Linux Xenial/16.04 LTS + kernel 4.4.0-109-generic