Commit e0415a08 authored by Pekka Pessi's avatar Pekka Pessi

Added su_getsocktype().

darcs-hash:20060504193836-65a35-c2e214d4a95069a395db6806158b14dec78ecfe6.gz
parent 10297e4d
......@@ -293,6 +293,9 @@ SOFIAPUBFUN int su_setblocking(su_socket_t s, int blocking);
SOFIAPUBFUN int su_setreuseaddr(su_socket_t s, int reuse);
/** Get the error code associated with the socket. */
SOFIAPUBFUN int su_soerror(su_socket_t s);
/** Get the socket type. */
SOFIAPUBFUN int su_getsocktype(su_socket_t s);
/** Get size of message available in socket. */
SOFIAPUBFUN issize_t su_getmsgsize(su_socket_t s);
......
......@@ -337,6 +337,17 @@ int su_soerror(su_socket_t s)
return error;
}
int su_getsocktype(su_socket_t s)
{
int socktype = 0;
socklen_t intlen = sizeof(socktype);
if (getsockopt(s, SOL_SOCKET, SO_TYPE, (void *)&socktype, &intlen) < 0)
return -1;
return socktype;
}
int su_setreuseaddr(su_socket_t s, int reuse)
{
return setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment