mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-01-15 05:41:16 +01:00
It's regularly needed to call getsockopt() on a connection, but each time the calling code has to do all the job by itself. This commit adds a "get_opt()" callback on the protocol struct, that directly calls getsockopt() on the connection's FD. A generic implementation for standard sockets is provided, though QUIC would likely require a different approach, or maybe a mapping. Due to the overlap between IP/TCP/socket option values, it is necessary for the caller to indicate both the level and the option. An abstraction of the level could be done, but the caller would nonetheless have to know the optname, which is generally defined in the same include files. So for now we'll consider that this callback is only for very specific use. The levels and optnames are purposely passed as signed ints so that it is possible to further extend the API by using negative levels for internal namespaces.