diff --git a/lib/isc/include/isc/socket.h b/lib/isc/include/isc/socket.h index 482390df33..d854f7c4ab 100644 --- a/lib/isc/include/isc/socket.h +++ b/lib/isc/include/isc/socket.h @@ -121,8 +121,8 @@ typedef struct isc_socket_connev { #define ISC_SOCKEVENT_INTR (ISC_EVENTCLASS_SOCKET + 261) typedef enum { - isc_socket_udp, - isc_socket_tcp + isc_socket_udp = 1, + isc_socket_tcp = 2 } isc_sockettype_t; /* @@ -597,6 +597,16 @@ isc_socketmgr_destroy(isc_socketmgr_t **managerp); * All resources used by the manager have been freed. */ +isc_sockettype_t +isc_socket_gettype(isc_socket_t *sock); +/* + * Returns the socket type for "sock." + * + * Requires: + * + * "sock" is a valid socket. + */ + ISC_LANG_ENDDECLS #endif /* ISC_SOCKET_H */ diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index 8f1ed174bf..3c26e504e3 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -2823,3 +2823,11 @@ isc_socket_sendmark(isc_socket_t *sock, return (ISC_R_SUCCESS); } + +isc_sockettype_t +isc_socket_gettype(isc_socket_t *sock) +{ + REQUIRE(VALID_SOCKET(sock)); + + return (sock->type); +}