[erlang-questions] How to add a option for inet:getopts

Per Hedeland per@REDACTED
Fri Jan 19 13:31:55 CET 2007

"Kenneth Lundin" <kenneth.lundin@REDACTED> wrote:
>We have preliminary planned to implement a new option called "raw" as
>an  extension to the
>and all other places where socket options are handled.
>The new "raw" option would look something like this:

That's nice...

>Both OptionCode and OptionValue is positive integers assumed to be mapped on
>UINT32 in C. Thus the use is limited to OptionValues that fits in an UINT32.

... but unfortunately the example here, SO_ORIGINAL_DST, returns a
'struct sockaddr_in', so it wouldn't help in this case. Maybe you could
have the value be a binary instead? (With the Erlang user being
responsible for packing/unpacking it the same as a C compiler on a given
host architecture would.) In that case getopts/2 would need a size too,
maybe just always have that included in the "name tuple".

--Per Hedeland

More information about the erlang-questions mailing list