Currently the only protocols supported in SockProtocol are Tcp and Udp (for linux), while there are many more.
For example, I'm working with raw sockets and I need to specify a special ETH_P_ALL protocol (man 7 packet), and there is one important thing about it: its number has to be presented in network byte order when passed to the system socket call.
Currently the SockProtocol enum simply provides i32 constants, so I can't put htons conversion there since there is no const fn call for that.
There is also no way to provide an arbitrary integer as a protocol number to the nix's socket call, hence I'm left with no options.
So I would say it would be great to have an option to pass the protocol number as a number (i32 or whatever) to the socket call, but it might be there are other ways to address the issue.
Currently the only protocols supported in
SockProtocolareTcpandUdp(for linux), while there are many more.For example, I'm working with raw sockets and I need to specify a special
ETH_P_ALLprotocol (man 7 packet), and there is one important thing about it: its number has to be presented in network byte order when passed to the systemsocketcall.Currently the
SockProtocolenum simply providesi32constants, so I can't puthtonsconversion there since there is noconst fncall for that.There is also no way to provide an arbitrary integer as a protocol number to the nix's
socketcall, hence I'm left with no options.So I would say it would be great to have an option to pass the protocol number as a number (
i32or whatever) to thesocketcall, but it might be there are other ways to address the issue.